feat: sticky exchange

This commit is contained in:
tiger tiger tiger 2026-01-18 17:52:04 +01:00
parent 2164c2e1fc
commit 65e818aa80
3 changed files with 7 additions and 24 deletions

View File

@ -263,11 +263,7 @@ func _end_drag(draggable: Draggable) -> void:
# Make sure sticky is parented to board
if sticky.get_parent() != self:
sticky.reparent(self)
# Ensure it's in the notes array
if not sticky in notes:
notes.append(sticky)
sticky.reparent(self)
# Check win condition after any sticky movement
check_board_completion()
@ -275,7 +271,6 @@ func _end_drag(draggable: Draggable) -> void:
func reclaim_sticky(note: StickyNote):
note.reparent(self)
notes.append(note)
func check_board_completion():
@ -288,12 +283,7 @@ func check_board_completion():
give_lore_feedback()
func is_board_complete() -> bool:
if mementos_collected < 4: return false
for sticky : StickyNote in notes:
if not sticky.is_attached: return false
return true
return mementos_collected == 4 and notes.all(func (n : StickyNote): return n.is_attached)
var unfitting: bool = false
var incomplete: bool = false
@ -337,8 +327,8 @@ func give_lore_feedback():
# Mark area that was hovered over as currently selected
func handle_hover(_draggable: Draggable) -> void:
# If we're hovering with the mouse without clicking, that updates our selection
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): return
if selection and selection.is_dragged: return
var candidate := _nearest_hovered(_sort_by_proximity_and_depth(notes))
if not candidate:
candidate = _nearest_hovered(_sort_by_proximity_and_depth(cards))
@ -400,8 +390,7 @@ func _input(event) -> void:
closed.emit()
get_viewport().set_input_as_handled()
if selection and event is InputEventMouseMotion and not event.is_action_pressed("mouse_left"):
if selection and not selection.is_dragged and event is InputEventMouseMotion and not event.is_action_pressed("mouse_left"):
var candidate := _nearest_hovered(_sort_by_proximity_and_depth(notes))
if not candidate:
candidate = _nearest_hovered(_sort_by_proximity_and_depth(cards))

View File

@ -95,10 +95,9 @@ func _input(event: InputEvent) -> void:
func _on_input_event(_viewport, event, _shape_idx):
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
if highlighted:
var mouse_offset := get_viewport().get_mouse_position() - position
var board := _get_board()
if board and board.has_method("handle_mouse_button"):
board.handle_mouse_button(event, self)
board.handle_mouse_button(event, self)
## Starts a drag operation

View File

@ -153,12 +153,7 @@ func _find_drop_target() -> Node:
if (not closest) or ((area.position - position).length() < (closest.position - position).length()):
closest = area
# Return the closest card if found
if closest:
return closest
# Priority 2: Default to board (stay loose in dropzone)
return null
return closest
## Find the nearest panel that can accept this sticky
func _find_nearest_panel() -> StickyNotePanel: