ScrollView: Make it easier to press-and-hold buttons without cancelling

This commit is contained in:
Henrik Rydgård
2026-02-26 09:40:32 +01:00
parent 34cafba6ad
commit c953814fe0
+4 -2
View File
@@ -46,10 +46,12 @@ TouchInput GestureDetector::Update(const TouchInput &touch, const Bounds &bounds
p.lastY = touch.y;
}
const float dragThreshold = 5.0f / g_display.dpi_scale_y;
if (p.distanceY > p.distanceX) {
if (p.down) {
double timeDown = time_now_d() - p.downTime;
if (!p.active && p.distanceY * timeDown > 3) {
if (!p.active && p.distanceY > dragThreshold) {
p.active |= GESTURE_DRAG_VERTICAL;
// Kill the drag. TODO: Only cancel the drag in one direction.
TouchInput inp2 = touch;
@@ -64,7 +66,7 @@ TouchInput GestureDetector::Update(const TouchInput &touch, const Bounds &bounds
if (p.distanceX > p.distanceY) {
if (p.down) {
double timeDown = time_now_d() - p.downTime;
if (!p.active && p.distanceX * timeDown > 3) {
if (!p.active && p.distanceX > dragThreshold) {
p.active |= GESTURE_DRAG_HORIZONTAL;
// Kill the drag. TODO: Only cancel the drag in one direction.
TouchInput inp2 = touch;