diff --git a/crates/engine/src/cmd/draw2/commands.rs b/crates/engine/src/cmd/draw2/commands.rs index bce1e24d98..9a2ee80033 100644 --- a/crates/engine/src/cmd/draw2/commands.rs +++ b/crates/engine/src/cmd/draw2/commands.rs @@ -12,7 +12,7 @@ pub fn specs() -> Vec { "Pencil", [], None, - "{points: [[x,y]…] or [[x,y,pressure]…] or [[x,y,pressure,tiltX,tiltY,rotation,wheel]…] (pen pressure 0..1: the stroke keeps it, for Calligraphic and Scatter brushes with Pressure variation; a point without one presses fully. Pen tilt in degrees, each −90..90, x positive leaning right and y leaning down the page, and barrel rotation in degrees clockwise, 0..360: the stroke keeps how far the pen leaned, which way and how far its barrel turned, for brushes with Tilt, Bearing and Rotation variation. An airbrush pen's finger wheel 0..1: the stroke keeps it for brushes with Stylus Wheel variation, a point without one half way; null for what a point lacks. A pressure, tilt, rotation or wheel outside its range, or a point array of more than seven numbers, is an error), fidelity?: pt (1.5; from 0.000015625 (0.01 / 640) to 100 / 0.0313 (about 3194.89), the Pencil's and the Paintbrush's 0.01 to 100 px Fidelity at the highest and the lowest zoom; a value outside that range is an error. The tools send their Fidelity in pixels divided by the zoom, kept within the range), fit?: bool (true; false: the points are joined by straight segments, as the Pencil previews a stroke with Live curve fitting off), closed?, style?: \"pencil\" (default) | \"brush\", fill?: bool, keepSelected?: bool (true: the drawn or continued path is selected; false: a new path leaves nothing selected, and a continued or redrawn one is deselected while the rest of the selection stays), extend?: {id, end?: \"end\" (default) | \"start\"}, connect?: {id, end: \"start\"|\"end\"} (only with extend), redraw?: {id, within?: pt (12)}} fit a freehand stroke → {id}. extend continues the path from that end, and closes it when `closed` is true (left out, when the stroke ends within four Fidelities of the path's other end, 6 to 400 pt); with connect, the stroke ends on that end of another path's last open subpath and joins it on, in one path with the extended path's appearance (the other path is removed when nothing of it is left); redraw (Edit Selected Paths) replaces the section of the path between where the stroke starts and ends, each within `within` of one subpath (the shorter way round a closed one), and draws a new path when the stroke doesn't end on it. Any other style, extend end or connect end, connect without extend, and a connect that names no other path with an open end are errors, a stroke of one point included, and nothing changes", + "{points: [[x,y]…] or [[x,y,pressure]…] or [[x,y,pressure,tiltX,tiltY,rotation,wheel]…] (pen pressure 0..1: the stroke keeps it, for Calligraphic and Scatter brushes with Pressure variation; a point without one presses fully. Pen tilt in degrees, each −90..90, x positive leaning right and y leaning down the page, and barrel rotation in degrees clockwise, 0..360: the stroke keeps how far the pen leaned, which way and how far its barrel turned, for brushes with Tilt, Bearing and Rotation variation. An airbrush pen's finger wheel 0..1: the stroke keeps it for brushes with Stylus Wheel variation, a point without one half way; null for what a point lacks. A pressure, tilt, rotation or wheel outside its range, or a point array of more than seven numbers, is an error), fidelity?: pt (1.5; from 0.000015625 (0.01 / 640) to 100 / 0.0313 (about 3194.89), the Pencil's and the Paintbrush's 0.01 to 100 px Fidelity at the highest and the lowest zoom; a value outside that range is an error. The tools send their Fidelity in pixels divided by the zoom, kept within the range), fit?: bool (true; false: the points are joined by straight segments, as the Pencil previews a stroke with Live curve fitting off), closed?, style?: \"pencil\" (default) | \"brush\", fill?: bool, keepSelected?: bool (true: the drawn or continued path is selected; false: a new path leaves nothing selected, and a continued or redrawn one is deselected while the rest of the selection stays), leaveSelection?: bool (false; true with keepSelected false: a new path leaves the selection as it is, as the Pencil previews a stroke that redraws a path), extend?: {id, end?: \"end\" (default) | \"start\"}, connect?: {id, end: \"start\"|\"end\"} (only with extend), redraw?: {id, within?: pt (12)}} fit a freehand stroke → {id}. extend continues the path from that end, and closes it when `closed` is true (left out, when the stroke ends within four Fidelities of the path's other end, 6 to 400 pt); with connect, the stroke ends on that end of another path's last open subpath and joins it on, in one path with the extended path's appearance (the other path is removed when nothing of it is left); redraw (Edit Selected Paths) replaces the section of the path between where the stroke starts and ends, each within `within` of one subpath (the way round a closed one that leaves the bigger shape; on an open one the way the stroke runs along it at each end decides: it replaces the part it runs along where it starts and joins the part it runs into where it lands, so it replaces the part between, keeps it and closes the path along the stroke, or, when its ends disagree, ends where it is lifted; an end that leaves or meets the path squarely follows the other end, and when both do it closes only if it goes round both pieces beyond), the stroke's ends bent smoothly onto the path; a stroke that starts on it and returns to the same point adds a loop there, and one lifted farther than `within` from it takes the path with it: a closed subpath opens where the stroke starts, an open one is cut there and drops the part the stroke heads along, and the path ends where the stroke does. Any other style, extend end or connect end, connect without extend, and a connect that names no other path with an open end are errors, a stroke of one point included, and nothing changes", has_doc, freehand ), diff --git a/crates/engine/src/cmd/draw2/freehand.rs b/crates/engine/src/cmd/draw2/freehand.rs index 607abf8f03..5f281e2e34 100644 --- a/crates/engine/src/cmd/draw2/freehand.rs +++ b/crates/engine/src/cmd/draw2/freehand.rs @@ -74,13 +74,329 @@ fn stroke_subpath(pts: &[Point], tol: Option, closed: bool) -> SubPath { } } -/// Pencil's Edit Selected Paths in the middle of a path: a stroke from one point of a subpath of -/// `pd` to another, each within `within` of it, replaces the section between them (the shorter -/// way round a closed subpath) with the stroke fitted at `tol` (with no `tol`, unfitted). The -/// subpath's index and its new shape; None when the stroke doesn't start and end on the same -/// subpath, or meets it once. +/// The anchor of `sp` at the point of it nearest to `q`: the one there, else a new one, and +/// whether it was added. +fn anchor_at(sp: &mut SubPath, q: Point) -> Option<(usize, bool)> { + let (_, seg, t, _, _) = PathData::single(sp.clone()).nearest(q)?; + let n = sp.anchors.len(); + if n == 0 { + return None; + } + Some(if t <= 1e-6 { + (seg % n, false) + } else if t >= 1.0 - 1e-6 { + ((seg + 1) % n, false) + } else { + (sp.insert_anchor(seg, t), true) + }) +} + +/// The direction `sp` leaves anchor `k` going forward (towards the next anchor). +fn forward_at(sp: &SubPath, k: usize) -> Option { + let a = sp.anchors.get(k)?; + let n = sp.anchors.len(); + let next = if sp.closed || k + 1 < n { sp.anchors.get((k + 1) % n) } else { None }; + let toward = if a.h_out != a.p { + a.h_out + } else if let Some(b) = next { + if b.h_in != b.p { b.h_in } else { b.p } + } else { + // The last anchor of an open subpath: forward goes on the way it arrived. + let prev = sp.anchors.get(k.checked_sub(1)?)?; + return Some(a.p - if a.h_in != a.p { a.h_in } else { prev.p }); + }; + let v = toward - a.p; + (v.hypot() > 1e-9).then_some(v) +} + +/// The direction stroke `pts` leaves its first point: towards its first point farther than +/// `reach` from it, or its last point. +fn heading(pts: &[Point], reach: f64) -> Option { + let (&p0, rest) = pts.split_first()?; + let to = rest.iter().find(|q| q.distance(p0) > reach).or(rest.last())?; + let v = *to - p0; + (v.hypot() > 1e-9).then_some(v) +} + +/// `stroke` (its first point moved onto anchor `a` of the path it leaves) fitted at `tol`: its +/// anchors, the first of which is at `a`. +fn fit_from(a: Point, pts: &[Point], tol: Option, reach: f64) -> Vec { + let mut stroke = pts.to_vec(); + bend_ends(&mut stroke, Some(a), None, reach); + stroke_subpath(&stroke, tol, false).anchors.into_vec() +} + +/// Bend the ends of `stroke` onto `a` (its start) and `b` (its end): each end moves all the way +/// and the stroke behind it less and less, to not at all `reach` along it (Edit selected paths +/// within), so a stroke that starts or ends near the path joins it smoothly instead of with a +/// straight piece. A stroke shorter than `reach` bends over its own length, so each end still +/// lands on its target and the other end's bend doesn't move it off. +fn bend_ends(stroke: &mut [Point], a: Option, b: Option, reach: f64) { + let (Some(&first), Some(&last)) = (stroke.first(), stroke.last()) else { return }; + // How far along the stroke each point lies, measured before anything moves. + let mut along = Vec::with_capacity(stroke.len()); + let mut total = 0.0; + let mut prev = first; + for p in stroke.iter() { + total += prev.distance(*p); + prev = *p; + along.push(total); + } + let reach = reach.min(total); + if !reach.is_finite() || reach <= 0.0 { + // No length to bend over: only the ends move. + if let (Some(a), Some(p)) = (a, stroke.first_mut()) { + *p = a; + } + if let (Some(b), Some(p)) = (b, stroke.last_mut()) { + *p = b; + } + return; + } + let weight = |d: f64| (1.0 - d / reach).max(0.0); + let (shift_a, shift_b) = (a.map(|a| a - first), b.map(|b| b - last)); + for (p, &d) in stroke.iter_mut().zip(&along) { + if let Some(s) = shift_a { + *p += s * weight(d); + } + if let Some(s) = shift_b { + *p += s * weight(total - d); + } + } +} + +/// Pencil's Edit Selected Paths for a stroke that starts on a subpath of `pd` (within `within` of +/// it) and ends away from it (#2850 follow-up): the path follows the stroke and ends where the +/// stroke does. A closed subpath opens where the stroke starts and keeps its whole outline, run +/// so that it arrives there heading the stroke's way. An open subpath is cut there and keeps the +/// part behind the stroke: the part the stroke heads along is dropped. The subpath's index and its +/// new shape; None when the stroke doesn't start on `pd`. `runs_up`, when given, says which part of +/// an open subpath the stroke heads along: the part towards its last anchor when true. +fn redraw_extend(pd: &PathData, pts: &[Point], tol: Option, within: f64, runs_up: Option) -> Option<(usize, SubPath)> { + let first = *pts.first()?; + let (si, _, _, _, d) = pd.nearest(first)?; + if d > within || pts.len() < 2 { + return None; + } + let mut sp = pd.subpaths.get(si)?.clone(); + if sp.anchors.len() < 2 { + return None; + } + let (mut k, _) = anchor_at(&mut sp, first)?; + let last = sp.anchors.len() - 1; + // Run the subpath so the stroke goes on from `k` forward; the result runs the subpath's own way + // again below, so a shape's holes stay holes under the non-zero fill rule. A closed subpath + // arrives at `k` heading the stroke's way. An open one drops the part the stroke heads along; + // one it leaves nearly square to it (more than 70° from its direction) drops its shorter + // part, never most of the path. From one of its ends it drops nothing. + let dir = heading(pts, within.max(tol.unwrap_or(0.0) * 2.0))?; + let cos = forward_at(&sp, k).map_or(0.0, |f| f.dot(dir) / (f.hypot() * dir.hypot()).max(1e-12)); + let flipped = if sp.closed { + cos < 0.0 + } else if k == 0 || k == last { + k == 0 + } else if let Some(up) = runs_up { + !up + } else if cos.abs() >= 0.34 { + cos < 0.0 + } else { + let len = |i: usize, j: usize| (i..j).map(|s| kurbo::ParamCurveArclen::arclen(&sp.segment(s), 0.01)).sum::(); + len(0, k) < len(k, last) + }; + if flipped { + sp.reverse(); + k = sp.anchors.len().checked_sub(1 + k)?; + } + let at = *sp.anchors.get(k)?; + let mut anchors: Vec = if sp.closed { + // From `k` all the way round back to `k`: the shape opens there. + let mut v: Vec = sp.anchors.get_range(k..)?.into_iter().chain(sp.anchors.get_range(..k)?).collect(); + if let Some(a0) = v.first_mut() { + *a0 = Anchor::with_handles(a0.p, a0.p, a0.h_out); + } + v.push(at); + v + } else { + sp.anchors.get_range(..=k)? + }; + let fit = fit_from(at.p, pts, tol, within); + let (f0, rest) = fit.split_first()?; + if let Some(a) = anchors.last_mut() { + *a = Anchor::with_handles(a.p, a.h_in, f0.h_out); + } + anchors.extend_from_slice(rest); + let mut out = SubPath::new(anchors, false); + if flipped { + out.reverse(); + } + Some((si, out)) +} + +/// A stroke that leaves anchor `k` of `sp` and comes back to it: the stroke is inserted there as a +/// loop out of the path (#2850 follow-up). +fn redraw_loop(mut sp: SubPath, k: usize, pts: &[Point], tol: Option, within: f64) -> Option { + let at = *sp.anchors.get(k)?; + let mut stroke = pts.to_vec(); + bend_ends(&mut stroke, Some(at.p), Some(at.p), within); + let fit = stroke_subpath(&stroke, tol, false).anchors.into_vec(); + let (Some(f0), Some(fl)) = (fit.first().copied(), fit.last().copied()) else { return None }; + if fit.len() < 3 { + return None; + } + let inner = fit.get(1..fit.len() - 1)?; + let mut anchors = sp.anchors.get_range(..k)?; + anchors.push(Anchor::with_handles(at.p, at.h_in, f0.h_out)); + anchors.extend_from_slice(inner); + anchors.push(Anchor::with_handles(at.p, fl.h_in, at.h_out)); + anchors.extend_from_slice(&sp.anchors.get_range(k + 1..)?); + sp.anchors = anchors.into(); + Some(sp) +} + +/// The area closed subpath `sp` would have with `stroke` (running from anchor `start` to anchor +/// `end`) in place of its run from `start` forward to `end`. +fn redrawn_area(sp: &SubPath, start: usize, end: usize, stroke: impl Iterator) -> f64 { + use kurbo::ParamCurveArea; + let n = sp.anchors.len(); + let (Some(from), Some(to)) = (sp.anchors.get(start), sp.anchors.get(end)) else { return 0.0 }; + let mut area: f64 = (0..(start + n - end) % n).map(|k| sp.segment((end + k) % n).signed_area()).sum(); + let mut at = from.p; + for q in stroke.chain([to.p]) { + area += kurbo::Line::new(at, q).signed_area(); + at = q; + } + area.abs() +} + +/// Which way a stroke runs along open subpath `sp` where it meets it: `stroke` starts at that end +/// of the stroke. It runs along when its first `within` of length stays within `within` of the +/// path and moves along the path more than away from it: Some(true) towards the subpath's last +/// anchor. None when it goes straight off (or onto) the path. +fn run_along(sp: &SubPath, mut stroke: impl Iterator, within: f64) -> Option { + let one = PathData::single(sp.clone()); + let p0 = stroke.next()?; + // The point `within` along the stroke, or its other end when it is shorter. + let (mut prev, mut len, mut q) = (p0, 0.0, p0); + for p in stroke { + let step = prev.distance(p); + if len + step >= within && step > 0.0 { + q = prev.lerp(p, (within - len) / step); + break; + } + len += step; + prev = p; + q = p; + } + let (_, s0, t0, on0, _) = one.nearest(p0)?; + let (_, s1, t1, on1, away) = one.nearest(q)?; + if away > within || on0.distance(on1) <= away { + return None; + } + Some(s1 as f64 + t1 > s0 as f64 + t0) +} + +/// What a stroke from anchor `from` to anchor `to` of open subpath `sp` does to it. +enum OpenRedraw { + /// Replaces the part between and leaves the path open. + Replace, + /// Keeps the part between, drops the pieces beyond and closes the path with the stroke. + Close, + /// Drops the part it starts along (towards the last anchor when true) and ends where it does. + Extend(bool), +} + +/// Pencil's Edit Selected Paths on an open subpath: what a stroke from anchor `from` to anchor `to` +/// of `sp` does, from the way it runs along the path at each end ([`run_along`]; `before` is the +/// subpath before the anchors at `from` and `to` were added). Where it starts, it replaces the part +/// it runs along; where it lands, it joins the part it runs into and the part behind goes. An end +/// that goes straight off or onto the path follows the other end. When both do, it closes only if +/// the shape it makes with the part between goes round both pieces beyond ([`goes_round`]). When +/// the two ends disagree, the start decides and the stroke's end stays where it is lifted. +fn open_redraw(before: &SubPath, sp: &SubPath, from: usize, to: usize, pts: &[Point], within: f64) -> OpenRedraw { + let up = to > from; + // Each end runs towards the last anchor (true) or the first. Running towards the other end + // of the stroke at the start, or on away from it where it lands, replaces the part between; + // the other way keeps the part between and closes the path. + let at_start = run_along(before, pts.iter().copied(), within); + let at_end = run_along(before, pts.iter().rev().copied(), within).map(|back| !back); + match (at_start, at_end) { + (Some(s), Some(e)) if s != e => OpenRedraw::Extend(s), + (Some(r), _) | (None, Some(r)) => { + if r == up { + OpenRedraw::Replace + } else { + OpenRedraw::Close + } + } + (None, None) => { + if goes_round(sp, from, to, pts) { + OpenRedraw::Close + } else { + OpenRedraw::Replace + } + } + } +} + +/// Does the shape that stroke `pts` (from anchor `from` to anchor `to` of open subpath `sp`) makes +/// with the part of `sp` between them go round both pieces of `sp` beyond them? A piece counts as +/// inside when more of it lies inside than outside; a piece of no length counts as inside. +fn goes_round(sp: &SubPath, from: usize, to: usize, pts: &[Point]) -> bool { + use kurbo::{ParamCurve, Shape}; + let (lo, hi) = (from.min(to), from.max(to)); + let Some(middle) = sp.anchors.get_range(lo..=hi) else { return false }; + let mut shape = PathData::single(SubPath::new(middle, false)).to_bezpath(); + // The stroke runs from `hi` back to `lo` to close the shape. + let back: Vec = if from == lo { pts.iter().rev().copied().collect() } else { pts.to_vec() }; + for p in back { + shape.line_to(p); + } + shape.close_path(); + let inside = |segs: std::ops::Range| { + let (mut yes, mut no) = (0, 0); + for k in segs { + let seg = sp.segment(k); + for t in [0.25, 0.5, 0.75] { + if shape.winding(seg.eval(t)) != 0 { yes += 1 } else { no += 1 } + } + } + yes >= no + }; + inside(0..lo) && inside(hi..sp.anchors.len().saturating_sub(1)) +} + +/// Closes open subpath `sp` with stroke `pts`, which runs from anchor `from` to anchor `to`: the +/// anchors between them stay, the pieces beyond go, and the stroke, its ends bent onto those +/// anchors ([`bend_ends`] over `within`), runs from one back to the other. +fn redraw_across_gap(sp: &SubPath, from: usize, to: usize, pts: &[Point], tol: Option, within: f64) -> Option { + let (lo, hi) = (from.min(to), from.max(to)); + let (a_lo, a_hi) = (*sp.anchors.get(lo)?, *sp.anchors.get(hi)?); + let mut stroke = pts.to_vec(); + if from == lo { + stroke.reverse(); + } + bend_ends(&mut stroke, Some(a_hi.p), Some(a_lo.p), within); + let fit = stroke_subpath(&stroke, tol, false).anchors.into_vec(); + let (Some(f0), Some(fl)) = (fit.first().copied(), fit.last().copied()) else { return None }; + let mut anchors = sp.anchors.get_range(lo..=hi)?; + if let Some(a) = anchors.first_mut() { + *a = Anchor::with_handles(a.p, fl.h_in, a.h_out); + } + if let Some(a) = anchors.last_mut() { + *a = Anchor::with_handles(a.p, a.h_in, f0.h_out); + } + anchors.extend_from_slice(fit.get(1..fit.len().saturating_sub(1)).unwrap_or_default()); + Some(SubPath::new(anchors, true)) +} + +/// Pencil's Edit Selected Paths in the middle of a path: a stroke that starts and ends within +/// `within` of a subpath of `pd` replaces the section between with the stroke fitted at `tol` (with +/// no `tol`, unfitted), its ends bent onto the path ([`bend_ends`]). On a closed subpath that is the +/// way round that leaves the bigger shape. On an open one the way the stroke runs along the path +/// at its ends decides ([`open_redraw`]): it replaces the part between, keeps the part between and +/// closes the path, or ends where it is lifted. The subpath's index and its new shape; None when +/// the stroke doesn't start and end on the same subpath. fn redraw_section(pd: &PathData, pts: &[Point], tol: Option, within: f64) -> Option<(usize, SubPath)> { - use kurbo::ParamCurveArclen; let (first, last) = (*pts.first()?, *pts.last()?); let (si, _, _, _, d_a) = pd.nearest(first)?; let (sj, _, _, _, d_b) = pd.nearest(last)?; @@ -91,35 +407,35 @@ fn redraw_section(pd: &PathData, pts: &[Point], tol: Option, within: f64) - if sp.anchors.len() < 2 { return None; } - // The anchor nearest to `q`: the one there, else a new one, and whether it was added. Each - // point is looked up on the subpath as it is by then: splitting a straight segment makes two - // new ones, which a `t` along the old one doesn't measure. - let place = |sp: &mut SubPath, q: Point| { - let (_, seg, t, _, _) = PathData::single(sp.clone()).nearest(q)?; - let n = sp.anchors.len(); - Some(if t <= 1e-6 { - (seg % n, false) - } else if t >= 1.0 - 1e-6 { - ((seg + 1) % n, false) - } else { - (sp.insert_anchor(seg, t), true) - }) - }; - let (mut from, _) = place(&mut sp, first)?; - let (to, added) = place(&mut sp, last)?; + let before = sp.clone(); + // Each point is looked up on the subpath as it is by then: splitting a straight segment makes + // two new ones, which a `t` along the old one doesn't measure. + let (mut from, _) = anchor_at(&mut sp, first)?; + let (to, added) = anchor_at(&mut sp, last)?; if added && to <= from { from += 1; } if from == to { - return None; + // The stroke starts and ends on the same point: it is a loop out of the path there. + return redraw_loop(sp, from, pts, tol, within).map(|sp| (si, sp)); + } + if !sp.closed { + match open_redraw(&before, &sp, from, to, pts, within) { + OpenRedraw::Replace => {} + OpenRedraw::Close => return redraw_across_gap(&sp, from, to, pts, tol, within).map(|sp| (si, sp)), + OpenRedraw::Extend(up) => return redraw_extend(pd, pts, tol, within, Some(up)), + } } let n = sp.anchors.len(); - // The length of the run of segments from anchor i forward to anchor j. - let run = |i: usize, j: usize| (0..(j + n - i) % n).map(|k| sp.segment((i + k) % n).arclen(0.01)).sum::(); // The stroke goes from `start` to `end` and replaces the run between them; `kept` runs from // `end` round to `start`, then the stroke's inner anchors follow. let (start, end, reversed) = if sp.closed { - if run(from, to) <= run(to, from) { (from, to, false) } else { (to, from, true) } + // The bigger of the two shapes the stroke could make stays: carving across a shape replaces + // the part it cuts off, drawing round outside it the part it goes round. Picking the side + // nearer the stroke instead threw away a thin shape under a tall arch over its long side. + let forward = redrawn_area(&sp, from, to, pts.iter().copied()); + let backward = redrawn_area(&sp, to, from, pts.iter().rev().copied()); + if forward >= backward { (from, to, false) } else { (to, from, true) } } else if from < to { (from, to, false) } else { @@ -129,10 +445,8 @@ fn redraw_section(pd: &PathData, pts: &[Point], tol: Option, within: f64) - if reversed { stroke.reverse(); } - let (Some(s0), Some(s1)) = (stroke.first_mut(), sp.anchors.get(start)) else { return None }; - *s0 = s1.p; - let (Some(e0), Some(e1)) = (stroke.last_mut(), sp.anchors.get(end)) else { return None }; - *e0 = e1.p; + let (Some(s1), Some(e1)) = (sp.anchors.get(start), sp.anchors.get(end)) else { return None }; + bend_ends(&mut stroke, Some(s1.p), Some(e1.p), within); let fit = stroke_subpath(&stroke, tol, false).anchors.into_vec(); let (Some(f0), Some(f1)) = (fit.first().copied(), fit.last().copied()) else { return None }; let inner = fit.get(1..fit.len().saturating_sub(1)).unwrap_or_default(); @@ -212,6 +526,9 @@ pub(crate) fn freehand_brushed(s: &mut Session, p: &Value, brush_name: Option<&s // The undo step's name: a stroke painted with a brush is a Paintbrush stroke, whatever its style. let label = if brush || brush_name.is_some() { "Paintbrush" } else { "Pencil" }; let keep_selected = switch_or(p, "keepSelected", true, C)?; + // The Pencil's preview of a stroke that redraws a path draws it as a new path but leaves the + // selection as it is: the path being redrawn stays selected until the release redraws it. + let leave_selection = switch_or(p, "leaveSelection", false, C)?; let filled = switch_or(p, "fill", false, C)?; let extend = p.get("extend").filter(|v| !v.is_null()); if extend.is_none() && p.get("connect").is_some_and(|v| !v.is_null()) { @@ -416,7 +733,9 @@ pub(crate) fn freehand_brushed(s: &mut Session, p: &Value, brush_name: Option<&s // shortcut: a stroke's pressure, tilt, bearing and rotation profiles are left as they // were, measured along the old path; fit them to the new length if strokes drawn with a // pen get redrawn. - if let Some((si, sp)) = redraw_section(&pd, &pts, fit_tol, within) { + // A stroke that ends back on the path redraws the section between; one that ends away from + // it takes the path with it (it is where the pen is lifted that decides). + if let Some((si, sp)) = redraw_section(&pd, &pts, fit_tol, within).or_else(|| redraw_extend(&pd, &pts, fit_tol, within, None)) { // A member path of a compound path is redrawn in it: the compound path is what is // selected, and what a brush paints. let whole = brush_target(&s.doc()?.doc, id); @@ -461,7 +780,7 @@ pub(crate) fn freehand_brushed(s: &mut Session, p: &Value, brush_name: Option<&s } } let out = insert_look(s, label, path_kind(PathData::single(sp)), look, None, keep_selected)?; - if !keep_selected { + if !keep_selected && !leave_selection { // A new stroke with Keep selected off leaves nothing selected: Illustrator starts the stroke // by dropping the earlier selection, it does not keep it (#5752). s.select(|_, sel| sel.clear())?; @@ -628,3 +947,32 @@ pub(super) fn blob(s: &mut Session, p: &Value) -> Result { })?; Ok(json!({ "id": keep.0 })) } + +#[cfg(test)] +mod bend_tests { + use super::*; + + /// The ends move onto their targets, the stroke behind them less and less, and nothing farther + /// along than `reach`. + #[test] + fn bend_ends_moves_the_ends_and_fades_out_along_the_reach() { + let mut pts: Vec = (0..=10).map(|i| Point::new(f64::from(i) * 10.0, 0.0)).collect(); + bend_ends(&mut pts, Some(Point::new(0.0, 8.0)), Some(Point::new(100.0, -8.0)), 40.0); + assert_eq!(pts[0], Point::new(0.0, 8.0)); + assert_eq!(pts[10], Point::new(100.0, -8.0)); + assert!((pts[2].y - 8.0 * 0.5).abs() < 1e-9, "halfway along the reach, half the shift: {:?}", pts[2]); + assert!((pts[8].y + 8.0 * 0.5).abs() < 1e-9, "{:?}", pts[8]); + assert_eq!(pts[5], Point::new(50.0, 0.0), "the middle doesn't move"); + } + + /// A stroke shorter than `reach` still has both ends on their targets: bending one end onto + /// its target doesn't pull the other end off its own. + #[test] + fn bend_ends_keeps_both_ends_on_target_for_a_short_stroke() { + let mut pts = vec![Point::new(40.0, -12.0), Point::new(44.0, -12.0), Point::new(48.0, -12.0)]; + bend_ends(&mut pts, Some(Point::new(40.0, 0.0)), Some(Point::new(48.0, 0.0)), 16.0); + assert_eq!(pts[0], Point::new(40.0, 0.0), "{pts:?}"); + assert_eq!(pts[2], Point::new(48.0, 0.0), "{pts:?}"); + assert_eq!(pts[1], Point::new(44.0, 0.0), "halfway, half of each end's shift: {pts:?}"); + } +} diff --git a/crates/engine/src/tests/brushsym.rs b/crates/engine/src/tests/brushsym.rs index 62b1bac629..427def6754 100644 --- a/crates/engine/src/tests/brushsym.rs +++ b/crates/engine/src/tests/brushsym.rs @@ -1357,7 +1357,10 @@ fn brush_freehand_refuses_unknown_keys() { let spec = crate::cmd::find_command("brush.freehand").unwrap(); let mut keys = crate::cmd::params::accepted_keys(spec.params).expect("the description names every key"); keys.sort_unstable(); - assert_eq!(keys, ["brush", "closed", "connect", "extend", "fidelity", "fill", "fit", "keepSelected", "points", "redraw", "style"]); + assert_eq!( + keys, + ["brush", "closed", "connect", "extend", "fidelity", "fill", "fit", "keepSelected", "leaveSelection", "points", "redraw", "style"] + ); let mut s = session(); let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0); select(&mut s, &[a]); diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index 25f954dc4b..5017316c44 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -198,6 +198,12 @@ fn near(a: Point, b: Point) -> bool { a.distance(b) < 1e-6 } +/// Whether open subpath `sp`'s two ends are at `a` and `b`, in either order (within `tol`). +fn ends_at(sp: &vectorcraft_geom::SubPath, a: Point, b: Point, tol: f64) -> bool { + let (Some(f), Some(l)) = (sp.anchors.first(), sp.anchors.last()) else { return false }; + (f.p.distance(a) < tol && l.p.distance(b) < tol) || (f.p.distance(b) < tol && l.p.distance(a) < tol) +} + fn area(pd: &PathData) -> f64 { vectorcraft_pathops::area(pd, FillRule::NonZero) } @@ -519,7 +525,8 @@ fn pencil_redraws_the_section_of_a_selected_path_between_its_ends() { } /// On a closed path the stroke replaces the shorter way between where it starts and ends, and the -/// path stays closed; a stroke that doesn't end on the path draws a new one. +/// path stays closed; a stroke that doesn't end on the path opens it where the stroke starts and +/// ends where the stroke does (no new path). #[test] fn pencil_redraws_the_shorter_way_round_a_closed_path() { let mut s = session(); @@ -536,11 +543,12 @@ fn pencil_redraws_the_shorter_way_round_a_closed_path() { } let top = kurbo::Shape::bounding_box(&path(&s, id).to_bezpath()).y0; assert!(top < -20.0, "the dip: top {top}"); - // Not ending on the path: a new path, the rectangle as it was. - let before = path(&s, id); + // Not ending on the path: the rectangle opens at (50, 100) and follows the stroke out. s.execute("path.freehand", &json!({"points": [[50, 100], [80, 150], [120, 160]], "redraw": {"id": id.0, "within": 4}})).unwrap(); - assert_eq!(paths(&s).len(), 2); - assert_eq!(path(&s, id), before); + assert_eq!(paths(&s).len(), 1, "no new path"); + let sp = &path(&s, id).subpaths[0]; + assert!(!sp.closed, "the rectangle opened"); + assert!(ends_at(sp, Point::new(50.0, 100.0), Point::new(120.0, 160.0), 1e-6), "from the opening to the stroke's end: {sp:?}"); assert!(s.execute("path.freehand", &json!({"points": [[0, 0], [1, 1]], "redraw": {"id": id.0, "within": -1}})).is_err()); } @@ -7037,6 +7045,382 @@ fn pencil_redraws_a_selected_compound_path() { assert!(members(&s)[1] != before[1], "the hole is redrawn"); } +/// A Pencil stroke that starts on a selected closed shape and is lifted away from it takes the +/// shape with it: the shape opens where the stroke started, keeps its whole outline, fill and +/// selection, and ends where the pen was lifted. While the stroke is drawn the shape stays as it +/// was and the selection with it (the preview shows the stroke on its own); the release leaves no +/// new path. +#[test] +fn a_stroke_lifted_away_from_a_closed_shape_opens_it_and_follows_the_stroke() { + let mut s = session(); + s.execute("select.none", &json!({})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#000000"})).unwrap(); + let id = rect(&mut s, 100.0, 100.0, 200.0, 100.0); + let fill = s.doc().unwrap().doc.node(id).unwrap().appearance.fill_paint().clone(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + s.set_tool_option_cmd(&json!({"tool": "pencil", "values": {"editWithin": 12}})).unwrap(); + let v = view(); + s.select_tool("pencil", v).unwrap(); + let count = |s: &Session| s.doc().unwrap().doc.layers[0].children().map_or(0, |c| c.len()); + let shape = |s: &Session| s.doc().unwrap().doc.node(id).unwrap().path_data().unwrap().clone(); + let before = shape(&s); + // From the right edge, a little hook up and out to the right. + s.pointer(&PointerEvent::new(PointerKind::Down, 300.0, 150.0), v).unwrap(); + for (x, y) in [(303.0, 140.0), (308.0, 128.0), (316.0, 118.0), (326.0, 112.0), (338.0, 110.0)] { + s.pointer(&PointerEvent::new(PointerKind::Drag, x, y), v).unwrap(); + assert!(shape(&s) == before, "the shape stays as it was while the stroke is drawn"); + assert_eq!(s.doc().unwrap().selection.objects, vec![id], "and stays selected"); + } + s.pointer(&PointerEvent::new(PointerKind::Up, 338.0, 110.0), v).unwrap(); + assert_eq!(count(&s), 1, "no new path"); + assert_eq!(s.doc().unwrap().selection.objects, vec![id], "the shape stays selected"); + let n = s.doc().unwrap().doc.node(id).unwrap(); + assert_eq!(n.appearance.fill_paint(), fill, "the fill stays"); + let sp = &n.path_data().unwrap().subpaths[0]; + assert!(!sp.closed, "the shape opened"); + let ps: Vec = sp.anchors.iter().map(|a| a.p).collect(); + for corner in [(100.0, 100.0), (300.0, 100.0), (300.0, 200.0), (100.0, 200.0)] { + assert!(ps.iter().any(|p| near(*p, Point::new(corner.0, corner.1))), "{corner:?} kept: {ps:?}"); + } + assert!(ends_at(sp, Point::new(300.0, 150.0), Point::new(338.0, 110.0), 0.5), "from the opening to where the pen was lifted: {ps:?}"); + // The outline joins the stroke heading up, the stroke's way: next to the anchor where the + // stroke leaves the opening is the bottom right corner. + let last = ps.len() - 1; + let k = (1..last).find(|&i| ps[i].distance(Point::new(300.0, 150.0)) < 0.5).unwrap(); + assert!(near(ps[k - 1], Point::new(300.0, 200.0)) || near(ps[k + 1], Point::new(300.0, 200.0)), "joins from below: {ps:?}"); +} + +/// On an open path, a stroke from its middle lifted away from it cuts the path there and drops the +/// part the stroke heads along; the part behind stays and ends where the pen was lifted. +#[test] +fn a_stroke_lifted_away_from_an_open_path_drops_the_part_it_heads_along() { + for (towards_end, kept) in [(true, Point::new(100.0, 100.0)), (false, Point::new(300.0, 100.0))] { + let mut s = session(); + let id = line(&mut s, 100.0, 100.0, 300.0, 100.0); + let dx = if towards_end { 1.0 } else { -1.0 }; + let pts: Vec<_> = (0..8).map(|i| json!([200.0 + dx * 4.0 * f64::from(i), 100.0 - 5.0 * f64::from(i)])).collect(); + s.execute("path.freehand", &json!({"points": pts, "redraw": {"id": id.0, "within": 4}})).unwrap(); + assert_eq!(paths(&s).len(), 1, "no new path"); + let sp = &path(&s, id).subpaths[0]; + let ps: Vec = sp.anchors.iter().map(|a| a.p).collect(); + assert!( + ends_at(sp, kept, Point::new(200.0 + dx * 28.0, 65.0), 0.5), + "towards the end {towards_end}: the part behind stays and ends where the pen was lifted: {ps:?}" + ); + let dropped = Point::new(if towards_end { 300.0 } else { 100.0 }, 100.0); + assert!(!ps.iter().any(|p| p.distance(dropped) < 1.0), "the part ahead is dropped: {ps:?}"); + } +} + +/// A stroke that leaves a selected path and comes back to the same point adds a loop there; the +/// path stays closed and keeps its corners. +#[test] +fn a_stroke_back_to_where_it_started_adds_a_loop() { + let mut s = session(); + let id = rect(&mut s, 0.0, 0.0, 200.0, 100.0); + let before = path(&s, id).subpaths[0].anchors.len(); + let loop_pts = json!([[100, 0], [90, -15], [95, -35], [110, -38], [120, -20], [108, -8], [100, 0]]); + s.execute("path.freehand", &json!({"points": loop_pts, "redraw": {"id": id.0, "within": 4}})).unwrap(); + assert_eq!(paths(&s).len(), 1, "no new path"); + let sp = &path(&s, id).subpaths[0]; + assert!(sp.closed && sp.anchors.len() > before, "{sp:?}"); + let top = kurbo::Shape::bounding_box(&path(&s, id).to_bezpath()).y0; + assert!(top < -30.0, "the loop: top {top}"); + for corner in [(0.0, 0.0), (200.0, 0.0), (200.0, 100.0), (0.0, 100.0)] { + assert!(sp.anchors.iter().any(|a| near(a.p, Point::new(corner.0, corner.1))), "{corner:?} kept"); + } +} + +/// On a closed path the stroke replaces the way round it heads from its start, even when that is +/// the longer way: the shape doesn't flip to the other side as the stroke goes on. +#[test] +fn a_redraw_of_a_closed_path_goes_the_way_the_stroke_heads() { + let mut s = session(); + let id = rect(&mut s, 0.0, 0.0, 200.0, 100.0); + // From (20, 0) out to the left, round below the rectangle and up its right side to (180, 0). + let pts = json!([[20, 0], [10, -15], [-20, -10], [-25, 50], [-20, 120], [100, 125], [220, 120], [225, 50], [210, -10], [190, -12], [180, 0]]); + s.execute("path.freehand", &json!({"points": pts, "redraw": {"id": id.0, "within": 4}})).unwrap(); + assert_eq!(paths(&s).len(), 1); + let sp = &path(&s, id).subpaths[0]; + assert!(sp.closed); + let ps: Vec = sp.anchors.iter().map(|a| a.p).collect(); + // The rectangle's left, bottom and right sides went with the stroke; its top between 20 and + // 180 stays. + for corner in [(0.0, 0.0), (0.0, 100.0), (200.0, 100.0), (200.0, 0.0)] { + assert!(!ps.iter().any(|p| p.distance(Point::new(corner.0, corner.1)) < 1.0), "{corner:?} replaced: {ps:?}"); + } + let b = kurbo::Shape::bounding_box(&path(&s, id).to_bezpath()); + assert!(b.y1 > 115.0 && b.x0 < -15.0, "the stroke's way round: {b:?}"); +} + +/// A stroke lifted farther from the path than Edit selected paths within takes the path with it; +/// one lifted within that distance joins it again, its end bent smoothly onto it. +#[test] +fn a_stroke_lifted_beyond_the_edit_distance_takes_the_path_along() { + let mut s = session(); + let id = rect(&mut s, 0.0, 0.0, 200.0, 100.0); + // A hook out of the right side that ends 8 pt from it. + let hook = json!([[200, 50], [210, 40], [222, 38], [226, 46], [222, 56], [208, 58]]); + s.execute("path.freehand", &json!({"points": hook, "redraw": {"id": id.0, "within": 4}})).unwrap(); + let sp = &path(&s, id).subpaths[0]; + assert!(!sp.closed, "8 pt away with 4 pt to edit within: the shape opened"); + let ends = [sp.anchors.first().unwrap().p, sp.anchors.last().unwrap().p]; + assert!(ends.iter().any(|p| p.distance(Point::new(208.0, 58.0)) < 0.5), "it ends where the pen was lifted: {ends:?}"); +} + +/// A shape with a hole that opens keeps its outline running its own way, so the hole stays a hole. +#[test] +fn opening_a_shape_with_a_hole_keeps_the_hole() { + for heads_back in [false, true] { + let mut s = session(); + let outer = rect(&mut s, 0.0, 0.0, 200.0, 200.0); + let hole = rect(&mut s, 50.0, 50.0, 100.0, 100.0); + s.execute("select.set", &json!({"ids": [outer.0, hole.0]})).unwrap(); + s.execute("object.compoundPath.make", &json!({})).unwrap(); + let compound = s.doc().unwrap().selection.objects[0]; + let member = |s: &Session, i: usize| s.doc().unwrap().doc.node(compound).unwrap().children().unwrap()[i].clone(); + let (outer_id, sign) = { + let m = member(&s, 0); + (m.id, m.path_data().unwrap().subpaths[0].signed_area().signum()) + }; + // A hook out of the top edge, heading one way or the other along it. + let dx = if heads_back { -1.0 } else { 1.0 }; + let hook: Vec<_> = (0..6).map(|i| json!([100.0 + dx * 6.0 * f64::from(i), -5.0 * f64::from(i)])).collect(); + s.execute("path.freehand", &json!({"points": hook, "redraw": {"id": outer_id.0, "within": 4}})).unwrap(); + let sp = member(&s, 0).path_data().unwrap().subpaths[0].clone(); + assert!(!sp.closed, "heads back {heads_back}: opened"); + assert_eq!(sp.signed_area().signum(), sign, "heads back {heads_back}: the outline runs its own way, the hole stays a hole"); + } +} + +/// A stroke across a shape from one point of its outline to another carves off the part it cuts +/// across, the lobe on that side, and keeps the rest, whichever way it is drawn. +#[test] +fn a_stroke_across_a_shape_carves_off_the_part_it_cuts() { + for reversed in [false, true] { + let mut s = session(); + // A wide shape with a lobe on top between x = 80 and x = 120. + let shape = json!([[0, 0], [80, 0], [80, -60], [120, -60], [120, 0], [300, 0], [300, 100], [0, 100]]); + let id = NodeId(s.execute("path.freehand", &json!({"points": shape, "closed": true, "fidelity": 0.01})).unwrap()["id"].as_u64().unwrap()); + // Across the lobe's base, a little inside the shape. + let mut cut = vec![json!([70, 0]), json!([85, 8]), json!([100, 10]), json!([115, 8]), json!([130, 0])]; + if reversed { + cut.reverse(); + } + s.execute("path.freehand", &json!({"points": cut, "redraw": {"id": id.0, "within": 4}})).unwrap(); + let sp = &path(&s, id).subpaths[0]; + assert!(sp.closed, "reversed {reversed}"); + let b = kurbo::Shape::bounding_box(&path(&s, id).to_bezpath()); + assert!(b.y0 > -20.0, "reversed {reversed}: the lobe (up to y = -60) is carved off: {b:?}"); + assert!(b.x1 > 295.0 && b.y1 > 95.0, "reversed {reversed}: the rest stays: {b:?}"); + } +} + +/// A stroke leaving an open path across it (no direction along it) drops the nearer, short side, +/// not most of the path. +#[test] +fn a_stroke_leaving_an_open_path_across_it_drops_the_side_it_is_near() { + let mut s = session(); + let id = line(&mut s, 100.0, 100.0, 300.0, 100.0); + // Straight up from x = 280, then bending towards the near end. + let up = json!([[280, 100], [280, 90], [281, 75], [284, 60], [290, 50]]); + s.execute("path.freehand", &json!({"points": up, "redraw": {"id": id.0, "within": 4}})).unwrap(); + let sp = &path(&s, id).subpaths[0]; + assert!(ends_at(sp, Point::new(100.0, 100.0), Point::new(290.0, 50.0), 0.5), "the long side stays: {sp:?}"); +} + +/// A stroke drawn over an open shape's open ends, from near one end to near the other, redraws +/// those ends along the stroke and closes the shape, whichever way it is drawn; the shape's body +/// between stays. +#[test] +fn a_stroke_over_an_open_shapes_ends_closes_it_along_the_stroke() { + for reversed in [false, true] { + let mut s = session(); + // A C open on the right: from the top right round the left to the bottom right. + let c: Vec<_> = (0..=30) + .map(|i| { + let a = (40.0 + 280.0 * f64::from(i) / 30.0).to_radians(); + json!([200.0 + 100.0 * a.cos(), 200.0 - 100.0 * a.sin()]) + }) + .collect(); + let id = NodeId(s.execute("path.freehand", &json!({"points": c, "fidelity": 0.5})).unwrap()["id"].as_u64().unwrap()); + let on = |deg: f64| { + let a = deg.to_radians(); + (200.0 + 100.0 * a.cos(), 200.0 - 100.0 * a.sin()) + }; + // From the C near its top end, out round the open side, back onto it near the bottom end. + let (a, b) = (on(60.0), on(300.0)); + let mut stroke = vec![json!([a.0, a.1]), json!([290.0, 150.0]), json!([315.0, 200.0]), json!([290.0, 250.0]), json!([b.0, b.1])]; + if reversed { + stroke.reverse(); + } + s.execute("path.freehand", &json!({"points": stroke, "redraw": {"id": id.0, "within": 4}})).unwrap(); + assert_eq!(paths(&s).len(), 1, "reversed {reversed}: no new path"); + let sp = &path(&s, id).subpaths[0]; + assert!(sp.closed, "reversed {reversed}: the shape closed"); + let bb = kurbo::Shape::bounding_box(&path(&s, id).to_bezpath()); + assert!(bb.x1 > 310.0 && bb.x0 < 105.0, "reversed {reversed}: closed along the stroke, the body kept: {bb:?}"); + // The old ends (at 40° and 320°) are gone. + for deg in [40.0, 320.0] { + let e = on(deg); + assert!(!sp.anchors.iter().any(|q| q.p.distance(Point::new(e.0, e.1)) < 1.0), "reversed {reversed}: the end at {deg}° is redrawn"); + } + } +} + +/// A stroke that starts and ends on an open path decides by the way it runs along the path at its +/// ends: where it starts it replaces the part it runs along, where it lands it joins the part it runs +/// into, an end that goes straight off or onto the path follows the other end, and when both do it +/// closes only round both pieces beyond. A stroke lifted away from the path ends there. The path is +/// an L whose bottom arm turns up and back over to a hook near the upright arm. +#[test] +fn a_redraw_on_an_open_path_follows_the_way_its_ends_run() { + // From the upright arm's top (100, 0) down, along the bottom, up the right side, back along the + // top to the hook, which ends at (160, 60). + let shape = [[100.0, 0.0], [100.0, 300.0], [400.0, 300.0], [400.0, 100.0], [160.0, 100.0], [160.0, 60.0]]; + // A stroke through `pts`, a point every 2 pt, as a hand draws it. + let dense = |pts: &[[f64; 2]]| { + let mut out = vec![json!(pts[0])]; + for w in pts.windows(2) { + let (a, b) = (Point::new(w[0][0], w[0][1]), Point::new(w[1][0], w[1][1])); + let n = (a.distance(b) / 2.0).ceil().max(1.0) as usize; + out.extend((1..=n).map(|i| { + let q = a.lerp(b, i as f64 / n as f64); + json!([q.x, q.y]) + })); + } + out + }; + let has = |sp: &vectorcraft_geom::SubPath, x: f64, y: f64| sp.anchors.iter().any(|a| a.p.distance(Point::new(x, y)) < 1.0); + // Over the loop above the path, from the top edge round to the left of the upright arm. + let over = [[250.0, 40.0], [200.0, -30.0], [100.0, -40.0], [40.0, 0.0]]; + // Each: its name, the stroke, and whether the path is closed and keeps the bottom right corner, + // the upright arm's top and the hook's end. + let cases = [ + // Runs along the top towards the hook, then up the upright arm: the hook goes, the end is + // left where the pen is lifted, on the arm, and the rest of the path stays. + ( + "towards the hook, landing up the arm", + vec![[250.0, 100.0], [165.0, 100.0], [130.0, 95.0], [100.0, 90.0], [100.0, 40.0]], + [false, true, true, false], + ), + // Runs along the top away from the hook, then lands running up the arm: the part between + // is replaced, both ends stay. + ( + "away from the hook, landing up the arm", + vec![[250.0, 100.0], [300.0, 100.0], [320.0, 60.0], [250.0, 30.0], [140.0, 40.0], [100.0, 90.0], [100.0, 60.0]], + [false, false, true, true], + ), + // Straight up off the top, over the arm's top, landing running down the arm: the arm's top and + // the hook go and the path closes round the rest. + ( + "straight off, landing down the arm", + [&[[250.0, 100.0]][..], &over, &[[40.0, 120.0], [85.0, 140.0], [100.0, 150.0], [100.0, 180.0]]].concat(), + [true, true, false, false], + ), + // Straight off and straight onto the arm, round both the arm's top and the hook: it closes. + ("straight off and on, round both", [&[[250.0, 100.0]][..], &over, &[[40.0, 150.0], [100.0, 150.0]]].concat(), [true, true, false, false]), + // The same loop carried on across the arm and lifted inside: the path ends there; the hook, + // the shorter side, goes. + ( + "across the arm, lifted away", + [&[[250.0, 100.0]][..], &over, &[[40.0, 150.0], [100.0, 150.0], [200.0, 160.0]]].concat(), + [false, true, true, false], + ), + ]; + for (name, stroke, [closed, body, top, hook]) in cases { + let mut s = session(); + let id = NodeId(s.execute("path.freehand", &json!({"points": shape, "fit": false})).unwrap()["id"].as_u64().unwrap()); + s.execute("path.freehand", &json!({"points": dense(&stroke), "redraw": {"id": id.0, "within": 12}})).unwrap(); + assert_eq!(paths(&s).len(), 1, "{name}: no new path"); + let sp = &path(&s, id).subpaths[0]; + assert_eq!(sp.closed, closed, "{name}: closed: {sp:?}"); + assert_eq!(has(sp, 400.0, 300.0), body, "{name}: the bottom right corner: {sp:?}"); + assert_eq!(has(sp, 100.0, 0.0), top, "{name}: the upright arm's top: {sp:?}"); + assert_eq!(has(sp, 160.0, 60.0), hook, "{name}: the hook's end: {sp:?}"); + } +} + +/// A stroke that starts on an open C's upper arm running towards its end, goes round the opening +/// and lands on the lower arm running back into the C closes it into a ring. +#[test] +fn a_stroke_run_over_both_arms_of_a_c_closes_it() { + let mut s = session(); + let on = |deg: f64| { + let a = deg.to_radians(); + json!([200.0 + 100.0 * a.cos(), 200.0 - 100.0 * a.sin()]) + }; + let c: Vec<_> = (0..=28).map(|i| on(40.0 + 10.0 * f64::from(i))).collect(); + let id = NodeId(s.execute("path.freehand", &json!({"points": c, "fidelity": 0.5})).unwrap()["id"].as_u64().unwrap()); + let mut stroke: Vec<_> = (0..=8).map(|i| on(56.0 - 2.0 * f64::from(i))).collect(); + stroke.extend([json!([300.0, 160.0]), json!([310.0, 200.0]), json!([300.0, 240.0])]); + stroke.extend((0..=8).map(|i| on(324.0 - 2.0 * f64::from(i)))); + s.execute("path.freehand", &json!({"points": stroke, "redraw": {"id": id.0, "within": 4}})).unwrap(); + let sp = &path(&s, id).subpaths[0]; + assert!(sp.closed, "a ring: {sp:?}"); + let bb = kurbo::Shape::bounding_box(&path(&s, id).to_bezpath()); + assert!(bb.x0 < 105.0 && bb.x1 > 300.0, "the C's body and the stroke: {bb:?}"); +} + +/// A tall bump redrawn over most of an open line replaces that part: the ends beyond it stay and +/// the line stays open. +#[test] +fn a_tall_redraw_over_most_of_an_open_line_keeps_its_ends() { + for reversed in [false, true] { + let mut s = session(); + let id = line(&mut s, 100.0, 300.0, 700.0, 300.0); + let mut bump = + vec![json!([200, 300]), json!([250, 226]), json!([325, 148]), json!([400, 120]), json!([475, 148]), json!([550, 226]), json!([600, 300])]; + if reversed { + bump.reverse(); + } + s.execute("path.freehand", &json!({"points": bump, "redraw": {"id": id.0, "within": 12}})).unwrap(); + let sp = &path(&s, id).subpaths[0]; + assert!(!sp.closed, "reversed {reversed}: still open"); + assert!(ends_at(sp, Point::new(100.0, 300.0), Point::new(700.0, 300.0), 1e-6), "reversed {reversed}: both ends stay: {sp:?}"); + assert!(kurbo::Shape::bounding_box(&path(&s, id).to_bezpath()).y0 < 135.0, "reversed {reversed}: the bump"); + } +} + +/// A tall arch over one long side of a thin closed shape replaces that side: the result is the +/// bigger of the two shapes the stroke could make, not the arch alone. +#[test] +fn a_tall_arch_over_a_thin_shapes_side_keeps_the_shape() { + for reversed in [false, true] { + let mut s = session(); + let id = rect(&mut s, 100.0, 300.0, 600.0, 60.0); + let mut arch = + vec![json!([130, 300]), json!([197, 216]), json!([265, 144]), json!([400, 80]), json!([535, 144]), json!([603, 216]), json!([670, 300])]; + if reversed { + arch.reverse(); + } + s.execute("path.freehand", &json!({"points": arch, "redraw": {"id": id.0, "within": 12}})).unwrap(); + let sp = &path(&s, id).subpaths[0]; + assert!(sp.closed, "reversed {reversed}"); + for corner in [(100.0, 300.0), (700.0, 300.0), (700.0, 360.0), (100.0, 360.0)] { + assert!(sp.anchors.iter().any(|a| near(a.p, Point::new(corner.0, corner.1))), "reversed {reversed}: {corner:?} kept: {sp:?}"); + } + assert!(kurbo::Shape::bounding_box(&path(&s, id).to_bezpath()).y0 < 95.0, "reversed {reversed}: the arch"); + } +} + +/// A stroke that comes back near the path, within Edit selected paths within but not on it, joins +/// it again: the shape stays one closed path, and the stroke's end bends onto it, so no anchor +/// lies off the stroke's way back. +#[test] +fn a_stroke_back_near_the_path_joins_it_smoothly() { + let mut s = session(); + let id = rect(&mut s, 0.0, 0.0, 200.0, 100.0); + // A bump out of the top edge that comes back down to 10 pt above it. + let bump = json!([[40, 0], [45, -20], [60, -40], [80, -45], [100, -40], [115, -25], [120, -10]]); + s.execute("path.freehand", &json!({"points": bump, "redraw": {"id": id.0, "within": 20}})).unwrap(); + assert_eq!(paths(&s).len(), 1); + let sp = &path(&s, id).subpaths[0]; + assert!(sp.closed, "joined again: still closed"); + let top = kurbo::Shape::bounding_box(&path(&s, id).to_bezpath()).y0; + assert!(top < -35.0, "the bump: top {top}"); +} + /// With the Pencil's Live preview off, nothing is added to the document while a filled stroke is /// drawn; the release draws the path with its fill, as one undo step. #[test] diff --git a/crates/tools/src/draw2/gesture.rs b/crates/tools/src/draw2/gesture.rs index a34c819761..4f2fb7b463 100644 --- a/crates/tools/src/draw2/gesture.rs +++ b/crates/tools/src/draw2/gesture.rs @@ -1561,6 +1561,26 @@ impl GestureTool { v } + /// The preview of a stroke being drawn: [`Self::freehand_params`], except that a stroke that + /// redraws a selected path is shown as it is drawn, joined at its start to the point of the + /// path nearest to it, with no fill, and leaves the path and the selection as they are: where + /// the stroke ends is only known at the release, which redraws the path (`finish`). + fn drawing_params(&self, cx: &ToolContext) -> Value { + let mut v = self.freehand_params(cx, false); + let Some((id, _)) = self.redraw else { return v }; + if let Some(o) = v.as_object_mut() { + o.remove("redraw"); + } + v["fill"] = json!(false); + v["keepSelected"] = json!(false); + v["leaveSelection"] = json!(true); + let on = self.points.first().and_then(|&p| cx.doc.node(id)?.path_data()?.nearest(p)).map(|n| n.3); + if let (Some(on), Some(pts)) = (on, v["points"].as_array_mut()) { + pts.insert(0, json!([on.x, on.y])); + } + v + } + fn finish(&mut self, cx: &ToolContext, m: Mods) -> Vec { let pts = &self.points; let has_sel = !cx.selection.is_empty(); @@ -1764,7 +1784,7 @@ impl Tool for GestureTool { } // With the Pencil's Live preview off a thin line shows instead (`overlays`). if self.previews() && crate::previews_at(self.points.len()) { - let mut v = self.freehand_params(cx, false); + let mut v = self.drawing_params(cx); let fidelity = self.fidelity.max(PREVIEW_FIDELITY_PX); v["fidelity"] = json!(fit_tolerance(cx, fidelity)); // A preview fitted coarser than the stroke kept is stale (`deactivate`). @@ -1883,10 +1903,11 @@ impl Tool for GestureTool { fn deactivate(&mut self, cx: &ToolContext) -> Vec { let began = self.began; self.tip_at = None; - // Drags past the last preview are in the stroke kept, too, and with Live curve fitting - // off the stroke kept is fitted. - let stale = (began && (self.previewed != self.points.len() || !self.live_fit) && self.draws_path() && !self.smoothing) - .then(|| Action::Preview("path.freehand".into(), self.freehand_params(cx, false))); + // Drags past the last preview are in the stroke kept, too, with Live curve fitting off the + // stroke kept is fitted, and a stroke that redraws a path redraws it (`drawing_params`). + let stale = + (began && (self.previewed != self.points.len() || !self.live_fit || self.redraw.is_some()) && self.draws_path() && !self.smoothing) + .then(|| Action::Preview("path.freehand".into(), self.freehand_params(cx, false))); self.snap.clear(); self.active = false; self.near_start = false; diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index 00f0ebc93e..24a0e1e5e6 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -856,6 +856,44 @@ fn pencil_shows_the_straight_line_cursor_when_a_press_draws_a_line() { assert_eq!(Cursor::PencilStraight.precise(), Cursor::Crosshair, "Use Precise Cursors"); } +/// While a stroke that redraws a selected path is drawn, its previews show the stroke as drawn, +/// joined at its start to the path, unfilled, and leave the path and the selection as they are; +/// the release (or a switch of tool mid-stroke) redraws the path. +#[test] +fn pencil_previews_a_redraw_as_the_stroke_drawn_and_redraws_at_the_release() { + let (mut d, _) = doc_with_rect(); + let l = d.layers[0].id; + let id = d.alloc_id(); + let line = vectorcraft_geom::PathData::from_bezpath(&vectorcraft_geom::BezPath::from_vec(vec![ + vectorcraft_geom::PathEl::MoveTo(Point::new(300.0, 300.0)), + vectorcraft_geom::PathEl::LineTo(Point::new(400.0, 300.0)), + ])); + d.insert(Some(l), 1, vectorcraft_doc::Node::path(id, line, vectorcraft_doc::Appearance::default_art())).unwrap(); + let mut s = Selection::default(); + s.set([id]); + let p = paint(); + let mut cx = cx(&d, &s, &p); + cx.smart_guides = false; + let mut t = GestureTool::new("pencil"); + t.set_option("fill", &json!(true)); + // Out from the path and back onto it: within Edit selected paths within all the way. + let acts = drag(&mut t, &cx, &[(350.0, 304.0), (352.0, 308.0), (356.0, 309.0), (360.0, 303.0)], Mods::default()); + let (release, drawing) = acts.split_last().unwrap(); + let previews: Vec<&Value> = drawing.iter().flatten().filter_map(|a| if let Action::Preview(_, v) = a { Some(v) } else { None }).collect(); + assert!(!previews.is_empty(), "{acts:?}"); + for v in previews { + assert!(v.get("redraw").is_none() && v["fill"] == false && v["keepSelected"] == false && v["leaveSelection"] == true, "{v}"); + assert_eq!(v["points"][0], json!([350.0, 300.0]), "joined to the path where it starts: {v}"); + assert_eq!(v["points"][1], json!([350.0, 304.0]), "{v}"); + } + assert!(matches!(release.as_slice(), [Action::Preview(_, v), Action::Commit] if v["redraw"]["id"] == id.0 && v["fill"] == true), "{release:?}"); + // A switch of tool mid-stroke keeps the redraw too. + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 350.0, 304.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 352.0, 320.0)); + let acts = t.deactivate(&cx); + assert!(matches!(acts.as_slice(), [Action::Preview(_, v), Action::Commit] if v["redraw"]["id"] == id.0), "{acts:?}"); +} + /// Before a press, the Pencil shows its new-path cursor (the star) exactly when the press draws /// a new path: over an end of a selected open path, which the stroke continues, and over a /// selected path, which it redraws, it does not. With nothing selected, with Edit Selected Paths diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 3ab53ccec3..9cb03f12b3 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-20 · **Change:** minor (G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel: right-click item context menus for rows (Duplicate, Delete, Hide/Show, Edit Effect, Clear Appearance, Reduce to Basic Appearance) with selection handling, #8809; previously: Text styles panel: right-click item context menus for Character Styles and Paragraph Styles with Options, Duplicate, Delete, Redefine, Clear Overrides; scores and estimates unchanged; previously: G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged; previously: Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: Trim View hides the ruler guides, guide paths and the grid while it is on and greys out Show/Hide Guides and Show/Hide Grid, #8363; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: G12: Brushes panel: item right-click context menu (Brush Options, Duplicate Brush, Delete Brush) with selection handling; scores and estimates unchanged; previously: Graphic Styles panel: right-click item context menu for tiles and rows with Options, Duplicate, Delete, Redefine, Break Link; scores and estimates unchanged; previously: In the web build, an edit while the view of a heavy document moves (a tool drag held at an edge of the canvas, #8551, or a wheel scroll during a drag) draws only the part it changed into the last frame, which stays drawn moved with the view, instead of rendering the whole canvas each frame, and edits that go on once the view is still don't put off its render (#8688); scores and estimates unchanged; previously: G12: Links panel row context menu (Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Embed Image / Unembed…) with selection handling; scores and estimates unchanged; previously: Artboard tool: Shift held once a move or Alt-copy drag is under way keeps it to the level, upright or 45° line, #8580; scores and estimates unchanged; previously: Image Trace Ignore Color keeps the canvas View and stays armed on a missed pixel (#8068); a tool drag held near an edge of the canvas scrolls the view, #8551; scores and estimates unchanged; previously: G12: Place: show progress window with Cancel for slow placed files exceeding 0.4 s, part of #5930; scores and estimates unchanged; previously: All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, and a hovered dimmed row takes the panel's darker fill so it stays readable, #8294; scores and estimates unchanged; previously: Layers: selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged; previously: PDF import: type filled and stroked after a page of type filled only comes in filled and stroked, #8549 follow-up; scores and estimates unchanged; previously: selected Dimension extension-line color and weight in Properties (#7078; four focused UI regressions passed); scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: #8200: `.ai` and EPS import: an Art brush in Tints of a swatch-linked stroke color comes in brushed, its tints linked to the swatch; scores and estimates unchanged; previously: Ellipse: Up/Down changes Anchors while drawing (#7840); scores and estimates unchanged; previously: Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side columns; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-20 · **Change:** minor (Pencil Edit Selected Paths follows lifted strokes, carves, loops, closes and redraws compound paths; Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: M14/G12: Appearance panel: right-click item context menus for rows (Duplicate, Delete, Hide/Show, Edit Effect, Clear Appearance, Reduce to Basic Appearance) with selection handling, #8809; previously: Text styles panel: right-click item context menus for Character Styles and Paragraph Styles with Options, Duplicate, Delete, Redefine, Clear Overrides; scores and estimates unchanged; previously: G12: Actions panel item context menus for action sets (New Action…, New Set…, Duplicate Set, Delete Set, Set Options…) and actions (Play, Record, Duplicate, Delete, Action Options…, Batch…) with selection handling; clicking Duplicate on an action duplicates that action; headless tests in `crates/ui-egui/src/panels/actions.rs`; scores and estimates unchanged; previously: Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: Trim View hides the ruler guides, guide paths and the grid while it is on and greys out Show/Hide Guides and Show/Hide Grid, #8363; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: G12: Brushes panel: item right-click context menu (Brush Options, Duplicate Brush, Delete Brush) with selection handling; scores and estimates unchanged; previously: Graphic Styles panel: right-click item context menu for tiles and rows with Options, Duplicate, Delete, Redefine, Break Link; scores and estimates unchanged; previously: In the web build, an edit while the view of a heavy document moves (a tool drag held at an edge of the canvas, #8551, or a wheel scroll during a drag) draws only the part it changed into the last frame, which stays drawn moved with the view, instead of rendering the whole canvas each frame, and edits that go on once the view is still don't put off its render (#8688); scores and estimates unchanged; previously: G12: Links panel row context menu (Relink…, Go To Link, Update Link, Edit Original, Show in Folder, Embed Image / Unembed…) with selection handling; scores and estimates unchanged; previously: Artboard tool: Shift held once a move or Alt-copy drag is under way keeps it to the level, upright or 45° line, #8580; scores and estimates unchanged; previously: Image Trace Ignore Color keeps the canvas View and stays armed on a missed pixel (#8068); a tool drag held near an edge of the canvas scrolls the view, #8551; scores and estimates unchanged; previously: G12: Place: show progress window with Cancel for slow placed files exceeding 0.4 s, part of #5930; scores and estimates unchanged; previously: All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, and a hovered dimmed row takes the panel's darker fill so it stays readable, #8294; scores and estimates unchanged; previously: Layers: selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged; previously: PDF import: type filled and stroked after a page of type filled only comes in filled and stroked, #8549 follow-up; scores and estimates unchanged; previously: selected Dimension extension-line color and weight in Properties (#7078; four focused UI regressions passed); scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: #8200: `.ai` and EPS import: an Art brush in Tints of a swatch-linked stroke color comes in brushed, its tints linked to the swatch; scores and estimates unchanged; previously: Ellipse: Up/Down changes Anchors while drawing (#7840); scores and estimates unchanged; previously: Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: SVG export preserves document units on root width/height for physical units, #864; G11 estimate 8–15 → 6–13 h; previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: #8128: `.ai` and EPS import: clipping paths grouped in a compound path are its subpaths, so the compound clipping path clips its clipping group; scores and estimates unchanged; previously: import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown shows an icon before each reference, #6304; scores and estimates unchanged; previously: Envelopes: a top object's side columns; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; previously minor: G5 docs: Art brush Overlap and Pattern brush auto corners removed from strokes remaining; symbols remaining lists dynamic on-canvas beyond solid and guides outside the art; previously minor: custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; `.ai` and EPS import: older Art brush objects read; numeric fields step on wheel hover without taking keyboard focus, and a panel wheel turn cannot seed a canvas zoom glide, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; the canvas keeps selection outlines and anchors between frames; Indian-language hyphenation review and license allowlist, #4947; Stroke gradients: an arrowhead aligned to the tip is painted to the corners of its base, #5964; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Hindi catalog and contributor loanword preferences; full wording review in progress; Properties in Edit Artboards: a Transform section with the reference point above the Artboards section, #5219; the Control bar's Stroke: and Opacity: links scrub their fields, #4088; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window, #4155; Control bar Paragraph section with type selected, #5372; translating unchanged type reuses its glyph and character-stroke outlines; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026; Units › East Asian Type acts, with Q and Ha units; scores unchanged) > > Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5). > @@ -1579,6 +1579,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur A Smooth drag measures only the anchors and curved segments near the drag, and each against only the stretches of the drag near it. A release still looks up every anchor and curved segment of a path in the drag's grid, so the lookups still grow with the path's length. The grid reduces the number of stretch measures. On a curved path of 100,000 anchors, a drag of 200 points over 200 pt of it makes 7,533 stretch measures to find the curved segments in its reach, where it made 19,899,801 (99,999 segments times 199 stretches). The smoothed path is the same as before (engine tests `a_drag_over_a_long_path_measures_only_what_is_near_it` and `the_drag_grid_gives_the_results_of_measuring_the_whole_drag` in `crates/engine/src/cmd/draw2/smooth.rs`). A segment leading out of the stretch a Smooth drag smooths that is in the drag's reach for no more than 1/64 of the reach from the stretch's anchor is left as it is, and the stretch ends at that anchor, so a drag that reaches an anchor an earlier drag added at the edge of its reach does not split the segment beyond it again or leave a corner there (`path.smoothRegion`). The 1/64 share is VectorCraft's own value (`tests/draw2.rs`, `smooth_drags_again_and_again_along_part_of_an_ellipse_add_no_anchors_or_corners`). Before a press that draws a new path, the Pencil cursor shows a small star, as [Draw freeform paths with the Pencil tool](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-freeform-paths-with-the-pencil-tool.html) describes; over a selected path within Edit selected paths' distance, which the press continues from an end or redraws, the star is not shown ([Reshape paths with the Pencil tool](https://web.archive.org/web/20260106004407/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/reshape-paths-with-the-pencil-tool.html)). + With Edit selected paths on, a Pencil or Paintbrush stroke that starts on a selected path and ends farther than its distance takes the path with it (a closed path opens where the stroke starts; an open one is cut there and drops the part the stroke heads along), one that returns to its start adds a loop, one over an open path's two ends closes it, a stroke across a closed shape replaces the side nearer to it, the stroke's ends bend onto the path, and a selected compound path's member paths are redrawn (`path.freehand` `redraw`, #3793); while the stroke is drawn, the preview shows it as drawn and the path changes at the release ([Reshape paths with the Pencil tool](https://web.archive.org/web/20260106004407/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/reshape-paths-with-the-pencil-tool.html)). Keep selected in the Pencil and Paintbrush Tool Options is on by default: while it is on, a stroke selects the path it draws or continues and replaces the earlier selection. While it is off, a new stroke leaves nothing selected, the earlier selection included, as the reference application starts the stroke by dropping it (#5752); a continued or redrawn path is deselected while the rest of the selection stays (`path.freehand` `keepSelected`). With two open paths selected, a Pencil stroke from an end of one that ends within Edit selected paths' distance of an end of the other connects them into one path with the first path's appearance, in one undo step, as [Connect two paths with the Pencil tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/connect-two-paths-with-the-pencil-tool.html) describes (`path.freehand` `connect`). `path.freehand` and `brush.freehand` refuse a `connect` without `extend` with an error, and check a `connect` given with `extend` before a stroke of one point returns, so a bad one changes neither the path's brush nor the selection. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e736d3aae5..c74a8a8d7b 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-20 · **Change:** minor (G12: Asset Export tile context menus; scores and estimates unchanged; previously: Properties panel per context (G12): contextual text Quick Actions (Create Outlines, Retype, Find and Replace…); scores and estimates unchanged; previously: Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: Trim View hides the ruler guides, guide paths and the grid while it is on and greys out Show/Hide Guides and Show/Hide Grid, #8363; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: Graphic Styles panel: right-click item context menu for tiles and rows with Options, Duplicate, Delete, Redefine, Break Link; scores and estimates unchanged; previously: Artboard tool: Shift held once a move or Alt-copy drag is under way keeps it to the level, upright or 45° line, #8580; scores and estimates unchanged; previously: Image Trace Ignore Color keeps the canvas View and stays armed on a missed pixel (#8068); Canvas context menu: a right-click on a path offers Simplify… next to Smooth…, opening the Simplify slider, or the Simplify dialog kept for next time, as Object › Path › Simplify… does, #8344; scores and estimates unchanged; previously: a tool drag held near an edge of the canvas scrolls the view, #8551; scores and estimates unchanged; previously: G12: Place: show progress window with Cancel for slow placed files exceeding 0.4 s, part of #5930; scores and estimates unchanged; previously: All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, and a hovered dimmed row takes the panel's darker fill so it stays readable, #8294; scores and estimates unchanged; previously: : selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged; previously: Layersselected Dimension extension-line color and weight in Properties (#7078; four focused UI regressions passed); scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: Ellipse: Up/Down changes Anchors while drawing (#7840); scores and estimates unchanged; previously: Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Layers panel: Alt over the list shows the copy cursor while rows or the selected-art square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Remove Background in the Contextual Task Bar, Properties › Quick Actions and the Control bar; previously minor: Ruler origin: the corner drag snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Outline view: images and gradient meshes are picked on what Outline draws, so a click inside them reaches the path behind, #6437; previously minor: a middle-click on a document tab closes it, #6506; previously minor: Blob Brush: a round tip's preview is the outline of the area it adds, round at both ends, as the stroke it commits (#4343); scores and estimates unchanged; previously:; ruler double-click adds a guide at the pointer, #5239; G5: Inventory Icons built-in symbol library (four built-ins); previously minor: files that record no units open in Preferences › Units › General, #5820; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Layers: Rename (`ui.rename`) opens the name field of the selected layer, group or object, #5324; Properties in Edit Artboards: Transform section above the Artboards section, #5219; scrubby labels: the Control bar's Stroke: and Opacity: links and the Properties panel's Stroke link scrub their fields, #4088; Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; shape tools: a press on the selection's centre point moves it and one in the rotate zone outside a box corner turns it, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-20 · **Change:** minor (Pencil Edit Selected Paths follows lifted strokes, carves, loops, closes and redraws compound paths; Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: G12: Asset Export tile context menus; scores and estimates unchanged; previously: Properties panel per context (G12): contextual text Quick Actions (Create Outlines, Retype, Find and Replace…); scores and estimates unchanged; previously: Layers: a targeted item with an appearance of its own keeps its inner ring visible around a smaller appearance dot, so the target circle's four looks differ, #8711; scores and estimates unchanged; previously: Trim View hides the ruler guides, guide paths and the grid while it is on and greys out Show/Hide Guides and Show/Hide Grid, #8363; scores and estimates unchanged; previously: Scissors shows the actual proposed cut point while hovering, using its existing snapping and cut target (#8655); scores and estimates unchanged; previously: Graphic Styles panel: right-click item context menu for tiles and rows with Options, Duplicate, Delete, Redefine, Break Link; scores and estimates unchanged; previously: Artboard tool: Shift held once a move or Alt-copy drag is under way keeps it to the level, upright or 45° line, #8580; scores and estimates unchanged; previously: Image Trace Ignore Color keeps the canvas View and stays armed on a missed pixel (#8068); Canvas context menu: a right-click on a path offers Simplify… next to Smooth…, opening the Simplify slider, or the Simplify dialog kept for next time, as Object › Path › Simplify… does, #8344; scores and estimates unchanged; previously: a tool drag held near an edge of the canvas scrolls the view, #8551; scores and estimates unchanged; previously: G12: Place: show progress window with Cancel for slow placed files exceeding 0.4 s, part of #5930; scores and estimates unchanged; previously: All Tools drawer: a tool the toolbar holds is dimmed in the readable dim text colour, not the disabled colour that was unreadable against the panel, and a hovered dimmed row takes the panel's darker fill so it stays readable, #8294; scores and estimates unchanged; previously: : selected guide rows stay highlighted after the pointer leaves (#7344); scores and estimates unchanged; previously: Layersselected Dimension extension-line color and weight in Properties (#7078; four focused UI regressions passed); scores and estimates unchanged; previously: Brush Options Key Color: restore canvas input for the existing one-shot pick, then resume the retained draft and previous tool (#8284; six full-app input regressions passed); scores and estimates unchanged; previously: Ellipse: Up/Down changes Anchors while drawing (#7840); scores and estimates unchanged; previously: Windows/Linux menu access keys and localized cues (#6596); previously: Backquote/~ arrow pattern nudges (#7717); scores and estimates unchanged; previously: Window > Toolbars > Compact Tools offers optional denser main Tools spacing (#7234); default layout, scores and estimates unchanged; previously: Direct Selection: Space during an ordinary path's handle drag repositions its anchor and handles, including a Pen loan (#7237, request 3 only; scores and estimates unchanged); previously: Floating panels keep their window level while focus moves between the app's windows, so a press on one panel's bar no longer hands the keyboard to another, #6986; scores and estimates unchanged; previously minor: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Layers panel: Alt over the list shows the copy cursor while rows or the selected-art square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Remove Background in the Contextual Task Bar, Properties › Quick Actions and the Control bar; previously minor: Ruler origin: the corner drag snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Outline view: images and gradient meshes are picked on what Outline draws, so a click inside them reaches the path behind, #6437; previously minor: a middle-click on a document tab closes it, #6506; previously minor: Blob Brush: a round tip's preview is the outline of the area it adds, round at both ends, as the stroke it commits (#4343); scores and estimates unchanged; previously:; ruler double-click adds a guide at the pointer, #5239; G5: Inventory Icons built-in symbol library (four built-ins); previously minor: files that record no units open in Preferences › Units › General, #5820; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Drop Shadow and glow dialogs: spinner arrows, #5367, #5368; Stroke Weight Up and Down shortcuts, #5797; Layers: Rename (`ui.rename`) opens the name field of the selected layer, group or object, #5324; Properties in Edit Artboards: Transform section above the Artboards section, #5219; scrubby labels: the Control bar's Stroke: and Opacity: links and the Properties panel's Stroke link scrub their fields, #4088; Properties: Quick Actions has Repeat Options for one selected repeat, #5181; Direct Selection: Shift-click picks several blend spine points, which drag together, #5285; Direct Selection: Cmd/Ctrl held lends the Selection tool and shows its bounding box, #3901; Join tool trims two crossing open paths and joins them at the crossing, #5844; Control bar: Paragraph: link and Align left/center/right while type is selected, #5372; shape tools: a press on the selection's centre point moves it and one in the rotate zone outside a box corner turns it, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) > > Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5). > @@ -223,7 +223,7 @@ tools, never checked side by side) isn't captured row by row. | Blend Replace Spine, move and Undo redraw (#5179) | CPU regression-tested | Renderer damage bounds include keys and steps rotated along a curved spine. Both original straight and curved CPU regressions pass, checking full-frame agreement and that every changed pixel lies inside the advertised redraw area. | | Several blend spine points picked and dragged together (#5285) | done | with Direct Selection, Shift-click picks more points of a selected blend's spine or takes one away, as on a path; dragging any picked point moves them all, and the key objects on them, in one undo step (`object.blend.spine.moveAnchor {with}`); a marquee picks the spine points inside it on the topmost selected blend, and with Shift adds or takes them away | | Add/Delete/Anchor Point tools; Anchor Point tool drags segments to reshape | done | #2267: a click on a handle end retracts that handle and leaves the anchor a corner with the other one; Shift held at the press on an anchor moves it, handles and all (Shift kept down: at 45° steps) instead of pulling out handles; Alt held while dragging a handle links it with the opposite handle and makes the anchor smooth, on a blend's spine too | -| Pencil: Fidelity, Keep selected, Alt to Smooth, edit selected paths, close by proximity | done | Fidelity is in screen pixels, the same at any zoom, and goes down to 0.01 px in the dialog and the tool, which sends `path.freehand` the value in points at the current zoom (#5729; the Smooth tool keeps 0.05 pt); its slider runs across the Tool Options row on a logarithmic rail from 0.01 to 20 px, the field shows hundredths, and the slider's and the field's arrow keys step hundredths up to 0.1 px, tenths up to 1 px and whole pixels above (Shift ×10) (#3328); Alt key toggles to Smooth Tool (#2001); Shift held at the press draws a straight line at 45° steps from the Constrain Angle, and Alt held at the press (with Alt key toggles to Smooth Tool off) a straight line at any angle (#3799), with a straight-line cursor (a short level line) while Shift or Alt is held before the press, and a path-continuation cursor (a short rising line) over an end of a selected open path, where the stroke continues the path, freehand or straight, and while a continuing stroke ends near an open end of another selected path it connects to; Edit Selected Paths continues a selected path from an end and, from a stroke that starts and ends on a selected path, redraws the section between (the shorter way round a closed path, #2850); with Keep selected (Pencil and Paintbrush, on by default) on, a stroke selects the path it draws or continues and replaces the earlier selection, and off a new stroke leaves nothing selected, the earlier selection included, while a continued or redrawn path is deselected and the rest of the selection stays; a filled Pencil path keeps a stroke of None (#1804, part of #1679); while a freehand stroke is drawn back to within Close Paths When Ends Are Within of its start, or a stroke continuing a selected path (a straight line too) to within it of that path's other end, the Pencil and the Paintbrush show the closing cursor, and a release there closes the path; a Pencil stroke from an end of one selected open path to an end of another connects the two into one path | +| Pencil: Fidelity, Keep selected, Alt to Smooth, edit selected paths, close by proximity | done | Fidelity is in screen pixels, the same at any zoom, and goes down to 0.01 px in the dialog and the tool, which sends `path.freehand` the value in points at the current zoom (#5729; the Smooth tool keeps 0.05 pt); its slider runs across the Tool Options row on a logarithmic rail from 0.01 to 20 px, the field shows hundredths, and the slider's and the field's arrow keys step hundredths up to 0.1 px, tenths up to 1 px and whole pixels above (Shift ×10) (#3328); Alt key toggles to Smooth Tool (#2001); Shift held at the press draws a straight line at 45° steps from the Constrain Angle, and Alt held at the press (with Alt key toggles to Smooth Tool off) a straight line at any angle (#3799), with a straight-line cursor (a short level line) while Shift or Alt is held before the press, and a path-continuation cursor (a short rising line) over an end of a selected open path, where the stroke continues the path, freehand or straight, and while a continuing stroke ends near an open end of another selected path it connects to; Edit Selected Paths continues a selected path from an end and, from a stroke that starts and ends on a selected path, redraws the section between (the way round a closed path that leaves the bigger shape, so a stroke across a shape carves off its smaller part and an arch over a thin shape's side keeps the shape; on an open path the way the stroke runs along it at each end decides: where it starts it replaces the part it runs along, where it lands it joins the part it runs into, so it replaces the part between, closes the path round it without the closing cursor, or ends where the pen is lifted; #2850), the stroke's ends bent smoothly onto the path; a stroke lifted farther than the distance takes the path with it (a closed path opens where the stroke starts, an open one is cut there and drops the part the stroke heads along), one back to its starting point adds a loop, and a selected compound path's member paths are redrawn too (#3793); while such a stroke is drawn the preview shows the stroke as drawn and the path changes at the release; with Keep selected (Pencil and Paintbrush, on by default) on, a stroke selects the path it draws or continues and replaces the earlier selection, and off a new stroke leaves nothing selected, the earlier selection included, while a continued or redrawn path is deselected and the rest of the selection stays; a filled Pencil path keeps a stroke of None (#1804, part of #1679); while a freehand stroke is drawn back to within Close Paths When Ends Are Within of its start, or a stroke continuing a selected path (a straight line too) to within it of that path's other end, the Pencil and the Paintbrush show the closing cursor, and a release there closes the path; a Pencil stroke from an end of one selected open path to an end of another connects the two into one path | | Drop Shadow, Outer Glow and Inner Glow: Opacity, the offsets, Blur and Darkness have spinner arrows that step by one (a unit for distances), repeat when held and stop at the fields' ends (#5367, #5368) | done | dialogs::effect test drop_shadow_and_outer_glow_fields_have_spinner_arrows; other effect dialogs' number fields still have none | | Effect dialogs' colour fields: a swatch beside the hex follows typed values, and a double-click opens the Color Picker over the dialog, whose OK fills it and Cancel comes back unchanged (#5365) | done | dialogs::effect tests outer_glow_colour_swatch_opens_the_color_picker and drop_shadow_colour_swatch_opens_the_color_picker (Drop Shadow's Color, #5364); the picker previews nothing itself, the effect dialog previews the returned colour | | Join tool scrubbing, Average, Join | done | Join merges the direct-selected anchors lying on one another along a path, as after Average, into one (#1533); the Join tool trims two crossing open paths whose overhanging ends it scrubs over and joins them at the crossing, instead of drawing a segment between their ends (#5844) |