extract duplicated code into a function

This commit is contained in:
Face
2025-09-25 19:40:02 +03:00
parent 5dc7721d9c
commit 4b54e6cce8

View File

@@ -67,15 +67,18 @@ func _input(event):
close_tween.set_ease(Tween.EASE_IN)
close_tween.set_trans(Tween.TRANS_CUBIC)
close_tween.parallel().tween_property(self, "custom_minimum_size:x", 0.0, 0.15)
close_tween.parallel().tween_property(self, "size:x", 0.0, 0.15)
close_tween.parallel().tween_property(button, "custom_minimum_size:x", 0.0, 0.15)
close_tween.parallel().tween_property(button, "size:x", 0.0, 0.15)
animate_tab_close(close_tween)
await close_tween.finished
tab_closed.emit()
queue_free()
func animate_tab_close(tween: Tween) -> void:
tween.parallel().tween_property(self, "custom_minimum_size:x", 0.0, 0.15)
tween.parallel().tween_property(self, "size:x", 0.0, 0.15)
tween.parallel().tween_property(button, "custom_minimum_size:x", 0.0, 0.15)
tween.parallel().tween_property(button, "size:x", 0.0, 0.15)
func set_title(title: String) -> void:
button.text = title
button.set_meta("original_text", title)
@@ -247,10 +250,7 @@ func _on_close_button_pressed() -> void:
close_tween.set_ease(Tween.EASE_IN)
close_tween.set_trans(Tween.TRANS_CUBIC)
close_tween.parallel().tween_property(self, "custom_minimum_size:x", 0.0, 0.15)
close_tween.parallel().tween_property(self, "size:x", 0.0, 0.15)
close_tween.parallel().tween_property(button, "custom_minimum_size:x", 0.0, 0.15)
close_tween.parallel().tween_property(button, "size:x", 0.0, 0.15)
animate_tab_close(close_tween)
await close_tween.finished
tab_closed.emit()