feat(m63-b): migrate the first-launch setup onto the shared chrome

This commit is contained in:
2026-09-14 02:33:04 +08:00
parent 9e4a58bd7f
commit 33de24bedc
+41 -34
View File
@@ -790,11 +790,13 @@ func show_first_launch() -> void:
first_launch_settings_panel.name = "FirstLaunchControls"
first_launch_settings_panel.mouse_filter = Control.MOUSE_FILTER_IGNORE
first_launch_responsive_layout.add_child(first_launch_settings_panel)
var controls_chrome := PageChrome.new().configure("card")
controls_chrome.name = "ControlsChrome"
controls_chrome.set_anchors_and_offsets_preset(Control.PRESET_FULL_RECT)
controls_chrome.mouse_filter = Control.MOUSE_FILTER_IGNORE
first_launch_settings_panel.add_child(controls_chrome)
# A full-height rolled card would squash the rows below the 48px touch
# contract, so the column keeps its original composition: heading and
# subheading on a shared header band, rows as shared command plates.
var controls_band := PageChrome.new().configure("header_band")
controls_band.name = "ControlsHeaderBand"
controls_band.mouse_filter = Control.MOUSE_FILTER_IGNORE
first_launch_settings_panel.add_child(controls_band)
var heading := _label(_tr("首次启动设置", "FIRST-LAUNCH SETUP"), UITokens.font_size("heading", _entry_text_scale()), PageChrome.INK)
heading.name = "FirstLaunchHeading"
first_launch_settings_panel.add_child(heading)
@@ -882,47 +884,49 @@ func _layout_first_launch() -> void:
preview_detail.size = detail_plate_rect.size - Vector2(92.0, 4.0)
first_launch_settings_panel.position = Vector2(preview_x + preview_width + gap, safe_y)
first_launch_settings_panel.size = Vector2(settings_width, content_height)
# Controls card opening: heading, rows and the apply command all stay on
# the parchment face between the rolled edges.
var panel_inset_x := settings_width * PageChrome.PANEL_EDGE_X + 8.0
var panel_inset_y := content_height * PageChrome.PANEL_EDGE_Y + 8.0
var controls_inner_width := settings_width - panel_inset_x * 2.0
# Header band opening: the heading block sits on the band face.
var band_height := clampf(content_height * 0.19, 86.0, 132.0)
var band_inset_x := settings_width * PageChrome.PANEL_EDGE_X + 8.0
var band_inset_y := band_height * PageChrome.PANEL_EDGE_Y + 4.0
var controls_inner_width := settings_width - band_inset_x * 2.0
var controls_band := first_launch_settings_panel.get_node("ControlsHeaderBand") as Control
controls_band.position = Vector2(0.0, 0.0)
controls_band.size = Vector2(settings_width, band_height)
var heading := first_launch_settings_panel.get_node("FirstLaunchHeading") as Label
heading.position = Vector2(panel_inset_x, panel_inset_y * 0.55)
heading.size = Vector2(controls_inner_width, maxf(28.0, panel_inset_y * 0.55))
heading.position = Vector2(band_inset_x, band_inset_y)
heading.size = Vector2(controls_inner_width, maxf(28.0, band_height * 0.42))
var subheading := first_launch_settings_panel.get_node("FirstLaunchSubheading") as Label
subheading.position = Vector2(panel_inset_x, heading.position.y + heading.size.y)
subheading.size = Vector2(controls_inner_width, maxf(24.0, panel_inset_y * 0.42))
var row_y := subheading.position.y + subheading.size.y + 8.0
subheading.position = Vector2(band_inset_x, heading.position.y + heading.size.y)
subheading.size = Vector2(controls_inner_width, maxf(22.0, band_height * 0.30))
var panel_inset_x := 0.0
var row_y := band_height + 8.0
var row_gap := 6.0 if available.y >= 420.0 else 4.0
var row_height := clampf(
(content_height - row_y - panel_inset_y * 1.6 - 58.0 - row_gap * 5.0) / 6.0,
44.0,
68.0
)
var row_height := clampf((content_height - row_y - 58.0 - row_gap * 5.0) / 6.0, 48.0, 68.0)
var row_names := ["SetupLanguage", "SetupSafeArea", "SetupTextScale", "SetupReducedMotion", "SetupReducedFlashes", "SetupCaptions"]
var compact_columns := available.y < 400.0
if compact_columns:
row_height = 48.0
var compact_width := (controls_inner_width - row_gap) * 0.5
var compact_width := (settings_width - row_gap) * 0.5
for index in range(row_names.size()):
var compact_row := first_launch_setting_buttons[row_names[index]] as Button
compact_row.position = Vector2(panel_inset_x + (index % 2) * (compact_width + row_gap), row_y + floori(index / 2.0) * (row_height + row_gap))
compact_row.position = Vector2((index % 2) * (compact_width + row_gap), row_y + floori(index / 2.0) * (row_height + row_gap))
compact_row.size = Vector2(compact_width, row_height)
_layout_first_setting_row(compact_row)
row_y += 3.0 * (row_height + row_gap)
else:
for row_data in row_names:
var row := first_launch_setting_buttons[row_data] as Button
row.position = Vector2(panel_inset_x, row_y)
row.size = Vector2(controls_inner_width, row_height)
row.position = Vector2(0.0, row_y)
row.size = Vector2(settings_width, row_height)
_layout_first_setting_row(row)
row_y += row_height + row_gap
var apply_y := minf(row_y + 6.0, content_height - panel_inset_y - 58.0)
first_launch_apply.position = Vector2(panel_inset_x, apply_y)
first_launch_apply.size = Vector2(controls_inner_width, 58.0)
first_launch_error.position = Vector2(panel_inset_x, apply_y + 60.0)
first_launch_error.size = Vector2(controls_inner_width, maxf(18.0, content_height - panel_inset_y - first_launch_error.position.y))
var apply_y := minf(row_y + 6.0, content_height - 58.0)
first_launch_apply.position = Vector2(0.0, apply_y)
first_launch_apply.size = Vector2(settings_width, 58.0)
# The failure line only appears on a rejected apply; keep it inside the
# column even when the compact rows fill the height.
first_launch_error.position = Vector2(0.0, minf(apply_y + 60.0, maxf(0.0, content_height - 19.0)))
first_launch_error.size = Vector2(settings_width, 18.0)
func _refresh_first_launch_labels() -> void:
@@ -1021,12 +1025,15 @@ func _layout_first_setting_row(button: Button) -> void:
# shrink the badge/chip and let the label wrap to two micro lines so every
# shipped name stays complete.
var compact_row := row_size.x < 220.0
var icon_size := clampf(row_size.y - 12.0, 24.0 if compact_row else 32.0, 54.0)
var value_width := clampf(row_size.x * (0.26 if compact_row else 0.30), 48.0 if compact_row else 68.0, 132.0)
icon.position = Vector2(6.0, (row_size.y - icon_size) * 0.5)
# Badge and value chip live on the plate face: inset by the shared plate's
# measured rolled edge so nothing is painted over the decorative border.
var plate_inset := row_size.x * PageChrome.PLATE_EDGE_X + 4.0
var icon_size := clampf(row_size.y - 14.0, 24.0 if compact_row else 30.0, 52.0)
var value_width := clampf(row_size.x * (0.26 if compact_row else 0.30), 46.0 if compact_row else 68.0, 132.0)
icon.position = Vector2(plate_inset, (row_size.y - icon_size) * 0.5)
icon.size = Vector2(icon_size, icon_size)
var value_height := maxf(28.0, row_size.y - 12.0)
value_plate.position = Vector2(row_size.x - value_width - 6.0, (row_size.y - value_height) * 0.5)
var value_height := maxf(28.0, row_size.y - 14.0)
value_plate.position = Vector2(row_size.x - value_width - plate_inset, (row_size.y - value_height) * 0.5)
value_plate.size = Vector2(value_width, value_height)
label.position = Vector2(icon.position.x + icon_size + 5.0, 0.0)
label.size = Vector2(maxf(24.0, value_plate.position.x - label.position.x - 4.0), row_size.y)