Przeglądaj źródła

:beetle: Fix ovelapping slides to be skipped

Input was consumed twice when slides were overlapping.
DricomDragon 2 lat temu
rodzic
commit
c67cf4f633

+ 1 - 0
godot/projector/show/Show.gd

@@ -36,6 +36,7 @@ func focus_slide(id: int) -> Slide:
 
 func _disconnect_current_slide():
 	if current_slide != null:
+		current_slide.remove_focus()
 		current_slide.finished.disconnect(_on_current_slide_finished)
 
 

+ 7 - 0
godot/projector/slide/Slide.gd

@@ -12,10 +12,16 @@ var center_offset: Vector2
 func _ready():
 	center_offset = _compute_center_offset()
 	set_visible(false)
+	remove_focus()
+
+
+func remove_focus() -> void:
+	set_process_unhandled_input(false)
 
 
 func focus() -> void:
 	set_visible(true)
+	set_process_unhandled_input(true)
 
 
 func get_center():
@@ -25,6 +31,7 @@ func get_center():
 func _unhandled_key_input(event: InputEvent):
 	if event.is_action("ui_accept") and event.is_pressed():
 		finished.emit()
+		get_viewport().set_input_as_handled()
 
 
 func _compute_center_offset() -> Vector2:

+ 1 - 0
godot/run/root.tscn

@@ -95,6 +95,7 @@ move_trans = 3
 scope_trans = 10
 
 [node name="Show" parent="Board" instance=ExtResource("2_cih7e")]
+start_slide = 75
 
 [node name="World" parent="Board/Show" instance=ExtResource("3_s3lgd")]
 scale = Vector2(10, 10)