abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Pointers.java
diff options
context:
space:
mode:
authorJules Aguillon2025-07-01 23:41:49 +0200
committerGitHub2025-07-01 23:41:49 +0200
commit1ff3bf2fc953b9445ac7ffbd1723475139281f72 (patch)
tree6726cc78ead47b87f1f0fd3808ec10779e8040bd /srcs/juloo.keyboard2/Pointers.java
parenta08db256611a66ca14e085fbd62a8fe352847e89 (diff)
downloadunexpected-keyboard-1ff3bf2fc953b9445ac7ffbd1723475139281f72.tar.gz
unexpected-keyboard-1ff3bf2fc953b9445ac7ffbd1723475139281f72.zip
Make vertical sliders slower (#1023)
Make vertical sliders slower. The intention is to make the up/down slider slower, as we have less visibility and do smaller movements in that direction.
Diffstat (limited to 'srcs/juloo.keyboard2/Pointers.java')
-rw-r--r--srcs/juloo.keyboard2/Pointers.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/srcs/juloo.keyboard2/Pointers.java b/srcs/juloo.keyboard2/Pointers.java
index 19cfde6..a163a4d 100644
--- a/srcs/juloo.keyboard2/Pointers.java
+++ b/srcs/juloo.keyboard2/Pointers.java
@@ -608,6 +608,10 @@ public final class Pointers implements Handler.Callback
static final float SPEED_SMOOTHING = 0.7f;
/** Avoid absurdly large values. */
static final float SPEED_MAX = 4.f;
+ /** Make vertical sliders slower. The intention is to make the up/down
+ slider slower, as we have less visibility and do smaller movements in
+ that direction. */
+ static final float SPEED_VERTICAL_MULT = 0.5f;
public void onTouchMove(Pointer ptr, float x, float y)
{
@@ -621,8 +625,9 @@ public final class Pointers implements Handler.Callback
return;
last_move_ms = System.currentTimeMillis();
}
- d += ((x - last_x) * direction_x + (y - last_y) * direction_y)
- * speed / _config.slide_step_px;
+ d += ((x - last_x) * speed * direction_x
+ + (y - last_y) * speed * SPEED_VERTICAL_MULT * direction_y)
+ / _config.slide_step_px;
update_speed(travelled, x, y);
// Send an event when [abs(d)] exceeds [1].
int d_ = (int)d;