From b9e6dc6e80bbd55789cb6c538054b3bc3c04b2c2 Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 29 Mar 2026 10:48:05 -0400 Subject: [PATCH] Fix touch input: distinguish taps from swipes for camera vs click MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added _touch_drag_active flag set only when finger moves > 4px threshold. Camera orbit now requires meaningful drag; taps no longer jiggle camera or get swallowed — board clicks fire correctly for gameplay actions. 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 | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 0bbad61..7c27a31 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -123,7 +123,8 @@ 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 _was_multi_touch : bool = false +var _touch_drag_active : bool = false # set when finger moves > threshold; suppresses tap-click # ── Selection state ─────────────────────────────────────────────────────────── @@ -812,9 +813,10 @@ func _unhandled_input(event: InputEvent) -> void: _held_coord = Vector2i(-1, -1) else: _hold_timer.stop() - if not _drag_active and _press_was_on_board: + if not _drag_active and not _touch_drag_active and _press_was_on_board: _handle_board_click(mb.position) _drag_active = false + _touch_drag_active = false _press_was_on_board = false elif event is InputEventMouseMotion: @@ -849,6 +851,7 @@ func _unhandled_input(event: InputEvent) -> void: var st := event as InputEventScreenTouch if st.pressed: _touch_points[st.index] = st.position + _touch_drag_active = false if _touch_points.size() >= 2: _pinch_dist = _touch_pair_dist() _last_mouse = _touch_pair_mid() @@ -863,11 +866,13 @@ 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: - _cam_yaw -= sd.relative.x * 0.4 - _cam_pitch = clampf(_cam_pitch + sd.relative.y * 0.3, 15.0, 75.0) - _apply_camera() - if sd.relative.length() > 2.0: + if sd.relative.length() > 4.0: + _touch_drag_active = true _hold_timer.stop() + if _touch_drag_active: + _cam_yaw -= sd.relative.x * 0.4 + _cam_pitch = clampf(_cam_pitch + sd.relative.y * 0.3, 15.0, 75.0) + _apply_camera() elif _touch_points.size() >= 2: var keys := _touch_points.keys() var pos_a : Vector2 = _touch_points[keys[0]]