Fix camera control: right-click orbits, left-click always fires board action
Left-click drag was orbiting the camera on desktop, so any mouse movement >2px during a click would suppress _handle_board_click. Moved camera orbit to right-mouse drag (_orbit_active flag) leaving left-click exclusively for board actions regardless of mouse movement. Touch single-finger orbit is unchanged. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -117,6 +117,7 @@ var _drag_active : bool = false
|
||||
var _press_was_on_board: bool = false # true only when the PRESS came from unhandled_input (board, not a UI card)
|
||||
var _camera_oriented : bool = false
|
||||
var _pan_active : bool = false
|
||||
var _orbit_active : bool = false # right-mouse drag → camera orbit on desktop
|
||||
var _last_mouse : Vector2 = Vector2.ZERO
|
||||
var _touch_points : Dictionary = {}
|
||||
var _pinch_dist : float = 0.0
|
||||
@@ -795,6 +796,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
elif mb.button_index == MOUSE_BUTTON_MIDDLE:
|
||||
_pan_active = mb.pressed
|
||||
_last_mouse = mb.position
|
||||
elif mb.button_index == MOUSE_BUTTON_RIGHT:
|
||||
_orbit_active = mb.pressed
|
||||
_last_mouse = mb.position
|
||||
elif mb.button_index == MOUSE_BUTTON_LEFT:
|
||||
if mb.pressed:
|
||||
# Double-click on a battlefield unit → show full card detail popup.
|
||||
@@ -827,15 +831,11 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
_last_mouse = mm.position
|
||||
# On some mobile browsers, pinch emits synthetic mouse-motion/left-drag
|
||||
# alongside touch/gesture events. Ignore mouse-orbit while touch is active
|
||||
# (or was recently multi-touch) to prevent accidental camera spin.
|
||||
if mm.button_mask & MOUSE_BUTTON_MASK_LEFT and _touch_points.is_empty() and not _was_multi_touch:
|
||||
if delta.length() > 2.0:
|
||||
_drag_active = true
|
||||
_hold_timer.stop()
|
||||
if _drag_active:
|
||||
_cam_yaw -= delta.x * 0.4
|
||||
_cam_pitch = clampf(_cam_pitch + delta.y * 0.3, 15.0, 75.0)
|
||||
_apply_camera()
|
||||
# Right-mouse drag orbits camera on desktop; left-click is reserved for board actions.
|
||||
if _orbit_active and _touch_points.is_empty() and not _was_multi_touch:
|
||||
_cam_yaw -= delta.x * 0.4
|
||||
_cam_pitch = clampf(_cam_pitch + delta.y * 0.3, 15.0, 75.0)
|
||||
_apply_camera()
|
||||
# Always update cursor/hover on mouse move (even while drag — hides during drag).
|
||||
_update_hover(mm.position)
|
||||
if _pan_active:
|
||||
|
||||
Reference in New Issue
Block a user