From 93ec9dc2ba8bff27b66935e23167ac148d64d6b8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 15 Mar 2013 08:53:02 -0700 Subject: [PATCH] Adjust the deadzone for taps and swipes. Fixes #990, or does for me. --- ui/ui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/ui.cpp b/ui/ui.cpp index 14cd15e9db..19f3d0ff9a 100644 --- a/ui/ui.cpp +++ b/ui/ui.cpp @@ -297,7 +297,8 @@ void UIList::pointerDown(int pointer, float x, float y) { movedDistanceY = 0.0f; } -const int holdFrames = 6; +const int holdFramesClick = 3; +const int holdFramesScroll = 10; void UIList::pointerMove(int pointer, float x, float y, bool inside) { float deltaX = x - lastX; @@ -313,7 +314,8 @@ void UIList::pointerMove(int pointer, float x, float y, bool inside) { inertiaY = 0.8 * inertiaY + 0.2 * -deltaY; } - if (inside && movedDistanceY > 35 && movedDistanceY > movedDistanceX && !scrolling && uistate.mouseframesdown[0] > holdFrames) { + const int deadzone = 30 * holdFramesScroll; + if (inside && movedDistanceY * uistate.mouseframesdown[0] > deadzone && !scrolling) { scrolling = true; } } @@ -407,7 +409,7 @@ int UIList::Do(int id, int x, int y, int w, int h, UIListAdapter *adapter) { if (item_y >= y - itemHeight && item_y <= y + h) { for (int k = 0; k < 1; k++) { // MAX_POINTERS if we add back multitouch if (uistate.mousedown[k] && - uistate.mouseframesdown[k] >= holdFrames && + uistate.mouseframesdown[k] >= holdFramesClick && adapter->itemEnabled(i) && !scrolling && selected == -1 &&