diff --git a/ROADMAP.md b/ROADMAP.md index 879133f4c7..24ed4abd7b 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -131,6 +131,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap - 2026-11-12: Stencil Bridges in the Cutting Tools add-on (Object › Plug-ins › Cutting Tools): strips of a set width are cut out of the selected art so that every island of a stencil cut from it (the inside of an O, a hole in a shape) stays attached to the sheet, by the shortest crossings first, vertical, horizontal or the shortest among 12 directions 15° apart, with up to 16 bridges per island; type is measured by its glyph outlines and stays type, and the original goes to a hidden layer or is replaced. One undo step (`addon.cutting.bridges`). A VectorCraft addition: headline numbers unchanged. - 2026-11-13: Banner Hems and Grommets in the Cutting Tools add-on (Object › Plug-ins › Cutting Tools): on the chosen sides of the selected art's bounds, or of each artboard, a hem line at a set depth inside the edge and grommet marks (a circle with a cross) at a set inset, one at each end of a side and the rest spread evenly at most a set spacing apart, stroked in a chosen swatch; a dialog with Preview, one undo step (`addon.cutting.banner`). A VectorCraft addition: headline numbers unchanged. - 2026-11-14: Nest Shapes in the Cutting Tools add-on (Object › Plug-ins › Cutting Tools): the selected objects move close together onto an artboard, a sheet of a set size or a roll of a set width, packed by their bounding boxes with a margin inside the edges and a spacing between them, optionally turning objects 90° to fit; objects that do not fit go in a column beside the sheet; a dialog with Preview, one undo step (`addon.cutting.nest`). A VectorCraft addition: headline numbers unchanged. +- 2026-11-15: With Smart Guides and Snap to Tangent on, a circle drawn from its center with the Ellipse tool (Alt and Shift) snaps its radius so that the circle touches a nearby path (a straight segment, a curve, or another circle from outside or inside) when the radius comes within the snapping tolerance of that size, and the touch point shows the "tangent" label. A VectorCraft addition: headline numbers unchanged. - 2026-11-05: Release Type on a Path joins the Type Tools add-on (Object › Plug-ins › Type Tools): each selected type on a path splits into point type with the same text and attributes, on one straight line starting where its first character sat, and the plain path it was set on, with its exact shape and place in the stacking order and no paint; or keeps only the path or only the text, optionally leaving the original. A dialog with Preview, one undo step (`addon.type.releasePath`, #5532). A VectorCraft addition: headline numbers unchanged. - 2026-11-04: New Document: the units chosen in Preset Details now belong to the chosen document, as the pane's options are listed for the selected preset; the chosen card shows them, every other Recent and Saved card keeps the units its document or preset was made in, and the built-in tabs still follow the chosen units, so switching between inches and millimetres no longer restyles every recent template. Scores and estimates unchanged. - 2026-11-14: Packaging Tools add-on (Object › Plug-ins › Packaging Tools): fold line roles for dielines (Cut, Crease, Partial Cut, Perforation), each carried by the swatch on a path's top stroke through a per-document role table that native files keep; PDF prints a role line on its swatch's separation when that swatch is a spot color, as the default role swatches are, and SVG, DXF and HP-GL keep the stroke's color. Make Cut Line, Make Crease Line, Make Partial Cut Line and Make Perforation Line give the selected paths a role, overprinting by default, and make a missing role swatch; the Fold Lines panel counts each role in the selection or the document, and its Role Swatches… picks another swatch for a role (`addon.packaging.setRole`, `addon.packaging.roles`, `addon.packaging.setRoleSwatch`). A VectorCraft addition: headline numbers unchanged. diff --git a/crates/tools/src/guides/snap.rs b/crates/tools/src/guides/snap.rs index d7ee8ecdd8..36bea9b231 100644 --- a/crates/tools/src/guides/snap.rs +++ b/crates/tools/src/guides/snap.rs @@ -421,6 +421,23 @@ impl DrawSnap { self.guides.clear(); } + /// Snap to Tangent for a circle drawn around `center`, its radius `r` set by the pointer at `p` + /// through the dragged `corner` (where [`Self::drag`] put it): the radius, within the Smart + /// Guides snapping tolerance of `r`, at which the circle touches nearby art + /// ([`Targets::tangent_radius`]), its guides replacing the last snap's. None, the guides kept, + /// with Smart Guides or Snap to Tangent off, pixels or the grid snapping instead (each read + /// again on every move, as [`PointSnap::snap_from`] reads pixels and the grid), nothing in + /// reach, or an anchor, center or crossing in reach of `p` or at `corner`. + pub fn circle_radius(&mut self, cx: &ToolContext, center: Point, p: Point, corner: Point, r: f64) -> Option { + let Some((_, PointSnap { targets: Some((t, tol)), op })) = &self.targets else { return None }; + if !cx.smart_guides || !cx.snap_tangent || cx.snaps_to_pixel(*op) || cx.snap_to_grid { + return None; + } + let (radius, guides) = t.tangent_radius(center, p, corner, r, cx.tol(*tol))?; + self.guides = guides; + Some(radius) + } + /// Snap `p`, dragged since the press, with the targets the press gathered. pub fn drag(&mut self, cx: &ToolContext, p: Point, from: Option<&Leave>) -> Point { if self.targets.is_none() { diff --git a/crates/tools/src/guides/targets.rs b/crates/tools/src/guides/targets.rs index e3e6abeef6..7341cf2713 100644 --- a/crates/tools/src/guides/targets.rs +++ b/crates/tools/src/guides/targets.rs @@ -107,6 +107,89 @@ pub(super) fn span(r: &Rect, x: bool) -> (f64, f64) { if x { (r.x0, r.x1) } else { (r.y0, r.y1) } } +/// Is `v` square to the direction `d` (both nonzero)? +fn square_to(v: Vec2, d: Vec2) -> bool { + let scale = v.hypot() * d.hypot(); + scale > 1e-18 && v.dot(d).abs() <= 1e-9 * scale +} + +/// Do the directions `a` and `b` (both nonzero) run the same way? +fn parallel(a: Vec2, b: Vec2) -> bool { + let scale = a.hypot() * b.hypot(); + scale > 1e-18 && a.dot(b) > 0.0 && a.cross(b).abs() <= 1e-6 * scale +} + +/// Does the curve `seg` run around `center` the whole way, as an arc of a circle about it drawn +/// with curves does: nearly square to the center all along, and its distance from the center +/// varying by no more than 0.03%? A circle drawn with four curves ([`vectorcraft_geom::shapes::ellipse`]) +/// strays outward from its radius by up to 0.0273%, so an ellipse whose axes differ by less than +/// that cannot be told from one. A circle around the center then lies along the curve. +fn runs_round(seg: &PathSeg, center: Point) -> bool { + const SAMPLES: [f64; 9] = [0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0]; + if matches!(seg, PathSeg::Line(_)) { + return false; + } + let (mut lo, mut hi) = (f64::INFINITY, 0.0_f64); + for t in SAMPLES { + let (v, d) = (seg.eval(t) - center, seg_direction(seg, t)); + if v.dot(d).abs() > 2e-3 * v.hypot() * d.hypot() { + return false; + } + (lo, hi) = (lo.min(v.hypot()), hi.max(v.hypot())); + } + hi - lo <= 3e-4 * hi +} + +/// Whether a segment of `segs` other than the `i`th carries on past the end `at` of the `i`th +/// (its start when `at_start`) in the same direction: it has an end at `at` and runs away from +/// it the way the `i`th runs out through it, so the two join smoothly there rather than overlap. +fn continues_smoothly(segs: &[&PathSeg], i: usize, at: Point, at_start: bool) -> bool { + let Some(seg) = segs.get(i) else { return false }; + let d = end_direction(seg, at_start); + let out = if at_start { -d } else { d }; + let close = 1e-9 * (1.0 + at.x.abs().max(at.y.abs())); + segs.iter().enumerate().filter(|(j, _)| *j != i).any(|(_, s)| { + [(true, s.start()), (false, s.end())].into_iter().any(|(start, end)| { + let d = end_direction(s, start); + end.distance(at) <= close && parallel(if start { d } else { -d }, out) + }) + }) +} + +/// The direction `seg` runs at its start (`at_start`) or its end. Where a curve's handle lies on +/// its anchor the derivative there is zero, so the direction is taken toward the next control +/// point that differs from the anchor, the direction the curve leaves the anchor in. +fn end_direction(seg: &PathSeg, at_start: bool) -> Vec2 { + let mut points: Vec = match seg { + PathSeg::Line(l) => vec![l.p0, l.p1], + PathSeg::Quad(q) => vec![q.p0, q.p1, q.p2], + PathSeg::Cubic(c) => vec![c.p0, c.p1, c.p2, c.p3], + }; + if !at_start { + points.reverse(); + } + let Some((&anchor, rest)) = points.split_first() else { return Vec2::ZERO }; + let away = rest.iter().map(|q| *q - anchor).find(|v| v.hypot2() > 0.0).unwrap_or(Vec2::ZERO); + if at_start { away } else { -away } +} + +/// The points inside `seg` where the line from `center` meets it square, where a circle round +/// `center` touches it, with the segment's direction there. A straight segment has at most one, its +/// foot of the perpendicular. On a curve, besides the sign changes [`touch_params`] finds, a sample +/// where the line is square exactly counts too: a center straight out from a symmetric curve's +/// middle meets it square at t = 0.5. +fn radial_touches(seg: &PathSeg, center: Point) -> Vec<(Point, Vec2)> { + /// The samples checked for an exact square meeting, as [`touch_params`] samples the curve. + const STEPS: u32 = 24; + if let PathSeg::Line(l) = seg { + let d = l.p1 - l.p0; + let t = (center - l.p0).dot(d) / d.hypot2(); + return if t.is_finite() && t > 0.0 && t < 1.0 { vec![(l.p0 + d * t, d)] } else { vec![] }; + } + let sampled = (1..STEPS).map(|i| f64::from(i) / f64::from(STEPS)).filter(|&t| square_to(seg.eval(t) - center, seg_direction(seg, t))); + sampled.chain(touch_params(seg, center, true)).map(|t| (seg.eval(t), seg_direction(seg, t))).collect() +} + /// Along axis `x`, does dragging `handle` move the box's minimum edge (true) or maximum (false)? fn resize_moves_min_edge(handle: Handle, x: bool) -> Option { let (ax, ay) = handle.axes(); @@ -778,6 +861,74 @@ impl Targets { out } + /// Snap to Tangent for a circle drawn around `center` with radius `r`: the radius nearest `r`, + /// within `tol` of it, at which the circle touches a target segment (where the line from + /// `center` meets the path square, at a point the path runs smoothly through), and the guides + /// showing it. None with an anchor, a center or a crossing within `tol` of the pointer `p`, or + /// at `corner`, where the drawn point snapped to: those win as they do for a drawn point. At + /// most 256 segments are measured, the ones nearest `p` when more cross the ring round + /// `center` at radius `r`. + pub(super) fn tangent_radius(&self, center: Point, p: Point, corner: Point, r: f64, tol: f64) -> Option<(f64, Vec)> { + /// How many segments one pointer move measures at most. + const MAX_SEGMENTS: usize = 256; + let finite = [center.x, center.y, p.x, p.y, corner.x, corner.y, r, tol].iter().all(|v| v.is_finite()); + if !self.tangent || !finite || r < 0.0 || tol <= 0.0 { + return None; + } + if self.nearest_point(p, tol).is_some() || self.crossing(p, tol).is_some() { + return None; + } + // The corner snapped onto a point or a crossing: it lies on one, not merely near. + let on = |q: Point| q.distance(corner) <= 1e-9 * (1.0 + corner.x.abs().max(corner.y.abs())); + if self.nearest_point(corner, tol).is_some_and(|(q, _)| on(q)) || self.crossing(corner, tol).is_some_and(on) { + return None; + } + let (lo, hi) = (r - tol, r + tol); + // A segment can touch the circle only if part of its control bounds lies within the ring + // between `lo` and `hi` around the center. + let in_ring = |b: &Rect| { + let near = Point::new(center.x.clamp(b.x0, b.x1), center.y.clamp(b.y0, b.y1)).distance(center); + let far = (center.x - b.x0).abs().max((center.x - b.x1).abs()).hypot((center.y - b.y0).abs().max((center.y - b.y1).abs())); + near <= hi && far >= lo + }; + let mut best: Option<(f64, Point, Vec2)> = None; + let mut offer = |q: Point, d: Vec2| { + let rho = q.distance(center); + if rho > tol && (rho - r).abs() <= tol && best.is_none_or(|(b, ..)| (rho - r).abs() < (b - r).abs()) { + best = Some((rho, q, d)); + } + }; + let mut ring: Vec<&(Rect, PathSeg)> = self.segments.iter().filter(|(b, _)| in_ring(b)).collect(); + if ring.len() > MAX_SEGMENTS { + let from_p = |b: &Rect| Point::new(p.x.clamp(b.x0, b.x1), p.y.clamp(b.y0, b.y1)).distance(p); + ring.select_nth_unstable_by(MAX_SEGMENTS, |a, b| from_p(&a.0).total_cmp(&from_p(&b.0))); + ring.truncate(MAX_SEGMENTS); + } + let near: Vec<&PathSeg> = ring.into_iter().map(|(_, s)| s).collect(); + for (i, seg) in near.iter().enumerate() { + // A circle around the same center lies along such a curve rather than touching it. + if runs_round(seg, center) { + continue; + } + for (q, d) in radial_touches(seg, center) { + offer(q, d); + } + // At an end square to the center the circle touches the path only where the next + // segment carries on in the same direction: at a corner or an open end it meets it. + // That segment ends on the circle too, so it is in the ring; when more than + // MAX_SEGMENTS segments are in the ring and it is not among those kept, the end is not + // offered. + for (at_start, end) in [(true, seg.start()), (false, seg.end())] { + let d = end_direction(seg, at_start); + if square_to(end - center, d) && continues_smoothly(&near, i, end, at_start) { + offer(end, d); + } + } + } + let (rho, q, d) = best?; + Some((rho, self.touch_guides(center, q, false, d, tol))) + } + /// The segment extension nearest `p`, within `tol` of it (and `p` farther than that from the /// end it starts at): that end, its direction and where `p` lands on it. Where `p` is nearer /// the horizontal or the vertical through that end there is none: lining up with it ("align") diff --git a/crates/tools/src/shape.rs b/crates/tools/src/shape.rs index 9eda809c03..0743036fb6 100644 --- a/crates/tools/src/shape.rs +++ b/crates/tools/src/shape.rs @@ -15,6 +15,10 @@ //! box's eight handles scales the selection, a press on the selection's centre point (Show Center) //! moves it, and one just outside a corner of its box turns it about that centre, as the Selection //! tool's handles, centre point and rotate zone do; a press anywhere else draws a new shape (#5477). +//! +//! With Smart Guides and Snap to Tangent on, a circle drawn from its center with the Ellipse tool (Alt and Shift) +//! takes the radius at which it touches a nearby path whenever its radius comes within the +//! snapping tolerance of it ([`DrawSnap::circle_radius`]). use serde_json::{Value, json}; use vectorcraft_doc::OrientedBox; @@ -92,6 +96,10 @@ pub struct ShapeTool { pub star_ratio: f64, /// The star's inner radius held while Ctrl/Cmd is down in a drag. inner: Option, + /// Where the last drag put the dragged corner of a circle drawn from its center, from the + /// center, when Snap to Tangent sized it ([`Self::tangent_circle`]); none when the pointer + /// sized it. Space moving the circle moves the corner it was drawn with there and clears it. + tangent_corner: Option, /// Line Segment Tool Options: the length and angle (degrees) a click's dialog opens with, and /// Fill Line (new lines take the current fill). pub line_length: f64, @@ -153,6 +161,7 @@ impl ShapeTool { corner_radius: 12.0, star_ratio: 0.5, inner: None, + tangent_corner: None, snap: DrawSnap::default(), line_length: 100.0, line_angle: 0.0, @@ -418,6 +427,27 @@ impl ShapeTool { } } + /// Snap to Tangent for a circle drawn from its center `s` (the Ellipse tool with Alt and + /// Shift): the dragged corner `p` moved toward or away from `s` so that the circle touches a + /// nearby path, when its radius is within the snapping tolerance of a touching one + /// ([`DrawSnap::circle_radius`]); `raw` is the pointer before snapping. The radius is measured + /// along the Constrain Angle's axes, as the drawn box is ([`turned_box`]). None for any other + /// shape or modifiers, or with `p` on `s`. + fn tangent_circle(&mut self, cx: &ToolContext, s: Point, raw: Point, p: Point, m: Mods) -> Option { + if self.id != "ellipse" || !(m.alt && m.shift) || m.space { + return None; + } + let axes = vectorcraft_geom::constrain_axes(cx.constrain_angle).unwrap_or(Affine::IDENTITY); + let back = axes.inverse(); + let (c, d) = (back * s, back * p - back * s); + let r = d.x.abs().max(d.y.abs()); + if r.is_nan() || r <= 0.0 { + return None; + } + let radius = self.snap.circle_radius(cx, s, raw, p, r)?; + Some(axes * (c + d * (radius / r))) + } + /// The command for a drag from `start` to `p` (snapped: a line's end already keeps Shift's /// angle). pub fn command(&self, start: Point, p: Point, m: Mods) -> (String, Value) { @@ -560,6 +590,7 @@ impl Tool for ShapeTool { } PointerKind::Drag => { let Some(mut s) = self.start else { return vec![] }; + let raw = ev.pos; let pos = self.snap.drag(cx, ev.pos, self.leave(cx, s, ev.mods).as_ref()); let ev = &PointerEvent { pos, ..*ev }; // The inner radius of the star the last drag showed, with the ratio it drew with: @@ -567,15 +598,28 @@ impl Tool for ShapeTool { // first arrives with the next position. let ratio = if self.mods.alt { straight_ratio(self.points).unwrap_or(self.star_ratio) } else { self.star_ratio }; let shown = (self.last - s).hypot() * ratio; + // Space moves a circle Snap to Tangent sized from the corner it was drawn with, so + // it keeps that size while it moves and after Space is let go. + if ev.mods.space + && self.began + && let Some(d) = self.tangent_corner.take() + { + self.last = s + d; + } space_moves(&mut s, &mut self.last, ev, self.began); self.start = Some(s); self.mods = ev.mods; if self.id == "star" { self.hold_inner(shown, s, ev.pos, ev.mods); } + // A circle from its center takes a radius that touches a nearby path. Whether the + // drag has begun is judged before that snap. + let dragged = ev.pos; + self.tangent_corner = self.tangent_circle(cx, s, raw, ev.pos, ev.mods).map(|q| q - s); + let ev = &PointerEvent { pos: self.tangent_corner.map_or(ev.pos, |d| s + d), ..*ev }; let mut out = vec![]; if !self.began { - if ev.pos.distance(s) < cx.tol(2.0) { + if dragged.distance(s) < cx.tol(2.0) { return out; } self.began = true; @@ -733,7 +777,9 @@ impl Tool for ShapeTool { let (w, h) = match self.id { "polygon" => ((self.last - s).x.abs(), (self.last - s).y.abs()), _ => { - let (r, _) = turned_box(s, self.last, self.mods, cx.constrain_angle); + // The corner Snap to Tangent moved a circle's to, as the preview draws it. + let corner = self.tangent_corner.map_or(self.last, |d| s + d); + let (r, _) = turned_box(s, corner, self.mods, cx.constrain_angle); (r.width(), r.height()) } }; diff --git a/crates/tools/src/shape/tests.rs b/crates/tools/src/shape/tests.rs index c76eef404e..4e0ee1d1dc 100644 --- a/crates/tools/src/shape/tests.rs +++ b/crates/tools/src/shape/tests.rs @@ -196,6 +196,356 @@ fn shift_square_alt_center() { assert_eq!(v, json!({"x": -10.0, "y": -10.0, "width": 20.0, "height": 20.0})); } +/// A 500 × 500 document holding `paths`. +fn doc_holding_paths(paths: impl IntoIterator) -> vectorcraft_doc::Document { + let mut d = vectorcraft_doc::Document::new(500.0, 500.0); + let l = d.layers[0].id; + for (i, path) in paths.into_iter().enumerate() { + let id = d.alloc_id(); + d.insert(Some(l), i, vectorcraft_doc::Node::path(id, path, vectorcraft_doc::Appearance::default_art())).unwrap(); + } + d +} + +/// The box of the last preview of a drag: x, y, width, height. +fn previewed_box(a: &[Action]) -> [f64; 4] { + let Some(Action::Preview(_, v)) = a.last() else { panic!("no preview: {a:?}") }; + ["x", "y", "width", "height"].map(|k| v[k].as_f64().unwrap_or(f64::NAN)) +} + +/// An Alt+Shift drag with the Ellipse tool from `center` to `to`: the circle's box as previewed, +/// and the overlays it shows. +fn circle_drag(c: &ToolContext, center: Point, to: Point) -> ([f64; 4], Vec) { + let both = Mods { alt: true, shift: true, ..Mods::default() }; + let mut t = ShapeTool::new("ellipse"); + t.pointer(c, &PointerEvent::new(PointerKind::Down, center.x, center.y).with_mods(both)); + let a = t.pointer(c, &PointerEvent::new(PointerKind::Drag, to.x, to.y).with_mods(both)); + (previewed_box(&a), t.overlays(c)) +} + +fn tangent_label_at(o: &[Overlay], at: Point, within: f64) -> bool { + o.iter().any(|o| matches!(o, Overlay::Label { text, p, .. } if text == "tangent" && p.distance(at) <= within)) +} + +/// Snap to Tangent: a circle drawn from its center takes the radius at which it touches a nearby +/// straight path, with the "tangent" label at the touch point, also when the touch point is the +/// middle of the segment; the size label gives the circle as drawn. +#[test] +fn a_circle_from_its_center_snaps_its_radius_to_touch_a_line() { + // The line's ends and middle line up with none of the corners below. + let d = doc_holding_paths([vectorcraft_geom::shapes::line(Point::new(60.0, 300.0), Point::new(380.0, 300.0))]); + let (s, p) = (Selection::default(), paint()); + let c = ToolContext { measurement_labels: true, ..cx(&d, &s, &p) }; + // The pointer makes the radius 98; the line is 100 below the center. + let (b, o) = circle_drag(&c, Point::new(200.0, 200.0), Point::new(203.0, 102.0)); + assert_eq!(b, [100.0, 100.0, 200.0, 200.0]); + assert!(tangent_label_at(&o, Point::new(200.0, 300.0), 1e-9), "{o:?}"); + assert!(o.iter().any(|o| matches!(o, Overlay::Measure { text, .. } if text == &c.size_label(200.0, 200.0))), "{o:?}"); + // From the other side of the touching radius too (102). + let (b, _) = circle_drag(&c, Point::new(200.0, 200.0), Point::new(205.0, 98.0)); + assert_eq!(b, [100.0, 100.0, 200.0, 200.0]); + // Space moves the snapped circle and keeps its size. + let both = Mods { alt: true, shift: true, ..Mods::default() }; + let mut t = ShapeTool::new("ellipse"); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, 200.0, 200.0).with_mods(both)); + t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 203.0, 102.0).with_mods(both)); + // Space pressed with the pointer still moves the circle by no more than the snap moved its + // corner. + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 203.0, 102.0).with_mods(Mods { space: true, ..both })); + let b = previewed_box(&a); + assert!(b[2] == 200.0 && b[3] == 200.0 && (b[0] - 100.0).abs() <= 4.0 && (b[1] - 100.0).abs() <= 4.0, "{b:?}"); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 253.0, 152.0).with_mods(Mods { space: true, ..both })); + let b = previewed_box(&a); + assert!(b[2] == 200.0 && b[3] == 200.0 && (b[0], b[1]) != (100.0, 100.0), "moved, same size: {b:?}"); + assert!(t.overlays(&c).iter().any(|o| matches!(o, Overlay::Measure { text, .. } if text == &c.size_label(200.0, 200.0)))); + // Letting go of Space where the moved circle no longer touches the line keeps its size, and + // moving on grows it from there. + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 253.0, 152.0).with_mods(both)); + assert_eq!(previewed_box(&a), b, "Space let go"); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 243.0, 142.0).with_mods(both)); + let (grown, moved) = (previewed_box(&a), Point::new(b[0] + 100.0, b[1] + 100.0)); + let radius = (243.0 - moved.x).abs().max((142.0 - moved.y).abs()); + assert!(grown[2] == 2.0 * radius && grown[3] == 2.0 * radius && radius > 105.0, "{grown:?} from {moved:?}"); + // Out of reach (radius 90): the pointer sizes it. + let (b, o) = circle_drag(&c, Point::new(200.0, 200.0), Point::new(203.0, 110.0)); + assert_eq!(b, [110.0, 110.0, 180.0, 180.0]); + assert!(!o.iter().any(|o| matches!(o, Overlay::Label { text, .. } if text == "tangent")), "{o:?}"); +} + +/// A circle drawn around a center outside another circle touches it from outside at the nearer +/// side and takes it inside at the farther side, the radii those of the closed form (the distance +/// between the centers less or plus the other radius) within the error of the curves that draw a +/// circle. A center inside a circle gives the inscribed circle; its touch point is an anchor of +/// the circle, where two segments join smoothly. A center at the circle's own center gets no snap: +/// every point is square to it. +#[test] +fn a_circle_from_its_center_snaps_to_touch_another_circle_from_outside_and_inside() { + use vectorcraft_geom::shapes::ellipse; + // A circle of radius 50 around (350, 300), its center 50√13 from (200, 200). + let d = doc_holding_paths([ellipse(Rect::new(300.0, 250.0, 400.0, 350.0))]); + let (s, p) = (Selection::default(), paint()); + let c = cx(&d, &s, &p); + let (center, between) = (Point::new(200.0, 200.0), 50.0 * 13f64.sqrt()); + let toward = Vec2::new(150.0, 100.0) / between; + for (radius, pointer) in [(between - 50.0, Vec2::new(20.0, -(between - 52.0))), (between + 50.0, Vec2::new(-20.0, between + 48.0))] { + let (b, o) = circle_drag(&c, center, center + pointer); + assert!((b[2] / 2.0 - radius).abs() < 0.02 && b[2] == b[3], "{b:?}, want radius {radius}"); + assert!(tangent_label_at(&o, center + toward * radius, 0.2), "{o:?}"); + } + // Concentric: no tangent snap. + let (_, o) = circle_drag(&c, Point::new(350.0, 300.0), Point::new(374.0, 252.0)); + assert!(!o.iter().any(|o| matches!(o, Overlay::Label { text, .. } if text == "tangent")), "{o:?}"); + // Ellipses with radii 10010 and 10000, or 1001 and 1000, around the center are nearly square + // to it all round, but they are not circles: a circle touches each at the ends of its axes. + for (rx, ry) in [(10_010.0, 10_000.0), (1001.0, 1000.0)] { + let d = doc_holding_paths([ellipse(Rect::new(250.0 - rx, 250.0 - ry, 250.0 + rx, 250.0 + ry))]); + let c = cx(&d, &s, &p); + let (_, o) = circle_drag(&c, Point::new(250.0, 250.0), Point::new(280.0, 252.0 - ry)); + assert!(tangent_label_at(&o, Point::new(250.0, 250.0 - ry), 1e-6), "{rx} × {ry}: {o:?}"); + } + let near = |b: [f64; 4], want: [f64; 4]| b.iter().zip(want).all(|(a, w)| (a - w).abs() < 1e-6); + // Inside a circle of radius 150 around (250, 250), 50 from its center: the inscribed circle has + // radius 100. + let d = doc_holding_paths([ellipse(Rect::new(100.0, 100.0, 400.0, 400.0))]); + let c = cx(&d, &s, &p); + let (b, o) = circle_drag(&c, Point::new(200.0, 250.0), Point::new(203.0, 152.0)); + assert!(near(b, [100.0, 150.0, 200.0, 200.0]), "{b:?}"); + assert!(tangent_label_at(&o, Point::new(100.0, 250.0), 1e-6), "{o:?}"); +} + +/// The touch point can fall inside a curved segment: the radius is the distance to the nearest +/// point of the curve, measured here by sampling the path's own segments densely. +#[test] +fn a_circle_from_its_center_snaps_to_touch_a_curve() { + use vectorcraft_geom::ParamCurve; + let path = vectorcraft_geom::shapes::ellipse(Rect::new(300.0, 100.0, 500.0, 200.0)); + let center = Point::new(250.0, 300.0); + let sp = &path.subpaths[0]; + let (want, at) = (0..sp.segment_count()) + .flat_map(|i| (0..=20_000).map(move |k| (i, f64::from(k) / 20_000.0))) + .map(|(i, t)| sp.segment(i).eval(t)) + .map(|q| (q.distance(center), q)) + .min_by(|a, b| a.0.total_cmp(&b.0)) + .unwrap(); + let d = doc_holding_paths([path]); + let (s, p) = (Selection::default(), paint()); + let c = cx(&d, &s, &p); + let r = want - 2.0; + let (b, o) = circle_drag(&c, center, center + Vec2::new(-r * 0.3, r)); + assert!((b[2] / 2.0 - want).abs() < 1e-4 && (b[3] / 2.0 - want).abs() < 1e-4, "radius {} want {want}", b[2] / 2.0); + assert!(tangent_label_at(&o, at, 1e-2), "{at:?} {o:?}"); + // Straight out from a symmetric curve's middle (t = 0.5, (200, 262.5)), 162.5 from (200, 100). + let mut bump = vectorcraft_geom::BezPath::new(); + bump.move_to((100.0, 300.0)); + bump.curve_to((150.0, 250.0), (250.0, 250.0), (300.0, 300.0)); + let d = doc_holding_paths([vectorcraft_geom::PathData::from_bezpath(&bump)]); + let c = cx(&d, &s, &p); + let (b, o) = circle_drag(&c, Point::new(200.0, 100.0), Point::new(40.0, 40.0)); + assert!((b[2] - 325.0).abs() < 1e-9 && (b[3] - 325.0).abs() < 1e-9, "{b:?}"); + assert!(tangent_label_at(&o, Point::new(200.0, 262.5), 1e-9), "{o:?}"); +} + +/// The snap is Snap to Tangent's, under Smart Guides: off, the pointer sizes the circle. An +/// ellipse (no Shift) and a box drawn from a corner (no Alt) do not snap. An open path's end and +/// a corner square to the center are where a circle meets the path rather than touches it, so +/// neither is offered. +#[test] +fn a_circle_from_its_center_keeps_its_radius_without_the_snap_or_a_smooth_touch() { + let line = vectorcraft_geom::shapes::line(Point::new(60.0, 300.0), Point::new(380.0, 300.0)); + let d = doc_holding_paths([line]); + let (s, p) = (Selection::default(), paint()); + // The pointer makes the radius 98, 2 short of touching the line. + let (center, to) = (Point::new(200.0, 200.0), Point::new(215.0, 102.0)); + for off in [ToolContext { snap_tangent: false, ..cx(&d, &s, &p) }, ToolContext { smart_guides: false, ..cx(&d, &s, &p) }] { + assert_eq!(circle_drag(&off, center, to).0, [102.0, 102.0, 196.0, 196.0]); + } + let c = cx(&d, &s, &p); + assert_eq!(circle_drag(&c, center, to).0, [100.0, 100.0, 200.0, 200.0], "on, it snaps"); + for (mods, want) in + [(Mods { alt: true, ..Mods::default() }, [185.0, 102.0, 30.0, 196.0]), (Mods { shift: true, ..Mods::default() }, [200.0, 102.0, 98.0, 98.0])] + { + let mut t = ShapeTool::new("ellipse"); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, center.x, center.y).with_mods(mods)); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, to.x, to.y).with_mods(mods)); + assert_eq!(previewed_box(&a), want, "{mods:?}"); + } + // The line's left end is square below (60, 200), but it is an open end, also with a second + // line starting there the same way, which overlaps it rather than carrying it on. + assert_eq!(circle_drag(&c, Point::new(60.0, 200.0), Point::new(63.0, 102.0)).0, [-38.0, 102.0, 196.0, 196.0]); + let line = |a: (f64, f64), b: (f64, f64)| vectorcraft_geom::shapes::line(Point::new(a.0, a.1), Point::new(b.0, b.1)); + let d = doc_holding_paths([line((60.0, 300.0), (380.0, 300.0)), line((60.0, 300.0), (200.0, 300.0))]); + let c = cx(&d, &s, &p); + assert_eq!(circle_drag(&c, Point::new(60.0, 200.0), Point::new(63.0, 102.0)).0, [-38.0, 102.0, 196.0, 196.0]); + // Two lines end to end in one direction meet smoothly under (200, 200): the circle touches there. + let d = doc_holding_paths([line((60.0, 300.0), (200.0, 300.0)), line((200.0, 300.0), (380.0, 300.0))]); + let c = cx(&d, &s, &p); + assert_eq!(circle_drag(&c, center, to).0, [100.0, 100.0, 200.0, 200.0]); + // A rectangle's corner (200, 200) is 100√2 from (300, 300), diagonal to both its sides. + let (d, _) = doc_with_rect(); + let c = cx(&d, &s, &p); + let r = 100.0 * 2f64.sqrt() - 2.0; + let (b, _) = circle_drag(&c, Point::new(300.0, 300.0), Point::new(300.0 + r, 300.0 + r * 0.5)); + assert!((b[2] - 2.0 * r).abs() < 1e-9, "{b:?}"); +} + +/// An anchor the dragged corner snapped to wins over the tangent radius, as it does for a drawn +/// point. With more segments near the radius than one move measures, the ones nearest the pointer +/// are measured. +#[test] +fn a_circle_from_its_center_prefers_an_anchor_and_measures_the_segments_nearest_the_pointer() { + let line = |a: (f64, f64), b: (f64, f64)| vectorcraft_geom::shapes::line(Point::new(a.0, a.1), Point::new(b.0, b.1)); + let (s, p) = (Selection::default(), paint()); + let center = Point::new(200.0, 200.0); + // Shift keeps the corner on the diagonal, and it slides onto the anchor (297, 103): radius 97. + let d = doc_holding_paths([line((60.0, 300.0), (380.0, 300.0)), line((297.0, 103.0), (297.0, 40.0))]); + let c = cx(&d, &s, &p); + let (b, o) = circle_drag(&c, center, Point::new(203.0, 102.0)); + assert_eq!(b, [103.0, 103.0, 194.0, 194.0]); + assert!(!o.iter().any(|o| matches!(o, Overlay::Label { text, .. } if text == "tangent")), "{o:?}"); + // A corner that only lines up with an anchor near it, (300, 104), still takes the tangent. + let d = doc_holding_paths([line((60.0, 300.0), (380.0, 300.0)), line((300.0, 104.0), (300.0, 40.0))]); + let c = cx(&d, &s, &p); + let (b, o) = circle_drag(&c, center, Point::new(203.0, 102.0)); + assert_eq!(b, [100.0, 100.0, 200.0, 200.0]); + assert!(tangent_label_at(&o, Point::new(200.0, 300.0), 1e-9), "{o:?}"); + // 300 short segments pointing at the center cross the ring above it, ahead of the line below. + let spokes = (0..300).map(|i| { + let a = (-55.0 + 110.0 * f64::from(i) / 299.0_f64).to_radians(); + let at = |r: f64| (200.0 + r * a.sin(), 200.0 - r * a.cos()); + line(at(95.0), at(105.0)) + }); + let d = doc_holding_paths(spokes.chain([line((60.0, 300.0), (380.0, 300.0))])); + let c = cx(&d, &s, &p); + // The press lines up with a spoke's anchor, so the center moves by less than a point. + let (b, o) = circle_drag(&c, center, Point::new(215.0, 298.0)); + assert!((b[2] - 200.0).abs() < 1e-9 && (b[3] - 200.0).abs() < 1e-9 && (b[1] - 100.0).abs() < 1e-9, "{b:?}"); + assert!(o.iter().any(|o| matches!(o, Overlay::Label { text, p, .. } if text == "tangent" && (p.y - 300.0).abs() < 1e-9)), "{o:?}"); +} + +/// With a Constrain Angle the radius is measured, and the snapped box rebuilt, along the turned +/// axes: the circle still touches the line. +#[test] +fn a_circle_snapped_to_touch_keeps_to_the_constrain_angle() { + let d = doc_holding_paths([vectorcraft_geom::shapes::line(Point::new(0.0, 300.0), Point::new(450.0, 300.0))]); + let (s, p) = (Selection::default(), paint()); + let c = ToolContext { constrain_angle: 30.0, ..cx(&d, &s, &p) }; + let axes = vectorcraft_geom::constrain_axes(30.0).unwrap(); + let center = Point::new(200.0, 200.0); + let both = Mods { alt: true, shift: true, ..Mods::default() }; + let mut t = ShapeTool::new("ellipse"); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, center.x, center.y).with_mods(both)); + let to = center + (axes * Point::new(-40.0, -97.0)).to_vec2(); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, to.x, to.y).with_mods(both)); + let Some(Action::Preview(_, v)) = a.last() else { panic!("{a:?}") }; + let (w, h) = (v["width"].as_f64().unwrap(), v["height"].as_f64().unwrap()); + assert!((w - 200.0).abs() < 1e-9 && (h - 200.0).abs() < 1e-9, "{v}"); + assert!((v["rotation"].as_f64().unwrap() + 30.0).abs() < 1e-9, "{v}"); + let mid = Point::new(v["x"].as_f64().unwrap() + w / 2.0, v["y"].as_f64().unwrap() + h / 2.0); + assert!(mid.distance(center) < 1e-9, "centered on the press: {mid:?}"); + // Space pressed with the pointer still keeps the size and moves the circle by no more than + // the snap moved its corner. + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, to.x, to.y).with_mods(Mods { space: true, ..both })); + let Some(Action::Preview(_, v)) = a.last() else { panic!("{a:?}") }; + let (w, h) = (v["width"].as_f64().unwrap(), v["height"].as_f64().unwrap()); + assert!((w - 200.0).abs() < 1e-9 && (h - 200.0).abs() < 1e-9, "{v}"); + let mid = Point::new(v["x"].as_f64().unwrap() + w / 2.0, v["y"].as_f64().unwrap() + h / 2.0); + assert!(mid.distance(center) <= 4.0, "{mid:?}"); +} + +/// Snap to Grid and pixel snapping place the drawn point instead of the tangent snap, also when +/// one is turned on while the circle is dragged out. Snap to Tangent turned off while dragging +/// stops the snap. +#[test] +fn a_circle_from_its_center_does_not_snap_to_touch_with_the_grid_or_pixels() { + let d = doc_holding_paths([vectorcraft_geom::shapes::line(Point::new(60.0, 300.0), Point::new(380.0, 300.0))]); + let (s, p) = (Selection::default(), paint()); + let on = cx(&d, &s, &p); + let grid = ToolContext { snap_to_grid: true, ..cx(&d, &s, &p) }; + let pixels = ToolContext { snap_to_pixel: true, pixel_snap: crate::PixelSnap { drawing: true, ..on.pixel_snap }, ..cx(&d, &s, &p) }; + let no_tangent = ToolContext { snap_tangent: false, ..cx(&d, &s, &p) }; + let both = Mods { alt: true, shift: true, ..Mods::default() }; + let drag = |press: &ToolContext, moved: &ToolContext, to: Point| { + let mut t = ShapeTool::new("ellipse"); + t.pointer(press, &PointerEvent::new(PointerKind::Down, 200.0, 200.0).with_mods(both)); + let a = t.pointer(moved, &PointerEvent::new(PointerKind::Drag, to.x, to.y).with_mods(both)); + (previewed_box(&a), t.overlays(moved)) + }; + let tangent = |o: &[Overlay]| o.iter().any(|o| matches!(o, Overlay::Label { text, .. } if text == "tangent")); + // The pointer makes the radius 98: the snap would make it 100. + let to = Point::new(203.0, 102.0); + assert_eq!(drag(&on, &on, to).0, [100.0, 100.0, 200.0, 200.0], "the snap applies"); + // Pixels round (203.2, 102.2) to (203, 102): radius 98. + let to = Point::new(203.2, 102.2); + for (press, moved) in [(&pixels, &pixels), (&on, &pixels)] { + let (b, o) = drag(press, moved, to); + assert_eq!(b, [102.0, 102.0, 196.0, 196.0]); + assert!(!tangent(&o), "{o:?}"); + } + // The grid (every 9 points) puts the corner on (207, 99): radius 101 from (200, 200), or 99 + // from (198, 198), where the grid puts a press made with it on. + for (press, moved, want) in [(&grid, &grid, [99.0, 99.0, 198.0, 198.0]), (&on, &grid, [99.0, 99.0, 202.0, 202.0])] { + let (b, o) = drag(press, moved, to); + assert_eq!(b, want); + assert!(!tangent(&o), "{o:?}"); + } + let (b, o) = drag(&on, &no_tangent, Point::new(203.0, 102.0)); + assert_eq!(b, [102.0, 102.0, 196.0, 196.0]); + assert!(!tangent(&o), "{o:?}"); +} + +/// A press and a small jitter is a click, not a drag, even when the tangent snap would size the +/// circle at the jittered pointer large enough to begin a drag. +#[test] +fn a_jittered_alt_shift_press_beside_a_path_is_a_click() { + // With a Constrain Angle, Shift does not hold the corner on the page's diagonal, which would + // take it onto the line. + let d = doc_holding_paths([vectorcraft_geom::shapes::line(Point::new(60.0, 300.0), Point::new(380.0, 300.0))]); + let (s, p) = (Selection::default(), paint()); + let c = ToolContext { constrain_angle: 30.0, ..cx(&d, &s, &p) }; + let both = Mods { alt: true, shift: true, ..Mods::default() }; + let mut t = ShapeTool::new("ellipse"); + // 5.5 above the line, beyond the snapping tolerance of 4. The jitter of 1.9 makes the radius + // 1.9 cos 30°, about 1.65, within 4 of the touching radius 5.5. + t.pointer(&c, &PointerEvent::new(PointerKind::Down, 200.0, 294.5).with_mods(both)); + assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 201.9, 294.5).with_mods(both)), vec![]); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Up, 201.9, 294.5).with_mods(both)); + assert!(!a.contains(&Action::Commit), "{a:?}"); +} + +/// An anchor or a crossing within the snapping tolerance of the pointer takes the point, and the +/// circle is not sized to touch the line. +#[test] +fn a_circle_from_its_center_prefers_an_anchor_or_a_crossing_at_the_pointer() { + let line = |a: (f64, f64), b: (f64, f64)| vectorcraft_geom::shapes::line(Point::new(a.0, a.1), Point::new(b.0, b.1)); + let (s, p) = (Selection::default(), paint()); + let center = Point::new(200.0, 200.0); + let base = line((60.0, 300.0), (380.0, 300.0)); + // An anchor at (205, 104), and two lines crossing there. + for extra in [vec![line((205.0, 104.0), (260.0, 40.0))], vec![line((185.0, 84.0), (225.0, 124.0)), line((185.0, 124.0), (225.0, 84.0))]] { + let d = doc_holding_paths(std::iter::once(base.clone()).chain(extra)); + let c = cx(&d, &s, &p); + let (b, o) = circle_drag(&c, center, Point::new(203.0, 102.0)); + assert!(b[2] != 200.0, "{b:?}"); + assert!(!o.iter().any(|o| matches!(o, Overlay::Label { text, .. } if text == "tangent")), "{o:?}"); + } +} + +/// A path whose anchor below the center joins two straight curves with their handles drawn back +/// onto that anchor runs smoothly through it: the circle touches it there. +#[test] +fn a_circle_from_its_center_touches_a_path_at_an_anchor_with_retracted_handles() { + let mut run = vectorcraft_geom::BezPath::new(); + run.move_to((60.0, 300.0)); + run.curve_to((100.0, 300.0), (200.0, 300.0), (200.0, 300.0)); + run.curve_to((200.0, 300.0), (300.0, 300.0), (380.0, 300.0)); + let d = doc_holding_paths([vectorcraft_geom::PathData::from_bezpath(&run)]); + let (s, p) = (Selection::default(), paint()); + let c = cx(&d, &s, &p); + let (b, o) = circle_drag(&c, Point::new(200.0, 200.0), Point::new(215.0, 102.0)); + assert_eq!(b, [100.0, 100.0, 200.0, 200.0]); + assert!(tangent_label_at(&o, Point::new(200.0, 300.0), 1e-9), "{o:?}"); +} + /// General › Constrain Angle: a Shift-drag squares along the turned axes, and the shape turns /// by the angle about its centre. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 7ab675f44e..1921a1aba0 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -612,6 +612,7 @@ since 2026-10-01. **Drawing tools — Polygon and Star counts:** The existing canvas placement dialog reads the stored count and saves it only after successful placement. `polygon_and_star_canvas_counts_persist_without_new_toolbar_dialogs` covers both tools, repeated drags, tool switching, reopening and Cancel. Counts remain session tool options. Existing click and toolbar gestures are retained; no score or hour change. **Drawing tools, Star inner radius held with Ctrl/Cmd:** While a star is dragged out, Ctrl/Cmd keeps the inner radius the star showed when the key went down, also when the key is pressed with the pointer still. `a_star_drag_holds_its_inner_radius_with_ctrl_and_straightens_with_alt` and `a_star_drag_holds_the_inner_radius_it_shows_when_ctrl_goes_down` cover it, with Alt's straight shoulders and a drag canceled with Escape. +**Drawing tools, Ellipse tool circle from its center sized to touch a path:** By VectorCraft's own rule, with Smart Guides and Snap to Tangent on, a circle drawn from its center (Alt and Shift) snaps its radius so that the circle touches a nearby path whenever the radius comes within the snapping tolerance of that size. The touch point is where the line from the center meets a straight segment or a curve square, inside a segment or at an anchor where the path runs smoothly, also where a curve's handle lies on that anchor. A circle can touch another circle from outside or touch it from inside, and a center inside a closed path gives a circle that touches the path from within. A corner or an open path's end is not offered, nor a curve around the same center. The touch point shows the "tangent" label and the line from the center as guides; the radius is measured along the Constrain Angle's axes, as the drawn box is, and Space moves the circle at the size it snapped to, which it keeps when Space is let go. The snap does not apply to an ellipse (no Shift). When an anchor, center or crossing is within the snapping tolerance of the pointer, or the dragged corner snapped onto one, the circle is not resized to touch a path. Snap to Grid and pixel snapping place the drawn point instead, also when turned on during the drag, and turning Snap to Tangent off during the drag stops the snap. A press with a small jitter is still a click rather than a drag. At most 256 segments near that radius are measured per pointer move, the ones nearest the pointer. `a_circle_from_its_center_snaps_its_radius_to_touch_a_line`, `a_circle_from_its_center_snaps_to_touch_another_circle_from_outside_and_inside`, `a_circle_from_its_center_snaps_to_touch_a_curve`, `a_circle_from_its_center_keeps_its_radius_without_the_snap_or_a_smooth_touch`, `a_circle_from_its_center_prefers_an_anchor_and_measures_the_segments_nearest_the_pointer`, `a_circle_snapped_to_touch_keeps_to_the_constrain_angle`, `a_circle_from_its_center_does_not_snap_to_touch_with_the_grid_or_pixels`, `a_jittered_alt_shift_press_beside_a_path_is_a_click`, `a_circle_from_its_center_prefers_an_anchor_or_a_crossing_at_the_pointer` and `a_circle_from_its_center_touches_a_path_at_an_anchor_with_retracted_handles` cover it. **Drawing tools, Dimension tool horizontal and vertical linear dimensions:** A linear dimension between two clicked points or dragged out from a segment is aligned, horizontal or vertical, chosen by where the pointer moves while it is placed, and a click again by the second point gives aligned; `dimension.create` and `dimension.update` take `orientation`, and the dimension stays linked to the anchors it measures, keeps its orientation when it or the art turns, with a line that lay outside the points kept outside them; an unlinked horizontal or vertical dimension that is reflected has its line on the reflected side. `the_pointer_chooses_aligned_horizontal_or_vertical`, `two_points_measure_horizontally_vertically_or_aligned`, `clicking_again_by_the_second_point_places_an_aligned_dimension`, `a_segment_drag_measures_horizontally_vertically_or_aligned`, `points_on_a_vertical_line_measure_aligned`, `horizontal_and_vertical_dimensions_draw_lines_along_their_axis`, `turned_horizontal_dimensions_stay_horizontal`, `a_linked_horizontal_dimension_keeps_its_gap_from_turned_art`, `a_linked_horizontal_dimension_below_or_between_its_points_follows_turned_art`, `a_reflected_horizontal_dimension_keeps_its_line_on_the_reflected_side`, `a_dimension_without_an_orientation_reads_as_aligned`, `dimension_orientation_is_checked` and `a_turned_dimension_keeps_its_line_on_its_side` cover it. **Drawing tools, Dimension tool points that are not anchors follow the art:** A clicked point on a segment stays at its place along the segment, also when the segment curves, and a point off the art is linked to anchors (or, when the anchors lie on one line, anchors and handles) of the path, so both ends of the dimension follow when the art is moved, scaled, turned or reflected, also when the point was placed by a Smart Guide and when the dimension is saved and opened again; a linked linear dimension of reflected art (other than art on one line) has its line on the reflected side; deleting the art, changing its anchor count or whether it is closed, turning an angle's arm into a curve, or making a measured circle or arc no longer circular leaves the dimension where it was, no longer linked, instead of removing it. `a_dimension_to_a_point_on_a_segment_follows_the_art_at_both_ends`, `a_dimension_to_a_point_off_the_art_moves_with_the_art`, `a_dimension_whose_art_changes_its_anchors_stays_where_it_was`, `a_dimension_whose_art_is_opened_stays_where_it_was`, `angle_and_arc_dimensions_whose_art_no_longer_fits_stay_where_they_were`, `a_dimension_that_cannot_be_drawn_again_keeps_its_art`, `a_linked_dimension_of_reflected_art_has_its_line_on_the_reflected_side`, `a_dimension_to_a_point_off_a_line_follows_the_line`, `a_point_off_an_arch_is_reflected_with_the_arch`, `a_point_beside_an_almost_straight_curve_follows_it`, `a_point_off_a_loop_with_its_anchors_in_one_place_follows_it`, `a_point_beside_a_reflected_line_moves_as_a_half_turn_would`, `a_point_on_a_segment_stays_on_it_when_the_segment_curves`, `a_linked_dimension_of_a_reflected_curve_has_its_line_on_the_reflected_side`, `a_dimension_of_art_reflected_across_its_points_changes_sides`, `a_dimension_between_paths_reflected_each_in_its_own_way_keeps_its_offset`, `free_points_survive_a_native_file`, `dimension_free_points_are_checked`, `points_off_anchors_are_held_against_the_path` and `a_point_smart_guides_place_is_held_against_the_path` cover it. **Drawing tools, Dimension tool points on a Smart Guide stay on the guide:** By VectorCraft's own rule, a clicked point that lies on a Smart Guide already, such as one in line with an object's center, stays where the pointer is when no anchor is within 8 pixels and no segment is within the Smart Guides snapping tolerance, instead of moving onto a segment farther than that tolerance and within 8 pixels; with Snap to Grid or Snap to Pixel on, a point stays on the grid or the whole pixel those options give. `a_point_on_a_guide_stays_on_the_guide` covers it.