Give the compact size set the reference app's control heights, panel padding, row gap, type sizes and corners

This commit is contained in:
bflatastic
2026-11-24 18:13:22 +07:00
parent 4fbca02f5b
commit c5d33dcd8d
3 changed files with 25 additions and 4 deletions
+1 -1
View File
@@ -2458,7 +2458,7 @@ fn label_links_open_their_panels() {
app.run("window.panel", json!({"panel": links})).unwrap();
app.run("window.panel.dock", json!({"panel": links, "onto": "layers"})).unwrap();
let mut bar = control_shown(app);
bar.room(egui::vec2(2000.0, 600.0));
bar.room(egui::vec2(2400.0, 600.0));
// Closes the Links panel, clicks `name` on the bar and answers whether the panel shows.
let click = |bar: &mut Shown, name: &str| {
// Closing a panel that is already closed is an error that changes nothing.
@@ -134,7 +134,7 @@ fn effect_rows_drag_to_reorder_and_into_an_item() {
let mut panel = Panel::new(app, appearance::show);
let ids = |fx: Vec<vectorcraft_doc::Effect>| fx.into_iter().map(|e| e.id).collect::<Vec<_>>();
// Twist below Roughen: dropped on the lower half of its row.
let (twist, below) = (row_spot(&mut panel, "Twist"), row_spot(&mut panel, "Roughen") + egui::vec2(0.0, 6.0));
let (twist, below) = (row_spot(&mut panel, "Twist"), row_spot(&mut panel, "Roughen") + egui::vec2(0.0, 9.0));
panel.drag_between(twist, below, egui::Modifiers::NONE);
assert_eq!(ids(effects(&panel.app(), None)), ["distort.roughen", "distort.twist"]);
drag_row(&mut panel, "Twist", "Stroke:", egui::Modifiers::ALT);
+23 -2
View File
@@ -146,8 +146,29 @@ pub fn root_theme(prefs: &Prefs) -> (ThemeId, ModeChoice, Option<Rgba>) {
}
/// The app's sizes over the framework's size sets (`sizes.json`): push buttons have the app's 4-point corners
/// where the sets give pills.
const SIZES: &[u8] = br#"{"all": {"radius.button": 4}}"#;
/// where the sets give pills, and the compact set takes the reference app's metrics: 26-point fields and spinners,
/// 10 points inside panels, 5 between rows, 13-point body type with 12.5-point labels and 11-point captions, 5-point
/// control corners, 8-point menus and 10-point windows, and 33-point panel tabs.
const SIZES: &[u8] = br#"{
"all": {"radius.button": 4},
"compact": {
"size.control.md": 26,
"size.panel_header": 33,
"space.pad.regular": 10,
"space.gap.row": 5,
"radius.control": 5,
"radius.surface": 8,
"radius.window": 10,
"typography.body.size": 13,
"typography.body.line_height": 17,
"typography.body_strong.size": 13,
"typography.body_strong.line_height": 17,
"typography.label.size": 12.5,
"typography.label.line_height": 17,
"typography.caption.size": 11,
"typography.caption.line_height": 15
}
}"#;
/// The app's sizes ([`SIZES`]) as one shared value: the token cache tells a change of sizes by its pointer, so a
/// new value each frame would resolve the tokens again each frame.