diff --git a/src/logic-scenes/board/card-board.gd b/src/logic-scenes/board/card-board.gd index b5e3c53..c4334d5 100644 --- a/src/logic-scenes/board/card-board.gd +++ b/src/logic-scenes/board/card-board.gd @@ -54,7 +54,7 @@ func is_in_dropzone(to_check: Node) -> bool: else: return true -func handle_mouse_button(to_handle: Area2D, input: InputEvent, dragableType: int): +func handle_mouse_button(to_handle: Area2D, input: InputEvent): # No two areas can be dragged at the same time. # Make sure that only the same area is dragged. @@ -70,14 +70,13 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent, dragableType: int # TODO: We need a better way to recognize whether "to_handle" is a Card or a Post-It. # (Tried checking for a script, didn't work, because script has no name attached. # Alternative might be to check for specific values within the script ("is_card" f.e)) - match dragableType: - 1: # 1 = Card + match to_handle.get_meta("type"): + "card": # 1 = Card if input.is_pressed(): - # TODO: Add function to rearrange the array based on positions in the dropzone - print_debug(":)") + reorder_areas("dropzone_content") else: currently_dragged_area = null - 2: # 2 = PostIt + "post-it": # 2 = PostIt if input.is_pressed(): to_handle.reparent(dropzone) to_handle.set_owner(self) # needs to be here otherwise the owner disappears diff --git a/src/logic-scenes/board/card.gd b/src/logic-scenes/board/card.gd index 13ca4cf..134ccc3 100644 --- a/src/logic-scenes/board/card.gd +++ b/src/logic-scenes/board/card.gd @@ -111,5 +111,5 @@ func _on_input_event(viewport, event, shape_idx): if event is InputEventMouseButton: if event.button_index == MOUSE_BUTTON_LEFT: if is_dragable and "handle_mouse_button" in owner: - owner.handle_mouse_button(self, event, 1) + owner.handle_mouse_button(self, event) diff --git a/src/logic-scenes/board/post-it.gd b/src/logic-scenes/board/post-it.gd index 08a82a9..b19bcd5 100644 --- a/src/logic-scenes/board/post-it.gd +++ b/src/logic-scenes/board/post-it.gd @@ -86,5 +86,5 @@ func _on_input_event(viewport, event, shape_idx): if event is InputEventMouseButton: if event.button_index == MOUSE_BUTTON_LEFT: if is_dragable and "handle_mouse_button" in owner: - owner.handle_mouse_button(self, event, 2) + owner.handle_mouse_button(self, event)