From 188c68279d6c75ed94f82ca7fc0b56c54614f174 Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sat, 25 Jan 2025 22:11:36 +0100 Subject: [PATCH] Slightly less permissive swipe detection This allows starting an anticircle gesture on a key with sliders on two opposite sides. --- srcs/juloo.keyboard2/Pointers.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java index 12482a5..5ac97c9 100644 --- a/srcs/juloo.keyboard2/Pointers.java +++ b/srcs/juloo.keyboard2/Pointers.java @@ -234,8 +234,9 @@ public final class Pointers implements Handler.Callback private KeyValue getNearestKeyAtDirection(Pointer ptr, int direction) { KeyValue k; - // [i] is [0, -1, 1, -2, 2, ...] - for (int i = 0; i > -4; i = (~i>>31) - i) + // [i] is [0, -1, 1, -2, 2], scanning a 1/4 of the circle's area, centered + // on the initial direction. + for (int i = 0; i > -2; i = (~i>>31) - i) { int d = (direction + i + 16) % 16; // Don't make the difference between a key that doesn't exist and a key