From 91cacaa6ede8f7d54930cd6ccbd8b2b062042dbb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 08:17:22 -0800 Subject: [PATCH] Path Precision Tools: the bounding shapes' menu items open a dialog with Offset and One per Object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Bounding Rectangle… and Add Bounding Circle… open the command dialog with Offset (0 to 4,000,000 pt), One per Object (`each`) and Preview, so the menu sets what the commands take. Cancel removes the preview without a step of history, and an Offset that takes the shape past the canvas edge leaves the dialog open with the error. - The canvas check reuses `sanity::rect_in_range`; the params text and docs/mcp.md say the limit holds along each axis. - Tests: the dialog (defaults, preview, Cancel, OK with and without an Offset and One per Object, the canvas error, the catalog rows); a circle just inside the limit; one edge past the limit is refused. - Catalogs: the two menu labels with "…" and "One per Object" in all 28; the four messages in bg, bs and id as well. --- ROADMAP.md | 2 +- .../src/cmd/addons/pathtools/bounding.rs | 19 ++- .../cmd/addons/pathtools/bounding/tests.rs | 24 +++- crates/engine/src/sanity.rs | 3 +- crates/ui-egui/src/addons/pathtools.rs | 10 +- crates/ui-egui/src/addons/pathtools/tests.rs | 115 ++++++++++++++---- crates/ui-egui/src/dialogs/command.rs | 15 ++- crates/ui-egui/src/dialogs/form.rs | 1 + crates/ui-egui/src/i18n/bg.tsv | 7 ++ crates/ui-egui/src/i18n/bs.tsv | 7 ++ crates/ui-egui/src/i18n/ca.tsv | 3 + crates/ui-egui/src/i18n/cs.tsv | 3 + crates/ui-egui/src/i18n/da.tsv | 3 + crates/ui-egui/src/i18n/de.tsv | 3 + crates/ui-egui/src/i18n/el.tsv | 3 + crates/ui-egui/src/i18n/es.tsv | 3 + crates/ui-egui/src/i18n/fi.tsv | 3 + crates/ui-egui/src/i18n/fr.tsv | 3 + crates/ui-egui/src/i18n/gu.tsv | 3 + crates/ui-egui/src/i18n/hi.tsv | 3 + crates/ui-egui/src/i18n/hu.tsv | 3 + crates/ui-egui/src/i18n/id.tsv | 7 ++ crates/ui-egui/src/i18n/it.tsv | 3 + crates/ui-egui/src/i18n/ja.tsv | 3 + crates/ui-egui/src/i18n/ka.tsv | 3 + crates/ui-egui/src/i18n/ko.tsv | 3 + crates/ui-egui/src/i18n/nl.tsv | 3 + crates/ui-egui/src/i18n/pl.tsv | 3 + crates/ui-egui/src/i18n/pt-br.tsv | 3 + crates/ui-egui/src/i18n/ru.tsv | 3 + crates/ui-egui/src/i18n/sv.tsv | 3 + crates/ui-egui/src/i18n/tr.tsv | 3 + crates/ui-egui/src/i18n/uk.tsv | 3 + crates/ui-egui/src/i18n/vi.tsv | 3 + crates/ui-egui/src/i18n/zh-hans.tsv | 3 + crates/ui-egui/src/i18n/zh-hant.tsv | 3 + docs/mcp.md | 14 ++- docs/target-app-parity.md | 2 +- docs/ui-parity.md | 2 +- 39 files changed, 249 insertions(+), 54 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 1c5d36c064..2885ebb841 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -150,7 +150,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap - 2026-11-01: Randomize Opacity joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): each selected object gets its own opacity at random between a minimum and a maximum percent, with a seed that repeats the result, as one undo step (`addon.arrange.randomizeOpacity`, #4925). - 2026-11-01: Sort Objects joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): the selected objects are sorted by width, height, area, position, opacity or stacking order (small to large, large to small or at random) and take another of those in that order, trading their values or stepping them evenly, as one undo step (`addon.arrange.sort`, #4917). - 2026-11-15: Tangent Circle joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): the circles that touch two selected paths or compound paths at a set radius, or three of them (up to eight for three circles), touching each outline without crossing it; circles, rotated ellipses and other paths alike. A dialog that previews every circle or one picked by number, the current paint, one undo step (`addon.pathtools.tangentCircle`). A VectorCraft addition: headline numbers unchanged. -- 2026-11-17: Add Bounding Rectangle and Add Bounding Circle join the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): a live rectangle on the selection's geometric bounding box, or the smallest live circle that holds its outlines, around the whole selection, with the current paint and one undo step; the commands also take `each` (one shape around each object) and `offset` (`addon.pathtools.boundingRectangle`, `addon.pathtools.boundingCircle`, #6966). A VectorCraft addition: headline numbers unchanged. +- 2026-11-17: Add Bounding Rectangle and Add Bounding Circle join the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): a live rectangle on the selection's geometric bounding box, or the smallest live circle that holds its outlines, around the whole selection or around each object, with the current paint and one undo step; the menu items open a dialog with Offset, One per Object and Preview (`addon.pathtools.boundingRectangle`, `addon.pathtools.boundingCircle`, #6966). A VectorCraft addition: headline numbers unchanged. - 2026-11-01: New Symbols from Layers joins the Document Tools add-on (Object › Plug-ins › Document Tools): one symbol of each top-level layer's art (the layers highlighted in the Layers panel when two or more are, else every layer), named after the layer, made as New Symbol makes one; Convert Layers to Symbols also puts an instance of each in place of its layer's art. Empty layers are skipped and reported; one undo step. A VectorCraft addition: headline numbers unchanged. - 2026-11-01: Document Tools, a built-in add-on (Object › Plug-ins › Document Tools), starts with Save a Timestamped Copy: a copy of the document named `_YYYY-MM-DD_HH-MM` (UTC; `-2`, `-3`… when that name is taken) goes next to it, or into a folder picked for a document never saved, written as File › Save a Copy writes it, so the document keeps its path, title and modified state. Off on the web, which has no clock. A VectorCraft addition: headline numbers unchanged. - 2026-11-01: Divide into Dashes joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): the selected paths, or only their direct-selected segments, are cut into separate open paths of a dash length measured along the curve, with an optional gap (left empty, or kept as pieces), each keeping the path's appearance; Fit to Corners and Ends stretches or squeezes the lengths so every run starts and ends on a dash. A dialog with Preview, one undo step, at most 100000 pieces. A VectorCraft addition: headline numbers unchanged. diff --git a/crates/engine/src/cmd/addons/pathtools/bounding.rs b/crates/engine/src/cmd/addons/pathtools/bounding.rs index a87d438540..54f4325c55 100644 --- a/crates/engine/src/cmd/addons/pathtools/bounding.rs +++ b/crates/engine/src/cmd/addons/pathtools/bounding.rs @@ -8,7 +8,8 @@ use vectorcraft_geom::{Affine, CubicBez, FillRule, ParamCurve, PathSeg, Point, R use super::super::super::edit::selected_roots; use super::super::super::{CommandSpec, bad, cmd, has_selection, number_or, switch_or}; -use crate::{MAX_COORD, Result, Session}; +use crate::sanity::rect_in_range; +use crate::{Result, Session}; #[cfg(test)] mod tests; @@ -29,7 +30,7 @@ pub(super) fn specs() -> Vec { "Add Bounding Rectangle", ["Object", "Plug-ins", "Path Precision Tools"], None, - "{each?: bool (default false: one rectangle around the whole selection; true: one around each selected object), offset?: pt (0 or more; default 0: added on every side)} draw a live rectangle on the geometric bounding box of the selected objects (strokes and effects left out), with the current paint, on top of the current layer or of the isolated group, as other new art; the rectangles are selected; one undo step. An object whose box has no width or no height (a straight horizontal or vertical line) gets no rectangle unless `offset` is more than 0, nor does an object with no bounds (an empty group); with `each` the result's `skipped` counts them. It is an error when no rectangle is left (\"the shape would have no size\" when a rectangle with no size was left out, else \"nothing to enclose\") and when a rectangle would reach more than 4,000,000 pt from the origin → {id: the first rectangle, ids, skipped?}", + "{each?: bool (default false: one rectangle around the whole selection; true: one around each selected object), offset?: pt (0 or more; default 0: added on every side)} draw a live rectangle on the geometric bounding box of the selected objects (strokes and effects left out), with the current paint, on top of the current layer or of the isolated group, as other new art; the rectangles are selected; one undo step. An object whose box has no width or no height (a straight horizontal or vertical line) gets no rectangle unless `offset` is more than 0, nor does an object with no bounds (an empty group); with `each` the result's `skipped` counts them. It is an error when no rectangle is left (\"the shape would have no size\" when a rectangle with no size was left out, else \"nothing to enclose\") and when an edge of a rectangle would lie more than 4,000,000 pt from the origin along either axis (\"the shape would reach past the edge of the canvas\"). The menu item Add Bounding Rectangle… opens a dialog with Offset and One per Object (`each`) and a Preview → {id: the first rectangle, ids, skipped?}", has_selection, bounding_rectangle ), @@ -38,7 +39,7 @@ pub(super) fn specs() -> Vec { "Add Bounding Circle", ["Object", "Plug-ins", "Path Precision Tools"], None, - "{each?: bool (default false: one circle around the whole selection; true: one around each selected object), offset?: pt (0 or more; default 0: added to the radius)} draw the smallest live circle that holds the outlines of the selected objects (paths and compound paths by their curves, clip groups and sublayers that clip their contents by their clipping paths, other sublayers by their shown objects, images by their corners, type and other objects by the corners of their bounding box; strokes and effects left out), with the radius 0.01 pt larger so it holds the curves themselves, with the current paint, on top of the current layer or of the isolated group, as other new art; the circles are selected; one undo step. An object at a single point gets no circle unless `offset` is more than 0, nor does an object with no outline (an empty group); with `each` the result's `skipped` counts them. It is an error when no circle is left (\"the shape would have no size\" when a circle with no size was left out, else \"nothing to enclose\") and when a circle would reach more than 4,000,000 pt from the origin → {id: the first circle, ids, skipped?}", + "{each?: bool (default false: one circle around the whole selection; true: one around each selected object), offset?: pt (0 or more; default 0: added to the radius)} draw the smallest live circle that holds the outlines of the selected objects (paths and compound paths by their curves, clip groups and sublayers that clip their contents by their clipping paths, other sublayers by their shown objects, images by their corners, type and other objects by the corners of their bounding box; strokes and effects left out), with the radius 0.01 pt larger so it holds the curves themselves, with the current paint, on top of the current layer or of the isolated group, as other new art; the circles are selected; one undo step. An object at a single point gets no circle unless `offset` is more than 0, nor does an object with no outline (an empty group); with `each` the result's `skipped` counts them. It is an error when no circle is left (\"the shape would have no size\" when a circle with no size was left out, else \"nothing to enclose\") and when an edge of a circle's bounding box would lie more than 4,000,000 pt from the origin along either axis (\"the shape would reach past the edge of the canvas\"). The menu item Add Bounding Circle… opens a dialog with Offset and One per Object (`each`) and a Preview → {id: the first circle, ids, skipped?}", has_selection, bounding_circle ), @@ -121,22 +122,18 @@ enum Around { NoOutline, /// The rectangle would have no width or no height, or the circle no radius. NoSize, - /// The shape would reach past [`MAX_COORD`] from the origin. + /// An edge of the shape would lie more than [`MAX_COORD`](crate::MAX_COORD) from the origin + /// along either axis. PastCanvas, } -/// Is every edge of `r` finite and within [`MAX_COORD`] of the origin? -fn on_canvas(r: Rect) -> bool { - [r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.abs() <= MAX_COORD) -} - /// The live rectangle or circle around `ids`, grown by `offset`. fn shape_around(d: &Document, symbols: &SymbolBoxes, ids: &[NodeId], kind: Kind, offset: f64) -> Around { match kind { Kind::Rectangle => { let Some(r) = d.bounds_of_with(ids, false, symbols) else { return Around::NoOutline }; let r = r.inflate(offset, offset); - if !on_canvas(r) { + if !rect_in_range(r) { return Around::PastCanvas; } if r.width() <= 0.0 || r.height() <= 0.0 { @@ -163,7 +160,7 @@ fn shape_around(d: &Document, symbols: &SymbolBoxes, ids: &[NodeId], kind: Kind, } let r = radius + FLATNESS + offset; let b = Rect::new(center.x - r, center.y - r, center.x + r, center.y + r); - if !on_canvas(b) { + if !rect_in_range(b) { return Around::PastCanvas; } Around::Shape(LiveShape::Ellipse { w: b.width(), h: b.height(), pie: (0.0, 360.0), xf: Affine::translate(b.origin().to_vec2()) }) diff --git a/crates/engine/src/cmd/addons/pathtools/bounding/tests.rs b/crates/engine/src/cmd/addons/pathtools/bounding/tests.rs index cba11afc00..d3cd4bfa86 100644 --- a/crates/engine/src/cmd/addons/pathtools/bounding/tests.rs +++ b/crates/engine/src/cmd/addons/pathtools/bounding/tests.rs @@ -345,8 +345,9 @@ fn bad_params_and_an_empty_selection_draw_nothing() { } } -/// An offset that would take the shape more than 4,000,000 pt from the origin is an error that -/// names the canvas edge, and nothing is drawn; the largest offset that stays inside is drawn. +/// An offset that would put an edge of the shape more than 4,000,000 pt from the origin along +/// either axis is an error that names the canvas edge, and nothing is drawn; the largest offsets +/// that stay inside are drawn, for the rectangle and for the circle. #[test] fn an_offset_past_the_canvas_edge_draws_nothing() { let mut s = session(); @@ -360,6 +361,25 @@ fn an_offset_past_the_canvas_edge_draws_nothing() { } let r = id_of(&s.execute(RECTANGLE, &json!({"offset": 3.99e6})).unwrap()); assert!(rect_near(bounds(&s, r), Rect::new(-3.99e6, -3.99e6, 3.99e6 + 10.0, 3.99e6 + 10.0), 1e-3)); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + let c = id_of(&s.execute(CIRCLE, &json!({"offset": 3.99e6})).unwrap()); + // The circle around the square from (0, 0) to (10, 10), 0.01 pt larger, then the offset. + let radius = 50.0f64.sqrt() + 0.01 + 3.99e6; + assert!(rect_near(bounds(&s, c), Rect::new(5.0 - radius, 5.0 - radius, 5.0 + radius, 5.0 + radius), 1e-3)); +} + +/// The limit holds along each axis on its own: a shape whose right edge would pass 4,000,000 pt is +/// refused although its other edges, and its distance along the other axis, are small. +#[test] +fn one_edge_past_the_canvas_edge_is_enough_to_refuse() { + let mut s = session(); + let a = rect(&mut s, 3_999_980.0, 0.0, 10.0, 10.0); + s.execute("select.set", &json!({"ids": [a.0]})).unwrap(); + for command in [RECTANGLE, CIRCLE] { + let e = refused(&mut s, command, json!({"offset": 20})); + assert!(e.contains("the shape would reach past the edge of the canvas"), "{command}: {e}"); + } + assert!(s.execute(RECTANGLE, &json!({"offset": 5})).is_ok(), "the right edge at 3,999,995 pt is inside"); } /// Many points keep only their hull's corners, and the circle around them is the one around all diff --git a/crates/engine/src/sanity.rs b/crates/engine/src/sanity.rs index 4737246c9d..33738597b6 100644 --- a/crates/engine/src/sanity.rs +++ b/crates/engine/src/sanity.rs @@ -49,7 +49,8 @@ pub(crate) fn doc_sane(d: &Document, sel: &Selection) -> bool { && objects_in_range(d, &sel.objects) } -fn rect_in_range(r: vectorcraft_geom::Rect) -> bool { +/// Is every edge of `r` finite and within [`MAX_COORD`] of the origin? +pub(crate) fn rect_in_range(r: vectorcraft_geom::Rect) -> bool { [r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite() && v.abs() <= MAX_COORD) } diff --git a/crates/ui-egui/src/addons/pathtools.rs b/crates/ui-egui/src/addons/pathtools.rs index 51bf86f47b..5108a8380d 100644 --- a/crates/ui-egui/src/addons/pathtools.rs +++ b/crates/ui-egui/src/addons/pathtools.rs @@ -1,6 +1,6 @@ //! Path Precision Tools in the interface: its submenu (Object › Plug-ins › Path Precision Tools), //! which selects its tools, opens its panels and runs Split / Add Points at Crossings, Set Corners… ([`set_corners`]), Divide into -//! Dashes ([`dashes`]), Expand Dashes into Paths, Smooth Bridge ([`bridge`]), Convert to Parametric Shape, Tangent Circle… ([`tangent_circle`]), Add Bounding Rectangle and Add Bounding Circle; the Anchor Inspector panel (the selected +//! Dashes ([`dashes`]), Expand Dashes into Paths, Smooth Bridge ([`bridge`]), Convert to Parametric Shape, Tangent Circle… ([`tangent_circle`]), Add Bounding Rectangle… and Add Bounding Circle…; the Anchor Inspector panel (the selected //! anchor's position and handles as numbers, the add-on's anchor edits, the Corner Tool's values, //! [`corner`], and the Shared Edge Merge Tool's, [`shared_edge`]); the Parametric Shape panel //! ([`shape`]); and its tools' options dialog (a double-click on the tool). Everything acts through `addon.pathtools.*` and @@ -36,6 +36,10 @@ pub const KIND: &str = "pathToolOptions"; pub const COMMON_TANGENTS: &str = "addon.pathtools.commonTangents"; /// The kinds of tangent Common Tangents' `tangents` picks, and their labels. pub const TANGENT_KINDS: &[(&str, &str)] = &[("All", "all"), ("External", "external"), ("Internal", "internal")]; +/// Add Bounding Rectangle's and Add Bounding Circle's commands, whose menu items open the command +/// dialog (Offset, One per Object) with a Preview. +pub const BOUNDING_RECTANGLE: &str = "addon.pathtools.boundingRectangle"; +pub const BOUNDING_CIRCLE: &str = "addon.pathtools.boundingCircle"; /// The close modes, as `addon.pathtools.close` names them, and their labels. const CLOSE_MODES: [(&str, &str); 3] = [("handles", "Keep Handles"), ("straight", "Straight"), ("smooth", "Smooth")]; const LABEL_W: f32 = 64.0; @@ -79,8 +83,8 @@ pub fn menu() -> Vec { Item::Cmd("Convert to Parametric Shape", "addon.pathtools.shape.convert", json!({})), Item::Cmd("Tangent Circle…", tangent_circle::COMMAND, Value::Null), Item::Cmd("Common Tangents…", COMMON_TANGENTS, json!({ "tangents": "all", "centerline": false })), - Item::Cmd("Add Bounding Rectangle", "addon.pathtools.boundingRectangle", json!({})), - Item::Cmd("Add Bounding Circle", "addon.pathtools.boundingCircle", json!({})), + Item::Cmd("Add Bounding Rectangle…", BOUNDING_RECTANGLE, json!({ "offset": 0, "each": false })), + Item::Cmd("Add Bounding Circle…", BOUNDING_CIRCLE, json!({ "offset": 0, "each": false })), ] } diff --git a/crates/ui-egui/src/addons/pathtools/tests.rs b/crates/ui-egui/src/addons/pathtools/tests.rs index e1bad9f6d6..6feecab29e 100644 --- a/crates/ui-egui/src/addons/pathtools/tests.rs +++ b/crates/ui-egui/src/addons/pathtools/tests.rs @@ -372,43 +372,106 @@ fn common_tangents_on_a_point_gives_the_same_lines_for_every_choice() { assert!(app.ui.status.contains("The point lies inside the path"), "{}", app.ui.status); } -/// Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle and Add Bounding Circle are -/// dimmed with nothing selected, open no dialog, and draw one shape around the whole selection with -/// no offset as one undo step. +/// Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle… and Add Bounding Circle… are +/// dimmed with nothing selected and open the command dialog with Offset 0, One per Object off and +/// Preview off. With Preview on the shape shows on the canvas; Cancel takes it away with no step of +/// history. OK with the defaults draws one shape around the whole selection; OK with an Offset and +/// One per Object draws a larger shape around each object, as one undo step. An Offset that takes +/// the shape past the canvas edge leaves the dialog open, the document unchanged and an error. #[test] -fn add_bounding_rectangle_and_circle_draw_around_the_whole_selection() { +fn add_bounding_rectangle_and_circle_open_a_dialog_with_offset_and_one_per_object() { let mut app = app(); - let items = [("Add Bounding Rectangle", "addon.pathtools.boundingRectangle"), ("Add Bounding Circle", "addon.pathtools.boundingCircle")]; + let items = [("Add Bounding Rectangle…", super::BOUNDING_RECTANGLE), ("Add Bounding Circle…", super::BOUNDING_CIRCLE)]; + let find = |app: &VectorcraftApp, label: &str| { + let entries = menus::menu_entries(app); + entries.into_iter().find(|e| e.path == ["Object", "Plug-ins", "Path Precision Tools"] && e.label == label).expect(label) + }; for (label, command) in items { - let entries = menus::menu_entries(&app); - let item = entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Path Precision Tools"] && e.label == label).expect(label); - assert_eq!((item.command.as_deref(), &item.params), (Some(command), &json!({}))); + let item = find(&app, label); + assert_eq!((item.command.as_deref(), &item.params), (Some(command), &json!({"offset": 0, "each": false}))); assert!(!item.enabled, "{label} with nothing selected"); } let a = app.run("shape.rectangle", json!({"x": 10, "y": 20, "width": 30, "height": 40})).unwrap()["id"].as_u64().unwrap(); let b = app.run("shape.rectangle", json!({"x": 100, "y": 20, "width": 20, "height": 40})).unwrap()["id"].as_u64().unwrap(); - // The selection's box. - let [x0, y0, x1, y1] = [10.0, 20.0, 120.0, 60.0]; - for (label, _) in items { + let steps = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len(); + let count = |app: &VectorcraftApp| app.session.doc().unwrap().doc.node_count(); + let made = |app: &VectorcraftApp| { + let st = app.session.doc().unwrap(); + st.selection.objects.iter().map(|id| st.doc.bounds_of(&[*id], false).unwrap()).collect::>() + }; + let open = |app: &mut VectorcraftApp, label: &str| { app.run("select.set", json!({"ids": [a, b]})).unwrap(); - let steps = app.session.doc().unwrap().history.undo.len(); - let entries = menus::menu_entries(&app); - let item = entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Path Precision Tools"] && e.label == label).unwrap(); + let item = find(app, label); assert!(item.enabled, "{label}"); let (cmd, p) = menus::click_target(&item.label, item.command.as_deref().unwrap(), &item.params); - menus::invoke(&mut app, &cmd, p); - assert!(app.ui.dialog.is_none(), "{label} opens no dialog"); - assert_eq!(app.session.doc().unwrap().history.undo.len(), steps + 1, "{label}: one undo step"); - let made = app.session.doc().unwrap().selection.objects.clone(); - assert_eq!(made.len(), 1, "{label}: one shape around the whole selection"); - let r = app.session.doc().unwrap().doc.bounds_of(&made, false).unwrap(); - assert!(r.x0 <= x0 + 1e-6 && r.y0 <= y0 + 1e-6 && r.x1 >= x1 - 1e-6 && r.y1 >= y1 - 1e-6, "{label}: {r:?}"); - if label == "Add Bounding Rectangle" { - assert!((r.x0 - x0).abs() < 1e-6 && (r.y0 - y0).abs() < 1e-6 && (r.x1 - x1).abs() < 1e-6 && (r.y1 - y1).abs() < 1e-6, "no offset: {r:?}"); + menus::invoke(app, &cmd, p); + }; + let near = |r: vectorcraft_geom::Rect, want: [f64; 4]| [r.x0, r.y0, r.x1, r.y1].iter().zip(want).all(|(v, w)| (v - w).abs() < 1e-6); + for (label, command) in items { + let (start, n, nodes) = (app.session.doc().unwrap().doc.clone(), steps(&app), count(&app)); + open(&mut app, label); + let d = app.ui.dialog.as_ref().unwrap_or_else(|| panic!("{label}: a dialog opens")); + assert_eq!((d.str("__command"), d.str("__label")), (command.to_string(), label.trim_end_matches('…').to_string())); + assert_eq!((d.f64("offset", -1.0), d.bool("each"), d.bool("preview")), (0.0, false, false), "{label}"); + let shown = painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx())); + for s in [label.trim_end_matches('…'), "Offset", "One per Object", "Preview"] { + assert!(shown.contains(s), "{label}: {s} in {shown}"); + } + assert_eq!(count(&app), nodes, "{label}: no preview without the checkbox"); + + // Preview on: the shape is on the canvas. Cancel: as it was, with no step of history. + crate::dialogs::set_field(app.ui.dialog.as_mut().unwrap(), "preview".into(), json!(true)); + painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx())); + assert_eq!(count(&app), nodes + 1, "{label}: previewed"); + crate::dialogs::cancel(&mut app); + assert_eq!(app.session.doc().unwrap().doc, start, "{label}: Cancel takes the preview away"); + assert_eq!(steps(&app), n, "{label}: and adds no undo step"); + + // OK with the defaults: one shape around the whole selection, from (10, 20) to (120, 60). + open(&mut app, label); + crate::dialogs::confirm(&mut app).unwrap(); + assert!(app.ui.dialog.is_none()); + assert_eq!((steps(&app), count(&app)), (n + 1, nodes + 1), "{label}: one shape, one undo step"); + let whole = made(&app); + if command == super::BOUNDING_RECTANGLE { + assert!(near(whole[0], [10.0, 20.0, 120.0, 60.0]), "{label}: {:?}", whole[0]); } else { - // The circle on the diagonal from (10, 20) to (120, 60), with the 0.01 pt allowance. - let radius = (110.0f64.hypot(40.0)) / 2.0 + 0.01; - assert!((r.width() / 2.0 - radius).abs() < 1e-6, "no offset: {r:?}"); + // The circle on the diagonal, with the 0.01 pt allowance. + let r = 110.0f64.hypot(40.0) / 2.0 + 0.01; + assert!(near(whole[0], [65.0 - r, 40.0 - r, 65.0 + r, 40.0 + r]), "{label}: {:?}", whole[0]); + } + + // OK with an Offset of 5 pt and One per Object: a shape around each object, one undo step. + open(&mut app, label); + let d = app.ui.dialog.as_mut().unwrap(); + crate::dialogs::set_field(d, "offset".into(), json!(5)); + crate::dialogs::set_field(d, "each".into(), json!(true)); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((steps(&app), count(&app)), (n + 2, nodes + 3), "{label}: two shapes, one more undo step"); + let each = made(&app); + if command == super::BOUNDING_RECTANGLE { + assert!(near(each[0], [5.0, 15.0, 45.0, 65.0]) && near(each[1], [95.0, 15.0, 125.0, 65.0]), "{label}: {each:?}"); + } else { + let (ra, rb) = (30.0f64.hypot(40.0) / 2.0 + 5.01, 20.0f64.hypot(40.0) / 2.0 + 5.01); + let want = [[25.0 - ra, 40.0 - ra, 25.0 + ra, 40.0 + ra], [110.0 - rb, 40.0 - rb, 110.0 + rb, 40.0 + rb]]; + assert!(near(each[0], want[0]) && near(each[1], want[1]), "{label}: {each:?}"); + } + + // An Offset past the canvas edge: the dialog stays open, nothing is drawn, and the error + // says why. + let (n, nodes) = (steps(&app), count(&app)); + open(&mut app, label); + crate::dialogs::set_field(app.ui.dialog.as_mut().unwrap(), "offset".into(), json!(5_000_000)); + let e = crate::dialogs::confirm(&mut app).unwrap_err(); + assert!(e.contains("the shape would reach past the edge of the canvas"), "{label}: {e}"); + assert!(app.ui.dialog.is_some(), "{label}: the dialog stays open"); + crate::dialogs::cancel(&mut app); + assert_eq!((steps(&app), count(&app)), (n, nodes), "{label}: nothing drawn"); + } + // Every language with complete menus has the menu items, the dialog's headings and its labels. + for lang in crate::i18n::Lang::all().filter(|l| l.complete_menus()) { + for s in ["Add Bounding Rectangle…", "Add Bounding Circle…", "Offset", "One per Object"] { + assert!(crate::i18n::has(lang, s), "{}: {s}", lang.code()); } } } diff --git a/crates/ui-egui/src/dialogs/command.rs b/crates/ui-egui/src/dialogs/command.rs index de7836f0a5..bbf06f895a 100644 --- a/crates/ui-egui/src/dialogs/command.rs +++ b/crates/ui-egui/src/dialogs/command.rs @@ -84,7 +84,9 @@ fn heading_in(lang: crate::i18n::Lang, label: &str) -> String { /// too (#5360), as public tutorials of the dialog show, and Type Tools › Release Type on a Path /// works the same way (#5532), and so do Image Tools › Remove Background and Color Mask and /// Cutting Tools › Weed Box and Lines, Banner Hems and Grommets and Nest Shapes, and Path -/// Precision Tools › Common Tangents. (Cancel rolls a preview back whichever dialog started it.) +/// Precision Tools › Common Tangents and the bounding shapes (Add Bounding Rectangle… and Add +/// Bounding Circle…). (Cancel rolls +/// a preview back whichever dialog started it.) fn previews(d: &Dialog) -> bool { match d.str("__command").as_str() { "object.repeat.options" => d.fields.contains_key("gridType"), @@ -95,7 +97,9 @@ fn previews(d: &Dialog) -> bool { | crate::addons::cutting::WEED | crate::addons::cutting::BANNER | crate::addons::cutting::NEST - | crate::addons::pathtools::COMMON_TANGENTS => true, + | crate::addons::pathtools::COMMON_TANGENTS + | crate::addons::pathtools::BOUNDING_RECTANGLE + | crate::addons::pathtools::BOUNDING_CIRCLE => true, _ => false, } } @@ -150,6 +154,7 @@ fn lengths(command: &str) -> &'static [&'static str] { "object.pathfinder.trap" => &["thickness"], crate::addons::cutting::BRIDGES => &["width"], "object.textWrap.options" => &["offset"], + crate::addons::pathtools::BOUNDING_RECTANGLE | crate::addons::pathtools::BOUNDING_CIRCLE => &["offset"], _ => &[], } } @@ -159,6 +164,11 @@ fn lengths(command: &str) -> &'static [&'static str] { pub(super) fn length_range(command: &str, key: &str) -> Option> { match (command, key) { ("object.textWrap.options", "offset") => Some(vectorcraft_engine::TEXT_WRAP_OFFSET_RANGE), + // The bounding shapes take an offset of 0 or more, and the command refuses one that takes + // the shape past the canvas edge. + (crate::addons::pathtools::BOUNDING_RECTANGLE | crate::addons::pathtools::BOUNDING_CIRCLE, "offset") => { + Some(0.0..=vectorcraft_engine::MAX_COORD) + } _ => None, } } @@ -182,6 +192,7 @@ fn order(command: &str) -> &'static [&'static str] { crate::addons::cutting::BRIDGES => &["width", "count", "direction", "keepOriginal"], crate::addons::packaging::SET_ROLE_SWATCH => &["role", "swatch"], crate::addons::pathtools::COMMON_TANGENTS => &["tangents", "centerline"], + crate::addons::pathtools::BOUNDING_RECTANGLE | crate::addons::pathtools::BOUNDING_CIRCLE => &["offset", "each"], _ => &[], } } diff --git a/crates/ui-egui/src/dialogs/form.rs b/crates/ui-egui/src/dialogs/form.rs index b46f35a79f..90797e3119 100644 --- a/crates/ui-egui/src/dialogs/form.rs +++ b/crates/ui-egui/src/dialogs/form.rs @@ -846,6 +846,7 @@ pub(crate) fn humanize(k: &str) -> String { "Height Width" => "Height/Width:".into(), "Traps With Process Color" => "Traps with Process Color:".into(), "Cols" => "Columns:".into(), + "Each" => "One per Object:".into(), "Flip Cols" => "Flip Columns:".into(), _ => format!("{s}:"), } diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index fef78dd149..06a15a1a87 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -7060,6 +7060,13 @@ breakText Glyphs Глифи # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Добавяне на ограничаващ правоъгълник Add Bounding Circle Добавяне на ограничаваща окръжност + Add Bounding Rectangle… Добавяне на ограничаващ правоъгълник… + Add Bounding Circle… Добавяне на ограничаваща окръжност… + One per Object По една за всеки обект +@msg nothing to enclose няма какво да се огради +@msg `offset` must be 0 or more `offset` трябва да е 0 или повече +@msg the shape would have no size фигурата няма да има размер +@msg the shape would reach past the edge of the canvas фигурата би излязла извън ръба на работната площ # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Инструменти за документи Save a Timestamped Copy Запазване на копие с дата и час diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 124bee2797..405862d71f 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -7109,6 +7109,13 @@ shape Open Otvoren # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Dodaj granični pravougaonik Add Bounding Circle Dodaj granični krug + Add Bounding Rectangle… Dodaj granični pravougaonik… + Add Bounding Circle… Dodaj granični krug… + One per Object Jedan po objektu +@msg nothing to enclose nema ničega za obuhvatiti +@msg `offset` must be 0 or more `offset` mora biti 0 ili više +@msg the shape would have no size oblik ne bi imao veličinu +@msg the shape would reach past the edge of the canvas oblik bi prešao rub radne površine # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Alati za dokument Save a Timestamped Copy Sačuvaj kopiju s datumom i vremenom diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 8e6469a720..a5c0e0fedd 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7849,6 +7849,9 @@ breakText Glyphs Glifs # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Afegeix un rectangle delimitador Add Bounding Circle Afegeix un cercle delimitador + Add Bounding Rectangle… Afegeix un rectangle delimitador… + Add Bounding Circle… Afegeix un cercle delimitador… + One per Object Un per objecte @msg nothing to enclose no hi ha res per envoltar @msg `offset` must be 0 or more `offset` ha de ser 0 o més @msg the shape would have no size la forma no tindria mida diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index eb5c7e21ba..9d54e70878 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7834,6 +7834,9 @@ breakText Glyphs Glyfy # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Přidat ohraničující obdélník Add Bounding Circle Přidat ohraničující kružnici + Add Bounding Rectangle… Přidat ohraničující obdélník… + Add Bounding Circle… Přidat ohraničující kružnici… + One per Object Jeden pro každý objekt @msg nothing to enclose není co ohraničit @msg `offset` must be 0 or more `offset` musí být 0 nebo více @msg the shape would have no size tvar by neměl žádnou velikost diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 3982a4dee4..55d6f43f8f 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -9888,6 +9888,9 @@ breakText Glyphs Glyffer # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Tilføj afgrænsende rektangel Add Bounding Circle Tilføj afgrænsende cirkel + Add Bounding Rectangle… Tilføj afgrænsende rektangel… + Add Bounding Circle… Tilføj afgrænsende cirkel… + One per Object Én pr. objekt @msg nothing to enclose intet at omslutte @msg `offset` must be 0 or more `offset` skal være 0 eller mere @msg the shape would have no size formen ville ikke have nogen størrelse diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index a39e0e5ea6..17a536c934 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7422,6 +7422,9 @@ breakText Glyphs Glyphen # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Begrenzungsrechteck hinzufügen Add Bounding Circle Begrenzungskreis hinzufügen + Add Bounding Rectangle… Begrenzungsrechteck hinzufügen… + Add Bounding Circle… Begrenzungskreis hinzufügen… + One per Object Eine pro Objekt @msg nothing to enclose nichts zu umschließen @msg `offset` must be 0 or more `offset` muss 0 oder größer sein @msg the shape would have no size die Form hätte keine Größe diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index e99bc1f22a..f2a335aaeb 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7822,6 +7822,9 @@ breakText Glyphs Γλύφοι # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Προσθήκη ορθογωνίου οριοθέτησης Add Bounding Circle Προσθήκη κύκλου οριοθέτησης + Add Bounding Rectangle… Προσθήκη ορθογωνίου οριοθέτησης… + Add Bounding Circle… Προσθήκη κύκλου οριοθέτησης… + One per Object Ένα ανά αντικείμενο @msg nothing to enclose δεν υπάρχει τίποτα για περίκλειση @msg `offset` must be 0 or more το `offset` πρέπει να είναι 0 ή μεγαλύτερο @msg the shape would have no size το σχήμα δεν θα είχε μέγεθος diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 07291920c7..72e205099e 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7810,6 +7810,9 @@ breakText Glyphs Glifos # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Agregar rectángulo delimitador Add Bounding Circle Agregar círculo delimitador + Add Bounding Rectangle… Agregar rectángulo delimitador… + Add Bounding Circle… Agregar círculo delimitador… + One per Object Uno por objeto @msg nothing to enclose no hay nada que rodear @msg `offset` must be 0 or more `offset` debe ser 0 o más @msg the shape would have no size la forma no tendría tamaño diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index aea9e7a3a9..253f0e1fee 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7898,6 +7898,9 @@ breakText Glyphs Merkit # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Lisää rajaava suorakulmio Add Bounding Circle Lisää rajaava ympyrä + Add Bounding Rectangle… Lisää rajaava suorakulmio… + Add Bounding Circle… Lisää rajaava ympyrä… + One per Object Yksi kutakin objektia kohden @msg nothing to enclose ei ympäröitävää @msg `offset` must be 0 or more `offset` on oltava 0 tai enemmän @msg the shape would have no size muodolla ei olisi kokoa diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 6bfe581c55..57bdc0a636 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7830,6 +7830,9 @@ breakText Glyphs Glyphes # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Ajouter un rectangle englobant Add Bounding Circle Ajouter un cercle englobant + Add Bounding Rectangle… Ajouter un rectangle englobant… + Add Bounding Circle… Ajouter un cercle englobant… + One per Object Une par objet @msg nothing to enclose rien à entourer @msg `offset` must be 0 or more `offset` doit être supérieur ou égal à 0 @msg the shape would have no size la forme n’aurait aucune taille diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 0209d28c62..86cc0e0312 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3090,6 +3090,9 @@ # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle બાઉન્ડિંગ લંબચોરસ ઉમેરો Add Bounding Circle બાઉન્ડિંગ વર્તુળ ઉમેરો + Add Bounding Rectangle… બાઉન્ડિંગ લંબચોરસ ઉમેરો… + Add Bounding Circle… બાઉન્ડિંગ વર્તુળ ઉમેરો… + One per Object દરેક ઑબ્જેક્ટ માટે એક Remove Guide ગાઇડ દૂર કરો Remove Item આઇટમ દૂર કરો Remove JavaScript File JavaScript ફાઇલ દૂર કરો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 674602dcad..6d6205221b 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -8468,6 +8468,9 @@ liquify-list-end {0}, {1} {0} और {1} # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle बाउंडिंग आयत जोड़ें Add Bounding Circle बाउंडिंग वृत्त जोड़ें + Add Bounding Rectangle… बाउंडिंग आयत जोड़ें… + Add Bounding Circle… बाउंडिंग वृत्त जोड़ें… + One per Object प्रत्येक ऑब्जेक्ट के लिए एक @msg nothing to enclose घेरने के लिए कुछ नहीं @msg `offset` must be 0 or more `offset` 0 या उससे अधिक होना चाहिए @msg the shape would have no size आकृति का कोई आकार नहीं होगा diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 655baf4acf..3bf85012d3 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7819,6 +7819,9 @@ breakText Glyphs Glifák # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Befoglaló téglalap hozzáadása Add Bounding Circle Befoglaló kör hozzáadása + Add Bounding Rectangle… Befoglaló téglalap hozzáadása… + Add Bounding Circle… Befoglaló kör hozzáadása… + One per Object Objektumonként egy @msg nothing to enclose nincs mit körülvenni @msg `offset` must be 0 or more `offset`: 0 vagy nagyobb érték kell @msg the shape would have no size az alakzatnak nem lenne mérete diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 55f916de4e..23d6c34bd0 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -7077,6 +7077,13 @@ breakText Glyphs Glif # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Tambahkan persegi panjang pembatas Add Bounding Circle Tambahkan lingkaran pembatas + Add Bounding Rectangle… Tambahkan persegi panjang pembatas… + Add Bounding Circle… Tambahkan lingkaran pembatas… + One per Object Satu per objek +@msg nothing to enclose tidak ada yang bisa dilingkupi +@msg `offset` must be 0 or more `offset` harus 0 atau lebih +@msg the shape would have no size bentuk tidak akan memiliki ukuran +@msg the shape would reach past the edge of the canvas bentuk akan melewati tepi kanvas # Document Tools add-on (Object › Plug-ins › Document Tools): Save a Timestamped Copy. Document Tools Alat dokumen Save a Timestamped Copy Simpan salinan bercap waktu diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 0ad81a0b40..719bce9368 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7461,6 +7461,9 @@ breakText Glyphs Glifi # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Aggiungi rettangolo di delimitazione Add Bounding Circle Aggiungi cerchio di delimitazione + Add Bounding Rectangle… Aggiungi rettangolo di delimitazione… + Add Bounding Circle… Aggiungi cerchio di delimitazione… + One per Object Uno per oggetto @msg nothing to enclose niente da racchiudere @msg `offset` must be 0 or more `offset` deve essere 0 o maggiore @msg the shape would have no size la forma non avrebbe dimensioni diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 74c3bb7e54..cbb976974d 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -9351,6 +9351,9 @@ breakText Glyphs 字形 # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle 外接長方形を追加 Add Bounding Circle 外接円を追加 + Add Bounding Rectangle… 外接長方形を追加… + Add Bounding Circle… 外接円を追加… + One per Object オブジェクトごとに 1 つ @msg nothing to enclose 囲むものがありません @msg `offset` must be 0 or more `offset` には 0 以上を指定してください @msg the shape would have no size 図形にサイズがありません diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index c97768ab17..4bafecc60e 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -10032,6 +10032,9 @@ breakText Glyphs გლიფები # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle შემომსაზღვრელი მართკუთხედის დამატება Add Bounding Circle შემომსაზღვრელი წრეწირის დამატება + Add Bounding Rectangle… შემომსაზღვრელი მართკუთხედის დამატება… + Add Bounding Circle… შემომსაზღვრელი წრეწირის დამატება… + One per Object თითო თითოეულ ობიექტზე @msg nothing to enclose შემოსაზღვრელი არაფერია @msg `offset` must be 0 or more `offset` უნდა იყოს 0 ან მეტი @msg the shape would have no size ფიგურას ზომა არ ექნებოდა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index cd67d51b9d..115d50065b 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -7433,6 +7433,9 @@ breakText Glyphs 글리프 # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle 경계 사각형 추가 Add Bounding Circle 경계 원 추가 + Add Bounding Rectangle… 경계 사각형 추가… + Add Bounding Circle… 경계 원 추가… + One per Object 개체마다 하나 @msg nothing to enclose 둘러쌀 항목이 없습니다 @msg `offset` must be 0 or more `offset`은(는) 0 이상이어야 합니다 @msg the shape would have no size 도형의 크기가 없습니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index b7bfb1642a..39d16ee18c 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -9726,6 +9726,9 @@ breakText Glyphs Glyphs # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Begrenzingsrechthoek toevoegen Add Bounding Circle Begrenzingscirkel toevoegen + Add Bounding Rectangle… Begrenzingsrechthoek toevoegen… + Add Bounding Circle… Begrenzingscirkel toevoegen… + One per Object Eén per object @msg nothing to enclose niets om te omsluiten @msg `offset` must be 0 or more `offset` moet 0 of meer zijn @msg the shape would have no size de vorm zou geen grootte hebben diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index acfbeeaa8e..c1f3cded0d 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7689,6 +7689,9 @@ breakText Glyphs Glify # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Dodaj prostokąt otaczający Add Bounding Circle Dodaj okrąg otaczający + Add Bounding Rectangle… Dodaj prostokąt otaczający… + Add Bounding Circle… Dodaj okrąg otaczający… + One per Object Jeden na obiekt @msg nothing to enclose nie ma czego otoczyć @msg `offset` must be 0 or more `offset` musi wynosić 0 lub więcej @msg the shape would have no size kształt nie miałby rozmiaru diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index acfdaa8c64..9d898bf513 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7853,6 +7853,9 @@ breakText Glyphs Glifos # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Adicionar Retângulo Delimitador Add Bounding Circle Adicionar Círculo Delimitador + Add Bounding Rectangle… Adicionar Retângulo Delimitador… + Add Bounding Circle… Adicionar Círculo Delimitador… + One per Object Um por objeto @msg nothing to enclose nada para envolver @msg `offset` must be 0 or more `offset` deve ser 0 ou mais @msg the shape would have no size a forma não teria tamanho diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 96cf7d4132..36321532fd 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -7824,6 +7824,9 @@ breakText Glyphs Глифы # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Добавить описанный прямоугольник Add Bounding Circle Добавить описанную окружность + Add Bounding Rectangle… Добавить описанный прямоугольник… + Add Bounding Circle… Добавить описанную окружность… + One per Object По одной на объект @msg nothing to enclose нечего окружать @msg `offset` must be 0 or more `offset` должно быть 0 или больше @msg the shape would have no size у фигуры не было бы размера diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 2ce32833b1..d6d44db58d 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7868,6 +7868,9 @@ breakText Glyphs Glyfer # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Lägg till omslutande rektangel Add Bounding Circle Lägg till omslutande cirkel + Add Bounding Rectangle… Lägg till omslutande rektangel… + Add Bounding Circle… Lägg till omslutande cirkel… + One per Object En per objekt @msg nothing to enclose inget att omsluta @msg `offset` must be 0 or more `offset` måste vara 0 eller mer @msg the shape would have no size formen skulle inte ha någon storlek diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 0ba3af2c12..8943207a6f 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -9724,6 +9724,9 @@ breakText Glyphs Glifler # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Çevreleyen Dikdörtgen Ekle Add Bounding Circle Çevreleyen Daire Ekle + Add Bounding Rectangle… Çevreleyen Dikdörtgen Ekle… + Add Bounding Circle… Çevreleyen Daire Ekle… + One per Object Nesne başına bir @msg nothing to enclose çevrelenecek hiçbir şey yok @msg `offset` must be 0 or more `offset` 0 veya daha büyük olmalıdır @msg the shape would have no size şeklin boyutu olmayacaktır diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index f6e91e2e3e..4e7c38ac2f 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7443,6 +7443,9 @@ breakText Glyphs Гліфи # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Додати описаний прямокутник Add Bounding Circle Додати описане коло + Add Bounding Rectangle… Додати описаний прямокутник… + Add Bounding Circle… Додати описане коло… + One per Object По одній на об’єкт @msg nothing to enclose нічого обводити @msg `offset` must be 0 or more `offset` має бути 0 або більше @msg the shape would have no size фігура не мала б розміру diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 4381bb5ed0..065842a2cd 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7487,6 +7487,9 @@ breakText Glyphs Glyph # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle Thêm hình chữ nhật bao quanh Add Bounding Circle Thêm hình tròn bao quanh + Add Bounding Rectangle… Thêm hình chữ nhật bao quanh… + Add Bounding Circle… Thêm hình tròn bao quanh… + One per Object Một cho mỗi đối tượng @msg nothing to enclose không có gì để bao quanh @msg `offset` must be 0 or more `offset` phải từ 0 trở lên @msg the shape would have no size hình sẽ không có kích thước diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 06d1b050f7..bfdff0b087 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7671,6 +7671,9 @@ breakText Glyphs 字形 # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle 添加外接矩形 Add Bounding Circle 添加外接圆 + Add Bounding Rectangle… 添加外接矩形… + Add Bounding Circle… 添加外接圆… + One per Object 每个对象一个 @msg nothing to enclose 没有可包围的内容 @msg `offset` must be 0 or more `offset` 必须大于或等于 0 @msg the shape would have no size 形状将没有大小 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 8a134df615..8b32a97fb2 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -7492,6 +7492,9 @@ breakText Glyphs 字符 # Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle. Add Bounding Rectangle 新增外接矩形 Add Bounding Circle 新增外接圓形 + Add Bounding Rectangle… 新增外接矩形… + Add Bounding Circle… 新增外接圓形… + One per Object 每個物件一個 @msg nothing to enclose 沒有可包圍的內容 @msg `offset` must be 0 or more `offset` 必須大於或等於 0 @msg the shape would have no size 形狀將沒有大小 diff --git a/docs/mcp.md b/docs/mcp.md index 2d884ba6e1..96b3dcbcab 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -13432,9 +13432,9 @@ Commands: Preview; with a point selected, every Tangents choice gives the same lines. → `{ids, external, internal, centerline, warning?}` (`centerline`: the centerline's id, or null). - `addon.pathtools.boundingRectangle {each?, offset?}` draws a live rectangle on the geometric bounding box of the - selected objects, strokes and effects left out (Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle, + selected objects, strokes and effects left out (Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle…, #6966). `addon.pathtools.boundingCircle {each?, offset?}` draws the smallest live circle that holds the outlines of - the selected objects (Add Bounding Circle). The circle reads paths and compound paths by their curves, clip groups + the selected objects (Add Bounding Circle…). The circle reads paths and compound paths by their curves, clip groups and sublayers that clip their contents by their clipping paths, other sublayers by their shown objects, images by their corners, and type and other objects by the corners of their bounding box. It splits each curve into pieces until every piece's control points lie within 0.01 pt of its chord, fits the circle to the ends of the pieces, and @@ -13442,8 +13442,9 @@ Commands: most; a piece that still bends more counts by its control points, which can make the circle slightly larger than the smallest one. `offset` (0 or more, default 0) adds space: a rectangle grows by `offset` on each side and a circle's radius grows by `offset`. `each: true` draws one shape around each selected object instead of one around the whole - selection. The two menu items open no dialog: they draw one shape around the whole selection with no offset, and - `each` and `offset` are set only through the commands. + selection. The menu items Add Bounding Rectangle… and Add Bounding Circle… open a dialog with Offset (0 to 4,000,000 + pt, default 0), One per Object (`each`, default off) and Preview; OK draws the shapes as one undo step, and Cancel + removes the preview without a step of history. Each shape gets the current paint and goes on top of the current layer, or of the isolated group, as other new art does; inside an isolated compound path it goes beside the compound path and does not join it. The new shapes are @@ -13451,8 +13452,9 @@ Commands: a shape with no size: the rectangle around a straight horizontal or vertical line, or the circle around a single point, unless `offset` is more than 0. With `each`, the result's `skipped` counts those objects. It is an error, with the document unchanged, when no shape is left to draw ("the shape would have no size" when a shape with no size was - left out, else "nothing to enclose"), when a shape would reach more than 4,000,000 pt from the origin ("the shape - would reach past the edge of the canvas", for example with a very large `offset`), and when `offset` is below 0. + left out, else "nothing to enclose"), when an edge of a shape (of a circle's bounding box) would lie more than + 4,000,000 pt from the origin along either axis ("the shape would reach past the edge of the canvas", for example + with a very large `offset`), and when `offset` is below 0. → `{id: the first shape, ids, skipped?}` ```json diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 5d50f33ba4..964e8b6d91 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2793,7 +2793,7 @@ A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Pre ## Path Precision Tools add-on: Add Bounding Rectangle and Add Bounding Circle (2026-11-17) -A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle (`addon.pathtools.boundingRectangle`) draws a live rectangle on the selection's geometric bounding box, and Add Bounding Circle (`addon.pathtools.boundingCircle`) draws the [smallest enclosing circle](https://en.wikipedia.org/wiki/Smallest-circle_problem) of the selected outlines, with curves flattened to within 0.01 pt and the radius 0.01 pt larger, so the circle holds the curves. Both use the current paint, go on top of the current layer or the isolated group, and are one undo step; shapes with no size are skipped (#6966). The menu items draw one shape around the whole selection with no offset; the commands also take `each` (one shape per object) and `offset`. Tests: `shapes::tests` in `vectorcraft-geom` (`enclosing`, `convex_hull`), `cmd::addons::pathtools::bounding::tests` in `vectorcraft-engine` and `addons::pathtools::tests` in `vectorcraft-ui-egui` (`add_bounding_rectangle_and_circle`). Commands: `docs/mcp.md` › Path Precision Tools add-on. +A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle (`addon.pathtools.boundingRectangle`) draws a live rectangle on the selection's geometric bounding box, and Add Bounding Circle (`addon.pathtools.boundingCircle`) draws the [smallest enclosing circle](https://en.wikipedia.org/wiki/Smallest-circle_problem) of the selected outlines, with curves flattened to within 0.01 pt and the radius 0.01 pt larger, so the circle holds the curves. Both use the current paint, go on top of the current layer or the isolated group, and are one undo step; shapes with no size are skipped (#6966). The commands take `each` (one shape per object) and `offset`, and the menu items Add Bounding Rectangle… and Add Bounding Circle… open a dialog with Offset, One per Object and Preview. Tests: `shapes::tests` in `vectorcraft-geom` (`enclosing`, `convex_hull`), `cmd::addons::pathtools::bounding::tests` in `vectorcraft-engine` and `addons::pathtools::tests` in `vectorcraft-ui-egui` (`add_bounding_rectangle_and_circle_open_a_dialog_with_offset_and_one_per_object`). Commands: `docs/mcp.md` › Path Precision Tools add-on. ## Path Precision Tools add-on: Expand Dashes into Paths (2026-11-01) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 21f28f9600..4e27e7da3d 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -517,7 +517,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Expand Dashes into Paths turns each selected path's dashed stroke into separate open paths, one per dash, laid out as the stroke draws them (pattern, offset, Align Dashes to Corners and Path Ends), each keeping the stroke with the dashes off; one undo step | done | #4922; `addon.pathtools.expandDashes` (in `crates/engine/src/cmd/addons/pathtools.rs`, using the renderer's dash layout) and its tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Smooth Bridge… (Radius as a percentage of the smaller circle's radius, Keep Originals; Preview) joins two selected circles into one outline with two concave arcs that touch both circles, in place of the circles or above them; one undo step | done | `addon.pathtools.bridge`, `crates/pathops/src/addons/pathtools/bridge.rs`, `crates/ui-egui/src/addons/pathtools/bridge.rs` and their tests; a VectorCraft addition, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Tangent Circle… draws the circles that touch two selected paths or compound paths at a radius, or three of them, each touching the outlines without crossing them; Radius (two shapes), a Circle menu (All or one by number) and Preview; one undo step | done | `addon.pathtools.tangentCircle` (in `crates/engine/src/cmd/addons/pathtools/tangent_circle.rs`, geometry in `crates/pathops/src/addons/pathtools/tangent_circle.rs`) and its tests; a VectorCraft addition, so it is not scored | -| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle and Add Bounding Circle draw a live rectangle on the selection's geometric bounding box, or the smallest live circle that holds its outlines, around the whole selection with no offset, without a dialog; one undo step | done | `addon.pathtools.boundingRectangle` and `addon.pathtools.boundingCircle` (in `crates/engine/src/cmd/addons/pathtools/bounding.rs`, the circle in `crates/geom/src/shapes.rs`, `enclosing_circle`; `each` and `offset` are command parameters only) and their tests, with the menu items' test `add_bounding_rectangle_and_circle_draw_around_the_whole_selection` in `crates/ui-egui/src/addons/pathtools/tests.rs`; a VectorCraft addition, so it is not scored | +| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools › Add Bounding Rectangle… and Add Bounding Circle… draw a live rectangle on the selection's geometric bounding box, or the smallest live circle that holds its outlines, from a dialog with Offset, One per Object (a shape around each object instead of one around the whole selection) and Preview; one undo step | done | `addon.pathtools.boundingRectangle` and `addon.pathtools.boundingCircle` (in `crates/engine/src/cmd/addons/pathtools/bounding.rs`, the circle in `crates/geom/src/shapes.rs`, `enclosing_circle`; the dialog is the command dialog, `crates/ui-egui/src/dialogs/command.rs`) and their tests, with the menu items' test `add_bounding_rectangle_and_circle_open_a_dialog_with_offset_and_one_per_object` in `crates/ui-egui/src/addons/pathtools/tests.rs`; a VectorCraft addition, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Effect › Path Effects lists its live effects (Dashes to Geometry, Add Anchors, Extend Path, Close Path, Smooth Anchors, Retract Handles, Reverse Direction, Simplify Anchors, Split at Anchors), each with the effect dialog's live Preview except Reverse Direction, which has no options, and listed in the Appearance panel like any effect | done | `addon.path.*`, `crates/effects/src/addons/path.rs`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its four tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/shape.rs` and their tests; not a feature of the reference app, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its six tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape, Corner Tool, Slide Anchor Along Path), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; the Corner Tool cuts editable corners on any path (hover shows the anchor, a click uses its radius and kind, a drag sizes the corner, Shift whole values; a corner's marker selects it and loads its values, drags to resize, to 0 or double-clicked removes it; never past what fits; Alt-marquee cuts every anchor inside) with a Corners section in the Anchor Inspector (radius, kind, selected count, Apply to Selected Anchors); Slide Anchor Along Path drags an anchor along its curve with the segments beside it refitted, Shift snapping where the tangent is a multiple of 45°; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/` and their tests; not a feature of the reference app, so it is not scored |