forge
Explore
Log in

Don't you dare go Hollow

One plate height for every tab

Browse files at this commit

19dcc3e33513be800f72efce80faece5bc21fc31Ahmet Kaan GümüşParent: 9085e57
  • ui
    • one plate height for every tab
Show full message
💄 ui(settings): one plate height for every tab

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.rsmodified+30 -0
@@ -4144,6 +4144,36 @@ fn the_settings_page_is_a_centred_modal_with_one_column_of_measure() {
41444144 column with its rows scrolling"
41454145 );
41464146 }
4147+ // One measure for every tab (user 2026-09-20: "switching between them
4148+ // feels weird" -- the plate hugged its rows, so PROJECT's seven and
4149+ // EXPORT's four resized it under the hand). The rows area wears the
4150+ // tallest section's fixed height, and that height is PROJECT's own
4151+ // arithmetic: count the section's rows out of its body rather than
4152+ // trusting the constant's comment.
4153+ assert!(
4154+ body.contains(".h(px(SETTINGS_ROWS_H))"),
4155+ "the settings rows lost their fixed measure -- a tab switch resizes the plate again"
4156+ );
4157+ let project = &source[source
4158+ .find("fn project_section(")
4159+ .expect("the PROJECT section")..];
4160+ let project = &project[..project.find("\n}\n").map_or(project.len(), |at| at + 2)];
4161+ let rows = [
4162+ "row(",
4163+ "row_ink(",
4164+ "row_static(",
4165+ "row_keyed(",
4166+ "row_full(",
4167+ "row_chord(",
4168+ ]
4169+ .iter()
4170+ .map(|call| project.matches(call).count())
4171+ .sum::<usize>();
4172+ assert_eq!(
4173+ crate::ui::settings_stance::SETTINGS_ROWS_H,
4174+ rows as f32 * CONTROL_H + (rows - 1) as f32 * 2.,
4175+ "SETTINGS_ROWS_H no longer measures the PROJECT section's {rows} rows"
4176+ );
41474177 assert!(
41484178 body.contains("this.close_card()"),
41494179 "the settings scrim swallows the press without closing the modal"
crates/app/src/ui/settings_stance.rsmodified+12 -1
@@ -795,6 +795,14 @@ const SETTINGS_EDGE: f32 = 24.;
795795 /// strip and a row under it -- the rows scroll from there.
796796 const SETTINGS_MIN_H: f32 = 160.;
797797
798+/// The rows' one measure, spent by every tab alike: the tallest section's own
799+/// height (PROJECT's seven rows at [`CONTROL_H`], the sections' 2px gaps
800+/// between them), so a tab switch swaps the rows and never resizes the plate
801+/// under the hand (user 2026-09-20: "switching between them feels weird"). A
802+/// shorter section leaves air below its last row; a short window still
803+/// scrolls, the plate's `max_h` cap shrinking this from `min_h(0)`.
804+pub(crate) const SETTINGS_ROWS_H: f32 = 7. * CONTROL_H + 6. * 2.;
805+
798806 /// The page itself: a centred modal card, closed by a click away or `esc`
799807 /// through [`Player::close_card`] like every other card here.
800808 ///
@@ -913,10 +921,13 @@ pub(crate) fn render(
913921 // column that began mid-screen. The strip above is the way
914922 // between them; there is one section in the tree at a time, so
915923 // a row that is not showing cannot be reached by a tab stroke
916- // or by the pointer either.
924+ // or by the pointer either. The area's height is the tallest
925+ // section's own ([`SETTINGS_ROWS_H`]), so a tab switch swaps
926+ // the rows and never resizes the plate under the hand.
917927 .child(
918928 div()
919929 .id("settings-rows")
930+ .h(px(SETTINGS_ROWS_H))
920931 .min_h(px(0.))
921932 .overflow_y_scroll()
922933 .child(match player.settings_tab {