fix: multiple StickyNotes can be attatched to a single scene
This commit is contained in:
parent
7423461464
commit
d9ec5d5d06
|
|
@ -11,14 +11,15 @@ enum {NAVIGATE, ASSIGN, DRAG}
|
||||||
var focus_stickies:bool = true:
|
var focus_stickies:bool = true:
|
||||||
set(stickies):
|
set(stickies):
|
||||||
if stickies and sticky_note_container.get_child_count() == 0: return
|
if stickies and sticky_note_container.get_child_count() == 0: return
|
||||||
if not current_context == ASSIGN and not focus_stickies == stickies:
|
|
||||||
|
focus_stickies = stickies
|
||||||
|
|
||||||
|
if not current_context == ASSIGN:
|
||||||
if stickies:
|
if stickies:
|
||||||
current_sticky_note_id = current_sticky_note_id
|
current_sticky_note_id = current_sticky_note_id
|
||||||
else:
|
else:
|
||||||
current_dropzone_id = current_dropzone_id
|
current_dropzone_id = current_dropzone_id
|
||||||
|
|
||||||
focus_stickies = stickies
|
|
||||||
|
|
||||||
var has_stage = false:
|
var has_stage = false:
|
||||||
set(focus):
|
set(focus):
|
||||||
if focus:
|
if focus:
|
||||||
|
|
@ -82,7 +83,9 @@ var mementos_collected: int = 0:
|
||||||
elif new_id < 0: current_dropzone_id = dropzone.get_child_count() - 1
|
elif new_id < 0: current_dropzone_id = dropzone.get_child_count() - 1
|
||||||
else: current_dropzone_id = new_id
|
else: current_dropzone_id = new_id
|
||||||
if current_context == ASSIGN:
|
if current_context == ASSIGN:
|
||||||
|
while not dropzone.get_child(current_dropzone_id) is Card: current_dropzone_id = (current_dropzone_id + 1) % dropzone.get_child_count()
|
||||||
dropzone.get_child(current_dropzone_id).preview_sticky_note(currently_active_node)
|
dropzone.get_child(current_dropzone_id).preview_sticky_note(currently_active_node)
|
||||||
|
|
||||||
elif not focus_stickies:
|
elif not focus_stickies:
|
||||||
currently_active_node = dropzone.get_child(current_dropzone_id)
|
currently_active_node = dropzone.get_child(current_dropzone_id)
|
||||||
|
|
||||||
|
|
@ -185,6 +188,8 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
||||||
to_handle = area.exchange_sticky_note_with(to_handle)
|
to_handle = area.exchange_sticky_note_with(to_handle)
|
||||||
to_handle.reparent(dropzone)
|
to_handle.reparent(dropzone)
|
||||||
sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note = to_handle
|
sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note = to_handle
|
||||||
|
to_handle.attached_to = sticky_note_container.get_child(current_sticky_note_id)
|
||||||
|
to_handle.reset_drag()
|
||||||
current_context = NAVIGATE
|
current_context = NAVIGATE
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@ func _on_mouse_entered():
|
||||||
if not Input.is_action_pressed("mouse_left"):
|
if not Input.is_action_pressed("mouse_left"):
|
||||||
# Do nothing if mouse hovers over sticky_note
|
# Do nothing if mouse hovers over sticky_note
|
||||||
if has_sticky_note_attached():
|
if has_sticky_note_attached():
|
||||||
if sticky_note_anchor.get_child(-1).highlighted:
|
if get_child(-1).highlighted:
|
||||||
return
|
return
|
||||||
highlighted = true
|
highlighted = true
|
||||||
if "handle_hover" in owner:
|
if "handle_hover" in owner:
|
||||||
|
|
@ -169,7 +169,7 @@ func _move_card():
|
||||||
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
position += (get_viewport().get_mouse_position() - position) - mouse_offset
|
||||||
|
|
||||||
func has_sticky_note_attached() -> bool:
|
func has_sticky_note_attached() -> bool:
|
||||||
return get_child(-1) is Card
|
return get_child(-1) is StickyNote
|
||||||
|
|
||||||
func preview_sticky_note(sticky_note: StickyNote):
|
func preview_sticky_note(sticky_note: StickyNote):
|
||||||
sticky_note.reparent(self.get_parent())
|
sticky_note.reparent(self.get_parent())
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,9 @@ func attatch_sticky_note(attatchment: StickyNote, tween:bool = true):
|
||||||
attatchment.transform = ancor.transform
|
attatchment.transform = ancor.transform
|
||||||
|
|
||||||
func reclaim_sticky_note():
|
func reclaim_sticky_note():
|
||||||
|
print("meep")
|
||||||
|
var is_emoty = is_empty()
|
||||||
|
print("meep")
|
||||||
if is_empty() and attached_sticky_note.on_board == true:
|
if is_empty() and attached_sticky_note.on_board == true:
|
||||||
attached_sticky_note.on_board = false
|
attached_sticky_note.on_board = false
|
||||||
attached_sticky_note.tween_transform_to(ancor.global_transform)
|
attached_sticky_note.tween_transform_to(ancor.global_transform)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue