|
@@ -38,15 +38,14 @@ func next_slide(trans: Focus.Transit) -> void:
|
|
|
|
|
|
|
|
|
func next_slide_at(next_id: int, trans: Focus.Transit) -> void:
|
|
|
- _disconnect_current_slide()
|
|
|
+ _disable_current_slide()
|
|
|
current_id = next_id
|
|
|
current_slide = _focus_slide(current_id, trans)
|
|
|
- _connect_current_slide()
|
|
|
+ _enable_current_slide()
|
|
|
|
|
|
|
|
|
func _focus_slide(id: int, trans: Focus.Transit) -> Slide:
|
|
|
var slide: Slide = slides[id]
|
|
|
- slide.focus()
|
|
|
new_focus.emit(slide.get_center(), slide.get_scale().x, trans)
|
|
|
return slide
|
|
|
|
|
@@ -56,13 +55,14 @@ func _hide_every_slide() -> void:
|
|
|
slide.gently_hide()
|
|
|
|
|
|
|
|
|
-func _disconnect_current_slide() -> void:
|
|
|
+func _disable_current_slide() -> void:
|
|
|
if current_slide != null:
|
|
|
- current_slide.remove_focus()
|
|
|
+ current_slide.disable()
|
|
|
current_slide.finished.disconnect(_on_current_slide_finished)
|
|
|
|
|
|
|
|
|
-func _connect_current_slide() -> void:
|
|
|
+func _enable_current_slide() -> void:
|
|
|
+ current_slide.enable()
|
|
|
current_slide.finished.connect(_on_current_slide_finished)
|
|
|
|
|
|
|
|
@@ -119,11 +119,12 @@ func _unhandled_input(event: InputEvent) -> void:
|
|
|
|
|
|
|
|
|
func _focus_nearest_slide_from(target_pos: Vector2) -> void:
|
|
|
- var next_id = _search_nearest_slide_from(target_pos)
|
|
|
+ var next_slide = _search_nearest_slide_from(target_pos)
|
|
|
+ var next_id = slides.find(next_slide)
|
|
|
next_slide_at(next_id, Focus.Transit.SMOOTH)
|
|
|
|
|
|
|
|
|
-func _search_nearest_slide_from(target_pos: Vector2) -> int:
|
|
|
+func _search_nearest_slide_from(target_pos: Vector2) -> Slide:
|
|
|
var nearest_slide = current_slide
|
|
|
var shortest_distance = target_pos.distance_squared_to(nearest_slide.get_center())
|
|
|
for current_slide in slides:
|
|
@@ -132,7 +133,7 @@ func _search_nearest_slide_from(target_pos: Vector2) -> int:
|
|
|
nearest_slide = current_slide
|
|
|
shortest_distance = current_distance
|
|
|
|
|
|
- return slides.find(nearest_slide)
|
|
|
+ return nearest_slide
|
|
|
|
|
|
|
|
|
func _on_current_slide_finished() -> void:
|