From 1a2fdad9ba52ebbc64ad7e689a407c25ae4f38bd Mon Sep 17 00:00:00 2001 From: dingo Date: Sun, 8 Mar 2026 13:38:52 -0400 Subject: [PATCH] =?UTF-8?q?Fix:=20CardWidget=20double-click=20causes=20imm?= =?UTF-8?q?ediate=20select=E2=86=92deselect=20cycle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Godot 4 fires two separate pressed=true InputEventMouseButton events for a fast click: a normal press and a double_click press, both in the same frame. The previous _gui_input emitted card_pressed for both, so the first emission selected the card and the second (double_click) immediately deselected it. Fix: - Skip card_pressed emission when event.double_click is true - Consume RELEASE as well as PRESS so neither can leak to the 3D board's _unhandled_input handler (belt-and-suspenders over the _press_was_on_board guard that already exists in game_screen.gd) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../scenes/collection/components/card_widget.gd | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Client/origin-client/scenes/collection/components/card_widget.gd b/Client/origin-client/scenes/collection/components/card_widget.gd index 64519e8..909d736 100644 --- a/Client/origin-client/scenes/collection/components/card_widget.gd +++ b/Client/origin-client/scenes/collection/components/card_widget.gd @@ -190,8 +190,14 @@ func get_definition_id() -> String: func _gui_input(event: InputEvent) -> void: - if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT: - card_pressed.emit(_definition_id) + if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT: + var mb := event as InputEventMouseButton + # Consume both press and release so neither leaks to the 3D board's + # _unhandled_input. Only emit card_pressed on a plain press — not on + # double-click (which Godot fires as a *second* pressed=true event in + # the same frame, causing an immediate select → deselect cycle). + if mb.pressed and not mb.double_click: + card_pressed.emit(_definition_id) accept_event() elif event is InputEventScreenTouch and event.pressed: card_pressed.emit(_definition_id)