From 247d92c2530722e826b60a14a393c3e86aeb4849 Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 29 Mar 2026 18:07:20 -0400 Subject: [PATCH] Fix touch: use cumulative drag distance to distinguish taps from swipes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 4px per-event threshold was too sensitive — normal finger tremor during a tap could exceed it, causing _touch_drag_active to suppress the click. Now accumulates total drag distance since touch-down; requires 12px total movement before classifying the touch as a camera orbit. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- Client/origin-client/scenes/game/game_screen.gd | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 847dbeb..c1213c8 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -123,8 +123,9 @@ var _pinch_dist : float = 0.0 # True from the moment a second finger lands until ALL fingers lift. # Prevents single-finger orbit from triggering during a pinch gesture even # if a ScreenDrag for finger-0 arrives before finger-1's ScreenTouch is processed. -var _was_multi_touch : bool = false -var _touch_drag_active : bool = false # set when finger moves > threshold; suppresses tap-click +var _was_multi_touch : bool = false +var _touch_drag_active : bool = false # set when cumulative finger movement > threshold; suppresses tap-click +var _touch_drag_total : float = 0.0 # cumulative drag distance since last touch-down # ── Selection state ─────────────────────────────────────────────────────────── @@ -817,6 +818,7 @@ func _unhandled_input(event: InputEvent) -> void: _handle_board_click(mb.position) _drag_active = false _touch_drag_active = false + _touch_drag_total = 0.0 _press_was_on_board = false elif event is InputEventMouseMotion: @@ -854,6 +856,7 @@ func _unhandled_input(event: InputEvent) -> void: if _touch_points.size() == 1: # Single-touch start: arm tap + hold (touch right-click) behavior. _touch_drag_active = false + _touch_drag_total = 0.0 _press_was_on_board = true _last_mouse = st.position var touch_coord := _mouse_to_tile_coord(st.position) @@ -878,6 +881,7 @@ func _unhandled_input(event: InputEvent) -> void: if _touch_points.is_empty(): _was_multi_touch = false _touch_drag_active = false + _touch_drag_total = 0.0 _press_was_on_board = false _held_coord = Vector2i(-1, -1) _hold_timer.stop() @@ -886,7 +890,8 @@ func _unhandled_input(event: InputEvent) -> void: var sd := event as InputEventScreenDrag _touch_points[sd.index] = sd.position if _touch_points.size() == 1 and not _was_multi_touch: - if sd.relative.length() > 4.0: + _touch_drag_total += sd.relative.length() + if _touch_drag_total > 12.0: _touch_drag_active = true _hold_timer.stop() if _touch_drag_active: