From 745a0d5b7b977defdd49fb23d056b2ff14ed2a29 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 28 Nov 2026 09:26:23 -0800 Subject: [PATCH] UI: canvas chrome clears the scroll bar and the empty navigator - The Rotate View compass of a turned view sits left of the vertical scroll bar. It was placed in the canvas's top right corner, where the scroll bar drew over most of it. - With no document open, the status bar's artboard navigator shows a dash instead of an empty box. --- crates/ui-egui/src/canvas.rs | 13 ++++++++++++- crates/ui-egui/src/chrome/status_bar.rs | 20 ++++++++++++++++++-- crates/ui-egui/src/tests/rotateview.rs | 20 ++++++++++++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index cb9ab68bd1..2efe7e984a 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -395,7 +395,7 @@ fn compass(app: &VectorcraftApp, ui: &mut Ui, space: &CanvasSpace) -> Option Option egui::Rect { + if app.ui.screen_mode >= 2 { + return rect; + } + let env = Env::of(ui); + let strip = env.tokens.size.icon.md + env.tokens.space.gap.tight; + egui::Rect::from_min_max(rect.min, egui::pos2((rect.right() - strip).max(rect.left()), rect.bottom())) +} + /// The scroll bars along the right and bottom edges (Normal and Full Screen with Menu Bar): the view /// a thumb drag or page press moved. fn scroll_bars(app: &mut VectorcraftApp, ui: &mut Ui, space: &CanvasSpace) -> Option { diff --git a/crates/ui-egui/src/chrome/status_bar.rs b/crates/ui-egui/src/chrome/status_bar.rs index 460a6ed51f..9848d86f1a 100644 --- a/crates/ui-egui/src/chrome/status_bar.rs +++ b/crates/ui-egui/src/chrome/status_bar.rs @@ -120,8 +120,15 @@ pub fn status_bar(app: &mut VectorcraftApp, ui: &mut Ui) { } } Field::new(tl!("Artboard")).side(SideLabel::new().kind(LabelKind::Hidden)).show(ui, |ui, _| { - if let Some(i) = - Select::new(tl!("Artboard"), Bind::given(cur), &boards).look(SelectLook::Filled).enabled(nab > 0).show(ui).events.committed().copied() + // With no document the navigator shows a dash, as the info readout does. + if let Some(i) = Select::new(tl!("Artboard"), Bind::given(cur), &boards) + .placeholder("\u{2013}") + .look(SelectLook::Filled) + .enabled(nab > 0) + .show(ui) + .events + .committed() + .copied() { go = Some(json!(i)); } @@ -264,6 +271,15 @@ mod tests { assert_eq!(app.session.active().unwrap().history.undo.len(), undo); } } + + #[test] + fn with_no_document_the_artboard_navigator_shows_a_dash() { + let app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let mut panel = Panel::new(app, status_bar); + panel.room(egui::vec2(1200.0, 300.0)); + panel.frame(); + assert_eq!(panel.value_role("Artboard", Role::COMBO_BOX).as_deref(), Some("\u{2013}"), "the empty navigator reads as a dash"); + } } /// What the bar shows as work in progress: the running script, then background jobs, opens and places. The first diff --git a/crates/ui-egui/src/tests/rotateview.rs b/crates/ui-egui/src/tests/rotateview.rs index 03ae5cc7a9..fdf58bcdcb 100644 --- a/crates/ui-egui/src/tests/rotateview.rs +++ b/crates/ui-egui/src/tests/rotateview.rs @@ -318,6 +318,26 @@ fn rotate_view_to_selection_squares_the_view_to_the_selected_object() { assert!(square_on_screen(&app)); } +/// The Rotate View compass of a turned view sits clear of the vertical scroll bar, so the bar does not cover it. +#[test] +fn the_rotate_view_compass_is_clear_of_the_vertical_scroll_bar() { + let mut w = Window::new(); + w.ctx.enable_accesskit(); + w.after(0.0, vec![]); + let out = w.after(0.0, vec![]); + let nodes = out.platform_output.accesskit_update.as_ref().map_or(&[][..], |u| &u.nodes[..]); + let bounds = |label: &str| { + nodes + .iter() + .find(|(_, n)| n.label() == Some(label)) + .and_then(|(_, n)| n.bounds()) + .map(|b| egui::Rect::from_min_max(egui::pos2(b.x0 as f32, b.y0 as f32), egui::pos2(b.x1 as f32, b.y1 as f32))) + .unwrap_or_else(|| panic!("no {label} in the access tree")) + }; + let (compass, bar) = (bounds("Rotation compass"), bounds("Vertical scroll bar")); + assert!(compass.right() <= bar.left(), "the compass {compass:?} reaches under the scroll bar {bar:?}"); +} + /// The window, with a 400 × 300 document whose view is turned to 30°, and the Selection tool. Each /// frame comes the given number of seconds, zero or more, after the one before it. struct Window {