Stabilize hand click-through and spin controls

This commit is contained in:
dingo
2026-05-07 13:25:33 -04:00
parent d621d9b03e
commit f6210caef4
3 changed files with 320 additions and 95 deletions
@@ -127,7 +127,7 @@ func _input(event: InputEvent) -> void:
if mb.button_index == MOUSE_BUTTON_LEFT and mb.pressed and not mb.double_click:
var is_card_active: bool = card_mode_active or ability_card_active
if is_card_active:
if hand_area != null and not hand_area.get_global_rect().has_point(mb.position):
if not _hand_blocks_pointer(mb.position):
_deselect_pending = true
_do_deselect_if_pending.call_deferred()
@@ -175,6 +175,8 @@ func _unhandled_input(event: InputEvent) -> void:
last_mouse = mb.position
elif mb.button_index == MOUSE_BUTTON_LEFT:
if mb.pressed:
if _hand_blocks_pointer(mb.position):
return
# Double-click on a battlefield unit → show full card detail popup.
if mb.double_click:
var dbl_unit_id: String = ""
@@ -364,3 +366,11 @@ func _touch_pair_mid() -> Vector2:
if keys.size() < 2:
return Vector2.ZERO
return ((touch_points[keys[0]] as Vector2) + (touch_points[keys[1]] as Vector2)) * 0.5
func _hand_blocks_pointer(screen_pos: Vector2) -> bool:
if hand_area == null or not is_instance_valid(hand_area):
return false
if hand_area.has_method("blocks_pointer"):
return bool(hand_area.call("blocks_pointer", screen_pos))
return hand_area.get_global_rect().has_point(screen_pos)