prevent putting multiple post its on one card
This commit is contained in:
parent
0c8e3557ae
commit
4be0471018
|
|
@ -89,6 +89,7 @@ func handle_mouse_button(to_handle: Area2D, input: InputEvent):
|
|||
var overlaps = to_handle.get_overlapping_areas()
|
||||
for area in overlaps:
|
||||
if area.get_meta("type") == "card":
|
||||
if !area.has_postit_attached():
|
||||
to_handle.reparent(area)
|
||||
to_handle.set_owner(self)
|
||||
to_handle.position = area.get_child(3).position
|
||||
|
|
@ -127,5 +128,5 @@ func reorder_areas(reorder: String):
|
|||
i += 1
|
||||
new_order.insert(i, obj)
|
||||
|
||||
print_debug(new_order)
|
||||
#print_debug(new_order)
|
||||
|
||||
|
|
|
|||
|
|
@ -118,3 +118,11 @@ func _on_input_event(viewport, event, shape_idx):
|
|||
func _move_card():
|
||||
if is_dragged:
|
||||
position += get_viewport().get_mouse_position() - position
|
||||
|
||||
func has_postit_attached() -> bool:
|
||||
var all_children = get_children()
|
||||
print_debug(all_children)
|
||||
for child in all_children:
|
||||
if child.get_meta("type") == "post-it":
|
||||
return true
|
||||
return false
|
||||
|
|
|
|||
Loading…
Reference in New Issue