Slightly less permissive swipe detection
Some checks are pending
Check layouts / check_layout.output (push) Waiting to run
Check layouts / Generated files (push) Waiting to run
Check translations / check-translations (push) Waiting to run
Make Apk CI / Build-Apk (push) Waiting to run

This allows starting an anticircle gesture on a key with sliders on two
opposite sides.
This commit is contained in:
Jules Aguillon 2025-01-25 22:11:36 +01:00
parent 3e3fd6ffda
commit 188c68279d

View File

@ -234,8 +234,9 @@ public final class Pointers implements Handler.Callback
private KeyValue getNearestKeyAtDirection(Pointer ptr, int direction) private KeyValue getNearestKeyAtDirection(Pointer ptr, int direction)
{ {
KeyValue k; KeyValue k;
// [i] is [0, -1, 1, -2, 2, ...] // [i] is [0, -1, 1, -2, 2], scanning a 1/4 of the circle's area, centered
for (int i = 0; i > -4; i = (~i>>31) - i) // on the initial direction.
for (int i = 0; i > -2; i = (~i>>31) - i)
{ {
int d = (direction + i + 16) % 16; int d = (direction + i + 16) % 16;
// Don't make the difference between a key that doesn't exist and a key // Don't make the difference between a key that doesn't exist and a key