Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed222820 authored by Aaron Kling's avatar Aaron Kling Committed by Rashed Abdel-Tawab
Browse files

Properly scale touch input window through resolution changes

The previous code would limit the touch window to the original
resolution.

Credit: https://stackoverflow.com/a/61284787
Change-Id: I6e93a00ac3009ab1c7b89135dacad302b020dc9f
parent 2968795f
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -3653,13 +3653,8 @@ void TouchInputMapper::rotateAndScale(float& x, float& y) {
}

bool TouchInputMapper::isPointInsideSurface(int32_t x, int32_t y) {
    const float xScaled = (x - mRawPointerAxes.x.minValue) * mXScale;
    const float yScaled = (y - mRawPointerAxes.y.minValue) * mYScale;

    return x >= mRawPointerAxes.x.minValue && x <= mRawPointerAxes.x.maxValue &&
            xScaled >= mSurfaceLeft && xScaled <= mSurfaceRight &&
            y >= mRawPointerAxes.y.minValue && y <= mRawPointerAxes.y.maxValue &&
            yScaled >= mSurfaceTop && yScaled <= mSurfaceBottom;
            y >= mRawPointerAxes.y.minValue && y <= mRawPointerAxes.y.maxValue;
}

const TouchInputMapper::VirtualKey* TouchInputMapper::findVirtualKeyHit(int32_t x, int32_t y) {