mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 15:01:01 +01:00
[gpu] Add drag threshold for tap detection on mobile
Small finger movements (< 5 pixels) during a touch no longer count as a drag, allowing tap-to-toggle-animation to work reliably on touchscreens. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2dbb476313
commit
95aa2c083b
1 file changed
+10
-1
+10
-1
@@ -426,7 +426,16 @@ demo_view_motion_func (demo_view_t *vu, double x, double y)
|
||||
if (!vu->buttons)
|
||||
return;
|
||||
|
||||
vu->dragged = true;
|
||||
/* Only count as dragged if moved more than a few pixels (helps touch). */
|
||||
if (!vu->dragged)
|
||||
{
|
||||
double dx = x - vu->beginx;
|
||||
double dy = y - vu->beginy;
|
||||
if (dx * dx + dy * dy > 25)
|
||||
vu->dragged = true;
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
int width, height;
|
||||
glfwGetWindowSize (vu->window, &width, &height);
|
||||
|
||||
Reference in new issue
Block a user