Refine physical exam chart layout

This commit is contained in:
hz
2026-08-13 22:21:02 -05:00
parent 6312b45a92
commit 7da07cb2a4
2 changed files with 16 additions and 4 deletions
+13 -4
View File
@@ -64,6 +64,7 @@ var available_exams: Array = []
var attempt_chart: Array = []
var medical_history_section_title: Label
var medical_history_exam_text: RichTextLabel
var medical_history_exam_scroll: ScrollContainer
var medical_history_tab_button: Button
var physical_exam_tab_button: Button
var experience_mode := "management"
@@ -411,18 +412,25 @@ func _build_medical_history_tabs() -> void:
physical_exam_tab_button.text = "Physical Exam"
physical_exam_tab_button.pressed.connect(_show_chart_tab.bind(true))
tabs.add_child(physical_exam_tab_button)
medical_history_exam_scroll = ScrollContainer.new()
medical_history_exam_scroll.custom_minimum_size = Vector2(0.0, 120.0)
medical_history_exam_scroll.size_flags_vertical = Control.SIZE_EXPAND_FILL
medical_history_exam_scroll.horizontal_scroll_mode = ScrollContainer.SCROLL_MODE_DISABLED
content.add_child(medical_history_exam_scroll)
medical_history_exam_text = RichTextLabel.new()
medical_history_exam_text.bbcode_enabled = true
medical_history_exam_text.fit_content = true
medical_history_exam_text.custom_minimum_size = Vector2(0.0, 120.0)
medical_history_exam_text.custom_minimum_size = Vector2(560.0, 120.0)
medical_history_exam_text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
medical_history_exam_text.add_theme_font_size_override("normal_font_size", 18)
content.add_child(medical_history_exam_text)
medical_history_exam_scroll.add_child(medical_history_exam_text)
_show_chart_tab(false)
func _show_chart_tab(show_exams: bool) -> void:
medical_history_section_title.visible = not show_exams
medical_history_text.visible = not show_exams
medical_history_exam_text.visible = show_exams
medical_history_exam_scroll.visible = show_exams
medical_history_tab_button.disabled = not show_exams
physical_exam_tab_button.disabled = show_exams
_resize_computer_windows()
@@ -568,7 +576,8 @@ func _resize_computer_windows() -> void:
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 exam_count := medical_history_exam_text.text.count("[b]") if medical_history_exam_text != null else 0
var history_height := 340.0 if not medical_history_exam_text.visible else clampf(250.0 + exam_count * 90.0, 340.0, 650.0)
var showing_exams := medical_history_exam_scroll != null and medical_history_exam_scroll.visible
var history_height := 340.0 if not showing_exams else clampf(250.0 + exam_count * 105.0, 340.0, 650.0)
var history_size := Vector2(
minf(680.0, maxf(320.0, size.x - 48.0)),
minf(history_height, maxf(300.0, size.y - 48.0)))
+3
View File
@@ -107,6 +107,8 @@ func _run() -> void:
_assert(screen.active_scene.medical_history_window.size.y <= 350.0, "Medical History should size closely to its tabbed 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.physical_exam_tab_button.text == "Physical Exam", "Medical History should include a Physical Exam tab")
_assert(screen.active_scene.medical_history_exam_text.text == "No physical examinations have been completed.", "Physical Exam should begin with an empty state")
_assert(screen.active_scene.medical_history_exam_text.bbcode_enabled, "Physical Exam headings should render as rich text")
_assert(screen.active_scene.medical_history_exam_text.get_parent() is ScrollContainer, "Physical Exam overflow should use an internal scroller")
_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
@@ -250,6 +252,7 @@ func _run() -> void:
screen.active_scene.open_medical_history()
screen.active_scene.physical_exam_tab_button.pressed.emit()
_assert(screen.active_scene.medical_history_exam_text.text.contains("Mild epigastric tenderness."), "completed findings should be stored in the Physical Exam tab")
_assert(screen.active_scene.medical_history_window.size.y <= 650.0, "the Physical Exam chart should remain bounded while findings scroll")
service.attempt = {"id": "classic-attempt", "state": "active", "openingCompleted": false, "interview": {}}
host.shown_screen = ""