From 19dcc3e33513be800f72efce80faece5bc21fc31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 20 Sep 2026 03:24:00 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20ui(settings):=20one=20plate=20he?= =?UTF-8?q?ight=20for=20every=20tab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rows area wore its content, so PROJECT's seven rows, EDITOR's five and EXPORT's four resized the centred plate on every tab switch. The area now has one fixed measure -- the tallest section's own (SETTINGS_ROWS_H, PROJECT's rows at CONTROL_H plus the gaps) -- a tab switch swaps the rows and the plate does not move; shorter sections leave air below their last row, and a short window still scrolls under the max_h cap. The modal geometry guard gains the fixed-height needle and counts PROJECT's rows out of the source to keep the constant honest. --- crates/app/src/tests/layout.rs | 30 ++++++++++++++++++++++++++++ crates/app/src/ui/settings_stance.rs | 13 +++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/crates/app/src/tests/layout.rs b/crates/app/src/tests/layout.rs index 1295713..b5ee76e 100644 --- a/crates/app/src/tests/layout.rs +++ b/crates/app/src/tests/layout.rs @@ -4144,6 +4144,36 @@ fn the_settings_page_is_a_centred_modal_with_one_column_of_measure() { column with its rows scrolling" ); } + // One measure for every tab (user 2026-09-20: "switching between them + // feels weird" -- the plate hugged its rows, so PROJECT's seven and + // EXPORT's four resized it under the hand). The rows area wears the + // tallest section's fixed height, and that height is PROJECT's own + // arithmetic: count the section's rows out of its body rather than + // trusting the constant's comment. + assert!( + body.contains(".h(px(SETTINGS_ROWS_H))"), + "the settings rows lost their fixed measure -- a tab switch resizes the plate again" + ); + let project = &source[source + .find("fn project_section(") + .expect("the PROJECT section")..]; + let project = &project[..project.find("\n}\n").map_or(project.len(), |at| at + 2)]; + let rows = [ + "row(", + "row_ink(", + "row_static(", + "row_keyed(", + "row_full(", + "row_chord(", + ] + .iter() + .map(|call| project.matches(call).count()) + .sum::(); + assert_eq!( + crate::ui::settings_stance::SETTINGS_ROWS_H, + rows as f32 * CONTROL_H + (rows - 1) as f32 * 2., + "SETTINGS_ROWS_H no longer measures the PROJECT section's {rows} rows" + ); assert!( body.contains("this.close_card()"), "the settings scrim swallows the press without closing the modal" diff --git a/crates/app/src/ui/settings_stance.rs b/crates/app/src/ui/settings_stance.rs index 8d471b4..0a7bea4 100644 --- a/crates/app/src/ui/settings_stance.rs +++ b/crates/app/src/ui/settings_stance.rs @@ -795,6 +795,14 @@ const SETTINGS_EDGE: f32 = 24.; /// strip and a row under it -- the rows scroll from there. const SETTINGS_MIN_H: f32 = 160.; +/// The rows' one measure, spent by every tab alike: the tallest section's own +/// height (PROJECT's seven rows at [`CONTROL_H`], the sections' 2px gaps +/// between them), so a tab switch swaps the rows and never resizes the plate +/// under the hand (user 2026-09-20: "switching between them feels weird"). A +/// shorter section leaves air below its last row; a short window still +/// scrolls, the plate's `max_h` cap shrinking this from `min_h(0)`. +pub(crate) const SETTINGS_ROWS_H: f32 = 7. * CONTROL_H + 6. * 2.; + /// The page itself: a centred modal card, closed by a click away or `esc` /// through [`Player::close_card`] like every other card here. /// @@ -913,10 +921,13 @@ pub(crate) fn render( // column that began mid-screen. The strip above is the way // between them; there is one section in the tree at a time, so // a row that is not showing cannot be reached by a tab stroke - // or by the pointer either. + // or by the pointer either. The area's height is the tallest + // section's own ([`SETTINGS_ROWS_H`]), so a tab switch swaps + // the rows and never resizes the plate under the hand. .child( div() .id("settings-rows") + .h(px(SETTINGS_ROWS_H)) .min_h(px(0.)) .overflow_y_scroll() .child(match player.settings_tab {