From 7661b057bc0a439cf2342f5aafbf16e0c8f7f78b Mon Sep 17 00:00:00 2001 From: Voyager Date: Sun, 2 Aug 2026 13:31:10 -0400 Subject: [PATCH] Dock weather clock to screen corner --- tests/ui_scaling_runtime_validation.gd | 12 ++++++++++++ tests/world_time_multiplayer_validation.gd | 4 ++++ ui/chat_ui.gd | 6 +----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/ui_scaling_runtime_validation.gd b/tests/ui_scaling_runtime_validation.gd index 7fbcead..f3f4974 100644 --- a/tests/ui_scaling_runtime_validation.gd +++ b/tests/ui_scaling_runtime_validation.gd @@ -150,13 +150,25 @@ func _run() -> void: assert(presenter.get_ui_viewport_size() == expected_viewport_size) assert(presenter.size.is_equal_approx(Vector2(expected_viewport_size))) var chat_panel := chat_ui.get_node("ChatPanel") as Control + var clock_panel := chat_ui.get_node("WorldClockPanel") as Control + var weather_icon := chat_ui.get_node("WorldWeatherIcon") as Control assert(chat_panel != null) + assert(clock_panel != null) + assert(weather_icon != null) assert(chat_panel.visible) assert(is_equal_approx(chat_panel.position.x, 0.0)) assert(is_equal_approx( (chat_panel.position.y + chat_panel.size.y) * effective_scale, display_size.y - ChatUI.BOTTOM_MARGIN * effective_scale, )) + assert(clock_panel.position.is_equal_approx(Vector2( + ChatUI.CLOCK_EDGE_MARGIN, + ChatUI.CLOCK_EDGE_MARGIN, + ))) + assert(is_equal_approx( + weather_icon.position.y, ChatUI.CLOCK_EDGE_MARGIN + )) + assert(weather_icon.position.x > clock_panel.position.x) print( ( "UI resize: requested=%s actual=%s viewport=%s container_scale=%.6f " diff --git a/tests/world_time_multiplayer_validation.gd b/tests/world_time_multiplayer_validation.gd index 6f1c455..66f7dad 100644 --- a/tests/world_time_multiplayer_validation.gd +++ b/tests/world_time_multiplayer_validation.gd @@ -129,6 +129,8 @@ func _run_client() -> void: assert(clock_label.text.ends_with(" pm")) assert(weather_icon.visible) assert(weather_icon.get_weather() == WorldWeatherService.Weather.RAINY) + assert(is_equal_approx(clock_panel.position.y, 10.0)) + assert(is_equal_approx(weather_icon.position.y, 10.0)) assert(clock_panel.position.y + clock_panel.size.y < chat_panel.position.y) var update_deadline: int = Time.get_ticks_msec() + 10000 @@ -156,10 +158,12 @@ func _run_client() -> void: await process_frame assert(clock_panel.position.x > 1000.0) assert(weather_icon.position.x < clock_panel.position.x) + assert(is_equal_approx(clock_panel.position.y, 10.0)) chat_ui.call("set_dock_right", false) await process_frame assert(clock_panel.position.x < 20.0) assert(weather_icon.position.x > clock_panel.position.x) + assert(is_equal_approx(clock_panel.position.y, 10.0)) print("World time multiplayer client validation: PASS") session.disconnect_session("") main.queue_free() diff --git a/ui/chat_ui.gd b/ui/chat_ui.gd index fce081a..9167a18 100644 --- a/ui/chat_ui.gd +++ b/ui/chat_ui.gd @@ -22,7 +22,6 @@ const COLLAPSED_REVEAL_WIDTH: float = 8.0 const HINT_EDGE_MARGIN: float = 4.0 const CLOCK_SIZE := Vector2(116.0, 34.0) const CLOCK_EDGE_MARGIN: float = 10.0 -const CLOCK_PANEL_GAP: float = 8.0 const WEATHER_ICON_SIZE := Vector2(34.0, 34.0) const WEATHER_ICON_GAP: float = 6.0 const WorldTimeServiceType = preload("res://world/world_time_service.gd") @@ -824,10 +823,7 @@ func _layout_presentation(animate: bool) -> void: ) var clock_position := Vector2( clock_x, - maxf( - CLOCK_EDGE_MARGIN, - target_position.y - CLOCK_SIZE.y - CLOCK_PANEL_GAP, - ), + CLOCK_EDGE_MARGIN, ) var weather_icon_x: float = ( clock_position.x - WEATHER_ICON_GAP - WEATHER_ICON_SIZE.x