Polish CCS computer desktop

This commit is contained in:
hz
2026-08-10 00:45:01 -05:00
parent 33b55753cb
commit 71f33453d3
3 changed files with 73 additions and 12 deletions
+23 -3
View File
@@ -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))