Refine tile drawer double-click behavior
This commit is contained in:
@@ -5,7 +5,7 @@ extends Node
|
||||
|
||||
signal board_clicked(screen_pos: Vector2) # tap/click on board (no drag)
|
||||
signal board_held(coord: Vector2i) # long press on tile (hold timer fired)
|
||||
signal board_double_clicked(screen_pos: Vector2) # double-click on unit
|
||||
signal board_double_clicked(screen_pos: Vector2) # double-click on board tile
|
||||
signal board_orbit(delta: Vector2) # camera orbit delta
|
||||
signal board_pan(delta: Vector2, cam_distance: float) # camera pan delta
|
||||
signal board_zoom(amount: float) # scroll/pinch zoom
|
||||
@@ -35,6 +35,7 @@ var gesture_finger_count: int = 0
|
||||
|
||||
var _deselect_pending: bool = false
|
||||
var _hand_scroll_time: float = 0.0
|
||||
var _suppress_click_release: bool = false
|
||||
|
||||
# ── References set by parent ──────────────────────────────────────────────────
|
||||
|
||||
@@ -177,12 +178,12 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
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 = ""
|
||||
if fn_mouse_to_unit_id.is_valid():
|
||||
dbl_unit_id = fn_mouse_to_unit_id.call(mb.position)
|
||||
if not dbl_unit_id.is_empty():
|
||||
var dbl_coord: Vector2i = Vector2i(-1, -1)
|
||||
if fn_mouse_to_tile_coord.is_valid():
|
||||
dbl_coord = fn_mouse_to_tile_coord.call(mb.position)
|
||||
if dbl_coord.x >= 0:
|
||||
_suppress_click_release = true
|
||||
board_double_clicked.emit(mb.position)
|
||||
return
|
||||
last_mouse = mb.position
|
||||
@@ -200,7 +201,9 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
else:
|
||||
if is_instance_valid(hold_timer):
|
||||
hold_timer.stop()
|
||||
if not drag_active and not touch_drag_active and press_was_on_board:
|
||||
if _suppress_click_release:
|
||||
_suppress_click_release = false
|
||||
elif not drag_active and not touch_drag_active and press_was_on_board:
|
||||
board_clicked.emit(mb.position)
|
||||
drag_active = false
|
||||
touch_drag_active = false
|
||||
|
||||
Reference in New Issue
Block a user