Fix: battlefield popup — Control wrapper between CanvasLayer and popup

CenterContainer/ScrollContainer require a proper Control parent to
compute sizes. Adding CardDetailPopup directly to a CanvasLayer broke
the nested container layout chain, causing zero-height Panel (invisible
content despite the grey overlay showing correctly).

Fix: spawn a dedicated CanvasLayer (layer 20, above HUD at layer 10)
containing a full-rect Control anchor, then parent the popup to that
Control. This restores proper anchor→Control→Container sizing.

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-08 18:10:57 -04:00
co-authored by Claude Happy
parent b3ce6a1200
commit 15a50f3d7c
@@ -161,9 +161,16 @@ func _ready() -> void:
get_tree().change_scene_to_file("res://scenes/main/MainScreen.tscn"))
_hold_timer.timeout.connect(_on_hold_timer_fired)
# Card detail popup (shared overlay — reused across multiple unit clicks).
# Card detail popup — needs a Control parent (not CanvasLayer directly) for
# CenterContainer/ScrollContainer layout to work, and its own layer above HUD.
var _popup_layer := CanvasLayer.new()
_popup_layer.layer = 20
add_child(_popup_layer)
var _popup_anchor := Control.new()
_popup_anchor.set_anchors_preset(Control.PRESET_FULL_RECT)
_popup_layer.add_child(_popup_anchor)
_card_detail_popup = _CARD_DETAIL_POPUP_SCENE.instantiate()
_hud.add_child(_card_detail_popup)
_popup_anchor.add_child(_card_detail_popup)
_card_detail_popup.hide()
Game.state_updated.connect(_on_state_updated)