diff --git a/src/logic-scenes/board/card-board.gd b/src/logic-scenes/board/card-board.gd index 3def2e1..84b4d9b 100644 --- a/src/logic-scenes/board/card-board.gd +++ b/src/logic-scenes/board/card-board.gd @@ -224,9 +224,15 @@ func handle_mouse_button(input: InputEventMouseButton, to_handle = currently_act to_handle = area.exchange_sticky_note_with(to_handle) to_handle.reparent(dropzone) to_handle.on_board = true - # FIXME: this caused an error when all stickies were attatched ... - 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) + if sticky_note_container.get_child_count() > 0: + 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) + else: + var new_panel = StickyNotePanel.new() + sticky_note_container.add_child(new_panel, true, Node.INTERNAL_MODE_DISABLED) + new_panel.owner = self + new_panel.attatch_sticky_note(to_handle, self, false) + current_sticky_note_id = 0 to_handle.reset_drag() current_context = NAVIGATE _return_sticky_notes_to_panels()