From 8c3d7c7abb6237f336de756637e7342c3fc922ba Mon Sep 17 00:00:00 2001 From: betalars Date: Thu, 8 May 2025 21:53:53 +0200 Subject: [PATCH] wip implement #96: picking up sticky notes from the card board --- src/logic-scenes/board/card-board.gd | 57 ++++++++++++++++------------ 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/src/logic-scenes/board/card-board.gd b/src/logic-scenes/board/card-board.gd index 6a7977e..6cfa1cf 100644 --- a/src/logic-scenes/board/card-board.gd +++ b/src/logic-scenes/board/card-board.gd @@ -225,6 +225,7 @@ func handle_mouse_button(input: InputEventMouseButton, to_handle = currently_act return else: area.attach_sticky_note(to_handle) + to_handle.z_index = 0 if sticky_note_container.get_child_count() > 0: sticky_note_container.get_child(current_sticky_note_id).clear_if_empty() current_context = NAVIGATE @@ -366,33 +367,39 @@ func _input(event): current_context = NAVIGATE elif event.is_action_pressed("ui_accept"): # select the selected note it - var card:Card if dropzone.get_child(current_dropzone_id) is Card: - card = dropzone.get_child(current_dropzone_id) - if current_context == ASSIGN: # to assign it to a card - if card.has_sticky_note_attached(): - currently_active_node = card.exchange_sticky_note_with(currently_active_node) - current_dropzone_id = find_first_free_card() + var card:Card = dropzone.get_child(current_dropzone_id) + if current_context == ASSIGN: # to assign it to a card + if card.has_sticky_note_attached(): + currently_active_node = card.exchange_sticky_note_with(currently_active_node) + current_dropzone_id = find_first_free_card() + else: + card.attach_sticky_note(sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note) + current_context = NAVIGATE + current_sticky_note_id += 1 + current_dropzone_id = find_first_free_card() + if is_board_complete(): emit_signal("board_completed") else: - card.attach_sticky_note(sticky_note_container.get_child(current_sticky_note_id).attached_sticky_note) - current_context = NAVIGATE - current_sticky_note_id += 1 - current_dropzone_id = find_first_free_card() - if is_board_complete(): emit_signal("board_completed") - else: - if !focus_stickies and card.has_sticky_note_attached(): - currently_active_node = card.remove_sticky_note() - add_sticky_note(currently_active_node) - current_dropzone_id = -1 - else: current_dropzone_id = find_first_free_card() - - current_context = ASSIGN - focus_stickies = !focus_stickies - if focus_stickies: - current_sticky_note_id = current_sticky_note_id - else: - current_dropzone_id = current_dropzone_id - + if !focus_stickies and card.has_sticky_note_attached(): + currently_active_node = card.remove_sticky_note() + add_sticky_note(currently_active_node) + current_dropzone_id = -1 + else: current_dropzone_id = find_first_free_card() + + current_context = ASSIGN + focus_stickies = !focus_stickies + if focus_stickies: + current_sticky_note_id = current_sticky_note_id + else: + current_dropzone_id = current_dropzone_id + elif dropzone.get_child(current_dropzone_id) is StickyNote: + if currently_active_node is StickyNote: + currently_active_node = dropzone.get_child(current_dropzone_id) + focus_stickies = false + current_context = ASSIGN + current_dropzone_id += 1 + currently_active_node.is_dragable = false + currently_active_node.z_index = 1 # move the note it so it floats next to the card where it should be attached func _select_card_for_assigning(sticky_note: Area2D, card: Area2D):