Center login panel content, pin legal links to the bottom
Making the auth panel a fixed height (to kill the scrollbar) left the shorter views (login, reset) stranded at the top with dead space below. Split panel_content into a main_column (header, message, mode views - expand-fill, center-aligned) and the legal footer as a sibling that stays pinned to the panel's bottom edge regardless of which view is showing or how tall its content is. Verified headlessly: top/bottom whitespace above and below the active view's content is now equal (e.g. login 174/174, steam 2/2), and the footer's position doesn't move between modes.
This commit is contained in:
@@ -196,16 +196,27 @@ func _build_ui() -> void:
|
||||
auth_panel.add_child(scroll)
|
||||
panel_gutter = MarginContainer.new()
|
||||
panel_gutter.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
panel_gutter.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
panel_gutter.add_theme_constant_override("margin_right", 28)
|
||||
scroll.add_child(panel_gutter)
|
||||
panel_content = VBoxContainer.new()
|
||||
panel_content.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
panel_content.add_theme_constant_override("separation", 16)
|
||||
panel_content.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
panel_content.add_theme_constant_override("separation", 24)
|
||||
panel_gutter.add_child(panel_content)
|
||||
|
||||
# main_column holds everything except the legal footer and is the part
|
||||
# that should center vertically when a view (e.g. login) is shorter than
|
||||
# the panel - the footer stays pinned to the very bottom either way.
|
||||
var main_column := VBoxContainer.new()
|
||||
main_column.size_flags_vertical = Control.SIZE_EXPAND_FILL
|
||||
main_column.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||
main_column.add_theme_constant_override("separation", 16)
|
||||
panel_content.add_child(main_column)
|
||||
|
||||
var panel_header := HBoxContainer.new()
|
||||
panel_header.add_theme_constant_override("separation", 18)
|
||||
panel_content.add_child(panel_header)
|
||||
main_column.add_child(panel_header)
|
||||
var small_icon := TextureRect.new()
|
||||
small_icon.texture = Brand.ranaze_mark_texture()
|
||||
small_icon.custom_minimum_size = Vector2(72, 72)
|
||||
@@ -229,14 +240,14 @@ func _build_ui() -> void:
|
||||
reset_view = _build_reset_view()
|
||||
steam_view = _build_steam_view()
|
||||
for view in [login_view, register_view, reset_view, steam_view]:
|
||||
panel_content.add_child(view)
|
||||
main_column.add_child(view)
|
||||
|
||||
message_label = Label.new()
|
||||
message_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
||||
message_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
||||
message_label.add_theme_font_size_override("font_size", 14)
|
||||
message_label.add_theme_font_override("font", Brand.font)
|
||||
panel_content.add_child(message_label)
|
||||
main_column.add_child(message_label)
|
||||
var legal_footer := HBoxContainer.new()
|
||||
legal_footer.alignment = BoxContainer.ALIGNMENT_CENTER
|
||||
legal_footer.add_theme_constant_override("separation", 12)
|
||||
|
||||
Reference in New Issue
Block a user