diff --git a/scripts/ui/main.gd b/scripts/ui/main.gd index dbbdc5f..1e5989c 100644 --- a/scripts/ui/main.gd +++ b/scripts/ui/main.gd @@ -896,7 +896,7 @@ func _build_app_menu() -> void: menu_exit_button.text = "Exit Run" menu_exit_button.custom_minimum_size = Vector2(0, 48) UISoundService.set_button_sound(menu_exit_button, "back") - menu_exit_button.pressed.connect(_exit_run) + menu_exit_button.pressed.connect(exit_current_run) content.add_child(menu_exit_button) var logout := Button.new() @@ -943,7 +943,7 @@ func _navigate_from_pause(target_screen: String) -> void: BlockSessionService.pause_current_question_timer() -func _exit_run() -> void: +func exit_current_run() -> void: _close_app_menu() if current_screen_name == "ccs_player": var ccs_player = screens.get("ccs_player") diff --git a/scripts/ui/question_player.gd b/scripts/ui/question_player.gd index ec200db..b86078f 100644 --- a/scripts/ui/question_player.gd +++ b/scripts/ui/question_player.gd @@ -90,6 +90,7 @@ var text_smaller_button: Button var text_larger_button: Button var labs_button: Button var calculator_button: Button +var exit_button: Button var clear_highlight_button: Button var flag_button: Button var report_button: Button @@ -317,6 +318,18 @@ func _ready() -> void: UISoundService.set_button_sound(text_larger_button, "toggle") text_larger_button.pressed.connect(func(): _adjust_question_text_scale(TEXT_SCALE_STEP)) + exit_button = Button.new() + exit_button.name = "ExitButton" + exit_button.tooltip_text = "Return to main area" + exit_button.icon = preload("res://assets/icons/lucide/house.svg") + exit_button.custom_minimum_size = Vector2(44, 44) + exit_button.add_theme_constant_override("icon_max_width", 22) + exit_button.alignment = HORIZONTAL_ALIGNMENT_CENTER + exit_button.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER + exit_button.focus_mode = Control.FOCUS_NONE + UISoundService.set_button_sound(exit_button, "back") + exit_button.pressed.connect(func(): main.exit_current_run()) + calculator_button = Button.new() calculator_button.name = "CalculatorButton" calculator_button.tooltip_text = "Open calculator" @@ -408,6 +421,7 @@ func _ready() -> void: # controls behind an extra click. No text labels either (their varying widths # broke even spacing when a button hid itself) - each button's existing # tooltip_text carries the label as hover text instead. + question_toolbar.add_child(exit_button) question_toolbar.add_child(text_smaller_button) question_toolbar.add_child(text_larger_button) question_toolbar.add_child(calculator_button) @@ -1046,7 +1060,7 @@ func _apply_question_theme() -> void: var navigator_heading := navigator_popup.find_child("NavigatorHeading", true, false) as Label if navigator_heading != null: navigator_heading.add_theme_color_override("font_color", Brand.text_color(dark)) - for control in [text_smaller_button, text_larger_button, calculator_button, bookmark_button, notes_button, flashcard_button, app_feedback_button]: + for control in [exit_button, text_smaller_button, text_larger_button, calculator_button, bookmark_button, notes_button, flashcard_button, app_feedback_button]: if control == null: continue var active: bool = control == bookmark_button and BookmarkService.is_bookmarked(str(BlockSessionService.get_current_question().get("id", "")))