feat(input): guard Guest Book taps and add double-tap placement
Guest Book: only open a card on a short stationary tap, ignore drags and flings, and guard the detail Close button after opening. Board: add a persisted double-tap placement mode with deferred single taps, while hold stays the default and right-click works in both modes.
This commit is contained in:
1 parent
bed81a2e05
commit
af4951baf8
8 files changed
+344
-11
No files matched your search
@@ -9,6 +9,7 @@ var game_mode := false
|
||||
var toggles := {}
|
||||
var hold_slider: HSlider
|
||||
var hold_value: Label
|
||||
var hold_panel: PanelContainer
|
||||
var game_actions: HBoxContainer
|
||||
var reset_row: Control
|
||||
var resume_button: Button
|
||||
@@ -84,6 +85,7 @@ func _ready() -> void:
|
||||
_add_pattern_row(list)
|
||||
_add_toggle(list, "Show timer", "Keep the clock visible while you solve.", "show_timer")
|
||||
_add_toggle(list, "Reduce motion", "Stop the bob and placement pop.", "reduce_motion")
|
||||
_add_toggle(list, "Double-tap to place", "Tap = mark · double-tap = check in.", "double_tap_place")
|
||||
_add_hold_row(list)
|
||||
|
||||
list.add_child(UI.spacer(2))
|
||||
@@ -152,6 +154,7 @@ func refresh() -> void:
|
||||
if hold_slider != null:
|
||||
hold_slider.set_value_no_signal(float(SaveGame.get_setting("hold_seconds")))
|
||||
hold_value.text = "%.2f s" % hold_slider.value
|
||||
_update_hold_availability()
|
||||
|
||||
|
||||
func _add_pattern_row(parent: VBoxContainer) -> void:
|
||||
@@ -197,7 +200,10 @@ func _add_toggle(parent: VBoxContainer, title: String, detail: String, key: Stri
|
||||
|
||||
var check := CheckButton.new()
|
||||
check.button_pressed = bool(SaveGame.get_setting(key))
|
||||
check.toggled.connect(func(on: bool) -> void: SaveGame.set_setting(key, on))
|
||||
check.toggled.connect(func(on: bool) -> void:
|
||||
SaveGame.set_setting(key, on)
|
||||
_update_hold_availability()
|
||||
)
|
||||
row.add_child(check)
|
||||
toggles[key] = check
|
||||
parent.add_child(panel)
|
||||
@@ -205,6 +211,7 @@ func _add_toggle(parent: VBoxContainer, title: String, detail: String, key: Stri
|
||||
|
||||
func _add_hold_row(parent: VBoxContainer) -> void:
|
||||
var panel := UI.panel(Palette.PAPER, 14, 8)
|
||||
hold_panel = panel
|
||||
var column := VBoxContainer.new()
|
||||
column.add_theme_constant_override("separation", 2)
|
||||
panel.add_child(column)
|
||||
@@ -271,6 +278,15 @@ func _on_hold_changed(value: float) -> void:
|
||||
SaveGame.set_setting("hold_seconds", snapped)
|
||||
|
||||
|
||||
func _update_hold_availability() -> void:
|
||||
if hold_slider == null or hold_panel == null:
|
||||
return
|
||||
var enabled := not bool(SaveGame.get_setting("double_tap_place"))
|
||||
hold_slider.editable = enabled
|
||||
hold_slider.mouse_filter = Control.MOUSE_FILTER_STOP if enabled else Control.MOUSE_FILTER_IGNORE
|
||||
hold_panel.modulate = Color(1, 1, 1, 1.0 if enabled else 0.45)
|
||||
|
||||
|
||||
func _on_scrim_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
_close()
|
||||
|
||||
Reference in new issue
Block a user