diff --git a/src/dev-util/hardcoded_cards.tscn b/src/dev-util/hardcoded_cards.tscn index d270cc8..73d378e 100644 --- a/src/dev-util/hardcoded_cards.tscn +++ b/src/dev-util/hardcoded_cards.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" uid="uid://dysgoaaesqjbg" path="res://dev-util/hardcoded_cards.gd" id="1_5kg6w"] -[node name="Node2D" type="PanelContainer"] +[node name="HardcodedCards" type="PanelContainer"] process_mode = 4 visible = false anchors_preset = 15 @@ -11,4 +11,6 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 focus_behavior_recursive = 1 +mouse_filter = 2 +mouse_behavior_recursive = 1 script = ExtResource("1_5kg6w") diff --git a/src/logic-scenes/board/card.gd b/src/logic-scenes/board/card.gd index 5c56c2b..ce21479 100644 --- a/src/logic-scenes/board/card.gd +++ b/src/logic-scenes/board/card.gd @@ -256,12 +256,9 @@ func exchange_sticky_note_with(new_note: StickyNote) -> StickyNote: # === DROP TARGET PATTERN IMPLEMENTATION === -## Temporary storage for exchanged sticky during drop operation -var _last_exchanged_sticky: StickyNote = null - ## Checks if this card can accept the given draggable func can_accept_drop(draggable: Draggable) -> bool: - return draggable is StickyNote + return draggable is StickyNote and draggable != self ## Handles dropping a sticky note onto this card ## Returns DropResult indicating success, rejection, or exchange @@ -271,10 +268,10 @@ func handle_drop(draggable: StickyNote) -> int: if has_sticky_note_attached(): # Exchange: remove current, attach new, store old for retrieval - _last_exchanged_sticky = exchange_sticky_note_with(draggable) + exchange_sticky_note_with(draggable) # Reset z_index for newly attached sticky draggable.z_index = 0 - return Draggable.DropResult.EXCHANGED + return Draggable.DropResult.ACCEPTED else: # Simple attach if attach_sticky_note(draggable): @@ -285,13 +282,6 @@ func handle_drop(draggable: StickyNote) -> int: # Attach failed (shouldn't happen, but handle it) return Draggable.DropResult.REJECTED -## Retrieves the sticky that was exchanged during last drop -## Clears the reference after retrieval -func get_last_exchanged_sticky() -> StickyNote: - var result := _last_exchanged_sticky - _last_exchanged_sticky = null - return result - # === DRAG LIFECYCLE OVERRIDES === diff --git a/src/logic-scenes/board/draggable.gd b/src/logic-scenes/board/draggable.gd index 799f756..652d9e8 100644 --- a/src/logic-scenes/board/draggable.gd +++ b/src/logic-scenes/board/draggable.gd @@ -11,7 +11,6 @@ extends Area2D enum DropResult { ACCEPTED, # Drop successful, item is now owned by target REJECTED, # Drop refused, item stays with previous owner - EXCHANGED # Swap occurred, exchanged item needs handling } var mouse_over: bool = false @@ -66,14 +65,14 @@ func _get_board() -> Node: ## Override these in Card and StickyNote for specific behavior func _on_mouse_entered() -> void: - prints("Draggable[base]._on_mouse_entered", self, self.name) + #prints("Draggable[base]._on_mouse_entered", self, self.name) mouse_over = true var handler := _get_hover_handler() if handler: handler.handle_hover(self) func _on_mouse_exited() -> void: - prints("Draggable[base]._on_mouse_exited", self, self.name) + #prints("Draggable[base]._on_mouse_exited", self, self.name) mouse_over = false var handler := _get_hover_handler() if handler: handler.handle_hover(self)