From 740b04cde0bab8b78449c06d61bc5426fabd65ca Mon Sep 17 00:00:00 2001 From: Fredrik Hallin Date: Sun, 29 Nov 2026 18:54:50 +0100 Subject: [PATCH 1/6] CI: use the standard macOS runner for releases --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 226830fc1b..538d09cc31 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,6 +42,7 @@ jobs: dry-run: ${{ github.event_name == 'schedule' }} app-name: vectorcraft app-title: VectorCraft + macos-runner: macos-15 craft-fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 web-craft-fonts: true version: ${{ inputs.version }} From a17883546e75e8e63f115b51d8a385597e932e08 Mon Sep 17 00:00:00 2001 From: Fredrik Hallin Date: Sun, 29 Nov 2026 18:58:59 +0100 Subject: [PATCH 2/6] Release: VectorCraft v0.25.0 Ship the drawing, text, import/export and editing fixes merged since 0.24.1. --- Cargo.lock | 120 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4da7886c88..b6394fde6b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8515,7 +8515,7 @@ dependencies = [ [[package]] name = "vectorcraft" -version = "0.24.1" +version = "0.25.0" dependencies = [ "arboard", "block2 0.6.2", @@ -8559,7 +8559,7 @@ dependencies = [ [[package]] name = "vectorcraft-affinity" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-affinity", "craft-image-codecs", @@ -8570,26 +8570,26 @@ dependencies = [ [[package]] name = "vectorcraft-apischema" -version = "0.24.1" +version = "0.25.0" dependencies = [ "serde_json", ] [[package]] name = "vectorcraft-brush" -version = "0.24.1" +version = "0.25.0" dependencies = [ "kurbo 0.13.1", "serde", "serde_json", "vectorcraft-color", "vectorcraft-doc", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", ] [[package]] name = "vectorcraft-cad" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-dxf", "craft-image-codecs", @@ -8601,14 +8601,14 @@ dependencies = [ "vectorcraft-color", "vectorcraft-doc", "vectorcraft-effects", - "vectorcraft-geom 0.24.1", - "vectorcraft-pathops 0.24.1", + "vectorcraft-geom 0.25.0", + "vectorcraft-pathops 0.25.0", "vectorcraft-text", ] [[package]] name = "vectorcraft-cli" -version = "0.24.1" +version = "0.25.0" dependencies = [ "log", "objc2-core-foundation", @@ -8619,7 +8619,7 @@ dependencies = [ "vectorcraft-doc", "vectorcraft-engine", "vectorcraft-format", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-mcp", "vectorcraft-render", "vectorcraft-svg", @@ -8631,7 +8631,7 @@ dependencies = [ [[package]] name = "vectorcraft-color" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-cms", "craft-color-ui", @@ -8647,7 +8647,7 @@ dependencies = [ [[package]] name = "vectorcraft-doc" -version = "0.24.1" +version = "0.25.0" dependencies = [ "chrono", "craft-image-codecs", @@ -8663,13 +8663,13 @@ dependencies = [ "thiserror 2.0.21", "tiff", "vectorcraft-color", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "zune-jpeg", ] [[package]] name = "vectorcraft-effects" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-image-codecs", "craft-svg", @@ -8679,8 +8679,8 @@ dependencies = [ "svgtypes 0.16.1", "vectorcraft-color", "vectorcraft-doc", - "vectorcraft-geom 0.24.1", - "vectorcraft-pathops 0.24.1", + "vectorcraft-geom 0.25.0", + "vectorcraft-pathops 0.25.0", "vectorcraft-plugins", "vectorcraft-text", "vectorcraft-three-d", @@ -8690,7 +8690,7 @@ dependencies = [ [[package]] name = "vectorcraft-engine" -version = "0.24.1" +version = "0.25.0" dependencies = [ "apple-native-keyring-store", "cfb", @@ -8737,10 +8737,10 @@ dependencies = [ "vectorcraft-doc", "vectorcraft-eps", "vectorcraft-format", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-js", "vectorcraft-metafile", - "vectorcraft-pathops 0.24.1", + "vectorcraft-pathops 0.25.0", "vectorcraft-pdf", "vectorcraft-plugins", "vectorcraft-render", @@ -8760,7 +8760,7 @@ dependencies = [ [[package]] name = "vectorcraft-eps" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-eps", "craft-image-codecs", @@ -8781,9 +8781,9 @@ dependencies = [ "vectorcraft-doc", "vectorcraft-effects", "vectorcraft-eps", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-metafile", - "vectorcraft-pathops 0.24.1", + "vectorcraft-pathops 0.25.0", "vectorcraft-pdf", "vectorcraft-render", "vectorcraft-testkit", @@ -8792,7 +8792,7 @@ dependencies = [ [[package]] name = "vectorcraft-format" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-gzip", "craft-vectorcraft-format", @@ -8804,7 +8804,7 @@ dependencies = [ "thiserror 2.0.21", "vectorcraft-brush", "vectorcraft-doc", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-testkit", ] @@ -8820,7 +8820,7 @@ dependencies = [ [[package]] name = "vectorcraft-geom" -version = "0.24.1" +version = "0.25.0" dependencies = [ "kurbo 0.13.1", "proptest", @@ -8831,7 +8831,7 @@ dependencies = [ [[package]] name = "vectorcraft-js" -version = "0.24.1" +version = "0.25.0" dependencies = [ "chrono", "craft-xml", @@ -8842,7 +8842,7 @@ dependencies = [ [[package]] name = "vectorcraft-mcp" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft", "craft-image-codecs", @@ -8854,7 +8854,7 @@ dependencies = [ "vectorcraft-doc", "vectorcraft-engine", "vectorcraft-format", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-render", "vectorcraft-svg", "vectorcraft-testkit", @@ -8863,7 +8863,7 @@ dependencies = [ [[package]] name = "vectorcraft-metafile" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-image-codecs", "craft-metafile", @@ -8873,7 +8873,7 @@ dependencies = [ "vectorcraft-color", "vectorcraft-doc", "vectorcraft-effects", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-text", ] @@ -8890,19 +8890,19 @@ dependencies = [ [[package]] name = "vectorcraft-pathops" -version = "0.24.1" +version = "0.25.0" dependencies = [ "kurbo 0.13.1", "linesweeper", "proptest", "thiserror 2.0.21", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-testkit", ] [[package]] name = "vectorcraft-pdf" -version = "0.24.1" +version = "0.25.0" dependencies = [ "aes 0.8.4", "chrono", @@ -8931,7 +8931,7 @@ dependencies = [ "vectorcraft-color", "vectorcraft-doc", "vectorcraft-effects", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-pdf", "vectorcraft-testkit", "vectorcraft-text", @@ -8939,7 +8939,7 @@ dependencies = [ [[package]] name = "vectorcraft-plugin-worker" -version = "0.24.1" +version = "0.25.0" dependencies = [ "js-sys", "vectorcraft-plugins", @@ -8949,7 +8949,7 @@ dependencies = [ [[package]] name = "vectorcraft-plugins" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-image-codecs", "craft-vectorcraft-format", @@ -8961,7 +8961,7 @@ dependencies = [ "thiserror 2.0.21", "vectorcraft-color", "vectorcraft-doc", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-js", "vectorcraft-plugins", "wasmi", @@ -8972,7 +8972,7 @@ dependencies = [ [[package]] name = "vectorcraft-render" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-gif", "craft-image-codecs", @@ -8990,7 +8990,7 @@ dependencies = [ "vectorcraft-color", "vectorcraft-doc", "vectorcraft-effects", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-plugins", "vectorcraft-testkit", "vectorcraft-text", @@ -9003,7 +9003,7 @@ dependencies = [ [[package]] name = "vectorcraft-scriptcheck" -version = "0.24.1" +version = "0.25.0" dependencies = [ "proptest", "unicode-properties", @@ -9011,7 +9011,7 @@ dependencies = [ [[package]] name = "vectorcraft-svg" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-docpath", "craft-image-codecs", @@ -9035,15 +9035,15 @@ dependencies = [ "vectorcraft-color", "vectorcraft-doc", "vectorcraft-effects", - "vectorcraft-geom 0.24.1", - "vectorcraft-pathops 0.24.1", + "vectorcraft-geom 0.25.0", + "vectorcraft-pathops 0.25.0", "vectorcraft-testkit", "vectorcraft-text", ] [[package]] name = "vectorcraft-testkit" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-image-codecs", "fax", @@ -9054,14 +9054,14 @@ dependencies = [ "vectorcraft-doc", "vectorcraft-engine", "vectorcraft-format", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-render", "vectorcraft-svg", ] [[package]] name = "vectorcraft-text" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft", "craft-fonts-build", @@ -9079,23 +9079,23 @@ dependencies = [ "unicode-script", "unicode-segmentation", "vectorcraft-doc", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vello_cpu", "write-fonts", ] [[package]] name = "vectorcraft-three-d" -version = "0.24.1" +version = "0.25.0" dependencies = [ "proptest", - "vectorcraft-geom 0.24.1", - "vectorcraft-pathops 0.24.1", + "vectorcraft-geom 0.25.0", + "vectorcraft-pathops 0.25.0", ] [[package]] name = "vectorcraft-thumbnail-handler" -version = "0.24.1" +version = "0.25.0" dependencies = [ "png 0.18.1", "windows", @@ -9104,7 +9104,7 @@ dependencies = [ [[package]] name = "vectorcraft-tools" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-image-codecs", "kurbo 0.13.1", @@ -9114,15 +9114,15 @@ dependencies = [ "vectorcraft-color", "vectorcraft-doc", "vectorcraft-effects", - "vectorcraft-geom 0.24.1", - "vectorcraft-pathops 0.24.1", + "vectorcraft-geom 0.25.0", + "vectorcraft-pathops 0.25.0", "vectorcraft-text", "vectorcraft-tools", ] [[package]] name = "vectorcraft-trace" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft-image-codecs", "image", @@ -9130,12 +9130,12 @@ dependencies = [ "serde", "serde_json", "thiserror 2.0.21", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", ] [[package]] name = "vectorcraft-ui-egui" -version = "0.24.1" +version = "0.25.0" dependencies = [ "bytemuck", "chrono", @@ -9159,7 +9159,7 @@ dependencies = [ "vectorcraft-engine", "vectorcraft-eps", "vectorcraft-format", - "vectorcraft-geom 0.24.1", + "vectorcraft-geom 0.25.0", "vectorcraft-pdf", "vectorcraft-plugins", "vectorcraft-render", @@ -9174,7 +9174,7 @@ dependencies = [ [[package]] name = "vectorcraft-web" -version = "0.24.1" +version = "0.25.0" dependencies = [ "craft", "craft-web-api", @@ -10403,7 +10403,7 @@ checksum = "9440ea3e5aeabb0ac63af70daf835274065238cdd0cec83418f417eae38bacee" [[package]] name = "xtask" -version = "0.24.1" +version = "0.25.0" dependencies = [ "serde_json", ] diff --git a/Cargo.toml b/Cargo.toml index d3057fb0af..1a611b41e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = ["crates/*", "apps/*", "xtask"] default-members = ["crates/*", "apps/vectorcraft", "apps/vectorcraft-cli", "xtask"] [workspace.package] -version = "0.24.1" +version = "0.25.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" From c31cef119901acf0df8201107d1734f5109c9d55 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 10:12:18 -0800 Subject: [PATCH 3/6] Tools: the controls under the tools scroll with them in a short window In a window too short for every tool, the Tools panel kept its paint chips, drawing modes and the other controls under the tools pinned at the bottom, so fewer tools were in view. The controls now scroll with the tools (ToolRail::footer_scrolls): in a window 560 points tall the rail shows 14 tools instead of 10, and scrolling to the end brings the controls into view under the last tool. Toolbars made with New Toolbar and torn-off strips keep their footer in view. --- crates/ui-egui/src/toolbar.rs | 4 +++ crates/ui-egui/src/toolbar/tests.rs | 49 ++++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 6f2f72d06a..65c1aadc35 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -456,6 +456,10 @@ fn show_rail(app: &mut VectorcraftApp, ui: &mut Ui, owner: Owner, at: GroupAt, m if app.session.prefs.tool_group_labels { rail = rail.captions(); } + // The Tools panel's controls under the tools scroll with them, so a short window shows more tools. + if tools_panel { + rail = rail.footer_scrolls(); + } if own_bar { rail = rail.tear_off().edit_toolbar(tl!("Edit Toolbar")); } diff --git a/crates/ui-egui/src/toolbar/tests.rs b/crates/ui-egui/src/toolbar/tests.rs index 9ce6cca2e6..75dfeb327c 100644 --- a/crates/ui-egui/src/toolbar/tests.rs +++ b/crates/ui-egui/src/toolbar/tests.rs @@ -282,17 +282,18 @@ fn polygon_and_star_canvas_counts_persist_without_new_toolbar_dialogs() { /// The paint chips, drawing modes and the rest of the footer lie inside the rail at one and at two columns (one column /// shows the current drawing mode alone), and in two columns the three drawing modes sit side by side, each setting -/// its mode (#1129). +/// its mode (#1129). The window is tall enough for every tool and the controls under them, which scroll with the tools. #[test] fn the_paint_and_drawing_mode_buttons_fit_the_toolbar_width() { let mut app = app_with(200, 200); let ctx = reader(); + let height = 2000.0; let footer = ["Color (, or Shift+,)", "Gradient (. or Shift+.)", "None (/)", "Draw Normal (Shift+D)", "Draw Behind (Shift+D)", "Draw Inside (Shift+D)"]; let mut nodes = vec![]; for (k, double) in [false, true].into_iter().enumerate() { app.run("window.toolbarColumns", json!({ "double": double })).unwrap(); - nodes = settled(&mut app, &ctx, k as f64 * 10.0, 900.0); + nodes = settled(&mut app, &ctx, k as f64 * 10.0, height); // The rail itself, not its dock grip, which is named for the pane too. let rail = nodes.iter().find(|n| n.role() == Role::Toolbar && n.label() == Some("Tools")).and_then(bounds).expect("the rail is drawn"); for label in &footer[..if double { 6 } else { 4 }] { @@ -302,13 +303,12 @@ fn the_paint_and_drawing_mode_buttons_fit_the_toolbar_width() { } let modes = ["Draw Normal (Shift+D)", "Draw Behind (Shift+D)", "Draw Inside (Shift+D)"].map(|label| named_rect(&nodes, label)); assert!(modes.iter().all(|r| (r.top() - modes[0].top()).abs() < 0.5), "side by side: {modes:?}"); - click(&mut app, &ctx, 20.0, modes[1].center(), 900.0); + click(&mut app, &ctx, 20.0, modes[1].center(), height); assert_eq!(app.session.draw_mode, vectorcraft_engine::DrawMode::Behind); } /// In one column the Color, Gradient and None chips share one line, and a rule across the rail parts the controls under -/// the tools from the tools, which scroll above them in a short rail: it lies between the last tool and Fill and -/// Stroke. +/// the tools from the tools: it lies between the last tool and Fill and Stroke. #[test] fn the_controls_under_the_tools_share_a_line_under_a_rule() { let mut app = app_with(200, 200); @@ -604,3 +604,42 @@ fn a_short_tools_rail_shows_its_scroll_bar_at_rest() { assert!(bars(&mut app, 0.0, 400.0) > 0, "a short rail shows its scroll bar with the pointer away"); assert_eq!(bars(&mut app, 10.0, 2000.0), 0, "a rail with room for every tool shows no scroll bar"); } + +/// In a window too short for the Tools panel, the controls under the tools scroll with them: the tool buttons fill +/// the rail down to its bottom edge, Fill and Stroke starts out of view under them, and scrolling to the end brings +/// Fill and Stroke into view under the last tool. +#[test] +fn the_tools_panel_controls_scroll_with_the_tools_in_a_short_window() { + let mut app = app_with(200, 200); + let ctx = reader(); + app.run("window.toolbarColumns", json!({ "double": false })).unwrap(); + let height = 560.0; + let nodes = settled(&mut app, &ctx, 0.0, height); + let rail = nodes.iter().find(|n| n.role() == Role::Toolbar && n.label() == Some("Tools")).and_then(bounds).expect("the rail is drawn"); + let tools = cells(&app, &nodes); + let in_view: Vec<&egui::Rect> = tools.iter().filter(|r| r.bottom() <= rail.bottom() + 0.5).collect(); + assert!(in_view.len() < tools.len(), "the window is too short for every tool: {} of {}", in_view.len(), tools.len()); + let pitch = tools[1].top() - tools[0].top(); + let lowest = in_view.iter().map(|r| r.bottom()).fold(f32::MIN, f32::max); + let bottom = rail.bottom(); + assert!(bottom - lowest < pitch, "the tools fill the rail to its bottom: the last in view ends at {lowest}, the rail at {bottom}"); + let proxy = named_rect(&nodes, "Fill and Stroke"); + assert!(proxy.top() >= rail.bottom() - 0.5, "Fill and Stroke starts out of view: {proxy:?} under {rail:?}"); + + let wheel = Event::MouseWheel { + unit: egui::MouseWheelUnit::Point, + delta: egui::vec2(0.0, -400.0), + modifiers: Default::default(), + phase: egui::TouchPhase::Move, + source: egui::MouseWheelSource::Unknown, + }; + let over = tools[0].center(); + for k in 0..10 { + frame(&mut app, &ctx, 1.0 + f64::from(k) * 0.05, vec![Event::PointerMoved(over), wheel.clone()], height); + } + let nodes = settled(&mut app, &ctx, 2.0, height); + let proxy = named_rect(&nodes, "Fill and Stroke"); + let last = cells(&app, &nodes).into_iter().max_by(|a, b| a.bottom().total_cmp(&b.bottom())).expect("the rail shows tools"); + assert!(proxy.bottom() <= rail.bottom() + 0.5, "Fill and Stroke is in view after scrolling: {proxy:?} in {rail:?}"); + assert!(last.bottom() <= proxy.top(), "the last tool {last:?} stands above Fill and Stroke {proxy:?}"); +} From 9f7501a8f6bf523351ef7b6232994da64ea1a31a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 11:24:48 -0800 Subject: [PATCH 4/6] Status bar: scrolling the view no longer lays out the zoom and artboard controls again The status bar's Zoom field, Zoom Presets menu, Rotation menu and artboard navigator were one memoized view keyed on the whole canvas view, so every frame of a wheel pan changed the key and ran all four again. The Zoom field reads only the view's zoom, and the status bar reads only the zoom of the view the field commits. - The Zoom field and Zoom Presets menu are their own memoized view, keyed on the zoom instead of the canvas view, so a pan replays them. - The Rotation menu and the artboard navigator are a second memoized view, so a zoom change runs only the zoom controls. The new test counts the runs of each view over ten pan frames and four zoom changes; before the change the pan ran the navigation controls ten times. --- crates/ui-egui/src/chrome/status_bar.rs | 130 +++++++++++++++--------- 1 file changed, 84 insertions(+), 46 deletions(-) diff --git a/crates/ui-egui/src/chrome/status_bar.rs b/crates/ui-egui/src/chrome/status_bar.rs index 1a3df7737b..b7446defb4 100644 --- a/crates/ui-egui/src/chrome/status_bar.rs +++ b/crates/ui-egui/src/chrome/status_bar.rs @@ -1,5 +1,5 @@ use super::{ROTATE_VIEW_ANGLES, Ui, VectorcraftApp, json}; -use craft::behavior::kurbo::Size; +use craft::behavior::kurbo::{Point, Size}; use craft::behavior::{CanvasView, IconId}; use craft::ui::bars::{Bar, BarKind, StatusMessage, StatusProgress}; use craft::ui::buttons::{Button, IconButton}; @@ -31,7 +31,7 @@ pub fn status_bar(app: &mut VectorcraftApp, ui: &mut Ui) { let view = app.view(); let rotation = view.map_or(0.0, |v| v.rotation); let lang = crate::i18n::current(); - let canvas_view = app.canvas_view(); + let canvas_zoom = app.canvas_view().map(|v| v.zoom); // PLAN: assumed Artboard::rect has `width()` and `height()`. let document = st.and_then(|d| d.doc.artboards.get(cur)).map_or(Size::new(1.0, 1.0), |a| Size::new(a.rect.width(), a.rect.height())); let scaling = app.ui_scaling(); @@ -92,21 +92,10 @@ pub fn status_bar(app: &mut VectorcraftApp, ui: &mut Ui) { }; // PLAN: assumed VectorcraftApp::canvas_view() -> Option (cv.S4) and the label msgid "Status Bar". Bar::new(tl!("Status Bar"), BarKind::Status).trailing(readouts).show(ui, |ui, _| { - let navigation = Navigation { - view: canvas_view, - document, - scaling, - print, - shown_zoom, - has_view: view.is_some(), - turned, - degrees, - cur, - revision, - artboards, - lang, - picked: Outbox::new(&mut picks), - }; + let zoom = + ZoomControls { zoom: canvas_zoom, document, scaling, print, shown_zoom, has_view: view.is_some(), lang, picked: Outbox::new(&mut picks) }; + let _ = MemoView::new("status-bar-zoom", zoom, show_zoom).show(ui); + let navigation = Navigation { has_view: view.is_some(), turned, degrees, cur, revision, artboards, lang, picked: Outbox::new(&mut picks) }; let _ = MemoView::new("status-bar-navigation", navigation, show_navigation).show(ui); Divider::vertical().show(ui); // An empty readout shows a dash. @@ -187,13 +176,12 @@ pub fn status_bar(app: &mut VectorcraftApp, ui: &mut Ui) { } } -/// What the status bar's navigation controls read: the Zoom field, the Rotation menu and the artboard navigator. The -/// bar replays them while these hold still and nothing reaches them (`MemoView`), as most frames only move the -/// readouts. +/// What the status bar's Zoom field and Zoom Presets menu read. The bar replays them while these hold still and +/// nothing reaches them (`MemoView`). The canvas view's center is not among them, so a pan replays them. #[derive(MemoProps)] -struct Navigation<'a> { - /// The canvas view the Zoom field shows and edits. - view: Option, +struct ZoomControls<'a> { + /// The canvas view's zoom (`CanvasView::zoom`), which the Zoom field shows and edits. + zoom: Option, /// The size of the artboard the navigator shows, which the Zoom field fits. document: Size, /// UI Scaling, which divides the canvas view's zoom. @@ -202,6 +190,45 @@ struct Navigation<'a> { print: Option, /// The view's zoom percentage, which the Zoom Presets menu checks. shown_zoom: Option, + /// Whether the active document has a view to zoom. + has_view: bool, + #[memo_props(hash = "an interface language: an index into the languages offered")] + lang: crate::i18n::Lang, + /// What the controls chose in the pass. + picked: Outbox<'a, NavigationPick>, +} + +/// The Zoom field and the Zoom Presets menu of the status bar, from [`ZoomControls`]. +fn show_zoom(p: &mut ZoomControls<'_>, ui: &mut Ui) { + #[cfg(test)] + tests::ZOOM_RUNS.with(|n| n.set(n.get() + 1)); + // The field reads only the view's zoom, and the bar reads only the zoom of the view it commits. + let view = p.zoom.map(|zoom| CanvasView::new(egui::Rect::ZERO, Point::ZERO, zoom)); + let document = p.document; + let zoom = Field::new(tl!("Zoom")) + .side(SideLabel::new().kind(LabelKind::Hidden)) + .show(ui, |ui, _| ZoomField::new(tl!("Zoom"), view, document).scrub(true).status_bar().show(ui)); + // The field edits the canvas view, whose zoom is divided by UI Scaling; `view.setZoom` takes the view's zoom. + if let Some(zoom) = zoom.inner { + if let Some(view) = zoom.view.committed() { + let percent = crate::state::zoom_display_percent(crate::state::View::zoom_of_canvas(view, p.scaling), p.print); + p.picked.send(NavigationPick::Zoom(percent)); + } + if let Some(invalid) = zoom.invalid_zoom { + p.picked.send(NavigationPick::InvalidZoom(invalid.message(&Env::of(ui)))); + } + } + let presets = zoom_presets(p.shown_zoom, p.print); + let open_presets = IconButton::new(IconId::new("chevron_down")).label(tl!("Zoom Presets")).enabled(p.has_view).show(ui); + if let Some(preset) = Menu::new(tl!("Zoom Presets")).values().opened_by(open_presets.response(), Trigger::Press).pick(ui, &presets).picked { + p.picked.send(NavigationPick::Preset(preset)); + } +} + +/// What the status bar's Rotation menu and artboard navigator read. The bar replays them while these hold still and +/// nothing reaches them (`MemoView`), as most frames only move the readouts, and a pan or a zoom leaves them alone. +#[derive(MemoProps)] +struct Navigation<'a> { /// Whether the active document has a view to turn. has_view: bool, /// The Rotate View preset the view is turned to, else `usize::MAX`. @@ -234,29 +261,10 @@ enum NavigationPick { Artboard(serde_json::Value), } -/// The Zoom field, the Rotation menu and the artboard navigator of the status bar, from [`Navigation`]. +/// The Rotation menu and the artboard navigator of the status bar, from [`Navigation`]. fn show_navigation(p: &mut Navigation<'_>, ui: &mut Ui) { #[cfg(test)] tests::NAVIGATION_RUNS.with(|n| n.set(n.get() + 1)); - let (view, document) = (p.view, p.document); - let zoom = Field::new(tl!("Zoom")) - .side(SideLabel::new().kind(LabelKind::Hidden)) - .show(ui, |ui, _| ZoomField::new(tl!("Zoom"), view, document).scrub(true).status_bar().show(ui)); - // The field edits the canvas view, whose zoom is divided by UI Scaling; `view.setZoom` takes the view's zoom. - if let Some(zoom) = zoom.inner { - if let Some(view) = zoom.view.committed() { - let percent = crate::state::zoom_display_percent(crate::state::View::zoom_of_canvas(view, p.scaling), p.print); - p.picked.send(NavigationPick::Zoom(percent)); - } - if let Some(invalid) = zoom.invalid_zoom { - p.picked.send(NavigationPick::InvalidZoom(invalid.message(&Env::of(ui)))); - } - } - let presets = zoom_presets(p.shown_zoom, p.print); - let open_presets = IconButton::new(IconId::new("chevron_down")).label(tl!("Zoom Presets")).enabled(p.has_view).show(ui); - if let Some(preset) = Menu::new(tl!("Zoom Presets")).values().opened_by(open_presets.response(), Trigger::Press).pick(ui, &presets).picked { - p.picked.send(NavigationPick::Preset(preset)); - } let angles: Vec> = ROTATE_VIEW_ANGLES.iter().enumerate().map(|(i, (label, _))| Entry::new(i, *label)).collect(); let (turned, angle, has_view) = (p.turned, format!("{}°", p.degrees), p.has_view); let mut rotate_to = None; @@ -388,13 +396,15 @@ mod tests { thread_local! { /// How many times this thread ran the status bar's navigation controls ([`show_navigation`]). pub(super) static NAVIGATION_RUNS: std::cell::Cell = const { std::cell::Cell::new(0) }; + /// How many times this thread ran the status bar's Zoom field and Zoom Presets menu ([`show_zoom`]). + pub(super) static ZOOM_RUNS: std::cell::Cell = const { std::cell::Cell::new(0) }; } - /// Frames that change nothing the navigation controls show replay them instead of laying them out again; a new - /// zoom or a new artboard runs them once, and they show it. + /// Frames that change nothing the zoom and navigation controls show replay them instead of laying them out again; + /// a new zoom or a new artboard runs them once, and they show it. #[test] fn idle_frames_replay_the_navigation_controls() { - let runs = || NAVIGATION_RUNS.with(std::cell::Cell::get); + let runs = || ZOOM_RUNS.with(std::cell::Cell::get) + NAVIGATION_RUNS.with(std::cell::Cell::get); let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); app.view_mut().unwrap().rect = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(600.0, 400.0)); @@ -423,6 +433,34 @@ mod tests { assert!(panel.enabled("Next Artboard") || panel.enabled("Previous Artboard"), "the navigator counts the new artboard"); } + /// Scrolling the view moves its center and nothing the navigation controls show, so frames of a wheel pan replay + /// them; a new zoom runs only the Zoom field and its presets, not the Rotation menu and the artboard navigator. + #[test] + fn wheel_frames_run_only_the_controls_that_show_what_changed() { + let runs = || (ZOOM_RUNS.with(std::cell::Cell::get), NAVIGATION_RUNS.with(std::cell::Cell::get)); + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + app.view_mut().unwrap().rect = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(600.0, 400.0)); + let mut panel = Panel::new(app, status_bar); + panel.room(egui::vec2(1200.0, 300.0)); + panel.frame(); + panel.frame(); + let before = runs(); + for i in 0..10 { + panel.app().view_mut().unwrap().center.y += if i % 2 == 0 { 40.0 } else { -25.0 }; + panel.frame(); + } + assert_eq!(runs(), before, "a pan runs neither the zoom controls nor the navigation controls"); + for i in 0..4 { + panel.app().run("view.setZoom", json!({"zoom": 150 + 25 * i})).unwrap(); + panel.frame(); + } + let after = runs(); + assert!(after.0 > before.0, "a new zoom runs the zoom controls"); + assert_eq!(after.1, before.1, "a new zoom does not run the Rotation menu and the artboard navigator"); + assert_eq!(panel.value("Zoom").as_deref(), Some("225%"), "the field shows the last zoom"); + } + #[test] fn the_zoom_presets_menu_sets_a_stop_and_fits_the_view() { let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); From 3617039ef5c2b953e2f6e028a1d4cc88c680fc22 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 11:36:48 -0800 Subject: [PATCH 5/6] Global Edit: the canvas shares the kept outlines instead of copying them each frame With one object selected and the Selection tool active, or while Global Edit is on, every frame copied each highlighted outline out of the kept list and made one overlay per object, which the canvas flattened and stroked again. With 10,000 matching objects that was most of a 27 ms frame. highlights and similar now return the kept outlines as a shared Highlights, grouped by layer color with a revision that changes only when the outlines are found again. The session sends one Overlay::Outlines per color, and the canvas shows it as a SelectionOutline keyed by that revision, so the lines are stroked again only when the outlines or the view change. --- crates/engine/src/cmd/globaledit.rs | 65 ++++++++++++++++++++++----- crates/engine/src/tests/globaledit.rs | 42 +++++++++++++++-- crates/engine/src/tooling.rs | 9 ++-- crates/tools/src/lib.rs | 5 +++ crates/ui-egui/src/canvas/overlays.rs | 10 ++++- crates/ui-egui/src/canvas/tests.rs | 24 ++++++++++ 6 files changed, 136 insertions(+), 19 deletions(-) diff --git a/crates/engine/src/cmd/globaledit.rs b/crates/engine/src/cmd/globaledit.rs index 4f498e972a..cecf216b24 100644 --- a/crates/engine/src/cmd/globaledit.rs +++ b/crates/engine/src/cmd/globaledit.rs @@ -194,6 +194,51 @@ impl Options { /// Outlines with their layer colours ([`highlights`]). pub type Outlines = Vec<(BezPath, [u8; 3])>; +/// The outlines [`highlights`] gives the canvas, grouped by layer color. The canvas asks every frame and gets the same +/// allocation back until the outlines are found again. +#[derive(Debug, Default, PartialEq)] +pub struct Highlights { + /// A number given to each set of outlines when it is found, and never to another set: the canvas keeps the lines + /// it stroked for these outlines while the number stays the same. + pub revision: u64, + /// The outlines in each layer color, the colors in the order of their first outline. + pub groups: Vec<([u8; 3], std::sync::Arc<[BezPath]>)>, +} + +/// The [`Highlights::revision`] the next set of outlines takes. +static NEXT_HIGHLIGHTS: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(1); + +/// [`Highlights`] with no outline, shared so the frames that show none allocate nothing. +static NO_HIGHLIGHTS: std::sync::LazyLock> = std::sync::LazyLock::new(Default::default); + +impl Highlights { + /// `outlines` grouped by color, under a new revision. + fn new(outlines: Outlines) -> std::sync::Arc { + if outlines.is_empty() { + return NO_HIGHLIGHTS.clone(); + } + let mut groups: Vec<([u8; 3], Vec)> = vec![]; + for (path, color) in outlines { + match groups.iter_mut().find(|(c, _)| *c == color) { + Some((_, paths)) => paths.push(path), + None => groups.push((color, vec![path])), + } + } + let revision = NEXT_HIGHLIGHTS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + std::sync::Arc::new(Highlights { revision, groups: groups.into_iter().map(|(c, paths)| (c, paths.into())).collect() }) + } + + /// How many outlines there are, in every color. + pub fn len(&self) -> usize { + self.groups.iter().map(|(_, paths)| paths.len()).sum() + } + + /// Whether there is no outline. + pub fn is_empty(&self) -> bool { + self.groups.iter().all(|(_, paths)| paths.is_empty()) + } +} + /// A Global Edit in progress (per document; not saved, not an undo step). #[derive(Clone, Debug, PartialEq)] pub struct GlobalEdit { @@ -202,7 +247,7 @@ pub struct GlobalEdit { /// outline onto its own. pub members: Vec<(NodeId, Affine)>, /// [`highlights`] as of a document revision: the canvas asks every frame. - outlines: std::cell::RefCell>, + outlines: std::cell::RefCell)>>, } /// An outline reduced to its form: the anchors and handles placed in a unit box, with what tells @@ -1017,31 +1062,31 @@ fn keep_series_changes(before: &Document, d: &mut Document, edited: &[NodeId]) { /// highlights them while Global Edit is on. While it is off, with one supported object selected, /// they are the outlines of the objects Start Global Edit would take with the Global Edit Options /// ([`similar`]). -pub fn highlights(s: &Session) -> Outlines { - let Some(st) = s.active() else { return vec![] }; +pub fn highlights(s: &Session) -> std::sync::Arc { + let Some(st) = s.active() else { return NO_HIGHLIGHTS.clone() }; let Some(ge) = &st.global_edit else { return similar(s) }; if let Some((rev, out)) = &*ge.outlines.borrow() && *rev == st.revision { return out.clone(); } - let out = outlines(st, &ge.members); + let out = Highlights::new(outlines(st, &ge.members)); *ge.outlines.borrow_mut() = Some((st.revision, out.clone())); out } /// [`similar`]'s outlines as of a document revision and the options they were found with. -pub type SimilarCache = std::cell::RefCell>; +pub type SimilarCache = std::cell::RefCell)>>; /// Before Global Edit starts: with one supported object selected, the outlines of the other /// objects Start Global Edit would take now with the session's Global Edit Options, so the canvas /// shows them as soon as the object is selected. None while an interaction (a drag) is in /// progress, or when fewer than two objects would be taken. Kept per document revision and /// options, as finding them walks the whole document. -pub fn similar(s: &Session) -> Outlines { - let Some(st) = s.active() else { return vec![] }; +pub fn similar(s: &Session) -> std::sync::Arc { + let Some(st) = s.active() else { return NO_HIGHLIGHTS.clone() }; if st.global_edit.is_some() || st.interaction.is_some() || st.selection.objects.len() != 1 { - return vec![]; + return NO_HIGHLIGHTS.clone(); } let o = &s.global_edit_options; if let Some((rev, opts, out)) = &*st.similar_outlines.borrow() @@ -1050,10 +1095,10 @@ pub fn similar(s: &Session) -> Outlines { { return out.clone(); } - let out = match matches(s, o) { + let out = Highlights::new(match matches(s, o) { Ok(m) if m.len() >= 2 => outlines(st, &m), _ => vec![], - }; + }); *st.similar_outlines.borrow_mut() = Some((st.revision, o.clone(), out.clone())); out } diff --git a/crates/engine/src/tests/globaledit.rs b/crates/engine/src/tests/globaledit.rs index ae56fa7c5a..076816e994 100644 --- a/crates/engine/src/tests/globaledit.rs +++ b/crates/engine/src/tests/globaledit.rs @@ -150,7 +150,7 @@ fn after_an_edit_only_the_changed_objects_are_compared_again_from_scratch() { assert_eq!(since(before), (4, 2), "the selected object and the three edited copies, two of them still similar"); assert_eq!(shown.len(), 38, "the widened copy is another shape; the moved and the enlarged ones still match"); let moved = node(&s, copies[1]).stroke_path().unwrap(); - assert!(shown.iter().any(|(p, _)| *p == moved), "the moved copy is shown where it is now"); + assert!(shown.groups.iter().flat_map(|(_, paths)| paths.iter()).any(|p| *p == moved), "the moved copy is shown where it is now"); s.execute("select.globalEditOptions", &json!({"size": true})).unwrap(); assert_eq!(highlights(&s).len(), 37, "with Size, the enlarged copy is left out"); assert_eq!(crate::cmd::globaledit::match_count(&s), 38); @@ -162,9 +162,7 @@ fn the_canvas_highlights_similar_objects_before_the_start_with_the_selection_too let [a, b, ..] = squares(&mut s); let outline = node(&s, b).stroke_path().unwrap(); let shown = |s: &mut Session| { - s.overlays(ViewInfo::default()) - .iter() - .any(|o| matches!(o, vectorcraft_tools::Overlay::Path { path, width, .. } if *path == outline && *width == 1.0)) + s.overlays(ViewInfo::default()).iter().any(|o| matches!(o, vectorcraft_tools::Overlay::Outlines { paths, .. } if paths.contains(&outline))) }; sel(&mut s, &[a]); s.select_tool("selection", ViewInfo::default()).unwrap(); @@ -175,6 +173,42 @@ fn the_canvas_highlights_similar_objects_before_the_start_with_the_selection_too assert!(shown(&mut s), "while Global Edit is on, with any tool"); } +/// Each frame hands the canvas the kept outlines, one overlay per layer color sharing them, with no copy of a path; the +/// revision changes when the outlines are found again. +#[test] +fn every_frame_shares_the_kept_outlines_instead_of_copying_each_one() { + use std::sync::Arc; + use vectorcraft_tools::Overlay; + let outlines = |s: &mut Session| -> Vec<(Arc<[vectorcraft_geom::BezPath]>, u64)> { + s.overlays(ViewInfo::default()) + .into_iter() + .filter_map(|o| if let Overlay::Outlines { paths, revision, .. } = o { Some((paths, revision)) } else { None }) + .collect() + }; + let mut s = session(); + let key = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + for i in 1..200 { + rect(&mut s, 20.0 * f64::from(i % 20), 100.0 + 20.0 * f64::from(i / 20), 10.0, 10.0); + } + sel(&mut s, &[key]); + s.select_tool("selection", ViewInfo::default()).unwrap(); + let first = outlines(&mut s); + let [(paths, revision)] = &first[..] else { panic!("one overlay for the one layer color, not one per object: {}", first.len()) }; + assert_eq!(paths.len(), 199); + let second = outlines(&mut s); + let [(again, same)] = &second[..] else { panic!("{}", second.len()) }; + assert!(Arc::ptr_eq(paths, again), "the next frame gets the same outlines, not a copy"); + assert_eq!(same, revision); + s.execute("select.globalEdit", &json!({})).unwrap(); + let on = outlines(&mut s); + let [(members, started)] = &on[..] else { panic!("{}", on.len()) }; + assert_eq!(members.len(), 199); + assert_ne!(started, revision, "outlines found again take a new revision"); + let next = outlines(&mut s); + let [(kept, still)] = &next[..] else { panic!("{}", next.len()) }; + assert!(Arc::ptr_eq(members, kept) && still == started, "and are kept from frame to frame while Global Edit is on"); +} + #[test] fn size_and_appearance_options_narrow_the_match() { let mut s = session(); diff --git a/crates/engine/src/tooling.rs b/crates/engine/src/tooling.rs index c5d2905963..422caab5ec 100644 --- a/crates/engine/src/tooling.rs +++ b/crates/engine/src/tooling.rs @@ -1478,9 +1478,12 @@ impl Session { // Global Edit: the objects edited with the selected one are highlighted; before it starts, // with the Selection tool, the objects it would take. let ge_on = self.active().is_some_and(|d| d.global_edit.is_some()); - let shown = if ge_on || self.tool.id() == "selection" { crate::cmd::globaledit::highlights(self) } else { vec![] }; - for (path, color) in shown { - v.push(Overlay::Path { path, color, width: 1.0, dashed: false }); + // One overlay per layer color, sharing the kept outlines. + if ge_on || self.tool.id() == "selection" { + let shown = crate::cmd::globaledit::highlights(self); + for (color, paths) in &shown.groups { + v.push(Overlay::Outlines { paths: paths.clone(), color: *color, revision: shown.revision }); + } } if let Some((cmd, p)) = deferred_preview { v.extend(self.deferred_preview_overlays_from_command(&cmd, &p)); diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index cfcce40bf9..7d0c17f068 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -88,6 +88,11 @@ pub enum Overlay { /// the dash pattern: the pieces of one line, each starting where the one before it ends, dash /// as the whole line does. SharedPath { path: std::sync::Arc, color: [u8; 3], width: f32, dash: Option }, + /// Thin solid outlines of many objects in one color (the objects Global Edit takes). Later calls + /// return the same `paths` with the same `revision` for as long as the outlines do not change, and + /// a new `revision` when they do. The host strokes them again only when `revision` or the view + /// changes. + Outlines { paths: std::sync::Arc<[BezPath]>, color: [u8; 3], revision: u64 }, /// A line segment (smart guide, handle line). Line { a: Point, b: Point, color: [u8; 3], dashed: bool }, /// An anchor square: filled = selected. diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index 8f9bd6f663..d1f8c469a8 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -48,7 +48,7 @@ pub(super) fn show(app: &VectorcraftApp, ui: &mut egui::Ui, space: &CanvasSpace, }); } -/// The framework control `o` stands for, if it is one: a marquee, a settled outline or a distance. +/// The framework control `o` stands for, if it is one: a marquee, a settled outline, a set of outlines or a distance. fn show_control(ui: &mut egui::Ui, rect: ScreenRect, o: &Overlay) { match o { Overlay::Marquee(r) => { @@ -65,6 +65,11 @@ fn show_control(ui: &mut egui::Ui, rect: ScreenRect, o: &Overlay) { let outline = if dash.is_some() { SelectionOutline::dashed(Label::Empty, paths) } else { SelectionOutline::solid(Label::Empty, paths) }; outline.color(data(*color)).revision(revision).show_at(ui, rect); } + Overlay::Outlines { paths, color, revision } => { + // The overlay's revision changes whenever its paths do, so the lines are stroked again only then or when + // the view changes. + SelectionOutline::solid(Label::Empty, paths).color(data(*color)).revision(*revision).show_at(ui, rect); + } Overlay::Distance { .. } => { if let Some((measure, color)) = distance_measure(o) { SmartGuides::new(&[], std::slice::from_ref(&measure)).color(color).show_at(ui, rect); @@ -180,7 +185,7 @@ impl Component for ToolMarks<'_> { } } -/// Paints the marks of `overlays` through `draw` in `view`; the marquees, shared paths and distances are controls +/// Paints the marks of `overlays` through `draw` in `view`; the marquees, shared paths, outlines and distances are controls /// of their own and paint nothing here. // PLAN: contract cv.S14 gives `paint(draw, view, overlays, options)`; the pill, ink and ring colours come from the theme, so the style goes too. fn paint(draw: &Draw<'_>, view: &CanvasView, overlays: &[Overlay], options: &PathOptionsSettings, style: &ToolMarksStyle) { @@ -244,6 +249,7 @@ fn paint(draw: &Draw<'_>, view: &CanvasView, overlays: &[Overlay], options: &Pat Overlay::Marquee(_) | Overlay::SelectionMarquee { .. } | Overlay::SharedPath { .. } + | Overlay::Outlines { .. } | Overlay::Distance { .. } | Overlay::HoverText { .. } => {} } diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index ae6956a288..a5fa556b8c 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -333,6 +333,30 @@ fn a_selection_drag_draws_its_marks_in_the_frame_the_pointer_moves() { assert!(moved >= 4, "the drag moves the object: {moved} frames"); } +/// With one rectangle selected, the canvas outlines its copies, which Start Global Edit would take, at their corners. +#[test] +fn the_canvas_outlines_the_objects_global_edit_would_take() { + let mut app = drag_app(); + let rect = |app: &mut VectorcraftApp, x: f64| { + app.session.execute("shape.rectangle", &json!({"x": x, "y": 100, "width": 40, "height": 30})).unwrap()["id"].as_u64().unwrap() + }; + let key = rect(&mut app, 20.0); + let copies = [rect(&mut app, 120.0), rect(&mut app, 220.0)]; + app.select_tool("selection"); + app.session.execute("select.set", &json!({"ids": [key]})).unwrap(); + let ctx = crate::testing::ui_context(); + frame(&mut app, &ctx, vec![]); + let xf = app.canvas_view().unwrap(); + let points = painted_points(&mut app, &ctx, vec![]); + for id in copies { + let b = app.session.active().unwrap().doc.bounds_of(&[vectorcraft_doc::NodeId(id)], false).unwrap(); + for corner in [Point::new(b.x0, b.y0), Point::new(b.x1, b.y1)] { + let at = xf.to_screen(corner); + assert!(points.iter().any(|p| p.distance(at) < 1.0), "copy {id} is outlined at {at:?}"); + } + } +} + /// A Pen drag draws the handle it pulls out in the frame the pointer moves: its end at that frame's pointer, and /// none at the pointer of the frame before. #[test] From 214c88d98536c143061b8560dff02f092afa1804 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 29 Nov 2026 11:45:44 -0800 Subject: [PATCH 6/6] Tools: the controls under the tools scroll with them, as bottom_controls says The doc comment on bottom_controls still said the tools scroll above the controls in a short rail. The Tools panel's rail now uses footer_scrolls, so the controls scroll with the tools and the rail draws the rule above them. --- crates/ui-egui/src/toolbar.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index 4d58c972d7..618bace39b 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -772,8 +772,8 @@ fn quad_bounds(quad: &[Point; 4]) -> vectorcraft_geom::Rect { /// The Fill/Stroke proxy, Color/Gradient/None, the drawing modes and screen mode under the rail's /// tools: in two columns the three drawing modes show, in one only the current one, which cycles /// them. A row the rail is too narrow for goes on in the next line. The All Tools drawer's Show -/// section hides any of them. The rail's footer region draws the rule that parts them from the tools, which scroll -/// above it in a short rail. +/// section hides any of them. The rail draws the rule that parts them from the tools, and they scroll with the tools +/// in a short rail. fn bottom_controls(app: &mut VectorcraftApp, ui: &mut Ui, footer: RailFooter) { let two = footer.columns > 1; let show = app.ui.toolbar_show;