One plate height for every tab
Browse files at this commit19dcc3e33513be800f72efce80faece5bc21fc31Parent: 9085e57- ui
- one plate height for every tab
2 changed files +42 -1
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() { | ||
| 4144 | 4144 | column with its rows scrolling" |
| 4145 | 4145 | ); |
| 4146 | 4146 | } |
| 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 | + ); | |
| 4147 | 4177 | assert!( |
| 4148 | 4178 | body.contains("this.close_card()"), |
| 4149 | 4179 | "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.; | ||
| 795 | 795 | /// strip and a row under it -- the rows scroll from there. |
| 796 | 796 | const SETTINGS_MIN_H: f32 = 160.; |
| 797 | 797 | |
| 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 | + | |
| 798 | 806 | /// The page itself: a centred modal card, closed by a click away or `esc` |
| 799 | 807 | /// through [`Player::close_card`] like every other card here. |
| 800 | 808 | /// |
| @@ -913,10 +921,13 @@ pub(crate) fn render( | ||
| 913 | 921 | // column that began mid-screen. The strip above is the way |
| 914 | 922 | // between them; there is one section in the tree at a time, so |
| 915 | 923 | // 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. | |
| 917 | 927 | .child( |
| 918 | 928 | div() |
| 919 | 929 | .id("settings-rows") |
| 930 | + .h(px(SETTINGS_ROWS_H)) | |
| 920 | 931 | .min_h(px(0.)) |
| 921 | 932 | .overflow_y_scroll() |
| 922 | 933 | .child(match player.settings_tab { |