Files
settled-reach/client/ui/implant/implant_header.gd
T
jpmschweitzerandClaude Opus 4.6 6ad1c8255f fix(ui): implant panel width constraint and text wrapping
Panel now clips content and constrains children to its width.
Components set autowrap and SIZE_FLAGS_FILL so text wraps within
the panel instead of overflowing. Bold markdown markers stripped
in ImplantTextBlock constructor.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 10:51:25 +02:00

41 lines
1.2 KiB
GDScript

@tool
class_name ImplantHeader
extends VBoxContainer
## Panel header — title + optional subtitle.
var _title_label: Label
var _subtitle_label: Label
func _init(title: String = "", subtitle: String = "") -> void:
_title_label = Label.new()
_title_label.text = title
_title_label.name = "Title"
_subtitle_label = Label.new()
_subtitle_label.text = subtitle
_subtitle_label.name = "Subtitle"
func _ready() -> void:
add_theme_constant_override("separation", 0)
size_flags_horizontal = Control.SIZE_FLAGS_FILL
_title_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
_subtitle_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
add_child(_title_label)
add_child(_subtitle_label)
func set_content(title: String, subtitle: String = "") -> void:
_title_label.text = title
_subtitle_label.text = subtitle
_subtitle_label.visible = not subtitle.is_empty()
func apply_implant_theme(t: ImplantTheme) -> void:
_title_label.add_theme_font_size_override("font_size", t.font_header)
_title_label.add_theme_color_override("font_color", t.text_primary)
_subtitle_label.add_theme_font_size_override("font_size", t.font_small)
_subtitle_label.add_theme_color_override("font_color", t.text_dim)