extract duplicated code into a function
This commit is contained in:
@@ -67,15 +67,18 @@ func _input(event):
|
|||||||
close_tween.set_ease(Tween.EASE_IN)
|
close_tween.set_ease(Tween.EASE_IN)
|
||||||
close_tween.set_trans(Tween.TRANS_CUBIC)
|
close_tween.set_trans(Tween.TRANS_CUBIC)
|
||||||
|
|
||||||
close_tween.parallel().tween_property(self, "custom_minimum_size:x", 0.0, 0.15)
|
animate_tab_close(close_tween)
|
||||||
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)
|
|
||||||
|
|
||||||
await close_tween.finished
|
await close_tween.finished
|
||||||
tab_closed.emit()
|
tab_closed.emit()
|
||||||
queue_free()
|
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:
|
func set_title(title: String) -> void:
|
||||||
button.text = title
|
button.text = title
|
||||||
button.set_meta("original_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_ease(Tween.EASE_IN)
|
||||||
close_tween.set_trans(Tween.TRANS_CUBIC)
|
close_tween.set_trans(Tween.TRANS_CUBIC)
|
||||||
|
|
||||||
close_tween.parallel().tween_property(self, "custom_minimum_size:x", 0.0, 0.15)
|
animate_tab_close(close_tween)
|
||||||
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)
|
|
||||||
|
|
||||||
await close_tween.finished
|
await close_tween.finished
|
||||||
tab_closed.emit()
|
tab_closed.emit()
|
||||||
|
|||||||
Reference in New Issue
Block a user