Merge "Properly rotate full [-pi, +pi] orientation range if available"
This commit is contained in:
@@ -4170,20 +4170,24 @@ void TouchInputMapper::cookPointerData() {
|
|||||||
x = float(in.y - mRawPointerAxes.y.minValue) * mYScale + mYTranslate;
|
x = float(in.y - mRawPointerAxes.y.minValue) * mYScale + mYTranslate;
|
||||||
y = float(mRawPointerAxes.x.maxValue - in.x) * mXScale + mXTranslate;
|
y = float(mRawPointerAxes.x.maxValue - in.x) * mXScale + mXTranslate;
|
||||||
orientation -= M_PI_2;
|
orientation -= M_PI_2;
|
||||||
if (orientation < - M_PI_2) {
|
if (orientation < mOrientedRanges.orientation.min) {
|
||||||
orientation += M_PI;
|
orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DISPLAY_ORIENTATION_180:
|
case DISPLAY_ORIENTATION_180:
|
||||||
x = float(mRawPointerAxes.x.maxValue - in.x) * mXScale + mXTranslate;
|
x = float(mRawPointerAxes.x.maxValue - in.x) * mXScale + mXTranslate;
|
||||||
y = float(mRawPointerAxes.y.maxValue - in.y) * mYScale + mYTranslate;
|
y = float(mRawPointerAxes.y.maxValue - in.y) * mYScale + mYTranslate;
|
||||||
|
orientation -= M_PI;
|
||||||
|
if (orientation < mOrientedRanges.orientation.min) {
|
||||||
|
orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case DISPLAY_ORIENTATION_270:
|
case DISPLAY_ORIENTATION_270:
|
||||||
x = float(mRawPointerAxes.y.maxValue - in.y) * mYScale + mYTranslate;
|
x = float(mRawPointerAxes.y.maxValue - in.y) * mYScale + mYTranslate;
|
||||||
y = float(in.x - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
|
y = float(in.x - mRawPointerAxes.x.minValue) * mXScale + mXTranslate;
|
||||||
orientation += M_PI_2;
|
orientation += M_PI_2;
|
||||||
if (orientation > M_PI_2) {
|
if (orientation > mOrientedRanges.orientation.max) {
|
||||||
orientation -= M_PI;
|
orientation -= (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user