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

Commit 44d065f8 authored by Yongshun Liu's avatar Yongshun Liu
Browse files

a11y: Fix accumulated drag offset for magnification UI

Draggable magnification UI components, such as the magnification window,
the mode switch button, and the settings panel, would gradually drift
from the pointer's actual position during drag gestures.

This was caused by floating-point precision loss. The drag offsets were
calculated as floats, but the UI position updates used integers. The
repeated truncation of the fractional part of the offset during casting
led to an accumulating error.

This change fixes the issue by preserving the fractional part of the
drag offset between motion events. The `MotionAccumulator` now only
consumes the integer part of the offset for the current UI update,
carrying over the remaining fractional part to the next event. This
ensures that the full drag distance is accounted for over time,
eliminating the deviation.

Additionally, this change refactors the `OnGestureListener` interface
by removing the unused coordinate parameters from `onStart()` and
`onFinish()`, simplifying the API.

Bug: 436696444
Flag: EXEMPT bugfix
Test: atest SystemUITests:MagnificationGestureDetectorTest
Test: atest SystemUITests:WindowMagnificationControllerTest
Change-Id: I0a5dd67b44a6a8acb610acb532478d0d1eafbeb6
parent 72f87516
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment