Pārlūkot izejas kodu

:beetle: Fix fast skip not being processed when in transit

Previously, triggering a fast transit during a slow transit was making
the next slide appear but not being focused.

This commit fix this by interrupting any ongoing transit.
DricomDragon 2 gadi atpakaļ
vecāks
revīzija
e068caa17b
1 mainītis faili ar 8 papildinājumiem un 2 dzēšanām
  1. 8 2
      godot/projector/focus/Focus.gd

+ 8 - 2
godot/projector/focus/Focus.gd

@@ -32,13 +32,14 @@ func focus_on(pos: Vector2, scalar_scale: float) -> void:
 
 
 func beam_to_focus() -> void:
+	_abort_ongoing_transit()
+
 	set_position(target_pos)
 	set_scope(target_scope)
 
 
 func transit_to_focus() -> void:
-	if tween:
-		tween.kill()
+	_abort_ongoing_transit()
 
 	var is_wider = target_scope.x > get_scope().x
 	var scope_ease = scope_wider_ease if is_wider else scope_closer_ease
@@ -63,6 +64,11 @@ func set_scope(new_scope: Vector2) -> void:
 	set_zoom(_invert_vector(new_scope))
 
 
+func _abort_ongoing_transit() -> void:
+	if tween:
+		tween.kill()
+
+
 func _on_show_new_focus(pos: Vector2, scalar_scale: float) -> void:
 	focus_on(pos, scalar_scale)