fix: rebuild HUD composition around real play viewport

This commit is contained in:
goose
2026-10-09 00:39:08 -04:00
parent a42002c834
commit 7c43fb2ecb
7 changed files with 242 additions and 69 deletions
+10 -4
View File
@@ -7,9 +7,9 @@ const EXPLORED_COLOR := Color(0.24, 0.29, 0.25, 0.98)
const VISIBLE_COLOR := Color(0.72, 0.66, 0.51, 1.0)
const PLAYER_COLOR := Color(0.96, 0.78, 0.3, 1.0)
const THREAT_COLOR := Color(0.84, 0.22, 0.14, 1.0)
const COMPACT_SIZE := Vector2(280.0, 300.0)
const COMPACT_SIZE := Vector2(396.0, 340.0)
const EXPANDED_SIZE := Vector2(520.0, 560.0)
const COMPACT_RAIL_INSET := 20.0
const COMPACT_RAIL_INSET := 14.0
const EXPANDED_FRAME_INSET := 28.0
@onready var map_region: Control = $MapRegion
@@ -91,15 +91,21 @@ func _layout_in_hud() -> void:
var layout := get_node_or_null("../ResponsiveLayout") as Control
if layout == null:
return
var host := layout.get_node_or_null("PlayAreaFrame" if expanded else "RightRail") as Control
var host := layout.get_node_or_null("PlayAreaFrame" if expanded else "MapSection") as Control
if host == null:
return
var requested_size := EXPANDED_SIZE if expanded else COMPACT_SIZE
var inset := EXPANDED_FRAME_INSET if expanded else COMPACT_RAIL_INSET
var available_size := host.size - Vector2.ONE * inset * 2.0
if not expanded:
# The section heading occupies its own clear line above the map.
available_size.y -= 28.0
var panel_size := Vector2(minf(requested_size.x, available_size.x), minf(requested_size.y, available_size.y))
size = panel_size
position = host.position + (host.size - panel_size) * 0.5
if expanded:
position = host.position + (host.size - panel_size) * 0.5
else:
position = host.position + Vector2((host.size.x - panel_size.x) * 0.5, 42.0)
func _draw() -> void:
if _map == null: