From 2b25e25424619742f72f44f400885e65c2f856e8 Mon Sep 17 00:00:00 2001 From: hz Date: Fri, 7 Aug 2026 19:17:20 -0500 Subject: [PATCH] Remove CCS viewport letterboxing --- scenes/ccs_cases_2/doctor_office.tscn | 12 ++++++++---- scripts/ui/ccs_cases_2/doctor_office.gd | 7 ++++--- scripts/ui/ccs_cases_2_screen.gd | 6 +++--- tests/ccs_cases_2_ui_test.gd | 5 +++-- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/scenes/ccs_cases_2/doctor_office.tscn b/scenes/ccs_cases_2/doctor_office.tscn index 39b7cb5..96c631c 100644 --- a/scenes/ccs_cases_2/doctor_office.tscn +++ b/scenes/ccs_cases_2/doctor_office.tscn @@ -270,14 +270,18 @@ grow_vertical = 2 mouse_filter = 2 texture = ExtResource("7_computer") expand_mode = 1 -stretch_mode = 5 +stretch_mode = 0 [node name="Close" type="Button" parent="ComputerOverlay"] -layout_mode = 0 -offset_left = 1512.0 +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -88.0 offset_top = 20.0 -offset_right = 1576.0 +offset_right = -24.0 offset_bottom = 84.0 +grow_horizontal = 0 mouse_default_cursor_shape = 2 tooltip_text = "Close computer" icon = ExtResource("9_close") diff --git a/scripts/ui/ccs_cases_2/doctor_office.gd b/scripts/ui/ccs_cases_2/doctor_office.gd index 580ccac..6ac6de3 100644 --- a/scripts/ui/ccs_cases_2/doctor_office.gd +++ b/scripts/ui/ccs_cases_2/doctor_office.gd @@ -346,7 +346,8 @@ func _render_choice_page() -> void: var option_text := str(option.get("text", "")) var button := TextureButton.new() button.set_meta("choice_id", choice_id) - button.custom_minimum_size = Vector2(350.0, 136.0) + button.custom_minimum_size = Vector2(0.0, 136.0) + button.size_flags_horizontal = Control.SIZE_EXPAND_FILL button.ignore_texture_size = true button.stretch_mode = TextureButton.STRETCH_SCALE button.texture_normal = _crop_choice_texture(CHOICE_NORMAL) @@ -363,9 +364,9 @@ func _render_choice_page() -> void: var label := Label.new() label.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT) - label.offset_left = 48.0 + label.offset_left = 28.0 label.offset_top = 12.0 - label.offset_right = -48.0 + label.offset_right = -28.0 label.offset_bottom = -12.0 label.mouse_filter = Control.MOUSE_FILTER_IGNORE label.add_theme_color_override("font_color", Color(0.055, 0.105, 0.145)) diff --git a/scripts/ui/ccs_cases_2_screen.gd b/scripts/ui/ccs_cases_2_screen.gd index b00aeb0..2fdc5e7 100644 --- a/scripts/ui/ccs_cases_2_screen.gd +++ b/scripts/ui/ccs_cases_2_screen.gd @@ -379,6 +379,6 @@ func _fit_stage() -> void: var available := size if available.x <= 0.0 or available.y <= 0.0: return - var fit_scale := minf(available.x / DESIGN_SIZE.x, available.y / DESIGN_SIZE.y) - stage_root.scale = Vector2.ONE * fit_scale - stage_root.position = (available - DESIGN_SIZE * fit_scale) * 0.5 + stage_root.scale = Vector2.ONE + stage_root.position = Vector2.ZERO + stage_root.size = available diff --git a/tests/ccs_cases_2_ui_test.gd b/tests/ccs_cases_2_ui_test.gd index be8db7e..7f8026e 100644 --- a/tests/ccs_cases_2_ui_test.gd +++ b/tests/ccs_cases_2_ui_test.gd @@ -91,12 +91,13 @@ func _run() -> void: _assert(screen.active_scene.is_computer_open(), "the computer launcher should open the simulated desktop") _assert(not screen.active_scene.computer_launcher.visible, "the launcher should hide while the computer is open") _assert(screen.active_scene.computer_overlay.get_node("Screen").texture.resource_path.ends_with("computer-base.png"), "the overlay should render the supplied computer base") - _assert(screen.active_scene.computer_overlay.get_node("Screen").stretch_mode == TextureRect.STRETCH_KEEP_ASPECT_CENTERED, "the computer should be fully contained without cropping") + _assert(screen.active_scene.computer_overlay.get_node("Screen").stretch_mode == TextureRect.STRETCH_SCALE, "the computer should fill the viewport without side bars") _assert(screen.close_transient_overlay(), "Escape routing should close the computer before the pause menu") _assert(not screen.active_scene.is_computer_open(), "closing the transient overlay should restore the doctor office") _assert(not screen.close_transient_overlay(), "a second Escape should be available to open the pause menu") _assert(is_equal_approx(screen.DESIGN_SIZE.x / screen.DESIGN_SIZE.y, 16.0 / 9.0), "the graphical CCS stage should use a true 16:9 design canvas") - _assert(is_equal_approx(screen.stage_root.scale.x, screen.stage_root.scale.y), "the graphical stage should preserve its aspect ratio") + _assert(screen.stage_root.size.is_equal_approx(screen.size), "the graphical stage should fill the available viewport") + _assert(screen.stage_root.position.is_equal_approx(Vector2.ZERO), "the graphical stage should not introduce letterbox margins") var stale_graphical_attempt := _sample_attempt(false) stale_graphical_attempt.experienceMode = "graphical_interview" stale_graphical_attempt.openingCompleted = true