From afc88ceacdc9f72b47f7b1d8036bc5bcd31e175b Mon Sep 17 00:00:00 2001 From: wusumac <736139669@qq.com> Date: Sat, 12 Sep 2026 19:39:14 +0800 Subject: [PATCH] fix(m56): give contract buttons explicit text slots --- docs/plans/M56_FIXED_CANVAS_UI_REPAIR.md | 2 ++ runtime/ui/m54/contract_action_dock.gd | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/plans/M56_FIXED_CANVAS_UI_REPAIR.md b/docs/plans/M56_FIXED_CANVAS_UI_REPAIR.md index aad4fa2f..81673b42 100644 --- a/docs/plans/M56_FIXED_CANVAS_UI_REPAIR.md +++ b/docs/plans/M56_FIXED_CANVAS_UI_REPAIR.md @@ -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 diff --git a/runtime/ui/m54/contract_action_dock.gd b/runtime/ui/m54/contract_action_dock.gd index aa6037e6..9a459bbb 100644 --- a/runtime/ui/m54/contract_action_dock.gd +++ b/runtime/ui/m54/contract_action_dock.gd @@ -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