Fix oversized, borderless consent checkbox
The generic "style every Button" pass in _apply_theme also matched CheckBox (it's a Button subtype) and ran after the checkbox-specific styling, overwriting the intended blue border with the plain default button box - and that box's own content margins were inflating the checkbox well past its 26x26 minimum (actual rendered size was 60x52). Skip CheckBox in that generic loop, zero out the checkbox stylebox's content margins, shrink it to 22x22, and stop it stretching to the row's full height. Also sized the consent text down (15->13) and gave the row some vertical breathing room. Verified with a rendered screenshot and a direct stylebox/size dump: checkbox is now 22x24 with a real 2px blue border, matching the provided reference.
This commit is contained in:
@@ -351,11 +351,17 @@ func _add_legal_consent(parent: VBoxContainer) -> CheckBox:
|
||||
# wrapping then stays confined to its column, and "Terms of Service"/
|
||||
# "Privacy Policy" render as inline links rather than a duplicate row
|
||||
# of link buttons underneath.
|
||||
var margin := MarginContainer.new()
|
||||
margin.add_theme_constant_override("margin_top", 8)
|
||||
margin.add_theme_constant_override("margin_bottom", 8)
|
||||
parent.add_child(margin)
|
||||
var row := HBoxContainer.new()
|
||||
row.add_theme_constant_override("separation", 12)
|
||||
parent.add_child(row)
|
||||
margin.add_child(row)
|
||||
var check := CheckBox.new()
|
||||
check.custom_minimum_size = Vector2(26, 26)
|
||||
check.name = "LegalConsentCheckBox"
|
||||
check.custom_minimum_size = Vector2(22, 22)
|
||||
check.size_flags_vertical = Control.SIZE_SHRINK_BEGIN
|
||||
check.add_theme_icon_override("unchecked", _blank_icon())
|
||||
row.add_child(check)
|
||||
var consent_text := RichTextLabel.new()
|
||||
@@ -365,7 +371,7 @@ func _add_legal_consent(parent: VBoxContainer) -> CheckBox:
|
||||
consent_text.meta_underlined = false
|
||||
consent_text.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
consent_text.add_theme_font_override("normal_font", Brand.font)
|
||||
consent_text.add_theme_font_size_override("normal_font_size", 15)
|
||||
consent_text.add_theme_font_size_override("normal_font_size", 13)
|
||||
consent_text.meta_clicked.connect(func(meta: Variant): _open_legal_document(str(meta)))
|
||||
legal_consent_texts.append(consent_text)
|
||||
row.add_child(consent_text)
|
||||
@@ -596,10 +602,13 @@ func _apply_theme() -> void:
|
||||
checkbox_box.border_color = Brand.SKY_BLUE if dark else Brand.ROYAL_BLUE
|
||||
checkbox_box.set_border_width_all(2)
|
||||
checkbox_box.set_corner_radius_all(6)
|
||||
checkbox_box.set_content_margin_all(0)
|
||||
for cb in find_children("*", "CheckBox", true, false):
|
||||
for state in ["normal", "hover", "pressed", "focus"]:
|
||||
cb.add_theme_stylebox_override(state, checkbox_box)
|
||||
for button in find_children("*", "Button", true, false):
|
||||
if button is CheckBox:
|
||||
continue
|
||||
var typed := button as Button
|
||||
typed.add_theme_font_override("font", Brand.font)
|
||||
typed.add_theme_color_override("font_color", Brand.text_color(dark))
|
||||
|
||||
Reference in New Issue
Block a user