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>
This commit is contained in:
@@ -10,6 +10,8 @@ func _init(text: String = "", color: Color = Color.TRANSPARENT) -> void:
|
||||
self.text = text
|
||||
_color_override = color
|
||||
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
size_flags_horizontal = Control.SIZE_FLAGS_FILL
|
||||
|
||||
|
||||
func set_content(text_value: String, color: Color = Color.TRANSPARENT) -> void:
|
||||
|
||||
@@ -19,6 +19,9 @@ func _init(title: String = "", subtitle: String = "") -> void:
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ var _vbox: VBoxContainer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Constrain panel to its custom_minimum_size width
|
||||
size_flags_horizontal = Control.SIZE_FLAGS_SHRINK_END
|
||||
clip_contents = true
|
||||
|
||||
_vbox = VBoxContainer.new()
|
||||
_vbox.name = "Content"
|
||||
add_child(_vbox)
|
||||
|
||||
@@ -9,16 +9,13 @@ var _text_alpha: float = 0.75
|
||||
|
||||
func _init(content: String = "", max_lines: int = -1) -> void:
|
||||
_max_lines = max_lines
|
||||
text = content
|
||||
text = content.replace("**", "") # strip markdown bold
|
||||
bbcode_enabled = false
|
||||
fit_content = true
|
||||
scroll_active = false
|
||||
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
if max_lines > 0:
|
||||
visible_characters_behavior = TextServer.VC_GLYPHS_LTR
|
||||
# Godot 4 RichTextLabel doesn't have max_lines directly —
|
||||
# we limit via visible_ratio or custom_minimum_size after layout.
|
||||
size_flags_horizontal = Control.SIZE_FLAGS_FILL
|
||||
|
||||
|
||||
func set_content(content: String, max_lines: int = -1) -> void:
|
||||
|
||||
@@ -113,6 +113,7 @@ func _ready() -> void:
|
||||
_info_panel.name = "InfoPanel"
|
||||
_info_panel.theme_resource = _implant_theme
|
||||
_info_panel.custom_minimum_size.x = POPUP_WIDTH
|
||||
_info_panel.size.x = POPUP_WIDTH
|
||||
_info_panel.visible = false
|
||||
_info_panel.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
add_child(_info_panel)
|
||||
|
||||
Reference in New Issue
Block a user