diff --git a/scenes/ccs_cases_2/doctor_office.tscn b/scenes/ccs_cases_2/doctor_office.tscn index 5eebd02..90044cc 100644 --- a/scenes/ccs_cases_2/doctor_office.tscn +++ b/scenes/ccs_cases_2/doctor_office.tscn @@ -278,30 +278,68 @@ stretch_mode = 0 layout_mode = 0 offset_left = 30.0 offset_top = 32.0 -offset_right = 150.0 -offset_bottom = 142.0 +offset_right = 142.0 +offset_bottom = 138.0 mouse_default_cursor_shape = 2 tooltip_text = "View nurse vital signs" icon = ExtResource("10_vitals") icon_max_width = 48 expand_icon = true -text = "Vitals" +icon_alignment = 1 vertical_icon_alignment = 0 +[node name="Label" type="Label" parent="ComputerOverlay/VitalsLauncher"] +layout_mode = 1 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -34.0 +grow_horizontal = 2 +grow_vertical = 0 +mouse_filter = 2 +theme_override_colors/font_color = Color(0.96, 0.98, 1, 1) +theme_override_colors/font_shadow_color = Color(0.01, 0.04, 0.07, 0.9) +theme_override_constants/shadow_offset_x = 1 +theme_override_constants/shadow_offset_y = 2 +theme_override_font_sizes/font_size = 17 +text = "Vitals" +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="MedicalHistoryLauncher" type="Button" parent="ComputerOverlay"] layout_mode = 0 -offset_left = 166.0 +offset_left = 158.0 offset_top = 32.0 -offset_right = 342.0 -offset_bottom = 142.0 +offset_right = 294.0 +offset_bottom = 138.0 mouse_default_cursor_shape = 2 tooltip_text = "View medical history" icon = ExtResource("11_history") icon_max_width = 48 expand_icon = true -text = "Medical History" +icon_alignment = 1 vertical_icon_alignment = 0 +[node name="Label" type="Label" parent="ComputerOverlay/MedicalHistoryLauncher"] +layout_mode = 1 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -34.0 +grow_horizontal = 2 +grow_vertical = 0 +mouse_filter = 2 +theme_override_colors/font_color = Color(0.96, 0.98, 1, 1) +theme_override_colors/font_shadow_color = Color(0.01, 0.04, 0.07, 0.9) +theme_override_constants/shadow_offset_x = 1 +theme_override_constants/shadow_offset_y = 2 +theme_override_font_sizes/font_size = 16 +text = "Medical History" +horizontal_alignment = 1 +vertical_alignment = 1 + [node name="VitalsWindow" type="PanelContainer" parent="ComputerOverlay"] visible = false z_index = 2 @@ -426,11 +464,9 @@ text = "Past Medical History" [node name="Text" type="Label" parent="ComputerOverlay/MedicalHistoryWindow/Margin/Content"] layout_mode = 2 -size_flags_vertical = 3 theme_override_colors/font_color = Color(0.04, 0.09, 0.13, 1) theme_override_font_sizes/font_size = 22 text = "No past medical history is available." -autowrap_mode = 3 [node name="Close" type="Button" parent="ComputerOverlay"] layout_mode = 1 diff --git a/scripts/ui/ccs_cases_2/doctor_office.gd b/scripts/ui/ccs_cases_2/doctor_office.gd index 6d683b9..fc0d746 100644 --- a/scripts/ui/ccs_cases_2/doctor_office.gd +++ b/scripts/ui/ccs_cases_2/doctor_office.gd @@ -81,6 +81,8 @@ func _ready() -> void: resized.connect(_resize_computer_windows) _style_vitals_window() _style_computer_window(medical_history_window) + _style_desktop_shortcut(vitals_launcher) + _style_desktop_shortcut(medical_history_launcher) _resize_computer_windows() _update_clock() _schedule_patient_blink() @@ -387,6 +389,7 @@ func _render_vitals(vitals: Dictionary) -> void: vitals_rows.add_child(value_label) vitals_rows.visible = not rows.is_empty() vitals_empty.visible = rows.is_empty() + _resize_computer_windows() func _build_vital_rows(vitals: Dictionary) -> Array[Dictionary]: @@ -454,16 +457,33 @@ func _style_computer_window(window: PanelContainer) -> void: window.add_theme_stylebox_override("panel", panel_style) +func _style_desktop_shortcut(button: Button) -> void: + var normal := StyleBoxEmpty.new() + var hover := StyleBoxFlat.new() + hover.bg_color = Color(0.82, 0.91, 0.97, 0.18) + hover.border_color = Color(0.9, 0.96, 1.0, 0.5) + hover.set_border_width_all(1) + hover.set_corner_radius_all(8) + var pressed := hover.duplicate() as StyleBoxFlat + pressed.bg_color = Color(0.72, 0.86, 0.96, 0.28) + button.add_theme_stylebox_override("normal", normal) + button.add_theme_stylebox_override("hover", hover) + button.add_theme_stylebox_override("pressed", pressed) + button.add_theme_stylebox_override("focus", hover) + + func _resize_computer_windows() -> void: if vitals_window == null or medical_history_window == null: return + var vital_row_count := vitals_rows.get_child_count() / 2 + var vitals_content_height := clampf(180.0 + float(vital_row_count) * 36.0, 300.0, 540.0) var vitals_size := Vector2( minf(720.0, maxf(320.0, size.x - 48.0)), - minf(540.0, maxf(360.0, size.y - 48.0))) + minf(vitals_content_height, maxf(300.0, size.y - 48.0))) _set_centered_window_rect(vitals_window, vitals_size, Vector2(-55.0, -25.0)) var history_size := Vector2( - minf(660.0, maxf(320.0, size.x - 48.0)), - minf(420.0, maxf(300.0, size.y - 48.0))) + minf(560.0, maxf(320.0, size.x - 48.0)), + minf(300.0, maxf(260.0, size.y - 48.0))) _set_centered_window_rect(medical_history_window, history_size, Vector2(55.0, 25.0)) diff --git a/tests/ccs_cases_2_ui_test.gd b/tests/ccs_cases_2_ui_test.gd index e2c9b08..b0e0fd0 100644 --- a/tests/ccs_cases_2_ui_test.gd +++ b/tests/ccs_cases_2_ui_test.gd @@ -90,6 +90,9 @@ func _run() -> void: _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.active_scene.vitals_launcher.visible, "the computer desktop should expose a Vitals app") _assert(screen.active_scene.medical_history_launcher.visible, "the computer desktop should expose a Medical History app") + _assert(screen.active_scene.vitals_launcher.text.is_empty() and screen.active_scene.medical_history_launcher.text.is_empty(), "desktop shortcuts should place labels below centered icons") + _assert(screen.active_scene.vitals_launcher.get_node("Label").text == "Vitals" and screen.active_scene.medical_history_launcher.get_node("Label").text == "Medical History", "desktop shortcut labels should remain readable") + _assert(screen.active_scene.vitals_launcher.get_theme_stylebox("normal") is StyleBoxEmpty and screen.active_scene.medical_history_launcher.get_theme_stylebox("normal") is StyleBoxEmpty, "desktop shortcuts should not render permanent button tiles") screen.active_scene.vitals_launcher.pressed.emit() _assert(screen.active_scene.is_vitals_open(), "the Vitals app should open a nurse vital-sign window") _assert(screen.active_scene.vitals_header.get_node("Title").text == "Vitals", "the vital window should use the concise Vitals heading") @@ -98,6 +101,8 @@ func _run() -> void: screen.active_scene.medical_history_launcher.pressed.emit() _assert(screen.active_scene.is_vitals_open() and screen.active_scene.is_medical_history_open(), "both chart windows should be able to remain open") _assert(screen.active_scene.medical_history_text.text == "Hyperlipidemia", "Medical History should render the case-authored past medical history") + _assert(screen.active_scene.medical_history_window.size.y <= 310.0, "Medical History should size closely to its short content (size %s, minimum %s)" % [screen.active_scene.medical_history_window.size, screen.active_scene.medical_history_window.get_combined_minimum_size()]) + _assert(screen.active_scene.vitals_window.size.y <= 410.0, "Vitals should size to its rendered measurement rows") _assert(screen.active_scene.medical_history_window.z_index > screen.active_scene.vitals_window.z_index, "the most recently opened chart window should come to the front") var original_history_position: Vector2 = screen.active_scene.medical_history_window.position screen.active_scene._set_medical_history_window_position(Vector2(90.0, 70.0))