fix(m56): give contract buttons explicit text slots

This commit is contained in:
2026-09-12 19:39:14 +08:00
parent 15bf8c6080
commit afc88ceacd
2 changed files with 20 additions and 2 deletions
+2
View File
@@ -61,6 +61,8 @@ audio, packaging, device release or unrelated postgame pages.
hidden legacy label instead of the visible component label.
- `M56-I06`: Contract header title/subtitle slots touched at 760x360; split
the authored rows and raised the header minimum height in `14eaf5a`.
- `M56-I07`: Contract action buttons relied on themed `Button.text` beneath
custom chrome; replaced it with an explicit icon-safe `ButtonLabel` slot.
## Gate record
+18 -2
View File
@@ -20,10 +20,26 @@ func configure(cancel_text: String, confirm_text: String, confirm_enabled: bool)
func _button(node_name: String, label_text: String, icon: String, variant: String, intent_id: String) -> Button:
var button := Button.new()
button.name = node_name
button.text = label_text
# Button.text uses the theme's default center slot and was being painted
# beneath the custom chrome. Own the text as an explicit runtime slot so
# the icon and label cannot drift or disappear at narrow widths.
button.text = ""
button.flat = true
button.focus_mode = Control.FOCUS_ALL
button.add_child(_entry_chrome(variant, icon))
var chrome := _entry_chrome(variant, icon)
button.add_child(chrome)
var label := preload("res://ui/shared/ui_factory.gd").label(label_text, "label", 1.0, Color("#202a31") if variant == "content_primary" else Color("#f5ead0"))
label.name = "ButtonLabel"
label.anchor_left = 0.23
label.anchor_top = 0.10
label.anchor_right = 0.96
label.anchor_bottom = 0.90
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
label.clip_text = true
label.text_overrun_behavior = TextServer.OVERRUN_TRIM_ELLIPSIS
label.mouse_filter = Control.MOUSE_FILTER_IGNORE
button.add_child(label)
button.pressed.connect(func(): action_pressed.emit(intent_id), CONNECT_DEFERRED)
return button