chore: clean up old code
This commit is contained in:
parent
b47801ae5c
commit
69e05f7562
|
|
@ -128,7 +128,7 @@ func find_drop_target() -> Node:
|
||||||
# Base implementation: return parent (board)
|
# Base implementation: return parent (board)
|
||||||
return get_parent()
|
return get_parent()
|
||||||
|
|
||||||
## Called after drop to clean up drag state
|
## End drag operation and return the node we want to be accepted by (if any)
|
||||||
func end_drag() -> Node:
|
func end_drag() -> Node:
|
||||||
is_dragged = false
|
is_dragged = false
|
||||||
_drag_source = null
|
_drag_source = null
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ var attached_to: Card:
|
||||||
get: return get_parent() as Card if is_attached else null
|
get: return get_parent() as Card if is_attached else null
|
||||||
|
|
||||||
|
|
||||||
signal transform_tween_finished
|
|
||||||
|
|
||||||
@onready var background_sprite: AnimatedSprite2D = %BackgroundSprite
|
@onready var background_sprite: AnimatedSprite2D = %BackgroundSprite
|
||||||
|
|
||||||
@export var text: String = "" :
|
@export var text: String = "" :
|
||||||
|
|
@ -93,6 +91,7 @@ func _process(_delta: float) -> void:
|
||||||
|
|
||||||
# === DRAG LIFECYCLE OVERRIDES ===
|
# === DRAG LIFECYCLE OVERRIDES ===
|
||||||
|
|
||||||
|
## End drag operation and return the node we were dropped on
|
||||||
func end_drag() -> Node:
|
func end_drag() -> Node:
|
||||||
super.end_drag()
|
super.end_drag()
|
||||||
return _find_drop_target()
|
return _find_drop_target()
|
||||||
|
|
@ -111,28 +110,7 @@ func _find_drop_target() -> Node:
|
||||||
|
|
||||||
return closest
|
return closest
|
||||||
|
|
||||||
## Find the nearest panel that can accept this sticky
|
|
||||||
func _find_nearest_panel() -> StickyNotePanel:
|
|
||||||
if not current_handle or not current_handle.has_node("HBoxContainer/ScrollContainer/VBoxContainer"):
|
|
||||||
return null
|
|
||||||
|
|
||||||
var panel_container := current_handle.get_node("HBoxContainer/ScrollContainer/VBoxContainer")
|
|
||||||
var sticky_rect := Rect2(global_position - Vector2(diameter/2, 10), Vector2(diameter/2, 10))
|
|
||||||
|
|
||||||
# First pass: look for empty panels we're hovering over
|
|
||||||
for panel in panel_container.get_children():
|
|
||||||
if panel is StickyNotePanel:
|
|
||||||
if panel.is_empty() and panel.get_global_rect().intersects(sticky_rect):
|
|
||||||
return panel
|
|
||||||
|
|
||||||
# Second pass: if no empty panel found, find first empty panel
|
|
||||||
for panel in panel_container.get_children():
|
|
||||||
if panel is StickyNotePanel and panel.is_empty():
|
|
||||||
return panel
|
|
||||||
|
|
||||||
# No empty panels found - will need to create one (handled by board)
|
|
||||||
return null
|
|
||||||
|
|
||||||
|
|
||||||
|
## Sticky notes are exempt from confinement if stuck to a card
|
||||||
func confine_to_screen() -> void:
|
func confine_to_screen() -> void:
|
||||||
if attached_to is not Card: super.confine_to_screen()
|
if attached_to is not Card: super.confine_to_screen()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue