|
|
|
|
@ -144,16 +144,50 @@ func _on_board_focused() -> void:
|
|
|
|
|
give_lore_feedback()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Finalizes board state before closing (ends drags, cleans up transitions)
|
|
|
|
|
func _finalize_board_state() -> void:
|
|
|
|
|
print_debug("CardBoard: Finalizing board state before closing (context: %d)" % current_context)
|
|
|
|
|
|
|
|
|
|
# End any active drag operations
|
|
|
|
|
if current_context == DRAG and is_instance_valid(currently_active_node):
|
|
|
|
|
if currently_active_node.is_dragged:
|
|
|
|
|
print_debug(" Ending active drag for: %s" % currently_active_node.name)
|
|
|
|
|
_end_drag(currently_active_node)
|
|
|
|
|
|
|
|
|
|
# Stop dragging for all items (safety net in case _end_drag didn't catch everything)
|
|
|
|
|
for child in dropzone.get_children():
|
|
|
|
|
if (child is Card or child is StickyNote) and child.is_dragged:
|
|
|
|
|
print_debug(" Force-stopping drag for: %s" % child.name)
|
|
|
|
|
child.is_dragged = false
|
|
|
|
|
|
|
|
|
|
# Also check cards for attached stickies that might be dragged
|
|
|
|
|
for child in dropzone.get_children():
|
|
|
|
|
if child is Card:
|
|
|
|
|
var attached_sticky = child.get_attached_sticky_note()
|
|
|
|
|
if attached_sticky and attached_sticky.is_dragged:
|
|
|
|
|
print_debug(" Force-stopping drag for attached sticky: %s" % attached_sticky.name)
|
|
|
|
|
attached_sticky.is_dragged = false
|
|
|
|
|
|
|
|
|
|
# Return stickies to panels if in ASSIGN mode
|
|
|
|
|
if current_context == ASSIGN:
|
|
|
|
|
print_debug(" Returning stickies to panels (was in ASSIGN mode)")
|
|
|
|
|
_return_sticky_notes_to_panels()
|
|
|
|
|
|
|
|
|
|
# Reset context to NAVIGATE
|
|
|
|
|
current_context = NAVIGATE
|
|
|
|
|
|
|
|
|
|
print_debug("CardBoard: Board state finalized")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Called when board loses focus
|
|
|
|
|
func _on_board_unfocused() -> void:
|
|
|
|
|
visible = false
|
|
|
|
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
|
|
|
|
if is_node_ready():
|
|
|
|
|
# Finalize any drag operations before closing
|
|
|
|
|
_finalize_board_state()
|
|
|
|
|
|
|
|
|
|
process_mode = Node.PROCESS_MODE_DISABLED
|
|
|
|
|
# Stop any active dragging
|
|
|
|
|
for sticky in dropzone.get_children():
|
|
|
|
|
if sticky is StickyNote:
|
|
|
|
|
sticky.is_dragged = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func reclaim_lost_focus(_thief):
|
|
|
|
|
|