added quick tween to post its which are attached to cards or returned to the panels

This commit is contained in:
Adrian Schmid 2023-07-15 15:59:22 +02:00
parent d93858c122
commit 7de83600f5
2 changed files with 12 additions and 9 deletions

View File

@ -345,7 +345,7 @@ func _enter_assignment_context():
# move the post it so it floats next to the card where it should be attached # move the post it so it floats next to the card where it should be attached
func _select_card_for_assigning(post_it: Area2D, card: Area2D): func _select_card_for_assigning(post_it: Area2D, card: Area2D):
post_it.global_position = card.get_child(3).global_position + Vector2(0, 50) post_it.tween_transform_to(card.get_child(3).global_position + Vector2(0, 50))
# leaves the context for assigning postit via button controls # leaves the context for assigning postit via button controls
func _leave_assignment_context(): func _leave_assignment_context():
@ -354,16 +354,16 @@ func _leave_assignment_context():
currently_selected_node = currently_selected_card_for_assigning currently_selected_node = currently_selected_card_for_assigning
# handles everything to return a post it to the panels # handles everything to return a post it to the panels
func _return_postit_to_panels(postit: Area2D): func _return_postit_to_panels(post_it: Area2D):
for panel in area_dict["post_it_panels"]: for panel in area_dict["post_it_panels"]:
if panel.get_child_count() == 1: if panel.get_child_count() == 1:
postit.reparent(panel) area_dict["dropzone_content"].erase(post_it)
postit.set_owner(self) area_dict["post_its_in_list"].push_back(post_it)
area_dict["dropzone_content"].erase(postit) post_it.tween_transform_to(panel.get_child(0).position)
area_dict["post_its_in_list"].push_back(postit) post_it.rotation = post_it.base_rotation
postit.position = panel.get_child(0).position post_it.scale = post_it.base_scale
postit.rotation = postit.base_rotation post_it.reparent(panel)
postit.scale = postit.base_scale post_it.set_owner(self)
reorder_areas("dropzone_content") reorder_areas("dropzone_content")
reorder_areas("post_its_in_list") reorder_areas("post_its_in_list")
break break

View File

@ -104,3 +104,6 @@ func is_postit_attached() -> bool:
return true return true
return false return false
func tween_transform_to(target: Vector2):
var transform_tween = create_tween()
transform_tween.tween_property(self, "position", target, 0.25)