From c5d33dcd8d544a12db8c4068fa46ce7d240e50ae Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 24 Nov 2026 18:13:22 +0700 Subject: [PATCH] Give the compact size set the reference app's control heights, panel padding, row gap, type sizes and corners --- crates/ui-egui/src/chrome/tests.rs | 2 +- crates/ui-egui/src/panels/tests_effectedit.rs | 2 +- crates/ui-egui/src/theme.rs | 25 +++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/chrome/tests.rs b/crates/ui-egui/src/chrome/tests.rs index 47d586032c..acc0ecf522 100644 --- a/crates/ui-egui/src/chrome/tests.rs +++ b/crates/ui-egui/src/chrome/tests.rs @@ -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. diff --git a/crates/ui-egui/src/panels/tests_effectedit.rs b/crates/ui-egui/src/panels/tests_effectedit.rs index da830e84da..3d2a921678 100644 --- a/crates/ui-egui/src/panels/tests_effectedit.rs +++ b/crates/ui-egui/src/panels/tests_effectedit.rs @@ -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| fx.into_iter().map(|e| e.id).collect::>(); // 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); diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index ec57a09dea..266c01bc42 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -146,8 +146,29 @@ pub fn root_theme(prefs: &Prefs) -> (ThemeId, ModeChoice, Option) { } /// 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.