From 24078d6071d36be653734f04a3a877a701e2bd4f Mon Sep 17 00:00:00 2001 From: yoriswind Date: Wed, 11 Nov 2026 06:42:13 -0800 Subject: [PATCH 001/158] M2: preserve filled open paths when erasing (#6582) --- crates/engine/src/cmd/draw2/common.rs | 20 +- crates/engine/src/cmd/draw2/cut.rs | 39 +++- crates/engine/tests/eraser_open_fill.rs | 286 ++++++++++++++++++++++++ docs/gaps.md | 7 +- docs/roadmap.md | 7 +- docs/target-app-parity.md | 6 +- docs/ui-parity.md | 4 + 7 files changed, 349 insertions(+), 20 deletions(-) create mode 100644 crates/engine/tests/eraser_open_fill.rs diff --git a/crates/engine/src/cmd/draw2/common.rs b/crates/engine/src/cmd/draw2/common.rs index 0ca376b243..3b5022ff64 100644 --- a/crates/engine/src/cmd/draw2/common.rs +++ b/crates/engine/src/cmd/draw2/common.rs @@ -319,18 +319,24 @@ pub(super) fn target_paths(doc: &Document, sel: &Selection, area: Rect) -> Vec Result> { - let closed_compound = |n: &Node| { +/// Any non-None fill in the appearance stack, including a fill below a topmost None. +pub(super) fn has_fill(n: &Node) -> bool { + n.appearance.items.iter().any(|item| item.is_fill() && !item.paint().is_none()) +} + +/// [`target_paths`] for tools that cut fills, with geometry and fill rule. Closed compound paths +/// act as one shape so their holes stay holes. With `open_fills`, filled compounds with open +/// members do too; callers that only cut closed paths leave that off. +pub(super) fn fill_targets(doc: &Document, sel: &Selection, area: Rect, open_fills: bool) -> Result> { + let area_compound = |n: &Node| { + let filled = open_fills && has_fill(n); matches!(&n.kind, NodeKind::Compound { children, .. } - if children.iter().all(|c| matches!(&c.kind, NodeKind::Path { path, .. } if path.is_closed()))) + if children.iter().all(|c| matches!(&c.kind, NodeKind::Path { path, .. } if path.is_closed() || filled))) }; let editable = doc.editable(); let mut out: Vec<(NodeId, PathData, FillRule)> = vec![]; for id in target_paths(doc, sel, area) { - let compound = doc.parent_of(id).and_then(|p| doc.node(p)).filter(|p| closed_compound(p) && editable(p.id)); + let compound = doc.parent_of(id).and_then(|p| doc.node(p)).filter(|p| area_compound(p) && editable(p.id)); let target = compound.map_or(id, |c| c.id); if out.iter().any(|t| t.0 == target) { continue; diff --git a/crates/engine/src/cmd/draw2/cut.rs b/crates/engine/src/cmd/draw2/cut.rs index 126fa57a1b..287b850b71 100644 --- a/crates/engine/src/cmd/draw2/cut.rs +++ b/crates/engine/src/cmd/draw2/cut.rs @@ -1,6 +1,6 @@ use super::common::{ - dist_to_polyline, fill_targets, ids_json, path_mut, path_of, points_param, poly_bounds, pressure_region, replace_with_pieces, samples_param, - sibling_with, size_pressure, target_paths, usize_opt, + dist_to_polyline, fill_targets, has_fill, ids_json, path_mut, path_of, points_param, poly_bounds, pressure_region, replace_with_pieces, + samples_param, sibling_with, size_pressure, target_paths, usize_opt, }; use super::{ Anchor, AnchorKind, Beside, BezPath, BoolOp, Cap, EngineError, FillRule, Join, NodeId, ParamCurve, PathData, Point, Result, Session, SubPath, @@ -244,7 +244,7 @@ pub(super) fn knife(s: &mut Session, p: &Value) -> Result { let st = s.doc()?; let strip = po::outline_stroke(&PathData::single(SubPath::polyline(&pts, false)), KNIFE_GAP, Cap::Butt, Join::Round, 4.0); let mut plan: Vec<(NodeId, Vec)> = vec![]; - for (id, pd, rule) in fill_targets(&st.doc, &st.selection, poly_bounds(&pts, 1.0))? { + for (id, pd, rule) in fill_targets(&st.doc, &st.selection, poly_bounds(&pts, 1.0), false)? { if !pd.is_closed() { continue; } @@ -305,13 +305,34 @@ pub(super) fn erase_region(s: &mut Session, p: &Value) -> Result { None => dist_to_polyline(&round, squash * q) <= r, }; let mut plan: Vec<(NodeId, Vec)> = vec![]; - for (id, pd, rule) in fill_targets(&st.doc, &st.selection, poly_bounds(&pts, reach))? { - if pd.is_closed() { - if po::area(&po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Intersect), FillRule::NonZero) <= 1e-6 { - continue; + for (id, pd, rule) in fill_targets(&st.doc, &st.selection, poly_bounds(&pts, reach), true)? { + let closed = pd.is_closed(); + let single = pd.subpaths.len() == 1; + let filled = !closed && st.doc.node(id).is_some_and(has_fill) && po::area(&pd, rule) > 0.0; + // Fill implicitly closes an open contour. Keep zero-area open lines + // separate: the fill Boolean would otherwise discard their stroke geometry. + let (areas, lines): (Vec<_>, Vec<_>) = + pd.subpaths.into_iter().partition(|sp| closed || (filled && (single || po::area(&PathData::single(sp.clone()), rule) > 0.0))); + let (areas, lines) = (PathData::new(areas), PathData::new(lines)); + let mut changed = false; + let mut pieces = vec![]; + if !areas.is_empty() { + if po::area(&po::boolean(&areas, rule, ®ion, FillRule::NonZero, BoolOp::Intersect), FillRule::NonZero) > 1e-6 { + changed = true; + pieces.extend(components(&po::boolean(&areas, rule, ®ion, FillRule::NonZero, BoolOp::Difference))); + } else { + pieces.push(areas); } - plan.push((id, components(&po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Difference)))); - } else if let Some(pieces) = erase_outline(&pd, short / 2.0, &under) { + } + if !lines.is_empty() { + if let Some(rest) = erase_outline(&lines, short / 2.0, &under) { + changed = true; + pieces.extend(rest); + } else { + pieces.push(lines); + } + } + if changed { plan.push((id, pieces)); } } diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs new file mode 100644 index 0000000000..19e73c125f --- /dev/null +++ b/crates/engine/tests/eraser_open_fill.rs @@ -0,0 +1,286 @@ +//! Filled open-path Eraser regressions through the public engine and CPU renderer. +// Integration tests may unwrap and panic on failure (AGENTS.md). +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] + +use serde_json::json; +use vectorcraft_doc::{NodeId, NodeKind}; +use vectorcraft_engine::Session; +use vectorcraft_geom::{FillRule, PathData, Point}; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 300, "height": 300})).unwrap(); + s +} + +fn path(s: &Session, id: NodeId) -> &PathData { + match &s.doc().unwrap().doc.node(id).unwrap().kind { + NodeKind::Path { path, .. } => path, + _ => panic!("the fixture is a path"), + } +} + +fn paths(s: &Session) -> Vec { + let mut paths = vec![]; + s.doc().unwrap().doc.walk(|node| { + if let NodeKind::Path { path, .. } = &node.kind { + paths.push(path.clone()); + } + }); + paths +} + +/// #6582: an open contour fills its implicitly closed area. Erasing a strip removes only that +/// strip, just as for the closed rectangle, rather than changing its fill to diagonal chords. +#[test] +fn eraser_preserves_the_fill_of_an_open_rectangle() { + let samples = [(110.0, 125.0), (190.0, 125.0), (110.0, 175.0), (190.0, 175.0)]; + let render = |s: &Session| { + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) + }; + for closed in [true, false] { + let mut s = session(); + let id = NodeId( + s.execute( + "path.create", + &json!({"closed": closed, "anchors": [ + {"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "none": true})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + assert_eq!(path(&s, id).is_closed(), closed); + let before = render(&s); + for (x, y) in samples.into_iter().chain([(150.0, 150.0)]) { + assert_eq!(before.pixel(x as u32, y as u32), [0, 0, 0, 255], "closed={closed}: original fill at ({x}, {y})"); + } + + // The explicit command fixes the tip at 10 pt; its round ends are outside the rectangle. + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + let remaining: Vec = paths(&s); + let filled = + |x, y| remaining.iter().any(|path| vectorcraft_geom::hit::fill_contains(&path.to_bezpath(), FillRule::NonZero, Point::new(x, y))); + let after = render(&s); + for (x, y) in samples { + assert!(filled(x, y), "closed={closed}: retained fill missing at ({x}, {y})"); + assert_eq!(after.pixel(x as u32, y as u32), [0, 0, 0, 255], "closed={closed}: retained pixel at ({x}, {y})"); + } + assert!(!filled(150.0, 150.0), "closed={closed}: eraser band still filled"); + assert_eq!(after.pixel(150, 150)[3], 0, "closed={closed}: erased pixel"); + let area: f64 = remaining.iter().map(|path| vectorcraft_pathops::area(path, FillRule::NonZero)).sum(); + assert!((area - 9000.0).abs() < 1.0, "closed={closed}: retained area {area}"); + } +} + +fn total_line_length(paths: &[PathData], x: f64) -> f64 { + paths + .iter() + .flat_map(|path| &path.subpaths) + .filter(|subpath| !subpath.closed && subpath.anchors.len() >= 2 && subpath.anchors.iter().all(|anchor| (anchor.p.x - x).abs() < 0.01)) + .map(|subpath| subpath.anchors.windows(2).map(|pair| pair[0].p.distance(pair[1].p)).sum::()) + .sum() +} + +#[test] +fn eraser_keeps_mixed_fill_and_zero_area_strokes_with_one_undo() { + for filled_open in [true, false] { + let mut s = session(); + let id = NodeId(s.execute("path.create", &json!({"anchors": [{"x": 100, "y": 100}]})).unwrap()["id"].as_u64().unwrap()); + s.execute( + "path.setAnchors", + &json!({"id": id.0, "subpaths": [ + {"closed": !filled_open, "anchors": [{"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200}]}, + {"closed": false, "anchors": [{"x": 250, "y": 100}, {"x": 250, "y": 200}]}, + {"closed": false, "anchors": [{"x": 250, "y": 220}, {"x": 250, "y": 270}]} + ]}), + ) + .unwrap(); + if filled_open { + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); + } else { + s.execute("paint.setFill", &json!({"ids": [id.0], "none": true})).unwrap(); + } + s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#ff0000"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [id.0], "weight": 2})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + + let before_miss = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let miss_history = s.doc().unwrap().history.undo.len(); + let miss = s.execute("path.eraseRegion", &json!({"points": [[50, 20], [250, 20]], "size": 10})).unwrap(); + assert_eq!(miss["ids"], json!([])); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before_miss, "a non-intersecting Eraser leaves the document unchanged"); + assert_eq!(s.doc().unwrap().history.undo.len(), miss_history, "a miss adds no history entry"); + + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let before_selection = s.doc().unwrap().selection.clone(); + let before_history = s.doc().unwrap().history.undo.len(); + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + let after = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let after_selection = s.doc().unwrap().selection.clone(); + assert_eq!(s.doc().unwrap().history.undo.len(), before_history + 1); + + let remaining = paths(&s); + let line_length = total_line_length(&remaining, 250.0); + assert!((line_length - 140.0).abs() < 0.1, "filled_open={filled_open}: retained open strokes {line_length}"); + assert!( + remaining + .iter() + .flat_map(|path| &path.subpaths) + .filter(|sp| sp.anchors.iter().all(|a| (a.p.x - 250.0).abs() < 0.01)) + .all(|sp| !sp.closed) + ); + let image = + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()); + for (x, y) in [(250, 120), (250, 180), (250, 240)] { + let pixel = image.pixel(x, y); + assert!(pixel[0] > 200 && pixel[1] < 60 && pixel[2] < 60 && pixel[3] > 200, "retained red stroke at ({x},{y}): {pixel:?}"); + } + if filled_open { + let area: f64 = remaining.iter().map(|path| vectorcraft_pathops::area(path, FillRule::NonZero)).sum(); + assert!((area - 9000.0).abs() < 1.0, "retained fill area {area}"); + for (x, y) in [(110, 125), (190, 125), (110, 175), (190, 175)] { + assert!(image.pixel(x, y)[3] > 240, "retained fill pixel ({x},{y})"); + } + assert_eq!(image.pixel(150, 150)[3], 0, "the fill erase band is empty"); + } else { + let outline_length: f64 = remaining.iter().map(PathData::length).sum(); + assert!((outline_length - 520.0).abs() < 1.0, "unfilled closed rectangle and two open lines retain 520 pt of stroke: {outline_length}"); + assert!(remaining.iter().flat_map(|path| &path.subpaths).all(|subpath| !subpath.closed), "unfilled outline survivors stay open"); + assert_eq!(image.pixel(150, 145)[3], 0, "outline splitting does not add a stroke across the rectangle interior"); + } + + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before, "one Undo restores the exact document"); + assert_eq!(s.doc().unwrap().selection, before_selection); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), after, "one Redo restores the exact erased document"); + assert_eq!(s.doc().unwrap().selection, after_selection); + } +} + +#[test] +fn eraser_keeps_open_compound_holes_with_both_fill_rules() { + for rule in ["nonZero", "evenOdd"] { + let mut s = session(); + let outer = NodeId( + s.execute( + "path.create", + &json!({"anchors": [ + {"x": 100, "y": 100}, {"x": 300, "y": 100}, {"x": 300, "y": 300}, {"x": 100, "y": 300} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + let inner = NodeId( + s.execute( + "path.create", + &json!({"anchors": [ + {"x": 150, "y": 150}, {"x": 150, "y": 250}, {"x": 250, "y": 250}, {"x": 250, "y": 150} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + for id in [outer, inner] { + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "none": true})).unwrap(); + } + s.execute("select.set", &json!({"ids": [outer.0, inner.0]})).unwrap(); + let compound = NodeId(s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + s.execute("path.setFillRule", &json!({"rule": rule})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let members = match &s.doc().unwrap().doc.node(compound).unwrap().kind { + NodeKind::Compound { children, .. } => children, + other => panic!("expected compound path, got {other:?}"), + }; + assert!(members.iter().all(|member| !member.path_data().unwrap().is_closed()), "{rule}: both source contours remain open"); + let before = + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()); + assert!(before.pixel(120, 140)[3] > 240, "{rule}: ring fills before Eraser"); + assert_eq!(before.pixel(200, 200)[3], 0, "{rule}: the compound hole is empty before Eraser"); + let before_miss = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let miss_history = s.doc().unwrap().history.undo.len(); + let miss = s.execute("path.eraseRegion", &json!({"points": [[200, 200]], "size": 10})).unwrap(); + assert_eq!(miss["ids"], json!([]), "{rule}: a stroke wholly inside the hole misses"); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before_miss); + assert_eq!(s.doc().unwrap().history.undo.len(), miss_history, "{rule}: the hole miss adds no history"); + + s.execute("path.eraseRegion", &json!({"points": [[80, 120], [320, 120]], "size": 10})).unwrap(); + let after = + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()); + assert_eq!(after.pixel(120, 120)[3], 0, "{rule}: swept band is empty"); + assert!(after.pixel(120, 140)[3] > 240, "{rule}: retained ring is filled"); + assert_eq!(after.pixel(200, 200)[3], 0, "{rule}: compound hole remains empty"); + } +} + +#[test] +fn eraser_removes_only_the_swept_strip_from_a_zero_signed_area_open_bowtie() { + let mut s = session(); + let id = NodeId( + s.execute( + "path.create", + &json!({"anchors": [ + {"x": 100, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200}, {"x": 200, "y": 100} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "none": true})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + assert!(!path(&s, id).is_closed(), "the bowtie is open"); + assert!(path(&s, id).subpaths.first().unwrap().signed_area().abs() < 1e-9, "the bowtie has zero signed area"); + let render = |s: &Session| { + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) + }; + let before = render(&s); + let before_area: f64 = before.pixels.as_chunks::<4>().0.iter().map(|rgba| f64::from(rgba[3]) / 255.0).sum(); + assert!((before_area - 5000.0).abs() < 2.0, "the open bowtie fills both lobes: {before_area}"); + for y in [110, 140, 175] { + assert!(before.pixel(150, y)[3] > 240, "original lobe pixel y={y}"); + } + + s.execute("path.eraseRegion", &json!({"points": [[50, 125], [250, 125]], "size": 10})).unwrap(); + let after = render(&s); + let after_area: f64 = after.pixels.as_chunks::<4>().0.iter().map(|rgba| f64::from(rgba[3]) / 255.0).sum(); + assert!((after_area - 4500.0).abs() < 2.0, "only the 500 px² sweep strip is removed: {after_area}"); + assert!(after.pixel(150, 110)[3] > 240); + assert!(after.pixel(150, 140)[3] > 240); + assert!(after.pixel(150, 175)[3] > 240); + assert_eq!(after.pixel(150, 125)[3], 0, "the swept strip is empty"); + let area: f64 = paths(&s).iter().map(|path| vectorcraft_pathops::area(path, FillRule::NonZero)).sum(); + assert!((area - 4500.0).abs() < 1.0, "retained bowtie area {area}"); +} + +/// Even-Odd can cancel a nonzero signed area: that open path still has an erasable stroke. +#[test] +fn eraser_cuts_the_outline_when_even_odd_cancels_an_open_paths_fill() { + let mut s = session(); + let made = s.execute("path.create", &json!({"d": "M100 100H200V200H100V100H200V200H100V100"})).unwrap(); + let id = NodeId(made["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"color": "#ff0000"})).unwrap(); + s.execute("stroke.set", &json!({"weight": 2})).unwrap(); + s.execute("path.setFillRule", &json!({"rule": "evenOdd"})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let original = path(&s, id); + assert!(!original.is_closed()); + assert!(original.subpaths.first().unwrap().signed_area().abs() > 10000.0); + assert!(vectorcraft_pathops::area(original, FillRule::EvenOdd) < 1e-9, "Even-Odd cancels the two laps"); + assert!((original.length() - 800.0).abs() < 1e-9); + + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + let length: f64 = paths(&s).iter().map(PathData::length).sum(); + assert!((length - 760.0).abs() < 0.1, "both laps lose their crossed stroke portions: {length}"); +} diff --git a/docs/gaps.md b/docs/gaps.md index 19376c4bf2..45f7fbb6a8 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,8 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; 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; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; 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; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> +> **Eraser fill update (2026-11-11):** filled open paths and compound holes use filled-area cutting (#6582); scores and estimates unchanged. ## Feature submission evidence @@ -305,6 +307,8 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G11 Correctness bugs in core tools +- **Improved (#6582):** the Eraser subtracts its swept area from filled open contours, preserving fill outside the stroke. Open compound members keep their holes under either fill rule; zero-area open lines keep outline splitting. Original engine integration regressions check rendered pixels, retained geometry, mixed paths and history. Scores and estimates unchanged. + - **Export-only improvement (#6309):** PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. Broader G11 scope, scores and estimates unchanged. - **Done, deletion only (#3380):** deleting anchors or segments that disconnect an ordinary contour creates independent selected path objects, preserving appearance, baked transforms, sibling order and one-step Undo/Redo. Existing multi-subpath paths and compound members stay intact. A second Delete removes all selected survivors. Bounds-fitted gradients keep their original placement on the new objects; already placed gradients stay unchanged. Segment endpoint highlighting remains open; broader G11 scope, scores and estimates are unchanged. Evidence: `crates/engine/tests/it/delete_path_pieces.rs` and the Delete/Backspace frame regression in `crates/ui-egui/src/tests/removeanchors.rs`. @@ -852,6 +856,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | Date | Change | Summary | |---|---|---| +| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; zero-area open lines retain outline splitting (#6582). Scores and estimates unchanged. | | 2026-11-11 | minor | G5: built-in Status Effects graphic style library (Poison Tint, Freeze Edge, Burn Aura, Stun Pulse, Stealth Fade, Shield Buff); Missing trimmed; estimate 7–17 → 6–16 h; MCP docs list UI Frames and Map Markers under Symbol libraries. | | 2026-11-11 | minor | G5: built-in Inventory Icons symbol library (Sword, Shield, Potion, Key, Gem; no default 9-slice); Missing trimmed; estimate 8–18 → 7–17 h. | | 2026-11-10 | minor | G4 type: Edit › Edit Custom Dictionary… adds, deletes and changes the custom dictionary's words, #4936; the Check Spelling dialog remains; scores and estimates unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index 82362eb94c..73b42db7a1 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,8 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-10 · **Change:** minor (M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** minor (M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> +> **Eraser fill update (2026-11-11):** filled open paths and compound holes use filled-area cutting (#6582); scores and estimates unchanged. > > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > @@ -140,7 +142,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l |---|---|---|---| | M0 | Skeleton + vertical slice | ✅ done | — | | M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | -| M2 | Drawing tools + smart guides | ✅ mostly done (#3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | +| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside its sweep on open paths and keeps compound holes (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | | M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel, Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls | 4–8 | | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | @@ -189,6 +191,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; zero-area open lines retain outline splitting (#6582). Scores and estimates unchanged. | | 2026-11-10 | minor | M10/G5: Status Effects built-in graphic style library; MCP docs catch-up for UI Frames and Map Markers; estimates unchanged | | 2026-11-10 | minor | M10/G5: Inventory Icons built-in symbol library (Sword, Shield, Potion, Key, Gem); estimates unchanged | | 2026-11-10 | minor | M7: the Edit Custom Dictionary dialog (#4936); the Check Spelling dialog remains; scores and estimates unchanged. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 8e78caf8e6..7cdd9af744 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2,6 +2,8 @@ > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** 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) > +> **Eraser fill update (2026-11-11):** filled open paths and compound holes use filled-area cutting (#6582); scores and estimates unchanged. +> > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > > **Flyout update:** 2026-11-06 — resizable icon-strip flyouts and bottom-aligned panel footers (#5713); scores and estimates unchanged. @@ -484,7 +486,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Drawing tools | 7 | 85% | rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, the freehand Tool Options' Keep selected, Alt to the Smooth tool, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding (Curvature point display improved, #1236 in part) | 8–13 | | Selection, transform & align tools | 6 | 85% | Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups, transform nuances (the rotated persistent bounding box is done; no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups, transform nuances (the rotated persistent bounding box is done) | 4–6 | -| Drawing tools | 7 | 86% | rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 | +| Drawing tools | 7 | 86% | Eraser preserves fill when cutting open paths (#6582); rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 86% | Live Paint gap options, Shape Builder gap detection, options (Tool Options dialog, clicking a stroke in merge mode) and Shift-drag marquee | 3–6 | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 96% | freeform gradients in SVG/PDF and mixed spot/process gradients in SVG (exported as stops; PDF export keeps the spot inks in a DeviceN shading, except next to RGB or Lab stops; dithered fills and Perceptual gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve are written as images in process colors), pattern fills in Expand | 2–4; Eyedropper source reads regression-tested (#1251) | | Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (five generated in code including Game Trails are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | @@ -938,6 +940,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur While a spiral is dragged out, Alt adds or removes whole winds of four segments and Ctrl/Cmd changes the decay. The spiral's inner end keeps the distance from the center it had on the first modified drag event, while the outer end follows the pointer. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list Alt-drag to add or subtract winds and Ctrl-drag to change the decay rate; [Draw spirals](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-spirals.html) defines four segments per full wind and Decay as the amount each wind decreases. An 80% spiral has 80% of its outer radius after four segments; newly drawn spirals with the same settings wind more broadly than in earlier VectorCraft builds. Rounding the fitted count to whole winds from the count on the first Alt-only drag event, the held inner radius, the ranges (2…1000 segments, 5…99.99 % decay), Ctrl/Cmd taking precedence when both are held, and the new values staying as Spiral tool options are our own rules. Switching back to Alt uses the current count as its new base while keeping the held inner end. Escape while an arc, spiral or grid is dragged out cancels it and puts back the options its keys, Alt and Ctrl/Cmd changed (slope, open or closed, base axis, segments, decay, dividers and skews), so the next drag and the tool's options start from the values before the canceled drag; a drag that is let go keeps them, and an option set with `tool.setOption` during the drag stays. This is VectorCraft's own rule. - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). + The Eraser cuts filled open contours as areas (#6582), retaining fill outside its sweep; cut filled pieces are closed as for closed input. Open compound members are cut together under their compound fill rule so holes stay empty. Zero-area open lines retain outline splitting, including lines alongside filled contours in one path. `crates/engine/tests/eraser_open_fill.rs` checks original open/closed shapes, retained/erased pixels, self-crossing fill, compound holes, mixed strokes and Undo/Redo; scores and hours are unchanged. A Scissors cut (`path.split`) leaves one of the two new end points selected and the rest of the path unselected, as [Cut paths](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/split-paths.html) and the "Split a path" section of the [CS3 user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) describe: the two end points lie on top of each other, and a Direct Selection drag from them moves the selected one with its handles and no other anchor. A closed path cut once stays one open path. While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. @@ -1971,6 +1974,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | Date | Change | Summary | |---|---|---| +| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; zero-area open lines retain outline splitting (#6582). Scores and estimates unchanged. | | 2026-11-11 | minor | Bundled content: built-in Status Effects graphic style library; style libraries evidence updated; ~40% → ~42%; MCP Symbol libraries list UI Frames and Map Markers; more built-in graphic-style libraries remain. | | 2026-11-11 | minor | Bundled content: built-in Inventory Icons symbol library (Sword, Shield, Potion, Key, Gem); symbol libraries evidence updated; ~38% → ~40%; more built-in symbol libraries remain. | | 2026-11-10 | minor | Type advanced: the Edit Custom Dictionary dialog, #4936; evidence added; the Check Spelling dialog remains; scores and hours unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 11346a20c4..b689ee6a69 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -2,6 +2,8 @@ > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-11 · **Change:** 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) > +> **Eraser fill update (2026-11-11):** filled open paths and compound holes use filled-area cutting (#6582); scores and estimates unchanged. +> > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > > Numeric spinner update (2026-11-10): held mouse arrows repeat past the click timeout; scores and estimates unchanged (#6307). @@ -158,6 +160,7 @@ tools, never checked side by side) isn't captured row by row. | Anchor Point and Curvature tools' own cursors | done | the caret on the anchor it converts; the pen nib with a curve badge | | Free Transform's Cmd/Ctrl side-shear cursor | done | two arrows passing along the side (ShearH, ShearV), instead of the resize arrow across it | | Cursors of their own for Lasso, Magic Wand, the freehand tools, Shaper, Live Paint Bucket, Measure, Print Tiling, the symbolism tools, vertical type, Scissors (over a segment and away), Mesh and Puppet Warp | partial | each tool returns its own cursor and Use Precise Cursors turns them into the crosshair; until they're drawn they borrow the crosshair, the I-beam, the Pen's add cursor or not-allowed | +| Eraser: filled open paths and compound holes | done | Area cutting preserves fill outside the swept region (#6582); zero-area open lines retain outline splitting. Original engine integration regressions cover rendered pixels, geometry, holes and mixed strokes. | | Blob Brush and Eraser: the tip's outline at the pointer | done | before a press and while painting, the outline of the tip (its size, angle and roundness, at the zoom) follows the pointer, black on a white halo, round a small centre dot; `[` / `]` and Tool Options change it at once; precise cursors (Caps Lock) show only the crosshair; it goes when the pointer leaves the canvas, while Cmd/Ctrl lends a selection tool and while Alt lends the Blob Brush the Smooth tool (#4977); `crates/tools/src/draw2/gesture.rs` and its tests While the button is down a round Blob Brush shows the outline of the area it will add, rounded at both ends, not a line as wide as the brush that ends square (#4343). | | Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) | | Each anchor snaps to Smart Guides and construction angles | done | `DrawSnap` | @@ -509,6 +512,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; zero-area open lines retain outline splitting (#6582). Scores and estimates unchanged. | | 2026-11-03 | minor | A double-click on a ruler adds a guide at the pointer (#5239): a vertical one on the top ruler, a horizontal one on the left ruler; scores and estimates unchanged. | | 2026-11-10 | minor | Symbol libraries: Inventory Icons joins Basic Shapes, UI Frames and Map Markers as a fourth built-in library (Sword, Shield, Potion, Key, Gem; no default 9-slice). | | 2026-11-11 | minor | Files that record no units (PDF, EPS or `.ai` without ruler units, raster images, metafiles, Affinity files, importer plug-ins) open and revert in Preferences › Units › General instead of points; native, SVG and DXF files and `.ai`/EPS ruler units are kept (#5820). Scores and estimates unchanged. | From ff9f18e8ef988ef98a3439fde60f822e6682d6c4 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Wed, 11 Nov 2026 07:21:55 -0800 Subject: [PATCH 002/158] M2: preserve Eraser appearance and outline grouping --- crates/engine/src/cmd/draw2/common.rs | 4 +- crates/engine/src/cmd/draw2/cut.rs | 7 +- crates/engine/tests/eraser_open_fill.rs | 90 +++++++++++++++++++++++++ docs/target-app-parity.md | 2 +- 4 files changed, 99 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/draw2/common.rs b/crates/engine/src/cmd/draw2/common.rs index 3b5022ff64..89a0f44007 100644 --- a/crates/engine/src/cmd/draw2/common.rs +++ b/crates/engine/src/cmd/draw2/common.rs @@ -319,9 +319,9 @@ pub(super) fn target_paths(doc: &Document, sel: &Selection, area: Rect) -> Vec bool { - n.appearance.items.iter().any(|item| item.is_fill() && !item.paint().is_none()) + n.appearance.items.iter().any(|item| item.is_fill() && item.visible() && !item.paint().is_none()) } /// [`target_paths`] for tools that cut fills, with geometry and fill rule. Closed compound paths diff --git a/crates/engine/src/cmd/draw2/cut.rs b/crates/engine/src/cmd/draw2/cut.rs index 287b850b71..34a8501a9c 100644 --- a/crates/engine/src/cmd/draw2/cut.rs +++ b/crates/engine/src/cmd/draw2/cut.rs @@ -327,7 +327,12 @@ pub(super) fn erase_region(s: &mut Session, p: &Value) -> Result { if !lines.is_empty() { if let Some(rest) = erase_outline(&lines, short / 2.0, &under) { changed = true; - pieces.extend(rest); + // Partitioning must not turn one compound outline into independently filled objects. + if single { + pieces.extend(rest); + } else if !rest.is_empty() { + pieces.push(PathData::new(rest.into_iter().flat_map(|path| path.subpaths).collect())); + } } else { pieces.push(lines); } diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index 19e73c125f..5d8a2b0895 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -284,3 +284,93 @@ fn eraser_cuts_the_outline_when_even_odd_cancels_an_open_paths_fill() { let length: f64 = paths(&s).iter().map(PathData::length).sum(); assert!((length - 760.0).abs() < 0.1, "both laps lose their crossed stroke portions: {length}"); } + +/// Hidden fills retain open outlines, while a lower visible fill beneath None still paints. +#[test] +fn eraser_hidden_fill_keeps_only_the_explicit_open_outline() { + let render = |s: &Session| { + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) + }; + for lower_fill in [false, true] { + let mut s = session(); + let id = NodeId( + s.execute( + "path.create", + &json!({"anchors": [ + {"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#ff0000"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [id.0], "weight": 2})).unwrap(); + if lower_fill { + // The basic black Fill remains visible underneath this added top Fill set to None. + s.execute("appearance.addFill", &json!({"ids": [id.0]})).unwrap(); + s.execute("appearance.setItem", &json!({"ids": [id.0], "index": 2, "none": true})).unwrap(); + } else { + // Basic appearance order is Fill 0, Stroke 1; hiding Fill 0 leaves only open strokes. + s.execute("appearance.setItem", &json!({"ids": [id.0], "index": 0, "visible": false})).unwrap(); + } + s.execute("select.none", &json!({})).unwrap(); + let before = render(&s); + if lower_fill { + assert!(before.pixel(150, 125)[3] > 240, "the lower black fill remains visible under top None"); + } else { + assert_eq!(before.pixel(150, 125)[3], 0, "hidden fill leaves the interior empty"); + assert_eq!(before.pixel(100, 125)[3], 0, "the open path has no implicit left stroke"); + } + assert!(before.pixel(200, 125)[0] > 200 && before.pixel(200, 125)[1] < 60, "the explicit right stroke is visible"); + + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + let after = render(&s); + if lower_fill { + assert!(after.pixel(150, 125)[3] > 240, "visible lower fill survives above the erased band"); + assert!(after.pixel(150, 175)[3] > 240, "visible lower fill survives below the erased band"); + assert_eq!(after.pixel(150, 150)[3], 0, "the Eraser band is empty"); + } else { + let survivors = paths(&s); + assert!(survivors.iter().all(|path| !path.is_closed()), "unfilled survivors remain open"); + let length: f64 = survivors.iter().map(PathData::length).sum(); + assert!((length - 290.0).abs() < 0.1, "only the crossed explicit right edge loses 10 pt: {length}"); + assert_eq!(after.pixel(150, 125)[3], 0, "hidden fill leaves the interior empty"); + assert_eq!(after.pixel(100, 125)[3], 0, "the missing implicit left stroke remains absent"); + } + } +} + +/// The original compound's cancelled outline stays grouped beside its filled contour. +#[test] +fn eraser_even_odd_cancellation_survives_beside_a_filled_subpath() { + let mut s = session(); + let id = NodeId( + s.execute("path.create", &json!({"d": "M100 100H200V200H100V100H200V200H100V100 M230 100H280V200H230"})).unwrap()["id"].as_u64().unwrap(), + ); + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#ff0000"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [id.0], "weight": 2})).unwrap(); + s.execute("path.setFillRule", &json!({"ids": [id.0], "rule": "evenOdd"})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + assert_eq!(path(&s, id).subpaths.len(), 2, "one node holds both open subpaths"); + assert!(path(&s, id).subpaths.iter().all(|subpath| !subpath.closed)); + let render = |s: &Session| { + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) + }; + let before = render(&s); + assert_eq!(before.pixel(150, 125)[3], 0, "the twice-traced open subpath cancels under Even-Odd"); + assert_eq!(before.pixel(150, 175)[3], 0, "the cancelled lower run is empty before Eraser"); + assert!(before.pixel(250, 125)[3] > 240, "the disjoint open rectangle fills"); + + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [290, 150]], "size": 10})).unwrap(); + let after = render(&s); + assert_eq!(after.pixel(150, 175)[3], 0, "the cancelled interior stays empty below the sweep"); + assert!(after.pixel(250, 125)[3] > 240, "the disjoint filled subpath survives"); + assert_eq!(after.pixel(250, 150)[3], 0, "the swept band through the filled subpath is empty"); + for (x, y) in [(100, 125), (200, 125), (230, 125), (280, 125)] { + let pixel = after.pixel(x, y); + assert!(pixel[0] > 200 && pixel[1] < 60 && pixel[2] < 60 && pixel[3] > 200, "open outline survivor ({x},{y}): {pixel:?}"); + } +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b4d9403719..2e907ea477 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -217,7 +217,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Area | Weight | Done | Main gaps | One agent (h) | Kind | |---|---:|---:|---|---:|---| | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); deletion splits an ordinary contour into selected sibling objects with bounds-fitted gradients kept in place (#3380, deletion only; `crates/engine/tests/it/delete_path_pieces.rs`); open-path anchor Delete keeps gaps; Select › Start Global Edit finds the paths, compound paths and symbol instances of the selected object's shape (Appearance, Size and artboard options) and gives an edit of one to all of them in proportion, as one undo step (#3521), and on a group the groups like it, an edit inside one reaching the same object in the others (#4939), and a Shift-click on a highlighted match leaves it out; the Align panel menu's Align to Glyph Bounds › Point Text and Area Text measure type by its glyphs' ink for Align and Distribute (#4231); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of rotated copies, transform nuances (no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | estimated; Global Edit regression-tested (`crates/engine/src/tests/globaledit.rs`; Quick Action, menu label and Escape in `panels::properties::tests::start_global_edit_quick_action_and_escape`) | -| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged | +| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; Eraser preserves filled open-path area outside its sweep, including compound holes and mixed stroked lines (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient additions are done (dither, perceptual blending, presets); freeform gradients in SVG/PDF, mixed spot/process gradients in SVG, PDF gradients mixing a spot color with RGB or Lab stops, and dithered spot gradient fills and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, which PDF export writes as images in process colors | 4–7 | estimated; Recolor model selection is available through the engine and MCP (#2520), and the dialog's color sliders (HSB, RGB, CMYK, Lab, Tint for a spot color) edit the selected row's new color in its mode, and the Edit tab's Global Adjust sliders (Saturation, Brightness, Temperature, Luminosity, -100% to 100%) change every recolored color at once (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | | Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (five generated libraries including Game Trails, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | From f6c48fd86b0f3da4bcb734748cdeea3b35820932 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Wed, 11 Nov 2026 12:08:18 -0800 Subject: [PATCH 003/158] G11: preserve explicit strokes when erasing ordinary filled open paths --- crates/engine/src/cmd/draw2/cut.rs | 103 ++++++++- crates/engine/tests/eraser_open_fill.rs | 281 +++++++++++++++++++++++- docs/gaps.md | 6 +- docs/roadmap.md | 6 +- docs/target-app-parity.md | 8 +- docs/ui-parity.md | 6 +- 6 files changed, 388 insertions(+), 22 deletions(-) diff --git a/crates/engine/src/cmd/draw2/cut.rs b/crates/engine/src/cmd/draw2/cut.rs index 34a8501a9c..31d4198277 100644 --- a/crates/engine/src/cmd/draw2/cut.rs +++ b/crates/engine/src/cmd/draw2/cut.rs @@ -3,9 +3,10 @@ use super::common::{ samples_param, sibling_with, size_pressure, target_paths, usize_opt, }; use super::{ - Anchor, AnchorKind, Beside, BezPath, BoolOp, Cap, EngineError, FillRule, Join, NodeId, ParamCurve, PathData, Point, Result, Session, SubPath, - Value, bad, eraser_area, eraser_tip, f64_or, fill_contains, id_param, json, number_or, po, + Anchor, AnchorKind, Appearance, Arc, Beside, BezPath, BoolOp, Cap, Document, EngineError, FillRule, Join, Node, NodeId, NodeKind, ParamCurve, + PathData, Point, Result, Session, SubPath, Value, bad, eraser_area, eraser_tip, f64_or, fill_contains, id_param, json, number_or, po, }; +use vectorcraft_doc::AppearanceItem; /// Split a filled path into connected pieces (each outer contour with its holes). pub(in super::super) fn components(pd: &PathData) -> Vec { @@ -304,9 +305,27 @@ pub(super) fn erase_region(s: &mut Session, p: &Value) -> Result { Some(bp) => fill_contains(bp, FillRule::NonZero, q), None => dist_to_polyline(&round, squash * q) <= r, }; - let mut plan: Vec<(NodeId, Vec)> = vec![]; + let mut plan = vec![]; for (id, pd, rule) in fill_targets(&st.doc, &st.selection, poly_bounds(&pts, reach), true)? { let closed = pd.is_closed(); + let node = st.doc.node(id).ok_or(EngineError::NoNode(id))?; + let painted_stroke = node + .appearance + .items + .iter() + .any(|item| matches!(item, AppearanceItem::Stroke(stroke) if stroke.visible && !stroke.paint.is_none() && stroke.width > 0.0)); + if !closed && has_fill(node) && painted_stroke && !needs_legacy_eraser(&st.doc, id) { + let fill_changed = po::area(&po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Intersect), FillRule::NonZero) > 1e-6; + let stroke = erase_outline(&pd, short / 2.0, &under); + if fill_changed || stroke.is_some() { + // Fill closes open contours implicitly; a stroke must keep only the original + // explicit segments. Keep every stroke subpath together so its paint is applied once. + let fill = po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Difference); + let stroke = stroke.map_or(pd, |pieces| PathData::new(pieces.into_iter().flat_map(|piece| piece.subpaths).collect())); + plan.push((id, ErasedPieces::Paint { fill, stroke, rule })); + } + continue; + } let single = pd.subpaths.len() == 1; let filled = !closed && st.doc.node(id).is_some_and(has_fill) && po::area(&pd, rule) > 0.0; // Fill implicitly closes an open contour. Keep zero-area open lines @@ -338,13 +357,72 @@ pub(super) fn erase_region(s: &mut Session, p: &Value) -> Result { } } if changed { - plan.push((id, pieces)); + plan.push((id, ErasedPieces::Geometry(pieces))); } } apply_plan(s, "Eraser", plan) } -fn apply_plan(s: &mut Session, label: &str, plan: Vec<(NodeId, Vec)>) -> Result { +enum ErasedPieces { + Geometry(Vec), + Paint { fill: PathData, stroke: PathData, rule: FillRule }, +} + +/// Splitting paint changes effect seeds, item indices and geometry contexts. Keep targets +/// with visible effects of their own or on an ancestor on the existing route. Clipping-source +/// subtrees also stay there: groups change their mask geometry and do not supply clip paint. +fn needs_legacy_eraser(d: &Document, id: NodeId) -> bool { + let Some(ancestry) = d.ancestry(id) else { return true }; + let mut parent: Option<&Node> = None; + for id in ancestry { + let Some(node) = d.node(id) else { return true }; + if parent.is_some_and(|p| p.clips() && p.children().and_then(|children| children.first()).is_some_and(|first| first.id == id)) { + return true; + } + if node.appearance.effects.iter().any(|effect| effect.visible) + || node.appearance.items.iter().any(|item| item.effects().iter().any(|effect| effect.visible)) + { + return true; + } + parent = Some(node); + } + false +} + +/// Paint fill and explicit stroke geometry in the original stack order, with object-level +/// transparency, effects and metadata on one wrapper rather than on each painted part. +fn separate_eraser_paints(d: &mut Document, id: NodeId, fill: PathData, stroke: PathData, rule: FillRule) -> Result { + let mut root = d.node(id).cloned().ok_or(EngineError::NoNode(id))?; + // Pin before the two geometries get different bounds, so their gradients stay in place. + root.pin_gradients(); + let mut runs: Vec> = vec![]; + for item in &root.appearance.items { + if let Some(run) = runs.last_mut().filter(|run| run.first().is_some_and(|first| first.is_fill() == item.is_fill())) { + run.push(item.clone()); + } else { + runs.push(vec![item.clone()]); + } + } + let mut children = vec![]; + for items in runs { + let is_fill = items.first().is_some_and(AppearanceItem::is_fill); + let path = if is_fill { &fill } else { &stroke }; + if path.is_empty() { + continue; + } + let mut child = Node::path(d.alloc_id(), path.clone(), Appearance { items, ..Default::default() }); + if let NodeKind::Path { rule: child_rule, .. } = &mut child.kind { + *child_rule = if is_fill { FillRule::NonZero } else { rule }; + } + children.push(Arc::new(child)); + } + root.kind = NodeKind::Group { children, clip: false }; + root.appearance.items.clear(); + root.appearance.contents_index = None; + Ok(root) +} + +fn apply_plan(s: &mut Session, label: &str, plan: Vec<(NodeId, ErasedPieces)>) -> Result { if plan.is_empty() { return Ok(json!({ "ids": [] })); } @@ -352,7 +430,18 @@ fn apply_plan(s: &mut Session, label: &str, plan: Vec<(NodeId, Vec)>) let mut all = vec![]; let mut cut = Beside::replacing(d, &plan.iter().map(|(id, _)| *id).collect::>()); for (id, pieces) in plan { - all.extend(replace_with_pieces(d, &mut cut, id, pieces)?); + match pieces { + ErasedPieces::Geometry(pieces) => all.extend(replace_with_pieces(d, &mut cut, id, pieces)?), + ErasedPieces::Paint { fill, stroke, rule } => { + let root = separate_eraser_paints(d, id, fill, stroke, rule)?; + if root.children().is_some_and(Vec::is_empty) { + cut.put(d, id, vec![])?; + } else { + cut.put(d, id, vec![root])?; + all.push(id); + } + } + } } cut.finish(d)?; sel.set(all.iter().copied()); @@ -373,7 +462,7 @@ pub(super) fn erase_segments(s: &mut Session, p: &Value) -> Result { for id in target_paths(&st.doc, &st.selection, poly_bounds(&pts, w)) { let (pd, _) = path_of(&st.doc, id)?; if let Some(pieces) = erase_outline(&pd, w / 2.0, &|q| dist_to_polyline(&pts, q) <= w / 2.0) { - plan.push((id, pieces)); + plan.push((id, ErasedPieces::Geometry(pieces))); } } apply_plan(s, "Path Eraser", plan) diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index 5d8a2b0895..fa7b2d90e5 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -30,6 +30,24 @@ fn paths(s: &Session) -> Vec { paths } +/// Geometric area of paths that own a visible fill, excluding stroke-only children. +/// This does not infer inherited paint from compound paths or containers. +fn own_filled_path_area(s: &Session) -> f64 { + let mut area = 0.0; + s.doc().unwrap().doc.walk(|node| { + if let NodeKind::Path { path, rule, .. } = &node.kind + && node + .appearance + .items + .iter() + .any(|item| matches!(item, vectorcraft_doc::AppearanceItem::Fill(fill) if fill.visible && !fill.paint.is_none())) + { + area += vectorcraft_pathops::area(path, *rule); + } + }); + area +} + /// #6582: an open contour fills its implicitly closed area. Erasing a strip removes only that /// strip, just as for the closed rectangle, rather than changing its fill to diagonal chords. #[test] @@ -141,7 +159,7 @@ fn eraser_keeps_mixed_fill_and_zero_area_strokes_with_one_undo() { assert!(pixel[0] > 200 && pixel[1] < 60 && pixel[2] < 60 && pixel[3] > 200, "retained red stroke at ({x},{y}): {pixel:?}"); } if filled_open { - let area: f64 = remaining.iter().map(|path| vectorcraft_pathops::area(path, FillRule::NonZero)).sum(); + let area = own_filled_path_area(&s); assert!((area - 9000.0).abs() < 1.0, "retained fill area {area}"); for (x, y) in [(110, 125), (190, 125), (110, 175), (190, 175)] { assert!(image.pixel(x, y)[3] > 240, "retained fill pixel ({x},{y})"); @@ -279,10 +297,12 @@ fn eraser_cuts_the_outline_when_even_odd_cancels_an_open_paths_fill() { assert!(original.subpaths.first().unwrap().signed_area().abs() > 10000.0); assert!(vectorcraft_pathops::area(original, FillRule::EvenOdd) < 1e-9, "Even-Odd cancels the two laps"); assert!((original.length() - 800.0).abs() < 1e-9); + assert_eq!(render_erased(&s).pixel(150, 125)[3], 0, "the cancelled interior is transparent before Eraser"); s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); let length: f64 = paths(&s).iter().map(PathData::length).sum(); assert!((length - 760.0).abs() < 0.1, "both laps lose their crossed stroke portions: {length}"); + assert_eq!(render_erased(&s).pixel(150, 125)[3], 0, "Eraser does not paint the cancelled interior outside its sweep"); } /// Hidden fills retain open outlines, while a lower visible fill beneath None still paints. @@ -363,14 +383,271 @@ fn eraser_even_odd_cancellation_survives_beside_a_filled_subpath() { assert_eq!(before.pixel(150, 125)[3], 0, "the twice-traced open subpath cancels under Even-Odd"); assert_eq!(before.pixel(150, 175)[3], 0, "the cancelled lower run is empty before Eraser"); assert!(before.pixel(250, 125)[3] > 240, "the disjoint open rectangle fills"); + assert_eq!(before.pixel(230, 125), [0, 0, 0, 255], "the second contour has fill but no explicit left stroke"); + assert_eq!(before.pixel(229, 125), [0, 0, 0, 0], "there is no stroke outside its implicit closing edge"); s.execute("path.eraseRegion", &json!({"points": [[50, 150], [290, 150]], "size": 10})).unwrap(); let after = render(&s); assert_eq!(after.pixel(150, 175)[3], 0, "the cancelled interior stays empty below the sweep"); assert!(after.pixel(250, 125)[3] > 240, "the disjoint filled subpath survives"); assert_eq!(after.pixel(250, 150)[3], 0, "the swept band through the filled subpath is empty"); - for (x, y) in [(100, 125), (200, 125), (230, 125), (280, 125)] { + for (x, y) in [(230, 125), (229, 125)] { + assert_eq!(after.pixel(x, y), before.pixel(x, y), "the implicit closing edge stays unstroked at ({x},{y})"); + } + for (x, y) in [(100, 125), (200, 125), (280, 125)] { let pixel = after.pixel(x, y); assert!(pixel[0] > 200 && pixel[1] < 60 && pixel[2] < 60 && pixel[3] > 200, "open outline survivor ({x},{y}): {pixel:?}"); } } +#[test] +fn eraser_preserves_the_missing_edge_of_a_filled_open_stroke() { + let mut failures = vec![]; + for (opacity, expected_alpha) in [(100, 255u8), (50, 128u8)] { + for closed in [true, false] { + let (mut s, id) = painted_open_rectangle(closed); + s.execute("transparency.set", &json!({"ids": [id.0], "opacity": opacity})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let mut check = |ok: bool, message: String| { + if !ok { + failures.push(format!("closed={closed} opacity={opacity}: {message}")); + } + }; + let before = render_erased(&s); + for y in [125, 175] { + check(before.pixel(150, y)[3].abs_diff(expected_alpha) <= 1, format!("original fill at y={y}: {:?}", before.pixel(150, y))); + } + let before_left = before.pixel(99, 125); + if closed { + check(before_left[0] > before_left[1] && before_left[3] > 0, format!("closed control's explicit red left edge: {before_left:?}")); + } else { + check(before_left[3] == 0, format!("open source has no implicit left stroke: {before_left:?}")); + } + let before_overlap = before.pixel(199, 125); + check(before_overlap[3].abs_diff(expected_alpha) <= 1, format!("object opacity is applied once before Eraser: {before_overlap:?}")); + check(before_overlap[0] > before_overlap[1] && before_overlap[3] > 0, format!("visible fill and red stroke overlap: {before_overlap:?}")); + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + let after = render_erased(&s); + for y in [125, 175] { + check( + after.pixel(150, y) == before.pixel(150, y), + format!("retained fill at y={y}: before {:?}, after {:?}", before.pixel(150, y), after.pixel(150, y)), + ); + } + check(after.pixel(150, 150)[3] == 0, format!("Eraser band is empty: {:?}", after.pixel(150, 150))); + let after_left = after.pixel(99, 125); + check(after_left == before_left, format!("left-edge stroke: before {before_left:?}, after {after_left:?}")); + let after_overlap = after.pixel(199, 125); + check(after_overlap == before_overlap, format!("unaffected fill/stroke overlap: before {before_overlap:?}, after {after_overlap:?}")); + check(after_overlap[0] > after_overlap[1] && after_overlap[3] > 0, format!("explicit right stroke remains visible: {after_overlap:?}")); + } + } + assert!(failures.is_empty(), "{}", failures.join("\n")); +} + +fn render_erased(s: &Session) -> vectorcraft_render::Rendered { + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) +} + +fn painted_open_rectangle(closed: bool) -> (Session, NodeId) { + let mut s = session(); + let id = NodeId( + s.execute( + "path.create", + &json!({"closed": closed, "anchors": [ + {"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#ff0000"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [id.0], "weight": 2})).unwrap(); + (s, id) +} + +fn assert_eraser_history(s: &mut Session, before: &serde_json::Value, before_selection: &vectorcraft_doc::Selection) { + let after = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let after_selection = s.doc().unwrap().selection.clone(); + let after_pixels = render_erased(s).pixels; + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), *before, "one Undo restores the exact source"); + assert_eq!(s.doc().unwrap().selection, *before_selection); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), after, "one Redo restores the exact erased document"); + assert_eq!(s.doc().unwrap().selection, after_selection); + assert_eq!(render_erased(s).pixels, after_pixels, "Redo restores the rendered appearance"); +} + +#[test] +fn eraser_keeps_object_metadata_and_mask_once_around_separate_fill_and_stroke() { + let (mut s, id) = painted_open_rectangle(false); + let mask = NodeId(s.execute("shape.rectangle", &json!({"x": 80, "y": 80, "width": 140, "height": 140})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"ids": [mask.0], "color": "#ffffff"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [mask.0], "none": true})).unwrap(); + s.execute("transparency.makeOpacityMask", &json!({"ids": [id.0, mask.0]})).unwrap(); + s.execute( + "transparency.set", + &json!({"ids": [id.0], "opacity": 50, "blend": "multiply", "isolate": true, "knockout": "off", "knockoutShape": true}), + ) + .unwrap(); + s.execute("attributes.set", &json!({"ids": [id.0], "note": "Eraser source", "showCenter": true})).unwrap(); + // A stored object axis is independent of this axis-aligned fixture's geometry. + s.edit("Fixture metadata", |doc, _| { + let n = doc.node_mut(id).unwrap(); + n.name = Some("Filled open stroke".into()); + n.bbox_angle = 17.0; + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let original = s.doc().unwrap().doc.node(id).unwrap().clone(); + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let before_selection = s.doc().unwrap().selection.clone(); + let before_history = s.doc().unwrap().history.undo.len(); + let before_image = render_erased(&s); + assert!(before_image.pixel(150, 125)[3].abs_diff(128) <= 1); + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + assert_eq!(s.doc().unwrap().history.undo.len(), before_history + 1); + let root = s.doc().unwrap().doc.node(id).unwrap(); + let NodeKind::Group { children, clip: false } = &root.kind else { panic!("fill and stroke share one ordinary object wrapper") }; + assert_eq!( + (&root.name, root.opacity, root.blend, root.isolate, root.knockout, root.knockout_shape, root.bbox_angle), + (&original.name, original.opacity, original.blend, original.isolate, original.knockout, original.knockout_shape, original.bbox_angle) + ); + assert_eq!(root.extras(), original.extras(), "the mask and Attributes remain on the object"); + assert!(!children.is_empty()); + for child in children { + assert!(child.name.is_none() && child.has_default_transparency(), "paint lanes do not repeat object metadata or transparency"); + assert_eq!(child.bbox_angle, 0.0); + assert_eq!(child.extras(), &vectorcraft_doc::NodeExtras::default()); + } + let after = render_erased(&s); + for (x, y) in [(99, 125), (150, 125), (150, 175), (199, 125)] { + assert_eq!(after.pixel(x, y), before_image.pixel(x, y), "object appearance outside the sweep at ({x},{y})"); + } + assert_eq!(after.pixel(150, 150)[3], 0); + assert_eraser_history(&mut s, &before, &before_selection); +} + +#[test] +fn eraser_keeps_a_painted_clipping_source_on_the_legacy_path_route() { + let mut results = vec![]; + for closed in [true, false] { + let mut s = session(); + let art = NodeId(s.execute("shape.rectangle", &json!({"x": 90, "y": 90, "width": 60, "height": 120})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"ids": [art.0], "color": "#ff0000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [art.0], "none": true})).unwrap(); + let clip = NodeId( + s.execute( + "path.create", + &json!({"closed": closed, "anchors": [ + {"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + let group = NodeId(s.execute("object.clippingMask.make", &json!({"ids": [art.0, clip.0]})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"ids": [clip.0], "color": "#0000ff"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [clip.0], "color": "#00ff00"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [clip.0], "weight": 2})).unwrap(); + s.execute("select.set", &json!({"ids": [clip.0]})).unwrap(); + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let before_selection = s.doc().unwrap().selection.clone(); + let image = render_erased(&s); + assert_eq!(image.pixel(110, 125), [255, 0, 0, 255], "clipped art paints above the clipping fill"); + assert_eq!(image.pixel(180, 125), [0, 0, 255, 255], "clipping fill paints behind the art"); + assert_eq!(image.pixel(199, 125), [0, 255, 0, 255], "clipping stroke paints over the fill"); + assert_eq!(image.pixel(90, 125)[3], 0, "art outside the clip is hidden"); + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + let doc = &s.doc().unwrap().doc; + let NodeKind::Group { children, clip: true } = &doc.node(group).unwrap().kind else { panic!("the clipping group is retained") }; + let source = children.first().unwrap(); + assert_eq!(source.id, clip); + assert!(matches!(source.kind, NodeKind::Path { .. }), "the actual clipping source stays a path"); + let paint = source.clip_paint(); + assert!(paint.fill.is_some() && paint.stroke.is_some(), "the clipping source keeps its fill and stroke paint"); + assert_eq!(render_erased(&s).pixel(150, 150)[3], 0, "the clipping region loses the sweep band"); + // Legacy fill Booleans close both source contours. This deliberately pins that existing + // painted-clip behavior against the unchanged closed-source route, not the ordinary fix. + results.push(render_erased(&s).pixels); + assert_eraser_history(&mut s, &before, &before_selection); + } + assert_eq!(results[0], results[1], "open clipping sources retain the existing closed-fill Boolean behavior"); +} + +#[test] +fn eraser_separates_an_ordinary_open_stroke_inside_a_clipping_group() { + let (mut s, art) = painted_open_rectangle(false); + let clip = NodeId(s.execute("shape.rectangle", &json!({"x": 80, "y": 80, "width": 140, "height": 140})).unwrap()["id"].as_u64().unwrap()); + s.execute("object.clippingMask.make", &json!({"ids": [art.0, clip.0]})).unwrap(); + s.execute("select.set", &json!({"ids": [art.0]})).unwrap(); + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let before_selection = s.doc().unwrap().selection.clone(); + let original_clip = s.doc().unwrap().doc.node(clip).unwrap().clone(); + let before_image = render_erased(&s); + assert_eq!(before_image.pixel(99, 125)[3], 0); + assert_eq!(before_image.pixel(150, 125), [0, 0, 0, 255]); + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + assert_eq!(s.doc().unwrap().doc.node(clip).unwrap(), &original_clip, "the actual clipping source is untouched"); + let after = render_erased(&s); + for (x, y) in [(99, 125), (150, 125), (150, 175), (199, 125)] { + assert_eq!(after.pixel(x, y), before_image.pixel(x, y), "ordinary clipped art retains its appearance at ({x},{y})"); + } + assert_eq!(after.pixel(150, 150)[3], 0); + assert_eraser_history(&mut s, &before, &before_selection); +} + +#[test] +fn eraser_keeps_a_live_outline_strokes_original_appearance_context() { + let mut results = vec![]; + for closed in [true, false] { + let (mut s, id) = painted_open_rectangle(closed); + s.execute("stroke.set", &json!({"ids": [id.0], "weight": 10})).unwrap(); + s.execute("effect.apply", &json!({"ids": [id.0], "effect": "path.outlineStroke", "item": null, "params": {}})).unwrap(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let original = s.doc().unwrap().doc.node(id).unwrap(); + assert_eq!(original.appearance.stroke().unwrap().width, 10.0); + assert!(original.appearance.effects.iter().any(|effect| effect.visible && effect.id == "path.outlineStroke")); + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let before_selection = s.doc().unwrap().selection.clone(); + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + let after = render_erased(&s); + assert!(after.pixels.as_chunks::<4>().0.iter().any(|pixel| pixel[3] > 0), "the live effect still paints"); + results.push(after.pixels); + assert_eraser_history(&mut s, &before, &before_selection); + } + // The legacy fill Booleans produce identical closed survivors and retain the 10 pt context. + assert_eq!(results[0], results[1], "an open source with a live effect retains the closed legacy rendering"); +} + +#[test] +fn eraser_preserves_a_translucent_fill_above_the_stroke() { + use vectorcraft_color::{Color, Paint}; + use vectorcraft_doc::{AppearanceItem, FillLayer}; + let (mut s, id) = painted_open_rectangle(false); + s.edit("Fixture top fill", |doc, _| { + let node = doc.node_mut(id).unwrap(); + assert!(matches!(node.appearance.items.last(), Some(AppearanceItem::Stroke(_)))); + let mut fill = FillLayer::new(Paint::solid(Color::WHITE)); + fill.opacity = 0.5; + node.appearance.items.push(AppearanceItem::Fill(fill)); + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let before = render_erased(&s); + let near = |actual: [u8; 4], expected: [u8; 4]| actual.iter().zip(expected).all(|(a, e)| a.abs_diff(e) <= 1); + assert!(near(before.pixel(199, 125), [255, 128, 128, 255]), "half-opacity white covers red: {:?}", before.pixel(199, 125)); + assert!(near(before.pixel(150, 125), [128, 128, 128, 255]), "half-opacity white covers black: {:?}", before.pixel(150, 125)); + assert_eq!(before.pixel(99, 125), [0, 0, 0, 0]); + s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); + let after = render_erased(&s); + for (x, y) in [(199, 125), (150, 125), (99, 125)] { + assert_eq!(after.pixel(x, y), before.pixel(x, y), "paint order and item opacity survive at ({x},{y})"); + } + assert_eq!(after.pixel(150, 150)[3], 0, "the swept band is empty"); +} diff --git a/docs/gaps.md b/docs/gaps.md index 4c9e18659b..71df386984 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -4,7 +4,7 @@ ## Feature submission evidence -> **Eraser fill update (2026-11-11):** filled open paths and compound holes use filled-area cutting (#6582); stroke-closure follow-up remains open; scores and estimates unchanged. +> **Eraser fill update (2026-11-11):** ordinary filled open paths retain fill and explicit strokes outside the sweep (#6582); clipping sources and live effects retain legacy behavior; scores and estimates unchanged. **Feature evidence last updated:** 2026-11-03. @@ -307,7 +307,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G11 Correctness bugs in core tools -- **Improved (#6582):** the Eraser subtracts its swept area from filled open contours, preserving fill outside the stroke. Open compound members keep their holes under either fill rule; zero-area open lines keep outline splitting. Original engine integration regressions check rendered pixels, retained geometry, mixed paths and history. Review follow-up: filled open paths with a visible stroke can gain a stroke on their implicit closing edge; separate fill/stroke geometry and clipping-source handling remain unresolved. A single twice-traced contour with canceled Even-Odd fill can also reveal fill after outline splitting. Scores and estimates unchanged. +- **Improved (#6582):** the Eraser subtracts its swept area from filled open contours, preserving fill outside the stroke. Open compound members keep their holes under either fill rule; zero-area open lines keep outline splitting. Ordinary filled open paths with visible strokes keep separate fill and explicit-stroke geometry in their original paint order, preserving missing closing edges, Even-Odd cancellation and object opacity. Thirteen engine integration regressions check rendered pixels, geometry, paint order, masks, mixed paths and history. Clipping-source subtrees and paths with visible appearance effects on themselves or an ancestor retain the existing route; its stroke-closure and canceled-fill limitations remain open pending the scope decision. Scores and estimates unchanged. - **Export-only improvement (#6309):** PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. Broader G11 scope, scores and estimates unchanged. @@ -861,7 +861,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | 2026-11-11 | minor | G5: built-in Energy Beams brush library (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail); Missing trimmed; estimate 5–15 → 4–14 h; MCP Brush libraries list Energy Beams. | | 2026-11-11 | minor | G5: built-in Skill Icons symbol library (Attack, Defend, Heal, Buff, Ult); Missing trimmed; estimate 6–16 → 5–15 h; MCP Symbol libraries list Skill Icons. | | 2026-11-10 | minor | G6: MCP catalogue (#6460): headless lists `UI_COMMANDS` (`ui: true`), eight prompts, effect vs command ids, 33 tools, commands/reference; estimate unchanged. | -| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; zero-area open lines retain outline splitting (#6582). Scores and estimates unchanged. | +| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; ordinary fills and explicit strokes keep separate geometry; clipping sources and live effects retain legacy behavior (#6582). Scores and estimates unchanged. | | 2026-11-11 | minor | G5: built-in Status Effects graphic style library (Poison Tint, Freeze Edge, Burn Aura, Stun Pulse, Stealth Fade, Shield Buff); Missing trimmed; estimate 7–17 → 6–16 h; MCP docs list UI Frames and Map Markers under Symbol libraries. | | 2026-11-11 | minor | G5: built-in Inventory Icons symbol library (Sword, Shield, Potion, Key, Gem; no default 9-slice); Missing trimmed; estimate 8–18 → 7–17 h. | | 2026-11-10 | minor | G4 type: Edit › Edit Custom Dictionary… adds, deletes and changes the custom dictionary's words, #4936; the Check Spelling dialog remains; scores and estimates unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index 42952e165c..d22b08caff 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -4,7 +4,7 @@ > > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > -> **Eraser fill update (2026-11-11):** filled open paths and compound holes use filled-area cutting (#6582); stroke-closure follow-up remains open; scores and estimates unchanged. +> **Eraser fill update (2026-11-11):** ordinary filled open paths retain fill and explicit strokes outside the sweep (#6582); clipping sources and live effects retain legacy behavior; scores and estimates unchanged. > > **Flyout update:** 2026-11-06 — resizable icon-strip flyouts and bottom-aligned panel footers (#5713); scores and estimates unchanged. > @@ -55,7 +55,7 @@ M7 type: Touch Type moves a right-to-left character along its line and up from i | 2026-11-08 | minor | Character Styles panel: a double-click on a user style's row opens its Character Style Options (`ui.charStyleOptions`); the dialog keeps a fixed width and scrolls its sections in a shorter window, so OK and Cancel stay on screen. Tests `panels::text_styles::tests::double_clicking_a_character_style_row_opens_its_options` and `dialogs::char_style_options::tests::the_sections_scroll_in_a_window_shorter_than_the_general_list`. Scores and estimates unchanged. | | 2026-11-08 | minor | #3380, deletion only: preserve gradient placement and exact surviving geometry; consume owned subpaths with a shared original-node snapshot; consolidate status/evidence and document command/helper contracts. Compound behavior and the existing M2 status entry are retained. Endpoint highlighting remains open; scores and estimates unchanged. | | 2026-11-10 | minor | M13 / G6: MCP catalogue (#6460): headless lists UI commands, eight prompts, 33 tools, effect vs command ids; scores and estimates unchanged. | -| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; zero-area open lines retain outline splitting (#6582). Scores and estimates unchanged. | +| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; ordinary fills and explicit strokes keep separate geometry; clipping sources and live effects retain legacy behavior (#6582). Scores and estimates unchanged. | | 2026-11-07 | minor | #3380 (deletion only): independent surviving path objects; transformed appearance, stacking, selection, cubic handles and Undo/Redo covered by `delete_path_pieces`; compound semantics retained. Endpoint highlighting remains open; scores and estimates unchanged. | | 2026-11-02 | minor | Selection QoL: saved marquee modes, screen drag direction with a 3 px dead zone, and translated mode/E feedback (#5313); VectorCraft addition, scores and estimates unchanged. | | 2026-11-07 | minor | Indian-language hyphenation (#4947): eleven MIT-licensed pattern sets, with grapheme and shaping-cluster protection in both composers and existing paragraph limits. Assamese and Sanskrit are selectable; Sanskrit automatic patterns remain pending an allowlisted source. Scores and estimates unchanged. | @@ -144,7 +144,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l |---|---|---|---| | M0 | Skeleton + vertical slice | ✅ done | — | | M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | -| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside its sweep on open paths and keeps compound holes (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | +| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside its sweep on open paths and keeps compound holes and ordinary explicit strokes; clipping-source/live-effect follow-up remains open (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | | M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel, Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls | 4–8 | | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 6bdc27d935..189da23121 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -4,7 +4,7 @@ > > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > -> **Eraser fill update (2026-11-11):** filled open paths and compound holes use filled-area cutting (#6582); stroke-closure follow-up remains open; scores and estimates unchanged. +> **Eraser fill update (2026-11-11):** ordinary filled open paths retain fill and explicit strokes outside the sweep (#6582); clipping sources and live effects retain legacy behavior; scores and estimates unchanged. > > **Flyout update:** 2026-11-06 — resizable icon-strip flyouts and bottom-aligned panel footers (#5713); scores and estimates unchanged. @@ -217,7 +217,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Area | Weight | Done | Main gaps | One agent (h) | Kind | |---|---:|---:|---|---:|---| | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); deletion splits an ordinary contour into selected sibling objects with bounds-fitted gradients kept in place (#3380, deletion only; `crates/engine/tests/it/delete_path_pieces.rs`); open-path anchor Delete keeps gaps; Select › Start Global Edit finds the paths, compound paths and symbol instances of the selected object's shape (Appearance, Size and artboard options) and gives an edit of one to all of them in proportion, as one undo step (#3521), and on a group the groups like it, an edit inside one reaching the same object in the others (#4939), and a Shift-click on a highlighted match leaves it out; the Align panel menu's Align to Glyph Bounds › Point Text and Area Text measure type by its glyphs' ink for Align and Distribute (#4231); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of rotated copies, transform nuances (no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | estimated; Global Edit regression-tested (`crates/engine/src/tests/globaledit.rs`; Quick Action, menu label and Escape in `panels::properties::tests::start_global_edit_quick_action_and_escape`) | -| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; Eraser preserves filled open-path area outside its sweep, including compound holes and mixed stroked lines (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | +| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; Eraser preserves ordinary filled open-path area and explicit strokes outside its sweep, including compound holes and mixed stroked lines; clipping-source/live-effect correction remains open (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient additions are done (dither, perceptual blending, presets); freeform gradients in SVG/PDF, mixed spot/process gradients in SVG, PDF gradients mixing a spot color with RGB or Lab stops, and dithered spot gradient fills and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, which PDF export writes as images in process colors | 4–7 | estimated; Recolor model selection is available through the engine and MCP (#2520), and the dialog's color sliders (HSB, RGB, CMYK, Lab, Tint for a spot color) edit the selected row's new color in its mode, and the Edit tab's Global Adjust sliders (Saturation, Brightness, Temperature, Luminosity, -100% to 100%) change every recolored color at once (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | | Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (six generated libraries including Game Trails and Energy Beams, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | @@ -945,7 +945,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur While a spiral is dragged out, Alt adds or removes whole winds of four segments and Ctrl/Cmd changes the decay. The spiral's inner end keeps the distance from the center it had on the first modified drag event, while the outer end follows the pointer. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list Alt-drag to add or subtract winds and Ctrl-drag to change the decay rate; [Draw spirals](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-spirals.html) defines four segments per full wind and Decay as the amount each wind decreases. An 80% spiral has 80% of its outer radius after four segments; newly drawn spirals with the same settings wind more broadly than in earlier VectorCraft builds. Rounding the fitted count to whole winds from the count on the first Alt-only drag event, the held inner radius, the ranges (2…1000 segments, 5…99.99 % decay), Ctrl/Cmd taking precedence when both are held, and the new values staying as Spiral tool options are our own rules. Switching back to Alt uses the current count as its new base while keeping the held inner end. Escape while an arc, spiral or grid is dragged out cancels it and puts back the options its keys, Alt and Ctrl/Cmd changed (slope, open or closed, base axis, segments, decay, dividers and skews), so the next drag and the tool's options start from the values before the canceled drag; a drag that is let go keeps them, and an option set with `tool.setOption` during the drag stays. This is VectorCraft's own rule. - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). - The Eraser cuts filled open contours as areas (#6582), retaining fill outside its sweep; cut filled pieces are closed as for closed input. Open compound members are cut together under their compound fill rule so holes stay empty. Zero-area open lines retain outline splitting, including lines alongside filled contours in one path. `crates/engine/tests/eraser_open_fill.rs` checks original open/closed shapes, retained/erased pixels, self-crossing fill, compound holes, mixed strokes and Undo/Redo. A confirmed review regression remains: closing filled open pieces can add a stroke on the original implicit closing edge; the stroke/clipping follow-up and single-contour canceled-fill limitation remain open. Scores and hours are unchanged. + The Eraser cuts filled open contours as areas (#6582), retaining fill outside its sweep. Open compound members are cut together under their compound fill rule so holes stay empty. Ordinary filled open paths keep closed fill geometry separate from their original explicit stroke segments, with the original paint order and object transparency on one wrapper. Canceled Even-Odd fill stays empty; zero-area open lines retain outline splitting. Thirteen tests in `crates/engine/tests/eraser_open_fill.rs` check open/closed shapes, retained/erased pixels, self-crossing fill, compound holes, missing stroke edges, object/item opacity, masks, mixed strokes and Undo/Redo. Painted clipping-source subtrees and paths with visible self/ancestor appearance effects deliberately retain the legacy route; that route can still add closing-edge strokes or reveal canceled fill. Their broader correction remains an open scope decision. Scores and hours are unchanged. A Scissors cut (`path.split`) leaves one of the two new end points selected and the rest of the path unselected, as [Cut paths](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/split-paths.html) and the "Split a path" section of the [CS3 user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) describe: the two end points lie on top of each other, and a Direct Selection drag from them moves the selected one with its handles and no other anchor. A closed path cut once stays one open path. While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. @@ -1982,7 +1982,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | 2026-11-11 | minor | Bundled content: built-in Energy Beams brush library (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail); brush libraries evidence updated; ~44% → ~46%; more built-in brush libraries remain. | | 2026-11-11 | minor | Bundled content: built-in Skill Icons symbol library (Attack, Defend, Heal, Buff, Ult); symbol libraries evidence updated; ~42% → ~44%; more built-in symbol libraries remain. | | 2026-11-10 | minor | Automation: MCP tool count 33; headless `command_list` lists `UI_COMMANDS` (`ui: true`); eight prompts; effect-id vs command-id clarified (#6460); scores and hours unchanged. | -| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; zero-area open lines retain outline splitting (#6582). Scores and estimates unchanged. | +| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; ordinary fills and explicit strokes keep separate geometry; clipping sources and live effects retain legacy behavior (#6582). Scores and estimates unchanged. | | 2026-11-11 | minor | Bundled content: built-in Status Effects graphic style library; style libraries evidence updated; ~40% → ~42%; MCP Symbol libraries list UI Frames and Map Markers; more built-in graphic-style libraries remain. | | 2026-11-11 | minor | Bundled content: built-in Inventory Icons symbol library (Sword, Shield, Potion, Key, Gem); symbol libraries evidence updated; ~38% → ~40%; more built-in symbol libraries remain. | | 2026-11-10 | minor | Type advanced: the Edit Custom Dictionary dialog, #4936; evidence added; the Check Spelling dialog remains; scores and hours unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index f323cdcd41..5443d19623 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -4,7 +4,7 @@ > > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > -> **Eraser fill update (2026-11-11):** filled open paths and compound holes use filled-area cutting (#6582); stroke-closure follow-up remains open; scores and estimates unchanged. +> **Eraser fill update (2026-11-11):** ordinary filled open paths retain fill and explicit strokes outside the sweep (#6582); clipping sources and live effects retain legacy behavior; scores and estimates unchanged. > > Numeric spinner update (2026-11-10): held mouse arrows repeat past the click timeout; scores and estimates unchanged (#6307). @@ -160,7 +160,7 @@ tools, never checked side by side) isn't captured row by row. | Anchor Point and Curvature tools' own cursors | done | the caret on the anchor it converts; the pen nib with a curve badge | | Free Transform's Cmd/Ctrl side-shear cursor | done | two arrows passing along the side (ShearH, ShearV), instead of the resize arrow across it | | Cursors of their own for Lasso, Magic Wand, the freehand tools, Shaper, Live Paint Bucket, Measure, Print Tiling, the symbolism tools, vertical type, Scissors (over a segment and away), Mesh and Puppet Warp | partial | each tool returns its own cursor and Use Precise Cursors turns them into the crosshair; until they're drawn they borrow the crosshair, the I-beam, the Pen's add cursor or not-allowed | -| Eraser: filled open paths and compound holes | partial | Area cutting preserves fill outside the swept region (#6582); zero-area open lines retain outline splitting. Original engine integration regressions cover rendered pixels, geometry, holes and mixed strokes. Stroke closure and canceled-fill follow-ups remain open; see G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | +| Eraser: filled open paths and compound holes | partial | Area cutting preserves fill outside the swept region (#6582). Ordinary filled open paths preserve explicit strokes, paint order, opacity and canceled fill with separate fill/stroke geometry; zero-area open lines retain outline splitting. Thirteen engine integration tests cover rendered pixels, geometry, holes, masks, mixed strokes and history. Clipping-source/live-effect correction remains open; see G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | | Blob Brush and Eraser: the tip's outline at the pointer | done | before a press and while painting, the outline of the tip (its size, angle and roundness, at the zoom) follows the pointer, black on a white halo, round a small centre dot; `[` / `]` and Tool Options change it at once; precise cursors (Caps Lock) show only the crosshair; it goes when the pointer leaves the canvas, while Cmd/Ctrl lends a selection tool and while Alt lends the Blob Brush the Smooth tool (#4977); `crates/tools/src/draw2/gesture.rs` and its tests While the button is down a round Blob Brush shows the outline of the area it will add, rounded at both ends, not a line as wide as the brush that ends square (#4343). | | Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) | | Each anchor snaps to Smart Guides and construction angles | done | `DrawSnap` | @@ -514,7 +514,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| -| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; zero-area open lines retain outline splitting (#6582). Scores and estimates unchanged. | +| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; ordinary fills and explicit strokes keep separate geometry; clipping sources and live effects retain legacy behavior (#6582). Scores and estimates unchanged. | | 2026-11-11 | minor | Outline view: a click on a path's outline selects it through an image or a gradient mesh in front, which Outline draws as a frame or mesh lines (#6437). | | 2026-11-11 | minor | A middle-click on a document tab (or its ×) closes it as the × does; closing a document's last view with unsaved changes asks to save first (#6506). VectorCraft addition; scores and estimates unchanged. | | 2026-11-03 | minor | A double-click on a ruler adds a guide at the pointer (#5239): a vertical one on the top ruler, a horizontal one on the left ruler; scores and estimates unchanged. | From 1869fc4ae875e1f9767416e35955847017d03274 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Wed, 11 Nov 2026 12:40:24 -0800 Subject: [PATCH 004/158] M2: scope open-path erasing to fill-only artwork --- crates/engine/src/cmd/draw2/common.rs | 18 +- crates/engine/src/cmd/draw2/cut.rs | 148 +------- crates/engine/tests/eraser_open_fill.rs | 479 +----------------------- docs/gaps.md | 6 +- docs/roadmap.md | 6 +- docs/target-app-parity.md | 8 +- docs/ui-parity.md | 6 +- 7 files changed, 46 insertions(+), 625 deletions(-) diff --git a/crates/engine/src/cmd/draw2/common.rs b/crates/engine/src/cmd/draw2/common.rs index 89a0f44007..8ded54e072 100644 --- a/crates/engine/src/cmd/draw2/common.rs +++ b/crates/engine/src/cmd/draw2/common.rs @@ -319,17 +319,25 @@ pub(super) fn target_paths(doc: &Document, sel: &Selection, area: Rect) -> Vec bool { n.appearance.items.iter().any(|item| item.is_fill() && item.visible() && !item.paint().is_none()) } -/// [`target_paths`] for tools that cut fills, with geometry and fill rule. Closed compound paths -/// act as one shape so their holes stay holes. With `open_fills`, filled compounds with open -/// members do too; callers that only cut closed paths leave that off. +/// A visible painted stroke keeps open paths on the existing outline-erasure route. +pub(super) fn has_painted_stroke(n: &Node) -> bool { + n.appearance.items.iter().any( + |item| matches!(item, vectorcraft_doc::AppearanceItem::Stroke(stroke) if stroke.visible && !stroke.paint.is_none() && stroke.width > 0.0), + ) +} + +/// [`target_paths`] for the tools that cut fills, with each target's geometry and fill rule: the +/// members of a compound path whose members are all closed paths give the compound path itself, +/// once, so its fill (holes included) is cut as one shape under its own fill rule. +/// With `open_fills`, an open compound with a visible fill and no painted visible stroke does too. pub(super) fn fill_targets(doc: &Document, sel: &Selection, area: Rect, open_fills: bool) -> Result> { let area_compound = |n: &Node| { - let filled = open_fills && has_fill(n); + let filled = open_fills && has_fill(n) && !has_painted_stroke(n); matches!(&n.kind, NodeKind::Compound { children, .. } if children.iter().all(|c| matches!(&c.kind, NodeKind::Path { path, .. } if path.is_closed() || filled))) }; diff --git a/crates/engine/src/cmd/draw2/cut.rs b/crates/engine/src/cmd/draw2/cut.rs index 31d4198277..284b233b84 100644 --- a/crates/engine/src/cmd/draw2/cut.rs +++ b/crates/engine/src/cmd/draw2/cut.rs @@ -1,12 +1,11 @@ use super::common::{ - dist_to_polyline, fill_targets, has_fill, ids_json, path_mut, path_of, points_param, poly_bounds, pressure_region, replace_with_pieces, - samples_param, sibling_with, size_pressure, target_paths, usize_opt, + dist_to_polyline, fill_targets, has_fill, has_painted_stroke, ids_json, path_mut, path_of, points_param, poly_bounds, pressure_region, + replace_with_pieces, samples_param, sibling_with, size_pressure, target_paths, usize_opt, }; use super::{ - Anchor, AnchorKind, Appearance, Arc, Beside, BezPath, BoolOp, Cap, Document, EngineError, FillRule, Join, Node, NodeId, NodeKind, ParamCurve, - PathData, Point, Result, Session, SubPath, Value, bad, eraser_area, eraser_tip, f64_or, fill_contains, id_param, json, number_or, po, + Anchor, AnchorKind, Beside, BezPath, BoolOp, Cap, EngineError, FillRule, Join, NodeId, NodeKind, ParamCurve, PathData, Point, Result, Session, + SubPath, Value, bad, eraser_area, eraser_tip, f64_or, fill_contains, id_param, json, number_or, po, }; -use vectorcraft_doc::AppearanceItem; /// Split a filled path into connected pieces (each outer contour with its holes). pub(in super::super) fn components(pd: &PathData) -> Vec { @@ -305,124 +304,26 @@ pub(super) fn erase_region(s: &mut Session, p: &Value) -> Result { Some(bp) => fill_contains(bp, FillRule::NonZero, q), None => dist_to_polyline(&round, squash * q) <= r, }; - let mut plan = vec![]; + let mut plan: Vec<(NodeId, Vec)> = vec![]; for (id, pd, rule) in fill_targets(&st.doc, &st.selection, poly_bounds(&pts, reach), true)? { - let closed = pd.is_closed(); - let node = st.doc.node(id).ok_or(EngineError::NoNode(id))?; - let painted_stroke = node - .appearance - .items - .iter() - .any(|item| matches!(item, AppearanceItem::Stroke(stroke) if stroke.visible && !stroke.paint.is_none() && stroke.width > 0.0)); - if !closed && has_fill(node) && painted_stroke && !needs_legacy_eraser(&st.doc, id) { - let fill_changed = po::area(&po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Intersect), FillRule::NonZero) > 1e-6; - let stroke = erase_outline(&pd, short / 2.0, &under); - if fill_changed || stroke.is_some() { - // Fill closes open contours implicitly; a stroke must keep only the original - // explicit segments. Keep every stroke subpath together so its paint is applied once. - let fill = po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Difference); - let stroke = stroke.map_or(pd, |pieces| PathData::new(pieces.into_iter().flat_map(|piece| piece.subpaths).collect())); - plan.push((id, ErasedPieces::Paint { fill, stroke, rule })); + // An unaggregated compound member keeps the outline route: its own appearance does not + // paint it. Eligible fill-only compounds were collected as one parent target above. + let compound_member = + st.doc.parent_of(id).and_then(|parent| st.doc.node(parent)).is_some_and(|parent| matches!(parent.kind, NodeKind::Compound { .. })); + let filled_open = !compound_member && st.doc.node(id).is_some_and(|node| has_fill(node) && !has_painted_stroke(node)); + if pd.is_closed() || filled_open { + if po::area(&po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Intersect), FillRule::NonZero) <= 1e-6 { + continue; } - continue; - } - let single = pd.subpaths.len() == 1; - let filled = !closed && st.doc.node(id).is_some_and(has_fill) && po::area(&pd, rule) > 0.0; - // Fill implicitly closes an open contour. Keep zero-area open lines - // separate: the fill Boolean would otherwise discard their stroke geometry. - let (areas, lines): (Vec<_>, Vec<_>) = - pd.subpaths.into_iter().partition(|sp| closed || (filled && (single || po::area(&PathData::single(sp.clone()), rule) > 0.0))); - let (areas, lines) = (PathData::new(areas), PathData::new(lines)); - let mut changed = false; - let mut pieces = vec![]; - if !areas.is_empty() { - if po::area(&po::boolean(&areas, rule, ®ion, FillRule::NonZero, BoolOp::Intersect), FillRule::NonZero) > 1e-6 { - changed = true; - pieces.extend(components(&po::boolean(&areas, rule, ®ion, FillRule::NonZero, BoolOp::Difference))); - } else { - pieces.push(areas); - } - } - if !lines.is_empty() { - if let Some(rest) = erase_outline(&lines, short / 2.0, &under) { - changed = true; - // Partitioning must not turn one compound outline into independently filled objects. - if single { - pieces.extend(rest); - } else if !rest.is_empty() { - pieces.push(PathData::new(rest.into_iter().flat_map(|path| path.subpaths).collect())); - } - } else { - pieces.push(lines); - } - } - if changed { - plan.push((id, ErasedPieces::Geometry(pieces))); + plan.push((id, components(&po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Difference)))); + } else if let Some(pieces) = erase_outline(&pd, short / 2.0, &under) { + plan.push((id, pieces)); } } apply_plan(s, "Eraser", plan) } -enum ErasedPieces { - Geometry(Vec), - Paint { fill: PathData, stroke: PathData, rule: FillRule }, -} - -/// Splitting paint changes effect seeds, item indices and geometry contexts. Keep targets -/// with visible effects of their own or on an ancestor on the existing route. Clipping-source -/// subtrees also stay there: groups change their mask geometry and do not supply clip paint. -fn needs_legacy_eraser(d: &Document, id: NodeId) -> bool { - let Some(ancestry) = d.ancestry(id) else { return true }; - let mut parent: Option<&Node> = None; - for id in ancestry { - let Some(node) = d.node(id) else { return true }; - if parent.is_some_and(|p| p.clips() && p.children().and_then(|children| children.first()).is_some_and(|first| first.id == id)) { - return true; - } - if node.appearance.effects.iter().any(|effect| effect.visible) - || node.appearance.items.iter().any(|item| item.effects().iter().any(|effect| effect.visible)) - { - return true; - } - parent = Some(node); - } - false -} - -/// Paint fill and explicit stroke geometry in the original stack order, with object-level -/// transparency, effects and metadata on one wrapper rather than on each painted part. -fn separate_eraser_paints(d: &mut Document, id: NodeId, fill: PathData, stroke: PathData, rule: FillRule) -> Result { - let mut root = d.node(id).cloned().ok_or(EngineError::NoNode(id))?; - // Pin before the two geometries get different bounds, so their gradients stay in place. - root.pin_gradients(); - let mut runs: Vec> = vec![]; - for item in &root.appearance.items { - if let Some(run) = runs.last_mut().filter(|run| run.first().is_some_and(|first| first.is_fill() == item.is_fill())) { - run.push(item.clone()); - } else { - runs.push(vec![item.clone()]); - } - } - let mut children = vec![]; - for items in runs { - let is_fill = items.first().is_some_and(AppearanceItem::is_fill); - let path = if is_fill { &fill } else { &stroke }; - if path.is_empty() { - continue; - } - let mut child = Node::path(d.alloc_id(), path.clone(), Appearance { items, ..Default::default() }); - if let NodeKind::Path { rule: child_rule, .. } = &mut child.kind { - *child_rule = if is_fill { FillRule::NonZero } else { rule }; - } - children.push(Arc::new(child)); - } - root.kind = NodeKind::Group { children, clip: false }; - root.appearance.items.clear(); - root.appearance.contents_index = None; - Ok(root) -} - -fn apply_plan(s: &mut Session, label: &str, plan: Vec<(NodeId, ErasedPieces)>) -> Result { +fn apply_plan(s: &mut Session, label: &str, plan: Vec<(NodeId, Vec)>) -> Result { if plan.is_empty() { return Ok(json!({ "ids": [] })); } @@ -430,18 +331,7 @@ fn apply_plan(s: &mut Session, label: &str, plan: Vec<(NodeId, ErasedPieces)>) - let mut all = vec![]; let mut cut = Beside::replacing(d, &plan.iter().map(|(id, _)| *id).collect::>()); for (id, pieces) in plan { - match pieces { - ErasedPieces::Geometry(pieces) => all.extend(replace_with_pieces(d, &mut cut, id, pieces)?), - ErasedPieces::Paint { fill, stroke, rule } => { - let root = separate_eraser_paints(d, id, fill, stroke, rule)?; - if root.children().is_some_and(Vec::is_empty) { - cut.put(d, id, vec![])?; - } else { - cut.put(d, id, vec![root])?; - all.push(id); - } - } - } + all.extend(replace_with_pieces(d, &mut cut, id, pieces)?); } cut.finish(d)?; sel.set(all.iter().copied()); @@ -462,7 +352,7 @@ pub(super) fn erase_segments(s: &mut Session, p: &Value) -> Result { for id in target_paths(&st.doc, &st.selection, poly_bounds(&pts, w)) { let (pd, _) = path_of(&st.doc, id)?; if let Some(pieces) = erase_outline(&pd, w / 2.0, &|q| dist_to_polyline(&pts, q) <= w / 2.0) { - plan.push((id, ErasedPieces::Geometry(pieces))); + plan.push((id, pieces)); } } apply_plan(s, "Path Eraser", plan) diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index fa7b2d90e5..d7e88e9a23 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -1,4 +1,4 @@ -//! Filled open-path Eraser regressions through the public engine and CPU renderer. +//! Fill-only open-path Eraser regressions through the public engine and CPU renderer. // Integration tests may unwrap and panic on failure (AGENTS.md). #![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] @@ -30,26 +30,6 @@ fn paths(s: &Session) -> Vec { paths } -/// Geometric area of paths that own a visible fill, excluding stroke-only children. -/// This does not infer inherited paint from compound paths or containers. -fn own_filled_path_area(s: &Session) -> f64 { - let mut area = 0.0; - s.doc().unwrap().doc.walk(|node| { - if let NodeKind::Path { path, rule, .. } = &node.kind - && node - .appearance - .items - .iter() - .any(|item| matches!(item, vectorcraft_doc::AppearanceItem::Fill(fill) if fill.visible && !fill.paint.is_none())) - { - area += vectorcraft_pathops::area(path, *rule); - } - }); - area -} - -/// #6582: an open contour fills its implicitly closed area. Erasing a strip removes only that -/// strip, just as for the closed rectangle, rather than changing its fill to diagonal chords. #[test] fn eraser_preserves_the_fill_of_an_open_rectangle() { let samples = [(110.0, 125.0), (190.0, 125.0), (110.0, 175.0), (190.0, 175.0)]; @@ -95,92 +75,6 @@ fn eraser_preserves_the_fill_of_an_open_rectangle() { } } -fn total_line_length(paths: &[PathData], x: f64) -> f64 { - paths - .iter() - .flat_map(|path| &path.subpaths) - .filter(|subpath| !subpath.closed && subpath.anchors.len() >= 2 && subpath.anchors.iter().all(|anchor| (anchor.p.x - x).abs() < 0.01)) - .map(|subpath| subpath.anchors.windows(2).map(|pair| pair[0].p.distance(pair[1].p)).sum::()) - .sum() -} - -#[test] -fn eraser_keeps_mixed_fill_and_zero_area_strokes_with_one_undo() { - for filled_open in [true, false] { - let mut s = session(); - let id = NodeId(s.execute("path.create", &json!({"anchors": [{"x": 100, "y": 100}]})).unwrap()["id"].as_u64().unwrap()); - s.execute( - "path.setAnchors", - &json!({"id": id.0, "subpaths": [ - {"closed": !filled_open, "anchors": [{"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200}]}, - {"closed": false, "anchors": [{"x": 250, "y": 100}, {"x": 250, "y": 200}]}, - {"closed": false, "anchors": [{"x": 250, "y": 220}, {"x": 250, "y": 270}]} - ]}), - ) - .unwrap(); - if filled_open { - s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); - } else { - s.execute("paint.setFill", &json!({"ids": [id.0], "none": true})).unwrap(); - } - s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#ff0000"})).unwrap(); - s.execute("stroke.set", &json!({"ids": [id.0], "weight": 2})).unwrap(); - s.execute("select.none", &json!({})).unwrap(); - - let before_miss = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); - let miss_history = s.doc().unwrap().history.undo.len(); - let miss = s.execute("path.eraseRegion", &json!({"points": [[50, 20], [250, 20]], "size": 10})).unwrap(); - assert_eq!(miss["ids"], json!([])); - assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before_miss, "a non-intersecting Eraser leaves the document unchanged"); - assert_eq!(s.doc().unwrap().history.undo.len(), miss_history, "a miss adds no history entry"); - - let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); - let before_selection = s.doc().unwrap().selection.clone(); - let before_history = s.doc().unwrap().history.undo.len(); - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); - let after = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); - let after_selection = s.doc().unwrap().selection.clone(); - assert_eq!(s.doc().unwrap().history.undo.len(), before_history + 1); - - let remaining = paths(&s); - let line_length = total_line_length(&remaining, 250.0); - assert!((line_length - 140.0).abs() < 0.1, "filled_open={filled_open}: retained open strokes {line_length}"); - assert!( - remaining - .iter() - .flat_map(|path| &path.subpaths) - .filter(|sp| sp.anchors.iter().all(|a| (a.p.x - 250.0).abs() < 0.01)) - .all(|sp| !sp.closed) - ); - let image = - vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()); - for (x, y) in [(250, 120), (250, 180), (250, 240)] { - let pixel = image.pixel(x, y); - assert!(pixel[0] > 200 && pixel[1] < 60 && pixel[2] < 60 && pixel[3] > 200, "retained red stroke at ({x},{y}): {pixel:?}"); - } - if filled_open { - let area = own_filled_path_area(&s); - assert!((area - 9000.0).abs() < 1.0, "retained fill area {area}"); - for (x, y) in [(110, 125), (190, 125), (110, 175), (190, 175)] { - assert!(image.pixel(x, y)[3] > 240, "retained fill pixel ({x},{y})"); - } - assert_eq!(image.pixel(150, 150)[3], 0, "the fill erase band is empty"); - } else { - let outline_length: f64 = remaining.iter().map(PathData::length).sum(); - assert!((outline_length - 520.0).abs() < 1.0, "unfilled closed rectangle and two open lines retain 520 pt of stroke: {outline_length}"); - assert!(remaining.iter().flat_map(|path| &path.subpaths).all(|subpath| !subpath.closed), "unfilled outline survivors stay open"); - assert_eq!(image.pixel(150, 145)[3], 0, "outline splitting does not add a stroke across the rectangle interior"); - } - - s.execute("edit.undo", &json!({})).unwrap(); - assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before, "one Undo restores the exact document"); - assert_eq!(s.doc().unwrap().selection, before_selection); - s.execute("edit.redo", &json!({})).unwrap(); - assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), after, "one Redo restores the exact erased document"); - assert_eq!(s.doc().unwrap().selection, after_selection); - } -} - #[test] fn eraser_keeps_open_compound_holes_with_both_fill_rules() { for rule in ["nonZero", "evenOdd"] { @@ -280,374 +174,3 @@ fn eraser_removes_only_the_swept_strip_from_a_zero_signed_area_open_bowtie() { let area: f64 = paths(&s).iter().map(|path| vectorcraft_pathops::area(path, FillRule::NonZero)).sum(); assert!((area - 4500.0).abs() < 1.0, "retained bowtie area {area}"); } - -/// Even-Odd can cancel a nonzero signed area: that open path still has an erasable stroke. -#[test] -fn eraser_cuts_the_outline_when_even_odd_cancels_an_open_paths_fill() { - let mut s = session(); - let made = s.execute("path.create", &json!({"d": "M100 100H200V200H100V100H200V200H100V100"})).unwrap(); - let id = NodeId(made["id"].as_u64().unwrap()); - s.execute("paint.setFill", &json!({"color": "#000000"})).unwrap(); - s.execute("paint.setStroke", &json!({"color": "#ff0000"})).unwrap(); - s.execute("stroke.set", &json!({"weight": 2})).unwrap(); - s.execute("path.setFillRule", &json!({"rule": "evenOdd"})).unwrap(); - s.execute("select.none", &json!({})).unwrap(); - let original = path(&s, id); - assert!(!original.is_closed()); - assert!(original.subpaths.first().unwrap().signed_area().abs() > 10000.0); - assert!(vectorcraft_pathops::area(original, FillRule::EvenOdd) < 1e-9, "Even-Odd cancels the two laps"); - assert!((original.length() - 800.0).abs() < 1e-9); - assert_eq!(render_erased(&s).pixel(150, 125)[3], 0, "the cancelled interior is transparent before Eraser"); - - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); - let length: f64 = paths(&s).iter().map(PathData::length).sum(); - assert!((length - 760.0).abs() < 0.1, "both laps lose their crossed stroke portions: {length}"); - assert_eq!(render_erased(&s).pixel(150, 125)[3], 0, "Eraser does not paint the cancelled interior outside its sweep"); -} - -/// Hidden fills retain open outlines, while a lower visible fill beneath None still paints. -#[test] -fn eraser_hidden_fill_keeps_only_the_explicit_open_outline() { - let render = |s: &Session| { - vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) - }; - for lower_fill in [false, true] { - let mut s = session(); - let id = NodeId( - s.execute( - "path.create", - &json!({"anchors": [ - {"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200} - ]}), - ) - .unwrap()["id"] - .as_u64() - .unwrap(), - ); - s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); - s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#ff0000"})).unwrap(); - s.execute("stroke.set", &json!({"ids": [id.0], "weight": 2})).unwrap(); - if lower_fill { - // The basic black Fill remains visible underneath this added top Fill set to None. - s.execute("appearance.addFill", &json!({"ids": [id.0]})).unwrap(); - s.execute("appearance.setItem", &json!({"ids": [id.0], "index": 2, "none": true})).unwrap(); - } else { - // Basic appearance order is Fill 0, Stroke 1; hiding Fill 0 leaves only open strokes. - s.execute("appearance.setItem", &json!({"ids": [id.0], "index": 0, "visible": false})).unwrap(); - } - s.execute("select.none", &json!({})).unwrap(); - let before = render(&s); - if lower_fill { - assert!(before.pixel(150, 125)[3] > 240, "the lower black fill remains visible under top None"); - } else { - assert_eq!(before.pixel(150, 125)[3], 0, "hidden fill leaves the interior empty"); - assert_eq!(before.pixel(100, 125)[3], 0, "the open path has no implicit left stroke"); - } - assert!(before.pixel(200, 125)[0] > 200 && before.pixel(200, 125)[1] < 60, "the explicit right stroke is visible"); - - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); - let after = render(&s); - if lower_fill { - assert!(after.pixel(150, 125)[3] > 240, "visible lower fill survives above the erased band"); - assert!(after.pixel(150, 175)[3] > 240, "visible lower fill survives below the erased band"); - assert_eq!(after.pixel(150, 150)[3], 0, "the Eraser band is empty"); - } else { - let survivors = paths(&s); - assert!(survivors.iter().all(|path| !path.is_closed()), "unfilled survivors remain open"); - let length: f64 = survivors.iter().map(PathData::length).sum(); - assert!((length - 290.0).abs() < 0.1, "only the crossed explicit right edge loses 10 pt: {length}"); - assert_eq!(after.pixel(150, 125)[3], 0, "hidden fill leaves the interior empty"); - assert_eq!(after.pixel(100, 125)[3], 0, "the missing implicit left stroke remains absent"); - } - } -} - -/// The original compound's cancelled outline stays grouped beside its filled contour. -#[test] -fn eraser_even_odd_cancellation_survives_beside_a_filled_subpath() { - let mut s = session(); - let id = NodeId( - s.execute("path.create", &json!({"d": "M100 100H200V200H100V100H200V200H100V100 M230 100H280V200H230"})).unwrap()["id"].as_u64().unwrap(), - ); - s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); - s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#ff0000"})).unwrap(); - s.execute("stroke.set", &json!({"ids": [id.0], "weight": 2})).unwrap(); - s.execute("path.setFillRule", &json!({"ids": [id.0], "rule": "evenOdd"})).unwrap(); - s.execute("select.none", &json!({})).unwrap(); - assert_eq!(path(&s, id).subpaths.len(), 2, "one node holds both open subpaths"); - assert!(path(&s, id).subpaths.iter().all(|subpath| !subpath.closed)); - let render = |s: &Session| { - vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) - }; - let before = render(&s); - assert_eq!(before.pixel(150, 125)[3], 0, "the twice-traced open subpath cancels under Even-Odd"); - assert_eq!(before.pixel(150, 175)[3], 0, "the cancelled lower run is empty before Eraser"); - assert!(before.pixel(250, 125)[3] > 240, "the disjoint open rectangle fills"); - assert_eq!(before.pixel(230, 125), [0, 0, 0, 255], "the second contour has fill but no explicit left stroke"); - assert_eq!(before.pixel(229, 125), [0, 0, 0, 0], "there is no stroke outside its implicit closing edge"); - - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [290, 150]], "size": 10})).unwrap(); - let after = render(&s); - assert_eq!(after.pixel(150, 175)[3], 0, "the cancelled interior stays empty below the sweep"); - assert!(after.pixel(250, 125)[3] > 240, "the disjoint filled subpath survives"); - assert_eq!(after.pixel(250, 150)[3], 0, "the swept band through the filled subpath is empty"); - for (x, y) in [(230, 125), (229, 125)] { - assert_eq!(after.pixel(x, y), before.pixel(x, y), "the implicit closing edge stays unstroked at ({x},{y})"); - } - for (x, y) in [(100, 125), (200, 125), (280, 125)] { - let pixel = after.pixel(x, y); - assert!(pixel[0] > 200 && pixel[1] < 60 && pixel[2] < 60 && pixel[3] > 200, "open outline survivor ({x},{y}): {pixel:?}"); - } -} -#[test] -fn eraser_preserves_the_missing_edge_of_a_filled_open_stroke() { - let mut failures = vec![]; - for (opacity, expected_alpha) in [(100, 255u8), (50, 128u8)] { - for closed in [true, false] { - let (mut s, id) = painted_open_rectangle(closed); - s.execute("transparency.set", &json!({"ids": [id.0], "opacity": opacity})).unwrap(); - s.execute("select.none", &json!({})).unwrap(); - let mut check = |ok: bool, message: String| { - if !ok { - failures.push(format!("closed={closed} opacity={opacity}: {message}")); - } - }; - let before = render_erased(&s); - for y in [125, 175] { - check(before.pixel(150, y)[3].abs_diff(expected_alpha) <= 1, format!("original fill at y={y}: {:?}", before.pixel(150, y))); - } - let before_left = before.pixel(99, 125); - if closed { - check(before_left[0] > before_left[1] && before_left[3] > 0, format!("closed control's explicit red left edge: {before_left:?}")); - } else { - check(before_left[3] == 0, format!("open source has no implicit left stroke: {before_left:?}")); - } - let before_overlap = before.pixel(199, 125); - check(before_overlap[3].abs_diff(expected_alpha) <= 1, format!("object opacity is applied once before Eraser: {before_overlap:?}")); - check(before_overlap[0] > before_overlap[1] && before_overlap[3] > 0, format!("visible fill and red stroke overlap: {before_overlap:?}")); - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); - let after = render_erased(&s); - for y in [125, 175] { - check( - after.pixel(150, y) == before.pixel(150, y), - format!("retained fill at y={y}: before {:?}, after {:?}", before.pixel(150, y), after.pixel(150, y)), - ); - } - check(after.pixel(150, 150)[3] == 0, format!("Eraser band is empty: {:?}", after.pixel(150, 150))); - let after_left = after.pixel(99, 125); - check(after_left == before_left, format!("left-edge stroke: before {before_left:?}, after {after_left:?}")); - let after_overlap = after.pixel(199, 125); - check(after_overlap == before_overlap, format!("unaffected fill/stroke overlap: before {before_overlap:?}, after {after_overlap:?}")); - check(after_overlap[0] > after_overlap[1] && after_overlap[3] > 0, format!("explicit right stroke remains visible: {after_overlap:?}")); - } - } - assert!(failures.is_empty(), "{}", failures.join("\n")); -} - -fn render_erased(s: &Session) -> vectorcraft_render::Rendered { - vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) -} - -fn painted_open_rectangle(closed: bool) -> (Session, NodeId) { - let mut s = session(); - let id = NodeId( - s.execute( - "path.create", - &json!({"closed": closed, "anchors": [ - {"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200} - ]}), - ) - .unwrap()["id"] - .as_u64() - .unwrap(), - ); - s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); - s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#ff0000"})).unwrap(); - s.execute("stroke.set", &json!({"ids": [id.0], "weight": 2})).unwrap(); - (s, id) -} - -fn assert_eraser_history(s: &mut Session, before: &serde_json::Value, before_selection: &vectorcraft_doc::Selection) { - let after = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); - let after_selection = s.doc().unwrap().selection.clone(); - let after_pixels = render_erased(s).pixels; - s.execute("edit.undo", &json!({})).unwrap(); - assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), *before, "one Undo restores the exact source"); - assert_eq!(s.doc().unwrap().selection, *before_selection); - s.execute("edit.redo", &json!({})).unwrap(); - assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), after, "one Redo restores the exact erased document"); - assert_eq!(s.doc().unwrap().selection, after_selection); - assert_eq!(render_erased(s).pixels, after_pixels, "Redo restores the rendered appearance"); -} - -#[test] -fn eraser_keeps_object_metadata_and_mask_once_around_separate_fill_and_stroke() { - let (mut s, id) = painted_open_rectangle(false); - let mask = NodeId(s.execute("shape.rectangle", &json!({"x": 80, "y": 80, "width": 140, "height": 140})).unwrap()["id"].as_u64().unwrap()); - s.execute("paint.setFill", &json!({"ids": [mask.0], "color": "#ffffff"})).unwrap(); - s.execute("paint.setStroke", &json!({"ids": [mask.0], "none": true})).unwrap(); - s.execute("transparency.makeOpacityMask", &json!({"ids": [id.0, mask.0]})).unwrap(); - s.execute( - "transparency.set", - &json!({"ids": [id.0], "opacity": 50, "blend": "multiply", "isolate": true, "knockout": "off", "knockoutShape": true}), - ) - .unwrap(); - s.execute("attributes.set", &json!({"ids": [id.0], "note": "Eraser source", "showCenter": true})).unwrap(); - // A stored object axis is independent of this axis-aligned fixture's geometry. - s.edit("Fixture metadata", |doc, _| { - let n = doc.node_mut(id).unwrap(); - n.name = Some("Filled open stroke".into()); - n.bbox_angle = 17.0; - Ok(()) - }) - .unwrap(); - s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); - let original = s.doc().unwrap().doc.node(id).unwrap().clone(); - let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); - let before_selection = s.doc().unwrap().selection.clone(); - let before_history = s.doc().unwrap().history.undo.len(); - let before_image = render_erased(&s); - assert!(before_image.pixel(150, 125)[3].abs_diff(128) <= 1); - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); - assert_eq!(s.doc().unwrap().history.undo.len(), before_history + 1); - let root = s.doc().unwrap().doc.node(id).unwrap(); - let NodeKind::Group { children, clip: false } = &root.kind else { panic!("fill and stroke share one ordinary object wrapper") }; - assert_eq!( - (&root.name, root.opacity, root.blend, root.isolate, root.knockout, root.knockout_shape, root.bbox_angle), - (&original.name, original.opacity, original.blend, original.isolate, original.knockout, original.knockout_shape, original.bbox_angle) - ); - assert_eq!(root.extras(), original.extras(), "the mask and Attributes remain on the object"); - assert!(!children.is_empty()); - for child in children { - assert!(child.name.is_none() && child.has_default_transparency(), "paint lanes do not repeat object metadata or transparency"); - assert_eq!(child.bbox_angle, 0.0); - assert_eq!(child.extras(), &vectorcraft_doc::NodeExtras::default()); - } - let after = render_erased(&s); - for (x, y) in [(99, 125), (150, 125), (150, 175), (199, 125)] { - assert_eq!(after.pixel(x, y), before_image.pixel(x, y), "object appearance outside the sweep at ({x},{y})"); - } - assert_eq!(after.pixel(150, 150)[3], 0); - assert_eraser_history(&mut s, &before, &before_selection); -} - -#[test] -fn eraser_keeps_a_painted_clipping_source_on_the_legacy_path_route() { - let mut results = vec![]; - for closed in [true, false] { - let mut s = session(); - let art = NodeId(s.execute("shape.rectangle", &json!({"x": 90, "y": 90, "width": 60, "height": 120})).unwrap()["id"].as_u64().unwrap()); - s.execute("paint.setFill", &json!({"ids": [art.0], "color": "#ff0000"})).unwrap(); - s.execute("paint.setStroke", &json!({"ids": [art.0], "none": true})).unwrap(); - let clip = NodeId( - s.execute( - "path.create", - &json!({"closed": closed, "anchors": [ - {"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200} - ]}), - ) - .unwrap()["id"] - .as_u64() - .unwrap(), - ); - let group = NodeId(s.execute("object.clippingMask.make", &json!({"ids": [art.0, clip.0]})).unwrap()["id"].as_u64().unwrap()); - s.execute("paint.setFill", &json!({"ids": [clip.0], "color": "#0000ff"})).unwrap(); - s.execute("paint.setStroke", &json!({"ids": [clip.0], "color": "#00ff00"})).unwrap(); - s.execute("stroke.set", &json!({"ids": [clip.0], "weight": 2})).unwrap(); - s.execute("select.set", &json!({"ids": [clip.0]})).unwrap(); - let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); - let before_selection = s.doc().unwrap().selection.clone(); - let image = render_erased(&s); - assert_eq!(image.pixel(110, 125), [255, 0, 0, 255], "clipped art paints above the clipping fill"); - assert_eq!(image.pixel(180, 125), [0, 0, 255, 255], "clipping fill paints behind the art"); - assert_eq!(image.pixel(199, 125), [0, 255, 0, 255], "clipping stroke paints over the fill"); - assert_eq!(image.pixel(90, 125)[3], 0, "art outside the clip is hidden"); - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); - let doc = &s.doc().unwrap().doc; - let NodeKind::Group { children, clip: true } = &doc.node(group).unwrap().kind else { panic!("the clipping group is retained") }; - let source = children.first().unwrap(); - assert_eq!(source.id, clip); - assert!(matches!(source.kind, NodeKind::Path { .. }), "the actual clipping source stays a path"); - let paint = source.clip_paint(); - assert!(paint.fill.is_some() && paint.stroke.is_some(), "the clipping source keeps its fill and stroke paint"); - assert_eq!(render_erased(&s).pixel(150, 150)[3], 0, "the clipping region loses the sweep band"); - // Legacy fill Booleans close both source contours. This deliberately pins that existing - // painted-clip behavior against the unchanged closed-source route, not the ordinary fix. - results.push(render_erased(&s).pixels); - assert_eraser_history(&mut s, &before, &before_selection); - } - assert_eq!(results[0], results[1], "open clipping sources retain the existing closed-fill Boolean behavior"); -} - -#[test] -fn eraser_separates_an_ordinary_open_stroke_inside_a_clipping_group() { - let (mut s, art) = painted_open_rectangle(false); - let clip = NodeId(s.execute("shape.rectangle", &json!({"x": 80, "y": 80, "width": 140, "height": 140})).unwrap()["id"].as_u64().unwrap()); - s.execute("object.clippingMask.make", &json!({"ids": [art.0, clip.0]})).unwrap(); - s.execute("select.set", &json!({"ids": [art.0]})).unwrap(); - let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); - let before_selection = s.doc().unwrap().selection.clone(); - let original_clip = s.doc().unwrap().doc.node(clip).unwrap().clone(); - let before_image = render_erased(&s); - assert_eq!(before_image.pixel(99, 125)[3], 0); - assert_eq!(before_image.pixel(150, 125), [0, 0, 0, 255]); - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); - assert_eq!(s.doc().unwrap().doc.node(clip).unwrap(), &original_clip, "the actual clipping source is untouched"); - let after = render_erased(&s); - for (x, y) in [(99, 125), (150, 125), (150, 175), (199, 125)] { - assert_eq!(after.pixel(x, y), before_image.pixel(x, y), "ordinary clipped art retains its appearance at ({x},{y})"); - } - assert_eq!(after.pixel(150, 150)[3], 0); - assert_eraser_history(&mut s, &before, &before_selection); -} - -#[test] -fn eraser_keeps_a_live_outline_strokes_original_appearance_context() { - let mut results = vec![]; - for closed in [true, false] { - let (mut s, id) = painted_open_rectangle(closed); - s.execute("stroke.set", &json!({"ids": [id.0], "weight": 10})).unwrap(); - s.execute("effect.apply", &json!({"ids": [id.0], "effect": "path.outlineStroke", "item": null, "params": {}})).unwrap(); - s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); - let original = s.doc().unwrap().doc.node(id).unwrap(); - assert_eq!(original.appearance.stroke().unwrap().width, 10.0); - assert!(original.appearance.effects.iter().any(|effect| effect.visible && effect.id == "path.outlineStroke")); - let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); - let before_selection = s.doc().unwrap().selection.clone(); - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); - let after = render_erased(&s); - assert!(after.pixels.as_chunks::<4>().0.iter().any(|pixel| pixel[3] > 0), "the live effect still paints"); - results.push(after.pixels); - assert_eraser_history(&mut s, &before, &before_selection); - } - // The legacy fill Booleans produce identical closed survivors and retain the 10 pt context. - assert_eq!(results[0], results[1], "an open source with a live effect retains the closed legacy rendering"); -} - -#[test] -fn eraser_preserves_a_translucent_fill_above_the_stroke() { - use vectorcraft_color::{Color, Paint}; - use vectorcraft_doc::{AppearanceItem, FillLayer}; - let (mut s, id) = painted_open_rectangle(false); - s.edit("Fixture top fill", |doc, _| { - let node = doc.node_mut(id).unwrap(); - assert!(matches!(node.appearance.items.last(), Some(AppearanceItem::Stroke(_)))); - let mut fill = FillLayer::new(Paint::solid(Color::WHITE)); - fill.opacity = 0.5; - node.appearance.items.push(AppearanceItem::Fill(fill)); - Ok(()) - }) - .unwrap(); - s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); - let before = render_erased(&s); - let near = |actual: [u8; 4], expected: [u8; 4]| actual.iter().zip(expected).all(|(a, e)| a.abs_diff(e) <= 1); - assert!(near(before.pixel(199, 125), [255, 128, 128, 255]), "half-opacity white covers red: {:?}", before.pixel(199, 125)); - assert!(near(before.pixel(150, 125), [128, 128, 128, 255]), "half-opacity white covers black: {:?}", before.pixel(150, 125)); - assert_eq!(before.pixel(99, 125), [0, 0, 0, 0]); - s.execute("path.eraseRegion", &json!({"points": [[50, 150], [250, 150]], "size": 10})).unwrap(); - let after = render_erased(&s); - for (x, y) in [(199, 125), (150, 125), (99, 125)] { - assert_eq!(after.pixel(x, y), before.pixel(x, y), "paint order and item opacity survive at ({x},{y})"); - } - assert_eq!(after.pixel(150, 150)[3], 0, "the swept band is empty"); -} diff --git a/docs/gaps.md b/docs/gaps.md index 71df386984..5222bab0ac 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -4,7 +4,7 @@ ## Feature submission evidence -> **Eraser fill update (2026-11-11):** ordinary filled open paths retain fill and explicit strokes outside the sweep (#6582); clipping sources and live effects retain legacy behavior; scores and estimates unchanged. +> **Eraser fill update (2026-11-11):** filled open paths without a visible painted stroke retain fill outside the sweep (#6582); stroked paths retain main behavior; scores and estimates unchanged. **Feature evidence last updated:** 2026-11-03. @@ -307,7 +307,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G11 Correctness bugs in core tools -- **Improved (#6582):** the Eraser subtracts its swept area from filled open contours, preserving fill outside the stroke. Open compound members keep their holes under either fill rule; zero-area open lines keep outline splitting. Ordinary filled open paths with visible strokes keep separate fill and explicit-stroke geometry in their original paint order, preserving missing closing edges, Even-Odd cancellation and object opacity. Thirteen engine integration regressions check rendered pixels, geometry, paint order, masks, mixed paths and history. Clipping-source subtrees and paths with visible appearance effects on themselves or an ancestor retain the existing route; its stroke-closure and canceled-fill limitations remain open pending the scope decision. Scores and estimates unchanged. +- **Improved (#6582), fill-only scope:** the Eraser subtracts its swept area from filled open contours with no visible painted stroke, preserving fill outside the sweep. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. The result keeps the existing path/compound piece structure and whole appearance. Filled-and-stroked open paths deliberately retain the outline-splitting behavior from main. Public reference semantics for those stroked paths were not established, and their fill behavior is not claimed fixed here. Focused engine integration tests cover fill-only open/closed geometry and pixels, compound holes and self-crossing fill. Scores and estimates unchanged. - **Export-only improvement (#6309):** PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. Broader G11 scope, scores and estimates unchanged. @@ -861,7 +861,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | 2026-11-11 | minor | G5: built-in Energy Beams brush library (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail); Missing trimmed; estimate 5–15 → 4–14 h; MCP Brush libraries list Energy Beams. | | 2026-11-11 | minor | G5: built-in Skill Icons symbol library (Attack, Defend, Heal, Buff, Ult); Missing trimmed; estimate 6–16 → 5–15 h; MCP Symbol libraries list Skill Icons. | | 2026-11-10 | minor | G6: MCP catalogue (#6460): headless lists `UI_COMMANDS` (`ui: true`), eight prompts, effect vs command ids, 33 tools, commands/reference; estimate unchanged. | -| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; ordinary fills and explicit strokes keep separate geometry; clipping sources and live effects retain legacy behavior (#6582). Scores and estimates unchanged. | +| 2026-11-11 | minor | Eraser: fill-only open contours and compound holes use area cutting; stroked open paths retain main behavior (#6582). Scores and estimates unchanged. | | 2026-11-11 | minor | G5: built-in Status Effects graphic style library (Poison Tint, Freeze Edge, Burn Aura, Stun Pulse, Stealth Fade, Shield Buff); Missing trimmed; estimate 7–17 → 6–16 h; MCP docs list UI Frames and Map Markers under Symbol libraries. | | 2026-11-11 | minor | G5: built-in Inventory Icons symbol library (Sword, Shield, Potion, Key, Gem; no default 9-slice); Missing trimmed; estimate 8–18 → 7–17 h. | | 2026-11-10 | minor | G4 type: Edit › Edit Custom Dictionary… adds, deletes and changes the custom dictionary's words, #4936; the Check Spelling dialog remains; scores and estimates unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index d22b08caff..7807fa9b18 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -4,7 +4,7 @@ > > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > -> **Eraser fill update (2026-11-11):** ordinary filled open paths retain fill and explicit strokes outside the sweep (#6582); clipping sources and live effects retain legacy behavior; scores and estimates unchanged. +> **Eraser fill update (2026-11-11):** filled open paths without a visible painted stroke retain fill outside the sweep (#6582); stroked paths retain main behavior; scores and estimates unchanged. > > **Flyout update:** 2026-11-06 — resizable icon-strip flyouts and bottom-aligned panel footers (#5713); scores and estimates unchanged. > @@ -55,7 +55,7 @@ M7 type: Touch Type moves a right-to-left character along its line and up from i | 2026-11-08 | minor | Character Styles panel: a double-click on a user style's row opens its Character Style Options (`ui.charStyleOptions`); the dialog keeps a fixed width and scrolls its sections in a shorter window, so OK and Cancel stay on screen. Tests `panels::text_styles::tests::double_clicking_a_character_style_row_opens_its_options` and `dialogs::char_style_options::tests::the_sections_scroll_in_a_window_shorter_than_the_general_list`. Scores and estimates unchanged. | | 2026-11-08 | minor | #3380, deletion only: preserve gradient placement and exact surviving geometry; consume owned subpaths with a shared original-node snapshot; consolidate status/evidence and document command/helper contracts. Compound behavior and the existing M2 status entry are retained. Endpoint highlighting remains open; scores and estimates unchanged. | | 2026-11-10 | minor | M13 / G6: MCP catalogue (#6460): headless lists UI commands, eight prompts, 33 tools, effect vs command ids; scores and estimates unchanged. | -| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; ordinary fills and explicit strokes keep separate geometry; clipping sources and live effects retain legacy behavior (#6582). Scores and estimates unchanged. | +| 2026-11-11 | minor | Eraser: fill-only open contours and compound holes use area cutting; stroked open paths retain main behavior (#6582). Scores and estimates unchanged. | | 2026-11-07 | minor | #3380 (deletion only): independent surviving path objects; transformed appearance, stacking, selection, cubic handles and Undo/Redo covered by `delete_path_pieces`; compound semantics retained. Endpoint highlighting remains open; scores and estimates unchanged. | | 2026-11-02 | minor | Selection QoL: saved marquee modes, screen drag direction with a 3 px dead zone, and translated mode/E feedback (#5313); VectorCraft addition, scores and estimates unchanged. | | 2026-11-07 | minor | Indian-language hyphenation (#4947): eleven MIT-licensed pattern sets, with grapheme and shaping-cluster protection in both composers and existing paragraph limits. Assamese and Sanskrit are selectable; Sanskrit automatic patterns remain pending an allowlisted source. Scores and estimates unchanged. | @@ -144,7 +144,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l |---|---|---|---| | M0 | Skeleton + vertical slice | ✅ done | — | | M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | -| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside its sweep on open paths and keeps compound holes and ordinary explicit strokes; clipping-source/live-effect follow-up remains open (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | +| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside its sweep on fill-only open paths and keeps their compound holes; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | | M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel, Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls | 4–8 | | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 189da23121..b5297c98de 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -4,7 +4,7 @@ > > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > -> **Eraser fill update (2026-11-11):** ordinary filled open paths retain fill and explicit strokes outside the sweep (#6582); clipping sources and live effects retain legacy behavior; scores and estimates unchanged. +> **Eraser fill update (2026-11-11):** filled open paths without a visible painted stroke retain fill outside the sweep (#6582); stroked paths retain main behavior; scores and estimates unchanged. > > **Flyout update:** 2026-11-06 — resizable icon-strip flyouts and bottom-aligned panel footers (#5713); scores and estimates unchanged. @@ -217,7 +217,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Area | Weight | Done | Main gaps | One agent (h) | Kind | |---|---:|---:|---|---:|---| | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); deletion splits an ordinary contour into selected sibling objects with bounds-fitted gradients kept in place (#3380, deletion only; `crates/engine/tests/it/delete_path_pieces.rs`); open-path anchor Delete keeps gaps; Select › Start Global Edit finds the paths, compound paths and symbol instances of the selected object's shape (Appearance, Size and artboard options) and gives an edit of one to all of them in proportion, as one undo step (#3521), and on a group the groups like it, an edit inside one reaching the same object in the others (#4939), and a Shift-click on a highlighted match leaves it out; the Align panel menu's Align to Glyph Bounds › Point Text and Area Text measure type by its glyphs' ink for Align and Distribute (#4231); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of rotated copies, transform nuances (no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | estimated; Global Edit regression-tested (`crates/engine/src/tests/globaledit.rs`; Quick Action, menu label and Escape in `panels::properties::tests::start_global_edit_quick_action_and_escape`) | -| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; Eraser preserves ordinary filled open-path area and explicit strokes outside its sweep, including compound holes and mixed stroked lines; clipping-source/live-effect correction remains open (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | +| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; Eraser preserves fill-only open-path area outside its sweep, including compound holes; stroked open paths retain main behavior and result structure (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient additions are done (dither, perceptual blending, presets); freeform gradients in SVG/PDF, mixed spot/process gradients in SVG, PDF gradients mixing a spot color with RGB or Lab stops, and dithered spot gradient fills and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, which PDF export writes as images in process colors | 4–7 | estimated; Recolor model selection is available through the engine and MCP (#2520), and the dialog's color sliders (HSB, RGB, CMYK, Lab, Tint for a spot color) edit the selected row's new color in its mode, and the Edit tab's Global Adjust sliders (Saturation, Brightness, Temperature, Luminosity, -100% to 100%) change every recolored color at once (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | | Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (six generated libraries including Game Trails and Energy Beams, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | @@ -945,7 +945,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur While a spiral is dragged out, Alt adds or removes whole winds of four segments and Ctrl/Cmd changes the decay. The spiral's inner end keeps the distance from the center it had on the first modified drag event, while the outer end follows the pointer. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list Alt-drag to add or subtract winds and Ctrl-drag to change the decay rate; [Draw spirals](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-spirals.html) defines four segments per full wind and Decay as the amount each wind decreases. An 80% spiral has 80% of its outer radius after four segments; newly drawn spirals with the same settings wind more broadly than in earlier VectorCraft builds. Rounding the fitted count to whole winds from the count on the first Alt-only drag event, the held inner radius, the ranges (2…1000 segments, 5…99.99 % decay), Ctrl/Cmd taking precedence when both are held, and the new values staying as Spiral tool options are our own rules. Switching back to Alt uses the current count as its new base while keeping the held inner end. Escape while an arc, spiral or grid is dragged out cancels it and puts back the options its keys, Alt and Ctrl/Cmd changed (slope, open or closed, base axis, segments, decay, dividers and skews), so the next drag and the tool's options start from the values before the canceled drag; a drag that is let go keeps them, and an option set with `tool.setOption` during the drag stays. This is VectorCraft's own rule. - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). - The Eraser cuts filled open contours as areas (#6582), retaining fill outside its sweep. Open compound members are cut together under their compound fill rule so holes stay empty. Ordinary filled open paths keep closed fill geometry separate from their original explicit stroke segments, with the original paint order and object transparency on one wrapper. Canceled Even-Odd fill stays empty; zero-area open lines retain outline splitting. Thirteen tests in `crates/engine/tests/eraser_open_fill.rs` check open/closed shapes, retained/erased pixels, self-crossing fill, compound holes, missing stroke edges, object/item opacity, masks, mixed strokes and Undo/Redo. Painted clipping-source subtrees and paths with visible self/ancestor appearance effects deliberately retain the legacy route; that route can still add closing-edge strokes or reveal canceled fill. Their broader correction remains an open scope decision. Scores and hours are unchanged. + The Eraser cuts fill-only open contours as areas (#6582), retaining fill outside its sweep. An eligible appearance has a visible non-None fill and no visible non-None stroke of positive width. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. Cut pieces keep the existing path/compound representation and whole appearance. Filled-and-stroked open paths retain the outline-splitting behavior from main. `crates/engine/tests/eraser_open_fill.rs` covers fill-only open/closed geometry and raster output, compound holes and self-crossing fill. This deliberately scoped fix does not claim to repair filled-and-stroked open-path fill behavior. Scores and hours are unchanged. A Scissors cut (`path.split`) leaves one of the two new end points selected and the rest of the path unselected, as [Cut paths](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/split-paths.html) and the "Split a path" section of the [CS3 user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) describe: the two end points lie on top of each other, and a Direct Selection drag from them moves the selected one with its handles and no other anchor. A closed path cut once stays one open path. While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. @@ -1982,7 +1982,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | 2026-11-11 | minor | Bundled content: built-in Energy Beams brush library (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail); brush libraries evidence updated; ~44% → ~46%; more built-in brush libraries remain. | | 2026-11-11 | minor | Bundled content: built-in Skill Icons symbol library (Attack, Defend, Heal, Buff, Ult); symbol libraries evidence updated; ~42% → ~44%; more built-in symbol libraries remain. | | 2026-11-10 | minor | Automation: MCP tool count 33; headless `command_list` lists `UI_COMMANDS` (`ui: true`); eight prompts; effect-id vs command-id clarified (#6460); scores and hours unchanged. | -| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; ordinary fills and explicit strokes keep separate geometry; clipping sources and live effects retain legacy behavior (#6582). Scores and estimates unchanged. | +| 2026-11-11 | minor | Eraser: fill-only open contours and compound holes use area cutting; stroked open paths retain main behavior (#6582). Scores and estimates unchanged. | | 2026-11-11 | minor | Bundled content: built-in Status Effects graphic style library; style libraries evidence updated; ~40% → ~42%; MCP Symbol libraries list UI Frames and Map Markers; more built-in graphic-style libraries remain. | | 2026-11-11 | minor | Bundled content: built-in Inventory Icons symbol library (Sword, Shield, Potion, Key, Gem); symbol libraries evidence updated; ~38% → ~40%; more built-in symbol libraries remain. | | 2026-11-10 | minor | Type advanced: the Edit Custom Dictionary dialog, #4936; evidence added; the Check Spelling dialog remains; scores and hours unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 5443d19623..9e82932395 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -4,7 +4,7 @@ > > Vector Halftone preview update (2026-11-10): temporary dot selection marks are hidden, and the bounding box stays available (#6369). > -> **Eraser fill update (2026-11-11):** ordinary filled open paths retain fill and explicit strokes outside the sweep (#6582); clipping sources and live effects retain legacy behavior; scores and estimates unchanged. +> **Eraser fill update (2026-11-11):** filled open paths without a visible painted stroke retain fill outside the sweep (#6582); stroked paths retain main behavior; scores and estimates unchanged. > > Numeric spinner update (2026-11-10): held mouse arrows repeat past the click timeout; scores and estimates unchanged (#6307). @@ -160,7 +160,7 @@ tools, never checked side by side) isn't captured row by row. | Anchor Point and Curvature tools' own cursors | done | the caret on the anchor it converts; the pen nib with a curve badge | | Free Transform's Cmd/Ctrl side-shear cursor | done | two arrows passing along the side (ShearH, ShearV), instead of the resize arrow across it | | Cursors of their own for Lasso, Magic Wand, the freehand tools, Shaper, Live Paint Bucket, Measure, Print Tiling, the symbolism tools, vertical type, Scissors (over a segment and away), Mesh and Puppet Warp | partial | each tool returns its own cursor and Use Precise Cursors turns them into the crosshair; until they're drawn they borrow the crosshair, the I-beam, the Pen's add cursor or not-allowed | -| Eraser: filled open paths and compound holes | partial | Area cutting preserves fill outside the swept region (#6582). Ordinary filled open paths preserve explicit strokes, paint order, opacity and canceled fill with separate fill/stroke geometry; zero-area open lines retain outline splitting. Thirteen engine integration tests cover rendered pixels, geometry, holes, masks, mixed strokes and history. Clipping-source/live-effect correction remains open; see G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | +| Eraser: filled open paths and compound holes | partial | Fill-only open paths preserve fill outside the sweep and compound holes under their fill rule (#6582). Focused engine tests cover open/closed geometry, raster output, compound holes and self-crossing fill. Filled-and-stroked open paths retain main behavior; that fill behavior is not claimed fixed. See G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | | Blob Brush and Eraser: the tip's outline at the pointer | done | before a press and while painting, the outline of the tip (its size, angle and roundness, at the zoom) follows the pointer, black on a white halo, round a small centre dot; `[` / `]` and Tool Options change it at once; precise cursors (Caps Lock) show only the crosshair; it goes when the pointer leaves the canvas, while Cmd/Ctrl lends a selection tool and while Alt lends the Blob Brush the Smooth tool (#4977); `crates/tools/src/draw2/gesture.rs` and its tests While the button is down a round Blob Brush shows the outline of the area it will add, rounded at both ends, not a line as wide as the brush that ends square (#4343). | | Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) | | Each anchor snaps to Smart Guides and construction angles | done | `DrawSnap` | @@ -514,7 +514,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| -| 2026-11-11 | minor | Eraser: filled open contours and compound holes use area cutting; ordinary fills and explicit strokes keep separate geometry; clipping sources and live effects retain legacy behavior (#6582). Scores and estimates unchanged. | +| 2026-11-11 | minor | Eraser: fill-only open contours and compound holes use area cutting; stroked open paths retain main behavior (#6582). Scores and estimates unchanged. | | 2026-11-11 | minor | Outline view: a click on a path's outline selects it through an image or a gradient mesh in front, which Outline draws as a frame or mesh lines (#6437). | | 2026-11-11 | minor | A middle-click on a document tab (or its ×) closes it as the × does; closing a document's last view with unsaved changes asks to save first (#6506). VectorCraft addition; scores and estimates unchanged. | | 2026-11-03 | minor | A double-click on a ruler adds a guide at the pointer (#5239): a vertical one on the top ruler, a horizontal one on the left ruler; scores and estimates unchanged. | From 23d442a8a44c9ce32b4a20d87f8dfb0b4e7e701f Mon Sep 17 00:00:00 2001 From: yoriswind Date: Thu, 12 Nov 2026 21:50:33 -0800 Subject: [PATCH 005/158] 5179: include spine-aligned blend artwork in redraw bounds --- .../engine/tests/blend_render_consistency.rs | 143 ++++++++++++++++++ crates/render/src/fx/bounds.rs | 16 +- docs/gaps.md | 5 + docs/roadmap.md | 5 +- docs/target-app-parity.md | 7 +- docs/ui-parity.md | 4 + 6 files changed, 175 insertions(+), 5 deletions(-) create mode 100644 crates/engine/tests/blend_render_consistency.rs diff --git a/crates/engine/tests/blend_render_consistency.rs b/crates/engine/tests/blend_render_consistency.rs new file mode 100644 index 0000000000..4fc6327152 --- /dev/null +++ b/crates/engine/tests/blend_render_consistency.rs @@ -0,0 +1,143 @@ +//! Blend edits invalidate every pixel they change, including keys aligned to a curved spine. +#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)] + +use std::sync::Arc; + +use serde_json::json; +use vectorcraft_doc::{Document, NodeId, NodeKind}; +use vectorcraft_engine::Session; +use vectorcraft_geom::Affine; +use vectorcraft_render::{Changed, RenderOptions, Rendered, Renderer, view_pixels}; + +const WIDTH: u32 = 720; +const HEIGHT: u32 = 480; + +type Retained = (Renderer, Option<(Arc, Vec)>); + +fn live(s: &Session, blend: NodeId, keys: [NodeId; 2], curved: bool) { + let doc = &s.doc().unwrap().doc; + let NodeKind::Blend { children, spec } = &doc.node(blend).unwrap().kind else { + panic!("INPUT: the fixture must remain a live blend"); + }; + assert_eq!(children.iter().map(|n| n.id).collect::>(), keys.to_vec()); + assert_eq!(serde_json::to_value(spec).unwrap()["spacing"], json!({"steps": 3})); + for key in keys { + assert_eq!(doc.parent_of(key), Some(blend), "INPUT: key identity/parent changed"); + } + if curved { + let bounds = spec.spine.as_ref().expect("INPUT: Replace Spine did not set a spine").bounds().unwrap(); + assert!(!spec.no_spine && bounds.height() > 40.0 && bounds.width() > 250.0, "INPUT: a real curved spine is required"); + } +} + +fn fixture() -> (Session, NodeId, [NodeId; 2]) { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": WIDTH, "height": HEIGHT})).unwrap(); + let mut rectangle = |x: f64, color: &str| { + let id = NodeId(s.execute("shape.rectangle", &json!({"x": x, "y": 120.0, "width": 64.0, "height": 48.0})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"color": color})).unwrap(); + s.execute("paint.setStroke", &json!({"none": true})).unwrap(); + id + }; + let keys = [rectangle(90.0, "#d52c38"), rectangle(430.0, "#25b453")]; + let blend = NodeId( + s.execute("object.blend.make", &json!({"ids": [keys[0].0, keys[1].0], "steps": 3, "orientation": "path"})).unwrap()["id"].as_u64().unwrap(), + ); + assert_eq!(s.doc().unwrap().selection.objects, vec![blend]); + live(&s, blend, keys, false); + (s, blend, keys) +} + +fn cpu() -> Renderer { + let mut renderer = Renderer::new(); + renderer.threads = 0; + renderer +} + +fn same_pixels(actual: &Rendered, expected: &Rendered) { + assert_eq!((actual.width, actual.height), (WIDTH, HEIGHT)); + assert_eq!((expected.width, expected.height), (WIDTH, HEIGHT)); + assert_eq!(actual.pixels.len(), (WIDTH * HEIGHT * 4) as usize); + assert!(actual.pixels == expected.pixels, "complete RGBA frames differ"); +} + +fn damage_pixels(stage: &str, changed: Changed, before: &[u8], current: &[u8]) { + let region = match changed { + Changed::Everything => return, + Changed::Nothing => None, + Changed::Area(area) => view_pixels(area, Affine::IDENTITY, WIDTH, HEIGHT), + }; + assert_eq!(before.len(), current.len()); + for (i, (old, new)) in before.as_chunks::<4>().0.iter().zip(current.as_chunks::<4>().0.iter()).enumerate() { + let (x, y) = (i as u32 % WIDTH, i as u32 / WIDTH); + if !region.is_some_and(|[x0, y0, x1, y1]| x >= x0 && x < x1 && y >= y0 && y < y1) { + assert_eq!(old, new, "{stage}: pixel ({x}, {y}) changed outside {changed:?}, view pixels {region:?}"); + } + } +} + +fn frame(s: &Session, retained: &mut Retained, stage: &str) -> Rendered { + let doc = &s.doc().unwrap().doc; + let opts = RenderOptions { background: Some([255, 255, 255, 255]), artboards: false, ..Default::default() }; + // Ask for the edit's advertised damage before rendering the new full frame on this renderer. + let changed = retained.1.as_ref().map(|(old, _)| retained.0.changed(old.as_ref(), doc.as_ref(), &opts)); + let actual = retained.0.render(doc.as_ref(), WIDTH, HEIGHT, Affine::IDENTITY, &opts); + let expected = cpu().render(doc.as_ref(), WIDTH, HEIGHT, Affine::IDENTITY, &opts); + same_pixels(&actual, &expected); + let red = expected.pixels.as_chunks::<4>().0.iter().filter(|p| p[0] > 150 && p[1] < 100 && p[2] < 120 && p[3] == 255).count(); + let green = expected.pixels.as_chunks::<4>().0.iter().filter(|p| p[0] < 100 && p[1] > 120 && p[2] < 150 && p[3] == 255).count(); + assert!(red > 100 && green > 100, "INPUT: both original colored keys must really draw: red={red}, green={green}"); + if let (Some((_, previous)), Some(changed)) = (&retained.1, changed) { + damage_pixels(stage, changed, previous, &expected.pixels); + } + retained.1 = Some((doc.clone(), expected.pixels)); + actual +} + +fn move_and_undo(s: &mut Session, retained: &mut Retained, blend: NodeId, keys: [NodeId; 2], curved: bool, before_frame: &Rendered) { + assert_eq!(s.doc().unwrap().selection.objects, vec![blend]); + let before = serde_json::to_value(s.doc().unwrap().doc.as_ref()).unwrap(); + s.execute("object.transform", &json!({"matrix": [1.0, 0.0, 0.0, 1.0, 37.0, 29.0]})).unwrap(); + live(s, blend, keys, curved); + assert_eq!(s.doc().unwrap().selection.objects, vec![blend]); + let moved = frame(s, retained, "moved"); + assert!(moved.pixels != before_frame.pixels, "INPUT: the fresh rendered fixture must actually move"); + s.execute("edit.undo", &json!({})).unwrap(); + live(s, blend, keys, curved); + assert_eq!(serde_json::to_value(s.doc().unwrap().doc.as_ref()).unwrap(), before); + assert_eq!(s.doc().unwrap().selection.objects, vec![blend]); + let restored = frame(s, retained, "undo-move"); + same_pixels(&restored, before_frame); +} + +#[test] +fn blend_5179_straight_move_undo_matches_fresh_cpu() { + let (mut s, blend, keys) = fixture(); + let mut retained = (cpu(), None); + let warm = frame(&s, &mut retained, "warm"); + move_and_undo(&mut s, &mut retained, blend, keys, false, &warm); +} + +#[test] +fn blend_5179_replace_spine_move_undo_matches_fresh_cpu() { + let (mut s, blend, keys) = fixture(); + let path = NodeId(s.execute("path.create", &json!({"d": "M122 144 C166 330 402 288 462 144"})).unwrap()["id"].as_u64().unwrap()); + s.execute("select.set", &json!({"ids": [blend.0, path.0]})).unwrap(); + let before = serde_json::to_value(s.doc().unwrap().doc.as_ref()).unwrap(); + let nodes = s.doc().unwrap().doc.node_count(); + let mut retained = (cpu(), None); + let warm = frame(&s, &mut retained, "before-replace"); + s.execute("object.blend.replaceSpine", &json!({})).unwrap(); + live(&s, blend, keys, true); + assert!(s.doc().unwrap().doc.node(path).is_none(), "Replace Spine consumes the original standalone path"); + assert_eq!(s.doc().unwrap().doc.node_count(), nodes - 1); + assert_eq!(s.doc().unwrap().selection.objects, vec![blend]); + let replaced = frame(&s, &mut retained, "replaced"); + assert!(replaced.pixels != warm.pixels, "INPUT: replacing the spine must visibly change the drawn fixture"); + move_and_undo(&mut s, &mut retained, blend, keys, true, &replaced); + s.execute("edit.undo", &json!({})).unwrap(); + live(&s, blend, keys, false); + assert_eq!(serde_json::to_value(s.doc().unwrap().doc.as_ref()).unwrap(), before); + let restored = frame(&s, &mut retained, "undo-replace"); + same_pixels(&restored, &warm); +} diff --git a/crates/render/src/fx/bounds.rs b/crates/render/src/fx/bounds.rs index 6fbd9f37ac..305c00de46 100644 --- a/crates/render/src/fx/bounds.rs +++ b/crates/render/src/fx/bounds.rs @@ -487,6 +487,12 @@ fn cull_bounds_in(symbols: &SymbolBoxes, n: &Node, after_reshape: bool) -> Optio let a = art_effects_reach(symbols, n); Some(b.inflate(a, a)) } + // A spine can rotate a blend's keys and steps past their unrotated visual bounds. + NodeKind::Blend { .. } => { + let b = n.reach_bounds_with(symbols)?; + let a = live_content_reach(symbols, n); + Some(b.inflate(a, a)) + } _ => { let b = n.visual_bounds_with(symbols)?; let b = match &n.kind { @@ -545,10 +551,14 @@ pub(crate) fn with_own_raster_reach(symbols: &SymbolBoxes, n: &Node, b: Rect) -> b.inflate(o, o) } -/// `n`'s own visual box, type's grown to hold its glyphs ([`glyphs_box`]): what it draws when its -/// object effects leave it as it is (Revolve builds no art from type). +/// `n`'s own box, type's grown to hold its glyphs ([`glyphs_box`]) and a blend's to hold its +/// spine-placed keys and steps: what it draws when its object effects leave it as it is +/// (Revolve builds no art from type). fn own_box(symbols: &SymbolBoxes, n: &Node) -> Option { - let b = n.visual_bounds_with(symbols)?; + let b = match &n.kind { + NodeKind::Blend { .. } => n.reach_bounds_with(symbols), + _ => n.visual_bounds_with(symbols), + }?; Some(match &n.kind { NodeKind::Text(t) => vectorcraft_geom::union_opt(Some(b), glyphs_box(t, n.appearance.outset())).unwrap_or(b), _ => b, diff --git a/docs/gaps.md b/docs/gaps.md index 782d6a27b8..e9a48b5f15 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -2,6 +2,8 @@ > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** 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: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; 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; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> Blend redraw update (#5179): renderer bounds include spine-placed keys and steps; both focused CPU regressions pass. Scores and estimates unchanged. + ## Feature submission evidence **Feature evidence last updated:** 2026-11-03. @@ -309,6 +311,8 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G11 Correctness bugs in core tools +- **Resolved redraw-bounds defect (#5179):** a curved-spine blend's renderer bounds include its rotated keys and steps after Replace Spine; `crates/engine/tests/blend_render_consistency.rs` keeps the straight-blend control and checks all changed pixels against the advertised area. Both focused CPU regressions pass; broader G11 scope and estimates unchanged. + - **Export-only improvement (#6309):** PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. Broader G11 scope, scores and estimates unchanged. - **Done, deletion only (#3380):** deleting anchors or segments that disconnect an ordinary contour creates independent selected path objects, preserving appearance, baked transforms, sibling order and one-step Undo/Redo. Existing multi-subpath paths and compound members stay intact. A second Delete removes all selected survivors. Bounds-fitted gradients keep their original placement on the new objects; already placed gradients stay unchanged. Segment endpoint highlighting remains open; broader G11 scope, scores and estimates are unchanged. Evidence: `crates/engine/tests/it/delete_path_pieces.rs` and the Delete/Backspace frame regression in `crates/ui-egui/src/tests/removeanchors.rs`. @@ -867,6 +871,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | Date | Change | Summary | |---|---|---| | 2026-11-12 | minor | Explicit editing-data import keeps a single artboard beyond a capped 14,400 pt PDF page (#6865), with a warning; automatic mode stays unchanged. Scores and estimates unchanged. | +| 2026-11-12 | minor | Blend redraw (#5179): renderer bounds include spine-placed keys and steps. Original straight and curved Replace Spine, move and Undo CPU regressions pass; scores and estimates unchanged. | | 2026-11-09 | minor | G4 review (#6084): positional variants no supported feature draws can be applied as glyph choices in both Glyphs views; unlisted glyphs still respect name ownership. OpenType style options keep only a valid last on-value when enabling a set. Existing contextual/ligature lookup and unsupported-feature gaps remain; estimate unchanged. | | 2026-11-07 | minor | G4: the Glyphs panel's Alternates for Current Selection applies the OpenType feature that draws a variant to that letter alone (`salt=2`; the style commands take `tag=N`; runs that differ only in their features shape as one piece of text), so an Arabic word stays joined, and Show › Entire Font lists the unencoded glyphs (#5514). Estimate unchanged. | | 2026-11-12 | minor | G11: numeric fields keep the caret when a focus click is released more than 1 pt from its press; a tap within 1 pt still selects the whole value (#6659, follow-up to #1326); short-drag and jitter-tap regressions in `tests/numfields.rs`; estimates unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index 4c78d258c9..a834302e91 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -10,6 +10,8 @@ > > Numeric spinner update (2026-11-10): held mouse arrows repeat past the click timeout; scores and estimates unchanged (#6307). +> Blend redraw update (#5179): renderer bounds include spine-placed keys and steps; both focused CPU regressions pass. Scores and estimates unchanged. + ## Feature submission evidence M4: Explicitly requested editing data keeps a single artboard larger than its 14,400 pt capped PDF page (#6865). Scores and estimates unchanged. @@ -152,7 +154,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | | M6 | Path operations (Pathfinder, Shape Builder, offset…) | ✅ mostly done (live compound shapes: Make, Alt-click a Shape Mode, member modes, Release, Expand (#4522); single-result Pathfinder names and SVG IDs retained (#1293); Divide open-cutting-path geometry, appearance and history verified (#1307; existing segment cap remains); Simplify preview/counts and rewritten-path component selection verified (#1272; the slider opens at the Auto-Simplify level; a Direct Selection part of a path simplifies on its own); Compound appearance and member fill-rule edits verified (#1197); Boolean precision on almost-horizontal edges fixed and the property tests made deterministic; Shape Builder gap detection, large-offset bug open); Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog | 3–6 | | M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof and the custom dictionary and Ignore All commands and Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, and Spelling › Auto Spell Check in the context menu of type, and the Edit Custom Dictionary dialog (#4936; the Check Spelling dialog remains); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs (feature-valued alternates and unencoded glyphs applied in one Undo step while keeping Arabic joining, #5514), OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, spell check, vertical type pending | 45–60 | -| M8 | Transform & distort (Puppet Warp, Liquify tools, Envelopes, Blends, Perspective Grid) | ✅ done (M8.1–M8.20 on 2026-10-06, fidelity pass): Liquify Tool Options with one shared brush, pen pressure, hold-to-apply, a safe scope and incremental strokes; tool options that last; Puppet Warp rotation, multi-select, Control bar and a rest-shape session that follows Undo; Width tool on compound paths; Envelope dialogs with preview, Reset with Warp/Mesh, full Envelope Options, type/images/symbols/appearance/gradients/patterns distorted on canvas and in every export, warps that keep their frame, Edit Contents, mesh handles and Control bar; Blend Options, anchor-targeted Blend tool, editable spine, keys picked on the canvas, faithful interpolation and knockout; Anchor Point spine conversion/handle editing and selection priority (#2544), with #2425 Shift reshape preserved; Perspective Grid with Define Grid, presets, lock/snap/rulers, widgets, the 1–4 plane switch, movable planes, Perspective Selection scale/copy/perpendicular/Transform Again, and type and symbols truly projected with Edit Text. Left: Anti-Alias and Preserve Shape output, warp-envelope point editing, brush interpolation in blends, Free Transform/Scale/Reflect along a rotated box | 2–4 | +| M8 | Transform & distort (Puppet Warp, Liquify tools, Envelopes, Blends, Perspective Grid) | ✅ done (M8.1–M8.20 on 2026-10-06, fidelity pass): Liquify Tool Options with one shared brush, pen pressure, hold-to-apply, a safe scope and incremental strokes; tool options that last; Puppet Warp rotation, multi-select, Control bar and a rest-shape session that follows Undo; Width tool on compound paths; Envelope dialogs with preview, Reset with Warp/Mesh, full Envelope Options, type/images/symbols/appearance/gradients/patterns distorted on canvas and in every export, warps that keep their frame, Edit Contents, mesh handles and Control bar; Blend Options, anchor-targeted Blend tool, editable spine, keys picked on the canvas, faithful interpolation and knockout; Anchor Point spine conversion/handle editing and selection priority (#2544), with #2425 Shift reshape preserved; Perspective Grid with Define Grid, presets, lock/snap/rulers, widgets, the 1–4 plane switch, movable planes, Perspective Selection scale/copy/perpendicular/Transform Again, and type and symbols truly projected with Edit Text. Left: Anti-Alias and Preserve Shape output, warp-envelope point editing, brush interpolation in blends, Free Transform/Scale/Reflect along a rotated box; #5179 curved-spine redraw bounds include rotated keys and steps (two focused CPU regressions) | 2–4 | | M9 | Live effects (+ 3D & Materials) | 🟡 2D effects done incl. Effect → Pathfinder, Color Adjustments and Document Raster Effects Settings; PDF export warns when the pixel cap lowers raster-effect resolution; Artistic › Colored Pencil, Cutout, Dry Brush, Film Grain, Fresco, Neon Glow, Paint Daubs, Palette Knife, Poster Edges, Rough Pastels, Smudge Stick, Sponge, Underpainting and Watercolor and Sketch › Halftone Pattern, Bas Relief, Charcoal, Conté Crayon, Photocopy, Stamp, Torn Edges and Water Paper done (57/57 Photoshop filters); Revolve with automatic smooth vector shading, default-on circular caps and continuous rims, Extrude & Bevel, Inflate and Rotate with one to ten colored directional lights and four original lighting presets; SVG Filters, remaining raster effects and 3D materials and shadows pending | 81–130 | | M10 | Brushes, symbols, patterns, Repeat | 🟡 pattern swatches (5 tile types, Pattern Options, editing mode, SVG ``/PDF export) and live Repeat (radial/grid/mirror) done; interactive selected mirror axis implemented (focused and native checks passed; full CI blocked by an unrelated text test); symbol libraries done (Window › Symbol Libraries, five generated libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons), User Defined, Other Library…, Save Symbols); brush libraries done (Window › Brush Libraries, nine generated libraries including Ink and Wash, Bristle Brushes and Dry Media, User Defined, Other Library…, Save Brushes); symbol editing shows draggable 9-slice guides (#5280), with guides outside the artwork still unsupported; brushes/symbols in progress | 23–37 | | M11 | Artboards & views (selected-set deletion shared by Artboards menu, trash and Properties, retaining artboard 1 when all are selected; Artboard deletion keys keep the first of an all-selected set and protect artwork; history prunes invalid indices while preserving valid multiselection (history tests and full workspace CI pass); click-to-fit objects with the Artboard tool (#1227), artboard escape routing and document setup modal handoff done; artboard panel/tool with Move Artwork for X/Y fields and Artboard Options, Trim View, middle-button pan, print tiling and the status bar's artboard navigator with synchronized Artboard tool selection done; Window › Arrange › Tile and Consolidate All Windows done; multiple windows, presentation polish) (cached canvas reprojection preserves scale during resize, rotation and DPI changes; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) (cached canvas dimensions match the renderer limit before cache-key creation, view construction and worker submission; regression-tested; estimates unchanged); status-bar pointer coordinates follow the active ruler origin and General units | 🟡; Artboard Options shares existing presets and orientation controls and can fit artwork without moving it; artwork fitting includes all drawn document art across artboards and off-board; artwork bounds are cached by active document and revision, and selection uses the shared bounds cache across artboards | 15–25 | @@ -200,6 +202,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | 2026-11-12 | minor | M14: numeric fields keep the caret when a focus click is released more than 1 pt from its press; a tap within 1 pt still selects all (#6659, follow-up to #1326); estimates unchanged. | | 2026-11-12 | minor | M12: Live Paint Bucket fills faces crossed in one drag (#6373). Scores and estimates unchanged. | | 2026-11-12 | minor | Save refusal follow-up (#6146): changed format opens its Save options; unchanged format retains original options. Focused UI regressions passed, including the format-change case that failed before the fix; native panel acceptance pending. Scores and estimates unchanged. | +| 2026-11-12 | minor | Blend redraw (#5179): renderer bounds include spine-placed keys and steps. Original straight and curved Replace Spine, move and Undo CPU regressions pass; scores and estimates unchanged. | | 2026-11-11 | minor | Eyedropper copies effective character dimensions between transformed text objects (#6404); scores and estimates unchanged. | | 2026-11-11 | minor | Ordinary Save to a location refusing writes offers Save As (#6146); cancellation preserves the original path and modified state; automation receives READ_ONLY_LOCATION. Scores and estimates unchanged. Validation pending. | | 2026-11-11 | minor | M10/G5: Energy Beams built-in brush library; MCP docs catch-up; estimates unchanged | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e2f536bdeb..4566d7ee41 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -12,6 +12,8 @@ > > **Flyout update:** 2026-11-06 — resizable icon-strip flyouts and bottom-aligned panel footers (#5713); scores and estimates unchanged. +> Blend redraw update (#5179): renderer bounds include spine-placed keys and steps; both focused CPU regressions pass. Scores and estimates unchanged. + ## Feature submission evidence EPS embedded fonts, 2026-11-09 (#6023–#6067): the fonts an EPS carries draw their glyphs instead of being set as type in an installed font: composite (Type 0) fonts with the 8/8 mapping, plain Type 42 fonts (characters from their glyph names or character map, widths from the font), CID-keyed fonts over CMaps (Type 0 and Type 2 CIDFonts, CIDFonts in a FontSet's Compact Font Format data, base-font CMaps, named CIDFonts over predefined Unicode CMaps set as type) and embedded Type 1 fonts; the show operators' spacing along the baseline is kept as tracking, `kshow` included. Each step is charged to the interpreter's budgets. Hand-written test files only (no corpus file uses these fonts); scores and estimates unchanged. Evidence: `crates/eps/src/import/tests_composite.rs`, `tests_type42.rs`, `tests_cid.rs`, `tests_type1.rs`; details in [file-format-parity.md](file-format-parity.md). @@ -231,7 +233,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | 3D and Materials (and Turntable) | 4 | ~25% | live Revolve with automatic smooth vector shading and default-on continuous circular caps, Extrude & Bevel (twist, taper, caps, five bevel shapes), Inflate and Rotate with Position presets (colored Inflate uses smooth membrane lighting; white-light Inflate retains its existing shading; Extrude & Bevel and Rotate retain planar shading; one to ten colored lights, shared neutral ambient, painter visibility); materials, light presets, shadows, ray tracing, the rest of 3D Classic (Rotate, Map Art), Turntable views, textures, map art and shading in 3D export | 30–55 | estimated (Extrude & Bevel, Inflate and Rotate added 2026-10-12) | | Type core | 9 | 80% | Auto-leading style resets are implemented; Hyphenation… and Justification… options are done (#2310, #2755), and a paragraph's Auto Leading also sets the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; remaining: Optical Margin Alignment, Middle Eastern features beyond bidi layout, optional group font-size preservation; transformed character controls fixed (#1034), see [type-parity.md](type-parity.md) | 14–19 | estimated; eleven-language pattern hyphenation in both composers, with grapheme and shaping-cluster protection (#4947, `hyphen::tests` and `layout::wrapping_tests`); Sanskrit patterns pending an allowlisted source; recent-font groups in font pickers (#3515); full-name font matches regression-tested (#1258); mixed paragraph alignment indication implemented; headless regressions, full integration CI and visual review pass; localized legacy family-name fallback with loaded/catalog regressions (#2208); Fractional Widths per type object regression-tested; color emoji fonts with bitmap glyphs (`sbix`, `CBDT`) draw and export; threading ports: every selected area type and type on a path shows its in and out ports (empty, arrow, red "+"), and the Selection tool threads from either, the in port into a frame before it, and a double-click on a threaded port breaks the thread there (`threads::tests::break_splits_the_thread_and_the_story_flows_into_the_first_part`, `select::tests::a_double_click_on_a_threaded_port_breaks_the_thread`, `canvas::tests::a_double_click_on_a_threaded_out_port_breaks_the_thread`) (#2572; `select::tests::a_click_on_the_in_port_threads_into_a_frame_before_it`, `text::tests::selected_type_shows_its_ports_in_each_state`, `threads::tests::add_before_threads_the_story_from_the_new_frame_into_the_clicked_one`, live screenshot); the Glyphs panel highlights and scrolls to the character selected with the Type tool (#4908, `panels::glyphs` tests); the OpenType panel lists only `ss01`–`ss20` sets present in the selected font and uses its custom names when supplied; Type-range desktop Copy publishes styled art and keeps font family, size and color on canvas Paste after editing (#5636); paint-only Arabic harakat keep joining with conditional GDEF-mark ownership and Insert Kashidas base-letter paint (`tests::harakat`) | | Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (ruby, mojikumi), variable font axes, tab leaders, spell check (engine, custom dictionary and Auto Spell Check with its right-click suggestions and Spelling › Auto Spell Check, and the Edit Custom Dictionary dialog done, #4936; the Check Spelling dialog remains), Touch Type, Retype | 20–28 | estimated; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | -| Symbols, blends, envelopes, Repeat, perspective | 5 | 88% | remaining: dynamic symbols' `.ai` round trip, further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons and Skill Icons are done), envelope Anti-Alias/Preserve Shape, 9-slice guides outside the art; Symbol Options › Registration, Export Type (Graphic / Movie Clip) and 9-slice guides (drawn and draggable during symbol editing, #5280) and Symbol Type (dynamic on-canvas fill/stroke including gradient/pattern, opacity and blend, #4938) are done | 4–7 | estimated; Blend panel Type and Ramp control step easing with a separate color Shift (#2539); Blend Options retains spacing and orientation; polynomial curves are original approximations; interactive selected mirror axis implemented; bounding-box handles take priority over the axis line (focused regression and native checks passed; full CI blocked by an unrelated text test); #2544 spine Anchor Point conversion and picking regression-tested | +| Symbols, blends, envelopes, Repeat, perspective | 5 | 88% | remaining: dynamic symbols' `.ai` round trip, further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons and Skill Icons are done), envelope Anti-Alias/Preserve Shape, 9-slice guides outside the art; Symbol Options › Registration, Export Type (Graphic / Movie Clip) and 9-slice guides (drawn and draggable during symbol editing, #5280) and Symbol Type (dynamic on-canvas fill/stroke including gradient/pattern, opacity and blend, #4938) are done | 4–7 | estimated; Blend panel Type and Ramp control step easing with a separate color Shift (#2539); Blend Options retains spacing and orientation; polynomial curves are original approximations; interactive selected mirror axis implemented; bounding-box handles take priority over the axis line (focused regression and native checks passed; full CI blocked by an unrelated text test); #2544 spine Anchor Point conversion and picking regression-tested; #5179 curved-spine redraw bounds include rotated keys and steps (two focused CPU regressions) | | Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (ruby, mojikumi), tab leaders, spell check (engine, custom dictionary and Auto Spell Check with its right-click suggestions and Spelling › Auto Spell Check, and the Edit Custom Dictionary dialog done, #4936; the Check Spelling dialog remains), Touch Type, Retype | 20–28 | estimated; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | | Symbols, blends, envelopes, Repeat, perspective | 5 | 88% | remaining: dynamic symbols' `.ai` round trip, further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, and Map Markers are done), envelope Anti-Alias/Preserve Shape, 9-slice guides outside the art; Symbol Options › Registration, Export Type (Graphic / Movie Clip) and 9-slice guides (drawn and draggable during symbol editing, #5280) and Symbol Type (dynamic on-canvas fill/stroke including gradient/pattern, opacity and blend, #4938) are done | 4–7 | estimated; Blend panel Type and Ramp control step easing with a separate color Shift (#2539); Blend Options retains spacing and orientation; polynomial curves are original approximations; interactive selected mirror axis implemented; bounding-box handles take priority over the axis line (focused regression and native checks passed; full CI blocked by an unrelated text test); #2544 spine Anchor Point conversion and picking regression-tested | | Image Trace, graphs, image tools | 3 | 75% | graph Column designs, Image Trace Create Strokes depth (Create Object Mosaic is done; junction-returning piece survival has source-generated regressions in `image-trace-quality.md`; simpler contour walk, identical output; an edge's sub-pixel shift is the same from either side; notches read only their own piece; collapsed loops keep few segments, so Paths is monotone on the code-drawn sweep) | 5–8 | estimated (raised from 72%); quick presets reveal adjustment controls, Properties reopens them; Live trace result bounds and selection highlights exclude the retained bitmap except in source-image views (scores/hours unchanged) | @@ -559,6 +561,8 @@ since 2026-10-01. ## Evidence: what ships today, by area +- **Blend redraw bounds (#5179):** renderer bounds include the reach of keys and steps rotated along a curved spine, so changed pixels remain inside the advertised redraw area. The original straight-blend control and curved Replace Spine, move and Undo regressions are in `crates/engine/tests/blend_render_consistency.rs`; both focused CPU cases pass. This is a redraw-bounds correction. Scores and hours unchanged. + - **Save refusal (#6146):** ordinary File > Save to its own location offers Save As after a terminal permission/read-only refusal, suggesting the original name and format, preserving options for the unchanged format and opening the chosen format’s Save options on a change. Cancel keeps the failed-save state. Busy pickers, recovery-copy errors, other failures, explicit destinations and Close/Quit keep the existing dialog. Engine, UI and MCP regression cases are in `cmd/fileio/tests_readonly.rs`, `io/tests_read_only_save.rs` and MCP `tests/fileio.rs`; focused UI regressions passed; engine regression execution and native panel acceptance pending. Scores and hours unchanged. - **PDF authored replacement text (#6165):** `crates/pdf/src/tests/actual_text.rs` covers replacement once with suffix placement, PDF text-string decoding, empty and nested owners, sibling spans, page reset, multiple text-show operations, style/line changes, fill-and-stroke, reader windows and bounded input. Authored logical-order stretches are protected while adjacent ordinary text still undergoes reconstruction. The replacement takes its first placed glyph's style and line; its characters are not redistributed over later lines/styles. Exact mixed-direction paragraph layout is not claimed. No export changes; scores and hours stay at 75% / 10–20 h. @@ -2144,6 +2148,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | 2026-11-12 | minor | `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints (its strokes' miter tips, and strokes a Transform effect moves, included), after its glyphs grown by half its strokes' weight; `.ai` import evidence updated (#6824); scores and estimates unchanged. | | 2026-11-12 | minor | Explicit editing-data import keeps a single artboard beyond a capped 14,400 pt PDF page (#6865), with a warning; automatic mode stays unchanged. Scores and estimates unchanged. | | 2026-11-12 | minor | Glyphs review (#6084): Entire Font uses the selection's version and variable axes for previews and alternate applicability. The default cell can reset an unlisted glyph choice when GSUB lists no alternates. Encoded Latin and other ordinary characters insert unchanged even if their glyph also has Arabic positional provenance; Arabic presentation forms retain base-letter insertion. Remove a redundant charmap scan from unlisted-glyph checks. Scores and estimates unchanged. | +| 2026-11-12 | minor | Blend redraw (#5179): renderer bounds include spine-placed keys and steps. Original straight and curved Replace Spine, move and Undo CPU regressions pass; scores and estimates unchanged. | | 2026-11-09 | minor | Glyphs review (#6084): positional alternates with no supported feature are accepted as glyph choices in both panel views; Entire Font's unlisted-glyph and name-ownership behavior is retained. OpenType style options keep only a valid last on-value when enabling a set. Contradictory old glyph-choice evidence corrected; scores and estimates unchanged. | | 2026-11-07 | minor | Type core: the Glyphs panel's Alternates for Current Selection applies the OpenType feature that draws a variant to the selected letter alone, so an Arabic word stays joined (`salt=2`; the style commands take `tag=N`), and Show › Entire Font lists the glyphs no character maps (#5514; [Replace characters with alternate glyphs](https://helpx.adobe.com/illustrator/desktop/design-with-text/special-characters-glyphs/replace-characters-with-alternate-glyphs.html)); evidence added; scores unchanged. | | 2026-11-12 | minor | UI chrome: a numeric-field focus click released more than 1 pt from its press keeps the caret; a tap within 1 pt still selects the whole value (#6659, follow-up to #1326); scores and hours unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index dfd840081e..5ea253c507 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -6,6 +6,8 @@ > > Numeric spinner update (2026-11-10): held mouse arrows repeat past the click timeout; scores and estimates unchanged (#6307). +> Blend redraw update (#5179): renderer bounds include spine-placed keys and steps; both focused CPU regressions pass. Scores and estimates unchanged. + > **Flyout update:** 2026-11-06 — resizable icon-strip flyouts and bottom-aligned panel footers (#5713); scores and estimates unchanged. ## Feature submission evidence @@ -168,6 +170,7 @@ tools, never checked side by side) isn't captured row by row. | Layers panel lists a blend's spine (#4820) | done | an open blend shows a `` row below its key objects, where Release leaves the spine; a click selects the blend (Shift/Cmd toggles it) so Direct Selection edits the spine; a locked blend's row selects nothing; no row while searching or filtering (`a_blends_spine_is_a_row_below_its_keys_that_selects_the_blend`) | | Layers panel: a layer whose Layer Options › Print is off shows its name italic (#5739) | done | the panel row and its drag ghost; a printing layer stays upright, and Print on again restores it; `panels::layers` test `a_layer_that_does_not_print_has_its_name_italic` | | Blend spine Anchor Point conversion and handle editing (#2544) | implemented | symmetric handles, independent drag/retraction, visible-handle policy and selection/stacking covered by tool and engine regressions; Windows native canvas checks and screenshots reviewed in PR #2643 | +| 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 doesn't pick spine points yet | | 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 | | Pencil: Fidelity, Keep selected, Alt to Smooth, edit selected paths, close by proximity | done | Fidelity goes down to 0.01 pt in the dialog, the tool and `path.freehand` (the Smooth tool keeps 0.05); its slider runs across the Tool Options row on a logarithmic rail from 0.01 to 20 pt, the field shows hundredths, and the slider's and the field's arrow keys step hundredths up to 0.1 pt, tenths up to 1 pt and whole points 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 while Shift or Alt is held before the press, and a path-continuation cursor over an end of a selected open path, where the line continues the path; 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, the Pencil and the Paintbrush show the closing cursor, and a release there closes the path | @@ -531,6 +534,7 @@ before release (#6373). [Paint faces and edges](https://helpx.adobe.com/illustra | 2026-11-12 | minor | Remove Background for a selected image in the Contextual Task Bar, Properties › Quick Actions and the Control bar, which runs at once with its defaults. Scores and estimates unchanged. | | 2026-11-12 | minor | Live Paint Bucket fills faces crossed in one drag (#6373). Scores and estimates unchanged. | | 2026-11-12 | minor | Save refusal follow-up (#6146): changed format opens its Save options; unchanged format retains original options. Focused UI regressions passed, including the format-change case that failed before the fix; native panel acceptance pending. Scores and estimates unchanged. | +| 2026-11-12 | minor | Blend redraw (#5179): renderer bounds include spine-placed keys and steps. Original straight and curved Replace Spine, move and Undo CPU regressions pass; scores and estimates unchanged. | | 2026-11-11 | minor | Ruler origin: the corner drag snaps as a drawn point does, onto the art's and the artboards' anchors, centres, edges and paths, and with Snap to Point along the ruler guides; scores and estimates unchanged | | 2026-11-11 | minor | macOS canvas cursor delivery (#2292): while the host owns the cursor it sets it again on every pass, so the tool's cursor stays after the pointer moves (#6362); `mac_cursor` ownership test updated; scores and estimates unchanged. | | 2026-11-11 | minor | Eyedropper copies effective character dimensions between transformed text objects (#6404); scores and estimates unchanged. | From 5401288918d7088d50ae36a99e687ff072da4bb9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 14:09:35 -0800 Subject: [PATCH 006/158] Artboard tool: edge buttons show a tooltip Resting the pointer on an Artboard tool edge button now shows a tooltip after egui's usual delay: "Click to add an artboard on this side; Alt-click to duplicate this artboard with its art", or on a locked artboard, where an Alt-click does nothing, "Click to add an artboard on this side". The wording is VectorCraft's own. Tools can attach hover text to an overlay region with the new Overlay::HoverText (a disc in document units, drawn as nothing). The canvas puts a hover-only widget over each region, so the canvas keeps every click and drag, and shows the translated text while the pointer is inside the disc, no canvas drag is under way and no pointer button is down. A button hidden for lack of room, during a drag or with several artboards selected has no region, so no tooltip. Both strings have rows in every complete catalog, checked by a new i18n test, since the tl! scan does not read the tools crate. --- crates/tools/src/lib.rs | 4 ++ crates/tools/src/xform.rs | 2 +- crates/tools/src/xform/artboard.rs | 11 +++- crates/tools/src/xform/artboard/tests.rs | 38 +++++++++++ crates/ui-egui/src/canvas.rs | 5 +- crates/ui-egui/src/canvas/overlays.rs | 23 +++++++ crates/ui-egui/src/canvas/tests.rs | 84 ++++++++++++++++++++++++ crates/ui-egui/src/i18n/bg.tsv | 2 + crates/ui-egui/src/i18n/bs.tsv | 2 + crates/ui-egui/src/i18n/ca.tsv | 2 + crates/ui-egui/src/i18n/cs.tsv | 2 + crates/ui-egui/src/i18n/da.tsv | 2 + crates/ui-egui/src/i18n/de.tsv | 2 + crates/ui-egui/src/i18n/el.tsv | 2 + crates/ui-egui/src/i18n/es.tsv | 2 + crates/ui-egui/src/i18n/fi.tsv | 2 + crates/ui-egui/src/i18n/fr.tsv | 2 + crates/ui-egui/src/i18n/hi.tsv | 2 + crates/ui-egui/src/i18n/hu.tsv | 2 + crates/ui-egui/src/i18n/id.tsv | 2 + crates/ui-egui/src/i18n/it.tsv | 2 + crates/ui-egui/src/i18n/ja.tsv | 2 + crates/ui-egui/src/i18n/ka.tsv | 2 + crates/ui-egui/src/i18n/ko.tsv | 2 + crates/ui-egui/src/i18n/nl.tsv | 2 + crates/ui-egui/src/i18n/pl.tsv | 2 + crates/ui-egui/src/i18n/pt-br.tsv | 2 + crates/ui-egui/src/i18n/ru.tsv | 2 + crates/ui-egui/src/i18n/sv.tsv | 2 + crates/ui-egui/src/i18n/tests.rs | 12 ++++ crates/ui-egui/src/i18n/tr.tsv | 2 + crates/ui-egui/src/i18n/uk.tsv | 2 + crates/ui-egui/src/i18n/vi.tsv | 2 + crates/ui-egui/src/i18n/zh-hans.tsv | 2 + crates/ui-egui/src/i18n/zh-hant.tsv | 2 + docs/target-app-parity.md | 1 + 36 files changed, 230 insertions(+), 4 deletions(-) diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index d46a7fd972..bb8335a5b1 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -92,6 +92,10 @@ pub enum Overlay { Swatch { p: Point, color: [u8; 4], selected: bool }, /// A hairline in a translucent colour (perspective gridlines), RGBA. GridLine { a: Point, b: Point, color: [u8; 4] }, + /// Hover text for the disc of `radius` (document units) around `center`: while the pointer + /// rests there and nothing is being dragged, the UI shows `text`, an English UI string it + /// translates, as a tooltip. Nothing is drawn for it. + HoverText { center: Point, radius: f64, text: &'static str }, } /// What an IME's "delete the text around the cursor" counts: UTF-8 bytes (winit's raw diff --git a/crates/tools/src/xform.rs b/crates/tools/src/xform.rs index 915eb35e8a..21aab996de 100644 --- a/crates/tools/src/xform.rs +++ b/crates/tools/src/xform.rs @@ -18,7 +18,7 @@ use vectorcraft_geom::{BezPath, Point, Rect, Shape}; use crate::{Overlay, Tool}; -pub use artboard::ArtboardTool; +pub use artboard::{ArtboardTool, EDGE_BUTTON_TIP, EDGE_BUTTON_TIP_LOCKED}; pub use eyedropper::EyedropperTool; pub use free::{DistortMode, FreeTransformTool}; pub use gradient::GradientTool; diff --git a/crates/tools/src/xform/artboard.rs b/crates/tools/src/xform/artboard.rs index 5af642c44b..cc4b0f52f3 100644 --- a/crates/tools/src/xform/artboard.rs +++ b/crates/tools/src/xform/artboard.rs @@ -28,7 +28,8 @@ //! no other artboard). Clicking one adds an empty artboard there (`artboard.new {beside, side}`); //! Alt-clicking duplicates the artboard with its art there (`artboard.duplicate {index, side}`), //! except on a locked artboard, where an Alt-click does nothing. Each is one undo step, and the new -//! artboard becomes the active one. +//! artboard becomes the active one. Resting the pointer on a button shows a tooltip that says what a +//! click does there and, on an unlocked artboard, what an Alt-click does. use serde_json::{Value, json}; use vectorcraft_doc::ArtboardSide; @@ -298,6 +299,10 @@ fn bleed_offset(cx: &ToolContext, rect: Rect, handle: Handle) -> Vec2 { const EDGE_BUTTON_OFFSET: f64 = 18.0; /// The add button's radius in screen pixels: a press this near its center takes it. const EDGE_BUTTON_RADIUS: f64 = 7.0; +/// The add button's tooltip ([`Overlay::HoverText`]), an English UI string the UI translates. +pub const EDGE_BUTTON_TIP: &str = "Click to add an artboard on this side; Alt-click to duplicate this artboard with its art"; +/// The add button's tooltip on a locked artboard, where an Alt-click does nothing. +pub const EDGE_BUTTON_TIP_LOCKED: &str = "Click to add an artboard on this side"; impl ArtboardTool { /// The add buttons on the active artboard's edges, each with its side and center: shown while @@ -657,9 +662,11 @@ impl Tool for ArtboardTool { if self.drag.is_some() { o.extend(self.guides.iter().cloned()); } - // The add buttons: a ring with a plus in it. + // The add buttons: a ring with a plus in it, and a tooltip over the area a press takes. let (radius, arm) = (cx.tol(EDGE_BUTTON_RADIUS), cx.tol(3.5)); + let tip = if ab.locked { EDGE_BUTTON_TIP_LOCKED } else { EDGE_BUTTON_TIP }; for (_, at) in self.edge_buttons(cx) { + o.push(Overlay::HoverText { center: at, radius, text: tip }); let ring: Vec = (0..24).map(|k| at + Vec2::from_angle(f64::from(k) * std::f64::consts::TAU / 24.0) * radius).collect(); let mut path = polygon(&ring, true); for arm in [Vec2::new(arm, 0.0), Vec2::new(0.0, arm)] { diff --git a/crates/tools/src/xform/artboard/tests.rs b/crates/tools/src/xform/artboard/tests.rs index 98410703f6..20c3128176 100644 --- a/crates/tools/src/xform/artboard/tests.rs +++ b/crates/tools/src/xform/artboard/tests.rs @@ -611,6 +611,44 @@ fn add_buttons_hide_with_several_artboards_selected_or_during_a_drag() { assert!(button_sides(&t, &c).is_empty(), "none while an artboard is dragged"); } +/// The tooltips the add buttons carry: each one's center, radius and text. +fn button_tips(t: &ArtboardTool, c: &ToolContext) -> Vec<(Point, f64, &'static str)> { + t.overlays(c) + .into_iter() + .filter_map(|o| if let Overlay::HoverText { center, radius, text } = o { Some((center, radius, text)) } else { None }) + .collect() +} + +#[test] +fn each_add_button_has_a_tooltip_over_the_area_a_press_takes() { + let mut d = two_boards(); + let (s, p) = (Selection::default(), paint()); + let c = cx(&d, &s, &p); + let t = ArtboardTool::default(); + let radius = c.tol(EDGE_BUTTON_RADIUS); + let want: Vec<_> = t.edge_buttons(&c).into_iter().map(|(_, at)| (at, radius, EDGE_BUTTON_TIP)).collect(); + assert_eq!(want.len(), 3, "no button and no tooltip on the side without room"); + assert_eq!(button_tips(&t, &c), want); + // The tooltip's disc is the one a press takes. + for (at, r, _) in &want { + assert!(t.edge_button_at(&c, *at + Vec2::new(r * 0.99, 0.0)).is_some()); + assert!(t.edge_button_at(&c, *at + Vec2::new(r * 1.01, 0.0)).is_none()); + } + // None with several artboards selected or during a drag. + let several = ArtboardTool { active: 1, others: vec![0], ..Default::default() }; + assert!(button_tips(&several, &c).is_empty()); + let mut dragging = ArtboardTool::default(); + dragging.pointer(&c, &ev(PointerKind::Down, 700.0, 100.0)); + dragging.pointer(&c, &ev(PointerKind::Drag, 720.0, 100.0)); + assert!(button_tips(&dragging, &c).is_empty(), "none while an artboard is dragged"); + // A locked artboard's buttons tell only what a click does: an Alt-click does nothing there. + d.artboards[0].locked = true; + let c = cx(&d, &s, &p); + let tips = button_tips(&t, &c); + assert_eq!(tips.len(), 3); + assert!(tips.iter().all(|(_, _, text)| *text == EDGE_BUTTON_TIP_LOCKED), "{tips:?}"); +} + #[test] fn an_add_button_adds_an_empty_artboard_and_alt_duplicates_on_that_side() { let d = two_boards(); diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index a947dde852..e67b0e9e18 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -61,7 +61,9 @@ use outline::KEY_OUTLINE; use outline::{OVERLAY_MAX_ANCHORS, c32, node_outline, walk_drawn}; #[cfg(test)] use overlays::selected_anchor; -use overlays::{HandleLook, blend_widgets_overlay, draw_inside_overlay, draw_overlays, hover_highlight, ime_geometry, selection_overlay}; +use overlays::{ + HandleLook, blend_widgets_overlay, draw_inside_overlay, draw_overlays, hover_highlight, ime_geometry, overlay_hover_text, selection_overlay, +}; pub use panes::Panes; pub(crate) use panes::{consolidate, pane, tile, tiled_area}; use raster::{changed_pixels, pixel_region, upload}; @@ -410,6 +412,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let overlays = selection_visuals(app, &painter, &xf, (hidden_chars, selection_marks, hover_still), revolve_edit, view_info); draw_overlays(&painter, &xf, &overlays, &t, HandleLook::of(&app.session.prefs)); + overlay_hover_text(ui, &xf, &overlays, ui.data(|d| d.get_temp::(drag_id())).is_some()); if !revolve_edit { shaper_widget_overlay(app, &painter, &xf); crate::panels::three_d::paint_graphic_handles(app, &painter, &xf); diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index aefd9253e9..d2a9a54530 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -437,6 +437,29 @@ pub(super) fn draw_overlays(p: &egui::Painter, xf: &Xf, overlays: &[Overlay], t: p.circle_stroke(c, 8.0, Stroke::new(2.0, t.accent)); } } + // Shown as a tooltip by `overlay_hover_text`; nothing is drawn. + Overlay::HoverText { .. } => {} + } + } +} + +/// The tooltips of the tool's [`Overlay::HoverText`] regions. Each region is a hover-only widget +/// over the canvas, which keeps the clicks and drags; while the pointer rests inside a region's +/// disc, egui shows its text, translated, after its usual tooltip delay. No tooltip shows during a +/// canvas drag (`dragging`) or while a pointer button is down. +pub(super) fn overlay_hover_text(ui: &egui::Ui, xf: &Xf, overlays: &[Overlay], dragging: bool) { + let pressed = ui.input(|i| i.pointer.any_down()); + for (i, o) in overlays.iter().enumerate() { + let Overlay::HoverText { center, radius, text } = o else { continue }; + let c = xf.to_screen(*center); + let r = (*radius * xf.zoom) as f32; + if !(r.is_finite() && r > 0.0 && c.is_finite()) { + continue; + } + let id = egui::Id::unique("canvas-hover-text").with(i); + let resp = ui.interact(egui::Rect::from_center_size(c, vec2(2.0 * r, 2.0 * r)), id, egui::Sense::hover()); + if !dragging && !pressed && resp.hover_pos().is_some_and(|p| p.distance(c) <= r) { + resp.on_hover_text(crate::i18n::t(text)); } } } diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 666a1c8a62..4c30cad0f9 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -884,6 +884,90 @@ fn the_artboard_tool_names_its_active_artboard_once() { assert!((active[0].1 - other[0].1).abs() < 2.0, "on the artboard's top edge like the other name: {active:?} vs {other:?}"); } +/// The texts one headless 800 × 600 canvas frame at `time` seconds draws, tooltips included. +fn texts_at(app: &mut VectorcraftApp, ctx: &egui::Context, time: f64, events: Vec) -> Vec { + fn collect(shape: &Shape, texts: &mut Vec) { + match shape { + Shape::Text(t) => texts.push(t.galley.text().to_string()), + Shape::Vec(shapes) => shapes.iter().for_each(|s| collect(s, texts)), + _ => {} + } + } + let screen_rect = Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0))); + let mut out = ctx.run_ui(egui::RawInput { screen_rect, time: Some(time), events, ..Default::default() }, |ui| show(app, ui)); + out.textures_delta.clear(); + let mut texts = vec![]; + out.shapes.iter().for_each(|s| collect(&s.shape, &mut texts)); + texts +} + +/// The Artboard tool's add buttons: resting the pointer on one shows its tooltip after egui's +/// tooltip delay, over the disc a press takes and not beside it. No tooltip shows while a drag +/// is under way, or once the button is gone. +#[test] +fn an_artboard_add_button_shows_its_tooltip_while_the_pointer_rests_on_it() { + use egui::Event; + let tip = vectorcraft_tools::xform::EDGE_BUTTON_TIP; + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 100})).unwrap(); + app.select_tool("artboard"); + let ctx = egui::Context::default(); + texts_at(&mut app, &ctx, 0.0, vec![]); + let xf = Xf::new(app.canvas_rect.unwrap(), app.view().unwrap()); + // The bottom button: the one below the artboard. + let regions: Vec<(Pos2, f32)> = app + .session + .overlays(app.view_info()) + .into_iter() + .filter_map(|o| match o { + Overlay::HoverText { center, radius, text } if text == tip => Some((xf.to_screen(center), (radius * xf.zoom) as f32)), + _ => None, + }) + .collect(); + assert_eq!(regions.len(), 4, "one tooltip for each add button"); + let (at, r) = regions.iter().copied().max_by(|a, b| a.0.y.total_cmp(&b.0.y)).unwrap(); + assert!((r - 7.0).abs() < 1e-3, "the disc a press takes: {r}"); + let shown = |texts: &[String]| texts.iter().any(|s| s == tip); + // Resting inside the disc: nothing at first, the tooltip after the delay. + assert!(!shown(&texts_at(&mut app, &ctx, 1.0, vec![Event::PointerMoved(at + vec2(r - 1.0, 0.0))]))); + assert!(!shown(&texts_at(&mut app, &ctx, 1.05, vec![])), "egui's tooltip delay first"); + let mut seen = false; + for k in 1..=20 { + seen |= shown(&texts_at(&mut app, &ctx, 1.05 + 0.1 * f64::from(k), vec![])); + } + assert!(seen, "the tooltip shows while the pointer rests on the button"); + // Just outside the disc, inside the square around it: no tooltip. + let mut t = 4.0; + texts_at(&mut app, &ctx, t, vec![Event::PointerMoved(at + vec2(r - 1.0, r - 1.0))]); + for _ in 0..20 { + t += 0.1; + assert!(!shown(&texts_at(&mut app, &ctx, t, vec![])), "beside the button"); + } + // A middle-button drag that starts on the button pans the view with the pointer, so the pointer + // stays on the button: no tooltip while it lasts. + let middle = |pos, pressed| Event::PointerButton { pos, button: egui::PointerButton::Middle, pressed, modifiers: Default::default() }; + texts_at(&mut app, &ctx, t, vec![Event::PointerMoved(at)]); + t += 0.1; + texts_at(&mut app, &ctx, t, vec![middle(at, true)]); + let to = at + vec2(30.0, 0.0); + for _ in 0..20 { + t += 0.1; + assert!(!shown(&texts_at(&mut app, &ctx, t, vec![Event::PointerMoved(to)])), "during a drag"); + } + texts_at(&mut app, &ctx, t, vec![middle(to, false)]); + // With an artboard below, there is no room for the bottom button, and its tooltip goes with it. + let r0 = app.session.active().unwrap().doc.artboards[0].rect; + app.session.execute("artboard.new", &json!({"beside": 0, "side": "bottom"})).unwrap(); + assert_eq!(app.session.active().unwrap().doc.artboards[0].rect, r0); + let xf = Xf::new(app.canvas_rect.unwrap(), app.view().unwrap()); + let below = xf.to_screen(vectorcraft_geom::Point::new(r0.center().x, r0.y1)) + vec2(0.0, 18.0); + texts_at(&mut app, &ctx, t, vec![Event::PointerMoved(below)]); + for _ in 0..20 { + t += 0.1; + assert!(!shown(&texts_at(&mut app, &ctx, t, vec![])), "no tooltip where no button shows"); + } +} + #[test] fn shift_clicking_canvas_artboard_label_toggles_multi_selection() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 85bf31792e..5fe2fc7846 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -922,6 +922,8 @@ font-technology Variable Променливи Duplicate Дублиране Duplicate and Offset 10 pt Дублиране и отместване с 10 pt Duplicate Artboard Дублиране на работна област + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Щракнете, за да добавите работна област от тази страна, Alt-щракване дублира тази работна област заедно с графиката ѝ + Click to add an artboard on this side Щракнете, за да добавите работна област от тази страна Copy Artboard Копиране на работна област Cut Artboard Изрязване на работна област Rename Artboards Преименуване на работни области diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 4d757344a9..cda72b848b 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -4102,6 +4102,8 @@ axis Both Obje Show Prikaži Copy Width Point Kopiraj tačku širine Duplicate Artboard Dupliciraj radnu ploču + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Kliknite da dodate radnu ploču na ovu stranu, Alt-klik duplicira ovu radnu ploču s njenim crtežom + Click to add an artboard on this side Kliknite da dodate radnu ploču na ovu stranu Area / Path Type Tekst u području / na putanji Decrease Font Size Smanji veličinu fonta Decrease Font Size by Five Steps Smanji veličinu fonta za pet koraka diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 4ab4a2bfdc..0e4c753f98 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -1363,6 +1363,8 @@ antiAlias Sharp Nítid Duplicate Duplica Duplicate and Offset 10 pt Duplica i desplaça 10 pt Duplicate Artboard Duplica el tauler + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Fes clic per afegir un tauler en aquest costat i Alt+clic per duplicar aquest tauler amb la il·lustració + Click to add an artboard on this side Fes clic per afegir un tauler en aquest costat Duplicate Artboards Duplica els taulers Duplicate Brush Duplica el pinzell Duplicate Character Style Duplica l’estil de caràcter diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 6edd8ba3be..cafef15cae 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4158,6 +4158,8 @@ axis Both Obě Show Zobrazit Copy Width Point Kopírovat bod šířky Duplicate Artboard Duplikovat pracovní plochu + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Kliknutím přidáte pracovní plochu na tuto stranu, Alt+kliknutím duplikujete tuto pracovní plochu i s kresbou + Click to add an artboard on this side Kliknutím přidáte pracovní plochu na tuto stranu Area / Path Type Text v oblasti / na cestě Decrease Font Size Zmenšit velikost písma Decrease Font Size by Five Steps Zmenšit velikost písma o pět kroků diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 48a863cbfd..0fa669fb5b 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -3875,6 +3875,8 @@ axis Both Begge Show Vis Copy Width Point Kopiér breddepunkt Duplicate Artboard Duplikér tegneflade + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Klik for at tilføje en kunstplade på denne side, Alt-klik for at duplikere kunstpladen med dens grafik + Click to add an artboard on this side Klik for at tilføje en kunstplade på denne side Area / Path Type Arealtekst / kurvetekst Decrease Font Size Formindsk skriftstørrelse Increase Font Size Forøg skriftstørrelse diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 8fe1734165..0032065a23 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -924,6 +924,8 @@ font-technology Variable Variabel Duplicate Duplizieren Duplicate and Offset 10 pt Duplizieren und um 10 pt versetzen Duplicate Artboard Zeichenfläche duplizieren + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Klicken fügt auf dieser Seite eine Zeichenfläche hinzu, Alt-Klick dupliziert diese Zeichenfläche mit ihrem Bildmaterial + Click to add an artboard on this side Klicken fügt auf dieser Seite eine Zeichenfläche hinzu Copy Artboard Zeichenfläche kopieren Cut Artboard Zeichenfläche ausschneiden Rename Artboards Zeichenflächen umbenennen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 921eecb266..bc8996b468 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -894,6 +894,8 @@ font-technology Variable Μεταβλητές Duplicate Δημιουργία αντιγράφου Duplicate and Offset 10 pt Δημιουργία αντιγράφου με μετατόπιση 10 pt Duplicate Artboard Δημιουργία αντιγράφου πίνακα σχεδίασης + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Κλικ για προσθήκη πίνακα σχεδίασης σε αυτή την πλευρά, Alt-κλικ για αντίγραφο αυτού του πίνακα σχεδίασης μαζί με τα γραφικά του + Click to add an artboard on this side Κλικ για προσθήκη πίνακα σχεδίασης σε αυτή την πλευρά Copy Artboard Αντιγραφή πίνακα σχεδίασης Cut Artboard Αποκοπή πίνακα σχεδίασης Rename Artboards Μετονομασία πινάκων σχεδίασης diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index f3d98e0518..e42ba30994 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -937,6 +937,8 @@ font-technology Variable Variables Duplicate Duplicar Duplicate and Offset 10 pt Duplicar y desplazar 10 pt Duplicate Artboard Duplicar mesa de trabajo + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Clic para añadir una mesa de trabajo en este lado, Alt+clic para duplicar esta mesa de trabajo con su ilustración + Click to add an artboard on this side Clic para añadir una mesa de trabajo en este lado Copy Artboard Copiar mesa de trabajo Cut Artboard Cortar mesa de trabajo Rename Artboards Cambiar nombre de mesas de trabajo diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 8631ff3e0e..053ccb773b 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4082,6 +4082,8 @@ axis Both Molemmat Show Näytä Copy Width Point Kopioi leveyspiste Duplicate Artboard Monista piirtoalusta + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Lisää piirtoalusta tälle puolelle napsauttamalla, monista piirtoalusta kuvituksineen Alt-napsautuksella + Click to add an artboard on this side Lisää piirtoalusta tälle puolelle napsauttamalla Area / Path Type Alue- / polkuteksti Decrease Font Size Pienennä fonttikokoa Decrease Font Size by Five Steps Pienennä fonttikokoa viisi askelta diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 61854baa63..4223ce954c 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -940,6 +940,8 @@ font-technology Variable Variables Duplicate Dupliquer Duplicate and Offset 10 pt Dupliquer et décaler de 10 pt Duplicate Artboard Dupliquer le plan de travail + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Cliquez pour ajouter un plan de travail de ce côté, Alt+clic pour dupliquer ce plan de travail avec son illustration + Click to add an artboard on this side Cliquez pour ajouter un plan de travail de ce côté Copy Artboard Copier le plan de travail Cut Artboard Couper le plan de travail Rename Artboards Renommer les plans de travail diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index c99e152ce9..9a3ede918e 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -1523,6 +1523,8 @@ antiAlias Sharp शार्प Duplicate Anchors एंकर की प्रति बनाएँ Duplicate and Offset 10 pt डुप्लिकेट और ऑफ़सेट 10 pt Duplicate Artboard आर्टबोर्ड की प्रति बनाएँ + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art इस ओर आर्टबोर्ड जोड़ने के लिए क्लिक करें; इस आर्टबोर्ड की उसके आर्टवर्क सहित प्रति बनाने के लिए Alt-क्लिक करें + Click to add an artboard on this side इस ओर आर्टबोर्ड जोड़ने के लिए क्लिक करें Duplicate Artboards आर्टबोर्ड्स की प्रति बनाएँ Duplicate Brush डुप्लिकेट ब्रश Duplicate Character Style कैरेक्टर स्टाइल की प्रति बनाएँ diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 8dd19c2cd7..a0dfd6df4a 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -1218,6 +1218,8 @@ font-technology Variable Változó Duplicate Kettőzés Duplicate and Offset 10 pt Kettőzés és eltolás 10 pt-tal Duplicate Artboard Rajztábla kettőzése + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Kattintás: rajztábla hozzáadása ezen az oldalon, Alt+kattintás: a rajztábla kettőzése a grafikájával együtt + Click to add an artboard on this side Kattintás: rajztábla hozzáadása ezen az oldalon Duplicate Artboards Rajztáblák kettőzése Duplicate Brush Ecset kettőzése Duplicate Character Style Karakterstílus kettőzése diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 80b567db6c..d69032f83d 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3875,6 +3875,8 @@ axis Both Keduanya Show Tampilkan Copy Width Point Salin titik lebar Duplicate Artboard Duplikatkan artboard + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Klik untuk menambahkan artboard di sisi ini, Alt+klik untuk menduplikatkan artboard ini beserta karya seninya + Click to add an artboard on this side Klik untuk menambahkan artboard di sisi ini Area / Path Type Teks area / teks jalur Decrease Font Size Perkecil ukuran font Increase Font Size Perbesar ukuran font diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index fee7dbd594..2e896134bc 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -945,6 +945,8 @@ font-technology Variable Variabili Duplicate Duplica Duplicate and Offset 10 pt Duplica e sposta di 10 pt Duplicate Artboard Duplica tavola da disegno + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Fai clic per aggiungere una tavola da disegno su questo lato, Alt+clic per duplicare questa tavola da disegno con la sua grafica + Click to add an artboard on this side Fai clic per aggiungere una tavola da disegno su questo lato Copy Artboard Copia tavola da disegno Cut Artboard Taglia tavola da disegno Rename Artboards Rinomina tavole da disegno diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 16d873ee32..4fc97ceda1 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -1580,6 +1580,8 @@ antiAlias Sharp シャープ Drawing Mode 描画モード Duplicate 複製 Duplicate Artboard アートボードを複製 + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art クリックでこの辺にアートボードを追加、Alt+クリックでこのアートボードをアートワークごと複製 + Click to add an artboard on this side クリックでこの辺にアートボードを追加 Copy Artboard アートボードをコピー Cut Artboard アートボードをカット Rename Artboards アートボード名を変更 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 667f6ca4c4..281810197b 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -3696,6 +3696,8 @@ axis Both ორივე Show ჩვენება Copy Width Point სიგანის წერტილის კოპირება Duplicate Artboard სამუშაო დაფის დუბლირება + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art დაწკაპეთ ამ მხარეს სამუშაო დაფის დასამატებლად; Alt-დაწკაპეთ ამ სამუშაო დაფის ნახატთან ერთად დასადუბლირებლად + Click to add an artboard on this side დაწკაპეთ ამ მხარეს სამუშაო დაფის დასამატებლად Area / Path Type არის / ტრაექტორიის ტექსტი Decrease Font Size შრიფტის შემცირება Increase Font Size შრიფტის გაზრდა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 926bfb6f3f..52510d7e3d 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -1570,6 +1570,8 @@ antiAlias Sharp 날카롭게 Drawing Mode 그리기 모드 Duplicate 복제 Duplicate Artboard 아트보드 복제 + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art 클릭하여 이쪽에 아트보드 추가, Alt-클릭하여 이 아트보드를 아트워크와 함께 복제 + Click to add an artboard on this side 클릭하여 이쪽에 아트보드 추가 Copy Artboard 아트보드 복사 Cut Artboard 아트보드 잘라내기 Rename Artboards 아트보드 이름 바꾸기 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 9152ecb3ec..2bc397359d 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4391,6 +4391,8 @@ axis Both Beide Show Tonen Copy Width Point Breedtepunt kopiëren Duplicate Artboard Tekengebied dupliceren + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Klik om aan deze kant een tekenbord toe te voegen, Alt-klik om dit tekenbord met zijn illustratie te dupliceren + Click to add an artboard on this side Klik om aan deze kant een tekenbord toe te voegen Area / Path Type Gebieds- / padtekst Decrease Font Size Tekengrootte verkleinen Increase Font Size Tekengrootte vergroten diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index ae2f4908c6..25266cf49b 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4000,6 +4000,8 @@ axis Both Obie Show Pokaż Copy Width Point Kopiuj punkt szerokości Duplicate Artboard Powiel obszar kompozycji + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Kliknij, aby dodać obszar kompozycji po tej stronie, kliknij z Alt, aby powielić ten obszar kompozycji wraz z grafiką + Click to add an artboard on this side Kliknij, aby dodać obszar kompozycji po tej stronie Area / Path Type Tekst akapitowy / na ścieżce Decrease Font Size Zmniejsz rozmiar czcionki Decrease Font Size by Five Steps Zmniejsz rozmiar czcionki o pięć kroków diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 3a0a6879e9..098ab09256 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -840,6 +840,8 @@ antiAlias Sharp Nítido Duotone Gradients Gradientes Duotônicos Duplicate Duplicar Duplicate Artboard Duplicar Mesa de Trabalho + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Clique para adicionar uma prancheta deste lado, Alt-clique para duplicar esta prancheta com sua arte + Click to add an artboard on this side Clique para adicionar uma prancheta deste lado Copy Artboard Copiar Mesa de Trabalho Cut Artboard Recortar Mesa de Trabalho Rename Artboards Renomear Mesas de Trabalho diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 44c8b914b9..b1ef9e9032 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -935,6 +935,8 @@ font-technology Variable Вариативные Duplicate Дублировать Duplicate and Offset 10 pt Дублировать и сместить на 10 пт Duplicate Artboard Дублировать монтажную область + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Щёлкните, чтобы добавить монтажную область с этой стороны; щёлкните с Alt, чтобы дублировать эту монтажную область вместе с графикой + Click to add an artboard on this side Щёлкните, чтобы добавить монтажную область с этой стороны Copy Artboard Копировать монтажную область Cut Artboard Вырезать монтажную область Rename Artboards Переименовать монтажные области diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 27117a1a61..12a2a48886 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -924,6 +924,8 @@ font-technology Variable Variabla Duplicate Duplicera Duplicate and Offset 10 pt Duplicera och förskjut 10 pt Duplicate Artboard Duplicera rityta + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Klicka för att lägga till en rityta på den här sidan, Alt-klicka för att duplicera ritytan med dess grafik + Click to add an artboard on this side Klicka för att lägga till en rityta på den här sidan Copy Artboard Kopiera rityta Cut Artboard Klipp ut rityta Rename Artboards Byt namn på ritytor diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 43bfd50f1a..e08cd2efa5 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -332,6 +332,18 @@ fn marquee_selection_labels_are_in_complete_catalogs() { } } +/// The Artboard tool's add buttons take their tooltips from the tools crate, which the `tl!` scan +/// does not read, so each complete catalog is checked for them here. +#[test] +fn artboard_add_button_tooltips_are_in_complete_catalogs() { + use vectorcraft_tools::xform::{EDGE_BUTTON_TIP, EDGE_BUTTON_TIP_LOCKED}; + for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus || COMPLETE_MESSAGES.contains(&lang.code)) { + for label in [EDGE_BUTTON_TIP, EDGE_BUTTON_TIP_LOCKED] { + assert!(lang.catalog().plain(label).is_some_and(|t| !t.is_empty() && t != label), "{} is missing {label}", lang.code); + } + } +} + /// Preferences › Performance › Use Monitor Profile for Canvas and the note under it. #[test] fn monitor_profile_labels_are_in_complete_catalogs() { diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 7d98ecaa48..91654916fa 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -916,6 +916,8 @@ font-technology Variable Değişken Duplicate Çoğalt Duplicate and Offset 10 pt Çoğalt ve Ofset 10 pt Duplicate Artboard Çalışma Yüzeyini Çoğalt + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Bu tarafa çalışma yüzeyi eklemek için tıklayın, bu çalışma yüzeyini çizimiyle birlikte çoğaltmak için Alt tuşunu basılı tutarak tıklayın + Click to add an artboard on this side Bu tarafa çalışma yüzeyi eklemek için tıklayın Copy Artboard Çalışma Yüzeyini Kopyala Cut Artboard Çalışma Yüzeyini Kes Rename Artboards Çalışma Yüzeylerini Yeniden Adlandır diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 0ceca21bbf..29c293e811 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -939,6 +939,8 @@ font-technology Variable Варіативні Duplicate Дублювати Duplicate and Offset 10 pt Дублювати та змістити на 10 пунктів Duplicate Artboard Дублювати монтажну область + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Клацніть, щоб додати монтажну область із цього боку; клацніть з Alt, щоб дублювати цю монтажну область разом із графікою + Click to add an artboard on this side Клацніть, щоб додати монтажну область із цього боку Copy Artboard Копіювати монтажну область Cut Artboard Вирізати монтажну область Rename Artboards Перейменувати монтажні області diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 39312c9214..9073421051 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -1109,6 +1109,8 @@ font-technology Variable Biến thiên Duplicate Nhân bản Duplicate and Offset 10 pt Nhân bản và dịch 10 pt Duplicate Artboard Nhân bản bảng vẽ + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Bấm để thêm bảng vẽ ở phía này, Alt-bấm để nhân bản bảng vẽ này cùng tác phẩm của nó + Click to add an artboard on this side Bấm để thêm bảng vẽ ở phía này Duplicate Artboards Nhân bản các bảng vẽ Duplicate Brush Nhân bản cọ Duplicate Character Style Nhân bản kiểu ký tự diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index f6924adb06..9bfb2ca934 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -879,6 +879,8 @@ antiAlias Sharp 锐利 Duplicate 复制 Duplicate and Offset 10 pt 复制并偏移 10 pt Duplicate Artboard 复制画板 + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art 单击在此侧添加画板,Alt+单击复制此画板及其图稿 + Click to add an artboard on this side 单击在此侧添加画板 Copy Artboard 拷贝画板 Cut Artboard 剪切画板 Rename Artboards 重命名画板 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 06b73d2a4b..dc5411bb3c 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -907,6 +907,8 @@ font-technology Variable 可變 Duplicate 製作複本 Duplicate and Offset 10 pt 製作複本並位移 10 pt Duplicate Artboard 製作工作區域複本 + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art 按一下以在這一側新增工作區域,Alt 加按一下以製作此工作區域及其圖稿的複本 + Click to add an artboard on this side 按一下以在這一側新增工作區域 Copy Artboard 複製工作區域 Cut Artboard 剪下工作區域 Rename Artboards 重新命名工作區域 diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e7c1b28726..8451304b9f 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -732,6 +732,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Escape in the distort tools:** Escape during a Puppet Warp pin drag or turn, a Perspective Grid tool handle or plane widget drag, a Perspective Selection move, resize or plane widget drag, or a Liquify stroke cancels it: the art goes back to how the press found it, no undo step is added, and the tool stays chosen. Puppet Warp also selects again the pins selected before the press, and Escape during a Liquify Alt-drag puts the brush size back. Regression tests: `escape_cancels_*` in `crates/tools/src/distort/puppet.rs`, `perspective.rs` and `liquify.rs`, and `escape_cancels_a_puppet_warp_perspective_or_liquify_drag` in `tests/distortkeys.rs`. - **Shift with the Artboard tool:** a Shift-click adds an artboard to the selection or takes it out when the button comes up. A Shift-drag inside an artboard draws a new artboard there, and a Shift-drag on the pasteboard is a marquee that toggles the artboards it touches, as the [default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (a Shift-drag draws an artboard within an existing one) and [Using multiple artboards](https://web.archive.org/web/20210925094818/https://helpx.adobe.com/illustrator/using/using-multiple-artboards.html) (archived copy) describe. Shift no longer keeps an artboard move at 45° steps or a drawn artboard square. Escape during a marquee or while a new artboard is being drawn cancels it and keeps the Artboard tool. Pointer and key tests in `crates/tools/src/xform/artboard.rs` cover the four gestures and Escape. - **Artboard edge buttons:** with the Artboard tool and one artboard selected, a button with a plus shows just outside the middle of each edge where an artboard of the same size fits on that side; clicking it adds an empty artboard of that size there (`artboard.new {beside, side}`), and Alt-clicking duplicates the artboard with its art there (`artboard.duplicate {index, side}`), each in one undo step, with the new artboard active. An Alt-click on a locked artboard's button does nothing, as the tool doesn't copy a locked artboard. The 20 pt gap and the room rule (within the canvas, overlapping no other artboard) are VectorCraft's own. Pointer tests in `crates/tools/src/xform/artboard/tests.rs` and an engine test in `tests/panelcmds.rs` cover it. Public references: [Add artboards instantly](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/add-new-artboards.html) and [Duplicate artboards instantly](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/duplicate-artboards.html). +- **Artboard edge button tooltips:** resting the pointer on an edge button shows a tooltip, after the interface's usual tooltip delay, that says a click adds an artboard on that side and, on an unlocked artboard, that an Alt-click duplicates the artboard with its art. The tooltip covers the same disc a press takes. No tooltip shows during a drag or where a button is hidden for lack of room. The wording is VectorCraft's own. Tools can attach such hover text to any overlay region (`Overlay::HoverText`). Tests in `crates/tools/src/xform/artboard/tests.rs`, `crates/ui-egui/src/canvas/tests.rs` and `crates/ui-egui/src/i18n/tests.rs` cover it. - **Artboard deletion keys:** Delete/Backspace delete selected boards in one Undo step, retaining the original first board in the current order when all are selected, as in the public [Delete artboards guide](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/delete-artboards.html). The last board and active drags stay protected; neither key clears selected artwork. Headless shortcut regressions in `tests/distortkeys.rs` cover reordered boards, artwork, saved state and Undo/Redo. - **Locked artboards:** a click in the Artboards panel's lock column locks or unlocks an artboard in one undo step (`artboard.setProps {index, locked}`), and the native format saves the lock. The Artboard tool doesn't move, copy, resize or delete a locked artboard, Rearrange and Fit to Artwork Bounds leave it as it is, and its name isn't edited on the canvas. The art on it (each object whose bounds overlap it, a group as one object) acts as locked art until it is unlocked: clicks, marquees, `select.set`, `select.all` and the tools pass over it, and commands that act on the selection leave it; art drawn or pasted onto it stays selected and editable until the selection leaves it out. Tests in `crates/doc/src/lib.rs`, `tests/panelcmds.rs`, `xform/artboard.rs`, `panels/artboards.rs` and `canvas.rs` cover them. Public references: [Lock artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/lock-artboards.html) and [Managing Artboards in Illustrator](https://creativepro.com/managing-artboards-in-illustrator/). - **Linux RPM packaging:** 64-bit runtime capabilities replace Fedora-specific required package names (#1275); glibc 2.35, libm and libgcc_s are declared alongside dynamically loaded xkbcommon and Vulkan/EGL. Generated x86_64/aarch64 metadata and isolated synthetic-provider resolution checked; real-distro install/start-up QA remains pending. From d9fcdba9161af5bc26010b2ea650634b43bc9421 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 13 Nov 2026 19:08:16 -0800 Subject: [PATCH 007/158] Library panels: built-in swatch, graphic style and symbol names show in the UI language MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A built-in swatch, gradient, pattern, graphic style or symbol library's panel now shows its item and color group names in the UI language, as the brush library panels already do. Find matches the name shown or the English name. A numbered swatch such as "Warm Gray 3" shows its group's translated name followed by the number; color values such as K=35 and #33cc99 are shown as they are. User Defined and Other Library... libraries keep their stored names, and a click, a drag and the Add to commands still use the English name. - LibraryKind::label returns Cow so a label can be composed; i18n::numbered_label translates the name before a trailing number. - Every complete catalog gets rows for the built-in names it lacked. - The Hindi row for "Vivid" now reads चटक. --- crates/ui-egui/src/i18n.rs | 18 ++ crates/ui-egui/src/i18n/bg.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/bs.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/ca.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/cs.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/da.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/de.tsv | 241 ++++++++++++++++++ crates/ui-egui/src/i18n/el.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/es.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/fi.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/fr.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/hi.tsv | 236 ++++++++++++++++- crates/ui-egui/src/i18n/hu.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/id.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/it.tsv | 239 +++++++++++++++++ crates/ui-egui/src/i18n/ja.tsv | 239 +++++++++++++++++ crates/ui-egui/src/i18n/ka.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/ko.tsv | 239 +++++++++++++++++ crates/ui-egui/src/i18n/nl.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/pl.tsv | 236 +++++++++++++++++ crates/ui-egui/src/i18n/pt-br.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/ru.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/sv.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/tests.rs | 91 +++++++ crates/ui-egui/src/i18n/tr.tsv | 234 +++++++++++++++++ crates/ui-egui/src/i18n/uk.tsv | 239 +++++++++++++++++ crates/ui-egui/src/i18n/vi.tsv | 239 +++++++++++++++++ crates/ui-egui/src/i18n/zh-hans.tsv | 237 +++++++++++++++++ crates/ui-egui/src/i18n/zh-hant.tsv | 239 +++++++++++++++++ crates/ui-egui/src/panels/brushes.rs | 5 +- crates/ui-egui/src/panels/graphic_styles.rs | 11 +- crates/ui-egui/src/panels/library_panel.rs | 9 +- .../ui-egui/src/panels/library_panel/tests.rs | 34 +++ .../ui-egui/src/panels/swatches/libraries.rs | 15 +- crates/ui-egui/src/panels/symbols.rs | 11 +- .../src/panels/tests_style_libraries.rs | 28 ++ .../src/panels/tests_symbol_libraries.rs | 26 ++ docs/target-app-parity.md | 1 + 38 files changed, 6597 insertions(+), 14 deletions(-) diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 9d15012784..429de0cb28 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -29,6 +29,7 @@ mod catalog; +use std::borrow::Cow; use std::sync::OnceLock; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -651,6 +652,23 @@ pub fn label_or_name(lang: Lang, s: &str, built_in: bool) -> &str { if built_in { tr(lang, s) } else { s } } +/// A built-in name that may end in a number ("Warm Gray 3") in `lang`: its own row, or the row of +/// the name before the number followed by the number as it is. Any other name, a color value +/// such as `K=35` among them, comes back as it is. +pub fn numbered_label(lang: Lang, s: &str) -> Cow<'_, str> { + if let Some(shown) = lang.catalog().plain(s) { + return Cow::Borrowed(shown); + } + if let Some((head, n)) = s.rsplit_once(' ') + && !n.is_empty() + && n.bytes().all(|b| b.is_ascii_digit()) + && let Some(shown) = lang.catalog().plain(head) + { + return Cow::Owned(format!("{shown} {n}")); + } + Cow::Borrowed(s) +} + /// How deep [`message`] translates placeholder values that are messages themselves. The status /// bar's line for an EPS file that can't be opened has five levels: `Couldn't open {name}: {e}`, /// the loader's `can't open …: {e}` (matched by `{path}: {e}`), the reader's `this PostScript file diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 1f469c69c9..4136f6c002 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -6241,6 +6241,240 @@ axis Y Axis Y ос Stars Звезди Triangles Триъгълници Sparkles Искри + Warm Gray Топло сиво + Cool Gray Студено сиво + Neutrals Неутрални + Ivory Слонова кост + Linen Лен + Oat Овес + Greige Грейж + Stone Камък + Taupe Сиво-кафяво + Slate Шисти + Clay Глина + Terracotta Теракота + Ochre Охра + Umber Умбра + Sand Пясък + Olive Маслинено + Moss Мъх + Rosy Розовеещо + Neutral Неутрално + Golden Златисто + Pastel Пастелни + Pastel Red Пастелно червено + Pastel Orange Пастелно оранжево + Pastel Amber Пастелно кехлибарено + Pastel Yellow Пастелно жълто + Pastel Lime Пастелно лаймово + Pastel Green Пастелно зелено + Pastel Teal Пастелно синьо-зелено + Pastel Cyan Пастелен циан + Pastel Azure Пастелно лазурно + Pastel Blue Пастелно синьо + Pastel Violet Пастелно виолетово + Pastel Magenta Пастелна магента + Soft Red Меко червено + Soft Orange Меко оранжево + Soft Amber Меко кехлибарено + Soft Yellow Меко жълто + Soft Lime Меко лаймово + Soft Green Меко зелено + Soft Teal Меко синьо-зелено + Soft Cyan Мек циан + Soft Azure Меко лазурно + Soft Blue Меко синьо + Soft Violet Меко виолетово + Soft Magenta Мека магента + Vivid Red Ярко червено + Vivid Orange Ярко оранжево + Vivid Amber Ярко кехлибарено + Vivid Yellow Ярко жълто + Vivid Lime Ярко лаймово + Vivid Green Ярко зелено + Vivid Teal Ярко синьо-зелено + Vivid Cyan Ярък циан + Vivid Azure Ярко лазурно + Vivid Blue Ярко синьо + Vivid Violet Ярко виолетово + Vivid Magenta Ярка магента + Deep Наситени + Deep Red Тъмночервено + Deep Orange Тъмнооранжево + Deep Amber Тъмно кехлибарено + Deep Yellow Тъмножълто + Deep Lime Тъмно лаймово + Deep Green Тъмнозелено + Deep Teal Тъмно синьо-зелено + Deep Cyan Тъмен циан + Deep Azure Тъмно лазурно + Deep Blue Тъмносиньо + Deep Violet Тъмновиолетово + Deep Magenta Тъмна магента + Gold Злато + Silver Сребро + Bronze Бронз + Copper Мед + Brass Месинг + Rose Gold Розово злато + Gunmetal Оръжеен метал + Platinum Платина + Pewter Калай + Ember Жарава + Lagoon Лагуна + Dusk Здрач + Clay to Teal От глина до синьо-зелено + Plum to Olive От слива до маслинено + Complementary Coral Коралово, комплементарни + Split Complementary Coral Коралово, сплит-комплементарни + Analogous Coral Коралово, аналогови + Triad Coral Коралово, триада + Tetrad Coral Коралово, тетрада + Pentagram Coral Коралово, петограм + Complementary Teal Синьо-зелено, комплементарни + Split Complementary Teal Синьо-зелено, сплит-комплементарни + Analogous Teal Синьо-зелено, аналогови + Triad Teal Синьо-зелено, триада + Tetrad Teal Синьо-зелено, тетрада + Pentagram Teal Синьо-зелено, петограм + Soft Spectrum Мек спектър + Red to Amber От червено до кехлибарено + Orange to Yellow От оранжево до жълто + Amber to Lime От кехлибарено до лаймово + Yellow to Green От жълто до зелено + Lime to Teal От лаймово до синьо-зелено + Green to Cyan От зелено до циан + Teal to Azure От синьо-зелено до лазурно + Cyan to Blue От циан до синьо + Azure to Violet От лазурно до виолетово + Blue to Magenta От синьо до магента + Violet to Red От виолетово до червено + Magenta to Orange От магента до оранжево + Dawn Зазоряване + Noon Пладне + Sunset Залез + Night Нощ + Overcast Облачно + White to Black От бяло до черно + Light Grays Светлосиви + Dark Grays Тъмносиви + Warm Grays Топли сиви + Cool Grays Студени сиви + Fade to Transparent Преливане към прозрачно + White Fade Бяло преливане + Vignette Винетка + Mist Мъгла + Petal Венчелистче + Fern Папрат + Smoke Дим + Honey Пчелен мед + Seafoam Морска пяна + Lavender Лавандула + Driftwood Изхвърлено дърво + Ink Wash Лавиран туш + Tide Прилив + Bloom Цъфтеж + Dew Роса + Pollen Прашец + Lichen Лишей + Prism Veil Призмен воал + Opal Ribbon Опалова лента + Pearl Flash Перлен проблясък + Aurora Foil Фолио полярно сияние + Iris Sheen Ирисов отблясък + Frost Spectrum Скрежен спектър + Silver Tide Сребърен прилив + Rose Quartz Gleam Блясък на розов кварц + Moonstone Shift Преливане на лунен камък + Violet Edge Виолетов ръб + Mint Halo Ментов ореол + Amber Corona Кехлибарена корона + Polar Glint Полярен проблясък + Pastel Orbit Пастелна орбита + Coral and Navy Коралово и тъмносиньо + Plum and Lime Слива и лайм + Teal and Gold Синьо-зелено и злато + Indigo and Peach Индиго и праскова + Forest and Rose Гора и роза + Red Glow Червено сияние + Orange Glow Оранжево сияние + Amber Glow Кехлибарено сияние + Yellow Glow Жълто сияние + Lime Glow Лаймово сияние + Green Glow Зелено сияние + Teal Glow Синьо-зелено сияние + Cyan Glow Цианово сияние + Azure Glow Лазурно сияние + Blue Glow Синьо сияние + Violet Glow Виолетово сияние + Magenta Glow Магентено сияние + Polka Dots Едри точки + Vertical Stripes Вертикални ивици + Horizontal Stripes Хоризонтални ивици + Diagonal Stripes Диагонални ивици + Checkerboard Шахматна дъска + Diamonds Ромбове + Crosses Кръстчета + Coarse Grit Едро зърно + Stipple Пунктир + Scratches Драскотини + Sparse Flecks Редки петънца + Dense Flecks Гъсти петънца + Sine Bands Синусоидни ленти + Ripple Lines Вълнисти линии + Interference Rings Интерференчни пръстени + Offset Rings Отместени пръстени + Warped Checks Изкривени квадрати + Pinched Stripes Притиснати ивици + Chevron Pulse Пулсиращи шеврони + Radiating Lenses Излъчващи лещи + Soft Shadow Мека сянка + Hard Shadow Твърда сянка + Lifted Card Повдигната карта + Neon Tube Неонова тръба + Inner Light Вътрешна светлина + Feathered Размити ръбове + Haze Омара + Double Rule Двойна линия + Triple Rule Тройна линия + Dashed Border Пунктирана рамка + Dotted Border Точкова рамка + Offset Keyline Отместен контур + Inset Keyline Вътрешен контур + Outside Stroke Външен щрих + Pointer Показалец + Highlighter Маркер + Sketchy Line Скицирана линия + Scribble Fill Драскано запълване + Wobble Клатене + Zig Zag Edge Зигзагообразен ръб + Wavy Edge Вълнист ръб + Puffy Надут + Starburst Звезден взрив + Glossy Лъскав + Brushed Metal Шлифован метал + Spotlight Прожектор + Sunset Band Ивица на залеза + Sea Glass Морско стъкло + Pearl Перла + Chrome Rim Хромиран кант + Glow Orb Светеща сфера + Pill Badge Значка-капсула + Round Badge Кръгла значка + Flag Wave Развяващо се знаме + Bulge Издутина + Twisted Усукан + Echo Ехо + Spiral Copies Копия по спирала + Multiply Tint Оттенък умножение + Darken Veil Воал потъмняване + Ghosted Призрачен + Two Tone Двуцветен + Overlay Glaze Глазура прекриване + Screen Light Светлина екран + Soft Light Wash Лавиране мека светлина + Burst Взрив + Rounded Square Закръглен квадрат Save Brush Library… Запази библиотека с четки… @msg no empty artboards to delete няма празни работни области за изтриване Scale Presets Пресети за мащаб diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index a23133933a..6f344aba18 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -6294,6 +6294,240 @@ axis Y Axis Y osa Stars Zvijezde Triangles Trouglovi Sparkles Iskrice + Warm Gray Topla siva + Cool Gray Hladna siva + Neutrals Neutralne + Ivory Slonovača + Linen Lan + Oat Zob + Greige Greige + Stone Kamen + Taupe Taupe + Slate Škriljac + Clay Glina + Terracotta Terakota + Ochre Oker + Umber Umbra + Sand Pijesak + Olive Maslinasta + Moss Mahovina + Rosy Ružičasta + Neutral Neutralna + Golden Zlatna + Pastel Pastelne + Pastel Red Pastelna crvena + Pastel Orange Pastelna narandžasta + Pastel Amber Pastelni jantar + Pastel Yellow Pastelna žuta + Pastel Lime Pastelna limeta + Pastel Green Pastelna zelena + Pastel Teal Pastelna plavozelena + Pastel Cyan Pastelni cijan + Pastel Azure Pastelna azurna + Pastel Blue Pastelna plava + Pastel Violet Pastelna ljubičasta + Pastel Magenta Pastelna magenta + Soft Red Blaga crvena + Soft Orange Blaga narandžasta + Soft Amber Blagi jantar + Soft Yellow Blaga žuta + Soft Lime Blaga limeta + Soft Green Blaga zelena + Soft Teal Blaga plavozelena + Soft Cyan Blagi cijan + Soft Azure Blaga azurna + Soft Blue Blaga plava + Soft Violet Blaga ljubičasta + Soft Magenta Blaga magenta + Vivid Red Živa crvena + Vivid Orange Živa narandžasta + Vivid Amber Živi jantar + Vivid Yellow Živa žuta + Vivid Lime Živa limeta + Vivid Green Živa zelena + Vivid Teal Živa plavozelena + Vivid Cyan Živi cijan + Vivid Azure Živa azurna + Vivid Blue Živa plava + Vivid Violet Živa ljubičasta + Vivid Magenta Živa magenta + Deep Tamne + Deep Red Tamnocrvena + Deep Orange Tamnonarandžasta + Deep Amber Tamni jantar + Deep Yellow Tamnožuta + Deep Lime Tamna limeta + Deep Green Tamnozelena + Deep Teal Tamna plavozelena + Deep Cyan Tamni cijan + Deep Azure Tamna azurna + Deep Blue Tamnoplava + Deep Violet Tamnoljubičasta + Deep Magenta Tamna magenta + Gold Zlato + Silver Srebro + Bronze Bronza + Copper Bakar + Brass Mesing + Rose Gold Rozo zlato + Gunmetal Čelično siva + Platinum Platina + Pewter Kalaj + Ember Žar + Lagoon Laguna + Dusk Sumrak + Clay to Teal Od gline do plavozelene + Plum to Olive Od šljive do maslinaste + Complementary Coral Koralna, komplementarne + Split Complementary Coral Koralna, podijeljene komplementarne + Analogous Coral Koralna, analogne + Triad Coral Koralna, trijada + Tetrad Coral Koralna, tetrada + Pentagram Coral Koralna, pentagram + Complementary Teal Plavozelena, komplementarne + Split Complementary Teal Plavozelena, podijeljene komplementarne + Analogous Teal Plavozelena, analogne + Triad Teal Plavozelena, trijada + Tetrad Teal Plavozelena, tetrada + Pentagram Teal Plavozelena, pentagram + Soft Spectrum Blagi spektar + Red to Amber Od crvene do jantara + Orange to Yellow Od narandžaste do žute + Amber to Lime Od jantara do limete + Yellow to Green Od žute do zelene + Lime to Teal Od limete do plavozelene + Green to Cyan Od zelene do cijana + Teal to Azure Od plavozelene do azurne + Cyan to Blue Od cijana do plave + Azure to Violet Od azurne do ljubičaste + Blue to Magenta Od plave do magente + Violet to Red Od ljubičaste do crvene + Magenta to Orange Od magente do narandžaste + Dawn Zora + Noon Podne + Sunset Zalazak sunca + Night Noć + Overcast Oblačno + White to Black Od bijele do crne + Light Grays Svijetle sive + Dark Grays Tamne sive + Warm Grays Tople sive + Cool Grays Hladne sive + Fade to Transparent Prelaz u providno + White Fade Bijeli prelaz + Vignette Vinjeta + Mist Izmaglica + Petal Latica + Fern Paprat + Smoke Dim + Honey Med + Seafoam Morska pjena + Lavender Lavanda + Driftwood Naplavljeno drvo + Ink Wash Lavirani tuš + Tide Plima + Bloom Cvjetanje + Dew Rosa + Pollen Polen + Lichen Lišaj + Prism Veil Prizmatični veo + Opal Ribbon Opalna traka + Pearl Flash Biserni bljesak + Aurora Foil Folija polarne svjetlosti + Iris Sheen Sjaj irisa + Frost Spectrum Mrazni spektar + Silver Tide Srebrna plima + Rose Quartz Gleam Sjaj ružičastog kvarca + Moonstone Shift Prelivanje mjesečevog kamena + Violet Edge Ljubičasta ivica + Mint Halo Oreol boje mente + Amber Corona Jantarna korona + Polar Glint Polarni odsjaj + Pastel Orbit Pastelna orbita + Coral and Navy Koralna i mornarsko plava + Plum and Lime Šljiva i limeta + Teal and Gold Plavozelena i zlatna + Indigo and Peach Indigo i breskva + Forest and Rose Šuma i ruža + Red Glow Crveni sjaj + Orange Glow Narandžasti sjaj + Amber Glow Jantarni sjaj + Yellow Glow Žuti sjaj + Lime Glow Sjaj limete + Green Glow Zeleni sjaj + Teal Glow Plavozeleni sjaj + Cyan Glow Cijan sjaj + Azure Glow Azurni sjaj + Blue Glow Plavi sjaj + Violet Glow Ljubičasti sjaj + Magenta Glow Magenta sjaj + Polka Dots Tufne + Vertical Stripes Vertikalne pruge + Horizontal Stripes Horizontalne pruge + Diagonal Stripes Dijagonalne pruge + Checkerboard Šahovska tabla + Diamonds Rombovi + Crosses Krstići + Coarse Grit Grubo zrno + Stipple Tačkanje + Scratches Ogrebotine + Sparse Flecks Rijetke mrlje + Dense Flecks Guste mrlje + Sine Bands Sinusne trake + Ripple Lines Talasaste linije + Interference Rings Interferentni prstenovi + Offset Rings Pomaknuti prstenovi + Warped Checks Iskrivljene kocke + Pinched Stripes Stisnute pruge + Chevron Pulse Pulsirajući ševroni + Radiating Lenses Zračeća sočiva + Soft Shadow Meka sjena + Hard Shadow Oštra sjena + Lifted Card Podignuta kartica + Neon Tube Neonska cijev + Inner Light Unutrašnje svjetlo + Feathered Omekšane ivice + Haze Sumaglica + Double Rule Dvostruka linija + Triple Rule Trostruka linija + Dashed Border Isprekidani okvir + Dotted Border Tačkasti okvir + Offset Keyline Pomaknuta kontura + Inset Keyline Unutrašnja kontura + Outside Stroke Vanjski potez + Pointer Pokazivač + Highlighter Marker + Sketchy Line Skicirana linija + Scribble Fill Išarana ispuna + Wobble Klimanje + Zig Zag Edge Cik-cak ivica + Wavy Edge Talasasta ivica + Puffy Napuhan + Starburst Zvjezdana eksplozija + Glossy Sjajan + Brushed Metal Brušeni metal + Spotlight Reflektor + Sunset Band Traka zalaska sunca + Sea Glass Morsko staklo + Pearl Biser + Chrome Rim Hromirani rub + Glow Orb Svjetleća kugla + Pill Badge Značka u obliku pilule + Round Badge Okrugla značka + Flag Wave Vijoreća zastava + Bulge Ispupčenje + Twisted Uvrnut + Echo Eho + Spiral Copies Kopije u spirali + Multiply Tint Nijansa množenja + Darken Veil Veo potamnjivanja + Ghosted Sablasno + Two Tone Dvobojno + Overlay Glaze Glazura prekrivanja + Screen Light Svjetlo ekrana + Soft Light Wash Laviranje mekim svjetlom + Burst Prasak + Rounded Square Zaobljeni kvadrat Save Brush Library… Sačuvaj biblioteku četkica… @msg `{_1}` has no brushes to apply `{_1}` nema četkica za primjenu @msg missing `library` (see brush.libraries) nedostaje `library` (pogledajte brush.libraries) diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 373eb0b79d..2df0d3428c 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -3976,6 +3976,240 @@ digits Malayalam Malaiàlam Stars Estrelles Triangles Triangles Sparkles Espurnes + Warm Gray Gris càlid + Cool Gray Gris fred + Neutrals Neutres + Ivory Ivori + Linen Lli + Oat Civada + Greige Greige + Stone Pedra + Taupe Talp + Slate Pissarra + Clay Argila + Terracotta Terracota + Ochre Ocre + Umber Ombra + Sand Sorra + Olive Oliva + Moss Molsa + Rosy Rosat + Neutral Neutre + Golden Daurat + Pastel Pastel + Pastel Red Vermell pastel + Pastel Orange Taronja pastel + Pastel Amber Ambre pastel + Pastel Yellow Groc pastel + Pastel Lime Llima pastel + Pastel Green Verd pastel + Pastel Teal Verd blavós pastel + Pastel Cyan Cian pastel + Pastel Azure Atzur pastel + Pastel Blue Blau pastel + Pastel Violet Violeta pastel + Pastel Magenta Magenta pastel + Soft Red Vermell suau + Soft Orange Taronja suau + Soft Amber Ambre suau + Soft Yellow Groc suau + Soft Lime Llima suau + Soft Green Verd suau + Soft Teal Verd blavós suau + Soft Cyan Cian suau + Soft Azure Atzur suau + Soft Blue Blau suau + Soft Violet Violeta suau + Soft Magenta Magenta suau + Vivid Red Vermell viu + Vivid Orange Taronja viu + Vivid Amber Ambre viu + Vivid Yellow Groc viu + Vivid Lime Llima viu + Vivid Green Verd viu + Vivid Teal Verd blavós viu + Vivid Cyan Cian viu + Vivid Azure Atzur viu + Vivid Blue Blau viu + Vivid Violet Violeta viu + Vivid Magenta Magenta viu + Deep Foscos + Deep Red Vermell fosc + Deep Orange Taronja fosc + Deep Amber Ambre fosc + Deep Yellow Groc fosc + Deep Lime Llima fosc + Deep Green Verd fosc + Deep Teal Verd blavós fosc + Deep Cyan Cian fosc + Deep Azure Atzur fosc + Deep Blue Blau fosc + Deep Violet Violeta fosc + Deep Magenta Magenta fosc + Gold Or + Silver Plata + Bronze Bronze + Copper Coure + Brass Llautó + Rose Gold Or rosa + Gunmetal Gris metall + Platinum Platí + Pewter Peltre + Ember Brasa + Lagoon Llacuna + Dusk Capvespre + Clay to Teal Argila a verd blavós + Plum to Olive Pruna a oliva + Complementary Coral Corall complementari + Split Complementary Coral Corall complementari dividit + Analogous Coral Corall anàleg + Triad Coral Corall en tríada + Tetrad Coral Corall en tètrada + Pentagram Coral Corall en pentagrama + Complementary Teal Verd blavós complementari + Split Complementary Teal Verd blavós complementari dividit + Analogous Teal Verd blavós anàleg + Triad Teal Verd blavós en tríada + Tetrad Teal Verd blavós en tètrada + Pentagram Teal Verd blavós en pentagrama + Soft Spectrum Espectre suau + Red to Amber Vermell a ambre + Orange to Yellow Taronja a groc + Amber to Lime Ambre a llima + Yellow to Green Groc a verd + Lime to Teal Llima a verd blavós + Green to Cyan Verd a cian + Teal to Azure Verd blavós a atzur + Cyan to Blue Cian a blau + Azure to Violet Atzur a violeta + Blue to Magenta Blau a magenta + Violet to Red Violeta a vermell + Magenta to Orange Magenta a taronja + Dawn Alba + Noon Migdia + Sunset Posta de sol + Night Nit + Overcast Ennuvolat + White to Black Blanc a negre + Light Grays Grisos clars + Dark Grays Grisos foscos + Warm Grays Grisos càlids + Cool Grays Grisos freds + Fade to Transparent Esvaïment a transparent + White Fade Esvaïment blanc + Vignette Vinyeta + Mist Boira + Petal Pètal + Fern Falguera + Smoke Fum + Honey Mel + Seafoam Escuma de mar + Lavender Espígol + Driftwood Fusta de deriva + Ink Wash Aiguada de tinta + Tide Marea + Bloom Floració + Dew Rosada + Pollen Pol·len + Lichen Liquen + Prism Veil Vel prismàtic + Opal Ribbon Cinta d’òpal + Pearl Flash Llampec nacrat + Aurora Foil Làmina aurora + Iris Sheen Lluentor iris + Frost Spectrum Espectre gebrat + Silver Tide Marea platejada + Rose Quartz Gleam Resplendor de quars rosa + Moonstone Shift Reflex de pedra de lluna + Violet Edge Vora violeta + Mint Halo Halo menta + Amber Corona Corona ambre + Polar Glint Espurneig polar + Pastel Orbit Òrbita pastel + Coral and Navy Corall i blau marí + Plum and Lime Pruna i llima + Teal and Gold Verd blavós i or + Indigo and Peach Indi i préssec + Forest and Rose Bosc i rosa + Red Glow Resplendor vermella + Orange Glow Resplendor taronja + Amber Glow Resplendor ambre + Yellow Glow Resplendor groga + Lime Glow Resplendor llima + Green Glow Resplendor verda + Teal Glow Resplendor verd blavós + Cyan Glow Resplendor cian + Azure Glow Resplendor atzur + Blue Glow Resplendor blava + Violet Glow Resplendor violeta + Magenta Glow Resplendor magenta + Polka Dots Pics + Vertical Stripes Ratlles verticals + Horizontal Stripes Ratlles horitzontals + Diagonal Stripes Ratlles diagonals + Checkerboard Escaquer + Diamonds Rombes + Crosses Creus + Coarse Grit Gra gruixut + Stipple Puntejat + Scratches Ratllades + Sparse Flecks Taques disperses + Dense Flecks Taques denses + Sine Bands Bandes sinusoidals + Ripple Lines Línies ondulades + Interference Rings Anells d’interferència + Offset Rings Anells desplaçats + Warped Checks Quadres deformats + Pinched Stripes Ratlles pinçades + Chevron Pulse Pols de galons + Radiating Lenses Lents radiants + Soft Shadow Ombra suau + Hard Shadow Ombra dura + Lifted Card Targeta elevada + Neon Tube Tub de neó + Inner Light Llum interior + Feathered Difuminat + Haze Calitja + Double Rule Filet doble + Triple Rule Filet triple + Dashed Border Vora discontínua + Dotted Border Vora puntejada + Offset Keyline Filet desplaçat + Inset Keyline Filet interior + Outside Stroke Traç exterior + Pointer Punter + Highlighter Retolador + Sketchy Line Línia esbossada + Scribble Fill Emplenament gargotejat + Wobble Tremolós + Zig Zag Edge Vora en ziga-zaga + Wavy Edge Vora ondulada + Puffy Inflat + Starburst Esclat estel·lar + Glossy Brillant + Brushed Metal Metall raspallat + Spotlight Focus + Sunset Band Banda de posta de sol + Sea Glass Vidre de mar + Pearl Perla + Chrome Rim Vora cromada + Glow Orb Orbe lluminós + Pill Badge Insígnia de càpsula + Round Badge Insígnia rodona + Flag Wave Bandera onejant + Bulge Bombament + Twisted Recargolat + Echo Eco + Spiral Copies Còpies en espiral + Multiply Tint Tint multiplica + Darken Veil Vel enfosqueix + Ghosted Fantasma + Two Tone Bicolor + Overlay Glaze Veladura superposició + Screen Light Llum pantalla + Soft Light Wash Aiguada llum suau + Burst Esclat + Rounded Square Quadrat arrodonit Scatter: Dispersió: Scissors Tisores Scissors Tool Eina de tisores diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 7178be3143..28375af85a 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -6795,6 +6795,240 @@ axis Y Axis osa Y Stars Hvězdy Triangles Trojúhelníky Sparkles Jiskry + Warm Gray Teplá šedá + Cool Gray Studená šedá + Neutrals Neutrální tóny + Ivory Slonovina + Linen Len + Oat Oves + Greige Greige + Stone Kámen + Taupe Taupe + Slate Břidlice + Clay Hlína + Terracotta Terakota + Ochre Okr + Umber Umbra + Sand Písek + Olive Olivová + Moss Mech + Rosy Růžová + Neutral Neutrální + Golden Zlatavá + Pastel Pastelové + Pastel Red Pastelová červená + Pastel Orange Pastelová oranžová + Pastel Amber Pastelová jantarová + Pastel Yellow Pastelová žlutá + Pastel Lime Pastelová limetková + Pastel Green Pastelová zelená + Pastel Teal Pastelová modrozelená + Pastel Cyan Pastelová azurová + Pastel Azure Pastelová blankytná + Pastel Blue Pastelová modrá + Pastel Violet Pastelová fialová + Pastel Magenta Pastelová purpurová + Soft Red Jemná červená + Soft Orange Jemná oranžová + Soft Amber Jemná jantarová + Soft Yellow Jemná žlutá + Soft Lime Jemná limetková + Soft Green Jemná zelená + Soft Teal Jemná modrozelená + Soft Cyan Jemná azurová + Soft Azure Jemná blankytná + Soft Blue Jemná modrá + Soft Violet Jemná fialová + Soft Magenta Jemná purpurová + Vivid Red Sytá červená + Vivid Orange Sytá oranžová + Vivid Amber Sytá jantarová + Vivid Yellow Sytá žlutá + Vivid Lime Sytá limetková + Vivid Green Sytá zelená + Vivid Teal Sytá modrozelená + Vivid Cyan Sytá azurová + Vivid Azure Sytá blankytná + Vivid Blue Sytá modrá + Vivid Violet Sytá fialová + Vivid Magenta Sytá purpurová + Deep Tmavé + Deep Red Tmavě červená + Deep Orange Tmavě oranžová + Deep Amber Tmavě jantarová + Deep Yellow Tmavě žlutá + Deep Lime Tmavě limetková + Deep Green Tmavě zelená + Deep Teal Tmavě modrozelená + Deep Cyan Tmavě azurová + Deep Azure Tmavě blankytná + Deep Blue Tmavě modrá + Deep Violet Tmavě fialová + Deep Magenta Tmavě purpurová + Gold Zlato + Silver Stříbro + Bronze Bronz + Copper Měď + Brass Mosaz + Rose Gold Růžové zlato + Gunmetal Ocelově šedá + Platinum Platina + Pewter Cín + Ember Žhavé uhlíky + Lagoon Laguna + Dusk Soumrak + Clay to Teal Hlína do modrozelené + Plum to Olive Švestka do olivové + Complementary Coral Korálová, komplementární + Split Complementary Coral Korálová, rozdělená komplementární + Analogous Coral Korálová, analogická + Triad Coral Korálová, triáda + Tetrad Coral Korálová, tetráda + Pentagram Coral Korálová, pentagram + Complementary Teal Modrozelená, komplementární + Split Complementary Teal Modrozelená, rozdělená komplementární + Analogous Teal Modrozelená, analogická + Triad Teal Modrozelená, triáda + Tetrad Teal Modrozelená, tetráda + Pentagram Teal Modrozelená, pentagram + Soft Spectrum Jemné spektrum + Red to Amber Červená do jantarové + Orange to Yellow Oranžová do žluté + Amber to Lime Jantarová do limetkové + Yellow to Green Žlutá do zelené + Lime to Teal Limetková do modrozelené + Green to Cyan Zelená do azurové + Teal to Azure Modrozelená do blankytné + Cyan to Blue Azurová do modré + Azure to Violet Blankytná do fialové + Blue to Magenta Modrá do purpurové + Violet to Red Fialová do červené + Magenta to Orange Purpurová do oranžové + Dawn Svítání + Noon Poledne + Sunset Západ slunce + Night Noc + Overcast Zataženo + White to Black Bílá do černé + Light Grays Světlé šedé + Dark Grays Tmavé šedé + Warm Grays Teplé šedé + Cool Grays Studené šedé + Fade to Transparent Přechod do průhledné + White Fade Bílý přechod + Vignette Viněta + Mist Opar + Petal Okvětní lístek + Fern Kapradí + Smoke Kouř + Honey Med + Seafoam Mořská pěna + Lavender Levandule + Driftwood Naplavené dřevo + Ink Wash Tušová lavírovka + Tide Příliv + Bloom Rozkvět + Dew Rosa + Pollen Pyl + Lichen Lišejník + Prism Veil Hranolový závoj + Opal Ribbon Opálová stuha + Pearl Flash Perleťový záblesk + Aurora Foil Polární fólie + Iris Sheen Duhový lesk + Frost Spectrum Ojíněné spektrum + Silver Tide Stříbrný příliv + Rose Quartz Gleam Lesk růženínu + Moonstone Shift Měsíční třpyt + Violet Edge Fialový okraj + Mint Halo Mátová svatozář + Amber Corona Jantarová koróna + Polar Glint Polární záblesk + Pastel Orbit Pastelová dráha + Coral and Navy Korálová a námořnická modrá + Plum and Lime Švestková a limetková + Teal and Gold Modrozelená a zlatá + Indigo and Peach Indigo a broskvová + Forest and Rose Lesní a růžová + Red Glow Červená záře + Orange Glow Oranžová záře + Amber Glow Jantarová záře + Yellow Glow Žlutá záře + Lime Glow Limetková záře + Green Glow Zelená záře + Teal Glow Modrozelená záře + Cyan Glow Azurová záře + Azure Glow Blankytná záře + Blue Glow Modrá záře + Violet Glow Fialová záře + Magenta Glow Purpurová záře + Polka Dots Puntíky + Vertical Stripes Svislé pruhy + Horizontal Stripes Vodorovné pruhy + Diagonal Stripes Šikmé pruhy + Checkerboard Šachovnice + Diamonds Kosočtverce + Crosses Křížky + Coarse Grit Hrubé zrno + Stipple Tečkování + Scratches Škrábance + Sparse Flecks Řídké skvrnky + Dense Flecks Husté skvrnky + Sine Bands Sinusové pásy + Ripple Lines Zvlněné čáry + Interference Rings Interferenční kruhy + Offset Rings Posunuté kruhy + Warped Checks Zkreslené kostky + Pinched Stripes Sevřené pruhy + Chevron Pulse Pulzující krokve + Radiating Lenses Paprsčité čočky + Soft Shadow Měkký stín + Hard Shadow Ostrý stín + Lifted Card Zvednutá karta + Neon Tube Neonová trubice + Inner Light Vnitřní světlo + Feathered Měkké okraje + Haze Mlžný opar + Double Rule Dvojitá linka + Triple Rule Trojitá linka + Dashed Border Čárkovaný okraj + Dotted Border Tečkovaný okraj + Offset Keyline Posunutá obrysová linka + Inset Keyline Vnitřní obrysová linka + Outside Stroke Vnější tah + Pointer Ukazatel + Highlighter Zvýrazňovač + Sketchy Line Skicovitá čára + Scribble Fill Čmáraná výplň + Wobble Kolísání + Zig Zag Edge Klikatý okraj + Wavy Edge Vlnitý okraj + Puffy Nafouknutý + Starburst Hvězdný výbuch + Glossy Lesklý + Brushed Metal Kartáčovaný kov + Spotlight Reflektor + Sunset Band Pás západu slunce + Sea Glass Mořské sklo + Pearl Perla + Chrome Rim Chromový lem + Glow Orb Zářící koule + Pill Badge Odznak tvaru pilulky + Round Badge Kulatý odznak + Flag Wave Vlající vlajka + Bulge Vyboulení + Twisted Zkroucený + Echo Ozvěna + Spiral Copies Kopie ve spirále + Multiply Tint Odstín násobení + Darken Veil Ztmavující závoj + Ghosted Průsvitný + Two Tone Dvoubarevný + Overlay Glaze Glazura překrytí + Screen Light Světlo závoje + Soft Light Wash Lavírka měkkého světla + Burst Výbuch + Rounded Square Zaoblený čtverec Save Brush Library… Uložit knihovnu štětců… @msg `{_1}` has no brushes to apply `{_1}` nemá žádné štětce k použití @msg missing `library` (see brush.libraries) chybí `library` (viz brush.libraries) diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 433c6af3d6..435472e180 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -6257,6 +6257,240 @@ axis Y Axis Y-akse Stars Stjerner Triangles Trekanter Sparkles Gnister + Warm Gray Varm grå + Cool Gray Kølig grå + Neutrals Neutrale toner + Ivory Elfenben + Linen Hør + Oat Havre + Greige Greige + Stone Sten + Taupe Taupe + Slate Skifer + Clay Ler + Terracotta Terrakotta + Ochre Okker + Umber Umbra + Sand Sand + Olive Oliven + Moss Mos + Rosy Rosa + Neutral Neutral + Golden Gylden + Pastel Pastel + Pastel Red Pastelrød + Pastel Orange Pastelorange + Pastel Amber Pastelrav + Pastel Yellow Pastelgul + Pastel Lime Pastellime + Pastel Green Pastelgrøn + Pastel Teal Pastelblågrøn + Pastel Cyan Pastelcyan + Pastel Azure Pastelazur + Pastel Blue Pastelblå + Pastel Violet Pastelviolet + Pastel Magenta Pastelmagenta + Soft Red Blød rød + Soft Orange Blød orange + Soft Amber Blød rav + Soft Yellow Blød gul + Soft Lime Blød lime + Soft Green Blød grøn + Soft Teal Blød blågrøn + Soft Cyan Blød cyan + Soft Azure Blød azur + Soft Blue Blød blå + Soft Violet Blød violet + Soft Magenta Blød magenta + Vivid Red Intens rød + Vivid Orange Intens orange + Vivid Amber Intens rav + Vivid Yellow Intens gul + Vivid Lime Intens lime + Vivid Green Intens grøn + Vivid Teal Intens blågrøn + Vivid Cyan Intens cyan + Vivid Azure Intens azur + Vivid Blue Intens blå + Vivid Violet Intens violet + Vivid Magenta Intens magenta + Deep Dybe + Deep Red Dyb rød + Deep Orange Dyb orange + Deep Amber Dyb rav + Deep Yellow Dyb gul + Deep Lime Dyb lime + Deep Green Dyb grøn + Deep Teal Dyb blågrøn + Deep Cyan Dyb cyan + Deep Azure Dyb azur + Deep Blue Dyb blå + Deep Violet Dyb violet + Deep Magenta Dyb magenta + Gold Guld + Silver Sølv + Bronze Bronze + Copper Kobber + Brass Messing + Rose Gold Rosaguld + Gunmetal Gunmetal + Platinum Platin + Pewter Tin + Ember Glød + Lagoon Lagune + Dusk Skumring + Clay to Teal Ler til blågrøn + Plum to Olive Blomme til oliven + Complementary Coral Koral komplementær + Split Complementary Coral Koral delt komplementær + Analogous Coral Koral analog + Triad Coral Koral triade + Tetrad Coral Koral tetrad + Pentagram Coral Koral pentagram + Complementary Teal Blågrøn komplementær + Split Complementary Teal Blågrøn delt komplementær + Analogous Teal Blågrøn analog + Triad Teal Blågrøn triade + Tetrad Teal Blågrøn tetrad + Pentagram Teal Blågrøn pentagram + Soft Spectrum Blødt spektrum + Red to Amber Rød til rav + Orange to Yellow Orange til gul + Amber to Lime Rav til lime + Yellow to Green Gul til grøn + Lime to Teal Lime til blågrøn + Green to Cyan Grøn til cyan + Teal to Azure Blågrøn til azur + Cyan to Blue Cyan til blå + Azure to Violet Azur til violet + Blue to Magenta Blå til magenta + Violet to Red Violet til rød + Magenta to Orange Magenta til orange + Dawn Daggry + Noon Middag + Sunset Solnedgang + Night Nat + Overcast Overskyet + White to Black Hvid til sort + Light Grays Lyse gråtoner + Dark Grays Mørke gråtoner + Warm Grays Varme gråtoner + Cool Grays Kølige gråtoner + Fade to Transparent Udtoning til gennemsigtig + White Fade Hvid udtoning + Vignette Vignet + Mist Dis + Petal Kronblad + Fern Bregne + Smoke Røg + Honey Honning + Seafoam Havskum + Lavender Lavendel + Driftwood Drivtømmer + Ink Wash Tuschlavering + Tide Tidevand + Bloom Blomstring + Dew Dug + Pollen Pollen + Lichen Lav + Prism Veil Prismeslør + Opal Ribbon Opalbånd + Pearl Flash Perleglimt + Aurora Foil Nordlysfolie + Iris Sheen Irisglans + Frost Spectrum Frostspektrum + Silver Tide Sølvtidevand + Rose Quartz Gleam Rosakvartsglans + Moonstone Shift Månestensskær + Violet Edge Violet kant + Mint Halo Mynteglorie + Amber Corona Ravkorona + Polar Glint Polarglimt + Pastel Orbit Pastelbane + Coral and Navy Koral og marineblå + Plum and Lime Blomme og lime + Teal and Gold Blågrøn og guld + Indigo and Peach Indigo og fersken + Forest and Rose Skov og rosa + Red Glow Rød glød + Orange Glow Orange glød + Amber Glow Ravglød + Yellow Glow Gul glød + Lime Glow Limeglød + Green Glow Grøn glød + Teal Glow Blågrøn glød + Cyan Glow Cyanglød + Azure Glow Azurglød + Blue Glow Blå glød + Violet Glow Violet glød + Magenta Glow Magentaglød + Polka Dots Prikker + Vertical Stripes Lodrette striber + Horizontal Stripes Vandrette striber + Diagonal Stripes Diagonale striber + Checkerboard Skakbræt + Diamonds Ruder + Crosses Kryds + Coarse Grit Groft korn + Stipple Punktering + Scratches Ridser + Sparse Flecks Spredte pletter + Dense Flecks Tætte pletter + Sine Bands Sinusbånd + Ripple Lines Bølgelinjer + Interference Rings Interferensringe + Offset Rings Forskudte ringe + Warped Checks Forvredne tern + Pinched Stripes Klemte striber + Chevron Pulse Chevronpuls + Radiating Lenses Strålende linser + Soft Shadow Blød skygge + Hard Shadow Hård skygge + Lifted Card Løftet kort + Neon Tube Neonrør + Inner Light Indre lys + Feathered Blød kant + Haze Dunst + Double Rule Dobbelt streg + Triple Rule Tredobbelt streg + Dashed Border Stiplet kant + Dotted Border Prikket kant + Offset Keyline Forskudt konturlinje + Inset Keyline Indre konturlinje + Outside Stroke Ydre streg + Pointer Viser + Highlighter Overstregningstusch + Sketchy Line Skitseagtig linje + Scribble Fill Kruseduldefyld + Wobble Slinger + Zig Zag Edge Zigzagkant + Wavy Edge Bølget kant + Puffy Oppustet + Starburst Stjerneudbrud + Glossy Blank + Brushed Metal Børstet metal + Spotlight Spotlys + Sunset Band Solnedgangsbånd + Sea Glass Havglas + Pearl Perle + Chrome Rim Kromkant + Glow Orb Lyskugle + Pill Badge Pillemærke + Round Badge Rundt mærke + Flag Wave Vajende flag + Bulge Bule + Twisted Snoet + Echo Ekko + Spiral Copies Spiralkopier + Multiply Tint Multiplikationstone + Darken Veil Mørkere slør + Ghosted Spøgelsesagtig + Two Tone Tofarvet + Overlay Glaze Overlejringsglasur + Screen Light Skærmlys + Soft Light Wash Blødt lys-lavering + Burst Udbrud + Rounded Square Afrundet kvadrat Save Brush Library… Gem penselbibliotek… @msg no empty artboards to delete ingen tomme tegneflader at slette Scale Presets Skaleringsforudindstillinger diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 951f6f9c37..bf00843a25 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -6387,6 +6387,247 @@ axis Y Axis Y-Achse Stars Sterne Triangles Dreiecke Sparkles Funkeln + Warm Gray Warmgrau + Cool Gray Kühlgrau + Neutrals Neutraltöne + Ivory Elfenbein + Linen Leinen + Oat Hafer + Greige Greige + Stone Stein + Taupe Taupe + Slate Schiefer + Clay Ton + Terracotta Terrakotta + Ochre Ocker + Umber Umbra + Sand Sand + Olive Oliv + Moss Moos + Rosy Rosig + Neutral Neutral + Golden Golden + Pastel Pastell + Pastel Red Pastellrot + Pastel Orange Pastellorange + Pastel Amber Pastellbernstein + Pastel Yellow Pastellgelb + Pastel Lime Pastelllimette + Pastel Green Pastellgrün + Pastel Teal Pastellpetrol + Pastel Cyan Pastellcyan + Pastel Azure Pastellazur + Pastel Blue Pastellblau + Pastel Violet Pastellviolett + Pastel Magenta Pastellmagenta + Soft Red Sanftes Rot + Soft Orange Sanftes Orange + Soft Amber Sanfter Bernstein + Soft Yellow Sanftes Gelb + Soft Lime Sanfte Limette + Soft Green Sanftes Grün + Soft Teal Sanftes Petrol + Soft Cyan Sanftes Cyan + Soft Azure Sanftes Azur + Soft Blue Sanftes Blau + Soft Violet Sanftes Violett + Soft Magenta Sanftes Magenta + Vivid Red Leuchtendes Rot + Vivid Orange Leuchtendes Orange + Vivid Amber Leuchtender Bernstein + Vivid Yellow Leuchtendes Gelb + Vivid Lime Leuchtende Limette + Vivid Green Leuchtendes Grün + Vivid Teal Leuchtendes Petrol + Vivid Cyan Leuchtendes Cyan + Vivid Azure Leuchtendes Azur + Vivid Blue Leuchtendes Blau + Vivid Violet Leuchtendes Violett + Vivid Magenta Leuchtendes Magenta + Deep Tief + Deep Red Tiefrot + Deep Orange Tieforange + Deep Amber Tiefbernstein + Deep Yellow Tiefgelb + Deep Lime Tieflimette + Deep Green Tiefgrün + Deep Teal Tiefpetrol + Deep Cyan Tiefcyan + Deep Azure Tiefazur + Deep Blue Tiefblau + Deep Violet Tiefviolett + Deep Magenta Tiefmagenta + Gold Gold + Silver Silber + Bronze Bronze + Copper Kupfer + Brass Messing + Rose Gold Roségold + Gunmetal Anthrazitmetall + Platinum Platin + Pewter Zinn + Ember Glut + Lagoon Lagune + Dusk Abenddämmerung + Clay to Teal Ton zu Petrol + Plum to Olive Pflaume zu Oliv + Complementary Coral Koralle komplementär + Split Complementary Coral Koralle geteilt komplementär + Analogous Coral Koralle analog + Triad Coral Koralle Triade + Tetrad Coral Koralle Tetrade + Pentagram Coral Koralle Pentagramm + Complementary Teal Petrol komplementär + Split Complementary Teal Petrol geteilt komplementär + Analogous Teal Petrol analog + Triad Teal Petrol Triade + Tetrad Teal Petrol Tetrade + Pentagram Teal Petrol Pentagramm + Soft Spectrum Sanftes Spektrum + Red to Amber Rot zu Bernstein + Orange to Yellow Orange zu Gelb + Amber to Lime Bernstein zu Limette + Yellow to Green Gelb zu Grün + Lime to Teal Limette zu Petrol + Green to Cyan Grün zu Cyan + Teal to Azure Petrol zu Azur + Cyan to Blue Cyan zu Blau + Azure to Violet Azur zu Violett + Blue to Magenta Blau zu Magenta + Violet to Red Violett zu Rot + Magenta to Orange Magenta zu Orange + Dawn Morgendämmerung + Noon Mittag + Sunset Sonnenuntergang + Night Nacht + Overcast Bewölkt + White to Black Weiß zu Schwarz + Light Grays Helle Grautöne + Dark Grays Dunkle Grautöne + Warm Grays Warme Grautöne + Cool Grays Kühle Grautöne + Fade to Transparent Verlauf zu transparent + White Fade Weißer Verlauf + Vignette Vignette + Mist Nebel + Petal Blütenblatt + Fern Farn + Smoke Rauch + Honey Honig + Seafoam Meerschaum + Lavender Lavendel + Driftwood Treibholz + Ink Wash Tuschelavierung + Tide Gezeiten + Bloom Blüte + Dew Tau + Pollen Pollen + Lichen Flechte + Prism Veil Prismenschleier + Opal Ribbon Opalband + Pearl Flash Perlmuttblitz + Aurora Foil Polarlichtfolie + Iris Sheen Irisschimmer + Frost Spectrum Frostspektrum + Silver Tide Silberflut + Rose Quartz Gleam Rosenquarzglanz + Moonstone Shift Mondsteinschimmer + Violet Edge Violetter Rand + Mint Halo Minzhof + Amber Corona Bernsteinkorona + Polar Glint Polarglanz + Pastel Orbit Pastellorbit + Coral and Navy Koralle und Marineblau + Plum and Lime Pflaume und Limette + Teal and Gold Petrol und Gold + Indigo and Peach Indigo und Pfirsich + Forest and Rose Wald und Rosé + Red Glow Rotes Leuchten + Orange Glow Oranges Leuchten + Amber Glow Bernsteinleuchten + Yellow Glow Gelbes Leuchten + Lime Glow Limettenleuchten + Green Glow Grünes Leuchten + Teal Glow Petrolleuchten + Cyan Glow Cyanleuchten + Azure Glow Azurleuchten + Blue Glow Blaues Leuchten + Violet Glow Violettes Leuchten + Magenta Glow Magentaleuchten + Polka Dots Tupfen + Vertical Stripes Senkrechte Streifen + Horizontal Stripes Waagerechte Streifen + Diagonal Stripes Diagonale Streifen + Checkerboard Schachbrett + Diamonds Rauten + Crosses Kreuze + Coarse Grit Grobe Körnung + Stipple Punktierung + Scratches Kratzer + Sparse Flecks Lockere Sprenkel + Dense Flecks Dichte Sprenkel + Sine Bands Sinusbänder + Ripple Lines Wellenlinien + Interference Rings Interferenzringe + Offset Rings Versetzte Ringe + Warped Checks Verzerrte Karos + Pinched Stripes Eingeschnürte Streifen + Chevron Pulse Winkelpuls + Radiating Lenses Strahlende Linsen + Soft Shadow Weicher Schatten + Hard Shadow Harter Schatten + Lifted Card Angehobene Karte + Neon Tube Neonröhre + Inner Light Inneres Licht + Feathered Weiche Kante + Haze Dunst + Double Rule Doppellinie + Triple Rule Dreifachlinie + Dashed Border Gestrichelter Rahmen + Dotted Border Gepunkteter Rahmen + Offset Keyline Versetzte Kontur + Inset Keyline Innere Kontur + Outside Stroke Außenkontur + Pointer Zeiger + Highlighter Textmarker + Sketchy Line Skizzenlinie + Scribble Fill Kritzelfüllung + Wobble Wackeln + Zig Zag Edge Zickzackkante + Wavy Edge Wellenkante + Puffy Aufgebläht + Starburst Sternexplosion + Glossy Glänzend + Brushed Metal Gebürstetes Metall + Spotlight Spotlicht + Sunset Band Abendrotband + Sea Glass Meerglas + Pearl Perle + Chrome Rim Chromrand + Glow Orb Leuchtkugel + Pill Badge Pillenabzeichen + Round Badge Rundes Abzeichen + Flag Wave Flaggenwelle + Bulge Wölbung + Twisted Verdreht + Echo Echo + Spiral Copies Spiralkopien + Multiply Tint Multiplizieren-Tönung + Darken Veil Abdunkeln-Schleier + Ghosted Geisterhaft + Two Tone Zweifarbig + Overlay Glaze Ineinanderkopieren-Lasur + Screen Light Negativ-multiplizieren-Licht + Soft Light Wash Weiches-Licht-Lavierung + Burst Strahlenkranz + Rounded Square Abgerundetes Quadrat + Bar Balken + Fine Dots Feine Punkte + Hexagon Sechseck + Speckle Sprenkel + Spectrum Spektrum + Triangle Dreieck + Vivid Leuchtend Save Brush Library… Pinsel-Bibliothek speichern… @msg `{_1}` has no brushes to apply `{_1}` hat keine Pinsel zum Anwenden @msg missing `library` (see brush.libraries) `library` fehlt (siehe brush.libraries) diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 62e3adc491..0dfddd132a 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -6747,6 +6747,240 @@ axis Y Axis Άξονας Y Stars Αστέρια Triangles Τρίγωνα Sparkles Σπίθες + Warm Gray Θερμό γκρι + Cool Gray Ψυχρό γκρι + Neutrals Ουδέτερα + Ivory Ελεφαντόδοντο + Linen Λινό + Oat Βρόμη + Greige Γκρεζ + Stone Πέτρα + Taupe Γκριζοκαφέ + Slate Σχιστόλιθος + Clay Πηλός + Terracotta Τερακότα + Ochre Ώχρα + Umber Σκιά + Sand Άμμος + Olive Λαδί + Moss Βρύα + Rosy Ροδαλό + Neutral Ουδέτερο + Golden Χρυσαφί + Pastel Παστέλ + Pastel Red Παστέλ κόκκινο + Pastel Orange Παστέλ πορτοκαλί + Pastel Amber Παστέλ κεχριμπαρί + Pastel Yellow Παστέλ κίτρινο + Pastel Lime Παστέλ λάιμ + Pastel Green Παστέλ πράσινο + Pastel Teal Παστέλ γαλαζοπράσινο + Pastel Cyan Παστέλ κυανό + Pastel Azure Παστέλ γαλάζιο + Pastel Blue Παστέλ μπλε + Pastel Violet Παστέλ βιολετί + Pastel Magenta Παστέλ ματζέντα + Soft Red Απαλό κόκκινο + Soft Orange Απαλό πορτοκαλί + Soft Amber Απαλό κεχριμπαρί + Soft Yellow Απαλό κίτρινο + Soft Lime Απαλό λάιμ + Soft Green Απαλό πράσινο + Soft Teal Απαλό γαλαζοπράσινο + Soft Cyan Απαλό κυανό + Soft Azure Απαλό γαλάζιο + Soft Blue Απαλό μπλε + Soft Violet Απαλό βιολετί + Soft Magenta Απαλό ματζέντα + Vivid Red Έντονο κόκκινο + Vivid Orange Έντονο πορτοκαλί + Vivid Amber Έντονο κεχριμπαρί + Vivid Yellow Έντονο κίτρινο + Vivid Lime Έντονο λάιμ + Vivid Green Έντονο πράσινο + Vivid Teal Έντονο γαλαζοπράσινο + Vivid Cyan Έντονο κυανό + Vivid Azure Έντονο γαλάζιο + Vivid Blue Έντονο μπλε + Vivid Violet Έντονο βιολετί + Vivid Magenta Έντονο ματζέντα + Deep Βαθιά + Deep Red Βαθύ κόκκινο + Deep Orange Βαθύ πορτοκαλί + Deep Amber Βαθύ κεχριμπαρί + Deep Yellow Βαθύ κίτρινο + Deep Lime Βαθύ λάιμ + Deep Green Βαθύ πράσινο + Deep Teal Βαθύ γαλαζοπράσινο + Deep Cyan Βαθύ κυανό + Deep Azure Βαθύ γαλάζιο + Deep Blue Βαθύ μπλε + Deep Violet Βαθύ βιολετί + Deep Magenta Βαθύ ματζέντα + Gold Χρυσό + Silver Ασημί + Bronze Μπρούντζος + Copper Χαλκός + Brass Ορείχαλκος + Rose Gold Ροζ χρυσό + Gunmetal Ατσαλί + Platinum Πλατίνα + Pewter Κασσίτερος + Ember Θράκα + Lagoon Λιμνοθάλασσα + Dusk Σούρουπο + Clay to Teal Από πηλό σε γαλαζοπράσινο + Plum to Olive Από δαμασκηνί σε λαδί + Complementary Coral Κοραλλί, συμπληρωματικά + Split Complementary Coral Κοραλλί, διαίρεση συμπληρωματικών + Analogous Coral Κοραλλί, ανάλογα + Triad Coral Κοραλλί, τριάδα + Tetrad Coral Κοραλλί, τετράδα + Pentagram Coral Κοραλλί, πεντάγραμμο + Complementary Teal Γαλαζοπράσινο, συμπληρωματικά + Split Complementary Teal Γαλαζοπράσινο, διαίρεση συμπληρωματικών + Analogous Teal Γαλαζοπράσινο, ανάλογα + Triad Teal Γαλαζοπράσινο, τριάδα + Tetrad Teal Γαλαζοπράσινο, τετράδα + Pentagram Teal Γαλαζοπράσινο, πεντάγραμμο + Soft Spectrum Απαλό φάσμα + Red to Amber Από κόκκινο σε κεχριμπαρί + Orange to Yellow Από πορτοκαλί σε κίτρινο + Amber to Lime Από κεχριμπαρί σε λάιμ + Yellow to Green Από κίτρινο σε πράσινο + Lime to Teal Από λάιμ σε γαλαζοπράσινο + Green to Cyan Από πράσινο σε κυανό + Teal to Azure Από γαλαζοπράσινο σε γαλάζιο + Cyan to Blue Από κυανό σε μπλε + Azure to Violet Από γαλάζιο σε βιολετί + Blue to Magenta Από μπλε σε ματζέντα + Violet to Red Από βιολετί σε κόκκινο + Magenta to Orange Από ματζέντα σε πορτοκαλί + Dawn Αυγή + Noon Μεσημέρι + Sunset Ηλιοβασίλεμα + Night Νύχτα + Overcast Συννεφιά + White to Black Από λευκό σε μαύρο + Light Grays Ανοιχτά γκρι + Dark Grays Σκούρα γκρι + Warm Grays Θερμά γκρι + Cool Grays Ψυχρά γκρι + Fade to Transparent Σβήσιμο σε διαφανές + White Fade Λευκό σβήσιμο + Vignette Βινιέτα + Mist Ομίχλη + Petal Πέταλο + Fern Φτέρη + Smoke Καπνός + Honey Μέλι + Seafoam Αφρός θάλασσας + Lavender Λεβάντα + Driftwood Ξύλο θάλασσας + Ink Wash Αραιωμένο μελάνι + Tide Παλίρροια + Bloom Άνθιση + Dew Δροσιά + Pollen Γύρη + Lichen Λειχήνα + Prism Veil Πέπλο πρίσματος + Opal Ribbon Κορδέλα οπαλίου + Pearl Flash Μαργαριταρένια λάμψη + Aurora Foil Φύλλο σέλαος + Iris Sheen Ιριδίζουσα γυαλάδα + Frost Spectrum Παγωμένο φάσμα + Silver Tide Ασημένια παλίρροια + Rose Quartz Gleam Λάμψη ροζ χαλαζία + Moonstone Shift Ανταύγεια σεληνόπετρας + Violet Edge Βιολετί άκρη + Mint Halo Άλως μέντας + Amber Corona Κεχριμπαρένιο στέμμα + Polar Glint Πολική αναλαμπή + Pastel Orbit Παστέλ τροχιά + Coral and Navy Κοραλλί και ναυτικό μπλε + Plum and Lime Δαμασκηνί και λάιμ + Teal and Gold Γαλαζοπράσινο και χρυσό + Indigo and Peach Λουλακί και ροδακινί + Forest and Rose Δάσος και τριαντάφυλλο + Red Glow Κόκκινη λάμψη + Orange Glow Πορτοκαλί λάμψη + Amber Glow Κεχριμπαρένια λάμψη + Yellow Glow Κίτρινη λάμψη + Lime Glow Λάμψη λάιμ + Green Glow Πράσινη λάμψη + Teal Glow Γαλαζοπράσινη λάμψη + Cyan Glow Κυανή λάμψη + Azure Glow Γαλάζια λάμψη + Blue Glow Μπλε λάμψη + Violet Glow Βιολετί λάμψη + Magenta Glow Λάμψη ματζέντα + Polka Dots Πουά + Vertical Stripes Κάθετες ρίγες + Horizontal Stripes Οριζόντιες ρίγες + Diagonal Stripes Διαγώνιες ρίγες + Checkerboard Σκακιέρα + Diamonds Ρόμβοι + Crosses Σταυροί + Coarse Grit Χοντρός κόκκος + Stipple Στικτό + Scratches Γρατσουνιές + Sparse Flecks Αραιές κηλίδες + Dense Flecks Πυκνές κηλίδες + Sine Bands Ημιτονοειδείς ζώνες + Ripple Lines Γραμμές κυματισμού + Interference Rings Δακτύλιοι συμβολής + Offset Rings Μετατοπισμένοι δακτύλιοι + Warped Checks Παραμορφωμένο καρό + Pinched Stripes Στενεμένες ρίγες + Chevron Pulse Παλμός σεβρόν + Radiating Lenses Ακτινωτοί φακοί + Soft Shadow Απαλή σκιά + Hard Shadow Σκληρή σκιά + Lifted Card Ανυψωμένη κάρτα + Neon Tube Σωλήνας νέον + Inner Light Εσωτερικό φως + Feathered Απαλές άκρες + Haze Θολούρα + Double Rule Διπλή γραμμή + Triple Rule Τριπλή γραμμή + Dashed Border Διακεκομμένο περίγραμμα + Dotted Border Περίγραμμα με τελείες + Offset Keyline Μετατοπισμένη γραμμή περιγράμματος + Inset Keyline Εσωτερική γραμμή περιγράμματος + Outside Stroke Εξωτερική πινελιά + Pointer Δείκτης + Highlighter Μαρκαδόρος υπογράμμισης + Sketchy Line Γραμμή σκίτσου + Scribble Fill Γέμισμα με μουτζούρες + Wobble Τρεμούλιασμα + Zig Zag Edge Ζιγκζάγκ άκρη + Wavy Edge Κυματιστή άκρη + Puffy Φουσκωτό + Starburst Έκρηξη αστεριού + Glossy Γυαλιστερό + Brushed Metal Βουρτσισμένο μέταλλο + Spotlight Προβολέας + Sunset Band Ζώνη ηλιοβασιλέματος + Sea Glass Γυαλί θάλασσας + Pearl Μαργαριτάρι + Chrome Rim Χρωμιωμένο χείλος + Glow Orb Φωτεινή σφαίρα + Pill Badge Σήμα κάψουλα + Round Badge Στρογγυλό σήμα + Flag Wave Κυματιστή σημαία + Bulge Διόγκωση + Twisted Στριμμένο + Echo Ηχώ + Spiral Copies Αντίγραφα σε σπείρα + Multiply Tint Απόχρωση πολλαπλασιασμού + Darken Veil Πέπλο σκοτεινιάσματος + Ghosted Φαντασματικό + Two Tone Δίχρωμο + Overlay Glaze Βερνίκι επικάλυψης + Screen Light Φως αρνητικού πολλαπλασιασμού + Soft Light Wash Αραίωση απαλού φωτός + Burst Έκρηξη + Rounded Square Στρογγυλεμένο τετράγωνο Save Brush Library… Αποθήκευση βιβλιοθήκης πινέλων… @msg `{_1}` has no brushes to apply Η `{_1}` δεν έχει πινέλα για εφαρμογή @msg missing `library` (see brush.libraries) λείπει το `library` (δείτε brush.libraries) diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index d1c6aa53af..b05b0cf626 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -6738,6 +6738,240 @@ axis Y Axis Eje Y Stars Estrellas Triangles Triángulos Sparkles Destellos + Warm Gray Gris cálido + Cool Gray Gris frío + Neutrals Neutros + Ivory Marfil + Linen Lino + Oat Avena + Greige Greige + Stone Piedra + Taupe Topo + Slate Pizarra + Clay Arcilla + Terracotta Terracota + Ochre Ocre + Umber Sombra + Sand Arena + Olive Oliva + Moss Musgo + Rosy Rosado + Neutral Neutro + Golden Dorado + Pastel Pastel + Pastel Red Rojo pastel + Pastel Orange Naranja pastel + Pastel Amber Ámbar pastel + Pastel Yellow Amarillo pastel + Pastel Lime Lima pastel + Pastel Green Verde pastel + Pastel Teal Verde azulado pastel + Pastel Cyan Cian pastel + Pastel Azure Azur pastel + Pastel Blue Azul pastel + Pastel Violet Violeta pastel + Pastel Magenta Magenta pastel + Soft Red Rojo suave + Soft Orange Naranja suave + Soft Amber Ámbar suave + Soft Yellow Amarillo suave + Soft Lime Lima suave + Soft Green Verde suave + Soft Teal Verde azulado suave + Soft Cyan Cian suave + Soft Azure Azur suave + Soft Blue Azul suave + Soft Violet Violeta suave + Soft Magenta Magenta suave + Vivid Red Rojo vivo + Vivid Orange Naranja vivo + Vivid Amber Ámbar vivo + Vivid Yellow Amarillo vivo + Vivid Lime Lima vivo + Vivid Green Verde vivo + Vivid Teal Verde azulado vivo + Vivid Cyan Cian vivo + Vivid Azure Azur vivo + Vivid Blue Azul vivo + Vivid Violet Violeta vivo + Vivid Magenta Magenta vivo + Deep Oscuros + Deep Red Rojo oscuro + Deep Orange Naranja oscuro + Deep Amber Ámbar oscuro + Deep Yellow Amarillo oscuro + Deep Lime Lima oscuro + Deep Green Verde oscuro + Deep Teal Verde azulado oscuro + Deep Cyan Cian oscuro + Deep Azure Azur oscuro + Deep Blue Azul oscuro + Deep Violet Violeta oscuro + Deep Magenta Magenta oscuro + Gold Oro + Silver Plata + Bronze Bronce + Copper Cobre + Brass Latón + Rose Gold Oro rosa + Gunmetal Gris metal + Platinum Platino + Pewter Peltre + Ember Brasa + Lagoon Laguna + Dusk Anochecer + Clay to Teal Arcilla a verde azulado + Plum to Olive Ciruela a oliva + Complementary Coral Coral complementario + Split Complementary Coral Coral complementario dividido + Analogous Coral Coral análogo + Triad Coral Coral en tríada + Tetrad Coral Coral en tétrada + Pentagram Coral Coral en pentagrama + Complementary Teal Verde azulado complementario + Split Complementary Teal Verde azulado complementario dividido + Analogous Teal Verde azulado análogo + Triad Teal Verde azulado en tríada + Tetrad Teal Verde azulado en tétrada + Pentagram Teal Verde azulado en pentagrama + Soft Spectrum Espectro suave + Red to Amber Rojo a ámbar + Orange to Yellow Naranja a amarillo + Amber to Lime Ámbar a lima + Yellow to Green Amarillo a verde + Lime to Teal Lima a verde azulado + Green to Cyan Verde a cian + Teal to Azure Verde azulado a azur + Cyan to Blue Cian a azul + Azure to Violet Azur a violeta + Blue to Magenta Azul a magenta + Violet to Red Violeta a rojo + Magenta to Orange Magenta a naranja + Dawn Amanecer + Noon Mediodía + Sunset Puesta de sol + Night Noche + Overcast Nublado + White to Black Blanco a negro + Light Grays Grises claros + Dark Grays Grises oscuros + Warm Grays Grises cálidos + Cool Grays Grises fríos + Fade to Transparent Fundido a transparente + White Fade Fundido blanco + Vignette Viñeta + Mist Neblina + Petal Pétalo + Fern Helecho + Smoke Humo + Honey Miel + Seafoam Espuma de mar + Lavender Lavanda + Driftwood Madera de deriva + Ink Wash Aguada de tinta + Tide Marea + Bloom Floración + Dew Rocío + Pollen Polen + Lichen Liquen + Prism Veil Velo prismático + Opal Ribbon Cinta de ópalo + Pearl Flash Destello nacarado + Aurora Foil Lámina aurora + Iris Sheen Brillo iris + Frost Spectrum Espectro escarchado + Silver Tide Marea plateada + Rose Quartz Gleam Brillo de cuarzo rosa + Moonstone Shift Reflejo de piedra lunar + Violet Edge Borde violeta + Mint Halo Halo menta + Amber Corona Corona ámbar + Polar Glint Destello polar + Pastel Orbit Órbita pastel + Coral and Navy Coral y azul marino + Plum and Lime Ciruela y lima + Teal and Gold Verde azulado y oro + Indigo and Peach Índigo y melocotón + Forest and Rose Bosque y rosa + Red Glow Resplandor rojo + Orange Glow Resplandor naranja + Amber Glow Resplandor ámbar + Yellow Glow Resplandor amarillo + Lime Glow Resplandor lima + Green Glow Resplandor verde + Teal Glow Resplandor verde azulado + Cyan Glow Resplandor cian + Azure Glow Resplandor azur + Blue Glow Resplandor azul + Violet Glow Resplandor violeta + Magenta Glow Resplandor magenta + Polka Dots Lunares + Vertical Stripes Rayas verticales + Horizontal Stripes Rayas horizontales + Diagonal Stripes Rayas diagonales + Checkerboard Tablero de ajedrez + Diamonds Rombos + Crosses Cruces + Coarse Grit Grano grueso + Stipple Punteado + Scratches Arañazos + Sparse Flecks Motas dispersas + Dense Flecks Motas densas + Sine Bands Bandas sinusoidales + Ripple Lines Líneas onduladas + Interference Rings Anillos de interferencia + Offset Rings Anillos desplazados + Warped Checks Cuadros deformados + Pinched Stripes Rayas pellizcadas + Chevron Pulse Pulso de chevrones + Radiating Lenses Lentes radiantes + Soft Shadow Sombra suave + Hard Shadow Sombra dura + Lifted Card Tarjeta elevada + Neon Tube Tubo de neón + Inner Light Luz interior + Feathered Difuminado + Haze Bruma + Double Rule Filete doble + Triple Rule Filete triple + Dashed Border Borde discontinuo + Dotted Border Borde punteado + Offset Keyline Filete desplazado + Inset Keyline Filete interior + Outside Stroke Trazo exterior + Pointer Puntero + Highlighter Rotulador + Sketchy Line Línea esbozada + Scribble Fill Relleno garabateado + Wobble Tembloroso + Zig Zag Edge Borde en zigzag + Wavy Edge Borde ondulado + Puffy Hinchado + Starburst Estallido estelar + Glossy Brillante + Brushed Metal Metal cepillado + Spotlight Foco + Sunset Band Banda de atardecer + Sea Glass Vidrio marino + Pearl Perla + Chrome Rim Borde cromado + Glow Orb Orbe luminoso + Pill Badge Insignia de píldora + Round Badge Insignia redonda + Flag Wave Bandera ondeante + Bulge Abultamiento + Twisted Retorcido + Echo Eco + Spiral Copies Copias en espiral + Multiply Tint Tinte multiplicar + Darken Veil Velo oscurecer + Ghosted Fantasma + Two Tone Bicolor + Overlay Glaze Veladura superponer + Screen Light Luz trama + Soft Light Wash Aguada luz suave + Burst Estallido + Rounded Square Cuadrado redondeado Save Brush Library… Guardar biblioteca de pinceles… @msg `{_1}` has no brushes to apply `{_1}` no tiene pinceles para aplicar @msg missing `library` (see brush.libraries) falta `library` (consulte brush.libraries) diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 45e47fd355..c23baf586a 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -6825,6 +6825,240 @@ axis Y Axis Y-akseli Stars Tähdet Triangles Kolmiot Sparkles Kipinät + Warm Gray Lämmin harmaa + Cool Gray Viileä harmaa + Neutrals Neutraalit + Ivory Norsunluu + Linen Pellava + Oat Kaura + Greige Greige + Stone Kivi + Taupe Taupe + Slate Liuskekivi + Clay Savi + Terracotta Terrakotta + Ochre Okra + Umber Umbra + Sand Hiekka + Olive Oliivi + Moss Sammal + Rosy Ruusuinen + Neutral Neutraali + Golden Kultainen + Pastel Pastelli + Pastel Red Pastellinpunainen + Pastel Orange Pastellinoranssi + Pastel Amber Pastellinmeripihka + Pastel Yellow Pastellinkeltainen + Pastel Lime Pastellinlime + Pastel Green Pastellinvihreä + Pastel Teal Pastellinsinivihreä + Pastel Cyan Pastellinsyaani + Pastel Azure Pastellinasuuri + Pastel Blue Pastellinsininen + Pastel Violet Pastellinvioletti + Pastel Magenta Pastellinmagenta + Soft Red Pehmeä punainen + Soft Orange Pehmeä oranssi + Soft Amber Pehmeä meripihka + Soft Yellow Pehmeä keltainen + Soft Lime Pehmeä lime + Soft Green Pehmeä vihreä + Soft Teal Pehmeä sinivihreä + Soft Cyan Pehmeä syaani + Soft Azure Pehmeä asuuri + Soft Blue Pehmeä sininen + Soft Violet Pehmeä violetti + Soft Magenta Pehmeä magenta + Vivid Red Eloisa punainen + Vivid Orange Eloisa oranssi + Vivid Amber Eloisa meripihka + Vivid Yellow Eloisa keltainen + Vivid Lime Eloisa lime + Vivid Green Eloisa vihreä + Vivid Teal Eloisa sinivihreä + Vivid Cyan Eloisa syaani + Vivid Azure Eloisa asuuri + Vivid Blue Eloisa sininen + Vivid Violet Eloisa violetti + Vivid Magenta Eloisa magenta + Deep Syvät + Deep Red Syvä punainen + Deep Orange Syvä oranssi + Deep Amber Syvä meripihka + Deep Yellow Syvä keltainen + Deep Lime Syvä lime + Deep Green Syvä vihreä + Deep Teal Syvä sinivihreä + Deep Cyan Syvä syaani + Deep Azure Syvä asuuri + Deep Blue Syvä sininen + Deep Violet Syvä violetti + Deep Magenta Syvä magenta + Gold Kulta + Silver Hopea + Bronze Pronssi + Copper Kupari + Brass Messinki + Rose Gold Ruusukulta + Gunmetal Tykkimetalli + Platinum Platina + Pewter Tina + Ember Hiillos + Lagoon Laguuni + Dusk Iltahämärä + Clay to Teal Savesta sinivihreään + Plum to Olive Luumusta oliiviin + Complementary Coral Koralli, vastaväri + Split Complementary Coral Koralli, jaettu vastaväri + Analogous Coral Koralli, analoginen + Triad Coral Koralli, triadi + Tetrad Coral Koralli, tetradi + Pentagram Coral Koralli, pentagrammi + Complementary Teal Sinivihreä, vastaväri + Split Complementary Teal Sinivihreä, jaettu vastaväri + Analogous Teal Sinivihreä, analoginen + Triad Teal Sinivihreä, triadi + Tetrad Teal Sinivihreä, tetradi + Pentagram Teal Sinivihreä, pentagrammi + Soft Spectrum Pehmeä spektri + Red to Amber Punaisesta meripihkaan + Orange to Yellow Oranssista keltaiseen + Amber to Lime Meripihkasta limeen + Yellow to Green Keltaisesta vihreään + Lime to Teal Limestä sinivihreään + Green to Cyan Vihreästä syaaniin + Teal to Azure Sinivihreästä asuuriin + Cyan to Blue Syaanista siniseen + Azure to Violet Asuurista violettiin + Blue to Magenta Sinisestä magentaan + Violet to Red Violetista punaiseen + Magenta to Orange Magentasta oranssiin + Dawn Aamunkoitto + Noon Keskipäivä + Sunset Auringonlasku + Night Yö + Overcast Pilvinen + White to Black Valkoisesta mustaan + Light Grays Vaaleat harmaat + Dark Grays Tummat harmaat + Warm Grays Lämpimät harmaat + Cool Grays Viileät harmaat + Fade to Transparent Häivytys läpinäkyvään + White Fade Valkoinen häivytys + Vignette Vinjetti + Mist Usva + Petal Terälehti + Fern Saniainen + Smoke Savu + Honey Hunaja + Seafoam Merivaahto + Lavender Laventeli + Driftwood Ajopuu + Ink Wash Tussilaveeraus + Tide Vuorovesi + Bloom Kukinta + Dew Kaste + Pollen Siitepöly + Lichen Jäkälä + Prism Veil Prismaharso + Opal Ribbon Opaalinauha + Pearl Flash Helmiäisvälähdys + Aurora Foil Revontulifolio + Iris Sheen Iiriskiilto + Frost Spectrum Huurrespektri + Silver Tide Hopeavuoksi + Rose Quartz Gleam Ruusukvartsin hohde + Moonstone Shift Kuukiven väreily + Violet Edge Violetti reuna + Mint Halo Mintunvärinen kehä + Amber Corona Meripihkakorona + Polar Glint Napakiilto + Pastel Orbit Pastellirata + Coral and Navy Koralli ja laivastonsininen + Plum and Lime Luumu ja lime + Teal and Gold Sinivihreä ja kulta + Indigo and Peach Indigo ja persikka + Forest and Rose Metsä ja ruusu + Red Glow Punainen hehku + Orange Glow Oranssi hehku + Amber Glow Meripihkan hehku + Yellow Glow Keltainen hehku + Lime Glow Limen hehku + Green Glow Vihreä hehku + Teal Glow Sinivihreä hehku + Cyan Glow Syaani hehku + Azure Glow Asuurin hehku + Blue Glow Sininen hehku + Violet Glow Violetti hehku + Magenta Glow Magentan hehku + Polka Dots Pallokuvio + Vertical Stripes Pystyraidat + Horizontal Stripes Vaakaraidat + Diagonal Stripes Vinoraidat + Checkerboard Shakkiruudukko + Diamonds Vinoneliöt + Crosses Ristit + Coarse Grit Karkea rae + Stipple Pisteytys + Scratches Naarmut + Sparse Flecks Harvat täplät + Dense Flecks Tiheät täplät + Sine Bands Siniaaltovyöt + Ripple Lines Väreviivat + Interference Rings Interferenssirenkaat + Offset Rings Siirretyt renkaat + Warped Checks Vääristyneet ruudut + Pinched Stripes Puristetut raidat + Chevron Pulse Nuolikuviopulssi + Radiating Lenses Säteilevät linssit + Soft Shadow Pehmeä varjo + Hard Shadow Terävä varjo + Lifted Card Kohotettu kortti + Neon Tube Neonputki + Inner Light Sisävalo + Feathered Pehmeäreunainen + Haze Utu + Double Rule Kaksoisviiva + Triple Rule Kolmoisviiva + Dashed Border Katkoviivareuna + Dotted Border Pisteviivareuna + Offset Keyline Siirretty ääriviiva + Inset Keyline Sisäinen ääriviiva + Outside Stroke Ulkoreunan viiva + Pointer Osoitin + Highlighter Korostuskynä + Sketchy Line Luonnosviiva + Scribble Fill Töherrystäyttö + Wobble Huojunta + Zig Zag Edge Siksakreuna + Wavy Edge Aaltoreuna + Puffy Pullistunut + Starburst Tähtiräjähdys + Glossy Kiiltävä + Brushed Metal Harjattu metalli + Spotlight Kohdevalo + Sunset Band Auringonlaskun vyö + Sea Glass Merilasi + Pearl Helmi + Chrome Rim Kromireuna + Glow Orb Hehkupallo + Pill Badge Pillerimerkki + Round Badge Pyöreä merkki + Flag Wave Liehuva lippu + Bulge Pullistuma + Twisted Kierretty + Echo Kaiku + Spiral Copies Spiraalikopiot + Multiply Tint Kerro-sävy + Darken Veil Tummenna-harso + Ghosted Haamumainen + Two Tone Kaksivärinen + Overlay Glaze Sulautus-lasite + Screen Light Rasteri-valo + Soft Light Wash Pehmeä valo -laveeraus + Burst Purkaus + Rounded Square Pyöristetty neliö Save Brush Library… Tallenna sivellinkirjasto… @msg `{_1}` has no brushes to apply Kohteessa `{_1}` ei ole käytettäviä siveltimiä @msg missing `library` (see brush.libraries) `library` puuttuu (katso brush.libraries) diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 057dce6872..820e1d2f26 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -6790,6 +6790,240 @@ axis Y Axis Axe Y Stars Étoiles Triangles Triangles Sparkles Étincelles + Warm Gray Gris chaud + Cool Gray Gris froid + Neutrals Neutres + Ivory Ivoire + Linen Lin + Oat Avoine + Greige Grège + Stone Pierre + Taupe Taupe + Slate Ardoise + Clay Argile + Terracotta Terre cuite + Ochre Ocre + Umber Terre d’ombre + Sand Sable + Olive Olive + Moss Mousse + Rosy Rosé + Neutral Neutre + Golden Doré + Pastel Pastel + Pastel Red Rouge pastel + Pastel Orange Orange pastel + Pastel Amber Ambre pastel + Pastel Yellow Jaune pastel + Pastel Lime Citron vert pastel + Pastel Green Vert pastel + Pastel Teal Sarcelle pastel + Pastel Cyan Cyan pastel + Pastel Azure Azur pastel + Pastel Blue Bleu pastel + Pastel Violet Violet pastel + Pastel Magenta Magenta pastel + Soft Red Rouge doux + Soft Orange Orange doux + Soft Amber Ambre doux + Soft Yellow Jaune doux + Soft Lime Citron vert doux + Soft Green Vert doux + Soft Teal Sarcelle doux + Soft Cyan Cyan doux + Soft Azure Azur doux + Soft Blue Bleu doux + Soft Violet Violet doux + Soft Magenta Magenta doux + Vivid Red Rouge vif + Vivid Orange Orange vif + Vivid Amber Ambre vif + Vivid Yellow Jaune vif + Vivid Lime Citron vert vif + Vivid Green Vert vif + Vivid Teal Sarcelle vif + Vivid Cyan Cyan vif + Vivid Azure Azur vif + Vivid Blue Bleu vif + Vivid Violet Violet vif + Vivid Magenta Magenta vif + Deep Foncés + Deep Red Rouge foncé + Deep Orange Orange foncé + Deep Amber Ambre foncé + Deep Yellow Jaune foncé + Deep Lime Citron vert foncé + Deep Green Vert foncé + Deep Teal Sarcelle foncé + Deep Cyan Cyan foncé + Deep Azure Azur foncé + Deep Blue Bleu foncé + Deep Violet Violet foncé + Deep Magenta Magenta foncé + Gold Or + Silver Argent + Bronze Bronze + Copper Cuivre + Brass Laiton + Rose Gold Or rose + Gunmetal Gris canon + Platinum Platine + Pewter Étain + Ember Braise + Lagoon Lagon + Dusk Crépuscule + Clay to Teal Argile à sarcelle + Plum to Olive Prune à olive + Complementary Coral Corail complémentaire + Split Complementary Coral Corail complémentaire divisée + Analogous Coral Corail analogue + Triad Coral Corail en triade + Tetrad Coral Corail en tétrade + Pentagram Coral Corail en pentagramme + Complementary Teal Sarcelle complémentaire + Split Complementary Teal Sarcelle complémentaire divisée + Analogous Teal Sarcelle analogue + Triad Teal Sarcelle en triade + Tetrad Teal Sarcelle en tétrade + Pentagram Teal Sarcelle en pentagramme + Soft Spectrum Spectre doux + Red to Amber Rouge à ambre + Orange to Yellow Orange à jaune + Amber to Lime Ambre à citron vert + Yellow to Green Jaune à vert + Lime to Teal Citron vert à sarcelle + Green to Cyan Vert à cyan + Teal to Azure Sarcelle à azur + Cyan to Blue Cyan à bleu + Azure to Violet Azur à violet + Blue to Magenta Bleu à magenta + Violet to Red Violet à rouge + Magenta to Orange Magenta à orange + Dawn Aube + Noon Midi + Sunset Coucher de soleil + Night Nuit + Overcast Ciel couvert + White to Black Blanc à noir + Light Grays Gris clairs + Dark Grays Gris foncés + Warm Grays Gris chauds + Cool Grays Gris froids + Fade to Transparent Fondu vers transparent + White Fade Fondu blanc + Vignette Vignette + Mist Brume + Petal Pétale + Fern Fougère + Smoke Fumée + Honey Miel + Seafoam Écume + Lavender Lavande + Driftwood Bois flotté + Ink Wash Lavis d’encre + Tide Marée + Bloom Floraison + Dew Rosée + Pollen Pollen + Lichen Lichen + Prism Veil Voile prismatique + Opal Ribbon Ruban opale + Pearl Flash Éclat nacré + Aurora Foil Feuille aurore + Iris Sheen Reflet iris + Frost Spectrum Spectre givré + Silver Tide Marée argentée + Rose Quartz Gleam Lueur quartz rose + Moonstone Shift Reflet pierre de lune + Violet Edge Bord violet + Mint Halo Halo menthe + Amber Corona Couronne ambrée + Polar Glint Scintillement polaire + Pastel Orbit Orbite pastel + Coral and Navy Corail et marine + Plum and Lime Prune et citron vert + Teal and Gold Sarcelle et or + Indigo and Peach Indigo et pêche + Forest and Rose Forêt et rose + Red Glow Lueur rouge + Orange Glow Lueur orange + Amber Glow Lueur ambre + Yellow Glow Lueur jaune + Lime Glow Lueur citron vert + Green Glow Lueur verte + Teal Glow Lueur sarcelle + Cyan Glow Lueur cyan + Azure Glow Lueur azur + Blue Glow Lueur bleue + Violet Glow Lueur violette + Magenta Glow Lueur magenta + Polka Dots Pois + Vertical Stripes Rayures verticales + Horizontal Stripes Rayures horizontales + Diagonal Stripes Rayures diagonales + Checkerboard Damier + Diamonds Losanges + Crosses Croix + Coarse Grit Grain grossier + Stipple Pointillé + Scratches Éraflures + Sparse Flecks Mouchetures éparses + Dense Flecks Mouchetures denses + Sine Bands Bandes sinusoïdales + Ripple Lines Lignes ondulées + Interference Rings Anneaux d’interférence + Offset Rings Anneaux décalés + Warped Checks Damier déformé + Pinched Stripes Rayures pincées + Chevron Pulse Chevrons pulsés + Radiating Lenses Lentilles rayonnantes + Soft Shadow Ombre douce + Hard Shadow Ombre dure + Lifted Card Carte surélevée + Neon Tube Tube néon + Inner Light Lumière intérieure + Feathered Estompé sur les bords + Haze Brouillard + Double Rule Double filet + Triple Rule Triple filet + Dashed Border Bordure en tirets + Dotted Border Bordure pointillée + Offset Keyline Filet décalé + Inset Keyline Filet intérieur + Outside Stroke Contour extérieur + Pointer Pointeur + Highlighter Surligneur + Sketchy Line Trait esquissé + Scribble Fill Fond griffonné + Wobble Tremblé + Zig Zag Edge Bord en zigzag + Wavy Edge Bord ondulé + Puffy Gonflé + Starburst Éclat d’étoile + Glossy Brillant + Brushed Metal Métal brossé + Spotlight Projecteur + Sunset Band Bande coucher de soleil + Sea Glass Verre de mer + Pearl Perle + Chrome Rim Bord chromé + Glow Orb Orbe lumineux + Pill Badge Badge pilule + Round Badge Badge rond + Flag Wave Drapeau ondulant + Bulge Renflement + Twisted Torsadé + Echo Écho + Spiral Copies Copies en spirale + Multiply Tint Teinte produit + Darken Veil Voile obscurcir + Ghosted Fantôme + Two Tone Bicolore + Overlay Glaze Glacis incrustation + Screen Light Lumière superposition + Soft Light Wash Lavis lumière tamisée + Burst Éclat + Rounded Square Carré arrondi Save Brush Library… Enregistrer la bibliothèque de formes… @msg `{_1}` has no brushes to apply `{_1}` n'a aucune forme à appliquer @msg missing `library` (see brush.libraries) `library` manquant (voir brush.libraries) diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 9d056e085a..391c7d23fe 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -460,6 +460,240 @@ antiAlias Sharp शार्प Stars तारे Triangles त्रिभुज Sparkles चमक + Warm Gray वार्म ग्रे + Cool Gray कूल ग्रे + Neutrals न्यूट्रल रंग + Ivory हाथीदाँत + Linen लिनन + Oat जई + Greige ग्रेज + Stone पत्थर + Taupe टोप + Slate स्लेट + Clay मिट्टी + Terracotta टेराकोटा + Ochre गेरू + Umber अम्बर मिट्टी + Sand रेत + Olive जैतूनी + Moss काई + Rosy गुलाबी आभा + Neutral न्यूट्रल + Golden सुनहरा + Pastel पेस्टल + Pastel Red पेस्टल लाल + Pastel Orange पेस्टल नारंगी + Pastel Amber पेस्टल एम्बर + Pastel Yellow पेस्टल पीला + Pastel Lime पेस्टल लाइम + Pastel Green पेस्टल हरा + Pastel Teal पेस्टल टील + Pastel Cyan पेस्टल सियान + Pastel Azure पेस्टल आसमानी + Pastel Blue पेस्टल नीला + Pastel Violet पेस्टल बैंगनी + Pastel Magenta पेस्टल मैजेंटा + Soft Red सॉफ़्ट लाल + Soft Orange सॉफ़्ट नारंगी + Soft Amber सॉफ़्ट एम्बर + Soft Yellow सॉफ़्ट पीला + Soft Lime सॉफ़्ट लाइम + Soft Green सॉफ़्ट हरा + Soft Teal सॉफ़्ट टील + Soft Cyan सॉफ़्ट सियान + Soft Azure सॉफ़्ट आसमानी + Soft Blue सॉफ़्ट नीला + Soft Violet सॉफ़्ट बैंगनी + Soft Magenta सॉफ़्ट मैजेंटा + Vivid Red चटक लाल + Vivid Orange चटक नारंगी + Vivid Amber चटक एम्बर + Vivid Yellow चटक पीला + Vivid Lime चटक लाइम + Vivid Green चटक हरा + Vivid Teal चटक टील + Vivid Cyan चटक सियान + Vivid Azure चटक आसमानी + Vivid Blue चटक नीला + Vivid Violet चटक बैंगनी + Vivid Magenta चटक मैजेंटा + Deep गहरे + Deep Red गहरा लाल + Deep Orange गहरा नारंगी + Deep Amber गहरा एम्बर + Deep Yellow गहरा पीला + Deep Lime गहरा लाइम + Deep Green गहरा हरा + Deep Teal गहरा टील + Deep Cyan गहरा सियान + Deep Azure गहरा आसमानी + Deep Blue गहरा नीला + Deep Violet गहरा बैंगनी + Deep Magenta गहरा मैजेंटा + Gold सोना + Silver चाँदी + Bronze काँसा + Copper ताँबा + Brass पीतल + Rose Gold रोज़ गोल्ड + Gunmetal गनमेटल + Platinum प्लैटिनम + Pewter प्यूटर + Ember अंगारा + Lagoon लैगून + Dusk साँझ + Clay to Teal मिट्टी से टील + Plum to Olive आलूबुखारा से जैतूनी + Complementary Coral कोरल, पूरक + Split Complementary Coral कोरल, विभाजित पूरक + Analogous Coral कोरल, अनुरूप + Triad Coral कोरल, त्रिदाद + Tetrad Coral कोरल, चतुष्क + Pentagram Coral कोरल, पेंटाग्राम + Complementary Teal टील, पूरक + Split Complementary Teal टील, विभाजित पूरक + Analogous Teal टील, अनुरूप + Triad Teal टील, त्रिदाद + Tetrad Teal टील, चतुष्क + Pentagram Teal टील, पेंटाग्राम + Soft Spectrum सॉफ़्ट स्पेक्ट्रम + Red to Amber लाल से एम्बर + Orange to Yellow नारंगी से पीला + Amber to Lime एम्बर से लाइम + Yellow to Green पीला से हरा + Lime to Teal लाइम से टील + Green to Cyan हरा से सियान + Teal to Azure टील से आसमानी + Cyan to Blue सियान से नीला + Azure to Violet आसमानी से बैंगनी + Blue to Magenta नीला से मैजेंटा + Violet to Red बैंगनी से लाल + Magenta to Orange मैजेंटा से नारंगी + Dawn भोर + Noon दोपहर + Sunset सूर्यास्त + Night रात + Overcast बादल + White to Black सफ़ेद से काला + Light Grays हल्के ग्रे + Dark Grays गहरे ग्रे + Warm Grays वार्म ग्रे रंग + Cool Grays कूल ग्रे रंग + Fade to Transparent पारदर्शी तक फ़ेड + White Fade सफ़ेद फ़ेड + Vignette विनेट + Mist धुंध + Petal पंखुड़ी + Fern फ़र्न + Smoke धुआँ + Honey शहद + Seafoam समुद्री झाग + Lavender लैवेंडर + Driftwood बहती लकड़ी + Ink Wash स्याही वॉश + Tide ज्वार + Bloom खिलना + Dew ओस + Pollen पराग + Lichen लाइकेन + Prism Veil प्रिज़्म परदा + Opal Ribbon ओपल रिबन + Pearl Flash मोती चमक + Aurora Foil ऑरोरा फ़ॉइल + Iris Sheen आइरिस आभा + Frost Spectrum पाला स्पेक्ट्रम + Silver Tide चाँदी ज्वार + Rose Quartz Gleam रोज़ क्वार्ट्ज़ दमक + Moonstone Shift चंद्रमणि झिलमिल + Violet Edge बैंगनी किनारा + Mint Halo पुदीना हलो + Amber Corona एम्बर कोरोना + Polar Glint ध्रुवीय झलक + Pastel Orbit पेस्टल कक्षा + Coral and Navy कोरल व नेवी + Plum and Lime आलूबुखारा व लाइम + Teal and Gold टील व सोना + Indigo and Peach इंडिगो व आड़ू + Forest and Rose जंगल व गुलाब + Red Glow लाल ग्लो + Orange Glow नारंगी ग्लो + Amber Glow एम्बर ग्लो + Yellow Glow पीला ग्लो + Lime Glow लाइम ग्लो + Green Glow हरा ग्लो + Teal Glow टील ग्लो + Cyan Glow सियान ग्लो + Azure Glow आसमानी ग्लो + Blue Glow नीला ग्लो + Violet Glow बैंगनी ग्लो + Magenta Glow मैजेंटा ग्लो + Polka Dots पोल्का डॉट्स + Vertical Stripes खड़ी धारियाँ + Horizontal Stripes आड़ी धारियाँ + Diagonal Stripes तिरछी धारियाँ + Checkerboard चेकरबोर्ड + Diamonds डायमंड + Crosses क्रॉस + Coarse Grit मोटा दाना + Stipple बिंदुकारी + Scratches खरोंचें + Sparse Flecks विरल छींटे + Dense Flecks घने छींटे + Sine Bands साइन पट्टियाँ + Ripple Lines लहर रेखाएँ + Interference Rings व्यतिकरण छल्ले + Offset Rings खिसके छल्ले + Warped Checks मुड़े चेक + Pinched Stripes सिकुड़ी धारियाँ + Chevron Pulse शेवरॉन स्पंदन + Radiating Lenses विकिरित लेंस + Soft Shadow सॉफ़्ट छाया + Hard Shadow कड़ी छाया + Lifted Card उठा कार्ड + Neon Tube नियॉन ट्यूब + Inner Light भीतरी रोशनी + Feathered फ़ेदर किया + Haze कुहासा + Double Rule दोहरी रेखा + Triple Rule तिहरी रेखा + Dashed Border डैश बॉर्डर + Dotted Border डॉट बॉर्डर + Offset Keyline खिसकी कीलाइन + Inset Keyline भीतरी कीलाइन + Outside Stroke बाहरी स्ट्रोक + Pointer पॉइंटर + Highlighter हाइलाइटर + Sketchy Line स्केच रेखा + Scribble Fill स्क्रिबल फ़िल + Wobble डगमग + Zig Zag Edge ज़िगज़ैग किनारा + Wavy Edge लहरदार किनारा + Puffy फूला + Starburst तारा विस्फोट + Glossy चमकदार + Brushed Metal ब्रश्ड मेटल + Spotlight स्पॉटलाइट + Sunset Band सूर्यास्त पट्टी + Sea Glass समुद्री काँच + Pearl मोती + Chrome Rim क्रोम किनारा + Glow Orb ग्लो गोला + Pill Badge पिल बैज + Round Badge गोल बैज + Flag Wave लहराता झंडा + Bulge उभार + Twisted ऐंठा + Echo प्रतिध्वनि + Spiral Copies सर्पिल कॉपियाँ + Multiply Tint मल्टिप्लाई टिंट + Darken Veil डार्कन परदा + Ghosted धुंधला + Two Tone दो टोन + Overlay Glaze ओवरले ग्लेज़ + Screen Light स्क्रीन रोशनी + Soft Light Wash सॉफ़्ट लाइट वॉश + Burst विस्फोट + Rounded Square गोल कोनों वाला वर्ग Art using a deleted global swatch keeps its colour. हटाए गए ग्लोबल स्वॉच वाला आर्टवर्क अपना रंग बनाए रखता है। Artboard आर्टबोर्ड Artboard {n} of {total} {total} में से आर्टबोर्ड {n} @@ -5486,7 +5720,7 @@ antiAlias Sharp शार्प Visibility दृश्यता Visible & Printable Layers दृश्यमान और प्रिंट करने योग्य लेयरें Visible Layers दृश्यमान लेयरें - Vivid विद + Vivid चटक Volume आयतन W: W: Warm गर्म diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index c2f1a52cd9..6ac62c7474 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -6778,6 +6778,240 @@ axis Y Axis Y tengely Stars Csillagok Triangles Háromszögek Sparkles Szikrák + Warm Gray Meleg szürke + Cool Gray Hideg szürke + Neutrals Semleges tónusok + Ivory Elefántcsont + Linen Len + Oat Zab + Greige Greige + Stone Kő + Taupe Tópszürke + Slate Pala + Clay Agyag + Terracotta Terrakotta + Ochre Okker + Umber Umbra + Sand Homok + Olive Olíva + Moss Moha + Rosy Rózsás + Neutral Semleges + Golden Aranyos + Pastel Pasztell + Pastel Red Pasztellpiros + Pastel Orange Pasztellnarancs + Pastel Amber Pasztellborostyán + Pastel Yellow Pasztellsárga + Pastel Lime Pasztell-lime + Pastel Green Pasztellzöld + Pastel Teal Pasztell kékeszöld + Pastel Cyan Pasztellcián + Pastel Azure Pasztellazúr + Pastel Blue Pasztellkék + Pastel Violet Pasztellibolya + Pastel Magenta Pasztellmagenta + Soft Red Lágy piros + Soft Orange Lágy narancs + Soft Amber Lágy borostyán + Soft Yellow Lágy sárga + Soft Lime Lágy lime + Soft Green Lágy zöld + Soft Teal Lágy kékeszöld + Soft Cyan Lágy cián + Soft Azure Lágy azúr + Soft Blue Lágy kék + Soft Violet Lágy ibolya + Soft Magenta Lágy magenta + Vivid Red Élénk piros + Vivid Orange Élénk narancs + Vivid Amber Élénk borostyán + Vivid Yellow Élénk sárga + Vivid Lime Élénk lime + Vivid Green Élénk zöld + Vivid Teal Élénk kékeszöld + Vivid Cyan Élénk cián + Vivid Azure Élénk azúr + Vivid Blue Élénk kék + Vivid Violet Élénk ibolya + Vivid Magenta Élénk magenta + Deep Mély + Deep Red Mélypiros + Deep Orange Mélynarancs + Deep Amber Mély borostyán + Deep Yellow Mélysárga + Deep Lime Mély lime + Deep Green Mélyzöld + Deep Teal Mély kékeszöld + Deep Cyan Mély cián + Deep Azure Mély azúr + Deep Blue Mélykék + Deep Violet Mély ibolya + Deep Magenta Mély magenta + Gold Arany + Silver Ezüst + Bronze Bronz + Copper Réz + Brass Sárgaréz + Rose Gold Rozéarany + Gunmetal Ágyúfém + Platinum Platina + Pewter Ón + Ember Parázs + Lagoon Lagúna + Dusk Alkonyat + Clay to Teal Agyagtól kékeszöldig + Plum to Olive Szilvától olíváig + Complementary Coral Korall, kiegészítő + Split Complementary Coral Korall, felosztott kiegészítő + Analogous Coral Korall, analóg + Triad Coral Korall, triád + Tetrad Coral Korall, tetrád + Pentagram Coral Korall, pentagram + Complementary Teal Kékeszöld, kiegészítő + Split Complementary Teal Kékeszöld, felosztott kiegészítő + Analogous Teal Kékeszöld, analóg + Triad Teal Kékeszöld, triád + Tetrad Teal Kékeszöld, tetrád + Pentagram Teal Kékeszöld, pentagram + Soft Spectrum Lágy spektrum + Red to Amber Pirostól borostyánig + Orange to Yellow Narancstól sárgáig + Amber to Lime Borostyántól lime-ig + Yellow to Green Sárgától zöldig + Lime to Teal Lime-tól kékeszöldig + Green to Cyan Zöldtől ciánig + Teal to Azure Kékeszöldtől azúrig + Cyan to Blue Ciántól kékig + Azure to Violet Azúrtól ibolyáig + Blue to Magenta Kéktől magentáig + Violet to Red Ibolyától pirosig + Magenta to Orange Magentától narancsig + Dawn Hajnal + Noon Dél + Sunset Naplemente + Night Éjszaka + Overcast Borult ég + White to Black Fehértől feketéig + Light Grays Világos szürkék + Dark Grays Sötét szürkék + Warm Grays Meleg szürkék + Cool Grays Hideg szürkék + Fade to Transparent Áttűnés átlátszóba + White Fade Fehér áttűnés + Vignette Vignetta + Mist Köd + Petal Szirom + Fern Páfrány + Smoke Füst + Honey Méz + Seafoam Tajték + Lavender Levendula + Driftwood Uszadékfa + Ink Wash Tuslavírozás + Tide Árapály + Bloom Virágzás + Dew Harmat + Pollen Virágpor + Lichen Zuzmó + Prism Veil Prizmafátyol + Opal Ribbon Opálszalag + Pearl Flash Gyöngyházvillanás + Aurora Foil Sarki fény fólia + Iris Sheen Íriszfény + Frost Spectrum Deres spektrum + Silver Tide Ezüst dagály + Rose Quartz Gleam Rózsakvarc csillogás + Moonstone Shift Holdkő játék + Violet Edge Ibolya szegély + Mint Halo Menta fényudvar + Amber Corona Borostyán korona + Polar Glint Sarki csillanás + Pastel Orbit Pasztell pálya + Coral and Navy Korall és tengerészkék + Plum and Lime Szilva és lime + Teal and Gold Kékeszöld és arany + Indigo and Peach Indigó és barack + Forest and Rose Erdő és rózsa + Red Glow Piros izzás + Orange Glow Narancs izzás + Amber Glow Borostyán izzás + Yellow Glow Sárga izzás + Lime Glow Lime izzás + Green Glow Zöld izzás + Teal Glow Kékeszöld izzás + Cyan Glow Cián izzás + Azure Glow Azúr izzás + Blue Glow Kék izzás + Violet Glow Ibolya izzás + Magenta Glow Magenta izzás + Polka Dots Pöttyök + Vertical Stripes Függőleges csíkok + Horizontal Stripes Vízszintes csíkok + Diagonal Stripes Átlós csíkok + Checkerboard Sakktábla + Diamonds Rombuszok + Crosses Keresztek + Coarse Grit Durva szemcse + Stipple Pontozás + Scratches Karcolások + Sparse Flecks Ritka pöttyözés + Dense Flecks Sűrű pöttyözés + Sine Bands Szinuszsávok + Ripple Lines Fodrozódó vonalak + Interference Rings Interferenciagyűrűk + Offset Rings Eltolt gyűrűk + Warped Checks Torzított kockák + Pinched Stripes Összecsípett csíkok + Chevron Pulse Chevronlüktetés + Radiating Lenses Sugárzó lencsék + Soft Shadow Lágy árnyék + Hard Shadow Éles árnyék + Lifted Card Kiemelt kártya + Neon Tube Neoncső + Inner Light Belső fény + Feathered Lágy szélű + Haze Pára + Double Rule Dupla vonal + Triple Rule Tripla vonal + Dashed Border Szaggatott szegély + Dotted Border Pontozott szegély + Offset Keyline Eltolt körvonal + Inset Keyline Belső körvonal + Outside Stroke Külső körvonal + Pointer Mutató + Highlighter Kiemelő + Sketchy Line Vázlatos vonal + Scribble Fill Firkált kitöltés + Wobble Remegés + Zig Zag Edge Cikcakkos szél + Wavy Edge Hullámos szél + Puffy Puffadt + Starburst Csillagrobbanás + Glossy Fényes + Brushed Metal Szálcsiszolt fém + Spotlight Reflektor + Sunset Band Naplementesáv + Sea Glass Tengeri üveg + Pearl Gyöngy + Chrome Rim Krómperem + Glow Orb Izzó gömb + Pill Badge Kapszula jelvény + Round Badge Kerek jelvény + Flag Wave Lobogó zászló + Bulge Kidudorodás + Twisted Csavart + Echo Visszhang + Spiral Copies Spirális másolatok + Multiply Tint Szorzás árnyalat + Darken Veil Sötétítés fátyol + Ghosted Áttetsző + Two Tone Kéttónusú + Overlay Glaze Átfedés máz + Screen Light Képernyő fény + Soft Light Wash Lágy fény lavírozás + Burst Robbanás + Rounded Square Lekerekített négyzet Save Brush Library… Ecsetkönyvtár mentése… @msg `{_1}` has no brushes to apply A(z) `{_1}` nem tartalmaz alkalmazható ecsetet @msg missing `library` (see brush.libraries) hiányzik a `library` (lásd: brush.libraries) diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index a36c629332..6409d26f2c 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -6257,6 +6257,240 @@ axis Y Axis Sumbu Y Stars Bintang Triangles Segitiga Sparkles Kilauan + Warm Gray Abu-abu hangat + Cool Gray Abu-abu sejuk + Neutrals Warna netral + Ivory Gading + Linen Linen + Oat Gandum + Greige Greige + Stone Batu + Taupe Taupe + Slate Batu tulis + Clay Tanah liat + Terracotta Terakota + Ochre Oker + Umber Umber + Sand Pasir + Olive Zaitun + Moss Lumut + Rosy Kemerahan + Neutral Netral + Golden Keemasan + Pastel Pastel + Pastel Red Merah pastel + Pastel Orange Oranye pastel + Pastel Amber Amber pastel + Pastel Yellow Kuning pastel + Pastel Lime Limau pastel + Pastel Green Hijau pastel + Pastel Teal Hijau toska pastel + Pastel Cyan Sian pastel + Pastel Azure Biru langit pastel + Pastel Blue Biru pastel + Pastel Violet Violet pastel + Pastel Magenta Magenta pastel + Soft Red Merah lembut + Soft Orange Oranye lembut + Soft Amber Amber lembut + Soft Yellow Kuning lembut + Soft Lime Limau lembut + Soft Green Hijau lembut + Soft Teal Hijau toska lembut + Soft Cyan Sian lembut + Soft Azure Biru langit lembut + Soft Blue Biru lembut + Soft Violet Violet lembut + Soft Magenta Magenta lembut + Vivid Red Merah cerah + Vivid Orange Oranye cerah + Vivid Amber Amber cerah + Vivid Yellow Kuning cerah + Vivid Lime Limau cerah + Vivid Green Hijau cerah + Vivid Teal Hijau toska cerah + Vivid Cyan Sian cerah + Vivid Azure Biru langit cerah + Vivid Blue Biru cerah + Vivid Violet Violet cerah + Vivid Magenta Magenta cerah + Deep Pekat + Deep Red Merah pekat + Deep Orange Oranye pekat + Deep Amber Amber pekat + Deep Yellow Kuning pekat + Deep Lime Limau pekat + Deep Green Hijau pekat + Deep Teal Hijau toska pekat + Deep Cyan Sian pekat + Deep Azure Biru langit pekat + Deep Blue Biru pekat + Deep Violet Violet pekat + Deep Magenta Magenta pekat + Gold Emas + Silver Perak + Bronze Perunggu + Copper Tembaga + Brass Kuningan + Rose Gold Emas mawar + Gunmetal Abu-abu logam + Platinum Platina + Pewter Timah + Ember Bara + Lagoon Laguna + Dusk Senja + Clay to Teal Tanah liat ke hijau toska + Plum to Olive Prem ke zaitun + Complementary Coral Koral komplementer + Split Complementary Coral Koral komplementer terpisah + Analogous Coral Koral analog + Triad Coral Koral triad + Tetrad Coral Koral tetrad + Pentagram Coral Koral pentagram + Complementary Teal Hijau toska komplementer + Split Complementary Teal Hijau toska komplementer terpisah + Analogous Teal Hijau toska analog + Triad Teal Hijau toska triad + Tetrad Teal Hijau toska tetrad + Pentagram Teal Hijau toska pentagram + Soft Spectrum Spektrum lembut + Red to Amber Merah ke amber + Orange to Yellow Oranye ke kuning + Amber to Lime Amber ke limau + Yellow to Green Kuning ke hijau + Lime to Teal Limau ke hijau toska + Green to Cyan Hijau ke sian + Teal to Azure Hijau toska ke biru langit + Cyan to Blue Sian ke biru + Azure to Violet Biru langit ke violet + Blue to Magenta Biru ke magenta + Violet to Red Violet ke merah + Magenta to Orange Magenta ke oranye + Dawn Fajar + Noon Tengah hari + Sunset Matahari terbenam + Night Malam + Overcast Mendung + White to Black Putih ke hitam + Light Grays Abu-abu terang + Dark Grays Abu-abu gelap + Warm Grays Gradasi abu-abu hangat + Cool Grays Gradasi abu-abu sejuk + Fade to Transparent Memudar ke transparan + White Fade Pudar putih + Vignette Vinyet + Mist Kabut + Petal Kelopak + Fern Pakis + Smoke Asap + Honey Madu + Seafoam Buih laut + Lavender Lavender + Driftwood Kayu apung + Ink Wash Sapuan tinta + Tide Pasang surut + Bloom Mekar + Dew Embun + Pollen Serbuk sari + Lichen Lumut kerak + Prism Veil Selubung prisma + Opal Ribbon Pita opal + Pearl Flash Kilatan mutiara + Aurora Foil Foil aurora + Iris Sheen Kilau iris + Frost Spectrum Spektrum beku + Silver Tide Pasang perak + Rose Quartz Gleam Kilau kuarsa mawar + Moonstone Shift Kilau batu bulan + Violet Edge Tepi violet + Mint Halo Halo mint + Amber Corona Korona amber + Polar Glint Kerlip kutub + Pastel Orbit Orbit pastel + Coral and Navy Koral dan biru dongker + Plum and Lime Prem dan limau + Teal and Gold Hijau toska dan emas + Indigo and Peach Nila dan persik + Forest and Rose Hutan dan mawar + Red Glow Pendar merah + Orange Glow Pendar oranye + Amber Glow Pendar amber + Yellow Glow Pendar kuning + Lime Glow Pendar limau + Green Glow Pendar hijau + Teal Glow Pendar hijau toska + Cyan Glow Pendar sian + Azure Glow Pendar biru langit + Blue Glow Pendar biru + Violet Glow Pendar violet + Magenta Glow Pendar magenta + Polka Dots Polkadot + Vertical Stripes Garis vertikal + Horizontal Stripes Garis horizontal + Diagonal Stripes Garis diagonal + Checkerboard Papan catur + Diamonds Belah ketupat + Crosses Silang + Coarse Grit Butiran kasar + Stipple Titik-titik + Scratches Goresan + Sparse Flecks Bintik jarang + Dense Flecks Bintik rapat + Sine Bands Pita sinus + Ripple Lines Garis riak + Interference Rings Cincin interferensi + Offset Rings Cincin bergeser + Warped Checks Kotak melengkung + Pinched Stripes Garis terjepit + Chevron Pulse Denyut chevron + Radiating Lenses Lensa memancar + Soft Shadow Bayangan lembut + Hard Shadow Bayangan tajam + Lifted Card Kartu terangkat + Neon Tube Tabung neon + Inner Light Cahaya dalam + Feathered Tepi lembut + Haze Kabut tipis + Double Rule Garis ganda + Triple Rule Garis rangkap tiga + Dashed Border Bingkai putus-putus + Dotted Border Bingkai bertitik + Offset Keyline Garis kontur bergeser + Inset Keyline Garis kontur dalam + Outside Stroke Goresan luar + Pointer Penunjuk + Highlighter Stabilo + Sketchy Line Garis sketsa + Scribble Fill Isian coretan + Wobble Goyang + Zig Zag Edge Tepi zigzag + Wavy Edge Tepi bergelombang + Puffy Menggembung + Starburst Ledakan bintang + Glossy Mengilap + Brushed Metal Logam disikat + Spotlight Lampu sorot + Sunset Band Pita senja + Sea Glass Kaca laut + Pearl Mutiara + Chrome Rim Bingkai krom + Glow Orb Bola berpendar + Pill Badge Lencana pil + Round Badge Lencana bulat + Flag Wave Bendera berkibar + Bulge Menggelembung + Twisted Terpuntir + Echo Gema + Spiral Copies Salinan spiral + Multiply Tint Rona multiply + Darken Veil Selubung menggelapkan + Ghosted Samar + Two Tone Dua warna + Overlay Glaze Glasir menimpa + Screen Light Cahaya layar + Soft Light Wash Sapuan cahaya lembut + Burst Ledakan + Rounded Square Persegi bulat Save Brush Library… Simpan pustaka kuas… @msg no empty artboards to delete tidak ada artboard kosong untuk dihapus Scale Presets Preset skala diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 0ac2816b07..c01745f673 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -6421,6 +6421,245 @@ axis Y Axis Asse Y Stars Stelle Triangles Triangoli Sparkles Scintille + Warm Gray Grigio caldo + Cool Gray Grigio freddo + Neutrals Neutri + Ivory Avorio + Linen Lino + Oat Avena + Greige Greige + Stone Pietra + Taupe Tortora + Slate Ardesia + Clay Argilla + Terracotta Terracotta + Ochre Ocra + Umber Terra d'ombra + Sand Sabbia + Olive Oliva + Moss Muschio + Rosy Rosato + Neutral Neutro + Golden Dorato + Pastel Pastello + Pastel Red Rosso pastello + Pastel Orange Arancione pastello + Pastel Amber Ambra pastello + Pastel Yellow Giallo pastello + Pastel Lime Lime pastello + Pastel Green Verde pastello + Pastel Teal Verde acqua pastello + Pastel Cyan Ciano pastello + Pastel Azure Azzurro pastello + Pastel Blue Blu pastello + Pastel Violet Viola pastello + Pastel Magenta Magenta pastello + Soft Red Rosso tenue + Soft Orange Arancione tenue + Soft Amber Ambra tenue + Soft Yellow Giallo tenue + Soft Lime Lime tenue + Soft Green Verde tenue + Soft Teal Verde acqua tenue + Soft Cyan Ciano tenue + Soft Azure Azzurro tenue + Soft Blue Blu tenue + Soft Violet Viola tenue + Soft Magenta Magenta tenue + Vivid Red Rosso vivo + Vivid Orange Arancione vivo + Vivid Amber Ambra vivo + Vivid Yellow Giallo vivo + Vivid Lime Lime vivo + Vivid Green Verde vivo + Vivid Teal Verde acqua vivo + Vivid Cyan Ciano vivo + Vivid Azure Azzurro vivo + Vivid Blue Blu vivo + Vivid Violet Viola vivo + Vivid Magenta Magenta vivo + Deep Scuri + Deep Red Rosso scuro + Deep Orange Arancione scuro + Deep Amber Ambra scuro + Deep Yellow Giallo scuro + Deep Lime Lime scuro + Deep Green Verde scuro + Deep Teal Verde acqua scuro + Deep Cyan Ciano scuro + Deep Azure Azzurro scuro + Deep Blue Blu scuro + Deep Violet Viola scuro + Deep Magenta Magenta scuro + Gold Oro + Silver Argento + Bronze Bronzo + Copper Rame + Brass Ottone + Rose Gold Oro rosa + Gunmetal Canna di fucile + Platinum Platino + Pewter Peltro + Ember Brace + Lagoon Laguna + Dusk Crepuscolo + Clay to Teal Argilla a verde acqua + Plum to Olive Prugna a oliva + Complementary Coral Corallo complementare + Split Complementary Coral Corallo complementare diviso + Analogous Coral Corallo analogo + Triad Coral Corallo in triade + Tetrad Coral Corallo in tetrade + Pentagram Coral Corallo in pentagramma + Complementary Teal Verde acqua complementare + Split Complementary Teal Verde acqua complementare diviso + Analogous Teal Verde acqua analogo + Triad Teal Verde acqua in triade + Tetrad Teal Verde acqua in tetrade + Pentagram Teal Verde acqua in pentagramma + Soft Spectrum Spettro tenue + Red to Amber Da rosso ad ambra + Orange to Yellow Da arancione a giallo + Amber to Lime Da ambra a lime + Yellow to Green Da giallo a verde + Lime to Teal Da lime a verde acqua + Green to Cyan Da verde a ciano + Teal to Azure Da verde acqua ad azzurro + Cyan to Blue Da ciano a blu + Azure to Violet Da azzurro a viola + Blue to Magenta Da blu a magenta + Violet to Red Da viola a rosso + Magenta to Orange Da magenta ad arancione + Dawn Alba + Noon Mezzogiorno + Sunset Tramonto + Night Notte + Overcast Nuvoloso + White to Black Da bianco a nero + Light Grays Grigi chiari + Dark Grays Grigi scuri + Warm Grays Grigi caldi + Cool Grays Grigi freddi + Fade to Transparent Dissolvenza a trasparente + White Fade Dissolvenza bianca + Vignette Vignettatura + Mist Foschia + Petal Petalo + Fern Felce + Smoke Fumo + Honey Miele + Seafoam Schiuma di mare + Lavender Lavanda + Driftwood Legno di mare + Ink Wash Acquerello a inchiostro + Tide Marea + Bloom Fioritura + Dew Rugiada + Pollen Polline + Lichen Lichene + Prism Veil Velo prismatico + Opal Ribbon Nastro opale + Pearl Flash Lampo perlato + Aurora Foil Lamina aurora + Iris Sheen Riflesso iride + Frost Spectrum Spettro brinato + Silver Tide Marea argentata + Rose Quartz Gleam Bagliore quarzo rosa + Moonstone Shift Riflesso pietra di luna + Violet Edge Bordo viola + Mint Halo Alone menta + Amber Corona Corona ambrata + Polar Glint Luccichio polare + Pastel Orbit Orbita pastello + Coral and Navy Corallo e blu navy + Plum and Lime Prugna e lime + Teal and Gold Verde acqua e oro + Indigo and Peach Indaco e pesca + Forest and Rose Foresta e rosa + Red Glow Bagliore rosso + Orange Glow Bagliore arancione + Amber Glow Bagliore ambra + Yellow Glow Bagliore giallo + Lime Glow Bagliore lime + Green Glow Bagliore verde + Teal Glow Bagliore verde acqua + Cyan Glow Bagliore ciano + Azure Glow Bagliore azzurro + Blue Glow Bagliore blu + Violet Glow Bagliore viola + Magenta Glow Bagliore magenta + Polka Dots Pois + Vertical Stripes Righe verticali + Horizontal Stripes Righe orizzontali + Diagonal Stripes Righe diagonali + Checkerboard Scacchiera + Diamonds Rombi + Crosses Croci + Coarse Grit Grana grossa + Stipple Puntinato + Scratches Graffi + Sparse Flecks Macchioline rade + Dense Flecks Macchioline fitte + Sine Bands Bande sinusoidali + Ripple Lines Linee increspate + Interference Rings Anelli di interferenza + Offset Rings Anelli sfalsati + Warped Checks Quadretti deformati + Pinched Stripes Righe strozzate + Chevron Pulse Impulso a chevron + Radiating Lenses Lenti radianti + Soft Shadow Ombra morbida + Hard Shadow Ombra netta + Lifted Card Scheda sollevata + Neon Tube Tubo al neon + Inner Light Luce interna + Feathered Sfumato + Haze Velatura + Double Rule Filetto doppio + Triple Rule Filetto triplo + Dashed Border Bordo tratteggiato + Dotted Border Bordo punteggiato + Offset Keyline Filetto sfalsato + Inset Keyline Filetto interno + Outside Stroke Traccia esterna + Pointer Puntatore + Highlighter Evidenziatore + Sketchy Line Linea abbozzata + Scribble Fill Riempimento scarabocchiato + Wobble Tremolio + Zig Zag Edge Bordo a zigzag + Wavy Edge Bordo ondulato + Puffy Gonfio + Starburst Esplosione stellare + Glossy Lucido + Brushed Metal Metallo spazzolato + Spotlight Riflettore + Sunset Band Fascia tramonto + Sea Glass Vetro di mare + Pearl Perla + Chrome Rim Bordo cromato + Glow Orb Sfera luminosa + Pill Badge Badge a pillola + Round Badge Badge rotondo + Flag Wave Bandiera ondeggiante + Bulge Rigonfiamento + Twisted Ritorto + Echo Eco + Spiral Copies Copie a spirale + Multiply Tint Tinta moltiplica + Darken Veil Velo scurisci + Ghosted Fantasma + Two Tone Bicolore + Overlay Glaze Velatura sovrapponi + Screen Light Luce schermo + Soft Light Wash Acquerello luce soffusa + Burst Esplosione + Rounded Square Quadrato arrotondato + Bar Barra + Hexagon Esagono + Spectrum Spettro + Triangle Triangolo + Vivid Vivi Save Brush Library… Salva libreria pennelli… @msg `{_1}` has no brushes to apply `{_1}` non ha pennelli da applicare @msg missing `library` (see brush.libraries) manca `library` (vedi brush.libraries) diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 71de1ce91c..63a657e74d 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -6487,6 +6487,245 @@ axis Y Axis Y 軸 Stars 星 Triangles 三角形 Sparkles きらめき + Warm Gray ウォームグレー + Cool Gray クールグレー + Neutrals ニュートラル系 + Ivory アイボリー + Linen リネン + Oat オート + Greige グレージュ + Stone ストーン + Taupe トープ + Slate スレート + Clay クレイ + Terracotta テラコッタ + Ochre オーカー + Umber 焦げ茶 + Sand サンド + Olive オリーブ + Moss モス + Rosy ロージー + Neutral ニュートラル + Golden ゴールデン + Pastel パステル + Pastel Red パステルレッド + Pastel Orange パステルオレンジ + Pastel Amber パステルアンバー + Pastel Yellow パステルイエロー + Pastel Lime パステルライム + Pastel Green パステルグリーン + Pastel Teal パステルティール + Pastel Cyan パステルシアン + Pastel Azure パステルアジュール + Pastel Blue パステルブルー + Pastel Violet パステルバイオレット + Pastel Magenta パステルマゼンタ + Soft Red ソフトレッド + Soft Orange ソフトオレンジ + Soft Amber ソフトアンバー + Soft Yellow ソフトイエロー + Soft Lime ソフトライム + Soft Green ソフトグリーン + Soft Teal ソフトティール + Soft Cyan ソフトシアン + Soft Azure ソフトアジュール + Soft Blue ソフトブルー + Soft Violet ソフトバイオレット + Soft Magenta ソフトマゼンタ + Vivid Red ビビッドレッド + Vivid Orange ビビッドオレンジ + Vivid Amber ビビッドアンバー + Vivid Yellow ビビッドイエロー + Vivid Lime ビビッドライム + Vivid Green ビビッドグリーン + Vivid Teal ビビッドティール + Vivid Cyan ビビッドシアン + Vivid Azure ビビッドアジュール + Vivid Blue ビビッドブルー + Vivid Violet ビビッドバイオレット + Vivid Magenta ビビッドマゼンタ + Deep ディープ + Deep Red ディープレッド + Deep Orange ディープオレンジ + Deep Amber ディープアンバー + Deep Yellow ディープイエロー + Deep Lime ディープライム + Deep Green ディープグリーン + Deep Teal ディープティール + Deep Cyan ディープシアン + Deep Azure ディープアジュール + Deep Blue ディープブルー + Deep Violet ディープバイオレット + Deep Magenta ディープマゼンタ + Gold ゴールド + Silver シルバー + Bronze ブロンズ + Copper カッパー + Brass ブラス + Rose Gold ローズゴールド + Gunmetal ガンメタル + Platinum プラチナ + Pewter ピューター + Ember 残り火 + Lagoon ラグーン + Dusk 夕暮れ + Clay to Teal クレイからティール + Plum to Olive プラムからオリーブ + Complementary Coral コーラル (補色) + Split Complementary Coral コーラル (分割補色) + Analogous Coral コーラル (類似色) + Triad Coral コーラル (トライアド) + Tetrad Coral コーラル (テトラード) + Pentagram Coral コーラル (ペンタグラム) + Complementary Teal ティール (補色) + Split Complementary Teal ティール (分割補色) + Analogous Teal ティール (類似色) + Triad Teal ティール (トライアド) + Tetrad Teal ティール (テトラード) + Pentagram Teal ティール (ペンタグラム) + Soft Spectrum ソフトスペクトル + Red to Amber レッドからアンバー + Orange to Yellow オレンジからイエロー + Amber to Lime アンバーからライム + Yellow to Green イエローからグリーン + Lime to Teal ライムからティール + Green to Cyan グリーンからシアン + Teal to Azure ティールからアジュール + Cyan to Blue シアンからブルー + Azure to Violet アジュールからバイオレット + Blue to Magenta ブルーからマゼンタ + Violet to Red バイオレットからレッド + Magenta to Orange マゼンタからオレンジ + Dawn 夜明け + Noon 正午 + Sunset 夕焼け + Night 夜 + Overcast 曇り空 + White to Black ホワイトからブラック + Light Grays ライトグレー + Dark Grays ダークグレー + Warm Grays ウォームグレー系 + Cool Grays クールグレー系 + Fade to Transparent 透明へフェード + White Fade ホワイトフェード + Vignette ビネット + Mist ミスト + Petal 花びら + Fern シダ + Smoke スモーク + Honey ハニー + Seafoam シーフォーム + Lavender ラベンダー + Driftwood 流木 + Ink Wash 墨のにじみ + Tide 潮 + Bloom 開花 + Dew 露 + Pollen 花粉 + Lichen 地衣 + Prism Veil プリズムベール + Opal Ribbon オパールリボン + Pearl Flash パールフラッシュ + Aurora Foil オーロラ箔 + Iris Sheen 虹彩の光沢 + Frost Spectrum 霜のスペクトル + Silver Tide 銀の潮 + Rose Quartz Gleam ローズクォーツの輝き + Moonstone Shift ムーンストーンの揺らめき + Violet Edge バイオレットの縁 + Mint Halo ミントのハロー + Amber Corona アンバーのコロナ + Polar Glint 極光のきらめき + Pastel Orbit パステルの軌道 + Coral and Navy コーラルとネイビー + Plum and Lime プラムとライム + Teal and Gold ティールとゴールド + Indigo and Peach インディゴとピーチ + Forest and Rose フォレストとローズ + Red Glow レッドグロー + Orange Glow オレンジグロー + Amber Glow アンバーグロー + Yellow Glow イエローグロー + Lime Glow ライムグロー + Green Glow グリーングロー + Teal Glow ティールグロー + Cyan Glow シアングロー + Azure Glow アジュールグロー + Blue Glow ブルーグロー + Violet Glow バイオレットグロー + Magenta Glow マゼンタグロー + Polka Dots 水玉 + Vertical Stripes 縦ストライプ + Horizontal Stripes 横ストライプ + Diagonal Stripes 斜めストライプ + Checkerboard 市松模様 + Diamonds ダイヤ柄 + Crosses 十字柄 + Coarse Grit 粗い粒子 + Stipple 点描 + Scratches 引っかき傷 + Sparse Flecks まばらな斑点 + Dense Flecks 密な斑点 + Sine Bands 正弦波の帯 + Ripple Lines 波紋線 + Interference Rings 干渉リング + Offset Rings ずれたリング + Warped Checks ゆがんだチェック + Pinched Stripes すぼまったストライプ + Chevron Pulse 山形パルス + Radiating Lenses 放射状レンズ + Soft Shadow ソフトシャドウ + Hard Shadow ハードシャドウ + Lifted Card 浮き上がったカード + Neon Tube ネオン管 + Inner Light 内側の光 + Feathered ぼかし + Haze もや + Double Rule 二重罫線 + Triple Rule 三重罫線 + Dashed Border 破線の枠 + Dotted Border 点線の枠 + Offset Keyline オフセットキーライン + Inset Keyline 内側キーライン + Outside Stroke 外側の線 + Pointer ポインター + Highlighter 蛍光ペン + Sketchy Line スケッチ風の線 + Scribble Fill 落書き風塗り + Wobble 揺らぎ + Zig Zag Edge ジグザグの縁 + Wavy Edge 波形の縁 + Puffy ふくらみ + Starburst スターバースト + Glossy 光沢 + Brushed Metal ヘアライン金属 + Spotlight スポットライト + Sunset Band 夕焼けの帯 + Sea Glass シーグラス + Pearl パール + Chrome Rim クロームの縁 + Glow Orb 光る球 + Pill Badge ピル型バッジ + Round Badge 丸型バッジ + Flag Wave 旗のなびき + Bulge 膨らみ + Twisted ねじれ + Echo エコー + Spiral Copies らせん状のコピー + Multiply Tint 乗算の色合い + Darken Veil 比較 (暗) のベール + Ghosted 半透明 + Two Tone ツートーン + Overlay Glaze オーバーレイの釉 + Screen Light スクリーンの光 + Soft Light Wash ソフトライトのにじみ + Burst バースト + Rounded Square 角丸の正方形 + Bar バー + Hexagon 六角形 + Spectrum スペクトル + Triangle 三角形 + Vivid ビビッド Save Brush Library… ブラシライブラリを保存… @msg `{_1}` has no brushes to apply `{_1}` に適用できるブラシがありません @msg missing `library` (see brush.libraries) `library` がありません (brush.libraries を参照) diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 2cff51d94b..34e8ce4608 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6746,6 +6746,240 @@ axis Y Axis Y ღერძი Stars ვარსკვლავები Triangles სამკუთხედები Sparkles ნაპერწკლები + Warm Gray თბილი ნაცრისფერი + Cool Gray ცივი ნაცრისფერი + Neutrals ნეიტრალურები + Ivory სპილოს ძვალი + Linen სელი + Oat შვრია + Greige ნაცრისფერ-ბეჟი + Stone ქვა + Taupe ნაცრისფერ-ყავისფერი + Slate ფიქალი + Clay თიხა + Terracotta ტერაკოტა + Ochre ოხრა + Umber უმბრა + Sand ქვიშა + Olive ზეთისხილისფერი + Moss ხავსი + Rosy ვარდისფრადი + Neutral ნეიტრალური + Golden ოქროსფერი + Pastel პასტელური + Pastel Red პასტელური წითელი + Pastel Orange პასტელური ნარინჯისფერი + Pastel Amber პასტელური ქარვისფერი + Pastel Yellow პასტელური ყვითელი + Pastel Lime პასტელური ლაიმისფერი + Pastel Green პასტელური მწვანე + Pastel Teal პასტელური ზღვისფერი + Pastel Cyan პასტელური ცისფერი + Pastel Azure პასტელური ლაჟვარდისფერი + Pastel Blue პასტელური ლურჯი + Pastel Violet პასტელური იისფერი + Pastel Magenta პასტელური მეწამული + Soft Red რბილი წითელი + Soft Orange რბილი ნარინჯისფერი + Soft Amber რბილი ქარვისფერი + Soft Yellow რბილი ყვითელი + Soft Lime რბილი ლაიმისფერი + Soft Green რბილი მწვანე + Soft Teal რბილი ზღვისფერი + Soft Cyan რბილი ცისფერი + Soft Azure რბილი ლაჟვარდისფერი + Soft Blue რბილი ლურჯი + Soft Violet რბილი იისფერი + Soft Magenta რბილი მეწამული + Vivid Red ცოცხალი წითელი + Vivid Orange ცოცხალი ნარინჯისფერი + Vivid Amber ცოცხალი ქარვისფერი + Vivid Yellow ცოცხალი ყვითელი + Vivid Lime ცოცხალი ლაიმისფერი + Vivid Green ცოცხალი მწვანე + Vivid Teal ცოცხალი ზღვისფერი + Vivid Cyan ცოცხალი ცისფერი + Vivid Azure ცოცხალი ლაჟვარდისფერი + Vivid Blue ცოცხალი ლურჯი + Vivid Violet ცოცხალი იისფერი + Vivid Magenta ცოცხალი მეწამული + Deep მუქი + Deep Red მუქი წითელი + Deep Orange მუქი ნარინჯისფერი + Deep Amber მუქი ქარვისფერი + Deep Yellow მუქი ყვითელი + Deep Lime მუქი ლაიმისფერი + Deep Green მუქი მწვანე + Deep Teal მუქი ზღვისფერი + Deep Cyan მუქი ცისფერი + Deep Azure მუქი ლაჟვარდისფერი + Deep Blue მუქი ლურჯი + Deep Violet მუქი იისფერი + Deep Magenta მუქი მეწამული + Gold ოქრო + Silver ვერცხლი + Bronze ბრინჯაო + Copper სპილენძი + Brass თითბერი + Rose Gold ვარდისფერი ოქრო + Gunmetal ფოლადისფერი + Platinum პლატინა + Pewter კალა + Ember ნაკვერჩხალი + Lagoon ლაგუნა + Dusk ბინდი + Clay to Teal თიხიდან ზღვისფრამდე + Plum to Olive ქლიავიდან ზეთისხილისფრამდე + Complementary Coral მარჯნისფერი, დამატებითი + Split Complementary Coral მარჯნისფერი, გაყოფილი დამატებითი + Analogous Coral მარჯნისფერი, ანალოგიური + Triad Coral მარჯნისფერი, ტრიადა + Tetrad Coral მარჯნისფერი, ტეტრადა + Pentagram Coral მარჯნისფერი, პენტაგრამა + Complementary Teal ზღვისფერი, დამატებითი + Split Complementary Teal ზღვისფერი, გაყოფილი დამატებითი + Analogous Teal ზღვისფერი, ანალოგიური + Triad Teal ზღვისფერი, ტრიადა + Tetrad Teal ზღვისფერი, ტეტრადა + Pentagram Teal ზღვისფერი, პენტაგრამა + Soft Spectrum რბილი სპექტრი + Red to Amber წითლიდან ქარვისფრამდე + Orange to Yellow ნარინჯისფრიდან ყვითლამდე + Amber to Lime ქარვისფრიდან ლაიმისფრამდე + Yellow to Green ყვითლიდან მწვანემდე + Lime to Teal ლაიმისფრიდან ზღვისფრამდე + Green to Cyan მწვანიდან ცისფრამდე + Teal to Azure ზღვისფრიდან ლაჟვარდისფრამდე + Cyan to Blue ცისფრიდან ლურჯამდე + Azure to Violet ლაჟვარდისფრიდან იისფრამდე + Blue to Magenta ლურჯიდან მეწამულამდე + Violet to Red იისფრიდან წითლამდე + Magenta to Orange მეწამულიდან ნარინჯისფრამდე + Dawn განთიადი + Noon შუადღე + Sunset მზის ჩასვლა + Night ღამე + Overcast მოღრუბლული + White to Black თეთრიდან შავამდე + Light Grays ღია ნაცრისფრები + Dark Grays მუქი ნაცრისფრები + Warm Grays თბილი ნაცრისფრები + Cool Grays ცივი ნაცრისფრები + Fade to Transparent გადასვლა გამჭვირვალემდე + White Fade თეთრი გადასვლა + Vignette ვინიეტი + Mist ნისლი + Petal ფურცელი + Fern გვიმრა + Smoke კვამლი + Honey თაფლი + Seafoam ზღვის ქაფი + Lavender ლავანდა + Driftwood ზღვის მიერ გამორიყული ხე + Ink Wash მელნის რეცხვა + Tide მოქცევა + Bloom ყვავილობა + Dew ცვარი + Pollen მტვერი + Lichen მღიერი + Prism Veil პრიზმული საბურველი + Opal Ribbon ოპალის ლენტი + Pearl Flash მარგალიტის ელვა + Aurora Foil ჩრდილოეთის ციალის ფოლგა + Iris Sheen ირისის ლაპლაპი + Frost Spectrum ყინვის სპექტრი + Silver Tide ვერცხლისფერი მოქცევა + Rose Quartz Gleam ვარდისფერი კვარცის ბზინვა + Moonstone Shift მთვარის ქვის ციმციმი + Violet Edge იისფერი კიდე + Mint Halo პიტნისფერი შარავანდი + Amber Corona ქარვისფერი გვირგვინი + Polar Glint პოლარული ელვარება + Pastel Orbit პასტელური ორბიტა + Coral and Navy მარჯნისფერი და მუქი ლურჯი + Plum and Lime ქლიავისფერი და ლაიმისფერი + Teal and Gold ზღვისფერი და ოქროსფერი + Indigo and Peach ინდიგო და ატმისფერი + Forest and Rose ტყე და ვარდი + Red Glow წითელი ნათება + Orange Glow ნარინჯისფერი ნათება + Amber Glow ქარვისფერი ნათება + Yellow Glow ყვითელი ნათება + Lime Glow ლაიმისფერი ნათება + Green Glow მწვანე ნათება + Teal Glow ზღვისფერი ნათება + Cyan Glow ცისფერი ნათება + Azure Glow ლაჟვარდისფერი ნათება + Blue Glow ლურჯი ნათება + Violet Glow იისფერი ნათება + Magenta Glow მეწამული ნათება + Polka Dots ბარდისებრი წერტილები + Vertical Stripes ვერტიკალური ზოლები + Horizontal Stripes ჰორიზონტალური ზოლები + Diagonal Stripes დიაგონალური ზოლები + Checkerboard ჭადრაკის დაფა + Diamonds რომბები + Crosses ჯვრები + Coarse Grit მსხვილი მარცვალი + Stipple წერტილოვანი დაჩრდილვა + Scratches ნაკაწრები + Sparse Flecks იშვიათი ლაქები + Dense Flecks ხშირი ლაქები + Sine Bands სინუსოიდური ზოლები + Ripple Lines ტალღოვანი ხაზები + Interference Rings ინტერფერენციის რგოლები + Offset Rings წანაცვლებული რგოლები + Warped Checks დამახინჯებული უჯრები + Pinched Stripes შევიწროებული ზოლები + Chevron Pulse შევრონების პულსი + Radiating Lenses მანათობელი ლინზები + Soft Shadow რბილი ჩრდილი + Hard Shadow მკვეთრი ჩრდილი + Lifted Card აწეული ბარათი + Neon Tube ნეონის მილი + Inner Light შიდა სინათლე + Feathered რბილი კიდეებით + Haze ბურუსი + Double Rule ორმაგი ხაზი (ჩარჩო) + Triple Rule სამმაგი ხაზი + Dashed Border შტრიხებიანი საზღვარი + Dotted Border წერტილოვანი საზღვარი + Offset Keyline წანაცვლებული კონტური + Inset Keyline შიდა კონტური + Outside Stroke გარე შტრიხი + Pointer მაჩვენებელი + Highlighter მარკერი + Sketchy Line ესკიზური ხაზი + Scribble Fill ჯღაბნით შევსება + Wobble რხევა + Zig Zag Edge ზიგზაგისებრი კიდე + Wavy Edge ტალღოვანი კიდე + Puffy გაბერილი + Starburst ვარსკვლავის აფეთქება + Glossy პრიალა + Brushed Metal გახეხილი ლითონი + Spotlight პროჟექტორი + Sunset Band მზის ჩასვლის ზოლი + Sea Glass ზღვის მინა + Pearl მარგალიტი + Chrome Rim ქრომის არშია + Glow Orb მანათობელი სფერო + Pill Badge კაფსულის ნიშანი + Round Badge მრგვალი ნიშანი + Flag Wave აფრიალებული დროშა + Bulge გამობერილობა + Twisted დაგრეხილი + Echo ექო + Spiral Copies ასლები სპირალზე + Multiply Tint გამრავლების ელფერი + Darken Veil ჩამუქების საბურველი + Ghosted მოჩვენებითი + Two Tone ორფეროვანი + Overlay Glaze გადაფარვის ჭიქური + Screen Light ეკრანის სინათლე + Soft Light Wash რბილი სინათლის რეცხვა + Burst აფეთქება + Rounded Square მომრგვალებული კვადრატი Save Brush Library… ფუნჯების ბიბლიოთეკის შენახვა… @msg `{_1}` has no brushes to apply `{_1}`-ში გამოსაყენებელი ფუნჯები არ არის @msg missing `library` (see brush.libraries) `library` აკლია (იხ. brush.libraries) diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 4715a413f4..ba9558df54 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -6382,6 +6382,245 @@ axis Y Axis Y축 Stars 별 Triangles 삼각형 Sparkles 반짝임 + Warm Gray 따뜻한 회색 + Cool Gray 차가운 회색 + Neutrals 뉴트럴 + Ivory 아이보리 + Linen 리넨 + Oat 오트 + Greige 그레이지 + Stone 스톤 + Taupe 토프 + Slate 슬레이트 + Clay 점토 + Terracotta 테라코타 + Ochre 황토색 + Umber 엄버 + Sand 모래 + Olive 올리브 + Moss 이끼 + Rosy 장밋빛 + Neutral 중성 + Golden 황금빛 + Pastel 파스텔 + Pastel Red 파스텔 빨강 + Pastel Orange 파스텔 주황 + Pastel Amber 파스텔 호박색 + Pastel Yellow 파스텔 노랑 + Pastel Lime 파스텔 라임 + Pastel Green 파스텔 초록 + Pastel Teal 파스텔 청록 + Pastel Cyan 파스텔 시안 + Pastel Azure 파스텔 하늘색 + Pastel Blue 파스텔 파랑 + Pastel Violet 파스텔 보라 + Pastel Magenta 파스텔 마젠타 + Soft Red 부드러운 빨강 + Soft Orange 부드러운 주황 + Soft Amber 부드러운 호박색 + Soft Yellow 부드러운 노랑 + Soft Lime 부드러운 라임 + Soft Green 부드러운 초록 + Soft Teal 부드러운 청록 + Soft Cyan 부드러운 시안 + Soft Azure 부드러운 하늘색 + Soft Blue 부드러운 파랑 + Soft Violet 부드러운 보라 + Soft Magenta 부드러운 마젠타 + Vivid Red 선명한 빨강 + Vivid Orange 선명한 주황 + Vivid Amber 선명한 호박색 + Vivid Yellow 선명한 노랑 + Vivid Lime 선명한 라임 + Vivid Green 선명한 초록 + Vivid Teal 선명한 청록 + Vivid Cyan 선명한 시안 + Vivid Azure 선명한 하늘색 + Vivid Blue 선명한 파랑 + Vivid Violet 선명한 보라 + Vivid Magenta 선명한 마젠타 + Deep 짙은 색 + Deep Red 짙은 빨강 + Deep Orange 짙은 주황 + Deep Amber 짙은 호박색 + Deep Yellow 짙은 노랑 + Deep Lime 짙은 라임 + Deep Green 짙은 초록 + Deep Teal 짙은 청록 + Deep Cyan 짙은 시안 + Deep Azure 짙은 하늘색 + Deep Blue 짙은 파랑 + Deep Violet 짙은 보라 + Deep Magenta 짙은 마젠타 + Gold 금 + Silver 은 + Bronze 청동 + Copper 구리 + Brass 황동 + Rose Gold 로즈 골드 + Gunmetal 건메탈 + Platinum 백금 + Pewter 백랍 + Ember 잔불 + Lagoon 석호 + Dusk 땅거미 + Clay to Teal 점토에서 청록으로 + Plum to Olive 자두색에서 올리브로 + Complementary Coral 코럴, 보색 + Split Complementary Coral 코럴, 분할 보색 + Analogous Coral 코럴, 유사색 + Triad Coral 코럴, 3색 조화 + Tetrad Coral 코럴, 4색 조화 + Pentagram Coral 코럴, 오각별 + Complementary Teal 청록, 보색 + Split Complementary Teal 청록, 분할 보색 + Analogous Teal 청록, 유사색 + Triad Teal 청록, 3색 조화 + Tetrad Teal 청록, 4색 조화 + Pentagram Teal 청록, 오각별 + Soft Spectrum 부드러운 스펙트럼 + Red to Amber 빨강에서 호박색으로 + Orange to Yellow 주황에서 노랑으로 + Amber to Lime 호박색에서 라임으로 + Yellow to Green 노랑에서 초록으로 + Lime to Teal 라임에서 청록으로 + Green to Cyan 초록에서 시안으로 + Teal to Azure 청록에서 하늘색으로 + Cyan to Blue 시안에서 파랑으로 + Azure to Violet 하늘색에서 보라로 + Blue to Magenta 파랑에서 마젠타로 + Violet to Red 보라에서 빨강으로 + Magenta to Orange 마젠타에서 주황으로 + Dawn 새벽 + Noon 정오 + Sunset 노을 + Night 밤 + Overcast 흐린 하늘 + White to Black 흰색에서 검정으로 + Light Grays 밝은 회색 + Dark Grays 어두운 회색 + Warm Grays 따뜻한 회색 계열 + Cool Grays 차가운 회색 계열 + Fade to Transparent 투명으로 페이드 + White Fade 흰색 페이드 + Vignette 비네트 + Mist 안개 + Petal 꽃잎 + Fern 고사리 + Smoke 연기 + Honey 꿀 + Seafoam 바다 거품 + Lavender 라벤더 + Driftwood 유목 + Ink Wash 수묵 번짐 + Tide 조수 + Bloom 개화 + Dew 이슬 + Pollen 꽃가루 + Lichen 지의류 + Prism Veil 프리즘 베일 + Opal Ribbon 오팔 리본 + Pearl Flash 진주 섬광 + Aurora Foil 오로라 호일 + Iris Sheen 무지갯빛 광택 + Frost Spectrum 서리 스펙트럼 + Silver Tide 은빛 물결 + Rose Quartz Gleam 로즈 쿼츠 광채 + Moonstone Shift 월장석 일렁임 + Violet Edge 보라 가장자리 + Mint Halo 민트 후광 + Amber Corona 호박색 코로나 + Polar Glint 극지의 반짝임 + Pastel Orbit 파스텔 궤도 + Coral and Navy 코럴과 네이비 + Plum and Lime 자두색과 라임 + Teal and Gold 청록과 금색 + Indigo and Peach 인디고와 복숭아색 + Forest and Rose 숲과 장미 + Red Glow 빨강 광채 + Orange Glow 주황 광채 + Amber Glow 호박색 광채 + Yellow Glow 노랑 광채 + Lime Glow 라임 광채 + Green Glow 초록 광채 + Teal Glow 청록 광채 + Cyan Glow 시안 광채 + Azure Glow 하늘색 광채 + Blue Glow 파랑 광채 + Violet Glow 보라 광채 + Magenta Glow 마젠타 광채 + Polka Dots 물방울무늬 + Vertical Stripes 세로 줄무늬 + Horizontal Stripes 가로 줄무늬 + Diagonal Stripes 사선 줄무늬 + Checkerboard 체커보드 + Diamonds 마름모 + Crosses 십자 + Coarse Grit 거친 입자 + Stipple 점묘 + Scratches 긁힌 자국 + Sparse Flecks 성긴 반점 + Dense Flecks 촘촘한 반점 + Sine Bands 사인파 띠 + Ripple Lines 물결선 + Interference Rings 간섭 고리 + Offset Rings 어긋난 고리 + Warped Checks 뒤틀린 체크 + Pinched Stripes 오므린 줄무늬 + Chevron Pulse 셰브런 펄스 + Radiating Lenses 방사형 렌즈 + Soft Shadow 부드러운 그림자 + Hard Shadow 선명한 그림자 + Lifted Card 들린 카드 + Neon Tube 네온관 + Inner Light 안쪽 빛 + Feathered 가장자리 흐림 + Haze 아지랑이 + Double Rule 이중 괘선 + Triple Rule 삼중 괘선 + Dashed Border 파선 테두리 + Dotted Border 점선 테두리 + Offset Keyline 오프셋 윤곽선 + Inset Keyline 안쪽 윤곽선 + Outside Stroke 바깥쪽 획 + Pointer 포인터 + Highlighter 형광펜 + Sketchy Line 스케치 선 + Scribble Fill 낙서 칠 + Wobble 흔들림 + Zig Zag Edge 지그재그 가장자리 + Wavy Edge 물결 가장자리 + Puffy 부풀림 + Starburst 별 폭발 + Glossy 광택 + Brushed Metal 브러시드 메탈 + Spotlight 스포트라이트 + Sunset Band 노을 띠 + Sea Glass 바다 유리 + Pearl 진주 + Chrome Rim 크롬 테 + Glow Orb 빛나는 구 + Pill Badge 알약 배지 + Round Badge 원형 배지 + Flag Wave 펄럭이는 깃발 + Bulge 불룩 + Twisted 비틀림 + Echo 메아리 + Spiral Copies 나선형 복사본 + Multiply Tint 곱하기 색조 + Darken Veil 어둡게 베일 + Ghosted 반투명 + Two Tone 투톤 + Overlay Glaze 오버레이 유약 + Screen Light 스크린 빛 + Soft Light Wash 소프트 라이트 번짐 + Burst 폭발 + Rounded Square 둥근 사각형 + Bar 막대 + Hexagon 육각형 + Spectrum 스펙트럼 + Triangle 삼각형 + Vivid 선명한 색 Save Brush Library… 브러시 라이브러리 저장… @msg `{_1}` has no brushes to apply `{_1}`에 적용할 브러시가 없습니다 @msg missing `library` (see brush.libraries) `library`가 없습니다(brush.libraries 참조) diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 94957fb782..160ac5fc23 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -6879,6 +6879,240 @@ axis Y Axis Y-as Stars Sterren Triangles Driehoeken Sparkles Fonkelingen + Warm Gray Warm grijs + Cool Gray Koel grijs + Neutrals Neutrale tinten + Ivory Ivoor + Linen Linnen + Oat Haver + Greige Greige + Stone Steen + Taupe Taupe + Slate Leisteen + Clay Klei + Terracotta Terracotta + Ochre Oker + Umber Omber + Sand Zand + Olive Olijf + Moss Mos + Rosy Rozig + Neutral Neutraal + Golden Goudkleurig + Pastel Pastel + Pastel Red Pastelrood + Pastel Orange Pasteloranje + Pastel Amber Pastelamber + Pastel Yellow Pastelgeel + Pastel Lime Pastellimoen + Pastel Green Pastelgroen + Pastel Teal Pastelblauwgroen + Pastel Cyan Pastelcyaan + Pastel Azure Pastelazuur + Pastel Blue Pastelblauw + Pastel Violet Pastelviolet + Pastel Magenta Pastelmagenta + Soft Red Zacht rood + Soft Orange Zacht oranje + Soft Amber Zacht amber + Soft Yellow Zacht geel + Soft Lime Zacht limoen + Soft Green Zacht groen + Soft Teal Zacht blauwgroen + Soft Cyan Zacht cyaan + Soft Azure Zacht azuur + Soft Blue Zacht blauw + Soft Violet Zacht violet + Soft Magenta Zacht magenta + Vivid Red Levendig rood + Vivid Orange Levendig oranje + Vivid Amber Levendig amber + Vivid Yellow Levendig geel + Vivid Lime Levendig limoen + Vivid Green Levendig groen + Vivid Teal Levendig blauwgroen + Vivid Cyan Levendig cyaan + Vivid Azure Levendig azuur + Vivid Blue Levendig blauw + Vivid Violet Levendig violet + Vivid Magenta Levendig magenta + Deep Diep + Deep Red Dieprood + Deep Orange Dieporanje + Deep Amber Diepamber + Deep Yellow Diepgeel + Deep Lime Dieplimoen + Deep Green Diepgroen + Deep Teal Diepblauwgroen + Deep Cyan Diepcyaan + Deep Azure Diepazuur + Deep Blue Diepblauw + Deep Violet Diepviolet + Deep Magenta Diepmagenta + Gold Goud + Silver Zilver + Bronze Brons + Copper Koper + Brass Messing + Rose Gold Roségoud + Gunmetal Antraciet metaal + Platinum Platina + Pewter Tin + Ember Gloed + Lagoon Lagune + Dusk Schemering + Clay to Teal Klei naar blauwgroen + Plum to Olive Pruim naar olijf + Complementary Coral Koraal complementair + Split Complementary Coral Koraal gesplitst complementair + Analogous Coral Koraal analoog + Triad Coral Koraal triade + Tetrad Coral Koraal tetrade + Pentagram Coral Koraal pentagram + Complementary Teal Blauwgroen complementair + Split Complementary Teal Blauwgroen gesplitst complementair + Analogous Teal Blauwgroen analoog + Triad Teal Blauwgroen triade + Tetrad Teal Blauwgroen tetrade + Pentagram Teal Blauwgroen pentagram + Soft Spectrum Zacht spectrum + Red to Amber Rood naar amber + Orange to Yellow Oranje naar geel + Amber to Lime Amber naar limoen + Yellow to Green Geel naar groen + Lime to Teal Limoen naar blauwgroen + Green to Cyan Groen naar cyaan + Teal to Azure Blauwgroen naar azuur + Cyan to Blue Cyaan naar blauw + Azure to Violet Azuur naar violet + Blue to Magenta Blauw naar magenta + Violet to Red Violet naar rood + Magenta to Orange Magenta naar oranje + Dawn Dageraad + Noon Middag + Sunset Zonsondergang + Night Nacht + Overcast Bewolkt + White to Black Wit naar zwart + Light Grays Lichte grijstinten + Dark Grays Donkere grijstinten + Warm Grays Warme grijstinten + Cool Grays Koele grijstinten + Fade to Transparent Vervagen naar transparant + White Fade Witte vervaging + Vignette Vignet + Mist Nevel + Petal Bloemblad + Fern Varen + Smoke Rook + Honey Honing + Seafoam Zeeschuim + Lavender Lavendel + Driftwood Drijfhout + Ink Wash Inktwassing + Tide Getij + Bloom Bloei + Dew Dauw + Pollen Stuifmeel + Lichen Korstmos + Prism Veil Prismasluier + Opal Ribbon Opaallint + Pearl Flash Parelflits + Aurora Foil Noorderlichtfolie + Iris Sheen Irisglans + Frost Spectrum IJzig spectrum + Silver Tide Zilveren getij + Rose Quartz Gleam Rozenkwartsglans + Moonstone Shift Maansteenglans + Violet Edge Violette rand + Mint Halo Munthalo + Amber Corona Ambercorona + Polar Glint Poolschittering + Pastel Orbit Pastelbaan + Coral and Navy Koraal en marineblauw + Plum and Lime Pruim en limoen + Teal and Gold Blauwgroen en goud + Indigo and Peach Indigo en perzik + Forest and Rose Bos en roze + Red Glow Rode gloed + Orange Glow Oranje gloed + Amber Glow Amberkleurige gloed + Yellow Glow Gele gloed + Lime Glow Limoengloed + Green Glow Groene gloed + Teal Glow Blauwgroene gloed + Cyan Glow Cyaangloed + Azure Glow Azuurgloed + Blue Glow Blauwe gloed + Violet Glow Violette gloed + Magenta Glow Magentagloed + Polka Dots Stippen + Vertical Stripes Verticale strepen + Horizontal Stripes Horizontale strepen + Diagonal Stripes Diagonale strepen + Checkerboard Dambord + Diamonds Ruiten + Crosses Kruisjes + Coarse Grit Grove korrel + Stipple Stippeling + Scratches Krassen + Sparse Flecks Verspreide spikkels + Dense Flecks Dichte spikkels + Sine Bands Sinusbanden + Ripple Lines Rimpellijnen + Interference Rings Interferentieringen + Offset Rings Verschoven ringen + Warped Checks Vervormde ruiten + Pinched Stripes Ingesnoerde strepen + Chevron Pulse Chevronpuls + Radiating Lenses Stralende lenzen + Soft Shadow Zachte schaduw + Hard Shadow Harde schaduw + Lifted Card Opgetilde kaart + Neon Tube Neonbuis + Inner Light Binnenlicht + Feathered Zachte rand + Haze Waas + Double Rule Dubbele lijn + Triple Rule Driedubbele lijn + Dashed Border Gestreepte rand + Dotted Border Gestippelde rand + Offset Keyline Verschoven contour + Inset Keyline Binnencontour + Outside Stroke Buitenlijn + Pointer Aanwijzer + Highlighter Markeerstift + Sketchy Line Schetslijn + Scribble Fill Krabbelvulling + Wobble Wiebel + Zig Zag Edge Zigzagrand + Wavy Edge Golvende rand + Puffy Opgeblazen + Starburst Sterrenuitbarsting + Glossy Glanzend + Brushed Metal Geborsteld metaal + Spotlight Spotlight + Sunset Band Zonsondergangband + Sea Glass Zeeglas + Pearl Parel + Chrome Rim Chromen rand + Glow Orb Gloeibol + Pill Badge Pilbadge + Round Badge Ronde badge + Flag Wave Wapperende vlag + Bulge Bolling + Twisted Gedraaid + Echo Echo + Spiral Copies Spiraalkopieën + Multiply Tint Vermenigvuldigen-tint + Darken Veil Donkerder-sluier + Ghosted Doorschijnend + Two Tone Tweekleurig + Overlay Glaze Bedekken-glazuur + Screen Light Scherm-licht + Soft Light Wash Zacht-licht-wassing + Burst Uitbarsting + Rounded Square Afgerond vierkant Save Brush Library… Penseelbibliotheek opslaan… @msg no empty artboards to delete geen lege tekengebieden om te verwijderen Scale Presets Schaalvoorinstellingen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 48f2671c2d..cf5adafd9b 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -6650,6 +6650,242 @@ axis Y Axis Oś Y Stars Gwiazdy Triangles Trójkąty Sparkles Iskry + Warm Gray Ciepła szarość + Cool Gray Chłodna szarość + Neutrals Barwy neutralne + Ivory Kość słoniowa + Linen Len + Oat Owies + Greige Greige + Stone Kamień + Taupe Taupe + Slate Łupek + Clay Glina + Terracotta Terakota + Ochre Ochra + Umber Umbra + Sand Piasek + Olive Oliwka + Moss Mech + Rosy Różowawy + Neutral Neutralny + Golden Złocisty + Pastel Pastelowe + Pastel Red Pastelowy czerwony + Pastel Orange Pastelowy pomarańczowy + Pastel Amber Pastelowy bursztynowy + Pastel Yellow Pastelowy żółty + Pastel Lime Pastelowa limonka + Pastel Green Pastelowy zielony + Pastel Teal Pastelowy morski + Pastel Cyan Pastelowy cyjan + Pastel Azure Pastelowy lazurowy + Pastel Blue Pastelowy niebieski + Pastel Violet Pastelowy fioletowy + Pastel Magenta Pastelowa magenta + Soft Red Łagodny czerwony + Soft Orange Łagodny pomarańczowy + Soft Amber Łagodny bursztynowy + Soft Yellow Łagodny żółty + Soft Lime Łagodna limonka + Soft Green Łagodny zielony + Soft Teal Łagodny morski + Soft Cyan Łagodny cyjan + Soft Azure Łagodny lazurowy + Soft Blue Łagodny niebieski + Soft Violet Łagodny fioletowy + Soft Magenta Łagodna magenta + Vivid Red Żywy czerwony + Vivid Orange Żywy pomarańczowy + Vivid Amber Żywy bursztynowy + Vivid Yellow Żywy żółty + Vivid Lime Żywa limonka + Vivid Green Żywy zielony + Vivid Teal Żywy morski + Vivid Cyan Żywy cyjan + Vivid Azure Żywy lazurowy + Vivid Blue Żywy niebieski + Vivid Violet Żywy fioletowy + Vivid Magenta Żywa magenta + Deep Głębokie + Deep Red Głęboki czerwony + Deep Orange Głęboki pomarańczowy + Deep Amber Głęboki bursztynowy + Deep Yellow Głęboki żółty + Deep Lime Głęboka limonka + Deep Green Głęboki zielony + Deep Teal Głęboki morski + Deep Cyan Głęboki cyjan + Deep Azure Głęboki lazurowy + Deep Blue Głęboki niebieski + Deep Violet Głęboki fioletowy + Deep Magenta Głęboka magenta + Gold Złoto + Silver Srebro + Bronze Brąz + Copper Miedź + Brass Mosiądz + Rose Gold Różowe złoto + Gunmetal Grafitowy metal + Platinum Platyna + Pewter Cyna + Ember Żar + Lagoon Laguna + Dusk Zmierzch + Clay to Teal Od gliny do morskiego + Plum to Olive Od śliwki do oliwki + Complementary Coral Koralowy, dopełniające + Split Complementary Coral Koralowy, rozdzielone dopełniające + Analogous Coral Koralowy, analogiczne + Triad Coral Koralowy, triada + Tetrad Coral Koralowy, tetrada + Pentagram Coral Koralowy, pentagram + Complementary Teal Morski, dopełniające + Split Complementary Teal Morski, rozdzielone dopełniające + Analogous Teal Morski, analogiczne + Triad Teal Morski, triada + Tetrad Teal Morski, tetrada + Pentagram Teal Morski, pentagram + Soft Spectrum Łagodne spektrum + Red to Amber Od czerwonego do bursztynowego + Orange to Yellow Od pomarańczowego do żółtego + Amber to Lime Od bursztynowego do limonki + Yellow to Green Od żółtego do zielonego + Lime to Teal Od limonki do morskiego + Green to Cyan Od zielonego do cyjanu + Teal to Azure Od morskiego do lazurowego + Cyan to Blue Od cyjanu do niebieskiego + Azure to Violet Od lazurowego do fioletowego + Blue to Magenta Od niebieskiego do magenty + Violet to Red Od fioletowego do czerwonego + Magenta to Orange Od magenty do pomarańczowego + Dawn Świt + Noon Południe + Sunset Zachód słońca + Night Noc + Overcast Zachmurzenie + White to Black Od białego do czarnego + Light Grays Jasne szarości + Dark Grays Ciemne szarości + Warm Grays Ciepłe szarości + Cool Grays Chłodne szarości + Fade to Transparent Zanikanie do przezroczystości + White Fade Białe zanikanie + Vignette Winieta + Mist Mgła + Petal Płatek + Fern Paproć + Smoke Dym + Honey Miód + Seafoam Morska piana + Lavender Lawenda + Driftwood Drewno wyrzucone przez morze + Ink Wash Lawowanie tuszem + Tide Przypływ + Bloom Rozkwit + Dew Rosa + Pollen Pyłek + Lichen Porost + Prism Veil Pryzmatyczny welon + Opal Ribbon Opalowa wstęga + Pearl Flash Perłowy błysk + Aurora Foil Folia zorzy + Iris Sheen Połysk irysu + Frost Spectrum Szronione spektrum + Silver Tide Srebrny przypływ + Rose Quartz Gleam Blask kwarcu różowego + Moonstone Shift Opalizacja kamienia księżycowego + Violet Edge Fioletowa krawędź + Mint Halo Miętowa aureola + Amber Corona Bursztynowa korona + Polar Glint Polarny błysk + Pastel Orbit Pastelowa orbita + Coral and Navy Koralowy i granatowy + Plum and Lime Śliwka i limonka + Teal and Gold Morski i złoty + Indigo and Peach Indygo i brzoskwinia + Forest and Rose Las i róża + Red Glow Czerwona poświata + Orange Glow Pomarańczowa poświata + Amber Glow Bursztynowa poświata + Yellow Glow Żółta poświata + Lime Glow Limonkowa poświata + Green Glow Zielona poświata + Teal Glow Morska poświata + Cyan Glow Cyjanowa poświata + Azure Glow Lazurowa poświata + Blue Glow Niebieska poświata + Violet Glow Fioletowa poświata + Magenta Glow Magentowa poświata + Polka Dots Groszki + Vertical Stripes Pionowe paski + Horizontal Stripes Poziome paski + Diagonal Stripes Ukośne paski + Checkerboard Szachownica + Diamonds Romby + Crosses Krzyżyki + Coarse Grit Gruboziarnisty + Stipple Punktowanie + Scratches Rysy + Sparse Flecks Rzadkie plamki + Dense Flecks Gęste plamki + Sine Bands Pasma sinusoidalne + Ripple Lines Linie zmarszczek + Interference Rings Pierścienie interferencyjne + Offset Rings Przesunięte pierścienie + Warped Checks Zniekształcona krata + Pinched Stripes Ściśnięte paski + Chevron Pulse Pulsujące jodełki + Radiating Lenses Promieniujące soczewki + Soft Shadow Miękki cień + Hard Shadow Twardy cień + Lifted Card Uniesiona karta + Neon Tube Neonówka + Inner Light Wewnętrzne światło + Feathered Wtopione krawędzie + Haze Opar + Double Rule Podwójna linia + Triple Rule Potrójna linia + Dashed Border Kreskowana ramka + Dotted Border Kropkowana ramka + Offset Keyline Przesunięty kontur + Inset Keyline Wewnętrzny kontur + Outside Stroke Obrys zewnętrzny + Pointer Wskaźnik + Highlighter Zakreślacz + Sketchy Line Szkicowa linia + Scribble Fill Wypełnienie bazgrołami + Wobble Chwianie + Zig Zag Edge Krawędź zygzakowata + Wavy Edge Falista krawędź + Puffy Napuszony + Starburst Wybuch gwiazdy + Glossy Błyszczący + Brushed Metal Szczotkowany metal + Spotlight Reflektor + Sunset Band Pas zachodu słońca + Sea Glass Szkło morskie + Pearl Perła + Chrome Rim Chromowany brzeg + Glow Orb Świecąca kula + Pill Badge Odznaka w kształcie pigułki + Round Badge Okrągła odznaka + Flag Wave Powiewająca flaga + Bulge Wybrzuszenie + Twisted Skręcony + Echo Echo + Spiral Copies Kopie po spirali + Multiply Tint Odcień mnożenia + Darken Veil Welon ciemniej + Ghosted Widmowy + Two Tone Dwutonowy + Overlay Glaze Glazura nakładki + Screen Light Światło mnożenia odwrotnego + Soft Light Wash Lawowanie łagodnym światłem + Burst Wybuch + Rounded Square Zaokrąglony kwadrat + Spectrum Spektrum + Vivid Żywe Save Brush Library… Zapisz bibliotekę pędzli… @msg `{_1}` has no brushes to apply `{_1}` nie ma pędzli do zastosowania @msg missing `library` (see brush.libraries) brak `library` (zobacz brush.libraries) diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index f6e54552d4..d7ff9c14e5 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -6710,6 +6710,240 @@ axis Y Axis Eixo Y Stars Estrelas Triangles Triângulos Sparkles Brilhos + Warm Gray Cinza Quente + Cool Gray Cinza Frio + Neutrals Neutros + Ivory Marfim + Linen Linho + Oat Aveia + Greige Greige + Stone Pedra + Taupe Taupe + Slate Ardósia + Clay Argila + Terracotta Terracota + Ochre Ocre + Umber Sombra + Sand Areia + Olive Oliva + Moss Musgo + Rosy Rosado + Neutral Neutro + Golden Dourado + Pastel Pastel + Pastel Red Vermelho Pastel + Pastel Orange Laranja Pastel + Pastel Amber Âmbar Pastel + Pastel Yellow Amarelo Pastel + Pastel Lime Lima Pastel + Pastel Green Verde Pastel + Pastel Teal Verde-azulado Pastel + Pastel Cyan Ciano Pastel + Pastel Azure Azure Pastel + Pastel Blue Azul Pastel + Pastel Violet Violeta Pastel + Pastel Magenta Magenta Pastel + Soft Red Vermelho Suave + Soft Orange Laranja Suave + Soft Amber Âmbar Suave + Soft Yellow Amarelo Suave + Soft Lime Lima Suave + Soft Green Verde Suave + Soft Teal Verde-azulado Suave + Soft Cyan Ciano Suave + Soft Azure Azure Suave + Soft Blue Azul Suave + Soft Violet Violeta Suave + Soft Magenta Magenta Suave + Vivid Red Vermelho Vívido + Vivid Orange Laranja Vívido + Vivid Amber Âmbar Vívido + Vivid Yellow Amarelo Vívido + Vivid Lime Lima Vívido + Vivid Green Verde Vívido + Vivid Teal Verde-azulado Vívido + Vivid Cyan Ciano Vívido + Vivid Azure Azure Vívido + Vivid Blue Azul Vívido + Vivid Violet Violeta Vívido + Vivid Magenta Magenta Vívido + Deep Profundas + Deep Red Vermelho Profundo + Deep Orange Laranja Profundo + Deep Amber Âmbar Profundo + Deep Yellow Amarelo Profundo + Deep Lime Lima Profundo + Deep Green Verde Profundo + Deep Teal Verde-azulado Profundo + Deep Cyan Ciano Profundo + Deep Azure Azure Profundo + Deep Blue Azul Profundo + Deep Violet Violeta Profundo + Deep Magenta Magenta Profundo + Gold Ouro + Silver Prata + Bronze Bronze + Copper Cobre + Brass Latão + Rose Gold Ouro Rosé + Gunmetal Grafite Metálico + Platinum Platina + Pewter Estanho + Ember Brasa + Lagoon Lagoa + Dusk Anoitecer + Clay to Teal Argila a Verde-azulado + Plum to Olive Ameixa a Oliva + Complementary Coral Coral Complementar + Split Complementary Coral Coral Complementar Dividida + Analogous Coral Coral Análoga + Triad Coral Coral em Tríade + Tetrad Coral Coral em Tétrade + Pentagram Coral Coral em Pentagrama + Complementary Teal Verde-azulado Complementar + Split Complementary Teal Verde-azulado Complementar Dividida + Analogous Teal Verde-azulado Análoga + Triad Teal Verde-azulado em Tríade + Tetrad Teal Verde-azulado em Tétrade + Pentagram Teal Verde-azulado em Pentagrama + Soft Spectrum Espectro Suave + Red to Amber Vermelho a Âmbar + Orange to Yellow Laranja a Amarelo + Amber to Lime Âmbar a Lima + Yellow to Green Amarelo a Verde + Lime to Teal Lima a Verde-azulado + Green to Cyan Verde a Ciano + Teal to Azure Verde-azulado a Azure + Cyan to Blue Ciano a Azul + Azure to Violet Azure a Violeta + Blue to Magenta Azul a Magenta + Violet to Red Violeta a Vermelho + Magenta to Orange Magenta a Laranja + Dawn Amanhecer + Noon Meio-dia + Sunset Pôr do Sol + Night Noite + Overcast Nublado + White to Black Branco a Preto + Light Grays Cinzas Claros + Dark Grays Cinzas Escuros + Warm Grays Cinzas Quentes + Cool Grays Cinzas Frios + Fade to Transparent Esmaecer a Transparente + White Fade Esmaecer Branco + Vignette Vinheta + Mist Névoa + Petal Pétala + Fern Samambaia + Smoke Fumaça + Honey Mel + Seafoam Espuma do Mar + Lavender Lavanda + Driftwood Madeira Flutuante + Ink Wash Aguada de Nanquim + Tide Maré + Bloom Florescer + Dew Orvalho + Pollen Pólen + Lichen Líquen + Prism Veil Véu Prismático + Opal Ribbon Fita de Opala + Pearl Flash Lampejo Perolado + Aurora Foil Folha Aurora + Iris Sheen Brilho Íris + Frost Spectrum Espectro Gelado + Silver Tide Maré Prateada + Rose Quartz Gleam Reflexo de Quartzo Rosa + Moonstone Shift Reflexo de Pedra da Lua + Violet Edge Borda Violeta + Mint Halo Halo Menta + Amber Corona Coroa Âmbar + Polar Glint Cintilação Polar + Pastel Orbit Órbita Pastel + Coral and Navy Coral e Azul-marinho + Plum and Lime Ameixa e Lima + Teal and Gold Verde-azulado e Ouro + Indigo and Peach Índigo e Pêssego + Forest and Rose Floresta e Rosa + Red Glow Brilho Vermelho + Orange Glow Brilho Laranja + Amber Glow Brilho Âmbar + Yellow Glow Brilho Amarelo + Lime Glow Brilho Lima + Green Glow Brilho Verde + Teal Glow Brilho Verde-azulado + Cyan Glow Brilho Ciano + Azure Glow Brilho Azure + Blue Glow Brilho Azul + Violet Glow Brilho Violeta + Magenta Glow Brilho Magenta + Polka Dots Bolinhas + Vertical Stripes Listras Verticais + Horizontal Stripes Listras Horizontais + Diagonal Stripes Listras Diagonais + Checkerboard Xadrez + Diamonds Losangos + Crosses Cruzes + Coarse Grit Grão Grosso + Stipple Pontilhado + Scratches Arranhões + Sparse Flecks Pintas Esparsas + Dense Flecks Pintas Densas + Sine Bands Faixas Senoidais + Ripple Lines Linhas Ondulantes + Interference Rings Anéis de Interferência + Offset Rings Anéis Deslocados + Warped Checks Xadrez Deformado + Pinched Stripes Listras Estranguladas + Chevron Pulse Pulso de Chevrons + Radiating Lenses Lentes Radiantes + Soft Shadow Sombra Suave + Hard Shadow Sombra Dura + Lifted Card Cartão Elevado + Neon Tube Tubo de Neon + Inner Light Luz Interna + Feathered Bordas Suaves + Haze Bruma + Double Rule Fio Duplo + Triple Rule Fio Triplo + Dashed Border Borda Tracejada + Dotted Border Borda Pontilhada + Offset Keyline Fio Deslocado + Inset Keyline Fio Interno + Outside Stroke Traçado Externo + Pointer Ponteiro + Highlighter Marca-texto + Sketchy Line Linha Esboçada + Scribble Fill Preenchimento Rabiscado + Wobble Tremido + Zig Zag Edge Borda em Zigue-zague + Wavy Edge Borda Ondulada + Puffy Inflado + Starburst Explosão Estelar + Glossy Brilhante + Brushed Metal Metal Escovado + Spotlight Holofote + Sunset Band Faixa de Pôr do Sol + Sea Glass Vidro do Mar + Pearl Pérola + Chrome Rim Borda Cromada + Glow Orb Orbe Luminoso + Pill Badge Selo Pílula + Round Badge Selo Redondo + Flag Wave Bandeira Ondulada + Bulge Protuberância + Twisted Torcido + Echo Eco + Spiral Copies Cópias em Espiral + Multiply Tint Tinta Multiplicar + Darken Veil Véu Escurecer + Ghosted Fantasma + Two Tone Bicolor + Overlay Glaze Veladura Sobrepor + Screen Light Luz Tela + Soft Light Wash Aguada Luz Suave + Burst Explosão + Rounded Square Quadrado Arredondado Save Brush Library… Salvar Biblioteca de Pincéis… @msg `{_1}` has no brushes to apply `{_1}` não tem pincéis para aplicar @msg missing `library` (see brush.libraries) falta `library` (consulte brush.libraries) diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 8dc8336089..db4e3365b4 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -6406,6 +6406,240 @@ axis Y Axis Ось Y Stars Звёзды Triangles Треугольники Sparkles Искры + Warm Gray Тёплый серый + Cool Gray Холодный серый + Neutrals Нейтральные + Ivory Слоновая кость + Linen Лён + Oat Овёс + Greige Грейж + Stone Камень + Taupe Серо-коричневый + Slate Сланец + Clay Глина + Terracotta Терракота + Ochre Охра + Umber Умбра + Sand Песок + Olive Оливковый + Moss Мох + Rosy Розоватый + Neutral Нейтральный + Golden Золотистый + Pastel Пастельные + Pastel Red Пастельный красный + Pastel Orange Пастельный оранжевый + Pastel Amber Пастельный янтарный + Pastel Yellow Пастельный жёлтый + Pastel Lime Пастельный лаймовый + Pastel Green Пастельный зелёный + Pastel Teal Пастельный сине-зелёный + Pastel Cyan Пастельный голубой + Pastel Azure Пастельный лазурный + Pastel Blue Пастельный синий + Pastel Violet Пастельный фиолетовый + Pastel Magenta Пастельный пурпурный + Soft Red Мягкий красный + Soft Orange Мягкий оранжевый + Soft Amber Мягкий янтарный + Soft Yellow Мягкий жёлтый + Soft Lime Мягкий лаймовый + Soft Green Мягкий зелёный + Soft Teal Мягкий сине-зелёный + Soft Cyan Мягкий голубой + Soft Azure Мягкий лазурный + Soft Blue Мягкий синий + Soft Violet Мягкий фиолетовый + Soft Magenta Мягкий пурпурный + Vivid Red Яркий красный + Vivid Orange Яркий оранжевый + Vivid Amber Яркий янтарный + Vivid Yellow Яркий жёлтый + Vivid Lime Яркий лаймовый + Vivid Green Яркий зелёный + Vivid Teal Яркий сине-зелёный + Vivid Cyan Яркий голубой + Vivid Azure Яркий лазурный + Vivid Blue Яркий синий + Vivid Violet Яркий фиолетовый + Vivid Magenta Яркий пурпурный + Deep Глубокие + Deep Red Тёмно-красный + Deep Orange Тёмно-оранжевый + Deep Amber Тёмно-янтарный + Deep Yellow Тёмно-жёлтый + Deep Lime Тёмно-лаймовый + Deep Green Тёмно-зелёный + Deep Teal Тёмный сине-зелёный + Deep Cyan Тёмно-голубой + Deep Azure Тёмно-лазурный + Deep Blue Тёмно-синий + Deep Violet Тёмно-фиолетовый + Deep Magenta Тёмно-пурпурный + Gold Золото + Silver Серебро + Bronze Бронза + Copper Медь + Brass Латунь + Rose Gold Розовое золото + Gunmetal Оружейный металл + Platinum Платина + Pewter Олово + Ember Тлеющие угли + Lagoon Лагуна + Dusk Сумерки + Clay to Teal От глины к сине-зелёному + Plum to Olive От сливового к оливковому + Complementary Coral Коралловый, дополнительная + Split Complementary Coral Коралловый, расщепленная дополнительная + Analogous Coral Коралловый, аналоговая + Triad Coral Коралловый, триада + Tetrad Coral Коралловый, тетрада + Pentagram Coral Коралловый, пентаграмма + Complementary Teal Сине-зелёный, дополнительная + Split Complementary Teal Сине-зелёный, расщепленная дополнительная + Analogous Teal Сине-зелёный, аналоговая + Triad Teal Сине-зелёный, триада + Tetrad Teal Сине-зелёный, тетрада + Pentagram Teal Сине-зелёный, пентаграмма + Soft Spectrum Мягкий спектр + Red to Amber От красного к янтарному + Orange to Yellow От оранжевого к жёлтому + Amber to Lime От янтарного к лаймовому + Yellow to Green От жёлтого к зелёному + Lime to Teal От лаймового к сине-зелёному + Green to Cyan От зелёного к голубому + Teal to Azure От сине-зелёного к лазурному + Cyan to Blue От голубого к синему + Azure to Violet От лазурного к фиолетовому + Blue to Magenta От синего к пурпурному + Violet to Red От фиолетового к красному + Magenta to Orange От пурпурного к оранжевому + Dawn Рассвет + Noon Полдень + Sunset Закат + Night Ночь + Overcast Пасмурно + White to Black От белого к чёрному + Light Grays Светло-серые + Dark Grays Тёмно-серые + Warm Grays Тёплые серые + Cool Grays Холодные серые + Fade to Transparent Переход в прозрачность + White Fade Белый переход + Vignette Виньетка + Mist Дымка + Petal Лепесток + Fern Папоротник + Smoke Дым + Honey Мёд + Seafoam Морская пена + Lavender Лаванда + Driftwood Плавник + Ink Wash Размывка тушью + Tide Прилив + Bloom Цветение + Dew Роса + Pollen Пыльца + Lichen Лишайник + Prism Veil Призматическая вуаль + Opal Ribbon Опаловая лента + Pearl Flash Жемчужная вспышка + Aurora Foil Фольга северного сияния + Iris Sheen Радужный отлив + Frost Spectrum Морозный спектр + Silver Tide Серебряный прилив + Rose Quartz Gleam Блеск розового кварца + Moonstone Shift Перелив лунного камня + Violet Edge Фиолетовый край + Mint Halo Мятный ореол + Amber Corona Янтарная корона + Polar Glint Полярный блик + Pastel Orbit Пастельная орбита + Coral and Navy Коралловый и тёмно-синий + Plum and Lime Сливовый и лаймовый + Teal and Gold Сине-зелёный и золотой + Indigo and Peach Индиго и персиковый + Forest and Rose Лесной и розовый + Red Glow Красное свечение + Orange Glow Оранжевое свечение + Amber Glow Янтарное свечение + Yellow Glow Жёлтое свечение + Lime Glow Лаймовое свечение + Green Glow Зелёное свечение + Teal Glow Сине-зелёное свечение + Cyan Glow Голубое свечение + Azure Glow Лазурное свечение + Blue Glow Синее свечение + Violet Glow Фиолетовое свечение + Magenta Glow Пурпурное свечение + Polka Dots Горошек + Vertical Stripes Вертикальные полосы + Horizontal Stripes Горизонтальные полосы + Diagonal Stripes Диагональные полосы + Checkerboard Шахматная доска + Diamonds Ромбы + Crosses Крестики + Coarse Grit Крупное зерно + Stipple Пунктир + Scratches Царапины + Sparse Flecks Редкие крапинки + Dense Flecks Густые крапинки + Sine Bands Синусоидальные полосы + Ripple Lines Линии ряби + Interference Rings Интерференционные кольца + Offset Rings Смещённые кольца + Warped Checks Искажённая клетка + Pinched Stripes Сжатые полосы + Chevron Pulse Пульсирующие шевроны + Radiating Lenses Лучистые линзы + Soft Shadow Мягкая тень + Hard Shadow Жёсткая тень + Lifted Card Приподнятая карточка + Neon Tube Неоновая трубка + Inner Light Внутренний свет + Feathered Растушёванный + Haze Марево + Double Rule Двойная линейка + Triple Rule Тройная линейка + Dashed Border Штриховая рамка + Dotted Border Точечная рамка + Offset Keyline Смещённый контур + Inset Keyline Внутренний контур + Outside Stroke Внешняя обводка + Pointer Указатель + Highlighter Маркер + Sketchy Line Набросочная линия + Scribble Fill Заливка каракулями + Wobble Дрожание + Zig Zag Edge Зигзагообразный край + Wavy Edge Волнистый край + Puffy Пухлый + Starburst Звёздный взрыв + Glossy Глянцевый + Brushed Metal Шлифованный металл + Spotlight Прожектор + Sunset Band Полоса заката + Sea Glass Морское стекло + Pearl Жемчуг + Chrome Rim Хромированный ободок + Glow Orb Светящийся шар + Pill Badge Значок-капсула + Round Badge Круглый значок + Flag Wave Развевающийся флаг + Bulge Выпуклость + Twisted Закрученный + Echo Эхо + Spiral Copies Копии по спирали + Multiply Tint Оттенок умножения + Darken Veil Затемняющая вуаль + Ghosted Призрачный + Two Tone Двухцветный + Overlay Glaze Глазурь перекрытия + Screen Light Свет растра + Soft Light Wash Размывка мягким светом + Burst Вспышка + Rounded Square Скруглённый квадрат Save Brush Library… Сохранить библиотеку кистей… @msg `{_1}` has no brushes to apply В `{_1}` нет кистей для применения @msg missing `library` (see brush.libraries) не указан `library` (см. brush.libraries) diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index cfb9d9734b..ceba4579b4 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -6775,6 +6775,240 @@ axis Y Axis Y-axel Stars Stjärnor Triangles Trianglar Sparkles Gnistor + Warm Gray Varmgrå + Cool Gray Kallgrå + Neutrals Neutrala toner + Ivory Elfenben + Linen Linne + Oat Havre + Greige Greige + Stone Sten + Taupe Taupe + Slate Skiffer + Clay Lera + Terracotta Terrakotta + Ochre Ockra + Umber Umbra + Sand Sand + Olive Oliv + Moss Mossa + Rosy Rosig + Neutral Neutral + Golden Gyllene + Pastel Pastell + Pastel Red Pastellröd + Pastel Orange Pastellorange + Pastel Amber Pastellbärnsten + Pastel Yellow Pastellgul + Pastel Lime Pastellime + Pastel Green Pastellgrön + Pastel Teal Pastellblågrön + Pastel Cyan Pastellcyan + Pastel Azure Pastellazur + Pastel Blue Pastellblå + Pastel Violet Pastellviolett + Pastel Magenta Pastellmagenta + Soft Red Mjuk röd + Soft Orange Mjuk orange + Soft Amber Mjuk bärnsten + Soft Yellow Mjuk gul + Soft Lime Mjuk lime + Soft Green Mjuk grön + Soft Teal Mjuk blågrön + Soft Cyan Mjuk cyan + Soft Azure Mjuk azur + Soft Blue Mjuk blå + Soft Violet Mjuk violett + Soft Magenta Mjuk magenta + Vivid Red Livfull röd + Vivid Orange Livfull orange + Vivid Amber Livfull bärnsten + Vivid Yellow Livfull gul + Vivid Lime Livfull lime + Vivid Green Livfull grön + Vivid Teal Livfull blågrön + Vivid Cyan Livfull cyan + Vivid Azure Livfull azur + Vivid Blue Livfull blå + Vivid Violet Livfull violett + Vivid Magenta Livfull magenta + Deep Djupa + Deep Red Djupröd + Deep Orange Djuporange + Deep Amber Djup bärnsten + Deep Yellow Djupgul + Deep Lime Djup lime + Deep Green Djupgrön + Deep Teal Djup blågrön + Deep Cyan Djup cyan + Deep Azure Djup azur + Deep Blue Djupblå + Deep Violet Djupviolett + Deep Magenta Djup magenta + Gold Guld + Silver Silver + Bronze Brons + Copper Koppar + Brass Mässing + Rose Gold Roséguld + Gunmetal Gunmetal + Platinum Platina + Pewter Tenn + Ember Glöd + Lagoon Lagun + Dusk Skymning + Clay to Teal Lera till blågrön + Plum to Olive Plommon till oliv + Complementary Coral Korall komplementär + Split Complementary Coral Korall delade komplementfärger + Analogous Coral Korall analog + Triad Coral Korall triad + Tetrad Coral Korall tetrad + Pentagram Coral Korall pentagram + Complementary Teal Blågrön komplementär + Split Complementary Teal Blågrön delade komplementfärger + Analogous Teal Blågrön analog + Triad Teal Blågrön triad + Tetrad Teal Blågrön tetrad + Pentagram Teal Blågrön pentagram + Soft Spectrum Mjukt spektrum + Red to Amber Röd till bärnsten + Orange to Yellow Orange till gul + Amber to Lime Bärnsten till lime + Yellow to Green Gul till grön + Lime to Teal Lime till blågrön + Green to Cyan Grön till cyan + Teal to Azure Blågrön till azur + Cyan to Blue Cyan till blå + Azure to Violet Azur till violett + Blue to Magenta Blå till magenta + Violet to Red Violett till röd + Magenta to Orange Magenta till orange + Dawn Gryning + Noon Middag + Sunset Solnedgång + Night Natt + Overcast Mulet + White to Black Vit till svart + Light Grays Ljusa gråtoner + Dark Grays Mörka gråtoner + Warm Grays Varma gråtoner + Cool Grays Kalla gråtoner + Fade to Transparent Tona till genomskinlig + White Fade Vit toning + Vignette Vinjett + Mist Dimma + Petal Kronblad + Fern Ormbunke + Smoke Rök + Honey Honung + Seafoam Havsskum + Lavender Lavendel + Driftwood Drivved + Ink Wash Tuschlavering + Tide Tidvatten + Bloom Blomning + Dew Dagg + Pollen Pollen + Lichen Lav + Prism Veil Prismaslöja + Opal Ribbon Opalband + Pearl Flash Pärlblixt + Aurora Foil Norrskensfolie + Iris Sheen Irisglans + Frost Spectrum Frostspektrum + Silver Tide Silvertidvatten + Rose Quartz Gleam Rosenkvartsglans + Moonstone Shift Månstensskimmer + Violet Edge Violett kant + Mint Halo Mintgloria + Amber Corona Bärnstenskorona + Polar Glint Polarglimt + Pastel Orbit Pastellbana + Coral and Navy Korall och marinblå + Plum and Lime Plommon och lime + Teal and Gold Blågrön och guld + Indigo and Peach Indigo och persika + Forest and Rose Skog och rosa + Red Glow Rött sken + Orange Glow Orange sken + Amber Glow Bärnstenssken + Yellow Glow Gult sken + Lime Glow Limesken + Green Glow Grönt sken + Teal Glow Blågrönt sken + Cyan Glow Cyansken + Azure Glow Azursken + Blue Glow Blått sken + Violet Glow Violett sken + Magenta Glow Magentasken + Polka Dots Prickar + Vertical Stripes Lodräta ränder + Horizontal Stripes Vågräta ränder + Diagonal Stripes Diagonala ränder + Checkerboard Schackruta + Diamonds Ruter + Crosses Kors + Coarse Grit Grovt korn + Stipple Punktering + Scratches Repor + Sparse Flecks Glesa fläckar + Dense Flecks Täta fläckar + Sine Bands Sinusband + Ripple Lines Krusningslinjer + Interference Rings Interferensringar + Offset Rings Förskjutna ringar + Warped Checks Förvrängda rutor + Pinched Stripes Klämda ränder + Chevron Pulse Chevronpuls + Radiating Lenses Strålande linser + Soft Shadow Mjuk skugga + Hard Shadow Hård skugga + Lifted Card Upplyft kort + Neon Tube Neonrör + Inner Light Inre ljus + Feathered Mjuk kant + Haze Dis + Double Rule Dubbel linje + Triple Rule Trippel linje + Dashed Border Streckad kant + Dotted Border Prickad kant + Offset Keyline Förskjuten konturlinje + Inset Keyline Inre konturlinje + Outside Stroke Yttre linje + Pointer Visare + Highlighter Överstrykningspenna + Sketchy Line Skissartad linje + Scribble Fill Klotterfyllning + Wobble Vingel + Zig Zag Edge Sicksackkant + Wavy Edge Vågig kant + Puffy Uppblåst + Starburst Stjärnexplosion + Glossy Blank + Brushed Metal Borstad metall + Spotlight Strålkastare + Sunset Band Solnedgångsband + Sea Glass Havsglas + Pearl Pärla + Chrome Rim Kromkant + Glow Orb Lysande klot + Pill Badge Pillermärke + Round Badge Runt märke + Flag Wave Vajande flagga + Bulge Utbuktning + Twisted Vriden + Echo Eko + Spiral Copies Spiralkopior + Multiply Tint Multiplicera-ton + Darken Veil Mörkare-slöja + Ghosted Spöklik + Two Tone Tvåfärgad + Overlay Glaze Överlägg-glasyr + Screen Light Skärm-ljus + Soft Light Wash Mjukt ljus-lavering + Burst Utbrott + Rounded Square Rundad kvadrat Save Brush Library… Spara penselbibliotek… @msg `{_1}` has no brushes to apply `{_1}` har inga penslar att använda @msg missing `library` (see brush.libraries) `library` saknas (se brush.libraries) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 705fc68db2..3fc3016b6b 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -375,6 +375,97 @@ fn built_in_library_brush_names_are_in_complete_catalogs() { assert!(bad.is_empty(), "{}", bad.join("\n")); } +/// The complete catalogs that lack a row for one of `names`, with the names each lacks; `shown` +/// tells whether a catalog shows a name translated. +fn lacking(names: &[String], shown: impl Fn(&Catalog, &str) -> bool) -> Vec { + let mut bad = vec![]; + for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus) { + let missing: Vec<&String> = names.iter().filter(|n| !shown(lang.catalog(), n.as_str())).collect(); + if !missing.is_empty() { + bad.push(format!("{} is missing {missing:?}", lang.code)); + } + } + bad +} + +/// Sorted, without repeats. +fn distinct(mut names: Vec) -> Vec { + names.sort(); + names.dedup(); + names +} + +/// A built-in graphic style library's panel lists its styles in the UI language, so every style of +/// every built-in library has a row in each complete catalog. +#[test] +fn built_in_library_style_names_are_in_complete_catalogs() { + use vectorcraft_engine::cmd::stylelib; + let session = vectorcraft_engine::Session::new(); + let names = distinct( + vectorcraft_doc::style_libs::STYLE_LIBRARIES + .iter() + .filter_map(|b| stylelib::library(&session, b.id)) + .flat_map(|(_, lib)| lib.styles.iter().map(|s| s.name.clone()).collect::>()) + .collect(), + ); + assert_eq!(names.len(), 80, "{names:?}"); + let bad = lacking(&names, |c, n| c.plain(n).is_some()); + assert!(bad.is_empty(), "{}", bad.join("\n")); +} + +/// A built-in symbol library's panel lists its symbols in the UI language, so every symbol of +/// every built-in library has a row in each complete catalog. +#[test] +fn built_in_library_symbol_names_are_in_complete_catalogs() { + use vectorcraft_engine::cmd::symbollib; + let session = vectorcraft_engine::Session::new(); + let names = distinct( + symbollib::BUILTIN + .iter() + .filter_map(|b| symbollib::library(&session, b.id)) + .flat_map(|(_, lib)| lib.doc.symbols.iter().map(|s| s.name.clone()).collect::>()) + .collect(), + ); + assert_eq!(names.len(), 26, "{names:?}"); + let bad = lacking(&names, |c, n| c.plain(n).is_some()); + assert!(bad.is_empty(), "{}", bad.join("\n")); +} + +/// A built-in swatch, gradient or pattern library's panel lists its swatches and color groups in +/// the UI language, so each name has a row in each complete catalog, or is a numbered name +/// ("Warm Gray 3") whose name before the number has one. Names that are color values (`#33cc99`, +/// `K=35`) are shown as they are. +#[test] +fn built_in_library_swatch_names_are_in_complete_catalogs() { + use vectorcraft_color::libraries::{GRADIENT_LIBRARIES, SWATCH_LIBRARIES, builtin_library}; + use vectorcraft_engine::cmd::patternlib::{self, PATTERN_LIBRARIES}; + let mut libs: Vec<_> = SWATCH_LIBRARIES.iter().chain(GRADIENT_LIBRARIES).filter_map(|b| builtin_library(b.id)).collect(); + libs.extend(PATTERN_LIBRARIES.iter().filter_map(|b| patternlib::library(b.id)).map(|(_, lib)| lib)); + assert_eq!(libs.len(), SWATCH_LIBRARIES.len() + GRADIENT_LIBRARIES.len() + PATTERN_LIBRARIES.len()); + let all = libs.iter().flat_map(|lib| lib.iter().map(|w| w.name.clone()).chain(lib.groups.iter().map(|g| g.name.clone())).collect::>()); + let names = distinct(all.filter(|n| !n.starts_with('#') && !n.starts_with("K=")).collect()); + assert_eq!(names.len(), 384, "{names:?}"); + let numbered = |c: &Catalog, n: &str| { + n.rsplit_once(' ').is_some_and(|(head, d)| !d.is_empty() && d.bytes().all(|b| b.is_ascii_digit()) && c.plain(head).is_some()) + }; + let bad = lacking(&names, |c, n| c.plain(n).is_some() || numbered(c, n)); + assert!(bad.is_empty(), "{}", bad.join("\n")); +} + +/// A numbered built-in name shows its name before the number translated and the number as it +/// is; a name with a row of its own uses that row, and any other name comes back unchanged. +#[test] +fn numbered_labels_translate_the_name_before_the_number() { + let fr = Lang::from_code("fr").expect("fr registered"); + assert_eq!(numbered_label(fr, "Grays"), tr(fr, "Grays")); + assert_ne!(tr(fr, "Grays"), "Grays"); + assert_eq!(numbered_label(fr, "Grays 12"), format!("{} 12", tr(fr, "Grays"))); + for kept in ["K=35", "#33cc99", "Grays x", "Grays ", "Not A Catalog Name 3"] { + assert_eq!(numbered_label(fr, kept), kept); + } + assert_eq!(numbered_label(Lang::EN, "Grays 12"), "Grays 12"); +} + /// Preference choices and the marquee's E hint share the same translated labels. #[test] fn marquee_selection_labels_are_in_complete_catalogs() { diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 2b3e843ba3..032ecc8392 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -6751,6 +6751,240 @@ axis Y Axis Y ekseni Stars Yıldızlar Triangles Üçgenler Sparkles Parıltılar + Warm Gray Sıcak Gri + Cool Gray Soğuk Gri + Neutrals Nötrler + Ivory Fildişi + Linen Keten + Oat Yulaf + Greige Grej + Stone Taş + Taupe Vizon + Slate Arduvaz + Clay Kil + Terracotta Terrakota + Ochre Aşı Boyası + Umber Toprak Kahve + Sand Kum + Olive Zeytin + Moss Yosun + Rosy Pembemsi + Neutral Nötr + Golden Altın Sarısı + Pastel Pastel + Pastel Red Pastel Kırmızı + Pastel Orange Pastel Turuncu + Pastel Amber Pastel Kehribar + Pastel Yellow Pastel Sarı + Pastel Lime Pastel Limon Yeşili + Pastel Green Pastel Yeşil + Pastel Teal Pastel Petrol Mavisi + Pastel Cyan Pastel Camgöbeği + Pastel Azure Pastel Gök Mavisi + Pastel Blue Pastel Mavi + Pastel Violet Pastel Menekşe + Pastel Magenta Pastel Macenta + Soft Red Yumuşak Kırmızı + Soft Orange Yumuşak Turuncu + Soft Amber Yumuşak Kehribar + Soft Yellow Yumuşak Sarı + Soft Lime Yumuşak Limon Yeşili + Soft Green Yumuşak Yeşil + Soft Teal Yumuşak Petrol Mavisi + Soft Cyan Yumuşak Camgöbeği + Soft Azure Yumuşak Gök Mavisi + Soft Blue Yumuşak Mavi + Soft Violet Yumuşak Menekşe + Soft Magenta Yumuşak Macenta + Vivid Red Canlı Kırmızı + Vivid Orange Canlı Turuncu + Vivid Amber Canlı Kehribar + Vivid Yellow Canlı Sarı + Vivid Lime Canlı Limon Yeşili + Vivid Green Canlı Yeşil + Vivid Teal Canlı Petrol Mavisi + Vivid Cyan Canlı Camgöbeği + Vivid Azure Canlı Gök Mavisi + Vivid Blue Canlı Mavi + Vivid Violet Canlı Menekşe + Vivid Magenta Canlı Macenta + Deep Koyu + Deep Red Koyu Kırmızı + Deep Orange Koyu Turuncu + Deep Amber Koyu Kehribar + Deep Yellow Koyu Sarı + Deep Lime Koyu Limon Yeşili + Deep Green Koyu Yeşil + Deep Teal Koyu Petrol Mavisi + Deep Cyan Koyu Camgöbeği + Deep Azure Koyu Gök Mavisi + Deep Blue Koyu Mavi + Deep Violet Koyu Menekşe + Deep Magenta Koyu Macenta + Gold Altın + Silver Gümüş + Bronze Bronz + Copper Bakır + Brass Pirinç + Rose Gold Rose Altın + Gunmetal Füme Metal + Platinum Platin + Pewter Kalay + Ember Kor + Lagoon Lagün + Dusk Alacakaranlık + Clay to Teal Kilden Petrol Mavisine + Plum to Olive Erikten Zeytine + Complementary Coral Mercan Tamamlayıcı + Split Complementary Coral Mercan Bölünmüş Tamamlayıcı + Analogous Coral Mercan Benzer + Triad Coral Mercan Üçlü + Tetrad Coral Mercan Dörtlü + Pentagram Coral Mercan Pentagram + Complementary Teal Petrol Mavisi Tamamlayıcı + Split Complementary Teal Petrol Mavisi Bölünmüş Tamamlayıcı + Analogous Teal Petrol Mavisi Benzer + Triad Teal Petrol Mavisi Üçlü + Tetrad Teal Petrol Mavisi Dörtlü + Pentagram Teal Petrol Mavisi Pentagram + Soft Spectrum Yumuşak Spektrum + Red to Amber Kırmızıdan Kehribara + Orange to Yellow Turuncudan Sarıya + Amber to Lime Kehribardan Limon Yeşiline + Yellow to Green Sarıdan Yeşile + Lime to Teal Limon Yeşilinden Petrol Mavisine + Green to Cyan Yeşilden Camgöbeğine + Teal to Azure Petrol Mavisinden Gök Mavisine + Cyan to Blue Camgöbeğinden Maviye + Azure to Violet Gök Mavisinden Menekşeye + Blue to Magenta Maviden Macentaya + Violet to Red Menekşeden Kırmızıya + Magenta to Orange Macentadan Turuncuya + Dawn Şafak + Noon Öğle + Sunset Gün Batımı + Night Gece + Overcast Kapalı Hava + White to Black Beyazdan Siyaha + Light Grays Açık Griler + Dark Grays Koyu Griler + Warm Grays Sıcak Griler + Cool Grays Soğuk Griler + Fade to Transparent Saydama Geçiş + White Fade Beyaz Geçiş + Vignette Vinyet + Mist Pus + Petal Taç Yaprağı + Fern Eğrelti + Smoke Duman + Honey Bal + Seafoam Deniz Köpüğü + Lavender Lavanta + Driftwood Dalga Odunu + Ink Wash Mürekkep Lavisi + Tide Gelgit + Bloom Çiçeklenme + Dew Çiy + Pollen Polen + Lichen Liken + Prism Veil Prizma Tül + Opal Ribbon Opal Şerit + Pearl Flash İnci Parıltısı + Aurora Foil Kutup Işığı Folyosu + Iris Sheen İris Parlaklığı + Frost Spectrum Kırağı Spektrumu + Silver Tide Gümüş Gelgit + Rose Quartz Gleam Pembe Kuvars Işıltısı + Moonstone Shift Aytaşı Yansıması + Violet Edge Menekşe Kenar + Mint Halo Nane Hale + Amber Corona Kehribar Korona + Polar Glint Kutup Pırıltısı + Pastel Orbit Pastel Yörünge + Coral and Navy Mercan ve Lacivert + Plum and Lime Erik ve Limon Yeşili + Teal and Gold Petrol Mavisi ve Altın + Indigo and Peach Çivit ve Şeftali + Forest and Rose Orman ve Gül + Red Glow Kırmızı Işıma + Orange Glow Turuncu Işıma + Amber Glow Kehribar Işıma + Yellow Glow Sarı Işıma + Lime Glow Limon Yeşili Işıma + Green Glow Yeşil Işıma + Teal Glow Petrol Mavisi Işıma + Cyan Glow Camgöbeği Işıma + Azure Glow Gök Mavisi Işıma + Blue Glow Mavi Işıma + Violet Glow Menekşe Işıma + Magenta Glow Macenta Işıma + Polka Dots Puantiye + Vertical Stripes Dikey Çizgiler + Horizontal Stripes Yatay Çizgiler + Diagonal Stripes Çapraz Çizgiler + Checkerboard Dama Tahtası + Diamonds Baklavalar + Crosses Artılar + Coarse Grit İri Gren + Stipple Noktalama + Scratches Çizikler + Sparse Flecks Seyrek Benekler + Dense Flecks Sık Benekler + Sine Bands Sinüs Bantları + Ripple Lines Dalgacık Çizgileri + Interference Rings Girişim Halkaları + Offset Rings Kaydırılmış Halkalar + Warped Checks Bükülmüş Kareler + Pinched Stripes Sıkıştırılmış Çizgiler + Chevron Pulse Şerit Darbesi + Radiating Lenses Işıyan Mercekler + Soft Shadow Yumuşak Gölge + Hard Shadow Sert Gölge + Lifted Card Kaldırılmış Kart + Neon Tube Neon Tüp + Inner Light İç Işık + Feathered Yumuşak Kenarlı + Haze Sis + Double Rule Çift Çizgi Kenar + Triple Rule Üçlü Çizgi Kenar + Dashed Border Kesik Çizgili Kenarlık + Dotted Border Noktalı Kenarlık + Offset Keyline Kaydırılmış Kontur + Inset Keyline İç Kontur + Outside Stroke Dış Kontur + Pointer İşaretçi + Highlighter Fosforlu Kalem + Sketchy Line Eskiz Çizgisi + Scribble Fill Karalama Dolgu + Wobble Titreşim + Zig Zag Edge Zikzak Kenar + Wavy Edge Dalgalı Kenar + Puffy Kabarık + Starburst Yıldız Patlaması + Glossy Parlak + Brushed Metal Fırçalanmış Metal + Spotlight Spot Işık + Sunset Band Gün Batımı Bandı + Sea Glass Deniz Camı + Pearl İnci + Chrome Rim Krom Kenar + Glow Orb Işıyan Küre + Pill Badge Hap Rozet + Round Badge Yuvarlak Rozet + Flag Wave Dalgalanan Bayrak + Bulge Şişkinlik + Twisted Bükülmüş + Echo Yankı + Spiral Copies Sarmal Kopyalar + Multiply Tint Çarp Tonu + Darken Veil Koyulaştır Örtüsü + Ghosted Hayalet + Two Tone İki Renkli + Overlay Glaze Kaplama Sırı + Screen Light Ekran Işığı + Soft Light Wash Yumuşak Işık Lavisi + Burst Patlama + Rounded Square Yuvarlatılmış Kare Save Brush Library… Fırça Kitaplığını Kaydet… @msg `{_1}` has no brushes to apply `{_1}` içinde uygulanacak fırça yok @msg missing `library` (see brush.libraries) `library` eksik (bkz. brush.libraries) diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 50690fa0c7..2bf1d61dff 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -6401,6 +6401,245 @@ axis Y Axis Вісь Y Stars Зірки Triangles Трикутники Sparkles Іскри + Warm Gray Теплий сірий + Cool Gray Холодний сірий + Neutrals Нейтральні + Ivory Слонова кістка + Linen Льон + Oat Овес + Greige Грейж + Stone Камінь + Taupe Сіро-коричневий + Slate Сланець + Clay Глина + Terracotta Теракота + Ochre Охра + Umber Умбра + Sand Пісок + Olive Оливковий + Moss Мох + Rosy Рожевуватий + Neutral Нейтральний + Golden Золотистий + Pastel Пастельні + Pastel Red Пастельний червоний + Pastel Orange Пастельний помаранчевий + Pastel Amber Пастельний бурштиновий + Pastel Yellow Пастельний жовтий + Pastel Lime Пастельний лаймовий + Pastel Green Пастельний зелений + Pastel Teal Пастельний синьо-зелений + Pastel Cyan Пастельний блакитний + Pastel Azure Пастельний лазуровий + Pastel Blue Пастельний синій + Pastel Violet Пастельний фіолетовий + Pastel Magenta Пастельний пурпурний + Soft Red М’який червоний + Soft Orange М’який помаранчевий + Soft Amber М’який бурштиновий + Soft Yellow М’який жовтий + Soft Lime М’який лаймовий + Soft Green М’який зелений + Soft Teal М’який синьо-зелений + Soft Cyan М’який блакитний + Soft Azure М’який лазуровий + Soft Blue М’який синій + Soft Violet М’який фіолетовий + Soft Magenta М’який пурпурний + Vivid Red Яскравий червоний + Vivid Orange Яскравий помаранчевий + Vivid Amber Яскравий бурштиновий + Vivid Yellow Яскравий жовтий + Vivid Lime Яскравий лаймовий + Vivid Green Яскравий зелений + Vivid Teal Яскравий синьо-зелений + Vivid Cyan Яскравий блакитний + Vivid Azure Яскравий лазуровий + Vivid Blue Яскравий синій + Vivid Violet Яскравий фіолетовий + Vivid Magenta Яскравий пурпурний + Deep Глибокі + Deep Red Темно-червоний + Deep Orange Темно-помаранчевий + Deep Amber Темно-бурштиновий + Deep Yellow Темно-жовтий + Deep Lime Темно-лаймовий + Deep Green Темно-зелений + Deep Teal Темний синьо-зелений + Deep Cyan Темно-блакитний + Deep Azure Темно-лазуровий + Deep Blue Темно-синій + Deep Violet Темно-фіолетовий + Deep Magenta Темно-пурпурний + Gold Золото + Silver Срібло + Bronze Бронза + Copper Мідь + Brass Латунь + Rose Gold Рожеве золото + Gunmetal Збройовий метал + Platinum Платина + Pewter Олово + Ember Жар + Lagoon Лагуна + Dusk Сутінки + Clay to Teal Від глини до синьо-зеленого + Plum to Olive Від сливового до оливкового + Complementary Coral Кораловий, доповняльна + Split Complementary Coral Кораловий, розщеплена доповняльна + Analogous Coral Кораловий, аналогова + Triad Coral Кораловий, тріада + Tetrad Coral Кораловий, тетрада + Pentagram Coral Кораловий, пентаграма + Complementary Teal Синьо-зелений, доповняльна + Split Complementary Teal Синьо-зелений, розщеплена доповняльна + Analogous Teal Синьо-зелений, аналогова + Triad Teal Синьо-зелений, тріада + Tetrad Teal Синьо-зелений, тетрада + Pentagram Teal Синьо-зелений, пентаграма + Soft Spectrum М’який спектр + Red to Amber Від червоного до бурштинового + Orange to Yellow Від помаранчевого до жовтого + Amber to Lime Від бурштинового до лаймового + Yellow to Green Від жовтого до зеленого + Lime to Teal Від лаймового до синьо-зеленого + Green to Cyan Від зеленого до блакитного + Teal to Azure Від синьо-зеленого до лазурового + Cyan to Blue Від блакитного до синього + Azure to Violet Від лазурового до фіолетового + Blue to Magenta Від синього до пурпурного + Violet to Red Від фіолетового до червоного + Magenta to Orange Від пурпурного до помаранчевого + Dawn Світанок + Noon Полудень + Sunset Захід сонця + Night Ніч + Overcast Похмуро + White to Black Від білого до чорного + Light Grays Світло-сірі + Dark Grays Темно-сірі + Warm Grays Теплі сірі + Cool Grays Холодні сірі + Fade to Transparent Перехід у прозорість + White Fade Білий перехід + Vignette Віньєтка + Mist Серпанок + Petal Пелюстка + Fern Папороть + Smoke Дим + Honey Мед + Seafoam Морська піна + Lavender Лаванда + Driftwood Викинуте морем дерево + Ink Wash Розмивка тушшю + Tide Приплив + Bloom Цвітіння + Dew Роса + Pollen Пилок + Lichen Лишайник + Prism Veil Призматична вуаль + Opal Ribbon Опалова стрічка + Pearl Flash Перлинний спалах + Aurora Foil Фольга полярного сяйва + Iris Sheen Райдужний полиск + Frost Spectrum Морозний спектр + Silver Tide Срібний приплив + Rose Quartz Gleam Блиск рожевого кварцу + Moonstone Shift Перелив місячного каменю + Violet Edge Фіолетовий край + Mint Halo М’ятний ореол + Amber Corona Бурштинова корона + Polar Glint Полярний відблиск + Pastel Orbit Пастельна орбіта + Coral and Navy Кораловий і темно-синій + Plum and Lime Сливовий і лаймовий + Teal and Gold Синьо-зелений і золотий + Indigo and Peach Індиго і персиковий + Forest and Rose Лісовий і рожевий + Red Glow Червоне сяйво + Orange Glow Помаранчеве сяйво + Amber Glow Бурштинове сяйво + Yellow Glow Жовте сяйво + Lime Glow Лаймове сяйво + Green Glow Зелене сяйво + Teal Glow Синьо-зелене сяйво + Cyan Glow Блакитне сяйво + Azure Glow Лазурове сяйво + Blue Glow Синє сяйво + Violet Glow Фіолетове сяйво + Magenta Glow Пурпурне сяйво + Polka Dots Горошок + Vertical Stripes Вертикальні смуги + Horizontal Stripes Горизонтальні смуги + Diagonal Stripes Діагональні смуги + Checkerboard Шахівниця + Diamonds Ромби + Crosses Хрестики + Coarse Grit Велике зерно + Stipple Пунктир + Scratches Подряпини + Sparse Flecks Рідкі цятки + Dense Flecks Густі цятки + Sine Bands Синусоїдні смуги + Ripple Lines Лінії брижів + Interference Rings Інтерференційні кільця + Offset Rings Зміщені кільця + Warped Checks Викривлена клітинка + Pinched Stripes Стиснуті смуги + Chevron Pulse Пульсуючі шеврони + Radiating Lenses Променисті лінзи + Soft Shadow М’яка тінь + Hard Shadow Різка тінь + Lifted Card Піднята картка + Neon Tube Неонова трубка + Inner Light Внутрішнє світло + Feathered Розтушований + Haze Імла + Double Rule Подвійна лінійка + Triple Rule Потрійна лінійка + Dashed Border Штрихова рамка + Dotted Border Точкова рамка + Offset Keyline Зміщений контур + Inset Keyline Внутрішній контур + Outside Stroke Зовнішня обвідка + Pointer Вказівник + Highlighter Маркер + Sketchy Line Ескізна лінія + Scribble Fill Заливка каракулями + Wobble Тремтіння + Zig Zag Edge Зигзагоподібний край + Wavy Edge Хвилястий край + Puffy Пухкий + Starburst Зоряний вибух + Glossy Глянцевий + Brushed Metal Шліфований метал + Spotlight Прожектор + Sunset Band Смуга заходу + Sea Glass Морське скло + Pearl Перлина + Chrome Rim Хромований обідок + Glow Orb Сяйна куля + Pill Badge Значок-капсула + Round Badge Круглий значок + Flag Wave Майоріючий прапор + Bulge Опуклість + Twisted Закручений + Echo Відлуння + Spiral Copies Копії по спіралі + Multiply Tint Відтінок множення + Darken Veil Затемнювальна вуаль + Ghosted Примарний + Two Tone Двоколірний + Overlay Glaze Глазур накладання + Screen Light Світло екрана + Soft Light Wash Розмивка м’яким світлом + Burst Спалах + Rounded Square Округлений квадрат + Bar Панель + Hexagon Шестикутник + Spectrum Спектр + Triangle Трикутник + Vivid Яскраві Save Brush Library… Зберегти бібліотеку пензлів… @msg `{_1}` has no brushes to apply У `{_1}` немає пензлів для застосування @msg missing `library` (see brush.libraries) не вказано `library` (див. brush.libraries) diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index d8469bce53..b6c99efc4e 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -6402,6 +6402,245 @@ axis Y Axis Trục Y Stars Ngôi sao Triangles Tam giác Sparkles Lấp lánh + Warm Gray Xám ấm + Cool Gray Xám lạnh + Neutrals Màu trung tính + Ivory Ngà + Linen Vải lanh + Oat Yến mạch + Greige Xám be + Stone Đá + Taupe Nâu xám + Slate Đá phiến + Clay Đất sét + Terracotta Đất nung + Ochre Đất son + Umber Nâu đất + Sand Cát + Olive Ô liu + Moss Rêu + Rosy Hồng phớt + Neutral Trung tính + Golden Vàng óng + Pastel Màu phấn + Pastel Red Đỏ phấn + Pastel Orange Cam phấn + Pastel Amber Hổ phách phấn + Pastel Yellow Vàng phấn + Pastel Lime Vàng chanh phấn + Pastel Green Xanh lá phấn + Pastel Teal Xanh mòng két phấn + Pastel Cyan Xanh lơ phấn + Pastel Azure Xanh da trời phấn + Pastel Blue Xanh dương phấn + Pastel Violet Tím phấn + Pastel Magenta Đỏ hồng phấn + Soft Red Đỏ dịu + Soft Orange Cam dịu + Soft Amber Hổ phách dịu + Soft Yellow Vàng dịu + Soft Lime Vàng chanh dịu + Soft Green Xanh lá dịu + Soft Teal Xanh mòng két dịu + Soft Cyan Xanh lơ dịu + Soft Azure Xanh da trời dịu + Soft Blue Xanh dương dịu + Soft Violet Tím dịu + Soft Magenta Đỏ hồng dịu + Vivid Red Đỏ rực + Vivid Orange Cam rực + Vivid Amber Hổ phách rực + Vivid Yellow Vàng rực + Vivid Lime Vàng chanh rực + Vivid Green Xanh lá rực + Vivid Teal Xanh mòng két rực + Vivid Cyan Xanh lơ rực + Vivid Azure Xanh da trời rực + Vivid Blue Xanh dương rực + Vivid Violet Tím rực + Vivid Magenta Đỏ hồng rực + Deep Đậm + Deep Red Đỏ đậm + Deep Orange Cam đậm + Deep Amber Hổ phách đậm + Deep Yellow Vàng đậm + Deep Lime Vàng chanh đậm + Deep Green Xanh lá đậm + Deep Teal Xanh mòng két đậm + Deep Cyan Xanh lơ đậm + Deep Azure Xanh da trời đậm + Deep Blue Xanh dương đậm + Deep Violet Tím đậm + Deep Magenta Đỏ hồng đậm + Gold Vàng kim + Silver Bạc + Bronze Đồng thiếc + Copper Đồng đỏ + Brass Đồng thau + Rose Gold Vàng hồng + Gunmetal Xám thép + Platinum Bạch kim + Pewter Thiếc + Ember Than hồng + Lagoon Đầm phá + Dusk Hoàng hôn + Clay to Teal Đất sét sang xanh mòng két + Plum to Olive Mận sang ô liu + Complementary Coral San hô, bổ sung + Split Complementary Coral San hô, bổ sung tách + Analogous Coral San hô, tương đồng + Triad Coral San hô, bộ ba + Tetrad Coral San hô, bộ bốn + Pentagram Coral San hô, ngôi sao năm cánh + Complementary Teal Xanh mòng két, bổ sung + Split Complementary Teal Xanh mòng két, bổ sung tách + Analogous Teal Xanh mòng két, tương đồng + Triad Teal Xanh mòng két, bộ ba + Tetrad Teal Xanh mòng két, bộ bốn + Pentagram Teal Xanh mòng két, ngôi sao năm cánh + Soft Spectrum Quang phổ dịu + Red to Amber Đỏ sang hổ phách + Orange to Yellow Cam sang vàng + Amber to Lime Hổ phách sang vàng chanh + Yellow to Green Vàng sang xanh lá + Lime to Teal Vàng chanh sang xanh mòng két + Green to Cyan Xanh lá sang xanh lơ + Teal to Azure Xanh mòng két sang xanh da trời + Cyan to Blue Xanh lơ sang xanh dương + Azure to Violet Xanh da trời sang tím + Blue to Magenta Xanh dương sang đỏ hồng + Violet to Red Tím sang đỏ + Magenta to Orange Đỏ hồng sang cam + Dawn Bình minh + Noon Giữa trưa + Sunset Hoàng hôn rực + Night Đêm + Overcast Trời âm u + White to Black Trắng sang đen + Light Grays Xám nhạt + Dark Grays Xám sẫm + Warm Grays Các sắc xám ấm + Cool Grays Các sắc xám lạnh + Fade to Transparent Mờ dần sang trong suốt + White Fade Mờ dần sang trắng + Vignette Viền tối + Mist Sương mù + Petal Cánh hoa + Fern Dương xỉ + Smoke Khói + Honey Mật ong + Seafoam Bọt biển + Lavender Oải hương + Driftwood Gỗ trôi dạt + Ink Wash Mực loang + Tide Thủy triều + Bloom Nở hoa + Dew Sương + Pollen Phấn hoa + Lichen Địa y + Prism Veil Màn lăng kính + Opal Ribbon Dải opal + Pearl Flash Ánh ngọc trai + Aurora Foil Lá cực quang + Iris Sheen Ánh óng ánh + Frost Spectrum Quang phổ sương giá + Silver Tide Triều bạc + Rose Quartz Gleam Ánh thạch anh hồng + Moonstone Shift Ánh đá mặt trăng + Violet Edge Viền tím + Mint Halo Quầng bạc hà + Amber Corona Vành hổ phách + Polar Glint Ánh cực + Pastel Orbit Quỹ đạo màu phấn + Coral and Navy San hô và xanh hải quân + Plum and Lime Mận và vàng chanh + Teal and Gold Xanh mòng két và vàng kim + Indigo and Peach Chàm và đào + Forest and Rose Rừng và hoa hồng + Red Glow Ánh đỏ + Orange Glow Ánh cam + Amber Glow Ánh hổ phách + Yellow Glow Ánh vàng + Lime Glow Ánh vàng chanh + Green Glow Ánh xanh lá + Teal Glow Ánh xanh mòng két + Cyan Glow Ánh xanh lơ + Azure Glow Ánh xanh da trời + Blue Glow Ánh xanh dương + Violet Glow Ánh tím + Magenta Glow Ánh đỏ hồng + Polka Dots Chấm bi + Vertical Stripes Sọc dọc + Horizontal Stripes Sọc ngang + Diagonal Stripes Sọc chéo + Checkerboard Bàn cờ + Diamonds Hình thoi + Crosses Chữ thập + Coarse Grit Hạt thô + Stipple Chấm điểm + Scratches Vết xước + Sparse Flecks Đốm thưa + Dense Flecks Đốm dày + Sine Bands Dải hình sin + Ripple Lines Đường gợn sóng + Interference Rings Vòng giao thoa + Offset Rings Vòng lệch + Warped Checks Ô vuông méo + Pinched Stripes Sọc thắt + Chevron Pulse Nhịp chữ V + Radiating Lenses Thấu kính tỏa tia + Soft Shadow Bóng mềm + Hard Shadow Bóng cứng + Lifted Card Thẻ nổi + Neon Tube Ống neon + Inner Light Ánh sáng bên trong + Feathered Viền mềm + Haze Mờ sương + Double Rule Đường kẻ đôi + Triple Rule Đường kẻ ba + Dashed Border Viền nét đứt + Dotted Border Viền chấm + Offset Keyline Đường viền lệch + Inset Keyline Đường viền trong + Outside Stroke Nét ngoài + Pointer Con trỏ + Highlighter Bút dạ quang + Sketchy Line Nét phác thảo + Scribble Fill Tô nguệch ngoạc + Wobble Chao đảo + Zig Zag Edge Mép răng cưa + Wavy Edge Mép lượn sóng + Puffy Phồng + Starburst Nổ sao + Glossy Bóng loáng + Brushed Metal Kim loại xước + Spotlight Đèn chiếu + Sunset Band Dải hoàng hôn + Sea Glass Thủy tinh biển + Pearl Ngọc trai + Chrome Rim Vành crôm + Glow Orb Quả cầu phát sáng + Pill Badge Huy hiệu viên thuốc + Round Badge Huy hiệu tròn + Flag Wave Cờ bay + Bulge Phình + Twisted Xoắn + Echo Tiếng vọng + Spiral Copies Bản sao xoắn ốc + Multiply Tint Sắc nhân + Darken Veil Màn làm tối + Ghosted Mờ ảo + Two Tone Hai tông + Overlay Glaze Men phủ lên + Screen Light Ánh màn hình + Soft Light Wash Loang ánh sáng mềm + Burst Bùng nổ + Rounded Square Hình vuông bo góc + Bar Thanh + Hexagon Lục giác + Spectrum Quang phổ + Triangle Tam giác + Vivid Rực rỡ Save Brush Library… Lưu thư viện cọ… @msg `{_1}` has no brushes to apply `{_1}` không có cọ nào để áp dụng @msg missing `library` (see brush.libraries) thiếu `library` (xem brush.libraries) diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index d9d9110276..0e8b64a3e6 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -6634,6 +6634,243 @@ axis Y Axis Y 轴 Stars 星形 Triangles 三角形 Sparkles 闪光 + Warm Gray 暖灰 + Cool Gray 冷灰 + Neutrals 中性色 + Ivory 象牙白 + Linen 亚麻 + Oat 燕麦 + Greige 灰米色 + Stone 石色 + Taupe 灰褐 + Slate 石板灰 + Clay 陶土 + Terracotta 赤陶 + Ochre 赭石 + Umber 棕土 + Sand 沙色 + Olive 橄榄 + Moss 苔藓 + Rosy 玫瑰调 + Neutral 中性 + Golden 金黄 + Pastel 粉彩 + Pastel Red 粉彩红 + Pastel Orange 粉彩橙 + Pastel Amber 粉彩琥珀 + Pastel Yellow 粉彩黄 + Pastel Lime 粉彩青柠 + Pastel Green 粉彩绿 + Pastel Teal 粉彩蓝绿 + Pastel Cyan 粉彩青 + Pastel Azure 粉彩天蓝 + Pastel Blue 粉彩蓝 + Pastel Violet 粉彩紫罗兰 + Pastel Magenta 粉彩洋红 + Soft Red 柔和红 + Soft Orange 柔和橙 + Soft Amber 柔和琥珀 + Soft Yellow 柔和黄 + Soft Lime 柔和青柠 + Soft Green 柔和绿 + Soft Teal 柔和蓝绿 + Soft Cyan 柔和青 + Soft Azure 柔和天蓝 + Soft Blue 柔和蓝 + Soft Violet 柔和紫罗兰 + Soft Magenta 柔和洋红 + Vivid Red 鲜艳红 + Vivid Orange 鲜艳橙 + Vivid Amber 鲜艳琥珀 + Vivid Yellow 鲜艳黄 + Vivid Lime 鲜艳青柠 + Vivid Green 鲜艳绿 + Vivid Teal 鲜艳蓝绿 + Vivid Cyan 鲜艳青 + Vivid Azure 鲜艳天蓝 + Vivid Blue 鲜艳蓝 + Vivid Violet 鲜艳紫罗兰 + Vivid Magenta 鲜艳洋红 + Deep 深色 + Deep Red 深红 + Deep Orange 深橙 + Deep Amber 深琥珀 + Deep Yellow 深黄 + Deep Lime 深青柠 + Deep Green 深绿 + Deep Teal 深蓝绿 + Deep Cyan 深青 + Deep Azure 深天蓝 + Deep Blue 深蓝 + Deep Violet 深紫罗兰 + Deep Magenta 深洋红 + Gold 金 + Silver 银 + Bronze 青铜 + Copper 铜 + Brass 黄铜 + Rose Gold 玫瑰金 + Gunmetal 枪灰 + Platinum 铂金 + Pewter 锡镴 + Ember 余烬 + Lagoon 泻湖 + Dusk 黄昏 + Clay to Teal 陶土到蓝绿 + Plum to Olive 梅紫到橄榄 + Complementary Coral 珊瑚色,互补色 + Split Complementary Coral 珊瑚色,分裂互补色 + Analogous Coral 珊瑚色,类似色 + Triad Coral 珊瑚色,三色组 + Tetrad Coral 珊瑚色,四色组 + Pentagram Coral 珊瑚色,五角星 + Complementary Teal 蓝绿,互补色 + Split Complementary Teal 蓝绿,分裂互补色 + Analogous Teal 蓝绿,类似色 + Triad Teal 蓝绿,三色组 + Tetrad Teal 蓝绿,四色组 + Pentagram Teal 蓝绿,五角星 + Soft Spectrum 柔和光谱 + Red to Amber 红到琥珀 + Orange to Yellow 橙到黄 + Amber to Lime 琥珀到青柠 + Yellow to Green 黄到绿 + Lime to Teal 青柠到蓝绿 + Green to Cyan 绿到青 + Teal to Azure 蓝绿到天蓝 + Cyan to Blue 青到蓝 + Azure to Violet 天蓝到紫罗兰 + Blue to Magenta 蓝到洋红 + Violet to Red 紫罗兰到红 + Magenta to Orange 洋红到橙 + Dawn 黎明 + Noon 正午 + Sunset 日落 + Night 夜晚 + Overcast 阴天 + White to Black 白到黑 + Light Grays 浅灰 + Dark Grays 深灰 + Warm Grays 暖灰系 + Cool Grays 冷灰系 + Fade to Transparent 渐隐到透明 + White Fade 白色渐隐 + Vignette 暗角 + Mist 薄雾 + Petal 花瓣 + Fern 蕨 + Smoke 烟 + Honey 蜂蜜 + Seafoam 海沫 + Lavender 薰衣草 + Driftwood 浮木 + Ink Wash 水墨 + Tide 潮汐 + Bloom 绽放 + Dew 露珠 + Pollen 花粉 + Lichen 地衣 + Prism Veil 棱镜纱 + Opal Ribbon 蛋白石丝带 + Pearl Flash 珍珠闪光 + Aurora Foil 极光箔 + Iris Sheen 虹彩光泽 + Frost Spectrum 霜之光谱 + Silver Tide 银潮 + Rose Quartz Gleam 粉晶微光 + Moonstone Shift 月光石流光 + Violet Edge 紫罗兰边 + Mint Halo 薄荷光晕 + Amber Corona 琥珀日冕 + Polar Glint 极地闪烁 + Pastel Orbit 粉彩轨道 + Coral and Navy 珊瑚色与海军蓝 + Plum and Lime 梅紫与青柠 + Teal and Gold 蓝绿与金 + Indigo and Peach 靛蓝与桃色 + Forest and Rose 森林与玫瑰 + Red Glow 红色辉光 + Orange Glow 橙色辉光 + Amber Glow 琥珀辉光 + Yellow Glow 黄色辉光 + Lime Glow 青柠辉光 + Green Glow 绿色辉光 + Teal Glow 蓝绿辉光 + Cyan Glow 青色辉光 + Azure Glow 天蓝辉光 + Blue Glow 蓝色辉光 + Violet Glow 紫罗兰辉光 + Magenta Glow 洋红辉光 + Polka Dots 波点 + Vertical Stripes 竖条纹 + Horizontal Stripes 横条纹 + Diagonal Stripes 斜条纹 + Checkerboard 棋盘格 + Diamonds 菱形 + Crosses 十字 + Coarse Grit 粗颗粒 + Stipple 点画 + Scratches 划痕 + Sparse Flecks 稀疏斑点 + Dense Flecks 密集斑点 + Sine Bands 正弦带 + Ripple Lines 涟漪线 + Interference Rings 干涉环 + Offset Rings 错位环 + Warped Checks 扭曲方格 + Pinched Stripes 收缩条纹 + Chevron Pulse 人字脉冲 + Radiating Lenses 放射透镜 + Soft Shadow 柔和阴影 + Hard Shadow 硬阴影 + Lifted Card 浮起卡片 + Neon Tube 霓虹灯管 + Inner Light 内光 + Feathered 羽化 + Haze 雾霭 + Double Rule 双线 + Triple Rule 三线 + Dashed Border 虚线边框 + Dotted Border 点线边框 + Offset Keyline 偏移轮廓线 + Inset Keyline 内缩轮廓线 + Outside Stroke 外描边 + Pointer 指针 + Highlighter 荧光笔 + Sketchy Line 草图线 + Scribble Fill 涂鸦填充 + Wobble 摇晃 + Zig Zag Edge 锯齿边 + Wavy Edge 波浪边 + Puffy 鼓起 + Starburst 星爆 + Glossy 光泽 + Brushed Metal 拉丝金属 + Spotlight 聚光灯 + Sunset Band 日落条带 + Sea Glass 海玻璃 + Pearl 珍珠 + Chrome Rim 镀铬边 + Glow Orb 发光球 + Pill Badge 胶囊徽章 + Round Badge 圆形徽章 + Flag Wave 飘扬的旗帜 + Bulge 凸起 + Twisted 扭转 + Echo 回声 + Spiral Copies 螺旋副本 + Multiply Tint 正片叠底色调 + Darken Veil 变暗薄纱 + Ghosted 半透明 + Two Tone 双色调 + Overlay Glaze 叠加釉 + Screen Light 滤色光 + Soft Light Wash 柔光晕染 + Burst 爆发 + Rounded Square 圆角正方形 + Bar 条形 + Hexagon 六边形 + Triangle 三角 Save Brush Library… 保存画笔库… @msg `{_1}` has no brushes to apply `{_1}` 中没有可应用的画笔 @msg missing `library` (see brush.libraries) 缺少 `library`(请参阅 brush.libraries) diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index a0d987fe69..3593e2e60a 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -6440,6 +6440,245 @@ axis Y Axis Y 軸 Stars 星形 Triangles 三角形 Sparkles 閃光 + Warm Gray 暖灰 + Cool Gray 冷灰 + Neutrals 中性色 + Ivory 象牙白 + Linen 亞麻 + Oat 燕麥 + Greige 灰米色 + Stone 石色 + Taupe 灰褐 + Slate 石板灰 + Clay 陶土 + Terracotta 赤陶 + Ochre 赭石 + Umber 棕土 + Sand 沙色 + Olive 橄欖 + Moss 苔蘚 + Rosy 玫瑰調 + Neutral 中性 + Golden 金黃 + Pastel 粉彩 + Pastel Red 粉彩紅 + Pastel Orange 粉彩橙 + Pastel Amber 粉彩琥珀 + Pastel Yellow 粉彩黃 + Pastel Lime 粉彩萊姆 + Pastel Green 粉彩綠 + Pastel Teal 粉彩藍綠 + Pastel Cyan 粉彩青 + Pastel Azure 粉彩天藍 + Pastel Blue 粉彩藍 + Pastel Violet 粉彩紫羅蘭 + Pastel Magenta 粉彩洋紅 + Soft Red 柔和紅 + Soft Orange 柔和橙 + Soft Amber 柔和琥珀 + Soft Yellow 柔和黃 + Soft Lime 柔和萊姆 + Soft Green 柔和綠 + Soft Teal 柔和藍綠 + Soft Cyan 柔和青 + Soft Azure 柔和天藍 + Soft Blue 柔和藍 + Soft Violet 柔和紫羅蘭 + Soft Magenta 柔和洋紅 + Vivid Red 鮮豔紅 + Vivid Orange 鮮豔橙 + Vivid Amber 鮮豔琥珀 + Vivid Yellow 鮮豔黃 + Vivid Lime 鮮豔萊姆 + Vivid Green 鮮豔綠 + Vivid Teal 鮮豔藍綠 + Vivid Cyan 鮮豔青 + Vivid Azure 鮮豔天藍 + Vivid Blue 鮮豔藍 + Vivid Violet 鮮豔紫羅蘭 + Vivid Magenta 鮮豔洋紅 + Deep 深色 + Deep Red 深紅 + Deep Orange 深橙 + Deep Amber 深琥珀 + Deep Yellow 深黃 + Deep Lime 深萊姆 + Deep Green 深綠 + Deep Teal 深藍綠 + Deep Cyan 深青 + Deep Azure 深天藍 + Deep Blue 深藍 + Deep Violet 深紫羅蘭 + Deep Magenta 深洋紅 + Gold 金 + Silver 銀 + Bronze 青銅 + Copper 銅 + Brass 黃銅 + Rose Gold 玫瑰金 + Gunmetal 槍灰 + Platinum 白金 + Pewter 錫鑞 + Ember 餘燼 + Lagoon 潟湖 + Dusk 黃昏 + Clay to Teal 陶土到藍綠 + Plum to Olive 梅紫到橄欖 + Complementary Coral 珊瑚色,互補色 + Split Complementary Coral 珊瑚色,分割互補色 + Analogous Coral 珊瑚色,類似色 + Triad Coral 珊瑚色,三色組 + Tetrad Coral 珊瑚色,四色組 + Pentagram Coral 珊瑚色,五角星 + Complementary Teal 藍綠,互補色 + Split Complementary Teal 藍綠,分割互補色 + Analogous Teal 藍綠,類似色 + Triad Teal 藍綠,三色組 + Tetrad Teal 藍綠,四色組 + Pentagram Teal 藍綠,五角星 + Soft Spectrum 柔和光譜 + Red to Amber 紅到琥珀 + Orange to Yellow 橙到黃 + Amber to Lime 琥珀到萊姆 + Yellow to Green 黃到綠 + Lime to Teal 萊姆到藍綠 + Green to Cyan 綠到青 + Teal to Azure 藍綠到天藍 + Cyan to Blue 青到藍 + Azure to Violet 天藍到紫羅蘭 + Blue to Magenta 藍到洋紅 + Violet to Red 紫羅蘭到紅 + Magenta to Orange 洋紅到橙 + Dawn 黎明 + Noon 正午 + Sunset 日落 + Night 夜晚 + Overcast 陰天 + White to Black 白到黑 + Light Grays 淺灰 + Dark Grays 深灰 + Warm Grays 暖灰系 + Cool Grays 冷灰系 + Fade to Transparent 漸隱到透明 + White Fade 白色漸隱 + Vignette 暈影 + Mist 薄霧 + Petal 花瓣 + Fern 蕨 + Smoke 煙 + Honey 蜂蜜 + Seafoam 海沫 + Lavender 薰衣草 + Driftwood 漂流木 + Ink Wash 水墨 + Tide 潮汐 + Bloom 綻放 + Dew 露珠 + Pollen 花粉 + Lichen 地衣 + Prism Veil 稜鏡紗 + Opal Ribbon 蛋白石緞帶 + Pearl Flash 珍珠閃光 + Aurora Foil 極光箔 + Iris Sheen 虹彩光澤 + Frost Spectrum 霜之光譜 + Silver Tide 銀潮 + Rose Quartz Gleam 粉晶微光 + Moonstone Shift 月光石流光 + Violet Edge 紫羅蘭邊 + Mint Halo 薄荷光暈 + Amber Corona 琥珀日冕 + Polar Glint 極地閃爍 + Pastel Orbit 粉彩軌道 + Coral and Navy 珊瑚色與海軍藍 + Plum and Lime 梅紫與萊姆 + Teal and Gold 藍綠與金 + Indigo and Peach 靛藍與桃色 + Forest and Rose 森林與玫瑰 + Red Glow 紅色光暈 + Orange Glow 橙色光暈 + Amber Glow 琥珀光暈 + Yellow Glow 黃色光暈 + Lime Glow 萊姆光暈 + Green Glow 綠色光暈 + Teal Glow 藍綠光暈 + Cyan Glow 青色光暈 + Azure Glow 天藍光暈 + Blue Glow 藍色光暈 + Violet Glow 紫羅蘭光暈 + Magenta Glow 洋紅光暈 + Polka Dots 圓點 + Vertical Stripes 直條紋 + Horizontal Stripes 橫條紋 + Diagonal Stripes 斜條紋 + Checkerboard 棋盤格 + Diamonds 菱形 + Crosses 十字 + Coarse Grit 粗顆粒 + Stipple 點畫 + Scratches 刮痕 + Sparse Flecks 稀疏斑點 + Dense Flecks 密集斑點 + Sine Bands 正弦帶 + Ripple Lines 漣漪線 + Interference Rings 干涉環 + Offset Rings 錯位環 + Warped Checks 扭曲方格 + Pinched Stripes 收縮條紋 + Chevron Pulse 人字脈衝 + Radiating Lenses 放射透鏡 + Soft Shadow 柔和陰影 + Hard Shadow 硬陰影 + Lifted Card 浮起卡片 + Neon Tube 霓虹燈管 + Inner Light 內光 + Feathered 羽化 + Haze 霧靄 + Double Rule 雙線 + Triple Rule 三線 + Dashed Border 虛線邊框 + Dotted Border 點線邊框 + Offset Keyline 位移輪廓線 + Inset Keyline 內縮輪廓線 + Outside Stroke 外側筆畫 + Pointer 指標 + Highlighter 螢光筆 + Sketchy Line 草圖線 + Scribble Fill 塗鴉填色 + Wobble 搖晃 + Zig Zag Edge 鋸齒邊 + Wavy Edge 波浪邊 + Puffy 鼓起 + Starburst 星爆 + Glossy 光澤 + Brushed Metal 拉絲金屬 + Spotlight 聚光燈 + Sunset Band 日落條帶 + Sea Glass 海玻璃 + Pearl 珍珠 + Chrome Rim 鍍鉻邊 + Glow Orb 發光球 + Pill Badge 膠囊徽章 + Round Badge 圓形徽章 + Flag Wave 飄揚的旗幟 + Bulge 凸起 + Twisted 扭轉 + Echo 回聲 + Spiral Copies 螺旋副本 + Multiply Tint 色彩增值色調 + Darken Veil 變暗薄紗 + Ghosted 半透明 + Two Tone 雙色調 + Overlay Glaze 覆蓋釉 + Screen Light 濾色光 + Soft Light Wash 柔光暈染 + Burst 爆發 + Rounded Square 圓角正方形 + Bar 長條 + Hexagon 六邊形 + Spectrum 光譜 + Triangle 三角 + Vivid 鮮豔 Save Brush Library… 儲存筆刷資料庫… @msg `{_1}` has no brushes to apply `{_1}` 中沒有可套用的筆刷 @msg missing `library` (see brush.libraries) 未提供 `library`(請參閱 brush.libraries) diff --git a/crates/ui-egui/src/panels/brushes.rs b/crates/ui-egui/src/panels/brushes.rs index 0b540a4ba5..0e41752551 100644 --- a/crates/ui-egui/src/panels/brushes.rs +++ b/crates/ui-egui/src/panels/brushes.rs @@ -7,6 +7,7 @@ //! on macOS) onto such a brush replaces its art. Brush libraries open in library panels //! ([`BrushLibraries`]). +use std::borrow::Cow; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; @@ -654,8 +655,8 @@ impl LibraryKind for BrushLibraries { } /// A built-in library's brush in the UI language; a User Defined or loaded library's brush as /// it is named. - fn label<'a>(id: &str, name: &'a str) -> &'a str { - super::label_or_name(name, brushlib::BUILTIN.iter().any(|b| b.id == id)) + fn label<'a>(id: &str, name: &'a str) -> Cow<'a, str> { + super::label_or_name(name, brushlib::BUILTIN.iter().any(|b| b.id == id)).into() } /// The brush's stroke preview, drawn with the library's resources. fn draw(_: &VectorcraftApp, ui: &Ui, r: egui::Rect, b: &LibBrush, selected: bool, hovered: bool) { diff --git a/crates/ui-egui/src/panels/graphic_styles.rs b/crates/ui-egui/src/panels/graphic_styles.rs index b87f291e67..85e1381c6f 100644 --- a/crates/ui-egui/src/panels/graphic_styles.rs +++ b/crates/ui-egui/src/panels/graphic_styles.rs @@ -9,6 +9,7 @@ //! the same tiles ([`picker`]). Graphic style libraries open in library panels //! ([`GraphicStyleLibraries`]). +use std::borrow::Cow; use std::cell::RefCell; use std::collections::HashMap; use std::sync::Arc; @@ -726,10 +727,16 @@ impl LibraryKind for GraphicStyleLibraries { fn path(app: &VectorcraftApp, id: &str) -> Option { app.session.style_libraries.path(id).map(str::to_string) } - fn rows<'a>(lib: &'a Self::Lib, _: &str, query: &str) -> Vec> { - let found = |n: &str| query.is_empty() || n.to_lowercase().contains(query); + /// Find matches a style's name as shown and as stored. + fn rows<'a>(lib: &'a Self::Lib, id: &str, query: &str) -> Vec> { + let found = |n: &str| query.is_empty() || n.to_lowercase().contains(query) || Self::label(id, n).to_lowercase().contains(query); lib.iter().filter(|s| found(&s.style().name)).map(|s| Row { name: &s.style().name, item: Some(s) }).collect() } + /// A built-in library's style in the UI language; a User Defined or loaded library's style as + /// it is named. + fn label<'a>(id: &str, name: &'a str) -> Cow<'a, str> { + super::label_or_name(name, STYLE_LIBRARIES.iter().any(|b| b.id == id)).into() + } /// The style on the Graphic Styles panel's preview shape. fn draw(app: &VectorcraftApp, ui: &Ui, r: Rect, s: &LibStyle, selected: bool, hovered: bool) { let paints = Paints { patterns: &s.lib.patterns, brushes: None }; diff --git a/crates/ui-egui/src/panels/library_panel.rs b/crates/ui-egui/src/panels/library_panel.rs index fdfb2f7c3b..0942fafad7 100644 --- a/crates/ui-egui/src/panels/library_panel.rs +++ b/crates/ui-egui/src/panels/library_panel.rs @@ -13,6 +13,7 @@ //! panel whose library can't be found shows the library as missing, with its file and Locate //! Library… (`ui.libraryPanel.locate`). The find text and the selection are panel state. +use std::borrow::Cow; use std::sync::{Mutex, PoisonError}; use egui::{Rect, Sense, Ui}; @@ -108,8 +109,8 @@ pub(crate) trait LibraryKind { fn rows<'a>(lib: &'a Self::Lib, id: &str, query: &str) -> Vec>; /// Row `name` of library `id` as its list row and tooltips show it (by default as it is). The /// row keeps `name` for its tile, selection, clicks, drags and the commands they run. - fn label<'a>(_id: &str, name: &'a str) -> &'a str { - name + fn label<'a>(_id: &str, name: &'a str) -> Cow<'a, str> { + Cow::Borrowed(name) } /// An item's thumbnail in `r`. fn draw(app: &VectorcraftApp, ui: &Ui, r: Rect, item: &Self::Item, selected: bool, hovered: bool); @@ -665,7 +666,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) { None => super::swatches::draw_folder(ui, chip), } let label = K::label(id, row.name); - list_row_name(ui, r, chip, label); + list_row_name(ui, r, chip, &label); drag_out::(ui, &resp, id, row); let tip = || row.item.map_or_else(|| label.to_string(), |i| format!("{label} ({})", K::describe(i))); click(ui, resp, row, &tip); @@ -678,7 +679,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) { None => folder_tile(ui, cell, is_sel(row.name)), } drag_out::(ui, &resp, id, row); - click(ui, resp, row, &|| K::label(id, row.name).to_string()); + click(ui, resp, row, &|| K::label(id, row.name).into_owned()); } } }); diff --git a/crates/ui-egui/src/panels/library_panel/tests.rs b/crates/ui-egui/src/panels/library_panel/tests.rs index 5d6fef049b..991cb8d0d0 100644 --- a/crates/ui-egui/src/panels/library_panel/tests.rs +++ b/crates/ui-egui/src/panels/library_panel/tests.rs @@ -719,3 +719,37 @@ fn the_list_fills_a_tall_panel_above_its_footer() { let loose = list(None); assert!(loose.height() <= 220.5, "unsized, the list keeps its height: {loose:?}"); } + +/// A built-in swatch library lists its swatches and color groups in the UI language, a numbered +/// swatch with its number as it is, and Find matches the name shown and the swatch's own name. A +/// click adds the swatch under its own name. A color value, and a User Defined or loaded +/// library's names, are shown as they are. +#[test] +fn built_in_library_swatches_are_listed_in_the_ui_language() { + let mut app = app(); + let ctx = context(); + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").expect("fr registered")); + app.run("window.swatchLibrary", json!({"library": "earth-tones"})).unwrap(); + app.run("ui.libraryPanel", json!({"panel": shown(&app), "view": "smallList"})).unwrap(); + let mut texts = vec![]; + for time in [0.0, 0.25] { + let screen_rect = Some(Rect::from_min_size(Pos2::ZERO, vec2(1200.0, 800.0))); + let mut out = ctx.run_ui(egui::RawInput { time: Some(time), screen_rect, ..Default::default() }, |ui| show_window(&mut app, ui.ctx())); + out.textures_delta.clear(); + texts = + out.shapes.iter().filter_map(|c| if let egui::Shape::Text(t) = &c.shape { Some(t.galley.text().to_string()) } else { None }).collect(); + } + assert!(texts.iter().any(|t| t == "Argile") && texts.iter().any(|t| t == "Argile 1"), "{texts:?}"); + assert!(!texts.iter().any(|t| t == "Clay" || t == "Clay 1"), "{texts:?}"); + let lib = SwatchLibraries::get(&app, "earth-tones").unwrap().1; + for query in ["argile 2", "clay 2"] { + let rows = SwatchLibraries::rows(&lib, "earth-tones", query); + assert_eq!(rows.iter().map(|r| r.name).collect::>(), ["Clay", "Clay 2"], "{query}"); + } + assert!(SwatchLibraries::rows(&lib, "loaded/1", "argile").is_empty(), "another library's swatch is matched by its own name only"); + assert_eq!(SwatchLibraries::label("grays-neutrals", "K=35"), "K=35"); + assert_eq!(SwatchLibraries::label("user/1", "Clay 3"), "Clay 3"); + click(&mut app, &ctx, "Clay 1", Modifiers::NONE, 1.0); + assert!(app.session.doc().unwrap().doc.swatch("Clay 1").is_some(), "added under its own name"); + crate::i18n::set_current(crate::i18n::Lang::EN); +} diff --git a/crates/ui-egui/src/panels/swatches/libraries.rs b/crates/ui-egui/src/panels/swatches/libraries.rs index 864f6ae7e0..2c0215d146 100644 --- a/crates/ui-egui/src/panels/swatches/libraries.rs +++ b/crates/ui-egui/src/panels/swatches/libraries.rs @@ -1,3 +1,5 @@ +use std::borrow::Cow; + use super::actions::deletable; use super::dnd::selection; use super::tiles::{describe, global_mark, list_icons, pattern_thumb_in}; @@ -82,9 +84,10 @@ impl LibraryKind for SwatchLibraries { app.session.swatch_libraries.path(id).map(str::to_string) } /// Ungrouped swatches, then each colour group's folder and swatches (a group whose name - /// matches shows all of them), as in the Swatches panel. - fn rows<'a>(lib: &'a Self::Lib, _: &str, query: &str) -> Vec> { - let found = |n: &str| query.is_empty() || n.to_lowercase().contains(query); + /// matches shows all of them), as in the Swatches panel. Find matches a name as shown and as + /// stored. + fn rows<'a>(lib: &'a Self::Lib, id: &str, query: &str) -> Vec> { + let found = |n: &str| query.is_empty() || n.to_lowercase().contains(query) || Self::label(id, n).to_lowercase().contains(query); let row = |w: &'a Swatch| Row { name: &w.name, item: Some(w) }; let mut out: Vec> = lib.swatches.iter().filter(|w| found(&w.name)).map(row).collect(); for g in &lib.groups { @@ -97,6 +100,12 @@ impl LibraryKind for SwatchLibraries { } out } + /// A built-in library's swatch or color group in the UI language, a numbered one ("Warm Gray + /// 3") with its number as it is; a User Defined or loaded library's as it is named. + fn label<'a>(id: &str, name: &'a str) -> Cow<'a, str> { + let built_in = SWATCH_LIBRARIES.iter().chain(GRADIENT_LIBRARIES).any(|b| b.id == id) || PATTERN_LIBRARIES.iter().any(|b| b.id == id); + if built_in { crate::i18n::numbered_label(crate::i18n::current(), name) } else { Cow::Borrowed(name) } + } fn draw(_: &VectorcraftApp, ui: &Ui, r: Rect, w: &Swatch, selected: bool, hovered: bool) { swatch_tile(ui, r, &w.paint, selected, hovered); // A built-in pattern library's pattern, drawn from the library. diff --git a/crates/ui-egui/src/panels/symbols.rs b/crates/ui-egui/src/panels/symbols.rs index ad081ddfcd..e3e28c2c02 100644 --- a/crates/ui-egui/src/panels/symbols.rs +++ b/crates/ui-egui/src/panels/symbols.rs @@ -2,6 +2,7 @@ //! selects a symbol (it becomes the Symbol Sprayer's current symbol); double-click opens it in symbol editing mode. Symbol //! libraries open in library panels ([`SymbolLibraries`]). +use std::borrow::Cow; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; @@ -496,10 +497,16 @@ impl LibraryKind for SymbolLibraries { fn path(app: &VectorcraftApp, id: &str) -> Option { app.session.symbol_libraries.path(id).map(str::to_string) } - fn rows<'a>(lib: &'a Self::Lib, _: &str, query: &str) -> Vec> { - let found = |n: &str| query.is_empty() || n.to_lowercase().contains(query); + /// Find matches a symbol's name as shown and as stored. + fn rows<'a>(lib: &'a Self::Lib, id: &str, query: &str) -> Vec> { + let found = |n: &str| query.is_empty() || n.to_lowercase().contains(query) || Self::label(id, n).to_lowercase().contains(query); lib.iter().filter(|s| found(s.name())).map(|s| Row { name: s.name(), item: Some(s) }).collect() } + /// A built-in library's symbol in the UI language; a User Defined or loaded library's symbol as + /// it is named. + fn label<'a>(id: &str, name: &'a str) -> Cow<'a, str> { + super::label_or_name(name, symbollib::BUILTIN.iter().any(|b| b.id == id)).into() + } /// The symbol's art on white, as the Symbols panel shows it. fn draw(_: &VectorcraftApp, ui: &Ui, r: egui::Rect, s: &LibSymbol, selected: bool, hovered: bool) { chip(ui, &s.lib.doc, &library_symbols(&s.lib), r, s.name()); diff --git a/crates/ui-egui/src/panels/tests_style_libraries.rs b/crates/ui-egui/src/panels/tests_style_libraries.rs index 2adeda9812..569c1765a7 100644 --- a/crates/ui-egui/src/panels/tests_style_libraries.rs +++ b/crates/ui-egui/src/panels/tests_style_libraries.rs @@ -210,3 +210,31 @@ fn saving_to_a_file_and_opening_a_vcstyles_file() { assert_eq!(other.submenu, Some("Other Libraries")); assert_eq!(GraphicStyleLibraries::get(&app, &open.id).unwrap().1.len(), app.session.doc().unwrap().doc.graphic_styles.len()); } + +/// A built-in library lists its styles in the UI language, and Find matches the name shown and the +/// style's own name. A click applies the style under its own name. Another library's styles are +/// matched by their own names only. +#[test] +fn built_in_library_styles_are_listed_in_the_ui_language() { + let mut app = app(); + let ctx = context(); + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").expect("fr registered")); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 80, "height": 40})).unwrap(); + app.run("window.graphicStyleLibrary", json!({"library": "shadows-glows"})).unwrap(); + let panel = last_open(&app.ui).map(LibraryPanel::panel).unwrap_or_default(); + app.run("ui.libraryPanel", json!({"panel": panel, "view": "smallList"})).unwrap(); + frame(&ctx, vec![], Modifiers::NONE, 0.0, |ui| library_panel::show_window(&mut app, ui.ctx())); + let texts = frame(&ctx, vec![], Modifiers::NONE, 0.25, |ui| library_panel::show_window(&mut app, ui.ctx())); + assert!(texts.iter().any(|t| t == "Ombre douce"), "{texts:?}"); + assert!(!texts.iter().any(|t| t == "Soft Shadow"), "{texts:?}"); + let lib = GraphicStyleLibraries::get(&app, "shadows-glows").unwrap().1; + for query in ["ombre douce", "soft shadow"] { + let rows = GraphicStyleLibraries::rows(&lib, "shadows-glows", query); + assert_eq!(rows.iter().map(|r| r.name).collect::>(), ["Soft Shadow"], "{query}"); + } + assert!(GraphicStyleLibraries::rows(&lib, "loaded/1", "ombre douce").is_empty(), "another library's style is matched by its own name only"); + click(&mut app, &ctx, "Soft Shadow", Modifiers::NONE, 1.0); + let (g, _) = app.session.selection_graphic_style().expect("applied to the selection"); + assert_eq!(g.name, "Soft Shadow"); + crate::i18n::set_current(crate::i18n::Lang::EN); +} diff --git a/crates/ui-egui/src/panels/tests_symbol_libraries.rs b/crates/ui-egui/src/panels/tests_symbol_libraries.rs index 9c58bc49c7..f75460b109 100644 --- a/crates/ui-egui/src/panels/tests_symbol_libraries.rs +++ b/crates/ui-egui/src/panels/tests_symbol_libraries.rs @@ -225,3 +225,29 @@ fn other_library_opens_a_documents_symbols_and_reports_unreadable_files() { assert!(last_open(&app.ui).is_none()); let _ = std::fs::remove_dir_all(dir); } + +/// A built-in library lists its symbols in the UI language, and Find matches the name shown and the +/// symbol's own name. A click adds the symbol under its own name. Another library's symbols are +/// matched by their own names only. +#[test] +fn built_in_library_symbols_are_listed_in_the_ui_language() { + let mut app = app(); + let ctx = context(); + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").expect("fr registered")); + app.run("window.symbolLibrary", json!({"library": "basic-shapes"})).unwrap(); + let panel = last_open(&app.ui).map(LibraryPanel::panel).unwrap_or_default(); + app.run("ui.libraryPanel", json!({"panel": panel, "view": "smallList"})).unwrap(); + frame(&ctx, vec![], 0.0, |ui| library_panel::show_window(&mut app, ui.ctx())); + let texts = frame(&ctx, vec![], 0.25, |ui| library_panel::show_window(&mut app, ui.ctx())); + assert!(texts.iter().any(|t| t == "Éclat") && texts.iter().any(|t| t == "Étoile"), "{texts:?}"); + assert!(!texts.iter().any(|t| t == "Burst"), "{texts:?}"); + let lib = SymbolLibraries::get(&app, "basic-shapes").unwrap().1; + for query in ["éclat", "burst"] { + let rows = SymbolLibraries::rows(&lib, "basic-shapes", query); + assert_eq!(rows.iter().map(|r| r.name).collect::>(), ["Burst"], "{query}"); + } + assert!(SymbolLibraries::rows(&lib, "loaded/1", "éclat").is_empty(), "another library's symbol is matched by its own name only"); + click(&mut app, &ctx, "Star", Modifiers::NONE, 1.0); + assert_eq!(symbols(&app), ["Star"]); + crate::i18n::set_current(crate::i18n::Lang::EN); +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 296bd84b2b..a4ff21b79f 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -949,6 +949,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Bristle Brushes library** ([What's new](https://helpx.adobe.com/illustrator/desktop/new-features/whats-new.html), [About brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Bristle Brushes holds ten bristle brushes, one for each tip shape (Fine Liner, Pointed Flat, Stubby Round, Dry Scrub, Soft Dome, Filbert, Angled Round, Angled Flat, Fan Blender, Grass Fan). The brushes, their names and their values are VectorCraft's own, and every value lies inside the range the bristle brush keeps (`brush.libraries`, `brush.addFromLibrary`; `the_bristle_brushes_library_covers_every_tip_shape_within_the_bristle_ranges`). - **Dry Media library** ([help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Dry Media holds four art brushes with textured strokes like dry drawing materials, each 100 pt long: Chalk Grain (about 8 pt high), Graphite Pencil (about 2.3 pt), Wax Crayon (about 5.5 pt) and Charcoal Dust (about 7 pt). The brushes, their names, sizes and art are VectorCraft's own: each is filled vector paths from a fixed seed, at most 80 paths and 500 anchors, stretched along the path with Tints colorization, and the chalk and crayon art has even-odd gaps where the paper shows (`brush.libraries`, `brush.addFromLibrary`; `the_dry_media_library_holds_grainy_art_brushes_with_bounded_art`). - **Brush names in library panels**: a built-in brush library's panel shows its brushes' names in the UI language, in its list rows and tooltips, and its Find field matches the name shown or the English name. This is VectorCraft's own rule. A User Defined or Other Library… library's brushes, and the document's Brushes panel, show names as they are stored. A click, a drag, Add to Brushes and `brush.addFromLibrary` still use the English name, so the brush comes into the document under that name (`built_in_library_brushes_are_listed_in_the_ui_language`, `built_in_library_brush_names_are_in_complete_catalogs`). + - **Swatch, graphic style and symbol names in library panels**: a built-in swatch, gradient, pattern, graphic style or symbol library's panel shows its item and color group names in the UI language, and its Find field matches the name shown or the English name. A numbered swatch such as "Warm Gray 3" shows its group's name in the UI language followed by the number, and a color value such as `K=35` or `#33cc99` is shown as it is. This is VectorCraft's own rule. A User Defined or Other Library… library's items show names as they are stored. A click, a drag and the Add to commands still use the English name, so the item comes into the document under that name (`built_in_library_swatches_are_listed_in_the_ui_language`, `built_in_library_styles_are_listed_in_the_ui_language`, `built_in_library_symbols_are_listed_in_the_ui_language`, `numbered_labels_translate_the_name_before_the_number`). - A canvas context menu: right-click selects the object under the pointer and lists what applies to the selection (Undo/Redo, clipboard, group, isolation, join, Remove Anchor Points when anchors are selected, masks, compound paths, guides, Transform, Arrange, Select, Export Selection, and on type Bullets and Numbering and Spelling › Auto Spell Check, checked while it is on), or the view commands on empty canvas. - A right-click over locked objects adds an Unlock submenu to the canvas context menu. The submenu lists up to 20 locked objects under the pointer, topmost first, by the name the Layers panel shows, and choosing one unlocks it (`layer.setProps`). A locked group is listed as one item. Objects on hidden, locked or template layers are not listed. - The canvas context menu lists Object › Path › Smooth… while the selection holds a path, in a group or a compound path too. It opens the Smooth slider, as the Object menu does (`right_click_on_a_path_opens_the_smooth_slider`, `smooth_follows_the_selections_paths`). From ff98a9cebf19b75eef9b282bf276559187deca2e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 05:27:42 -0800 Subject: [PATCH 008/158] i18n: add Gujarati rows for the Artboard tool's add-button tooltips The Artboard tool's two edge-button tooltips had no gu row, so the complete-catalog test for them failed once gu became a complete catalog. --- crates/ui-egui/src/i18n/gu.tsv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 716d851655..c6dedae9d9 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -570,6 +570,8 @@ Click the art with the Gradient tool to add or select points. પોઇન્ટ ઉમેરવા કે પસંદ કરવા ગ્રેડિયન્ટ ટૂલ વડે આર્ટવર્ક પર ક્લિક કરો. Click the first point પહેલા પોઇન્ટ પર ક્લિક કરો Click the ramp or a type button to apply a gradient. ગ્રેડિયન્ટ લાગુ કરવા માટે રૅમ્પ અથવા ટાઇપ બટન પર ક્લિક કરો. + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art આ બાજુ આર્ટબોર્ડ ઉમેરવા ક્લિક કરો, આ આર્ટબોર્ડને તેની આર્ટ સાથે ડુપ્લિકેટ કરવા Alt-ક્લિક કરો + Click to add an artboard on this side આ બાજુ આર્ટબોર્ડ ઉમેરવા ક્લિક કરો Click to apply to the selected type પસંદ કરેલા ટેક્સ્ટ પર લાગુ કરવા ક્લિક કરો Click to choose a swatch, Shift-click to mix a colour સ્વેચ પસંદ કરવા ક્લિક કરો, રંગ મિક્સ કરવા Shift-ક્લિક કરો Click to edit સંપાદન માટે ક્લિક કરો From 8896339305a436e89125228095f5542020900c6c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 05:51:56 -0800 Subject: [PATCH 009/158] i18n: Gujarati has rows for the built-in library swatch, graphic style and symbol names --- crates/ui-egui/src/i18n/gu.tsv | 269 +++++++++++++++++++++++++++++++++ 1 file changed, 269 insertions(+) diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 716d851655..405fdeb831 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4680,3 +4680,272 @@ swatch [Registration] [રજિસ્ટ્રેશન] Repeat Objects પુનરાવર્તિત ઑબ્જેક્ટ્સ @msg `{path}` must be one of {_1}, not {got} `{path}` એ {_1}માંથી એક હોવું જોઈએ, {got} નહીં Path Length પાથની લંબાઈ +# Built-in library names: graphic styles, swatches, gradients, patterns and symbols. + Boss Alert બૉસ ચેતવણી + Brushed Metal બ્રશ કરેલી ધાતુ + Bulge ઉપસાવ + Burn Aura બળતી આભા + Chrome Rim ક્રોમ કિનાર + Coin Shine સિક્કાની ચમક + Crosshatch ક્રોસહેચ + Damage Flash નુકસાન ઝબકારો + Darken Veil ઘેરો પડદો + Dashed Border ડેશવાળી કિનારી + Dotted Border ટપકાંવાળી કિનારી + Double Rule બેવડી રેખા + Echo પડઘો + Ember અંગારો + Feathered ફેધર કરેલું + Flag Wave ધ્વજ લહેર + Freeze Edge થીજેલી કિનારી + Ghosted ઝાંખું + Glossy ચળકતું + Glow Orb ઝળહળતો ગોળો + Hard Shadow તીક્ષ્ણ પડછાયો + Haze ધુમ્મસ + Health Fill હેલ્થ ભરણ + Highlighter હાઇલાઇટર + Inner Light આંતરિક પ્રકાશ + Inset Keyline અંદરની કીલાઇન + Lifted Card ઊંચકેલું કાર્ડ + Mana Glow મના ઝળહળાટ + Multiply Tint ગુણાકાર ટિન્ટ + Neon Tube નિયોન ટ્યુબ + Offset Keyline ઑફસેટ કીલાઇન + Outside Stroke બહારનો સ્ટ્રોક + Overlay Glaze ઓવરલે ગ્લેઝ + Pearl મોતી + Pill Badge ગોળી બેજ + Pointer પોઇન્ટર + Poison Tint ઝેરી ટિન્ટ + Puffy ફૂલેલું + Quest Outline ક્વેસ્ટ રૂપરેખા + Round Badge ગોળ બેજ + Screen Light સ્ક્રીન પ્રકાશ + Scribble Fill લીટીવાળું ભરણ + Sea Glass દરિયાઈ કાચ + Shield Buff ઢાલ બફ + Sketchy Line સ્કેચ જેવી રેખા + Soft Light Wash સૉફ્ટ લાઇટ વૉશ + Soft Shadow નરમ પડછાયો + Spiral Copies સર્પાકાર નકલો + Spotlight સ્પોટલાઇટ + Starburst તારા વિસ્ફોટ + Stealth Fade છૂપું ઝાંખું થવું + Stun Pulse સ્ટન પલ્સ + Sunset Band સૂર્યાસ્ત પટ્ટો + Triple Rule ત્રિવિધ રેખા + Twisted વળ ચડાવેલું + Two Tone બે રંગી + Wavy Edge લહેરિયાં કિનારી + Wobble ડગમગ + Zig Zag Edge ઝિગઝૅગ કિનારી + Amber Corona એમ્બર કોરોના + Amber Glow એમ્બર ઝળહળાટ + Amber to Lime એમ્બરથી લાઇમ + Analogous Coral સમીપવર્તી કોરલ + Analogous Teal સમીપવર્તી ટીલ + Aurora Foil અરોરા ફોઇલ + Azure Glow આસમાની ઝળહળાટ + Azure to Violet આસમાનીથી વાયોલેટ + Bloom મહોર + Blue Glow વાદળી ઝળહળાટ + Blue to Magenta વાદળીથી મેજેન્ટા + Brass પિત્તળ + Bronze કાંસું + Charcoal ચારકોલ + Checkerboard ચેકરબોર્ડ + Chevron Pulse શેવરોન પલ્સ + Chrome ક્રોમ + Clay માટી + Clay to Teal માટીથી ટીલ + Coarse Grit બરછટ કણ + Complementary Coral પૂરક કોરલ + Complementary Teal પૂરક ટીલ + Cool Gray ઠંડો ગ્રે + Cool Grays ઠંડા ગ્રે + Copper કોપર + Coral and Navy કોરલ અને નેવી + Crosses ચોકડીઓ + Cyan Glow સાયન ઝળહળાટ + Cyan to Blue સાયનથી વાદળી + Dark Grays ઘેરા ગ્રે + Dawn પરોઢ + Deep ઘેરો + Deep Amber ઘેરો એમ્બર + Deep Azure ઘેરો આસમાની + Deep Blue ઘેરો વાદળી + Deep Cyan ઘેરો સાયન + Deep Green ઘેરો લીલો + Deep Lime ઘેરો લાઇમ + Deep Magenta ઘેરો મેજેન્ટા + Deep Orange ઘેરો નારંગી + Deep Red ઘેરો લાલ + Deep Teal ઘેરો ટીલ + Deep Violet ઘેરો વાયોલેટ + Deep Yellow ઘેરો પીળો + Dense Flecks ગાઢ છાંટા + Dew ઝાકળ + Diagonal Stripes ત્રાંસા પટ્ટા + Diamonds હીરા + Driftwood તરતું લાકડું + Dusk સંધ્યા + Fade to Transparent પારદર્શક સુધી ઝાંખું + Fern ફર્ન + Fine Dots ઝીણાં ટપકાં + Forest and Rose જંગલ અને રોઝ + Frost Spectrum હિમ સ્પેક્ટ્રમ + Gold સોનું + Golden સોનેરી + Green Glow લીલો ઝળહળાટ + Green to Cyan લીલાથી સાયન + Greige ગ્રેઝ + Gunmetal ગનમેટલ + Honey મધ + Horizontal Stripes આડા પટ્ટા + Indigo and Peach ઈન્ડિગો અને પીચ + Ink Wash શાહી વૉશ + Interference Rings વ્યતિકરણ વલયો + Iris Sheen આઇરિસ ચમક + Ivory હાથીદાંત + Lagoon લગૂન + Lavender લવંડર + Lichen લાઇકેન + Light Grays આછા ગ્રે + Lime Glow લાઇમ ઝળહળાટ + Lime to Teal લાઇમથી ટીલ + Linen લિનન + Magenta Glow મેજેન્ટા ઝળહળાટ + Magenta to Orange મેજેન્ટાથી નારંગી + Mint Halo ફુદીના પ્રભામંડળ + Mist ધૂંધ + Moonstone Shift ચંદ્રમણિ ઝલક + Moss શેવાળ + Neutral તટસ્થ + Neutrals તટસ્થ રંગો + Night રાત + Noon બપોર + Oat ઓટ + Ochre ગેરુ + Offset Rings ઑફસેટ વલયો + Olive ઓલિવ + Opal Ribbon ઓપલ રિબન + Orange Glow નારંગી ઝળહળાટ + Orange to Yellow નારંગીથી પીળો + Overcast વાદળછાયું + Pastel પેસ્ટલ + Pastel Amber પેસ્ટલ એમ્બર + Pastel Azure પેસ્ટલ આસમાની + Pastel Blue પેસ્ટલ વાદળી + Pastel Cyan પેસ્ટલ સાયન + Pastel Green પેસ્ટલ લીલો + Pastel Lime પેસ્ટલ લાઇમ + Pastel Magenta પેસ્ટલ મેજેન્ટા + Pastel Orange પેસ્ટલ નારંગી + Pastel Orbit પેસ્ટલ ભ્રમણકક્ષા + Pastel Red પેસ્ટલ લાલ + Pastel Teal પેસ્ટલ ટીલ + Pastel Violet પેસ્ટલ વાયોલેટ + Pastel Yellow પેસ્ટલ પીળો + Pearl Flash મોતી ઝબકાર + Pentagram Coral પેન્ટાગ્રામ કોરલ + Pentagram Teal પેન્ટાગ્રામ ટીલ + Petal પાંખડી + Pewter પ્યુટર + Pinched Stripes દબાયેલા પટ્ટા + Platinum પ્લેટિનમ + Plum and Lime પ્લમ અને લાઇમ + Plum to Olive પ્લમથી ઓલિવ + Polar Glint ધ્રુવીય ચમક + Polka Dots પોલ્કા ટપકાં + Pollen પરાગ + Prism Veil પ્રિઝમ પડદો + Radiating Lenses પ્રસરતા લેન્સ + Red Glow લાલ ઝળહળાટ + Red to Amber લાલથી એમ્બર + Ripple Lines લહેર રેખાઓ + Rose Gold રોઝ ગોલ્ડ + Rose Quartz Gleam રોઝ ક્વાર્ટ્ઝ ચમક + Rosy ગુલાબી + Sand રેતી + Scratches ઉઝરડા + Seafoam દરિયાઈ ફીણ + Silver ચાંદી + Silver Tide ચાંદી ભરતી + Sine Bands સાઇન પટ્ટા + Slate સ્લેટ + Smoke ધુમાડો + Soft Amber સૉફ્ટ એમ્બર + Soft Azure સૉફ્ટ આસમાની + Soft Blue સૉફ્ટ વાદળી + Soft Cyan સૉફ્ટ સાયન + Soft Green સૉફ્ટ લીલો + Soft Lime સૉફ્ટ લાઇમ + Soft Magenta સૉફ્ટ મેજેન્ટા + Soft Orange સૉફ્ટ નારંગી + Soft Red સૉફ્ટ લાલ + Soft Spectrum સૉફ્ટ સ્પેક્ટ્રમ + Soft Teal સૉફ્ટ ટીલ + Soft Violet સૉફ્ટ વાયોલેટ + Soft Yellow સૉફ્ટ પીળો + Sparse Flecks છૂટાછવાયા છાંટા + Speckle ટપકીઓ + Spectrum સ્પેક્ટ્રમ + Split Complementary Coral વિભાજિત પૂરક કોરલ + Split Complementary Teal વિભાજિત પૂરક ટીલ + Stipple બિંદુચિત્ર + Stone પથ્થર + Sunset સૂર્યાસ્ત + Taupe ટૉપ + Teal Glow ટીલ ઝળહળાટ + Teal and Gold ટીલ અને સોનું + Teal to Azure ટીલથી આસમાની + Terracotta ટેરાકોટા + Tetrad Coral ચતુષ્ક કોરલ + Tetrad Teal ચતુષ્ક ટીલ + Tide ભરતી + Triad Coral ત્રિક કોરલ + Triad Teal ત્રિક ટીલ + Umber અંબર માટી + Vertical Stripes ઊભા પટ્ટા + Vignette વિગ્નેટ + Violet Edge વાયોલેટ કિનારી + Violet Glow વાયોલેટ ઝળહળાટ + Violet to Red વાયોલેટથી લાલ + Vivid તેજસ્વી + Vivid Amber તેજસ્વી એમ્બર + Vivid Azure તેજસ્વી આસમાની + Vivid Blue તેજસ્વી વાદળી + Vivid Cyan તેજસ્વી સાયન + Vivid Green તેજસ્વી લીલો + Vivid Lime તેજસ્વી લાઇમ + Vivid Magenta તેજસ્વી મેજેન્ટા + Vivid Orange તેજસ્વી નારંગી + Vivid Red તેજસ્વી લાલ + Vivid Teal તેજસ્વી ટીલ + Vivid Violet તેજસ્વી વાયોલેટ + Vivid Yellow તેજસ્વી પીળો + Warm Gray હૂંફાળો ગ્રે + Warm Grays હૂંફાળા ગ્રે + Warped Checks વળેલાં ચેક + White Fade સફેદ ઝાંખપ + White to Black સફેદથી કાળો + Yellow Glow પીળો ઝળહળાટ + Yellow to Green પીળાથી લીલો + Arrow તીર + Bar પટ્ટી + Burst વિસ્ફોટ + Button બટન + Checkpoint ચેકપોઇન્ટ + Crosshair ક્રોસહેર + Flag ધ્વજ + Gem રત્ન + Hexagon ષટ્કોણ + Key ચાવી + Panel પેનલ + Pin પિન + Potion ઔષધ + Rounded Square ગોળ ખૂણાવાળો ચોરસ + Shield ઢાલ + Sword તલવાર + Triangle ત્રિકોણ From 7292350010aeb0c297af3efd07da648f40b981e3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 07:45:12 -0800 Subject: [PATCH 010/158] Color Wheel: Show Color Vision Preview shows the color through four color vision simulations The Color Wheel panel's menu gains Show Color Vision Preview, which adds a row of four chips under the wheel or the box: the current color through the protanopia, deuteranopia and tritanopia simulations that View > Proof Setup uses (Cms::proof_srgb), and an achromatopsia chip that shows the gray with the color's CIE L*, a rule of VectorCraft's own. Each chip takes the keyboard focus, reports its name and its hex value to screen readers and shows both in its tooltip. A click or a key on a chip does not apply its color. With no solid color the chips are empty and keep their names. ui.colorWheel takes a vision key next to view and channel and returns all three. A value that is not true, false or null is an error and changes nothing. The setting is kept with the preferences, and a saved value the build does not read falls back to the default without losing the other settings. New strings have rows in the complete catalogs. Docs: docs/mcp.md, docs/control-protocol.md, docs/target-app-parity.md. --- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/i18n/bg.tsv | 5 + crates/ui-egui/src/i18n/bs.tsv | 5 + crates/ui-egui/src/i18n/ca.tsv | 5 + crates/ui-egui/src/i18n/cs.tsv | 5 + crates/ui-egui/src/i18n/da.tsv | 5 + crates/ui-egui/src/i18n/de.tsv | 5 + crates/ui-egui/src/i18n/el.tsv | 5 + crates/ui-egui/src/i18n/es.tsv | 5 + crates/ui-egui/src/i18n/fi.tsv | 5 + crates/ui-egui/src/i18n/fr.tsv | 5 + crates/ui-egui/src/i18n/gu.tsv | 5 + crates/ui-egui/src/i18n/hi.tsv | 5 + crates/ui-egui/src/i18n/hu.tsv | 5 + crates/ui-egui/src/i18n/id.tsv | 5 + crates/ui-egui/src/i18n/it.tsv | 5 + crates/ui-egui/src/i18n/ja.tsv | 5 + crates/ui-egui/src/i18n/ka.tsv | 5 + crates/ui-egui/src/i18n/ko.tsv | 5 + crates/ui-egui/src/i18n/nl.tsv | 5 + crates/ui-egui/src/i18n/pl.tsv | 5 + crates/ui-egui/src/i18n/pt-br.tsv | 5 + crates/ui-egui/src/i18n/ru.tsv | 5 + crates/ui-egui/src/i18n/sv.tsv | 5 + crates/ui-egui/src/i18n/tr.tsv | 5 + crates/ui-egui/src/i18n/uk.tsv | 5 + crates/ui-egui/src/i18n/vi.tsv | 5 + crates/ui-egui/src/i18n/zh-hans.tsv | 5 + crates/ui-egui/src/i18n/zh-hant.tsv | 5 + crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/panels.rs | 2 + crates/ui-egui/src/panels/color_wheel.rs | 97 ++++++- .../src/panels/tests_color_wheel_box.rs | 26 +- .../src/panels/tests_color_wheel_vision.rs | 258 ++++++++++++++++++ crates/ui-egui/src/state.rs | 3 +- docs/control-protocol.md | 6 +- docs/mcp.md | 6 + docs/target-app-parity.md | 1 + 38 files changed, 519 insertions(+), 24 deletions(-) create mode 100644 crates/ui-egui/src/panels/tests_color_wheel_vision.rs diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 943faa4782..0af5289bd9 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -1324,7 +1324,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.colorWheel", "Color Wheel Options", "", - "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, and pick the box's channel, as Box Channel does: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); keys left out keep their values, params that are not an object, another key or a value off the list are an error and change nothing, both are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel}", + "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, vision?: bool} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, and pick the box's channel, as Box Channel does: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); vision shows Show Color Vision Preview's row under the wheel or the box, four chips with the current color as simulated for protanopia, deuteranopia and tritanopia (the simulations of view.proofSetup's protanopia, deuteranopia and tritanopia targets) and for achromatopsia (the gray with the color's CIE L*), each named with its hex value in its tooltip and to screen readers, and taking the keyboard focus; a click or a key on a chip does not apply its color; keys left out or null keep their values ({} reads them), params that are not an object, another key or a value off the list are an error and change nothing, the settings are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel, vision}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 348ac7b881..7017ac7bd3 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5810,6 +5810,11 @@ theme Appearance Външен вид The active document changed while the screen color sampler was open Активният документ се промени, докато взимането на цвят от екрана беше отворено This system has no screen color sampler Тази система няма инструмент за взимане на цвят от екрана Color blindness – Tritanopia-type Цветна слепота – тип тританопия + Show Color Vision Preview Показване на преглед на цветовото зрение + Protanopia Протанопия + Deuteranopia Девтеранопия + Tritanopia Тританопия + Achromatopsia Ахроматопсия Panels Except Tools and Control Панели без инструменти и контрол # Type › Reset Tracking and Kerning diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 3b1a9e001c..a1af907e0c 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -592,6 +592,11 @@ Color blindness – Protanopia-type Daltonizam – tip protanopije Color blindness – Deuteranopia-type Daltonizam – tip deuteranopije Color blindness – Tritanopia-type Daltonizam – tip tritanopije + Show Color Vision Preview Prikaži pregled vida boja + Protanopia Protanopija + Deuteranopia Deuteranopija + Tritanopia Tritanopija + Achromatopsia Ahromatopsija Customize… Prilagodi… Proof Colors Probne boje Zoom In Uvećaj diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 488b46c4f5..de7451339b 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -779,6 +779,11 @@ antiAlias Sharp Nítid Color blindness – Deuteranopia-type Daltonisme – tipus deuteranòpsia Color blindness – Protanopia-type Daltonisme – tipus protanòpsia Color blindness – Tritanopia-type Daltonisme – tipus tritanòpsia + Show Color Vision Preview Mostra la previsualització de la visió del color + Protanopia Protanòpsia + Deuteranopia Deuteranòpsia + Tritanopia Tritanòpsia + Achromatopsia Acromatòpsia Color Burn Subexposa el color Color conversion: Conversió de color: Color Dodge Sobreexposició de color diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 6a57e90e37..32402c3583 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -605,6 +605,11 @@ Color blindness – Protanopia-type Barvoslepost – protanopie Color blindness – Deuteranopia-type Barvoslepost – deuteranopie Color blindness – Tritanopia-type Barvoslepost – tritanopie + Show Color Vision Preview Zobrazit náhled barevného vidění + Protanopia Protanopie + Deuteranopia Deuteranopie + Tritanopia Tritanopie + Achromatopsia Achromatopsie Customize… Vlastní… Proof Colors Barvy nátisku Zoom In Zvětšit diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 54a79e38e5..bc5550c8d5 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5565,6 +5565,11 @@ mark-style Japanese Japansk The active document changed while the screen color sampler was open Det aktive dokument ændrede sig, mens skærmfarvesampleren var åben This system has no screen color sampler Dette system har ingen skærmfarvesampler Color blindness – Tritanopia-type Farveblindhed – tritanopitype + Show Color Vision Preview Vis eksempel på farvesyn + Protanopia Protanopi + Deuteranopia Deuteranopi + Tritanopia Tritanopi + Achromatopsia Akromatopsi Panels Except Tools and Control Paneler undtagen værktøjer og kontrol Reset Tracking and Kerning Nulstil sporing og kerning Reset Horizontal Scale Nulstil vandret skalering diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index ab77cb0dd7..aa1d9e9534 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -514,6 +514,11 @@ font-technology Variable Variabel Color blindness – Deuteranopia-type Farbenblindheit – Deuteranopie Color blindness – Protanopia-type Farbenblindheit – Protanopie Color blindness – Tritanopia-type Farbenblindheit – Tritanopie + Show Color Vision Preview Farbsehvorschau einblenden + Protanopia Protanopie + Deuteranopia Deuteranopie + Tritanopia Tritanopie + Achromatopsia Achromatopsie Color Burn Farbig nachbelichten Color conversion: Farbkonvertierung: Color Dodge Farbig abwedeln diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index a1a203a257..fee3b3b5f4 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5998,6 +5998,11 @@ effect Points Σημεία Close the circular ends of open profiles. Partial sweeps keep their cut sides open. Κλείσιμο των κυκλικών άκρων των ανοιχτών προφίλ. Οι μερικές περιστροφές κρατούν ανοιχτές τις πλευρές τομής τους. Color Panel Options Επιλογές πίνακα χρώματος Color blindness – Tritanopia-type Αχρωματοψία – τύπου τριτανοπίας + Show Color Vision Preview Εμφάνιση προεπισκόπησης χρωματικής όρασης + Protanopia Πρωτανοπία + Deuteranopia Δευτερανοπία + Tritanopia Τριτανοπία + Achromatopsia Ολική αχρωματοψία Create Dimension Δημιουργία διάστασης Darkness Σκουρότητα Destination Folder: Φάκελος προορισμού: diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 45fd0d8235..60511775ec 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -536,6 +536,11 @@ font-technology Variable Variables Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopía Color blindness – Protanopia-type Daltonismo – tipo protanopía Color blindness – Tritanopia-type Daltonismo – tipo tritanopía + Show Color Vision Preview Mostrar vista previa de visión del color + Protanopia Protanopía + Deuteranopia Deuteranopía + Tritanopia Tritanopía + Achromatopsia Acromatopsia Color Burn Subexponer color Color conversion: Conversión de color: Color Dodge Sobreexponer color diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index f6db5b8ee1..83e137334a 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -6009,6 +6009,11 @@ mark-style Japanese Japanilainen Close the circular ends of open profiles. Partial sweeps keep their cut sides open. Sulje avointen profiilien pyöreät päät. Osittaiset pyöräytykset jättävät leikkauspintansa auki. Color Panel Options Väri-paneelin asetukset Color blindness – Tritanopia-type Värisokeus – tritanopia + Show Color Vision Preview Näytä värinäön esikatselu + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Akromatopsia Create Dimension Luo mitta Darkness Tummuus Destination Folder: Kohdekansio: diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index ae0bf3b436..88a8ae8af6 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -537,6 +537,11 @@ font-technology Variable Variables Color blindness – Deuteranopia-type Daltonisme – type deutéranopie Color blindness – Protanopia-type Daltonisme – type protanopie Color blindness – Tritanopia-type Daltonisme – type tritanopie + Show Color Vision Preview Afficher un aperçu de la vision des couleurs + Protanopia Protanopie + Deuteranopia Deutéranopie + Tritanopia Tritanopie + Achromatopsia Achromatopsie Color Burn Densité couleur + Color conversion: Conversion des couleurs : Color Dodge Densité couleur - diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index f38612601c..07dfda4cf0 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -643,6 +643,11 @@ Color blindness – Deuteranopia-type રંગ અંધત્વ – ડ્યુટેરેનોપિયા પ્રકાર Color blindness – Protanopia-type રંગ અંધત્વ – પ્રોટેનોપિયા પ્રકાર Color blindness – Tritanopia-type રંગ અંધત્વ – ટ્રિટેનોપિયા પ્રકાર + Show Color Vision Preview રંગ દ્રષ્ટિ પૂર્વાવલોકન બતાવો + Protanopia પ્રોટેનોપિયા + Deuteranopia ડ્યુટેરેનોપિયા + Tritanopia ટ્રિટેનોપિયા + Achromatopsia એક્રોમેટોપ્સિયા Color conversion: રંગ રૂપાંતર: Color field રંગ ક્ષેત્ર Color images રંગીન ઇમેજ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 624671acca..e2af7c75b6 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -901,6 +901,11 @@ antiAlias Sharp शार्प Color blindness – Deuteranopia-type कलर ब्लाइंडनेस – ड्यूटेरानोपिया प्रकार Color blindness – Protanopia-type रंग अंधापन - प्रोटानोपिया प्रकार Color blindness – Tritanopia-type कलर ब्लाइंडनेस – ट्राइटेनोपिया प्रकार + Show Color Vision Preview कलर विज़न प्रीव्यू दिखाएँ + Protanopia प्रोटानोपिया + Deuteranopia ड्यूटेरानोपिया + Tritanopia ट्राइटेनोपिया + Achromatopsia एक्रोमैटोप्सिया Color Burn कलर बर्न Color conversion: रंग रूपांतरण: Color Dodge कलर डॉज diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 3e8a200697..1a80d791b4 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -709,6 +709,11 @@ font-technology Variable Változó Color blindness – Deuteranopia-type Színvakság – deuteranópia Color blindness – Protanopia-type Színvakság – protanópia Color blindness – Tritanopia-type Színvakság – tritanópia + Show Color Vision Preview Színlátás-előnézet megjelenítése + Protanopia Protanópia + Deuteranopia Deuteranópia + Tritanopia Tritanópia + Achromatopsia Akromatopszia Color Burn Színsötétítés Color conversion: Színátalakítás: Color Dodge Színvilágosítás diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 2107a23bf0..d2b04685e3 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5565,6 +5565,11 @@ mark-style Japanese Jepang The active document changed while the screen color sampler was open Dokumen aktif berubah saat pengambil warna layar terbuka This system has no screen color sampler Sistem ini tidak memiliki pengambil warna layar Color blindness – Tritanopia-type Buta warna – tipe Tritanopia + Show Color Vision Preview Tampilkan pratinjau penglihatan warna + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Akromatopsia Panels Except Tools and Control Semua panel kecuali Alat dan Kontrol Reset Tracking and Kerning Atur ulang tracking dan kerning Reset Horizontal Scale Atur ulang skala horizontal diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index f75dc629db..53449c5606 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -536,6 +536,11 @@ font-technology Variable Variabili Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopia Color blindness – Protanopia-type Daltonismo – tipo protanopia Color blindness – Tritanopia-type Daltonismo – tipo tritanopia + Show Color Vision Preview Mostra anteprima della visione dei colori + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Acromatopsia Color Burn Brucia colore Color conversion: Conversione colore: Color Dodge Scherma colore diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 67072cc8b3..17b0e35d0e 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -640,6 +640,11 @@ digits Malayalam マラヤーラム数字 Color blindness – Protanopia-type P 型(1 型)色覚 Color blindness – Deuteranopia-type D 型(2 型)色覚 Color blindness – Tritanopia-type T 型(3 型)色覚 + Show Color Vision Preview 色覚のプレビューを表示 + Protanopia P 型色覚 + Deuteranopia D 型色覚 + Tritanopia T 型色覚 + Achromatopsia 1 色覚 Customize… カスタマイズ… Proof Colors 色の校正 Zoom In ズームイン diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index c8513b84c3..122e501b09 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5686,6 +5686,11 @@ imageTrace Outline კონტური @plural {n} part of the file wasn't read|{n} parts of the file weren't read ფაილის წაუკითხავი ნაწილები: {n}|ფაილის წაუკითხავი ნაწილები: {n} # Upstream sync 2026-10-16: legacy .ai export, screen color sampler, Hidden Objects, Dimension tool. Color blindness – Tritanopia-type დალტონიზმი – ტრიტანოპიის ტიპი + Show Color Vision Preview ფერთა აღქმის გადახედვის ჩვენება + Protanopia პროტანოპია + Deuteranopia დეიტერანოპია + Tritanopia ტრიტანოპია + Achromatopsia აქრომატოფსია Darkness სიმუქე Sample Color from Screen ფერის აღება ეკრანიდან This system has no screen color sampler ამ სისტემას ეკრანიდან ფერის აღების საშუალება არ აქვს diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 8aa0bc41ca..91256df9eb 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -633,6 +633,11 @@ digits Malayalam 말라얄람어 Color blindness – Protanopia-type 색맹 – 적색맹 유형 Color blindness – Deuteranopia-type 색맹 – 녹색맹 유형 Color blindness – Tritanopia-type 색맹 – 청색맹 유형 + Show Color Vision Preview 색각 미리 보기 표시 + Protanopia 적색맹 + Deuteranopia 녹색맹 + Tritanopia 청색맹 + Achromatopsia 전색맹 Customize… 사용자 지정… Proof Colors 교정 색상 Zoom In 확대 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index de5b7a3cf6..7ac537614a 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -6146,6 +6146,11 @@ mark-style Japanese Japans The active document changed while the screen color sampler was open Het actieve document is gewijzigd terwijl de schermkleurkiezer open was This system has no screen color sampler Dit systeem heeft geen schermkleurkiezer Color blindness – Tritanopia-type Kleurenblindheid – type tritanopie + Show Color Vision Preview Voorvertoning van kleurwaarneming tonen + Protanopia Protanopie + Deuteranopia Deuteranopie + Tritanopia Tritanopie + Achromatopsia Achromatopsie Panels Except Tools and Control Alle panelen behalve Gereedschap en Bediening Reset Tracking and Kerning Tracking en kerning herstellen Reset Horizontal Scale Horizontale schaal herstellen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index f9bdc664f1..b7748b9579 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -561,6 +561,11 @@ Color blindness – Protanopia-type Daltonizm – typu protanopia Color blindness – Deuteranopia-type Daltonizm – typu deuteranopia Color blindness – Tritanopia-type Daltonizm – typu tritanopia + Show Color Vision Preview Pokaż podgląd widzenia barw + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Achromatopsja Customize… Dostosuj… Proof Colors Próba kolorów Zoom In Powiększ diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 07cd9c6fd6..29551e9855 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -526,6 +526,11 @@ antiAlias Sharp Nítido Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopia Color blindness – Protanopia-type Daltonismo – tipo protanopia Color blindness – Tritanopia-type Daltonismo – tipo tritanopia + Show Color Vision Preview Mostrar Visualização da Visão de Cores + Protanopia Protanopia + Deuteranopia Deuteranopia + Tritanopia Tritanopia + Achromatopsia Acromatopsia Color conversion: Conversão de cor: Color images Imagens coloridas Color: Cor: diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index fcf44192cd..d5fc09295a 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -534,6 +534,11 @@ font-technology Variable Вариативные Color blindness – Deuteranopia-type Дальтонизм — дейтеранопия Color blindness – Protanopia-type Дальтонизм — протанопия Color blindness – Tritanopia-type Дальтонизм — тританопия + Show Color Vision Preview Показать имитацию цветового зрения + Protanopia Протанопия + Deuteranopia Дейтеранопия + Tritanopia Тританопия + Achromatopsia Ахроматопсия Color Burn Затемнение основы Color conversion: Преобразование цвета: Color Dodge Осветление основы diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index d68878734e..0f0bb4a01a 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5999,6 +5999,11 @@ theme Appearance Utseende Close the circular ends of open profiles. Partial sweeps keep their cut sides open. Stäng de cirkulära ändarna på öppna profiler. Partiella svep behåller sina snittsidor öppna. Color Panel Options Alternativ för panelen Färg Color blindness – Tritanopia-type Färgblindhet – tritanopi + Show Color Vision Preview Visa förhandsvisning av färgseende + Protanopia Protanopi + Deuteranopia Deuteranopi + Tritanopia Tritanopi + Achromatopsia Akromatopsi Create Dimension Skapa mått Darkness Mörkhet Destination Folder: Målmapp: diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index b3c88cc563..ca333d6ac5 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -518,6 +518,11 @@ font-technology Variable Değişken Color blindness – Deuteranopia-type Renk körlüğü – Döteranopi tipi Color blindness – Protanopia-type Renk körlüğü – Protanopi tipi Color blindness – Tritanopia-type Renk körlüğü – Tritanopia tipi + Show Color Vision Preview Renk Görme Önizlemesini Göster + Protanopia Protanopi + Deuteranopia Döteranopi + Tritanopia Tritanopi + Achromatopsia Akromatopsi Color Burn Renkli Yanık Color conversion: Renk dönüşümü: Color Dodge Renk Soldurma diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 0ab6257df4..1f906688ae 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -530,6 +530,11 @@ font-technology Variable Варіативні Color blindness – Deuteranopia-type Дальтонізм - дейтеранопія Color blindness – Protanopia-type Дальтонізм - протанопія Color blindness – Tritanopia-type Дальтонізм - тританопія + Show Color Vision Preview Показати імітацію колірного зору + Protanopia Протанопія + Deuteranopia Дейтеранопія + Tritanopia Тританопія + Achromatopsia Ахроматопсія Color Burn Затемнення основи Color conversion: Перетворення кольору: Color Dodge Освітлення основи diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 80cc4951cf..695e003eae 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -621,6 +621,11 @@ font-technology Variable Biến thiên Color blindness – Deuteranopia-type Mù màu – loại Deuteranopia Color blindness – Protanopia-type Mù màu – loại Protanopia Color blindness – Tritanopia-type Mù màu – loại Tritanopia + Show Color Vision Preview Hiện xem trước thị giác màu + Protanopia Mù màu đỏ + Deuteranopia Mù màu lục + Tritanopia Mù màu lam + Achromatopsia Mù màu toàn phần Color Burn Đốt màu Color conversion: Chuyển đổi màu: Color Dodge Tránh màu diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 9561a51baf..0526f6e6dd 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -482,6 +482,11 @@ antiAlias Sharp 锐利 Color blindness – Deuteranopia-type 色盲 – 绿色盲型 Color blindness – Protanopia-type 色盲 – 红色盲型 Color blindness – Tritanopia-type 色盲 – 蓝色盲型 + Show Color Vision Preview 显示色觉预览 + Protanopia 红色盲 + Deuteranopia 绿色盲 + Tritanopia 蓝色盲 + Achromatopsia 全色盲 Color Burn 颜色加深 Color conversion: 色彩转换: Color Dodge 颜色减淡 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 7489e3d4d9..77ee5a9c9f 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -499,6 +499,11 @@ font-technology Variable 可變 Color blindness – Deuteranopia-type 色盲 – 綠色盲型 Color blindness – Protanopia-type 色盲 – 紅色盲型 Color blindness – Tritanopia-type 色盲 – 藍色盲型 + Show Color Vision Preview 顯示色覺預覽 + Protanopia 紅色盲 + Deuteranopia 綠色盲 + Tritanopia 藍色盲 + Achromatopsia 全色盲 Color Burn 加深顏色 Color conversion: 色彩轉換: Color Dodge 加亮顏色 diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index d36ecae60f..d13a83c1f3 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1325,7 +1325,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.colorWheel", "Color Wheel Options", "", - "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, and pick the box's channel, as Box Channel does: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); keys left out keep their values, params that are not an object, another key or a value off the list are an error and change nothing, both are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel}", + "{view?: wheel|box, channel?: hue|saturation|brightness|red|green|blue, vision?: bool} show the Color Wheel panel's wheel or its box, as the panel menu's Wheel View and Box View do, and pick the box's channel, as Box Channel does: the box is a color field with the channel's strip at its right, and the field shows the other two components (hue: saturation across and brightness up; saturation: hue across and brightness up; brightness: hue across and saturation up; red: blue across and green up; green: blue across and red up; blue: red across and green up); vision shows Show Color Vision Preview's row under the wheel or the box, four chips with the current color as simulated for protanopia, deuteranopia and tritanopia (the simulations of view.proofSetup's protanopia, deuteranopia and tritanopia targets) and for achromatopsia (the gray with the color's CIE L*), each named with its hex value in its tooltip and to screen readers, and taking the keyboard focus; a click or a key on a chip does not apply its color; keys left out or null keep their values ({} reads them), params that are not an object, another key or a value off the list are an error and change nothing, the settings are kept with the preferences, and the command does not open the panel (window.panel {panel: \"colorWheel\"} does) (ui.inspect: ui.color_wheel) → {view, channel, vision}", ), ( "ui.savePdfDialog", diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index d12c89d2af..34a1ad2748 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -698,6 +698,8 @@ mod tests_color_wheel; #[cfg(test)] mod tests_color_wheel_box; #[cfg(test)] +mod tests_color_wheel_vision; +#[cfg(test)] mod tests_constrain; #[cfg(test)] mod tests_css_properties; diff --git a/crates/ui-egui/src/panels/color_wheel.rs b/crates/ui-egui/src/panels/color_wheel.rs index 31522578e5..b66f9c8e38 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -11,11 +11,16 @@ //! channel strip at its right, for the channel picked under Box Channel (Hue, Saturation, //! Brightness, Red, Green or Blue). The field shows the other two components on the Color //! Picker's axes. The view and the channel are kept with the preferences (`ui.colorWheel`). +//! +//! Panel menu › Show Color Vision Preview adds a row under the wheel or the box with the color as +//! simulated for protanopia, deuteranopia and tritanopia, through the simulations View › Proof +//! Setup uses, and for achromatopsia as the gray with the color's CIE L*. The chips only show the +//! simulation. -use egui::{Ui, UiBuilder, vec2}; +use egui::{Rect, Sense, Stroke, StrokeKind, Ui, UiBuilder, vec2}; use serde::{Deserialize, Serialize}; use serde_json::{Value, json}; -use vectorcraft_color::cms::{self, Cms}; +use vectorcraft_color::cms::{self, Cms, ProofSetup, ProofTarget}; use vectorcraft_color::{Color, Paint, hsb_to_rgb, rgb_to_hsb}; use vectorcraft_doc::{ColorMode, NodeId}; @@ -23,6 +28,7 @@ use super::color::{Target, apply, wheel_target}; use super::{pstate, set_pstate}; use crate::VectorcraftApp; use crate::dialogs::color_picker::Channel; +use crate::theme::Tokens; use crate::widgets::{self, FieldAxis, Live, SliderValue, menu_item}; pub const ID: &str = "colorWheel"; @@ -67,6 +73,13 @@ pub struct Settings { pub view: View, #[serde(serialize_with = "serialize_channel", deserialize_with = "deserialize_channel")] pub channel: Channel, + /// Show Color Vision Preview: the row of simulated colors under the wheel or the box. + #[serde(deserialize_with = "deserialize_flag")] + pub vision: bool, +} + +fn deserialize_flag<'de, D: serde::Deserializer<'de>>(d: D) -> Result { + Ok(::deserialize(d)?.as_bool().unwrap_or_default()) } fn deserialize_view<'de, D: serde::Deserializer<'de>>(d: D) -> Result { @@ -90,11 +103,11 @@ pub fn deserialize_settings<'de, D: serde::Deserializer<'de>>(d: D) -> Result Result { - const KEYS: [&str; 2] = ["view", "channel"]; + const KEYS: [&str; 3] = ["view", "channel", "vision"]; match p { Value::Null => {} Value::Object(o) => { @@ -113,11 +126,15 @@ pub(crate) fn command(app: &mut VectorcraftApp, p: &Value) -> Result {} Some(v) => set.channel = v.as_str().and_then(Channel::parse).ok_or("`channel` must be hue, saturation, brightness, red, green or blue")?, } + if let Some(on) = crate::menus::opt_bool(p, "vision")? { + set.vision = on; + } app.ui.color_wheel = set; Ok(json!(app.ui.color_wheel)) } -/// The panel menu: Wheel View and Box View, and Box Channel while the box shows. +/// The panel menu: Wheel View and Box View, Box Channel while the box shows, and Show Color Vision +/// Preview. pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { let set = app.ui.color_wheel.clone(); for (label, view) in [(tl!("Wheel View"), View::Wheel), (tl!("Box View"), View::Box)] { @@ -134,6 +151,10 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { } }); }); + ui.separator(); + if menu_item(ui, tl!("Show Color Vision Preview"), true, set.vision) { + command(app, &json!({ "vision": !set.vision })).ok(); + } } /// The display values of HSB `hsb` in `ch`'s space, from 0 to 1: hue, saturation and brightness, @@ -207,6 +228,64 @@ fn show_box(ui: &mut Ui, ch: Channel, hsb: [f32; 3], marked: bool, size: f32) -> /// Panel state: the HSB picked last, its [`Owner`] and the display sRGB of the color it stored. const MEMORY: &str = "color-wheel-hsb"; +/// The height of the color vision chips and the space between them. +const VISION_CHIP: f32 = 16.0; +const VISION_GAP: f32 = 3.0; + +/// The display sRGB of `c` as simulated for protanopia, deuteranopia and tritanopia, through +/// `cms`'s Proof Setup simulations, and for achromatopsia: the gray with `c`'s CIE L*, through the +/// same display transform. +pub(crate) fn vision_colors(cms: &Cms, c: &Color) -> [[f32; 3]; 4] { + let srgb = cms.display_rgb(c); + let proof = |target| cms.proof_srgb(srgb, &ProofSetup { target, ..Default::default() }); + let gray = cms.display_rgb(&Color::lab(cms.lab(c).l, 0.0, 0.0)); + [proof(ProofTarget::Protanopia), proof(ProofTarget::Deuteranopia), proof(ProofTarget::Tritanopia), gray] +} + +/// The names of the color vision chips, in the order of [`vision_colors`]. +fn vision_names() -> [String; 4] { + [tl!("Protanopia"), tl!("Deuteranopia"), tl!("Tritanopia"), tl!("Achromatopsia")].map(|s| s.to_string()) +} + +/// The 0 to 255 values of display sRGB `rgb`. +pub(crate) fn bytes(rgb: [f32; 3]) -> [u8; 3] { + rgb.map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8) +} + +/// `#rrggbb` of 0 to 255 values. +pub(crate) fn hex([r, g, b]: [u8; 3]) -> String { + format!("#{r:02x}{g:02x}{b:02x}") +} + +/// The Show Color Vision Preview row: four chips across the panel with `color` as each color +/// vision deficiency shows it. Each chip takes the keyboard focus and reports its name and, with a +/// solid color, its hex value as its value to screen readers; its tooltip shows both. A click or a +/// key on a chip does nothing. With no solid color the chips are empty and carry only their names. +fn vision_row(ui: &mut Ui, cms: &Cms, color: Option<&Color>) { + let t = Tokens::get(ui.ctx()); + let colors = color.map(|c| vision_colors(cms, c)); + let width = ui.available_width(); + let (row, _) = ui.allocate_exact_size(vec2(width, VISION_CHIP), Sense::hover()); + let w = ((width - 3.0 * VISION_GAP) / 4.0).max(1.0); + let enabled = ui.is_enabled(); + for (i, name) in vision_names().into_iter().enumerate() { + let cell = Rect::from_min_size(row.min + vec2(i as f32 * (w + VISION_GAP), 0.0), vec2(w, VISION_CHIP)); + let resp = ui.interact(cell, ui.scope_id().with(("color-vision", i)), Sense::focusable_noninteractive()); + let value = colors.map(|cs| { + let [r, g, b] = bytes(cs[i]); + ui.painter().rect_filled(cell, 0.0, egui::Color32::from_rgb(r, g, b)); + hex([r, g, b]) + }); + let stroke = if resp.has_focus() { ui.visuals().selection.stroke } else { Stroke::new(1.0, t.border) }; + ui.painter().rect_stroke(cell, 0.0, stroke, StrokeKind::Inside); + let tip = match &value { + Some(v) => format!("{name}\n{v}"), + None => name.clone(), + }; + resp.widget_info(|| egui::WidgetInfo { current_text_value: value.clone(), ..egui::WidgetInfo::labeled(egui::Role::Image, enabled, &name) }); + resp.on_hover_text(tip); + } +} /// What the HSB picked last belongs to: the document, the selected objects or text characters, /// the appearance item, the proxy, the gradient stop or freeform point, its paint, and the color @@ -344,6 +423,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { pick = Some(([hsb[0], x, 1.0 - y], field_phase)); } }); + if app.ui.color_wheel.vision { + ui.add_space(4.0); + vision_row(ui, &cms, color.as_ref()); + } let Some((hsb, phase)) = pick else { return }; let behind = super::alt_held(ui); let cmyk_doc = app.session.active().is_some_and(|d| d.doc.color_mode == ColorMode::Cmyk); diff --git a/crates/ui-egui/src/panels/tests_color_wheel_box.rs b/crates/ui-egui/src/panels/tests_color_wheel_box.rs index d3866fd5d9..4a6144443c 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_box.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_box.rs @@ -167,16 +167,16 @@ fn the_strip_takes_the_arrow_keys_and_screen_readers_actions() { #[test] fn ui_color_wheel_sets_and_reads_the_view_and_the_channel() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); - assert_eq!(app.run("ui.colorWheel", json!({})).unwrap(), json!({"view": "wheel", "channel": "hue"})); - assert_eq!(app.run("ui.colorWheel", json!({"view": "box"})).unwrap(), json!({"view": "box", "channel": "hue"})); - assert_eq!(app.run("ui.colorWheel", json!({"channel": "green"})).unwrap(), json!({"view": "box", "channel": "green"})); + assert_eq!(app.run("ui.colorWheel", json!({})).unwrap(), json!({"view": "wheel", "channel": "hue", "vision": false})); + assert_eq!(app.run("ui.colorWheel", json!({"view": "box"})).unwrap(), json!({"view": "box", "channel": "hue", "vision": false})); + assert_eq!(app.run("ui.colorWheel", json!({"channel": "green"})).unwrap(), json!({"view": "box", "channel": "green", "vision": false})); let e = app.run("ui.colorWheel", json!({"view": "triangle"})).unwrap_err(); assert_eq!(e, "`view` must be wheel or box"); let e = app.run("ui.colorWheel", json!({"view": "wheel", "channel": 7})).unwrap_err(); assert_eq!(e, "`channel` must be hue, saturation, brightness, red, green or blue"); - assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Green }, "an error changes nothing"); + assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Green, vision: false }, "an error changes nothing"); let ui = crate::control::inspect(&app, &egui::Context::default()); - assert_eq!(ui["ui"]["color_wheel"], json!({"view": "box", "channel": "green"})); + assert_eq!(ui["ui"]["color_wheel"], json!({"view": "box", "channel": "green", "vision": false})); } /// The command's errors are translated in the catalogs that translate status and error messages, @@ -211,10 +211,10 @@ fn ui_color_wheel_rejects_other_params() { let e = app.run("ui.colorWheel", json!([1])).unwrap_err(); assert_eq!(e, "the params must be an object, not [1]"); let e = app.run("ui.colorWheel", json!({"veiw": "wheel"})).unwrap_err(); - assert_eq!(e, "unknown parameter `veiw`; the command takes: view, channel"); + assert_eq!(e, "unknown parameter `veiw`; the command takes: view, channel, vision"); let e = app.run("ui.colorWheel", json!({"view": "wheel", "chanel": "blue"})).unwrap_err(); - assert_eq!(e, "unknown parameter `chanel`; the command takes: view, channel"); - assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Red }, "an error changes nothing"); + assert_eq!(e, "unknown parameter `chanel`; the command takes: view, channel, vision"); + assert_eq!(app.ui.color_wheel, Settings { view: View::Box, channel: Channel::Red, vision: false }, "an error changes nothing"); } /// With None there is no color to edit: the strip reads 0 to screen readers, as the hue ring does, @@ -249,7 +249,11 @@ fn ui_color_wheel_answers_junk_params_without_a_panic() { /// not know reads as the key's default without losing the other preferences. #[test] fn the_settings_are_kept_and_read_leniently() { - let ui = crate::UiState { color_wheel: Settings { view: View::Box, channel: Channel::Blue }, color_rgb_percent: true, ..Default::default() }; + let ui = crate::UiState { + color_wheel: Settings { view: View::Box, channel: Channel::Blue, vision: true }, + color_rgb_percent: true, + ..Default::default() + }; let saved = serde_json::to_value(&ui).unwrap(); let back: crate::UiState = serde_json::from_value(saved.clone()).unwrap(); assert_eq!(back.color_wheel, ui.color_wheel); @@ -262,11 +266,11 @@ fn the_settings_are_kept_and_read_leniently() { let mut odd = saved.clone(); odd["color_wheel"] = json!({"view": "box", "channel": 7}); let back: crate::UiState = serde_json::from_value(odd).unwrap(); - assert_eq!(back.color_wheel, Settings { view: View::Box, channel: Channel::default() }); + assert_eq!(back.color_wheel, Settings { view: View::Box, channel: Channel::default(), vision: false }); let mut odd = saved.clone(); odd["color_wheel"] = json!({"view": "triangle", "channel": "blue"}); let back: crate::UiState = serde_json::from_value(odd).unwrap(); - assert_eq!(back.color_wheel, Settings { view: View::Wheel, channel: Channel::Blue }); + assert_eq!(back.color_wheel, Settings { view: View::Wheel, channel: Channel::Blue, vision: false }); let mut odd = saved; odd["color_wheel"] = json!("box"); let back: crate::UiState = serde_json::from_value(odd).unwrap(); diff --git a/crates/ui-egui/src/panels/tests_color_wheel_vision.rs b/crates/ui-egui/src/panels/tests_color_wheel_vision.rs new file mode 100644 index 0000000000..818bb49650 --- /dev/null +++ b/crates/ui-egui/src/panels/tests_color_wheel_vision.rs @@ -0,0 +1,258 @@ +//! The Color Wheel panel's Show Color Vision Preview row drawn headless: the simulated colors, their +//! names and values, the painted chips, a gray fill, no solid color, clicks and keys on the chips, +//! the keyboard focus, the panel menu and `ui.colorWheel`. + +use egui::{Color32, Key, Modifiers, Rect, Shape, vec2}; +use egui_kittest::Harness; +use egui_kittest::kittest::{NodeT, Queryable}; +use serde_json::{Value, json}; +use vectorcraft_color::Color; +use vectorcraft_color::cms::{self, ProofSetup, ProofTarget}; +use vectorcraft_engine::Session; + +use super::color_wheel::{bytes, show, vision_colors}; +use crate::VectorcraftApp; + +/// `#rrggbb` of display sRGB `rgb`, as the chips show it. +fn hex(rgb: [f32; 3]) -> String { + super::color_wheel::hex(bytes(rgb)) +} + +const NAMES: [&str; 4] = ["Protanopia", "Deuteranopia", "Tritanopia", "Achromatopsia"]; + +/// A document with a selected rectangle filled with `fill`, with Show Color Vision Preview on. +fn app(fill: Value) -> VectorcraftApp { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + app.run("paint.setFill", json!({"color": fill})).unwrap(); + app.run("ui.colorWheel", json!({"vision": true})).unwrap(); + app +} + +fn harness(app: VectorcraftApp) -> Harness<'static, VectorcraftApp> { + let mut h = Harness::builder().with_size(vec2(260.0, 360.0)).build_ui_state(|ui, app: &mut VectorcraftApp| show(app, ui), app); + h.run_steps(2); + h +} + +/// The value a chip reports to screen readers. +fn value(h: &Harness<'static, VectorcraftApp>, name: &str) -> Option { + h.get_by_label(name).value() +} + +fn fill(app: &VectorcraftApp) -> Color { + super::current_paints(app).0.color().expect("a solid fill") +} + +fn undo_len(app: &VectorcraftApp) -> usize { + app.session.doc().unwrap().history.undo.len() +} + +/// The fill painted inside `cell`, if a filled rectangle covers it. +fn painted(h: &Harness<'static, VectorcraftApp>, cell: Rect) -> Option { + h.output().shapes.iter().find_map(|c| match &c.shape { + Shape::Rect(r) + if r.fill != Color32::TRANSPARENT && r.rect.expand(0.5).contains_rect(cell.shrink(0.5)) && cell.expand(0.5).contains_rect(r.rect) => + { + Some(r.fill) + } + _ => None, + }) +} + +fn color32(hex: &str) -> Color32 { + Color32::from_hex(hex).expect("a #rrggbb value") +} + +/// The protanopia, deuteranopia and tritanopia chips show the fill as View › Proof Setup's +/// simulations show it: each reports the simulation's hex value and is painted in it. +#[test] +fn the_chips_show_the_proof_setup_simulations_of_the_fill() { + let h = harness(app(json!("#3366cc"))); + let cms = cms::active(); + let srgb = cms.display_rgb(&fill(h.state())); + for (name, target) in + [("Protanopia", ProofTarget::Protanopia), ("Deuteranopia", ProofTarget::Deuteranopia), ("Tritanopia", ProofTarget::Tritanopia)] + { + let want = hex(cms.proof_srgb(srgb, &ProofSetup { target, ..Default::default() })); + assert_eq!(value(&h, name).as_deref(), Some(want.as_str()), "{name}"); + assert_eq!(painted(&h, h.get_by_label(name).rect()), Some(color32(&want)), "{name} is painted {want}"); + } +} + +/// The achromatopsia chip of a red fill is the gray with red's CIE L* (D50, about 54.29: #828282), +/// and the simulations of a pure red differ from it and from each other. +#[test] +fn the_achromatopsia_chip_is_the_gray_of_the_colors_lightness() { + let cms = cms::active(); + let [p, d, t, a] = vision_colors(&cms, &Color::rgb(1.0, 0.0, 0.0)); + assert_eq!(hex(a), "#828282"); + assert_ne!(hex(p), hex(d)); + assert_ne!(hex(t), hex(a)); + let h = harness(app(json!("#ff0000"))); + assert_eq!(value(&h, "Achromatopsia").as_deref(), Some("#828282")); + assert_eq!(painted(&h, h.get_by_label("Achromatopsia").rect()), Some(color32("#828282"))); +} + +/// A gray fill shows as the same gray in every chip. +#[test] +fn a_gray_fill_is_the_same_gray_in_every_chip() { + let h = harness(app(json!("#808080"))); + let gray = hex(cms::active().display_rgb(&fill(h.state()))); + for name in NAMES { + assert_eq!(value(&h, name).as_deref(), Some(gray.as_str()), "{name} shows {gray}"); + } +} + +/// With the box in the wheel's place the row shows under the box, with the same values. +#[test] +fn the_row_shows_under_the_box_too() { + let mut a = app(json!("#3366cc")); + a.run("ui.colorWheel", json!({"view": "box", "channel": "red"})).unwrap(); + let h = harness(a); + let [p, ..] = vision_colors(&cms::active(), &fill(h.state())); + assert_eq!(value(&h, "Protanopia").as_deref(), Some(hex(p).as_str())); + let field = h.get_by_label("Color box").rect(); + for name in NAMES { + assert!(h.get_by_label(name).rect().top() >= field.bottom(), "{name} is under the box"); + } +} + +/// With a None fill the chips carry only their names, with no value and no color. +#[test] +fn with_a_none_fill_the_chips_have_no_color() { + let mut a = app(json!("#ff0000")); + a.run("paint.setFill", json!({"none": true})).unwrap(); + let h = harness(a); + for name in NAMES { + assert_eq!(value(&h, name), None, "{name} has no value"); + assert_eq!(painted(&h, h.get_by_label(name).rect()), None, "{name} is not painted"); + } +} + +/// Screen readers find each chip by its deficiency name, with its hex value as its value, and Tab +/// steps through the four chips in order. +#[test] +fn the_chips_take_the_focus_and_report_their_names_and_values() { + let mut h = harness(app(json!("#3366cc"))); + for name in NAMES { + let node = h.get_by_label(name); + assert_eq!(node.accesskit_node().role(), egui::accesskit::Role::Image, "{name}"); + assert!(node.value().is_some_and(|v| v.starts_with('#') && v.len() == 7), "{name}: {:?}", node.value()); + assert!(!node.accesskit_node().is_disabled(), "{name}"); + } + // Tab stops on the panel's other controls first. + for _ in 0..40 { + if h.get_by_label(NAMES[0]).accesskit_node().is_focused() { + break; + } + h.key_press(Key::Tab); + h.run_steps(1); + } + assert!(h.get_by_label(NAMES[0]).accesskit_node().is_focused(), "Tab reaches {}", NAMES[0]); + for name in &NAMES[1..] { + h.key_press(Key::Tab); + h.run_steps(1); + assert!(h.get_by_label(name).accesskit_node().is_focused(), "the next Tab reaches {name}"); + } +} + +/// A click on a chip, and Enter or Space on a focused chip, leave the fill and the undo history as +/// they were. +#[test] +fn a_click_or_a_key_on_a_chip_applies_nothing() { + let mut h = harness(app(json!("#3366cc"))); + let (before, undo) = (fill(h.state()), undo_len(h.state())); + for name in NAMES { + h.get_by_label(name).click(); + h.run_steps(2); + for key in [Key::Enter, Key::Space] { + h.key_press_modifiers(Modifiers::NONE, key); + h.run_steps(1); + } + assert_eq!(fill(h.state()), before, "{name}"); + assert_eq!(undo_len(h.state()), undo, "{name}: no undo step"); + } +} + +/// Without the setting the row is not drawn, and the panel menu's Show Color Vision Preview turns +/// it on and off. +#[test] +fn the_panel_menu_turns_the_row_on_and_off() { + let mut a = app(json!("#3366cc")); + a.run("ui.colorWheel", json!({"vision": false})).unwrap(); + let h = harness(a); + assert!(h.query_by_label_contains("Protanopia").is_none()); + let mut a = app(json!("#3366cc")); + a.run("ui.colorWheel", json!({"vision": false})).unwrap(); + let mut fonts = false; + let mut menu = Harness::builder().build_ui_state( + move |ui, app: &mut VectorcraftApp| { + // The fonts, which draw the check mark, take effect from the next frame. + if !fonts { + crate::theme::install_fonts(ui.ctx()); + fonts = true; + return; + } + super::color_wheel::menu(app, ui); + }, + a, + ); + menu.run_steps(3); + menu.get_by_label_contains("Show Color Vision Preview").click(); + menu.run_steps(2); + assert!(menu.state().ui.color_wheel.vision); + menu.get_by_label_contains("Show Color Vision Preview").click(); + menu.run_steps(2); + assert!(!menu.state().ui.color_wheel.vision); +} + +/// `ui.colorWheel` sets the keys given and reads them with `{}`, and `ui.inspect` reports them as +/// `ui.color_wheel`. A value that is not a bool, params that are not an object and another key +/// are errors that change nothing. +#[test] +fn ui_color_wheel_sets_and_reads_the_settings() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + assert_eq!(app.run("ui.colorWheel", json!({})).unwrap(), json!({"view": "wheel", "channel": "hue", "vision": false})); + assert_eq!(app.run("ui.colorWheel", json!({"vision": true})).unwrap(), json!({"view": "wheel", "channel": "hue", "vision": true})); + assert_eq!(crate::control::inspect(&app, &egui::Context::default())["ui"]["color_wheel"]["vision"], true); + assert_eq!(app.run("ui.colorWheel", json!({"vision": "no"})).unwrap_err(), "`vision` must be true or false"); + assert_eq!(app.run("ui.colorWheel", json!("junk")).unwrap_err(), "the params must be an object, not \"junk\""); + assert_eq!(app.run("ui.colorWheel", json!(5)).unwrap_err(), "the params must be an object, not 5"); + assert_eq!( + app.run("ui.colorWheel", json!({"visoin": false})).unwrap_err(), + "unknown parameter `visoin`; the command takes: view, channel, vision" + ); + assert!(app.ui.color_wheel.vision); + assert_eq!(app.run("ui.colorWheel", json!({"vision": null})).unwrap()["vision"], true); + assert_eq!(app.run("ui.colorWheel", Value::Null).unwrap()["vision"], true); + // Setting the view or the channel keeps the row, and setting the row keeps them. + assert_eq!(app.run("ui.colorWheel", json!({"view": "box"})).unwrap()["vision"], true); + assert_eq!(app.run("ui.colorWheel", json!({"vision": false})).unwrap(), json!({"view": "box", "channel": "hue", "vision": false})); +} + +/// `ui.colorWheel` answers every junk parameter, with and without a document, without a panic. +#[test] +fn ui_color_wheel_answers_junk_params_without_a_panic() { + let doc = crate::menus::UI_COMMANDS.iter().find(|c| c.0 == "ui.colorWheel").expect("registered").3; + let mut app = app(json!("#3366cc")); + let mut empty = VectorcraftApp::new(Session::new(), Default::default()); + for p in vectorcraft_testkit::strategies::junk_params(doc, "/nonexistent").into_iter().chain(vectorcraft_testkit::strategies::junk_values()) { + let _ = app.run("ui.colorWheel", p.clone()); + let _ = empty.run("ui.colorWheel", p); + } +} + +/// The saved settings read leniently: a value this build does not know reads as the default and +/// the other preferences are kept. +#[test] +fn saved_settings_read_leniently() { + let read = |v: Value| serde_json::from_value::(v).expect("the preferences read"); + let s = read(json!({"color_wheel": {"vision": true}, "color_rgb_percent": true})); + assert!(s.color_wheel.vision && s.color_rgb_percent); + let s = read(json!({"color_wheel": {"vision": "yes", "later": 3}, "color_rgb_percent": true})); + assert!(!s.color_wheel.vision && s.color_rgb_percent); + let s = read(json!({"color_wheel": "junk", "color_rgb_percent": true})); + assert!(!s.color_wheel.vision && s.color_rgb_percent); +} diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index d1722e8b72..959f20395f 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -734,7 +734,8 @@ pub struct UiState { /// of an RGB field, `ui.colorPanel`, [`crate::panels::color::deserialize_rgb_percent`]). #[serde(default, deserialize_with = "crate::panels::color::deserialize_rgb_percent")] pub color_rgb_percent: bool, - /// Color Wheel panel: the wheel or the box, and the box's channel (`ui.colorWheel`, + /// Color Wheel panel: the wheel or the box, the box's channel, and the color vision row + /// (`ui.colorWheel`, /// [`crate::panels::color_wheel::deserialize_settings`]). #[serde(default, deserialize_with = "crate::panels::color_wheel::deserialize_settings")] pub color_wheel: crate::panels::color_wheel::Settings, diff --git a/docs/control-protocol.md b/docs/control-protocol.md index bb13e0d5f5..6d01fd91e2 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -265,9 +265,9 @@ My Themes tab lists the saved themes; every action runs a command (`colorTheme.s Color Wheel panel (`window.panel {panel: "colorWheel"}`): a hue ring around a saturation and brightness square. A pick runs the commands the Color panel's sliders run: `paint.setFill` or `paint.setStroke` with `keepModel`, `paint.editGradient` for a gradient's selected stop, and `paint.freeform.setPoint` for a freeform gradient's selected -point (the first stop or point when none is selected). `ui.colorWheel {view?, channel?}` shows the wheel or the box (a -color field with a channel strip at its right) and picks the box's channel; it returns the settings, and `ui.inspect` -reports them as `ui.color_wheel`. +point (the first stop or point when none is selected). `ui.colorWheel {view?, channel?, vision?}` shows the wheel or +the box (a color field with a channel strip at its right), picks the box's channel and shows or hides the color vision +row; it returns the settings, and `ui.inspect` reports them as `ui.color_wheel`. Edit Colors dialogs: `ui.colorBalanceDialog` opens Adjust Colors (`colorBalance`: fields `mode` `gray`/`rgb`/`cmyk`/ `global`, the channels `r` `g` `b` / `c` `m` `y` `k` / `gray` / `tint` (global mode) from −100 to 100, `convert`, `fill`, `stroke`, diff --git a/docs/mcp.md b/docs/mcp.md index 12c1f38184..927d37be23 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -625,6 +625,12 @@ strip at its right) in place of the wheel, as the panel menu's Box View and Box shows the wheel again. Keys left out keep their values. Params that are not an object, another key or a value off the list return an error and change nothing. The command returns `{view, channel}`, and both settings are kept with the preferences. +`ui.colorWheel {"vision": true}` turns on the Color Wheel panel's Show Color Vision Preview, as its panel menu +does: a row of four chips under the wheel or the box shows the current color through the protanopia, deuteranopia +and tritanopia simulations of `view.proofSetup`, and for achromatopsia as the gray with the color's CIE L*. Each +chip reports its name and hex value to screen readers, and a click on a chip does not apply its color. `false` +hides the row. A value that is not a bool returns an error and changes nothing. The command returns +`{view, channel, vision}`, and the setting is kept with the preferences. In remote desktop mode, `invoke_menu` with `{"command":"ui.sampleScreenColor","params":{}}` shows the system's screen color sampler and returns `null` before a color is picked: the system's sampler on macOS, the XDG desktop diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e34f814534..e8cfd684ba 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1512,6 +1512,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur A Cmd/Ctrl-click on the Color panel's spectrum applies Complement and a Cmd/Ctrl+Shift-click applies Invert to the active Fill or Stroke (`paint.complement`, `paint.invert`); with Alt also held, the click recolors the inactive one, as the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) list them. A double-click right of an RGB field switches the Color panel's R, G and B between percent and 0 to 255 ([Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), Color panel). In VectorCraft the color does not change, Web Safe RGB and the hex field stay in 0 to 255, and the panel keeps the choice between sessions (`ui.colorPanel {rgbPercent}`); the color mixer of the Fill and Stroke chips and the gradient stop dialog follow the same setting. Toggle RGB Percent (`ui.colorRgbPercent`) in the command palette and Keyboard Shortcuts switches the units from the keyboard. Tests: `rgb_percent_switches_the_rgb_fields_between_percent_and_0_to_255`, `rgb_percent_does_not_switch_while_the_rows_are_disabled`, `rgb_percent_comes_back_after_a_restart` and `toggle_rgb_percent_switches_the_units_from_the_keyboard` in `crates/ui-egui/src/panels/color/tests.rs`. View › Proof Setup › Color blindness – Tritanopia-type turns Proof Colors on and proofs the canvas with the tritanopia simulation of Brettel, Viénot and Mollon (1997). The Separations Preview panel's Proof Setup list offers the same target (`view.proofSetup {target: "tritanopia"}`). Grays keep their value. + In VectorCraft the Color Wheel panel menu's Show Color Vision Preview (`ui.colorWheel {vision: true}`) adds a row of four chips under the wheel or the box: the current color through the protanopia, deuteranopia and tritanopia simulations that View › Proof Setup uses, and an achromatopsia chip, which is VectorCraft's own gray with the color's CIE L*. Each chip takes the keyboard focus and gives its name and hex value in its tooltip and to screen readers, and a click on one does not apply it. The setting is kept with the preferences. Tests: `crates/ui-egui/src/panels/tests_color_wheel_vision.rs`. The Separations Preview panel's Gamut Check button reports one color outside the CMYK gamut in the singular and more in the plural, in English and in each language's plural forms (`gamut_check_status_takes_the_plural_form` in `crates/ui-egui/src/i18n/tests.rs`). - **Document Color Mode outside the layers:** File › Document Color Mode (in one undo step) and `document.open {colorMode}` also convert the colors of graph designs, graphic styles, opacity-mask art, the tile that pattern editing's Cancel puts back and the art of brushes (with a Hue Shift brush's key color); a tint of a global swatch there becomes the converted swatch's color at its tint, as in the art. - **Segments dragged onto the grid (#3835):** with View › Snap to Grid (or Snap to Pixel) on, a straight segment dragged with Direct Selection or Group Selection lands its anchors on the grid, the box round them putting an edge on a gridline on each axis as a moved object's does (Shift keeps the move on its line), instead of the point it was pressed at landing on an intersection and leaving both anchors off the grid; a dragged anchor still lands on an intersection itself, and drawn points and resize handles already snapped (`direct::tests::a_dragged_segment_lands_its_anchors_on_the_grid`). From 7cd7652add5b958a38957ea09f9c41a09928ac0b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 07:45:32 -0800 Subject: [PATCH 011/158] i18n: complete catalogs have rows for the Weather Icons library and symbol names The built-in Weather Icons symbol library adds the symbols Sun, Moon, Cloud, Rain, Thunder and Snow. Each complete catalog now has a row for each of them and for the library name, and the symbol-name test counts 32 names. --- crates/ui-egui/src/i18n/bg.tsv | 7 +++++++ crates/ui-egui/src/i18n/bs.tsv | 7 +++++++ crates/ui-egui/src/i18n/ca.tsv | 7 +++++++ crates/ui-egui/src/i18n/cs.tsv | 7 +++++++ crates/ui-egui/src/i18n/da.tsv | 7 +++++++ crates/ui-egui/src/i18n/de.tsv | 7 +++++++ crates/ui-egui/src/i18n/el.tsv | 7 +++++++ crates/ui-egui/src/i18n/es.tsv | 7 +++++++ crates/ui-egui/src/i18n/fi.tsv | 7 +++++++ crates/ui-egui/src/i18n/fr.tsv | 7 +++++++ crates/ui-egui/src/i18n/gu.tsv | 7 +++++++ crates/ui-egui/src/i18n/hi.tsv | 7 +++++++ crates/ui-egui/src/i18n/hu.tsv | 7 +++++++ crates/ui-egui/src/i18n/id.tsv | 7 +++++++ crates/ui-egui/src/i18n/it.tsv | 7 +++++++ crates/ui-egui/src/i18n/ja.tsv | 7 +++++++ crates/ui-egui/src/i18n/ka.tsv | 7 +++++++ crates/ui-egui/src/i18n/ko.tsv | 7 +++++++ crates/ui-egui/src/i18n/nl.tsv | 7 +++++++ crates/ui-egui/src/i18n/pl.tsv | 7 +++++++ crates/ui-egui/src/i18n/pt-br.tsv | 7 +++++++ crates/ui-egui/src/i18n/ru.tsv | 7 +++++++ crates/ui-egui/src/i18n/sv.tsv | 7 +++++++ crates/ui-egui/src/i18n/tests.rs | 2 +- crates/ui-egui/src/i18n/tr.tsv | 7 +++++++ crates/ui-egui/src/i18n/uk.tsv | 7 +++++++ crates/ui-egui/src/i18n/vi.tsv | 7 +++++++ crates/ui-egui/src/i18n/zh-hans.tsv | 7 +++++++ crates/ui-egui/src/i18n/zh-hant.tsv | 7 +++++++ 29 files changed, 197 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 8003d375b5..ed5af35188 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -6139,6 +6139,7 @@ axis Y Axis Y ос Checkpoint Контролна точка Inventory Icons Икони на инвентара Skill Icons Икони на умения + Weather Icons Икони за времето Attack Атака Defend Защита Heal Лечение @@ -6481,6 +6482,12 @@ axis Y Axis Y ос Soft Light Wash Лавиране мека светлина Burst Взрив Rounded Square Закръглен квадрат + Sun Слънце + Moon Луна + Cloud Облак + Rain Дъжд + Thunder Гръм + Snow Сняг Save Brush Library… Запази библиотека с четки… @msg no empty artboards to delete няма празни работни области за изтриване Scale Presets Пресети за мащаб diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 360df18ce5..9744eb9871 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -6186,6 +6186,7 @@ axis Y Axis Y osa Checkpoint Kontrolna tačka Inventory Icons Ikone inventara Skill Icons Ikone vještina + Weather Icons Ikone vremena Attack Napad Defend Odbrana Heal Iscjeljenje @@ -6534,6 +6535,12 @@ axis Y Axis Y osa Soft Light Wash Laviranje mekim svjetlom Burst Prasak Rounded Square Zaobljeni kvadrat + Sun Sunce + Moon Mjesec + Cloud Oblak + Rain Kiša + Thunder Grom + Snow Snijeg Save Brush Library… Sačuvaj biblioteku četkica… @msg `{_1}` has no brushes to apply `{_1}` nema četkica za primjenu @msg missing `library` (see brush.libraries) nedostaje `library` (pogledajte brush.libraries) diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index f8d87afb06..465afe73b0 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -468,6 +468,7 @@ antiAlias Sharp Nítid Checkpoint Punt de control Inventory Icons Icones d’inventari Skill Icons Icones d'habilitat + Weather Icons Icones del temps Attack Atac Defend Defensa Heal Curació @@ -4213,6 +4214,12 @@ digits Malayalam Malaiàlam Soft Light Wash Aiguada llum suau Burst Esclat Rounded Square Quadrat arrodonit + Sun Sol + Moon Lluna + Cloud Núvol + Rain Pluja + Thunder Tro + Snow Neu Scatter: Dispersió: Scissors Tisores Scissors Tool Eina de tisores diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 75573082b3..46b39f10bb 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -6690,6 +6690,7 @@ axis Y Axis osa Y Checkpoint Kontrolní bod Inventory Icons Ikony inventáře Skill Icons Ikony dovedností + Weather Icons Ikony počasí Attack Útok Defend Obrana Heal Léčení @@ -7038,6 +7039,12 @@ axis Y Axis osa Y Soft Light Wash Lavírka měkkého světla Burst Výbuch Rounded Square Zaoblený čtverec + Sun Slunce + Moon Měsíc + Cloud Mrak + Rain Déšť + Thunder Hrom + Snow Sníh Save Brush Library… Uložit knihovnu štětců… @msg `{_1}` has no brushes to apply `{_1}` nemá žádné štětce k použití @msg missing `library` (see brush.libraries) chybí `library` (viz brush.libraries) diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 7ae1e227c7..29758aa52f 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -6155,6 +6155,7 @@ axis Y Axis Y-akse Checkpoint Kontrolpunkt Inventory Icons Inventarikoner Skill Icons Færdighedsikoner + Weather Icons Vejrikoner Attack Angreb Defend Forsvar Heal Helbredelse @@ -6497,6 +6498,12 @@ axis Y Axis Y-akse Soft Light Wash Blødt lys-lavering Burst Udbrud Rounded Square Afrundet kvadrat + Sun Sol + Moon Måne + Cloud Sky + Rain Regn + Thunder Torden + Snow Sne Save Brush Library… Gem penselbibliotek… @msg no empty artboards to delete ingen tomme tegneflader at slette Scale Presets Skaleringsforudindstillinger diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index ee97a6263a..d1e0487f53 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -6282,6 +6282,7 @@ axis Y Axis Y-Achse Checkpoint Kontrollpunkt Inventory Icons Inventar-Symbole Skill Icons Fähigkeitssymbole + Weather Icons Wettersymbole Attack Angriff Defend Verteidigung Heal Heilung @@ -6630,6 +6631,12 @@ axis Y Axis Y-Achse Soft Light Wash Weiches-Licht-Lavierung Burst Strahlenkranz Rounded Square Abgerundetes Quadrat + Sun Sonne + Moon Mond + Cloud Wolke + Rain Regen + Thunder Donner + Snow Schnee Bar Balken Fine Dots Feine Punkte Hexagon Sechseck diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index b5990ded14..b0923fe6b7 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -6642,6 +6642,7 @@ axis Y Axis Άξονας Y Checkpoint Σημείο ελέγχου Inventory Icons Εικονίδια αποθέματος Skill Icons Εικονίδια δεξιοτήτων + Weather Icons Εικονίδια καιρού Attack Επίθεση Defend Άμυνα Heal Θεραπεία @@ -6990,6 +6991,12 @@ axis Y Axis Άξονας Y Soft Light Wash Αραίωση απαλού φωτός Burst Έκρηξη Rounded Square Στρογγυλεμένο τετράγωνο + Sun Ήλιος + Moon Φεγγάρι + Cloud Σύννεφο + Rain Βροχή + Thunder Βροντή + Snow Χιόνι Save Brush Library… Αποθήκευση βιβλιοθήκης πινέλων… @msg `{_1}` has no brushes to apply Η `{_1}` δεν έχει πινέλα για εφαρμογή @msg missing `library` (see brush.libraries) λείπει το `library` (δείτε brush.libraries) diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index e717946e8c..35de44d453 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -6633,6 +6633,7 @@ axis Y Axis Eje Y Checkpoint Punto de control Inventory Icons Iconos de inventario Skill Icons Iconos de habilidad + Weather Icons Iconos del tiempo Attack Ataque Defend Defensa Heal Curación @@ -6981,6 +6982,12 @@ axis Y Axis Eje Y Soft Light Wash Aguada luz suave Burst Estallido Rounded Square Cuadrado redondeado + Sun Sol + Moon Luna + Cloud Nube + Rain Lluvia + Thunder Trueno + Snow Nieve Save Brush Library… Guardar biblioteca de pinceles… @msg `{_1}` has no brushes to apply `{_1}` no tiene pinceles para aplicar @msg missing `library` (see brush.libraries) falta `library` (consulte brush.libraries) diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 4c68462083..2d954ce3af 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -6720,6 +6720,7 @@ axis Y Axis Y-akseli Checkpoint Tarkastuskohta Inventory Icons Inventaarioikonit Skill Icons Taitoikonit + Weather Icons Sääikonit Attack Hyökkäys Defend Puolustus Heal Parannus @@ -7068,6 +7069,12 @@ axis Y Axis Y-akseli Soft Light Wash Pehmeä valo -laveeraus Burst Purkaus Rounded Square Pyöristetty neliö + Sun Aurinko + Moon Kuu + Cloud Pilvi + Rain Sade + Thunder Ukkonen + Snow Lumi Save Brush Library… Tallenna sivellinkirjasto… @msg `{_1}` has no brushes to apply Kohteessa `{_1}` ei ole käytettäviä siveltimiä @msg missing `library` (see brush.libraries) `library` puuttuu (katso brush.libraries) diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 9c08b77e84..276f0d893b 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -6685,6 +6685,7 @@ axis Y Axis Axe Y Checkpoint Point de contrôle Inventory Icons Icônes d’inventaire Skill Icons Icônes de compétences + Weather Icons Icônes météo Attack Attaque Defend Défense Heal Soin @@ -7033,6 +7034,12 @@ axis Y Axis Axe Y Soft Light Wash Lavis lumière tamisée Burst Éclat Rounded Square Carré arrondi + Sun Soleil + Moon Lune + Cloud Nuage + Rain Pluie + Thunder Tonnerre + Snow Neige Save Brush Library… Enregistrer la bibliothèque de formes… @msg `{_1}` has no brushes to apply `{_1}` n'a aucune forme à appliquer @msg missing `library` (see brush.libraries) `library` manquant (voir brush.libraries) diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 405fdeb831..a9d910683f 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4273,6 +4273,7 @@ antiAlias Sharp શાર્પ Charge Wave ચાર્જ તરંગ Spark Trail તણખાનો પથ Skill Icons કૌશલ્ય આઇકન + Weather Icons હવામાન આઇકન Attack હુમલો Defend બચાવ Heal ઉપચાર @@ -4946,6 +4947,12 @@ swatch [Registration] [રજિસ્ટ્રેશન] Pin પિન Potion ઔષધ Rounded Square ગોળ ખૂણાવાળો ચોરસ + Sun સૂર્ય + Moon ચંદ્ર + Cloud વાદળ + Rain વરસાદ + Thunder ગર્જના + Snow બરફ Shield ઢાલ Sword તલવાર Triangle ત્રિકોણ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index e47dc7b652..1f12a94b1d 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -694,6 +694,12 @@ antiAlias Sharp शार्प Soft Light Wash सॉफ़्ट लाइट वॉश Burst विस्फोट Rounded Square गोल कोनों वाला वर्ग + Sun सूरज + Moon चाँद + Cloud बादल + Rain बारिश + Thunder गरज + Snow बर्फ़ Art using a deleted global swatch keeps its colour. हटाए गए ग्लोबल स्वॉच वाला आर्टवर्क अपना रंग बनाए रखता है। Artboard आर्टबोर्ड Artboard {n} of {total} {total} में से आर्टबोर्ड {n} @@ -795,6 +801,7 @@ antiAlias Sharp शार्प Checkpoint चेकपॉइंट Inventory Icons इन्वेंटरी आइकन Skill Icons कौशल आइकन + Weather Icons मौसम आइकन Attack आक्रमण Defend रक्षा Heal उपचार diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 8ba74eefcd..36d74468da 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -6673,6 +6673,7 @@ axis Y Axis Y tengely Checkpoint Ellenőrzőpont Inventory Icons Leltári ikonok Skill Icons Képességikonok + Weather Icons Időjárás-ikonok Attack Támadás Defend Védelem Heal Gyógyítás @@ -7021,6 +7022,12 @@ axis Y Axis Y tengely Soft Light Wash Lágy fény lavírozás Burst Robbanás Rounded Square Lekerekített négyzet + Sun Nap + Moon Hold + Cloud Felhő + Rain Eső + Thunder Mennydörgés + Snow Hó Save Brush Library… Ecsetkönyvtár mentése… @msg `{_1}` has no brushes to apply A(z) `{_1}` nem tartalmaz alkalmazható ecsetet @msg missing `library` (see brush.libraries) hiányzik a `library` (lásd: brush.libraries) diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index dc6d104d52..dc11f81e52 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -6155,6 +6155,7 @@ axis Y Axis Sumbu Y Checkpoint Pos pemeriksaan Inventory Icons Ikon Inventaris Skill Icons Ikon Keahlian + Weather Icons Ikon Cuaca Attack Serang Defend Bertahan Heal Pulihkan @@ -6497,6 +6498,12 @@ axis Y Axis Sumbu Y Soft Light Wash Sapuan cahaya lembut Burst Ledakan Rounded Square Persegi bulat + Sun Matahari + Moon Bulan + Cloud Awan + Rain Hujan + Thunder Guntur + Snow Salju Save Brush Library… Simpan pustaka kuas… @msg no empty artboards to delete tidak ada artboard kosong untuk dihapus Scale Presets Preset skala diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 85e33a28c4..beaa9072f1 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -6316,6 +6316,7 @@ axis Y Axis Asse Y Checkpoint Punto di controllo Inventory Icons Icone inventario Skill Icons Icone abilità + Weather Icons Icone meteo Attack Attacco Defend Difesa Heal Cura @@ -6664,6 +6665,12 @@ axis Y Axis Asse Y Soft Light Wash Acquerello luce soffusa Burst Esplosione Rounded Square Quadrato arrotondato + Sun Sole + Moon Luna + Cloud Nuvola + Rain Pioggia + Thunder Tuono + Snow Neve Bar Barra Hexagon Esagono Spectrum Spettro diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index ab74989426..790ac6809f 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -6382,6 +6382,7 @@ axis Y Axis Y 軸 Checkpoint チェックポイント Inventory Icons インベントリアイコン Skill Icons スキルアイコン + Weather Icons 天気アイコン Attack 攻撃 Defend 防御 Heal 回復 @@ -6730,6 +6731,12 @@ axis Y Axis Y 軸 Soft Light Wash ソフトライトのにじみ Burst バースト Rounded Square 角丸の正方形 + Sun 太陽 + Moon 月 + Cloud 雲 + Rain 雨 + Thunder 雷 + Snow 雪 Bar バー Hexagon 六角形 Spectrum スペクトル diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 3300e81a99..df6766fb5b 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6641,6 +6641,7 @@ axis Y Axis Y ღერძი Checkpoint საკონტროლო წერტილი Inventory Icons ინვენტარის ხატულები Skill Icons უნარების ხატულები + Weather Icons ამინდის ხატულები Attack შეტევა Defend თავდაცვა Heal განკურნება @@ -6989,6 +6990,12 @@ axis Y Axis Y ღერძი Soft Light Wash რბილი სინათლის რეცხვა Burst აფეთქება Rounded Square მომრგვალებული კვადრატი + Sun მზე + Moon მთვარე + Cloud ღრუბელი + Rain წვიმა + Thunder ქუხილი + Snow თოვლი Save Brush Library… ფუნჯების ბიბლიოთეკის შენახვა… @msg `{_1}` has no brushes to apply `{_1}`-ში გამოსაყენებელი ფუნჯები არ არის @msg missing `library` (see brush.libraries) `library` აკლია (იხ. brush.libraries) diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 6661f1bda4..390b471275 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -6277,6 +6277,7 @@ axis Y Axis Y축 Checkpoint 체크포인트 Inventory Icons 인벤토리 아이콘 Skill Icons 스킬 아이콘 + Weather Icons 날씨 아이콘 Attack 공격 Defend 방어 Heal 치유 @@ -6625,6 +6626,12 @@ axis Y Axis Y축 Soft Light Wash 소프트 라이트 번짐 Burst 폭발 Rounded Square 둥근 사각형 + Sun 해 + Moon 달 + Cloud 구름 + Rain 비 + Thunder 천둥 + Snow 눈 Bar 막대 Hexagon 육각형 Spectrum 스펙트럼 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index f230e49b98..750faba3ee 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -8598,6 +8598,7 @@ axis Y Axis Y-as Checkpoint Controlepunt Inventory Icons Inventarisiconen Skill Icons Vaardigheidsiconen + Weather Icons Weericonen Attack Aanval Defend Verdediging Heal Genezen @@ -8940,6 +8941,12 @@ axis Y Axis Y-as Soft Light Wash Zacht-licht-wassing Burst Uitbarsting Rounded Square Afgerond vierkant + Sun Zon + Moon Maan + Cloud Wolk + Rain Regen + Thunder Donder + Snow Sneeuw Save Brush Library… Penseelbibliotheek opslaan… @msg no empty artboards to delete geen lege tekengebieden om te verwijderen Scale Presets Schaalvoorinstellingen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index e53e3631ff..a23cd854fb 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -6545,6 +6545,7 @@ axis Y Axis Oś Y Checkpoint Punkt kontrolny Inventory Icons Ikony ekwipunku Skill Icons Ikony umiejętności + Weather Icons Ikony pogody Attack Atak Defend Obrona Heal Leczenie @@ -6893,6 +6894,12 @@ axis Y Axis Oś Y Soft Light Wash Lawowanie łagodnym światłem Burst Wybuch Rounded Square Zaokrąglony kwadrat + Sun Słońce + Moon Księżyc + Cloud Chmura + Rain Deszcz + Thunder Grzmot + Snow Śnieg Spectrum Spektrum Vivid Żywe Save Brush Library… Zapisz bibliotekę pędzli… diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 3060141f27..451ba40f4c 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -6605,6 +6605,7 @@ axis Y Axis Eixo Y Checkpoint Ponto de verificação Inventory Icons Ícones de inventário Skill Icons Ícones de habilidade + Weather Icons Ícones de clima Attack Ataque Defend Defesa Heal Cura @@ -6953,6 +6954,12 @@ axis Y Axis Eixo Y Soft Light Wash Aguada Luz Suave Burst Explosão Rounded Square Quadrado Arredondado + Sun Sol + Moon Lua + Cloud Nuvem + Rain Chuva + Thunder Trovão + Snow Neve Save Brush Library… Salvar Biblioteca de Pincéis… @msg `{_1}` has no brushes to apply `{_1}` não tem pincéis para aplicar @msg missing `library` (see brush.libraries) falta `library` (consulte brush.libraries) diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 6b70ef3427..0d1b09b8eb 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -6301,6 +6301,7 @@ axis Y Axis Ось Y Checkpoint Контрольная точка Inventory Icons Иконки инвентаря Skill Icons Иконки навыков + Weather Icons Иконки погоды Attack Атака Defend Защита Heal Лечение @@ -6649,6 +6650,12 @@ axis Y Axis Ось Y Soft Light Wash Размывка мягким светом Burst Вспышка Rounded Square Скруглённый квадрат + Sun Солнце + Moon Луна + Cloud Облако + Rain Дождь + Thunder Гром + Snow Снег Save Brush Library… Сохранить библиотеку кистей… @msg `{_1}` has no brushes to apply В `{_1}` нет кистей для применения @msg missing `library` (see brush.libraries) не указан `library` (см. brush.libraries) diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 6734afa3f4..ec8c2b7071 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -6670,6 +6670,7 @@ axis Y Axis Y-axel Checkpoint Kontrollpunkt Inventory Icons Inventarieikoner Skill Icons Färdighetsikoner + Weather Icons Väderikoner Attack Attack Defend Försvar Heal Retuschering @@ -7018,6 +7019,12 @@ axis Y Axis Y-axel Soft Light Wash Mjukt ljus-lavering Burst Utbrott Rounded Square Rundad kvadrat + Sun Sol + Moon Måne + Cloud Moln + Rain Regn + Thunder Åska + Snow Snö Save Brush Library… Spara penselbibliotek… @msg `{_1}` has no brushes to apply `{_1}` har inga penslar att använda @msg missing `library` (see brush.libraries) `library` saknas (se brush.libraries) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index e565721539..b78fb6a0c8 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -451,7 +451,7 @@ fn built_in_library_symbol_names_are_in_complete_catalogs() { .flat_map(|(_, lib)| lib.doc.symbols.iter().map(|s| s.name.clone()).collect::>()) .collect(), ); - assert_eq!(names.len(), 26, "{names:?}"); + assert_eq!(names.len(), 32, "{names:?}"); let bad = lacking(&names, |c, n| c.plain(n).is_some()); assert!(bad.is_empty(), "{}", bad.join("\n")); } diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 709df200cd..2844bb1ace 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -6763,6 +6763,7 @@ axis Y Axis Y ekseni Checkpoint Kontrol noktası Inventory Icons Envanter Simgeleri Skill Icons Yetenek Simgeleri + Weather Icons Hava Durumu Simgeleri Attack Saldırı Defend Savunma Heal İyileştirme @@ -7111,6 +7112,12 @@ axis Y Axis Y ekseni Soft Light Wash Yumuşak Işık Lavisi Burst Patlama Rounded Square Yuvarlatılmış Kare + Sun Güneş + Moon Ay + Cloud Bulut + Rain Yağmur + Thunder Gök Gürültüsü + Snow Kar Save Brush Library… Fırça Kitaplığını Kaydet… @msg `{_1}` has no brushes to apply `{_1}` içinde uygulanacak fırça yok @msg missing `library` (see brush.libraries) `library` eksik (bkz. brush.libraries) diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 19eeaedf1d..2e712b578a 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -6296,6 +6296,7 @@ axis Y Axis Вісь Y Checkpoint Контрольна точка Inventory Icons Піктограми інвентарю Skill Icons Іконки навичок + Weather Icons Іконки погоди Attack Атака Defend Захист Heal Лікування @@ -6644,6 +6645,12 @@ axis Y Axis Вісь Y Soft Light Wash Розмивка м’яким світлом Burst Спалах Rounded Square Округлений квадрат + Sun Сонце + Moon Місяць + Cloud Хмара + Rain Дощ + Thunder Грім + Snow Сніг Bar Панель Hexagon Шестикутник Spectrum Спектр diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 80fd45d546..d60d1f0f5d 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -6297,6 +6297,7 @@ axis Y Axis Trục Y Checkpoint Điểm kiểm tra Inventory Icons Biểu tượng túi đồ Skill Icons Biểu tượng kỹ năng + Weather Icons Biểu tượng thời tiết Attack Tấn công Defend Phòng thủ Heal Hồi máu @@ -6645,6 +6646,12 @@ axis Y Axis Trục Y Soft Light Wash Loang ánh sáng mềm Burst Bùng nổ Rounded Square Hình vuông bo góc + Sun Mặt trời + Moon Mặt trăng + Cloud Mây + Rain Mưa + Thunder Sấm + Snow Tuyết Bar Thanh Hexagon Lục giác Spectrum Quang phổ diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 0e9f3a85d4..5b99b377bf 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -6529,6 +6529,7 @@ axis Y Axis Y 轴 Checkpoint 检查点 Inventory Icons 物品栏图标 Skill Icons 技能图标 + Weather Icons 天气图标 Attack 攻击 Defend 防御 Heal 治疗 @@ -6877,6 +6878,12 @@ axis Y Axis Y 轴 Soft Light Wash 柔光晕染 Burst 爆发 Rounded Square 圆角正方形 + Sun 太阳 + Moon 月亮 + Cloud 云 + Rain 雨 + Thunder 雷 + Snow 雪 Bar 条形 Hexagon 六边形 Triangle 三角 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 84b6ea8d74..765a0c53ef 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -6336,6 +6336,7 @@ axis Y Axis Y 軸 Checkpoint 檢查點 Inventory Icons 物品欄圖示 Skill Icons 技能圖示 + Weather Icons 天氣圖示 Attack 攻擊 Defend 防禦 Heal 治療 @@ -6684,6 +6685,12 @@ axis Y Axis Y 軸 Soft Light Wash 柔光暈染 Burst 爆發 Rounded Square 圓角正方形 + Sun 太陽 + Moon 月亮 + Cloud 雲 + Rain 雨 + Thunder 雷 + Snow 雪 Bar 長條 Hexagon 六邊形 Spectrum 光譜 From 4a7acfe0eec6d31aeb09d81c1b4327f4e813f1a8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 08:25:58 -0800 Subject: [PATCH 012/158] Color Wheel: color vision chips show hex as the Color panel does - The chips report and show their hex value as the Color panel's hex field writes it (828282), not as #828282. - The saved Show Color Vision Preview setting reads through the Color panel's existing reader (`deserialize_rgb_percent`) instead of a copy. - The key test moves the keyboard focus to each chip with Tab before it presses Enter and Space. - A test checks that `{"view": "box", "channel": "red", "vision": 1}` returns an error and leaves the view and the channel unchanged. - docs/mcp.md says the command returns `{view, channel, vision}` in one place, and that `null` keeps the setting. - The module doc says the vision setting is kept with the preferences. --- crates/ui-egui/src/panels/color_wheel.rs | 26 +++++----- .../src/panels/tests_color_wheel_vision.rs | 47 ++++++++++++------- crates/ui-egui/src/state.rs | 3 +- docs/mcp.md | 7 ++- 4 files changed, 48 insertions(+), 35 deletions(-) diff --git a/crates/ui-egui/src/panels/color_wheel.rs b/crates/ui-egui/src/panels/color_wheel.rs index b66f9c8e38..bbc2b588c5 100644 --- a/crates/ui-egui/src/panels/color_wheel.rs +++ b/crates/ui-egui/src/panels/color_wheel.rs @@ -10,12 +10,15 @@ //! The panel menu's Box View puts a box in the wheel's place: a color field with a vertical //! channel strip at its right, for the channel picked under Box Channel (Hue, Saturation, //! Brightness, Red, Green or Blue). The field shows the other two components on the Color -//! Picker's axes. The view and the channel are kept with the preferences (`ui.colorWheel`). +//! Picker's axes. //! //! Panel menu › Show Color Vision Preview adds a row under the wheel or the box with the color as //! simulated for protanopia, deuteranopia and tritanopia, through the simulations View › Proof //! Setup uses, and for achromatopsia as the gray with the color's CIE L*. The chips only show the //! simulation. +//! +//! The view, the channel and Show Color Vision Preview are kept with the preferences +//! (`ui.colorWheel`). use egui::{Rect, Sense, Stroke, StrokeKind, Ui, UiBuilder, vec2}; use serde::{Deserialize, Serialize}; @@ -73,15 +76,12 @@ pub struct Settings { pub view: View, #[serde(serialize_with = "serialize_channel", deserialize_with = "deserialize_channel")] pub channel: Channel, - /// Show Color Vision Preview: the row of simulated colors under the wheel or the box. - #[serde(deserialize_with = "deserialize_flag")] + /// Show Color Vision Preview: the row of simulated colors under the wheel or the box. A saved + /// `true` shows the row and any other value hides it. + #[serde(deserialize_with = "crate::panels::color::deserialize_rgb_percent")] pub vision: bool, } -fn deserialize_flag<'de, D: serde::Deserializer<'de>>(d: D) -> Result { - Ok(::deserialize(d)?.as_bool().unwrap_or_default()) -} - fn deserialize_view<'de, D: serde::Deserializer<'de>>(d: D) -> Result { let v = ::deserialize(d)?; Ok(v.as_str().and_then(View::parse).unwrap_or_default()) @@ -104,8 +104,9 @@ pub fn deserialize_settings<'de, D: serde::Deserializer<'de>>(d: D) -> Result Result { const KEYS: [&str; 3] = ["view", "channel", "vision"]; match p { @@ -252,15 +253,16 @@ pub(crate) fn bytes(rgb: [f32; 3]) -> [u8; 3] { rgb.map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8) } -/// `#rrggbb` of 0 to 255 values. +/// The hex text of 0 to 255 values, in the form of the Color panel's hex field (`E67828`). pub(crate) fn hex([r, g, b]: [u8; 3]) -> String { - format!("#{r:02x}{g:02x}{b:02x}") + format!("{r:02X}{g:02X}{b:02X}") } /// The Show Color Vision Preview row: four chips across the panel with `color` as each color /// vision deficiency shows it. Each chip takes the keyboard focus and reports its name and, with a /// solid color, its hex value as its value to screen readers; its tooltip shows both. A click or a -/// key on a chip does nothing. With no solid color the chips are empty and carry only their names. +/// key on a chip does nothing. With no solid color the chips are empty and keep their names in the tooltip and for screen +/// readers. fn vision_row(ui: &mut Ui, cms: &Cms, color: Option<&Color>) { let t = Tokens::get(ui.ctx()); let colors = color.map(|c| vision_colors(cms, c)); diff --git a/crates/ui-egui/src/panels/tests_color_wheel_vision.rs b/crates/ui-egui/src/panels/tests_color_wheel_vision.rs index 818bb49650..5c73496642 100644 --- a/crates/ui-egui/src/panels/tests_color_wheel_vision.rs +++ b/crates/ui-egui/src/panels/tests_color_wheel_vision.rs @@ -62,7 +62,7 @@ fn painted(h: &Harness<'static, VectorcraftApp>, cell: Rect) -> Option } fn color32(hex: &str) -> Color32 { - Color32::from_hex(hex).expect("a #rrggbb value") + Color32::from_hex(&format!("#{hex}")).expect("an RRGGBB value") } /// The protanopia, deuteranopia and tritanopia chips show the fill as View › Proof Setup's @@ -81,18 +81,18 @@ fn the_chips_show_the_proof_setup_simulations_of_the_fill() { } } -/// The achromatopsia chip of a red fill is the gray with red's CIE L* (D50, about 54.29: #828282), +/// The achromatopsia chip of a red fill is the gray with red's CIE L* (D50, about 54.29: 828282), /// and the simulations of a pure red differ from it and from each other. #[test] fn the_achromatopsia_chip_is_the_gray_of_the_colors_lightness() { let cms = cms::active(); let [p, d, t, a] = vision_colors(&cms, &Color::rgb(1.0, 0.0, 0.0)); - assert_eq!(hex(a), "#828282"); + assert_eq!(hex(a), "828282"); assert_ne!(hex(p), hex(d)); assert_ne!(hex(t), hex(a)); let h = harness(app(json!("#ff0000"))); - assert_eq!(value(&h, "Achromatopsia").as_deref(), Some("#828282")); - assert_eq!(painted(&h, h.get_by_label("Achromatopsia").rect()), Some(color32("#828282"))); + assert_eq!(value(&h, "Achromatopsia").as_deref(), Some("828282")); + assert_eq!(painted(&h, h.get_by_label("Achromatopsia").rect()), Some(color32("828282"))); } /// A gray fill shows as the same gray in every chip. @@ -139,18 +139,14 @@ fn the_chips_take_the_focus_and_report_their_names_and_values() { for name in NAMES { let node = h.get_by_label(name); assert_eq!(node.accesskit_node().role(), egui::accesskit::Role::Image, "{name}"); - assert!(node.value().is_some_and(|v| v.starts_with('#') && v.len() == 7), "{name}: {:?}", node.value()); + assert!( + node.value().is_some_and(|v| v.len() == 6 && v.bytes().all(|b| b.is_ascii_digit() || b.is_ascii_uppercase())), + "{name}: {:?}", + node.value() + ); assert!(!node.accesskit_node().is_disabled(), "{name}"); } - // Tab stops on the panel's other controls first. - for _ in 0..40 { - if h.get_by_label(NAMES[0]).accesskit_node().is_focused() { - break; - } - h.key_press(Key::Tab); - h.run_steps(1); - } - assert!(h.get_by_label(NAMES[0]).accesskit_node().is_focused(), "Tab reaches {}", NAMES[0]); + tab_to(&mut h, NAMES[0]); for name in &NAMES[1..] { h.key_press(Key::Tab); h.run_steps(1); @@ -158,6 +154,19 @@ fn the_chips_take_the_focus_and_report_their_names_and_values() { } } +/// Press Tab until the chip `name` has the keyboard focus. Tab stops on the panel's other controls +/// first. +fn tab_to(h: &mut Harness<'static, VectorcraftApp>, name: &str) { + for _ in 0..40 { + if h.get_by_label(name).accesskit_node().is_focused() { + break; + } + h.key_press(Key::Tab); + h.run_steps(1); + } + assert!(h.get_by_label(name).accesskit_node().is_focused(), "Tab reaches {name}"); +} + /// A click on a chip, and Enter or Space on a focused chip, leave the fill and the undo history as /// they were. #[test] @@ -167,6 +176,7 @@ fn a_click_or_a_key_on_a_chip_applies_nothing() { for name in NAMES { h.get_by_label(name).click(); h.run_steps(2); + tab_to(&mut h, name); for key in [Key::Enter, Key::Space] { h.key_press_modifiers(Modifiers::NONE, key); h.run_steps(1); @@ -209,8 +219,9 @@ fn the_panel_menu_turns_the_row_on_and_off() { } /// `ui.colorWheel` sets the keys given and reads them with `{}`, and `ui.inspect` reports them as -/// `ui.color_wheel`. A value that is not a bool, params that are not an object and another key -/// are errors that change nothing. +/// `ui.color_wheel`. A `vision` value other than true, false or null, params that are not an object +/// and another key are errors that change nothing, the view and the channel given with them +/// included. #[test] fn ui_color_wheel_sets_and_reads_the_settings() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); @@ -218,6 +229,8 @@ fn ui_color_wheel_sets_and_reads_the_settings() { assert_eq!(app.run("ui.colorWheel", json!({"vision": true})).unwrap(), json!({"view": "wheel", "channel": "hue", "vision": true})); assert_eq!(crate::control::inspect(&app, &egui::Context::default())["ui"]["color_wheel"]["vision"], true); assert_eq!(app.run("ui.colorWheel", json!({"vision": "no"})).unwrap_err(), "`vision` must be true or false"); + assert_eq!(app.run("ui.colorWheel", json!({"view": "box", "channel": "red", "vision": 1})).unwrap_err(), "`vision` must be true or false"); + assert_eq!(app.run("ui.colorWheel", json!({})).unwrap(), json!({"view": "wheel", "channel": "hue", "vision": true})); assert_eq!(app.run("ui.colorWheel", json!("junk")).unwrap_err(), "the params must be an object, not \"junk\""); assert_eq!(app.run("ui.colorWheel", json!(5)).unwrap_err(), "the params must be an object, not 5"); assert_eq!( diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 959f20395f..4705876ece 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -735,8 +735,7 @@ pub struct UiState { #[serde(default, deserialize_with = "crate::panels::color::deserialize_rgb_percent")] pub color_rgb_percent: bool, /// Color Wheel panel: the wheel or the box, the box's channel, and the color vision row - /// (`ui.colorWheel`, - /// [`crate::panels::color_wheel::deserialize_settings`]). + /// (`ui.colorWheel`, [`crate::panels::color_wheel::deserialize_settings`]). #[serde(default, deserialize_with = "crate::panels::color_wheel::deserialize_settings")] pub color_wheel: crate::panels::color_wheel::Settings, /// Swatches panel: Show Recent Colors in its panel menu, which draws the panel's Recent Colors diff --git a/docs/mcp.md b/docs/mcp.md index 927d37be23..89a10d0a07 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -623,14 +623,13 @@ and answers true when the fields show in percent. `ui.colorWheel {"view": "box", "channel": "red"}` shows the Color Wheel panel's box (a color field with the channel's strip at its right) in place of the wheel, as the panel menu's Box View and Box Channel do, and `"view": "wheel"` shows the wheel again. Keys left out keep their values. Params that are not an object, another key or a value off -the list return an error and change nothing. The command returns `{view, channel}`, and both settings are kept with -the preferences. +the list return an error and change nothing. The command returns `{view, channel, vision}`, and the settings are +kept with the preferences. `ui.colorWheel {"vision": true}` turns on the Color Wheel panel's Show Color Vision Preview, as its panel menu does: a row of four chips under the wheel or the box shows the current color through the protanopia, deuteranopia and tritanopia simulations of `view.proofSetup`, and for achromatopsia as the gray with the color's CIE L*. Each chip reports its name and hex value to screen readers, and a click on a chip does not apply its color. `false` -hides the row. A value that is not a bool returns an error and changes nothing. The command returns -`{view, channel, vision}`, and the setting is kept with the preferences. +hides the row, and `null` keeps the setting. Any other value returns an error and changes nothing. In remote desktop mode, `invoke_menu` with `{"command":"ui.sampleScreenColor","params":{}}` shows the system's screen color sampler and returns `null` before a color is picked: the system's sampler on macOS, the XDG desktop From fb1c4ec562d752b93e91b8f99ecd90a530f0b683 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 11:25:55 -0800 Subject: [PATCH 013/158] Edit: Find and Replace steps through matches in a dialog that stays open Edit > Find and Replace... opens a dialog of its own with Find and Replace With fields, Match Case, Find Whole Word, Search Backwards, Check Hidden Layers and Check Locked Layers, and Find, Replace, Replace & Find, Replace All and Done. Find shows the match in its line of text with its place among the matches and selects its type object. edit.findNext returns the match (id, start, end, index, count, selected) and takes backwards, hiddenLayers, lockedLayers and from. The new edit.replaceMatch replaces one match as one undo step. edit.findReplace takes the two layer switches and reports how many matches it replaced. Ruby after a replaced match moves with the text. Edit > Find Next goes on from the dialog's last search in the same document, and is no longer offered as an action step. --- crates/engine/src/cmd/plugin_call/reviewed.rs | 1 + crates/engine/src/cmd/typemenu.rs | 262 +++++++++--- .../engine/src/tests/ids_without_selection.rs | 2 +- crates/engine/src/tests/menucmds.rs | 183 ++++++++- crates/mcp/src/ui_catalog.rs | 7 +- crates/ui-egui/src/dialogs.rs | 2 + crates/ui-egui/src/dialogs/find_replace.rs | 358 +++++++++++++++++ .../ui-egui/src/dialogs/find_replace/tests.rs | 377 ++++++++++++++++++ crates/ui-egui/src/i18n/bg.tsv | 10 + crates/ui-egui/src/i18n/bs.tsv | 10 + crates/ui-egui/src/i18n/ca.tsv | 13 + crates/ui-egui/src/i18n/cs.tsv | 13 + crates/ui-egui/src/i18n/da.tsv | 10 + crates/ui-egui/src/i18n/de.tsv | 13 + crates/ui-egui/src/i18n/el.tsv | 13 + crates/ui-egui/src/i18n/es.tsv | 13 + crates/ui-egui/src/i18n/fi.tsv | 13 + crates/ui-egui/src/i18n/fr.tsv | 13 + crates/ui-egui/src/i18n/hi.tsv | 13 + crates/ui-egui/src/i18n/hu.tsv | 13 + crates/ui-egui/src/i18n/id.tsv | 10 + crates/ui-egui/src/i18n/it.tsv | 13 + crates/ui-egui/src/i18n/ja.tsv | 13 + crates/ui-egui/src/i18n/ka.tsv | 13 + crates/ui-egui/src/i18n/ko.tsv | 13 + crates/ui-egui/src/i18n/nl.tsv | 13 + crates/ui-egui/src/i18n/pl.tsv | 13 + crates/ui-egui/src/i18n/pt-br.tsv | 13 + crates/ui-egui/src/i18n/ru.tsv | 13 + crates/ui-egui/src/i18n/sv.tsv | 13 + crates/ui-egui/src/i18n/tr.tsv | 13 + crates/ui-egui/src/i18n/uk.tsv | 13 + crates/ui-egui/src/i18n/vi.tsv | 13 + crates/ui-egui/src/i18n/zh-hans.tsv | 13 + crates/ui-egui/src/i18n/zh-hant.tsv | 13 + crates/ui-egui/src/menus/entries.rs | 7 +- crates/ui-egui/src/menus/invoke.rs | 12 + crates/ui-egui/src/menus/run.rs | 4 + crates/ui-egui/src/menus/tree.rs | 2 +- crates/ui-egui/src/menus/ui_commands.rs | 7 +- crates/ui-egui/src/palette.rs | 2 +- crates/ui-egui/src/state.rs | 6 + docs/mcp.md | 46 +++ docs/target-app-parity.md | 1 + 44 files changed, 1542 insertions(+), 76 deletions(-) create mode 100644 crates/ui-egui/src/dialogs/find_replace.rs create mode 100644 crates/ui-egui/src/dialogs/find_replace/tests.rs diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index 5329f23331..f11724dc1e 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -165,6 +165,7 @@ pub(super) const ALLOWED: &[&str] = &[ "edit.duplicate", "edit.findNext", "edit.findReplace", + "edit.replaceMatch", "effect.apply", "effect.deferredStatus", "effect.duplicate", diff --git a/crates/engine/src/cmd/typemenu.rs b/crates/engine/src/cmd/typemenu.rs index c140ba6572..0797991bf2 100644 --- a/crates/engine/src/cmd/typemenu.rs +++ b/crates/engine/src/cmd/typemenu.rs @@ -10,8 +10,8 @@ use super::object::choice; use super::threads::ThreadIndex; use super::typecmd::{area_text, block_gaps, needed_room, refresh_bounds}; use super::{ - CommandSpec, EngineError, Result, Session, bad, checked_ids_param, cmd, find_command, has_clipboard, has_doc, has_selection, number_or, - switch_or, targets, text_param, + CommandSpec, EngineError, Result, Session, bad, checked_ids_param, cmd, find_command, has_clipboard, has_doc, has_selection, index_opt, + number_or, object_param, switch_or, targets, text_param, }; pub fn specs() -> Vec { @@ -120,7 +120,7 @@ pub fn specs() -> Vec { "Find and Replace…", ["Edit"], None, - "{find, replace?: \"\", matchCase?: false, wholeWord?: false, ids?} replace in every text object (or ids) → {count}. Matches never span style runs.", + "{find, replace?: \"\", matchCase?: false, wholeWord?: false, hiddenLayers?: false, lockedLayers?: false, ids?} replace every match in the type the search reaches (or in ids, whatever their layers), as one undo step → {count (every match), replaced (the matches that did not already read as `replace`)}. The search reaches visible, unlocked type on visible, unlocked layers, off locked artboards; hiddenLayers adds the type of hidden layers and sublayers and lockedLayers that of locked ones, while a hidden or locked object or group keeps its type out. Matches never span style runs. When nothing matches, or every match already reads as `replace`, nothing changes and no undo step is recorded.", has_doc, find_replace ), @@ -129,10 +129,19 @@ pub fn specs() -> Vec { "Find Next", ["Edit"], None, - "{find, matchCase?, wholeWord?} select the next text object (after the selected one, wrapping) containing `find` → {id|null}", + "{find, matchCase?: false, wholeWord?: false, backwards?: false, hiddenLayers?: false, lockedLayers?: false, from?: {id, start, end} (a match this command returned, or the range edit.replaceMatch returned)} find the next match of `find` in the type edit.findReplace reaches and select its type object → {id, start, end (the match's bytes in the object's plain text), index (its place among all the matches, from 1), count, selected} or {id: null, count: 0}. The search visits type objects from the top of the stacking order down and each object's matches in reading order; backwards visits the objects from the bottom up and each object's matches from the last. It goes on after `from` and, past the last match, starts again at the first. Without `from` it goes on after the first selected type object, and with no type selected it starts at the first match. A match on a hidden or locked layer is returned with selected false and the selection stays as it is. Nothing is recorded for undo.", has_doc, find_next ), + cmd!( + "edit.replaceMatch", + "Replace", + [], + None, + "{find, replace?: \"\", matchCase?: false, wholeWord?: false, id, start, end} replace one match of `find`, the bytes start..end of type object id as edit.findNext returns them, with `replace`, as one undo step → {id, start, end (the replacement's bytes; pass them to edit.findNext as `from` to go on), replaced}. Bytes that are no match of `find` are refused. When the match already reads as `replace`, nothing changes, no undo step is recorded and replaced is false.", + has_doc, + replace_one + ), cmd!( "edit.pasteWithoutFormatting", "Paste without Formatting", @@ -1305,14 +1314,9 @@ fn is_word(c: char) -> bool { c.is_alphanumeric() || c == '_' } -/// Byte ranges of `needle` in `hay`. -pub(crate) fn find_all(hay: &str, needle: &str, match_case: bool, whole_word: bool) -> Vec<(usize, usize)> { - find_all_between(hay, needle, match_case, whole_word, None, None) -} - -/// [`find_all`] in run `i` of `runs`: a whole word looks past the run's ends at the characters -/// next to it, so a change of style inside a word is not a word boundary (#5901). Matches stay -/// inside the run. +/// Byte ranges of `needle` in run `i` of `runs`: a whole word looks past the run's ends at the +/// characters next to it, so a change of style inside a word is not a word boundary (#5901). +/// Matches stay inside the run. fn find_in_run(runs: &[TextRun], i: usize, needle: &str, match_case: bool, whole_word: bool) -> Vec<(usize, usize)> { let Some(run) = runs.get(i) else { return vec![] }; let before = runs.get(..i).and_then(|r| r.iter().rev().find_map(|r| r.text.chars().next_back())); @@ -1320,8 +1324,8 @@ fn find_in_run(runs: &[TextRun], i: usize, needle: &str, match_case: bool, whole find_all_between(&run.text, needle, match_case, whole_word, before, after) } -/// [`find_all`], with `before` and `after` the characters on either side of `hay` (none at the -/// text's ends), which a whole word must not touch either. +/// Byte ranges of `needle` in `hay`, with `before` and `after` the characters on either side of +/// `hay` (none at the text's ends), which a whole word must not touch either. fn find_all_between(hay: &str, needle: &str, match_case: bool, whole_word: bool, before: Option, after: Option) -> Vec<(usize, usize)> { let nc: Vec = needle.chars().collect(); if nc.is_empty() { @@ -1353,102 +1357,232 @@ fn find_all_between(hay: &str, needle: &str, match_case: bool, whole_word: bool, /// The visible, unlocked type objects of visible, unlocked layers, off locked artboards, in paint /// order: the text Find and Replace and Check Spelling go through. pub(crate) fn all_texts(d: &Document) -> Vec { - fn visit(n: &Node, locks: &LockedArtboards<'_>, v: &mut Vec) { - if !n.visible || n.locked { + searched_texts(d, false, false) +} + +/// [`all_texts`], with the type of hidden layers (`hidden_layers`) and of locked layers +/// (`locked_layers`) as well, as Check Hidden Layers and Check Locked Layers of Find and Replace +/// ask. The switches are about layers and sublayers: a hidden or locked object or group keeps its +/// type out, and so does a locked artboard. +fn searched_texts(d: &Document, hidden_layers: bool, locked_layers: bool) -> Vec { + fn visit(n: &Node, locks: &LockedArtboards<'_>, layers: (bool, bool), v: &mut Vec) { + let layer = matches!(n.kind, NodeKind::Layer { .. }); + if (!n.visible && !(layer && layers.0)) || (n.locked && !(layer && layers.1)) { return; } if matches!(n.kind, NodeKind::Text(_)) && !locks.holds_id(n.id) { v.push(n.id); } for c in n.children().into_iter().flatten() { - visit(c, locks, v); + visit(c, locks, layers, v); } } let mut v = vec![]; let locks = d.locked_artboards(); for l in &d.layers { - visit(l, &locks, &mut v); + visit(l, &locks, (hidden_layers, locked_layers), &mut v); } v } +/// What Find and Replace looks for: the text, Match Case and Find Whole Word. +struct Query { + find: String, + match_case: bool, + whole_word: bool, +} + +impl Query { + /// The `find`, `matchCase` and `wholeWord` params of command `c`. An empty or missing `find` + /// is an error. + fn of(p: &Value, c: &str) -> Result { + let find = text_param(p, "find", c)?.filter(|f| !f.is_empty()).ok_or_else(|| bad(c, "missing `find`"))?.to_string(); + Ok(Self { find, match_case: switch_or(p, "matchCase", false, c)?, whole_word: switch_or(p, "wholeWord", false, c)? }) + } + + /// The matches in `t`, in reading order, each as (run, start, end) with `start..end` the bytes + /// of the match in the object's plain text. A match stays inside one style run, and an inline + /// graphic is art, not characters to find. + fn matches(&self, t: &TextObject) -> Vec<(usize, usize, usize)> { + let mut hits = vec![]; + let mut base = 0; + for (ri, r) in t.runs.iter().enumerate() { + if r.inline.is_none() { + hits.extend( + find_in_run(&t.runs, ri, &self.find, self.match_case, self.whole_word).into_iter().map(|(a, b)| (ri, base + a, base + b)), + ); + } + base += r.text.len(); + } + hits + } +} + +/// Replace bytes `start..end` of the plain text of `t`, which lie inside run `run`, with `rep`. +/// The paragraph styles and the ruby follow the edit, as `text.editRange` moves them. The caller +/// refreshes the bounds. +fn replace_match(t: &mut TextObject, run: usize, start: usize, end: usize, rep: &str) { + let base: usize = t.runs.iter().take(run).map(|r| r.text.len()).sum(); + let (Some(a), Some(b)) = (start.checked_sub(base), end.checked_sub(base)) else { return }; + if !t.runs.get(run).is_some_and(|r| a <= b && r.text.is_char_boundary(a) && r.text.is_char_boundary(b)) { + return; + } + t.splice_paras(start, end, rep); + if let Some(r) = t.runs.get_mut(run) { + r.text.replace_range(a..b, rep); + } + t.ruby_after_replace(start, end, rep.len()); +} + fn find_replace(s: &mut Session, p: &Value) -> Result { const C: &str = "edit.findReplace"; - let find = text_param(p, "find", C)?.filter(|f| !f.is_empty()).ok_or_else(|| bad(C, "missing `find`"))?.to_string(); + let q = Query::of(p, C)?; let rep = text_param(p, "replace", C)?.unwrap_or("").to_string(); - let (mc, ww) = (switch_or(p, "matchCase", false, C)?, switch_or(p, "wholeWord", false, C)?); + let (hidden, locked) = (switch_or(p, "hiddenLayers", false, C)?, switch_or(p, "lockedLayers", false, C)?); let ids = match p.get("ids").filter(|v| !v.is_null()) { Some(_) => text_ids(&s.doc()?.doc, &checked_ids_param(s, p, "ids", C)?), - None => all_texts(&s.doc()?.doc), + None => searched_texts(&s.doc()?.doc, hidden, locked), }; let st = s.doc()?; - let total: usize = ids + // Every match, and the matches that do not already read as the replacement. + let (total, replaced) = ids .iter() .filter_map(|id| match &st.doc.node(*id)?.kind { - NodeKind::Text(t) => Some((0..t.runs.len()).map(|i| find_in_run(&t.runs, i, &find, mc, ww).len()).sum::()), + NodeKind::Text(t) => { + let plain = t.plain_text(); + let hits = q.matches(t); + Some((hits.len(), hits.iter().filter(|(_, a, b)| plain.get(*a..*b) != Some(rep.as_str())).count())) + } _ => None, }) - .sum(); - if total == 0 { - return Ok(json!({ "count": 0 })); + .fold((0, 0), |(n, r), (hn, hr)| (n + hn, r + hr)); + if replaced == 0 { + return Ok(json!({ "count": total, "replaced": 0 })); } super::overprint::edit_counted(s, "Replace", |d| { let mut changed = 0; for id in &ids { let Some(NodeKind::Text(t)) = d.node_mut(*id).map(|n| &mut n.kind) else { continue }; - // Matches as (run, start, end) with offsets inside the run. Inline graphics are art, not - // characters to rewrite. - let mut hits = vec![]; - let mut base = 0; - for (ri, r) in t.runs.iter().enumerate() { - if r.inline.is_none() { - for (a, b) in find_in_run(&t.runs, ri, &find, mc, ww) { - if r.text.get(a..b) != Some(rep.as_str()) { - hits.push((ri, base + a, base + b, a, b)); - } - } - } - base += r.text.len(); - } + let plain = t.plain_text(); + let hits: Vec<_> = q.matches(t).into_iter().filter(|(_, a, b)| plain.get(*a..*b) != Some(rep.as_str())).collect(); if hits.is_empty() { continue; } - // Last match first, so the offsets of earlier ones stay valid. The paragraph styles follow - // each edit, as `text.editRange` does. - for (ri, ta, tb, a, b) in hits.into_iter().rev() { - t.splice_paras(ta, tb, &rep); - if let Some(r) = t.runs.get_mut(ri) { - r.text.replace_range(a..b, &rep); - } + // Last match first, so the offsets of earlier ones stay valid. + for (ri, a, b) in hits.into_iter().rev() { + replace_match(t, ri, a, b, &rep); } changed += 1; refresh_bounds(t); } Ok(changed) })?; - Ok(json!({ "count": total })) + Ok(json!({ "count": total, "replaced": replaced })) +} + +/// A match of Find and Replace: bytes `start..end` of the plain text of type object `id`. +#[derive(Clone, Copy)] +struct Match { + id: NodeId, + start: usize, + end: usize, +} + +impl Match { + /// The `id`, `start` and `end` that `p` gives for a match, under command `c`: an object id and + /// two byte offsets, put in order as `text.editRange` orders its own. + fn of(p: &Value, c: &str) -> Result { + let whole = |key: &str| index_opt(p, key, c)?.ok_or_else(|| bad(c, format!("missing `{key}`"))); + let id = object_param(p, "id", c)?.ok_or_else(|| bad(c, "missing `id`"))?; + let (start, end) = (whole("start")?, whole("end")?); + Ok(Self { id, start: start.min(end), end: start.max(end) }) + } } fn find_next(s: &mut Session, p: &Value) -> Result { const C: &str = "edit.findNext"; - let find = text_param(p, "find", C)?.filter(|f| !f.is_empty()).ok_or_else(|| bad(C, "missing `find`"))?.to_string(); - let (mc, ww) = (switch_or(p, "matchCase", false, C)?, switch_or(p, "wholeWord", false, C)?); + let q = Query::of(p, C)?; + let backwards = switch_or(p, "backwards", false, C)?; + let (hidden, locked) = (switch_or(p, "hiddenLayers", false, C)?, switch_or(p, "lockedLayers", false, C)?); + // A `from` that is no object gives no `id`, and is refused as one without it. + let from = match p.get("from") { + None | Some(Value::Null) => None, + Some(v) => Some(Match::of(v, C)?), + }; let st = s.doc()?; - let all = all_texts(&st.doc); - let cur = st.selection.objects.first().and_then(|id| all.iter().position(|x| x == id)); - let n = all.len(); - let start = cur.map(|c| c + 1).unwrap_or(0); - let hit = (0..n).map(|k| all[(start + k) % n.max(1)]).find(|id| match st.doc.node(*id).map(|n| &n.kind) { - Some(NodeKind::Text(t)) => !find_all(&t.plain_text(), &find, mc, ww).is_empty(), - _ => false, - }); - match hit { - Some(id) => { - s.select(|_, sel| sel.set([id]))?; - Ok(json!({ "id": id.0 })) - } - None => Ok(json!({ "id": null })), + // The objects in the order the search visits them: from the top of the stacking order down, + // or with Search Backwards from the bottom up. + let mut order = searched_texts(&st.doc, hidden, locked); + if !backwards { + order.reverse(); } + // Every match in that order as (object's place, match): inside an object in reading order, or + // with Search Backwards from its end. + let mut all: Vec<(usize, Match)> = vec![]; + for (place, id) in order.iter().enumerate() { + let Some(NodeKind::Text(t)) = st.doc.node(*id).map(|n| &n.kind) else { continue }; + let mut hits = q.matches(t); + if backwards { + hits.reverse(); + } + all.extend(hits.into_iter().map(|(_, start, end)| (place, Match { id: *id, start, end }))); + } + if all.is_empty() { + return Ok(json!({ "id": null, "count": 0 })); + } + // The search goes on from `from`, or from the whole of the first selected type object it + // visits, so that the same call again reaches the next object. From anywhere else it starts + // at the first match. + let from = from.or_else(|| { + st.selection.objects.iter().filter(|id| order.contains(id)).find_map(|id| match &st.doc.node(*id)?.kind { + NodeKind::Text(t) => Some(Match { id: *id, start: 0, end: t.runs.iter().map(|r| r.text.len()).sum() }), + _ => None, + }) + }); + let after = |(place, m): &(usize, Match), at: usize, f: &Match| { + *place > at || (*place == at && if backwards { m.end <= f.start } else { m.start >= f.end }) + }; + let k = from + .and_then(|f| order.iter().position(|id| *id == f.id).map(|at| (at, f))) + .and_then(|(at, f)| all.iter().position(|hit| after(hit, at, &f))) + .unwrap_or(0); + let Some((_, m)) = all.get(k).copied() else { return Ok(json!({ "id": null, "count": 0 })) }; + let count = all.len(); + // Type that a selection tool can't reach (on a hidden or locked layer) is found without being + // selected. + let selected = all_texts(&st.doc).contains(&m.id); + if selected && st.selection.objects != [m.id] { + s.select(|_, sel| sel.set([m.id]))?; + } + let index = if backwards { count - k } else { k + 1 }; + Ok(json!({ "id": m.id.0, "start": m.start, "end": m.end, "index": index, "count": count, "selected": selected })) +} + +fn replace_one(s: &mut Session, p: &Value) -> Result { + const C: &str = "edit.replaceMatch"; + let q = Query::of(p, C)?; + let rep = text_param(p, "replace", C)?.unwrap_or("").to_string(); + let m = Match::of(p, C)?; + let st = s.doc()?; + let t = match st.doc.node(m.id).map(|n| &n.kind) { + Some(NodeKind::Text(t)) => t, + Some(_) => return Err(bad(C, format!("node {} is not text", m.id.0))), + None => return Err(EngineError::NoNode(m.id)), + }; + let Some((run, ..)) = q.matches(t).into_iter().find(|(_, a, b)| (*a, *b) == (m.start, m.end)) else { + return Err(bad(C, format!("no match of `find` at bytes {}..{} of object {}", m.start, m.end, m.id.0))); + }; + let end = m.start + rep.len(); + if t.plain_text().get(m.start..m.end) == Some(rep.as_str()) { + return Ok(json!({ "id": m.id.0, "start": m.start, "end": end, "replaced": false })); + } + s.edit("Replace", |d, _| { + let Some(NodeKind::Text(t)) = d.node_mut(m.id).map(|n| &mut n.kind) else { return Err(EngineError::NoNode(m.id)) }; + replace_match(t, run, m.start, m.end, &rep); + refresh_bounds(t); + Ok(()) + })?; + Ok(json!({ "id": m.id.0, "start": m.start, "end": end, "replaced": true })) } // ---------- Paste without Formatting ---------- diff --git a/crates/engine/src/tests/ids_without_selection.rs b/crates/engine/src/tests/ids_without_selection.rs index b274e7956f..9a48655468 100644 --- a/crates/engine/src/tests/ids_without_selection.rs +++ b/crates/engine/src/tests/ids_without_selection.rs @@ -377,7 +377,7 @@ fn ids_cases(d: u64) -> Vec<(&'static str, &'static str, serde_json::Value, Unse ("addon.color.filter", "ids", json!({"effect": "addon.color.invert"}), Selected), ("addon.color.applyNearestSwatch", "ids", json!({}), Selected), ("edit.colors.overprintBlack", "ids", json!({}), Selected), - ("edit.findReplace", "ids", json!({"find": "A", "replace": "B"}), Gives(json!({"count": 1}))), + ("edit.findReplace", "ids", json!({"find": "A", "replace": "B"}), Gives(json!({"count": 1, "replaced": 1}))), ("layer.highlight", "ids", json!({}), Fails("missing ids")), ("layer.move", "ids", json!({ "target": d }), Fails("missing ids")), ("library.add", "ids", json!({"kind": "graphic"}), Selected), diff --git a/crates/engine/src/tests/menucmds.rs b/crates/engine/src/tests/menucmds.rs index abb0bf31eb..939f36269c 100644 --- a/crates/engine/src/tests/menucmds.rs +++ b/crates/engine/src/tests/menucmds.rs @@ -2140,7 +2140,8 @@ fn find_and_replace_leaves_type_on_a_locked_artboard() { /// Find and Replace that replaces each match with the text it is (`CAT` found in `cat`, ignoring /// case, and replaced by `cat`) records no undo step: the step to redo stays and the document stays -/// unmodified. It still replies with the count. A replacement that changes the text is one undo step. +/// unmodified. It still replies with the count, and with no match replaced. A replacement that +/// changes the text is one undo step. #[test] fn find_and_replace_that_changes_nothing_records_no_undo_step() { let mut s = session(); @@ -2148,9 +2149,9 @@ fn find_and_replace_that_changes_nothing_records_no_undo_step() { select_with_a_step_to_redo(&mut s, &[a]); let before = history(&s); assert_eq!((before.1, before.2), (1, false), "a step to redo, and nothing unsaved"); - assert_eq!(s.execute("edit.findReplace", &json!({"find": "CAT", "replace": "cat"})).unwrap(), json!({"count": 2})); + assert_eq!(s.execute("edit.findReplace", &json!({"find": "CAT", "replace": "cat"})).unwrap(), json!({"count": 2, "replaced": 0})); assert_eq!((history(&s), plain(&s, a)), (before, "cat cat".to_string())); - assert_eq!(s.execute("edit.findReplace", &json!({"find": "cat", "replace": "dog"})).unwrap(), json!({"count": 2})); + assert_eq!(s.execute("edit.findReplace", &json!({"find": "cat", "replace": "dog"})).unwrap(), json!({"count": 2, "replaced": 2})); assert_eq!((history(&s), plain(&s, a)), ((before.0 + 1, 0, true), "dog dog".to_string())); } @@ -2187,12 +2188,186 @@ fn find_next_cycles_through_text_objects() { let _ = text(&mut s, "banana"); let c = text(&mut s, "pineapple"); s.execute("select.none", &json!({})).unwrap(); - assert_eq!(id_of(&s.execute("edit.findNext", &json!({"find": "APPLE"})).unwrap()), a); + // From the top of the stacking order down, then round again. + assert_eq!(id_of(&s.execute("edit.findNext", &json!({"find": "APPLE"})).unwrap()), c); + assert_eq!(id_of(&s.execute("edit.findNext", &json!({"find": "apple"})).unwrap()), a); assert_eq!(id_of(&s.execute("edit.findNext", &json!({"find": "apple"})).unwrap()), c); + // A selection that starts with a shape goes on after its first type object. + let shape = rect(&mut s, 300.0, 300.0, 20.0, 20.0); + sel(&mut s, &[shape, c]); assert_eq!(id_of(&s.execute("edit.findNext", &json!({"find": "apple"})).unwrap()), a); assert!(s.execute("edit.findNext", &json!({"find": "zzz"})).unwrap()["id"].is_null()); } +/// The match `r` (an `edit.findNext` result) as (object, start, end, index, count). +fn found(r: &Value) -> (u64, u64, u64, u64, u64) { + let n = |k: &str| r[k].as_u64().unwrap_or_else(|| panic!("no `{k}` in {r}")); + (n("id"), n("start"), n("end"), n("index"), n("count")) +} + +/// Find Next steps through the matches one by one when each call is given the match before it: +/// the objects from the top of the stacking order down, each object's matches in reading order, +/// and round again after the last. Search Backwards visits them the other way. Each match is +/// returned with its bytes and its object is selected; nothing is recorded for undo. +#[test] +fn find_next_steps_through_the_matches_in_both_directions() { + let mut s = session(); + let bottom = text(&mut s, "cat éa cat"); + let _ = text(&mut s, "dog"); + let top = text(&mut s, "a cat"); + s.execute("select.none", &json!({})).unwrap(); + let before = history(&s); + let step = |s: &mut Session, from: &Value, backwards: bool| { + let from = if from.is_null() { Value::Null } else { json!({"id": from["id"], "start": from["start"], "end": from["end"]}) }; + s.execute("edit.findNext", &json!({"find": "cat", "from": from, "backwards": backwards})).unwrap() + }; + // "é" is two bytes, so the second match of the bottom object is at bytes 8..11. + let forward = [(top.0, 2, 5, 1, 3), (bottom.0, 0, 3, 2, 3), (bottom.0, 8, 11, 3, 3), (top.0, 2, 5, 1, 3)]; + let mut at = Value::Null; + for want in forward { + at = step(&mut s, &at, false); + assert_eq!((found(&at), selected(&s), at["selected"].clone()), (want, vec![NodeId(want.0)], json!(true))); + } + let backward = [(bottom.0, 8, 11, 3, 3), (bottom.0, 0, 3, 2, 3), (top.0, 2, 5, 1, 3), (bottom.0, 8, 11, 3, 3)]; + s.execute("select.none", &json!({})).unwrap(); + let mut at = Value::Null; + for want in backward { + at = step(&mut s, &at, true); + assert_eq!((found(&at), selected(&s)), (want, vec![NodeId(want.0)])); + } + assert_eq!(history(&s), before, "finding is no undo step"); + // A `from` in an object the search does not visit starts at the first match. + let r = s.execute("edit.findNext", &json!({"find": "cat", "from": {"id": 999_999, "start": 0, "end": 0}})).unwrap(); + assert_eq!(found(&r), (top.0, 2, 5, 1, 3)); + // Nothing found: no match, and the selection stays. + let r = s.execute("edit.findNext", &json!({"find": "zebra"})).unwrap(); + assert_eq!((r, selected(&s)), (json!({"id": null, "count": 0}), vec![top])); +} + +/// Check Hidden Layers and Check Locked Layers: Find Next and Find and Replace leave the type of +/// a hidden layer and of a locked layer alone unless the switch for it is on. A match on such a +/// layer is returned without being selected. A hidden or locked object keeps its type out with +/// the switches on. +#[test] +fn find_and_replace_reach_hidden_and_locked_layers_only_when_asked() { + for (prop, switch, other) in [("visible", "hiddenLayers", "lockedLayers"), ("locked", "lockedLayers", "hiddenLayers")] { + let mut s = session(); + let open = text(&mut s, "cat one"); + let layer = id_of(&s.execute("layer.new", &json!({})).unwrap()); + let closed = text(&mut s, "cat two"); + let object = text(&mut s, "cat three"); + let off = |id: NodeId| if prop == "visible" { json!({"id": id.0, "visible": false}) } else { json!({"id": id.0, "locked": true}) }; + s.execute("object.setProps", &off(object)).unwrap(); + s.execute("layer.setProps", &off(layer)).unwrap(); + sel(&mut s, &[open]); + // Without the switch, and with only the other one, the one reachable match is found. + for p in [json!({"find": "cat"}), json!({"find": "cat", other: true})] { + let r = s.execute("edit.findNext", &p).unwrap(); + assert_eq!(found(&r), (open.0, 0, 3, 1, 1), "{prop} {p}"); + } + // With it, the layer's type is searched (it is above, so it comes first) and not selected. + s.execute("select.none", &json!({})).unwrap(); + let r = s.execute("edit.findNext", &json!({"find": "cat", switch: true})).unwrap(); + assert_eq!((found(&r), r["selected"].clone(), selected(&s)), ((closed.0, 0, 3, 1, 2), json!(false), vec![]), "{prop}"); + let r = s.execute("edit.findNext", &json!({"find": "cat", switch: true, "from": {"id": closed.0, "start": 0, "end": 3}})).unwrap(); + assert_eq!((found(&r), r["selected"].clone(), selected(&s)), ((open.0, 0, 3, 2, 2), json!(true), vec![open]), "{prop}"); + // Replace All: the same reach. + let n = undo_len(&s); + assert_eq!( + s.execute("edit.findReplace", &json!({"find": "cat", "replace": "dog", other: true})).unwrap(), + json!({"count": 1, "replaced": 1}), + "{prop}" + ); + assert_eq!((plain(&s, open), plain(&s, closed), plain(&s, object)), ("dog one".into(), "cat two".into(), "cat three".into()), "{prop}"); + assert_eq!( + s.execute("edit.findReplace", &json!({"find": "cat", "replace": "dog", switch: true})).unwrap(), + json!({"count": 1, "replaced": 1}), + "{prop}" + ); + assert_eq!((plain(&s, closed), plain(&s, object), undo_len(&s)), ("dog two".into(), "cat three".into(), n + 2), "{prop}"); + } +} + +/// Replace changes one match, the bytes Find Next returned, as one undo step, and returns the +/// replacement's bytes to go on from. Bytes that are no match are refused, and a match that +/// already reads as the replacement is left with no undo step. +#[test] +fn replace_match_replaces_the_one_match_found() { + let mut s = session(); + let t = text(&mut s, "cat cat Cat"); + s.execute("select.none", &json!({})).unwrap(); + let first = s.execute("edit.findNext", &json!({"find": "cat"})).unwrap(); + assert_eq!(found(&first), (t.0, 0, 3, 1, 3)); + let n = undo_len(&s); + let r = s.execute("edit.replaceMatch", &json!({"find": "cat", "replace": "horse", "id": t.0, "start": 0, "end": 3})).unwrap(); + assert_eq!(r, json!({"id": t.0, "start": 0, "end": 5, "replaced": true})); + assert_eq!((plain(&s, t), undo_len(&s)), ("horse cat Cat".to_string(), n + 1)); + // Replace & Find: on from the replacement, so text put in is not searched again. + let r = s.execute("edit.replaceMatch", &json!({"find": "cat", "replace": "a cat", "id": t.0, "start": 6, "end": 9})).unwrap(); + let next = s.execute("edit.findNext", &json!({"find": "cat", "from": {"id": r["id"], "start": r["start"], "end": r["end"]}})).unwrap(); + assert_eq!((plain(&s, t), found(&next)), ("horse a cat Cat".to_string(), (t.0, 12, 15, 2, 2))); + // Match Case decides what a match is. + let shape = rect(&mut s, 300.0, 300.0, 20.0, 20.0); + s.execute("select.none", &json!({})).unwrap(); + let before = (history(&s), plain(&s, t)); + for (p, want) in [ + (json!({"find": "cat", "replace": "x", "matchCase": true, "id": t.0, "start": 12, "end": 15}), "at bytes 12..15 of object"), + (json!({"find": "cat", "replace": "x", "id": t.0, "start": 1, "end": 4}), "at bytes 1..4 of object"), + (json!({"find": "cat", "replace": "x", "id": t.0, "start": 4, "end": 1}), "at bytes 1..4 of object"), + (json!({"find": "cat", "replace": "x", "id": t.0, "start": 0}), "missing `end`"), + (json!({"find": "cat", "replace": "x", "start": 0, "end": 3}), "missing `id`"), + (json!({"find": "cat", "replace": "x", "id": t.0, "start": "0", "end": 3}), "`start` must be a whole number"), + (json!({"find": "", "replace": "x", "id": t.0, "start": 0, "end": 3}), "missing `find`"), + (json!({"find": "cat", "replace": 5, "id": t.0, "start": 8, "end": 11}), "`replace` must be a string"), + (json!({"find": "cat", "replace": "x", "id": shape.0, "start": 0, "end": 3}), "is not text"), + ] { + let r = s.execute("edit.replaceMatch", &p); + assert!(matches!(&r, Err(EngineError::BadParams { msg, .. }) if msg.contains(want)), "{p}: {r:?}"); + assert_eq!((history(&s), plain(&s, t)), before, "{p}"); + } + let r = s.execute("edit.replaceMatch", &json!({"find": "cat", "replace": "x", "id": 999_999, "start": 0, "end": 3})); + assert!(matches!(r, Err(EngineError::NoNode(NodeId(999_999)))), "{r:?}"); + // A match that already reads as the replacement: nothing to undo. + let r = s.execute("edit.replaceMatch", &json!({"find": "CAT", "replace": "Cat", "id": t.0, "start": 12, "end": 15})).unwrap(); + assert_eq!((r, history(&s)), (json!({"id": t.0, "start": 12, "end": 15, "replaced": false}), before.0)); + // Find Next refuses a `from` that is not a match. + for (from, want) in [ + (json!(5), "missing `id`"), + (json!({"id": t.0, "start": 2}), "missing `end`"), + (json!({"id": "x", "start": 0, "end": 1}), "`id` must be a whole number"), + ] { + let r = s.execute("edit.findNext", &json!({"find": "cat", "from": from})); + assert!(matches!(&r, Err(EngineError::BadParams { msg, .. }) if msg.contains(want)), "{from}: {r:?}"); + } + for key in ["backwards", "hiddenLayers", "lockedLayers"] { + let r = s.execute("edit.findNext", &json!({"find": "cat", key: "yes"})); + assert!(matches!(&r, Err(EngineError::BadParams { msg, .. }) if *msg == format!("`{key}` must be true or false")), "{key}: {r:?}"); + } + for key in ["hiddenLayers", "lockedLayers"] { + let r = s.execute("edit.findReplace", &json!({"find": "cat", key: 1})); + assert!(matches!(&r, Err(EngineError::BadParams { msg, .. }) if *msg == format!("`{key}` must be true or false")), "{key}: {r:?}"); + } +} + +/// Ruby over text after a replaced match moves with the text, for Replace and for Replace All, as +/// it does when the text is typed. +#[test] +fn find_and_replace_moves_the_ruby_after_a_match() { + for all in [false, true] { + let mut s = session(); + let t = text(&mut s, "ab 漢字"); + sel(&mut s, &[t]); + s.execute("type.ruby", &json!({"text": "かんじ", "start": 3, "end": 9})).unwrap(); + if all { + s.execute("edit.findReplace", &json!({"find": "ab", "replace": "abcd"})).unwrap(); + } else { + s.execute("edit.replaceMatch", &json!({"find": "ab", "replace": "abcd", "id": t.0, "start": 0, "end": 2})).unwrap(); + } + let NodeKind::Text(tt) = &node(&s, t).kind else { panic!() }; + assert_eq!((tt.plain_text().as_str(), tt.ruby.first().map(|r| (r.start, r.end))), ("abcd 漢字", Some((5, 11))), "all: {all}"); + } +} + /// The Type menu's commands and Find and Replace and Find Next refuse a param of the wrong type, or /// `ids` that name no object, with an error naming the param, and leave the text, the selection and /// the undo history as they were, even when Insert Character is also given a source it would use diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 616a11498d..8bc2cf9d36 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -801,7 +801,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{effect: id, index?: int (edit that applied effect in place, prefilled; OK runs effect.setParams), item?: appearance item index|null (the fill/stroke whose effects, null the object's; default: the Appearance panel's active item), aligned?: bool (index and item are rows of the first selected object's stack, which OK edits in each object where it has them, as effect.setParams does)} open the effect's dialog with live preview; without `index`, an effect already in that list first opens `effectExists` (confirm edits it, discard adds another) → {pending: \"effectExists\"}", ), - ("ui.paramDialog", "Command Dialog", "", "{command, label?, params} open a parameter dialog for any command"), + ( + "ui.paramDialog", + "Command Dialog", + "", + "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place, and Edit › Find Next goes on from it in the same document while the dialog is closed", + ), ( "ui.recolorDialog", "Recolor Artwork…", diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 5afad21b0d..5a0b3da355 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -47,6 +47,7 @@ mod export_for_screens; pub mod eyedropper; pub mod file_info; pub mod find_links; +pub mod find_replace; pub mod flare_options; pub mod flatten; pub mod flattener_presets; @@ -387,6 +388,7 @@ registry! { MissingLinks: [missing_links::KIND] => missing_links::SPEC, MissingFonts: [missing_fonts::KIND] => missing_fonts::SPEC, FindLinks: [find_links::KIND] => find_links::SPEC, + FindReplace: [find_replace::KIND] => find_replace::SPEC, TextImport: [text_import::KIND] => text_import::SPEC, PdfPresets: [pdf_presets::KIND] => pdf_presets::SPEC, PdfPreset: [save_pdf::PRESET_KIND] => save_pdf::PRESET_SPEC, diff --git a/crates/ui-egui/src/dialogs/find_replace.rs b/crates/ui-egui/src/dialogs/find_replace.rs new file mode 100644 index 0000000000..a43e737e18 --- /dev/null +++ b/crates/ui-egui/src/dialogs/find_replace.rs @@ -0,0 +1,358 @@ +//! Edit › Find and Replace…: the Find and Replace With fields, Match Case, Find Whole Word, Search +//! Backwards, Check Hidden Layers and Check Locked Layers, and the Find, Replace, Replace & Find, +//! Replace All and Done buttons, as "Find and replace text" in the public +//! [reference](https://helpx.adobe.com/pdf/illustrator_reference.pdf) describes them. The dialog +//! stays open: Find goes to the next match (`edit.findNext`), Replace changes that match +//! (`edit.replaceMatch`), Replace & Find changes it and goes to the next, and Replace All changes +//! every match (`edit.findReplace`). Each Replace is one undo step, and so is Replace All. +//! +//! These rules are VectorCraft's own. A match is shown in the dialog in its line of text with its +//! place among the matches, and its type object is selected, unless it is on a hidden or locked +//! layer. Enter runs Find. Replace and Replace & Find wait for a match that Find reached with the +//! Find text and the options as they are now. Edit › Find Next goes on from the last search while +//! the dialog is closed, and opens the dialog when there has been none. +//! +//! Fields: `find`, `replace`, `matchCase`, `wholeWord`, `backwards`, `hiddenLayers`, +//! `lockedLayers` and `action` (what `ui.dialog.confirm` does: `find`, `replace`, `replaceFind`, +//! `replaceAll` or `done`; a button sets it and confirms). The dialog keeps the place the search +//! reached in `__at`, the `uid` of its document in `__doc` and the Find text and switches it was +//! reached with in `__atQuery`, the match found in `__found` and the line under the fields in +//! `__note`. A place in a document other than the active one, or reached with other Find text or +//! switches, is not used: the search starts again. + +use serde_json::{Map, Value, json}; +use vectorcraft_doc::{NodeId, NodeKind}; + +use super::{DialogAction, DialogSpec, form}; +use crate::state::Dialog; +use crate::{VectorcraftApp, widgets}; + +/// The dialog kind of Find and Replace. +pub const KIND: &str = "findReplace"; + +/// The command of its menu item, which Replace All runs. +pub const COMMAND: &str = "edit.findReplace"; + +/// The command Find runs, and Edit › Find Next. +pub const NEXT: &str = "edit.findNext"; + +/// The command Replace runs. +const REPLACE: &str = "edit.replaceMatch"; + +/// The switches that decide what a match is and which type is searched. +const SWITCHES: [&str; 4] = ["matchCase", "wholeWord", "hiddenLayers", "lockedLayers"]; + +/// The place the search reached: `{id, start, end}`, a match or the text that replaced one. +const AT: &str = "__at"; +/// The match Find reached, which Replace changes: `{index, count, query}`, with `query` the Find +/// text and the switches it was found with. +const FOUND: &str = "__found"; +/// The line under the fields, in English: no matches, or how many Replace All replaced. +const NOTE: &str = "__note"; + +/// The characters of a match's line shown on either side of it. +const CONTEXT: usize = 24; + +pub(super) const SPEC: DialogSpec = DialogSpec { + heading: |_| tl!("Find and Replace").into(), + body_with_actions: Some(body), + confirm, + ok: None, + min_width: 480.0, + ..DialogSpec::FORM +}; + +/// The document a place in [`AT`] or the last search's `from` belongs to: its `uid`. +const DOC: &str = "__doc"; +/// The Find text and switches the place in [`AT`] was reached with ([`query`]). +const AT_QUERY: &str = "__atQuery"; + +/// The params of the Edit menu's Find and Replace… item: a `find` of null, which gives the dialog +/// no field, so that it opens on the last search. +pub fn menu_params() -> Value { + json!({"find": null}) +} + +/// The `uid` of the active document. +fn active_uid(app: &VectorcraftApp) -> Option { + app.session.active().map(|d| d.uid) +} + +/// Open Find and Replace on the last search when there has been one, with the fields that +/// `params` gives in its place. A value of another type than the field's, such as the menu item's +/// null `find` ([`menu_params`]), gives none. +pub fn open(app: &mut VectorcraftApp, params: &Map) -> Result { + let mut fields = Map::new(); + fields.insert("find".into(), json!("")); + fields.insert("replace".into(), json!("")); + for key in SWITCHES.into_iter().chain(["backwards"]) { + fields.insert(key.into(), json!(false)); + } + let last = app.ui.last_find.as_ref().and_then(Value::as_object).cloned().unwrap_or_default(); + for (k, v) in last.iter().chain(params) { + // Only the dialog's own fields, each of its own type. + if fields.get(k).is_some_and(|f| f.is_string() == v.is_string() && f.is_boolean() == v.is_boolean()) { + fields.insert(k.clone(), v.clone()); + } + } + // The place the last search reached, while its document is the active one. + let uid = active_uid(app); + if let Some(at) = last.get("from").filter(|v| v.is_object() && uid.is_some() && last.get("doc").and_then(Value::as_u64) == uid) { + fields.insert(AT.into(), at.clone()); + fields.insert(DOC.into(), json!(uid)); + fields.insert(AT_QUERY.into(), query_in(&last)); + } + fields.insert("action".into(), json!("find")); + fields.insert("__command".into(), json!(COMMAND)); + app.ui.dialog = Some(Dialog { kind: KIND.into(), fields }); + Ok(Value::Null) +} + +/// Edit › Find Next with no text to find: the next match of the last search, from the place it +/// reached, with the options the dialog had. With no search yet, it opens the dialog. +pub fn find_next(app: &mut VectorcraftApp) -> Result { + let Some(mut last) = app.ui.last_find.clone().filter(|l| l.get("find").and_then(Value::as_str).is_some_and(|f| !f.is_empty())) else { + return open(app, &Map::new()); + }; + let uid = active_uid(app); + if let Some(o) = last.as_object_mut() { + o.remove("replace"); + // A place in another document is no place in this one. + if uid.is_none() || o.remove("doc").and_then(|d| d.as_u64()) != uid { + o.remove("from"); + } + } + let r = app.run(NEXT, last)?; + if r["id"].is_null() { + app.status("No matches found"); + return Ok(r); + } + if let Some(l) = app.ui.last_find.as_mut() { + l["from"] = json!({ "id": r["id"], "start": r["start"], "end": r["end"] }); + l["doc"] = json!(uid); + } + Ok(r) +} + +/// The Find text and the switches of [`SWITCHES`]: what a match is, as params. +fn query(d: &Dialog) -> Value { + query_in(&d.fields) +} + +/// [`query`] of the dialog fields, or of the last search, in `fields`. +fn query_in(fields: &Map) -> Value { + let mut q = json!({ "find": fields.get("find").and_then(Value::as_str).unwrap_or_default() }); + for key in SWITCHES { + q[key] = json!(fields.get(key).and_then(Value::as_bool).unwrap_or(false)); + } + q +} + +/// The place the search reached, `{id, start, end}`, while its document is the active one and +/// the Find text and the switches are those it was reached with. +fn place<'a>(app: &VectorcraftApp, d: &'a Dialog) -> Option<&'a Value> { + let uid = active_uid(app)?; + let same = d.fields.get(DOC).and_then(Value::as_u64) == Some(uid) && d.fields.get(AT_QUERY) == Some(&query(d)); + same.then(|| d.fields.get(AT)).flatten().filter(|at| at.is_object()) +} + +/// Keep `at`, a place in the active document, as the place the search reached. +fn set_place(app: &VectorcraftApp, d: &mut Dialog, at: Value) { + d.fields.insert(AT.into(), at); + d.fields.insert(DOC.into(), json!(active_uid(app))); + d.fields.insert(AT_QUERY.into(), query(d)); +} + +/// The match Replace changes, as `{id, start, end}`: the one Find reached in the active document, +/// while the Find text and the switches are as they were when it was found. +fn current_match<'a>(app: &VectorcraftApp, d: &'a Dialog) -> Option<&'a Value> { + let found = d.fields.get(FOUND)?; + (found.get("query") == Some(&query(d))).then(|| place(app, d)).flatten() +} + +/// Keep what the dialog searched for and the place it reached, for Edit › Find Next and for the +/// next time the dialog opens. +fn remember(app: &mut VectorcraftApp, d: &Dialog) { + let mut last = query(d); + last["replace"] = json!(d.str("replace")); + last["backwards"] = json!(d.bool("backwards")); + if let Some(at) = place(app, d) { + last["from"] = at.clone(); + last["doc"] = json!(active_uid(app)); + } + app.ui.last_find = Some(last); +} + +/// Find: the next match after the place the search reached, kept as that place and as the match +/// Replace changes. With no match, the note says so. +fn find(app: &mut VectorcraftApp, d: &mut Dialog) -> Result { + let mut p = query(d); + p["backwards"] = json!(d.bool("backwards")); + if let Some(at) = place(app, d) { + p["from"] = at.clone(); + } + d.fields.remove(FOUND); + d.fields.remove(NOTE); + let r = app.run(NEXT, p)?; + if r["id"].is_null() { + app.status("No matches found"); + d.fields.insert(NOTE.into(), json!(app.ui.status)); + return Ok(r); + } + set_place(app, d, json!({ "id": r["id"], "start": r["start"], "end": r["end"] })); + d.fields.insert(FOUND.into(), json!({ "index": r["index"], "count": r["count"], "query": query(d) })); + Ok(r) +} + +/// Replace: the match Find reached becomes the Replace With text, and the search goes on from +/// it. With no such match, it finds one. +fn replace(app: &mut VectorcraftApp, d: &mut Dialog) -> Result { + let Some(at) = current_match(app, d).cloned() else { return find(app, d) }; + let mut p = query(d); + for key in ["hiddenLayers", "lockedLayers"] { + if let Some(o) = p.as_object_mut() { + o.remove(key); + } + } + p["replace"] = json!(d.str("replace")); + for key in ["id", "start", "end"] { + p[key] = at[key].clone(); + } + d.fields.remove(FOUND); + d.fields.remove(NOTE); + let r = app.run(REPLACE, p)?; + set_place(app, d, json!({ "id": r["id"], "start": r["start"], "end": r["end"] })); + Ok(r) +} + +/// Replace All: every match becomes the Replace With text, and the note says how many. +fn replace_all(app: &mut VectorcraftApp, d: &mut Dialog) -> Result { + let mut p = query(d); + p["replace"] = json!(d.str("replace")); + d.fields.remove(FOUND); + d.fields.remove(NOTE); + let r = app.run(COMMAND, p)?; + // The matches that changed: those that already read as the Replace With text do not count. + match (r["count"].as_u64().unwrap_or(0), r["replaced"].as_u64().unwrap_or(0)) { + (0, _) => app.status("No matches found"), + (_, n) => app.status(format!("Matches replaced: {n}")), + } + d.fields.insert(NOTE.into(), json!(app.ui.status)); + Ok(r) +} + +/// A button or `ui.dialog.confirm`: run the `action` and keep the dialog open, or close it for +/// `done`. What a command refuses is the note, and the dialog stays open. +fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { + let mut d = d.clone(); + let action = d.fields.insert("action".into(), json!("find")).and_then(|a| a.as_str().map(str::to_string)).unwrap_or_default(); + let r = match action.as_str() { + "done" => { + remember(app, &d); + app.ui.dialog = None; + return Ok(Value::Null); + } + "" | "find" => find(app, &mut d), + "replace" => replace(app, &mut d), + "replaceFind" => match current_match(app, &d) { + Some(_) => replace(app, &mut d).and_then(|_| find(app, &mut d)), + None => find(app, &mut d), + }, + "replaceAll" => replace_all(app, &mut d), + _ => Err("no such action".to_string()), + }; + if let Err(e) = &r { + d.fields.insert(NOTE.into(), json!(e)); + } + remember(app, &d); + app.ui.dialog = Some(d); + r +} + +/// The match Find reached as it reads in its text: (the text before it on its line, the match, +/// the text after it), each at most [`CONTEXT`] characters, and its place among the matches. +fn shown_match(app: &VectorcraftApp, d: &Dialog) -> Option<([String; 3], String)> { + let at = current_match(app, d)?; + let found = d.fields.get(FOUND)?; + let whole = |v: &Value| v.as_u64().and_then(|n| usize::try_from(n).ok()); + let (id, start, end) = (at["id"].as_u64()?, whole(&at["start"])?, whole(&at["end"])?); + let NodeKind::Text(t) = &app.session.active()?.doc.node(NodeId(id))?.kind else { return None }; + let text = t.plain_text(); + let (before, hit, after) = (text.get(..start)?, text.get(start..end)?, text.get(end..)?); + let before = before.rsplit(['\n', '\r']).next().unwrap_or_default(); + let after = after.split(['\n', '\r']).next().unwrap_or_default(); + let skip = before.chars().count().saturating_sub(CONTEXT); + let lead = if skip > 0 { "…" } else { "" }; + let tail = if after.chars().count() > CONTEXT { "…" } else { "" }; + let before = format!("{lead}{}", before.chars().skip(skip).collect::()); + let after = format!("{}{tail}", after.chars().take(CONTEXT).collect::()); + Some(([before, hit.to_string(), after], format!("{} / {}", found["index"], found["count"]))) +} + +fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> DialogAction { + let can_find = !d.str("find").is_empty(); + let found = current_match(app, d).is_some(); + let mut action = None; + ui.horizontal_top(|ui| { + ui.vertical(|ui| { + widgets::dim_label(ui, tl!("Find:")); + form::text(ui, d, "find", 320.0); + ui.add_space(6.0); + widgets::dim_label(ui, tl!("Replace With:")); + form::text(ui, d, "replace", 320.0); + ui.add_space(10.0); + ui.horizontal_top(|ui| { + ui.vertical(|ui| { + form::check(ui, d, "matchCase", "Match Case"); + form::check(ui, d, "wholeWord", "Find Whole Word"); + form::check(ui, d, "backwards", "Search Backwards"); + }); + ui.add_space(16.0); + ui.vertical(|ui| { + form::check(ui, d, "hiddenLayers", "Check Hidden Layers"); + form::check(ui, d, "lockedLayers", "Check Locked Layers"); + }); + }); + }); + ui.add_space(16.0); + ui.vertical(|ui| { + let mut button = |ui: &mut egui::Ui, label: &str, enabled: bool, name: &'static str| { + if ui.add_enabled_ui(enabled, |ui| widgets::flat_button(ui, label, 130.0).clicked()).inner { + action = Some(name); + } + ui.add_space(6.0); + }; + button(ui, if found { tl!("Find Next") } else { tl!("Find") }, can_find, "find"); + button(ui, tl!("Replace"), can_find && found, "replace"); + button(ui, tl!("Replace & Find"), can_find && found, "replaceFind"); + button(ui, tl!("Replace All"), can_find, "replaceAll"); + button(ui, tl!("Done"), true, "done"); + }); + }); + ui.add_space(8.0); + if let Some(([before, hit, after], place)) = shown_match(app, d) { + let t = crate::theme::Tokens::get(ui.ctx()); + ui.horizontal_wrapped(|ui| { + ui.spacing_mut().item_spacing.x = 0.0; + widgets::dim_name(ui, &format!("{place} {before}")); + ui.colored_label(t.text_strong, egui::RichText::new(hit).strong().underline()); + widgets::dim_name(ui, &after); + }); + } else if let Some(note) = d.fields.get(NOTE).and_then(Value::as_str) { + widgets::dim_name(ui, &crate::i18n::message(crate::i18n::current(), note)); + } + // Enter finds, as the Find button does. + if action.is_none() && can_find && crate::shortcuts::pressed_anew(ui.ctx(), egui::Key::Enter) { + action = Some("find"); + } + match action { + Some(name) => { + d.fields.insert("action".into(), json!(name)); + DialogAction::Confirm + } + None => DialogAction::None, + } +} + +#[cfg(test)] +mod tests; diff --git a/crates/ui-egui/src/dialogs/find_replace/tests.rs b/crates/ui-egui/src/dialogs/find_replace/tests.rs new file mode 100644 index 0000000000..a55e1c0085 --- /dev/null +++ b/crates/ui-egui/src/dialogs/find_replace/tests.rs @@ -0,0 +1,377 @@ +use egui::{Event, PointerButton, Pos2, Rect, vec2}; +use serde_json::{Value, json}; +use vectorcraft_doc::{NodeId, NodeKind}; + +use crate::VectorcraftApp; + +/// An app on a document holding point type `texts`, bottom first, with nothing selected → the +/// app and the type objects' ids. +fn app_with(texts: &[&str]) -> (VectorcraftApp, Vec) { + let mut s = vectorcraft_engine::Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 600})).unwrap(); + let ids = texts.iter().map(|t| s.execute("text.create", &json!({"x": 50, "y": 50, "text": t})).unwrap()["id"].as_u64().unwrap()).collect(); + s.execute("select.none", &json!({})).unwrap(); + (VectorcraftApp::new(s, crate::Services::default()), ids) +} + +/// Choose Edit › Find and Replace…, as a click on the menu item does. +fn choose(app: &mut VectorcraftApp) { + let (id, p) = crate::shortcut_editor::menu_target(super::COMMAND).expect("the menu item gives params"); + crate::menus::invoke(app, &id, p); +} + +/// Choose Edit › Find Next, as a click on the menu item does. +fn choose_find_next(app: &mut VectorcraftApp) { + let e = crate::menus::menu_entries(app).into_iter().find(|e| e.label == "Find Next").expect("in the Edit menu"); + assert_eq!((e.command.as_deref(), e.enabled), (Some(super::NEXT), true)); + crate::menus::invoke(app, super::NEXT, json!({"find": ""})); +} + +fn set(app: &mut VectorcraftApp, k: &str, v: Value) { + app.ui.dialog.as_mut().unwrap().fields.insert(k.into(), v); +} + +fn field(app: &VectorcraftApp, k: &str) -> Value { + app.ui.dialog.as_ref().expect("the dialog is open").fields.get(k).cloned().unwrap_or(Value::Null) +} + +/// The match Replace would change, as (object, start, end). +fn matched(app: &VectorcraftApp) -> Option<(u64, u64, u64)> { + let at = super::current_match(app, app.ui.dialog.as_ref()?)?; + Some((at["id"].as_u64()?, at["start"].as_u64()?, at["end"].as_u64()?)) +} + +fn plain(app: &VectorcraftApp, id: u64) -> String { + match &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind { + NodeKind::Text(t) => t.plain_text(), + _ => panic!("not type"), + } +} + +fn undo_steps(app: &VectorcraftApp) -> usize { + app.session.active().unwrap().history.undo.len() +} + +fn selected(app: &VectorcraftApp) -> Vec { + app.session.active().unwrap().selection.objects.iter().map(|id| id.0).collect() +} + +/// One frame of the dialog on an 800 × 600 window → the text painted, with its rect. +fn frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec) -> Vec<(String, Rect)> { + // A window takes a sizing frame and fades in: each frame is a quarter second on. + let time = ctx.input(|i| i.time) + 0.25; + let screen_rect = Some(Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0))); + let raw = egui::RawInput { screen_rect, events, time: Some(time), ..Default::default() }; + let mut out = ctx.run_ui(raw, |ui| crate::dialogs::show(app, ui.ctx())); + out.textures_delta.clear(); + fn walk(s: &egui::Shape, v: &mut Vec<(String, Rect)>) { + match s { + egui::Shape::Text(t) => v.push((t.galley.text().to_string(), Rect::from_min_size(t.pos, t.galley.size()))), + egui::Shape::Vec(s) => s.iter().for_each(|s| walk(s, v)), + _ => {} + } + } + let mut v = vec![]; + out.shapes.iter().for_each(|c| walk(&c.shape, &mut v)); + v +} + +fn context() -> egui::Context { + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + ctx +} + +fn click(app: &mut VectorcraftApp, ctx: &egui::Context, label: &str) -> Vec<(String, Rect)> { + frame(app, ctx, vec![]); + let texts = frame(app, ctx, vec![]); + let at = texts.iter().find(|(t, _)| t == label).map(|(_, r)| r.center()).unwrap_or_else(|| panic!("no `{label}` in {texts:?}")); + let press = |pressed| Event::PointerButton { pos: at, button: PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(app, ctx, vec![Event::PointerMoved(at)]); + frame(app, ctx, vec![press(true)]); + frame(app, ctx, vec![press(false)]); + frame(app, ctx, vec![]) +} + +/// Edit › Find and Replace… opens the dialog of its own, with the fields and options of the +/// public reference's "Find and replace text", instead of the generic parameter dialog. +#[test] +fn the_edit_menu_opens_the_find_and_replace_dialog() { + let (mut app, _) = app_with(&["cat"]); + let e = crate::menus::menu_entries(&app).into_iter().find(|e| e.label == "Find and Replace…").expect("in the Edit menu"); + assert_eq!((e.path.as_slice(), e.command.as_deref(), e.enabled), (&["Edit".to_string()][..], Some(super::COMMAND), true)); + choose(&mut app); + let d = app.ui.dialog.as_ref().expect("Find and Replace opens"); + assert_eq!((d.kind.as_str(), d.fields["__command"].clone()), (super::KIND, json!(super::COMMAND))); + for (key, want) in [("find", json!("")), ("replace", json!("")), ("action", json!("find"))] { + assert_eq!(d.fields[key], want, "{key}"); + } + for key in ["matchCase", "wholeWord", "backwards", "hiddenLayers", "lockedLayers"] { + assert_eq!(d.fields[key], json!(false), "{key}"); + } + let ctx = context(); + frame(&mut app, &ctx, vec![]); + let texts: Vec = frame(&mut app, &ctx, vec![]).into_iter().map(|(t, _)| t).collect(); + for label in [ + "Find and Replace", + "Find:", + "Replace With:", + "Match Case", + "Find Whole Word", + "Search Backwards", + "Check Hidden Layers", + "Check Locked Layers", + "Find", + "Replace", + "Replace & Find", + "Replace All", + "Done", + ] { + assert!(texts.iter().any(|t| t == label), "no `{label}` in {texts:?}"); + } +} + +/// The dialog stays open from match to match: Find goes to the next match and selects its +/// object, Replace changes that match, Replace & Find changes it and goes on, Replace All changes +/// the rest, and Done closes. Each Replace is one undo step, and so is Replace All; finding and a +/// Replace All with nothing to replace record none. +#[test] +fn the_buttons_step_through_the_matches() { + let (mut app, ids) = app_with(&["cat cat", "a cat"]); + let (bottom, top) = (ids[0], ids[1]); + choose(&mut app); + let ctx = context(); + set(&mut app, "find", json!("cat")); + set(&mut app, "replace", json!("dog")); + let steps = undo_steps(&app); + // Find: the first match, in the top object, shown with its place and its line of text. + let texts = click(&mut app, &ctx, "Find"); + assert_eq!((matched(&app), selected(&app), undo_steps(&app)), (Some((top, 2, 5)), vec![top], steps)); + assert!(texts.iter().any(|(t, _)| t.starts_with("1 / 3")) && texts.iter().any(|(t, _)| t == "cat"), "{texts:?}"); + assert!(texts.iter().any(|(t, _)| t == "Find Next"), "Find reads Find Next once a match is found: {texts:?}"); + // Replace: that match only, and the search stays where it was. + click(&mut app, &ctx, "Replace"); + assert_eq!((plain(&app, top), plain(&app, bottom), undo_steps(&app)), ("a dog".to_string(), "cat cat".to_string(), steps + 1)); + assert_eq!((matched(&app), field(&app, "__at")), (None, json!({"id": top, "start": 2, "end": 5}))); + // Find goes on from there, to the bottom object. + click(&mut app, &ctx, "Find"); + assert_eq!((matched(&app), selected(&app), field(&app, "__found")["count"].clone()), (Some((bottom, 0, 3)), vec![bottom], json!(2))); + // Replace & Find: one undo step, and the next match is the one left. + click(&mut app, &ctx, "Replace & Find"); + assert_eq!((plain(&app, bottom), undo_steps(&app), matched(&app)), ("dog cat".to_string(), steps + 2, Some((bottom, 4, 7)))); + // Replace All: the rest as one undo step, with the count under the fields. + let texts = click(&mut app, &ctx, "Replace All"); + assert_eq!((plain(&app, bottom), undo_steps(&app), matched(&app)), ("dog dog".to_string(), steps + 3, None)); + assert!(texts.iter().any(|(t, _)| t == "Matches replaced: 1"), "{texts:?}"); + // Nothing left: no undo step, and the dialog says so, for Replace All and for Find. + for button in ["Replace All", "Find"] { + let texts = click(&mut app, &ctx, button); + assert_eq!((undo_steps(&app), matched(&app)), (steps + 3, None), "{button}"); + assert!(texts.iter().any(|(t, _)| t == "No matches found"), "{button}: {texts:?}"); + } + assert!(app.ui.dialog.is_some(), "the dialog stays open until Done"); + click(&mut app, &ctx, "Done"); + assert!(app.ui.dialog.is_none(), "Done closes it"); + assert_eq!(undo_steps(&app), steps + 3); +} + +/// Replace and Replace & Find wait for a match found with the Find text and the options as they +/// are: before the first Find, and after the Find text changes, a click on them changes nothing. +/// With no Find text, no button but Done acts. Enter runs Find. +#[test] +fn replace_waits_for_a_match_of_the_text_as_it_is() { + let (mut app, ids) = app_with(&["cat cart"]); + choose(&mut app); + let ctx = context(); + let steps = undo_steps(&app); + set(&mut app, "replace", json!("x")); + for button in ["Find", "Replace", "Replace & Find", "Replace All"] { + click(&mut app, &ctx, button); + assert_eq!((plain(&app, ids[0]), undo_steps(&app), matched(&app)), ("cat cart".to_string(), steps, None), "{button} with no Find text"); + } + set(&mut app, "find", json!("cat")); + for button in ["Replace", "Replace & Find"] { + click(&mut app, &ctx, button); + assert_eq!((plain(&app, ids[0]), undo_steps(&app), matched(&app)), ("cat cart".to_string(), steps, None), "{button} before Find"); + } + // Enter finds. + frame(&mut app, &ctx, vec![]); + let enter = |pressed| Event::Key { key: egui::Key::Enter, physical_key: None, pressed, repeat: false, modifiers: Default::default() }; + frame(&mut app, &ctx, vec![enter(true)]); + frame(&mut app, &ctx, vec![enter(false)]); + assert_eq!(matched(&app), Some((ids[0], 0, 3))); + // The Find text changes: the match found is no longer the one to replace. + set(&mut app, "find", json!("ca")); + assert_eq!(matched(&app), None); + for button in ["Replace", "Replace & Find"] { + click(&mut app, &ctx, button); + assert_eq!((plain(&app, ids[0]), undo_steps(&app)), ("cat cart".to_string(), steps), "{button} after the Find text changed"); + } + // An option changes: the same. + set(&mut app, "find", json!("cat")); + assert_eq!(matched(&app), Some((ids[0], 0, 3))); + set(&mut app, "matchCase", json!(true)); + assert_eq!(matched(&app), None); + // Search Backwards is a direction, not what a match is. + set(&mut app, "matchCase", json!(false)); + set(&mut app, "backwards", json!(true)); + assert_eq!(matched(&app), Some((ids[0], 0, 3))); + click(&mut app, &ctx, "Replace"); + assert_eq!((plain(&app, ids[0]), undo_steps(&app)), ("x cart".to_string(), steps + 1)); +} + +/// `ui.dialog.confirm` runs the dialog's `action`, keeps it open and puts `action` back to find; +/// done closes it. An action it does not know is refused, and so is an empty Find text. +#[test] +fn confirm_runs_the_action() { + let (mut app, ids) = app_with(&["cat cat cat"]); + choose(&mut app); + set(&mut app, "find", json!("cat")); + set(&mut app, "replace", json!("dog")); + let steps = undo_steps(&app); + let r = crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((r["start"].clone(), r["index"].clone(), r["count"].clone(), matched(&app)), (json!(0), json!(1), json!(3), Some((ids[0], 0, 3)))); + set(&mut app, "action", json!("replaceFind")); + let r = crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((plain(&app, ids[0]), r["start"].clone(), field(&app, "action")), ("dog cat cat".to_string(), json!(4), json!("find"))); + set(&mut app, "action", json!("replace")); + let r = crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((plain(&app, ids[0]), r["replaced"].clone(), matched(&app)), ("dog dog cat".to_string(), json!(true), None)); + // Replace with no match found: it finds one. + set(&mut app, "action", json!("replace")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((plain(&app, ids[0]), matched(&app), undo_steps(&app)), ("dog dog cat".to_string(), Some((ids[0], 8, 11)), steps + 2)); + set(&mut app, "action", json!("replaceAll")); + assert_eq!(crate::dialogs::confirm(&mut app).unwrap(), json!({"count": 1, "replaced": 1})); + assert_eq!((plain(&app, ids[0]), undo_steps(&app)), ("dog dog dog".to_string(), steps + 3)); + // Matches that already read as the Replace With text are found and not counted as replaced. + set(&mut app, "find", json!("DOG")); + set(&mut app, "action", json!("replaceAll")); + assert_eq!(crate::dialogs::confirm(&mut app).unwrap(), json!({"count": 3, "replaced": 0})); + assert_eq!((undo_steps(&app), field(&app, "__note")), (steps + 3, json!("Matches replaced: 0"))); + set(&mut app, "find", json!("dog")); + for (action, find) in [("erase", "dog"), ("find", ""), ("replaceAll", "")] { + set(&mut app, "action", json!(action)); + set(&mut app, "find", json!(find)); + assert!(crate::dialogs::confirm(&mut app).is_err(), "{action} {find:?}"); + assert_eq!((plain(&app, ids[0]), undo_steps(&app), field(&app, "action")), ("dog dog dog".to_string(), steps + 3, json!("find"))); + assert!(field(&app, "__note").is_string(), "{action} {find:?}: the dialog shows why"); + } + set(&mut app, "action", json!("done")); + crate::dialogs::confirm(&mut app).unwrap(); + assert!(app.ui.dialog.is_none()); +} + +/// Edit › Find Next goes on from the dialog's last search while the dialog is closed, with its +/// options, and says when nothing matches. With no search yet, it opens the dialog, and the +/// dialog opens again on the last search. +#[test] +fn find_next_goes_on_from_the_last_search() { + let (mut app, ids) = app_with(&["Cat", "cat", "cat"]); + choose_find_next(&mut app); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(super::KIND), "no search yet: the dialog opens"); + set(&mut app, "find", json!("cat")); + set(&mut app, "replace", json!("dog")); + set(&mut app, "matchCase", json!(true)); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(matched(&app), Some((ids[2], 0, 3))); + set(&mut app, "action", json!("done")); + crate::dialogs::confirm(&mut app).unwrap(); + let steps = undo_steps(&app); + // On from the match the dialog found; Match Case still leaves out "Cat". + for want in [ids[1], ids[2], ids[1]] { + choose_find_next(&mut app); + assert_eq!((selected(&app), app.ui.dialog.is_none(), undo_steps(&app)), (vec![want], true, steps)); + } + // The dialog opens on the last search and the place it reached. + choose(&mut app); + assert_eq!((field(&app, "find"), field(&app, "replace"), field(&app, "matchCase")), (json!("cat"), json!("dog"), json!(true))); + assert_eq!(field(&app, "__at"), json!({"id": ids[1], "start": 0, "end": 3})); + set(&mut app, "find", json!("zebra")); + assert!(crate::dialogs::confirm(&mut app).unwrap()["id"].is_null()); + set(&mut app, "action", json!("done")); + crate::dialogs::confirm(&mut app).unwrap(); + app.ui.status.clear(); + choose_find_next(&mut app); + assert_eq!((app.ui.status.as_str(), selected(&app)), ("No matches found", vec![ids[1]])); +} + +/// The place a search reached goes with the Find text and the switches it was reached with: a +/// search for other text starts again, in the dialog and when `ui.paramDialog` gives other text, +/// and the same search goes on from that place. +#[test] +fn a_changed_search_starts_again() { + let (mut app, ids) = app_with(&["cat dog cat", "dog"]); + let (bottom, top) = (ids[0], ids[1]); + choose(&mut app); + set(&mut app, "find", json!("cat")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(matched(&app), Some((bottom, 0, 3))); + set(&mut app, "find", json!("dog")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(matched(&app), Some((top, 0, 3)), "not the dog after the cat found"); + set(&mut app, "find", json!("cat")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(matched(&app), Some((bottom, 0, 3))); + set(&mut app, "action", json!("done")); + crate::dialogs::confirm(&mut app).unwrap(); + crate::menus::invoke(&mut app, "ui.paramDialog", json!({"command": super::COMMAND, "params": {"find": "dog"}})); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(matched(&app), Some((top, 0, 3))); + app.ui.dialog = None; + choose(&mut app); + assert_eq!(field(&app, "find"), json!("dog")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(matched(&app), Some((bottom, 4, 7)), "the same search goes on"); +} + +/// The place a search reached belongs to its document: in another document, Edit › Find Next and +/// the dialog start at that document's first match, even where an object there has the same id. +/// The params of a `ui.paramDialog` call take the place of the last search's, a switch that is off +/// included, while the menu item's own params leave the last search as it was. +#[test] +fn a_search_place_stays_in_its_document_and_given_params_win() { + let (mut app, ids) = app_with(&["cat cat"]); + choose(&mut app); + set(&mut app, "find", json!("cat")); + set(&mut app, "matchCase", json!(true)); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(matched(&app), Some((ids[0], 0, 3))); + set(&mut app, "action", json!("done")); + crate::dialogs::confirm(&mut app).unwrap(); + // A second document, whose type object has the id of the first one's. + app.run("file.new", json!({"width": 800, "height": 600})).unwrap(); + let other = app.run("text.create", json!({"x": 50, "y": 50, "text": "cat cat"})).unwrap()["id"].as_u64().unwrap(); + app.run("select.none", json!({})).unwrap(); + assert_eq!(other, ids[0]); + choose_find_next(&mut app); + assert_eq!( + (selected(&app), app.ui.last_find.as_ref().map(|l| l["from"].clone())), + (vec![other], Some(json!({"id": other, "start": 0, "end": 3}))) + ); + // The dialog opens on the last search; Find goes on in this document. + choose(&mut app); + assert_eq!(field(&app, "matchCase"), json!(true)); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(matched(&app), Some((other, 4, 7))); + // Back in the first document, the dialog's place is not used: Replace finds first and changes + // nothing. + assert!(app.session.set_active(0)); + assert_eq!(matched(&app), None); + set(&mut app, "replace", json!("dog")); + set(&mut app, "action", json!("replace")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((plain(&app, ids[0]), matched(&app)), ("cat cat".to_string(), Some((ids[0], 0, 3)))); + set(&mut app, "action", json!("done")); + crate::dialogs::confirm(&mut app).unwrap(); + // Given params win over the last search; the menu item's own do not. + crate::menus::invoke(&mut app, "ui.paramDialog", json!({"command": super::COMMAND, "params": {"matchCase": false, "replace": "dog"}})); + assert_eq!((field(&app, "find"), field(&app, "matchCase"), field(&app, "replace")), (json!("cat"), json!(false), json!("dog"))); + app.ui.dialog = None; + let empty = json!({"find": "", "replace": "", "matchCase": false, "wholeWord": false}); + crate::menus::invoke(&mut app, "ui.paramDialog", json!({"command": super::COMMAND, "params": empty})); + assert_eq!((field(&app, "find"), field(&app, "matchCase")), (json!(""), json!(false))); + app.ui.dialog = None; + choose(&mut app); + assert_eq!((field(&app, "find"), field(&app, "matchCase")), (json!("cat"), json!(true))); +} diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 28944173dd..ae97c08ddb 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -1202,6 +1202,16 @@ font-technology Variable Променливи Fill: click for swatches, Shift-click for the color mixer Запълване: щракнете за образци, Shift-щракване за смесителя на цветове Find Търсене Find and Replace… Търсене и замяна… + Find and Replace Търсене и замяна + Find: Търсене: + Replace With: Замяна с: + Replace & Find Замяна и търсене + Replace All Замяна на всички + Match Case Съвпадение на малки и главни букви + Find Whole Word Търсене на цяла дума + Search Backwards Търсене назад + Check Hidden Layers Проверка на скритите слоеве + Check Locked Layers Проверка на заключените слоеве Find Font Търсене на шрифт Find Font… Търсене на шрифт… Find Next Търсене на следващ diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 01b90e5148..e0f2a7791d 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -85,6 +85,16 @@ Paste without Formatting Zalijepi bez oblikovanja Clear Očisti Find and Replace… Pronađi i zamijeni… + Find and Replace Pronađi i zamijeni + Find: Pronađi: + Replace With: Zamijeni sa: + Replace & Find Zamijeni i pronađi + Replace All Zamijeni sve + Match Case Razlikuj velika i mala slova + Find Whole Word Pronađi cijelu riječ + Search Backwards Pretraži unazad + Check Hidden Layers Provjeri skrivene slojeve + Check Locked Layers Provjeri zaključane slojeve Find Next Pronađi sljedeće Spelling Pravopis Auto Spell Check Automatska provjera pravopisa diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 4ddd1d5605..1110e85c25 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -1697,6 +1697,19 @@ digits Malayalam Malaiàlam Filters Filtres Find Cerca Find and Replace… Cerca i reemplaça… + Find and Replace Cerca i reemplaça + Find: Cerca: + Replace With: Reemplaça per: + Replace & Find Reemplaça i cerca + Replace All Reemplaça-ho tot + Match Case Distingeix majúscules i minúscules + Find Whole Word Cerca la paraula sencera + Search Backwards Cerca cap enrere + Check Hidden Layers Comprova les capes ocultes + Check Locked Layers Comprova les capes bloquejades +@msg No matches found No s’ha trobat cap coincidència +@msg Matches replaced: {n} Coincidències reemplaçades: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} no hi ha cap coincidència de `find` als bytes {_1}..{_2} de l’objecte {_3} Find Font Cerca un tipus de lletra Find Font Files Cerca fitxers de tipus de lletra Find Fonts Cerca tipus de lletra diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 211982f086..d8d9ff3c05 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -90,6 +90,19 @@ Paste without Formatting Vložit bez formátování Clear Smazat Find and Replace… Najít a nahradit… + Find and Replace Najít a nahradit + Find: Najít: + Replace With: Nahradit čím: + Replace & Find Nahradit a najít + Replace All Nahradit vše + Match Case Rozlišovat velká a malá písmena + Find Whole Word Najít celé slovo + Search Backwards Hledat zpět + Check Hidden Layers Prohledat skryté vrstvy + Check Locked Layers Prohledat zamknuté vrstvy +@msg No matches found Nenalezeny žádné shody +@msg Matches replaced: {n} Nahrazeno shod: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} na bajtech {_1}..{_2} objektu {_3} není žádná shoda s `find` Find Next Najít další Spelling Pravopis Auto Spell Check Automatická kontrola pravopisu diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index b3de0ae89a..d2c4bf5afa 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -78,6 +78,16 @@ Paste without Formatting Indsæt uden formatering Clear Fjern Find and Replace… Find og erstat… + Find and Replace Find og erstat + Find: Find: + Replace With: Erstat med: + Replace & Find Erstat og find + Replace All Erstat alle + Match Case Forskel på store og små bogstaver + Find Whole Word Find hele ord + Search Backwards Søg baglæns + Check Hidden Layers Kontrollér skjulte lag + Check Locked Layers Kontrollér låste lag Find Next Find næste Spelling Stavekontrol Auto Spell Check Automatisk stavekontrol diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index d0610144ef..4a1eabcece 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -1230,6 +1230,19 @@ font-technology Variable Variabel Fill: click for swatches, Shift-click for the color mixer Fläche: Klicken für Farbfelder, Shift-Klick für den Farbmischer Find Suchen Find and Replace… Suchen und ersetzen… + Find and Replace Suchen und ersetzen + Find: Suchen: + Replace With: Ersetzen durch: + Replace & Find Ersetzen und suchen + Replace All Alle ersetzen + Match Case Groß-/Kleinschreibung beachten + Find Whole Word Ganzes Wort suchen + Search Backwards Rückwärts suchen + Check Hidden Layers Ausgeblendete Ebenen durchsuchen + Check Locked Layers Gesperrte Ebenen durchsuchen +@msg No matches found Keine Treffer gefunden +@msg Matches replaced: {n} Ersetzte Treffer: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} kein Treffer für `find` bei Byte {_1}..{_2} von Objekt {_3} Find Font Schrift suchen Find Font… Schrift suchen… Find Next Weitersuchen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index d03f8c6958..5f12f6ff1b 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -1180,6 +1180,19 @@ font-technology Variable Μεταβλητές Fill: click for swatches, Shift-click for the color mixer Γέμισμα: κλικ για δείγματα, Shift-κλικ για τον μείκτη χρωμάτων Find Εύρεση Find and Replace… Εύρεση και αντικατάσταση… + Find and Replace Εύρεση και αντικατάσταση + Find: Εύρεση: + Replace With: Αντικατάσταση με: + Replace & Find Αντικατάσταση και εύρεση + Replace All Αντικατάσταση όλων + Match Case Ταίριασμα πεζών-κεφαλαίων + Find Whole Word Εύρεση ολόκληρης λέξης + Search Backwards Αναζήτηση προς τα πίσω + Check Hidden Layers Έλεγχος κρυφών επιπέδων + Check Locked Layers Έλεγχος κλειδωμένων επιπέδων +@msg No matches found Δεν βρέθηκαν αντιστοιχίες +@msg Matches replaced: {n} Αντιστοιχίες που αντικαταστάθηκαν: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} καμία αντιστοιχία του `find` στα byte {_1}..{_2} του αντικειμένου {_3} Find Font Εύρεση γραμματοσειράς Find Font… Εύρεση γραμματοσειράς… Find Next Εύρεση επόμενου diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 3e8bd23752..654ec57749 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -1251,6 +1251,19 @@ font-technology Variable Variables Fill: click for swatches, Shift-click for the color mixer Relleno: clic para muestras, Shift+clic para el mezclador de colores Find Buscar Find and Replace… Buscar y reemplazar… + Find and Replace Buscar y reemplazar + Find: Buscar: + Replace With: Reemplazar por: + Replace & Find Reemplazar y buscar + Replace All Reemplazar todo + Match Case Coincidir mayúsculas y minúsculas + Find Whole Word Buscar palabra completa + Search Backwards Buscar hacia atrás + Check Hidden Layers Comprobar capas ocultas + Check Locked Layers Comprobar capas bloqueadas +@msg No matches found No se encontraron coincidencias +@msg Matches replaced: {n} Coincidencias reemplazadas: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} no hay ninguna coincidencia de `find` en los bytes {_1}..{_2} del objeto {_3} Find Font Buscar fuente Find Font… Buscar fuente… Find Next Buscar siguiente diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index d408220f47..fd19f7246c 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -98,6 +98,19 @@ Paste without Formatting Liitä ilman muotoilua Clear Tyhjennä Find and Replace… Etsi ja korvaa… + Find and Replace Etsi ja korvaa + Find: Etsi: + Replace With: Korvaa tekstillä: + Replace & Find Korvaa ja etsi + Replace All Korvaa kaikki + Match Case Sama kirjainkoko + Find Whole Word Etsi koko sana + Search Backwards Etsi taaksepäin + Check Hidden Layers Tarkista piilotetut tasot + Check Locked Layers Tarkista lukitut tasot +@msg No matches found Osumia ei löytynyt +@msg Matches replaced: {n} Korvattuja osumia: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} objektin {_3} tavuissa {_1}..{_2} ei ole haun `find` osumaa Find Next Etsi seuraava Spelling Oikeinkirjoitus Auto Spell Check Automaattinen oikeinkirjoituksen tarkistus diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 318bbbeb44..9d79ede0b2 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -1245,6 +1245,19 @@ font-technology Variable Variables Fill: click for swatches, Shift-click for the color mixer Fond : cliquez pour le nuancier, Maj+clic pour le mélangeur de couleurs Find Rechercher Find and Replace… Rechercher et remplacer… + Find and Replace Rechercher et remplacer + Find: Rechercher: + Replace With: Remplacer par: + Replace & Find Remplacer et rechercher + Replace All Tout remplacer + Match Case Respecter la casse + Find Whole Word Rechercher le mot entier + Search Backwards Rechercher vers l’arrière + Check Hidden Layers Vérifier les calques masqués + Check Locked Layers Vérifier les calques verrouillés +@msg No matches found Aucune occurrence trouvée +@msg Matches replaced: {n} Occurrences remplacées : {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} aucune occurrence de `find` aux octets {_1}..{_2} de l’objet {_3} Find Font Rechercher une police Find Font… Rechercher une police… Find Next Rechercher le suivant diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 78c0a9a7eb..a68dcbedc3 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -1885,6 +1885,19 @@ antiAlias Sharp शार्प Filters फिल्टर Find खोजें Find and Replace… खोजें और बदलें… + Find and Replace खोजें और बदलें + Find: खोजें: + Replace With: इससे रिप्लेस करें: + Replace & Find रिप्लेस करें और खोजें + Replace All सभी रिप्लेस करें + Match Case केस मिलाएँ + Find Whole Word पूरा शब्द खोजें + Search Backwards पीछे की ओर खोजें + Check Hidden Layers छिपी हुई लेयर्स जाँचें + Check Locked Layers लॉक की गई लेयर्स जाँचें +@msg No matches found कोई मिलान नहीं मिला +@msg Matches replaced: {n} रिप्लेस किए गए मिलान: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} ऑब्जेक्ट {_3} के बाइट {_1}..{_2} पर `find` का कोई मिलान नहीं है Find Font फ़ॉन्ट खोजें Find Font Files फ़ॉन्ट फ़ाइल का पता लगाएं Find Font… फ़ॉन्ट खोजें… diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index a1f6100b2f..1747ad1712 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -1559,6 +1559,19 @@ digits Malayalam Malajálam Film & Video Film és videó Find Keresés Find and Replace… Keresés és csere… + Find and Replace Keresés és csere + Find: Keresés: + Replace With: Csere erre: + Replace & Find Csere és keresés + Replace All Az összes cseréje + Match Case Kis- és nagybetűk megkülönböztetése + Find Whole Word Teljes szó keresése + Search Backwards Keresés visszafelé + Check Hidden Layers Rejtett rétegek ellenőrzése + Check Locked Layers Zárolt rétegek ellenőrzése +@msg No matches found Nincs találat +@msg Matches replaced: {n} Cserélt találatok: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} nincs `find` találat a(z) {_3} objektum {_1}..{_2} bájtjain Find Font Betűtípus keresése Find Font Files Betűtípusfájlok keresése Find Fonts Betűtípusok keresése diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index c7c6b956db..0312437363 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -78,6 +78,16 @@ Paste without Formatting Tempel tanpa pemformatan Clear Hapus Find and Replace… Cari dan ganti… + Find and Replace Cari dan ganti + Find: Cari: + Replace With: Ganti dengan: + Replace & Find Ganti dan cari + Replace All Ganti semua + Match Case Cocokkan huruf besar/kecil + Find Whole Word Cari seluruh kata + Search Backwards Cari mundur + Check Hidden Layers Periksa lapisan tersembunyi + Check Locked Layers Periksa lapisan terkunci Find Next Cari berikutnya Spelling Ejaan Auto Spell Check Pemeriksaan ejaan otomatis diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 6743704785..093544fda9 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -1260,6 +1260,19 @@ font-technology Variable Variabili Fill: click for swatches, Shift-click for the color mixer Riempimento: fai clic per i campioni, Shift+clic per il miscelatore colori Find Trova Find and Replace… Trova e sostituisci… + Find and Replace Trova e sostituisci + Find: Trova: + Replace With: Sostituisci con: + Replace & Find Sostituisci e trova + Replace All Sostituisci tutto + Match Case Maiuscole/minuscole + Find Whole Word Trova parola intera + Search Backwards Cerca all'indietro + Check Hidden Layers Controlla livelli nascosti + Check Locked Layers Controlla livelli bloccati +@msg No matches found Nessuna corrispondenza trovata +@msg Matches replaced: {n} Corrispondenze sostituite: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} nessuna corrispondenza di `find` ai byte {_1}..{_2} dell'oggetto {_3} Find Font Trova font Find Font… Trova font… Find Next Trova successivo diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c9cdb8fcbe..afa5bb4a68 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -163,6 +163,19 @@ digits Malayalam マラヤーラム数字 Paste without Formatting 書式なしでペースト Clear 消去 Find and Replace… 検索と置換… + Find and Replace 検索と置換 + Find: 検索: + Replace With: 置換文字列: + Replace & Find 置換して検索 + Replace All すべて置換 + Match Case 大文字と小文字を区別 + Find Whole Word 単語単位で検索 + Search Backwards 逆方向に検索 + Check Hidden Layers 非表示レイヤーを検索 + Check Locked Layers ロックされたレイヤーを検索 +@msg No matches found 一致する文字列が見つかりません +@msg Matches replaced: {n} 置換した一致: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} オブジェクト {_3} のバイト {_1}..{_2} に `find` の一致はありません Find Next 次を検索 Find Objects オブジェクトを検索 Compare with Image 画像と比較 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 55f726dc38..5c62e0615b 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -88,6 +88,19 @@ Paste without Formatting ფორმატირების გარეშე ჩასმა Clear გასუფთავება Find and Replace… ძებნა და ჩანაცვლება… + Find and Replace ძებნა და ჩანაცვლება + Find: ძებნა: + Replace With: ჩანაცვლება შემდეგით: + Replace & Find ჩანაცვლება და ძებნა + Replace All ყველას ჩანაცვლება + Match Case რეგისტრის გათვალისწინება + Find Whole Word მთელი სიტყვის ძებნა + Search Backwards უკუმიმართულებით ძებნა + Check Hidden Layers დამალული შრეების შემოწმება + Check Locked Layers ჩაკეტილი შრეების შემოწმება +@msg No matches found დამთხვევები ვერ მოიძებნა +@msg Matches replaced: {n} ჩანაცვლებული დამთხვევები: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} ობიექტ {_3}-ის {_1}..{_2} ბაიტებზე `find`-ის დამთხვევა არ არის Find Next შემდეგის ძებნა Spelling მართლწერა Auto Spell Check მართლწერის ავტომატური შემოწმება diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index abe2b4bc28..a5fc870751 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -156,6 +156,19 @@ digits Malayalam 말라얄람어 Paste without Formatting 서식 없이 붙여넣기 Clear 지우기 Find and Replace… 찾기 및 바꾸기… + Find and Replace 찾기 및 바꾸기 + Find: 찾기: + Replace With: 바꿀 내용: + Replace & Find 바꾼 후 찾기 + Replace All 모두 바꾸기 + Match Case 대/소문자 구분 + Find Whole Word 단어 단위로 찾기 + Search Backwards 역방향 검색 + Check Hidden Layers 숨겨진 레이어 확인 + Check Locked Layers 잠긴 레이어 확인 +@msg No matches found 일치하는 항목이 없습니다 +@msg Matches replaced: {n} 바꾼 일치 항목: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} 개체 {_3}의 바이트 {_1}..{_2}에 `find`와 일치하는 항목이 없습니다 Find Next 다음 찾기 Find Objects 개체 찾기 Compare with Image 이미지와 비교 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index ed281382a4..3b3d163817 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -582,6 +582,19 @@ Paste without Formatting Plakken zonder opmaak Clear Wissen Find and Replace… Zoeken en vervangen… + Find and Replace Zoeken en vervangen + Find: Zoeken: + Replace With: Vervangen door: + Replace & Find Vervangen en zoeken + Replace All Alles vervangen + Match Case Hoofdlettergevoelig + Find Whole Word Heel woord zoeken + Search Backwards Achterwaarts zoeken + Check Hidden Layers Verborgen lagen controleren + Check Locked Layers Vergrendelde lagen controleren +@msg No matches found Geen overeenkomsten gevonden +@msg Matches replaced: {n} Vervangen overeenkomsten: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} geen overeenkomst van `find` bij bytes {_1}..{_2} van object {_3} Find Next Volgende zoeken Spelling Spelling Auto Spell Check Automatische spellingcontrole diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 08e96e6a35..6f91958d78 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -93,6 +93,19 @@ Paste without Formatting Wklej bez formatowania Clear Wyczyść Find and Replace… Znajdź i zamień… + Find and Replace Znajdź i zamień + Find: Znajdź: + Replace With: Zastąp przez: + Replace & Find Zastąp i znajdź + Replace All Zastąp wszystko + Match Case Uwzględnij wielkość liter + Find Whole Word Znajdź całe słowo + Search Backwards Szukaj wstecz + Check Hidden Layers Sprawdź ukryte warstwy + Check Locked Layers Sprawdź zablokowane warstwy +@msg No matches found Nie znaleziono dopasowań +@msg Matches replaced: {n} Zastąpione dopasowania: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} brak dopasowania `find` w bajtach {_1}..{_2} obiektu {_3} Find Next Znajdź następny Spelling Pisownia Auto Spell Check Automatyczne sprawdzanie pisowni diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 79c4d9dc8e..2e096d6485 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -1140,6 +1140,19 @@ antiAlias Sharp Nítido Find Font… Localizar Fonte… Find Next Localizar Próximo Find and Replace… Localizar e Substituir… + Find and Replace Localizar e Substituir + Find: Localizar: + Replace With: Substituir por: + Replace & Find Substituir e Localizar + Replace All Substituir Tudo + Match Case Diferenciar Maiúsculas de Minúsculas + Find Whole Word Localizar Palavra Inteira + Search Backwards Pesquisar para Trás + Check Hidden Layers Verificar Camadas Ocultas + Check Locked Layers Verificar Camadas Bloqueadas +@msg No matches found Nenhuma correspondência encontrada +@msg Matches replaced: {n} Correspondências substituídas: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} nenhuma correspondência de `find` nos bytes {_1}..{_2} do objeto {_3} First Page Primeira Página First-line Left Indent Recuo Esquerdo da Primeira Linha Fisheye… Olho de Peixe… diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 9f608618e7..b88785cf7a 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -1249,6 +1249,19 @@ font-technology Variable Вариативные Fill: click for swatches, Shift-click for the color mixer Заливка: щёлкните для образцов, Shift+щелчок — для смесителя цветов Find Найти Find and Replace… Найти и заменить… + Find and Replace Найти и заменить + Find: Найти: + Replace With: Заменить на: + Replace & Find Заменить и найти + Replace All Заменить все + Match Case Учитывать регистр + Find Whole Word Найти слово целиком + Search Backwards Искать назад + Check Hidden Layers Проверять скрытые слои + Check Locked Layers Проверять заблокированные слои +@msg No matches found Совпадений не найдено +@msg Matches replaced: {n} Заменено совпадений: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} в байтах {_1}..{_2} объекта {_3} нет совпадения с `find` Find Font Найти шрифт Find Font… Найти шрифт… Find Next Найти далее diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 6156ca23d5..b36244f510 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -1215,6 +1215,19 @@ font-technology Variable Variabla Fill: click for swatches, Shift-click for the color mixer Fyllning: klicka för färgrutor, Shift-klicka för färgmixern Find Sök Find and Replace… Sök och ersätt… + Find and Replace Sök och ersätt + Find: Sök: + Replace With: Ersätt med: + Replace & Find Ersätt och sök + Replace All Ersätt alla + Match Case Matcha skiftläge + Find Whole Word Sök hela ord + Search Backwards Sök bakåt + Check Hidden Layers Kontrollera dolda lager + Check Locked Layers Kontrollera låsta lager +@msg No matches found Inga träffar hittades +@msg Matches replaced: {n} Ersatta träffar: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} ingen träff för `find` vid byte {_1}..{_2} i objekt {_3} Find Font Sök typsnitt Find Font… Sök typsnitt… Find Next Sök nästa diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 7120d44707..964a66274a 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -1204,6 +1204,19 @@ font-technology Variable Değişken Fill: click for swatches, Shift-click for the color mixer Doldur: renk örnekleri için tıklayın, renk karıştırıcı için Shift tuşunu basılı tutarak tıklayın Find Bul Find and Replace… Bul ve Değiştir… + Find and Replace Bul ve Değiştir + Find: Bul: + Replace With: Şununla Değiştir: + Replace & Find Değiştir ve Bul + Replace All Tümünü Değiştir + Match Case Büyük/Küçük Harf Eşleştir + Find Whole Word Tam Sözcüğü Bul + Search Backwards Geriye Doğru Ara + Check Hidden Layers Gizli Katmanları Denetle + Check Locked Layers Kilitli Katmanları Denetle +@msg No matches found Eşleşme bulunamadı +@msg Matches replaced: {n} Değiştirilen eşleşmeler: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} {_3} nesnesinin {_1}..{_2} baytlarında `find` eşleşmesi yok Find Font Yazı Tipi Bul Find Font… Yazı Tipi Bul… Find Next Sonrakini Bul diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 84f296b0a6..d23d1f72ca 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -1254,6 +1254,19 @@ font-technology Variable Варіативні Fill: click for swatches, Shift-click for the color mixer Заливка: клацніть для зразків, Shift+клацання — для змішувача кольорів Find Знайти Find and Replace… Знайти та замінити… + Find and Replace Знайти та замінити + Find: Знайти: + Replace With: Замінити на: + Replace & Find Замінити та знайти + Replace All Замінити все + Match Case Враховувати регістр + Find Whole Word Знайти слово цілком + Search Backwards Шукати назад + Check Hidden Layers Перевіряти приховані шари + Check Locked Layers Перевіряти заблоковані шари +@msg No matches found Збігів не знайдено +@msg Matches replaced: {n} Замінено збігів: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} у байтах {_1}..{_2} об’єкта {_3} немає збігу з `find` Find Font Знайти шрифт Find Font… Знайти шрифт… Find Next Знайти далі diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index e8b9e5758f..5bebf649d9 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -1470,6 +1470,19 @@ digits Malayalam Malayalam Posterization Áp phích hóa Find Tìm Find and Replace… Tìm và thay thế… + Find and Replace Tìm và thay thế + Find: Tìm: + Replace With: Thay thế bằng: + Replace & Find Thay thế và tìm + Replace All Thay thế tất cả + Match Case Phân biệt chữ hoa chữ thường + Find Whole Word Tìm toàn bộ từ + Search Backwards Tìm ngược + Check Hidden Layers Kiểm tra lớp ẩn + Check Locked Layers Kiểm tra lớp bị khóa +@msg No matches found Không tìm thấy kết quả khớp +@msg Matches replaced: {n} Số kết quả khớp đã thay thế: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} không có kết quả khớp với `find` tại byte {_1}..{_2} của đối tượng {_3} Find Font Tìm phông Find Font Files Tìm tệp phông chữ Find Fonts Tìm phông chữ diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 719968086f..eb4d47a4dd 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -1192,6 +1192,19 @@ antiAlias Sharp 锐利 Fill: click for swatches, Shift-click for the color mixer 填色:单击开启色板,按住 Shift 单击开启混色器 Find 查找 Find and Replace… 查找和替换… + Find and Replace 查找和替换 + Find: 查找: + Replace With: 替换为: + Replace & Find 替换并查找 + Replace All 全部替换 + Match Case 区分大小写 + Find Whole Word 查找全字匹配 + Search Backwards 反向搜索 + Check Hidden Layers 检查隐藏图层 + Check Locked Layers 检查锁定图层 +@msg No matches found 未找到匹配项 +@msg Matches replaced: {n} 已替换的匹配项:{n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} 对象 {_3} 的字节 {_1}..{_2} 处没有 `find` 的匹配项 Find Font 查找字体 Find Font… 查找字体… Find Next 查找下一个 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 121a8b8c02..f054cbeda5 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -1226,6 +1226,19 @@ font-technology Variable 可變 Fill: click for swatches, Shift-click for the color mixer 填色:按一下開啟色票,按住 Shift 按一下開啟混色器 Find 尋找 Find and Replace… 尋找與取代… + Find and Replace 尋找與取代 + Find: 尋找: + Replace With: 取代為: + Replace & Find 取代並尋找 + Replace All 全部取代 + Match Case 大小寫須相符 + Find Whole Word 尋找全字 + Search Backwards 反向搜尋 + Check Hidden Layers 檢查隱藏圖層 + Check Locked Layers 檢查鎖定圖層 +@msg No matches found 找不到相符項目 +@msg Matches replaced: {n} 已取代的相符項目:{n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} 物件 {_3} 的位元組 {_1}..{_2} 處沒有 `find` 的相符項目 Find Font 尋找字體 Find Font… 尋找字體… Find Next 尋找下一個 diff --git a/crates/ui-egui/src/menus/entries.rs b/crates/ui-egui/src/menus/entries.rs index 953b5b58f4..ebf5707949 100644 --- a/crates/ui-egui/src/menus/entries.rs +++ b/crates/ui-egui/src/menus/entries.rs @@ -146,9 +146,10 @@ const NOT_INSERTED_MENUS: [&str; 4] = ["VectorCraft", "File", "Window", "Help"]; /// Commands whose menu items do more than run the command, which action playback does not do: /// Object › Image Trace › Make and Make and Expand trace off the UI thread with progress and Cancel -/// ([`crate::trace_runs::start`]), and Object › Pattern › Make and Edit Pattern open the Pattern -/// Options panel. -const MENU_ONLY_COMMANDS: [&str; 4] = ["imageTrace.make", "imageTrace.makeAndExpand", "object.pattern.make", "object.pattern.edit"]; +/// ([`crate::trace_runs::start`]), Object › Pattern › Make and Edit Pattern open the Pattern +/// Options panel, and Edit › Find Next goes on from the last Find and Replace search or opens its +/// dialog ([`crate::dialogs::find_replace::find_next`]). +const MENU_ONLY_COMMANDS: [&str; 5] = ["imageTrace.make", "imageTrace.makeAndExpand", "object.pattern.make", "object.pattern.edit", "edit.findNext"]; /// The View menu commands that the app runs itself, not the engine, and that can be steps of an /// action ([`plays_in_app`]): Outline, Pixel Preview, Trim View, Presentation Mode and Screen Mode, diff --git a/crates/ui-egui/src/menus/invoke.rs b/crates/ui-egui/src/menus/invoke.rs index 3aab5e1e44..475d71ed07 100644 --- a/crates/ui-egui/src/menus/invoke.rs +++ b/crates/ui-egui/src/menus/invoke.rs @@ -298,6 +298,18 @@ fn open_view_dialog(app: &mut VectorcraftApp, id: &str, p: &Value) -> bool { } return true; } + // Find Next with no text to find, as its menu item runs it: the next match of the last Find + // and Replace search, or the dialog when there has been none. + if id == crate::dialogs::find_replace::NEXT + && p.get("find").is_none_or(|f| f.as_str() == Some("")) + && p.as_object().is_none_or(|o| o.len() <= 1) + && app.session.active().is_some() + { + if let Err(e) = crate::dialogs::find_replace::find_next(app) { + app.status(e); + } + return true; + } // Edit Views…: the saved views in a list, to rename or delete. if id == "view.saved.edit" && p.as_object().is_none_or(|o| o.is_empty()) { if let Err(e) = crate::dialogs::edit_views::open(app) { diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 7b7f7a6b21..f2a0b789d1 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -705,6 +705,10 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option { let cmd = s("command").unwrap_or_default(); let mut fields = p.get("params").and_then(Value::as_object).cloned().unwrap_or_default(); + // Find and Replace has a dialog of its own, which stays open from match to match. + if cmd == crate::dialogs::find_replace::COMMAND { + return Some(crate::dialogs::find_replace::open(app, &fields)); + } fields.insert("__command".into(), json!(cmd)); fields.insert("__label".into(), json!(s("label").unwrap_or(cmd.clone()))); app.ui.dialog = Some(crate::state::Dialog { kind: "command".into(), fields }); diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index 4b86b4152d..538ffd303b 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -95,7 +95,7 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec)> { c("Paste without Formatting", "edit.pasteWithoutFormatting"), c("Clear", "edit.clear"), Sep, - cp("Find and Replace…", "edit.findReplace", json!({"find": "", "replace": "", "matchCase": false, "wholeWord": false})), + cp("Find and Replace…", "edit.findReplace", crate::dialogs::find_replace::menu_params()), cp("Find Next", "edit.findNext", json!({"find": ""})), sub("Spelling", vec![c("Auto Spell Check", "edit.autoSpellCheck"), todos("Check Spelling…", "Cmd+I")]), // Edit › Edit Custom Dictionary…, beside Spelling, on the public Check and correct diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 52c8c2e7bf..641268a9ab 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -802,7 +802,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{effect: id, index?: int (edit that applied effect in place, prefilled; OK runs effect.setParams), item?: appearance item index|null (the fill/stroke whose effects, null the object's; default: the Appearance panel's active item), aligned?: bool (index and item are rows of the first selected object's stack, which OK edits in each object where it has them, as effect.setParams does)} open the effect's dialog with live preview; without `index`, an effect already in that list first opens `effectExists` (confirm edits it, discard adds another) → {pending: \"effectExists\"}", ), - ("ui.paramDialog", "Command Dialog", "", "{command, label?, params} open a parameter dialog for any command"), + ( + "ui.paramDialog", + "Command Dialog", + "", + "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place, and Edit › Find Next goes on from it in the same document while the dialog is closed", + ), ( "ui.recolorDialog", "Recolor Artwork…", diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index ded320a5aa..796e2016db 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -387,7 +387,7 @@ mod tests { ("object.path.cleanUp", "command"), ("object.mesh.create", "command"), ("type.smartPunctuation", "command"), - ("edit.findReplace", "command"), + ("edit.findReplace", crate::dialogs::find_replace::KIND), ("object.path.smooth", crate::dialogs::smooth_slider::KIND), ]; for (id, kind) in expected { diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 80a87b4563..bfaabf7db6 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -582,6 +582,11 @@ pub struct UiState { /// The Replace Font request behind the status bar's warning ([`ReplaceFontWarning`]). Not saved. #[serde(skip)] pub replace_font_warning: Option, + /// The last Find and Replace search ([`crate::dialogs::find_replace`]): the dialog's Find and + /// Replace With text, its options and the place the search reached, which Edit › Find Next + /// goes on from while the dialog is closed. Not saved. + #[serde(skip)] + pub last_find: Option, /// The notes of the last open that gave any, or of the last save or export, with the status /// text that names the first of them: hovering that text lists them when there are several. /// Not saved. @@ -1171,6 +1176,7 @@ impl Default for UiState { status: String::new(), status_sets: 0, replace_font_warning: None, + last_find: None, status_notes: None, palette_open: false, palette_query: String::new(), diff --git a/docs/mcp.md b/docs/mcp.md index 2e43c14d0e..7350d2f4c2 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -8688,6 +8688,52 @@ for it (each a `text.editRange {id, start, end, insert}` item labelled with its All (`text.spelling.ignoreAll {word}`) and Add to Dictionary (`text.spelling.addWord {word}`); the context menu's entries list them with their params. A right-click on type also has Spelling › Auto Spell Check (`edit.autoSpellCheck`). +## Find and Replace + +`edit.findNext {find, matchCase?, wholeWord?, backwards?, hiddenLayers?, lockedLayers?, from?}` finds the next match +of `find` and selects its type object. The result is `{id, start, end, index, count, selected}`: `start` and `end` +are byte offsets in the type object's text, the ones `text.editRange` takes, `index` is the match's place among all +the matches (from 1) and `count` is how many there are. With no match it is `{id: null, count: 0}`. Nothing is +recorded for undo. + +- The search reaches visible, unlocked type on visible, unlocked layers, off locked artboards. `hiddenLayers` adds the + type of hidden layers and sublayers and `lockedLayers` that of locked ones, as Check Hidden Layers and Check Locked + Layers do in [Find and replace text](https://helpx.adobe.com/pdf/illustrator_reference.pdf). A hidden or locked + object or group keeps its type out. +- `backwards` is Search Backwards on that page: the search goes from the bottom of the stacking order to the top. + Without it, the search goes from the top down. +- These rules are VectorCraft's own. Inside a type object the matches come in reading order, or from the last with + `backwards`. `from: {id, start, end}`, a match the command returned or the range `edit.replaceMatch` returned, is + where the search goes on from; past the last match it starts again at the first. Without `from` it goes on after the + first selected type object, and with no type selected it starts at the first match. A match on a hidden or locked + layer comes back with `selected: false` and the selection stays as it is. A match stays inside one style run. + +`edit.replaceMatch {find, replace?, matchCase?, wholeWord?, id, start, end}` replaces that one match with `replace` +as one undo step and returns `{id, start, end, replaced}`, with `start` and `end` the replacement's bytes. Bytes that +are no match of `find` are refused. A match that already reads as `replace` is left as it is, with no undo step and +`replaced: false`. `edit.findReplace {find, replace?, matchCase?, wholeWord?, hiddenLayers?, lockedLayers?, ids?}` +replaces every match in the type the search reaches (or in `ids`) as one undo step and returns `{count, replaced}`, +with `count` the matches and `replaced` those that did not already read as `replace`; when +nothing changes, no undo step is recorded. An empty `find` is an error in all three. + +```json +{"name":"run_command","arguments":{"command":"edit.findNext","params":{"find":"colour","wholeWord":true}}} +{"name":"run_command","arguments":{"command":"edit.replaceMatch","params":{"find":"colour","replace":"color","wholeWord":true,"id":12,"start":4,"end":10}}} +{"name":"run_command","arguments":{"command":"edit.findNext","params":{"find":"colour","wholeWord":true,"from":{"id":12,"start":4,"end":9}}}} +``` + +In the app, Edit › Find and Replace… opens a dialog that stays open (kind `findReplace`), with Find and Replace With +fields, Match Case, Find Whole Word, Search Backwards, Check Hidden Layers and Check Locked Layers, and Find, Replace, +Replace & Find, Replace All and Done. Its fields are `find`, `replace`, `matchCase`, `wholeWord`, `backwards`, +`hiddenLayers`, `lockedLayers` and `action`; `ui.dialog.confirm` runs the `action`: `find` (the default), `replace`, +`replaceFind`, `replaceAll` or `done`, which closes the dialog. The dialog shows the match found in its line of text +with its place among the matches. Replace and Replace & Find change a match that Find reached with the Find text and +the options as they are now, and find one otherwise. Enter runs Find. Edit › Find Next goes on from the dialog's last +search while the dialog is closed, and opens the dialog when there has been none. A place the search reached in one +document is not used in another, nor once the Find text or an option that decides a match changes: the search then +starts again as it does without `from`. `ui.paramDialog` opens +the dialog on the last search, with the fields its `params` give in its place. + ## Justification options diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 8f5043993a..315f02eee1 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1659,6 +1659,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur The Layers panel's New Layer (on top), Select Art and Target (Shift-click), Move Rows (the copy), Template, Paste Remembers Layers and Release to Layers (Build) refuse a value other than true, false or null, such as "true", and leave the document, the selection, the highlighted rows and the undo history as they were; New Sublayer refuses such a `top` too. Change Case, Smart Punctuation, Find and Replace, Convert To Area Type, Convert To Point Type, Type on a Path Options, the Type on a Path effects and Fill with Placeholder Text record no undo step when they change nothing. Find and Replace, Find Next, Change Case, Smart Punctuation, Insert Character and Type on a Path Options refuse a text option other than text or null, such as a replacement of 5, and a switch other than true, false or null, such as "true". Smart Punctuation also refuses a scope other than selection or document, Type on a Path Options a spacing given as text, and Find and Replace `ids` that are not a list of existing object ids. Each leaves the text, the selection and the undo history as they were. + Edit › Find and Replace… opens a dialog that stays open, with Find, Replace, Replace & Find, Replace All and Done, and Match Case, Find Whole Word, Search Backwards, Check Hidden Layers and Check Locked Layers. Find Next (`edit.findNext`) returns each match with its bytes, from the top of the stacking order down or, with Search Backwards, from the bottom up; `edit.replaceMatch` replaces one match as one undo step; Edit › Find Next goes on from the dialog's last search. The commands that take `keepModel` (fills and strokes, Appearance rows, Live Paint, Shape Builder fills, gradient stops and freeform points, gradient mesh points, type colors, the Symbol Stainer and the swatch commands) refuse a `keepModel` other than true, false or null, such as "true". Toggle Fill/Stroke Focus (`fill`), Invert, Complement, Apply Last Color and Apply Last Gradient (`stroke`), `paint.setFill` and `paint.setStroke` (`focus`, `none`), and `appearance.setItem`, `livePaint.fill`, `livePaint.strokeEdge`, a `shapeBuilder.merge` `fill`, `swatch.new` and `swatch.edit`'s `paint` (`none`) refuse such a value too. Each leaves the document, its undo history and the defaults for new art as they were. The shape tools' commands (Rectangle, Polygon, Star, Flare, Spiral, Arc, Rectangular Grid and Polar Grid), `path.create` (with `anchors` or `d`), the type commands (new type, type in a path, character formats, the byte range a text command takes, Touch Type, font size steps, `text.getRange`, Optical Margin Alignment, System Layout, Fractional Widths, Ruby and Area Type Options), the symbol commands (Place, Delete, the Symbol Sprayer and the symbolism tools), the swatch commands, the Appearance panel's commands, the gradient and freeform gradient commands, Shape Builder, Live Paint and Image Trace refuse an option other than true, false or null and a number given as text, such as "true" or "40", and leave the document and its undo history as they were. - **Fonts:** a font is found by any of its names (family and style in every language of its name table, legacy family/style pairs, PostScript name), so documents from other apps open with the font they name; Find Font and `text.fonts` say for each font whether it was found exactly, by another name, substituted or missing, and how many glyphs are missing. PDF and `.ai` import brings Japanese text back as live type: CID fonts without a ToUnicode map read through the standard CMaps, vertical columns (WMode 1) as vertical type, letter spacing as tracking; a glyph is live type only when the installed font (in the closest style of its family) draws the same glyph, and text in a font that isn't installed comes in as live type shown in the fallback font until the font is installed (exports that draw it — PDF, EPS, EMF/WMF, raster, SVG outlines or embedded fonts — warn that they wrote the fallback font, and Print and Print Preview warn about the type that prints in it; `textAs: outlines` keeps the PDF's embedded glyphs). Two installed versions of one family and style (a font library keeping an old file beside a new one) both load, the first staying the one the family and style resolve to; PDF and `.ai` import tries each version when the glyphs differ, and type set in a version other than that one names it (`CharStyle::font_version`), which layout, the substituted-glyph highlight, Find Font, Package and Document Info follow. Fonts outside the font folders are listed too: those font services such as Adobe Fonts load on Windows, through DirectWrite and, for those only GDI lists, through GDI (#1258), and those apps and font managers register with CoreText on macOS (#579). When a document opens with fonts that aren't available, fonts used only in symbols included, a Missing Fonts dialog lists them after the linked-file questions, with Find Fonts (Type › Find Font on them) and Close. Its Find in Folder… (in Find Font too) searches a folder on several threads, reads only what the font scan reads of font files and skips app packages, the Program Files and ProgramData folders, the system's folders and the app data folders in a home folder; Add Fonts copies the font files the user chooses, suitcase fonts with their resource fork, into VectorCraft's own Fonts folder, which the desktop app and `vectorcraft-cli` read (`text.missingFonts`, `text.findFontFiles`, `text.addFontFiles`). The font scan on Linux also reads the folders fontconfig's configuration lists, such as TeX fonts under `/usr/share/texmf/fonts` (#1548, fixes #1529; not verified on Linux). From a7c8d287772aadbfe0282ad5196ef32eb584115b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 15:25:01 -0800 Subject: [PATCH 014/158] Object Mosaic: Create Object Mosaic opens a dialog with its size, ratio and percentage options Object > Create Object Mosaic... opens its own dialog on the selected image: Current Size, New Size, Tile Spacing, Number of Tiles, Constrain Ratio (Width or Height), Result (Color or Grayscale), Resize Using Percentages, Delete Raster and Use Ratio. It replaces the generic parameter dialog, which showed only the counts, the spacing and the two switches. object.createObjectMosaic takes percentages, constrain and useRatio. Use Ratio keeps the count on the kept side and picks the other count whose tiles, spacing taken off, come closest to square, measured along the image's own sides. A new width or height outside 0.1 to 1000000 is refused, and the result gives the columns and rows used. Docs: docs/mcp.md, docs/target-app-parity.md. --- crates/engine/src/cmd.rs | 3 + crates/engine/src/cmd/menucmds.rs | 137 +++++- crates/engine/src/tests.rs | 108 +++++ crates/ui-egui/src/dialogs.rs | 7 + crates/ui-egui/src/dialogs/object_mosaic.rs | 468 ++++++++++++++++++++ crates/ui-egui/src/dialogs/tests.rs | 8 +- crates/ui-egui/src/i18n/bg.tsv | 10 + crates/ui-egui/src/i18n/bs.tsv | 10 + crates/ui-egui/src/i18n/ca.tsv | 10 + crates/ui-egui/src/i18n/cs.tsv | 10 + crates/ui-egui/src/i18n/da.tsv | 10 + crates/ui-egui/src/i18n/de.tsv | 10 + crates/ui-egui/src/i18n/el.tsv | 10 + crates/ui-egui/src/i18n/es.tsv | 10 + crates/ui-egui/src/i18n/fi.tsv | 10 + crates/ui-egui/src/i18n/fr.tsv | 10 + crates/ui-egui/src/i18n/gu.tsv | 9 + crates/ui-egui/src/i18n/hi.tsv | 9 + crates/ui-egui/src/i18n/hu.tsv | 10 + crates/ui-egui/src/i18n/id.tsv | 10 + crates/ui-egui/src/i18n/it.tsv | 10 + crates/ui-egui/src/i18n/ja.tsv | 10 + crates/ui-egui/src/i18n/ka.tsv | 10 + crates/ui-egui/src/i18n/ko.tsv | 10 + crates/ui-egui/src/i18n/nl.tsv | 10 + crates/ui-egui/src/i18n/pl.tsv | 10 + crates/ui-egui/src/i18n/pt-br.tsv | 10 + crates/ui-egui/src/i18n/ru.tsv | 10 + crates/ui-egui/src/i18n/sv.tsv | 10 + crates/ui-egui/src/i18n/tr.tsv | 10 + crates/ui-egui/src/i18n/uk.tsv | 10 + crates/ui-egui/src/i18n/vi.tsv | 10 + crates/ui-egui/src/i18n/zh-hans.tsv | 10 + crates/ui-egui/src/i18n/zh-hant.tsv | 10 + crates/ui-egui/src/menus/run.rs | 4 + docs/mcp.md | 30 +- docs/target-app-parity.md | 1 + 37 files changed, 1022 insertions(+), 22 deletions(-) create mode 100644 crates/ui-egui/src/dialogs/object_mosaic.rs diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index a2d0316913..4abdbf1556 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -885,6 +885,9 @@ pub(crate) use buildcmds::TracePresetChanges; /// The shapes a group selected alone gives the Pathfinder panel. pub use pathops::shape_count; +/// The tile counts Create Object Mosaic would use (the dialog's Use Ratio button sets them). +pub use menucmds::mosaic_counts; + /// The gaps View › Show Live Paint Gaps shows on a Live Paint group. pub use buildcmds::live_paint_gaps; diff --git a/crates/engine/src/cmd/menucmds.rs b/crates/engine/src/cmd/menucmds.rs index 1ab0e0b670..41fc1cf2fe 100644 --- a/crates/engine/src/cmd/menucmds.rs +++ b/crates/engine/src/cmd/menucmds.rs @@ -124,7 +124,7 @@ pub fn specs() -> Vec { "Create Object Mosaic…", ["Object"], None, - "{columns=10, rows=10 (whole numbers, kept within 1..1000), width?, height? (new size in pt; default the image's), spacingX=0, spacingY=0 (pt between tiles), gray?: bool, deleteRaster?: bool} a group of rectangles coloured by the selected image's average tile colours → {id, tiles}", + "{columns=10, rows=10 (whole numbers, kept within 1..1000), width?, height? (new size in pt, 0.1..1000000; default the image's), percentages?: bool (width and height are percentages of the image's size, default 100), constrain?: \"width\"|\"height\"|null (Constrain Ratio: the mosaic keeps the image's proportions, the named side's size leads and the other side's is worked out from it), useRatio?: bool|\"width\"|\"height\" (square tiles as drawn, spacing taken off: the count on the side named, or with true on the constrained side, columns by default, stays and the other is the count, 1..1000, whose tiles come closest to square), spacingX=0, spacingY=0 (pt between tiles), gray?: bool, deleteRaster?: bool} a group of rectangles coloured by the selected image's average tile colours → {id, tiles, columns, rows}", has_image, object_mosaic ), @@ -891,7 +891,23 @@ pub(crate) fn has_image(s: &Session) -> std::result::Result<(), String> { } } -fn object_mosaic(s: &mut Session, p: &Value) -> Result { +/// What `object.createObjectMosaic` makes from its params: the image, the tile counts, the tiles' +/// placement, their size and spacing in image pixels, and the options. +struct MosaicPlan { + id: NodeId, + im: ImageObject, + cols: u32, + rows: u32, + xf: Affine, + tile: (f64, f64), + gap: (f64, f64), + gray: bool, + delete: bool, +} + +/// The mosaic `object.createObjectMosaic` would make from `p`, worked out without decoding the +/// image or changing the document. +fn mosaic_plan(s: &Session, p: &Value) -> Result { const C: &str = "object.createObjectMosaic"; let st = s.doc()?; let id = st @@ -901,28 +917,92 @@ fn object_mosaic(s: &mut Session, p: &Value) -> Result { .copied() .find(|id| matches!(st.doc.node(*id).map(|n| &n.kind), Some(NodeKind::Image(_)))) .ok_or_else(|| bad(C, "select an image"))?; - let node = st.doc.node(id).cloned().ok_or(EngineError::NoNode(id))?; + let node = st.doc.node(id).ok_or(EngineError::NoNode(id))?; let NodeKind::Image(im) = &node.kind else { return Err(bad(C, "select an image")) }; - let blob = st.doc.images.get(&im.key).filter(|b| !b.bytes.is_empty()).ok_or_else(|| bad(C, "the image has no embedded pixels"))?; - let raster = vectorcraft_trace::Raster::decode(&blob.bytes).map_err(|e| bad(C, e.to_string()))?; - let cols = whole_or(p, "columns", 10, C)?.clamp(1, 1000) as u32; - let rows = whole_or(p, "rows", 10, C)?.clamp(1, 1000) as u32; + if !st.doc.images.get(&im.key).is_some_and(|b| !b.bytes.is_empty()) { + return Err(bad(C, "the image has no embedded pixels")); + } + let mut cols = whole_or(p, "columns", 10, C)?.clamp(1, 1000) as u32; + let mut rows = whole_or(p, "rows", 10, C)?.clamp(1, 1000) as u32; let gray = switch_or(p, "gray", false, C)?; - let colors = vectorcraft_trace::mosaic(&raster, cols, rows); + let percentages = switch_or(p, "percentages", false, C)?; + // A side named "width" (true) or "height" (false), as `constrain` and `useRatio` take it. + let side = |key: &str, v: &Value, also: &str| match v.as_str() { + Some("width") => Ok(true), + Some("height") => Ok(false), + _ => Err(bad(C, format!("`{key}` must be one of {}", format_args!("\"width\", \"height\"{also} or null")))), + }; + let constrain = match p.get("constrain") { + None | Some(Value::Null) => None, + Some(v) => Some(side("constrain", v, "")?), + }; + // Use Ratio's kept side: true keeps Constrain Ratio's side (the width when it is left out). + let use_ratio = match p.get("useRatio") { + None | Some(Value::Null | Value::Bool(false)) => None, + Some(Value::Bool(true)) => Some(constrain.unwrap_or(true)), + Some(v) => Some(side("useRatio", v, ", true, false")?), + }; // Tiles in image space, placed by the image transform (scaled to a new size if asked). let b = node.geometric_bounds().ok_or_else(|| bad(C, "image has no bounds"))?; check_numbers(p, &["width", "height", "spacingX", "spacingY"], C)?; - let (nw, nh) = (f64_or(p, "width", b.width()).max(0.1), f64_or(p, "height", b.height()).max(0.1)); - let resize = Affine::translate(b.origin().to_vec2()) - * Affine::scale_non_uniform(nw / b.width().max(1e-9), nh / b.height().max(1e-9)) - * Affine::translate(-b.origin().to_vec2()); + let (bw, bh) = (b.width().max(1e-9), b.height().max(1e-9)); + // A size given (pt, or % of the image's) is from 0.1 to 1,000,000; one left out is the image's. + let size = |key: &str, base: f64| -> Result { + let Some(x) = p.get(key).and_then(Value::as_f64) else { return Ok(base) }; + let (min, max) = (0.1, 1_000_000.0); + if !(min..=max).contains(&x) { + return Err(bad(C, format!("`{key}` must be between {min} and {max} (got {x})"))); + } + Ok(if percentages { base * x / 100.0 } else { x }) + }; + let (mut nw, mut nh) = (size("width", bw)?, size("height", bh)?); + // Constrain Ratio keeps the image's proportions: the named side leads and the other follows. + match constrain { + Some(true) => nh = nw * bh / bw, + Some(false) => nw = nh * bw / bh, + None => {} + } + // A size under 0.1 pt grows to 0.1 pt, in proportion while Constrain Ratio keeps it. + let (nw, nh) = match constrain { + Some(_) => { + let k = (0.1 / nw.min(nh)).max(1.0); + (nw * k, nh * k) + } + None => (nw.max(0.1), nh.max(0.1)), + }; + let resize = Affine::translate(b.origin().to_vec2()) * Affine::scale_non_uniform(nw / bw, nh / bh) * Affine::translate(-b.origin().to_vec2()); let xf = resize * im.xf; - let (tw, th) = (im.width as f64 / cols as f64, im.height as f64 / rows as f64); - // Spacing is in points; convert to image pixels along each axis. + // Points per image pixel along each of the image's axes (the image may be turned). let ppx = (xf * Point::new(1.0, 0.0) - xf * Point::ZERO).hypot().max(1e-9); let ppy = (xf * Point::new(0.0, 1.0) - xf * Point::ZERO).hypot().max(1e-9); - let (gx, gy) = ((f64_or(p, "spacingX", 0.0).max(0.0) / ppx).min(tw * 0.9), (f64_or(p, "spacingY", 0.0).max(0.0) / ppy).min(th * 0.9)); + let (sx, sy) = (f64_or(p, "spacingX", 0.0).max(0.0), f64_or(p, "spacingY", 0.0).max(0.0)); + let (iw, ih) = (im.width as f64, im.height as f64); + // Use Ratio: square tiles as drawn, spacing taken off, from the count on the kept side, + // measured along the image's axes. + match use_ratio { + Some(true) => rows = mosaic_square_count(cols, iw * ppx, ih * ppy, sx, sy), + Some(false) => cols = mosaic_square_count(rows, ih * ppy, iw * ppx, sy, sx), + None => {} + } + let (tw, th) = (iw / cols as f64, ih / rows as f64); + // Spacing is in points; convert to image pixels along each axis. + let gap = ((sx / ppx).min(tw * 0.9), (sy / ppy).min(th * 0.9)); let delete = switch_or(p, "deleteRaster", false, C)?; + Ok(MosaicPlan { id, im: im.as_ref().clone(), cols, rows, xf, tile: (tw, th), gap, gray, delete }) +} + +/// The tile counts (columns, rows) `object.createObjectMosaic` would use with `p`, Use Ratio +/// included, without making the mosaic (the dialog's Use Ratio button shows them). +pub fn mosaic_counts(s: &Session, p: &Value) -> Result<(u32, u32)> { + mosaic_plan(s, p).map(|m| (m.cols, m.rows)) +} + +fn object_mosaic(s: &mut Session, p: &Value) -> Result { + const C: &str = "object.createObjectMosaic"; + let MosaicPlan { id, im, cols, rows, xf, tile: (tw, th), gap: (gx, gy), gray, delete } = mosaic_plan(s, p)?; + let blob = s.doc()?.doc.images.get(&im.key).ok_or_else(|| bad(C, "the image has no embedded pixels"))?; + let raster = vectorcraft_trace::Raster::decode(&blob.bytes).map_err(|e| bad(C, e.to_string()))?; + let colors = vectorcraft_trace::mosaic(&raster, cols, rows); let (gid, n) = s.edit("Create Object Mosaic", |d, sel| { let mut tiles = vec![]; for r in 0..rows { @@ -960,7 +1040,32 @@ fn object_mosaic(s: &mut Session, p: &Value) -> Result { sel.set([gid]); Ok((gid, n)) })?; - Ok(json!({ "id": gid.0, "tiles": n })) + Ok(json!({ "id": gid.0, "tiles": n, "columns": cols, "rows": rows })) +} + +/// The tile count along one side of an Object Mosaic whose tiles, as drawn, come closest to square +/// (Use Ratio): `kept` tiles span `kept_len` on the other side, and this side is `other_len` long. +/// Each tile is its cell less the gap on its side (`kept_gap`, `other_gap`), and a gap takes at +/// most 90% of a cell, as the tiles are drawn. Within 1..1000, the smaller count on a tie; all +/// lengths in points. +pub(crate) fn mosaic_square_count(kept: u32, kept_len: f64, other_len: f64, kept_gap: f64, other_gap: f64) -> u32 { + let drawn = |len: f64, n: u32, gap: f64| { + let cell = len / n.max(1) as f64; + cell - gap.max(0.0).min(cell * 0.9) + }; + let side = drawn(kept_len, kept, kept_gap); + if !(side.is_finite() && side > 0.0 && other_len.is_finite() && other_len > 0.0) { + return 1; + } + // A tile on this side shrinks as the count grows: find the first count whose tile is no wider + // than `side`, then take it or the count before it, whichever is closer. + let (mut lo, mut hi) = (1u32, 1000u32); + while lo < hi { + let mid = (lo + hi) / 2; + if drawn(other_len, mid, other_gap) > side { lo = mid + 1 } else { hi = mid } + } + let off = |n: u32| (drawn(other_len, n, other_gap) - side).abs(); + if lo > 1 && off(lo - 1) <= off(lo) { lo - 1 } else { lo } } fn polygon_path(pts: &[Point]) -> PathData { diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 57445a36be..8f7cf46950 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -4035,6 +4035,114 @@ fn object_mosaic_refuses_a_boolean_given_as_text() { assert_eq!((r["tiles"].clone(), images(&s)), (json!(2), 1)); } +/// The size of the mosaic a call makes from the 100 × 50 pt image selected in `s`, with its column and row counts. +fn mosaic_size(s: &mut Session, p: serde_json::Value) -> (f64, f64, serde_json::Value, serde_json::Value) { + let image = s.doc().unwrap().selection.objects.clone(); + let r = s.execute("object.createObjectMosaic", &p).unwrap(); + let b = s.doc().unwrap().doc.node(NodeId(r["id"].as_u64().unwrap())).unwrap().geometric_bounds().unwrap(); + s.execute("select.set", &json!({ "ids": image })).unwrap(); + ((b.width() * 1e6).round() / 1e6, (b.height() * 1e6).round() / 1e6, r["columns"].clone(), r["rows"].clone()) +} + +/// Resize Using Percentages reads the new width and height as percentages of the image's size; Constrain Ratio keeps +/// the image's proportions, the named side leading; Use Ratio makes the tiles square from the count on the +/// constrained side (columns by default), and the call answers the counts it used. +#[test] +fn object_mosaic_resizes_by_percentages_constrains_the_ratio_and_squares_the_tiles() { + let mut s = session(); + rect(&mut s, 0.0, 0.0, 100.0, 50.0); + s.execute("paint.setStroke", &json!({"none": true})).unwrap(); + s.execute("object.rasterize", &json!({"ppi": 72})).unwrap(); + assert_eq!(mosaic_size(&mut s, json!({"columns": 2, "rows": 1})), (100.0, 50.0, json!(2), json!(1))); + assert_eq!(mosaic_size(&mut s, json!({"width": 50, "height": 200, "percentages": true})), (50.0, 100.0, json!(10), json!(10))); + // A side left out is 100% of the image's. + assert_eq!(mosaic_size(&mut s, json!({"width": 150, "percentages": true})).0, 150.0); + assert_eq!(mosaic_size(&mut s, json!({"width": 200, "height": 10, "constrain": "width"})), (200.0, 100.0, json!(10), json!(10))); + assert_eq!(mosaic_size(&mut s, json!({"width": 10, "height": 25, "constrain": "height"})), (50.0, 25.0, json!(10), json!(10))); + assert_eq!(mosaic_size(&mut s, json!({"width": 50, "constrain": "width", "percentages": true})), (50.0, 25.0, json!(10), json!(10))); + // Square tiles: 10 columns of 10 pt over 50 pt are 5 rows; 4 rows of 12.5 pt over 100 pt are 8 columns. + assert_eq!(mosaic_size(&mut s, json!({"columns": 10, "rows": 3, "useRatio": true})), (100.0, 50.0, json!(10), json!(5))); + assert_eq!(mosaic_size(&mut s, json!({"columns": 3, "rows": 4, "useRatio": true, "constrain": "height"})), (100.0, 50.0, json!(8), json!(4))); + // A side named for Use Ratio is kept without Constrain Ratio: the size stays as given. + assert_eq!(mosaic_size(&mut s, json!({"rows": 4, "height": 100, "useRatio": "height"})), (100.0, 100.0, json!(4), json!(4))); + // On a new size: 30 columns over 300 × 50 pt are 5 rows. + assert_eq!(mosaic_size(&mut s, json!({"columns": 30, "width": 300, "useRatio": true})), (300.0, 50.0, json!(30), json!(5))); + // The count is kept within 1..1000. + assert_eq!(mosaic_size(&mut s, json!({"columns": 1, "width": 1, "height": 5000, "useRatio": true})).3, json!(1000)); + assert_eq!(mosaic_size(&mut s, json!({"columns": 1, "width": 5000, "height": 1, "useRatio": true})).3, json!(1)); + // A size under 0.1 pt grows in proportion while Constrain Ratio keeps it. + let (w, h, ..) = mosaic_size(&mut s, json!({"width": 0.1, "constrain": "width"})); + assert!((w - 0.2).abs() < 1e-6 && (h - 0.1).abs() < 1e-6, "{w} × {h}"); +} + +/// Use Ratio squares the tiles as drawn: with 4 pt between columns, 10 columns of 10 pt cells draw 6 pt wide, so the +/// rows are 6 pt plus their own 4 pt apart (5 rows down 50 pt); on an image turned 90°, the tiles are measured along +/// its own axes. +#[test] +fn object_mosaic_use_ratio_takes_spacing_and_turned_images_into_account() { + let mut s = session(); + rect(&mut s, 0.0, 0.0, 100.0, 50.0); + s.execute("paint.setStroke", &json!({"none": true})).unwrap(); + s.execute("object.rasterize", &json!({"ppi": 72})).unwrap(); + let image = s.doc().unwrap().selection.objects.clone(); + let counts = |s: &Session, p: serde_json::Value| crate::cmd::mosaic_counts(s, &p).unwrap(); + assert_eq!(counts(&s, json!({"columns": 10, "useRatio": true, "spacingX": 4, "spacingY": 4})), (10, 5)); + assert_eq!(counts(&s, json!({"columns": 10, "useRatio": true, "spacingX": 4})), (10, 8)); + assert_eq!(counts(&s, json!({"columns": 10, "rows": 7})), (10, 7), "without Use Ratio the counts are kept"); + let r = s.execute("object.createObjectMosaic", &json!({"columns": 10, "useRatio": true, "spacingX": 4})).unwrap(); + let g = s.doc().unwrap().doc.node(NodeId(r["id"].as_u64().unwrap())).unwrap().clone(); + let t = g.children().unwrap()[0].geometric_bounds().unwrap(); + assert!((t.width() - 6.0).abs() < 1e-6 && (t.height() - 6.25).abs() < 1e-6, "{t:?}"); + s.execute("edit.undo", &json!({})).unwrap(); + s.execute("select.set", &json!({ "ids": image })).unwrap(); + // Turned 90°, the image's 100 pt side runs down the page; 10 columns along it are still 5 rows across its 50. + s.execute("object.rotate", &json!({"angle": 90})).unwrap(); + assert_eq!(counts(&s, json!({"columns": 10, "useRatio": true})), (10, 5)); +} + +#[test] +fn object_mosaic_square_count_is_the_nearest_whole_count() { + use crate::cmd::menucmds::mosaic_square_count; + assert_eq!(mosaic_square_count(10, 100.0, 50.0, 0.0, 0.0), 5); + assert_eq!(mosaic_square_count(3, 100.0, 50.0, 0.0, 0.0), 2); + assert_eq!(mosaic_square_count(0, 100.0, 50.0, 0.0, 0.0), 1); + assert_eq!(mosaic_square_count(10, 0.0, 50.0, 0.0, 0.0), 1); + assert_eq!(mosaic_square_count(1000, 1.0, 1000.0, 0.0, 0.0), 1000); + // Spacing wider than a cell leaves 10% of it, on either side. + assert_eq!(mosaic_square_count(10, 100.0, 50.0, 50.0, 0.0), 50); + // 10 columns of 1 pt tiles (9 pt gaps) over 100 pt; rows 100 pt apart are capped too, so 10 rows draw 1 pt. + assert_eq!(mosaic_square_count(10, 100.0, 100.0, 9.0, 100.0), 10); + // 15 pt tiles over 50 pt: 3 rows draw 16.7 pt and 4 rows 12.5 pt, so 3. + assert_eq!(mosaic_square_count(1, 15.0, 50.0, 0.0, 0.0), 3); +} + +/// A Constrain Ratio side that is not "width" or "height", a new size of 0 or less, and Use Ratio or Resize Using +/// Percentages given as text are errors naming the key; no mosaic is made. +#[test] +fn object_mosaic_refuses_a_bad_ratio_side_size_or_switch() { + let mut s = session(); + rect(&mut s, 0.0, 0.0, 100.0, 50.0); + s.execute("object.rasterize", &json!({"ppi": 72})).unwrap(); + let undo = |s: &Session| s.doc().unwrap().history.undo.len(); + let before = undo(&s); + for (p, msg) in [ + (json!({"constrain": "both"}), "`constrain` must be one of \"width\", \"height\" or null"), + (json!({"constrain": 1}), "`constrain` must be one of \"width\", \"height\" or null"), + (json!({"width": 0}), "`width` must be between 0.1 and 1000000 (got 0)"), + (json!({"height": -5, "percentages": true}), "`height` must be between 0.1 and 1000000 (got -5)"), + (json!({"width": 2e6, "percentages": true}), "`width` must be between 0.1 and 1000000 (got 2000000)"), + (json!({"useRatio": "true"}), "`useRatio` must be one of \"width\", \"height\", true, false or null"), + (json!({"useRatio": 1}), "`useRatio` must be one of \"width\", \"height\", true, false or null"), + (json!({"percentages": 1}), "`percentages` must be true or false"), + ] { + let r = s.execute("object.createObjectMosaic", &p); + assert!(matches!(&r, Err(EngineError::BadParams { msg: m, .. }) if m == msg), "{p}: {r:?}"); + assert_eq!(undo(&s), before, "{p}"); + } + let r = s.execute("object.createObjectMosaic", &json!({"constrain": null, "useRatio": null, "percentages": null})).unwrap(); + assert_eq!(r["tiles"], json!(100)); +} + #[test] fn snap_to_pixel_rounds_drawing_and_moves() { let mut s = session(); diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 5afad21b0d..e05da0a333 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -78,6 +78,7 @@ pub mod new_color_group; mod new_document; pub mod new_swatch; pub mod new_text_style; +pub mod object_mosaic; pub mod objects_on_path_options; pub mod office_export; pub mod package; @@ -428,6 +429,7 @@ registry! { ScriptClose: [script_run::CLOSE_KIND] => script_run::CLOSE_SPEC, ScriptNotice: [script_run::NOTICE_KIND] => script_run::NOTICE_SPEC, VectorHalftone: [halftone::KIND] => halftone::SPEC, + ObjectMosaic: [object_mosaic::KIND] => object_mosaic::SPEC, SimplifySlider: [simplify_slider::KIND] => simplify_slider::SPEC, SmoothSlider: [smooth_slider::KIND] => smooth_slider::SPEC, PerspectiveGrid: [perspective_grid::KIND] => perspective_grid::SPEC, @@ -593,6 +595,11 @@ pub fn set_field(d: &mut Dialog, field: String, value: Value) { if d.kind == "preferences" { crate::prefs_dialog::note_set(d, &field, &value); } + // Create Object Mosaic's Resize Using Percentages shows the new size the other way, as its checkbox does. + if d.kind == object_mosaic::KIND && field == "percentages" { + object_mosaic::set_percentages(d, &value); + return; + } let dxf = (d.kind == dxf_options::KIND).then(|| field.clone()); d.fields.insert(field, value); if let Some(field) = dxf { diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs new file mode 100644 index 0000000000..ed8b060a92 --- /dev/null +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -0,0 +1,468 @@ +//! Object → Create Object Mosaic: the selected image's Current Size, the mosaic's New Size, Tile +//! Spacing and Number of Tiles, Constrain Ratio (Width or Height), Result (Color or Grayscale), +//! Resize Using Percentages, Delete Raster and Use Ratio. OK runs `object.createObjectMosaic` as one +//! undo step. +//! +//! Fields: `width`, `height` (pt, or percentages of the image's size with `percentages`), +//! `spacingX`, `spacingY` (pt), `columns`, `rows`, `lock` (Constrain Ratio on), `constrain` +//! (`width` | `height`: the side Constrain Ratio and Use Ratio keep), `gray`, `percentages` and +//! `deleteRaster`. `__imageW` and `__imageH` hold the image's size (pt). + +use serde_json::{Value, json}; +use vectorcraft_doc::NodeKind; + +use super::{DialogSpec, form, run_and_close}; +use crate::state::Dialog; +use crate::{VectorcraftApp, widgets}; + +/// The dialog kind of Create Object Mosaic. +pub const KIND: &str = "objectMosaic"; + +/// The command the dialog runs. +pub const COMMAND: &str = "object.createObjectMosaic"; + +/// Width of the label column. +const LABEL_W: f32 = 112.0; + +/// Width of a size or count field. +const FIELD_W: f32 = 76.0; + +pub(super) const SPEC: DialogSpec = + DialogSpec { heading: |_| tl!("Create Object Mosaic").into(), body, confirm, min_width: 360.0, ..DialogSpec::FORM }; + +/// The size (pt) of the first selected image, which the mosaic is made from. +fn image_size(app: &VectorcraftApp) -> Option<(f64, f64)> { + let st = app.session.active()?; + let node = st.selection.objects.iter().filter_map(|id| st.doc.node(*id)).find(|n| matches!(n.kind, NodeKind::Image(_)))?; + let b = node.geometric_bounds()?; + Some((b.width(), b.height())) +} + +/// Open the dialog on the selected image, with the values `given` holds (the menu item's params, or +/// a caller's `object.createObjectMosaic` params, its Use Ratio applied to the counts) and the +/// command's defaults for the rest. With no image selected, or with params the command refuses, +/// nothing opens and the error says why. +pub fn open(app: &mut VectorcraftApp, given: &Value) -> Result { + let Some((w, h)) = image_size(app) else { return Err("select an image".into()) }; + let none = json!({}); + let given = if given.is_null() { &none } else { given }; + app.session.check_params(COMMAND, given).map_err(|e| e.to_string())?; + let (cols, rows) = vectorcraft_engine::cmd::mosaic_counts(&app.session, given).map_err(|e| e.to_string())?; + let n = |key: &str, d: f64| given.get(key).and_then(Value::as_f64).unwrap_or(d); + let b = |key: &str| given.get(key).and_then(Value::as_bool).unwrap_or(false); + let pct = b("percentages"); + // The new size starts at the image's, within the sizes the command takes (0.1 to 1,000,000 pt). + let (base_w, base_h) = if pct { (100.0, 100.0) } else { (w.clamp(0.1, 1.0e6), h.clamp(0.1, 1.0e6)) }; + let named = |key: &str| given.get(key).and_then(Value::as_str).filter(|s| matches!(*s, "width" | "height")); + let constrain = named("constrain"); + // The side the dialog keeps: Constrain Ratio's, else the one Use Ratio names. + let side = constrain.or(named("useRatio")).unwrap_or("width"); + let fields = json!({ + "width": n("width", base_w), "height": n("height", base_h), "spacingX": n("spacingX", 0.0), "spacingY": n("spacingY", 0.0), + "columns": cols, "rows": rows, + "lock": constrain.is_some(), "constrain": side, "gray": b("gray"), "percentages": pct, + "deleteRaster": b("deleteRaster"), "__imageW": w, "__imageH": h, + }); + app.ui.dialog = Some(Dialog::new(KIND, fields)); + Ok(json!({ "dialog": KIND })) +} + +/// The image's size (pt) the dialog holds. +fn image(d: &Dialog) -> (f64, f64) { + (d.f64("__imageW", 1.0).max(1e-9), d.f64("__imageH", 1.0).max(1e-9)) +} + +/// Whether Constrain Ratio and Use Ratio keep the width (else the height). +fn keeps_width(d: &Dialog) -> bool { + d.str("constrain") != "height" +} + +/// With Constrain Ratio on, the side that follows set from the side that leads, in the image's +/// proportions. +fn follow_ratio(d: &mut Dialog) { + if !d.bool("lock") { + return; + } + let (iw, ih) = image(d); + let pct = d.bool("percentages"); + if keeps_width(d) { + let w = d.f64("width", 0.0); + d.fields.insert("height".into(), json!(if pct { w } else { w * ih / iw })); + } else { + let h = d.f64("height", 0.0); + d.fields.insert("width".into(), json!(if pct { h } else { h * iw / ih })); + } +} + +/// Resize Using Percentages turned on or off: the new size shown the other way, so it stays the +/// same size. +fn switch_percentages(d: &mut Dialog, on: bool) { + let (iw, ih) = image(d); + let (w, h) = (d.f64("width", iw), d.f64("height", ih)); + let (w, h) = if on { (w / iw * 100.0, h / ih * 100.0) } else { (iw * w / 100.0, ih * h / 100.0) }; + d.fields.insert("width".into(), json!(w)); + d.fields.insert("height".into(), json!(h)); + d.fields.insert("percentages".into(), json!(on)); +} + +/// `ui.dialog.set` of `percentages`: true or false switches the new size as the checkbox does; +/// another value is kept as it is, and the command refuses it on OK. +pub(super) fn set_percentages(d: &mut Dialog, value: &Value) { + match value.as_bool() { + Some(on) if on != d.bool("percentages") => switch_percentages(d, on), + Some(_) => {} + None => { + d.fields.insert("percentages".into(), value.clone()); + } + } +} + +/// Use Ratio: the count on the kept side stays and the other makes the tiles square, as the +/// command counts them for the fields as they are (Constrain Ratio's side, the new size and the +/// spacing). +fn use_ratio(app: &VectorcraftApp, d: &mut Dialog) { + let mut p = params(d); + p["useRatio"] = json!(if keeps_width(d) { "width" } else { "height" }); + match vectorcraft_engine::cmd::mosaic_counts(&app.session, &p) { + Ok((cols, rows)) => { + d.fields.insert("columns".into(), json!(cols)); + d.fields.insert("rows".into(), json!(rows)); + } + Err(e) => form::note_refusal(d, &e), + } +} + +/// Field `key` as `object.createObjectMosaic` takes it: a number (text with a unit, as +/// `ui.dialog.set` may give it, read in points), `default` when the field is missing, and any other +/// value as it is, for the command to refuse. +fn number(d: &Dialog, key: &str, default: f64) -> Value { + match d.fields.get(key) { + None => json!(default), + Some(Value::String(s)) => vectorcraft_doc::Unit::Points.parse(s).map_or_else(|| json!(s), |v| json!(v)), + Some(v) => v.clone(), + } +} + +/// Field `key` as the command takes an on/off value: false when the field is missing, and any +/// other value as it is, for the command to refuse one that is not true or false. +fn switch(d: &Dialog, key: &str) -> Value { + d.fields.get(key).cloned().unwrap_or(json!(false)) +} + +/// `object.createObjectMosaic` parameters from the fields. +fn params(d: &Dialog) -> Value { + json!({ + "columns": number(d, "columns", 10.0), "rows": number(d, "rows", 10.0), + "width": number(d, "width", 100.0), "height": number(d, "height", 100.0), "percentages": switch(d, "percentages"), + "constrain": if d.bool("lock") { json!(if keeps_width(d) { "width" } else { "height" }) } else { Value::Null }, + "spacingX": number(d, "spacingX", 0.0), "spacingY": number(d, "spacingY", 0.0), + "gray": switch(d, "gray"), "deleteRaster": switch(d, "deleteRaster"), + }) +} + +/// A Width and a Height field for `keys`: lengths in `unit` of at least `least` points, or +/// percentages with `pct`. With `follows`, the field of that key is grayed (Constrain Ratio sets it). +fn pair(ui: &mut egui::Ui, d: &mut Dialog, keys: [&str; 2], unit: vectorcraft_doc::Unit, (pct, least): (bool, f64), follows: Option<&str>) { + for (key, label) in keys.into_iter().zip([tl!("Width:"), tl!("Height:")]) { + widgets::dim_label(ui, label); + ui.add_enabled_ui(follows != Some(key), |ui| { + if pct { + if let Some(v) = widgets::spin_plain(ui, ("mosaic", key), d.f64(key, 100.0), "%", 2, FIELD_W, 1.0, 0.1, &[]) { + d.fields.insert(key.into(), json!(v)); + } + } else { + form::length_within(ui, d, key, unit, FIELD_W, Some(least..=1.0e6)); + } + }); + } +} + +fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { + let unit = app.session.general_unit(); + let (iw, ih) = image(d); + widgets::label_row(ui, tl!("Current Size:"), LABEL_W, |ui| { + widgets::dim_label(ui, tl!("Width:")); + widgets::dim_name(ui, &unit.format(iw)); + widgets::dim_label(ui, tl!("Height:")); + widgets::dim_name(ui, &unit.format(ih)); + }); + ui.add_space(4.0); + let follows = d.bool("lock").then(|| if keeps_width(d) { "height" } else { "width" }); + let pct = d.bool("percentages"); + widgets::label_row(ui, tl!("New Size:"), LABEL_W, |ui| pair(ui, d, ["width", "height"], unit, (pct, 0.1), follows)); + follow_ratio(d); + ui.add_space(4.0); + widgets::label_row(ui, tl!("Tile Spacing:"), LABEL_W, |ui| pair(ui, d, ["spacingX", "spacingY"], unit, (false, 0.0), None)); + ui.add_space(4.0); + widgets::label_row(ui, tl!("Number of Tiles:"), LABEL_W, |ui| { + for (key, label) in [("columns", tl!("Width:")), ("rows", tl!("Height:"))] { + widgets::dim_label(ui, label); + if let Some(v) = widgets::spin_plain(ui, ("mosaic", key), d.f64(key, 10.0), "", 0, FIELD_W, 1.0, 1.0, &[]) { + d.fields.insert(key.into(), json!(v.round().clamp(1.0, 1000.0))); + } + } + }); + ui.add_space(4.0); + widgets::label_row(ui, tl!("Constrain Ratio:"), LABEL_W, |ui| { + form::check(ui, d, "lock", tl!("Constrain Width and Height Proportions")); + let width = keeps_width(d); + if widgets::radio(ui, tl!("Width"), width, true) { + d.fields.insert("constrain".into(), json!("width")); + } + if widgets::radio(ui, tl!("Height"), !width, true) { + d.fields.insert("constrain".into(), json!("height")); + } + }); + follow_ratio(d); + ui.add_space(4.0); + widgets::label_row(ui, tl!("Result:"), LABEL_W, |ui| { + let gray = d.bool("gray"); + if widgets::radio(ui, tl!("Color"), !gray, true) { + d.fields.insert("gray".into(), json!(false)); + } + if widgets::radio(ui, tl!("Grayscale"), gray, true) { + d.fields.insert("gray".into(), json!(true)); + } + }); + ui.add_space(4.0); + widgets::label_row(ui, tl!("Options:"), LABEL_W, |ui| { + ui.vertical(|ui| { + if widgets::check(ui, tl!("Resize Using Percentages"), pct, true) { + switch_percentages(d, !pct); + } + form::check(ui, d, "deleteRaster", tl!("Delete Raster")); + }); + }); + ui.add_space(6.0); + if widgets::flat_button(ui, tl!("Use Ratio"), 96.0).clicked() { + use_ratio(app, d); + } + false +} + +fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { + run_and_close(app, COMMAND, params(d)) +} + +#[cfg(test)] +mod tests { + use super::*; + use vectorcraft_engine::Session; + + /// A frame of the open dialog → the texts painted. The dialog measures itself on its first + /// frame, so a fresh context needs two. + fn frame(app: &mut VectorcraftApp, ctx: &egui::Context) -> Vec { + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| super::super::show(app, ui.ctx())); + out.textures_delta.clear(); + out.shapes.iter().filter_map(|s| if let egui::epaint::Shape::Text(t) = &s.shape { Some(t.galley.text().to_string()) } else { None }).collect() + } + + fn context() -> egui::Context { + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + ctx + } + + /// A tile count the dialog holds. + fn count(d: &Dialog, key: &str) -> u32 { + d.f64(key, 0.0) as u32 + } + + /// An app with a 100 × 50 pt embedded image selected. + fn app_with_image() -> VectorcraftApp { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 400})).unwrap(); + app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 100, "height": 50})).unwrap(); + app.run("paint.setStroke", json!({"none": true})).unwrap(); + app.run("object.rasterize", json!({"ppi": 72})).unwrap(); + app + } + + /// The mosaic group's size and tile count. + fn mosaic(app: &VectorcraftApp) -> Option<(f64, f64, usize)> { + let mut found = None; + app.session.active()?.doc.walk(|n| { + if n.name.as_deref() == Some("Object Mosaic") { + let b = n.geometric_bounds().unwrap(); + found = Some(((b.width() * 1e6).round() / 1e6, (b.height() * 1e6).round() / 1e6, n.children().map_or(0, |c| c.len()))); + } + }); + found + } + + fn open_from_menu(app: &mut VectorcraftApp) { + let entry = crate::menus::menu_entries(app).into_iter().find(|e| e.label == "Create Object Mosaic…").expect("menu item"); + let (cmd, params) = crate::menus::click_target(&entry.label, entry.command.as_deref().unwrap(), &entry.params); + crate::menus::invoke(app, &cmd, params); + } + + /// The menu item opens this dialog, not the generic one, on the image's size, with every documented row; OK + /// makes the mosaic as one undo step. + #[test] + fn the_menu_item_opens_the_dialog_with_its_rows() { + let mut app = app_with_image(); + open_from_menu(&mut app); + let d = app.ui.dialog.as_ref().expect("a dialog"); + assert_eq!(d.kind, KIND); + assert_eq!((d.f64("width", 0.0), d.f64("height", 0.0), d.f64("columns", 0.0), d.f64("rows", 0.0)), (100.0, 50.0, 10.0, 10.0)); + let ctx = context(); + frame(&mut app, &ctx); + let texts = frame(&mut app, &ctx); + for want in [ + "Create Object Mosaic", + "Current Size:", + "New Size:", + "Tile Spacing:", + "Number of Tiles:", + "Constrain Ratio:", + "Constrain Width and Height Proportions", + "Result:", + "Color", + "Grayscale", + "Resize Using Percentages", + "Delete Raster", + "Use Ratio", + "100 pt", + "50 pt", + ] { + assert!(texts.iter().any(|t| t == want), "{want:?} in {texts:?}"); + } + let undo = app.session.doc().unwrap().history.undo.len(); + crate::dialogs::confirm(&mut app).unwrap(); + assert!(app.ui.dialog.is_none()); + assert_eq!(mosaic(&app), Some((100.0, 50.0, 100))); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1); + } + + /// An image narrower than 0.1 pt opens with a new width of 0.1 pt, which OK makes. + #[test] + fn a_tiny_image_opens_with_a_size_the_command_takes() { + let mut app = app_with_image(); + app.run("object.scale", json!({"sx": 0.05, "sy": 100})).unwrap(); + open(&mut app, &json!({})).unwrap(); + assert_eq!(app.ui.dialog.as_ref().unwrap().f64("width", 0.0), 0.1); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(mosaic(&app).map(|m| m.0), Some(0.1)); + } + + /// With no image selected the dialog does not open and the error says why. + #[test] + fn without_an_image_nothing_opens() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 400})).unwrap(); + app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 100, "height": 50})).unwrap(); + let e = open(&mut app, &json!({})).unwrap_err(); + assert!(app.ui.dialog.is_none()); + assert!(e.contains("select an image"), "{e}"); + } + + /// Constrain Ratio keeps the new size in the image's proportions from the side it names; Resize Using + /// Percentages shows the same size as percentages; Use Ratio makes the tiles square from the kept side's count. + #[test] + fn constrain_ratio_percentages_and_use_ratio_set_the_fields() { + let mut app = app_with_image(); + open(&mut app, &json!({"columns": 10, "rows": 10})).unwrap(); + let ctx = context(); + frame(&mut app, &ctx); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("lock".into(), json!(true)); + d.fields.insert("width".into(), json!(300)); + frame(&mut app, &ctx); + let mut d = app.ui.dialog.take().unwrap(); + assert_eq!(d.f64("height", 0.0), 150.0, "height follows the width"); + // Percentages: 300 × 150 pt of a 100 × 50 pt image is 300%. + switch_percentages(&mut d, true); + assert_eq!((d.f64("width", 0.0), d.f64("height", 0.0)), (300.0, 300.0)); + // Use Ratio: 10 columns across 300 pt are 30 pt tiles, so 5 rows down 150 pt. + use_ratio(&app, &mut d); + assert_eq!((count(&d, "columns"), count(&d, "rows")), (10, 5)); + // Kept by height: 4 rows of 37.5 pt over 300 pt are 8 columns. + d.fields.insert("constrain".into(), json!("height")); + d.fields.insert("rows".into(), json!(4)); + use_ratio(&app, &mut d); + assert_eq!((count(&d, "columns"), count(&d, "rows")), (8, 4)); + switch_percentages(&mut d, false); + assert_eq!((d.f64("width", 0.0), d.f64("height", 0.0)), (300.0, 150.0)); + d.fields.insert("gray".into(), json!(true)); + app.ui.dialog = Some(d); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(mosaic(&app), Some((300.0, 150.0, 32))); + } + + /// A caller's params open the dialog with their values, and OK makes the mosaic they ask for. + #[test] + fn a_callers_params_open_the_dialog_with_their_values() { + let mut app = app_with_image(); + let params = json!({"columns": 4, "rows": 2, "width": 200, "percentages": true, "constrain": "width", "gray": true}); + app.run("ui.paramDialog", json!({"command": COMMAND, "label": "Create Object Mosaic", "params": params})).unwrap(); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!(d.kind, KIND); + assert_eq!( + (d.f64("width", 0.0), d.bool("percentages"), d.bool("lock"), d.str("constrain"), d.bool("gray")), + (200.0, true, true, "width".into(), true) + ); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(mosaic(&app), Some((200.0, 100.0, 8))); + // Use Ratio given applies to the counts shown: 10 columns over 100 × 50 pt are 5 rows. + app.run("select.set", json!({"ids": [image_id(&app)]})).unwrap(); + let params = json!({"columns": 10, "rows": 3, "useRatio": true}); + app.run("ui.paramDialog", json!({"command": COMMAND, "params": params})).unwrap(); + assert_eq!(count(app.ui.dialog.as_ref().unwrap(), "rows"), 5); + // A side Use Ratio names is the side the dialog keeps: 4 rows over 100 × 50 pt are 8 columns. + let params = json!({"columns": 3, "rows": 4, "useRatio": "height"}); + app.run("ui.paramDialog", json!({"command": COMMAND, "params": params})).unwrap(); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!((count(d, "columns"), count(d, "rows"), d.str("constrain"), d.bool("lock")), (8, 4, "height".into(), false)); + app.ui.dialog = None; + // Params the command refuses open nothing and say why. + for (bad, key) in [(json!({"width": "abc"}), "width"), (json!({"constrain": "both"}), "constrain"), (json!({"widht": 200}), "widht")] { + let e = app.run("ui.paramDialog", json!({"command": COMMAND, "params": bad})).unwrap_err(); + assert!(app.ui.dialog.is_none(), "{e}"); + assert!(e.contains(key), "{e}"); + } + } + + /// `ui.dialog.set` of Resize Using Percentages shows the new size the other way, as the checkbox + /// does, so OK makes the same mosaic. Values the command refuses, set that way, are refused on OK + /// and make no mosaic. + #[test] + fn setting_fields_from_outside_keeps_the_size_or_is_refused() { + let mut app = app_with_image(); + open(&mut app, &json!({"width": 200, "height": 100})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + crate::dialogs::set_field(d, "percentages".into(), json!(true)); + assert_eq!((d.f64("width", 0.0), d.f64("height", 0.0), d.bool("percentages")), (200.0, 200.0, true)); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(mosaic(&app).map(|m| (m.0, m.1)), Some((200.0, 100.0))); + app.run("edit.undo", json!({})).unwrap(); + for (field, value) in [("percentages", json!("yes")), ("width", json!("abc")), ("gray", json!(1))] { + app.run("select.set", json!({"ids": [image_id(&app)]})).unwrap(); + open(&mut app, &json!({})).unwrap(); + crate::dialogs::set_field(app.ui.dialog.as_mut().unwrap(), field.into(), value); + let e = crate::dialogs::confirm(&mut app).unwrap_err(); + assert!(e.contains(field), "{field}: {e}"); + assert_eq!(mosaic(&app), None, "{field}"); + } + } + + /// The id of the image in the document. + fn image_id(app: &VectorcraftApp) -> u64 { + let mut id = None; + app.session.active().unwrap().doc.walk(|n| { + if matches!(n.kind, NodeKind::Image(_)) { + id = Some(n.id.0); + } + }); + id.unwrap() + } + + /// #1000: the count the dialog holds reaches the command, so a count of 3.0 makes three columns. + #[test] + fn a_count_reaches_the_command() { + let mut app = app_with_image(); + open_from_menu(&mut app); + app.ui.dialog.as_mut().unwrap().fields.insert("columns".into(), json!(3.0)); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(mosaic(&app).map(|m| m.2), Some(30)); + } +} diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index 3ce5455437..d50b08f97f 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -1128,8 +1128,8 @@ fn a_hex_code_pasted_into_the_hex_field_replaces_its_digits() { } } -/// #1000: a count typed in Object › Create Object Mosaic… reaches the command (a whole number typed -/// in a command's dialog is an integer), so the mosaic has that many columns, not the 10 × 10 grid. +/// #1000: a count set in Object › Create Object Mosaic… reaches the command, so the mosaic has that +/// many columns, not the 10 × 10 grid; Enter confirms the dialog. #[test] fn object_mosaic_makes_the_grid_typed_in_its_dialog() { let mut app = app(); @@ -1145,9 +1145,9 @@ fn object_mosaic_makes_the_grid_typed_in_its_dialog() { let entry = crate::menus::menu_entries(&app).into_iter().find(|e| e.label == "Create Object Mosaic…").expect("menu item"); let (cmd, params) = crate::menus::click_target(&entry.label, entry.command.as_deref().unwrap(), &entry.params); crate::menus::invoke(&mut app, &cmd, params); - // Its first field, Columns, is focused: type 3 over it and press Enter. frame(&mut app, vec![]); - frame(&mut app, vec![egui::Event::Text("3".into())]); + app.ui.dialog.as_mut().expect("the mosaic dialog").fields.insert("columns".into(), json!(3.0)); + frame(&mut app, vec![]); let enter = egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }; frame(&mut app, vec![enter]); assert!(app.ui.dialog.is_none()); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 28944173dd..da7fdcc70a 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -668,6 +668,16 @@ font-technology Variable Променливи Create New Swatch… Създаване на нов образец… Create New {kind} Style Създаване на нов стил за {kind} Create Object Mosaic… Създаване на обектова мозайка… + Create Object Mosaic Създаване на обектова мозайка + Current Size: Текущ размер: + New Size: Нов размер: + Tile Spacing: Разстояние между плочките: + Number of Tiles: Брой плочки: + Constrain Ratio: Ограничаване на съотношението: + Result: Резултат: + Resize Using Percentages Преоразмеряване с проценти + Delete Raster Изтриване на растерното изображение + Use Ratio Използване на съотношението Create Outlines Създаване на контур Create Path Създаване на път Create PDF layers from layers and sublayers Създаване на PDF слоеве от слоеве и подслоеве diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 01b90e5148..88530380fb 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -219,6 +219,16 @@ Rasterize… Rasteriziraj… Create Gradient Mesh… Kreiraj gradijentnu mrežu… Create Object Mosaic… Kreiraj mozaik objekata… + Create Object Mosaic Kreiraj mozaik objekata + Current Size: Trenutna veličina: + New Size: Nova veličina: + Tile Spacing: Razmak između pločica: + Number of Tiles: Broj pločica: + Constrain Ratio: Ograniči omjer: + Result: Rezultat: + Resize Using Percentages Promijeni veličinu u postocima + Delete Raster Izbriši rastersku sliku + Use Ratio Koristi omjer Vector Halftone… Vektorski polutonovi… Create Trim Marks Kreiraj oznake za obrezivanje Flatten Transparency… Spljošti prozirnost… diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 4ddd1d5605..120a525639 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -979,6 +979,16 @@ antiAlias Sharp Nítid Create New Swatch… Crea una mostra nova… Create New {kind} Style Crea un estil de {kind} nou Create Object Mosaic… Crea un mosaic d’objectes… + Create Object Mosaic Crea un mosaic d’objectes + Current Size: Mida actual: + New Size: Mida nova: + Tile Spacing: Espaiat de les tessel·les: + Number of Tiles: Nombre de tessel·les: + Constrain Ratio: Restringeix la proporció: + Result: Resultat: + Resize Using Percentages Canvia la mida amb percentatges + Delete Raster Suprimeix la imatge ràster + Use Ratio Usa la proporció Create Outlines Crea contorns Create Path Crea un traçat Create PDF layers from layers and sublayers Crea capes de PDF a partir de capes i subcapes diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 211982f086..328b60a247 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -225,6 +225,16 @@ Rasterize… Rastrovat… Create Gradient Mesh… Vytvořit přechodovou síť… Create Object Mosaic… Vytvořit mozaiku objektů… + Create Object Mosaic Vytvořit mozaiku objektů + Current Size: Aktuální velikost: + New Size: Nová velikost: + Tile Spacing: Rozestupy dlaždic: + Number of Tiles: Počet dlaždic: + Constrain Ratio: Zachovat poměr: + Result: Výsledek: + Resize Using Percentages Změnit velikost v procentech + Delete Raster Odstranit rastrový obraz + Use Ratio Použít poměr Vector Halftone… Vektorový polotón… Create Trim Marks Vytvořit značky ořezu Flatten Transparency… Sloučit průhlednost… diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index b3de0ae89a..65d141c988 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -212,6 +212,16 @@ Rasterize… Rasterisér… Create Gradient Mesh… Opret gradientnet… Create Object Mosaic… Opret objektmosaik… + Create Object Mosaic Opret objektmosaik + Current Size: Aktuel størrelse: + New Size: Ny størrelse: + Tile Spacing: Mellemrum mellem fliser: + Number of Tiles: Antal fliser: + Constrain Ratio: Begræns forhold: + Result: Resultat: + Resize Using Percentages Tilpas størrelse med procenter + Delete Raster Slet rasterbillede + Use Ratio Brug forhold Vector Halftone… Vektorhalvtone… Create Trim Marks Opret beskæringsmærker Flatten Transparency… Udjævn gennemsigtighed… diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index d0610144ef..d64a3ec160 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -661,6 +661,16 @@ font-technology Variable Variabel Create New Swatch… Neues Farbfeld erstellen… Create New {kind} Style Neues {kind}format erstellen Create Object Mosaic… Objektmosaik erstellen… + Create Object Mosaic Objektmosaik erstellen + Current Size: Aktuelle Größe: + New Size: Neue Größe: + Tile Spacing: Kachelabstand: + Number of Tiles: Anzahl der Kacheln: + Constrain Ratio: Proportionen beschränken: + Result: Ergebnis: + Resize Using Percentages Größe in Prozent ändern + Delete Raster Pixelbild löschen + Use Ratio Verhältnis verwenden Create Outlines In Pfade umwandeln Create Path Pfad erstellen Create PDF layers from layers and sublayers PDF-Ebenen aus Ebenen und Unterebenen erstellen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index d03f8c6958..b2b525911b 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -642,6 +642,16 @@ font-technology Variable Μεταβλητές Create New Swatch… Δημιουργία νέου δείγματος χρώματος… Create New {kind} Style Δημιουργία νέου στυλ {kind} Create Object Mosaic… Δημιουργία μωσαϊκού αντικειμένων… + Create Object Mosaic Δημιουργία μωσαϊκού αντικειμένων + Current Size: Τρέχον μέγεθος: + New Size: Νέο μέγεθος: + Tile Spacing: Απόσταση πλακιδίων: + Number of Tiles: Αριθμός πλακιδίων: + Constrain Ratio: Περιορισμός αναλογίας: + Result: Αποτέλεσμα: + Resize Using Percentages Αλλαγή μεγέθους με ποσοστά + Delete Raster Διαγραφή εικόνας εικονοστοιχείων + Use Ratio Χρήση αναλογίας Create Outlines Δημιουργία περιγραμμάτων Create Path Δημιουργία διαδρομής Create PDF layers from layers and sublayers Δημιουργία επιπέδων PDF από επίπεδα και υποεπίπεδα diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 3e8bd23752..df7bf676a7 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -683,6 +683,16 @@ font-technology Variable Variables Create New Swatch… Crear muestra nueva… Create New {kind} Style Crear estilo de {kind} nuevo Create Object Mosaic… Crear mosaico de objetos… + Create Object Mosaic Crear mosaico de objetos + Current Size: Tamaño actual: + New Size: Tamaño nuevo: + Tile Spacing: Espaciado de teselas: + Number of Tiles: Número de teselas: + Constrain Ratio: Limitar proporción: + Result: Resultado: + Resize Using Percentages Cambiar tamaño con porcentajes + Delete Raster Eliminar imagen rasterizada + Use Ratio Usar proporción Create Outlines Crear contornos Create Path Crear trazado Create PDF layers from layers and sublayers Crear capas PDF a partir de las capas y subcapas diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index d408220f47..97cb15c00e 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -232,6 +232,16 @@ Rasterize… Rasteroi… Create Gradient Mesh… Luo liukuväriverkko… Create Object Mosaic… Luo objektimosaiikki… + Create Object Mosaic Luo objektimosaiikki + Current Size: Nykyinen koko: + New Size: Uusi koko: + Tile Spacing: Laattojen välistys: + Number of Tiles: Laattojen määrä: + Constrain Ratio: Rajoita suhdetta: + Result: Tulos: + Resize Using Percentages Muuta kokoa prosentteina + Delete Raster Poista rasterikuva + Use Ratio Käytä suhdetta Vector Halftone… Vektorirasterointi… Create Trim Marks Luo leikkuumerkit Flatten Transparency… Litistä läpinäkyvyys… diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 318bbbeb44..0c88b39ea4 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -684,6 +684,16 @@ font-technology Variable Variables Create New Swatch… Créer une nuance… Create New {kind} Style Créer un style de {kind} Create Object Mosaic… Créer une mosaïque d’objets… + Create Object Mosaic Créer une mosaïque d’objets + Current Size: Taille actuelle : + New Size: Nouvelle taille : + Tile Spacing: Espacement des carreaux : + Number of Tiles: Nombre de carreaux : + Constrain Ratio: Conserver les proportions : + Result: Résultat : + Resize Using Percentages Redimensionner en pourcentage + Delete Raster Supprimer l’image pixellisée + Use Ratio Utiliser le rapport Create Outlines Vectoriser Create Path Créer un tracé Create PDF layers from layers and sublayers Créer des calques PDF à partir des calques et sous-calques diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index 716d851655..672077c95d 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -783,6 +783,15 @@ Create New Swatch… નવો સ્વેચ બનાવો… Create Object Mosaic ઑબ્જેક્ટ મોઝેઇક બનાવો Create Object Mosaic… ઑબ્જેક્ટ મોઝેઇક બનાવો… + Current Size: વર્તમાન કદ: + New Size: નવું કદ: + Tile Spacing: ટાઇલ વચ્ચે અંતર: + Number of Tiles: ટાઇલની સંખ્યા: + Constrain Ratio: ગુણોત્તર જાળવો: + Result: પરિણામ: + Resize Using Percentages ટકાવારીથી કદ બદલો + Delete Raster રાસ્ટર છબી કાઢી નાખો + Use Ratio ગુણોત્તર વાપરો Create Outlines આઉટલાઇન બનાવો Create PDF layers from layers and sublayers લેયર અને સબલેયરમાંથી PDF લેયર બનાવો Create PDF-Compatible File PDF-સુસંગત ફાઇલ બનાવો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 78c0a9a7eb..26eebd7628 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -1117,6 +1117,15 @@ antiAlias Sharp शार्प Create New Swatch… नया स्वॉच बनाएँ… Create Object Mosaic ऑब्जेक्ट मोज़ेक बनाएँ Create Object Mosaic… ऑब्जेक्ट मोज़ेक बनाएँ… + Current Size: वर्तमान साइज़: + New Size: नया साइज़: + Tile Spacing: टाइल स्पेसिंग: + Number of Tiles: टाइलों की संख्या: + Constrain Ratio: अनुपात सीमित करें: + Result: परिणाम: + Resize Using Percentages प्रतिशत से साइज़ बदलें + Delete Raster रास्टर इमेज हटाएँ + Use Ratio अनुपात इस्तेमाल करें Create Outlines आउटलाइन बनाएँ Create Path पाथ बनाएँ Create PDF layers from layers and sublayers लेयर्स और सबलेयरों से PDF लेयरें बनाएं diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index a1f6100b2f..8ae9f8db91 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -881,6 +881,16 @@ font-technology Variable Változó Create New Swatch… Új színminta létrehozása… Create New {kind} Style Új stílus létrehozása: {kind} Create Object Mosaic… Objektummozaik létrehozása… + Create Object Mosaic Objektummozaik létrehozása + Current Size: Jelenlegi méret: + New Size: Új méret: + Tile Spacing: Csempék térköze: + Number of Tiles: Csempék száma: + Constrain Ratio: Arány rögzítése: + Result: Eredmény: + Resize Using Percentages Átméretezés százalékban + Delete Raster Raszterkép törlése + Use Ratio Arány használata Create Outlines Átalakítás útvonallá Create Path Útvonal létrehozása Create PDF layers from layers and sublayers PDF-rétegek létrehozása a rétegekből és alrétegekből diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index c7c6b956db..af0cdf56d3 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -212,6 +212,16 @@ Rasterize… Rasterisasi… Create Gradient Mesh… Buat mesh gradien… Create Object Mosaic… Buat mozaik objek… + Create Object Mosaic Buat mozaik objek + Current Size: Ukuran saat ini: + New Size: Ukuran baru: + Tile Spacing: Spasi ubin: + Number of Tiles: Jumlah ubin: + Constrain Ratio: Batasi rasio: + Result: Hasil: + Resize Using Percentages Ubah ukuran dengan persentase + Delete Raster Hapus gambar raster + Use Ratio Gunakan rasio Vector Halftone… Halftone vektor… Create Trim Marks Buat tanda potong Flatten Transparency… Ratakan transparansi… diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 6743704785..3a0c6aba8b 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -683,6 +683,16 @@ font-technology Variable Variabili Create New Swatch… Crea nuovo campione… Create New {kind} Style Crea nuovo stile {kind} Create Object Mosaic… Crea mosaico di oggetti… + Create Object Mosaic Crea mosaico di oggetti + Current Size: Dimensione attuale: + New Size: Nuova dimensione: + Tile Spacing: Spaziatura tessere: + Number of Tiles: Numero di tessere: + Constrain Ratio: Vincola proporzioni: + Result: Risultato: + Resize Using Percentages Ridimensiona in percentuale + Delete Raster Elimina immagine raster + Use Ratio Usa proporzioni Create Outlines Crea contorni Create Path Crea tracciato Create PDF layers from layers and sublayers Crea livelli PDF dai livelli e sottolivelli diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c9cdb8fcbe..6ea5212bf5 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -261,6 +261,16 @@ digits Malayalam マラヤーラム数字 Rasterize… ラスタライズ… Create Gradient Mesh… グラデーションメッシュを作成… Create Object Mosaic… モザイクオブジェクトを作成… + Create Object Mosaic モザイクオブジェクトを作成 + Current Size: 現在のサイズ: + New Size: 新しいサイズ: + Tile Spacing: タイルの間隔: + Number of Tiles: タイル数: + Constrain Ratio: 比率を固定: + Result: 結果: + Resize Using Percentages パーセントでサイズを変更 + Delete Raster ラスター画像を削除 + Use Ratio 比率を使用 Vector Halftone… ベクターハーフトーン… Create Trim Marks トリムマークを作成 Flatten Transparency… 透明部分を分割・統合… diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 55f726dc38..dd799eccd4 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -183,6 +183,16 @@ Rasterize… რასტრირება… Create Gradient Mesh… გრადიენტული ბადის შექმნა… Create Object Mosaic… ობიექტების მოზაიკის შექმნა… + Create Object Mosaic ობიექტების მოზაიკის შექმნა + Current Size: მიმდინარე ზომა: + New Size: ახალი ზომა: + Tile Spacing: ფილებს შორის ინტერვალი: + Number of Tiles: ფილების რაოდენობა: + Constrain Ratio: პროპორციის შეზღუდვა: + Result: შედეგი: + Resize Using Percentages ზომის შეცვლა პროცენტებით + Delete Raster რასტრული გამოსახულების წაშლა + Use Ratio პროპორციის გამოყენება Vector Halftone… ვექტორული ნახევარტონი… Create Trim Marks ჭრის ნიშნების შექმნა Flatten Transparency… გამჭვირვალობის გაბრტყელება… diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index abe2b4bc28..d7aff86dba 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -254,6 +254,16 @@ digits Malayalam 말라얄람어 Rasterize… 래스터화… Create Gradient Mesh… 그레이디언트 메시 만들기… Create Object Mosaic… 개체 모자이크 만들기… + Create Object Mosaic 개체 모자이크 만들기 + Current Size: 현재 크기: + New Size: 새 크기: + Tile Spacing: 타일 간격: + Number of Tiles: 타일 수: + Constrain Ratio: 비율 제한: + Result: 결과: + Resize Using Percentages 백분율로 크기 조정 + Delete Raster 래스터 이미지 삭제 + Use Ratio 비율 사용 Vector Halftone… 벡터 하프톤… Create Trim Marks 트림 마크 만들기 Flatten Transparency… 투명도 병합… diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index ed281382a4..8737dbfb32 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -730,6 +730,16 @@ Rasterize… Rasteriseren… Create Gradient Mesh… Verloopmesh maken… Create Object Mosaic… Objectmozaïek maken… + Create Object Mosaic Objectmozaïek maken + Current Size: Huidige grootte: + New Size: Nieuwe grootte: + Tile Spacing: Tussenruimte tegels: + Number of Tiles: Aantal tegels: + Constrain Ratio: Verhouding beperken: + Result: Resultaat: + Resize Using Percentages Grootte wijzigen met percentages + Delete Raster Rasterafbeelding verwijderen + Use Ratio Verhouding gebruiken Vector Halftone… Vectorhalftoon… Create Trim Marks Afsnijtekens maken Flatten Transparency… Transparantie afvlakken… diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 08e96e6a35..736f3931fe 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -189,6 +189,16 @@ Rasterize… Rasteryzuj… Create Gradient Mesh… Utwórz siatkę gradientową… Create Object Mosaic… Utwórz mozaikę obiektów… + Create Object Mosaic Utwórz mozaikę obiektów + Current Size: Bieżący rozmiar: + New Size: Nowy rozmiar: + Tile Spacing: Odstęp między kafelkami: + Number of Tiles: Liczba kafelków: + Constrain Ratio: Ogranicz proporcje: + Result: Wynik: + Resize Using Percentages Zmień rozmiar w procentach + Delete Raster Usuń obraz rastrowy + Use Ratio Użyj proporcji Vector Halftone… Półton wektorowy… Create Trim Marks Utwórz znaczniki przycięcia Flatten Transparency… Spłaszcz przezroczystość… diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 79c4d9dc8e..ef6b2ffd91 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -608,6 +608,16 @@ antiAlias Sharp Nítido Create New Swatch… Criar Nova Amostra… Create New {kind} Style Criar Novo Estilo de {kind} Create Object Mosaic… Criar Mosaico de Objetos… + Create Object Mosaic Criar Mosaico de Objetos + Current Size: Tamanho atual: + New Size: Novo tamanho: + Tile Spacing: Espaçamento dos ladrilhos: + Number of Tiles: Número de ladrilhos: + Constrain Ratio: Restringir proporção: + Result: Resultado: + Resize Using Percentages Redimensionar usando porcentagens + Delete Raster Excluir imagem rasterizada + Use Ratio Usar proporção Create Outlines Criar Contornos Create PDF layers from layers and sublayers Criar camadas de PDF a partir das camadas e subcamadas Create PDF-Compatible File Criar Arquivo Compatível com PDF diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 9f608618e7..00ba36c68f 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -681,6 +681,16 @@ font-technology Variable Вариативные Create New Swatch… Создать новый образец… Create New {kind} Style Создать новый стиль {kind} Create Object Mosaic… Создать мозаику объектов… + Create Object Mosaic Создать мозаику объектов + Current Size: Текущий размер: + New Size: Новый размер: + Tile Spacing: Интервал между плитками: + Number of Tiles: Количество плиток: + Constrain Ratio: Сохранять пропорции: + Result: Результат: + Resize Using Percentages Изменить размер в процентах + Delete Raster Удалить растровое изображение + Use Ratio Использовать пропорции Create Outlines Создать контуры Create Path Создать контур Create PDF layers from layers and sublayers Создавать слои PDF из слоёв и подслоёв diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 6156ca23d5..64f32f05d7 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -670,6 +670,16 @@ font-technology Variable Variabla Create New Swatch… Skapa ny färgruta… Create New {kind} Style Skapa ny stil ({kind}) Create Object Mosaic… Skapa objektmosaik… + Create Object Mosaic Skapa objektmosaik + Current Size: Aktuell storlek: + New Size: Ny storlek: + Tile Spacing: Avstånd mellan plattor: + Number of Tiles: Antal plattor: + Constrain Ratio: Begränsa förhållande: + Result: Resultat: + Resize Using Percentages Ändra storlek med procent + Delete Raster Ta bort rasterbild + Use Ratio Använd förhållande Create Outlines Skapa konturbanor Create Path Skapa bana Create PDF layers from layers and sublayers Skapa PDF-lager från lager och underlager diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 7120d44707..089c4caa82 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -662,6 +662,16 @@ font-technology Variable Değişken Create New Swatch… Yeni Renk Örneği Oluştur… Create New {kind} Style Yeni {kind} Stili Oluşturun Create Object Mosaic… Nesne Mozaiği Oluştur… + Create Object Mosaic Nesne Mozaiği Oluştur + Current Size: Geçerli Boyut: + New Size: Yeni Boyut: + Tile Spacing: Döşeme Aralığı: + Number of Tiles: Döşeme Sayısı: + Constrain Ratio: Oranı Sınırla: + Result: Sonuç: + Resize Using Percentages Yüzdelerle Yeniden Boyutlandır + Delete Raster Raster Görüntüyü Sil + Use Ratio Oranı Kullan Create Outlines Anahatlar Oluştur Create Path Yol Oluştur Create PDF layers from layers and sublayers Katmanlardan ve alt katmanlardan PDF katmanları oluşturun diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 84f296b0a6..a50cb47980 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -677,6 +677,16 @@ font-technology Variable Варіативні Create New Swatch… Створити новий зразок… Create New {kind} Style Створити новий стиль {kind} Create Object Mosaic… Створити мозаїку об’єктів… + Create Object Mosaic Створити мозаїку об’єктів + Current Size: Поточний розмір: + New Size: Новий розмір: + Tile Spacing: Інтервал між плитками: + Number of Tiles: Кількість плиток: + Constrain Ratio: Зберігати пропорції: + Result: Результат: + Resize Using Percentages Змінити розмір у відсотках + Delete Raster Видалити растрове зображення + Use Ratio Використати пропорції Create Outlines Створити контури Create Path Створити контур Create PDF layers from layers and sublayers Створювати шари PDF із шарів та підшарів diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index e8b9e5758f..eabdc31ae6 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -782,6 +782,16 @@ font-technology Variable Biến thiên Create New Swatch… Tạo mẫu màu mới… Create New {kind} Style Tạo kiểu {kind} mới Create Object Mosaic… Tạo khảm đối tượng… + Create Object Mosaic Tạo khảm đối tượng + Current Size: Kích thước hiện tại: + New Size: Kích thước mới: + Tile Spacing: Khoảng cách ô: + Number of Tiles: Số ô: + Constrain Ratio: Ràng buộc tỷ lệ: + Result: Kết quả: + Resize Using Percentages Đổi kích thước theo phần trăm + Delete Raster Xóa ảnh raster + Use Ratio Dùng tỷ lệ Create Outlines Tạo đường bao Create Path Tạo đường dẫn Create PDF layers from layers and sublayers Tạo lớp PDF từ các lớp và lớp con diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 719968086f..b5f17c7d9d 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -628,6 +628,16 @@ antiAlias Sharp 锐利 Create New Swatch… 新建色板… Create New {kind} Style 创建新的{kind}样式 Create Object Mosaic… 创建对象马赛克… + Create Object Mosaic 创建对象马赛克 + Current Size: 当前尺寸: + New Size: 新尺寸: + Tile Spacing: 拼贴间距: + Number of Tiles: 拼贴数量: + Constrain Ratio: 约束比例: + Result: 结果: + Resize Using Percentages 使用百分比调整大小 + Delete Raster 删除栅格图像 + Use Ratio 使用比例 Create Outlines 创建轮廓 Create Path 创建路径 Create PDF layers from layers and sublayers 从图层和子图层创建 PDF 图层 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 121a8b8c02..3f1dd675b0 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -646,6 +646,16 @@ font-technology Variable 可變 Create New Swatch… 建立新色票… Create New {kind} Style 建立新的{kind}樣式 Create Object Mosaic… 建立物件馬賽克… + Create Object Mosaic 建立物件馬賽克 + Current Size: 目前大小: + New Size: 新大小: + Tile Spacing: 拼貼間距: + Number of Tiles: 拼貼數量: + Constrain Ratio: 限制比例: + Result: 結果: + Resize Using Percentages 使用百分比調整大小 + Delete Raster 刪除點陣圖 + Use Ratio 使用比例 Create Outlines 建立外框 Create Path 建立路徑 Create PDF layers from layers and sublayers 從圖層和子圖層建立 PDF 圖層 diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 7b7f7a6b21..ed5c94fbba 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -702,6 +702,10 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option { + crate::dialogs::object_mosaic::open(app, p.get("params").unwrap_or(&Value::Null)) + } "ui.paramDialog" => { let cmd = s("command").unwrap_or_default(); let mut fields = p.get("params").and_then(Value::as_object).cloned().unwrap_or_default(); diff --git a/docs/mcp.md b/docs/mcp.md index 2e43c14d0e..d760baa267 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1815,12 +1815,38 @@ nothing. These Object menu commands refuse a string, a number or another value that is not true or false with `` `copy` must be true or false ``, naming the key, and change nothing: `reflectX`, `reflectY`, `random`, `copy`, -`relative`, `strokes`, `corners`, `objects` and `patterns` in `object.transformEach`; `gray` and `deleteRaster` in -`object.createObjectMosaic`; `trim` in `object.cropImage`; `allArtboards` in `object.createTrimMarks`; and `byColumn`, +`relative`, `strokes`, `corners`, `objects` and `patterns` in `object.transformEach`; `gray`, `deleteRaster` +and `percentages` in `object.createObjectMosaic`; `trim` in `object.cropImage`; `allArtboards` in `object.createTrimMarks`; and `byColumn`, `moveArtwork`, `patterns` and `lockedAndHidden` in `artboard.rearrange`. A null is read as a key left out. `object.createTrimMarks` refuses a `style` that is not a string, such as `5`, with `` `style` must be roman or japanese ``, the message it gives for a string that names no style. +Object › Create Object Mosaic… opens a dialog on the selected image +([Create a mosaic from a bitmap image](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/create-mosaic-from-bitmap-image.html)): +Current Size, New Size, Tile Spacing, Number of Tiles, Constrain Ratio (Width or Height), Result (Color or +Grayscale), Resize Using Percentages, Delete Raster and Use Ratio. With no image selected it does not open. OK runs +`object.createObjectMosaic` as one undo step. The command takes: + +- `percentages: true`: `width` and `height` are percentages of the image's size (a side left out is 100). +- `constrain: "width"` or `"height"`: the mosaic keeps the image's proportions. The named side's size is used and the + other side's is worked out from it, so a `height` given with `constrain: "width"` is not used. +- `useRatio: "width"` or `"height"`: the tiles are square as drawn, with the spacing taken off. The count on the named + side (`columns` for `"width"`) stays, and the other count, within 1 to 1000, is the one whose tiles come closest to + square, measured along the image's own sides when it is turned. `useRatio: true` keeps the `constrain` side, or the + width when `constrain` is left out. This rounding is VectorCraft's own rule. The dialog's Use Ratio button sets the + counts the same way. + +A `width` or `height` outside 0.1 to 1000000 (points, or percent with `percentages`) is refused with +`` `width` must be between 0.1 and 1000000 (got 0) ``. A `constrain` other than `"width"`, `"height"` or null is +refused with `` `constrain` must be one of "width", "height" or null ``, and a `useRatio` other than those, true or +false with `` `useRatio` must be one of "width", "height", true, false or null ``; the command then changes nothing. A +side that `constrain` works out as under 0.1 pt grows to 0.1 pt, and the other side grows with it. The result also gives the `columns` and `rows` the mosaic was made with, here for a 100 × 50 pt image: + +```json +{"columns": 10, "rows": 3, "useRatio": true} +→ {"id": 42, "tiles": 50, "columns": 10, "rows": 5} +``` + A whole number that is larger than the build's `usize` can hold (4294967295 on a 32-bit build, such as the `wasm32-unknown-unknown` web build) counts as larger than any index, place, byte offset or count. An index, such as a `subpath`, `anchor`, `segment`, document `index`, `artboard`, appearance `item` or `index`, gradient `stop` or diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index c6375f3aa3..eb5428f4e2 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1319,6 +1319,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Initial live Revolve (#605, #846): a portable geometry and shading crate (`three-d`), editable path and compound profiles, compact options with artboard rotation and light gizmos, SVG/PDF vector output and Expand Appearance that can trim covered faces. Cap is on by default with continuous curved vector rims; shading uses vector gradients automatically, with sharp profile corners, uniform caps and round seam joins. The Lights list, Add Light and Delete Light manage one to ten independent colored lights; ambient is shared and visibility remains approximate ([revolve.md](revolve.md)). - Live effects with previewing dialogs: Distort & Transform, Path, Convert to Shape, 15 Warp styles, Round Corners, Scribble, Effect → Pathfinder (all 10 operations, live on groups; several loose objects are grouped first, in one undo step), Color Adjustments (Brightness/Contrast, Curves, Levels, Hue/Saturation, Shift to Color, Temperature/Tint, on vectors, live type and embedded images), and raster drop shadow, glows and feather. SVG and PDF export keep live effects (geometry baked; SVG raster effects as filters). Zig Zag spaces its ridges evenly along each segment, so lines and curves get a regular wave in Corner and Smooth (#1558). Warp › Arc (the effect and Envelope › Make with Warp) bends in the object's real proportions: a circular arc with concentric edges and no fold-over at 100%, so Arc on art that isn't square draws differently from before (#1581, fixes #1578). `effect.apply` and `effect.setParams` give an error for a misspelt or wrongly typed effect parameter instead of running the effect with its default (#1623, #1592). Roughen with Smooth keeps turn-backs smooth instead of making cusps that draw as spikes (#1646, #1643). Scribble draws one zig-zag per region, with no lines across holes and notches; convex shapes are unchanged (#1651, #1648). - Scribble (Effect › Stylize › Scribble…) has a Variation for each of Path Overlap, Curviness and Spacing ([Scribble options](https://helpx.adobe.com/illustrator/using/creating-sketches-mosaics.html)) (`overlapVariation`, `curvinessVariation`, `spacingVariation`), shown in its dialog and in the Appearance panel. A Scribble saved with the earlier single `variation` reads it as the Path Overlap and Spacing variations and draws as before. The angle is stored above -180° and up to 180°, so 270° is stored as -90°. + - Object › Create Object Mosaic… opens its own dialog on the selected image ([Create a mosaic from a bitmap image](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/create-mosaic-from-bitmap-image.html)): Current Size, New Size, Tile Spacing, Number of Tiles, Constrain Ratio (Width or Height), Result (Color or Grayscale), Resize Using Percentages, Delete Raster and Use Ratio. `object.createObjectMosaic` takes `percentages`, `constrain` and `useRatio`; Use Ratio keeps the constrained side's count and picks the other count whose tiles, spacing taken off, come closest to square, VectorCraft's own rule (`dialogs::object_mosaic::tests`, `tests::object_mosaic_resizes_by_percentages_constrains_the_ratio_and_squares_the_tiles`). - **Simplify feedback and component selection (#1272):** the existing tolerance dialog previews from the original interaction snapshot and shows original/new anchor counts. Preview off and Cancel restore the document and selection; OK is one Undo. A refit or Add Anchor Points clears component indexes only on paths whose geometry changes, keeping their objects selected whole and unchanged paths' components intact. Engine and real-egui frame regressions cover document/selection restoration and grouped paths. Public references: [Simplify benefits](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/simplify-path-benefits.html) and [advanced options](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/simplify-paths-advanced-options-overview.html). Nearly unchanged appearance is expected when reducing points. The checklist is partial, without raising scores. From 21edd7f6d85708b67c333eddcb5606416b35e215 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 15:42:57 -0800 Subject: [PATCH 015/158] i18n: Danish rows for Find and Replace messages --- crates/ui-egui/src/i18n/da.tsv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 19171ddcc0..e0b922564b 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -697,6 +697,9 @@ Search Backwards Søg baglæns Check Hidden Layers Kontrollér skjulte lag Check Locked Layers Kontrollér låste lag +@msg No matches found Ingen forekomster fundet +@msg Matches replaced: {n} Erstattede forekomster: {n} +@msg no match of `find` at bytes {_1}..{_2} of object {_3} ingen forekomst af `find` ved byte {_1}..{_2} i objekt {_3} Find Next Find næste Spelling Stavekontrol Auto Spell Check Automatisk stavekontrol From 95a237e57599f0b9aefa200553822c1955826933 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 17:14:51 -0800 Subject: [PATCH 016/158] Object Mosaic: a constrained size under the minimum grows in proportion With Constrain Ratio on, OK leaves out the side it sets while that side holds the size Constrain Ratio gave it, so the command works it out from the kept side and grows both in proportion to its 0.1 pt minimum. A kept width of 0.1 pt over a 100 x 50 pt image now makes a 0.2 x 0.1 pt mosaic instead of refusing the 0.05 pt height. Another value set on that side is still passed on for the command to check. Resize Using Percentages keeps the fields and the mode as they are when the size would fall outside 0.1 to 1000000 the other way, and the dialog shows the limit. The dialog also shows why Use Ratio was refused. Docs: docs/target-app-parity.md (image tools row). --- crates/ui-egui/src/dialogs/object_mosaic.rs | 112 +++++++++++++++++--- docs/target-app-parity.md | 2 +- 2 files changed, 97 insertions(+), 17 deletions(-) diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs index ed8b060a92..ca699569be 100644 --- a/crates/ui-egui/src/dialogs/object_mosaic.rs +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -13,6 +13,7 @@ use vectorcraft_doc::NodeKind; use super::{DialogSpec, form, run_and_close}; use crate::state::Dialog; +use crate::theme::Tokens; use crate::{VectorcraftApp, widgets}; /// The dialog kind of Create Object Mosaic. @@ -77,29 +78,51 @@ fn keeps_width(d: &Dialog) -> bool { d.str("constrain") != "height" } +/// With Constrain Ratio on, the size field that follows the kept side. +fn follower(d: &Dialog) -> Option<&'static str> { + d.bool("lock").then(|| if keeps_width(d) { "height" } else { "width" }) +} + +/// The new sizes the command takes, in points or percentages (`object.createObjectMosaic`). +const SIZE_RANGE: std::ops::RangeInclusive = 0.1..=1.0e6; + /// With Constrain Ratio on, the side that follows set from the side that leads, in the image's /// proportions. fn follow_ratio(d: &mut Dialog) { - if !d.bool("lock") { - return; - } - let (iw, ih) = image(d); - let pct = d.bool("percentages"); - if keeps_width(d) { - let w = d.f64("width", 0.0); - d.fields.insert("height".into(), json!(if pct { w } else { w * ih / iw })); - } else { - let h = d.f64("height", 0.0); - d.fields.insert("width".into(), json!(if pct { h } else { h * iw / ih })); + if let Some((key, v)) = derived(d) { + d.fields.insert(key.into(), json!(v)); } } +/// With Constrain Ratio on, the side that follows and the size it gets from the side that leads. +fn derived(d: &Dialog) -> Option<(&'static str, f64)> { + let key = follower(d)?; + let (iw, ih) = image(d); + let pct = d.bool("percentages"); + Some(if key == "height" { + let w = d.f64("width", 0.0); + (key, if pct { w } else { w * ih / iw }) + } else { + let h = d.f64("height", 0.0); + (key, if pct { h } else { h * iw / ih }) + }) +} + /// Resize Using Percentages turned on or off: the new size shown the other way, so it stays the -/// same size. +/// same size. When a size the command takes (all but the side Constrain Ratio sets) falls outside +/// what the command accepts the other way, the fields and the mode stay as they are and the dialog +/// shows the limit. fn switch_percentages(d: &mut Dialog, on: bool) { let (iw, ih) = image(d); let (w, h) = (d.f64("width", iw), d.f64("height", ih)); let (w, h) = if on { (w / iw * 100.0, h / ih * 100.0) } else { (iw * w / 100.0, ih * h / 100.0) }; + let skip = follower(d); + if let Some((key, v)) = [("width", w), ("height", h)].into_iter().find(|(k, v)| skip != Some(*k) && !SIZE_RANGE.contains(v)) { + let why = format!("`{key}` must be between {} and {} (got {v})", SIZE_RANGE.start(), SIZE_RANGE.end()); + d.fields.insert(form::REFUSED.into(), json!(why)); + return; + } + d.fields.remove(form::REFUSED); d.fields.insert("width".into(), json!(w)); d.fields.insert("height".into(), json!(h)); d.fields.insert("percentages".into(), json!(on)); @@ -125,6 +148,7 @@ fn use_ratio(app: &VectorcraftApp, d: &mut Dialog) { p["useRatio"] = json!(if keeps_width(d) { "width" } else { "height" }); match vectorcraft_engine::cmd::mosaic_counts(&app.session, &p) { Ok((cols, rows)) => { + d.fields.remove(form::REFUSED); d.fields.insert("columns".into(), json!(cols)); d.fields.insert("rows".into(), json!(rows)); } @@ -149,15 +173,24 @@ fn switch(d: &Dialog, key: &str) -> Value { d.fields.get(key).cloned().unwrap_or(json!(false)) } -/// `object.createObjectMosaic` parameters from the fields. +/// `object.createObjectMosaic` parameters from the fields. With Constrain Ratio on, the side it +/// sets is left out while it holds the size Constrain Ratio gives it: the command works it out from +/// the kept side and grows both in proportion to its 0.1 pt minimum. Any other value set on that +/// side is passed on for the command to check. fn params(d: &Dialog) -> Value { - json!({ + let mut p = json!({ "columns": number(d, "columns", 10.0), "rows": number(d, "rows", 10.0), "width": number(d, "width", 100.0), "height": number(d, "height", 100.0), "percentages": switch(d, "percentages"), "constrain": if d.bool("lock") { json!(if keeps_width(d) { "width" } else { "height" }) } else { Value::Null }, "spacingX": number(d, "spacingX", 0.0), "spacingY": number(d, "spacingY", 0.0), "gray": switch(d, "gray"), "deleteRaster": switch(d, "deleteRaster"), - }) + }); + if let (Some((key, v)), Some(o)) = (derived(d), p.as_object_mut()) + && o.get(key).and_then(Value::as_f64).is_some_and(|x| x == v) + { + o.remove(key); + } + p } /// A Width and a Height field for `keys`: lengths in `unit` of at least `least` points, or @@ -187,7 +220,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { widgets::dim_name(ui, &unit.format(ih)); }); ui.add_space(4.0); - let follows = d.bool("lock").then(|| if keeps_width(d) { "height" } else { "width" }); + let follows = follower(d); let pct = d.bool("percentages"); widgets::label_row(ui, tl!("New Size:"), LABEL_W, |ui| pair(ui, d, ["width", "height"], unit, (pct, 0.1), follows)); follow_ratio(d); @@ -233,6 +266,10 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { form::check(ui, d, "deleteRaster", tl!("Delete Raster")); }); }); + if let Some(why) = d.fields.get(form::REFUSED).and_then(Value::as_str) { + ui.add_space(4.0); + ui.add(egui::Label::new(egui::RichText::new(why).color(Tokens::get(ui.ctx()).warning)).wrap()); + } ui.add_space(6.0); if widgets::flat_button(ui, tl!("Use Ratio"), 96.0).clicked() { use_ratio(app, d); @@ -389,6 +426,23 @@ mod tests { assert_eq!(mosaic(&app), Some((300.0, 150.0, 32))); } + /// With Constrain Ratio on, a kept width of 0.1 pt over a 100 × 50 pt image sets a height of + /// 0.05 pt, under the command's minimum: OK makes the 0.2 × 0.1 pt mosaic the command grows it to. + #[test] + fn a_constrained_size_under_the_minimum_grows_in_proportion() { + let mut app = app_with_image(); + open(&mut app, &json!({})).unwrap(); + let ctx = context(); + frame(&mut app, &ctx); + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("lock".into(), json!(true)); + d.fields.insert("width".into(), json!(0.1)); + frame(&mut app, &ctx); + assert_eq!(app.ui.dialog.as_ref().unwrap().f64("height", 0.0), 0.05, "height follows the width"); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(mosaic(&app).map(|m| (m.0, m.1)), Some((0.2, 0.1))); + } + /// A caller's params open the dialog with their values, and OK makes the mosaic they ask for. #[test] fn a_callers_params_open_the_dialog_with_their_values() { @@ -435,6 +489,23 @@ mod tests { crate::dialogs::confirm(&mut app).unwrap(); assert_eq!(mosaic(&app).map(|m| (m.0, m.1)), Some((200.0, 100.0))); app.run("edit.undo", json!({})).unwrap(); + // 0.1 × 0.1 pt of a 1000 × 500 pt image are 0.01% × 0.02%, under the command's 0.1%: the + // points stay, with the limit shown, and OK makes that size. + app.run("select.set", json!({"ids": [image_id(&app)]})).unwrap(); + app.run("object.scale", json!({"sx": 1000, "sy": 1000})).unwrap(); + open(&mut app, &json!({"width": 0.1, "height": 0.1})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + crate::dialogs::set_field(d, "percentages".into(), json!(true)); + assert_eq!((d.f64("width", 0.0), d.f64("height", 0.0), d.bool("percentages")), (0.1, 0.1, false)); + assert!(d.str(form::REFUSED).contains("`width` must be between 0.1"), "{}", d.str(form::REFUSED)); + let ctx = context(); + frame(&mut app, &ctx); + let texts = frame(&mut app, &ctx); + assert!(texts.iter().any(|t| t.contains("must be between")), "the limit is shown: {texts:?}"); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(mosaic(&app).map(|m| (m.0, m.1)), Some((0.1, 0.1))); + app.run("edit.undo", json!({})).unwrap(); + app.run("edit.undo", json!({})).unwrap(); for (field, value) in [("percentages", json!("yes")), ("width", json!("abc")), ("gray", json!(1))] { app.run("select.set", json!({"ids": [image_id(&app)]})).unwrap(); open(&mut app, &json!({})).unwrap(); @@ -443,6 +514,15 @@ mod tests { assert!(e.contains(field), "{field}: {e}"); assert_eq!(mosaic(&app), None, "{field}"); } + // With Constrain Ratio on, a value the command refuses, set on the side it sets, is refused too. + for value in [json!("abc"), json!(0)] { + app.run("select.set", json!({"ids": [image_id(&app)]})).unwrap(); + open(&mut app, &json!({"constrain": "width"})).unwrap(); + crate::dialogs::set_field(app.ui.dialog.as_mut().unwrap(), "height".into(), value.clone()); + let e = crate::dialogs::confirm(&mut app).unwrap_err(); + assert!(e.contains("height"), "{value}: {e}"); + assert_eq!(mosaic(&app), None, "{value}"); + } } /// The id of the image in the document. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index eb5428f4e2..60ea6baab7 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -246,7 +246,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Symbols, blends, envelopes, Repeat, perspective | 5 | 88% | remaining: dynamic symbols' `.ai` round trip, further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons and Weather Icons are done), envelope Anti-Alias/Preserve Shape, 9-slice guides outside the art; Symbol Options › Registration, Export Type (Graphic / Movie Clip) and 9-slice guides (drawn and draggable during symbol editing, #5280) and Symbol Type (dynamic on-canvas fill/stroke including gradient/pattern, opacity and blend, #4938) are done | 4–7 | estimated; Blend panel Type and Ramp control step easing with a separate color Shift (#2539); Blend Options retains spacing and orientation; polynomial curves are original approximations; interactive selected mirror axis implemented; bounding-box handles take priority over the axis line (focused regression and native checks passed; full CI blocked by an unrelated text test); #2544 spine Anchor Point conversion and picking regression-tested | | Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (ruby, mojikumi), tab leaders, spell check (engine, custom dictionary and Auto Spell Check with its right-click suggestions and Spelling › Auto Spell Check, and the Edit Custom Dictionary dialog done, #4936; the Check Spelling dialog remains), Touch Type, Retype | 20–28 | estimated; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | | Symbols, blends, envelopes, Repeat, perspective | 5 | 88% | remaining: dynamic symbols' `.ai` round trip, further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons and Weather Icons are done), envelope Anti-Alias/Preserve Shape, 9-slice guides outside the art; Symbol Options › Registration, Export Type (Graphic / Movie Clip) and 9-slice guides (drawn and draggable during symbol editing, #5280) and Symbol Type (dynamic on-canvas fill/stroke including gradient/pattern, opacity and blend, #4938) are done | 4–7 | estimated; Blend panel Type and Ramp control step easing with a separate color Shift (#2539); Blend Options retains spacing and orientation; polynomial curves are original approximations; interactive selected mirror axis implemented; bounding-box handles take priority over the axis line (focused regression and native checks passed; full CI blocked by an unrelated text test); #2544 spine Anchor Point conversion and picking regression-tested | -| Image Trace, graphs, image tools | 3 | 75% | graph Column designs, Image Trace Create Strokes depth (Create Object Mosaic is done; junction-returning piece survival has source-generated regressions in `image-trace-quality.md`; simpler contour walk, identical output; an edge's sub-pixel shift is the same from either side; notches read only their own piece; collapsed loops keep few segments, so Paths is monotone on the code-drawn sweep) | 5–8 | estimated (raised from 72%); quick presets reveal adjustment controls, Properties reopens them; Live trace result bounds and selection highlights exclude the retained bitmap except in source-image views (scores/hours unchanged) | +| Image Trace, graphs, image tools | 3 | 75% | graph Column designs, Image Trace Create Strokes depth (Create Object Mosaic is done; junction-returning piece survival has source-generated regressions in `image-trace-quality.md`; simpler contour walk, identical output; an edge's sub-pixel shift is the same from either side; notches read only their own piece; collapsed loops keep few segments, so Paths is monotone on the code-drawn sweep) | 5–8 | estimated (raised from 72%); quick presets reveal adjustment controls, Properties reopens them; Live trace result bounds and selection highlights exclude the retained bitmap except in source-image views (scores/hours unchanged); Create Object Mosaic's dialog with New Size, Constrain Ratio, Resize Using Percentages and Use Ratio is covered by `dialogs::object_mosaic::tests` (score, gaps and hours unchanged) | | Live vector effects | 5 | 85% | Outline Object, SVG Filters | 4–8 | measured count 49/50 (Pathfinder 13/13 with Trap), depth estimated; Warp Options controls verified by focused checks and original-image review | | 3D and Materials (and Turntable) | 4 | ~25% | live Revolve with automatic smooth vector shading and default-on continuous circular caps, Extrude & Bevel (twist, taper, caps, five bevel shapes), Inflate and Rotate with Position presets (colored Inflate uses smooth membrane lighting; white-light Inflate retains its existing shading; Extrude & Bevel and Rotate retain planar shading; one to ten colored lights, shared neutral ambient, original lighting presets, painter visibility), Revolve (Classic) with Angle, Cap, Offset and the Plastic, Diffuse, No Shading and Wireframe surfaces, the Quick Actions › Expand as Wireframes command (#6354); materials, shadows, ray tracing, the rest of 3D Classic (Map Art), Turntable views, textures, map art and shading in 3D export | 30–55 | estimated (Extrude & Bevel, Inflate and Rotate added 2026-10-12); Revolve (Classic) is covered by the `revolve::classic` tests and `dialogs::revolve::tests::classic_revolve_shows_its_options_and_applies_as_one_step`; Expand as Wireframes is covered by `crates/effects/src/solids/wireframe/tests.rs` and `crates/engine/src/cmd/wireframe/tests.rs` (score, gaps and hours unchanged); every 3D seam has round joins (2026-11-12, [three-d.md](three-d.md#seams)), score, gaps and hours unchanged | | Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (mojikumi), variable font axes, tab leaders, spell check (engine, custom dictionary and Auto Spell Check with its right-click suggestions and Spelling › Auto Spell Check, and the Edit Custom Dictionary dialog done, #4936; the Check Spelling dialog remains), Touch Type, Retype | 20–28 | estimated; No Break keeps marked characters on one line; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | From 3183d77489a619e4ececebe32c5768267fbe88a7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 18:12:06 -0800 Subject: [PATCH 017/158] Object Mosaic: a refused size set on the constrained side stays for OK to report A new width or height that ui.dialog.set gives and the command refuses (not a number, or outside 0.1 to 1000000) now stays in its field, also on the side Constrain Ratio sets, until a size the command takes replaces it. Before, the next frame replaced it with the size worked out from the kept side, so OK made a mosaic instead of reporting it. --- crates/ui-egui/src/dialogs.rs | 4 ++ crates/ui-egui/src/dialogs/object_mosaic.rs | 59 +++++++++++++++++++-- 2 files changed, 59 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index e05da0a333..ee57b8010a 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -601,10 +601,14 @@ pub fn set_field(d: &mut Dialog, field: String, value: Value) { return; } let dxf = (d.kind == dxf_options::KIND).then(|| field.clone()); + let mosaic = (d.kind == object_mosaic::KIND).then(|| field.clone()); d.fields.insert(field, value); if let Some(field) = dxf { dxf_options::note_set(d, &field); } + if let Some(field) = mosaic { + object_mosaic::note_set(d, &field); + } } /// The fields `ui.dialog.set` can set on `d`, sorted: those it holds other than its `__` ones, the diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs index ca699569be..1ab1262952 100644 --- a/crates/ui-egui/src/dialogs/object_mosaic.rs +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -87,10 +87,41 @@ fn follower(d: &Dialog) -> Option<&'static str> { const SIZE_RANGE: std::ops::RangeInclusive = 0.1..=1.0e6; /// With Constrain Ratio on, the side that follows set from the side that leads, in the image's -/// proportions. +/// proportions. A size `ui.dialog.set` gave the following side that the command refuses stays, +/// for OK to report. fn follow_ratio(d: &mut Dialog) { - if let Some((key, v)) = derived(d) { - d.fields.insert(key.into(), json!(v)); + let Some((key, v)) = derived(d) else { return }; + if d.bool(&kept(key)) { + if !takes(d, key) { + return; + } + d.fields.remove(&kept(key)); + } + d.fields.insert(key.into(), json!(v)); +} + +/// The field that is true while size field `key` holds a value `ui.dialog.set` gave and the +/// command refuses. +fn kept(key: &str) -> String { + format!("__kept.{key}") +} + +/// Whether the command takes size field `key` as it is: a number from 0.1 to 1,000,000. +fn takes(d: &Dialog, key: &str) -> bool { + number(d, key, 0.0).as_f64().is_some_and(|x| SIZE_RANGE.contains(&x)) +} + +/// `ui.dialog.set` of `field`: a new size the command refuses (not a number, or outside 0.1 to +/// 1,000,000) stays in its field while it is refused, also on the side Constrain Ratio sets, instead +/// of being replaced by the size worked out from the kept side. +pub(super) fn note_set(d: &mut Dialog, field: &str) { + if !matches!(field, "width" | "height") { + return; + } + if takes(d, field) { + d.fields.remove(&kept(field)); + } else { + d.fields.insert(kept(field), json!(true)); } } @@ -514,15 +545,35 @@ mod tests { assert!(e.contains(field), "{field}: {e}"); assert_eq!(mosaic(&app), None, "{field}"); } - // With Constrain Ratio on, a value the command refuses, set on the side it sets, is refused too. + // With Constrain Ratio on, a value the command refuses, set on the side it sets, is refused + // too, also after a frame. for value in [json!("abc"), json!(0)] { app.run("select.set", json!({"ids": [image_id(&app)]})).unwrap(); open(&mut app, &json!({"constrain": "width"})).unwrap(); crate::dialogs::set_field(app.ui.dialog.as_mut().unwrap(), "height".into(), value.clone()); + frame(&mut app, &ctx); let e = crate::dialogs::confirm(&mut app).unwrap_err(); assert!(e.contains("height"), "{value}: {e}"); assert_eq!(mosaic(&app), None, "{value}"); } + // Once that side holds a size the command takes, Constrain Ratio sets it again. + app.run("select.set", json!({"ids": [image_id(&app)]})).unwrap(); + open(&mut app, &json!({"constrain": "width"})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + for (field, value) in [("height", json!(0)), ("lock", json!(false)), ("height", json!(80)), ("lock", json!(true))] { + crate::dialogs::set_field(d, field.into(), value); + } + frame(&mut app, &ctx); + assert_eq!(app.ui.dialog.as_ref().unwrap().f64("height", 0.0), 50.0); + // A refused height stays while a refused width is set and then corrected. + let d = app.ui.dialog.as_mut().unwrap(); + for (field, value) in [("height", json!(0)), ("width", json!(0)), ("width", json!(100))] { + crate::dialogs::set_field(d, field.into(), value); + } + frame(&mut app, &ctx); + let e = crate::dialogs::confirm(&mut app).unwrap_err(); + assert!(e.contains("height"), "{e}"); + assert_eq!(mosaic(&app), None); } /// The id of the image in the document. From 2242af85f7a8f40e01578f24c028e046f0e5f73f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 18:57:19 -0800 Subject: [PATCH 018/158] Object Mosaic: a size that is not a number, or a refused height, stays for OK to report Resize Using Percentages no longer replaces a width or height that is not a number with one converted from the image's size: the fields and the mode stay and the dialog shows why. With Constrain Ratio on, a refused size set on the constrained side is passed to the command even when it equals the size worked out from the kept side, so OK reports it. --- crates/ui-egui/src/dialogs/object_mosaic.rs | 49 ++++++++++++++++++--- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs index 1ab1262952..680ebd4d95 100644 --- a/crates/ui-egui/src/dialogs/object_mosaic.rs +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -140,12 +140,19 @@ fn derived(d: &Dialog) -> Option<(&'static str, f64)> { } /// Resize Using Percentages turned on or off: the new size shown the other way, so it stays the -/// same size. When a size the command takes (all but the side Constrain Ratio sets) falls outside -/// what the command accepts the other way, the fields and the mode stay as they are and the dialog -/// shows the limit. +/// same size. When a size field does not hold a number, or a size the command takes (all but the +/// side Constrain Ratio sets) falls outside what the command accepts the other way, the fields and +/// the mode stay as they are and the dialog shows why. fn switch_percentages(d: &mut Dialog, on: bool) { let (iw, ih) = image(d); - let (w, h) = (d.f64("width", iw), d.f64("height", ih)); + let size = |key: &str| number(d, key, 100.0).as_f64().ok_or_else(|| format!("`{key}` must be a number (got {})", d.str(key))); + let (w, h) = match (size("width"), size("height")) { + (Ok(w), Ok(h)) => (w, h), + (Err(why), _) | (_, Err(why)) => { + d.fields.insert(form::REFUSED.into(), json!(why)); + return; + } + }; let (w, h) = if on { (w / iw * 100.0, h / ih * 100.0) } else { (iw * w / 100.0, ih * h / 100.0) }; let skip = follower(d); if let Some((key, v)) = [("width", w), ("height", h)].into_iter().find(|(k, v)| skip != Some(*k) && !SIZE_RANGE.contains(v)) { @@ -207,7 +214,8 @@ fn switch(d: &Dialog, key: &str) -> Value { /// `object.createObjectMosaic` parameters from the fields. With Constrain Ratio on, the side it /// sets is left out while it holds the size Constrain Ratio gives it: the command works it out from /// the kept side and grows both in proportion to its 0.1 pt minimum. Any other value set on that -/// side is passed on for the command to check. +/// side, and a refused value `ui.dialog.set` gave it even when it equals that size, is passed on for +/// the command to check. fn params(d: &Dialog) -> Value { let mut p = json!({ "columns": number(d, "columns", 10.0), "rows": number(d, "rows", 10.0), @@ -217,6 +225,7 @@ fn params(d: &Dialog) -> Value { "gray": switch(d, "gray"), "deleteRaster": switch(d, "deleteRaster"), }); if let (Some((key, v)), Some(o)) = (derived(d), p.as_object_mut()) + && !d.bool(&kept(key)) && o.get(key).and_then(Value::as_f64).is_some_and(|x| x == v) { o.remove(key); @@ -576,6 +585,36 @@ mod tests { assert_eq!(mosaic(&app), None); } + /// A width `ui.dialog.set` gave that is not a number stays when Resize Using Percentages is set, + /// with the mode unchanged and the reason shown, and OK refuses it. + #[test] + fn a_size_that_is_not_a_number_stays_when_percentages_switch() { + let mut app = app_with_image(); + open(&mut app, &json!({})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + crate::dialogs::set_field(d, "width".into(), json!("abc")); + crate::dialogs::set_field(d, "percentages".into(), json!(true)); + assert_eq!((d.str("width"), d.bool("percentages")), ("abc".into(), false)); + assert!(d.str(form::REFUSED).contains("`width` must be a number"), "{}", d.str(form::REFUSED)); + let e = crate::dialogs::confirm(&mut app).unwrap_err(); + assert!(e.contains("width"), "{e}"); + assert_eq!(mosaic(&app), None); + } + + /// With Constrain Ratio on, a refused height `ui.dialog.set` gave is refused on OK even when it + /// equals the size Constrain Ratio works out from the width (0.05 pt from 0.1 pt over 100 × 50 pt). + #[test] + fn a_refused_height_equal_to_the_constrained_size_is_refused() { + let mut app = app_with_image(); + open(&mut app, &json!({"constrain": "width"})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + crate::dialogs::set_field(d, "width".into(), json!(0.1)); + crate::dialogs::set_field(d, "height".into(), json!(0.05)); + let e = crate::dialogs::confirm(&mut app).unwrap_err(); + assert!(e.contains("height"), "{e}"); + assert_eq!(mosaic(&app), None); + } + /// The id of the image in the document. fn image_id(app: &VectorcraftApp) -> u64 { let mut id = None; From 16d1ed57acfdb04f78f2b0e8d650c1701a9b35c4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 14 Nov 2026 20:42:01 -0800 Subject: [PATCH 019/158] Scripts: the status bar shows text a script throws as it is A failed run's status translated a script's own thrown text whenever it matched one of the app's messages, so `throw new Error('invalid array length')` read as the app's translated error. Run errors now say whether their message is the script's own text: errors the interpreter or a host function throws are marked when they are made, stay the app's own when a script catches and rethrows them unchanged, and become the script's text when it changes their name or message. The status bar translates the words around such a message and shows the script's text unchanged. - `script.run`'s failed report adds `messageOrigin` (`script` or `built-in`); `message`, `kind` and the console line are unchanged. - The advice about other applications' objects follows only the app's own reference errors, not the same text thrown by a script. --- crates/engine/src/script/mod.rs | 46 ++++++++++++++------ crates/engine/src/tests/script_include.rs | 25 +++++++++++ crates/engine/src/tests/script_run.rs | 52 ++++++++++++++++++++++ crates/js/src/builtins.rs | 2 +- crates/js/src/heap.rs | 6 ++- crates/js/src/interp.rs | 48 ++++++++++++++++++-- crates/js/src/interp_tests.rs | 38 ++++++++++++++++ crates/js/src/realm.rs | 39 ++++++++++++----- crates/ui-egui/src/chrome/status_bar.rs | 15 ++++++- crates/ui-egui/src/chrome/tests.rs | 53 +++++++++++++++++++++++ crates/ui-egui/src/i18n.rs | 29 +++++++++++++ crates/ui-egui/src/i18n/tests.rs | 15 +++++++ docs/mcp.md | 6 ++- docs/target-app-parity.md | 1 + 14 files changed, 342 insertions(+), 33 deletions(-) diff --git a/crates/engine/src/script/mod.rs b/crates/engine/src/script/mod.rs index 1b95b5fe2a..bb80023017 100644 --- a/crates/engine/src/script/mod.rs +++ b/crates/engine/src/script/mod.rs @@ -1476,12 +1476,14 @@ fn kind_id(kind: &RunErrorKind) -> &'static str { } } -/// `message`, with what to do about a failure that comes from a script written for another program. -fn explained(kind: &RunErrorKind, message: &str) -> String { +/// `e`'s message, with what to do about a failure that comes from a script written for another +/// program. A message the script supplied itself ([`RunError::authored`]) is given as it is. +fn explained(e: &RunError) -> String { const HOST_OBJECTS: &[&str] = &["app", "Window", "BridgeTalk", "activeDocument", "documents"]; + let message = &e.message; let names_host_object = message.strip_prefix("ReferenceError: ").is_some_and(|m| HOST_OBJECTS.iter().any(|o| m.split_whitespace().next() == Some(o))); - if *kind == RunErrorKind::Thrown && names_host_object { + if e.kind == RunErrorKind::Thrown && !e.authored && names_host_object { format!("{message} (scripts here use the `vc` object; objects other applications give their scripts are not available)") } else { message.to_string() @@ -1499,7 +1501,7 @@ fn preprocessor_error(f: include::Failure) -> (RunError, Option>) { include::FailKind::Limit => (RunErrorKind::Limit(LimitKind::Host), f.message), }; let file = (f.index > 0).then_some(f.file); - (RunError { kind, message, line: f.line, column: f.column }, file) + (RunError { kind, message, line: f.line, column: f.column, authored: false }, file) } /// `e`, the error `realm` raised in the run of `host`, at the line and column of the file it is in, @@ -1508,20 +1510,20 @@ fn located(host: &Host, realm: &Realm, e: &RunError) -> (RunError, Option { let (e, index, file) = map(&host.script_map.borrow()); @@ -1694,6 +1696,15 @@ impl Session { self.script_report.as_ref().filter(|r| r["ok"] == false).map(failure_text) } + /// [`Self::script_failure_text`] split around the message when that message is text the script + /// supplied itself (`messageOrigin` `script`): the text before it, the message and the text after + /// it. `None` when the last run did not fail, or failed with one of the app's own errors. + pub fn script_authored_failure(&self) -> Option<(String, &str, String)> { + let r = self.script_report.as_ref().filter(|r| r["ok"] == false && r["messageOrigin"] == "script")?; + let (before, after) = failure_frame(r); + Some((before, r["message"].as_str().unwrap_or_default(), after)) + } + /// Has the running script used up its growth allowance, so a person must answer? A run asked /// to stop no longer waits: the next [`Session::script_pump`] ends it. pub fn script_waiting(&self) -> bool { @@ -1764,7 +1775,7 @@ impl Session { }; drop(key); let kind = LimitKind::Interrupted; - let e = RunError { kind: RunErrorKind::Limit(kind), message: format!("limit reached: {kind:?}"), line: 0, column: 0 }; + let e = RunError { kind: RunErrorKind::Limit(kind), message: format!("limit reached: {kind:?}"), line: 0, column: 0, authored: false }; let _ = self.script_failed(job, &e); true } @@ -1986,14 +1997,14 @@ impl Session { // A stop while a dialog waits ends the run there; the interpreter cannot go on from the call. if job.realm.waits() { let kind = LimitKind::Interrupted; - let e = RunError { kind: RunErrorKind::Limit(kind), message: format!("limit reached: {kind:?}"), line: 0, column: 0 }; + let e = RunError { kind: RunErrorKind::Limit(kind), message: format!("limit reached: {kind:?}"), line: 0, column: 0, authored: false }; return Some(self.script_failed(job, &e)); } job.host.calls_this_slice.set(0); let outcome = run_slice(self, &mut job); match outcome { Err(panic) => { - let e = RunError { kind: RunErrorKind::Internal, message: panic, line: 0, column: 0 }; + let e = RunError { kind: RunErrorKind::Internal, message: panic, line: 0, column: 0, authored: false }; Some(self.script_failed(job, &e)) } Ok(Err(e)) => Some(self.script_failed(job, &e)), @@ -2006,7 +2017,7 @@ impl Session { let n = job.host.dialogs.unused(); let kind = LimitKind::Host; let message = format!("`answers` has {n} answer{} the script did not use", if n == 1 { "" } else { "s" }); - Some(self.script_failed(job, &RunError { kind: RunErrorKind::Limit(kind), message, line: 0, column: 0 })) + Some(self.script_failed(job, &RunError { kind: RunErrorKind::Limit(kind), message, line: 0, column: 0, authored: false })) } Ok(Ok(Progress::Done(_))) => { let r = self.script_commit(job); @@ -2050,7 +2061,7 @@ impl Session { if changed && (!crate::sanity::doc_sane(&st.doc, &st.selection) || st.doc.too_deep(None)) { job.world.docs = start; job.world.swap(self); - let e = RunError { kind: RunErrorKind::Internal, message: INVALID_RESULT.to_string(), line: 0, column: 0 }; + let e = RunError { kind: RunErrorKind::Internal, message: INVALID_RESULT.to_string(), line: 0, column: 0, authored: false }; return self.script_failed(job, &e); } } @@ -2153,7 +2164,8 @@ fn failure_report(name: &str, e: &RunError, file: Option<&str>, host: &Host, fue let mut report = json!({ "ok": false, "kind": kind_id(&e.kind), - "message": explained(&e.kind, &e.message), + "message": explained(e), + "messageOrigin": if e.authored { "script" } else { "built-in" }, "name": name, "line": e.line, "column": e.column, @@ -2245,6 +2257,12 @@ fn close_run(s: &mut Session, host: &Host, report: &mut Value, ending: console:: /// The text of a failed run's error. fn failure_text(report: &Value) -> String { + let (before, after) = failure_frame(report); + format!("{before}{}{after}", report["message"].as_str().unwrap_or_default()) +} + +/// The text of a failed run's error before its message and after it. +fn failure_frame(report: &Value) -> (String, String) { let s = |k: &str| report[k].as_str().unwrap_or_default(); let (line, column) = (report["line"].as_u64().unwrap_or(0), report["column"].as_u64().unwrap_or(0)); let at = match report["file"].as_str() { @@ -2259,7 +2277,7 @@ fn failure_text(report: &Value) -> String { } else { String::new() }; - format!("{}{at}: {} ({}){kept}", s("name"), s("message"), s("kind")) + (format!("{}{at}: ", s("name")), format!(" ({}){kept}", s("kind"))) } /// A run's slice: the working copy in, the real session lent to the host functions, one measured diff --git a/crates/engine/src/tests/script_include.rs b/crates/engine/src/tests/script_include.rs index 1ad659cfdd..cc6756c332 100644 --- a/crates/engine/src/tests/script_include.rs +++ b/crates/engine/src/tests/script_include.rs @@ -77,6 +77,31 @@ fn script_missing_include_reports_origin() { assert!(report["message"].as_str().unwrap().contains("include file not found: nope.jsxinc"), "{report}"); assert_eq!(report["log"], json!([]), "nothing ran before the include was read"); assert!(report.get("file").is_none(), "the line is the script's own"); + assert_eq!(report["messageOrigin"], "built-in"); + let _ = std::fs::remove_dir_all(base); +} + +/// An error in an included file keeps where its message came from: a value the file threw is the +/// script's own text, and an error the app raised for it, or for a file `$.evalFile` could not run, is not. +#[test] +fn script_include_errors_keep_their_message_origin() { + let base = folder("origin"); + write(&base.join("main/lib.jsxinc"), "var a = 1;\n throw new RangeError('invalid array length');"); + write(&base.join("main/native.jsxinc"), "var a = 1;\n new Array(-1);"); + for (text, message, origin) in [ + ("#include \"lib.jsxinc\"", "RangeError: invalid array length", "script"), + ("#include \"native.jsxinc\"", "RangeError: invalid array length", "built-in"), + ("try {\n#include \"native.jsxinc\"\n} catch (e) { throw e; }", "RangeError: invalid array length", "built-in"), + ("try {\n#include \"native.jsxinc\"\n} catch (e) { throw e.message; }", "invalid array length", "script"), + ] { + let report = failed(&base, text); + assert_eq!((report["message"].as_str(), report["messageOrigin"].as_str()), (Some(message), Some(origin)), "{text}: {report}"); + } + let report = failed(&base, "#include \"lib.jsxinc\""); + let file = report["file"].as_str().map(|f| Path::new(f).ends_with("lib.jsxinc")); + assert_eq!((file, report["line"].as_u64(), report["column"].as_u64()), (Some(true), Some(2), Some(3)), "{report}"); + let report = failed(&base, "$.evalFile('nope.jsx');"); + assert_eq!(report["messageOrigin"], "built-in", "{report}"); let _ = std::fs::remove_dir_all(base); } diff --git a/crates/engine/src/tests/script_run.rs b/crates/engine/src/tests/script_run.rs index d272fea167..ac91ea4a7d 100644 --- a/crates/engine/src/tests/script_run.rs +++ b/crates/engine/src/tests/script_run.rs @@ -170,6 +170,58 @@ fn an_error_names_the_script_its_place_and_kind() { assert_eq!(s.script_report().unwrap()["line"], 1); } +/// A failed run's report keeps its message and kind and says where the message came from: text the +/// script supplied, or one of the app's own errors. The status text and the console line read the +/// same either way, and only the app's own errors get advice about other applications' objects. +#[test] +fn failed_script_report_keeps_message_and_adds_origin() { + let mut s = two_docs(); + for (source, kind, message, origin) in [ + ("throw new Error('invalid array length');", "thrown", "Error: invalid array length", "script"), + ("throw new RangeError('invalid array length');", "thrown", "RangeError: invalid array length", "script"), + ("throw 'invalid array length';", "thrown", "invalid array length", "script"), + ("throw 'ReferenceError: app is not defined';", "thrown", "ReferenceError: app is not defined", "script"), + ("try { new Array(-1); } catch (e) { throw new Error(e.message); }", "thrown", "Error: invalid array length", "script"), + ("new Array(-1);", "thrown", "RangeError: invalid array length", "built-in"), + ("try { new Array(-1); } catch (e) { throw e; }", "thrown", "RangeError: invalid array length", "built-in"), + ("vc.run();", "thrown", "TypeError: vc.run: give a command id, as a string", "built-in"), + ] { + let e = run(&mut s, source).unwrap_err().to_string(); + let report = s.script_report().unwrap().clone(); + assert_eq!( + (report["kind"].as_str(), report["message"].as_str(), report["messageOrigin"].as_str()), + (Some(kind), Some(message), Some(origin)), + "{source}" + ); + let (line, column) = (&report["line"], &report["column"]); + let before = format!("t.js: line {line}, column {column}: "); + assert_eq!(e, format!("{before}{message} ({kind})"), "{source}"); + assert_eq!(s.script_failure_text().as_deref(), Some(e.as_str())); + let authored = s.script_authored_failure(); + assert_eq!(authored, (origin == "script").then(|| (before.clone(), message, format!(" ({kind})"))), "{source}"); + let console = s.execute("script.console", &json!({})).unwrap(); + let error = console["lines"].as_array().unwrap().iter().rev().find(|l| l["kind"] == "error").map(|l| l["text"].clone()); + assert_eq!(error, Some(json!(format!("t.js:{line}:{column}: {message}"))), "{source}"); + } + // The app's own reference error names the `vc` object; the same text a script threw does not. + run(&mut s, "app.activeDocument;").unwrap_err(); + assert!(s.script_report().unwrap()["message"].as_str().unwrap().contains("`vc`")); + assert_eq!(s.script_report().unwrap()["messageOrigin"], "built-in"); + // An error in code `eval` compiled keeps where its message came from. + let e = run(&mut s, "eval(\"throw new Error('invalid array length')\");").unwrap_err().to_string(); + assert_eq!(e, "t.js: Error: invalid array length (thrown)"); + assert_eq!(s.script_authored_failure(), Some(("t.js: ".to_string(), "Error: invalid array length", " (thrown)".to_string()))); + // Syntax errors and limits are the app's own. + run(&mut s, "var = 1;").unwrap_err(); + assert_eq!((s.script_report().unwrap()["kind"].as_str(), s.script_authored_failure()), (Some("syntax"), None)); + s.execute("script.run", &json!({"source": "while (true) {}", "name": "t.js", "maxFuel": 100_000})).unwrap_err(); + assert_eq!((s.script_report().unwrap()["messageOrigin"].as_str(), s.script_authored_failure()), (Some("built-in"), None)); + // A run that completes has no failure to split. + run(&mut s, "throw 'x';").unwrap_err(); + run(&mut s, "1").unwrap(); + assert_eq!(s.script_authored_failure(), None); +} + /// An error raised where the run has no place for it, such as in code `eval` compiled, is named /// with the script and its kind alone, with one colon after the script's name. #[test] diff --git a/crates/js/src/builtins.rs b/crates/js/src/builtins.rs index 301b1235a4..4b9b14cfe0 100644 --- a/crates/js/src/builtins.rs +++ b/crates/js/src/builtins.rs @@ -318,7 +318,7 @@ fn install_errors(interp: &mut Interp, object_proto: ObjId) -> JsResult<()> { for (i, (name, f)) in kinds.into_iter().enumerate() { // Error.prototype and each NativeError prototype are Error objects (sections 15.11.4 and // 15.11.7.7). - let proto = alloc(interp, Class::Error, Some(if i == 0 { object_proto } else { error_proto })); + let proto = alloc(interp, Class::Error(None), Some(if i == 0 { object_proto } else { error_proto })); if i == 0 { error_proto = proto; method(interp, proto, "toString", error_to_string, 0)?; diff --git a/crates/js/src/heap.rs b/crates/js/src/heap.rs index dea53c557f..b72d00da90 100644 --- a/crates/js/src/heap.rs +++ b/crates/js/src/heap.rs @@ -213,7 +213,9 @@ pub(crate) enum Class { length_writable: bool, }, Function(Func), - Error, + /// An error object. One the interpreter threw itself holds a hash of the description it had + /// then ([`crate::interp::Interp::describe`]); one a script made holds `None`. + Error(Option), Arguments(Box), /// A `Boolean` object made by ToObject, with its primitive value. Boolean(bool), @@ -311,7 +313,7 @@ impl Class { Class::Ordinary | Class::ForIn(_) => "Object", Class::Array { .. } => "Array", Class::Function(_) => "Function", - Class::Error => "Error", + Class::Error(_) => "Error", Class::Arguments(_) => "Arguments", Class::Boolean(_) => "Boolean", Class::Number(_) => "Number", diff --git a/crates/js/src/interp.rs b/crates/js/src/interp.rs index aa4a4c5c78..6b86b3765b 100644 --- a/crates/js/src/interp.rs +++ b/crates/js/src/interp.rs @@ -48,6 +48,14 @@ fn internal(message: &str) -> JsResult { Err(Abrupt::Internal(message.into())) } +/// The hash an error the interpreter throws keeps of its description ([`Interp::throw`]). +fn description_hash(text: &str) -> u64 { + use std::hash::{Hash, Hasher}; + let mut h = std::hash::DefaultHasher::new(); + text.hash(&mut h); + h.finish() +} + /// The kinds of error object the engine throws. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub(crate) enum ErrorType { @@ -60,6 +68,21 @@ pub(crate) enum ErrorType { Uri, } +impl ErrorType { + /// The `name` the prototype of this kind of error has before a script changes it. + pub(crate) fn name(self) -> &'static str { + match self { + ErrorType::Error => "Error", + ErrorType::Eval => "EvalError", + ErrorType::Range => "RangeError", + ErrorType::Reference => "ReferenceError", + ErrorType::Syntax => "SyntaxError", + ErrorType::Type => "TypeError", + ErrorType::Uri => "URIError", + } + } +} + /// The objects the interpreter itself refers to. #[derive(Clone, Copy, Debug)] pub(crate) struct Intrinsics { @@ -498,15 +521,34 @@ impl Interp { pub(crate) fn error_object(&mut self, t: ErrorType, message: &str) -> ObjId { let proto = self.intrinsics.error_proto(t); - let mut o = Object::new(Class::Error, Some(proto)); + let mut o = Object::new(Class::Error(None), Some(proto)); if !message.is_empty() { o.props.insert(key("message"), Prop::Data { value: Value::str(message), flags: HIDDEN }); } self.heap.alloc_object(o) } + /// An error of the interpreter's or a host function's own, marked as such with a hash of the + /// description it has with its kind's own name ([`Self::thrown_by_script`]), so a name a script + /// gave the kind's prototype before the error was made counts as the script's text. pub(crate) fn throw(&mut self, t: ErrorType, message: &str) -> Abrupt { - Abrupt::Throw(Value::Object(self.error_object(t, message))) + let o = self.error_object(t, message); + let own = if message.is_empty() { t.name().to_string() } else { format!("{}: {message}", t.name()) }; + if let Some(object) = self.heap.object_mut(o) { + object.class = Class::Error(Some(description_hash(&own))); + } + Abrupt::Throw(Value::Object(o)) + } + + /// Is the text [`Self::describe`] gives for the thrown value `v` the script's own? It is unless + /// `v` is an error the interpreter or a host function threw, with its name and message as they + /// were then: a value the script threw, an error it made, and an error whose name or message it + /// changed all hold its own text. + pub(crate) fn thrown_by_script(&mut self, v: &Value) -> bool { + let Value::Object(o) = v else { return true }; + let Some(Class::Error(Some(hash))) = self.heap.object(*o).map(|o| &o.class) else { return true }; + let hash = *hash; + description_hash(&self.describe(v)) != hash } pub(crate) fn type_error(&mut self, message: &str) -> Abrupt { @@ -770,7 +812,7 @@ impl Interp { let passed = matches!((&v, std::mem::replace(&mut self.passing, Value::Undefined)), (Value::Object(a), Value::Object(b)) if *a == b); if !passed && let Value::Object(o) = v - && self.heap.object(o).is_some_and(|o| matches!(o.class, Class::Error)) + && self.heap.object(o).is_some_and(|o| matches!(o.class, Class::Error(_))) { self.last_error = v.clone(); } diff --git a/crates/js/src/interp_tests.rs b/crates/js/src/interp_tests.rs index 93c487b378..c73195b085 100644 --- a/crates/js/src/interp_tests.rs +++ b/crates/js/src/interp_tests.rs @@ -239,6 +239,44 @@ fn errors_carry_line_and_column() { assert_eq!(e.message, "42"); } +/// A run error says whether its message is the script's own text, whatever that text reads: an +/// error the interpreter or a host function threw is not, even when a script caught it and threw +/// it again, and a value or error the script made, or an error whose name or message it changed, +/// is. +#[test] +fn script_error_origin_distinguishes_native_and_authored_values() { + let native = "RangeError: invalid array length"; + for (src, message, authored) in [ + ("new Array(-1)", native, false), + ("try { new Array(-1); } catch (e) { throw e; }", native, false), + ("try { new Array(-1); } catch (e) { e.message = 'invalid array length'; throw e; }", native, false), + ("nope()", "ReferenceError: nope is not defined", false), + ("throw new RangeError('invalid array length')", native, true), + ("throw new Error('invalid array length')", "Error: invalid array length", true), + ("throw 'invalid array length'", "invalid array length", true), + ("throw 17", "17", true), + ("throw {}", "[object Object]", true), + ("throw new Error()", "Error", true), + ("try { new Array(-1); } catch (e) { throw e.message; }", "invalid array length", true), + ("try { new Array(-1); } catch (e) { throw new RangeError(e.message); }", native, true), + ("try { new Array(-1); } catch (e) { e.message = 'mine'; throw e; }", "RangeError: mine", true), + ("try { nope(); } catch (e) { e.name = 'TypeError'; throw e; }", "TypeError: nope is not defined", true), + ("try { new Array(-1); } catch (e) { RangeError.prototype.name = 'Mine'; throw e; }", "Mine: invalid array length", true), + ("RangeError.prototype.name = 'Mine'; new Array(-1)", "Mine: invalid array length", true), + ("RangeError.prototype.name = 'RangeError'; new Array(-1)", native, false), + ] { + let e = fail(src); + assert_eq!((e.kind, e.message.as_str(), e.authored), (RunErrorKind::Thrown, message, authored), "{src}"); + } + assert!(!fail("var x = ;").authored, "a syntax error"); + let mut realm = Realm::new(); + realm.define_function("add", |_| Err("add takes two numbers".into())); + let e = realm.run("add()").unwrap_err(); + assert_eq!((e.message.as_str(), e.authored), ("Error: add takes two numbers", false), "a host function's error"); + let e = realm.run("throw new Error('add takes two numbers')").unwrap_err(); + assert_eq!((e.message.as_str(), e.authored), ("Error: add takes two numbers", true)); +} + #[test] fn host_functions_receive_arguments_and_return_values() { let mut realm = Realm::new(); diff --git a/crates/js/src/realm.rs b/crates/js/src/realm.rs index 4146ae891b..1570a9e70d 100644 --- a/crates/js/src/realm.rs +++ b/crates/js/src/realm.rs @@ -139,6 +139,10 @@ pub struct RunError { pub message: String, pub line: u32, pub column: u32, + /// `message` is text the script supplied: a value it threw, or an error object it made or whose + /// name or message it changed. False for the interpreter's and host functions' own errors, + /// syntax errors and limits, even when a script caught one and threw it again. + pub authored: bool, } impl std::fmt::Display for RunError { @@ -151,7 +155,7 @@ impl std::error::Error for RunError {} impl From for RunError { fn from(e: SyntaxError) -> Self { - RunError { kind: RunErrorKind::Syntax, message: e.to_string(), line: e.line, column: e.column } + RunError { kind: RunErrorKind::Syntax, message: e.to_string(), line: e.line, column: e.column, authored: false } } } @@ -241,7 +245,7 @@ impl Realm { self.script_tag = UNKNOWN_SOURCE; let interp = &mut self.interp; if let Some(message) = &interp.install_error { - return Err(RunError { kind: RunErrorKind::Internal, message: message.clone(), line: 0, column: 0 }); + return Err(RunError { kind: RunErrorKind::Internal, message: message.clone(), line: 0, column: 0, authored: false }); } interp.fuel = interp.limits.fuel; interp.flattened_fuel.set(0); @@ -268,7 +272,7 @@ impl Realm { interp.error_tag = self.script_tag; Err(e.into()) } - Err(CompileError::Internal(m)) => Err(RunError { kind: RunErrorKind::Internal, message: m, line: 0, column: 0 }), + Err(CompileError::Internal(m)) => Err(RunError { kind: RunErrorKind::Internal, message: m, line: 0, column: 0, authored: false }), } } @@ -291,15 +295,18 @@ impl Realm { Ok(v) => Ok(interp.to_js_value(&v)), Err(Abrupt::Throw(v)) => { let message = interp.describe(&v); + let authored = interp.thrown_by_script(&v); interp.last_thrown = v; - Err(RunError { kind: RunErrorKind::Thrown, message, line, column }) + Err(RunError { kind: RunErrorKind::Thrown, message, line, column, authored }) } Err(Abrupt::Limit(LimitKind::Host)) => { let message = interp.host_abort.take().unwrap_or_else(|| format!("limit reached: {:?}", LimitKind::Host)); - Err(RunError { kind: RunErrorKind::Limit(LimitKind::Host), message, line, column }) + Err(RunError { kind: RunErrorKind::Limit(LimitKind::Host), message, line, column, authored: false }) } - Err(Abrupt::Limit(kind)) => Err(RunError { kind: RunErrorKind::Limit(kind), message: format!("limit reached: {kind:?}"), line, column }), - Err(Abrupt::Internal(message)) => Err(RunError { kind: RunErrorKind::Internal, message, line, column }), + Err(Abrupt::Limit(kind)) => { + Err(RunError { kind: RunErrorKind::Limit(kind), message: format!("limit reached: {kind:?}"), line, column, authored: false }) + } + Err(Abrupt::Internal(message)) => Err(RunError { kind: RunErrorKind::Internal, message, line, column, authored: false }), } } @@ -321,10 +328,16 @@ impl Realm { pub fn advance(&mut self, slice: u64) -> Result { let interp = &mut self.interp; if interp.frames.is_empty() { - return Err(RunError { kind: RunErrorKind::Internal, message: "no run to advance".into(), line: 0, column: 0 }); + return Err(RunError { kind: RunErrorKind::Internal, message: "no run to advance".into(), line: 0, column: 0, authored: false }); } if interp.waiting { - return Err(RunError { kind: RunErrorKind::Internal, message: "the run waits for a host function's result".into(), line: 0, column: 0 }); + return Err(RunError { + kind: RunErrorKind::Internal, + message: "the run waits for a host function's result".into(), + line: 0, + column: 0, + authored: false, + }); } let total = interp.fuel; let cap = slice.saturating_add(self.unbroken_fuel).min(total); @@ -380,7 +393,13 @@ impl Realm { pub fn answer(&mut self, d: crate::Data) -> Result<(), RunError> { let interp = &mut self.interp; if !interp.waiting { - return Err(RunError { kind: RunErrorKind::Internal, message: "no host function waits for a result".into(), line: 0, column: 0 }); + return Err(RunError { + kind: RunErrorKind::Internal, + message: "no host function waits for a result".into(), + line: 0, + column: 0, + authored: false, + }); } interp.waiting = false; // The value on top of the stack stood in for the result. diff --git a/crates/ui-egui/src/chrome/status_bar.rs b/crates/ui-egui/src/chrome/status_bar.rs index 1e946b56da..8e9f26b929 100644 --- a/crates/ui-egui/src/chrome/status_bar.rs +++ b/crates/ui-egui/src/chrome/status_bar.rs @@ -237,7 +237,7 @@ pub(super) fn status_readouts(app: &VectorcraftApp, ui: &mut Ui, t: &Tokens) { let more = busy.len() - 1; (if more > 0 { format!("{label}… (+{more})") } else { format!("{label}…") }, &[][..]) } else { - (crate::i18n::msg(&app.ui.status), status_notes(&app.ui)) + (status_message(app), status_notes(&app.ui)) }; if !message.is_empty() { let rect = egui::Rect::from_min_max(egui::pos2((area.left() + 18.0).min(right), area.top()), egui::pos2(right, area.bottom())); @@ -245,6 +245,19 @@ pub(super) fn status_readouts(app: &VectorcraftApp, ui: &mut Ui, t: &Tokens) { } } +/// The status message in the interface language. While it is the error of the last script run +/// and that error's message is text the script supplied, that text is shown as it is and only the +/// words around it are translated. +pub(crate) fn status_message(app: &VectorcraftApp) -> String { + let status = app.ui.status.as_str(); + if let Some((before, kept, after)) = app.session.script_authored_failure() + && status.strip_prefix(before.as_str()).and_then(|rest| rest.strip_suffix(after.as_str())) == Some(kept) + { + return crate::i18n::msg_keeping(&before, kept, &after); + } + crate::i18n::msg(status) +} + /// Most notes the status message's hover and access information list. const MAX_LISTED_NOTES: usize = 30; diff --git a/crates/ui-egui/src/chrome/tests.rs b/crates/ui-egui/src/chrome/tests.rs index be37f10a29..23af31a827 100644 --- a/crates/ui-egui/src/chrome/tests.rs +++ b/crates/ui-egui/src/chrome/tests.rs @@ -491,6 +491,59 @@ fn the_message_of_an_open_with_several_notes_lists_them_on_hover() { assert_eq!(hovered.iter().filter(|t| t.text.starts_with("Opened")).count(), 1, "no tooltip: {hovered:?}"); } +/// The status message of a failed script run shows text the script threw as it is, even when it +/// reads like one of the app's own errors, and translates the words around it; the app's own error +/// is translated. Both a run that ends in one call and a run the frames take to its end show it. +#[test] +fn german_script_status_preserves_authored_error_and_translates_native_error() { + crate::i18n::set_current(crate::i18n::Lang::from_code("de").expect("de registered")); + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + let failed = |app: &mut crate::VectorcraftApp, source: &str, frames: bool| { + app.session.script_frames = frames; + let r = app.run("script.run", json!({"source": source, "name": "t.js"})); + if frames { + assert_eq!(r.map(|v| v["running"].clone()), Ok(json!(true)), "{source}"); + for _ in 0..1_000 { + if !app.session.script_running() { + break; + } + crate::script_runs::poll(app); + } + } else { + assert!(r.is_err(), "{source}"); + } + assert!(!app.session.script_running()); + super::status_bar::status_message(app) + }; + let long = "invalid array length ".repeat(120); + for frames in [false, true] { + let shown = failed(&mut app, "throw new Error('invalid array length')", frames); + assert_eq!(shown, "t.js: Zeile 1, Spalte 1: Error: invalid array length (ausgelöst)"); + let shown = failed(&mut app, "throw 'invalid array length'", frames); + assert_eq!(shown, "t.js: Zeile 1, Spalte 1: invalid array length (ausgelöst)"); + let shown = failed(&mut app, "new Array(-1)", frames); + assert!(shown.starts_with("t.js: Zeile 1, Spalte 1: ") && shown.contains("ungültige Array-Länge"), "{shown}"); + for text in ["", "invalid array length\nsecond line", "{name}: {e}", "t.js: line 1, column 1: invalid array length (thrown)", long.as_str()] { + let source = format!("throw {}", serde_json::to_string(text).unwrap()); + assert_eq!(failed(&mut app, &source, frames), format!("t.js: Zeile 1, Spalte 1: {text} (ausgelöst)"), "{text}"); + } + } + // Another message, even one spelled like the script's text, is translated as before. + failed(&mut app, "throw 'invalid array length'", false); + app.ui.status = "invalid array length".to_string(); + assert_eq!(super::status_bar::status_message(&app), "ungültige Array-Länge"); + // A change of language while the message stays keeps the script's text. + failed(&mut app, "throw new Error('invalid array length')", false); + crate::i18n::set_current(crate::i18n::Lang::from_code("fr").expect("fr registered")); + assert_eq!(super::status_bar::status_message(&app), "t.js : ligne 1, colonne 1 : Error: invalid array length (levée)"); + crate::i18n::set_current(crate::i18n::Lang::EN); + assert_eq!(super::status_bar::status_message(&app), app.ui.status); + // After a run that completes, the message is an ordinary one. + app.session.script_frames = false; + app.run("script.run", json!({"source": "1", "name": "t.js"})).unwrap(); + assert_eq!(app.session.script_authored_failure(), None); +} + /// The message of an open that starts with a line about its linked files lists the open's notes on /// hover and for screen readers, in a wide and in a narrow window. A later message leaves the list /// out. diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 377df81a72..75f3067730 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -765,6 +765,35 @@ pub fn msg(s: &str) -> String { out } +/// Stands in for the value [`message_keeping`] shows as it is while the text around it is +/// translated. +const KEPT_VALUE: char = '\u{FFFC}'; + +/// The message `before`, `kept` and `after` make, with `before` and `after` translated as +/// [`message`] translates a message and `kept` (such as text a script threw) shown as it is, even +/// when it reads like a message that has a translation. When the translation does not hold the +/// place of `kept` exactly once, the message is shown in English. +pub fn message_keeping(lang: Lang, before: &str, kept: &str, after: &str) -> String { + keeping(|s| message(lang, s), before, kept, after) +} + +/// [`message_keeping`] in the current language, remembering the last translation as [`msg`] does. +pub fn msg_keeping(before: &str, kept: &str, after: &str) -> String { + keeping(msg, before, kept, after) +} + +fn keeping(translate: impl Fn(&str) -> String, before: &str, kept: &str, after: &str) -> String { + let english = || format!("{before}{kept}{after}"); + if before.contains(KEPT_VALUE) || after.contains(KEPT_VALUE) { + return english(); + } + let shown = translate(&format!("{before}{KEPT_VALUE}{after}")); + match shown.split_once(KEPT_VALUE) { + Some((head, tail)) if !tail.contains(KEPT_VALUE) => format!("{head}{kept}{tail}"), + _ => english(), + } +} + /// [`trn`] in the current language. pub fn tn(n: u64, one: &str, other: &str) -> String { trn(current(), n, one, other) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 55295f011a..6a4c1c407e 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -3252,6 +3252,21 @@ fn script_errors_are_translated() { } } +/// A message with a value kept as it is translates the words around the value and shows the value +/// unchanged, whatever it reads like; when the words around it cannot hold its place once, the +/// message stays English. +#[test] +fn a_kept_value_is_shown_as_it_is_in_a_translated_message() { + let de = Lang::from_code("de").expect("registered"); + let (before, after) = ("t.js: line 1, column 1: ", " (thrown)"); + for kept in ["invalid array length", "", "{e}", "\u{FFFC}", "a\nb", "t.js: line 1, column 1: x (thrown)"] { + assert_eq!(message_keeping(de, before, kept, after), format!("t.js: Zeile 1, Spalte 1: {kept} (ausgelöst)"), "{kept:?}"); + } + assert_eq!(message_keeping(de, "t.js\u{FFFC}: line 1, column 1: ", "x", after), "t.js\u{FFFC}: line 1, column 1: x (thrown)"); + assert_eq!(message_keeping(de, "no such message ", "x", ""), "no such message x"); + assert_eq!(message_keeping(Lang::EN, before, "invalid array length", after), "t.js: line 1, column 1: invalid array length (thrown)"); +} + /// The errors a script's `$` object, its `alert`, `confirm` and `prompt` dialogs, `vc.document`, /// `vc.log`, the methods of its `File` and `Folder` objects and a run's limits give, and the errors /// of the script engine commands, are translated in every language of [`COMPLETE_MESSAGES`], on diff --git a/docs/mcp.md b/docs/mcp.md index 9336ea35ca..a58c47a64a 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -2374,8 +2374,10 @@ In the app, a script past the growth limit stops at a question to continue or to with an error at that limit. The headless reply is `{ok: true, name, changed, written, log, fuelUsed, hostCalls, runTimeMs, timingAvailable, hostCallCounts, slowestCommands, console, dialogs, dialogCount, dialogsTruncated}`. In the app the reply is `{running: true, name}`, and the report appears later as `scriptReport` in `ui.inspect`. The -report of a failed run has the same fields after `kind`, `message`, `line`, `column`, `file` (when the error is in -another file than the script) and `fuelLeft`. +report of a failed run has the same fields after `kind`, `message`, `messageOrigin`, `line`, `column`, `file` (when +the error is in another file than the script) and `fuelLeft`. `messageOrigin` is `script` when `message` is text the +script supplied (a value it threw, or an error it made or whose name or message it changed) and `built-in` for the +app's own errors, syntax errors and limits. The status bar shows a `script` message as it is, untranslated. - `runTimeMs` is the time the script ran, its commands included. Waits between frames and for a person's answer are left out. `timingAvailable` is false on the web, where `runTimeMs` is 0. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 90d82894db..2a912fee9a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -827,6 +827,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s. - Scripts: File › Scripts › Other Script… and `script.run` run a JavaScript file against the open documents as one transaction with one undo step for each changed document. A failed or stopped run puts every document back. `crates/engine/src/tests/script_run.rs`. - Scripts: Window › Script Console shows each run's `$.write` and `$.writeln` output, `vc.log` entries, uncaught error with the script's name, line and column, and a report of its time, host calls and slowest commands, keeping at most 2,048 lines and counting the lines it dropped. `script.run`'s report carries the same data, and `script.console`, `script.console.clear` and `ui.copyScriptConsole` read, clear and copy it. `crates/engine/src/tests/script_console.rs`. + - Scripts: the status bar translates its own words around a failed run's error and the app's own error messages, and shows text the script threw itself (a value, an error it made, or an error whose name or message it changed) as it is, even when that text reads like one of the app's messages. `script.run`'s report gives `messageOrigin` (`script` or `built-in`), and the advice about objects other applications give their scripts follows only the app's own reference errors. VectorCraft's own rule. `crates/js/src/interp_tests.rs`, `crates/engine/src/tests/script_run.rs`, `crates/ui-egui/src/chrome/tests.rs`. - Scripts: the `$` object has the other members the Dollar object page lists (https://extendscript.docsforadobe.dev/extendscript-tools-features/dollar-object/), from `$.about()` to `$.version`, and scripts have the global `localize(object, ...values)` (https://extendscript.docsforadobe.dev/extendscript-tools-features/localizing-extendscript-strings/), `toSource(value)` and `Object.prototype.toSource()`. Each run starts with the interface's locale, and what a script changes in `$` lasts only for that run. `crates/engine/src/tests/script_dollar.rs`, `crates/js/src/extension_tests.rs`. - Scripts: `toSource` throws a `TypeError` for a property that is not writable or not configurable, a sealed, frozen or non-extensible object or array, and an array with a read-only `length` (VectorCraft's own rule). `crates/js/src/extension_tests.rs`. - Scripts: a canceled request stops a run that sleeps in `$.sleep`, waits at a dialog or waits for approval to grow at the run's next slice, before its wake time or an answer, and every document goes back to its state before the run. VectorCraft's own rule. `crates/engine/src/tests/script_dollar.rs`, `crates/engine/src/tests/script_dialogs.rs`, `crates/engine/src/tests/script_run.rs`. From 69410d99d7a6b1e46923029b53e40dc0c4d2727c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 07:31:45 -0800 Subject: [PATCH 020/158] Object Mosaic: a constrained size above 1000000 pt shrinks in proportion - With Constrain Ratio on, a side worked out above 1000000 pt shrinks to 1000000 pt and the other side shrinks with it, as a side under 0.1 pt grows. An image more than 10000000 times wider than tall (or taller than wide) leaves no such size, and the call is refused with an error. - A percentage typed in New Size is kept at 1000000, the most the command takes. - The #1000 test types the count into Number of Tiles again. - docs/mcp.md says a size given for the side Constrain Ratio works out is still checked, and the new lines are wrapped like the paragraph. --- crates/engine/src/cmd/menucmds.rs | 11 +++-- crates/engine/src/tests.rs | 10 +++++ crates/ui-egui/src/dialogs/object_mosaic.rs | 45 +++++++++++++++++++-- crates/ui-egui/src/dialogs/tests.rs | 26 ++++++++++-- docs/mcp.md | 15 +++++-- 5 files changed, 94 insertions(+), 13 deletions(-) diff --git a/crates/engine/src/cmd/menucmds.rs b/crates/engine/src/cmd/menucmds.rs index 41fc1cf2fe..606cd28618 100644 --- a/crates/engine/src/cmd/menucmds.rs +++ b/crates/engine/src/cmd/menucmds.rs @@ -124,7 +124,7 @@ pub fn specs() -> Vec { "Create Object Mosaic…", ["Object"], None, - "{columns=10, rows=10 (whole numbers, kept within 1..1000), width?, height? (new size in pt, 0.1..1000000; default the image's), percentages?: bool (width and height are percentages of the image's size, default 100), constrain?: \"width\"|\"height\"|null (Constrain Ratio: the mosaic keeps the image's proportions, the named side's size leads and the other side's is worked out from it), useRatio?: bool|\"width\"|\"height\" (square tiles as drawn, spacing taken off: the count on the side named, or with true on the constrained side, columns by default, stays and the other is the count, 1..1000, whose tiles come closest to square), spacingX=0, spacingY=0 (pt between tiles), gray?: bool, deleteRaster?: bool} a group of rectangles coloured by the selected image's average tile colours → {id, tiles, columns, rows}", + "{columns=10, rows=10 (whole numbers, kept within 1..1000), width?, height? (new size in pt, 0.1..1000000; default the image's), percentages?: bool (width and height are percentages of the image's size, default 100), constrain?: \"width\"|\"height\"|null (Constrain Ratio: the mosaic keeps the image's proportions, the named side's size leads and the other side's is worked out from it, both growing or shrinking in proportion to keep the sizes within 0.1..1000000), useRatio?: bool|\"width\"|\"height\" (square tiles as drawn, spacing taken off: the count on the side named, or with true on the constrained side, columns by default, stays and the other is the count, 1..1000, whose tiles come closest to square), spacingX=0, spacingY=0 (pt between tiles), gray?: bool, deleteRaster?: bool} a group of rectangles colored by the selected image's average tile colors → {id, tiles, columns, rows}", has_image, object_mosaic ), @@ -962,10 +962,15 @@ fn mosaic_plan(s: &Session, p: &Value) -> Result { Some(false) => nw = nh * bw / bh, None => {} } - // A size under 0.1 pt grows to 0.1 pt, in proportion while Constrain Ratio keeps it. + // A size under 0.1 pt grows to 0.1 pt, in proportion while Constrain Ratio keeps it. A side + // Constrain Ratio works out above 1,000,000 pt shrinks to 1,000,000 pt, the other with it. let (nw, nh) = match constrain { Some(_) => { - let k = (0.1 / nw.min(nh)).max(1.0); + let k = (0.1 / nw.min(nh)).max(1.0).min(1_000_000.0 / nw.max(nh)); + // Proportions over 10,000,000 to 1 leave no size with both sides within the range. + if nw.min(nh) * k < 0.1 * (1.0 - 1e-9) { + return Err(bad(C, "the image's proportions leave no size with both sides between 0.1 and 1000000 pt")); + } (nw * k, nh * k) } None => (nw.max(0.1), nh.max(0.1)), diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index df9fea654d..15023df3ab 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -4079,6 +4079,14 @@ fn object_mosaic_resizes_by_percentages_constrains_the_ratio_and_squares_the_til // A size under 0.1 pt grows in proportion while Constrain Ratio keeps it. let (w, h, ..) = mosaic_size(&mut s, json!({"width": 0.1, "constrain": "width"})); assert!((w - 0.2).abs() < 1e-6 && (h - 0.1).abs() < 1e-6, "{w} × {h}"); + // A side Constrain Ratio works out above 1,000,000 pt shrinks to it, in proportion: a height of + // 1,000,000 pt over the 100 × 50 pt image would need a width of 2,000,000 pt. + assert_eq!(mosaic_size(&mut s, json!({"height": 1e6, "constrain": "height"})), (1e6, 5e5, json!(10), json!(10))); + // An image 20,000,000 times wider than it is tall has no such size: the call is refused. + s.execute("object.scale", &json!({"sx": 1, "sy": 1e-7})).unwrap(); + let r = s.execute("object.createObjectMosaic", &json!({"width": 1e6, "constrain": "width"})); + let msg = "the image's proportions leave no size with both sides between 0.1 and 1000000 pt"; + assert!(matches!(&r, Err(EngineError::BadParams { msg: m, .. }) if m == msg), "{r:?}"); } /// Use Ratio squares the tiles as drawn: with 4 pt between columns, 10 columns of 10 pt cells draw 6 pt wide, so the @@ -4137,6 +4145,8 @@ fn object_mosaic_refuses_a_bad_ratio_side_size_or_switch() { (json!({"width": 0}), "`width` must be between 0.1 and 1000000 (got 0)"), (json!({"height": -5, "percentages": true}), "`height` must be between 0.1 and 1000000 (got -5)"), (json!({"width": 2e6, "percentages": true}), "`width` must be between 0.1 and 1000000 (got 2000000)"), + // A side Constrain Ratio works out is not used, but a size given for it is still checked. + (json!({"width": 200, "height": 0, "constrain": "width"}), "`height` must be between 0.1 and 1000000 (got 0)"), (json!({"useRatio": "true"}), "`useRatio` must be one of \"width\", \"height\", true, false or null"), (json!({"useRatio": 1}), "`useRatio` must be one of \"width\", \"height\", true, false or null"), (json!({"percentages": 1}), "`percentages` must be true or false"), diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs index 680ebd4d95..313751320a 100644 --- a/crates/ui-egui/src/dialogs/object_mosaic.rs +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -1,4 +1,4 @@ -//! Object → Create Object Mosaic: the selected image's Current Size, the mosaic's New Size, Tile +//! Object › Create Object Mosaic…: the selected image's Current Size, the mosaic's New Size, Tile //! Spacing and Number of Tiles, Constrain Ratio (Width or Height), Result (Color or Grayscale), //! Resize Using Percentages, Delete Raster and Use Ratio. OK runs `object.createObjectMosaic` as one //! undo step. @@ -234,14 +234,14 @@ fn params(d: &Dialog) -> Value { } /// A Width and a Height field for `keys`: lengths in `unit` of at least `least` points, or -/// percentages with `pct`. With `follows`, the field of that key is grayed (Constrain Ratio sets it). +/// percentages with `pct`, up to 1,000,000. With `follows`, the field of that key is grayed (Constrain Ratio sets it). fn pair(ui: &mut egui::Ui, d: &mut Dialog, keys: [&str; 2], unit: vectorcraft_doc::Unit, (pct, least): (bool, f64), follows: Option<&str>) { for (key, label) in keys.into_iter().zip([tl!("Width:"), tl!("Height:")]) { widgets::dim_label(ui, label); ui.add_enabled_ui(follows != Some(key), |ui| { if pct { if let Some(v) = widgets::spin_plain(ui, ("mosaic", key), d.f64(key, 100.0), "%", 2, FIELD_W, 1.0, 0.1, &[]) { - d.fields.insert(key.into(), json!(v)); + d.fields.insert(key.into(), json!(v.min(*SIZE_RANGE.end()))); } } else { form::length_within(ui, d, key, unit, FIELD_W, Some(least..=1.0e6)); @@ -615,6 +615,45 @@ mod tests { assert_eq!(mosaic(&app), None); } + /// A percentage typed in New Size above 1,000,000 is kept at 1,000,000, the most the command + /// takes, so Enter makes the mosaic: 1,000,000% of the 100 pt width is 1,000,000 pt. + #[test] + fn a_typed_percentage_stays_within_what_the_command_takes() { + let mut app = app_with_image(); + open(&mut app, &json!({"percentages": true})).unwrap(); + let ctx = context(); + let run = |app: &mut VectorcraftApp, events: Vec| { + let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| super::super::show(app, ui.ctx())); + out.textures_delta.clear(); + out.shapes + .iter() + .filter_map(|s| { + if let egui::epaint::Shape::Text(t) = &s.shape { + Some((t.galley.text().to_string(), t.visual_bounding_rect().center())) + } else { + None + } + }) + .collect::>() + }; + run(&mut app, vec![]); + let texts = run(&mut app, vec![]); + // New Size's Width field comes right after the row's Width caption. + let row = texts.iter().position(|(t, _)| t == "New Size:").expect("the New Size row"); + let width = texts[row..].iter().position(|(t, _)| t == "Width:").and_then(|i| texts.get(row + i + 1)); + assert_eq!(width.map(|(t, _)| t.as_str()), Some("100%"), "{texts:?}"); + let at = width.map(|(_, p)| *p).unwrap(); + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + run(&mut app, vec![egui::Event::PointerMoved(at), press(true)]); + run(&mut app, vec![press(false)]); + run(&mut app, vec![]); + run(&mut app, vec![egui::Event::Text("2000000".into())]); + let enter = egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }; + run(&mut app, vec![enter]); + assert!(app.ui.dialog.is_none(), "Enter makes the mosaic: {:?}", app.ui.dialog.as_ref().map(|d| d.str(form::REFUSED))); + assert_eq!(mosaic(&app).map(|m| (m.0, m.1)), Some((1e6, 50.0))); + } + /// The id of the image in the document. fn image_id(app: &VectorcraftApp) -> u64 { let mut id = None; diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index d50b08f97f..85f6a14baa 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -1128,8 +1128,8 @@ fn a_hex_code_pasted_into_the_hex_field_replaces_its_digits() { } } -/// #1000: a count set in Object › Create Object Mosaic… reaches the command, so the mosaic has that -/// many columns, not the 10 × 10 grid; Enter confirms the dialog. +/// #1000: a count typed in Object › Create Object Mosaic…'s Number of Tiles reaches the command, so +/// the mosaic has that many columns, not the 10 × 10 grid; Enter confirms the dialog. #[test] fn object_mosaic_makes_the_grid_typed_in_its_dialog() { let mut app = app(); @@ -1138,16 +1138,36 @@ fn object_mosaic_makes_the_grid_typed_in_its_dialog() { let ctx = egui::Context::default(); theme::install_fonts(&ctx); theme::apply(&ctx, Default::default()); + // A frame → the texts painted, with their centers. let frame = |app: &mut VectorcraftApp, events: Vec| { let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui.ctx())); out.textures_delta.clear(); + fn walk(s: &egui::Shape, out: &mut Vec<(String, egui::Pos2)>) { + match s { + egui::Shape::Vec(v) => v.iter().for_each(|s| walk(s, out)), + egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.visual_bounding_rect().center())), + _ => {} + } + } + let mut texts = vec![]; + out.shapes.iter().for_each(|c| walk(&c.shape, &mut texts)); + texts }; let entry = crate::menus::menu_entries(&app).into_iter().find(|e| e.label == "Create Object Mosaic…").expect("menu item"); let (cmd, params) = crate::menus::click_target(&entry.label, entry.command.as_deref().unwrap(), &entry.params); crate::menus::invoke(&mut app, &cmd, params); frame(&mut app, vec![]); - app.ui.dialog.as_mut().expect("the mosaic dialog").fields.insert("columns".into(), json!(3.0)); + let texts = frame(&mut app, vec![]); + // Number of Tiles' Width field comes right after the row's Width caption. + let row = texts.iter().position(|(t, _)| t == "Number of Tiles:").expect("the Number of Tiles row"); + let columns = texts[row..].iter().position(|(t, _)| t == "Width:").and_then(|i| texts.get(row + i + 1)); + assert_eq!(columns.map(|(t, _)| t.as_str()), Some("10"), "{texts:?}"); + let at = columns.map(|(_, p)| *p).unwrap(); + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(&mut app, vec![egui::Event::PointerMoved(at), press(true)]); + frame(&mut app, vec![press(false)]); frame(&mut app, vec![]); + frame(&mut app, vec![egui::Event::Text("3".into())]); let enter = egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }; frame(&mut app, vec![enter]); assert!(app.ui.dialog.is_none()); diff --git a/docs/mcp.md b/docs/mcp.md index 32acf6084a..7c00e1ca06 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -1882,8 +1882,9 @@ nothing. These Object menu commands refuse a string, a number or another value that is not true or false with `` `copy` must be true or false ``, naming the key, and change nothing: `reflectX`, `reflectY`, `random`, `copy`, -`relative`, `strokes`, `corners`, `objects` and `patterns` in `object.transformEach`; `gray`, `deleteRaster` -and `percentages` in `object.createObjectMosaic`; `trim` in `object.cropImage`; `allArtboards` in `object.createTrimMarks`; and `byColumn`, +`relative`, `strokes`, `corners`, `objects` and `patterns` in `object.transformEach`; `gray`, `deleteRaster` and +`percentages` in `object.createObjectMosaic`; `trim` in `object.cropImage`; `allArtboards` in +`object.createTrimMarks`; and `byColumn`, `moveArtwork`, `patterns` and `lockedAndHidden` in `artboard.rearrange`. A null is read as a key left out. `object.createTrimMarks` refuses a `style` that is not a string, such as `5`, with `` `style` must be roman or japanese ``, the message it gives for a string that names no style. @@ -1896,7 +1897,8 @@ Grayscale), Resize Using Percentages, Delete Raster and Use Ratio. With no image - `percentages: true`: `width` and `height` are percentages of the image's size (a side left out is 100). - `constrain: "width"` or `"height"`: the mosaic keeps the image's proportions. The named side's size is used and the - other side's is worked out from it, so a `height` given with `constrain: "width"` is not used. + other side's is worked out from it, so a `height` given with `constrain: "width"` is not used. It is still checked + against the range below. - `useRatio: "width"` or `"height"`: the tiles are square as drawn, with the spacing taken off. The count on the named side (`columns` for `"width"`) stays, and the other count, within 1 to 1000, is the one whose tiles come closest to square, measured along the image's own sides when it is turned. `useRatio: true` keeps the `constrain` side, or the @@ -1907,7 +1909,12 @@ A `width` or `height` outside 0.1 to 1000000 (points, or percent with `percentag `` `width` must be between 0.1 and 1000000 (got 0) ``. A `constrain` other than `"width"`, `"height"` or null is refused with `` `constrain` must be one of "width", "height" or null ``, and a `useRatio` other than those, true or false with `` `useRatio` must be one of "width", "height", true, false or null ``; the command then changes nothing. A -side that `constrain` works out as under 0.1 pt grows to 0.1 pt, and the other side grows with it. The result also gives the `columns` and `rows` the mosaic was made with, here for a 100 × 50 pt image: +side that `constrain` works out as under 0.1 pt grows to 0.1 pt, and the other side grows with it. A side that +`constrain` works out as over 1000000 pt shrinks to 1000000 pt, and the other side shrinks with it. With `constrain` +on an image more than 10000000 times wider than tall (or taller than wide), no size keeps both sides in the range, and +the call is refused with `` the image's proportions leave no size with both sides between 0.1 and 1000000 pt ``. + +The result also gives the `columns` and `rows` the mosaic was made with, here for a 100 × 50 pt image: ```json {"columns": 10, "rows": 3, "useRatio": true} From 4bc874ca79c67c90f0924e22297e84b9af392f1c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 16:20:29 +0000 Subject: [PATCH 021/158] Share cached glyph outline drawing --- Cargo.lock | 12 ++++++++ crates/text/Cargo.toml | 2 ++ crates/text/src/fontdb/lookup.rs | 48 ++++++++++++++++++++++++-------- 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 887b10ab11..07f06d5ac8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1005,6 +1005,17 @@ name = "craft-eps" version = "0.1.0" source = "git+https://github.com/storytold/craft-libs?rev=6d620e971e820b517b11a99cad040ebac670e1e2#6d620e971e820b517b11a99cad040ebac670e1e2" +[[package]] +name = "craft-font-catalog" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=14bccd4e09094820babc434d2681297be8873bd9#14bccd4e09094820babc434d2681297be8873bd9" +dependencies = [ + "kurbo 0.13.1", + "skrifa 0.47.0", + "thiserror 2.0.21", + "windows-registry", +] + [[package]] name = "craft-fonts-build" version = "0.1.0" @@ -6871,6 +6882,7 @@ dependencies = [ name = "vectorcraft-text" version = "0.24.1" dependencies = [ + "craft-font-catalog", "harfrust 0.13.3", "icu_segmenter", "kurbo 0.13.1", diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index 1f8ddc3755..9b95f04301 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -9,6 +9,8 @@ description = "VectorCraft text: font database, shaping, layout, glyph outlines" workspace = true [dependencies] +# Pending shared extraction; pin the immutable official PR head until it merges. +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "14bccd4e09094820babc434d2681297be8873bd9", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index 23e00afa0c..a846f2af45 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -3,17 +3,14 @@ use super::PathBuf; use super::build::{instanced, style_distance, style_italic, style_weight}; use super::cache::Catalog; use super::face::{FALLBACK_FAMILY, FontFace, MAX_LIVE_INSTANCES, Variation, VariationAxis}; -use super::glyph_pen::{FlipPen, svg_drawn}; +use super::glyph_pen::svg_drawn; #[cfg(not(target_arch = "wasm32"))] use super::names::SYSTEM_FALLBACKS; use super::names::{norm, norm_chars, script_families}; #[cfg(not(target_arch = "wasm32"))] use super::scan::{enumerate_faces, font_files}; use super::traits::{Alias, FontMatch, FontTraits}; -use super::{ - Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, DrawSettings, FontDb, GlyphId, GlyphImage, MetadataProvider, NEXT_ID, OUTLINE_CACHE_MAX, - Ordering, Size, -}; +use super::{Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, FontDb, GlyphImage, MetadataProvider, NEXT_ID, OUTLINE_CACHE_MAX, Ordering}; /// The most faces [`FontDb::postscript_faces`] gives, and the most families it loads. const MAX_POSTSCRIPT_FACES: usize = 16; @@ -566,13 +563,13 @@ impl FontDb { if let Some(p) = self.outlines.lock().unwrap_or_else(|e| e.into_inner()).get(&key) { return p.clone(); } - let mut pen = FlipPen(BezPath::new()); - if let Some(f) = face.skrifa() - && let Some(g) = f.outline_glyphs().get(GlyphId::new(gid)) - { - let _ = g.draw(DrawSettings::unhinted(Size::unscaled(), face.location()), &mut pen); - } - let p = Arc::new(pen.0); + let path = craft_font_catalog::FontOutline::from_bytes(face.data(), face.index(), face.variations()) + .and_then(|font| font.outline_recovering(gid)) + // The old pen kept a partial path when drawing failed. Keep that behavior while + // the shared implementation bounds the number of elements from untrusted fonts. + .map(|(path, _status)| kurbo::Affine::scale_non_uniform(1.0, -1.0) * path) + .unwrap_or_default(); + let p = Arc::new(path); let mut cache = self.outlines.lock().unwrap_or_else(|e| e.into_inner()); if cache.len() >= OUTLINE_CACHE_MAX { cache.clear(); @@ -634,3 +631,30 @@ impl FontDb { content } } + +#[cfg(test)] +mod shared_outline_tests { + use super::super::glyph_pen::FlipPen; + use super::*; + use skrifa::instance::Size; + use skrifa::outline::DrawSettings; + use skrifa::{GlyphId, MetadataProvider}; + + #[test] + fn shared_outlines_match_original_pen_for_variable_instances() { + let db = FontDb::with_font_dirs(vec![]); + let Some(bytes) = crate::test_fonts::variable_font() else { return }; + assert!(db.add_font(bytes) > 0); + let face = db.face(crate::test_fonts::VARIABLE_FAMILY, "Bold").expect("named instance is registered"); + let f = face.skrifa().expect("font parses"); + for ch in ['A', 'V', ' ', 'a'] { + let Some(glyph) = f.charmap().map(ch) else { continue }; + let mut old = FlipPen(BezPath::new()); + if let Some(outline) = f.outline_glyphs().get(GlyphId::new(glyph.to_u32())) { + // Match the prior production behavior, including a partial path on error. + let _ = outline.draw(DrawSettings::unhinted(Size::unscaled(), face.location()), &mut old); + } + assert_eq!(*db.outline(&face, glyph.to_u32()), old.0, "glyph {ch}"); + } + } +} From 221b2d58b38710d9138ac6afe372b87d1cf32aae Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 16:25:15 +0000 Subject: [PATCH 022/158] Use shared contextual run shaping --- Cargo.lock | 3 +- crates/text/Cargo.toml | 2 +- crates/text/src/shape.rs | 64 +++++++++++++++------------------------- 3 files changed, 26 insertions(+), 43 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07f06d5ac8..898dc85234 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,8 +1008,9 @@ source = "git+https://github.com/storytold/craft-libs?rev=6d620e971e820b517b11a9 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=14bccd4e09094820babc434d2681297be8873bd9#14bccd4e09094820babc434d2681297be8873bd9" +source = "git+https://github.com/storytold/craft-libs?rev=159b942defe3613c91a4beec5fadfcb1593f2600#159b942defe3613c91a4beec5fadfcb1593f2600" dependencies = [ + "harfrust 0.13.3", "kurbo 0.13.1", "skrifa 0.47.0", "thiserror 2.0.21", diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index 9b95f04301..3477a6d473 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] # Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "14bccd4e09094820babc434d2681297be8873bd9", default-features = false } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "159b942defe3613c91a4beec5fadfcb1593f2600", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/shape.rs b/crates/text/src/shape.rs index 13cd2e06de..7c6a2d720f 100644 --- a/crates/text/src/shape.rs +++ b/crates/text/src/shape.rs @@ -8,7 +8,7 @@ use unicode_bidi::Level; use unicode_script::{Script, UnicodeScript}; use unicode_segmentation::UnicodeSegmentation; -use harfrust::{BufferClusterLevel, Direction, Feature, ShapeOptions, Tag, UnicodeBuffer}; +use harfrust::{Direction, Feature, Tag}; use kurbo::Shape; use skrifa::MetadataProvider; use skrifa::charmap::Charmap; @@ -1515,46 +1515,28 @@ fn shape_segment(text: &str, context: &Range, seg: &Segment, feats: &OtFe let along_features = with_more(&|s| feats.resolve(s)); // gid, cluster, x and y advance, x and y offset. let shape = |feats: &[Feature], direction: Direction| { - let mut buf = UnicodeBuffer::new(); - for (i, c) in text_seg.char_indices() { - let cl = (range.start + i) as u32; - let c = st.digits.map(c); - if upper { - for u in c.to_uppercase() { - buf.add(u, cl); - } - } else { - buf.add(c, cl); - } - } - buf.set_direction(direction); - buf.guess_segment_properties(); - if char_level.get() { - buf.set_cluster_level(BufferClusterLevel::Characters); - } - // The characters' language picks the font's forms for it (`locl`: Turkish keeps fi - // apart and the dot on its i). - if let Some(l) = &language { - buf.set_language(l.clone()); - } - // Harfrust keeps this Unicode context for joining/positional shaping, but does not emit - // glyphs for it. This retains context at real style/font segmentation boundaries without - // shaping across those boundaries or claiming cross-style ligatures/mark attachment. - if let Some(pre) = text.get(context.start..range.start) { - buf.set_pre_context(pre); - } - if let Some(post) = text.get(range.end..context.end) { - buf.set_post_context(post); - } - // A buffer whose characters name no script reads as `UNKNOWN`: its plan has none. - let script = Some(buf.script()).filter(|s| *s != harfrust::script::UNKNOWN); - let plan = face.shape_plan(&shaper, buf.direction(), script, language.as_ref(), feats); - let gb = shaper.shape(buf, ShapeOptions::new().features(feats).plan(Some(&plan))); - gb.glyph_infos() - .iter() - .zip(gb.glyph_positions()) - .map(|(info, pos)| (info.glyph_id, info.cluster, pos.x_advance, pos.y_advance, pos.x_offset, pos.y_offset)) - .collect::>() + let input = craft_font_catalog::RunInput { + text: text_seg, + source_start: range.start, + pre_context: text.get(context.start..range.start).unwrap_or_default(), + post_context: text.get(range.end..context.end).unwrap_or_default(), + direction, + language: language.as_ref(), + features: feats, + character_clusters: char_level.get(), + uppercase: upper, + }; + craft_font_catalog::shape_run( + &shaper, + &input, + |c| st.digits.map(c), + |shaper, direction, script, language, features| face.shape_plan(shaper, direction, script, language, features), + ) + // HarfRust clusters are u32; a run beyond that source offset cannot be represented. + .unwrap_or_default() + .into_iter() + .map(|g| (g.glyph_id, g.cluster, g.x_advance, g.y_advance, g.x_offset, g.y_offset)) + .collect::>() }; let along = if level.is_rtl() { Direction::RightToLeft } else { Direction::LeftToRight }; *raw = shape(&along_features, along).into_iter().map(|(g, c, xa, _, xo, yo)| (g, c, xa, xo, yo)).collect(); From 09f02d70b51a37a06ef69d5bfac9e7b151398cb3 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 16:26:03 +0000 Subject: [PATCH 023/158] Remove superseded outline import --- crates/text/src/fontdb.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/text/src/fontdb.rs b/crates/text/src/fontdb.rs index e96e1d0fae..df12ce99e7 100644 --- a/crates/text/src/fontdb.rs +++ b/crates/text/src/fontdb.rs @@ -8,7 +8,7 @@ use std::sync::{Arc, Mutex, RwLock}; use kurbo::BezPath; use skrifa::instance::{Location, LocationRef, Size}; -use skrifa::outline::{DrawSettings, OutlinePen}; +use skrifa::outline::OutlinePen; use skrifa::raw::FileRef; use skrifa::string::StringId; use skrifa::{GlyphId, MetadataProvider, Tag}; From 6fa5a6fb56333659dac6fd8a664d7ecb1a439d6d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 16:28:57 +0000 Subject: [PATCH 024/158] Compare malformed glyph recovery against original pen --- Cargo.lock | 2 +- crates/text/Cargo.toml | 2 +- crates/text/src/fontdb/lookup.rs | 33 ++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07f06d5ac8..c9ed1d024c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,7 +1008,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=6d620e971e820b517b11a9 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=14bccd4e09094820babc434d2681297be8873bd9#14bccd4e09094820babc434d2681297be8873bd9" +source = "git+https://github.com/storytold/craft-libs?rev=58e2a887e6fe346deff2708513b0c1cd7c2af8c3#58e2a887e6fe346deff2708513b0c1cd7c2af8c3" dependencies = [ "kurbo 0.13.1", "skrifa 0.47.0", diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index 9b95f04301..0f311b964b 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] # Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "14bccd4e09094820babc434d2681297be8873bd9", default-features = false } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "58e2a887e6fe346deff2708513b0c1cd7c2af8c3", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index a846f2af45..8ff792751b 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -657,4 +657,37 @@ mod shared_outline_tests { assert_eq!(*db.outline(&face, glyph.to_u32()), old.0, "glyph {ch}"); } } + + #[test] + fn malformed_cff_prefix_matches_original_pen() { + use skrifa::raw::ps::cff::CffFontRef; + let Ok(dir) = std::env::var("CRAFT_FONTS_DIR") else { return }; + let mut bytes = std::fs::read(std::path::Path::new(&dir).join("fonts/noto-sans-cjk-sc/NotoSansCJKsc-Regular.otf")).unwrap(); + let (gid, start) = { + let f = skrifa::FontRef::new(&bytes).unwrap(); + let table = f.table_data(skrifa::Tag::new(b"CFF ")).unwrap().as_bytes(); + let cff = CffFontRef::new(table, 0, None).unwrap(); + let (gid, cs) = (0..cff.num_glyphs()) + .find_map(|gid| { + let cs = cff.charstrings().get(gid as usize)?; + (cs.len() >= 8).then_some((gid, cs)) + }) + .unwrap(); + (gid, cs.as_ptr() as usize - bytes.as_ptr() as usize) + }; + bytes[start..start + 8].copy_from_slice(&[139, 139, 21, 239, 139, 5, 10, 14]); + let f = skrifa::FontRef::new(&bytes).unwrap(); + let mut old = FlipPen(BezPath::new()); + let result = f + .outline_glyphs() + .get(GlyphId::new(gid)) + .unwrap() + .draw(DrawSettings::unhinted(Size::unscaled(), skrifa::instance::LocationRef::default()), &mut old); + assert!(result.is_err()); + assert!(!old.0.elements().is_empty()); + let shared = craft_font_catalog::FontOutline::from_bytes(&bytes, 0, &[]).unwrap(); + let (path, status) = shared.outline_recovering(gid).unwrap(); + assert!(status.is_err()); + assert_eq!(kurbo::Affine::scale_non_uniform(1.0, -1.0) * path, old.0); + } } From 10b3779c4eafe2944ca63bd7aa91d791e04e5c90 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 08:32:03 -0800 Subject: [PATCH 025/158] Library panels: rows for the Neon & Glow style names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main added the built-in Neon & Glow graphic style library, so the style-name check now lists 86 names. Each complete catalog gets rows for Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet and Cobalt Phosphor, after the other style rows. - ka: main already has rows for Weather Icons, Soft Shadow and Hard Shadow, so the branch's copies of those rows are removed. - hi: Triad Coral and Triad Teal use त्रिक, the term of the Triad row, as the Hindi glossary check requires. --- crates/ui-egui/src/i18n/bg.tsv | 6 ++++++ crates/ui-egui/src/i18n/bs.tsv | 6 ++++++ crates/ui-egui/src/i18n/ca.tsv | 6 ++++++ crates/ui-egui/src/i18n/cs.tsv | 6 ++++++ crates/ui-egui/src/i18n/da.tsv | 6 ++++++ crates/ui-egui/src/i18n/de.tsv | 6 ++++++ crates/ui-egui/src/i18n/el.tsv | 6 ++++++ crates/ui-egui/src/i18n/es.tsv | 6 ++++++ crates/ui-egui/src/i18n/fi.tsv | 6 ++++++ crates/ui-egui/src/i18n/fr.tsv | 6 ++++++ crates/ui-egui/src/i18n/gu.tsv | 6 ++++++ crates/ui-egui/src/i18n/hi.tsv | 10 ++++++++-- crates/ui-egui/src/i18n/hu.tsv | 6 ++++++ crates/ui-egui/src/i18n/id.tsv | 6 ++++++ crates/ui-egui/src/i18n/it.tsv | 6 ++++++ crates/ui-egui/src/i18n/ja.tsv | 6 ++++++ crates/ui-egui/src/i18n/ka.tsv | 9 ++++++--- crates/ui-egui/src/i18n/ko.tsv | 6 ++++++ crates/ui-egui/src/i18n/nl.tsv | 6 ++++++ crates/ui-egui/src/i18n/pl.tsv | 6 ++++++ crates/ui-egui/src/i18n/pt-br.tsv | 6 ++++++ crates/ui-egui/src/i18n/ru.tsv | 6 ++++++ crates/ui-egui/src/i18n/sv.tsv | 6 ++++++ crates/ui-egui/src/i18n/tests.rs | 2 +- crates/ui-egui/src/i18n/tr.tsv | 6 ++++++ crates/ui-egui/src/i18n/uk.tsv | 6 ++++++ crates/ui-egui/src/i18n/vi.tsv | 6 ++++++ crates/ui-egui/src/i18n/zh-hans.tsv | 6 ++++++ crates/ui-egui/src/i18n/zh-hant.tsv | 6 ++++++ 29 files changed, 171 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index d087d39eb1..b53ebee4bb 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -6576,6 +6576,12 @@ axis Y Axis Y ос Overlay Glaze Глазура прекриване Screen Light Светлина екран Soft Light Wash Лавиране мека светлина + Cyan Neon Циан неон + Magenta Laser Магента лазер + Amber Tube Кехлибарена тръба + Electric Lime Електрически лайм + Pulse Violet Пулсиращо виолетово + Cobalt Phosphor Кобалтов фосфор Burst Взрив Rounded Square Закръглен квадрат Sun Слънце diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index b9dcce9306..580ba40fa7 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -6629,6 +6629,12 @@ axis Y Axis Y osa Overlay Glaze Glazura prekrivanja Screen Light Svjetlo ekrana Soft Light Wash Laviranje mekim svjetlom + Cyan Neon Cijan neon + Magenta Laser Magenta laser + Amber Tube Jantarna cijev + Electric Lime Električna limeta + Pulse Violet Pulsirajuća ljubičasta + Cobalt Phosphor Kobaltni fosfor Burst Prasak Rounded Square Zaobljeni kvadrat Sun Sunce diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index da1e5d9d7c..e0c2f24488 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4289,6 +4289,12 @@ digits Malayalam Malaiàlam Overlay Glaze Veladura superposició Screen Light Llum pantalla Soft Light Wash Aiguada llum suau + Cyan Neon Neó cian + Magenta Laser Làser magenta + Amber Tube Tub ambre + Electric Lime Llima elèctrica + Pulse Violet Violeta polsant + Cobalt Phosphor Fòsfor cobalt Burst Esclat Rounded Square Quadrat arrodonit Sun Sol diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 8735250f67..1acb611f10 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7182,6 +7182,12 @@ axis Y Axis osa Y Overlay Glaze Glazura překrytí Screen Light Světlo závoje Soft Light Wash Lavírka měkkého světla + Cyan Neon Azurový neon + Magenta Laser Purpurový laser + Amber Tube Jantarová trubice + Electric Lime Elektrická limetková + Pulse Violet Pulzující fialová + Cobalt Phosphor Kobaltový luminofor Burst Výbuch Rounded Square Zaoblený čtverec Sun Slunce diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 8dda384bda..be532d49ba 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -7262,6 +7262,12 @@ axis Y Axis Y-akse Overlay Glaze Overlejringsglasur Screen Light Skærmlys Soft Light Wash Blødt lys-lavering + Cyan Neon Cyan neon + Magenta Laser Magenta laser + Amber Tube Ravfarvet rør + Electric Lime Elektrisk lime + Pulse Violet Pulserende violet + Cobalt Phosphor Koboltfosfor Burst Udbrud Rounded Square Afrundet kvadrat Sun Sol diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 5d55e89fd2..f73be8d89a 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -6769,6 +6769,12 @@ axis Y Axis Y-Achse Overlay Glaze Ineinanderkopieren-Lasur Screen Light Negativ-multiplizieren-Licht Soft Light Wash Weiches-Licht-Lavierung + Cyan Neon Cyan-Neon + Magenta Laser Magenta-Laser + Amber Tube Bernsteinröhre + Electric Lime Elektrisches Limettengrün + Pulse Violet Pulsierendes Violett + Cobalt Phosphor Kobalt-Phosphor Burst Strahlenkranz Rounded Square Abgerundetes Quadrat Sun Sonne diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index c899490936..1e5f32a9e1 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7150,6 +7150,12 @@ axis Y Axis Άξονας Y Overlay Glaze Βερνίκι επικάλυψης Screen Light Φως αρνητικού πολλαπλασιασμού Soft Light Wash Αραίωση απαλού φωτός + Cyan Neon Κυανό νέον + Magenta Laser Ματζέντα λέιζερ + Amber Tube Κεχριμπαρένιος σωλήνας + Electric Lime Ηλεκτρικό λάιμ + Pulse Violet Παλλόμενο βιολετί + Cobalt Phosphor Φωσφόρος κοβαλτίου Burst Έκρηξη Rounded Square Στρογγυλεμένο τετράγωνο Sun Ήλιος diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 49d0c6e3b3..7ead144f0a 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7138,6 +7138,12 @@ axis Y Axis Eje Y Overlay Glaze Veladura superponer Screen Light Luz trama Soft Light Wash Aguada luz suave + Cyan Neon Neón cian + Magenta Laser Láser magenta + Amber Tube Tubo ámbar + Electric Lime Lima eléctrica + Pulse Violet Violeta pulsante + Cobalt Phosphor Fósforo cobalto Burst Estallido Rounded Square Cuadrado redondeado Sun Sol diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 691653e8f1..a09bf9a5ab 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7227,6 +7227,12 @@ axis Y Axis Y-akseli Overlay Glaze Sulautus-lasite Screen Light Rasteri-valo Soft Light Wash Pehmeä valo -laveeraus + Cyan Neon Syaani neon + Magenta Laser Magenta laser + Amber Tube Meripihkaputki + Electric Lime Sähköinen lime + Pulse Violet Sykkivä violetti + Cobalt Phosphor Kobolttifosfori Burst Purkaus Rounded Square Pyöristetty neliö Sun Aurinko diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 263a8622be..ff1676c1c9 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7177,6 +7177,12 @@ axis Y Axis Axe Y Overlay Glaze Glacis incrustation Screen Light Lumière superposition Soft Light Wash Lavis lumière tamisée + Cyan Neon Néon cyan + Magenta Laser Laser magenta + Amber Tube Tube ambre + Electric Lime Citron vert électrique + Pulse Violet Violet pulsé + Cobalt Phosphor Phosphore cobalt Burst Éclat Rounded Square Carré arrondi Sun Soleil diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index fd09b9eb9f..842bdc94af 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4819,6 +4819,12 @@ swatch [Registration] [રજિસ્ટ્રેશન] Shield Buff ઢાલ બફ Sketchy Line સ્કેચ જેવી રેખા Soft Light Wash સૉફ્ટ લાઇટ વૉશ + Cyan Neon સાયન નિયૉન + Magenta Laser મજેન્ટા લેસર + Amber Tube એમ્બર ટ્યૂબ + Electric Lime ઇલેક્ટ્રિક લાઇમ + Pulse Violet પલ્સ વાયોલેટ + Cobalt Phosphor કોબાલ્ટ ફૉસ્ફર Soft Shadow નરમ પડછાયો Spiral Copies સર્પાકાર નકલો Spotlight સ્પોટલાઇટ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index f643c33fc2..a53397eefc 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -555,13 +555,13 @@ antiAlias Sharp शार्प Complementary Coral कोरल, पूरक Split Complementary Coral कोरल, विभाजित पूरक Analogous Coral कोरल, अनुरूप - Triad Coral कोरल, त्रिदाद + Triad Coral कोरल, त्रिक Tetrad Coral कोरल, चतुष्क Pentagram Coral कोरल, पेंटाग्राम Complementary Teal टील, पूरक Split Complementary Teal टील, विभाजित पूरक Analogous Teal टील, अनुरूप - Triad Teal टील, त्रिदाद + Triad Teal टील, त्रिक Tetrad Teal टील, चतुष्क Pentagram Teal टील, पेंटाग्राम Soft Spectrum सॉफ़्ट स्पेक्ट्रम @@ -700,6 +700,12 @@ antiAlias Sharp शार्प Overlay Glaze ओवरले ग्लेज़ Screen Light स्क्रीन रोशनी Soft Light Wash सॉफ़्ट लाइट वॉश + Cyan Neon सियान नियॉन + Magenta Laser मैजेंटा लेज़र + Amber Tube एम्बर ट्यूब + Electric Lime इलेक्ट्रिक लाइम + Pulse Violet पल्स वायलेट + Cobalt Phosphor कोबाल्ट फ़ॉस्फ़र Burst विस्फोट Rounded Square गोल कोनों वाला वर्ग Sun सूरज diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index a47ff5a67c..8f7aa069a4 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7166,6 +7166,12 @@ axis Y Axis Y tengely Overlay Glaze Átfedés máz Screen Light Képernyő fény Soft Light Wash Lágy fény lavírozás + Cyan Neon Ciánneon + Magenta Laser Bíbor lézer + Amber Tube Borostyáncső + Electric Lime Elektromos lime + Pulse Violet Pulzáló ibolya + Cobalt Phosphor Kobaltfoszfor Burst Robbanás Rounded Square Lekerekített négyzet Sun Nap diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 7054d5be7d..4e0f52973f 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -6592,6 +6592,12 @@ axis Y Axis Sumbu Y Overlay Glaze Glasir menimpa Screen Light Cahaya layar Soft Light Wash Sapuan cahaya lembut + Cyan Neon Neon sian + Magenta Laser Laser magenta + Amber Tube Tabung amber + Electric Lime Limau elektrik + Pulse Violet Ungu berdenyut + Cobalt Phosphor Fosfor kobalt Burst Ledakan Rounded Square Persegi bulat Sun Matahari diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 7dd799183f..22eb5bb03d 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -6805,6 +6805,12 @@ axis Y Axis Asse Y Overlay Glaze Velatura sovrapponi Screen Light Luce schermo Soft Light Wash Acquerello luce soffusa + Cyan Neon Neon ciano + Magenta Laser Laser magenta + Amber Tube Tubo ambra + Electric Lime Lime elettrico + Pulse Violet Viola pulsante + Cobalt Phosphor Fosforo cobalto Burst Esplosione Rounded Square Quadrato arrotondato Sun Sole diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 6a6bfdb3ba..e35ed53f37 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -8682,6 +8682,12 @@ axis Y Axis Y 軸 Overlay Glaze オーバーレイの釉 Screen Light スクリーンの光 Soft Light Wash ソフトライトのにじみ + Cyan Neon シアンのネオン + Magenta Laser マゼンタのレーザー + Amber Tube 琥珀色の管 + Electric Lime エレクトリックライム + Pulse Violet 脈打つ紫 + Cobalt Phosphor コバルトの蛍光体 Burst バースト Rounded Square 角丸の正方形 Sun 太陽 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index d97b37ceb1..9ec433bc5e 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -8869,7 +8869,6 @@ axis Y Axis Y ღერძი Checkpoint საკონტროლო წერტილი Inventory Icons ინვენტარის ხატულები Skill Icons უნარების ხატულები - Weather Icons ამინდის ხატულები Attack შეტევა Defend თავდაცვა Heal განკურნება @@ -9178,8 +9177,6 @@ axis Y Axis Y ღერძი Pinched Stripes შევიწროებული ზოლები Chevron Pulse შევრონების პულსი Radiating Lenses მანათობელი ლინზები - Soft Shadow რბილი ჩრდილი - Hard Shadow მკვეთრი ჩრდილი Lifted Card აწეული ბარათი Neon Tube ნეონის მილი Inner Light შიდა სინათლე @@ -9223,6 +9220,12 @@ axis Y Axis Y ღერძი Overlay Glaze გადაფარვის ჭიქური Screen Light ეკრანის სინათლე Soft Light Wash რბილი სინათლის რეცხვა + Cyan Neon ციანის ნეონი + Magenta Laser მაჯენტას ლაზერი + Amber Tube ქარვისფერი მილი + Electric Lime ელექტრული ლაიმი + Pulse Violet მფეთქავი იისფერი + Cobalt Phosphor კობალტის ფოსფორი Burst აფეთქება Rounded Square მომრგვალებული კვადრატი Sun მზე diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 84a7d94c83..e7329f15b0 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -6769,6 +6769,12 @@ axis Y Axis Y축 Overlay Glaze 오버레이 유약 Screen Light 스크린 빛 Soft Light Wash 소프트 라이트 번짐 + Cyan Neon 시안 네온 + Magenta Laser 마젠타 레이저 + Amber Tube 호박색 튜브 + Electric Lime 일렉트릭 라임 + Pulse Violet 펄스 바이올렛 + Cobalt Phosphor 코발트 형광체 Burst 폭발 Rounded Square 둥근 사각형 Sun 해 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index ce1aec987b..5414354757 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -9087,6 +9087,12 @@ axis Y Axis Y-as Overlay Glaze Bedekken-glazuur Screen Light Scherm-licht Soft Light Wash Zacht-licht-wassing + Cyan Neon Cyaan neon + Magenta Laser Magenta laser + Amber Tube Amberkleurige buis + Electric Lime Elektrisch limoen + Pulse Violet Pulserend violet + Cobalt Phosphor Kobaltfosfor Burst Uitbarsting Rounded Square Afgerond vierkant Sun Zon diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 70e62e5286..780575fa3b 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7036,6 +7036,12 @@ axis Y Axis Oś Y Overlay Glaze Glazura nakładki Screen Light Światło mnożenia odwrotnego Soft Light Wash Lawowanie łagodnym światłem + Cyan Neon Cyjanowy neon + Magenta Laser Karmazynowy laser + Amber Tube Bursztynowa rura + Electric Lime Elektryczna limonka + Pulse Violet Pulsujący fiolet + Cobalt Phosphor Kobaltowy luminofor Burst Wybuch Rounded Square Zaokrąglony kwadrat Sun Słońce diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 372c1b3cfd..709adb3b67 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7094,6 +7094,12 @@ axis Y Axis Eixo Y Overlay Glaze Veladura Sobrepor Screen Light Luz Tela Soft Light Wash Aguada Luz Suave + Cyan Neon Neon Ciano + Magenta Laser Laser Magenta + Amber Tube Tubo Âmbar + Electric Lime Lima Elétrica + Pulse Violet Violeta Pulsante + Cobalt Phosphor Fósforo Cobalto Burst Explosão Rounded Square Quadrado Arredondado Sun Sol diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index b7d0a48e08..b800c3313b 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -6806,6 +6806,12 @@ axis Y Axis Ось Y Overlay Glaze Глазурь перекрытия Screen Light Свет растра Soft Light Wash Размывка мягким светом + Cyan Neon Голубой неон + Magenta Laser Пурпурный лазер + Amber Tube Янтарная трубка + Electric Lime Электрический лайм + Pulse Violet Пульсирующий фиолетовый + Cobalt Phosphor Кобальтовый люминофор Burst Вспышка Rounded Square Скруглённый квадрат Sun Солнце diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 6b4f7603b8..cc46477bc6 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7170,6 +7170,12 @@ axis Y Axis Y-axel Overlay Glaze Överlägg-glasyr Screen Light Skärm-ljus Soft Light Wash Mjukt ljus-lavering + Cyan Neon Cyan neon + Magenta Laser Magenta laser + Amber Tube Bärnstensrör + Electric Lime Elektrisk lime + Pulse Violet Pulserande violett + Cobalt Phosphor Koboltfosfor Burst Utbrott Rounded Square Rundad kvadrat Sun Sol diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index a83eb27724..b8897c7954 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -522,7 +522,7 @@ fn built_in_library_style_names_are_in_complete_catalogs() { .flat_map(|(_, lib)| lib.styles.iter().map(|s| s.name.clone()).collect::>()) .collect(), ); - assert_eq!(names.len(), 80, "{names:?}"); + assert_eq!(names.len(), 86, "{names:?}"); let bad = lacking(&names, |c, n| c.plain(n).is_some()); assert!(bad.is_empty(), "{}", bad.join("\n")); } diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 11099c1b8d..ff3da24de9 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -9060,6 +9060,12 @@ axis Y Axis Y ekseni Overlay Glaze Kaplama Sırı Screen Light Ekran Işığı Soft Light Wash Yumuşak Işık Lavisi + Cyan Neon Camgöbeği Neon + Magenta Laser Macenta Lazer + Amber Tube Kehribar Tüp + Electric Lime Elektrik Yeşili + Pulse Violet Nabız Moru + Cobalt Phosphor Kobalt Fosfor Burst Patlama Rounded Square Yuvarlatılmış Kare Sun Güneş diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 562245ed70..1df6cbd780 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -6787,6 +6787,12 @@ axis Y Axis Вісь Y Overlay Glaze Глазур накладання Screen Light Світло екрана Soft Light Wash Розмивка м’яким світлом + Cyan Neon Блакитний неон + Magenta Laser Пурпуровий лазер + Amber Tube Бурштинова трубка + Electric Lime Електричний лайм + Pulse Violet Пульсуючий фіолетовий + Cobalt Phosphor Кобальтовий люмінофор Burst Спалах Rounded Square Округлений квадрат Sun Сонце diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index c6f1533a1c..2d7c49765e 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -6804,6 +6804,12 @@ axis Y Axis Trục Y Overlay Glaze Men phủ lên Screen Light Ánh màn hình Soft Light Wash Loang ánh sáng mềm + Cyan Neon Neon lục lam + Magenta Laser Laser đỏ tươi + Amber Tube Ống hổ phách + Electric Lime Chanh điện + Pulse Violet Tím nhấp nháy + Cobalt Phosphor Lân quang coban Burst Bùng nổ Rounded Square Hình vuông bo góc Sun Mặt trời diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index c5db33421c..29cbfdc990 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7020,6 +7020,12 @@ axis Y Axis Y 轴 Overlay Glaze 叠加釉 Screen Light 滤色光 Soft Light Wash 柔光晕染 + Cyan Neon 青色霓虹 + Magenta Laser 品红激光 + Amber Tube 琥珀灯管 + Electric Lime 电光青柠 + Pulse Violet 脉冲紫 + Cobalt Phosphor 钴蓝荧光 Burst 爆发 Rounded Square 圆角正方形 Sun 太阳 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 05c7a69919..52e6fd7579 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -6828,6 +6828,12 @@ axis Y Axis Y 軸 Overlay Glaze 覆蓋釉 Screen Light 濾色光 Soft Light Wash 柔光暈染 + Cyan Neon 青色霓虹 + Magenta Laser 洋紅雷射 + Amber Tube 琥珀燈管 + Electric Lime 電光萊姆 + Pulse Violet 脈衝紫 + Cobalt Phosphor 鈷藍螢光 Burst 爆發 Rounded Square 圓角正方形 Sun 太陽 From 5ddac17b9ccc7a91dabc0f34bd268466686e1094 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 16:32:09 +0000 Subject: [PATCH 026/158] Use shared cluster font fallback --- Cargo.lock | 2 +- crates/text/Cargo.toml | 2 +- crates/text/src/shape.rs | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 866127f755..8fada38330 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,7 +1008,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=6d620e971e820b517b11a9 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=11f54a35ff8a62f06b752c752c7ab5c991f4de7a#11f54a35ff8a62f06b752c752c7ab5c991f4de7a" +source = "git+https://github.com/storytold/craft-libs?rev=1a2b3b327f033f83a59363b5e7d236bc6f0fe122#1a2b3b327f033f83a59363b5e7d236bc6f0fe122" dependencies = [ "harfrust 0.13.3", "kurbo 0.13.1", diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index 6b21ed675f..d0157546eb 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] # Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "11f54a35ff8a62f06b752c752c7ab5c991f4de7a", default-features = false } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "1a2b3b327f033f83a59363b5e7d236bc6f0fe122", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/shape.rs b/crates/text/src/shape.rs index 7c6a2d720f..3740b0c4e1 100644 --- a/crates/text/src/shape.rs +++ b/crates/text/src/shape.rs @@ -1221,10 +1221,7 @@ fn shapes_alike(a: &CharStyle, b: &CharStyle) -> bool { /// `digits`: not what the layout handles itself (tab, line and paragraph breaks), joiners or /// variation selectors. fn drawn_chars(cluster: &str, digits: Digits) -> impl Iterator + '_ { - cluster - .chars() - .map(move |c| digits.map(c)) - .filter(|&c| !(c.is_control() || matches!(c, '\u{200C}' | '\u{200D}' | '\u{2028}' | '\u{FE00}'..='\u{FE0F}' | '\u{E0100}'..='\u{E01EF}'))) + craft_font_catalog::drawable_characters(cluster, move |c| digits.map(c)) } /// Does the face with charmap `map` have a glyph for `c` (any face does when it has no charmap)? @@ -1236,11 +1233,14 @@ fn in_face(map: Option<&Charmap<'_>>, c: char) -> bool { /// first fallback face with all of them, so that a letter's marks are shaped with it and attach to /// it (#4491); when there is none, the face its first character takes on its own. fn fallback_face(db: &FontDb, primary: &Arc, pmap: Option<&Charmap<'_>>, cluster: &str, digits: Digits) -> Arc { - let fallback = |c| db.fallback_for_style(c, primary.id(), primary.weight, primary.italic); - drawn_chars(cluster, digits) - .find_map(|c| fallback(c).filter(|f| drawn_chars(cluster, digits).all(|c| f.covers(c)))) - .or_else(|| drawn_chars(cluster, digits).next().filter(|&c| !in_face(pmap, c)).and_then(fallback)) - .unwrap_or_else(|| primary.clone()) + craft_font_catalog::cluster_face( + cluster, + primary, + |c| digits.map(c), + |c| in_face(pmap, c), + |c| db.fallback_for_style(c, primary.id(), primary.weight, primary.italic), + |face, c| face.covers(c), + ) } /// The script `c` is shaped in: Japanese and Chinese text mixes Han, Hiragana, Katakana and From 0f5a12b58d3f7ad4e8a8882775101375a58e181a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 08:38:52 -0800 Subject: [PATCH 027/158] Pathfinder: Make Compound Shape warns when a line adds no area MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A compound shape closes the open paths in it, so a straight line encloses no area and contributes no area to the shape. Make Compound Shape (and Alt-clicking a Shape Mode) still makes the shape as before, and now returns a warning, shown in the status bar, when a member is or holds an open path that encloses no area once closed, a line inside a group or a compound path included. The warning names Object › Path › Outline Stroke. A self-crossing open path is measured by its fill rule, so a bow tie whose signed area is zero gives no warning. The warning has a row in each complete-message catalog. Reported in #7849. --- crates/engine/src/cmd.rs | 3 + crates/engine/src/cmd/compoundshape.rs | 37 ++++++++- crates/engine/src/tests/compound_shape.rs | 91 +++++++++++++++++++++++ crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tests.rs | 11 +++ crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + docs/mcp.md | 4 +- 29 files changed, 167 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index c6aed0a644..98d3ed9b20 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -861,6 +861,9 @@ pub use xform::{AppearanceAttrs, EyedropperAttrs, EyedropperOptions, FillAttrs, /// The shape modes of the selected compound-shape members (the Pathfinder panel lights theirs). pub use compoundshape::selected_member_modes; +/// Make Compound Shape's warning when a member is an open path that encloses no area. +pub use compoundshape::OPEN_PATHS_ADD_NO_AREA; + /// Pathfinder Options (`Prefs::pathfinder`). pub use pathops::{PATHFINDER_PRECISION_RANGE, PathfinderOptions}; diff --git a/crates/engine/src/cmd/compoundshape.rs b/crates/engine/src/cmd/compoundshape.rs index bc93b399a5..74257b528f 100644 --- a/crates/engine/src/cmd/compoundshape.rs +++ b/crates/engine/src/cmd/compoundshape.rs @@ -8,6 +8,8 @@ use std::sync::Arc; use serde_json::{Value, json}; use vectorcraft_doc::{Document, Node, NodeId, NodeKind, ShapeMode}; +use vectorcraft_geom::{FillRule, PathData}; +use vectorcraft_pathops as po; use vectorcraft_render::effects; use super::edit::{roots_of, selected_roots}; @@ -16,6 +18,10 @@ use super::{CommandSpec, EngineError, Result, Session, bad, cmd, has_multi}; const MODE_NAMES: [&str; 4] = ["add", "subtract", "intersect", "exclude"]; +/// Make Compound Shape's warning, which the status bar shows, when a member holds a line or another +/// open path that encloses no area once closed, and so contributes no area to the shape. +pub const OPEN_PATHS_ADD_NO_AREA: &str = "a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first"; + pub fn specs() -> Vec { vec![ cmd!( @@ -23,7 +29,7 @@ pub fn specs() -> Vec { "Make Compound Shape", ["Window", "Pathfinder"], None, - "{ids?: [id…] (selected first; default: the selection), mode?: \"add\"|\"subtract\"|\"intersect\"|\"exclude\" (default add; Alt-clicking a Shape Mode button gives its mode)} the two or more selected objects (paths, compound paths, groups, compound shapes, type, blends, envelopes) become the members of one compound shape, each with the shape mode, in their stacking order where the frontmost was: it draws as the area they make from the backmost up (open paths closed; a blend as its steps, an envelope as its distorted art, an object with a warp or other geometry effect as it draws), painted with the appearance and transparency of the topmost member in Add, Intersect or Exclude mode (with every member in Subtract, the backmost), and the members stay editable (Direct Selection, Layers panel, isolation mode) → {id}", + "{ids?: [id…] (selected first; default: the selection), mode?: \"add\"|\"subtract\"|\"intersect\"|\"exclude\" (default add; Alt-clicking a Shape Mode button gives its mode)} the two or more selected objects (paths, compound paths, groups, compound shapes, type, blends, envelopes) become the members of one compound shape, each with the shape mode, in their stacking order where the frontmost was: it draws as the area they make from the backmost up (open paths closed; a blend as its steps, an envelope as its distorted art, an object with a warp or other geometry effect as it draws), painted with the appearance and transparency of the topmost member in Add, Intersect or Exclude mode (with every member in Subtract, the backmost), and the members stay editable (Direct Selection, Layers panel, isolation mode) → {id, warning?: when a member is or holds a line or another open path that encloses no area once closed, and so contributes no area}", has_multi, make ), @@ -157,6 +163,7 @@ fn make(s: &mut Session, p: &Value) -> Result { // all have `mode`, the topmost, or the backmost when they all subtract. let order: Vec<&Node> = if mode == ShapeMode::Subtract { members } else { members.into_iter().rev().collect() }; let hook = |c: &Node| effects::outline_object(Some(d), c); + let no_area = order.iter().any(|n| adds_no_area(d, n, &hook)); let style = order.into_iter().find_map(|n| top_style(d, n, &hook)); let id = s.edit("Make Compound Shape", |d, sel| { let gid = d.alloc_id(); @@ -179,7 +186,33 @@ fn make(s: &mut Session, p: &Value) -> Result { sel.set([id]); Ok(id) })?; - Ok(json!({ "id": id.0 })) + let mut out = json!({ "id": id.0 }); + if no_area { + out["warning"] = json!(OPEN_PATHS_ADD_NO_AREA); + } + Ok(out) +} + +/// Member `n` holds an open path that adds no area to a compound shape: one of the paths it takes +/// part as ([`effects::member_leaves`]), inside a group or a compound path too, has an open subpath +/// that encloses no area once closed (a straight line, or an evenodd contour traced twice). The area +/// is the one the path's fill rule gives, which also keeps a self-crossing path whose signed area +/// is zero (a bow tie) from the warning, as Divide measures it. +fn adds_no_area(d: &Document, n: &Node, hook: effects::OutlineHook) -> bool { + effects::member_leaves(Some(d), n, Some(hook)).iter().any(|leaf| { + let (paths, rule): (Vec<&PathData>, FillRule) = match &leaf.kind { + NodeKind::Compound { children, rule } => (children.iter().filter_map(|c| c.path_data()).collect(), *rule), + NodeKind::Path { path, rule, .. } => (vec![path], *rule), + _ => return false, + }; + paths.iter().flat_map(|p| &p.subpaths).filter(|sp| !sp.closed).any(|sp| { + let mut closed = sp.clone(); + closed.closed = true; + // The signed-area test alone only holds for nonzero: evenodd can fill nothing where + // the signed area is not zero (a contour traced twice). + !(rule == FillRule::NonZero && po::encloses_area(sp)) && po::area(&PathData::single(closed), rule) <= 0.0 + }) + }) } /// The paint and transparency of the frontmost shape `n` adds to a compound shape's area, from the diff --git a/crates/engine/src/tests/compound_shape.rs b/crates/engine/src/tests/compound_shape.rs index 3f027254b0..8127ea5bcb 100644 --- a/crates/engine/src/tests/compound_shape.rs +++ b/crates/engine/src/tests/compound_shape.rs @@ -696,3 +696,94 @@ fn a_locked_or_hidden_layer_keeps_the_isolated_compound_shape_from_clicks() { assert!(selected(&s).is_empty(), "{prop}: nor by a marquee"); } } + +/// A straight line, closed as a compound shape closes open paths, encloses no area, so it +/// contributes no area to the shape: Make Compound Shape still makes it, in any mode and at any +/// place in the stack, and its reply carries a warning that names Outline Stroke. The shape draws +/// the area the other members make in that mode: the square alone in Add, or on top in Subtract, +/// and nothing in Intersect or when the line is the backmost member in Subtract. A line in a group, +/// beside a closed path too, and an open evenodd square traced twice are the same. An open path that encloses an area once closed (a bow tie +/// whose lobes cancel in signed area included) and closed shapes alone give no warning (#7849). +#[test] +fn lines_that_add_no_area_are_reported() { + use crate::cmd::OPEN_PATHS_ADD_NO_AREA; + fn line_of(s: &mut Session) -> NodeId { + NodeId(run(s, "shape.line", json!({"x1": 20, "y1": 50, "x2": 180, "y2": 50}))["id"].as_u64().unwrap()) + } + fn vee_of(s: &mut Session) -> NodeId { + let anchors = json!([{"x": 20, "y": 50}, {"x": 100, "y": 150}, {"x": 180, "y": 50}]); + NodeId(run(s, "path.create", json!({ "anchors": anchors }))["id"].as_u64().unwrap()) + } + fn bow_tie_of(s: &mut Session) -> NodeId { + let anchors = json!([{"x": 20, "y": 0}, {"x": 180, "y": 100}, {"x": 180, "y": 0}, {"x": 20, "y": 100}]); + NodeId(run(s, "path.create", json!({ "anchors": anchors }))["id"].as_u64().unwrap()) + } + fn twice_around_of(s: &mut Session) -> NodeId { + let d = "M20 20 L80 20 L80 80 L20 80 L20 20 L80 20 L80 80 L20 80"; + let id = NodeId(run(s, "path.create", json!({ "d": d }))["id"].as_u64().unwrap()); + run(s, "path.setFillRule", json!({"rule": "evenOdd"})); + id + } + fn group_of(s: &mut Session, ids: &[NodeId]) -> NodeId { + run(s, "select.set", json!({"ids": ids.iter().map(|i| i.0).collect::>()})); + NodeId(run(s, "object.group", json!({}))["id"].as_u64().unwrap()) + } + type Build = fn(&mut Session) -> NodeId; + // (case, mode, the other member, whether it goes behind the 100 pt square, warned, area drawn) + type Case = (&'static str, &'static str, Build, bool, bool, Option); + let cases: [Case; 11] = [ + ("an open evenodd square traced twice", "add", twice_around_of, false, true, Some(10_000.0)), + ("a line", "add", line_of, false, true, Some(10_000.0)), + ("a line, subtracting", "subtract", line_of, false, true, Some(10_000.0)), + ("a line, intersecting", "intersect", line_of, false, true, Some(0.0)), + ("a line behind, subtracting", "subtract", line_of, true, true, Some(0.0)), + ( + "a group of lines", + "add", + |s| { + let ids = [line_of(s), line_of(s)]; + group_of(s, &ids) + }, + false, + true, + Some(10_000.0), + ), + ( + "a group of a line and a square", + "add", + |s| { + let ids = [line_of(s), square(s, 200.0, "#00ff00")]; + group_of(s, &ids) + }, + false, + true, + Some(20_000.0), + ), + ("an open path that encloses an area", "add", vee_of, false, false, None), + ("an open bow tie, whose signed area is zero", "add", bow_tie_of, false, false, None), + ("a square", "add", |s| square(s, 50.0, "#0000ff"), false, false, Some(15_000.0)), + ("a square, subtracting", "subtract", |s| square(s, 50.0, "#0000ff"), false, false, Some(5_000.0)), + ]; + for (what, mode, build, behind, warned, want) in cases { + let mut s = Session::new(); + run(&mut s, "file.new", json!({"width": 400, "height": 300})); + let (back, front) = if behind { + let other = build(&mut s); + (other, square(&mut s, 0.0, "#ff0000")) + } else { + let sq = square(&mut s, 0.0, "#ff0000"); + (sq, build(&mut s)) + }; + run(&mut s, "select.set", json!({"ids": [back.0, front.0]})); + let r = run(&mut s, "object.compoundShape.make", json!({ "mode": mode })); + let id = NodeId(r["id"].as_u64().unwrap_or_else(|| panic!("{what}: {r}"))); + assert_eq!(node(&s, id).children().unwrap().len(), 2, "{what}: both are members"); + assert_eq!(r.get("warning").and_then(Value::as_str), warned.then_some(OPEN_PATHS_ADD_NO_AREA), "{what}: {r}"); + if let Some(want) = want { + let d = &s.doc().unwrap().doc; + let hook = |c: &Node| effects::outline_object(Some(d), c); + let got = effects::compound_shape_area(None, &node(&s, id), Some(&hook)).map_or(0.0, |p| area(&p)); + assert!((got - want).abs() < 0.5, "{what}: draws {got}, not {want}"); + } + } +} diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index f98daa7f92..123c568192 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7771,3 +7771,4 @@ breakText Glyphs Glifs @msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} píxels és massa gran per a Targa (com a màxim 65535 píxels per costat): reduïu la resolució @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} píxels és massa gran per a PSD (com a màxim {MAX_SIDE} píxels per costat): reduïu la resolució @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer ha de ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first una línia o un altre traçat obert que no tanca cap àrea no aporta cap àrea a la forma composta; per incloure’l, apliqueu-hi primer Objecte › Traçat › Contorneja el traç diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index b174608032..00bdc239f9 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -9198,6 +9198,7 @@ breakText Glyphs Glyfy @msg the character's size can't be measured velikost znaku nelze změřit @msg the code runs past its last instruction kód běží za svou poslední instrukci @msg the compound shape is too complex to expand složený tvar je příliš složitý na rozložení +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first čára nebo jiná otevřená cesta, která neohraničuje žádnou plochu, nepřidá složenému tvaru žádnou plochu; chcete-li ji zahrnout, použijte na ni nejprve Objekt › Cesta › Převést tah na obrys @msg the container of the listed objects is gone kontejner uvedených objektů už neexistuje @msg the copy `{user_id}` can't be read as a library kopii `{user_id}` nelze přečíst jako knihovnu @msg the copy would leave the canvas kopie by opustila plátno diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 0ae36e3699..447632af9e 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -7681,3 +7681,4 @@ breakText Glyphs Glyffer Nest Shapes Pak figurer tæt Roll Rulle @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer skal være "singleLine", "everyLine", "standardSingleLine" eller "standardEveryLine" +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first en linje eller anden åben kurve, der ikke omslutter noget område, tilføjer intet område til den sammensatte figur; anvend først Objekt › Kurve › Streg til kontur på den for at tage den med diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 99e487ecb1..f27e8ad350 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -8741,6 +8741,7 @@ breakText Glyphs Glyphen @msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size die Zeichenflächen passen nicht auf die Arbeitsfläche: weniger Zeichenflächen, weniger Abstand oder eine kleinere Größe @msg the character's size can't be measured die Größe des Zeichens kann nicht gemessen werden @msg the compound shape is too complex to expand die zusammengesetzte Form ist zu komplex zum Umwandeln +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first eine Linie oder ein anderer offener Pfad, der keine Fläche umschließt, trägt keine Fläche zur zusammengesetzten Form bei; um ihn einzubeziehen, wenden Sie zuerst Objekt › Pfad › Konturlinie darauf an @msg the container of the listed objects is gone der Container der aufgelisteten Objekte ist nicht mehr vorhanden @msg the copy `{user_id}` can't be read as a library die Kopie `{user_id}` kann nicht als Bibliothek gelesen werden @msg the copy would leave the canvas die Kopie würde die Arbeitsfläche verlassen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 7fe692d27e..5c3596686f 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7745,3 +7745,4 @@ breakText Glyphs Γλύφοι @msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution τα {width} × {height} εικονοστοιχεία είναι υπερβολικό μέγεθος για Targa (το πολύ 65535 εικονοστοιχεία ανά πλευρά): μειώστε την ανάλυση @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution τα {w} × {h} εικονοστοιχεία είναι υπερβολικό μέγεθος για PSD (το πολύ {MAX_SIDE} εικονοστοιχεία ανά πλευρά): μειώστε την ανάλυση @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" το composer πρέπει να είναι "singleLine", "everyLine", "standardSingleLine" ή "standardEveryLine" +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first μια γραμμή ή άλλη ανοιχτή διαδρομή που δεν περικλείει εμβαδόν δεν προσθέτει εμβαδόν στο σύνθετο σχήμα· για να τη συμπεριλάβετε, εφαρμόστε της πρώτα Αντικείμενο › Διαδρομή › Μετατροπή περιγράμματος σε διαδρομή diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index f0a5d12844..d3416d928f 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7732,3 +7732,4 @@ breakText Glyphs Glifos Nest Shapes Anidar formas Roll Rollo @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer debe ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first una línea u otro trazado abierto que no encierra ningún área no aporta ningún área a la forma compuesta; para incluirlo, aplícale primero Objeto › Trazado › Contornear trazo diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 718b99ea1b..be6b4be6c1 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7828,3 +7828,4 @@ breakText Glyphs Merkit @msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} pikseliä on liian suuri Targa-kuvalle (enintään 65535 pikseliä sivua kohti): pienennä tarkkuutta @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pikseliä on liian suuri PSD-kuvalle (enintään {MAX_SIDE} pikseliä sivua kohti): pienennä tarkkuutta @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer on oltava "singleLine", "everyLine", "standardSingleLine" tai "standardEveryLine" +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first viiva tai muu avoin polku, joka ei rajaa aluetta, ei lisää yhdistelmämuotoon aluetta; jos haluat sisällyttää sen, käytä siihen ensin komentoa Objekti › Polku › Ääriviivaa viiva diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 6b946a7f1e..4e3fedef24 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -9059,6 +9059,7 @@ breakText Glyphs Glyphes @msg the character's size can't be measured la taille du caractère ne peut pas être mesurée @msg the code runs past its last instruction le code s’exécute au-delà de sa dernière instruction @msg the compound shape is too complex to expand la forme composée est trop complexe pour être décomposée +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first une ligne ou un autre tracé ouvert qui n’entoure aucune surface n’ajoute aucune surface à la forme composée ; pour l’inclure, appliquez-lui d’abord Objet › Tracé › Vectoriser le contour @msg the container of the listed objects is gone le conteneur des objets listés a disparu @msg the copy `{user_id}` can't be read as a library la copie `{user_id}` ne peut pas être lue comme une bibliothèque @msg the copy would leave the canvas la copie sortirait de la zone de travail diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 2bb71a0b45..4263661e34 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -8229,6 +8229,7 @@ antiAlias Sharp शार्प @msg the CMYK image couldn't be written CMYK इमेज को नहीं लिखा जा सकता @msg the Color Picker is not open रंग पिकर खुला नहीं है @msg the compound shape is too complex to expand मिश्रित आकार का विस्तार करने के लिए बहुत जटिल है +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first कोई रेखा या अन्य खुला पाथ जो कोई क्षेत्र नहीं घेरता, मिश्रित आकार में कोई क्षेत्र नहीं जोड़ता; इसे शामिल करने के लिए पहले उस पर ऑब्जेक्ट › पाथ › स्ट्रोक को आउटलाइन में बदलें लागू करें @msg the compressed file unpacks to more than {_1} MB संकुचित फ़ाइल {_1} MB से अधिक के लिए अनपैक @msg the compressed file unpacks to more than VectorCraft reads ({_1} MB of document, {_2} MB per image) संपीड़ित फ़ाइल खुलकर उससे बड़ी हो जाती है जितना VectorCraft पढ़ता है (डॉक्यूमेंट के {_1} MB, हर इमेज के {_2} MB) @msg the container of the listed objects is gone सूचीबद्ध ऑब्जेक्ट्स का कंटेनर चला गया है diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 253e8f6764..ce74a3a071 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -9069,6 +9069,7 @@ breakText Glyphs Glifák @msg the character's size can't be measured a karakter mérete nem mérhető meg @msg the code runs past its last instruction a kód túlfut az utolsó utasításán @msg the compound shape is too complex to expand az összetett alakzat túl bonyolult a kibontáshoz +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first egy vonal vagy más nyitott útvonal, amely nem zár közre területet, nem ad területet az összetett alakzathoz; a felvételéhez előbb alkalmazza rá az Objektum › Útvonal › Körvonal útvonallá alakítása parancsot @msg the container of the listed objects is gone a felsorolt objektumok tárolója már nincs meg @msg the copy `{user_id}` can't be read as a library a másolat nem olvasható be könyvtárként: `{user_id}` @msg the copy would leave the canvas a másolat kikerülne a vászonról diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index b0ef62f97a..4d3ba9de5d 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -8791,6 +8791,7 @@ breakText Glyphs Glifi @msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size le tavole da disegno non entrano nell'area di lavoro: usa meno tavole da disegno, una spaziatura minore o una dimensione più piccola @msg the character's size can't be measured impossibile misurare la dimensione del carattere @msg the compound shape is too complex to expand la forma composta è troppo complessa da espandere +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first una linea o un altro tracciato aperto che non racchiude alcuna area non aggiunge alcuna area alla forma composta; per includerlo, applica prima Oggetto › Tracciato › Contorna traccia @msg the container of the listed objects is gone il contenitore degli oggetti elencati non esiste più @msg the copy `{user_id}` can't be read as a library la copia `{user_id}` non può essere letta come libreria @msg the copy would leave the canvas la copia uscirebbe dall'area di lavoro diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index ed4981b977..5d2a4487e4 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -7992,6 +7992,7 @@ axis Y Axis Y 軸 @msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size アートボードがキャンバスに収まりません: アートボードの数を減らすか、間隔またはサイズを小さくしてください @msg the character's size can't be measured 文字のサイズを計測できません @msg the compound shape is too complex to expand 複合シェイプが複雑すぎて拡張できません +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first 領域を囲まない直線などのオープンパスは、複合シェイプに領域を加えません。含めるには、先にそのパスに「オブジェクト › パス › パスのアウトライン」を適用してください @msg the container of the listed objects is gone 指定したオブジェクトを含むコンテナがなくなりました @msg the copy `{user_id}` can't be read as a library コピー `{user_id}` をライブラリとして読み込めません @msg the copy would leave the canvas コピーがキャンバスからはみ出します diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 358960bd37..b218a84b52 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -1553,6 +1553,7 @@ @msg the color book is cut short ფერთა წიგნი შეკვეცილია @msg the color book's names take more than {_1} MB ფერთა წიგნის სახელები {_1} MB-ზე მეტს იკავებს @msg the compound shape is too complex to expand შედგენილი ფიგურა ზედმეტად რთულია გასაშლელად +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first ხაზი ან სხვა ღია ტრაექტორია, რომელიც ფართობს არ შემოსაზღვრავს, შედგენილ ფიგურას ფართობს არ უმატებს; მის ჩასართავად ჯერ გამოიყენეთ ობიექტი › ტრაექტორია › კონტურის ფიგურად გარდაქმნა @msg the container of the listed objects is gone ჩამოთვლილი ობიექტების კონტეინერი აღარ არსებობს @msg the copy `{user_id}` can't be read as a library ასლის `{user_id}` ბიბლიოთეკად წაკითხვა შეუძლებელია @msg the copy would leave the canvas ასლი ტილოს გარეთ გავიდოდა diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index cd7130d7ef..36f5ee2fac 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -8796,6 +8796,7 @@ breakText Glyphs 글리프 @msg the character's size can't be measured 글자의 크기를 잴 수 없습니다 @msg the code runs past its last instruction 코드가 마지막 명령을 지나 실행됩니다 @msg the compound shape is too complex to expand 컴파운드 모양이 너무 복잡해서 확장할 수 없습니다 +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first 영역을 둘러싸지 않는 선이나 기타 열린 패스는 컴파운드 모양에 영역을 더하지 않습니다. 포함하려면 먼저 개체 › 패스 › 선 윤곽선화를 적용하세요 @msg the container of the listed objects is gone 나열한 개체의 컨테이너가 없어졌습니다 @msg the copy `{user_id}` can't be read as a library 복사본 `{user_id}`을(를) 라이브러리로 읽을 수 없습니다 @msg the copy would leave the canvas 복사본이 캔버스를 벗어납니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 101d37b1e6..1be0b7a1e0 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -7119,6 +7119,7 @@ imageTrace Outline Contour @msg the character's size can't be measured de grootte van het teken kan niet worden gemeten @msg the code runs past its last instruction de code loopt voorbij de laatste instructie @msg the compound shape is too complex to expand de samengestelde vorm is te complex om uit te breiden +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first een lijn of ander open pad dat geen oppervlak omsluit, voegt geen oppervlak toe aan de samengestelde vorm; pas er eerst Object › Pad › Contour omzetten op toe om het op te nemen @msg the container of the listed objects is gone de container van de vermelde objecten is verdwenen @msg the copy `{user_id}` can't be read as a library de kopie `{user_id}` kan niet als bibliotheek worden gelezen @msg the copy would leave the canvas de kopie zou buiten het canvas vallen diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index f5db22b1be..3531ca7f7f 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -9031,6 +9031,7 @@ breakText Glyphs Glify @msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size obszary kompozycji nie mieszczą się na płótnie: użyj mniejszej liczby obszarów, mniejszych odstępów lub mniejszego rozmiaru @msg the character's size can't be measured nie można zmierzyć rozmiaru znaku @msg the compound shape is too complex to expand kształt złożony jest zbyt skomplikowany, aby go rozszerzyć +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first linia lub inna otwarta ścieżka, która nie obejmuje żadnego obszaru, nie dodaje obszaru do kształtu złożonego; aby ją uwzględnić, najpierw zastosuj do niej Obiekt › Ścieżka › Obrys konturu @msg the container of the listed objects is gone kontener wymienionych obiektów już nie istnieje @msg the copy `{user_id}` can't be read as a library kopii `{user_id}` nie można odczytać jako biblioteki @msg the copy would leave the canvas kopia wykroczyłaby poza płótno diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index a2b5cd06ba..9e9a3565c4 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -9259,6 +9259,7 @@ swatch Yellow Green Verde-amarelado @msg the character's size can't be measured não é possível medir o tamanho do caractere @msg the code runs past its last instruction o código passa da última instrução @msg the compound shape is too complex to expand a forma composta é complexa demais para expandir +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first uma linha ou outro caminho aberto que não envolve nenhuma área não acrescenta nenhuma área à forma composta; para incluí-lo, aplique primeiro Objeto › Caminho › Contornar Traçado a ele @msg the container of the listed objects is gone o contêiner dos objetos listados não existe mais @msg the copy `{user_id}` can't be read as a library a cópia `{user_id}` não pode ser lida como uma biblioteca @msg the copy would leave the canvas a cópia sairia da tela diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index e5113d70ba..c69c294274 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -9179,6 +9179,7 @@ shape Open Открытый @msg the character's size can't be measured размер символа невозможно измерить @msg the code runs past its last instruction код выполняется дальше своей последней инструкции @msg the compound shape is too complex to expand составная фигура слишком сложна, чтобы её разобрать +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first линия или другой открытый контур, не охватывающий площади, не добавляет площади к составной фигуре; чтобы включить его, сначала примените к нему Объект › Контур › Обвести обводку @msg the container of the listed objects is gone контейнер перечисленных объектов больше не существует @msg the copy `{user_id}` can't be read as a library копию `{user_id}` невозможно прочитать как библиотеку @msg the copy would leave the canvas копия вышла бы за пределы холста diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index e344e63b8f..1eb63b7f21 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -8725,6 +8725,7 @@ digits Hindi Hindi @msg the character's size can't be measured tecknets storlek kan inte mätas @msg the CMYK image couldn't be written CMYK-bilden kunde inte skrivas @msg the compound shape is too complex to expand den sammansatta formen är för komplex för att expanderas +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first en linje eller annan öppen bana som inte omsluter någon yta lägger inte till någon yta i den sammansatta formen; för att ta med den, använd först Objekt › Bana › Konvertera kontur till form på den @msg the container of the listed objects is gone behållaren för de listade objekten finns inte längre @msg the copy `{user_id}` can't be read as a library kopian `{user_id}` kan inte läsas som ett bibliotek @msg the copy would leave the canvas kopian skulle hamna utanför arbetsytan diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index b632e5cac3..2f89cb8894 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -451,6 +451,17 @@ fn objects_on_path_detach_strings_are_in_complete_catalogs() { } } +/// Make Compound Shape's warning for a member that adds no area, which the status bar shows and +/// the message scan doesn't read, is translated in each language of [`COMPLETE_MESSAGES`]. +#[test] +fn compound_shape_no_area_warning_is_translated() { + let warning = vectorcraft_engine::cmd::OPEN_PATHS_ADD_NO_AREA; + for code in COMPLETE_MESSAGES { + let lang = Lang::from_code(code).expect("registered"); + assert_ne!(message(lang, warning), warning, "{code}"); + } +} + /// The Window › Brush Libraries menu, built from the built-in library table, names each library. #[test] fn built_in_brush_library_names_are_in_complete_catalogs() { diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index c999e476e1..cad99b3afd 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -8371,6 +8371,7 @@ axis Y Axis Y ekseni @msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size çalışma yüzeyleri tuvale sığmıyor: daha az çalışma yüzeyi, daha az aralık veya daha küçük bir boyut kullanın @msg the character's size can't be measured karakterin boyutu ölçülemiyor @msg the compound shape is too complex to expand bileşik şekil genişletilemeyecek kadar karmaşık +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first alan çevrelemeyen bir çizgi veya başka bir açık yol bileşik şekle hiçbir alan eklemez; dahil etmek için önce ona Nesne › Yol › Anahat Konturu uygulayın @msg the container of the listed objects is gone listelenen nesnelerin kapsayıcısı artık yok @msg the copy `{user_id}` can't be read as a library `{user_id}` kopyası bir kütüphane olarak okunamıyor @msg the copy would leave the canvas kopya tuvalin dışına çıkardı diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index f4aed127a4..c7fcbad04b 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -8793,6 +8793,7 @@ breakText Glyphs Гліфи @msg the character's size can't be measured розмір символу не можна виміряти @msg the code runs past its last instruction код виконується далі своєї останньої інструкції @msg the compound shape is too complex to expand складена фігура занадто складна для розбирання +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first лінія чи інший відкритий контур, що не охоплює площі, не додає площі до складеної фігури; щоб включити його, спершу застосуйте до нього Об’єкт › Контур › Обвести обведення @msg the container of the listed objects is gone контейнера перелічених об’єктів більше немає @msg the copy `{user_id}` can't be read as a library копію `{user_id}` не вдалося прочитати як бібліотеку @msg the copy would leave the canvas копія вийшла б за межі полотна diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 5a901079b3..cd59268ed1 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7402,3 +7402,4 @@ breakText Glyphs Glyph @msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} điểm ảnh quá lớn cho Targa (tối đa 65535 điểm ảnh mỗi cạnh): hãy giảm độ phân giải @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} điểm ảnh quá lớn cho PSD (tối đa {MAX_SIDE} điểm ảnh mỗi cạnh): hãy giảm độ phân giải @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer phải là "singleLine", "everyLine", "standardSingleLine" hoặc "standardEveryLine" +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first một đường thẳng hoặc đường dẫn mở khác không bao quanh vùng nào sẽ không thêm vùng nào vào hình phức hợp; để đưa nó vào, trước tiên hãy áp dụng Đối tượng › Đường dẫn › Đường bao nét cho nó diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 8d4c110afd..887664579b 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -9017,6 +9017,7 @@ breakText Glyphs 字形 @msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size 画板在画布上放不下:请减少画板、缩小间距或减小尺寸 @msg the character's size can't be measured 无法测量该字符的大小 @msg the compound shape is too complex to expand 复合形状过于复杂,无法扩展 +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first 直线或其他不围成区域的开放路径不会为复合形状增加任何区域;要包含它,请先对其应用“对象 › 路径 › 轮廓化描边” @msg the container of the listed objects is gone 所列对象的容器已不存在 @msg the copy `{user_id}` can't be read as a library 副本 `{user_id}` 无法作为库读取 @msg the copy would leave the canvas 副本会超出画布 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 30da93ab71..5ebec809e5 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -8945,6 +8945,7 @@ breakText Glyphs 字符 @msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size 工作區域無法容納於畫布:請減少工作區域、縮小間距或縮小尺寸 @msg the character's size can't be measured 無法測量字元的大小 @msg the compound shape is too complex to expand 複合形狀過於複雜,無法展開 +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first 直線或其他不圍成區域的開放路徑不會為複合形狀增加任何區域;若要納入,請先對其套用「物件 › 路徑 › 外框筆畫」 @msg the container of the listed objects is gone 所列物件的容器已不存在 @msg the copy `{user_id}` can't be read as a library 複本 `{user_id}` 無法讀取為資料庫 @msg the copy would leave the canvas 複本會超出畫布 diff --git a/docs/mcp.md b/docs/mcp.md index c38d6fc7a2..f4fc94e310 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5076,7 +5076,9 @@ envelopes) the members of one live compound shape, each in shape mode `mode` (`" as its steps, an envelope as its distorted art, an object with a warp or another geometry effect as it draws, each updated when the member is edited), painted with its own appearance, which it takes from the topmost member not in Subtract (with every member subtracting, the backmost); a -fill or stroke given to it or to a member paints the compound shape. The members stay editable (Direct Selection, +fill or stroke given to it or to a member paints the compound shape. Open paths are closed, so a straight line encloses +no area and contributes no area to the shape. When a member is or holds such a path, the reply's `warning` says so +and names Object › Path › Outline Stroke. The members stay editable (Direct Selection, the Layers panel, isolation mode). `object.compoundShape.setMode {mode, ids?}` sets the mode of the members the selection is or is in, `object.compoundShape.release` gives the members back as they were, and `object.compoundShape.expand` turns each compound shape into the path, or compound path, of its area. A saved file From b4fdbdd1acbbd8d5e58819990ef12076063618f9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 16:39:40 +0000 Subject: [PATCH 028/158] Stream shared outlines into the existing bounded pen --- Cargo.lock | 2 +- crates/text/Cargo.toml | 2 +- crates/text/src/fontdb/glyph_pen.rs | 19 ++++++++++ crates/text/src/fontdb/lookup.rs | 56 +++++++++++++++++++++++------ 4 files changed, 66 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9ed1d024c..03843d9578 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,7 +1008,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=6d620e971e820b517b11a9 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=58e2a887e6fe346deff2708513b0c1cd7c2af8c3#58e2a887e6fe346deff2708513b0c1cd7c2af8c3" +source = "git+https://github.com/storytold/craft-libs?rev=4d51586a45321b101f608276ce7ccbcec3f1fab3#4d51586a45321b101f608276ce7ccbcec3f1fab3" dependencies = [ "kurbo 0.13.1", "skrifa 0.47.0", diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index 0f311b964b..6a6ed42b51 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] # Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "58e2a887e6fe346deff2708513b0c1cd7c2af8c3", default-features = false } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "4d51586a45321b101f608276ce7ccbcec3f1fab3", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/fontdb/glyph_pen.rs b/crates/text/src/fontdb/glyph_pen.rs index fdbb27e3a7..5387ff4b55 100644 --- a/crates/text/src/fontdb/glyph_pen.rs +++ b/crates/text/src/fontdb/glyph_pen.rs @@ -53,6 +53,25 @@ impl OutlinePen for FlipPen { } } +// Share font decoding while preserving the app's existing y-down geometry and resource budget. +impl craft_font_catalog::GlyphPen for FlipPen { + fn move_to(&mut self, x: f32, y: f32) { + OutlinePen::move_to(self, x, y); + } + fn line_to(&mut self, x: f32, y: f32) { + OutlinePen::line_to(self, x, y); + } + fn quad_to(&mut self, x1: f32, y1: f32, x: f32, y: f32) { + OutlinePen::quad_to(self, x1, y1, x, y); + } + fn curve_to(&mut self, x1: f32, y1: f32, x2: f32, y2: f32, x: f32, y: f32) { + OutlinePen::curve_to(self, x1, y1, x2, y2, x, y); + } + fn close(&mut self) { + OutlinePen::close(self); + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index 8ff792751b..27385253a6 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -3,7 +3,7 @@ use super::PathBuf; use super::build::{instanced, style_distance, style_italic, style_weight}; use super::cache::Catalog; use super::face::{FALLBACK_FAMILY, FontFace, MAX_LIVE_INSTANCES, Variation, VariationAxis}; -use super::glyph_pen::svg_drawn; +use super::glyph_pen::{FlipPen, svg_drawn}; #[cfg(not(target_arch = "wasm32"))] use super::names::SYSTEM_FALLBACKS; use super::names::{norm, norm_chars, script_families}; @@ -563,13 +563,12 @@ impl FontDb { if let Some(p) = self.outlines.lock().unwrap_or_else(|e| e.into_inner()).get(&key) { return p.clone(); } - let path = craft_font_catalog::FontOutline::from_bytes(face.data(), face.index(), face.variations()) - .and_then(|font| font.outline_recovering(gid)) - // The old pen kept a partial path when drawing failed. Keep that behavior while - // the shared implementation bounds the number of elements from untrusted fonts. - .map(|(path, _status)| kurbo::Affine::scale_non_uniform(1.0, -1.0) * path) - .unwrap_or_default(); - let p = Arc::new(path); + let mut pen = FlipPen(BezPath::new()); + if let Ok(font) = craft_font_catalog::FontOutline::from_bytes(face.data(), face.index(), face.variations()) { + // As before, keep the prefix emitted before a malformed glyph reports an error. + let _ = font.draw_to(gid, &mut pen); + } + let p = Arc::new(pen.0); let mut cache = self.outlines.lock().unwrap_or_else(|e| e.into_inner()); if cache.len() >= OUTLINE_CACHE_MAX { cache.clear(); @@ -686,8 +685,43 @@ mod shared_outline_tests { assert!(result.is_err()); assert!(!old.0.elements().is_empty()); let shared = craft_font_catalog::FontOutline::from_bytes(&bytes, 0, &[]).unwrap(); - let (path, status) = shared.outline_recovering(gid).unwrap(); - assert!(status.is_err()); - assert_eq!(kurbo::Affine::scale_non_uniform(1.0, -1.0) * path, old.0); + let mut streamed = FlipPen(BezPath::new()); + assert!(shared.draw_to(gid, &mut streamed).is_err()); + assert_eq!(streamed.0, old.0); + } + + #[test] + fn large_valid_outline_matches_original_pen() { + let Ok(dir) = std::env::var("CRAFT_FONTS_DIR") else { return }; + let source = std::fs::read(std::path::Path::new(&dir).join("fonts/noto-sans-cjk-sc/NotoSansCJKsc-Regular.otf")).unwrap(); + let source = skrifa::FontRef::new(&source).unwrap(); + let mut program = vec![139, 139, 21]; + for _ in 0..100_001 { + program.extend_from_slice(&[140, 6]); + } + program.push(14); + let mut cff = vec![1, 0, 4, 4, 0, 1, 1, 1, 2, b'X', 0, 1, 1, 1, 7, 29, 0, 0, 0, 25, 17, 0, 0, 0, 0]; + cff.extend_from_slice(&[0, 1, 4]); + cff.extend_from_slice(&1u32.to_be_bytes()); + cff.extend_from_slice(&((program.len() as u32) + 1).to_be_bytes()); + cff.extend_from_slice(&program); + let mut builder = write_fonts::FontBuilder::new(); + for tag in [b"head", b"maxp", b"hhea", b"hmtx"] { + builder.add_raw(write_fonts::types::Tag::new(tag), source.table_data(skrifa::Tag::new(tag)).unwrap().as_bytes().to_vec()); + } + builder.add_raw(write_fonts::types::Tag::new(b"CFF "), cff); + let bytes = builder.build(); + let f = skrifa::FontRef::new(&bytes).unwrap(); + let mut old = FlipPen(BezPath::new()); + f.outline_glyphs() + .get(GlyphId::new(0)) + .unwrap() + .draw(DrawSettings::unhinted(Size::unscaled(), skrifa::instance::LocationRef::default()), &mut old) + .unwrap(); + assert!(old.0.elements().len() > 100_000); + let shared = craft_font_catalog::FontOutline::from_bytes(&bytes, 0, &[]).unwrap(); + let mut streamed = FlipPen(BezPath::new()); + shared.draw_to(0, &mut streamed).unwrap(); + assert_eq!(streamed.0, old.0); } } From 729ed8958d062169d311908b25b31d7a64aec691 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 16:43:08 +0000 Subject: [PATCH 029/158] Use shared shaping segment boundaries --- Cargo.lock | 2 +- crates/text/Cargo.toml | 2 +- crates/text/src/shape.rs | 10 +++------- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5529c359a1..ca805670fb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,7 +1008,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=6d620e971e820b517b11a9 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=8bf20b4ba2311c1a69310fc8cba7155cf43cd42e#8bf20b4ba2311c1a69310fc8cba7155cf43cd42e" +source = "git+https://github.com/storytold/craft-libs?rev=d0a9c79933a54883cd5bc3dfe839f1dd699f2c69#d0a9c79933a54883cd5bc3dfe839f1dd699f2c69" dependencies = [ "harfrust 0.13.3", "kurbo 0.13.1", diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index 932ca596a1..7feac2bc60 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] # Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "8bf20b4ba2311c1a69310fc8cba7155cf43cd42e", default-features = false } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "d0a9c79933a54883cd5bc3dfe839f1dd699f2c69", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/shape.rs b/crates/text/src/shape.rs index 3740b0c4e1..1dbb6a2ace 100644 --- a/crates/text/src/shape.rs +++ b/crates/text/src/shape.rs @@ -600,7 +600,7 @@ pub(crate) fn shape_runs( // Split into segments by font coverage (and case, for Small Caps). let mut seg = Segment { range: a..a, runs, source_runs, st, face: primary.clone(), small: false, level: level_at(a) }; let mut cache: std::collections::HashMap<&str, Arc> = std::collections::HashMap::new(); - let mut script = Script::Common; + let mut boundary = craft_font_catalog::SegmentBoundary::new(primary.id(), level_at(a)); // A grapheme cluster (a letter and its marks, an emoji sequence) is set in one face. for (i, cluster) in text[a..b].grapheme_indices(true) { let i = a + i; @@ -620,20 +620,16 @@ pub(crate) fn shape_runs( }; let small = small_caps && c.is_lowercase(); let next_script = shaping_script(c); - let strong_script = !matches!(next_script, Script::Common | Script::Inherited); - let script_change = strong_script && script != Script::Common && script != next_script; + let strong_script = (!matches!(next_script, Script::Common | Script::Inherited)).then_some(next_script); // Combining marks, zero width joiners and non-joiners, and variation selectors stay // with the character before them. - if (face.id() != seg.face.id() || small != seg.small || level != seg.level || script_change) && !is_mark(c) { + if boundary.advance(face.id(), level, small, strong_script, is_mark(c)) { if i > seg.range.start { seg.range.end = i; shape_segment(text, &range, &seg, feats, out); } seg = Segment { range: i..i, face, small, level, ..seg }; } - if strong_script { - script = next_script; - } } if b > seg.range.start { seg.range.end = b; From 300240446774590acf048639ebb2fe3820dfeac6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 17:19:37 +0000 Subject: [PATCH 030/158] Use shared visual cluster ordering --- Cargo.lock | 3 ++- crates/text/Cargo.toml | 2 +- crates/text/src/layout/bidi.rs | 35 +++++----------------------------- 3 files changed, 8 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ca805670fb..9441174671 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,12 +1008,13 @@ source = "git+https://github.com/storytold/craft-libs?rev=6d620e971e820b517b11a9 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d0a9c79933a54883cd5bc3dfe839f1dd699f2c69#d0a9c79933a54883cd5bc3dfe839f1dd699f2c69" +source = "git+https://github.com/storytold/craft-libs?rev=524aaa78b8a04c0497fd28b9f12438ca3711e648#524aaa78b8a04c0497fd28b9f12438ca3711e648" dependencies = [ "harfrust 0.13.3", "kurbo 0.13.1", "skrifa 0.47.0", "thiserror 2.0.21", + "unicode-bidi", "windows-registry", ] diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index 7feac2bc60..e308fad856 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] # Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "d0a9c79933a54883cd5bc3dfe839f1dd699f2c69", default-features = false } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "524aaa78b8a04c0497fd28b9f12438ca3711e648", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/layout/bidi.rs b/crates/text/src/layout/bidi.rs index 3f9872983d..e4574c42d4 100644 --- a/crates/text/src/layout/bidi.rs +++ b/crates/text/src/layout/bidi.rs @@ -81,34 +81,9 @@ pub(super) fn visual_order(bidi: Option<&BidiInfo<'_>>, paragraph_start: usize, return vec![]; } let levels = bidi.reordered_levels(para, line.start.saturating_sub(paragraph_start)..line.end.saturating_sub(paragraph_start)); - // A list marker (length 0) is a cluster of its own. - let mut clusters: Vec> = Vec::new(); - for (i, g) in glyphs.iter().enumerate() { - if i > 0 && glyphs.get(i - 1).is_some_and(|p| p.byte == g.byte && (p.len == 0) == (g.len == 0)) { - if let Some(c) = clusters.last_mut() { - c.end = i + 1; - } - } else { - clusters.push(i..i + 1); - } - } - // A list marker is at the paragraph's level, and at a right-to-left one its tab is drawn - // before (left of) its characters. - let cluster_levels: Vec<_> = clusters - .iter() - .filter_map(|c| glyphs.get(c.start)) - .map(|g| if g.len == 0 { g.level } else { levels.get(g.byte.saturating_sub(paragraph_start)).copied().unwrap_or(g.level) }) - .collect(); - let reversed = |i: usize| glyphs.get(clusters.get(i).map_or(0, |c| c.start)).is_some_and(|g| g.len == 0 && g.level.is_rtl()); - unicode_bidi::BidiInfo::reorder_visual(&cluster_levels) - .into_iter() - .filter_map(|i| clusters.get(i).map(|c| (c.clone(), reversed(i)))) - .flat_map(|(c, rev)| { - let mut v: Vec = c.collect(); - if rev { - v.reverse(); - } - v - }) - .collect() + craft_font_catalog::visual_order( + glyphs.iter().map(|g| craft_font_catalog::VisualGlyph { byte: g.byte, len: g.len, level: g.level }), + paragraph_start, + &levels, + ) } From 3d0b4c9a26f94a99828ee86dbc99358cc646af63 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 17:22:25 +0000 Subject: [PATCH 031/158] Use shared measured line break selection --- Cargo.lock | 2 +- crates/text/Cargo.toml | 2 +- crates/text/src/layout/breaking.rs | 20 ++------------------ 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9441174671..b08e7086aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,7 +1008,7 @@ source = "git+https://github.com/storytold/craft-libs?rev=6d620e971e820b517b11a9 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=524aaa78b8a04c0497fd28b9f12438ca3711e648#524aaa78b8a04c0497fd28b9f12438ca3711e648" +source = "git+https://github.com/storytold/craft-libs?rev=3d1b0b5edfb55c056a4de539751d647ae60a3dcf#3d1b0b5edfb55c056a4de539751d647ae60a3dcf" dependencies = [ "harfrust 0.13.3", "kurbo 0.13.1", diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index e308fad856..cba164b048 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] # Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "524aaa78b8a04c0497fd28b9f12438ca3711e648", default-features = false } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "3d1b0b5edfb55c056a4de539751d647ae60a3dcf", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/layout/breaking.rs b/crates/text/src/layout/breaking.rs index ef62fa2bcc..1cfeee724f 100644 --- a/crates/text/src/layout/breaking.rs +++ b/crates/text/src/layout/breaking.rs @@ -457,24 +457,8 @@ pub(super) fn break_line( line_end: &[f64], fits: Option<&dyn Fn(usize, bool) -> bool>, ) -> (usize, bool) { - // The line ending at `chosen`, once it holds a tab, when it fits as drawn; otherwise the latest - // of the legal `breaks` before it that fits as drawn, measuring at most `checks` of them from - // the latest back and bisecting the earlier ones without a hyphen; the first of them when none - // of those measured fits. - let settle = |tabbed: bool, checks: usize, chosen: (usize, bool), breaks: &[(usize, bool)]| -> (usize, bool) { - let Some(fits) = fits.filter(|_| tabbed) else { return chosen }; - if fits(chosen.0, chosen.1) { - return chosen; - } - let earlier = breaks.get(breaks.partition_point(|b| b.0 <= i)..breaks.partition_point(|b| b.0 < chosen.0)).unwrap_or_default(); - if let Some(&b) = earlier.iter().rev().take(checks).find(|b| fits(b.0, b.1)) { - return b; - } - // Without a hyphen, a line that ends later is drawn no narrower, so those breaks bisect. - let rest = earlier.get(..earlier.len().saturating_sub(checks)).unwrap_or_default(); - let plain: Vec<&(usize, bool)> = rest.iter().filter(|b| !b.1).collect(); - let fitting = plain.partition_point(|b| fits(b.0, b.1)); - fitting.checked_sub(1).and_then(|k| plain.get(k).copied()).or(earlier.first()).copied().unwrap_or(chosen) + let settle = |tabbed: bool, checks: usize, chosen: (usize, bool), breaks: &[(usize, bool)]| { + craft_font_catalog::settle_line_break(tabbed, checks, i, chosen, breaks, fits) }; // How many breaks a line measures as drawn one by one. let checks = |back: f64| if back > 0.0 { MAX_DRAWN_CHECKS_STEPPING_BACK } else { MAX_DRAWN_CHECKS }; From d02b41414ac99aa89a53990104d506473ac73845 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 17:25:58 +0000 Subject: [PATCH 032/158] Use shared ligature caret mapping --- Cargo.lock | 3 ++- crates/text/Cargo.toml | 2 +- crates/text/src/layout.rs | 40 ++++++++++++++++----------------------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b08e7086aa..3c717e02a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1008,13 +1008,14 @@ source = "git+https://github.com/storytold/craft-libs?rev=6d620e971e820b517b11a9 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=3d1b0b5edfb55c056a4de539751d647ae60a3dcf#3d1b0b5edfb55c056a4de539751d647ae60a3dcf" +source = "git+https://github.com/storytold/craft-libs?rev=70cfdb281775d226c2af592e36b1063e124a17a9#70cfdb281775d226c2af592e36b1063e124a17a9" dependencies = [ "harfrust 0.13.3", "kurbo 0.13.1", "skrifa 0.47.0", "thiserror 2.0.21", "unicode-bidi", + "unicode-segmentation", "windows-registry", ] diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index cba164b048..648d0bb409 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] # Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "3d1b0b5edfb55c056a4de539751d647ae60a3dcf", default-features = false } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "70cfdb281775d226c2af592e36b1063e124a17a9", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 0aa6e1aee5..083d9f390c 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -62,30 +62,22 @@ fn continues_cluster(prev: Option<&SGlyph>, g: Option<&SGlyph>) -> bool { /// ([`upright_extent`]) as a share of `upright`, the length in font units its own width runs down. /// Empty for a glyph of one character. fn ligature_carets(text: &str, g: &SGlyph, rtl: bool, upright: Option) -> Vec<(usize, f64)> { - use unicode_segmentation::UnicodeSegmentation; - let Some(s) = text.get(g.byte..g.byte + g.len).filter(|_| g.len > 1) else { return Vec::new() }; - let starts: Vec = s.grapheme_indices(true).skip(1).map(|(i, _)| g.byte + i).collect(); - if starts.is_empty() { - return Vec::new(); - } - let parts = starts.len() + 1; - let from_font = if let Some(length) = upright { - let (cell, top) = upright_extent(g); - g.face - .vertical_ligature_carets(g.gid, starts.len(), top, cell) - .filter(|c| c.len() == starts.len() && length > 0.0) - .map(|c| c.into_iter().map(|d| d / length).collect::>()) - .filter(|c| c.iter().all(|f| *f > 0.0 && *f < 1.0)) - } else { - let advance = g.face.advance(g.gid); - g.face - .ligature_carets(g.gid, starts.len()) - .filter(|c| c.len() == starts.len() && advance > 0.0) - .map(|c| c.into_iter().map(|x| if rtl { 1.0 - x / advance } else { x / advance }).collect::>()) - }; - let mut at = from_font.unwrap_or_else(|| (1..parts).map(|j| j as f64 / parts as f64).collect()); - at.sort_by(f64::total_cmp); - starts.into_iter().zip(at).collect() + craft_font_catalog::ligature_caret_stops(text, g.byte, g.len, |count| { + if let Some(length) = upright { + let (cell, top) = upright_extent(g); + g.face + .vertical_ligature_carets(g.gid, count, top, cell) + .filter(|c| c.len() == count && length > 0.0) + .map(|c| c.into_iter().map(|d| d / length).collect::>()) + .filter(|c| c.iter().all(|f| *f > 0.0 && *f < 1.0)) + } else { + let advance = g.face.advance(g.gid); + g.face + .ligature_carets(g.gid, count) + .filter(|c| c.len() == count && advance > 0.0) + .map(|c| c.into_iter().map(|x| if rtl { 1.0 - x / advance } else { x / advance }).collect::>()) + } + }) } /// Does glyph `g`, standing upright in vertical type, take a cell of its own down the column? Every From 09dda7bd9a9f3c7e5332413b97fe47a88ec63186 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 17:44:53 +0000 Subject: [PATCH 033/158] Use shared strict XML attribute validation --- Cargo.lock | 7 ++- Cargo.toml | 2 +- crates/engine/src/cmd.rs | 1 - crates/engine/src/cmd/place/docx.rs | 2 - crates/engine/src/cmd/variablecmds/library.rs | 1 - crates/engine/src/cmd/xmlattrs.rs | 55 ------------------- 6 files changed, 5 insertions(+), 63 deletions(-) delete mode 100644 crates/engine/src/cmd/xmlattrs.rs diff --git a/Cargo.lock b/Cargo.lock index d80b61462e..cc6f905610 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1262,9 +1262,10 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=e2dc681a3#e2dc681a3ad8a47038da2f11ddd2c5e1c0454991" +source = "git+https://github.com/storytold/craft-libs?rev=9a9b89e9e#9a9b89e9e8f057705e56398069c6f288a254b077" dependencies = [ "quick-xml 0.41.0", + "serde", "thiserror 2.0.21", ] @@ -6662,7 +6663,7 @@ dependencies = [ "chrono", "craft-docpath", "craft-proof", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e2dc681a3)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9a9b89e9e)", "crc32fast", "flate2", "hayro-jpeg2000", @@ -6850,7 +6851,7 @@ dependencies = [ "aes", "chrono", "craft-pdf", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=e2dc681a3)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9a9b89e9e)", "flate2", "getrandom 0.4.3", "image", diff --git a/Cargo.toml b/Cargo.toml index e77c950b1a..9cd8c4f5d3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "6d620e971e craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "6d620e971e820b517b11a99cad040ebac670e1e2" } # WMF, EMF and EMF+ reader (craft-libs#778). craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "6d620e971e820b517b11a99cad040ebac670e1e2" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "e2dc681a3" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "9a9b89e9e" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "e2dc681a3" } craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "e2dc681a3" } craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "e2dc681a3" } diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index ae67281995..fc793b2184 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -98,7 +98,6 @@ pub(crate) mod symboledit; pub mod symbollib; pub(crate) mod tabs; mod textedit; -mod xmlattrs; pub use textedit::effective_kerning; pub mod textstyles; diff --git a/crates/engine/src/cmd/place/docx.rs b/crates/engine/src/cmd/place/docx.rs index 804e3fd6ae..6766b67c7c 100644 --- a/crates/engine/src/cmd/place/docx.rs +++ b/crates/engine/src/cmd/place/docx.rs @@ -171,8 +171,6 @@ fn parse(xml: &str, name: &str, cmd: &str) -> Result { craft_xml::Error::TooDeep(_) => bad(cmd, format!("`{name}` in the Word document nests elements more than {MAX_NESTING} deep")), _ => bad(cmd, format!("`{name}` in the Word document is not well-formed XML: {e}")), })?; - crate::cmd::xmlattrs::validate(xml.as_bytes(), opts.limits) - .map_err(|e| bad(cmd, format!("`{name}` in the Word document is not well-formed XML: {e}")))?; Ok(doc) } diff --git a/crates/engine/src/cmd/variablecmds/library.rs b/crates/engine/src/cmd/variablecmds/library.rs index ceab798373..2205ab5d58 100644 --- a/crates/engine/src/cmd/variablecmds/library.rs +++ b/crates/engine/src/cmd/variablecmds/library.rs @@ -250,7 +250,6 @@ fn parse_library(xml: &str, cmd: &str, text_only: bool) -> Result { craft_xml::Error::TooDeep(_) => bad(cmd, format!("the variable library nests elements more than {MAX_LIBRARY_NESTING} deep")), _ => bad(cmd, format!("the variable library is not well-formed XML: {e}")), })?; - crate::cmd::xmlattrs::validate(xml.as_bytes(), opts.limits).map_err(|e| bad(cmd, format!("the variable library is not well-formed XML: {e}")))?; let Some(root) = std::iter::once(&doc).chain(doc.descendants()).find(|n| n.is(craft_xml::Local("variableSets"))) else { return Err(bad(cmd, "the file holds no `variableSets` element")); }; diff --git a/crates/engine/src/cmd/xmlattrs.rs b/crates/engine/src/cmd/xmlattrs.rs deleted file mode 100644 index 6dd2578fae..0000000000 --- a/crates/engine/src/cmd/xmlattrs.rs +++ /dev/null @@ -1,55 +0,0 @@ -//! Attribute uniqueness checks missing from the pinned shared XML reader's strict mode. -//! -//! Temporary consumer guard: parsing remains in craft-xml. Move this invariant into the -//! shared strict reader and remove this second event pass when that dependency is updated. - -/// Check names before canonical/local-name rewriting can collapse distinct attributes. -/// The event reader and namespace scope use the same caller-supplied resource caps. -pub(super) fn validate(xml: &[u8], limits: craft_xml::Limits) -> Result<(), String> { - use std::collections::BTreeSet; - - let opts = craft_xml::Options { limits, doctype: craft_xml::Doctype::Reject, ..Default::default() }.strict(); - let mut events = opts.events(xml); - let mut bindings: Vec<(String, String)> = Vec::new(); - let mut scopes = Vec::new(); - while let Some(event) = events.next().map_err(|e| e.to_string())? { - match event { - craft_xml::Event::Start { attrs, .. } => { - scopes.push(bindings.len()); - let mut raw = BTreeSet::new(); - for (key, value) in &attrs { - if !raw.insert(key.as_str()) { - return Err(format!("duplicate attribute `{key}`")); - } - if let Some(prefix) = key.strip_prefix("xmlns:") { - if bindings.len() >= limits.max_attrs { - return Err("too many in-scope namespace declarations".into()); - } - bindings.push((prefix.to_string(), value.clone())); - } - } - let mut expanded = BTreeSet::new(); - for (key, _) in &attrs { - if key == "xmlns" || key.starts_with("xmlns:") { - continue; - } - // Default namespaces do not apply to attributes. Preserve undeclared - // prefixes for standalone SVG library fragments, as the importer did. - let name = match key.split_once(':') { - Some(("xml", local)) => ("http://www.w3.org/XML/1998/namespace", local), - Some((prefix, local)) => { - bindings.iter().rev().find(|(p, _)| p == prefix).map_or(("", key.as_str()), |(_, uri)| (uri.as_str(), local)) - } - None => ("", key.as_str()), - }; - if !expanded.insert(name) { - return Err(format!("duplicate expanded attribute `{key}`")); - } - } - } - craft_xml::Event::End { .. } => bindings.truncate(scopes.pop().unwrap_or(0)), - _ => {} - } - } - Ok(()) -} From ac98891a697bf7c8769fd863caabe8b0ab824849 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 17:45:27 +0000 Subject: [PATCH 034/158] Pin XML validation test fix --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc6f905610..188f08016d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1262,7 +1262,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=9a9b89e9e#9a9b89e9e8f057705e56398069c6f288a254b077" +source = "git+https://github.com/storytold/craft-libs?rev=99007f191#99007f1915d8b3495effffdfb8550a94a4d0bf87" dependencies = [ "quick-xml 0.41.0", "serde", @@ -6663,7 +6663,7 @@ dependencies = [ "chrono", "craft-docpath", "craft-proof", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9a9b89e9e)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=99007f191)", "crc32fast", "flate2", "hayro-jpeg2000", @@ -6851,7 +6851,7 @@ dependencies = [ "aes", "chrono", "craft-pdf", - "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=9a9b89e9e)", + "craft-xml 0.1.0 (git+https://github.com/storytold/craft-libs?rev=99007f191)", "flate2", "getrandom 0.4.3", "image", diff --git a/Cargo.toml b/Cargo.toml index 9cd8c4f5d3..a9f2993921 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -33,7 +33,7 @@ craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "6d620e971e craft-dxf = { git = "https://github.com/storytold/craft-libs", rev = "6d620e971e820b517b11a99cad040ebac670e1e2" } # WMF, EMF and EMF+ reader (craft-libs#778). craft-metafile = { git = "https://github.com/storytold/craft-libs", rev = "6d620e971e820b517b11a99cad040ebac670e1e2" } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "9a9b89e9e" } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "99007f191" } craft-image-codecs = { git = "https://github.com/storytold/craft-libs", rev = "e2dc681a3" } craft-gif = { git = "https://github.com/storytold/craft-libs", rev = "e2dc681a3" } craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "e2dc681a3" } From 71d7253444dd6cef7280bf69359d6e9d87f1c1ed Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Sun, 15 Nov 2026 18:49:21 +0000 Subject: [PATCH 035/158] Run outline differential tests without font installation --- crates/text/src/fontdb/lookup.rs | 51 +++++++++++++------------------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index 27385253a6..24a6280755 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -657,24 +657,28 @@ mod shared_outline_tests { } } + // Generated CFF keeps the differential tests independent of installed fonts. + fn cff_font(program: &[u8]) -> Vec { + let mut cff = vec![1, 0, 4, 4, 0, 1, 1, 1, 2, b'X', 0, 1, 1, 1, 7, 29, 0, 0, 0, 25, 17, 0, 0, 0, 0]; + cff.extend_from_slice(&[0, 1, 4]); + cff.extend_from_slice(&1u32.to_be_bytes()); + cff.extend_from_slice(&((program.len() as u32) + 1).to_be_bytes()); + cff.extend_from_slice(program); + let mut builder = write_fonts::FontBuilder::new(); + let mut head = vec![0; 54]; + head[18..20].copy_from_slice(&1000u16.to_be_bytes()); + let mut hhea = vec![0; 36]; + hhea[34..36].copy_from_slice(&1u16.to_be_bytes()); + for (tag, data) in [(b"head", head), (b"hhea", hhea), (b"hmtx", vec![0, 100, 0, 0]), (b"maxp", vec![0, 0, 0x50, 0, 0, 1]), (b"CFF ", cff)] { + builder.add_raw(write_fonts::types::Tag::new(tag), data); + } + builder.build() + } + #[test] fn malformed_cff_prefix_matches_original_pen() { - use skrifa::raw::ps::cff::CffFontRef; - let Ok(dir) = std::env::var("CRAFT_FONTS_DIR") else { return }; - let mut bytes = std::fs::read(std::path::Path::new(&dir).join("fonts/noto-sans-cjk-sc/NotoSansCJKsc-Regular.otf")).unwrap(); - let (gid, start) = { - let f = skrifa::FontRef::new(&bytes).unwrap(); - let table = f.table_data(skrifa::Tag::new(b"CFF ")).unwrap().as_bytes(); - let cff = CffFontRef::new(table, 0, None).unwrap(); - let (gid, cs) = (0..cff.num_glyphs()) - .find_map(|gid| { - let cs = cff.charstrings().get(gid as usize)?; - (cs.len() >= 8).then_some((gid, cs)) - }) - .unwrap(); - (gid, cs.as_ptr() as usize - bytes.as_ptr() as usize) - }; - bytes[start..start + 8].copy_from_slice(&[139, 139, 21, 239, 139, 5, 10, 14]); + let bytes = cff_font(&[139, 139, 21, 239, 139, 5, 10, 14]); + let gid = 0; let f = skrifa::FontRef::new(&bytes).unwrap(); let mut old = FlipPen(BezPath::new()); let result = f @@ -692,25 +696,12 @@ mod shared_outline_tests { #[test] fn large_valid_outline_matches_original_pen() { - let Ok(dir) = std::env::var("CRAFT_FONTS_DIR") else { return }; - let source = std::fs::read(std::path::Path::new(&dir).join("fonts/noto-sans-cjk-sc/NotoSansCJKsc-Regular.otf")).unwrap(); - let source = skrifa::FontRef::new(&source).unwrap(); let mut program = vec![139, 139, 21]; for _ in 0..100_001 { program.extend_from_slice(&[140, 6]); } program.push(14); - let mut cff = vec![1, 0, 4, 4, 0, 1, 1, 1, 2, b'X', 0, 1, 1, 1, 7, 29, 0, 0, 0, 25, 17, 0, 0, 0, 0]; - cff.extend_from_slice(&[0, 1, 4]); - cff.extend_from_slice(&1u32.to_be_bytes()); - cff.extend_from_slice(&((program.len() as u32) + 1).to_be_bytes()); - cff.extend_from_slice(&program); - let mut builder = write_fonts::FontBuilder::new(); - for tag in [b"head", b"maxp", b"hhea", b"hmtx"] { - builder.add_raw(write_fonts::types::Tag::new(tag), source.table_data(skrifa::Tag::new(tag)).unwrap().as_bytes().to_vec()); - } - builder.add_raw(write_fonts::types::Tag::new(b"CFF "), cff); - let bytes = builder.build(); + let bytes = cff_font(&program); let f = skrifa::FontRef::new(&bytes).unwrap(); let mut old = FlipPen(BezPath::new()); f.outline_glyphs() From 14972b7667ccbd123e8f28a8aa095ea251737557 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Sun, 15 Nov 2026 19:49:07 -0800 Subject: [PATCH 036/158] M2: keep erased contours in their clipping mask --- crates/engine/src/cmd/draw2/cut.rs | 13 +- crates/engine/tests/eraser_open_fill.rs | 248 ++++++++++++++++++++++++ docs/gaps.md | 2 +- docs/roadmap.md | 2 +- docs/target-app-parity.md | 6 +- docs/ui-parity.md | 2 +- 6 files changed, 265 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/cmd/draw2/cut.rs b/crates/engine/src/cmd/draw2/cut.rs index 8c98aee1f8..1730c4fef0 100644 --- a/crates/engine/src/cmd/draw2/cut.rs +++ b/crates/engine/src/cmd/draw2/cut.rs @@ -1,6 +1,7 @@ use super::common::{ PenRecord, SIZE_VARIATIONS, SIZES, Sample, dist_to_polyline, fill_targets, has_fill, has_painted_stroke, ids_json, path_mut, path_of, - points_param, poly_bounds, pressure_region, ranged, replace_with_pieces, samples_param, sibling_with, size_pressure, target_paths, usize_opt, + points_param, poly_bounds, pressure_region, ranged, replace_with_pieces, samples_param, set_geometry, sibling_with, size_pressure, target_paths, + usize_opt, }; use super::{ Anchor, AnchorKind, Beside, BezPath, BoolOp, Cap, Document, EngineError, FillRule, Join, NodeId, NodeKind, Paint, ParamCurve, PathData, Point, @@ -510,7 +511,15 @@ fn apply_plan(s: &mut Session, label: &str, plan: Vec<(NodeId, Vec)>) let mut all = vec![]; let mut cut = Beside::replacing(d, &plan.iter().map(|(id, _)| *id).collect::>()); for (id, pieces) in plan { - all.extend(replace_with_pieces(d, &mut cut, id, pieces)?); + let clipping_path = d.position(id).is_some_and(|(parent, i, _)| i == 0 && parent.and_then(|p| d.node(p)).is_some_and(|p| p.clips())); + if clipping_path { + // Keep every clipping contour in its original first child slot. An empty mask + // must also stay there so the clipped artwork cannot become the new mask. + set_geometry(d, id, PathData::new(pieces.into_iter().flat_map(|p| p.subpaths).collect()))?; + all.push(id); + } else { + all.extend(replace_with_pieces(d, &mut cut, id, pieces)?); + } } cut.finish(d)?; sel.set(all.iter().copied()); diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index 25c5f08e05..a41e8a51e2 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -405,3 +405,251 @@ fn eraser_marquee_keeps_compound_holes_and_outline_controls() { assert_eq!(s.doc().unwrap().selection, selection); assert_eq!(s.doc().unwrap().history.undo.len(), history); } + +// A mask is a role of one first child, not a collection of ordinary sibling pieces. +struct ClipMaskFixture { + group: NodeId, + mask: NodeId, + art: NodeId, + compound: bool, + rule: FillRule, + appearance: Value, + art_json: Value, +} + +fn blue_clip_art(s: &mut Session) -> NodeId { + let art = NodeId(s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 300, "height": 300})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"ids": [art.0], "color": "#0000ff"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [art.0], "none": true})).unwrap(); + art +} + +fn painted_clip(s: &mut Session, art: NodeId, mask: NodeId, compound: bool) -> ClipMaskFixture { + s.execute("select.set", &json!({"ids": [art.0, mask.0]})).unwrap(); + let group = NodeId(s.execute("object.clippingMask.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + assert!(s.doc().unwrap().doc.node(mask).unwrap().appearance.fill_paint().is_none(), "Make clears the clipping path's paint"); + // The reported area route requires visible fill on the mask AFTER Make, which clears it. + s.execute("paint.setFill", &json!({"ids": [mask.0], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [mask.0], "none": true})).unwrap(); + s.execute("select.set", &json!({"ids": [mask.0]})).unwrap(); + assert_eq!(s.doc().unwrap().selection.objects, vec![mask], "only the mask is an Eraser target"); + let node = s.doc().unwrap().doc.node(mask).unwrap(); + assert!(!node.appearance.fill_paint().is_none(), "the restored visible fill admits the area route"); + assert!(node.appearance.stroke_paint().is_none(), "no painted stroke admits an outline fallback"); + let rule = match &node.kind { + NodeKind::Path { rule, .. } | NodeKind::Compound { rule, .. } => *rule, + other => panic!("expected a path or compound mask, got {other:?}"), + }; + let fixture = ClipMaskFixture { + group, + mask, + art, + compound, + rule, + appearance: serde_json::to_value(&node.appearance).unwrap(), + art_json: serde_json::to_value(s.doc().unwrap().doc.node(art).unwrap()).unwrap(), + }; + assert_clip_identity(s, &fixture); + fixture +} + +fn assert_clip_identity(s: &Session, c: &ClipMaskFixture) { + let d = &s.doc().unwrap().doc; + let children = match &d.node(c.group).unwrap().kind { + NodeKind::Group { children, clip: true } => children, + other => panic!("expected the original clip group, got {other:?}"), + }; + assert_eq!(children.iter().map(|n| n.id).collect::>(), [c.mask, c.art], "the one mask stays first; no painted siblings or promoted art"); + let mask = d.node(c.mask).unwrap(); + let rule = match (&mask.kind, c.compound) { + (NodeKind::Path { rule, clipping: true, .. }, false) | (NodeKind::Compound { rule, .. }, true) => *rule, + (other, _) => panic!("the original mask kind/role changed: {other:?}"), + }; + assert_eq!(rule, c.rule); + assert_eq!(serde_json::to_value(&mask.appearance).unwrap(), c.appearance); + assert_eq!(serde_json::to_value(d.node(c.art).unwrap()).unwrap(), c.art_json, "the clipped art itself is untouched"); +} + +fn assert_clip_pixels(s: &Session, blue: &[(u32, u32)], clear: &[(u32, u32)]) { + let image = vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()); + for &(x, y) in blue { + assert_eq!(image.pixel(x, y), [0, 0, 255, 255], "clipped blue art at ({x}, {y}), not a painted mask sibling"); + } + for &(x, y) in clear { + assert_eq!(image.pixel(x, y)[3], 0, "transparent clip region at ({x}, {y})"); + } +} + +fn clip_eraser(s: &mut Session, mode: &str, full: bool) -> Value { + if mode == "rect" { + let rect = if full { json!([50, 50, 300, 300]) } else { json!([50, 145, 200, 10]) }; + s.execute("path.eraseRegion", &json!({"rect": rect})).unwrap() + } else { + assert!(matches!(mode, "fixed" | "varied")); + let params = if full { json!({"points": [[150, 150]], "size": 300}) } else { json!({"points": [[50, 150], [250, 150]], "size": 10}) }; + erase(s, params, mode == "varied") + } +} + +fn fully_erase_clip_and_restore(s: &mut Session, c: &ClipMaskFixture, mode: &str) { + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + clip_eraser(s, mode, true); + let image = vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()); + assert!(image.pixels.as_chunks::<4>().0.iter().all(|pixel| pixel[3] == 0), "empty geometry must hide all clipped art, not promote it"); + assert_clip_identity(s, c); + match &s.doc().unwrap().doc.node(c.mask).unwrap().kind { + NodeKind::Path { path, .. } => assert!(path.is_empty()), + NodeKind::Compound { children, .. } => assert!(children.is_empty()), + other => panic!("empty mask retains its kind: {other:?}"), + } + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + let empty = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let empty_selection = s.doc().unwrap().selection.clone(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), empty); + assert_eq!(s.doc().unwrap().selection, empty_selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + assert_clip_identity(s, c); +} + +#[test] +fn eraser_clipping_split_and_empty_masks_keep_their_single_role() { + for closed in [false, true] { + for mode in ["fixed", "varied", "rect"] { + let mut s = session(); + let art = blue_clip_art(&mut s); + let mask = marquee_rectangle(&mut s, closed, false); + let c = painted_clip(&mut s, art, mask, false); + assert_eq!(path(&s, mask).is_closed(), closed, "the original mask's open/closed state is real"); + assert_clip_pixels(&s, &[(110, 125), (190, 125), (110, 175), (190, 175), (150, 150)], &[(90, 150)]); + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + clip_eraser(&mut s, mode, false); + assert_clip_pixels(&s, &[(110, 125), (190, 125), (110, 175), (190, 175)], &[(150, 150), (90, 150)]); + assert_clip_identity(&s, &c); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1, "closed={closed}, mode={mode}: one erase edit"); + let split = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let split_selection = s.doc().unwrap().selection.clone(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), split); + assert_eq!(s.doc().unwrap().selection, split_selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + fully_erase_clip_and_restore(&mut s, &c, mode); + } + } +} + +#[test] +fn eraser_clipping_compound_holes_and_empty_masks_keep_their_rule() { + for rule in ["nonZero", "evenOdd"] { + let mut s = session(); + let art = blue_clip_art(&mut s); + let mut ids = vec![]; + for anchors in [ + json!([{"x": 100, "y": 100}, {"x": 300, "y": 100}, {"x": 300, "y": 300}, {"x": 100, "y": 300}]), + json!([{"x": 150, "y": 150}, {"x": 150, "y": 250}, {"x": 250, "y": 250}, {"x": 250, "y": 150}]), + ] { + let id = s.execute("path.create", &json!({"anchors": anchors})).unwrap()["id"].as_u64().unwrap(); + s.execute("paint.setFill", &json!({"ids": [id], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id], "none": true})).unwrap(); + ids.push(id); + } + s.execute("select.set", &json!({"ids": ids})).unwrap(); + let mask = NodeId(s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + s.execute("path.setFillRule", &json!({"rule": rule})).unwrap(); + let c = painted_clip(&mut s, art, mask, true); + assert_eq!(c.rule, if rule == "evenOdd" { FillRule::EvenOdd } else { FillRule::NonZero }); + let members = match &s.doc().unwrap().doc.node(mask).unwrap().kind { + NodeKind::Compound { children, .. } => children, + other => panic!("expected compound, got {other:?}"), + }; + assert!(members.iter().all(|member| !member.path_data().unwrap().is_closed()), "the source contours are open"); + assert_clip_pixels(&s, &[(120, 110), (120, 120), (120, 140)], &[(200, 200), (90, 110)]); + // First witness the independent zero-mask promotion defect in actual pixels. + let original = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let original_selection = s.doc().unwrap().selection.clone(); + let original_history = s.doc().unwrap().history.undo.len(); + fully_erase_clip_and_restore(&mut s, &c, "rect"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), original); + assert_eq!(s.doc().unwrap().selection, original_selection); + assert_eq!(s.doc().unwrap().history.undo.len(), original_history); + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + s.execute("path.eraseRegion", &json!({"rect": [80, 115, 240, 10]})).unwrap(); + assert_clip_identity(&s, &c); + assert_clip_pixels(&s, &[(120, 110), (120, 140)], &[(120, 120), (200, 200), (90, 110)]); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + let split = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let split_selection = s.doc().unwrap().selection.clone(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), split); + assert_eq!(s.doc().unwrap().selection, split_selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + // Member IDs may be rebuilt by set_geometry; only the compound mask's own role is stable. + } +} + +#[test] +fn eraser_clipping_path_eraser_keeps_mask_but_removes_ordinary_art() { + let mut s = session(); + let art = blue_clip_art(&mut s); + let mask = marquee_rectangle(&mut s, false, false); + let c = painted_clip(&mut s, art, mask, false); + assert!(!path(&s, mask).is_closed()); + assert_clip_pixels(&s, &[(190, 110), (190, 150), (190, 190)], &[(90, 150)]); + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + s.execute("path.eraseSegments", &json!({"points": [[50, 150], [250, 150]], "width": 10})).unwrap(); + // The two open outline pieces close as triangles for clipping, not as an area subtraction. + assert_clip_pixels(&s, &[(190, 110), (190, 190)], &[(190, 150), (90, 150)]); + assert_clip_identity(&s, &c); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + let split = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let split_selection = s.doc().unwrap().selection.clone(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), split); + assert_eq!(s.doc().unwrap().selection, split_selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + + // The same shared apply_plan must still REMOVE wholly erased ordinary art. + let mut s = session(); + let ordinary = marquee_rectangle(&mut s, false, false); + s.execute("select.set", &json!({"ids": [ordinary.0]})).unwrap(); + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + s.execute("path.eraseSegments", &json!({"points": [[50, 150], [250, 150]], "width": 300})).unwrap(); + assert!(s.doc().unwrap().doc.node(ordinary).is_none(), "ordinary art does not retain an empty mask node"); + assert!(s.doc().unwrap().selection.is_empty()); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + s.execute("edit.redo", &json!({})).unwrap(); + assert!(s.doc().unwrap().doc.node(ordinary).is_none()); + assert!(s.doc().unwrap().selection.is_empty()); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); +} diff --git a/docs/gaps.md b/docs/gaps.md index d952e53f5f..7fd2cb6631 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -329,7 +329,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G11 Correctness bugs in core tools -- **Improved (#6582), fill-only scope:** the Eraser subtracts its swept area or Alt-drag marquee from filled open contours with no visible painted stroke, preserving fill outside the sweep. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. The result keeps the existing path/compound piece structure and whole appearance. Filled-and-stroked open paths deliberately retain the outline-splitting behavior from main. Public reference semantics for those stroked paths were not established, and their fill behavior is not claimed fixed here. Focused engine integration tests cover fixed and varied tips and Alt-drag marquees on fill-only open/closed geometry and pixels, compound holes and self-crossing fill, plus painted-stroke paths that keep the outline route. Scores and estimates unchanged. +- **Improved (#6582), fill-only scope:** the Eraser subtracts its swept area or Alt-drag marquee from filled open contours with no visible painted stroke, preserving fill outside the sweep. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. The result keeps the existing path/compound piece structure and whole appearance. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths deliberately retain the outline-splitting behavior from main. Public reference semantics for those stroked paths were not established, and their fill behavior is not claimed fixed here. Focused engine integration tests cover fixed and varied tips and Alt-drag marquees on fill-only open/closed geometry and pixels, compound holes and self-crossing fill, plus painted-stroke paths that keep the outline route and clipping-mask split, empty-mask and Path Eraser controls. Scores and estimates unchanged. - **Export-only improvement (#6309):** PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. Broader G11 scope, scores and estimates unchanged. diff --git a/docs/roadmap.md b/docs/roadmap.md index a74ebafa28..412037186f 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -160,7 +160,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule |---|---|---|---| | M0 | Skeleton + vertical slice | ✅ done | — | | M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | -| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | +| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; clipping masks retain surviving contours or empty geometry in the same node; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | | M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel, Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); | 4–8 | | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 759aafa229..8f503bc0e0 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -249,7 +249,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Area | Weight | Done | Main gaps | One agent (h) | Kind | |---|---:|---:|---|---:|---| | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); deletion splits an ordinary contour into selected sibling objects with bounds-fitted gradients kept in place (#3380, deletion only; `crates/engine/tests/it/delete_path_pieces.rs`); open-path anchor Delete keeps gaps; Select › Start Global Edit finds the paths, compound paths and symbol instances of the selected object's shape (Appearance, Size and artboard options) and gives an edit of one to all of them in proportion, as one undo step (#3521), and on a group the groups like it, an edit inside one reaching the same object in the others (#4939), and a Shift-click on a highlighted match leaves it out; the Align panel menu's Align to Glyph Bounds › Point Text and Area Text measure type by its glyphs' ink for Align and Distribute (#4231); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of rotated copies, transform nuances (no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | estimated; Global Edit regression-tested (`crates/engine/src/tests/globaledit.rs`; Quick Action, menu label and Escape in `panels::properties::tests::start_global_edit_quick_action_and_escape`) | -| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; the Pen, Smart Pen and Curvature tool show the measurement readout with the rubber band off (#7043), score, gaps and hours unchanged; Eraser preserves fill-only open-path area outside fixed and varied tip sweeps and Alt-drag marquees, including compound holes; stroked open paths retain main behavior and result structure (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | +| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; the Pen, Smart Pen and Curvature tool show the measurement readout with the rubber band off (#7043), score, gaps and hours unchanged; Eraser preserves fill-only open-path area outside fixed and varied tip sweeps and Alt-drag marquees, including compound holes; clipping masks keep their remaining contours and empty-mask role; stroked open paths retain main behavior and result structure (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522); Live Paint Bucket face drags, including narrow faces and one Undo, regression-tested (#6373) | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | Eyedropper copies effective character dimensions across text transforms (#6404); 30.0's gradient additions are done (dither, perceptual blending, presets); freeform gradients in SVG/PDF, mixed spot/process gradients in SVG, PDF gradients mixing a spot color with RGB or Lab stops, and dithered spot gradient fills and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, which PDF export writes as images in process colors| 4–7 | estimated; Recolor model selection is available through the engine and MCP (#2520), and the dialog's color sliders (HSB, RGB, CMYK, Lab, Tint for a spot color) edit the selected row's new color in its mode, and the Edit tab's Global Adjust sliders (Saturation, Brightness, Temperature, Luminosity, -100% to 100%) change every recolored color at once (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged; a point on a gradient mesh's outline locates on its edge on every side (#7006: `mesh_locate_takes_a_point_on_any_side_of_the_outline`, `mesh_add_line_exactly_on_the_edge_needs_no_tolerance`), score and hours unchanged | | Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (ten generated libraries including Tech Circuit, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | @@ -518,7 +518,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Drawing tools | 7 | 85% | rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, the freehand Tool Options' Keep selected, Alt to the Smooth tool, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding (Curvature point display improved, #1236 in part) | 8–13 | | Selection, transform & align tools | 6 | 85% | Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups, transform nuances (the rotated persistent bounding box is done; no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups, transform nuances (the rotated persistent bounding box is done) | 4–6 | -| Drawing tools | 7 | 86% | Eraser preserves fill when cutting fill-only open paths with fixed or varied tips or Alt-drag marquees; painted-stroke paths retain main behavior (#6582); rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 | +| Drawing tools | 7 | 86% | Eraser preserves fill when cutting fill-only open paths with fixed or varied tips or Alt-drag marquees; painted-stroke paths retain main behavior and clipping masks keep their remaining contours or empty geometry (#6582); rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 86% | Live Paint gap options, Shape Builder gap detection, options (Tool Options dialog, clicking a stroke in merge mode) and Shift-drag marquee | 3–6 | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 96% | Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); freeform gradients in SVG/PDF and mixed spot/process gradients in SVG (exported as stops; PDF export keeps the spot inks in a DeviceN shading, except next to RGB or Lab stops; dithered fills and Perceptual gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve are written as images in process colors), pattern fills in Expand | 2–4; Eyedropper source reads regression-tested (#1251) | | Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (ten generated in code including Tech Circuit, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | @@ -1196,7 +1196,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Escape while an arc, spiral or grid is dragged out cancels it and puts back the options its keys, Alt and Ctrl/Cmd changed (slope, open or closed, base axis, segments, decay, dividers and skews), so the next drag and the tool's options start from the values before the canceled drag; a drag that is let go keeps them, and an option set with `tool.setOption` during the drag stays. This is VectorCraft's own rule. VectorCraft's own Anchors field in the Ellipse dialog (a click with the Ellipse tool; `shape.ellipse {anchors}`, part of #7840) sets how many smooth anchors the ellipse has, 4 by default; 4 draws a live ellipse, and any other count from 2 to 1000 draws a plain path with the anchors spaced evenly by angle, fitted to the typed width and height. The count last confirmed stays as the Ellipse tool's `anchors` option, and the next Ellipse dialog opens on it (`ellipse_with_four_anchors_is_the_live_ellipse`, `ellipse_anchors_draw_that_many_anchors_on_the_ellipse`, `ellipse_refuses_a_bad_anchor_count`, `the_ellipse_dialog_draws_and_keeps_its_anchor_count`). - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). - The Eraser cuts fill-only open contours as areas (#6582), retaining fill outside its sweep or Alt-drag marquee. An eligible appearance has a visible non-None fill and no visible non-None stroke of positive width. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. Cut pieces keep the existing path/compound representation and whole appearance. Filled-and-stroked open paths retain the outline-splitting behavior from main. `crates/engine/tests/eraser_open_fill.rs` covers fixed and varied tips on fill-only open/closed geometry and raster output, compound holes and self-crossing fill, plus a painted-stroke outline control. This deliberately scoped fix does not claim to repair filled-and-stroked open-path fill behavior. Scores and hours are unchanged. + The Eraser cuts fill-only open contours as areas (#6582), retaining fill outside its sweep or Alt-drag marquee. An eligible appearance has a visible non-None fill and no visible non-None stroke of positive width. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. Cut pieces keep the existing path/compound representation and whole appearance. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths retain the outline-splitting behavior from main. `crates/engine/tests/eraser_open_fill.rs` covers fixed and varied tips on fill-only open/closed geometry and raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. This deliberately scoped fix does not claim to repair filled-and-stroked open-path fill behavior. Scores and hours are unchanged. A Scissors cut (`path.split`) leaves one of the two new end points selected and the rest of the path unselected, as [Cut paths](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/split-paths.html) and the "Split a path" section of the [CS3 user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) describe: the two end points lie on top of each other, and a Direct Selection drag from them moves the selected one with its handles and no other anchor. A closed path cut once stays one open path. While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 4544f63031..d43b1c4808 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -171,7 +171,7 @@ tools, never checked side by side) isn't captured row by row. | Free Transform's Cmd/Ctrl side-shear cursor | done | two arrows passing along the side (ShearH, ShearV), instead of the resize arrow across it | | Live Paint Bucket cursors | partial | a filled bucket over a face a click fills, a brush over an edge it paints, an empty bucket where it paints nothing, following Paint Fills, Paint Strokes and Shift; the Eyedropper with Alt; the crosshair with Use Precise Cursors. No cursor swatch preview | | Cursors of their own for Lasso, Magic Wand, the freehand tools, Shaper, Measure, Print Tiling, the symbolism tools, vertical type, Scissors (over a segment and away), Mesh and Puppet Warp | partial | each tool returns its own cursor and Use Precise Cursors turns them into the crosshair; until they're drawn they borrow the crosshair, the I-beam, the Pen's add cursor or not-allowed | -| Eraser: filled open paths and compound holes | partial | Fill-only open paths preserve fill outside sweeps and Alt-drag marquees and keep compound holes under their fill rule (#6582). Focused engine tests cover fixed and varied tips and Alt-drag marquees on open/closed geometry, raster output, compound holes and self-crossing fill, plus a painted-stroke outline control. Filled-and-stroked open paths retain main behavior; that fill behavior is not claimed fixed. See G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | +| Eraser: filled open paths and compound holes | partial | Fill-only open paths preserve fill outside sweeps and Alt-drag marquees and keep compound holes under their fill rule (#6582). Path or Compound clipping masks retain all surviving contours or empty geometry in the same node, preserving the mask role; Path Eraser shares this behavior. Focused engine tests cover fixed and varied tips and Alt-drag marquees on open/closed geometry, raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. Filled-and-stroked open paths retain main behavior; that fill behavior is not claimed fixed. See G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | | Blob Brush and Eraser: the tip's outline at the pointer | done | before a press and while painting, the outline of the tip (its size, angle and roundness, at the zoom) follows the pointer, black on a white halo, round a small centre dot; `[` / `]` and Tool Options change it at once; precise cursors (Caps Lock) show only the crosshair; it goes when the pointer leaves the canvas, while Cmd/Ctrl lends a selection tool and while Alt lends the Blob Brush the Smooth tool (#4977); `crates/tools/src/draw2/gesture.rs` and its tests While the button is down a round Blob Brush shows the outline of the area it will add, rounded at both ends, not a line as wide as the brush that ends square (#4343). | | Eraser: an Alt-drag draws a marquee and the release erases everything inside it (closed shapes and fill-only open paths lose the rectangle's area, other open paths are cut where they cross its edges); Alt+Shift keeps the marquee square; Escape cancels it, and a click erases nothing | done | `path.eraseRegion {rect}`; [public behavior reference](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=133); `eraser_alt_drag_draws_a_marquee_and_erases_the_rectangle`, `eraser_alt_shift_drag_keeps_the_marquee_square`, `eraser_marquee_click_or_escape_erases_nothing`, `erase_region_rect_erases_everything_inside_it`, `erase_region_rect_refuses_bad_values` | | Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) | From 1012d7d2b576674effc6534fbb76f05aac77eb0b Mon Sep 17 00:00:00 2001 From: yoriswind Date: Sun, 15 Nov 2026 21:09:45 -0800 Subject: [PATCH 037/158] M2: preserve gradient placement while erasing --- crates/engine/src/cmd/draw2/cut.rs | 9 + crates/engine/tests/eraser_open_fill.rs | 228 ++++++++++++++++++++++++ docs/gaps.md | 2 +- docs/roadmap.md | 2 +- docs/target-app-parity.md | 6 +- docs/ui-parity.md | 2 +- 6 files changed, 243 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/draw2/cut.rs b/crates/engine/src/cmd/draw2/cut.rs index 1730c4fef0..63051297e3 100644 --- a/crates/engine/src/cmd/draw2/cut.rs +++ b/crates/engine/src/cmd/draw2/cut.rs @@ -508,6 +508,15 @@ fn apply_plan(s: &mut Session, label: &str, plan: Vec<(NodeId, Vec)>) return Ok(json!({ "ids": [] })); } let ids = s.edit(label, |d, sel| { + // Pin paint owners before any member changes their original bounds. + for (id, _) in &plan { + let owner = crate::cmd::path::compound_or_self(d, *id); + for target in [owner, *id] { + if let Some(node) = d.node_mut(target) { + node.pin_gradients(); + } + } + } let mut all = vec![]; let mut cut = Beside::replacing(d, &plan.iter().map(|(id, _)| *id).collect::>()); for (id, pieces) in plan { diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index a41e8a51e2..783853943f 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -653,3 +653,231 @@ fn eraser_clipping_path_eraser_keeps_mask_but_removes_ordinary_art() { assert!(s.doc().unwrap().selection.is_empty()); assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); } + +// Bounds-fitted fill gradients are page-space paints, not Along-stroke gradients. +fn eraser_gradient_fill(s: &mut Session, id: NodeId, placed: bool) -> Value { + let mut gradient = json!({"kind": "linear", "angle": 90, "dither": false, "stops": [ + {"offset": 0, "color": "#ff0000"}, {"offset": 1, "color": "#0000ff"} + ]}); + if placed { + gradient["start"] = json!([150, 200]); + gradient["end"] = json!([150, 100]); + } + s.execute("paint.setFill", &json!({"ids": [id.0], "gradient": gradient})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "none": true})).unwrap(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let vectorcraft_doc::color::Paint::Gradient(g) = s.doc().unwrap().doc.node(id).unwrap().appearance.fill_paint() else { + panic!("the public paint command must install a gradient fill"); + }; + assert_eq!(g.geom.is_some(), placed, "the fixture distinguishes fitted and explicitly placed gradients"); + assert!(!g.gradient.dither, "exact retained-pixel comparisons do not use noise"); + serde_json::to_value(g.geom).unwrap() +} + +fn eraser_gradient_image(s: &Session) -> vectorcraft_render::Rendered { + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) +} + +fn eraser_gradient_region(s: &mut Session, mode: &str, trim: bool, miss: bool) -> Value { + if mode == "rect" { + let rect = if miss { + json!([10, 10, 10, 10]) + } else if trim { + json!([50, 90, 200, 20]) + } else { + json!([50, 145, 200, 10]) + }; + s.execute("path.eraseRegion", &json!({"rect": rect})).unwrap() + } else { + assert!(matches!(mode, "fixed" | "varied")); + let params = if miss { + json!({"points": [[20, 20]], "size": 10}) + } else if trim { + json!({"points": [[50, 100], [250, 100]], "size": 20}) + } else { + json!({"points": [[50, 150], [250, 150]], "size": 10}) + }; + erase(s, params, mode == "varied") + } +} + +fn eraser_gradient_rectangle_case(closed: bool, mode: &str, trim: bool, placed: bool) { + let mut s = session(); + let id = marquee_rectangle(&mut s, closed, false); + let placed_geom = eraser_gradient_fill(&mut s, id, placed); + assert_eq!(path(&s, id).is_closed(), closed); + let before_image = eraser_gradient_image(&s); + let before = s.doc().unwrap().doc.clone(); + let before_json = serde_json::to_value(&before).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + for y in [125, 175] { + assert_eq!(before_image.pixel(150, y)[3], 255, "the retained sample is inside the original fill"); + } + assert_ne!(before_image.pixel(150, 125), before_image.pixel(150, 175), "the original ramp varies vertically"); + let erased_y = if trim { 105 } else { 150 }; + assert_eq!(before_image.pixel(150, erased_y)[3], 255); + + let miss = eraser_gradient_region(&mut s, mode, trim, true); + assert_eq!(miss["ids"], json!([])); + assert!(std::sync::Arc::ptr_eq(&s.doc().unwrap().doc, &before), "a miss must not pin or replace the document"); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before_json); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + + let result = eraser_gradient_region(&mut s, mode, trim, false); + let ids = result["ids"].as_array().unwrap(); + assert_eq!(ids.len(), if trim { 1 } else { 2 }, "closed={closed}, mode={mode}, trim={trim}: actual piece count"); + let after_image = eraser_gradient_image(&s); + assert_eq!(after_image.pixel(150, erased_y)[3], 0, "the erase operation really removes the intended band"); + for y in [125, 175] { + assert_eq!( + after_image.pixel(150, y), + before_image.pixel(150, y), + "closed={closed}, mode={mode}, trim={trim}, placed={placed}: retained gradient color at (150, {y})" + ); + } + if placed { + for id in ids { + let node = s.doc().unwrap().doc.node(NodeId(id.as_u64().unwrap())).unwrap(); + let vectorcraft_doc::color::Paint::Gradient(g) = node.appearance.fill_paint() else { panic!("the placed fill remains a gradient") }; + assert_eq!(serde_json::to_value(g.geom).unwrap(), placed_geom, "an explicit vector is not refitted"); + } + } + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1, "one erase is one edit"); + let after = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let after_selection = s.doc().unwrap().selection.clone(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before_json); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), after); + assert_eq!(s.doc().unwrap().selection, after_selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + assert_eq!(eraser_gradient_image(&s).pixels, after_image.pixels, "Redo restores the exact rendered result"); +} + +#[test] +fn eraser_gradient_retains_page_colors_for_split_trim_and_placed_fill() { + // A legal already-placed vector is the positive control for the shared pinning seam. + eraser_gradient_rectangle_case(false, "fixed", false, true); + for closed in [false, true] { + for mode in ["fixed", "varied", "rect"] { + for trim in [false, true] { + eraser_gradient_rectangle_case(closed, mode, trim, false); + } + } + } +} + +fn eraser_gradient_compound_fixture(s: &mut Session, rule: &str) -> (NodeId, NodeId, NodeId) { + let mut ids = vec![]; + for anchors in [ + json!([{"x": 100, "y": 100}, {"x": 200, "y": 100}, {"x": 200, "y": 200}, {"x": 100, "y": 200}]), + json!([{"x": 140, "y": 140}, {"x": 140, "y": 160}, {"x": 160, "y": 160}, {"x": 160, "y": 140}]), + ] { + let id = s.execute("path.create", &json!({"anchors": anchors})).unwrap()["id"].as_u64().unwrap(); + s.execute("paint.setFill", &json!({"ids": [id], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id], "none": true})).unwrap(); + ids.push(id); + } + let outer = NodeId(*ids.first().unwrap()); + let inner = NodeId(*ids.get(1).unwrap()); + s.execute("select.set", &json!({"ids": ids})).unwrap(); + let compound = NodeId(s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + s.execute("path.setFillRule", &json!({"rule": rule})).unwrap(); + eraser_gradient_fill(s, compound, false); + let owner = s.doc().unwrap().doc.node(compound).unwrap(); + let members = match &owner.kind { + NodeKind::Compound { children, .. } => children, + other => panic!("expected a compound, got {other:?}"), + }; + assert_eq!(members.len(), 2); + for member in members { + assert!(!member.path_data().unwrap().is_closed(), "the compound's source contours are genuinely open"); + assert!(member.appearance.fill_paint().is_none() && member.appearance.stroke_paint().is_none(), "the parent alone owns the paint"); + } + let bounds = owner.geometric_bounds().unwrap(); + assert_eq!(bounds, vectorcraft_geom::Rect::new(100.0, 100.0, 200.0, 200.0)); + (outer, inner, compound) +} + +fn eraser_gradient_compound_case(outline: bool, rule: &str) { + let mut s = session(); + let (outer, inner, compound) = eraser_gradient_compound_fixture(&mut s, rule); + let before_image = eraser_gradient_image(&s); + let retained = if outline { vec![(190, 175)] } else { vec![(150, 125), (150, 175)] }; + for &(x, y) in &retained { + assert_eq!(before_image.pixel(x, y)[3], 255, "{rule}: retained source interior"); + } + assert_ne!(before_image.pixel(190, 125), before_image.pixel(190, 175), "the parent paint is a nonconstant vertical ramp"); + assert_eq!(before_image.pixel(155, 155)[3], 0, "the source hole is empty"); + let before = s.doc().unwrap().doc.clone(); + let before_json = serde_json::to_value(&before).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + let inner_before = serde_json::to_value(s.doc().unwrap().doc.node(inner).unwrap()).unwrap(); + let miss = if outline { + s.execute("path.eraseSegments", &json!({"points": [[20, 20]], "width": 20})).unwrap() + } else { + s.execute("path.eraseRegion", &json!({"rect": [145, 145, 10, 10]})).unwrap() + }; + assert_eq!(miss["ids"], json!([])); + assert!(std::sync::Arc::ptr_eq(&s.doc().unwrap().doc, &before), "{rule}: no-op must not pin the owner"); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + assert_eq!(s.doc().unwrap().selection, selection); + + if outline { + // Path Eraser plans the outer leaf, but its Compound parent supplies the gradient. + s.execute("path.eraseSegments", &json!({"points": [[50, 100], [250, 100]], "width": 20})).unwrap(); + let after_bounds = s.doc().unwrap().doc.node(compound).unwrap().geometric_bounds().unwrap(); + assert!((after_bounds.y0 - 110.0).abs() < 1e-5, "the edited extremal outline shrinks the parent fit: {after_bounds:?}"); + assert_eq!(serde_json::to_value(s.doc().unwrap().doc.node(inner).unwrap()).unwrap(), inner_before, "the inner member itself was not edited"); + let hole = Point::new(155.0, 155.0); + assert!( + vectorcraft_geom::hit::fill_contains(&path(&s, outer).to_bezpath(), FillRule::NonZero, hole), + "the sample remains inside the outer fill" + ); + assert!( + vectorcraft_geom::hit::fill_contains(&path(&s, inner).to_bezpath(), FillRule::NonZero, hole), + "the unchanged inner contour still makes a hole there" + ); + } else { + s.execute("path.eraseRegion", &json!({"rect": [50, 145, 200, 10]})).unwrap(); + } + let after_image = eraser_gradient_image(&s); + assert_eq!(after_image.pixel(155, 155)[3], 0, "{rule}: the un-erased part of the hole stays empty"); + if !outline { + assert_eq!(after_image.pixel(190, 150)[3], 0, "the marquee actually removes filled art across the ring"); + assert_eq!(after_image.pixel(150, 142)[3], 0, "the hole above the erased band remains empty"); + } + for &(x, y) in &retained { + assert_eq!( + after_image.pixel(x, y), + before_image.pixel(x, y), + "{rule}, outline={outline}: parent-owned gradient must keep its original color at ({x}, {y})" + ); + } + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + let after = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let after_selection = s.doc().unwrap().selection.clone(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before_json); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), after); + assert_eq!(s.doc().unwrap().selection, after_selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + assert_eq!(eraser_gradient_image(&s).pixels, after_image.pixels); +} + +#[test] +fn eraser_gradient_compound_owner_keeps_page_colors_and_holes() { + for outline in [true, false] { + for rule in ["nonZero", "evenOdd"] { + eraser_gradient_compound_case(outline, rule); + } + } +} diff --git a/docs/gaps.md b/docs/gaps.md index 7fd2cb6631..425709e1ee 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -329,7 +329,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G11 Correctness bugs in core tools -- **Improved (#6582), fill-only scope:** the Eraser subtracts its swept area or Alt-drag marquee from filled open contours with no visible painted stroke, preserving fill outside the sweep. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. The result keeps the existing path/compound piece structure and whole appearance. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths deliberately retain the outline-splitting behavior from main. Public reference semantics for those stroked paths were not established, and their fill behavior is not claimed fixed here. Focused engine integration tests cover fixed and varied tips and Alt-drag marquees on fill-only open/closed geometry and pixels, compound holes and self-crossing fill, plus painted-stroke paths that keep the outline route and clipping-mask split, empty-mask and Path Eraser controls. Scores and estimates unchanged. +- **Improved (#6582), fill-only scope:** the Eraser subtracts its swept area or Alt-drag marquee from filled open contours with no visible painted stroke, preserving fill outside the sweep. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. The result keeps the existing path/compound piece structure and whole appearance. Bounds-fitted gradients keep their original placement on retained geometry. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths deliberately retain the outline-splitting behavior from main. Public reference semantics for those stroked paths were not established, and their fill behavior is not claimed fixed here. Focused engine integration tests cover fixed and varied tips and Alt-drag marquees on fill-only open/closed geometry and pixels, compound holes and self-crossing fill, plus painted-stroke paths that keep the outline route and clipping-mask split, empty-mask and Path Eraser controls. Scores and estimates unchanged. - **Export-only improvement (#6309):** PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. Broader G11 scope, scores and estimates unchanged. diff --git a/docs/roadmap.md b/docs/roadmap.md index f5b7b0fd11..2d7064bdaf 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -160,7 +160,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule |---|---|---|---| | M0 | Skeleton + vertical slice | ✅ done | — | | M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | -| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; clipping masks retain surviving contours or empty geometry in the same node; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | +| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; clipping masks retain surviving contours or empty geometry in the same node; bounds-fitted gradients keep their original placement; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | | M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel (its spectrum grows with a resized panel, #8005), Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); | 4–8 | | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 6bb61a8c91..fbc1513c0f 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -249,7 +249,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Area | Weight | Done | Main gaps | One agent (h) | Kind | |---|---:|---:|---|---:|---| | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); deletion splits an ordinary contour into selected sibling objects with bounds-fitted gradients kept in place (#3380, deletion only; `crates/engine/tests/it/delete_path_pieces.rs`); open-path anchor Delete keeps gaps; Select › Start Global Edit finds the paths, compound paths and symbol instances of the selected object's shape (Appearance, Size and artboard options) and gives an edit of one to all of them in proportion, as one undo step (#3521), and on a group the groups like it, an edit inside one reaching the same object in the others (#4939), and a Shift-click on a highlighted match leaves it out; the Align panel menu's Align to Glyph Bounds › Point Text and Area Text measure type by its glyphs' ink for Align and Distribute (#4231); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of rotated copies, transform nuances (no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | estimated; Global Edit regression-tested (`crates/engine/src/tests/globaledit.rs`; Quick Action, menu label and Escape in `panels::properties::tests::start_global_edit_quick_action_and_escape`) | -| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; the Pen, Smart Pen and Curvature tool show the measurement readout with the rubber band off (#7043), score, gaps and hours unchanged; Eraser preserves fill-only open-path area outside fixed and varied tip sweeps and Alt-drag marquees, including compound holes; clipping masks keep their remaining contours and empty-mask role; stroked open paths retain main behavior and result structure (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | +| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; the Pen, Smart Pen and Curvature tool show the measurement readout with the rubber band off (#7043), score, gaps and hours unchanged; Eraser preserves fill-only open-path area outside fixed and varied tip sweeps and Alt-drag marquees, including compound holes; clipping masks keep their remaining contours and empty-mask role; bounds-fitted gradients keep their original placement; stroked open paths retain main behavior and result structure (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522); Live Paint Bucket face drags, including narrow faces and one Undo, regression-tested (#6373) | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | Eyedropper copies effective character dimensions across text transforms (#6404); 30.0's gradient additions are done (dither, perceptual blending, presets); freeform gradients in SVG/PDF, mixed spot/process gradients in SVG, PDF gradients mixing a spot color with RGB or Lab stops, and dithered spot gradient fills and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, which PDF export writes as images in process colors| 4–7 | estimated; Recolor model selection is available through the engine and MCP (#2520), and the dialog's color sliders (HSB, RGB, CMYK, Lab, Tint for a spot color) edit the selected row's new color in its mode, and the Edit tab's Global Adjust sliders (Saturation, Brightness, Temperature, Luminosity, -100% to 100%) change every recolored color at once (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged; a point on a gradient mesh's outline locates on its edge on every side (#7006: `mesh_locate_takes_a_point_on_any_side_of_the_outline`, `mesh_add_line_exactly_on_the_edge_needs_no_tolerance`), score and hours unchanged; Color panel spectrum grows with the resized panel (#8005) | | Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (ten generated libraries including Tech Circuit, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | @@ -518,7 +518,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Drawing tools | 7 | 85% | rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, the freehand Tool Options' Keep selected, Alt to the Smooth tool, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding (Curvature point display improved, #1236 in part) | 8–13 | | Selection, transform & align tools | 6 | 85% | Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups, transform nuances (the rotated persistent bounding box is done; no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups, transform nuances (the rotated persistent bounding box is done) | 4–6 | -| Drawing tools | 7 | 86% | Eraser preserves fill when cutting fill-only open paths with fixed or varied tips or Alt-drag marquees; painted-stroke paths retain main behavior and clipping masks keep their remaining contours or empty geometry (#6582); rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 | +| Drawing tools | 7 | 86% | Eraser preserves fill when cutting fill-only open paths with fixed or varied tips or Alt-drag marquees; painted-stroke paths retain main behavior and clipping masks keep their remaining contours or empty geometry, with bounds-fitted gradient placement preserved (#6582); rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 86% | Live Paint gap options, Shape Builder gap detection, options (Tool Options dialog, clicking a stroke in merge mode) and Shift-drag marquee | 3–6 | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 96% | Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); freeform gradients in SVG/PDF and mixed spot/process gradients in SVG (exported as stops; PDF export keeps the spot inks in a DeviceN shading, except next to RGB or Lab stops; dithered fills and Perceptual gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve are written as images in process colors), pattern fills in Expand | 2–4; Eyedropper source reads regression-tested (#1251) | | Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (ten generated in code including Tech Circuit, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | @@ -1199,7 +1199,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Escape while an arc, spiral or grid is dragged out cancels it and puts back the options its keys, Alt and Ctrl/Cmd changed (slope, open or closed, base axis, segments, decay, dividers and skews), so the next drag and the tool's options start from the values before the canceled drag; a drag that is let go keeps them, and an option set with `tool.setOption` during the drag stays. This is VectorCraft's own rule. VectorCraft's own Anchors field in the Ellipse dialog (a click with the Ellipse tool; `shape.ellipse {anchors}`, part of #7840) sets how many smooth anchors the ellipse has, 4 by default; 4 draws a live ellipse, and any other count from 2 to 1000 draws a plain path with the anchors spaced evenly by angle, fitted to the typed width and height. The count last confirmed stays as the Ellipse tool's `anchors` option, and the next Ellipse dialog opens on it (`ellipse_with_four_anchors_is_the_live_ellipse`, `ellipse_anchors_draw_that_many_anchors_on_the_ellipse`, `ellipse_refuses_a_bad_anchor_count`, `the_ellipse_dialog_draws_and_keeps_its_anchor_count`). - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). - The Eraser cuts fill-only open contours as areas (#6582), retaining fill outside its sweep or Alt-drag marquee. An eligible appearance has a visible non-None fill and no visible non-None stroke of positive width. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. Cut pieces keep the existing path/compound representation and whole appearance. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths retain the outline-splitting behavior from main. `crates/engine/tests/eraser_open_fill.rs` covers fixed and varied tips on fill-only open/closed geometry and raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. This deliberately scoped fix does not claim to repair filled-and-stroked open-path fill behavior. Scores and hours are unchanged. + The Eraser cuts fill-only open contours as areas (#6582), retaining fill outside its sweep or Alt-drag marquee. An eligible appearance has a visible non-None fill and no visible non-None stroke of positive width. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. Cut pieces keep the existing path/compound representation and whole appearance. Bounds-fitted gradients keep their original placement on retained geometry. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths retain the outline-splitting behavior from main. `crates/engine/tests/eraser_open_fill.rs` covers fixed and varied tips on fill-only open/closed geometry and raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. This deliberately scoped fix does not claim to repair filled-and-stroked open-path fill behavior. Scores and hours are unchanged. A Scissors cut (`path.split`) leaves one of the two new end points selected and the rest of the path unselected, as [Cut paths](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/split-paths.html) and the "Split a path" section of the [CS3 user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) describe: the two end points lie on top of each other, and a Direct Selection drag from them moves the selected one with its handles and no other anchor. A closed path cut once stays one open path. While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 18fe02851c..4b107e9d3b 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -171,7 +171,7 @@ tools, never checked side by side) isn't captured row by row. | Free Transform's Cmd/Ctrl side-shear cursor | done | two arrows passing along the side (ShearH, ShearV), instead of the resize arrow across it | | Live Paint Bucket cursors | partial | a filled bucket over a face a click fills, a brush over an edge it paints, an empty bucket where it paints nothing, following Paint Fills, Paint Strokes and Shift; the Eyedropper with Alt; the crosshair with Use Precise Cursors. No cursor swatch preview | | Cursors of their own for Lasso, Magic Wand, the freehand tools, Shaper, Measure, Print Tiling, the symbolism tools, vertical type, Scissors (over a segment and away), Mesh and Puppet Warp | partial | each tool returns its own cursor and Use Precise Cursors turns them into the crosshair; until they're drawn they borrow the crosshair, the I-beam, the Pen's add cursor or not-allowed | -| Eraser: filled open paths and compound holes | partial | Fill-only open paths preserve fill outside sweeps and Alt-drag marquees and keep compound holes under their fill rule (#6582). Path or Compound clipping masks retain all surviving contours or empty geometry in the same node, preserving the mask role; Path Eraser shares this behavior. Focused engine tests cover fixed and varied tips and Alt-drag marquees on open/closed geometry, raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. Filled-and-stroked open paths retain main behavior; that fill behavior is not claimed fixed. See G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | +| Eraser: filled open paths and compound holes | partial | Fill-only open paths preserve fill outside sweeps and Alt-drag marquees and keep compound holes under their fill rule (#6582). Path or Compound clipping masks retain all surviving contours or empty geometry in the same node, preserving the mask role; Path Eraser shares this behavior. Bounds-fitted gradients keep their original placement on retained geometry. Focused engine tests cover fixed and varied tips and Alt-drag marquees on open/closed geometry, raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. Filled-and-stroked open paths retain main behavior; that fill behavior is not claimed fixed. See G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | | Blob Brush and Eraser: the tip's outline at the pointer | done | before a press and while painting, the outline of the tip (its size, angle and roundness, at the zoom) follows the pointer, black on a white halo, round a small centre dot; `[` / `]` and Tool Options change it at once; precise cursors (Caps Lock) show only the crosshair; it goes when the pointer leaves the canvas, while Cmd/Ctrl lends a selection tool and while Alt lends the Blob Brush the Smooth tool (#4977); `crates/tools/src/draw2/gesture.rs` and its tests While the button is down a round Blob Brush shows the outline of the area it will add, rounded at both ends, not a line as wide as the brush that ends square (#4343). | | Eraser: an Alt-drag draws a marquee and the release erases everything inside it (closed shapes and fill-only open paths lose the rectangle's area, other open paths are cut where they cross its edges); Alt+Shift keeps the marquee square; Escape cancels it, and a click erases nothing | done | `path.eraseRegion {rect}`; [public behavior reference](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=133); `eraser_alt_drag_draws_a_marquee_and_erases_the_rectangle`, `eraser_alt_shift_drag_keeps_the_marquee_square`, `eraser_marquee_click_or_escape_erases_nothing`, `erase_region_rect_erases_everything_inside_it`, `erase_region_rect_refuses_bad_values` | | Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) | From 573a924d190a338f77a21a962cc2d400308f1949 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Sun, 15 Nov 2026 23:07:02 -0800 Subject: [PATCH 038/158] M2: preserve evaluated ancestor gradients while erasing --- crates/effects/src/geometry.rs | 30 ++ crates/effects/src/group.rs | 60 +++- crates/effects/src/lib.rs | 4 +- crates/effects/src/placement.rs | 74 +++++ crates/effects/src/reshape.rs | 2 +- crates/engine/src/cmd/draw2/cut.rs | 21 +- crates/engine/tests/eraser_open_fill.rs | 369 ++++++++++++++++++++++++ crates/render/src/fx.rs | 3 + crates/render/src/fx/placement.rs | 86 ++++++ crates/render/src/fx/predicates.rs | 11 +- crates/render/src/fx/renderer.rs | 2 +- crates/render/src/lib.rs | 1 + docs/gaps.md | 5 +- docs/roadmap.md | 5 +- docs/target-app-parity.md | 9 +- docs/ui-parity.md | 5 +- 16 files changed, 656 insertions(+), 31 deletions(-) create mode 100644 crates/effects/src/placement.rs create mode 100644 crates/render/src/fx/placement.rs diff --git a/crates/effects/src/geometry.rs b/crates/effects/src/geometry.rs index 39924835fd..6a7405648c 100644 --- a/crates/effects/src/geometry.rs +++ b/crates/effects/src/geometry.rs @@ -312,6 +312,36 @@ impl Carry { } } + /// Undo the actual maps of already placed gradients. Failure only changes this temporary + /// appearance; callers retain the stored row unchanged when a map cannot be inverted. + pub(crate) fn unapply_placed(&self, ap: &mut Appearance) -> Option<()> { + for step in self.0.iter().rev() { + for item in &mut ap.items { + if !matches!(item.paint(), vectorcraft_doc::color::Paint::Gradient(_)) { + continue; + } + let map = match *step { + CarryStep::Affine { m, .. } => m, + CarryStep::Boxes { from, to } => match item { + AppearanceItem::Fill(_) => crate::reshape::box_map(from, to), + AppearanceItem::Stroke(s) => crate::reshape::box_map(s.paint_bounds(from), s.paint_bounds(to)), + }, + }; + if vectorcraft_doc::node::flattens(map) { + return None; + } + let inverse = map.inverse(); + if !inverse.is_finite() { + return None; + } + if let vectorcraft_doc::color::Paint::Gradient(g) = item.paint_mut() { + g.transform(inverse); + } + } + } + Some(()) + } + pub(crate) fn push(&mut self, more: Carry) { self.0.extend(more.0); self.1.extend(more.1); diff --git a/crates/effects/src/group.rs b/crates/effects/src/group.rs index 63215d897d..8ae666ea64 100644 --- a/crates/effects/src/group.rs +++ b/crates/effects/src/group.rs @@ -824,16 +824,16 @@ fn take_sublayer_guides(n: &mut Node, out: &mut Vec>, is_guide: &impl take_held_guides(n, held, out, false, false); } -/// `n`, a group or layer, as plain art: its Pathfinder effects evaluated, its geometry effects -/// reshaping all its members as one piece (the whole art's bounds as their reference box) after -/// the members' own geometry and Pathfinder effects ([`members_as_drawn`]), and its -/// own fills and strokes turned into art painting the members' geometry ([`member_shapes`]) below -/// the members (after a clipping path) or above them, as its contents slot says. Its -/// transparency, opacity mask and raster effects stay. `None` when it has none of these. Live -/// objects among the members are evaluated with the symbols of `doc` (see [`member_shapes`]), and -/// a Pathfinder operation or compound shape takes the symbol instances among its members as their -/// symbols' art from `doc`. -pub fn evaluate_container(doc: Option<&Document>, n: &Node) -> Option { +struct PreparedContainer { + m: Node, + guides: Vec>, + paint: bool, + carry: crate::Carry, +} + +/// The existing container pass up to its own rows becoming art. Keep its carried appearance for +/// rendering, and retain the same Carry for freezing only missing stored placements separately. +fn prepare_container(doc: Option<&Document>, n: &Node) -> Option { if !is_container(n) { return None; } @@ -844,6 +844,7 @@ pub fn evaluate_container(doc: Option<&Document>, n: &Node) -> Option { return None; } let mut m = n.clone(); + let mut carry = crate::Carry::default(); // Its ruler guides take no part: they go back above the evaluated art at the end. With effects // that replace or copy the art, so do its guides among the art and those in its sublayers and // groups, which would otherwise go with that art: they stay on `n`, in order, hidden and @@ -870,7 +871,7 @@ pub fn evaluate_container(doc: Option<&Document>, n: &Node) -> Option { let _later = crate::raster::LaterGroups::enter(&n.appearance.effects); members_as_drawn(doc, &mut m); } - let carry = crate::reshape::reshape_leaves_carrying(&mut m, &fx, &n.appearance.effects, doc); + carry = crate::reshape::reshape_leaves_carrying(&mut m, &fx, &n.appearance.effects, doc); // The group's own fills and strokes paint the members as a whole: their gradients follow // the effects as the members' do. if paint && carry.moves(&m.appearance) { @@ -879,6 +880,20 @@ pub fn evaluate_container(doc: Option<&Document>, n: &Node) -> Option { } m.appearance.effects = crate::raster::without_geometry(&m.appearance.effects); m.appearance.effects.retain(|e| !is_pathfinder(&e.id)); + Some(PreparedContainer { m, guides, paint, carry }) +} + +/// `n`, a group or layer, as plain art: its Pathfinder effects evaluated, its geometry effects +/// reshaping all its members as one piece (the whole art's bounds as their reference box) after +/// the members' own geometry and Pathfinder effects ([`members_as_drawn`]), and its +/// own fills and strokes turned into art painting the members' geometry ([`member_shapes`]) below +/// the members (after a clipping path) or above them, as its contents slot says. Its +/// transparency, opacity mask and raster effects stay. `None` when it has none of these. Live +/// objects among the members are evaluated with the symbols of `doc` (see [`member_shapes`]), and +/// a Pathfinder operation or compound shape takes the symbol instances among its members as their +/// symbols' art from `doc`. +pub fn evaluate_container(doc: Option<&Document>, n: &Node) -> Option { + let PreparedContainer { mut m, guides, paint, .. } = prepare_container(doc, n)?; if paint { let shapes = member_shapes(doc, &m); let bounds = m.geometric_bounds(); @@ -901,6 +916,29 @@ pub fn evaluate_container(doc: Option<&Document>, n: &Node) -> Option { Some(m) } +/// Freeze representable fitted own paints to the box the container pass gives them, retaining +/// every live effect and already explicit placement. Hidden-only containers the pass does not +/// evaluate stay unchanged; this does not add a different fallback to `evaluate_container`. +pub fn pinned_container_appearance(doc: &Document, n: &Node) -> Option { + if !n.appearance.has_unplaced_gradient() { + return None; + } + let PreparedContainer { m, carry, .. } = prepare_container(Some(doc), n)?; + let bounds = m.geometric_bounds()?; + let mut out = (*n.appearance).clone(); + let mut changed = false; + for (item, original) in out.items.iter_mut().zip(&n.appearance.items) { + if paints(original) + && matches!(original.paint(), Paint::Gradient(g) if !g.is_placed()) + && let Some(pinned) = crate::pinned_gradient_item(original, bounds, &[&carry]) + { + *item = pinned; + changed = true; + } + } + changed.then_some(out) +} + /// Replace each visible member of `n` with geometry or Pathfinder effects of its own, at every /// depth of its groups and layers, by the art it draws ([`evaluate_container`], /// [`crate::reshape::own_effects_art`]), so the geometry effects of `n` reshape what its members diff --git a/crates/effects/src/lib.rs b/crates/effects/src/lib.rs index 6c6bec1387..23e09f5185 100644 --- a/crates/effects/src/lib.rs +++ b/crates/effects/src/lib.rs @@ -45,6 +45,7 @@ mod lighting_presets; mod live; mod marks; pub mod pixel; +mod placement; pub mod preview; mod raster; mod reshape; @@ -75,12 +76,13 @@ pub use bake::{ pub use clip::{WarpSeams, clip_outline, knockout_silhouette, reshaped_clip_outline, warp_pieces_translucent}; pub use group::{ OutlineHook, PATHFINDER_EFFECTS, compound_shape_area, compound_shape_art, evaluate_container, has_container_appearance, has_pathfinder, - is_pathfinder, member_leaves, member_shapes, paints, pathfinder_children, shape_art, + is_pathfinder, member_leaves, member_shapes, paints, pathfinder_children, pinned_container_appearance, shape_art, }; pub use lighting_presets::{LIGHTING_PRESETS, LightingPreset, lighting_preset_params, matching_lighting_preset}; pub use live::{expand_live, expand_live_deep, expanded_live_group, outline_object, text_outliner}; pub use marks::{CROP_MARKS, crop_marks_art, has_crop_marks}; pub use pixel::{PIXEL_EFFECTS, PixelFx, PixelSpace}; +pub use placement::pinned_gradient_item; pub use raster::{ RASTERIZE, RasterFx, Rasterize, color_param, follow_items, item_effects_in, outset, raster_effects, rasterize_stage, stage_map, staged_effects, without_geometry, diff --git a/crates/effects/src/placement.rs b/crates/effects/src/placement.rs new file mode 100644 index 0000000000..409022cef7 --- /dev/null +++ b/crates/effects/src/placement.rs @@ -0,0 +1,74 @@ +//! Conservative stored placements for gradients fitted by the existing effects passes. + +use vectorcraft_doc::color::{GradientKind, GradientPaint, Paint}; +use vectorcraft_doc::{Appearance, AppearanceItem}; +use vectorcraft_geom::Rect; + +use crate::Carry; + +/// Freeze one fitted gradient at the evaluated row's geometric bounds, before its live effects. +/// `carries` are the actual object and item passes, in rendering order. Only missing placement +/// fields are returned; explicit coordinates and the row's other data stay unchanged. A map or +/// model that cannot reproduce the original resolved row returns `None`, leaving it fitted. +pub fn pinned_gradient_item(item: &AppearanceItem, bounds: Rect, carries: &[&Carry]) -> Option { + if gradient(item)?.is_placed() { + return Some(item.clone()); + } + if ![bounds.x0, bounds.y0, bounds.x1, bounds.y1].iter().all(|v| v.is_finite()) { + return None; + } + let resolved = resolve(item, bounds, carries); + if !finite_placement(resolved.items.first()?) { + return None; + } + let mut stored = resolved.clone(); + for carry in carries.iter().rev() { + carry.unapply_placed(&mut stored)?; + } + if !finite_placement(stored.items.first()?) { + return None; + } + let candidate = missing_placement(item, stored.items.first()?)?; + let replayed = resolve(&candidate, bounds, carries); + (finite_placement(replayed.items.first()?) && replayed.approx_eq(&resolved)).then_some(candidate) +} + +fn gradient(item: &AppearanceItem) -> Option<&GradientPaint> { + match item.paint() { + Paint::Gradient(g) => Some(g), + _ => None, + } +} + +fn resolve(item: &AppearanceItem, bounds: Rect, carries: &[&Carry]) -> Appearance { + let mut ap = Appearance { items: vec![item.clone()], ..Default::default() }; + for carry in carries { + carry.apply(&mut ap); + } + ap.pin_gradients(bounds); + ap +} + +fn missing_placement(item: &AppearanceItem, placed: &AppearanceItem) -> Option { + let original = gradient(item)?; + let placed = gradient(placed)?; + let mut out = item.clone(); + let Paint::Gradient(g) = out.paint_mut() else { return None }; + if original.geom.is_none() { + g.geom = placed.geom; + } + if original.gradient.kind == GradientKind::Freeform && !original.has_freeform_points() { + let freeform = placed.freeform.as_ref()?; + match &mut g.freeform { + Some(f) => f.points.clone_from(&freeform.points), + None => g.freeform = Some(freeform.clone()), + } + } + Some(out) +} + +fn finite_placement(item: &AppearanceItem) -> bool { + let Some(g) = gradient(item) else { return false }; + g.geom.is_none_or(|v| v.start.is_finite() && v.end.is_finite() && v.aspect.is_finite() && v.focal.is_none_or(|p| p.is_finite())) + && g.freeform.as_ref().is_none_or(|f| f.points.iter().all(|p| p.at.is_finite())) +} diff --git a/crates/effects/src/reshape.rs b/crates/effects/src/reshape.rs index 172eab2348..a7b08215e4 100644 --- a/crates/effects/src/reshape.rs +++ b/crates/effects/src/reshape.rs @@ -3055,7 +3055,7 @@ pub(crate) fn follow_boxes(ap: &mut Appearance, from: Rect, to: Rect) { /// The map that takes box `from` onto box `to` along each axis (along an axis `from` has no extent /// on, a move from its center to `to`'s). -fn box_map(from: Rect, to: Rect) -> vectorcraft_geom::Affine { +pub(crate) fn box_map(from: Rect, to: Rect) -> vectorcraft_geom::Affine { let axis = |a0: f64, a1: f64, b0: f64, b1: f64| { if (a1 - a0).abs() > 1e-12 { let s = (b1 - b0) / (a1 - a0); diff --git a/crates/engine/src/cmd/draw2/cut.rs b/crates/engine/src/cmd/draw2/cut.rs index e3ee153744..c103a9c90d 100644 --- a/crates/engine/src/cmd/draw2/cut.rs +++ b/crates/engine/src/cmd/draw2/cut.rs @@ -517,13 +517,22 @@ fn apply_plan(s: &mut Session, label: &str, plan: Vec<(NodeId, Vec)>) return Ok(json!({ "ids": [] })); } let ids = s.edit(label, |d, sel| { - // Pin paint owners before any member changes their original bounds. - for (id, _) in &plan { - let owner = crate::cmd::path::compound_or_self(d, *id); - for target in [owner, *id] { - if let Some(node) = d.node_mut(target) { - node.pin_gradients(); + // Measure every original painting owner before any geometry or appearance changes. + // This includes a Compound above a Path Eraser target and containers above live art. + let owners: std::collections::BTreeSet<_> = plan.iter().flat_map(|(id, _)| d.ancestry(*id).unwrap_or_default()).collect(); + let pinned: Vec<_> = owners + .into_iter() + .filter_map(|id| { + let node = d.node(id)?; + if !node.appearance.has_unplaced_gradient() { + return None; } + vectorcraft_render::pinned_appearance_for_geometry_edit(d, node).map(|appearance| (id, appearance)) + }) + .collect(); + for (id, appearance) in pinned { + if let Some(node) = d.node_mut(id) { + node.appearance = appearance.into(); } } let mut all = vec![]; diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index 783853943f..5392c1203a 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -881,3 +881,372 @@ fn eraser_gradient_compound_owner_keeps_page_colors_and_holes() { } } } + +fn eraser_container_gradient_fixture(s: &mut Session, placed: bool, nested: bool) -> (NodeId, NodeId, NodeId, Value) { + let mut ids = vec![]; + for anchors in [ + json!([{"x": 100, "y": 100}, {"x": 150, "y": 100}, {"x": 150, "y": 140}, {"x": 100, "y": 140}]), + json!([{"x": 170, "y": 160}, {"x": 220, "y": 160}, {"x": 220, "y": 200}, {"x": 170, "y": 200}]), + ] { + let id = s.execute("path.create", &json!({"anchors": anchors, "closed": true})).unwrap()["id"].as_u64().unwrap(); + s.execute("paint.setFill", &json!({"ids": [id], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id], "none": true})).unwrap(); + ids.push(id); + } + let edited = NodeId(ids[0]); + let sibling = NodeId(ids[1]); + s.execute("select.set", &json!({"ids": ids})).unwrap(); + let inner = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + let owner = if nested { NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()) } else { inner }; + s.execute("appearance.addFill", &json!({"ids": [owner.0], "target": "object"})).unwrap(); + let mut gradient = json!({"kind": "linear", "angle": 90, "dither": false, "stops": [ + {"offset": 0, "color": "#ff0000"}, {"offset": 1, "color": "#0000ff"} + ]}); + if placed { + gradient["start"] = json!([160, 200]); + gradient["end"] = json!([160, 100]); + } + s.execute("appearance.setItem", &json!({"ids": [owner.0], "target": "object", "index": 0, "gradient": gradient})).unwrap(); + let d = &s.doc().unwrap().doc; + let n = d.node(owner).unwrap(); + assert!(matches!(n.kind, NodeKind::Group { clip: false, .. })); + assert_eq!(n.appearance.items.len(), 1, "the Group owns one fill row"); + assert_eq!(n.appearance.contents_at(), 0, "the own fill paints above the children's black fills"); + let vectorcraft_doc::color::Paint::Gradient(g) = n.appearance.fill_paint() else { panic!("the Group itself owns the gradient") }; + assert_eq!(g.geom.is_some(), placed); + assert!(!g.gradient.dither); + let geom = serde_json::to_value(g.geom).unwrap(); + assert_eq!(n.geometric_bounds().unwrap(), vectorcraft_geom::Rect::new(100.0, 100.0, 220.0, 200.0)); + for id in [edited, sibling] { + assert!(!d.node(id).unwrap().appearance.has_unplaced_gradient(), "the gradient is not on a leaf"); + } + assert_eq!(d.parent_of(edited), Some(inner)); + if nested { + assert_eq!(d.parent_of(inner), Some(owner)); + assert!(d.node(inner).unwrap().appearance.items.is_empty(), "the intervening Group has no own paint"); + } + s.execute("select.set", &json!({"ids": [edited.0]})).unwrap(); + (edited, sibling, owner, geom) +} + +fn eraser_container_gradient_restore(s: &mut Session, before: &Value, selection: &vectorcraft_doc::Selection, history: usize) { + let after = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let after_selection = s.doc().unwrap().selection.clone(); + let after_pixels = eraser_gradient_image(s).pixels; + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1, "one erase remains one edit"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), *before); + assert_eq!(&s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), after); + assert_eq!(s.doc().unwrap().selection, after_selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + assert_eq!(eraser_gradient_image(s).pixels, after_pixels); +} + +fn eraser_container_gradient_case(placed: bool, nested: bool) { + let mut s = session(); + let (edited, sibling, owner, geom) = eraser_container_gradient_fixture(&mut s, placed, nested); + let before_image = eraser_gradient_image(&s); + assert_eq!(before_image.pixel(125, 105)[3], 255, "the extremal child really paints the erase region"); + assert_eq!(before_image.pixel(190, 175)[3], 255); + assert_ne!(before_image.pixel(190, 175), before_image.pixel(190, 185), "the owner's paint varies on the untouched sibling"); + assert_ne!(before_image.pixel(190, 175), [0, 0, 0, 255], "the Group's top paint actually covers the black child"); + let before = s.doc().unwrap().doc.clone(); + let before_json = serde_json::to_value(&before).unwrap(); + let sibling_before = serde_json::to_value(before.node(sibling).unwrap()).unwrap(); + let ancestry = before.ancestry(edited).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + let miss = eraser_gradient_region(&mut s, "rect", true, true); + assert_eq!(miss["ids"], json!([])); + assert!(std::sync::Arc::ptr_eq(&s.doc().unwrap().doc, &before), "a miss must not replace any ancestor"); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before_json); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + let result = eraser_gradient_region(&mut s, "rect", true, false); + assert_eq!(result["ids"].as_array().unwrap().len(), 1, "trim keeps one piece, not a split"); + let d = &s.doc().unwrap().doc; + assert_eq!(d.ancestry(edited).unwrap(), ancestry, "the child and every original container retain their roles"); + assert_eq!(serde_json::to_value(d.node(sibling).unwrap()).unwrap(), sibling_before, "the sibling itself was not edited"); + let n = d.node(owner).unwrap(); + assert!(matches!(n.kind, NodeKind::Group { clip: false, .. })); + assert!((n.geometric_bounds().unwrap().y0 - 110.0).abs() < 1e-5, "the owner's original minimum y really shrinks"); + let after_image = eraser_gradient_image(&s); + assert_eq!(after_image.pixel(125, 105)[3], 0, "the intended band is erased through the Group's paint"); + assert_eq!( + after_image.pixel(190, 175), + before_image.pixel(190, 175), + "placed={placed}, nested={nested}: erasing one child must not recolor its untouched sibling" + ); + if placed { + let vectorcraft_doc::color::Paint::Gradient(g) = n.appearance.fill_paint() else { panic!("the own fill stays a gradient") }; + assert_eq!(serde_json::to_value(g.geom).unwrap(), geom, "an explicitly placed owner is not refitted"); + } + eraser_container_gradient_restore(&mut s, &before_json, &selection, history); +} + +#[test] +fn eraser_container_gradient_keeps_untouched_sibling_colors() { + // Positive control runs before the unchanged-product fitted-paint failure. + eraser_container_gradient_case(true, false); + eraser_container_gradient_case(false, false); + eraser_container_gradient_case(false, true); +} + +fn eraser_container_effect_gradient_case(group: bool, placed: bool) { + let mut s = session(); + let (edited, owner, geom) = if group { + let (edited, _, owner, geom) = eraser_container_gradient_fixture(&mut s, placed, false); + (edited, owner, geom) + } else { + let id = marquee_rectangle(&mut s, true, false); + let geom = eraser_gradient_fill(&mut s, id, placed); + (id, id, geom) + }; + s.execute( + "effect.apply", + &json!({ + "ids": [owner.0], "target": "object", "item": null, + "effect": "path.offsetPath", "params": {"offset": 10, "joins": "round"} + }), + ) + .unwrap(); + let d = &s.doc().unwrap().doc; + let n = d.node(owner).unwrap(); + assert_eq!(n.appearance.effects.len(), 1); + let effect = &n.appearance.effects[0]; + assert_eq!(effect.id, "path.offsetPath"); + assert!(effect.visible); + assert_eq!(effect.params["offset"].as_f64(), Some(10.0)); + assert_eq!(effect.params["joins"], json!("round")); + let effect_before = serde_json::to_value(&n.appearance.effects).unwrap(); + let vectorcraft_doc::color::Paint::Gradient(g) = n.appearance.fill_paint() else { panic!("the effect owner really owns the gradient") }; + assert_eq!(g.geom.is_some(), placed); + assert!(!g.gradient.dither); + assert_eq!(g.gradient.stops.len(), 2); + assert_ne!(g.gradient.stops[0].color, g.gradient.stops[1].color, "the own paint is a real nonconstant ramp before rendering"); + let original_bounds = n.geometric_bounds().unwrap(); + assert_eq!((original_bounds.y0, original_bounds.y1), (100.0, 200.0)); + let before_image = eraser_gradient_image(&s); + assert_eq!(before_image.pixel(125, 105)[3], 255); + assert_eq!(before_image.pixel(190, 175)[3], 255); + assert_eq!(before_image.pixel(190, 185)[3], 255); + assert_ne!(before_image.pixel(190, 175), before_image.pixel(190, 185), "the rendered own gradient is nonconstant"); + assert_eq!(before_image.pixel(190, 205)[3], 255, "the live positive offset paints beyond the source's y=200 bounds"); + let before = s.doc().unwrap().doc.clone(); + let before_json = serde_json::to_value(&before).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + let ancestry = before.ancestry(edited).unwrap(); + let miss = s.execute("path.eraseRegion", &json!({"rect": [10, 10, 10, 10]})).unwrap(); + assert_eq!(miss["ids"], json!([])); + assert!(std::sync::Arc::ptr_eq(&s.doc().unwrap().doc, &before)); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + + // Remove 30 pt of source height: the remaining +10 pt live offset cannot + // repaint the cleared (125,105) pixel. The offset itself remains live. + let result = s.execute("path.eraseRegion", &json!({"rect": [50, 80, 200, 50]})).unwrap(); + assert_eq!(result["ids"].as_array().unwrap().len(), 1, "this is a one-piece extremal trim"); + let d = &s.doc().unwrap().doc; + assert_eq!(d.ancestry(edited).unwrap(), ancestry); + let n = d.node(owner).unwrap(); + assert!((n.geometric_bounds().unwrap().y0 - 130.0).abs() < 1e-5, "the original owner bounds really shrink"); + assert_eq!(serde_json::to_value(&n.appearance.effects).unwrap(), effect_before, "the edit must not flatten or remove the live effect"); + let after_image = eraser_gradient_image(&s); + assert_eq!(after_image.pixel(125, 105)[3], 0, "the +10 offset cannot repaint this deliberately deep erased band"); + assert_eq!( + after_image.pixel(190, 175), + before_image.pixel(190, 175), + "group={group}, placed={placed}: freezing the raw Node box must not recolor retained effected art" + ); + if placed { + let vectorcraft_doc::color::Paint::Gradient(g) = n.appearance.fill_paint() else { panic!("the placed fill remains a gradient") }; + assert_eq!(serde_json::to_value(g.geom).unwrap(), geom); + } + eraser_container_gradient_restore(&mut s, &before_json, &selection, history); +} + +#[test] +fn eraser_container_gradient_keeps_evaluated_offset_fit() { + // Establish ordinary legal placement through the SAME live offset first. + eraser_container_effect_gradient_case(true, true); + eraser_container_effect_gradient_case(false, true); + eraser_container_effect_gradient_case(true, false); + eraser_container_effect_gradient_case(false, false); +} + +fn eraser_placement_ramp(placed: bool, bottom: f64, top: f64) -> Value { + let mut gradient = json!({"kind": "linear", "angle": 90, "dither": false, "stops": [ + {"offset": 0, "color": "#ff0000"}, {"offset": 1, "color": "#0000ff"} + ]}); + if placed { + gradient["start"] = json!([160, bottom]); + gradient["end"] = json!([160, top]); + } + gradient +} + +fn eraser_placement_effects(s: &Session, owner: NodeId) -> Value { + let n = s.doc().unwrap().doc.node(owner).unwrap(); + json!({"object": n.appearance.effects, + "items": n.appearance.items.iter().map(|item| item.effects()).collect::>()}) +} + +fn eraser_placement_trim( + s: &mut Session, + edited: NodeId, + owner: NodeId, + clear: (u32, u32), +) -> (vectorcraft_render::Rendered, vectorcraft_render::Rendered) { + let before_image = eraser_gradient_image(s); + assert_eq!(before_image.pixel(clear.0, clear.1)[3], 255, "the actual effected art paints the erase witness"); + let before = s.doc().unwrap().doc.clone(); + let before_json = serde_json::to_value(&before).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + let ancestry = before.ancestry(edited).unwrap(); + let effects = eraser_placement_effects(s, owner); + let bounds = before.node(owner).unwrap().geometric_bounds().unwrap(); + assert_eq!((bounds.y0, bounds.y1), (100.0, 200.0)); + let miss = s.execute("path.eraseRegion", &json!({"rect": [10, 10, 10, 10]})).unwrap(); + assert_eq!(miss["ids"], json!([])); + assert!(std::sync::Arc::ptr_eq(&s.doc().unwrap().doc, &before)); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + let result = s.execute("path.eraseRegion", &json!({"rect": [50, 80, 200, 50]})).unwrap(); + assert_eq!(result["ids"].as_array().unwrap().len(), 1, "the extremal trim keeps one piece"); + let d = &s.doc().unwrap().doc; + assert_eq!(d.ancestry(edited).unwrap(), ancestry); + assert!((d.node(owner).unwrap().geometric_bounds().unwrap().y0 - 130.0).abs() < 1e-5); + assert_eq!(eraser_placement_effects(s, owner), effects, "stored object and item effects stay live and identical"); + let after_image = eraser_gradient_image(s); + assert_eq!(after_image.pixel(clear.0, clear.1)[3], 0, "the witness really leaves the effected art"); + eraser_container_gradient_restore(s, &before_json, &selection, history); + (before_image, after_image) +} + +fn eraser_placement_matches( + placed: &(vectorcraft_render::Rendered, vectorcraft_render::Rendered), + fitted: &(vectorcraft_render::Rendered, vectorcraft_render::Rendered), + samples: &[(u32, u32)], +) { + for &(x, y) in samples { + assert_eq!(placed.0.pixel(x, y)[3], 255); + assert_eq!(placed.1.pixel(x, y)[3], 255, "the equivalent placed control retains the sample"); + assert_eq!(fitted.0.pixel(x, y), placed.0.pixel(x, y), "the public placed vector is equivalent BEFORE the edit at ({x},{y})"); + assert_eq!( + fitted.1.pixel(x, y), + placed.1.pixel(x, y), + "fitted and equivalent placed paint follow the SAME live effects AFTER the edit at ({x},{y})" + ); + } + assert_ne!(placed.0.pixel(samples[0].0, samples[0].1), placed.0.pixel(samples[1].0, samples[1].1)); +} + +fn eraser_placement_affine_scene(placed: bool) -> (vectorcraft_render::Rendered, vectorcraft_render::Rendered) { + let mut s = session(); + let (edited, _, owner, _) = eraser_container_gradient_fixture(&mut s, false, false); + // Offset10 makes the original aggregate fit y=90..210. The explicit control + // fixes THAT frame before the following Transform carries it, not the raw box. + s.execute( + "appearance.setItem", + &json!({"ids": [owner.0], "target": "object", "index": 0, + "gradient": eraser_placement_ramp(placed, 210.0, 90.0)}), + ) + .unwrap(); + s.execute( + "effect.apply", + &json!({"ids": [owner.0], "target": "object", "item": null, + "effect": "path.offsetPath", "params": {"offset": 10, "joins": "round"}}), + ) + .unwrap(); + s.execute( + "effect.apply", + &json!({"ids": [owner.0], "target": "object", "item": null, + "effect": "distort.transform", "params": {"scaleH": 100, "scaleV": 150, + "reference": 8, "objects": true, "copies": 0, "random": false, + "rotate": 0, "moveH": 0, "moveV": 0, "patterns": false, "strokes": false}}), + ) + .unwrap(); + let n = s.doc().unwrap().doc.node(owner).unwrap(); + assert_eq!(n.appearance.effects.len(), 2); + let transform = &n.appearance.effects[1]; + assert_eq!(transform.id, "distort.transform"); + assert!(transform.visible); + assert_eq!(transform.params["scaleV"].as_f64(), Some(150.0)); + assert_eq!(transform.params["reference"].as_f64(), Some(8.0)); + assert_eq!(transform.params["objects"].as_bool(), Some(true)); + assert_eq!(transform.params["copies"].as_f64(), Some(0.0)); + let vectorcraft_doc::color::Paint::Gradient(g) = n.appearance.fill_paint() else { panic!("own Group gradient missing") }; + assert_eq!(g.geom.is_some(), placed); + // Reference8 is the bottom-right of the effected aggregate (230,210), + // unchanged by the top trim. V150 sends the original y90 edge to y30; + // without this actual affine action pixel(125,60) would be transparent. + eraser_placement_trim(&mut s, edited, owner, (125, 60)) +} + +#[test] +fn eraser_placement_control_affine_carry_matches_equivalent_placed() { + let placed = eraser_placement_affine_scene(true); + let fitted = eraser_placement_affine_scene(false); + eraser_placement_matches(&placed, &fitted, &[(190, 175), (190, 185)]); +} + +fn eraser_placement_item_stroke_scene(placed: bool) -> (vectorcraft_render::Rendered, vectorcraft_render::Rendered) { + let mut s = session(); + let id = marquee_rectangle(&mut s, true, false); + s.execute("paint.setFill", &json!({"ids": [id.0], "none": true})).unwrap(); + s.execute("stroke.set", &json!({"ids": [id.0], "weight": 10})).unwrap(); + // The row's +10 geometry expands y100..200 to y90..210; Within stroke + // weight10 fits its gradient to the inflated y85..215 paint box. + s.execute( + "paint.setStroke", + &json!({"ids": [id.0], + "gradient": eraser_placement_ramp(placed, 215.0, 85.0)}), + ) + .unwrap(); + let index = s + .doc() + .unwrap() + .doc + .node(id) + .unwrap() + .appearance + .items + .iter() + .position(|item| matches!(item, vectorcraft_doc::AppearanceItem::Stroke(_))) + .unwrap(); + s.execute("paint.editGradient", &json!({"ids": [id.0], "item": index, "stroke": true, "strokeMode": "within"})).unwrap(); + s.execute( + "effect.apply", + &json!({"ids": [id.0], "target": "object", "item": index, + "effect": "path.offsetPath", "params": {"offset": 10, "joins": "round"}}), + ) + .unwrap(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let n = s.doc().unwrap().doc.node(id).unwrap(); + assert!(matches!(n.kind, NodeKind::Path { .. })); + assert!(n.appearance.fill_paint().is_none()); + assert!(n.appearance.effects.is_empty(), "this effect belongs only to the stroke row"); + let vectorcraft_doc::AppearanceItem::Stroke(st) = &n.appearance.items[index] else { panic!("public stroke row missing") }; + assert_eq!(st.width, 10.0); + assert_eq!(st.gradient_mode, vectorcraft_doc::StrokeGradientMode::Within); + assert!(st.path_gradient().is_none(), "the test excludes Along/Across path-coordinate paint"); + assert_eq!(st.effects.len(), 1); + assert_eq!(st.effects[0].id, "path.offsetPath"); + assert!(st.effects[0].visible); + let vectorcraft_doc::color::Paint::Gradient(g) = &st.paint else { panic!("stroke gradient missing") }; + assert_eq!(g.geom.is_some(), placed); + assert!(!g.gradient.dither); + eraser_placement_trim(&mut s, id, id, (150, 90)) +} + +#[test] +fn eraser_placement_control_item_within_stroke_matches_equivalent_placed() { + let placed = eraser_placement_item_stroke_scene(true); + let fitted = eraser_placement_item_stroke_scene(false); + eraser_placement_matches(&placed, &fitted, &[(210, 175), (210, 185)]); +} diff --git a/crates/render/src/fx.rs b/crates/render/src/fx.rs index 2bf05ef537..9a406639eb 100644 --- a/crates/render/src/fx.rs +++ b/crates/render/src/fx.rs @@ -64,10 +64,13 @@ use crate::{Frame, Renderer, blend_mode, fill_rule, paint}; mod bounds; mod entries; mod pixels; +mod placement; mod predicates; mod raster; mod renderer; +pub use placement::pinned_appearance_for_geometry_edit; + #[cfg(test)] pub(crate) use bounds::visual_bounds; pub(crate) use bounds::{ diff --git a/crates/render/src/fx/placement.rs b/crates/render/src/fx/placement.rs new file mode 100644 index 0000000000..fedb4bc89c --- /dev/null +++ b/crates/render/src/fx/placement.rs @@ -0,0 +1,86 @@ +//! Stored gradient fits for geometry edits on the renderer's ordinary shape/container paths. + +use vectorcraft_color::Paint; +use vectorcraft_doc::{Appearance, AppearanceItem, Document, Effect, Node, NodeKind}; +use vectorcraft_effects::{self as effects, GeomContext}; +use vectorcraft_geom::{BezPath, Rect, Shape}; + +use super::bounds::{apply_carrying, effected_path_carrying, item_effects, node_bezpath}; +use super::predicates::has_non_container_art_fx; +use super::renderer::carried; + +/// Store the current renderer fit of gradients that can be represented by the existing appearance. +/// +/// Alternate materialized art, visible plug-ins, Rasterize and path-coordinate stroke gradients +/// keep their existing fit behavior. An unsupported or non-roundtripping carry also leaves its row +/// unchanged; this neither flattens art nor changes persisted effects. `None` makes no change. +pub fn pinned_appearance_for_geometry_edit(doc: &Document, n: &Node) -> Option { + if !n.appearance.has_unplaced_gradient() || unsupported(n) || has_non_container_art_fx(n) { + return None; + } + match &n.kind { + NodeKind::Group { .. } | NodeKind::Layer { .. } => effects::pinned_container_appearance(doc, n), + NodeKind::Path { guide: false, .. } | NodeKind::Compound { .. } => pinned_shape(doc, n), + _ => None, + } +} + +fn rasterizes(fx: &[Effect]) -> bool { + fx.iter().any(|effect| effect.visible && effect.id == effects::RASTERIZE) +} + +fn unsupported(n: &Node) -> bool { + effects::has_plugin_effect(n) + || rasterizes(&n.appearance.effects) + || n.appearance + .items + .iter() + .any(|item| rasterizes(item.effects()) || matches!(item, AppearanceItem::Stroke(stroke) if stroke.path_gradient().is_some())) +} + +fn unplaced(item: &AppearanceItem) -> bool { + item.visible() && matches!(item.paint(), Paint::Gradient(gradient) if !gradient.is_placed()) +} + +fn pinned_shape(doc: &Document, n: &Node) -> Option { + let bp = node_bezpath(n)?; + let (geometry, object_carry) = effected_path_carrying(doc, n, &bp); + if geometry.elements().is_empty() { + return None; + } + // Share the renderer's actual temporary object carry and skipped-effect flags. + let temporary = carried(n, &object_carry); + let paints = temporary.as_deref().unwrap_or(n); + let context = GeomContext { doc: Some(doc), ..GeomContext::of(paints) }; + let mut appearance = (*n.appearance).clone(); + let mut changed = false; + for (index, original) in n.appearance.items.iter().enumerate().filter(|(_, item)| unplaced(item)) { + // `item` must belong to the same temporary appearance borrowed by `context.item`: + // that lookup uses pointer identity to recover the actual row index/seed. + let item = paints.appearance.items.get(index)?; + let (item_geometry, item_carry) = apply_carrying(item_effects(item), &geometry, &context.item(item)); + let bounds = item_bounds(item, &geometry, &item_geometry, &item_carry)?; + if let Some(pinned) = effects::pinned_gradient_item(original, bounds, &[&object_carry, &item_carry]) { + *appearance.items.get_mut(index)? = pinned; + changed = true; + } + } + changed.then_some(appearance) +} + +/// The same temporary item carry/skipped flags and `ib` choice as `Renderer::paint_items`. +fn item_bounds(item: &AppearanceItem, geometry: &BezPath, item_geometry: &BezPath, carry: &effects::Carry) -> Option { + let mut appearance = Appearance { items: vec![item.clone()], ..Default::default() }; + if !carry.is_empty() && matches!(item.paint(), Paint::Gradient(_)) { + carry.apply(&mut appearance); + } + let mut item = appearance.items.pop()?; + if carry.skipped() { + carry.hide_skipped(item.effects_mut()); + } + Some(if effects::has_geometry(item_effects(&item)) && !item_geometry.elements().is_empty() { + item_geometry.bounding_box() + } else { + geometry.bounding_box() + }) +} diff --git a/crates/render/src/fx/predicates.rs b/crates/render/src/fx/predicates.rs index e4e479b2e5..08bfceb7f2 100644 --- a/crates/render/src/fx/predicates.rs +++ b/crates/render/src/fx/predicates.rs @@ -25,11 +25,20 @@ pub(crate) fn has_fx(n: &Node) -> bool { /// effect copies it with a gradient or changes its fills and strokes ([`effects::has_transform_art`]), /// or is it a group or layer with an appearance of its own (see [`Renderer::draw_object_fx`])? pub(crate) fn has_object_fx(n: &Node) -> bool { + object_fx(n, true) +} + +/// The alternate-art dispatches other than a group or layer's own container appearance. +pub(super) fn has_non_container_art_fx(n: &Node) -> bool { + object_fx(n, false) +} + +fn object_fx(n: &Node, containers: bool) -> bool { (effects::needs_outline(n) && (visible(&n.appearance.effects) || n.projection().is_some())) || effects::has_item_geometry(n) || effects::has_instance_row_raster(n) || effects::has_transform_art(n) - || effects::has_container_appearance(n) + || (containers && effects::has_container_appearance(n)) || effects::has_crop_marks(n) || effects::addons::halftone::has_halftone(n) || effects::has_adjustment(n) diff --git a/crates/render/src/fx/renderer.rs b/crates/render/src/fx/renderer.rs index 0291d998f0..6040b10665 100644 --- a/crates/render/src/fx/renderer.rs +++ b/crates/render/src/fx/renderer.rs @@ -998,7 +998,7 @@ impl Renderer { /// the Transform effects the geometry pass left out hidden ([`effects::Carry::hide_skipped`]), so /// its raster effects and those of its fills and strokes stay with its art; `None` when it stays /// as it is. -fn carried(n: &Node, carry: &effects::Carry) -> Option> { +pub(super) fn carried(n: &Node, carry: &effects::Carry) -> Option> { let moves = carry.moves(&n.appearance); (moves || carry.skipped()).then(|| { let mut m = n.clone(); diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index c49671fd8c..09177dceac 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -43,6 +43,7 @@ use lru::FrameCache; pub use brush_fx::instance_art; pub use changed::{Changed, changed, placed_area, view_pixels}; pub use effects::stroke::width_outline; +pub use fx::pinned_appearance_for_geometry_edit; pub use images::{IMAGE_CACHE_MAX, image_cache_bytes, installed_memory, newly_undecodable, set_image_cache_budget}; pub use live::expand_live; pub use pattern::render_pattern_swatch; diff --git a/docs/gaps.md b/docs/gaps.md index 00b2a96f53..a7d8637dfe 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-15 · **Change:** minor (Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups , or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; 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: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; 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; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups , or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; 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: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; 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; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -330,7 +330,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G11 Correctness bugs in core tools -- **Improved (#6582), fill-only scope:** the Eraser subtracts its swept area or Alt-drag marquee from filled open contours with no visible painted stroke, preserving fill outside the sweep. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. The result keeps the existing path/compound piece structure and whole appearance. Bounds-fitted gradients keep their original placement on retained geometry. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths deliberately retain the outline-splitting behavior from main. Public reference semantics for those stroked paths were not established, and their fill behavior is not claimed fixed here. Focused engine integration tests cover fixed and varied tips and Alt-drag marquees on fill-only open/closed geometry and pixels, compound holes and self-crossing fill, plus painted-stroke paths that keep the outline route and clipping-mask split, empty-mask and Path Eraser controls. Scores and estimates unchanged. +- **Improved (#6582), fill-only scope:** the Eraser subtracts its swept area or Alt-drag marquee from filled open contours with no visible painted stroke, preserving fill outside the sweep. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. The result keeps the existing path/compound piece structure and whole appearance. Bounds-fitted gradients on ordinary paths, compounds, groups and layers keep their original evaluated placement when it can be reproduced in the stored paint. Effects that draw replacement artwork, effect plug-ins, Rasterize, gradients along or across a stroke, and flattened placements or placements that cannot reproduce the original appearance keep their existing fitted behavior. Already placed gradients and live-effect settings are retained; changes to a live effect's geometry can still move its paint. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths deliberately retain the outline-splitting behavior from main. Public reference semantics for those stroked paths were not established, and their fill behavior is not claimed fixed here. Focused engine integration tests cover fixed and varied tips and Alt-drag marquees on fill-only open/closed geometry and pixels, compound holes and self-crossing fill, plus painted-stroke paths that keep the outline route and clipping-mask split, empty-mask and Path Eraser controls. `crates/engine/tests/eraser_open_fill.rs` also includes container-own paint and evaluated-placement regression cases. Scores and estimates unchanged. - **Export-only improvement (#6309):** PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. Broader G11 scope, scores and estimates unchanged. @@ -899,6 +899,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | Date | Change | Summary | |---|---|---| +| 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-14 | minor | Type: Middle Eastern & South Asian and Standard composers per paragraph (#4935): Paragraph panel menu, paragraph styles, `text.setFormat {composer}` and the native file; the Standard composers set Indic, Arabic and Hebrew type glyph by glyph. `.ai`, EPS and PDF files carry no composer. Scores and estimates unchanged. | | 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. | | 2026-11-12 | minor | 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 (the seams of Revolve and of colored lights, and 3D (Classic) Wireframe edges, were already round): no thorns on edge-on facets, and facets with no neighbour now have rounded convex corners ([three-d.md](three-d.md#seams)). Scores and estimates unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index 2d7064bdaf..6347be1fbc 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > > Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865). > @@ -160,7 +160,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule |---|---|---|---| | M0 | Skeleton + vertical slice | ✅ done | — | | M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | -| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; clipping masks retain surviving contours or empty geometry in the same node; bounds-fitted gradients keep their original placement; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | +| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; clipping masks retain surviving contours or empty geometry in the same node; ordinary Group/Layer paints and evaluated gradient placements are preserved when the stored paint reproduces their appearance; replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot be reproduced keep their existing fitting; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | | M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel (its spectrum grows with a resized panel, #8005), Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); | 4–8 | | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | @@ -210,6 +210,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | | 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do, instead of butt caps, miter joins and a miter limit of 10; a glyph filled and then stroked otherwise than the run its fill joined comes in as a run of its own, so the glyphs before it keep their stroke (#7741; `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). Scores and estimates unchanged. | | 2026-11-15 | minor | M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimates unchanged | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 909940215f..3300fb5c79 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-16 · **Change:** minor (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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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-16 · **Change:** minor (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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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). > @@ -249,7 +249,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Area | Weight | Done | Main gaps | One agent (h) | Kind | |---|---:|---:|---|---:|---| | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); deletion splits an ordinary contour into selected sibling objects with bounds-fitted gradients kept in place (#3380, deletion only; `crates/engine/tests/it/delete_path_pieces.rs`); open-path anchor Delete keeps gaps; Select › Start Global Edit finds the paths, compound paths and symbol instances of the selected object's shape (Appearance, Size and artboard options) and gives an edit of one to all of them in proportion, as one undo step (#3521), and on a group the groups like it, an edit inside one reaching the same object in the others (#4939), and a Shift-click on a highlighted match leaves it out; the Align panel menu's Align to Glyph Bounds › Point Text and Area Text measure type by its glyphs' ink for Align and Distribute (#4231); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of rotated copies, transform nuances (no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | estimated; Global Edit regression-tested (`crates/engine/src/tests/globaledit.rs`; Quick Action, menu label and Escape in `panels::properties::tests::start_global_edit_quick_action_and_escape`) | -| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; the Pen, Smart Pen and Curvature tool show the measurement readout with the rubber band off (#7043), score, gaps and hours unchanged; Eraser preserves fill-only open-path area outside fixed and varied tip sweeps and Alt-drag marquees, including compound holes; clipping masks keep their remaining contours and empty-mask role; bounds-fitted gradients keep their original placement; stroked open paths retain main behavior and result structure (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | +| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; the Pen, Smart Pen and Curvature tool show the measurement readout with the rubber band off (#7043), score, gaps and hours unchanged; Eraser preserves fill-only open-path area outside fixed and varied tip sweeps and Alt-drag marquees, including compound holes; clipping masks keep their remaining contours and empty-mask role; ordinary Group/Layer paints and evaluated gradient placements are preserved when the stored paint reproduces their appearance; replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot be reproduced keep their existing fitting; stroked open paths retain main behavior and result structure (#6582; `crates/engine/tests/eraser_open_fill.rs`), score and hours unchanged | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522); Live Paint Bucket face drags, including narrow faces and one Undo, regression-tested (#6373) | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | Eyedropper copies effective character dimensions across text transforms (#6404); 30.0's gradient additions are done (dither, perceptual blending, presets); freeform gradients in SVG/PDF, mixed spot/process gradients in SVG, PDF gradients mixing a spot color with RGB or Lab stops, and dithered spot gradient fills and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, which PDF export writes as images in process colors| 4–7 | estimated; Recolor model selection is available through the engine and MCP (#2520), and the dialog's color sliders (HSB, RGB, CMYK, Lab, Tint for a spot color) edit the selected row's new color in its mode, and the Edit tab's Global Adjust sliders (Saturation, Brightness, Temperature, Luminosity, -100% to 100%) change every recolored color at once (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged; a point on a gradient mesh's outline locates on its edge on every side (#7006: `mesh_locate_takes_a_point_on_any_side_of_the_outline`, `mesh_add_line_exactly_on_the_edge_needs_no_tolerance`), score and hours unchanged; Color panel spectrum grows with the resized panel (#8005) | | Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (ten generated libraries including Tech Circuit, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | @@ -518,7 +518,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Drawing tools | 7 | 85% | rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, the freehand Tool Options' Keep selected, Alt to the Smooth tool, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding (Curvature point display improved, #1236 in part) | 8–13 | | Selection, transform & align tools | 6 | 85% | Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups, transform nuances (the rotated persistent bounding box is done; no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups, transform nuances (the rotated persistent bounding box is done) | 4–6 | -| Drawing tools | 7 | 86% | Eraser preserves fill when cutting fill-only open paths with fixed or varied tips or Alt-drag marquees; painted-stroke paths retain main behavior and clipping masks keep their remaining contours or empty geometry, with bounds-fitted gradient placement preserved (#6582); rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 | +| Drawing tools | 7 | 86% | Eraser preserves fill when cutting fill-only open paths with fixed or varied tips or Alt-drag marquees; painted-stroke paths retain main behavior and clipping masks keep their remaining contours or empty geometry, with reproducible evaluated gradient placement preserved on ordinary paths, compounds, groups and layers (#6582); replacement-art effects, plug-ins/Rasterize, along/across strokes and placements that cannot be reproduced retain fitting; rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 86% | Live Paint gap options, Shape Builder gap detection, options (Tool Options dialog, clicking a stroke in merge mode) and Shift-drag marquee | 3–6 | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 96% | Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); freeform gradients in SVG/PDF and mixed spot/process gradients in SVG (exported as stops; PDF export keeps the spot inks in a DeviceN shading, except next to RGB or Lab stops; dithered fills and Perceptual gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve are written as images in process colors), pattern fills in Expand | 2–4; Eyedropper source reads regression-tested (#1251) | | Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (ten generated in code including Tech Circuit, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | @@ -1200,7 +1200,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Escape while an arc, spiral or grid is dragged out cancels it and puts back the options its keys, Alt and Ctrl/Cmd changed (slope, open or closed, base axis, segments, decay, dividers and skews), so the next drag and the tool's options start from the values before the canceled drag; a drag that is let go keeps them, and an option set with `tool.setOption` during the drag stays. This is VectorCraft's own rule. VectorCraft's own Anchors field in the Ellipse dialog (a click with the Ellipse tool; `shape.ellipse {anchors}`, part of #7840) sets how many smooth anchors the ellipse has, 4 by default; 4 draws a live ellipse, and any other count from 2 to 1000 draws a plain path with the anchors spaced evenly by angle, fitted to the typed width and height. The count last confirmed stays as the Ellipse tool's `anchors` option, and the next Ellipse dialog opens on it (`ellipse_with_four_anchors_is_the_live_ellipse`, `ellipse_anchors_draw_that_many_anchors_on_the_ellipse`, `ellipse_refuses_a_bad_anchor_count`, `the_ellipse_dialog_draws_and_keeps_its_anchor_count`). - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). - The Eraser cuts fill-only open contours as areas (#6582), retaining fill outside its sweep or Alt-drag marquee. An eligible appearance has a visible non-None fill and no visible non-None stroke of positive width. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. Cut pieces keep the existing path/compound representation and whole appearance. Bounds-fitted gradients keep their original placement on retained geometry. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths retain the outline-splitting behavior from main. `crates/engine/tests/eraser_open_fill.rs` covers fixed and varied tips on fill-only open/closed geometry and raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. This deliberately scoped fix does not claim to repair filled-and-stroked open-path fill behavior. Scores and hours are unchanged. + The Eraser cuts fill-only open contours as areas (#6582), retaining fill outside its sweep or Alt-drag marquee. An eligible appearance has a visible non-None fill and no visible non-None stroke of positive width. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. Cut pieces keep the existing path/compound representation and whole appearance. Bounds-fitted gradients on ordinary paths, compounds, groups and layers keep their original evaluated placement when it can be reproduced in the stored paint. Effects that draw replacement artwork, effect plug-ins, Rasterize, gradients along or across a stroke, and flattened placements or placements that cannot reproduce the original appearance keep their existing fitted behavior. Already placed gradients and live-effect settings are retained; changes to a live effect's geometry can still move its paint. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths retain the outline-splitting behavior from main. `crates/engine/tests/eraser_open_fill.rs` covers fixed and varied tips on fill-only open/closed geometry and raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. The same public target includes container-own paint and evaluated-placement regression cases. This deliberately scoped fix does not claim to repair filled-and-stroked open-path fill behavior. Scores and hours are unchanged. A Scissors cut (`path.split`) leaves one of the two new end points selected and the rest of the path unselected, as [Cut paths](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/split-paths.html) and the "Split a path" section of the [CS3 user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) describe: the two end points lie on top of each other, and a Direct Selection drag from them moves the selected one with its handles and no other anchor. A closed path cut once stays one open path. While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. @@ -2647,6 +2647,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | Date | Change | Summary | |---|---|---| +| 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | | 2026-11-14 | minor | Paragraph composers (#4935): `text.setFormat {composer}` and paragraph styles take `singleLine` and `everyLine` (the Middle Eastern & South Asian composers, what all type used and the default) and `standardSingleLine` and `standardEveryLine`, which break lines the same way and set a complex script (Indic, Arabic, Hebrew) glyph by glyph as the font maps its characters, with no conjuncts, reordering, marks placed or joining forms. The choice is per paragraph, saved in the native file only when it is not Every-line, and not written to `.ai`, EPS or PDF files, whose composer setting this app has no recorded format for. Scores and estimates unchanged. Tests `tests::composers`. | | 2026-11-14 | minor | G5: Weather Icons joins Basic Shapes, UI Frames, Map Markers, Inventory Icons and Skill Icons as a sixth built-in symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow; original procedural vector symbols generated in code, no default 9-slice); area score and estimate unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index c4d7ed0cd4..6f0efdb62a 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-16 · **Change:** minor (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-16 · **Change:** minor (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). > @@ -171,7 +171,7 @@ tools, never checked side by side) isn't captured row by row. | Free Transform's Cmd/Ctrl side-shear cursor | done | two arrows passing along the side (ShearH, ShearV), instead of the resize arrow across it | | Live Paint Bucket cursors | partial | a filled bucket over a face a click fills, a brush over an edge it paints, an empty bucket where it paints nothing, following Paint Fills, Paint Strokes and Shift; the Eyedropper with Alt; the crosshair with Use Precise Cursors. No cursor swatch preview | | Cursors of their own for Lasso, Magic Wand, the freehand tools, Shaper, Measure, Print Tiling, the symbolism tools, vertical type, Scissors (over a segment and away), Mesh and Puppet Warp | partial | each tool returns its own cursor and Use Precise Cursors turns them into the crosshair; until they're drawn they borrow the crosshair, the I-beam, the Pen's add cursor or not-allowed | -| Eraser: filled open paths and compound holes | partial | Fill-only open paths preserve fill outside sweeps and Alt-drag marquees and keep compound holes under their fill rule (#6582). Path or Compound clipping masks retain all surviving contours or empty geometry in the same node, preserving the mask role; Path Eraser shares this behavior. Bounds-fitted gradients keep their original placement on retained geometry. Focused engine tests cover fixed and varied tips and Alt-drag marquees on open/closed geometry, raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. Filled-and-stroked open paths retain main behavior; that fill behavior is not claimed fixed. See G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | +| Eraser: filled open paths and compound holes | partial | Fill-only open paths preserve fill outside sweeps and Alt-drag marquees and keep compound holes under their fill rule (#6582). Path or Compound clipping masks retain all surviving contours or empty geometry in the same node, preserving the mask role; Path Eraser shares this behavior. Bounds-fitted gradients on ordinary paths, compounds, groups and layers keep their original evaluated placement when it can be reproduced in the stored paint. Effects that draw replacement artwork, effect plug-ins, Rasterize, gradients along or across a stroke, and flattened placements or placements that cannot reproduce the original appearance keep their existing fitted behavior. Already placed gradients and live-effect settings are retained; changes to a live effect's geometry can still move its paint. Focused engine tests cover fixed and varied tips and Alt-drag marquees on open/closed geometry, raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. `crates/engine/tests/eraser_open_fill.rs` also includes container-own paint and evaluated-placement regression cases. Filled-and-stroked open paths retain main behavior; that fill behavior is not claimed fixed. See G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | | Blob Brush and Eraser: the tip's outline at the pointer | done | before a press and while painting, the outline of the tip (its size, angle and roundness, at the zoom) follows the pointer, black on a white halo, round a small centre dot; `[` / `]` and Tool Options change it at once; precise cursors (Caps Lock) show only the crosshair; it goes when the pointer leaves the canvas, while Cmd/Ctrl lends a selection tool and while Alt lends the Blob Brush the Smooth tool (#4977); `crates/tools/src/draw2/gesture.rs` and its tests While the button is down a round Blob Brush shows the outline of the area it will add, rounded at both ends, not a line as wide as the brush that ends square (#4343). | | Eraser: an Alt-drag draws a marquee and the release erases everything inside it (closed shapes and fill-only open paths lose the rectangle's area, other open paths are cut where they cross its edges); Alt+Shift keeps the marquee square; Escape cancels it, and a click erases nothing | done | `path.eraseRegion {rect}`; [public behavior reference](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=133); `eraser_alt_drag_draws_a_marquee_and_erases_the_rectangle`, `eraser_alt_shift_drag_keeps_the_marquee_square`, `eraser_marquee_click_or_escape_erases_nothing`, `erase_region_rect_erases_everything_inside_it`, `erase_region_rect_refuses_bad_values` | | Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) | @@ -557,6 +557,7 @@ before release (#6373). [Paint faces and edges](https://helpx.adobe.com/illustra | Date | Change | Summary | |---|---|---| +| 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | | 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. | | 2026-11-12 | minor | Numeric fields: a focus click released more than 1 pt from its press keeps the caret; a tap within 1 pt still selects the whole value (#6659, follow-up to #1326). Scores and estimates unchanged. | From a829b54a249d10ca92c11afd2684808b3d633632 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Sun, 15 Nov 2026 23:43:42 -0800 Subject: [PATCH 039/158] M2: ignore hidden Rasterize and path-gradient rows --- crates/engine/tests/eraser_open_fill.rs | 96 +++++++++++++++++++++++++ crates/render/src/fx/placement.rs | 7 +- docs/gaps.md | 5 +- docs/roadmap.md | 5 +- docs/target-app-parity.md | 5 +- docs/ui-parity.md | 5 +- 6 files changed, 111 insertions(+), 12 deletions(-) diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index 5392c1203a..b00a9ce208 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -1250,3 +1250,99 @@ fn eraser_placement_control_item_within_stroke_matches_equivalent_placed() { let fitted = eraser_placement_item_stroke_scene(false); eraser_placement_matches(&placed, &fitted, &[(210, 175), (210, 185)]); } + +fn eraser_mixed_gradient_hidden_stroke(s: &mut Session, id: NodeId, rasterize: bool) -> usize { + let index = s.doc().unwrap().doc.node(id).unwrap().appearance.items.iter().position(|item| !item.is_fill()).unwrap(); + s.execute( + "appearance.setItem", + &json!({"ids": [id.0], "index": index, "weight": 4, "gradient": { + "kind": "linear", "stops": [{"offset": 0, "color": "#00ff00"}, {"offset": 1, "color": "#ff00ff"}] + }}), + ) + .unwrap(); + let mode = if rasterize { "within" } else { "along" }; + s.execute("paint.editGradient", &json!({"ids": [id.0], "item": index, "stroke": true, "strokeMode": mode})).unwrap(); + if rasterize { + s.execute("effect.apply", &json!({"ids": [id.0], "target": "object", "item": index, "effect": "rasterize", "params": {}})).unwrap(); + } + s.execute("appearance.setItem", &json!({"ids": [id.0], "index": index, "visible": false})).unwrap(); + index +} + +fn eraser_mixed_gradient_rows_case(placed: bool, rasterize: bool) -> ([[u8; 4]; 2], [[u8; 4]; 2]) { + let mut s = session(); + let id = marquee_rectangle(&mut s, false, false); + let placed_geom = eraser_gradient_fill(&mut s, id, placed); + let index = eraser_mixed_gradient_hidden_stroke(&mut s, id, rasterize); + let node = s.doc().unwrap().doc.node(id).unwrap(); + assert!(!path(&s, id).is_closed(), "the fixture exercises the fill-only open-path route"); + assert!(node.appearance.has_drawn_fill()); + let hidden = node.appearance.items[index].clone(); + let vectorcraft_doc::AppearanceItem::Stroke(stroke) = &hidden else { panic!("the explicit row is a stroke") }; + assert!(!stroke.visible); + assert_eq!(stroke.width, 4.0, "the hidden row has a genuine positive stroke weight"); + assert!(matches!(stroke.paint, vectorcraft_doc::color::Paint::Gradient(_))); + assert_eq!(stroke.path_gradient().is_some(), !rasterize, "the two cases isolate the two owner-wide guard branches"); + assert_eq!( + stroke.gradient_mode, + if rasterize { vectorcraft_doc::StrokeGradientMode::Within } else { vectorcraft_doc::StrokeGradientMode::Along } + ); + assert_eq!(stroke.effects.iter().any(|e| e.visible && e.id == "rasterize"), rasterize); + assert!( + node.appearance + .items + .iter() + .all(|item| { !matches!(item, vectorcraft_doc::AppearanceItem::Stroke(st) if st.visible && !st.paint.is_none() && st.width > 0.0) }), + "no visible painted stroke may change Eraser's area eligibility" + ); + let vectorcraft_doc::color::Paint::Gradient(fill) = node.appearance.fill_paint() else { panic!("the visible fill is a gradient") }; + assert_eq!(fill.geom.is_some(), placed); + let before = s.doc().unwrap().doc.clone(); + let before_json = serde_json::to_value(&before).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + let before_image = eraser_gradient_image(&s); + let before_colors = [before_image.pixel(150, 125), before_image.pixel(150, 175)]; + assert!(before_colors.iter().all(|color| color[3] == 255)); + assert_ne!(before_colors[0], before_colors[1], "the visible fill is a genuine nonconstant ramp"); + assert_eq!(before_image.pixel(150, 150)[3], 255); + + let miss = eraser_gradient_region(&mut s, "rect", false, true); + assert_eq!(miss["ids"], json!([])); + assert!(std::sync::Arc::ptr_eq(&s.doc().unwrap().doc, &before)); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before_json); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + + let result = eraser_gradient_region(&mut s, "rect", false, false); + let ids = result["ids"].as_array().unwrap(); + assert_eq!(ids.len(), 2, "the marquee splits the filled area into two retained pieces"); + for value in ids { + let node = s.doc().unwrap().doc.node(NodeId(value.as_u64().unwrap())).unwrap(); + assert_eq!(node.appearance.items[index], hidden, "the unsupported hidden row stays byte-for-byte unchanged"); + if placed { + let vectorcraft_doc::color::Paint::Gradient(fill) = node.appearance.fill_paint() else { panic!("the fill stays a gradient") }; + assert_eq!(serde_json::to_value(fill.geom).unwrap(), placed_geom); + } + } + let after_image = eraser_gradient_image(&s); + assert_eq!(after_image.pixel(150, 150)[3], 0, "the intended fill band is erased"); + let after_colors = [after_image.pixel(150, 125), after_image.pixel(150, 175)]; + eraser_container_gradient_restore(&mut s, &before_json, &selection, history); + (before_colors, after_colors) +} + +#[test] +fn eraser_mixed_gradient_rows_keep_visible_fill_placement() { + let placed_along = eraser_mixed_gradient_rows_case(true, false); + assert_eq!(placed_along.0, placed_along.1, "an explicitly placed fill with hidden Along stroke is the legitimate control"); + let placed_rasterize = eraser_mixed_gradient_rows_case(true, true); + assert_eq!(placed_rasterize.0, placed_rasterize.1, "an explicitly placed fill with a hidden Rasterize row remains unchanged"); + // Finish both fitted scenes, including metadata/no-op/Undo controls, before the shared color assertion. + let fitted_along = eraser_mixed_gradient_rows_case(false, false); + let fitted_rasterize = eraser_mixed_gradient_rows_case(false, true); + assert!( + fitted_along.0 == fitted_along.1 && fitted_rasterize.0 == fitted_rasterize.1, + "hidden rows must not suppress the visible fill's placement: Along {fitted_along:?}; Rasterize {fitted_rasterize:?}" + ); +} diff --git a/crates/render/src/fx/placement.rs b/crates/render/src/fx/placement.rs index fedb4bc89c..eaaa8eb83d 100644 --- a/crates/render/src/fx/placement.rs +++ b/crates/render/src/fx/placement.rs @@ -32,10 +32,9 @@ fn rasterizes(fx: &[Effect]) -> bool { fn unsupported(n: &Node) -> bool { effects::has_plugin_effect(n) || rasterizes(&n.appearance.effects) - || n.appearance - .items - .iter() - .any(|item| rasterizes(item.effects()) || matches!(item, AppearanceItem::Stroke(stroke) if stroke.path_gradient().is_some())) + || n.appearance.items.iter().any(|item| { + item.visible() && (rasterizes(item.effects()) || matches!(item, AppearanceItem::Stroke(stroke) if stroke.path_gradient().is_some())) + }) } fn unplaced(item: &AppearanceItem) -> bool { diff --git a/docs/gaps.md b/docs/gaps.md index a7d8637dfe..78fc176bc9 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups , or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; 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: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; 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; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups , or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; 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: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; 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; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -330,7 +330,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi ## G11 Correctness bugs in core tools -- **Improved (#6582), fill-only scope:** the Eraser subtracts its swept area or Alt-drag marquee from filled open contours with no visible painted stroke, preserving fill outside the sweep. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. The result keeps the existing path/compound piece structure and whole appearance. Bounds-fitted gradients on ordinary paths, compounds, groups and layers keep their original evaluated placement when it can be reproduced in the stored paint. Effects that draw replacement artwork, effect plug-ins, Rasterize, gradients along or across a stroke, and flattened placements or placements that cannot reproduce the original appearance keep their existing fitted behavior. Already placed gradients and live-effect settings are retained; changes to a live effect's geometry can still move its paint. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths deliberately retain the outline-splitting behavior from main. Public reference semantics for those stroked paths were not established, and their fill behavior is not claimed fixed here. Focused engine integration tests cover fixed and varied tips and Alt-drag marquees on fill-only open/closed geometry and pixels, compound holes and self-crossing fill, plus painted-stroke paths that keep the outline route and clipping-mask split, empty-mask and Path Eraser controls. `crates/engine/tests/eraser_open_fill.rs` also includes container-own paint and evaluated-placement regression cases. Scores and estimates unchanged. +- **Improved (#6582), fill-only scope:** the Eraser subtracts its swept area or Alt-drag marquee from filled open contours with no visible painted stroke, preserving fill outside the sweep. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. The result keeps the existing path/compound piece structure and whole appearance. Bounds-fitted gradients on ordinary paths, compounds, groups and layers keep their original evaluated placement when it can be reproduced in the stored paint. Effects that draw replacement artwork, effect plug-ins, Rasterize, gradients along or across a stroke, and flattened placements or placements that cannot reproduce the original appearance keep their existing fitted behavior. Hidden Rasterize rows and hidden strokes with gradients along or across their paths do not block preserving a visible gradient. Already placed gradients and live-effect settings are retained; changes to a live effect's geometry can still move its paint. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths deliberately retain the outline-splitting behavior from main. Public reference semantics for those stroked paths were not established, and their fill behavior is not claimed fixed here. Focused engine integration tests cover fixed and varied tips and Alt-drag marquees on fill-only open/closed geometry and pixels, compound holes and self-crossing fill, plus painted-stroke paths that keep the outline route and clipping-mask split, empty-mask and Path Eraser controls. `crates/engine/tests/eraser_open_fill.rs` also includes container-own paint and evaluated-placement regression cases. Scores and estimates unchanged. - **Export-only improvement (#6309):** PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. Broader G11 scope, scores and estimates unchanged. @@ -899,6 +899,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | Date | Change | Summary | |---|---|---| +| 2026-11-16 | minor | Eraser review (#6582): hidden Rasterize rows and hidden strokes with gradients along or across their paths do not block preserving visible fitted gradients. Visible unsupported paint branches retain existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-14 | minor | Type: Middle Eastern & South Asian and Standard composers per paragraph (#4935): Paragraph panel menu, paragraph styles, `text.setFormat {composer}` and the native file; the Standard composers set Indic, Arabic and Hebrew type glyph by glyph. `.ai`, EPS and PDF files carry no composer. Scores and estimates unchanged. | | 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index 6347be1fbc..d9c6b9e3f3 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > > Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865). > @@ -160,7 +160,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule |---|---|---|---| | M0 | Skeleton + vertical slice | ✅ done | — | | M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | -| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; clipping masks retain surviving contours or empty geometry in the same node; ordinary Group/Layer paints and evaluated gradient placements are preserved when the stored paint reproduces their appearance; replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot be reproduced keep their existing fitting; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | +| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; clipping masks retain surviving contours or empty geometry in the same node; ordinary Group/Layer paints and evaluated gradient placements are preserved when the stored paint reproduces their appearance; hidden Rasterize and Along/Across stroke rows do not block visible gradients; replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot be reproduced keep their existing fitting; stroked open paths retain main behavior (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | | M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel (its spectrum grows with a resized panel, #8005), Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); | 4–8 | | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | @@ -210,6 +210,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-11-16 | minor | Eraser review (#6582): hidden Rasterize rows and hidden strokes with gradients along or across their paths do not block preserving visible fitted gradients. Visible unsupported paint branches retain existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | | 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do, instead of butt caps, miter joins and a miter limit of 10; a glyph filled and then stroked otherwise than the run its fill joined comes in as a run of its own, so the glyphs before it keep their stroke (#7741; `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). Scores and estimates unchanged. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 3300fb5c79..6de426bd3f 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-16 · **Change:** minor (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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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-16 · **Change:** minor (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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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). > @@ -1200,7 +1200,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Escape while an arc, spiral or grid is dragged out cancels it and puts back the options its keys, Alt and Ctrl/Cmd changed (slope, open or closed, base axis, segments, decay, dividers and skews), so the next drag and the tool's options start from the values before the canceled drag; a drag that is let go keeps them, and an option set with `tool.setOption` during the drag stays. This is VectorCraft's own rule. VectorCraft's own Anchors field in the Ellipse dialog (a click with the Ellipse tool; `shape.ellipse {anchors}`, part of #7840) sets how many smooth anchors the ellipse has, 4 by default; 4 draws a live ellipse, and any other count from 2 to 1000 draws a plain path with the anchors spaced evenly by angle, fitted to the typed width and height. The count last confirmed stays as the Ellipse tool's `anchors` option, and the next Ellipse dialog opens on it (`ellipse_with_four_anchors_is_the_live_ellipse`, `ellipse_anchors_draw_that_many_anchors_on_the_ellipse`, `ellipse_refuses_a_bad_anchor_count`, `the_ellipse_dialog_draws_and_keeps_its_anchor_count`). - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). - The Eraser cuts fill-only open contours as areas (#6582), retaining fill outside its sweep or Alt-drag marquee. An eligible appearance has a visible non-None fill and no visible non-None stroke of positive width. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. Cut pieces keep the existing path/compound representation and whole appearance. Bounds-fitted gradients on ordinary paths, compounds, groups and layers keep their original evaluated placement when it can be reproduced in the stored paint. Effects that draw replacement artwork, effect plug-ins, Rasterize, gradients along or across a stroke, and flattened placements or placements that cannot reproduce the original appearance keep their existing fitted behavior. Already placed gradients and live-effect settings are retained; changes to a live effect's geometry can still move its paint. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths retain the outline-splitting behavior from main. `crates/engine/tests/eraser_open_fill.rs` covers fixed and varied tips on fill-only open/closed geometry and raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. The same public target includes container-own paint and evaluated-placement regression cases. This deliberately scoped fix does not claim to repair filled-and-stroked open-path fill behavior. Scores and hours are unchanged. + The Eraser cuts fill-only open contours as areas (#6582), retaining fill outside its sweep or Alt-drag marquee. An eligible appearance has a visible non-None fill and no visible non-None stroke of positive width. Fill-only open compound members are cut together under their compound fill rule so holes stay empty. Cut pieces keep the existing path/compound representation and whole appearance. Bounds-fitted gradients on ordinary paths, compounds, groups and layers keep their original evaluated placement when it can be reproduced in the stored paint. Effects that draw replacement artwork, effect plug-ins, Rasterize, gradients along or across a stroke, and flattened placements or placements that cannot reproduce the original appearance keep their existing fitted behavior. Hidden Rasterize rows and hidden strokes with gradients along or across their paths do not block preserving a visible gradient. Already placed gradients and live-effect settings are retained; changes to a live effect's geometry can still move its paint. Path or Compound clipping masks keep every surviving contour in the same mask node; full erasure leaves an empty mask without promoting clipped contents. The mask identity, fill rule, appearance and parent child order are retained. Path Eraser uses the same preservation of the clipping role. Filled-and-stroked open paths retain the outline-splitting behavior from main. `crates/engine/tests/eraser_open_fill.rs` covers fixed and varied tips on fill-only open/closed geometry and raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. The same public target includes container-own paint and evaluated-placement regression cases. This deliberately scoped fix does not claim to repair filled-and-stroked open-path fill behavior. Scores and hours are unchanged. A Scissors cut (`path.split`) leaves one of the two new end points selected and the rest of the path unselected, as [Cut paths](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/split-paths.html) and the "Split a path" section of the [CS3 user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) describe: the two end points lie on top of each other, and a Direct Selection drag from them moves the selected one with its handles and no other anchor. A closed path cut once stays one open path. While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. @@ -2647,6 +2647,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | Date | Change | Summary | |---|---|---| +| 2026-11-16 | minor | Eraser review (#6582): hidden Rasterize rows and hidden strokes with gradients along or across their paths do not block preserving visible fitted gradients. Visible unsupported paint branches retain existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | | 2026-11-14 | minor | Paragraph composers (#4935): `text.setFormat {composer}` and paragraph styles take `singleLine` and `everyLine` (the Middle Eastern & South Asian composers, what all type used and the default) and `standardSingleLine` and `standardEveryLine`, which break lines the same way and set a complex script (Indic, Arabic, Hebrew) glyph by glyph as the font maps its characters, with no conjuncts, reordering, marks placed or joining forms. The choice is per paragraph, saved in the native file only when it is not Every-line, and not written to `.ai`, EPS or PDF files, whose composer setting this app has no recorded format for. Scores and estimates unchanged. Tests `tests::composers`. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 6f0efdb62a..7313b34d3e 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-16 · **Change:** minor (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-16 · **Change:** minor (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). > @@ -171,7 +171,7 @@ tools, never checked side by side) isn't captured row by row. | Free Transform's Cmd/Ctrl side-shear cursor | done | two arrows passing along the side (ShearH, ShearV), instead of the resize arrow across it | | Live Paint Bucket cursors | partial | a filled bucket over a face a click fills, a brush over an edge it paints, an empty bucket where it paints nothing, following Paint Fills, Paint Strokes and Shift; the Eyedropper with Alt; the crosshair with Use Precise Cursors. No cursor swatch preview | | Cursors of their own for Lasso, Magic Wand, the freehand tools, Shaper, Measure, Print Tiling, the symbolism tools, vertical type, Scissors (over a segment and away), Mesh and Puppet Warp | partial | each tool returns its own cursor and Use Precise Cursors turns them into the crosshair; until they're drawn they borrow the crosshair, the I-beam, the Pen's add cursor or not-allowed | -| Eraser: filled open paths and compound holes | partial | Fill-only open paths preserve fill outside sweeps and Alt-drag marquees and keep compound holes under their fill rule (#6582). Path or Compound clipping masks retain all surviving contours or empty geometry in the same node, preserving the mask role; Path Eraser shares this behavior. Bounds-fitted gradients on ordinary paths, compounds, groups and layers keep their original evaluated placement when it can be reproduced in the stored paint. Effects that draw replacement artwork, effect plug-ins, Rasterize, gradients along or across a stroke, and flattened placements or placements that cannot reproduce the original appearance keep their existing fitted behavior. Already placed gradients and live-effect settings are retained; changes to a live effect's geometry can still move its paint. Focused engine tests cover fixed and varied tips and Alt-drag marquees on open/closed geometry, raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. `crates/engine/tests/eraser_open_fill.rs` also includes container-own paint and evaluated-placement regression cases. Filled-and-stroked open paths retain main behavior; that fill behavior is not claimed fixed. See G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | +| Eraser: filled open paths and compound holes | partial | Fill-only open paths preserve fill outside sweeps and Alt-drag marquees and keep compound holes under their fill rule (#6582). Path or Compound clipping masks retain all surviving contours or empty geometry in the same node, preserving the mask role; Path Eraser shares this behavior. Bounds-fitted gradients on ordinary paths, compounds, groups and layers keep their original evaluated placement when it can be reproduced in the stored paint. Effects that draw replacement artwork, effect plug-ins, Rasterize, gradients along or across a stroke, and flattened placements or placements that cannot reproduce the original appearance keep their existing fitted behavior. Hidden Rasterize rows and hidden strokes with gradients along or across their paths do not block preserving a visible gradient. Already placed gradients and live-effect settings are retained; changes to a live effect's geometry can still move its paint. Focused engine tests cover fixed and varied tips and Alt-drag marquees on open/closed geometry, raster output, compound holes and self-crossing fill, plus a painted-stroke outline control and clipping-mask split, empty-mask and Path Eraser cases. `crates/engine/tests/eraser_open_fill.rs` also includes container-own paint and evaluated-placement regression cases. Filled-and-stroked open paths retain main behavior; that fill behavior is not claimed fixed. See G11 in [gaps.md](gaps.md#g11-correctness-bugs-in-core-tools). | | Blob Brush and Eraser: the tip's outline at the pointer | done | before a press and while painting, the outline of the tip (its size, angle and roundness, at the zoom) follows the pointer, black on a white halo, round a small centre dot; `[` / `]` and Tool Options change it at once; precise cursors (Caps Lock) show only the crosshair; it goes when the pointer leaves the canvas, while Cmd/Ctrl lends a selection tool and while Alt lends the Blob Brush the Smooth tool (#4977); `crates/tools/src/draw2/gesture.rs` and its tests While the button is down a round Blob Brush shows the outline of the area it will add, rounded at both ends, not a line as wide as the brush that ends square (#4343). | | Eraser: an Alt-drag draws a marquee and the release erases everything inside it (closed shapes and fill-only open paths lose the rectangle's area, other open paths are cut where they cross its edges); Alt+Shift keeps the marquee square; Escape cancels it, and a click erases nothing | done | `path.eraseRegion {rect}`; [public behavior reference](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=133); `eraser_alt_drag_draws_a_marquee_and_erases_the_rectangle`, `eraser_alt_shift_drag_keeps_the_marquee_square`, `eraser_marquee_click_or_escape_erases_nothing`, `erase_region_rect_erases_everything_inside_it`, `erase_region_rect_refuses_bad_values` | | Busy cursor during long operations | done | Background open, save and export show the system progress cursor (gap G1) | @@ -557,6 +557,7 @@ before release (#6373). [Paint faces and edges](https://helpx.adobe.com/illustra | Date | Change | Summary | |---|---|---| +| 2026-11-16 | minor | Eraser review (#6582): hidden Rasterize rows and hidden strokes with gradients along or across their paths do not block preserving visible fitted gradients. Visible unsupported paint branches retain existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | | 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. | From 07743712508cc30180b3e5b64842ee42740daf4c Mon Sep 17 00:00:00 2001 From: yoriswind Date: Mon, 16 Nov 2026 10:57:58 -0800 Subject: [PATCH 040/158] #6582: preserve straight fill closure during erasure --- crates/engine/src/cmd/draw2/cut.rs | 20 ++++++ crates/engine/tests/eraser_open_fill.rs | 87 +++++++++++++++++++++++++ 2 files changed, 107 insertions(+) diff --git a/crates/engine/src/cmd/draw2/cut.rs b/crates/engine/src/cmd/draw2/cut.rs index 747f5f710f..8a9c5d039e 100644 --- a/crates/engine/src/cmd/draw2/cut.rs +++ b/crates/engine/src/cmd/draw2/cut.rs @@ -343,6 +343,7 @@ pub(super) fn erase_region(s: &mut Session, p: &Value) -> Result { let mut plan: Vec<(NodeId, Vec)> = vec![]; for (id, pd, rule) in fill_targets(&st.doc, &st.selection, poly_bounds(&pts, reach), true)? { if erase_as_area(&st.doc, id, &pd) { + let pd = eraser_fill_operand(pd); if po::area(&po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Intersect), FillRule::NonZero) <= 1e-6 { continue; } @@ -364,6 +365,23 @@ fn erase_as_area(doc: &Document, id: NodeId, pd: &PathData) -> bool { pd.is_closed() || filled_open } +/// Close only Eraser's temporary fill operand, preserving an open path's straight closing edge. +fn eraser_fill_operand(mut pd: PathData) -> PathData { + for sp in &mut pd.subpaths { + if !sp.closed { + // These endpoint handles are unused by an open path. Closing it must not activate them. + if let Some(first) = sp.anchors.first_mut() { + first.h_in = first.p; + } + if let Some(last) = sp.anchors.last_mut() { + last.h_out = last.p; + } + sp.closed = true; + } + } + pd +} + /// `path.eraseRegion`'s `rect: [x, y, width, height]`: four finite numbers, with a width and a /// height above 0. fn marquee_param(v: &Value, cmd: &str) -> Result { @@ -405,6 +423,7 @@ fn erase_rect(s: &mut Session, r: Rect) -> Result { let mut plan: Vec<(NodeId, Vec)> = vec![]; for (id, pd, rule) in fill_targets(&st.doc, &st.selection, r, true)? { if erase_as_area(&st.doc, id, &pd) { + let pd = eraser_fill_operand(pd); if po::area(&po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Intersect), FillRule::NonZero) <= 1e-6 { continue; } @@ -505,6 +524,7 @@ fn erase_varied(s: &mut Session, samples: &[Sample], tip: [f64; 3], vary: [(Vari let mut plan: Vec<(NodeId, Vec)> = vec![]; for (id, pd, rule) in fill_targets(&st.doc, &st.selection, poly_bounds(&pts, reach), true)? { if erase_as_area(&st.doc, id, &pd) { + let pd = eraser_fill_operand(pd); if po::area(&po::boolean(&pd, rule, ®ion, FillRule::NonZero, BoolOp::Intersect), FillRule::NonZero) <= 1e-6 { continue; } diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index b00a9ce208..f36208e8ad 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -1346,3 +1346,90 @@ fn eraser_mixed_gradient_rows_keep_visible_fill_placement() { "hidden rows must not suppress the visible fill's placement: Along {fitted_along:?}; Rasterize {fitted_rasterize:?}" ); } + +fn eraser_endpoint_region(s: &mut Session, mode: &str, miss: bool) -> Value { + if mode == "rect" { + let rect = if miss { json!([55, 145, 10, 10]) } else { json!([150, 140, 20, 20]) }; + s.execute("path.eraseRegion", &json!({"rect": rect})).unwrap() + } else { + let points = if miss { json!([[60, 150]]) } else { json!([[160, 150]]) }; + erase(s, json!({"points": points, "size": 20}), mode == "varied") + } +} + +fn eraser_keeps_unused_endpoint_handles_out_of_fill_case(mode: &str) { + for (closed, stroked) in [(false, false), (true, false), (false, true)] { + let mut s = session(); + let id = NodeId( + s.execute( + "path.create", + &json!({"closed": closed, "anchors": [ + {"x": 100, "y": 100, "in": [0, 100]}, {"x": 200, "y": 100}, + {"x": 200, "y": 200}, {"x": 100, "y": 200, "out": [0, 200]} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + if stroked { + s.execute("paint.setFill", &json!({"ids": [id.0], "none": true})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [id.0], "weight": 4})).unwrap(); + } else { + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#000000"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "none": true})).unwrap(); + } + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let sp = &path(&s, id).subpaths[0]; + assert_eq!(sp.closed, closed); + assert_eq!(sp.anchors.first().unwrap().h_in, Point::new(0.0, 100.0)); + assert_eq!(sp.anchors.last().unwrap().h_out, Point::new(0.0, 200.0)); + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let selection = s.doc().unwrap().selection.clone(); + let history = s.doc().unwrap().history.undo.len(); + let before_image = eraser_gradient_image(&s); + assert_eq!(before_image.pixel(60, 150)[3], if closed { 255 } else { 0 }, "{mode}: fixture closure"); + assert_eq!(before_image.pixel(160, 150)[3], if stroked { 0 } else { 255 }, "{mode}: interior witness"); + + let result = eraser_endpoint_region(&mut s, mode, false); + let after_image = eraser_gradient_image(&s); + assert_eq!(after_image.pixel(160, 150)[3], 0, "{mode}: erased interior"); + assert_eq!(after_image.pixel(60, 150), before_image.pixel(60, 150), "{mode}: no new bulge or lost closed curve"); + if stroked { + assert_eq!(result["ids"], json!([]), "{mode}: the open outline misses an interior dab"); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + continue; + } + assert_eq!(after_image.pixel(180, 180), [0, 0, 0, 255], "{mode}: retained fill"); + assert_eq!(s.doc().unwrap().history.undo.len(), history + 1); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before, "{mode}: original geometry and endpoint handles restored"); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + if !closed { + let miss = eraser_endpoint_region(&mut s, mode, true); + assert_eq!(miss["ids"], json!([]), "{mode}: the phantom bulge cannot count as an intersection"); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + } + } +} + +#[test] +fn eraser_keeps_unused_endpoint_handles_out_of_fill_marquee() { + eraser_keeps_unused_endpoint_handles_out_of_fill_case("rect"); +} + +#[test] +fn eraser_keeps_unused_endpoint_handles_out_of_fill_fixed_tip() { + eraser_keeps_unused_endpoint_handles_out_of_fill_case("fixed"); +} + +#[test] +fn eraser_keeps_unused_endpoint_handles_out_of_fill_varied_tip() { + eraser_keeps_unused_endpoint_handles_out_of_fill_case("varied"); +} From 3addb0940fc608bcaafd1e4e66c4ae0533cf7127 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 14:06:47 -0800 Subject: [PATCH 041/158] Shapes: dragging a live polygon's side widget changes its number of sides A selected live polygon shows a small diamond beside the middle of the right side of its bounding box, with the Selection tool and with the Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools, while the bounding box and edges are shown. Dragging it sets the side count from 3 to 11: down adds a side and up removes one for every 12 screen pixels along the box's own vertical axis, and the pointer shows the count while measurement labels are on. A polygon of more than 11 sides keeps its count until the drag goes up, which gives it 11. The drag sends object.setLiveShape {sides} in one undo step, none when the count ends where it began, and Escape puts the count back. Typed counts keep their 3 to 1000 range. The widget is drawn only while the box is drawn, so it hides during a move, a turn and its own drag. The help page describes the widget and its 3 to 11 range: https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/add-or-remove-sides-from-polygons.html The widget's look and place, the drag direction, the step and the rule for more than 11 sides are VectorCraft's own. Docs: docs/target-app-parity.md and docs/ui-parity.md. --- crates/mcp/src/tests/shapewidgets.rs | 43 +++- crates/tools/src/lib.rs | 1 + crates/tools/src/select.rs | 33 ++- crates/tools/src/shape.rs | 23 +- crates/tools/src/shape/tests.rs | 45 ++++ crates/tools/src/sidewidget.rs | 348 ++++++++++++++++++++++++++ crates/ui-egui/src/canvas/overlays.rs | 7 + crates/ui-egui/src/canvas/tests.rs | 42 ++++ docs/target-app-parity.md | 1 + docs/ui-parity.md | 1 + 10 files changed, 533 insertions(+), 11 deletions(-) create mode 100644 crates/tools/src/sidewidget.rs diff --git a/crates/mcp/src/tests/shapewidgets.rs b/crates/mcp/src/tests/shapewidgets.rs index 3ef209efab..ce8eaea001 100644 --- a/crates/mcp/src/tests/shapewidgets.rs +++ b/crates/mcp/src/tests/shapewidgets.rs @@ -1,5 +1,6 @@ -//! A shape tool's double-click on a selected live shape's corner widget through MCP: the -//! gesture's `requests` carry the Transform panel. +//! Live shape widgets through MCP: a shape tool's double-click on a selected live shape's corner +//! widget, whose gesture's `requests` carry the Transform panel, and a drag on a live polygon's +//! side widget. use serde_json::{Value, json}; use vectorcraft_tools::corners::CornerWidgets; @@ -28,3 +29,41 @@ fn a_corner_widget_double_click_with_a_shape_tool_requests_the_transform_panel() let off = ok(&mut h, "pointer_gesture", json!({"events": [{"kind": "doubleclick", "x": 280, "y": 280}]})); assert_eq!(off["requests"], json!([]), "{off}"); } + +/// The selected live polygon's sides, radius and transform. +fn polygon(h: &mut Headless) -> (u32, f64, vectorcraft_geom::Affine) { + let st = h.session.doc().unwrap(); + let id = st.selection.objects[0]; + let vectorcraft_doc::NodeKind::Path { live, .. } = &st.doc.node(id).unwrap().kind else { panic!("not a path") }; + let Some(vectorcraft_doc::LiveShape::Polygon { sides, radius, xf, .. }) = live.as_deref() else { panic!("not a live polygon: {live:?}") }; + (*sides, *radius, *xf) +} + +/// A drag down on a live polygon's side widget with the Selection tool gives it more sides in one +/// undo step, keeping its radius and transform; undo puts the count back. +#[test] +fn a_side_widget_drag_changes_a_polygons_sides_in_one_undo_step() { + let mut h = Headless::new(); + h.call("engine.execute", json!({"command": "file.new", "params": {"width": 300, "height": 300}})).unwrap(); + h.call("engine.execute", json!({"command": "shape.polygon", "params": {"cx": 150, "cy": 150, "radius": 60, "sides": 5}})).unwrap(); + let st = h.session.doc().unwrap(); + let id = st.selection.objects[0]; + let b = st.doc.node(id).unwrap().geometric_bounds_with(&st.doc.symbol_boxes()).expect("bounds"); + let bx = vectorcraft_doc::OrientedBox::aligned(b); + let w = vectorcraft_tools::sidewidget::SideWidget::of(&st.doc, &st.selection, &bx, h.view.zoom).expect("a side widget"); + let steps = st.history.undo.len(); + let before = polygon(&mut h); + assert_eq!(before.0, 5); + let zoom = h.view.zoom; + let ev = |kind: &str, dy: f64| json!({"kind": kind, "x": w.at.x, "y": w.at.y + dy / zoom}); + ok(&mut h, "pointer_gesture", json!({"tool": "selection", "events": [ev("down", 0.0), ev("drag", 13.0), ev("drag", 25.0), ev("up", 25.0)]})); + let after = polygon(&mut h); + assert_eq!((after.0, after.1, after.2), (7, before.1, before.2)); + assert_eq!(h.session.doc().unwrap().history.undo.len(), steps + 1, "one undo step"); + h.call("engine.execute", json!({"command": "edit.undo", "params": {}})).unwrap(); + assert_eq!(polygon(&mut h), before); + // A drag that comes back to the start leaves no undo step. + ok(&mut h, "pointer_gesture", json!({"tool": "selection", "events": [ev("down", 0.0), ev("drag", 25.0), ev("drag", 0.0), ev("up", 0.0)]})); + assert_eq!(polygon(&mut h), before); + assert_eq!(h.session.doc().unwrap().history.undo.len(), steps); +} diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index 07579cd456..5cd110b989 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -40,6 +40,7 @@ pub mod select; pub mod settings; pub mod shape; pub mod shaperwidget; +pub mod sidewidget; pub mod slice; pub mod symbolism; pub mod text; diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs index 543f9c7bb1..6735674487 100644 --- a/crates/tools/src/select.rs +++ b/crates/tools/src/select.rs @@ -53,6 +53,7 @@ use crate::pathtype::{self, BracketDrag, over_bracket}; use crate::pie::{self, PieDrag}; use crate::rulerguide::GuideEdit; use crate::shaperwidget; +use crate::sidewidget::{self, SideDrag}; use crate::typewidget; use crate::{Action, Cursor, Mods, Overlay, PixelOp, PointerEvent, PointerKind, Tool, ToolContext, ToolKey, json_ids}; @@ -133,6 +134,8 @@ enum State { Corner(CornerDrag), /// Dragging a live ellipse's pie widget. Pie(PieDrag), + /// Dragging a live polygon's side widget. + Sides(SideDrag), /// Dragging a selected blend's Appearance or Easing widget. BlendWidget(BlendWidgetDrag), /// Dragging an Objects on Path group's Rotate All widget. @@ -797,7 +800,7 @@ impl Tool for SelectionTool { /// E during a marquee drag switches the marquee between the objects it touches and only the /// objects inside it. Escape during a drag (a move or an Alt-drag copy, a bounding-box scale or - /// rotation, a marquee, a corner widget, a pie widget, a blend widget, the Rotate All, Space, Move All or Select/Move widget, the brackets of type on a path, a mirror + /// rotation, a marquee, a corner widget, a pie widget, a polygon's side widget, a blend widget, the Rotate All, Space, Move All or Select/Move widget, the brackets of type on a path, a mirror /// axis, a grid repeat's handles, a ruler guide) cancels it: what it changed goes back, no copy /// is left, and the tool waits for the next press. With the pointer loaded with text, Escape /// drops the text. @@ -834,6 +837,12 @@ impl Tool for SelectionTool { { return d.cancel(); } + if key == ToolKey::Escape + && matches!(self.state, State::Sides(_)) + && let State::Sides(d) = std::mem::take(&mut self.state) + { + return d.cancel(); + } if key == ToolKey::Escape && matches!(self.state, State::NineSlice(_)) && let State::NineSlice(d) = std::mem::take(&mut self.state) @@ -917,6 +926,7 @@ impl Tool for SelectionTool { State::Moving { began: true, .. } | State::Scaling { .. } | State::Rotating { .. } => true, State::Corner(c) => c.adjusting(), State::Pie(d) => d.adjusting(), + State::Sides(d) => d.adjusting(), State::BlendWidget(d) => d.adjusting(), State::RotateAll(d) => d.adjusting(), State::Space(d) => d.adjusting(), @@ -1094,6 +1104,15 @@ impl Tool for SelectionTool { self.state = State::Idle; d.finish() } + (PointerKind::Drag, State::Sides(mut d)) => { + let out = d.drag(cx, p); + self.state = State::Sides(d); + out + } + (PointerKind::Up, State::Sides(d)) => { + self.state = State::Idle; + d.finish() + } (PointerKind::Drag, State::BlendWidget(mut d)) => { let out = d.drag(cx, p); self.state = State::BlendWidget(d); @@ -1201,6 +1220,7 @@ impl Tool for SelectionTool { }), State::Corner(c) => o.extend(c.overlays(cx)), State::Pie(d) => o.extend(d.overlays(cx)), + State::Sides(d) => o.extend(d.overlays(cx)), State::BlendWidget(d) => o.extend(d.overlays(cx)), State::RotateAll(d) => o.extend(d.overlays(cx)), State::Space(d) => o.extend(d.overlays(cx)), @@ -1260,7 +1280,7 @@ impl Tool for SelectionTool { State::Moving { began: true, .. } if m.alt => return Cursor::SelectionCopy, State::Moving { began: true, .. } => return if self.snapped { Cursor::ArrowHollow } else { Cursor::Arrow }, State::Corner(_) => return Cursor::CornerRadius, - State::Pie(_) | State::BlendWidget(_) => return Cursor::ArrowHollow, + State::Pie(_) | State::Sides(_) | State::BlendWidget(_) => return Cursor::ArrowHollow, State::RotateAll(_) => return Cursor::Rotate, State::Space(_) => return Cursor::ArrowHollow, State::MoveAll(_) | State::Member(_) => return Cursor::Move, @@ -1283,6 +1303,9 @@ impl Tool for SelectionTool { if near_selected && pie::over_widget(cx, p) { return Cursor::ArrowHollow; } + if sidewidget::over_widget(cx, p) { + return Cursor::ArrowHollow; + } if blendwidget::over_widget(cx, p) { return Cursor::ArrowHollow; } @@ -1674,7 +1697,7 @@ impl SelectionTool { self.state = State::Loaded { from, before: port == crate::text::Port::In, press: None }; return Some(vec![]); } - // 1. Live Corners widgets, pie widgets, blend widgets, the Rotate All, Space, Move All and Select/Move widgets and type on a path's brackets, then the + // 1. Live Corners widgets, pie widgets, a polygon's side widget, blend widgets, the Rotate All, Space, Move All and Select/Move widgets and type on a path's brackets, then the // bounding-box handles of the current selection. if let Some(c) = CornerDrag::hit(cx, ev, false) { self.state = State::Corner(c); @@ -1684,6 +1707,10 @@ impl SelectionTool { self.state = State::Pie(d); return Some(vec![]); } + if let Some(d) = SideDrag::hit(cx, ev) { + self.state = State::Sides(d); + return Some(vec![]); + } if let Some(d) = BlendWidgetDrag::hit(cx, ev) { self.state = State::BlendWidget(d); return Some(vec![]); diff --git a/crates/tools/src/shape.rs b/crates/tools/src/shape.rs index d783a1fede..76c7c9f2bd 100644 --- a/crates/tools/src/shape.rs +++ b/crates/tools/src/shape.rs @@ -17,7 +17,8 @@ //! The selection keeps its bounding box and its Live Shape widgets on show with the Rectangle, //! Rounded Rectangle, Ellipse, Polygon and Star tools, so a shape just drawn can be adjusted at //! once: a drag on a live rectangle's or polygon's corner widget rounds its corners and a drag on -//! a live ellipse's pie widget sets its pie angle, as with the Selection tool; a drag on one of the +//! a live ellipse's pie widget sets its pie angle and a drag on a live polygon's side widget sets +//! its number of sides, as with the Selection tool; a drag on one of the //! box's eight handles scales the selection, a press on the selection's centre point (Show Center) //! moves it, and one just outside a corner of its box turns it about that centre, as the Selection //! tool's handles, centre point and rotate zone do; a press anywhere else draws a new shape (#5477). @@ -35,6 +36,7 @@ use crate::corners::{self, CornerDrag}; use crate::guides::{DrawSnap, Leave, PointSnap, TangentLine, Targets, square}; use crate::pie::{self, PieDrag}; use crate::select::{MoveSnap, handle_cursor, hit_center, is_area_type, matrix_json, rotate_zone, shown_box}; +use crate::sidewidget::{self, SideDrag}; use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey}; /// The largest corner radius the Rounded Rectangle tool draws, points: the range of General › @@ -76,6 +78,7 @@ pub fn shows_shape_widgets(id: &str) -> bool { enum WidgetDrag { Corner(CornerDrag), Pie(PieDrag), + Sides(SideDrag), } /// A drag of the selection itself, taken by a shape tool: a handle of its box scales it, the centre @@ -257,18 +260,21 @@ impl ShapeTool { self.star_ratio = o.star_ratio; } - /// A press on a corner or pie widget of the selection: the drag adjusts it. + /// A press on a corner, pie or side widget of the selection: the drag adjusts it. fn press_widget(&mut self, cx: &ToolContext, ev: &PointerEvent) -> bool { if !shows_shape_widgets(self.id) { return false; } - self.widget = CornerDrag::hit(cx, ev, false).map(WidgetDrag::Corner).or_else(|| PieDrag::hit(cx, ev).map(WidgetDrag::Pie)); + self.widget = CornerDrag::hit(cx, ev, false) + .map(WidgetDrag::Corner) + .or_else(|| PieDrag::hit(cx, ev).map(WidgetDrag::Pie)) + .or_else(|| SideDrag::hit(cx, ev).map(WidgetDrag::Sides)); self.widget.is_some() } - /// Is `p` over a corner or pie widget of the selection that a press would drag? + /// Is `p` over a corner, pie or side widget of the selection that a press would drag? fn over_widget(&self, cx: &ToolContext, p: Point) -> bool { - shows_shape_widgets(self.id) && (corners::over_widget(cx, p, false) || pie::over_widget(cx, p)) + shows_shape_widgets(self.id) && (corners::over_widget(cx, p, false) || pie::over_widget(cx, p) || sidewidget::over_widget(cx, p)) } /// The selection's box, while this tool shows it (the tools that draw a box, with a selection @@ -444,10 +450,12 @@ impl ShapeTool { PointerKind::Drag => match w { WidgetDrag::Corner(c) => c.drag(cx, ev.pos), WidgetDrag::Pie(d) => d.drag(cx, ev.pos), + WidgetDrag::Sides(d) => d.drag(cx, ev.pos), }, PointerKind::Up => match self.widget.take() { Some(WidgetDrag::Corner(c)) => c.finish(), Some(WidgetDrag::Pie(d)) => d.finish(), + Some(WidgetDrag::Sides(d)) => d.finish(), None => vec![], }, _ => vec![], @@ -779,6 +787,7 @@ impl Tool for ShapeTool { (ToolKey::Escape, _) => match self.widget.take() { Some(WidgetDrag::Corner(c)) if c.adjusting() => vec![Action::Cancel], Some(WidgetDrag::Pie(d)) if d.adjusting() => vec![Action::Cancel], + Some(WidgetDrag::Sides(d)) => d.cancel(), _ => vec![], }, _ => vec![], @@ -849,6 +858,7 @@ impl Tool for ShapeTool { match &self.widget { Some(WidgetDrag::Corner(c)) => c.adjusting(), Some(WidgetDrag::Pie(d)) => d.adjusting(), + Some(WidgetDrag::Sides(d)) => d.adjusting(), None => match &self.selection { Some(SelectionDrag::Move { began, .. }) => *began, Some(SelectionDrag::Rotate { .. } | SelectionDrag::Scale { .. }) => true, @@ -871,6 +881,7 @@ impl Tool for ShapeTool { match &self.widget { Some(WidgetDrag::Corner(c)) => return c.overlays(cx), Some(WidgetDrag::Pie(d)) => return d.overlays(cx), + Some(WidgetDrag::Sides(d)) => return d.overlays(cx), None => {} } // A line on a common tangent shows that snap's guides, and its length and angle. @@ -921,7 +932,7 @@ impl Tool for ShapeTool { let idle = self.start.is_none(); match &self.widget { Some(WidgetDrag::Corner(_)) => return Cursor::CornerRadius, - Some(WidgetDrag::Pie(_)) => return Cursor::ArrowHollow, + Some(WidgetDrag::Pie(_) | WidgetDrag::Sides(_)) => return Cursor::ArrowHollow, None => {} } // Alt-dragging the selection leaves a copy behind; otherwise the arrow, hollow while the diff --git a/crates/tools/src/shape/tests.rs b/crates/tools/src/shape/tests.rs index 274a00bdbf..2252b8bd67 100644 --- a/crates/tools/src/shape/tests.rs +++ b/crates/tools/src/shape/tests.rs @@ -1103,6 +1103,51 @@ fn a_shape_tool_drags_the_selected_shapes_widgets() { assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, 200.0, 20.0)), vec![Action::Commit]); } +/// With a shape tool, a drag down on a selected live polygon's side widget adds sides instead of +/// drawing, and Escape puts the count back; Line Segment draws from the widget. +#[test] +fn a_shape_tool_drags_a_polygons_side_widget() { + use vectorcraft_doc::{Appearance, LiveShape, Node, NodeKind}; + let shape = + LiveShape::Polygon { radius: 80.0, sides: 5, xf: Affine::translate((250.0, 250.0)), radii: vec![], kinds: vec![], radii_relative: false }; + let mut d = vectorcraft_doc::Document::new(500.0, 500.0); + let (l, id) = (d.layers[0].id, d.alloc_id()); + let mut n = Node::path(id, shape.to_path(), Appearance::default_art()); + if let NodeKind::Path { live: slot, .. } = &mut n.kind { + *slot = Some(Box::new(shape)); + } + d.insert(Some(l), 0, n).unwrap(); + let mut s = Selection::default(); + s.add(id); + let p = paint(); + let c = cx(&d, &s, &p); + let (w, _) = crate::sidewidget::SideWidget::for_tool(&c).expect("a side widget"); + let down = |px: f64| PointerEvent::new(PointerKind::Drag, w.at.x, w.at.y + px); + for tool in ["rectangle", "roundedRectangle", "ellipse", "polygon", "star"] { + let mut t = ShapeTool::new(tool); + assert_eq!(t.cursor(&c, w.at, Mods::default()), Cursor::ArrowHollow, "{tool}"); + assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Down, w.at.x, w.at.y)).is_empty(), "{tool}"); + let a = t.pointer(&c, &down(25.0)); + assert_eq!( + a, + vec![Action::Begin("Live Shape".into()), Action::Preview("object.setLiveShape".into(), json!({ "id": id.0, "sides": 7 }))], + "{tool}" + ); + assert!(t.transforming() && !t.drawing_boxed(), "{tool}"); + assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, w.at.x, w.at.y + 25.0)), vec![Action::Commit], "{tool}"); + assert!(!t.busy(), "{tool}"); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, w.at.x, w.at.y)); + t.pointer(&c, &down(-13.0)); + assert_eq!(t.key(&c, ToolKey::Escape, Mods::default()), vec![Action::Cancel], "{tool}"); + assert!(!t.busy(), "{tool}"); + } + let mut t = ShapeTool::new("lineSegment"); + assert_eq!(t.cursor(&c, w.at, Mods::default()), Cursor::Crosshair); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, w.at.x, w.at.y)); + let a = t.pointer(&c, &down(25.0)); + assert!(matches!(a.last(), Some(Action::Preview(cmd, _)) if cmd == "shape.line"), "{a:?}"); +} + /// A double-click on a corner widget of a selected live shape, with a shape tool that shows the /// widgets, asks for the Transform panel and nothing else: neither click draws, edits or begins an /// undo step, and the tool stays idle. Line Segment, a plain path, a pie widget, a hidden or diff --git a/crates/tools/src/sidewidget.rs b/crates/tools/src/sidewidget.rs new file mode 100644 index 0000000000..5d338856a7 --- /dev/null +++ b/crates/tools/src/sidewidget.rs @@ -0,0 +1,348 @@ +//! The side widget: a small diamond beside the right side of a selected live polygon's bounding +//! box (). +//! Dragging it down adds sides and dragging it up removes them, one side per [`STEP_PX`] screen +//! pixels along the box's own vertical axis, from 3 to 11 sides. A polygon with more than 11 +//! sides keeps its count until the drag goes up a step, which gives it 11. The drag sends +//! `object.setLiveShape`'s `sides` in one undo step, and none when the count ends where it began. +//! The Selection tool and the shape tools that show the box hit the widget, and the canvas draws it +//! from the same geometry. + +use serde_json::json; +use vectorcraft_doc::{Document, LiveShape, NodeId, NodeKind, OrientedBox, Selection}; +use vectorcraft_geom::Point; + +use crate::select::shown_box; +use crate::{Action, Overlay, PointerEvent, ToolContext}; + +/// The widget's center sits this far (screen px) outside the middle of the box's right side, clear +/// of its handle. +const OFFSET_PX: f64 = 16.0; +/// Half the widget's diagonal (screen px), as the canvas draws it. +pub const RADIUS_PX: f32 = 4.0; +/// How near (screen px) the pointer must be to hit it. +const HIT_PX: f64 = 5.0; +/// How far (screen px) the pointer moves along the box's vertical axis per side. +pub const STEP_PX: f64 = 12.0; +/// The fewest sides a drag gives. +pub const MIN_SIDES: u32 = 3; +/// The most sides a drag gives. +pub const MAX_SIDES: u32 = 11; + +/// The side widget of a selection that is exactly one editable live polygon. +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct SideWidget { + pub id: NodeId, + /// Center in document coordinates. + pub at: Point, + /// The polygon's side count. + pub sides: u32, +} + +impl SideWidget { + /// The widget beside `bx`, the selection's bounding box, at `zoom` (screen px per document + /// point). None unless the selection is one whole editable live polygon, with no anchors or + /// segments of it selected. + pub fn of(doc: &Document, selection: &Selection, bx: &OrientedBox, zoom: f64) -> Option { + let [id] = selection.objects[..] else { return None }; + if !selection.anchors.is_empty() || selection.segments.contains_key(&id) || !doc.is_editable(id) || !zoom.is_finite() || zoom <= 0.0 { + return None; + } + let NodeKind::Path { live, .. } = &doc.node(id)?.kind else { return None }; + let Some(LiveShape::Polygon { sides, .. }) = live.as_deref() else { return None }; + let r = bx.rect; + let at = bx.to_doc() * Point::new(r.x1 + OFFSET_PX / zoom, r.center().y); + (at.x.is_finite() && at.y.is_finite()).then_some(Self { id, at, sides: *sides }) + } + + /// The widget the tool can drag (its bounding box showing). + pub fn for_tool(cx: &ToolContext) -> Option<(Self, OrientedBox)> { + // One object or none: a larger selection's box is not measured. + if cx.selection.objects.len() != 1 { + return None; + } + let bx = shown_box(cx)?; + Some((Self::of(cx.doc, cx.selection, &bx, cx.zoom)?, bx)) + } + + /// The widget of `cx` and its box if the widget is under `p`. + fn at(cx: &ToolContext, p: Point) -> Option<(Self, OrientedBox)> { + Self::for_tool(cx).filter(|(w, _)| w.at.distance(p) <= cx.tol(HIT_PX)) + } +} + +/// Is `p` over the side widget? +pub fn over_widget(cx: &ToolContext, p: Point) -> bool { + SideWidget::at(cx, p).is_some() +} + +/// The side count a drag of `steps` (down positive) gives a polygon of `from` sides: within 3 to 11, +/// and `from` itself while a polygon of more than 11 sides has not been dragged up. +pub fn sides_after(from: u32, steps: i64) -> u32 { + let (min, max) = (i64::from(MIN_SIDES), i64::from(MAX_SIDES)); + let to = if from <= MAX_SIDES { + i64::from(from) + steps + } else if steps >= 0 { + return from; + } else { + max + 1 + steps + }; + to.clamp(min, max) as u32 +} + +/// Dragging the side widget. +#[derive(Clone, Debug)] +pub struct SideDrag { + widget: SideWidget, + bx: OrientedBox, + start: Point, + /// The pointer has left the click. + moved: bool, + /// The undo step has begun: the count has differed from the polygon's. + began: bool, + /// The count last sent (the polygon's until the drag changes it). + sides: u32, + at: Point, +} + +impl SideDrag { + /// The drag has left the click. + pub fn adjusting(&self) -> bool { + self.moved + } + + /// Start a drag when the press `ev` is on the side widget of the selection. + pub fn hit(cx: &ToolContext, ev: &PointerEvent) -> Option { + let (widget, bx) = SideWidget::at(cx, ev.pos)?; + Some(Self { widget, bx, start: ev.pos, moved: false, began: false, sides: widget.sides, at: ev.pos }) + } + + pub fn drag(&mut self, cx: &ToolContext, p: Point) -> Vec { + self.at = p; + if !self.moved { + if p.distance(self.start) < cx.tol(3.0) { + return vec![]; + } + self.moved = true; + } + let down = (self.bx.to_local(p).y - self.bx.to_local(self.start).y) * cx.zoom; + let steps = (down / STEP_PX).trunc(); + let sides = sides_after(self.widget.sides, if steps.is_finite() { steps as i64 } else { 0 }); + if sides == self.sides { + return vec![]; + } + let mut out = vec![]; + if !self.began { + self.began = true; + out.push(Action::Begin("Live Shape".into())); + } + self.sides = sides; + out.push(Action::Preview("object.setLiveShape".into(), json!({ "id": self.widget.id.0, "sides": sides }))); + out + } + + /// The release: one undo step when the count changed, and nothing kept when it came back. + pub fn finish(self) -> Vec { + match (self.began, self.sides == self.widget.sides) { + (false, _) => vec![], + (true, true) => vec![Action::Cancel], + (true, false) => vec![Action::Commit], + } + } + + /// Escape: the polygon keeps the count it had. + pub fn cancel(self) -> Vec { + if self.began { vec![Action::Cancel] } else { vec![] } + } + + /// The side count next to the pointer. + pub fn overlays(&self, cx: &ToolContext) -> Vec { + if !self.moved || !cx.measurement_labels { + return vec![]; + } + vec![Overlay::Measure { p: self.at, text: format!("Sides: {}", self.sides) }] + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::select::SelectionTool; + use crate::testutil::*; + use crate::{Cursor, Mods, PointerKind, Tool, ToolKey}; + use vectorcraft_doc::{Appearance, Node}; + use vectorcraft_geom::Affine; + + /// A document holding a live polygon of `sides` sides and radius 100 placed by `xf`, and a + /// selection of it. + fn polygon_doc(sides: u32, xf: Affine) -> (Document, NodeId, Selection) { + let live = LiveShape::Polygon { radius: 100.0, sides, xf, radii: vec![], kinds: vec![], radii_relative: false }; + let mut d = Document::new(800.0, 800.0); + let l = d.layers[0].id; + let id = d.alloc_id(); + let mut n = Node::path(id, live.to_path(), Appearance::default_art()); + if let NodeKind::Path { live: slot, .. } = &mut n.kind { + *slot = Some(Box::new(live)); + } + d.insert(Some(l), 0, n).unwrap(); + let mut s = Selection::default(); + s.add(id); + (d, id, s) + } + + fn ev(kind: PointerKind, p: Point) -> PointerEvent { + PointerEvent::new(kind, p.x, p.y) + } + + fn sides_of(a: &[Action]) -> Vec { + a.iter().filter_map(|a| if let Action::Preview(_, v) = a { v["sides"].as_u64() } else { None }).collect() + } + + #[test] + fn the_counts_stay_within_three_and_eleven() { + assert_eq!(sides_after(5, 1), 6); + assert_eq!(sides_after(5, -1), 4); + assert_eq!(sides_after(5, 100), 11); + assert_eq!(sides_after(5, -100), 3); + assert_eq!(sides_after(3, -1), 3); + assert_eq!(sides_after(11, 1), 11); + // Over 11: unchanged until the drag goes up, which gives 11, then 10. + assert_eq!(sides_after(40, 0), 40); + assert_eq!(sides_after(40, 5), 40); + assert_eq!(sides_after(40, -1), 11); + assert_eq!(sides_after(40, -2), 10); + assert_eq!(sides_after(1000, -100), 3); + } + + /// The widget sits 16 px right of the middle of the box's right side, at any zoom; only one + /// whole editable live polygon shows it. + #[test] + fn one_whole_live_polygon_shows_the_widget() { + let (d, id, s) = polygon_doc(6, Affine::translate((300.0, 300.0))); + let p = paint(); + let c = cx(&d, &s, &p); + let (w, bx) = SideWidget::for_tool(&c).expect("a widget"); + assert_eq!((w.id, w.sides), (id, 6)); + let want = |zoom: f64| Point::new(bx.rect.x1 + 16.0 / zoom, bx.rect.center().y); + assert!(w.at.distance(want(1.0)) < 1e-9, "{w:?} {bx:?}"); + assert!(SideWidget::of(&d, &s, &bx, 4.0).unwrap().at.distance(want(4.0)) < 1e-9); + assert!(over_widget(&c, w.at) && !over_widget(&c, w.at + vectorcraft_geom::Vec2::new(0.0, 8.0))); + // Hidden with the bounding box hidden, with an anchor or segment selected, or with no zoom. + assert!(SideWidget::for_tool(&ToolContext { show_bbox: false, ..cx(&d, &s, &p) }).is_none()); + let mut part = s.clone(); + part.segments.insert(id, Default::default()); + assert!(SideWidget::of(&d, &part, &bx, 1.0).is_none()); + assert!(SideWidget::of(&d, &s, &bx, 0.0).is_none() && SideWidget::of(&d, &s, &bx, f64::NAN).is_none()); + // A locked polygon, two polygons, nothing or a plain path: none. + let mut locked = d.clone(); + locked.node_mut(id).unwrap().locked = true; + assert!(SideWidget::of(&locked, &s, &bx, 1.0).is_none()); + let mut two = d.clone(); + let other = two.alloc_id(); + let mut n = two.node(id).unwrap().clone(); + n.id = other; + let l = two.layers[0].id; + two.insert(Some(l), 0, n).unwrap(); + let mut both = s.clone(); + both.add(other); + assert!(SideWidget::of(&two, &both, &bx, 1.0).is_none()); + assert!(SideWidget::of(&d, &Selection::default(), &bx, 1.0).is_none()); + let (d, rect) = doc_with_rect(); + let mut s = Selection::default(); + s.add(rect); + let bx = OrientedBox::aligned(vectorcraft_geom::Rect::new(0.0, 0.0, 10.0, 10.0)); + assert!(SideWidget::of(&d, &s, &bx, 1.0).is_none()); + } + + /// With the Selection tool, dragging the widget down adds a side per 12 screen px and up removes + /// them, within 3 to 11, in one undo step with the count shown next to the pointer. + #[test] + fn dragging_the_widget_changes_the_sides() { + let (d, id, s) = polygon_doc(5, Affine::translate((300.0, 300.0))); + let p = paint(); + for zoom in [1.0, 2.0] { + let c = ToolContext { zoom, ..cx(&d, &s, &p) }; + let (w, _) = SideWidget::for_tool(&c).unwrap(); + let at = |px: f64| w.at + vectorcraft_geom::Vec2::new(0.0, px / zoom); + let mut t = SelectionTool::default(); + assert_eq!(t.cursor(&c, w.at, Mods::default()), Cursor::ArrowHollow); + assert!(t.pointer(&c, &ev(PointerKind::Down, w.at)).is_empty()); + // Past the click but short of a step: nothing yet. + assert!(t.pointer(&c, &ev(PointerKind::Drag, at(6.0))).is_empty()); + assert!(t.transforming()); + let a = t.pointer(&c, &ev(PointerKind::Drag, at(12.0))); + assert_eq!(a[0], Action::Begin("Live Shape".into())); + assert_eq!(a[1], Action::Preview("object.setLiveShape".into(), json!({ "id": id.0, "sides": 6 }))); + assert!(t.overlays(&c).iter().any(|o| matches!(o, Overlay::Measure { text, .. } if text == "Sides: 6"))); + // The same count again sends nothing; far down stops at 11, far up at 3. + assert!(t.pointer(&c, &ev(PointerKind::Drag, at(20.0))).is_empty()); + assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, at(500.0)))), [11]); + assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, at(-500.0)))), [3]); + assert_eq!(t.pointer(&c, &ev(PointerKind::Up, at(-500.0))), vec![Action::Commit]); + assert!(!t.busy() && !t.transforming()); + } + // A click sends nothing, and the readout follows Measurement Labels. + let c = cx(&d, &s, &p); + let (w, _) = SideWidget::for_tool(&c).unwrap(); + let mut t = SelectionTool::default(); + assert!(t.pointer(&c, &ev(PointerKind::Down, w.at)).is_empty()); + assert!(t.pointer(&c, &ev(PointerKind::Up, w.at)).is_empty()); + t.pointer(&c, &ev(PointerKind::Down, w.at)); + t.pointer(&c, &ev(PointerKind::Drag, w.at + vectorcraft_geom::Vec2::new(0.0, 13.0))); + let quiet = ToolContext { measurement_labels: false, ..cx(&d, &s, &p) }; + assert!(!t.overlays(&quiet).iter().any(|o| matches!(o, Overlay::Measure { .. }))); + // Back at the start: the release keeps nothing. + assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, w.at))), [5]); + assert_eq!(t.pointer(&c, &ev(PointerKind::Up, w.at)), vec![Action::Cancel]); + } + + /// On a turned polygon the drag is read along the box's own vertical axis. + #[test] + fn a_turned_polygon_reads_the_drag_along_its_box() { + let xf = Affine::translate((400.0, 400.0)) * Affine::rotate(std::f64::consts::FRAC_PI_2); + let (d, _, s) = polygon_doc(5, xf); + let p = paint(); + let c = cx(&d, &s, &p); + let (w, bx) = SideWidget::for_tool(&c).unwrap(); + let down = bx.to_doc() * Point::new(0.0, 1.0) - bx.to_doc() * Point::ZERO; + let mut t = SelectionTool::default(); + t.pointer(&c, &ev(PointerKind::Down, w.at)); + assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, w.at + down * 25.0))), [7], "{bx:?}"); + assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, w.at - down * 13.0))), [4]); + } + + /// A polygon of more than 11 sides keeps its count on a press and a drag down; the first step + /// up gives 11. + #[test] + fn a_polygon_over_eleven_sides_does_not_jump() { + let (d, _, s) = polygon_doc(40, Affine::translate((300.0, 300.0))); + let p = paint(); + let c = cx(&d, &s, &p); + let (w, _) = SideWidget::for_tool(&c).unwrap(); + let mut t = SelectionTool::default(); + assert!(t.pointer(&c, &ev(PointerKind::Down, w.at)).is_empty()); + assert!(t.pointer(&c, &ev(PointerKind::Drag, w.at + vectorcraft_geom::Vec2::new(0.0, 40.0))).is_empty()); + assert!(t.pointer(&c, &ev(PointerKind::Up, w.at + vectorcraft_geom::Vec2::new(0.0, 40.0))).is_empty()); + t.pointer(&c, &ev(PointerKind::Down, w.at)); + let a = t.pointer(&c, &ev(PointerKind::Drag, w.at - vectorcraft_geom::Vec2::new(0.0, 12.0))); + assert_eq!(a[0], Action::Begin("Live Shape".into())); + assert_eq!(sides_of(&a), [11]); + assert!(t.overlays(&c).iter().any(|o| matches!(o, Overlay::Measure { text, .. } if text == "Sides: 11"))); + assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, w.at - vectorcraft_geom::Vec2::new(0.0, 24.0)))), [10]); + } + + /// Escape during a drag puts the count back; the release after it sends nothing. + #[test] + fn escape_cancels_a_side_widget_drag() { + let (d, _, s) = polygon_doc(5, Affine::translate((300.0, 300.0))); + let p = paint(); + let c = cx(&d, &s, &p); + let (w, _) = SideWidget::for_tool(&c).unwrap(); + let mut t = SelectionTool::default(); + t.pointer(&c, &ev(PointerKind::Down, w.at)); + t.pointer(&c, &ev(PointerKind::Drag, w.at + vectorcraft_geom::Vec2::new(0.0, 30.0))); + assert_eq!(t.key(&c, ToolKey::Escape, Mods::default()), vec![Action::Cancel]); + assert!(!t.busy() && !t.transforming()); + assert!(!t.overlays(&c).iter().any(|o| matches!(o, Overlay::Measure { .. }))); + assert!(t.pointer(&c, &ev(PointerKind::Up, w.at)).is_empty()); + } +} diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index 613b0fae9c..cc73f0d25b 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -255,6 +255,13 @@ pub(super) fn selection_overlay(app: &mut VectorcraftApp, p: &egui::Painter, xf: p.circle_filled(c, r, if w.area { color } else { Color32::WHITE }); p.circle_stroke(c, r, Stroke::new(1.0, color)); } + // A live polygon's side widget: a diamond beside the middle of the box's right side, drawn + // only while the box is drawn (the box hides during a turn and during a drag of the widget). + if !drawing_boxed && let Some(w) = vectorcraft_tools::sidewidget::SideWidget::of(&st.doc, &st.selection, &b, xf.zoom) { + let (c, r) = (xf.to_screen(w.at), vectorcraft_tools::sidewidget::RADIUS_PX); + let diamond = vec![c + vec2(0.0, -r), c + vec2(r, 0.0), c + vec2(0.0, r), c + vec2(-r, 0.0)]; + p.add(Shape::convex_polygon(diamond, Color32::WHITE, Stroke::new(1.0, color))); + } } // Pie widgets (Selection tool, with View › Show Bounding Box, on live ellipses): each joined // by a line to the outline's point at its angle. They stay while one is dragged. diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index cc65044dfb..53f0070109 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -6551,6 +6551,48 @@ fn a_selected_ellipse_shows_its_pie_widgets() { assert_eq!(widgets(&mut app), 0, "no bounding box, no widgets"); } +/// A selected live polygon shows its side widget, a white diamond beside its box, with the +/// Selection tool and the shape tools while the bounding box shows, and hides with the box while +/// the polygon is moved. +#[test] +fn a_selected_polygon_shows_its_side_widget() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + app.session.execute("shape.polygon", &json!({"cx": 200, "cy": 150, "radius": 60, "sides": 5})).unwrap(); + let ctx = egui::Context::default(); + // A white diamond as wide and tall as the widget. + let size = 2.0 * vectorcraft_tools::sidewidget::RADIUS_PX; + let diamond = |ps: &egui::epaint::PathShape| { + let span = |f: fn(&egui::Pos2) -> f32| { + let v: Vec = ps.points.iter().map(f).collect(); + v.iter().copied().fold(f32::MIN, f32::max) - v.iter().copied().fold(f32::MAX, f32::min) + }; + ps.closed && ps.points.len() == 4 && ps.fill == Color32::WHITE && (span(|p| p.x) - size).abs() < 0.01 && (span(|p| p.y) - size).abs() < 0.01 + }; + let widgets = |app: &mut VectorcraftApp| shapes(app, &ctx).iter().filter(|s| matches!(s, Shape::Path(ps) if diamond(ps))).count(); + app.select_tool("selection"); + assert_eq!(widgets(&mut app), 1); + app.select_tool("polygon"); + assert_eq!(widgets(&mut app), 1); + app.select_tool("directSelection"); + assert_eq!(widgets(&mut app), 0); + app.select_tool("lineSegment"); + assert_eq!(widgets(&mut app), 0); + app.select_tool("selection"); + app.run("view.boundingBox", json!({})).unwrap(); + assert_eq!(widgets(&mut app), 0, "no bounding box, no widget"); + app.run("view.boundingBox", json!({})).unwrap(); + // A move of the polygon hides the box, and the widget with it, until the release. + let view = app.view_info(); + app.session.pointer(&PointerEvent::new(PointerKind::Down, 200.0, 150.0), view).unwrap(); + app.session.pointer(&PointerEvent::new(PointerKind::Drag, 260.0, 150.0), view).unwrap(); + assert_eq!(widgets(&mut app), 0, "hidden while the polygon moves"); + app.session.pointer(&PointerEvent::new(PointerKind::Up, 260.0, 150.0), view).unwrap(); + assert_eq!(widgets(&mut app), 1, "back after the release"); + app.session.execute("shape.ellipse", &json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + assert_eq!(widgets(&mut app), 0, "an ellipse has none"); +} + /// A selected Objects on Path group shows its Rotate All widget with the Selection and Objects on /// Path tools. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b4b36e1c39..c8a6aafe17 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1260,6 +1260,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur With Direct Selection, Shift pressed during the drag of a curved segment keeps both of its handles at right angles to the line between its anchors, on the same side and at the same length (`path.reshapeSegment {perpendicular}`). Shift held while any segment is dragged with the Anchor Point tool or the Pen with Alt does the same. With the Anchor Point tool, Shift held at the press on an anchor (or a selected blend's spine point) moves it, handles and all, instead of pulling out handles; Shift kept down keeps the move at 45° steps, and a Shift-click that doesn't move leaves the anchor as it was (`path.moveAnchor`). A selected blend spine's segment dragged with the Anchor Point tool, or a curved one dragged with Direct Selection, bends the same way (`object.blend.spine.reshapeSegment`). - **Live Corners:** drag a live rectangle's corner widgets (Selection or Direct Selection) to round all corners, with a radius readout; with Direct Selection, select corner anchors to show and round just those corners (#381). Each corner keeps its own radius and kind (Round, Inverted Round, Chamfer): Alt-click a widget to cycle the kind, double-click it for the Corners dialog, and the Properties and Transform radius fields set the selected corners (`object.setLiveShape {corners, radius, kind}`). A link toggle behind Corner Radius (the `singleCornerRadius` preference) switches the panels to a field for each corner of a live rectangle: Top Left, Top Right, Bottom Right and Bottom Left. Corners stay circular when the rectangle is scaled unevenly or along its own sides when rotated (the radius keeps its size, or scales by the mean scale with Scale Corners on); only a shear distorts them. On a rectangle that isn't square every corner is the same circle: a radius past half the shorter side stops there for all of them, the widgets sit on the corners as drawn and turn the edited corners red at that limit, CSS export writes the drawn radii, and rectangles saved stretched by older versions get circular corners when their corners are next set (#442). Live Corners work on any path's corners too, as on a rectangle's (#511): a star's, a live polygon's (which also shows them to the Selection tool, has a Corner Radius field in the Properties and Transform panels and keeps its radius as its sides change) and a pen path's, wherever two sides meet at an angle at an anchor that isn't smooth: curved sides too, trimmed to what the cut leaves of them (#1144). Direct Selection shows the widgets of every corner, or of the corners holding selected anchors; each corner is a circle tangent to both sides, drawn no larger than takes its cut halfway along its shorter side; a path keeps its uncut outline so its corners stay editable, and the same command, dialog, angle preference and View › Hide Corner Widget apply. With Direct Selection a click on a widget (no drag) selects its corner, as a click on the corner's anchor does, so the next drag on it rounds that corner alone; Shift-click toggles it (#1239). While a corner widget is dragged with the Selection tool the bounding box hides, so the rounding shows against the path alone (#1229). A round corner next to a curved side curves smoothly instead of sticking out of the shape (#1547, fixes #1512). View › Hide Edges hides the Live Corners widgets, the bounding box and the type widget, and the selection tools then do not answer a press on them or change the cursor over them. + - **Polygon side widget:** a selected live polygon shows a small diamond beside the middle of the right side of its bounding box, with the Selection tool and with the Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools, while the bounding box and the edges are shown. Dragging the widget sets the polygon's side count, from 3 to 11, as [the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/add-or-remove-sides-from-polygons.html) describes; typed counts in the Transform panel and `object.setLiveShape` still go from 3 to 1000. A drag down adds one side and a drag up removes one for every 12 screen pixels along the box's own vertical axis, and the pointer shows the count while measurement labels are on. A polygon of more than 11 sides keeps its count until the drag goes up, which gives it 11. The drag sends `object.setLiveShape {sides}`, so the polygon keeps its center, radius and rotation; the release adds one undo step when the count changed and none when it ends where it began, and Escape puts the count back. The widget's look and place, the drag direction, the step and the rule for more than 11 sides are VectorCraft's own (`crates/tools/src/sidewidget.rs`). - **Blend spine Anchor Point tool (#2544):** on a selected blend, dragging a spine corner makes symmetric Smooth handles; the tool displays and picks existing spine handles when switched to, drags one independently or retracts it on click, and clicking a point with handles retracts both. The spine is edited live without moving its key objects. Windows native canvas checks and screenshots reviewed: symmetric and independent handles, corner/retraction, Shift constraints and perpendicular reshaping, tool switching, key preservation, Undo/Redo, save/reopen, hidden handles and overlapping Path/Blend priority (PR #2643). Behaviour reference: [public path-editing documentation](https://helpx.adobe.com/illustrator/using/adjust-path-segments.html). - **Blend spine points by marquee:** with Direct Selection, a marquee picks the spine points inside it on a selected blend, the topmost one when several are selected, and the picked points drag together as Shift-clicked ones do; Shift-marquee adds points or takes picked ones away, a plain marquee around none of them drops the picks, and Escape during the marquee keeps them. Unselected, locked and hidden blends are skipped. The spine's points are anchor points edited with Direct Selection ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/modify-spine-of-blended-objects.html)), and a boundary drag with the tool selects anchor points ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/select-anchor-points-in-paths.html)); the rules for selected, topmost and Shift are VectorCraft's own (`crates/tools/src/direct/tests.rs`, `marquee_picks_selected_blend_spine_points_which_drag_together`, `shift_marquee_toggles_selected_blend_spine_points`, `marquee_skips_unselected_locked_and_hidden_blend_spines`, `escape_cancels_a_marquee_and_keeps_the_picked_spine_points`). - **Blend steps of brushed strokes:** the steps interpolate the pen pressure, tilt, bearing and rotation recorded with the Paintbrush, so a Calligraphic, Scatter or Art brush that varies with the pen changes gradually from one key to the next. A key without a recording counts as half pressure, half tilt and 0°, as brushes read it, and angles turn the shorter way round. When the blend starts a key's path at another anchor (an open path run from its end, a closed one turned to another start), the key's recordings, width profile, arrowheads, dashes and a gradient along or across the stroke turn with the path. Different brushes still switch halfway (VectorCraft's own rule; strokes blend their options, as [Blended objects overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blended-objects-overview.html) describes; `crates/doc/src/blend.rs`, `pen_pressure_tilt_and_angles_interpolate_for_brushes`, `stroke_profiles_turn_with_a_key_path_started_elsewhere`, `stroke_gradients_and_dashes_turn_with_a_key_path_started_elsewhere`). diff --git a/docs/ui-parity.md b/docs/ui-parity.md index c0ae4fd14a..034a54f4b1 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -232,6 +232,7 @@ tools, never checked side by side) isn't captured row by row. | Live Corners widgets (radius readout, Alt-click cycles kind, double-click the Corners dialog) | done | a Direct Selection click on a widget selects its corner (#1239), and with every corner selected a Shift-click on a widget picks that corner alone instead of deselecting it (#5188); a press-and-drag on a widget of a path selected whole still rounds every corner (#908), and adding widgets to the selection by Shift-click (#1232) is missing; the bounding box hides while a widget is dragged with the Selection tool (#1229); a round corner next to a curved side curves smoothly instead of sticking out of the shape (#1512); a corner rounds until its cut reaches its neighbours' cuts, so one corner of a square alone reaches the whole side (#2332) | | Corners between curved sides (#1144), Relative rounding | done | #1144 closed; Relative rounding in the Corners dialog (Relative / Absolute, radius as a percentage of each corner's maximum, kept as the shape is resized; `object.setLiveShape` `relativeRadii`, #3091, `tests_livecorners::relative_corner_rounding_keeps_fraction_on_resize`) | | Pie widgets on a live ellipse: drag one to set Pie Start or End Angle, double-click one to make the ellipse whole | done | Selection tool, with the bounding box showing | +| Side widget on a live polygon: drag it to set the number of sides from 3 to 11 | done | Selection tool and the Rectangle, Rounded Rectangle, Ellipse, Polygon and Star tools, with the bounding box showing; a drag down adds sides and a drag up removes them; Escape cancels ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/add-or-remove-sides-from-polygons.html)) | | A shape just drawn shows its bounding box and Live Shape widgets with the shape tool still active, and the selection can be moved and turned without switching tools | done | #5477: Rectangle, Rounded Rectangle, Ellipse, Polygon and Star keep the selection's bounding box, corner widgets and pie widgets on show while they draw nothing; a drag on a corner or pie widget adjusts it (arrows step the corner kind, Escape cancels), a press on the selection's centre point (Attributes › Show Center) moves the selection — the Selection tool's move arrow, snapping and Alt copy — a press just outside a corner of the box turns it about the centre (the Selection tool's rotate zone and cursor), and a press anywhere else draws (so a second shape drawn from the first one's centre moves the first: press elsewhere or deselect first). Public descriptions: [Live Shapes](https://helpx.adobe.com/illustrator/using/live-shapes.html) (live shapes adjust without switching tools) and [CreativePro, Working with Live Shapes](https://creativepro.com/?p=23921) (a widget shows in every corner on release; drag one toward the centre to round). A drag on one of the box's handles scales the selection as the Selection tool's handles do. A double-click on a corner widget of a selected live rectangle or polygon shows and selects the Transform panel where it is (closed, docked, floating or in an icon column; a second double-click keeps it on show), and leaves the tool, the selection and the document as they were; a double-click on a pie widget, off the widgets, with Show Corner Widget off or with Line Segment does nothing, and the Selection tool's double-click on a corner widget still opens the Corners dialog. Public description: [Live shape properties](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/live-shape-properties.html) (a double-click on a corner widget of a selected live shape opens the Transform panel). Tests `a_shape_tool_drags_the_selected_shapes_widgets`, `a_shape_tool_moves_the_selection_by_its_centre_point_and_turns_it_from_a_corner`, `a_shape_tool_scales_the_selection_by_its_bounding_box_handles`, `a_double_click_on_a_corner_widget_shows_the_transform_panel`, `a_double_click_on_a_corner_widget_with_a_shape_tool_asks_for_the_transform_panel` (engine), `a_corner_widget_double_click_with_a_shape_tool_requests_the_transform_panel` (MCP: the `pointer_gesture` reply's `requests` carry `{"panel": "transform"}`) and `a_tools_panel_request_shows_the_panel_and_a_second_keeps_it_shown` (UI) | | Isolation mode by double-click (groups and single objects), breadcrumbs, Esc to exit | done | Single paths, compound paths, images, meshes and placed files isolate too ([helpx: Isolate objects](https://helpx.adobe.com/africa/illustrator/desktop/manage-objects/select-objects/isolate-objects.html)); locking or hiding the layer (or a group) around the isolated object afterwards keeps clicks and marquees off it, as outside isolation mode (#5309) | | "Magnetic" moves of selected anchors with a modifier (#955 request) | missing | not a feature of the reference app as documented; under discussion | From 73fe594bb36a300b3d487e8d618ce646edfabd0e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 10:42:25 -0800 Subject: [PATCH 042/158] Command Palette: the highlighted result points to where it lives MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While the palette is open, the highlighted result is marked where it lives, in the same frame the arrow keys or the pointer move the highlight. A result with an item of the in-window menu bar has that menu's title outlined, and a box under it shows the item's whole path (Effect › Stylize › Round Corners…). A panel points at the Window menu. A tool has its slot's button outlined on the toolbar its row names, or its own button on a strip torn off its group. The box beside it, on the canvas side of the toolbar, names the tool, or reads "In the Direct Selection Tool group: press and hold to open it" for a tool hidden in a group; screen readers hear that sentence with the search field's description. The box stays inside the window and off the button and the palette's popup: beside a button, its text wraps to up to three rows to fit before the popup or the window's edge, and where it still would not fit, the footer shows the text and only the outline is drawn. When the popup covers the control, nothing is drawn and the footer names the home. Highlighting a result opens no menu, flyout or All Tools drawer, shows no toolbar and leaves the chosen tool as it is. With the system's menu bar, nothing is drawn over it, and the footer reads "In the menu bar:" and the path. When no control in view shows the home (Presentation Mode, toolbars hidden by Window › Tools or Tab, a button scrolled out of view or under a floating panel or another toolbar), the footer names the home followed by "not shown now". A command with no menu item reads "No menu item" there, with its shortcut. The menu bar, the Tools panel, the toolbars made with New Toolbar and the strips torn off them note where they draw each control only while the palette is open, and only controls wholly in view. The list keeps one pass of each window. The palette uses only the controls noted in the current pass of its own window, and shows no footer line for the home in the pass that opens it, before anything is noted. learn.locateTool's search for a tool's place moves into a function without side effects (locate::find), which the palette calls with the order its rows use. Learn calls it and then shows the toolbar, flyout or drawer as before, and the mark's outline is shared. New strings have rows in every catalog. --- crates/ui-egui/src/custom_toolbars.rs | 1 + crates/ui-egui/src/i18n/bg.tsv | 3 + crates/ui-egui/src/i18n/bs.tsv | 3 + crates/ui-egui/src/i18n/ca.tsv | 3 + crates/ui-egui/src/i18n/cs.tsv | 3 + crates/ui-egui/src/i18n/da.tsv | 3 + crates/ui-egui/src/i18n/de.tsv | 3 + crates/ui-egui/src/i18n/el.tsv | 3 + crates/ui-egui/src/i18n/es.tsv | 3 + crates/ui-egui/src/i18n/fi.tsv | 3 + crates/ui-egui/src/i18n/fr.tsv | 3 + crates/ui-egui/src/i18n/gu.tsv | 3 + crates/ui-egui/src/i18n/hi.tsv | 3 + crates/ui-egui/src/i18n/hu.tsv | 3 + crates/ui-egui/src/i18n/id.tsv | 3 + crates/ui-egui/src/i18n/it.tsv | 3 + crates/ui-egui/src/i18n/ja.tsv | 3 + crates/ui-egui/src/i18n/ka.tsv | 3 + crates/ui-egui/src/i18n/ko.tsv | 3 + crates/ui-egui/src/i18n/nl.tsv | 3 + crates/ui-egui/src/i18n/pl.tsv | 3 + crates/ui-egui/src/i18n/pt-br.tsv | 3 + crates/ui-egui/src/i18n/ru.tsv | 3 + crates/ui-egui/src/i18n/sv.tsv | 3 + crates/ui-egui/src/i18n/tr.tsv | 3 + crates/ui-egui/src/i18n/uk.tsv | 3 + crates/ui-egui/src/i18n/vi.tsv | 3 + crates/ui-egui/src/i18n/zh-hans.tsv | 3 + crates/ui-egui/src/i18n/zh-hant.tsv | 3 + crates/ui-egui/src/menus/bar.rs | 1 + crates/ui-egui/src/palette.rs | 864 +++++++++++++++++++++- crates/ui-egui/src/panels/learn/locate.rs | 92 ++- crates/ui-egui/src/toolbar.rs | 13 +- docs/target-app-parity.md | 1 + 34 files changed, 1023 insertions(+), 33 deletions(-) diff --git a/crates/ui-egui/src/custom_toolbars.rs b/crates/ui-egui/src/custom_toolbars.rs index f8c3033a5e..5ee944afe3 100644 --- a/crates/ui-egui/src/custom_toolbars.rs +++ b/crates/ui-egui/src/custom_toolbars.rs @@ -1121,6 +1121,7 @@ pub(crate) fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { ui.add_space((middle - BUTTON / 2.0 * row.len() as f32 - ui.cursor().min.x).max(0.0)); for &(s, slot) in row { let Some((rect, shown)) = slot_button(ui, &t, &press, slot, &mut actions) else { continue }; + crate::palette::note_spot(ui, rect, || crate::palette::SpotAt::Slot(Some(bar.name.clone()), slot.clone())); if edit_this { buttons.push((s, rect)); } diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 11db47b8da..e2c664ab34 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3195,6 +3195,9 @@ digits Malayalam Малаялам No menu item Няма елемент в менюто Toolbar Лента с инструменти {toolbar}, in the {tool} group {toolbar}, в групата на {tool} + In the menu bar: {path} В лентата с менюта: {path} + In the {group} group: press and hold to open it В групата {group}: натиснете и задръжте, за да я отворите + {home}, not shown now {home}, не се показва сега @plural {n} result|{n} results {n} резултат|{n} резултата @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} от {n} резултат. Продължете да пишете, за да ги стесните.|{shown} от {n} резултата. Продължете да пишете, за да ги стесните. Recent Commands Последни команди diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 0eb468b3d4..13effad79c 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -4394,6 +4394,9 @@ font-technology Variable Varijabilni No menu item Nema stavke menija Toolbar Traka s alatima {toolbar}, in the {tool} group {toolbar}, u grupi {tool} + In the menu bar: {path} Na traci menija: {path} + In the {group} group: press and hold to open it U grupi {group}: pritisnite i držite da je otvorite + {home}, not shown now {home}, trenutno nije prikazano @plural {n} result|{n} results {n} rezultat|{n} rezultata|{n} rezultata @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} od {n} rezultata. Nastavite kucati da ih suzite.|{shown} od {n} rezultata. Nastavite kucati da ih suzite.|{shown} od {n} rezultata. Nastavite kucati da ih suzite. Recent Commands Nedavne naredbe diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 7abf69a8b5..7f0a3c57aa 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4124,6 +4124,9 @@ digits Malayalam Malaiàlam No menu item Cap element de menú Toolbar Barra d’eines {toolbar}, in the {tool} group {toolbar}, al grup {tool} + In the menu bar: {path} A la barra de menús: {path} + In the {group} group: press and hold to open it Al grup {group}: manteniu premut per obrir-lo + {home}, not shown now {home}, ara no es mostra @plural {n} result|{n} results {n} resultat|{n} resultats @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} de {n} resultat. Continueu escrivint per reduir-los.|{shown} de {n} resultats. Continueu escrivint per reduir-los. Recent Commands Ordres recents diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index aa95a8140d..0c04e49f7a 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4499,6 +4499,9 @@ font-technology Variable Variabilní No menu item Žádná položka nabídky Toolbar Panel nástrojů {toolbar}, in the {tool} group {toolbar}, ve skupině {tool} + In the menu bar: {path} V řádku nabídek: {path} + In the {group} group: press and hold to open it Ve skupině {group}: stisknutím a podržením ji otevřete + {home}, not shown now {home}, nyní není zobrazeno @plural {n} result|{n} results {n} výsledek|{n} výsledky|{n} výsledků @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} z {n} výsledku. Pište dál a výsledky se zúží.|{shown} z {n} výsledků. Pište dál a výsledky se zúží.|{shown} z {n} výsledků. Pište dál a výsledky se zúží. Recent Commands Nedávné příkazy diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index b565df95a2..1cedc382f1 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -6873,6 +6873,9 @@ font-technology Variable Variable No menu item Intet menupunkt Toolbar Værktøjslinje {toolbar}, in the {tool} group {toolbar}, i gruppen {tool} + In the menu bar: {path} I menulinjen: {path} + In the {group} group: press and hold to open it I gruppen {group}: tryk og hold for at åbne den + {home}, not shown now {home}, vises ikke nu @plural {n} result|{n} results {n} resultat|{n} resultater @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} af {n} resultat. Skriv videre for at indsnævre dem.|{shown} af {n} resultater. Skriv videre for at indsnævre dem. Recent Commands Seneste kommandoer diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 7080608618..c0594cad7f 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3259,6 +3259,9 @@ digits Malayalam Malayalam No menu item Kein Menüeintrag Toolbar Werkzeugleiste {toolbar}, in the {tool} group {toolbar}, in der Gruppe „{tool}“ + In the menu bar: {path} In der Menüleiste: {path} + In the {group} group: press and hold to open it In der Gruppe {group}: zum Öffnen gedrückt halten + {home}, not shown now {home}, derzeit nicht angezeigt Tool Werkzeug Command Befehl @plural {n} result|{n} results {n} Ergebnis|{n} Ergebnisse diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 81758e74be..046e5ecd3e 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3961,6 +3961,9 @@ digits Malayalam Μαλαγιάλαμ No menu item Χωρίς στοιχείο μενού Toolbar Γραμμή εργαλείων {toolbar}, in the {tool} group {toolbar}, στην ομάδα {tool} + In the menu bar: {path} Στη γραμμή μενού: {path} + In the {group} group: press and hold to open it Στην ομάδα {group}: πατήστε παρατεταμένα για να ανοίξει + {home}, not shown now {home}, δεν εμφανίζεται τώρα @plural {n} result|{n} results {n} αποτέλεσμα|{n} αποτελέσματα @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} από {n} αποτέλεσμα. Συνεχίστε να πληκτρολογείτε για να τα περιορίσετε.|{shown} από {n} αποτελέσματα. Συνεχίστε να πληκτρολογείτε για να τα περιορίσετε. Recent Commands Πρόσφατες εντολές diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index df7d42b3ef..fb4b0c72f6 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3297,6 +3297,9 @@ digits Malayalam Malayálam No menu item Sin elemento de menú Toolbar Barra de herramientas {toolbar}, in the {tool} group {toolbar}, en el grupo {tool} + In the menu bar: {path} En la barra de menús: {path} + In the {group} group: press and hold to open it En el grupo {group}: mantén pulsado para abrirlo + {home}, not shown now {home}, no se muestra ahora @plural {n} result|{n} results {n} resultado|{n} resultados @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} de {n} resultado. Sigue escribiendo para acotarlos.|{shown} de {n} resultados. Sigue escribiendo para acotarlos. Recent Commands Comandos recientes diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 9f6dbda3f5..88b919e7f1 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4418,6 +4418,9 @@ font-technology Variable Muuttuvat No menu item Ei valikkokohdetta Toolbar Työkalurivi {toolbar}, in the {tool} group {toolbar}, ryhmässä {tool} + In the menu bar: {path} Valikkorivillä: {path} + In the {group} group: press and hold to open it Ryhmässä {group}: avaa painamalla pitkään + {home}, not shown now {home}, ei näkyvissä nyt @plural {n} result|{n} results {n} tulos|{n} tulosta @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown}/{n} tulosta. Kirjoita lisää rajataksesi tuloksia.|{shown}/{n} tulosta. Kirjoita lisää rajataksesi tuloksia. Recent Commands Viimeisimmät komennot diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 5b084deebc..1bbdf3f56a 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3285,6 +3285,9 @@ digits Malayalam Malayalam No menu item Aucun élément de menu Toolbar Barre d’outils {toolbar}, in the {tool} group {toolbar}, dans le groupe {tool} + In the menu bar: {path} Dans la barre des menus, sous {path} + In the {group} group: press and hold to open it Dans le groupe {group}, maintenez enfoncé pour l’ouvrir + {home}, not shown now {home}, non affiché pour l’instant @plural {n} result|{n} results {n} résultat|{n} résultats @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} sur {n} résultat. Continuez à taper pour les affiner.|{shown} sur {n} résultats. Continuez à taper pour les affiner. Recent Commands Commandes récentes diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index b7ba94dcd9..eb39b36683 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3400,6 +3400,9 @@ No menu item કોઈ મેનૂ આઇટમ નથી Toolbar ટૂલબાર {toolbar}, in the {tool} group {toolbar}, {tool} જૂથમાં + In the menu bar: {path} મેનૂ બારમાં: {path} + In the {group} group: press and hold to open it {group} જૂથમાં: ખોલવા માટે દબાવીને પકડી રાખો + {home}, not shown now {home}, હમણાં બતાવેલ નથી Tool ટૂલ Command કમાન્ડ Panel પેનલ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 15a93243be..4843bacb7f 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4474,6 +4474,9 @@ antiAlias Sharp शार्प No menu item कोई मेनू आइटम नहीं Toolbar टूलबार {toolbar}, in the {tool} group {toolbar}, {tool} समूह में + In the menu bar: {path} मेनू बार में: {path} + In the {group} group: press and hold to open it {group} समूह में: खोलने के लिए दबाकर रखें + {home}, not shown now {home}, अभी नहीं दिखाया गया @plural {n} result|{n} results {n} परिणाम|{n} परिणाम @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} में से {shown} परिणाम। इन्हें सीमित करने के लिए लिखते रहें।|{n} में से {shown} परिणाम। इन्हें सीमित करने के लिए लिखते रहें। Recent Commands हाल के आदेश diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 708bcac172..a9902799c3 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3918,6 +3918,9 @@ mark-style Japanese Japán No menu item Nincs menüpont Toolbar Eszköztár {toolbar}, in the {tool} group {toolbar}, a(z) {tool} csoportjában + In the menu bar: {path} A menüsorban: {path} + In the {group} group: press and hold to open it A(z) {group} csoportban: a megnyitáshoz nyomja le és tartsa lenyomva + {home}, not shown now {home}, most nem látható @plural {n} result|{n} results {n} találat @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} találatból {shown} látható. Gépeljen tovább a szűkítéshez. Recent Commands Legutóbbi parancsok diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index d61a59f994..8ab7c786ae 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -4150,6 +4150,9 @@ font-technology Variable Variabel No menu item Tidak ada item menu Toolbar Bilah alat {toolbar}, in the {tool} group {toolbar}, dalam grup {tool} + In the menu bar: {path} Di bilah menu: {path} + In the {group} group: press and hold to open it Di grup {group}: tekan dan tahan untuk membukanya + {home}, not shown now {home}, tidak ditampilkan sekarang @plural {n} result|{n} results {n} hasil @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} dari {n} hasil. Terus ketik untuk mempersempitnya. Recent Commands Perintah terbaru diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 57b6c23772..8c568e7d53 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3340,6 +3340,9 @@ digits Malayalam Malayalam No menu item Nessuna voce di menu Toolbar Barra degli strumenti {toolbar}, in the {tool} group {toolbar}, nel gruppo {tool} + In the menu bar: {path} Nella barra dei menu: {path} + In the {group} group: press and hold to open it Nel gruppo {group}: tieni premuto per aprirlo + {home}, not shown now {home}, ora non visibile Tool Strumento Command Comando @plural {n} result|{n} results {n} risultato|{n} risultati diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 240cbe4d7e..2e4896c640 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3218,6 +3218,9 @@ mark-style Japanese 日本式 No menu item メニュー項目なし Toolbar ツールバー {toolbar}, in the {tool} group {toolbar}、{tool} のグループ内 + In the menu bar: {path} メニューバー: {path} + In the {group} group: press and hold to open it {group} のグループ内: 長押しで開きます + {home}, not shown now {home}、現在は表示されていません @plural {n} result|{n} results {n} 件 @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} 件中 {shown} 件。続けて入力すると絞り込めます。 Recent Commands 最近使ったコマンド diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index b20ce14387..b5cdb3505d 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6102,6 +6102,9 @@ font-technology Variable ცვლადი No menu item მენიუს ელემენტი არ არის Toolbar ხელსაწყოთა ზოლი {toolbar}, in the {tool} group {toolbar}, ჯგუფში {tool} + In the menu bar: {path} მენიუს ზოლში: {path} + In the {group} group: press and hold to open it ჯგუფში {group}: გასახსნელად დააჭირეთ და გეჭიროთ + {home}, not shown now {home}, ახლა არ ჩანს @plural {n} result|{n} results {n} შედეგი @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} შედეგიდან {shown}. გააგრძელეთ აკრეფა მათ შესამცირებლად. Recent Commands ბოლო ბრძანებები diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 6151b3b3a1..df53b2d97b 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3207,6 +3207,9 @@ mark-style Japanese 일본식 No menu item 메뉴 항목 없음 Toolbar 도구 모음 {toolbar}, in the {tool} group {toolbar}, {tool} 그룹 + In the menu bar: {path} 메뉴 막대: {path} + In the {group} group: press and hold to open it {group} 그룹: 길게 눌러 여세요 + {home}, not shown now {home}, 지금 표시되지 않음 Tool 도구 Command 명령 @plural {n} result|{n} results 결과 {n}개 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 375216b63e..f2e7e41cef 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4767,6 +4767,9 @@ font-technology Variable Variabel No menu item Geen menu-item Toolbar Gereedschapsbalk {toolbar}, in the {tool} group {toolbar}, in de groep {tool} + In the menu bar: {path} In de menubalk: {path} + In the {group} group: press and hold to open it In de groep {group}: ingedrukt houden om te openen + {home}, not shown now {home}, nu niet zichtbaar @plural {n} result|{n} results {n} resultaat|{n} resultaten @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} van {n} resultaat. Typ verder om ze te beperken.|{shown} van {n} resultaten. Typ verder om ze te beperken. Recent Commands Recente opdrachten diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 60b4a5da8b..483d00fdf9 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4340,6 +4340,9 @@ font-technology Variable Zmienne No menu item Brak pozycji menu Toolbar Pasek narzędzi {toolbar}, in the {tool} group {toolbar}, w grupie {tool} + In the menu bar: {path} Na pasku menu: {path} + In the {group} group: press and hold to open it W grupie {group}: naciśnij i przytrzymaj, aby ją otworzyć + {home}, not shown now {home}, teraz niewidoczne @plural {n} result|{n} results {n} wynik|{n} wyniki|{n} wyników @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} z {n} wyniku. Pisz dalej, aby je zawęzić.|{shown} z {n} wyników. Pisz dalej, aby je zawęzić.|{shown} z {n} wyników. Pisz dalej, aby je zawęzić. Recent Commands Ostatnie polecenia diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 7d90f36d4b..21e82ad1a3 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2756,6 +2756,9 @@ digits Malayalam Malaiala No menu item Nenhum item de menu Toolbar Barra de Ferramentas {toolbar}, in the {tool} group {toolbar}, no grupo {tool} + In the menu bar: {path} Na barra de menus: {path} + In the {group} group: press and hold to open it No grupo {group}: mantenha pressionado para abri-lo + {home}, not shown now {home}, não exibido agora @plural {n} result|{n} results {n} resultado|{n} resultados @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} de {n} resultado. Continue digitando para filtrá-los.|{shown} de {n} resultados. Continue digitando para filtrá-los. Recent Commands Comandos recentes diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 6bd50f8acf..62c73c5b9a 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3329,6 +3329,9 @@ digits Malayalam Малаялам No menu item Нет пункта меню Toolbar Панель инструментов {toolbar}, in the {tool} group {toolbar}, в группе «{tool}» + In the menu bar: {path} В строке меню: {path} + In the {group} group: press and hold to open it В группе {group}: нажмите и удерживайте, чтобы открыть её + {home}, not shown now {home}, сейчас не показано @plural {n} result|{n} results {n} результат|{n} результата|{n} результатов @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} из {n} результата. Продолжайте вводить, чтобы сузить их.|{shown} из {n} результатов. Продолжайте вводить, чтобы сузить их.|{shown} из {n} результатов. Продолжайте вводить, чтобы сузить их. Recent Commands Недавние команды diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 2ac4d2e3cf..a707130a0e 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3215,6 +3215,9 @@ digits Malayalam Malayalam No menu item Inget menyalternativ Toolbar Verktygsfält {toolbar}, in the {tool} group {toolbar}, i gruppen {tool} + In the menu bar: {path} I menyraden: {path} + In the {group} group: press and hold to open it I gruppen {group}: tryck och håll ned för att öppna den + {home}, not shown now {home}, visas inte nu @plural {n} result|{n} results {n} resultat|{n} resultat @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {shown} av {n} resultat. Fortsätt skriva för att begränsa dem.|{shown} av {n} resultat. Fortsätt skriva för att begränsa dem. Recent Commands Senaste kommandon diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index a756b478f7..6ca949c7f7 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3087,6 +3087,9 @@ digits Malayalam Malayalam No menu item Menü öğesi yok Toolbar Araç Çubuğu {toolbar}, in the {tool} group {toolbar}, {tool} grubunda + In the menu bar: {path} Menü çubuğunda: {path} + In the {group} group: press and hold to open it {group} grubunda: açmak için basılı tutun + {home}, not shown now {home}, şu anda gösterilmiyor @plural {n} result|{n} results {n} sonuç @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. {n} sonuçtan {shown} tanesi. Daraltmak için yazmaya devam edin. Recent Commands Son komutlar diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 047f5e3c92..7822b8747f 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3332,6 +3332,9 @@ digits Malayalam Малаялам No menu item Немає пункту меню Toolbar Панель інструментів {toolbar}, in the {tool} group {toolbar}, у групі «{tool}» + In the menu bar: {path} У рядку меню: {path} + In the {group} group: press and hold to open it У групі {group}: натисніть і утримуйте, щоб відкрити її + {home}, not shown now {home}, зараз не показано Tool Інструмент Command Команда @plural {n} result|{n} results {n} результат|{n} результати|{n} результатів diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index f8b6148789..a6c88ee160 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3675,6 +3675,9 @@ mark-style Japanese Kiểu Nhật No menu item Không có mục menu Toolbar Thanh công cụ {toolbar}, in the {tool} group {toolbar}, trong nhóm {tool} + In the menu bar: {path} Trên thanh menu: {path} + In the {group} group: press and hold to open it Trong nhóm {group}: nhấn giữ để mở + {home}, not shown now {home}, hiện không hiển thị Tool Công cụ Command Lệnh @plural {n} result|{n} results {n} kết quả diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index ab720c08fc..c1e7a2afc5 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3159,6 +3159,9 @@ digits Malayalam 马拉雅拉姆数字 No menu item 无菜单项 Toolbar 工具栏 {toolbar}, in the {tool} group {toolbar},位于 {tool} 组中 + In the menu bar: {path} 在菜单栏中:{path} + In the {group} group: press and hold to open it 在“{group}”组中:按住即可打开 + {home}, not shown now {home},当前未显示 @plural {n} result|{n} results {n} 个结果 @plural {shown} of {n} result. Keep typing to narrow them.|{shown} of {n} results. Keep typing to narrow them. 共 {n} 个结果,显示 {shown} 个。继续输入以缩小范围。 Recent Commands 最近使用的命令 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 73edaec679..6a791458fc 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4465,6 +4465,9 @@ digits Malayalam 馬來亞拉姆數字 No menu item 無選單項目 Toolbar 工具列 {toolbar}, in the {tool} group {toolbar},位於 {tool} 群組中 + In the menu bar: {path} 在選單列中:{path} + In the {group} group: press and hold to open it 在「{group}」群組中:按住即可開啟 + {home}, not shown now {home},目前未顯示 Tool 工具 Command 指令 @plural {n} result|{n} results {n} 個結果 diff --git a/crates/ui-egui/src/menus/bar.rs b/crates/ui-egui/src/menus/bar.rs index 85588620e8..4481a1a9ce 100644 --- a/crates/ui-egui/src/menus/bar.rs +++ b/crates/ui-egui/src/menus/bar.rs @@ -37,6 +37,7 @@ pub fn menu_bar(app: &mut VectorcraftApp, ui: &mut egui::Ui) -> f32 { for (title, items) in tree.iter() { let text = egui::RichText::new(tl!(title)).size(13.0).color(t.text); let resp = ui.add(egui::Button::new(text)); + crate::palette::note_spot(ui, resp.rect, || crate::palette::SpotAt::Menu((*title).to_string())); egui::Popup::menu(&resp).show(|ui| menu_body(app, ui, items, &mut clicked)); if *title == "File" { file_open = egui::Popup::is_id_open(ui.ctx(), egui::Popup::default_response_id(&resp)); diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index f1ec0e5dd4..1c9c42d1fb 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -560,6 +560,276 @@ fn row_label(e: &Entry, home: &str) -> String { if shortcut.is_empty() { start } else { format!("{start}, {shortcut}") } } +/// A control the highlighted result's callout can point at ([`note_spot`]). +#[derive(Clone, Debug, PartialEq, Eq)] +pub(crate) enum SpotAt { + /// A title of the in-window menu bar, by its English name. + Menu(String), + /// A slot's button on the Tools panel (toolbar none) or on the toolbar made with New Toolbar of + /// this name, and the ids of the tools its group holds. + Slot(Option, Vec), + /// A tool's button on a strip torn off the Tools panel (toolbar none) or off the toolbar made + /// with New Toolbar of this name, and the tool's id. + Strip(Option, String), +} + +/// Where a control was drawn: the viewport and pass, its layer, the clip rectangle and its own. +#[derive(Clone, Debug)] +struct Spot { + at: SpotAt, + viewport: egui::ViewportId, + pass: u64, + layer: egui::LayerId, + clip: egui::Rect, + rect: egui::Rect, +} + +fn spots_id() -> egui::Id { + egui::Id::unique("palette-spots") +} + +/// Where the palette says whether it is open, for [`note_spot`]. +fn spots_wanted_id() -> egui::Id { + egui::Id::unique("palette-spots-wanted") +} + +/// While the palette is open, notes that `ui` drew the control `at` at `rect` in this pass, so the +/// highlighted result's callout can point at it. The menu bar and the toolbars draw before the +/// palette in each pass; `at` is built only while the palette is open. A control that is not +/// wholly in view ([`in_view`]) is not noted, so a pass notes no more controls than the window +/// shows. +pub(crate) fn note_spot(ui: &egui::Ui, rect: egui::Rect, at: impl FnOnce() -> SpotAt) { + let ctx = ui.ctx(); + if !ctx.data(|d| d.get_temp::(spots_wanted_id())).unwrap_or(false) || !in_view(ctx.content_rect(), ui.clip_rect(), rect) { + return; + } + let viewport = ctx.viewport_id(); + let pass = ctx.cumulative_pass_nr_for(viewport); + let spot = Spot { at: at(), viewport, pass, layer: ui.layer_id(), clip: ui.clip_rect(), rect }; + ctx.data_mut(|d| add_spot(d.get_temp_mut_or_default::>(spots_id()), spot)); +} + +/// Adds `spot` to `list`. The first control a viewport notes in a pass drops every control it +/// noted in earlier passes, so the list holds at most one pass of each viewport: no more controls +/// than its windows drew wholly in view. +fn add_spot(list: &mut Vec, spot: Spot) { + if list.iter().rev().find(|s| s.viewport == spot.viewport).is_some_and(|s| s.pass != spot.pass) { + list.retain(|s| s.viewport != spot.viewport || s.pass == spot.pass); + } + list.push(spot); +} + +/// Is `rect`, drawn clipped to `clip`, wholly in view: inside `clip` and inside the window `screen`? +fn in_view(screen: egui::Rect, clip: egui::Rect, rect: egui::Rect) -> bool { + rect.is_finite() && clip.expand(0.5).contains_rect(rect) && screen.expand(0.5).contains_rect(rect) +} + +/// The control noted as `at` in this pass of this viewport, when it is wholly in view and no +/// window or toolbar lies over it ([`covered`]). +fn spot(ctx: &egui::Context, at: impl Fn(&SpotAt) -> bool) -> Option { + let viewport = ctx.viewport_id(); + let pass = ctx.cumulative_pass_nr_for(viewport); + let screen = ctx.content_rect(); + let found = ctx.data_mut(|d| { + d.get_temp_mut_or_default::>(spots_id()) + .iter() + .find(|s| s.viewport == viewport && s.pass == pass && at(&s.at) && in_view(screen, s.clip, s.rect)) + .cloned() + })?; + (!covered(ctx, &found)).then_some(found) +} + +/// Does a shown area above the control `s`'s layer overlap it: a floating panel, a toolbar or a +/// menu? The palette's own backdrop, popup and Recent Commands list do not count (the callout keeps +/// off the popup itself, [`aim`]), nor do tooltips. A layer that is not an area (a docked panel's) +/// is under every area of a higher order. +fn covered(ctx: &egui::Context, s: &Spot) -> bool { + let own = [egui::Id::unique("palette-backdrop"), egui::Id::unique("palette"), recent_list_id()]; + ctx.memory(|m| { + let order: Vec = m.layer_ids().collect(); + let at = order.iter().position(|l| *l == s.layer); + order.iter().enumerate().any(|(i, l)| { + let above = match at { + Some(at) => i > at, + None => l.order > s.layer.order, + }; + above + && l.order < egui::Order::Tooltip + && !own.contains(&l.id) + && m.areas().is_visible(l) + && m.area_rect(l.id).is_some_and(|r| r.intersects(s.rect)) + }) + }) +} + +/// Where the highlighted result lives, as the palette points at it. +enum Pointer { + /// The control that shows the home, the callout's text, and the footer line that names the + /// home when the popup covers the control. + At(Spot, String, String), + /// No control in view shows the home: the footer shows the text. + Footer(String), +} + +/// The footer line for a home that no control in view shows. +fn unseen_line(home: &str) -> String { + crate::i18n::fmt(tl!("{home}, not shown now"), &[("home", home)]) +} + +fn unseen(home: &str) -> Pointer { + Pointer::Footer(unseen_line(home)) +} + +/// How the callout at a control keeps off the palette's popup and off the control. +#[derive(Clone, Copy, PartialEq, Debug)] +enum Aim { + /// Outline the control and show the text in a box beside it. + Box, + /// Outline the control and show the text in the footer: a box beside the control would cover + /// the popup or the control. + Outline, + /// The popup covers the control: no callout, and the footer names the home. + Covered, +} + +/// How the callout at `place` with `text` keeps off the popup at `popup` and off the control. +fn aim(ctx: &egui::Context, popup: Option, place: &Spot, text: &str) -> Aim { + if popup.is_some_and(|p| p.intersects(place.rect)) { + return Aim::Covered; + } + let boxed = callout_box(ctx, place, text, popup).0; + if popup.is_some_and(|p| p.intersects(boxed)) || boxed.intersects(place.rect) { Aim::Outline } else { Aim::Box } +} + +/// The callout for the highlighted result `e`. A tool points at its slot's button on a shown +/// toolbar, in the order of [`tool_home`], or at its button on a strip torn off its group; a +/// result with an item of the in-window menu bar points at the menu's title. A native menu bar, +/// a home that is not in view now and a result with no menu item get a footer line instead. +fn pointer(app: &VectorcraftApp, ctx: &egui::Context, e: &Entry) -> Pointer { + let lang = crate::i18n::current(); + if let Some(id) = e.id.strip_prefix("tool:") { + let Some(tool) = vectorcraft_tools::tool_info(id) else { return unseen(&tool_home(app, id)) }; + let Ok(found) = crate::panels::learn::locate::find(app, tool.id, true) else { return unseen(&tool_home(app, id)) }; + let bar = match &found.target { + crate::panels::learn::locate::Target::Tools => None, + crate::panels::learn::locate::Target::Custom(name) => Some(name.as_str()), + crate::panels::learn::locate::Target::AllTools => return unseen(&tool_home(app, id)), + }; + let place = if found.location == "strip" { + spot(ctx, |at| matches!(at, SpotAt::Strip(b, t) if b.as_deref() == bar && t == tool.id)) + } else { + spot(ctx, |at| matches!(at, SpotAt::Slot(b, tools) if b.as_deref() == bar && tools.iter().any(|t| t == tool.id))) + }; + let Some(place) = place else { return unseen(&tool_home(app, id)) }; + let text = match found.shown.filter(|_| found.location == "flyout").and_then(vectorcraft_tools::tool_info) { + Some(group) => crate::i18n::fmt(tl!("In the {group} group: press and hold to open it"), &[("group", crate::i18n::tr(lang, group.label))]), + None => crate::i18n::tr(lang, tool.label).to_string(), + }; + return Pointer::At(place, text, tool_home(app, id)); + } + let Some(path) = &e.home else { + let shortcut = menus::shown_shortcut(&e.shortcut); + let none = tl!("No menu item"); + return Pointer::Footer(if shortcut.is_empty() { none.to_string() } else { format!("{none}, {shortcut}") }); + }; + // The native bar's application menu gives its items no label of their own. + let full = match e.menu_item { + "" => shown_label(lang, path), + item => format!("{} › {}", shown_label(lang, path), crate::i18n::tr(lang, item)), + }; + let in_bar = crate::i18n::fmt(tl!("In the menu bar: {path}"), &[("path", &full)]); + if app.services.native_menu.is_some() { + return Pointer::Footer(in_bar); + } + let title = path.split(" › ").next().unwrap_or_default(); + match spot(ctx, |at| matches!(at, SpotAt::Menu(t) if t == title)) { + Some(place) => Pointer::At(place, full, in_bar), + None => unseen(&full), + } +} + +/// The callout drawn in the last pass: the outlined control, the box (none when the footer shows +/// the text) and the text. Only tests keep it. +type Callout = Option<(egui::Rect, Option, String)>; + +#[cfg(test)] +fn callout_id() -> egui::Id { + egui::Id::unique("palette-callout") +} + +/// The callout's layer, above the palette's backdrop and popup. +fn callout_painter(ctx: &egui::Context) -> egui::Painter { + ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("palette-callout-layer"))).with_clip_rect(ctx.content_rect()) +} + +/// Where the box with `text` goes beside the control `place`, and its text laid out: under a menu +/// title, and on the canvas side of a toolbar's button (its right when the button is in the +/// window's left half). Beside a button, the text wraps to at most [`BOX_ROWS`] rows to fit +/// between the button and the window's edge, or the palette's popup at `popup` when the popup is +/// on that side. The box stays inside the window. +fn callout_box(ctx: &egui::Context, place: &Spot, text: &str, popup: Option) -> (egui::Rect, Arc) { + let t = Tokens::get(ctx); + let screen = ctx.content_rect(); + let r = place.rect; + let menu = matches!(place.at, SpotAt::Menu(_)); + let right = r.center().x <= screen.center().x; + let mut width = screen.width() - 2.0 * BOX_PAD.x - 8.0; + if !menu { + // Beside a button, the text wraps to fit between the button and the window's edge. + // Narrower room than this leaves the box over the button, and the footer shows the text + // instead ([`aim`]). + let room = if right { screen.right() - r.right() } else { r.left() - screen.left() } - 10.0 - 2.0 * BOX_PAD.x; + if room >= 80.0 { + width = width.min(room); + } + } + if let Some(p) = popup.filter(|_| !menu) { + let room = if right { p.left() - r.right() } else { r.left() - p.right() } - 10.0 - 2.0 * BOX_PAD.x; + // Narrower room than this leaves the box where it would cover the popup, and the footer + // shows the text instead ([`aim`]). + if room >= 80.0 { + width = width.min(room); + } + } + let mut job = egui::text::LayoutJob::simple(text.to_owned(), egui::FontId::proportional(12.0), t.text, width.max(0.0)); + job.wrap = egui::text::TextWrapping { + max_width: width.max(0.0), + max_rows: if menu { 1 } else { BOX_ROWS }, + break_anywhere: false, + overflow_character: Some('…'), + }; + let galley = callout_painter(ctx).layout_job(job); + let size = galley.size() + 2.0 * BOX_PAD; + let at = if menu { + egui::pos2(r.left(), r.bottom() + 4.0) + } else if right { + egui::pos2(r.right() + 6.0, r.center().y - size.y / 2.0) + } else { + egui::pos2(r.left() - 6.0 - size.x, r.center().y - size.y / 2.0) + }; + let x = at.x.min(screen.right() - 4.0 - size.x).max(screen.left() + 4.0); + let y = at.y.min(screen.bottom() - 4.0 - size.y).max(screen.top() + 4.0); + (egui::Rect::from_min_size(egui::pos2(x, y), size), galley) +} + +/// How many rows the text of a box beside a toolbar's button wraps to at most. +const BOX_ROWS: usize = 3; + +/// The space between the callout box's border and its text. +const BOX_PAD: egui::Vec2 = egui::vec2(6.0, 3.0); + +/// Outline the control `place`, and with `text` show it in a box beside it ([`callout_box`], with +/// the popup at `popup`). Returns the box. +fn callout(ctx: &egui::Context, place: &Spot, text: Option<&str>, popup: Option) -> Option { + let t = Tokens::get(ctx); + let painter = callout_painter(ctx); + crate::panels::learn::locate::outline(&painter.with_clip_rect(place.clip.intersect(ctx.content_rect())), place.rect, t.selection); + let (rect, galley) = callout_box(ctx, place, text?, popup); + painter.rect(rect, 4.0, t.panel, egui::Stroke::new(1.0, t.selection), egui::StrokeKind::Inside); + painter.galley(rect.min + BOX_PAD, galley, t.text); + Some(rect) +} + /// The line under the results: how many results matched, how many of them the list holds when it /// can't hold them all, or that none matched. fn footer(listed: usize, total: usize) -> String { @@ -711,6 +981,18 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { // closed it focused another widget, such as a field in a window above the backdrop. let focus_id = egui::Id::unique("palette-focus-before"); let field_id = egui::Id::unique("palette-field"); + // The menu bar and the toolbars note where they draw their controls only while the palette is + // open; the pass that opens it asks for another, which they draw noting them. + let wanted = ctx.data_mut(|d| std::mem::replace(d.get_temp_mut_or_default::(spots_wanted_id()), app.ui.palette_open)); + if app.ui.palette_open && !wanted { + ctx.request_repaint(); + } else if !app.ui.palette_open && wanted { + ctx.data_mut(|d| { + d.remove::>(spots_id()); + #[cfg(test)] + d.remove::(callout_id()); + }); + } if !app.ui.palette_open { let field = ctx.data_mut(|d| { let field = d.get_temp::(field_id); @@ -812,6 +1094,12 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { let screen = ctx.content_rect(); // The highlighted result the rows and the field's description are drawn with. let mut drawn = sel; + // The control that shows where the highlighted result lives, the callout's text, and how the + // footer drawn in this pass keeps the callout off the popup. + let mut pointed: Option<(Spot, String, Aim)> = None; + // The popup as the last pass laid it out: the footer is drawn before this pass's popup has its + // size, and the callout is checked again against that size after the popup is drawn. + let last_popup = ctx.memory(|m| m.area_rect(egui::Id::unique("palette"))); // The backdrop covers the canvas, the toolbars, the docked panels and the app bar under the // popup, in the order of a modal dialog's backdrop (`dialogs::modal::backdrop`), so the press // that closes the palette does not press a control under it. Windows in the Foreground order @@ -821,7 +1109,8 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { }); // The area keeps itself inside the window (egui's `Area::constrain` is on), so in a window too // short for the field, one row and the footer below TOP, the popup moves up. - egui::Area::new(egui::Id::unique("palette")).order(egui::Order::Foreground).anchor(egui::Align2::CENTER_TOP, [0.0, TOP]).show(ctx, |ui| { + let popup_area = egui::Area::new(egui::Id::unique("palette")).order(egui::Order::Foreground).anchor(egui::Align2::CENTER_TOP, [0.0, TOP]); + let area = popup_area.show(ctx, |ui| { let margin: i8 = 10; egui::Frame::popup(ui.style()).fill(t.panel).inner_margin(egui::Margin::same(margin)).show(ui, |ui| { ui.set_width(520.0); @@ -876,12 +1165,14 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { let resized = (view - last_view).abs() > 0.5; // Screen readers stay on the field: its description names the highlighted result and // its place among every match, as the footer counts them. + let mut described = None; if let Some(e) = matches.get(sel) { let rank = if sel + 1 == matches.len() { kept.unwrap_or(sel) } else { sel }; let pos = (rank + 1).to_string(); let of = total.to_string(); let name = row_label(e, &home_text(app, e)); let said = crate::i18n::fmt(tl!("{pos} of {total}: {name}"), &[("pos", &pos), ("total", &of), ("name", &name)]); + described = Some(said.clone()); ui.ctx().accesskit_node_builder(r.id, |node| node.set_description(said)); } if n > 0 { @@ -945,7 +1236,45 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { }); } ui.add_space(6.0); - ui.label(egui::RichText::new(footer(n, total)).color(t.text_dim)); + // The highlighted result's home, after a pointer or a scroll moved the highlight too. In + // the pass that opens the palette, the menu bar and the toolbars have noted nothing yet, + // and the next pass shows it. + let mut hint = None; + match matches.get(sel).filter(|_| wanted).map(|e| pointer(app, ui.ctx(), e)) { + Some(Pointer::At(place, text, covered)) => { + let how = aim(ui.ctx(), last_popup, &place, &text); + hint = match how { + Aim::Box => None, + Aim::Outline => Some(text.clone()), + Aim::Covered => Some(covered), + }; + // Screen readers get the text of a box beside a tool's button, such as how to + // open the group that hides the tool, with the field's description, unless the + // description already holds it. + if how == Aim::Box + && !matches!(place.at, SpotAt::Menu(_)) + && sel == drawn + && let Some(said) = &described + && !said.contains(text.as_str()) + { + let said = format!("{said}, {text}"); + ui.ctx().accesskit_node_builder(r.id, |node| node.set_description(said)); + } + pointed = Some((place, text, how)); + } + Some(Pointer::Footer(text)) => hint = Some(text), + None => {} + } + ui.scope(|ui| { + // The footer stays one line of text tall, as the list's height counts it. + ui.spacing_mut().interact_size.y = 0.0; + ui.horizontal(|ui| { + ui.label(egui::RichText::new(footer(n, total)).color(t.text_dim)); + if let Some(hint) = hint { + ui.add(egui::Label::new(egui::RichText::new(hint).color(t.text_dim)).truncate()); + } + }); + }); if !list_open && !history_focused && ui.input(|i| i.key_pressed(egui::Key::Enter)) @@ -970,6 +1299,24 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { let popup = egui::LayerId::new(egui::Order::Foreground, egui::Id::unique("palette")); let list = egui::LayerId::new(egui::Order::Foreground, recent_list_id()); let outside = presses.into_iter().any(|p| !ctx.layer_id_at(p).is_some_and(|l| l == popup || l == list)); + // The callout keeps off the popup as drawn in this pass. When the popup's new size changes + // which of the three cases applies, the next pass draws the footer to match. + let now = Some(area.response.rect); + let shown: Callout = pointed.and_then(|(place, text, before)| { + let how = aim(ctx, now, &place, &text); + if how != before { + ctx.request_repaint(); + } + match how { + Aim::Covered => None, + Aim::Outline => Some((place.rect, callout(ctx, &place, None, now), text)), + Aim::Box => Some((place.rect, callout(ctx, &place, Some(&text), now), text)), + } + }); + #[cfg(test)] + ctx.data_mut(|d| d.insert_temp::(callout_id(), shown)); + #[cfg(not(test))] + drop(shown); // The pointer or a scroll moved the highlight after the rows were drawn: the next frame draws // it where it now is. if sel != drawn { @@ -2996,4 +3343,517 @@ mod tests { assert!(rows(&nodes).iter().any(|r| r.1 && r.0 == label), "its row is drawn and highlighted"); assert_eq!(field_description(&nodes), format!("{} of {}: {label}", MAX_RESULTS + 1, ranked.len())); } + + impl Window { + /// Opens the palette on `query` and draws until the toolbars and the menu bar have noted + /// their controls: the last frame's screen-reader tree. + fn search(&mut self, query: &str) -> Vec { + self.app.ui.palette_open = true; + self.app.ui.palette_query = query.into(); + self.frame(vec![]); + self.frame(vec![]) + } + + /// The highlighted result's id. + fn highlighted(&self) -> String { + self.ctx.data(|d| d.get_temp::(egui::Id::unique("palette-selected"))).unwrap().4 + } + + /// The callout the last frame drew: the outlined control, the box and its text. + fn callout(&self) -> Callout { + self.ctx.data(|d| d.get_temp::(callout_id())).flatten() + } + + /// The text of the labels in the popup in the screen-reader tree `nodes`: the footer's. + fn popup_labels(&self, nodes: &[egui::accesskit::Node]) -> Vec { + let popup = self.popup(); + nodes + .iter() + .filter(|n| n.role() == egui::accesskit::Role::Label) + .filter(|n| n.bounds().is_some_and(|b| popup.contains(egui::pos2(((b.x0 + b.x1) / 2.0) as f32, ((b.y0 + b.y1) / 2.0) as f32)))) + .filter_map(|n| n.label().or(n.value()).map(str::to_string)) + .collect() + } + } + + /// The bounds of the control whose screen-reader name is `name`, alone or followed by its + /// shortcut in parentheses. + fn bounds_of(nodes: &[egui::accesskit::Node], name: &str) -> egui::Rect { + let at = button_at(nodes, name); + let node = nodes + .iter() + .filter(|n| n.role() == egui::accesskit::Role::Button) + .find(|n| n.bounds().is_some_and(|b| ((b.x0 + b.x1) / 2.0) as f32 == at.x && ((b.y0 + b.y1) / 2.0) as f32 == at.y)) + .unwrap(); + let b = node.bounds().unwrap(); + egui::Rect::from_min_max(egui::pos2(b.x0 as f32, b.y0 as f32), egui::pos2(b.x1 as f32, b.y1 as f32)) + } + + /// Highlighting a result with an item of the in-window menu bar outlines that menu's title, as + /// drawn in the same frame, and the box under it shows the item's whole path. + #[test] + fn the_highlighted_result_outlines_its_menu_title() { + let mut window = Window::new(); + let nodes = window.search("round corners"); + assert_eq!(window.highlighted(), "effect:stylize.roundCorners"); + let (outlined, callout, text) = window.callout().expect("a callout"); + assert_eq!(text, "Effect › Stylize › Round Corners…"); + assert_eq!(outlined, bounds_of(&nodes, "Effect")); + let callout = callout.expect("a box"); + assert!(callout.top() >= outlined.bottom(), "the box is under the title: {callout:?} {outlined:?}"); + // A panel's home is the Window menu. + window.search("layers"); + assert_eq!(window.highlighted(), "panel:layers"); + let (outlined, _, text) = window.callout().expect("a callout"); + assert_eq!(text, "Window › Layers"); + assert_eq!(outlined, bounds_of(&window.frame(vec![]), "Window")); + // Closing the palette ends the callout. + window.app.ui.palette_open = false; + window.frame(vec![]); + assert_eq!(window.callout(), None); + } + + struct NativeMenus; + impl crate::native_menu::Backend for NativeMenus { + fn sync(&mut self, _: &crate::native_menu::MenuBar) {} + fn drain(&mut self) -> Vec { + Vec::new() + } + } + + /// With the system's menu bar, nothing is drawn over it: the footer names the menu path. + #[test] + fn with_a_native_menu_bar_the_footer_names_the_path() { + let mut window = Window::new(); + window.app.services.native_menu = Some(crate::native_menu::NativeMenu::new(Box::new(NativeMenus))); + let nodes = window.search("round corners"); + assert_eq!(window.highlighted(), "effect:stylize.roundCorners"); + assert_eq!(window.callout(), None); + assert!(labels(&nodes).contains(&"In the menu bar: Effect › Stylize › Round Corners…".to_string()), "{:?}", labels(&nodes)); + // The application menu's items have no label of their own: the path ends at the menu. + let nodes = window.search("help.about"); + assert_eq!(window.highlighted(), "help.about"); + let menu = format!("In the menu bar: {}", crate::native_menu::APP_NAME); + assert!(labels(&nodes).contains(&menu), "{:?}", labels(&nodes)); + } + + /// A tool hidden in a group outlines its group's button and says how to open the group; once + /// chosen from the group, the button shows it and the box names the tool alone. The box is on + /// the canvas side of the toolbar. + #[test] + fn a_tool_result_outlines_its_toolbar_slot() { + let mut window = Window::new(); + let nodes = window.search("group selection tool"); + assert_eq!(window.highlighted(), "tool:groupSelection"); + let (outlined, callout, text) = window.callout().expect("a callout"); + assert_eq!(text, "In the Direct Selection Tool group: press and hold to open it"); + assert_eq!(outlined, bounds_of(&nodes, "Direct Selection Tool")); + // Screen readers hear how to open the group with the search field's description. + let said: Vec<_> = nodes.iter().filter(|n| n.role() == egui::accesskit::Role::TextInput).filter_map(|n| n.description()).collect(); + assert!(said.iter().any(|d| d.ends_with(", In the Direct Selection Tool group: press and hold to open it")), "{said:?}"); + let callout = callout.expect("a box"); + assert!(callout.left() > outlined.right(), "right of a toolbar docked left: {callout:?} {outlined:?}"); + window.app.select_tool("groupSelection"); + let nodes = window.search("group selection tool"); + let (outlined, _, text) = window.callout().unwrap_or_else(|| panic!("a callout: {:?} {:?}", labels(&nodes), window.popup())); + assert_eq!(text, "Group Selection Tool"); + assert_eq!(outlined, bounds_of(&nodes, "Group Selection Tool")); + // Docked right, the box goes on its left. The Zoom Tool's slot is below the popup. + window.app.ui.toolbar_right = true; + window.frame(vec![]); + let nodes = window.search("zoom tool"); + assert_eq!(window.highlighted(), "tool:zoom"); + let (outlined, callout, text) = window.callout().unwrap_or_else(|| panic!("a callout: {:?} {:?}", labels(&nodes), window.popup())); + assert_eq!(text, "Zoom Tool"); + assert!(!window.popup().intersects(outlined), "{outlined:?} {:?}", window.popup()); + let callout = callout.expect("a box"); + assert!(callout.right() < outlined.left(), "left of a toolbar docked right: {callout:?} {outlined:?}"); + } + + /// A shown toolbar made with New Toolbar called Drawing that floats at `pos` and holds the Pen + /// Tool and the Curvature Tool in one group. + fn drawing_toolbar(pos: [f32; 2]) -> crate::state::CustomToolbar { + crate::state::CustomToolbar { + name: "Drawing".into(), + slots: vec![vec!["pen".into(), "curvature".into()]], + shown: true, + pos, + dock: None, + dock_right: false, + slot_tool: Default::default(), + double: false, + floating: vec![], + } + } + + /// With the Tools panel hidden, a shown toolbar made with New Toolbar that holds the tool gets + /// the outline; a group torn off it into a strip has the tool's own button outlined. + #[test] + fn a_tool_on_a_toolbar_made_with_new_toolbar_is_outlined_there() { + let mut window = Window::new(); + window.app.ui.toolbar = false; + window.app.ui.custom_toolbars.push(drawing_toolbar([100.0, 200.0])); + let nodes = window.search("pen tool"); + assert_eq!(window.highlighted(), "tool:pen"); + let (outlined, callout, text) = window.callout().expect("a callout"); + assert_eq!(text, "Pen Tool"); + assert!(callout.is_some()); + assert_eq!(outlined, bounds_of(&nodes, "Pen Tool")); + assert!(outlined.left() >= 100.0, "on the toolbar made with New Toolbar: {outlined:?}"); + // The group torn off into a strip. + window.app.ui.custom_toolbars[0] + .floating + .push(crate::state::FloatingFlyout { tools: vec!["pen".into(), "curvature".into()], pos: [600.0, 500.0] }); + window.frame(vec![]); + window.frame(vec![]); + let (outlined, _, text) = window.callout().expect("a callout"); + assert_eq!(text, "Pen Tool"); + assert!(outlined.left() >= 600.0 && outlined.top() >= 500.0, "on the strip: {outlined:?}"); + } + + /// A group torn off the Tools panel into a strip has the tool's own button on the strip + /// outlined, with the tool's name. + #[test] + fn a_strip_torn_off_the_tools_panel_is_pointed_at() { + let mut window = Window::new(); + let slot = crate::toolbar::slots(&window.app).into_iter().map(|(_, s)| s).find(|s| s.contains(&"groupSelection")).expect("the group"); + let tools = slot.iter().map(|t| t.to_string()).collect(); + window.app.ui.floating_flyouts.push(crate::state::FloatingFlyout { tools, pos: [600.0, 500.0] }); + window.frame(vec![]); + window.search("group selection tool"); + assert_eq!(window.highlighted(), "tool:groupSelection"); + let (outlined, callout, text) = window.callout().expect("a callout"); + assert_eq!(text, "Group Selection Tool"); + assert!(callout.is_some()); + assert!(outlined.left() >= 600.0 && outlined.top() >= 500.0, "on the strip: {outlined:?}"); + } + + /// Two viewports that note controls in turn keep one pass each in the list, whichever noted + /// first, also after one of them stops noting controls. + #[test] + fn the_noted_controls_hold_one_pass_per_viewport() { + let rect = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(10.0, 10.0)); + let spot = |viewport: egui::ViewportId, pass: u64| Spot { + at: SpotAt::Menu("File".into()), + viewport, + pass, + layer: egui::LayerId::background(), + clip: rect, + rect, + }; + let (a, b) = (egui::ViewportId::ROOT, egui::ViewportId::from_hash_of("another window")); + let mut list = Vec::new(); + for pass in 0..20 { + for _ in 0..3 { + add_spot(&mut list, spot(a, pass)); + } + for _ in 0..2 { + add_spot(&mut list, spot(b, pass)); + } + assert_eq!(list.len(), 5, "pass {pass}"); + assert!(list.iter().all(|s| s.pass == pass), "pass {pass}"); + } + // The other window stops noting controls. + for pass in 20..40 { + for _ in 0..3 { + add_spot(&mut list, spot(a, pass)); + } + assert_eq!(list.len(), 5, "pass {pass}"); + } + } + + /// Beside a button, the box's text wraps to at most three rows to fit between the button and + /// the popup; with no popup beside it, it is one row. + #[test] + fn a_box_beside_a_button_wraps_to_fit_beside_the_popup() { + let ctx = egui::Context::default(); + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0)); + let mut checked = false; + let input = egui::RawInput { screen_rect: Some(screen), ..Default::default() }; + let mut out = ctx.run_ui(input, |ui| { + let ctx = ui.ctx(); + let rect = egui::Rect::from_min_size(egui::pos2(20.0, 100.0), egui::vec2(28.0, 28.0)); + let place = Spot { at: SpotAt::Slot(None, vec![]), viewport: ctx.viewport_id(), pass: 0, layer: ui.layer_id(), clip: screen, rect }; + let popup = egui::Rect::from_min_size(egui::pos2(rect.right() + 150.0, 50.0), egui::vec2(400.0, 300.0)); + let text = "In the Direct Selection Tool group: press and hold to open it"; + let (boxed, galley) = callout_box(ctx, &place, text, Some(popup)); + assert!((2..=BOX_ROWS).contains(&galley.rows.len()), "{} rows", galley.rows.len()); + assert!(boxed.left() > rect.right() && boxed.right() <= popup.left(), "{boxed:?} {popup:?}"); + let (_, one) = callout_box(ctx, &place, text, None); + assert_eq!(one.rows.len(), 1); + checked = true; + }); + out.textures_delta.clear(); + assert!(checked); + } + + /// The box never covers the button it points at: in a narrow window it wraps to fit between + /// the button and the window's edge, and where it cannot, only the outline is drawn and the + /// footer shows the text. + #[test] + fn the_box_keeps_off_its_button() { + let text = "In the Direct Selection Tool group: press and hold to open it"; + let check = |width: f32, left: f32| { + let ctx = egui::Context::default(); + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(width, 300.0)); + let mut how = None; + let input = egui::RawInput { screen_rect: Some(screen), ..Default::default() }; + let mut out = ctx.run_ui(input, |ui| { + let ctx = ui.ctx(); + let rect = egui::Rect::from_min_size(egui::pos2(left, 100.0), egui::vec2(28.0, 28.0)); + let place = Spot { at: SpotAt::Slot(None, vec![]), viewport: ctx.viewport_id(), pass: 0, layer: ui.layer_id(), clip: screen, rect }; + let aimed = aim(ctx, None, &place, text); + if aimed == Aim::Box { + let (boxed, _) = callout_box(ctx, &place, text, None); + assert!(!boxed.intersects(rect) && screen.contains_rect(boxed), "{boxed:?} {rect:?}"); + } + how = Some(aimed); + }); + out.textures_delta.clear(); + how + }; + assert_eq!(check(400.0, 180.0), Some(Aim::Box)); + assert_eq!(check(400.0, 192.0), Some(Aim::Box)); + assert_eq!(check(180.0, 60.0), Some(Aim::Outline)); + } + + /// The callout never covers the palette: a button under the popup is not pointed at, and a + /// button whose box would cover the popup is outlined with its text in the footer. + #[test] + fn the_callout_stays_off_the_palette() { + let mut window = Window::new(); + window.app.ui.toolbar = false; + window.app.ui.custom_toolbars.push(drawing_toolbar([600.0, 120.0])); + let nodes = window.search("pen tool"); + assert_eq!(window.highlighted(), "tool:pen"); + assert!(window.popup().contains(egui::pos2(620.0, 140.0)), "the toolbar is under the popup: {:?}", window.popup()); + assert_eq!(window.callout(), None); + // The toolbar is shown, under the popup: the footer names it and does not say it is hidden. + let footer = window.popup_labels(&nodes); + assert!(footer.contains(&"Drawing".to_string()), "{footer:?}"); + assert!(!footer.iter().any(|l| l.contains("not shown now")), "{footer:?}"); + // Left of the popup, with the box's place to its right on the popup. + let popup = window.popup(); + window.app.ui.custom_toolbars[0].pos = [popup.left() - 60.0, popup.top() + 30.0]; + window.frame(vec![]); + let nodes = window.frame(vec![]); + let (outlined, callout, text) = window.callout().expect("a callout"); + assert!(!popup.intersects(outlined), "{outlined:?} {popup:?}"); + assert_eq!((callout, text.as_str()), (None, "Pen Tool")); + assert!(labels(&nodes).contains(&"Pen Tool".to_string()), "{:?}", labels(&nodes)); + } + + /// In the pass where more results make the popup taller and it now covers the button, the + /// callout is checked against the popup's new size, and the next pass's footer names the home. + #[test] + fn the_callout_keeps_off_a_popup_that_grew_in_the_same_pass() { + let mut window = Window::new(); + window.app.ui.toolbar = false; + window.app.ui.custom_toolbars.push(drawing_toolbar([100.0, 120.0])); + window.search("pen tool"); + let small = window.popup(); + window.app.ui.custom_toolbars[0].pos = [small.center().x, small.bottom() + 2.0]; + window.frame(vec![]); + window.frame(vec![]); + assert_eq!(window.highlighted(), "tool:pen"); + let (outlined, ..) = window.callout().expect("a callout below the popup"); + window.app.ui.palette_query = "pen".into(); + window.frame(vec![]); + assert_eq!(window.highlighted(), "tool:pen"); + assert!(window.popup().intersects(outlined), "the popup grew over the button: {:?} {outlined:?}", window.popup()); + assert_eq!(window.callout(), None); + let nodes = window.frame(vec![]); + let footer = window.popup_labels(&nodes); + assert!(footer.contains(&"Drawing".to_string()), "{footer:?}"); + assert!(!footer.iter().any(|l| l.contains("not shown now")), "{footer:?}"); + } + + /// No callout where no control in view shows the home: in Presentation Mode, with the Tools + /// panel hidden, and for a command with no menu item. The footer says where it lives. + #[test] + fn a_home_out_of_view_is_named_in_the_footer() { + let mut window = Window::new(); + window.app.ui.screen_mode = 3; + let nodes = window.search("pen tool"); + assert_eq!(window.highlighted(), "tool:pen"); + assert_eq!(window.callout(), None); + assert!(labels(&nodes).contains(&"Toolbar, not shown now".to_string()), "{:?}", labels(&nodes)); + window.app.ui.screen_mode = 0; + window.app.ui.toolbar = false; + let nodes = window.search("pen tool"); + assert_eq!(window.callout(), None); + assert!(labels(&nodes).contains(&"Toolbar, not shown now".to_string()), "{:?}", labels(&nodes)); + // Toolbars hidden with Tab. + window.app.ui.toolbar = true; + window.app.run("window.dock", serde_json::json!({})).expect("Tab"); + assert!(window.app.ui.tab_hid.is_some()); + let nodes = window.search("pen tool"); + assert_eq!(window.highlighted(), "tool:pen"); + assert_eq!(window.callout(), None); + assert!(labels(&nodes).contains(&"Toolbar, not shown now".to_string()), "{:?}", labels(&nodes)); + window.app.run("window.dock", serde_json::json!({})).expect("Tab"); + assert!(window.app.ui.tab_hid.is_none() && window.app.ui.toolbar); + let entries = entries(&window.ctx, Lang::EN); + let none = entries.iter().find(|e| e.home.is_none() && !e.id.starts_with("tool:") && e.shortcut.is_empty()).expect("no menu item"); + let nodes = window.search(&none.id); + assert_eq!(window.highlighted(), none.id); + assert_eq!(window.callout(), None); + assert!(labels(&nodes).contains(&"No menu item".to_string()), "{:?}", labels(&nodes)); + // With a shortcut, the footer gives it. + let keyed = entries.iter().find(|e| e.home.is_none() && !e.id.starts_with("tool:") && !e.shortcut.is_empty()).expect("a shortcut"); + let nodes = window.search(&keyed.id); + assert_eq!(window.highlighted(), keyed.id); + assert_eq!(window.callout(), None); + let line = format!("No menu item, {}", menus::shown_shortcut(&keyed.shortcut)); + assert!(labels(&nodes).contains(&line), "{line} in {:?}", labels(&nodes)); + } + + /// In the pass that opens the palette, the menu bar and the toolbars have noted no control yet: + /// the footer does not call a home that is in view "not shown now", and the next pass points + /// at it. + #[test] + fn the_pass_that_opens_the_palette_names_no_home_as_hidden() { + let mut window = Window::new(); + // Opened once and closed, the popup has its size, so the pass that opens it again draws + // it. One pass a frame, so the frame shows that pass. + window.search("pen tool"); + window.app.ui.palette_open = false; + window.frame(vec![]); + window.ctx.options_mut(|o| o.max_passes = std::num::NonZeroUsize::MIN); + window.app.ui.palette_open = true; + let nodes = window.frame(vec![]); + assert_eq!(window.highlighted(), "tool:pen"); + let footer = window.popup_labels(&nodes); + assert!(!footer.is_empty(), "the popup is drawn: {:?}", labels(&nodes)); + assert!(!footer.iter().any(|l| l.contains("not shown now")), "{footer:?}"); + window.frame(vec![]); + assert!(window.callout().is_some()); + } + + /// Moving the pointer onto a row moves the callout to that result's home in the same frame. + #[test] + fn the_callout_follows_the_pointer() { + let mut window = Window::new(); + let nodes = window.search("select"); + let entries = entries(&window.ctx, Lang::EN); + let x = window.popup().center().x; + let target = rows(&nodes) + .into_iter() + .filter(|r| !r.1) + .find_map(|r| { + let e = entries.iter().find(|e| row_label(e, &home_text(&window.app, e)) == r.0)?; + let path = e.home.as_ref().filter(|_| !e.id.starts_with("tool:") && !e.menu_item.is_empty())?; + Some((e.id.clone(), format!("{path} › {}", e.menu_item), (r.2 + r.3) / 2.0)) + }) + .expect("a row with a menu item"); + let (id, text, y) = target; + window.frame(vec![egui::Event::PointerMoved(egui::pos2(x, y as f32 - 3.0))]); + window.frame(vec![egui::Event::PointerMoved(egui::pos2(x, y as f32))]); + assert_eq!(window.highlighted(), id); + assert_eq!(window.callout().map(|c| c.2), Some(text)); + } + + /// Down moves the callout to the next result's home in the same frame, and moving the + /// highlight changes no toolbar, flyout, drawer or tool. + #[test] + fn the_callout_follows_the_highlight_and_reveals_nothing() { + let mut window = Window::new(); + window.search("select"); + let before = (window.app.ui.flyout, window.app.ui.tools_drawer, window.app.ui.toolbar, window.app.session.tool_id()); + let entries = entries(&window.ctx, Lang::EN); + for _ in 0..6 { + let key = + egui::Event::Key { key: egui::Key::ArrowDown, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE }; + window.frame(vec![key]); + let id = window.highlighted(); + let e = entries.iter().find(|e| e.id == id).unwrap(); + let callout = window.callout(); + if let Some(path) = e.home.as_ref().filter(|_| !id.starts_with("tool:")) { + assert_eq!(callout.map(|c| c.2), Some(format!("{path} › {}", e.menu_item)), "{id}"); + } + assert!(window.app.ui.learn_locate.is_none()); + } + let after = (window.app.ui.flyout, window.app.ui.tools_drawer, window.app.ui.toolbar, window.app.session.tool_id()); + assert_eq!(before, after); + } + + /// Every catalog translates the callout's and the footer's words. + #[test] + fn catalogs_translate_the_callout_words() { + let words = ["In the menu bar: {path}", "In the {group} group: press and hold to open it", "{home}, not shown now"]; + let missing: Vec = Lang::all() + .filter(|l| *l != Lang::EN) + .flat_map(|l| words.iter().filter(move |w| !crate::i18n::has(l, w)).map(move |w| format!("{}: {w}", l.code()))) + .collect(); + assert!(missing.is_empty(), "{missing:?}"); + } + + /// A control noted in an earlier pass, in another viewport or clipped by its scroll area is not + /// pointed at; the box stays inside a narrow window. + #[test] + fn only_a_control_in_view_in_this_pass_is_pointed_at() { + let ctx = egui::Context::default(); + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(300.0, 200.0)); + let mut checked = false; + for _ in 0..2 { + let input = egui::RawInput { screen_rect: Some(screen), ..Default::default() }; + let mut out = ctx.run_ui(input, |ui| { + let ctx = ui.ctx(); + let pass = ctx.cumulative_pass_nr_for(ctx.viewport_id()); + let rect = egui::Rect::from_min_size(egui::pos2(270.0, 10.0), egui::vec2(28.0, 28.0)); + let at = |name: &str| SpotAt::Menu(name.into()); + let spot = |name: &str, viewport, pass, clip| Spot { at: at(name), viewport, pass, layer: ui.layer_id(), clip, rect }; + let list = vec![ + spot("old", ctx.viewport_id(), pass.wrapping_sub(1), screen), + spot("other", egui::ViewportId::from_hash_of("detached"), pass, screen), + spot("clipped", ctx.viewport_id(), pass, egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(280.0, 200.0))), + spot("shown", ctx.viewport_id(), pass, screen), + ]; + ctx.data_mut(|d| d.insert_temp(spots_id(), list)); + for name in ["old", "other", "clipped"] { + assert!(super::spot(ctx, |a| *a == at(name)).is_none(), "{name}"); + } + let shown = super::spot(ctx, |a| *a == at("shown")).expect("shown"); + let text = "Effect › Stylize › Round Corners… and a long tail of words"; + let r = callout(ctx, &Spot { at: SpotAt::Slot(None, vec![]), ..shown.clone() }, Some(text), None).unwrap(); + assert!(screen.contains_rect(r), "{r:?}"); + let r = callout(ctx, &shown, Some(text), None).unwrap(); + assert!(screen.contains_rect(r), "{r:?}"); + checked = true; + }); + out.textures_delta.clear(); + } + assert!(checked); + } + + /// A control under a window drawn above its layer is not pointed at; with the window moved off + /// it, it is. + #[test] + fn a_control_under_a_window_is_not_pointed_at() { + let ctx = egui::Context::default(); + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(400.0, 300.0)); + let rect = egui::Rect::from_min_size(egui::pos2(20.0, 20.0), egui::vec2(28.0, 28.0)); + let at = || SpotAt::Menu("bar".into()); + for (cover_at, pointed) in [(egui::pos2(10.0, 10.0), false), (egui::pos2(200.0, 150.0), true)] { + let mut seen = None; + // The second pass sees both areas laid out. + for _ in 0..2 { + let input = egui::RawInput { screen_rect: Some(screen), ..Default::default() }; + let mut out = ctx.run_ui(input, |ui| { + let ctx = ui.ctx().clone(); + ctx.data_mut(|d| d.insert_temp(spots_wanted_id(), true)); + egui::Area::new(egui::Id::unique("test-toolbar")).order(egui::Order::Middle).fixed_pos(egui::Pos2::ZERO).show(&ctx, |ui| { + ui.allocate_rect(rect, egui::Sense::hover()); + note_spot(ui, rect, at); + }); + egui::Area::new(egui::Id::unique("test-cover")).order(egui::Order::Middle).fixed_pos(cover_at).show(&ctx, |ui| { + ui.allocate_space(egui::vec2(80.0, 80.0)); + }); + seen = Some(super::spot(&ctx, |a| *a == at()).is_some()); + }); + out.textures_delta.clear(); + } + assert_eq!(seen, Some(pointed), "{cover_at:?}"); + } + } } diff --git a/crates/ui-egui/src/panels/learn/locate.rs b/crates/ui-egui/src/panels/learn/locate.rs index 607da1c45c..b678049c0e 100644 --- a/crates/ui-egui/src/panels/learn/locate.rs +++ b/crates/ui-egui/src/panels/learn/locate.rs @@ -103,8 +103,12 @@ pub(crate) fn mark(app: &mut VectorcraftApp, ctx: &Context, layer: LayerId, clip l.drawn = true; ctx.request_repaint_after_secs(left as f32); let t = Tokens::get(ctx); - let painter = ctx.layer_painter(layer).with_clip_rect(clip.intersect(ctx.content_rect())); - painter.rect_stroke(rect.shrink(1.0), CornerRadius::same(6), Stroke::new(MARK_WIDTH, t.selection), StrokeKind::Inside); + outline(&ctx.layer_painter(layer).with_clip_rect(clip.intersect(ctx.content_rect())), rect, t.selection); +} + +/// Outline `rect`, a control that a mark points at, with `painter` in `color`. +pub(crate) fn outline(painter: &egui::Painter, rect: Rect, color: egui::Color32) { + painter.rect_stroke(rect.shrink(1.0), CornerRadius::same(6), Stroke::new(MARK_WIDTH, color), StrokeKind::Inside); } /// After the toolbars and panels have drawn: Escape ends the locate, also an Escape that closed the @@ -161,46 +165,76 @@ pub(crate) fn locate_tool(app: &mut VectorcraftApp, p: &Value) -> Result return Err(format!("`{key}` must be a string")), }; let tool = vectorcraft_tools::tool_info(tool).ok_or_else(|| format!("unknown tool `{tool}`"))?.id; + let found = match find(app, tool, false) { + Ok(found) => found, + Err(reason) => return Ok(unavailable(tool, reason)), + }; + match found.target { + Target::Tools => { + app.ui.toolbar = true; + start(app, tool, Target::Tools); + Ok(json!({"tool": tool, "location": found.location, "toolbar": null})) + } + Target::Custom(name) => { + start(app, tool, Target::Custom(name.clone())); + Ok(json!({"tool": tool, "location": found.location, "toolbar": name})) + } + Target::AllTools => { + app.run("window.editToolbar", json!({"open": true}))?; + start(app, tool, Target::AllTools); + Ok(json!({"tool": tool, "location": "allTools", "toolbar": null})) + } + } +} + +/// Where a toolbar holds a tool: [`find`]'s answer. +#[derive(Clone, Debug, PartialEq, Eq)] +pub(crate) struct Found { + /// The control that shows the tool. + pub target: Target, + /// `toolbar` (its slot's button shows it), `flyout` (it is hidden in its slot's group), + /// `strip` (its group is torn off into a strip) or `allTools`. + pub location: &'static str, + /// The tool the slot's button shows, for `toolbar` and `flyout`. + pub shown: Option<&'static str>, +} + +/// Where `tool` is in the current layout, without showing or opening anything: the Tools panel's +/// toolbar first, also while Window › Tools hides it, then the shown toolbars made with New +/// Toolbar, else the All Tools drawer. With `shown_first`, a hidden Tools panel comes after the +/// toolbars made with New Toolbar. An error names why no toolbar can show the tool now. +pub(crate) fn find(app: &VectorcraftApp, tool: &'static str, shown_first: bool) -> Result { if app.ui.screen_mode >= 3 { - return Ok(unavailable(tool, "Presentation Mode hides the toolbars: change the screen mode to show them")); + return Err("Presentation Mode hides the toolbars: change the screen mode to show them"); } // Tab hides the toolbars made with New Toolbar until the next Tab, also once Window › Tools // shows the Tools panel again. let tab_hid = app.ui.tab_hid.is_some(); if tab_hid && !app.ui.toolbar { - return Ok(unavailable(tool, "Tab has hidden the toolbars: press Tab to show them")); + return Err("Tab has hidden the toolbars: press Tab to show them"); } - if let Some(slot) = crate::toolbar::slots(app).into_iter().map(|(_, s)| s).find(|s| s.contains(&tool)) { - let location = if slot.len() > 1 && crate::toolbar::is_floating(app, None, slot[0]) { - "strip" - } else if crate::toolbar::shown_tool(app, &slot) == tool { - "toolbar" + let main = crate::toolbar::slots(app).into_iter().map(|(_, s)| s).find(|s| s.contains(&tool)).map(|slot| { + if slot.len() > 1 && crate::toolbar::is_floating(app, None, slot[0]) { + Found { target: Target::Tools, location: "strip", shown: None } } else { - "flyout" - }; - app.ui.toolbar = true; - start(app, tool, Target::Tools); - return Ok(json!({"tool": tool, "location": location, "toolbar": null})); + let shown = crate::toolbar::shown_tool(app, &slot); + Found { target: Target::Tools, location: if shown == tool { "toolbar" } else { "flyout" }, shown: Some(shown) } + } + }); + if let Some(main) = main.clone().filter(|_| !shown_first || app.ui.toolbar) { + return Ok(main); } let active = app.session.tool_id(); let custom = app.ui.custom_toolbars.iter().filter(|b| b.shown && !tab_hid).find_map(|bar| { let slot = bar.slots.iter().find(|s| s.iter().any(|t| t == tool))?; let tools: Vec<&'static str> = slot.iter().filter_map(|id| vectorcraft_tools::tool_info(id).map(|t| t.id)).collect(); let first = *tools.first()?; - let location = if tools.len() > 1 && crate::toolbar::is_floating(app, Some(&bar.name), first) { - "strip" - } else if crate::custom_toolbars::shown_tool(bar, active, &tools) == Some(tool) { - "toolbar" - } else { - "flyout" - }; - Some((bar.name.clone(), location)) + let target = Target::Custom(bar.name.clone()); + if tools.len() > 1 && crate::toolbar::is_floating(app, Some(&bar.name), first) { + return Some(Found { target, location: "strip", shown: None }); + } + let shown = crate::custom_toolbars::shown_tool(bar, active, &tools); + Some(Found { target, location: if shown == Some(tool) { "toolbar" } else { "flyout" }, shown }) }); - if let Some((name, location)) = custom { - start(app, tool, Target::Custom(name.clone())); - return Ok(json!({"tool": tool, "location": location, "toolbar": name})); - } - app.run("window.editToolbar", json!({"open": true}))?; - start(app, tool, Target::AllTools); - Ok(json!({"tool": tool, "location": "allTools", "toolbar": null})) + Ok(custom.or(main).unwrap_or(Found { target: Target::AllTools, location: "allTools", shown: None })) } diff --git a/crates/ui-egui/src/toolbar.rs b/crates/ui-egui/src/toolbar.rs index c8cbd94cfd..7372d424f7 100644 --- a/crates/ui-egui/src/toolbar.rs +++ b/crates/ui-egui/src/toolbar.rs @@ -299,6 +299,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut Ui, cols: usize, floating: Option, key: &str) -> egui::Id { /// One icon button per tool, the active one lit, with its name and shortcut on hover. Returns the /// tool clicked and the button of `locate`. -fn tool_strip(ui: &mut Ui, t: &Tokens, active: &str, tools: &[String], locate: Option<&str>) -> (Option<&'static str>, Option) { +fn tool_strip( + ui: &mut Ui, + t: &Tokens, + active: &str, + tools: &[String], + toolbar: Option<&str>, + locate: Option<&str>, +) -> (Option<&'static str>, Option) { let mut chosen = None; let mut located = None; for tool in tools.iter().filter_map(|id| tool_info(id)) { let (r, resp) = ui.allocate_exact_size(STRIP_BUTTON, Sense::click()); + crate::palette::note_spot(ui, r, || crate::palette::SpotAt::Strip(toolbar.map(str::to_string), tool.id.to_string())); let well = r.shrink(1.0); if active == tool.id { ui.painter().rect_filled(well, CornerRadius::same(6), t.tool_active); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 2059f3d35d..ed127fd7a2 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1337,6 +1337,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur A Command Palette query word also finds a result whose name or menu path holds a word with the same meaning: "remove bg" lists Remove Background… first, "outline text" lists Type › Create Outlines first, and "flip", "combine", "vectorize" and "colour" list Reflect…, Unite, an Image Trace command and the Color panel among the first 3 results. The words come from VectorCraft's own table of 21 groups of English words (`palette/words.rs`, at most 60 groups of at most 6 words); a word that is the whole label of another command, such as Merge or Mirror, is in no group, and neither is Insert. A word or its English base word that is in a group meets the other words of its group in labels and menu paths, and their base words, but not ids or word starts. A result whose label holds the word itself ranks above one whose label holds a word with the same meaning, which ranks above one whose menu path holds the word, so "type" now lists Scale Text Attributes above Type › Orientation › Vertical. A catalog may add a group's words in its language with a row in the `search` context (the group's English words joined by ", ", then that language's words), used while that language is the UI language; no catalog has to have these rows (`palette::search` tests `a_word_with_the_same_meaning_finds_the_result`, `a_catalog_row_adds_words_to_a_group`, `words_with_the_same_meaning_find_the_command`; `palette::words` tests; `i18n` test `search_rows_name_a_group_and_add_single_words`). A Command Palette query word also finds a command by what the command's description says: "transparent background" lists Remove Background… among the first 3 results, and "png" lists it after every result with "png" in its name or menu path. The description is the command's params text (an engine or plug-in command's, a UI command's, or an effect's) without each `{…}` group that is not inside a `{`, `[` or `(` group, without each such `[…]` or `(…)` group just after a `→`, and without the `→` before a removed group, cut to its first 300 characters at the end of a word. The words of a schema ("corners" for Remove Background…) and of a result written as a group do not find the command; a result written as words after a `→` stays in the description. Words of 2 characters or fewer, words with no letter, and "the", "and", "ids", "true", "false" and "null" are left out. A query word that is a word of a description, shares an English base word with one, starts one or has the same meaning as one finds the result, and such a result ranks below every result that the query matches in its name, menu path or id, as text inside a word or through a typo. Descriptions are English only, and a typo does not match them. Tools, panels and filter plug-ins have no description (`palette::search` tests `a_description_leaves_out_the_schema_and_the_result`, `a_word_of_the_description_finds_the_result`, `a_description_match_ranks_below_a_typo`, `words_of_a_description_find_the_command`). Each Command Palette row starts with an icon for its kind (a tool's own icon, or one for a panel, an effect, a filter plug-in or a command) and shows where the result lives after its label, in smaller dim text: the menu path of the menu bar item that runs it, with that item's label when it differs from the result's ("File › Exit" for Quit VectorCraft), and "No menu item" for a command no item runs. A panel's row shows "Window". A row with a home shows its label without the menu path in front of it. A path that keeps two results' names apart stays in the label, unless the row's home shows the same path; a tool's row drops the "Tools" in front of its name. A tool's row names the toolbar it is on: "Toolbar" for its button on the Tools panel, or the name of a toolbar made with New Toolbar, followed by ", in the group" when the tool is hidden in the group of a slot whose button shows another tool ("Toolbar, in the Direct Selection Tool group" for the Group Selection Tool), and "All Tools" when no toolbar holds it. A toolbar shown now comes first (the Tools panel, then the toolbars made with New Toolbar), then a hidden Tools panel, then hidden toolbars made with New Toolbar; toolbars count as hidden in Presentation Mode and while Tab hides the panels. The Learn command (`window.learn`), which Window › Learn runs, takes the Window menu as its home, so a search reads its menu path like any other result's, and among results that tie on everything else it ranks as a command of the menu bar, before panels and after tools. The home is cut short with "…" before the label, and a label too long for the row keeps the id it shows after its name unless the id alone is wider than the row. A cut row shows all its text while the pointer rests on it, and screen readers read the kind, the label, the home and the shortcut. The row height is unchanged (`palette` tests `rows_show_where_each_result_lives`, `no_two_rows_read_alike`, `a_tool_row_names_its_toolbar_slot`, `a_narrow_row_cuts_the_home_first_and_keeps_the_id`, `screen_readers_hear_the_kind_and_home`, `catalogs_translate_the_kind_and_home_words`). + While the Command Palette is open, the highlighted result points to where it lives, in the same frame the arrow keys or the pointer move the highlight. A result with an item of the in-window menu bar has that menu's title outlined, with the item's whole path in a box under it ("Effect › Stylize › Round Corners…"); a panel points at the Window menu. A tool has its slot's button outlined on the toolbar the row names, or its own button on a strip torn off its group, with a box on the canvas side of the toolbar that names the tool, or says "In the Direct Selection Tool group: press and hold to open it" for a tool hidden in a group; screen readers hear that sentence with the search field's description. The box stays inside the window and off the button and the palette's popup: beside a button, its text wraps to up to three rows to fit before the popup or the window's edge, and where it still does not fit, the footer shows the text and only the outline is drawn; when the popup covers the control, nothing is drawn and the footer names the home. Nothing opens or shows: no menu, flyout, toolbar or All Tools drawer, and the chosen tool stays. With the system's menu bar, the footer reads "In the menu bar:" and the path instead; when no control in view shows the home (Presentation Mode, toolbars hidden by Window › Tools or Tab, a button scrolled out of view or under a floating panel or another toolbar) the footer names the home followed by "not shown now", and a command with no menu item reads "No menu item" with its shortcut. The menu bar and the toolbars note where they drew their controls only while the palette is open, and the palette uses only what this pass drew in its own window (`palette` tests `the_highlighted_result_outlines_its_menu_title`, `with_a_native_menu_bar_the_footer_names_the_path`, `a_tool_result_outlines_its_toolbar_slot`, `a_tool_on_a_toolbar_made_with_new_toolbar_is_outlined_there`, `a_strip_torn_off_the_tools_panel_is_pointed_at`, `a_box_beside_a_button_wraps_to_fit_beside_the_popup`, `the_box_keeps_off_its_button`, `the_callout_stays_off_the_palette`, `the_callout_keeps_off_a_popup_that_grew_in_the_same_pass`, `a_home_out_of_view_is_named_in_the_footer`, `the_pass_that_opens_the_palette_names_no_home_as_hidden`, `the_callout_follows_the_pointer`, `the_callout_follows_the_highlight_and_reveals_nothing`, `only_a_control_in_view_in_this_pass_is_pointed_at`, `a_control_under_a_window_is_not_pointed_at`, `the_noted_controls_hold_one_pass_per_viewport`, `catalogs_translate_the_callout_words`). `object.setProps` with `visible: false` or `locked: true` deselects every selected object that is then hidden or locked, the key object included, as the eye and lock columns do. Ctrl/Cmd+Alt-clicking an eye switches the other layers to Outline and the row's layer to Preview, or switches all layers back to Preview when the others are in Outline (`layer.outlineOthers`, `layer.previewAll`). Ctrl/Cmd+Alt-clicking New Layer adds a layer directly below the current layer, at its level (`layer.new {below: true}`), and Ctrl/Cmd+Alt-clicking New Sublayer adds a sublayer under the contents of the layer it goes into (`layer.newSublayer {bottom: true}`), each in one undo step. The reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists these clicks for placing a layer below the selected layer and a new sublayer at the bottom of the layer list. From b957d5d07c7651b4b69a6bf9645c5de4a4639936 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 15:07:16 -0800 Subject: [PATCH 043/158] Swatches: swatches dragged onto the New Swatch button are duplicated A swatch dragged from the Swatches panel, in any view, and released on the New Swatch button is copied through swatch.duplicate without opening the New Swatch dialog. A swatch that is part of the selection carries the other selected swatches with it, and the copies of one drop are one undo step. Each copy goes just after its swatch and in its color group, takes the usual "copy" name, and is selected. Modifiers held on release do not change the drop. Color groups, None and Registration are not duplicated; a user swatch whose name starts with a bracket is. The button is outlined only while such a swatch of the active document is held over it, so a paint from another panel, art, a swatch dragged from another document and a swatch deleted during the drag duplicate nothing. A click on the button still opens New Swatch. --- crates/ui-egui/src/panels/swatches/actions.rs | 59 +++++- crates/ui-egui/src/panels/swatches/tests.rs | 175 +++++++++++++++++- docs/target-app-parity.md | 1 + 3 files changed, 226 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/src/panels/swatches/actions.rs b/crates/ui-egui/src/panels/swatches/actions.rs index 1779f9dfa6..c1fd461d09 100644 --- a/crates/ui-egui/src/panels/swatches/actions.rs +++ b/crates/ui-egui/src/panels/swatches/actions.rs @@ -83,10 +83,14 @@ pub(super) fn bottom(app: &mut VectorcraftApp, ui: &mut Ui, sel: &[String]) { app.run("ui.newColorGroup", json!({"swatches": deletable(sel)})).ok(); } // Alt-click skips the dialog; Ctrl/Cmd-click makes a spot color, and Ctrl/Cmd+Shift-click - // makes a global process color. - if widgets::icon_button(ui, "dc-new-item", tl!("New Swatch"), false, 24.0).clicked() { + // makes a global process color. Swatches dragged from the list and dropped on it are + // duplicated. + let copies = dragged_swatches(app, ui.ctx()); + let new = widgets::icon_button(ui, "dc-new-item", tl!("New Swatch"), false, 24.0); + if new.clicked() { new_swatch(app, sel, ui.input(|i| i.modifiers)); } + drop_on_new(app, ui, &new, copies); // Alt-click deletes without asking. Swatches or color groups dragged from the list can be // dropped on it, also with nothing selected: the button is enabled while they are held. let del = deletable(sel); @@ -106,12 +110,19 @@ pub(super) const DRAG_DOC: &str = "swatch-drag-doc"; /// Swatch can delete: neither None nor Registration, and still in the document. Empty for any other /// drag, and for a drag started in another document. fn dragged_deletable(app: &VectorcraftApp, ctx: &egui::Context) -> Vec { + let Some(st) = app.session.active() else { return vec![] }; + deletable(&dragged_rows(app, ctx)).into_iter().filter(|n| st.doc.swatch_name_taken(n)).collect() +} + +/// The names of the swatches or color groups of the active document being dragged from the list, +/// in panel order. Empty for any other drag, and for a drag started in another document. +fn dragged_rows(app: &VectorcraftApp, ctx: &egui::Context) -> Vec { let Some(st) = app.session.active() else { return vec![] }; if pstate::>(ctx, DRAG_DOC) != Some(st.uid) { return vec![]; } match egui::DragAndDrop::payload::(ctx).as_deref() { - Some(PanelDrag::Paint { rows: Some(r), .. }) => deletable(&r.names).into_iter().filter(|n| st.doc.swatch_name_taken(n)).collect(), + Some(PanelDrag::Paint { rows: Some(r), .. }) => r.names.clone(), _ => vec![], } } @@ -133,6 +144,48 @@ fn drop_on_delete(app: &mut VectorcraftApp, ui: &Ui, button: &Response, names: V } } +/// The swatches of the active document being dragged from the list that New Swatch can duplicate, +/// in panel order: the dragged rows ([`dragged_rows`]) that are swatches still in the document, +/// other than None and Registration. +fn dragged_swatches(app: &VectorcraftApp, ctx: &egui::Context) -> Vec { + let Some(st) = app.session.active() else { return vec![] }; + dragged_rows(app, ctx).into_iter().filter(|n| st.doc.swatch(n).is_some_and(|w| !w.is_reserved())).collect() +} + +/// Swatches (`names`) dragged onto New Swatch (`button`): the button is outlined while they are +/// held over it, and the release of the primary button duplicates them ([`duplicate`]), whatever +/// modifiers are held. The release of another button ends the drag, and other drags are left to +/// their own targets. +fn drop_on_new(app: &mut VectorcraftApp, ui: &Ui, button: &Response, names: Vec) { + if names.is_empty() || button.dnd_hover_payload::().is_none() { + return; + } + widgets::drop_target_outline(ui, button.rect); + if !ui.input(|i| i.pointer.button_released(egui::PointerButton::Primary)) { + return; + } + if button.dnd_release_payload::().is_some() { + duplicate(app, ui.ctx(), &names); + } +} + +/// Duplicates the swatches `names` (`swatch.duplicate`, each copy just after its swatch and in its +/// color group) in one undo step and selects the copies. A failure is shown in the status bar and +/// changes nothing. +fn duplicate(app: &mut VectorcraftApp, ctx: &egui::Context, names: &[String]) { + let made = if let [name] = names { + app.run("swatch.duplicate", json!({ "name": name })).map(|r| vec![r]) + } else { + let commands: Vec = names.iter().map(|n| json!({ "command": "swatch.duplicate", "params": { "name": n } })).collect(); + app.run("command.batch", json!({ "label": "Duplicate Swatch", "commands": commands })) + .map(|r| r["results"].as_array().cloned().unwrap_or_default()) + }; + match made { + Ok(made) => set_pstate(ctx, "swatch-selected", made.iter().filter_map(|r| r["name"].as_str().map(str::to_string)).collect::>()), + Err(e) => app.status(e), + } +} + /// The colour group the selection points at: the last selected group, or the group of the last /// selected swatch. fn target_group(app: &VectorcraftApp, sel: &[String]) -> Option { diff --git a/crates/ui-egui/src/panels/swatches/tests.rs b/crates/ui-egui/src/panels/swatches/tests.rs index 9fb6a94e22..f664b8b8c1 100644 --- a/crates/ui-egui/src/panels/swatches/tests.rs +++ b/crates/ui-egui/src/panels/swatches/tests.rs @@ -593,8 +593,13 @@ fn frame_out(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec, /// The Delete Swatch button in `out`: its rectangle and whether it is enabled. fn trash_button(out: &egui::FullOutput) -> (Rect, bool) { + footer_button(out, "Delete Swatch") +} + +/// The button labeled `label` in `out`: its rectangle and whether it is enabled. +fn footer_button(out: &egui::FullOutput, label: &str) -> (Rect, bool) { let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; - let node = nodes.iter().map(|(_, n)| n).find(|n| n.label().is_some_and(|l| l.trim() == "Delete Swatch")).expect("a Delete Swatch button"); + let node = nodes.iter().map(|(_, n)| n).find(|n| n.label().is_some_and(|l| l.trim() == label)).unwrap_or_else(|| panic!("a {label} button")); let b = node.bounds().expect("the button's bounds"); (Rect::from_min_max(pos2(b.x0 as f32, b.y0 as f32), pos2(b.x1 as f32, b.y1 as f32)), !node.is_disabled()) } @@ -611,16 +616,23 @@ fn outlined(out: &egui::FullOutput, rect: Rect) -> bool { /// there, a frame per step from `time`. Returns whether the button was outlined and enabled while /// the drag was held over it. fn drag_to_trash(app: &mut VectorcraftApp, ctx: &egui::Context, name: &str, modifiers: Modifiers, time: f64) -> (bool, bool) { + drag_to_button(app, ctx, name, "Delete Swatch", modifiers, time) +} + +/// Drag the tile of `name` with `modifiers` held onto the button labeled `label` and release the +/// primary button there, a frame per step from `time`. Returns whether the button was outlined and +/// enabled while the drag was held over it. +fn drag_to_button(app: &mut VectorcraftApp, ctx: &egui::Context, name: &str, label: &str, modifiers: Modifiers, time: f64) -> (bool, bool) { frame_out(app, ctx, vec![], modifiers, time); - let (trash, _) = trash_button(&frame_out(app, ctx, vec![], modifiers, time + 0.05)); + let (target, _) = footer_button(&frame_out(app, ctx, vec![], modifiers, time + 0.05), label); let from = tile_center(ctx, name); let button = |pos, pressed| Event::PointerButton { pos, button: PointerButton::Primary, pressed, modifiers }; frame_out(app, ctx, vec![Event::PointerMoved(from), button(from, true)], modifiers, time + 0.1); frame_out(app, ctx, vec![Event::PointerMoved(from + vec2(6.0, 4.0))], modifiers, time + 0.2); - frame_out(app, ctx, vec![Event::PointerMoved(trash.center())], modifiers, time + 0.3); - let held = frame_out(app, ctx, vec![Event::PointerMoved(trash.center())], modifiers, time + 0.4); - let seen = (outlined(&held, trash), trash_button(&held).1); - frame_out(app, ctx, vec![Event::PointerMoved(trash.center()), button(trash.center(), false)], modifiers, time + 0.5); + frame_out(app, ctx, vec![Event::PointerMoved(target.center())], modifiers, time + 0.3); + let held = frame_out(app, ctx, vec![Event::PointerMoved(target.center())], modifiers, time + 0.4); + let seen = (outlined(&held, target), footer_button(&held, label).1); + frame_out(app, ctx, vec![Event::PointerMoved(target.center()), button(target.center(), false)], modifiers, time + 0.5); seen } @@ -750,6 +762,157 @@ fn delete_swatch_ignores_other_drags() { unchanged(&app, "the first document"); } +/// Swatches dragged from the list onto New Swatch are duplicated without a dialog, in thumbnail +/// and list views: each copy goes just after its swatch, in its color group, and is selected, and +/// the copies of one drop are one undo step. A selected swatch carries the other selected swatches +/// with it, but not the selected groups, None or Registration. Modifiers do not change the drop, a +/// repeated name is numbered, and a group, None and Registration dragged alone duplicate nothing. +#[test] +fn swatches_dropped_on_new_swatch_are_duplicated() { + let mut app = app(); + let ctx = context(); + let after = |app: &VectorcraftApp, group: Option<&str>, name: &str| { + let n = names_of(app, group); + n.iter().position(|x| x == name).and_then(|i| n.get(i + 1).cloned()) + }; + let undo = undo_steps(&app); + // An unselected swatch, nothing selected. + assert_eq!(drag_to_button(&mut app, &ctx, "Orange", "New Swatch", Modifiers::NONE, 1.0), (true, true), "outlined while held"); + assert!(app.ui.dialog.is_none(), "no dialog"); + assert_eq!(after(&app, None, "Orange").as_deref(), Some("Orange copy")); + assert_eq!(selected(&ctx), ["Orange copy"], "the copy is selected"); + assert_eq!(undo_steps(&app), undo + 1, "one undo step"); + let copy = app.session.doc().unwrap().doc.swatch("Orange copy").cloned().unwrap(); + assert_eq!(copy.paint, app.session.doc().unwrap().doc.swatch("Orange").unwrap().paint, "the copy keeps the paint"); + app.run("edit.undo", json!({})).unwrap(); + assert!(app.session.doc().unwrap().doc.swatch("Orange copy").is_none(), "Undo removes the copy"); + app.run("edit.redo", json!({})).unwrap(); + assert_eq!(after(&app, None, "Orange").as_deref(), Some("Orange copy"), "Redo brings it back"); + // Again: the copy's name is numbered. + set_pstate(&ctx, "swatch-selected", Vec::::new()); + drag_to_button(&mut app, &ctx, "Orange", "New Swatch", Modifiers::NONE, 2.0); + assert_eq!(after(&app, None, "Orange").as_deref(), Some("Orange copy 2")); + assert_eq!(selected(&ctx), ["Orange copy 2"]); + // A selected swatch carries the selected swatches, in panel order and into their groups, with + // Alt held; the copies are one undo step. + let sel = ["[None]", "Bright Red", "Grays", "Sunset", "Lime"].map(String::from).to_vec(); + set_pstate(&ctx, "swatch-selected", sel); + let undo = undo_steps(&app); + assert_eq!(drag_to_button(&mut app, &ctx, "Lime", "New Swatch", Modifiers::ALT, 3.0), (true, true)); + assert!(app.ui.dialog.is_none(), "no dialog with Alt"); + assert_eq!(after(&app, None, "Lime").as_deref(), Some("Lime copy")); + assert_eq!(after(&app, None, "Sunset").as_deref(), Some("Sunset copy")); + assert_eq!(after(&app, Some("Brights"), "Bright Red").as_deref(), Some("Bright Red copy")); + assert_eq!(selected(&ctx), ["Lime copy", "Sunset copy", "Bright Red copy"]); + assert_eq!(names_of(&app, Some("Grays")).len(), 9, "the group is not duplicated"); + assert_eq!(undo_steps(&app), undo + 1, "one undo step for all"); + app.run("edit.undo", json!({})).unwrap(); + let d = app.session.doc().unwrap().doc.clone(); + assert!(["Lime copy", "Sunset copy", "Bright Red copy"].iter().all(|n| d.swatch(n).is_none()), "Undo removes every copy"); + // A group, None and Registration dragged alone: nothing. + set_pstate(&ctx, "swatch-selected", Vec::::new()); + let (kept, undo) = (app.session.doc().unwrap().doc.clone(), undo_steps(&app)); + for (i, name) in ["Grays", "[None]", REGISTRATION].into_iter().enumerate() { + assert_eq!(drag_to_button(&mut app, &ctx, name, "New Swatch", Modifiers::NONE, 4.0 + i as f64), (false, true), "{name}"); + assert!(app.ui.dialog.is_none(), "{name}"); + assert_eq!(app.session.doc().unwrap().doc, kept, "{name}"); + } + assert_eq!(undo_steps(&app), undo); + // A swatch of the user's whose name starts with a bracket is an ordinary swatch. + app.run("swatch.new", json!({"name": "[Blue]", "color": "#0000ff"})).unwrap(); + assert_eq!(drag_to_button(&mut app, &ctx, "[Blue]", "New Swatch", Modifiers::NONE, 8.0), (true, true)); + assert_eq!(after(&app, None, "[Blue]").as_deref(), Some("[Blue] copy")); + // In a list view. + let undo = undo_steps(&app); + app.ui.swatches_view = View::SmallList; + assert_eq!(drag_to_button(&mut app, &ctx, "Red", "New Swatch", Modifiers::NONE, 9.0), (true, true)); + assert_eq!(after(&app, None, "Red").as_deref(), Some("Red copy")); + assert_eq!(undo_steps(&app), undo + 1); +} + +/// New Swatch duplicates only swatches dragged from the active document's list that are still in +/// it: a paint dragged from elsewhere, art, a swatch dragged from another document, and a swatch +/// deleted while it is dragged duplicate nothing. A secondary button released while a swatch is +/// held over the button ends the drag without duplicating, and a click still opens New Swatch. +#[test] +fn new_swatch_ignores_other_drags() { + let mut app = app(); + let id = app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); + let ctx = context(); + let (new, _) = footer_button(&frame_out(&mut app, &ctx, vec![], Modifiers::NONE, 0.0), "New Swatch"); + let (before, undo) = (app.session.doc().unwrap().doc.clone(), undo_steps(&app)); + let unchanged = |app: &VectorcraftApp, case: &str| { + assert!(app.ui.dialog.is_none(), "{case}: no dialog"); + assert_eq!(app.session.doc().unwrap().doc, before, "{case}: duplicates nothing"); + assert_eq!(undo_steps(app), undo, "{case}: no undo step"); + }; + // The payloads are set directly, as if dragged from this document's list. + set_pstate(&ctx, super::actions::DRAG_DOC, app.session.active().map(|st| st.uid)); + let release = |at| Event::PointerButton { pos: at, button: PointerButton::Primary, pressed: false, modifiers: Modifiers::NONE }; + let cases = [ + ("a paint", PanelDrag::paint(Paint::solid(Color::from_hex("#ed1c24").unwrap()))), + ("art", PanelDrag::Art(vec![vectorcraft_doc::NodeId(id)])), + ]; + for (i, (case, drag)) in cases.into_iter().enumerate() { + egui::DragAndDrop::set_payload(&ctx, drag); + let held = frame_out(&mut app, &ctx, vec![Event::PointerMoved(new.center())], Modifiers::NONE, 1.0 + i as f64); + assert!(!outlined(&held, new), "{case}: not outlined"); + frame_out(&mut app, &ctx, vec![release(new.center())], Modifiers::NONE, 1.5 + i as f64); + unchanged(&app, case); + egui::DragAndDrop::clear_payload(&ctx); + } + let press = |at, button, pressed| Event::PointerButton { pos: at, button, pressed, modifiers: Modifiers::NONE }; + let hold_orange = |app: &mut VectorcraftApp, time: f64| { + frame_out(app, &ctx, vec![], Modifiers::NONE, time); + let from = tile_center(&ctx, "Orange"); + frame_out(app, &ctx, vec![Event::PointerMoved(from), press(from, PointerButton::Primary, true)], Modifiers::NONE, time + 0.1); + frame_out(app, &ctx, vec![Event::PointerMoved(from + vec2(6.0, 4.0))], Modifiers::NONE, time + 0.2); + assert!(egui::DragAndDrop::payload::(&ctx).is_some(), "Orange is dragged"); + }; + // A secondary release over the button, then the primary release. + hold_orange(&mut app, 3.0); + frame_out(&mut app, &ctx, vec![Event::PointerMoved(new.center())], Modifiers::NONE, 3.3); + let held = frame_out(&mut app, &ctx, vec![Event::PointerMoved(new.center())], Modifiers::NONE, 3.4); + assert!(outlined(&held, new), "Orange is held over the button"); + frame_out(&mut app, &ctx, vec![press(new.center(), PointerButton::Secondary, true)], Modifiers::NONE, 3.5); + frame_out(&mut app, &ctx, vec![press(new.center(), PointerButton::Secondary, false)], Modifiers::NONE, 3.6); + unchanged(&app, "a secondary release"); + frame_out(&mut app, &ctx, vec![release(new.center())], Modifiers::NONE, 3.7); + unchanged(&app, "the primary release after it"); + // A swatch deleted while it is dragged. + hold_orange(&mut app, 4.0); + app.run("swatch.delete", json!({"names": ["Orange"]})).unwrap(); + let (gone, undo_gone) = (app.session.doc().unwrap().doc.clone(), undo_steps(&app)); + frame_out(&mut app, &ctx, vec![Event::PointerMoved(new.center())], Modifiers::NONE, 4.3); + let held = frame_out(&mut app, &ctx, vec![Event::PointerMoved(new.center())], Modifiers::NONE, 4.4); + assert!(!outlined(&held, new), "a deleted swatch is not outlined"); + frame_out(&mut app, &ctx, vec![release(new.center())], Modifiers::NONE, 4.5); + assert_eq!((app.session.doc().unwrap().doc.clone(), undo_steps(&app)), (gone, undo_gone), "a deleted swatch is not duplicated"); + app.run("edit.undo", json!({})).unwrap(); + // A swatch dragged from this document while another document with the same swatches becomes + // active. + hold_orange(&mut app, 5.0); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + let (other, undo_new) = (app.session.doc().unwrap().doc.clone(), undo_steps(&app)); + frame_out(&mut app, &ctx, vec![Event::PointerMoved(new.center())], Modifiers::NONE, 5.3); + let held = frame_out(&mut app, &ctx, vec![Event::PointerMoved(new.center())], Modifiers::NONE, 5.4); + let (new_other, _) = footer_button(&held, "New Swatch"); + assert!(!outlined(&held, new_other), "not outlined in the other document"); + frame_out(&mut app, &ctx, vec![release(new_other.center())], Modifiers::NONE, 5.5); + assert_eq!((app.session.doc().unwrap().doc.clone(), undo_steps(&app)), (other, undo_new), "the other document duplicates nothing"); + assert!(app.session.set_active(0)); + unchanged(&app, "the first document"); + // A click still opens New Swatch. + frame_out(&mut app, &ctx, vec![], Modifiers::NONE, 6.0); + let click = vec![ + Event::PointerMoved(new.center()), + press(new.center(), PointerButton::Primary, true), + press(new.center(), PointerButton::Primary, false), + ]; + frame_out(&mut app, &ctx, click, Modifiers::NONE, 6.1); + assert!(app.ui.dialog.is_some(), "a click opens the New Swatch dialog"); +} + #[test] fn art_dropped_on_the_panel_becomes_a_pattern_swatch() { let mut app = app(); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 26c000262a..e667daf73e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1679,6 +1679,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Right-clicking a swatch in either list or thumbnail view selects it without applying paint and offers Swatch Options…, Duplicate Swatch and Delete Swatch for that item. None, [Registration] and missing swatches disable these actions. Existing active-item multiselection is retained; actions still target only the clicked item. Evidence: `panels::swatches::tests::context_menu` harness tests cover all five views, selection, dialog dispatch, duplicate/delete and Undo. All 39 Swatches tests pass; the regression fails with the menu hooks removed. Rendered headless list and thumbnail menus were inspected, and a fresh local deep CodeRabbit review reported zero findings. Full workspace CI passed on Linux/WSL on the merged branch (all 13 gates), including the test-helper correction for the upstream compile error tracked in #7727; native Windows full CI has two unchanged engine-test failures. Scores and estimates unchanged. Validation on 2026-11-15: native Windows formatting, workspace Clippy and all 39 focused Swatches tests passed. Windows full CI stopped at unchanged engine tests `tests::package::a_confined_package_names_files_outside_the_read_root_by_name` (slash-sensitive report assertion) and `tests::plugins::plugin_storage_behind_a_link_is_left_alone` (storage-link setup returned AlreadyExists). Both cases pass in the Linux/WSL full CI run, which passed all 13 gates. No engine or CI workflow changes are included. Dragging swatches onto Delete Swatch deletes them ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=136), Replace, merge, or delete swatches section, lists this drag as one of the ways to delete the selected swatches): a swatch or color group dragged from the Swatches panel, in any view, and released on the Delete Swatch button is deleted through `swatch.delete`, even while nothing was selected and the button is disabled for clicks. A swatch that is part of the selection carries the other selected swatches of its kind with it. VectorCraft's own rules: the drop asks first as a plain click does, and Alt does not skip the question; Cancel keeps everything, and OK deletes them in one undo step; None and [Registration] are never taken; the button is enabled while swatches are selected or while a swatch or group of the active document is being dragged, and it is outlined only while such a swatch or group is held over it, so a paint from another panel, art and a swatch dragged from another document delete nothing. Tests: `panels::swatches::tests::swatches_dropped_on_delete_swatch_are_deleted_after_asking`, `delete_swatch_ignores_other_drags`. + Dragging swatches onto New Swatch duplicates them ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/use-swatches/duplicate-swatches.html) gives this drag as another way to duplicate the selected swatches): a swatch dragged from the Swatches panel, in any view, and released on the New Swatch button is copied through `swatch.duplicate` without opening the New Swatch dialog. A swatch that is part of the selection carries the other selected swatches with it. VectorCraft's own rules: each copy goes just after its swatch and in its color group, named ` copy` and then ` copy 2`; the copies of one drop are one undo step and are selected; modifiers held on release do not change the drop; color groups, None and [Registration] are not duplicated; the button is outlined only while such a swatch of the active document is held over it, so a paint from another panel, art, a swatch dragged from another document and a swatch deleted during the drag duplicate nothing. Tests: `panels::swatches::tests::swatches_dropped_on_new_swatch_are_duplicated`, `new_swatch_ignores_other_drags`. Editing, renaming, deleting or merging a global swatch also changes the colors linked to it in graph designs, the art of brushes and the tile that pattern editing's Cancel puts back, in the same undo step as the rest of the art; Default Swatches with replace unlinks them there too. A swatch step in `command.batch` (Delete, Swatch Options, Merge, Edit Color Group) changes the fill and stroke for new art as the command run on its own does, so art drawn later in the batch or after it takes the same paint; a batch that fails, and a canceled batch preview, put back the paints it started with, and a canceled Swatch Options preview leaves them as they were. These swatch commands also change the fills and strokes of the appearance new art takes, and Undo and Redo of the command or the batch put the paints for new art back with the swatches. Spot Colors options (`swatch.spotOptions`) and Default Swatches with replace (`swatch.resetDefaults {replace: true}`) as `command.batch` steps also change the fill and stroke for new art as each command run on its own does: a fill or stroke linked to a Lab spot swatch keeps its link and tint and takes the Lab values or their CMYK equivalent, and one linked to a swatch the replace removes keeps its color and loses the link. Evidence: `swatch_steps_in_a_batch_change_the_new_art_paints_as_commands_do`, `spot_colors_options_in_a_batch_change_the_new_art_paints_as_the_command_does`, `default_swatches_replace_in_a_batch_unlinks_the_new_art_paints_as_the_command_does`, `undo_and_redo_of_a_swatch_edit_put_back_the_new_art_paints`, `swatch_edits_reach_the_paints_of_the_new_art_template`, `a_failed_batch_puts_back_the_new_art_paints_a_swatch_step_changed` and `canceling_a_swatch_options_preview_keeps_the_new_art_paints` in `crates/engine/src/tests/swatches.rs`. Add Used Colors (`swatch.addUsedColors`) and Select All Unused (`swatch.unused`) look colors, swatch names, links, tints and gradients up in hash sets instead of searching every swatch and color for each color or linked paint (New Color Group from artwork too), and New Swatch with several colors (`swatch.new`), New Color Group (`swatch.newGroup`) and Edit Color Group (`swatch.editGroup`) name their new swatches from one set of the names already taken. The new swatches keep their names, order and links, and Select All Unused lists the same swatches. Evidence: `add_used_colors_adds_each_new_color_once_with_free_names`, `add_used_colors_global_links_every_paint_of_a_new_color`, `unused_matches_links_tints_colors_gradients_and_patterns_exactly`, `new_swatches_from_colors_are_numbered_after_names_already_taken`, `new_color_group_numbers_its_colors_after_the_group_and_its_moved_swatches`, `new_color_group_from_artwork_lists_each_color_once_with_free_names` and `edit_color_group_numbers_extra_colors_after_the_names_it_keeps` in `crates/engine/src/tests/swatchcmds.rs`; `free_swatch_names_match_naming_each_swatch_as_it_is_added` and `free_swatch_names_match_new_swatch_names_as_swatches_are_added` in `crates/doc/src/swatches.rs`. From 788ebb396168e7ca932f80160a833640e76c44a3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 15:23:35 -0800 Subject: [PATCH 044/158] Swatches: a user swatch named with a leading bracket dropped on Delete Swatch is deleted Delete Swatch took dragged rows through the name-prefix filter of the selection's click path, so a user swatch such as [Blue] dropped on the button was ignored. The drop now keeps color groups and every swatch of the document other than None and Registration, as swatch.delete does. --- crates/ui-egui/src/panels/swatches/actions.rs | 3 ++- crates/ui-egui/src/panels/swatches/tests.rs | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/swatches/actions.rs b/crates/ui-egui/src/panels/swatches/actions.rs index c1fd461d09..5c3fe41597 100644 --- a/crates/ui-egui/src/panels/swatches/actions.rs +++ b/crates/ui-egui/src/panels/swatches/actions.rs @@ -111,7 +111,8 @@ pub(super) const DRAG_DOC: &str = "swatch-drag-doc"; /// drag, and for a drag started in another document. fn dragged_deletable(app: &VectorcraftApp, ctx: &egui::Context) -> Vec { let Some(st) = app.session.active() else { return vec![] }; - deletable(&dragged_rows(app, ctx)).into_iter().filter(|n| st.doc.swatch_name_taken(n)).collect() + let d = &st.doc; + dragged_rows(app, ctx).into_iter().filter(|n| d.swatch_name_taken(n) && d.swatch(n).is_none_or(|w| !w.is_reserved())).collect() } /// The names of the swatches or color groups of the active document being dragged from the list, diff --git a/crates/ui-egui/src/panels/swatches/tests.rs b/crates/ui-egui/src/panels/swatches/tests.rs index f664b8b8c1..c8e9755cd6 100644 --- a/crates/ui-egui/src/panels/swatches/tests.rs +++ b/crates/ui-egui/src/panels/swatches/tests.rs @@ -695,6 +695,14 @@ fn swatches_dropped_on_delete_swatch_are_deleted_after_asking() { assert_eq!(doc(&app), kept, "{name}"); } assert_eq!(undo_steps(&app), undo + 2); + // A swatch of the user's whose name starts with a bracket is an ordinary swatch. + app.run("swatch.new", json!({"name": "[Blue]", "color": "#0000ff"})).unwrap(); + let undo = undo_steps(&app); + assert_eq!(drag_to_trash(&mut app, &ctx, "[Blue]", Modifiers::NONE, 7.0), (true, true)); + assert_eq!(dialog_message(&app).as_deref(), Some("Delete “[Blue]”?")); + crate::dialogs::confirm(&mut app).unwrap(); + assert!(doc(&app).swatch("[Blue]").is_none(), "OK deletes it"); + assert_eq!(undo_steps(&app), undo + 1); } /// Delete Swatch takes only swatches dragged from the active document's list: a paint dragged from From c8a0650bcdd589204914a4f41087dc03a3ee0990 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 16:19:55 -0800 Subject: [PATCH 045/158] Command Palette: an effect's item in the path translates as the Effect menu's does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The callout, the row's home and the search index named a built-in effect's menu item with the plain translation of its English label, while the Effect menu translates it by the effect id (Effect › Pathfinder › Réunion in French). They now use the effect id first, and a live-effect plug-in's name stays as written, as in the menu. --- crates/ui-egui/src/palette.rs | 49 ++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 1c9c42d1fb..1a5cd0b1ef 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -268,6 +268,17 @@ fn shown_label(lang: crate::i18n::Lang, label: &str) -> String { label.split(" › ").map(|s| crate::i18n::tr(lang, s)).collect::>().join(" › ") } +/// The label of the item of the menu bar that runs `e`, in `lang`. A built-in effect's item +/// translates by its effect id first, as the Effect menu's does, and a live-effect plug-in's name +/// does not translate. +fn item_label(lang: crate::i18n::Lang, e: &Entry) -> &'static str { + match e.id.strip_prefix("effect:") { + Some(effect) if vectorcraft_plugins::effect::plugin_id(effect).is_some() => e.menu_item, + Some(effect) => crate::i18n::tr_id(lang, effect, e.menu_item), + None => crate::i18n::tr(lang, e.menu_item), + } +} + /// One palette entry, with what it shows and what a query matches worked out once. pub(crate) struct Entry { id: String, @@ -343,7 +354,7 @@ fn entries_in(ctx: &egui::Context, lang: crate::i18n::Lang, native: bool) -> Arc fn catalog(lang: crate::i18n::Lang, native: bool) -> Catalog { let list = build_in(lang, native); let shown_homes: Vec> = - list.iter().map(|e| e.home.as_deref().map(|h| format!("{} › {}", shown_label(lang, h), crate::i18n::tr(lang, e.menu_item)))).collect(); + list.iter().map(|e| e.home.as_deref().map(|h| format!("{} › {}", shown_label(lang, h), item_label(lang, e)))).collect(); // A group's row in the `search` context gives its words in `lang`; a plain row is not read. let search_row = |key: &str| crate::i18n::tr_ctx_row(lang, words::CONTEXT, key).map(str::to_string); let index = search::Index::build(&list, &shown_homes, ¶ms_texts(&list), search_row); @@ -508,7 +519,7 @@ fn home_text(app: &VectorcraftApp, e: &Entry) -> String { return tool_home(app, tool); } match &e.home { - Some(path) if e.names_item => format!("{} › {}", shown_label(lang, path), crate::i18n::tr(lang, e.menu_item)), + Some(path) if e.names_item => format!("{} › {}", shown_label(lang, path), item_label(lang, e)), Some(path) => shown_label(lang, path), None => tl!("No menu item").to_string(), } @@ -735,7 +746,7 @@ fn pointer(app: &VectorcraftApp, ctx: &egui::Context, e: &Entry) -> Pointer { // The native bar's application menu gives its items no label of their own. let full = match e.menu_item { "" => shown_label(lang, path), - item => format!("{} › {}", shown_label(lang, path), crate::i18n::tr(lang, item)), + _ => format!("{} › {}", shown_label(lang, path), item_label(lang, e)), }; let in_bar = crate::i18n::fmt(tl!("In the menu bar: {path}"), &[("path", &full)]); if app.services.native_menu.is_some() { @@ -3437,6 +3448,38 @@ mod tests { assert!(labels(&nodes).contains(&menu), "{:?}", labels(&nodes)); } + /// A built-in effect's item in the path translates by its effect id, as the Effect menu shows + /// it. + #[test] + fn the_path_names_an_effect_item_as_the_effect_menu_does() { + let mut window = Window::new(); + window.app.services.native_menu = Some(crate::native_menu::NativeMenu::new(Box::new(NativeMenus))); + let fr = Lang::from_code("fr").unwrap(); + crate::i18n::set_current(fr); + let list = entries(&window.ctx, fr); + let add = list.iter().find(|e| e.id == "effect:pathfinder.add").expect("the Add effect"); + let shown = match pointer(&window.app, &window.ctx, add) { + Pointer::Footer(text) => text, + Pointer::At(_, text, _) => text, + }; + crate::i18n::set_current(Lang::EN); + assert!(shown.ends_with(" › Réunion"), "{shown}"); + // A live-effect plug-in's name stays as written, as the Effect menu shows it. + let plugin = Entry { + id: format!("effect:{}", vectorcraft_plugins::effect::effect_id("test.ui.add")), + shortcut: String::new(), + shown: "Add".into(), + haystack: String::new(), + home: Some("Effect › Plug-ins".into()), + menu_item: "Add", + kind: 0, + label_at: 0, + names_item: false, + }; + assert_ne!(crate::i18n::tr(fr, "Add"), "Add"); + assert_eq!(item_label(fr, &plugin), "Add"); + } + /// A tool hidden in a group outlines its group's button and says how to open the group; once /// chosen from the group, the button shows it and the box names the tool alone. The box is on /// the canvas side of the toolbar. From 046dc65db8d5d0be1e0a07b23e939c5ae2bd9337 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 16:34:44 -0800 Subject: [PATCH 046/158] Command Palette: a tool on a torn-off strip is named without its group A row's home, the footer and the screen-reader text named a tool on a strip torn off a group as hidden "in the ... group", while the strip shows each of its tools on its own button and the callout outlines that button. A torn-off group's tools are now named by their toolbar alone, on the Tools panel and on toolbars made with New Toolbar. --- crates/ui-egui/src/palette.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 1a5cd0b1ef..122b09c7c3 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -527,7 +527,8 @@ fn home_text(app: &VectorcraftApp, e: &Entry) -> String { /// Where `tool` is in the current layout: "Toolbar" for its button on the Tools panel, or the name /// of the toolbar made with New Toolbar that holds it, followed by ", in the group", naming -/// the tool its slot's button shows, when the tool is hidden in that slot's group; "All Tools" +/// the tool its slot's button shows, when the tool is hidden in that slot's group and the group is +/// not torn off into a strip; "All Tools" /// when no toolbar holds it. A toolbar shown now comes first: the Tools panel, then the toolbars /// made with New Toolbar; then a hidden Tools panel, then hidden toolbars made with New Toolbar. /// Toolbars are hidden in Presentation Mode and while Tab hides the panels. @@ -540,12 +541,19 @@ fn tool_home(app: &VectorcraftApp, tool: &str) -> String { }; let toolbars_shown = app.ui.screen_mode < 3 && app.ui.tab_hid.is_none(); let main = crate::toolbar::slots(app).into_iter().map(|(_, s)| s).find(|s| s.contains(&tool)); - let main = main.map(|slot| place(tl!("Toolbar"), Some(crate::toolbar::shown_tool(app, &slot)))); + // A group torn off into a strip shows each of its tools on its own button. + let main = main.map(|slot| { + let torn_off = slot.len() > 1 && crate::toolbar::is_floating(app, None, slot[0]); + place(tl!("Toolbar"), if torn_off { None } else { Some(crate::toolbar::shown_tool(app, &slot)) }) + }); let active = app.session.tool_id(); let custom = |shown: bool| { app.ui.custom_toolbars.iter().filter(|b| b.shown == shown).find_map(|bar| { let slot = bar.slots.iter().find(|s| s.iter().any(|t| t == tool))?; let tools: Vec<&'static str> = slot.iter().filter_map(|id| vectorcraft_tools::tool_info(id).map(|t| t.id)).collect(); + if tools.len() > 1 && tools.first().is_some_and(|first| crate::toolbar::is_floating(app, Some(&bar.name), first)) { + return Some(place(&bar.name, None)); + } Some(place(&bar.name, crate::custom_toolbars::shown_tool(bar, active, &tools))) }) }; @@ -3543,6 +3551,8 @@ mod tests { assert!(callout.is_some()); assert_eq!(outlined, bounds_of(&nodes, "Pen Tool")); assert!(outlined.left() >= 100.0, "on the toolbar made with New Toolbar: {outlined:?}"); + let bar = window.app.ui.custom_toolbars[0].name.clone(); + assert_eq!(tool_home(&window.app, "curvature"), format!("{bar}, in the Pen Tool group")); // The group torn off into a strip. window.app.ui.custom_toolbars[0] .floating @@ -3552,6 +3562,8 @@ mod tests { let (outlined, _, text) = window.callout().expect("a callout"); assert_eq!(text, "Pen Tool"); assert!(outlined.left() >= 600.0 && outlined.top() >= 500.0, "on the strip: {outlined:?}"); + // The row's home names no group: the strip shows each tool on its own button. + assert_eq!(tool_home(&window.app, "curvature"), bar); } /// A group torn off the Tools panel into a strip has the tool's own button on the strip @@ -3569,6 +3581,8 @@ mod tests { assert_eq!(text, "Group Selection Tool"); assert!(callout.is_some()); assert!(outlined.left() >= 600.0 && outlined.top() >= 500.0, "on the strip: {outlined:?}"); + // The row's home names no group: the strip shows each tool on its own button. + assert_eq!(tool_home(&window.app, "groupSelection"), "Toolbar"); } /// Two viewports that note controls in turn keep one pass each in the list, whichever noted From f053c280a529f7b7f1a6f7d020886895628ed876 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 17:14:07 -0800 Subject: [PATCH 047/158] Command Palette: a menu item in the path is named as the menu bar draws it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The callout, the row's home and the search index translated a filter plug-in's name, which Object › Plug-ins shows as written, and translated other items by their English label alone, while the menu bar translates them by the command id first (File › Close is Cerrar archivo in Spanish). They now use the menu bar's rule. --- crates/ui-egui/src/palette.rs | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 122b09c7c3..5ce4f9014b 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -268,15 +268,26 @@ fn shown_label(lang: crate::i18n::Lang, label: &str) -> String { label.split(" › ").map(|s| crate::i18n::tr(lang, s)).collect::>().join(" › ") } -/// The label of the item of the menu bar that runs `e`, in `lang`. A built-in effect's item -/// translates by its effect id first, as the Effect menu's does, and a live-effect plug-in's name -/// does not translate. +/// The label of the item of the menu bar that runs `e`, in `lang`, as the menu bar draws it +/// ([`menus::display_label`]). A built-in effect's item translates by its effect id first, as the +/// Effect menu's does. Any other item translates by the id of the command it runs first (File › +/// Close is Cerrar archivo in Spanish), and a name the menu shows as written ([`menus::shows_a_name`]: +/// a filter or live-effect plug-in's) does not translate. fn item_label(lang: crate::i18n::Lang, e: &Entry) -> &'static str { - match e.id.strip_prefix("effect:") { - Some(effect) if vectorcraft_plugins::effect::plugin_id(effect).is_some() => e.menu_item, - Some(effect) => crate::i18n::tr_id(lang, effect, e.menu_item), - None => crate::i18n::tr(lang, e.menu_item), + if let Some(effect) = e.id.strip_prefix("effect:") { + return match vectorcraft_plugins::effect::plugin_id(effect) { + Some(_) => e.menu_item, + None => crate::i18n::tr_id(lang, effect, e.menu_item), + }; } + // The command the menu item runs: `plugin.dialog` for a filter, `window.panel` for a panel and + // the engine command a UI command wraps. + let id = match e.id.as_str() { + id if id.starts_with("plugin:") => "plugin.dialog", + id if id.starts_with("panel:") => "window.panel", + id => WRAPPED.iter().find(|(_, ui)| *ui == id).map_or(id, |(engine, _)| engine), + }; + if menus::shows_a_name(id, e.menu_item) { e.menu_item } else { crate::i18n::tr_id(lang, id, e.menu_item) } } /// One palette entry, with what it shows and what a query matches worked out once. @@ -3457,7 +3468,7 @@ mod tests { } /// A built-in effect's item in the path translates by its effect id, as the Effect menu shows - /// it. + /// it, another item by its command id, and a plug-in's name stays as written. #[test] fn the_path_names_an_effect_item_as_the_effect_menu_does() { let mut window = Window::new(); @@ -3486,6 +3497,14 @@ mod tests { }; assert_ne!(crate::i18n::tr(fr, "Add"), "Add"); assert_eq!(item_label(fr, &plugin), "Add"); + // So does a filter plug-in's name, as Object › Plug-ins shows it. + let filter = Entry { id: "plugin:test.ui.add".into(), home: Some("Object › Plug-ins".into()), ..plugin }; + assert_eq!(item_label(fr, &filter), "Add"); + // Another item translates by the id of the command it runs, as the menu bar draws it. + let es = Lang::from_code("es").unwrap(); + let close = entries(&window.ctx, es).iter().find(|e| e.id == "file.close").map(|e| (e.menu_item, item_label(es, e))); + assert_ne!(crate::i18n::tr(es, "Close"), "Cerrar archivo"); + assert_eq!(close, Some(("Close", "Cerrar archivo"))); } /// A tool hidden in a group outlines its group's button and says how to open the group; once From 8cd51bf95a2ceca77b3e157ab3a63a718b7e89ef Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 21:28:31 -0800 Subject: [PATCH 048/158] Command Palette: "setting" finds Preferences, and a Recent Commands pick gives the focus back The stem forms of a group's English words join the group, so "setting" finds Preferences through settings. A pick from Recent Commands with the keyboard, which leaves the focus on its row, now gives the focus back to the widget that had it when the palette opened. --- crates/ui-egui/src/palette.rs | 52 ++++++++++++++++++++++++++-- crates/ui-egui/src/palette/search.rs | 28 +++++++++++---- 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 2ad2ffcea3..3330281587 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -569,16 +569,21 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { // closed it focused another widget, such as a field in a window above the backdrop. let focus_id = egui::Id::unique("palette-focus-before"); let field_id = egui::Id::unique("palette-field"); + // The Recent Commands rows drawn in the last frame, so a pick with the keyboard, which leaves the + // focus on its row, gives the focus back too. + let rows_id = egui::Id::unique("palette-recent-rows"); if !app.ui.palette_open { - let field = ctx.data_mut(|d| { + let (field, rows) = ctx.data_mut(|d| { let field = d.get_temp::(field_id); d.remove::(field_id); - field + let rows = d.get_temp::>(rows_id).unwrap_or_default(); + d.remove::>(rows_id); + (field, rows) }); let now = ctx.memory(|m| m.focused()); if let Some(Some(before)) = ctx.data_mut(|d| d.remove_temp::>(focus_id)) && app.ui.dialog.is_none() - && (now.is_none() || now == field) + && (now.is_none() || now == field || now.is_some_and(|n| rows.contains(&n))) { ctx.memory_mut(|m| m.request_focus(before)); } @@ -701,12 +706,14 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { if !list_open && !history_focused { r.request_focus(); } + let mut rows = Vec::new(); egui::Popup::menu(&button).id(recent_list_id()).show(|ui| { if recent.is_empty() { ui.add_enabled(false, egui::Button::new(tl!("No recent commands"))); } for (i, e) in recent.iter().enumerate() { let row = ui.add(egui::Button::new(e.shown.as_str()).shortcut_text(menus::shown_shortcut(&e.shortcut))); + rows.push(row.id); if i == rsel { row.request_focus(); } @@ -715,6 +722,7 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { } } }); + ui.ctx().data_mut(|d| d.insert_temp(rows_id, rows)); r }) .inner; @@ -2334,6 +2342,44 @@ mod tests { assert_eq!(ctx.memory(|m| m.focused()), Some(above), "the clicked field keeps the focus"); } + /// A pick with the keyboard from Recent Commands that opens no dialog gives the focus back to + /// the widget that had it when the palette opened, though the picked row had the keyboard. + #[test] + fn a_pick_from_recent_commands_gives_the_focus_back() { + let ctx = egui::Context::default(); + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default()); + app.ui.recent_commands = vec!["paint.swap".into()]; + let mut text = String::new(); + let field = egui::Id::unique("other field"); + let mut frame = |app: &mut VectorcraftApp, focus: bool, events: Vec| { + ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| { + let r = ui.add(egui::TextEdit::singleline(&mut text).id(field)); + if focus { + r.request_focus(); + } + show(app, ui.ctx()); + }) + .textures_delta + .clear(); + }; + frame(&mut app, true, vec![]); + frame(&mut app, false, vec![]); + app.ui.palette_open = true; + frame(&mut app, false, vec![]); + egui::Popup::open_id(&ctx, recent_list_id()); + frame(&mut app, false, vec![]); + frame(&mut app, false, vec![]); + assert!(recent_list_open(&ctx), "the list is open"); + assert_ne!(ctx.memory(|m| m.focused()), Some(field), "the row has the keyboard"); + let enter = egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE }; + frame(&mut app, false, vec![enter]); + assert!(!app.ui.palette_open, "the pick closes the palette"); + assert!(app.ui.dialog.is_none(), "{}", app.ui.status); + frame(&mut app, false, vec![]); + frame(&mut app, false, vec![]); + assert_eq!(ctx.memory(|m| m.focused()), Some(field)); + } + /// The whole window, with a document whose rectangle is selected, drawn a frame at a time in /// English with screen readers on. struct Window { diff --git a/crates/ui-egui/src/palette/search.rs b/crates/ui-egui/src/palette/search.rs index e70b9f3637..8f1dd0e504 100644 --- a/crates/ui-egui/src/palette/search.rs +++ b/crates/ui-egui/src/palette/search.rs @@ -72,8 +72,9 @@ pub(crate) struct Index { initials_text: String, /// Each result's offset and length in `initials_text`. initials: Vec<(u32, u16)>, - /// Each word of a group of words with the same meaning ([`super::words::GROUPS`], and the - /// words the UI language's catalog adds), with the group's place in the table. + /// Each word of a group of words with the same meaning ([`super::words::GROUPS`], the words the + /// UI language's catalog adds, and the English words' stem forms), with the group's place in the + /// table. synonyms: HashMap, u16>, } @@ -84,8 +85,10 @@ pub(crate) fn is_one_word(w: &str) -> bool { } /// The words of each group of [`super::words::GROUPS`], with the words `search_row` gives for the -/// group's catalog row ([`super::words::row_key`]) in the UI language. A word the catalog gives -/// that is not a single word, or that is already a word of a group, is left out. +/// group's catalog row ([`super::words::row_key`]) in the UI language, and the English stem forms +/// ([`stems`]) of the group's English words (`setting` of settings). A word the catalog gives that +/// is not a single word, or that is already a word of a group, is left out, and so is a stem form +/// that is already a word of a group. fn synonym_groups(search_row: impl Fn(&str) -> Option) -> HashMap, u16> { let mut out: HashMap, u16> = HashMap::new(); let groups = super::words::GROUPS.iter().enumerate().filter_map(|(g, words)| u16::try_from(g).ok().map(|g| (g, words))); @@ -94,7 +97,7 @@ fn synonym_groups(search_row: impl Fn(&str) -> Option) -> HashMap Option) -> HashMap Date: Tue, 17 Nov 2026 08:14:14 -0500 Subject: [PATCH 049/158] Use shared contextual run shaping (#7878) --- Cargo.lock | 3 +- crates/text/Cargo.toml | 2 +- crates/text/src/shape.rs | 92 +++++++++++++++------------------------- 3 files changed, 38 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 29921a6d06..745e8c4171 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1039,8 +1039,9 @@ source = "git+https://github.com/storytold/craft-libs?rev=a499742a9389f47d10cdc6 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=4d51586a45321b101f608276ce7ccbcec3f1fab3#4d51586a45321b101f608276ce7ccbcec3f1fab3" +source = "git+https://github.com/storytold/craft-libs?rev=d0a9c79933a54883cd5bc3dfe839f1dd699f2c69#d0a9c79933a54883cd5bc3dfe839f1dd699f2c69" dependencies = [ + "harfrust 0.13.3", "kurbo 0.13.1", "skrifa 0.47.0", "thiserror 2.0.21", diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index 6a6ed42b51..7feac2bc60 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -10,7 +10,7 @@ workspace = true [dependencies] # Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "4d51586a45321b101f608276ce7ccbcec3f1fab3", default-features = false } +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "d0a9c79933a54883cd5bc3dfe839f1dd699f2c69", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/shape.rs b/crates/text/src/shape.rs index c9ae809da5..795e2c375b 100644 --- a/crates/text/src/shape.rs +++ b/crates/text/src/shape.rs @@ -8,7 +8,7 @@ use unicode_bidi::Level; use unicode_script::{Script, UnicodeScript}; use unicode_segmentation::UnicodeSegmentation; -use harfrust::{BufferClusterLevel, Direction, Feature, ShapeOptions, Tag, UnicodeBuffer}; +use harfrust::{Direction, Feature, Tag}; use kurbo::Shape; use skrifa::MetadataProvider; use skrifa::charmap::Charmap; @@ -673,7 +673,7 @@ pub(crate) fn shape_runs( // Split into segments by font coverage (and case, for Small Caps). let mut seg = Segment { db, range: a..a, runs, source_runs, st, face: primary.clone(), small: false, level: level_at(a) }; let mut cache: std::collections::HashMap<&str, Arc> = std::collections::HashMap::new(); - let mut script = Script::Common; + let mut boundary = craft_font_catalog::SegmentBoundary::new(primary.id(), level_at(a)); // A grapheme cluster (a letter and its marks, an emoji sequence) is set in one face. for (i, cluster) in text[a..b].grapheme_indices(true) { let i = a + i; @@ -693,20 +693,16 @@ pub(crate) fn shape_runs( }; let small = small_caps && c.is_lowercase(); let next_script = shaping_script(c); - let strong_script = !matches!(next_script, Script::Common | Script::Inherited); - let script_change = strong_script && script != Script::Common && script != next_script; + let strong_script = (!matches!(next_script, Script::Common | Script::Inherited)).then_some(next_script); // Combining marks, zero width joiners and non-joiners, and variation selectors stay // with the character before them. - if (face.id() != seg.face.id() || small != seg.small || level != seg.level || script_change) && !is_mark(c) { + if boundary.advance(face.id(), level, small, strong_script, is_mark(c)) { if i > seg.range.start { seg.range.end = i; shape_segment(text, &range, &seg, feats, out); } seg = Segment { range: i..i, face, small, level, ..seg }; } - if strong_script { - script = next_script; - } } if b > seg.range.start { seg.range.end = b; @@ -1301,10 +1297,7 @@ fn shapes_alike(a: &CharStyle, b: &CharStyle) -> bool { /// `digits`: not what the layout handles itself (tab, line and paragraph breaks), joiners or /// variation selectors. fn drawn_chars(cluster: &str, digits: Digits) -> impl Iterator + '_ { - cluster - .chars() - .map(move |c| digits.map(c)) - .filter(|&c| !(c.is_control() || matches!(c, '\u{200C}' | '\u{200D}' | '\u{2028}' | '\u{FE00}'..='\u{FE0F}' | '\u{E0100}'..='\u{E01EF}'))) + craft_font_catalog::drawable_characters(cluster, move |c| digits.map(c)) } /// Does the face with charmap `map` have a glyph for `c` (any face does when it has no charmap)? @@ -1316,11 +1309,14 @@ fn in_face(map: Option<&Charmap<'_>>, c: char) -> bool { /// first fallback face with all of them, so that a letter's marks are shaped with it and attach to /// it (#4491); when there is none, the face its first character takes on its own. fn fallback_face(db: &FontDb, primary: &Arc, pmap: Option<&Charmap<'_>>, cluster: &str, digits: Digits) -> Arc { - let fallback = |c| db.fallback_for_style(c, primary.id(), primary.weight, primary.italic); - drawn_chars(cluster, digits) - .find_map(|c| fallback(c).filter(|f| drawn_chars(cluster, digits).all(|c| f.covers(c)))) - .or_else(|| drawn_chars(cluster, digits).next().filter(|&c| !in_face(pmap, c)).and_then(fallback)) - .unwrap_or_else(|| primary.clone()) + craft_font_catalog::cluster_face( + cluster, + primary, + |c| digits.map(c), + |c| in_face(pmap, c), + |c| db.fallback_for_style(c, primary.id(), primary.weight, primary.italic), + |face, c| face.covers(c), + ) } /// The script `c` is shaped in: Japanese and Chinese text mixes Han, Hiragana, Katakana and @@ -1606,46 +1602,28 @@ fn shape_segment(text: &str, context: &Range, seg: &Segment, feats: &OtFe let along_features = with_more(&|s| feats.resolve(s)); // gid, cluster, x and y advance, x and y offset. let shape = |feats: &[Feature], direction: Direction| { - let mut buf = UnicodeBuffer::new(); - for (i, c) in text_seg.char_indices() { - let cl = (range.start + i) as u32; - let c = st.digits.map(c); - if upper { - for u in c.to_uppercase() { - buf.add(u, cl); - } - } else { - buf.add(c, cl); - } - } - buf.set_direction(direction); - buf.guess_segment_properties(); - if char_level.get() { - buf.set_cluster_level(BufferClusterLevel::Characters); - } - // The characters' language picks the font's forms for it (`locl`: Turkish keeps fi - // apart and the dot on its i). - if let Some(l) = &language { - buf.set_language(l.clone()); - } - // Harfrust keeps this Unicode context for joining/positional shaping, but does not emit - // glyphs for it. This retains context at real style/font segmentation boundaries without - // shaping across those boundaries or claiming cross-style ligatures/mark attachment. - if let Some(pre) = text.get(context.start..range.start) { - buf.set_pre_context(pre); - } - if let Some(post) = text.get(range.end..context.end) { - buf.set_post_context(post); - } - // A buffer whose characters name no script reads as `UNKNOWN`: its plan has none. - let script = Some(buf.script()).filter(|s| *s != harfrust::script::UNKNOWN); - let plan = face.shape_plan(&shaper, buf.direction(), script, language.as_ref(), feats); - let gb = shaper.shape(buf, ShapeOptions::new().features(feats).plan(Some(&plan))); - gb.glyph_infos() - .iter() - .zip(gb.glyph_positions()) - .map(|(info, pos)| (info.glyph_id, info.cluster, pos.x_advance, pos.y_advance, pos.x_offset, pos.y_offset)) - .collect::>() + let input = craft_font_catalog::RunInput { + text: text_seg, + source_start: range.start, + pre_context: text.get(context.start..range.start).unwrap_or_default(), + post_context: text.get(range.end..context.end).unwrap_or_default(), + direction, + language: language.as_ref(), + features: feats, + character_clusters: char_level.get(), + uppercase: upper, + }; + craft_font_catalog::shape_run( + &shaper, + &input, + |c| st.digits.map(c), + |shaper, direction, script, language, features| face.shape_plan(shaper, direction, script, language, features), + ) + // HarfRust clusters are u32; a run beyond that source offset cannot be represented. + .unwrap_or_default() + .into_iter() + .map(|g| (g.glyph_id, g.cluster, g.x_advance, g.y_advance, g.x_offset, g.y_offset)) + .collect::>() }; let along = if level.is_rtl() { Direction::RightToLeft } else { Direction::LeftToRight }; *raw = shape(&along_features, along).into_iter().map(|(g, c, xa, _, xo, yo)| (g, c, xa, xo, yo)).collect(); From 176db2d09cabbc7600025d8f52c32982880575b0 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 05:10:33 -0800 Subject: [PATCH 050/158] Object Mosaic: true or false replaces a refused percentages value After ui.dialog.set gave Resize Using Percentages a value that is not true or false, setting false (or setting true while the sizes were already in percentages) left the refused value in place, so OK kept failing. The dialog now remembers the mode the sizes were in while such a value is set: the same mode stores the boolean and keeps the sizes, and the other mode shows the sizes the other way, as the checkbox does. Null is read as false, as the command reads it, so percentage sizes are converted to points. --- crates/ui-egui/src/dialogs/object_mosaic.rs | 57 ++++++++++++++++++--- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs index 313751320a..bc7ebdbbfe 100644 --- a/crates/ui-egui/src/dialogs/object_mosaic.rs +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -129,7 +129,7 @@ pub(super) fn note_set(d: &mut Dialog, field: &str) { fn derived(d: &Dialog) -> Option<(&'static str, f64)> { let key = follower(d)?; let (iw, ih) = image(d); - let pct = d.bool("percentages"); + let pct = in_percentages(d); Some(if key == "height" { let w = d.f64("width", 0.0); (key, if pct { w } else { w * ih / iw }) @@ -161,18 +161,36 @@ fn switch_percentages(d: &mut Dialog, on: bool) { return; } d.fields.remove(form::REFUSED); + d.fields.remove(&kept("percentages")); d.fields.insert("width".into(), json!(w)); d.fields.insert("height".into(), json!(h)); d.fields.insert("percentages".into(), json!(on)); } -/// `ui.dialog.set` of `percentages`: true or false switches the new size as the checkbox does; -/// another value is kept as it is, and the command refuses it on OK. +/// Whether the new size fields hold percentages: Resize Using Percentages, or while that field holds +/// a value that is not true or false, the mode it held before that value was set. +fn in_percentages(d: &Dialog) -> bool { + match d.fields.get("percentages") { + Some(Value::Bool(on)) => *on, + Some(_) => d.bool(&kept("percentages")), + None => false, + } +} + +/// `ui.dialog.set` of `percentages`: true or false switches the new size as the checkbox does, and +/// replaces a value that is not true or false; null is false. Another value is kept as it is, and +/// the command refuses it on OK. pub(super) fn set_percentages(d: &mut Dialog, value: &Value) { - match value.as_bool() { - Some(on) if on != d.bool("percentages") => switch_percentages(d, on), - Some(_) => {} + let mode = in_percentages(d); + // The command reads null as the field left out, which is off. + match if value.is_null() { Some(false) } else { value.as_bool() } { + Some(on) if on != mode => switch_percentages(d, on), + Some(on) => { + d.fields.remove(&kept("percentages")); + d.fields.insert("percentages".into(), json!(on)); + } None => { + d.fields.insert(kept("percentages"), json!(mode)); d.fields.insert("percentages".into(), value.clone()); } } @@ -261,7 +279,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { }); ui.add_space(4.0); let follows = follower(d); - let pct = d.bool("percentages"); + let pct = in_percentages(d); widgets::label_row(ui, tl!("New Size:"), LABEL_W, |ui| pair(ui, d, ["width", "height"], unit, (pct, 0.1), follows)); follow_ratio(d); ui.add_space(4.0); @@ -601,6 +619,31 @@ mod tests { assert_eq!(mosaic(&app), None); } + /// True or false set after a Resize Using Percentages value the command refuses replaces it: the + /// same mode as before keeps the sizes, and the other mode shows them the other way. Null is + /// false, as the command reads it. OK then makes the mosaic. + #[test] + fn true_or_false_replaces_a_refused_percentages_value() { + let pct = json!({"percentages": true, "width": 50, "height": 50}); + for (given, sets, size) in [ + (json!({}), vec![json!("yes"), json!(false)], (100.0, 50.0)), + (pct.clone(), vec![json!("yes"), json!(false)], (50.0, 25.0)), + (pct.clone(), vec![Value::Null], (50.0, 25.0)), + (pct, vec![json!("yes"), Value::Null], (50.0, 25.0)), + ] { + let mut app = app_with_image(); + open(&mut app, &given).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + for value in sets { + crate::dialogs::set_field(d, "percentages".into(), value); + } + assert_eq!(d.fields.get("percentages"), Some(&json!(false)), "{given}"); + assert_eq!((d.f64("width", 0.0), d.f64("height", 0.0)), size, "{given}"); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(mosaic(&app).map(|m| (m.0, m.1)), Some(size), "{given}"); + } + } + /// With Constrain Ratio on, a refused height `ui.dialog.set` gave is refused on OK even when it /// equals the size Constrain Ratio works out from the width (0.05 pt from 0.1 pt over 100 × 50 pt). #[test] From e91116e0bfba872eb69e03116edd81aefaea0545 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 06:00:08 -0800 Subject: [PATCH 051/158] Object Mosaic: percentages convert against the image's current size The dialog reads the selected image's size again each frame, before ui.dialog.set sets fields, and on OK. An image scaled while the dialog is open shows its new Current Size, and Resize Using Percentages converts New Size against it, so OK makes the size shown. With no image selected, switching Resize Using Percentages leaves the fields as they are and the dialog asks for an image. --- crates/ui-egui/src/control.rs | 2 + crates/ui-egui/src/dialogs/object_mosaic.rs | 97 ++++++++++++++++++++- 2 files changed, 96 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index a2c29fadc4..3ce5846e65 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -1607,6 +1607,8 @@ fn dispatch(app: &mut VectorcraftApp, ctx: &egui::Context, req: &ControlRequest) let names = crate::dialogs::field_names(d).join(", "); return err(format!("the `{}` dialog has no field `{f}`; its fields: {names}", d.kind)); } + // Create Object Mosaic converts New Size against the selected image's size as it is now. + crate::dialogs::object_mosaic::refresh(app); // In order: a field that sets others (an export preset) goes before the fields after it. // A field that fails leaves the dialog as it was before the request. let before = app.ui.dialog.clone(); diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs index bc7ebdbbfe..cab5371d93 100644 --- a/crates/ui-egui/src/dialogs/object_mosaic.rs +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -6,7 +6,9 @@ //! Fields: `width`, `height` (pt, or percentages of the image's size with `percentages`), //! `spacingX`, `spacingY` (pt), `columns`, `rows`, `lock` (Constrain Ratio on), `constrain` //! (`width` | `height`: the side Constrain Ratio and Use Ratio keep), `gray`, `percentages` and -//! `deleteRaster`. `__imageW` and `__imageH` hold the image's size (pt). +//! `deleteRaster`. `__imageW` and `__imageH` hold the image's size (pt), read again from the +//! selected image each frame, before `ui.dialog.set` sets fields and on OK; `__noImage` is true +//! while no image is selected. use serde_json::{Value, json}; use vectorcraft_doc::NodeKind; @@ -68,6 +70,36 @@ pub fn open(app: &mut VectorcraftApp, given: &Value) -> Result { Ok(json!({ "dialog": KIND })) } +/// The field that is true while no image is selected. +const NO_IMAGE: &str = "__noImage"; + +/// What the dialog shows when Resize Using Percentages is switched with no image selected. +const NO_IMAGE_WHY: &str = "select an image"; + +/// The selected image's size `size` (from [`image_size`]) read into the dialog, so New Size is +/// converted and constrained against the image as it is now, also after it was scaled while the +/// dialog was open. With no image selected the last size read stays and `__noImage` is set. +fn read_image(size: Option<(f64, f64)>, d: &mut Dialog) { + let Some((w, h)) = size else { + d.fields.insert(NO_IMAGE.into(), json!(true)); + return; + }; + if d.fields.remove(NO_IMAGE).is_some() && d.str(form::REFUSED) == NO_IMAGE_WHY { + d.fields.remove(form::REFUSED); + } + d.fields.insert("__imageW".into(), json!(w)); + d.fields.insert("__imageH".into(), json!(h)); +} + +/// [`read_image`] on the open dialog when it is this one. `ui.dialog.set` runs it before it sets +/// any field. +pub(crate) fn refresh(app: &mut VectorcraftApp) { + let size = image_size(app); + if let Some(d) = app.ui.dialog.as_mut().filter(|d| d.kind == KIND) { + read_image(size, d); + } +} + /// The image's size (pt) the dialog holds. fn image(d: &Dialog) -> (f64, f64) { (d.f64("__imageW", 1.0).max(1e-9), d.f64("__imageH", 1.0).max(1e-9)) @@ -142,8 +174,13 @@ fn derived(d: &Dialog) -> Option<(&'static str, f64)> { /// Resize Using Percentages turned on or off: the new size shown the other way, so it stays the /// same size. When a size field does not hold a number, or a size the command takes (all but the /// side Constrain Ratio sets) falls outside what the command accepts the other way, the fields and -/// the mode stay as they are and the dialog shows why. +/// the mode stay as they are and the dialog shows why. With no image selected, nothing changes and +/// the dialog asks for one. fn switch_percentages(d: &mut Dialog, on: bool) { + if d.bool(NO_IMAGE) { + d.fields.insert(form::REFUSED.into(), json!(NO_IMAGE_WHY)); + return; + } let (iw, ih) = image(d); let size = |key: &str| number(d, key, 100.0).as_f64().ok_or_else(|| format!("`{key}` must be a number (got {})", d.str(key))); let (w, h) = match (size("width"), size("height")) { @@ -270,6 +307,7 @@ fn pair(ui: &mut egui::Ui, d: &mut Dialog, keys: [&str; 2], unit: vectorcraft_do fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { let unit = app.session.general_unit(); + read_image(image_size(app), d); let (iw, ih) = image(d); widgets::label_row(ui, tl!("Current Size:"), LABEL_W, |ui| { widgets::dim_label(ui, tl!("Width:")); @@ -335,8 +373,12 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { false } +/// OK: the new size worked out against the image's size as it is now, as a frame would show it. fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { - run_and_close(app, COMMAND, params(d)) + let mut d = d.clone(); + read_image(image_size(app), &mut d); + follow_ratio(&mut d); + run_and_close(app, COMMAND, params(&d)) } #[cfg(test)] @@ -619,6 +661,55 @@ mod tests { assert_eq!(mosaic(&app), None); } + /// The image scaled from 100 × 50 pt to 200 × 100 pt while the dialog is open: Current Size shows + /// the new size, and Resize Using Percentages, by `ui.dialog.set` or by its checkbox, converts + /// New Size against it, so OK makes the size shown. With no image selected, switching is refused. + #[test] + fn percentages_convert_against_the_image_scaled_while_the_dialog_is_open() { + let set = |app: &mut VectorcraftApp, field: &str, value: Value| { + let (req, _) = crate::control::ControlRequest::new("ui.dialog.set", json!({"field": field, "value": value})); + let crate::control::Outcome::Done(r) = crate::control::handle(app, &egui::Context::default(), &req) else { + panic!("expected an immediate reply") + }; + r + }; + let mut app = app_with_image(); + open(&mut app, &json!({"width": 200, "height": 100})).unwrap(); + app.run("object.scale", json!({"sx": 200, "sy": 200})).unwrap(); + let ctx = context(); + frame(&mut app, &ctx); + let texts = frame(&mut app, &ctx); + assert!(texts.iter().any(|t| t == "200 pt"), "Current Size shows the scaled image: {texts:?}"); + let r = set(&mut app, "percentages", json!(true)); + assert_eq!(r["ok"], json!(true), "{r}"); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!((d.f64("width", 0.0), d.f64("height", 0.0), d.bool("percentages")), (100.0, 100.0, true)); + app.run("object.scale", json!({"sx": 50, "sy": 50})).unwrap(); + // The checkbox, after the image went back to 100 × 50 pt: 100% of it is 100 × 50 pt. + let size = image_size(&app); + let d = app.ui.dialog.as_mut().unwrap(); + read_image(size, d); + switch_percentages(d, false); + assert_eq!((d.f64("width", 0.0), d.f64("height", 0.0)), (100.0, 50.0)); + crate::dialogs::set_field(d, "percentages".into(), json!(true)); + app.run("object.scale", json!({"sx": 200, "sy": 200})).unwrap(); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(mosaic(&app).map(|m| (m.0, m.1)), Some((200.0, 100.0)), "100% of the image as it is on OK"); + app.run("edit.undo", json!({})).unwrap(); + // No image selected: the mode and sizes stay and the dialog asks for an image. + app.run("select.set", json!({"ids": [image_id(&app)]})).unwrap(); + open(&mut app, &json!({})).unwrap(); + app.run("select.set", json!({"ids": []})).unwrap(); + set(&mut app, "percentages", json!(true)); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!((d.f64("width", 0.0), d.bool("percentages")), (200.0, false)); + assert_eq!(d.str(form::REFUSED), NO_IMAGE_WHY); + app.run("select.set", json!({"ids": [image_id(&app)]})).unwrap(); + set(&mut app, "percentages", json!(true)); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!((d.f64("width", 0.0), d.bool("percentages"), d.str(form::REFUSED)), (100.0, true, String::new())); + } + /// True or false set after a Resize Using Percentages value the command refuses replaces it: the /// same mode as before keeps the sizes, and the other mode shows them the other way. Null is /// false, as the command reads it. OK then makes the mosaic. From c8d16e66ae28d7275c4f5648cb4301c818fed2ae Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 06:11:27 -0800 Subject: [PATCH 052/158] Object Mosaic: OK refuses a Constrain Ratio value the command refuses A Constrain Ratio side other than width or height, set through ui.dialog.set, is passed to object.createObjectMosaic, which refuses it, instead of being read as the width. A Constrain Ratio (lock) that is not true or false is refused on OK, and the dialog stays open. --- crates/ui-egui/src/dialogs/object_mosaic.rs | 36 ++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs index cab5371d93..08497fb3c0 100644 --- a/crates/ui-egui/src/dialogs/object_mosaic.rs +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -266,6 +266,18 @@ fn switch(d: &Dialog, key: &str) -> Value { d.fields.get(key).cloned().unwrap_or(json!(false)) } +/// `constrain` as the command takes it: null with Constrain Ratio off, else the side the field +/// holds (the width when it holds none), and any other value as it is, for the command to refuse. +fn constrained_side(d: &Dialog) -> Value { + if !d.bool("lock") { + return Value::Null; + } + match d.fields.get("constrain") { + None | Some(Value::Null) => json!("width"), + Some(v) => v.clone(), + } +} + /// `object.createObjectMosaic` parameters from the fields. With Constrain Ratio on, the side it /// sets is left out while it holds the size Constrain Ratio gives it: the command works it out from /// the kept side and grows both in proportion to its 0.1 pt minimum. Any other value set on that @@ -275,7 +287,7 @@ fn params(d: &Dialog) -> Value { let mut p = json!({ "columns": number(d, "columns", 10.0), "rows": number(d, "rows", 10.0), "width": number(d, "width", 100.0), "height": number(d, "height", 100.0), "percentages": switch(d, "percentages"), - "constrain": if d.bool("lock") { json!(if keeps_width(d) { "width" } else { "height" }) } else { Value::Null }, + "constrain": constrained_side(d), "spacingX": number(d, "spacingX", 0.0), "spacingY": number(d, "spacingY", 0.0), "gray": switch(d, "gray"), "deleteRaster": switch(d, "deleteRaster"), }); @@ -374,7 +386,11 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { } /// OK: the new size worked out against the image's size as it is now, as a frame would show it. +/// A Constrain Ratio (`lock`) that is not true or false is refused, and the dialog stays open. fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { + if d.fields.get("lock").is_some_and(|v| !v.is_boolean() && !v.is_null()) { + return Err("`lock` must be true or false".into()); + } let mut d = d.clone(); read_image(image_size(app), &mut d); follow_ratio(&mut d); @@ -710,6 +726,24 @@ mod tests { assert_eq!((d.f64("width", 0.0), d.bool("percentages"), d.str(form::REFUSED)), (100.0, true, String::new())); } + /// A Constrain Ratio side other than width or height, or a Constrain Ratio that is not true or + /// false, set by `ui.dialog.set`, is refused on OK and makes no mosaic. + #[test] + fn a_constrain_ratio_value_the_command_refuses_is_refused() { + for (field, value, also) in [("constrain", json!("both"), Some(("lock", json!(true)))), ("lock", json!("yes"), None)] { + let mut app = app_with_image(); + open(&mut app, &json!({})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + if let Some((k, v)) = also { + crate::dialogs::set_field(d, k.into(), v); + } + crate::dialogs::set_field(d, field.into(), value.clone()); + let e = crate::dialogs::confirm(&mut app).unwrap_err(); + assert!(e.contains(field), "{value}: {e}"); + assert_eq!(mosaic(&app), None, "{value}"); + } + } + /// True or false set after a Resize Using Percentages value the command refuses replaces it: the /// same mode as before keeps the sizes, and the other mode shows them the other way. Null is /// false, as the command reads it. OK then makes the mosaic. From 5f0e01137942c056944ea5b79183ce92e17d1961 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Tue, 17 Nov 2026 07:48:02 -0800 Subject: [PATCH 053/158] Preserve open outlines painted by ancestor strokes --- crates/engine/src/cmd/draw2/common.rs | 16 +- crates/engine/src/cmd/draw2/cut.rs | 9 +- crates/engine/tests/eraser_open_fill.rs | 189 ++++++++++++++++++++++++ 3 files changed, 209 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/draw2/common.rs b/crates/engine/src/cmd/draw2/common.rs index 4a52ee0720..694e6aeca5 100644 --- a/crates/engine/src/cmd/draw2/common.rs +++ b/crates/engine/src/cmd/draw2/common.rs @@ -357,13 +357,27 @@ pub(super) fn has_painted_stroke(n: &Node) -> bool { ) } +/// A container stroke that paints this target's open geometry. A clipping container's own +/// paint follows its clipping outline, and a compound shape paints its combined area instead. +/// Neither makes its descendants' implicit fill-closing edges into new stroked edges. +pub(super) fn has_painted_ancestor_stroke(doc: &Document, id: NodeId) -> bool { + doc.ancestry(id) + .unwrap_or_default() + .into_iter() + .rev() + .skip(1) + .filter_map(|id| doc.node(id)) + .take_while(|node| !node.clips() && !node.is_compound_shape()) + .any(|node| matches!(node.kind, NodeKind::Group { .. } | NodeKind::Layer { .. }) && has_painted_stroke(node)) +} + /// [`target_paths`] for the tools that cut fills, with each target's geometry and fill rule: the /// members of a compound path whose members are all closed paths give the compound path itself, /// once, so its fill (holes included) is cut as one shape under its own fill rule. /// With `open_fills`, an open compound with a visible fill and no painted visible stroke does too. pub(super) fn fill_targets(doc: &Document, sel: &Selection, area: Rect, open_fills: bool) -> Result> { let area_compound = |n: &Node| { - let filled = open_fills && has_fill(n) && !has_painted_stroke(n); + let filled = open_fills && has_fill(n) && !has_painted_stroke(n) && !has_painted_ancestor_stroke(doc, n.id); matches!(&n.kind, NodeKind::Compound { children, .. } if children.iter().all(|c| matches!(&c.kind, NodeKind::Path { path, .. } if path.is_closed() || filled))) }; diff --git a/crates/engine/src/cmd/draw2/cut.rs b/crates/engine/src/cmd/draw2/cut.rs index 8a9c5d039e..cbf0b8e333 100644 --- a/crates/engine/src/cmd/draw2/cut.rs +++ b/crates/engine/src/cmd/draw2/cut.rs @@ -1,7 +1,7 @@ use super::common::{ - PenRecord, SIZE_VARIATIONS, SIZES, Sample, center_strokes, dist_to_polyline, fill_targets, has_fill, has_painted_stroke, ids_json, path_mut, - path_of, points_param, poly_bounds, pressure_region, ranged, replace_with_pieces, samples_param, set_geometry, sibling_with, size_pressure, - target_paths, usize_opt, + PenRecord, SIZE_VARIATIONS, SIZES, Sample, center_strokes, dist_to_polyline, fill_targets, has_fill, has_painted_ancestor_stroke, + has_painted_stroke, ids_json, path_mut, path_of, points_param, poly_bounds, pressure_region, ranged, replace_with_pieces, samples_param, + set_geometry, sibling_with, size_pressure, target_paths, usize_opt, }; use super::{ Anchor, AnchorKind, Beside, BezPath, BoolOp, Cap, Document, EngineError, FillRule, Join, NodeId, NodeKind, Paint, ParamCurve, PathData, Point, @@ -361,7 +361,8 @@ fn erase_as_area(doc: &Document, id: NodeId, pd: &PathData) -> bool { // paint it. Eligible fill-only compounds were collected as one parent target above. let compound_member = doc.parent_of(id).and_then(|parent| doc.node(parent)).is_some_and(|parent| matches!(parent.kind, NodeKind::Compound { .. })); - let filled_open = !compound_member && doc.node(id).is_some_and(|node| has_fill(node) && !has_painted_stroke(node)); + let filled_open = + !compound_member && !has_painted_ancestor_stroke(doc, id) && doc.node(id).is_some_and(|node| has_fill(node) && !has_painted_stroke(node)); pd.is_closed() || filled_open } diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index 3b131992b5..790c0b7cf8 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -1646,3 +1646,192 @@ fn eraser_copying_container_gradient_keeps_source_fit_through_earlier_copy() { assert_eq!(fitted.1, fitted.0, "pinning follows the earlier eligible copy split as rendering does"); assert_eq!(fitted.1, placed.1, "both live copy stages preserve the same source placement after editing"); } + +#[test] +fn eraser_keeps_group_painted_open_paths_on_the_outline_route() { + for mode in ["fixed", "varied", "marquee"] { + for group_stroke in [false, true] { + let mut s = session(); + let id = NodeId( + s.execute( + "path.create", + &json!({"anchors": [ + {"x": 100, "y": 100}, {"x": 200, "y": 100}, + {"x": 200, "y": 200}, {"x": 100, "y": 200} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#0000ff"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "none": true})).unwrap(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let group = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + if group_stroke { + s.execute("appearance.addStroke", &json!({"ids": [group.0], "target": "object"})).unwrap(); + s.execute( + "appearance.setItem", + &json!({"ids": [group.0], "target": "object", "index": 0, + "color": "#ff0000", "weight": 4}), + ) + .unwrap(); + } + s.execute("select.none", &json!({})).unwrap(); + assert!(!path(&s, id).is_closed()); + let d = &s.doc().unwrap().doc; + assert_eq!(d.parent_of(id), Some(group)); + assert!(d.node(id).unwrap().appearance.stroke_paint().is_none()); + assert_eq!(d.node(group).unwrap().appearance.stroke_width(), if group_stroke { 4.0 } else { 0.0 }); + let render = |s: &Session| { + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) + }; + let before_image = render(&s); + assert_eq!(before_image.pixel(150, 150), [0, 0, 255, 255]); + if group_stroke { + assert_eq!(before_image.pixel(150, 100), [255, 0, 0, 255], "the Group really paints the child's open outline"); + assert_eq!(before_image.pixel(99, 125)[3], 0, "the missing closing edge is not stroked"); + } + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let history = s.doc().unwrap().history.undo.len(); + let selection = s.doc().unwrap().selection.clone(); + let paint = s.paint.clone(); + // This ordinary Eraser gesture hits fill, at least 30 pt from every real outline. + let result = match mode { + "marquee" => s.execute("path.eraseRegion", &json!({"rect": [130, 145, 40, 10]})).unwrap(), + _ => erase(&mut s, json!({"points": [[130, 150], [170, 150]], "size": 10}), mode == "varied"), + }; + if group_stroke { + assert_eq!(result["ids"], json!([]), "{mode}: a Group-painted open outline keeps main's miss behavior"); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(render(&s).pixels, before_image.pixels); + } else { + assert!(!result["ids"].as_array().unwrap().is_empty(), "{mode}: the fill-only Group control still cuts as an area"); + let after_image = render(&s); + assert_eq!(after_image.pixel(150, 150)[3], 0); + assert_eq!(after_image.pixel(120, 125), [0, 0, 255, 255]); + } + assert_eq!(s.paint, paint); + } + } +} + +#[test] +fn eraser_ancestor_stroke_classification_keeps_container_context() { + for container in ["nested", "layer", "compound", "clip"] { + for stroke in ["painted", "hidden", "none", "zero"] { + eraser_ancestor_stroke_case(container, stroke); + } + } +} + +fn eraser_ancestor_stroke_case(container: &str, stroke: &str) { + let mut s = eraser_ancestor_stroke_scene(container, stroke); + let render = |s: &Session| { + vectorcraft_render::Renderer::new().render(&s.doc().unwrap().doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()) + }; + let before_image = render(&s); + assert_eq!(before_image.pixel(150, 150), [0, 0, 255, 255], "{container}/{stroke}: actual filled input"); + let outline_route = stroke == "painted" && container != "clip"; + if outline_route { + assert_eq!(before_image.pixel(150, 100), [255, 0, 0, 255], "{container}: actual ancestor stroke"); + } else if container == "clip" && stroke == "painted" { + assert_eq!(before_image.pixel(150, 90), [255, 0, 0, 255], "the ancestor paints the clipping outline"); + assert_eq!(before_image.pixel(150, 100), [0, 0, 255, 255], "the ancestor does not stroke the clipped child's outline"); + } + let before = serde_json::to_value(&s.doc().unwrap().doc).unwrap(); + let history = s.doc().unwrap().history.undo.len(); + let selection = s.doc().unwrap().selection.clone(); + let paint = s.paint.clone(); + let result = erase(&mut s, json!({"points": [[130, 150], [170, 150]], "size": 10}), false); + if outline_route { + assert_eq!(result["ids"], json!([]), "{container}/{stroke}: preserve main's open-outline miss"); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().history.undo.len(), history); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(render(&s).pixels, before_image.pixels); + } else { + assert!(!result["ids"].as_array().unwrap().is_empty(), "{container}/{stroke}: the eligible fill still cuts"); + let after_image = render(&s); + assert_eq!(after_image.pixel(150, 150)[3], 0, "{container}/{stroke}"); + assert_eq!(after_image.pixel(120, 125), [0, 0, 255, 255], "{container}/{stroke}"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(&s.doc().unwrap().doc).unwrap(), before); + assert_eq!(s.doc().unwrap().selection, selection); + assert_eq!(render(&s).pixels, before_image.pixels); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(render(&s).pixel(150, 150)[3], 0); + } + assert_eq!(s.paint, paint); +} + +fn eraser_ancestor_stroke_scene(container: &str, stroke: &str) -> Session { + let mut s = session(); + let id = NodeId( + s.execute( + "path.create", + &json!({"anchors": [ + {"x": 100, "y": 100}, {"x": 200, "y": 100}, + {"x": 200, "y": 200}, {"x": 100, "y": 200} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(), + ); + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#0000ff"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [id.0], "none": true})).unwrap(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let mut subject = id; + if container == "compound" { + let other = s + .execute( + "path.create", + &json!({"anchors": [ + {"x": 220, "y": 100}, {"x": 240, "y": 100}, + {"x": 240, "y": 120}, {"x": 220, "y": 120} + ]}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(); + s.execute("paint.setFill", &json!({"ids": [other], "color": "#0000ff"})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [other], "none": true})).unwrap(); + s.execute("select.set", &json!({"ids": [id.0, other]})).unwrap(); + subject = NodeId(s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + let NodeKind::Compound { children, .. } = &s.doc().unwrap().doc.node(subject).unwrap().kind else { + panic!("the public Make command produces a compound path") + }; + assert_eq!(children.len(), 2); + assert!(children.iter().all(|child| !child.path_data().unwrap().is_closed())); + } else if container == "clip" { + let mask = s.execute("shape.rectangle", &json!({"x": 90, "y": 90, "width": 120, "height": 120})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [id.0, mask]})).unwrap(); + subject = NodeId(s.execute("object.clippingMask.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + assert!(s.doc().unwrap().doc.node(subject).unwrap().clips()); + } + let owner = if container == "layer" { + s.doc().unwrap().doc.layer_of(id).unwrap() + } else { + s.execute("select.set", &json!({"ids": [subject.0]})).unwrap(); + let inner = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + if container == "nested" { NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()) } else { inner } + }; + s.execute("appearance.addStroke", &json!({"ids": [owner.0], "target": "object"})).unwrap(); + s.execute( + "appearance.setItem", + &json!({"ids": [owner.0], "target": "object", "index": 0, + "color": "#ff0000", "weight": if stroke == "zero" { 0 } else { 4 }, "visible": stroke != "hidden"}), + ) + .unwrap(); + if stroke == "none" { + s.execute("appearance.setItem", &json!({"ids": [owner.0], "target": "object", "index": 0, "none": true})).unwrap(); + } + // Select only the original open child (or the two-member compound). In the clip + // control, neither the mask nor the other container geometry is an Eraser target. + let selected = if container == "compound" { subject } else { id }; + s.execute("select.set", &json!({"ids": [selected.0]})).unwrap(); + s +} From 0586232cbf22d88c54d4823b5a9eafaca3f593ef Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 07:53:39 -0800 Subject: [PATCH 054/158] i18n: French Object Mosaic labels use a no-break space before colons The six Object Mosaic dialog labels that end in a colon now put U+00A0 before it, as the other colon rows in fr.tsv do, so french_catalog_uses_nonbreaking_prose_punctuation passes. --- crates/ui-egui/src/i18n/fr.tsv | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 99dd69b285..53527e3afe 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -700,12 +700,12 @@ font-technology Variable Variables Create New {kind} Style Créer un style de {kind} Create Object Mosaic… Créer une mosaïque d’objets… Create Object Mosaic Créer une mosaïque d’objets - Current Size: Taille actuelle : - New Size: Nouvelle taille : - Tile Spacing: Espacement des carreaux : - Number of Tiles: Nombre de carreaux : - Constrain Ratio: Conserver les proportions : - Result: Résultat : + Current Size: Taille actuelle : + New Size: Nouvelle taille : + Tile Spacing: Espacement des carreaux : + Number of Tiles: Nombre de carreaux : + Constrain Ratio: Conserver les proportions : + Result: Résultat : Resize Using Percentages Redimensionner en pourcentage Delete Raster Supprimer l’image pixellisée Use Ratio Utiliser le rapport From 0a212624c10fbc5d90f37b95f9c2fc21985c0626 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 08:09:58 -0800 Subject: [PATCH 055/158] Object Mosaic: OK keeps the dialog open when the command refuses its fields OK closed the dialog whether or not object.createObjectMosaic succeeded, so a field the command refused, set through ui.dialog.set, was lost. The dialog now closes only when the command succeeds, as form::commit_preview does. --- crates/ui-egui/src/dialogs/object_mosaic.rs | 30 ++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs index 08497fb3c0..eac36e9095 100644 --- a/crates/ui-egui/src/dialogs/object_mosaic.rs +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -13,7 +13,7 @@ use serde_json::{Value, json}; use vectorcraft_doc::NodeKind; -use super::{DialogSpec, form, run_and_close}; +use super::{DialogSpec, form}; use crate::state::Dialog; use crate::theme::Tokens; use crate::{VectorcraftApp, widgets}; @@ -386,7 +386,9 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { } /// OK: the new size worked out against the image's size as it is now, as a frame would show it. -/// A Constrain Ratio (`lock`) that is not true or false is refused, and the dialog stays open. +/// A Constrain Ratio (`lock`) that is not true or false is refused, and the dialog stays open. The +/// dialog also stays open with its fields when the command refuses them, as [`form::commit_preview`] +/// does. fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { if d.fields.get("lock").is_some_and(|v| !v.is_boolean() && !v.is_null()) { return Err("`lock` must be true or false".into()); @@ -394,7 +396,11 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { let mut d = d.clone(); read_image(image_size(app), &mut d); follow_ratio(&mut d); - run_and_close(app, COMMAND, params(&d)) + let r = app.run(COMMAND, params(&d)); + if r.is_ok() { + app.ui.dialog = None; + } + r } #[cfg(test)] @@ -744,6 +750,24 @@ mod tests { } } + /// When the command refuses the dialog's fields, OK leaves the dialog open with them, so they can + /// be corrected; OK then makes the mosaic and closes it. + #[test] + fn a_refused_field_keeps_the_dialog_open() { + let mut app = app_with_image(); + open(&mut app, &json!({"width": 80})).unwrap(); + crate::dialogs::set_field(app.ui.dialog.as_mut().unwrap(), "gray".into(), json!(1)); + let e = crate::dialogs::confirm(&mut app).unwrap_err(); + assert!(e.contains("gray"), "{e}"); + assert_eq!(mosaic(&app), None); + let d = app.ui.dialog.as_mut().expect("the dialog stays open"); + assert_eq!((d.f64("width", 0.0), d.fields.get("gray")), (80.0, Some(&json!(1)))); + crate::dialogs::set_field(d, "gray".into(), json!(true)); + crate::dialogs::confirm(&mut app).unwrap(); + assert!(app.ui.dialog.is_none()); + assert_eq!(mosaic(&app).map(|m| m.0), Some(80.0)); + } + /// True or false set after a Resize Using Percentages value the command refuses replaces it: the /// same mode as before keeps the sizes, and the other mode shows them the other way. Null is /// false, as the command reads it. OK then makes the mosaic. From 04c65a85af1e2722798331dfb5ba8244473b2039 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 08:30:51 -0800 Subject: [PATCH 056/158] Messages: app.toast shows a message over the window without stopping work `app.toast {message, level?, seconds?}` queues a short message that the desktop app shows at the window's bottom right. It closes after its time (4 seconds by default, 0.5 to 60) or when clicked. At most 5 show at once, the newest lowest; a message shows at most 6 lines with the whole text on hover, and a stack taller than the window scrolls. `level` (info, success, warning, error) sets the color of its edge. Scripts raise one with `vc.run`, MCP clients and plug-ins through the command, and an action records it as a step. The app's own code calls `Session::toast`. The command edits no document and adds no undo step; invalid values are errors. Part of #7523: the tick sound is not included. Docs: docs/mcp.md, the Automation evidence in docs/target-app-parity.md. --- crates/engine/src/cmd.rs | 2 + crates/engine/src/cmd/plugin_call/reviewed.rs | 1 + crates/engine/src/cmd/toast.rs | 248 ++++++++++++++ crates/engine/src/lib.rs | 2 + crates/engine/src/session/documents.rs | 1 + crates/ui-egui/src/app.rs | 2 + crates/ui-egui/src/lib.rs | 3 + crates/ui-egui/src/toasts.rs | 308 ++++++++++++++++++ docs/mcp.md | 17 + docs/target-app-parity.md | 1 + 10 files changed, 585 insertions(+) create mode 100644 crates/engine/src/cmd/toast.rs create mode 100644 crates/ui-egui/src/toasts.rs diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index c4a86dd3a5..692408f112 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -104,6 +104,7 @@ pub use textedit::effective_kerning; pub mod textstyles; pub(crate) mod textwrap; pub(crate) mod threads; +pub mod toast; pub(crate) mod typecmd; mod typemenu; mod variablecmds; @@ -333,6 +334,7 @@ pub fn command_specs() -> &'static [CommandSpec] { v.extend(compositefonts::specs()); v.extend(fontfiles::specs()); v.extend(help::specs()); + v.extend(toast::specs()); v.extend(threads::specs()); v.extend(textwrap::specs()); v.extend(graph::specs()); diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index 6a0caf4cd6..01e3e1a4e6 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -84,6 +84,7 @@ pub(super) const ALLOWED: &[&str] = &[ "addon.shapes.star", "addon.type.releasePath", "addon.type.textTweaker", + "app.toast", "appearance.addEffect", "appearance.addFill", "appearance.addStroke", diff --git a/crates/engine/src/cmd/toast.rs b/crates/engine/src/cmd/toast.rs new file mode 100644 index 0000000000..c692ad702d --- /dev/null +++ b/crates/engine/src/cmd/toast.rs @@ -0,0 +1,248 @@ +//! `app.toast`: a short message shown over the window that does not stop work and goes away by +//! itself (a toast). Scripts (`vc.run`), actions (a recorded step), MCP clients and the app's own +//! code ([`Session::toast`]) raise one. The engine queues the messages and the desktop app takes +//! them each frame ([`Session::take_toasts`]) and shows them. + +use std::collections::VecDeque; + +use serde_json::{Value, json}; + +use super::{CommandSpec, Result, always, bad, cmd}; +use crate::Session; + +const ID: &str = "app.toast"; + +/// The most characters a message has. +pub const MAX_CHARS: usize = 500; + +/// How long a message shows when `seconds` is omitted, and the shortest and longest time it may +/// show. +pub const DEFAULT_SECONDS: f64 = 4.0; +pub const MIN_SECONDS: f64 = 0.5; +pub const MAX_SECONDS: f64 = 60.0; + +/// The most messages waiting for the app to take them: past it the oldest one goes. A session +/// without a window (MCP, the command line) never takes them. +pub const MAX_QUEUED: usize = 32; + +/// What kind of news a message is, which sets its color. +#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] +pub enum Level { + #[default] + Info, + Success, + Warning, + Error, +} + +impl Level { + pub const ALL: [Level; 4] = [Level::Info, Level::Success, Level::Warning, Level::Error]; + + /// Its `level` value. + pub fn param(self) -> &'static str { + match self { + Level::Info => "info", + Level::Success => "success", + Level::Warning => "warning", + Level::Error => "error", + } + } + + /// The level whose `level` value is `param`. + pub fn from_param(param: &str) -> Option { + Level::ALL.into_iter().find(|l| l.param() == param) + } +} + +/// A message to show. +#[derive(Clone, Debug, PartialEq)] +pub struct Toast { + pub message: String, + pub level: Level, + /// How long it shows, in seconds. + pub seconds: f64, +} + +impl Toast { + /// A message of `level` shown for [`DEFAULT_SECONDS`]. + pub fn new(message: impl Into, level: Level) -> Toast { + Toast { message: message.into(), level, seconds: DEFAULT_SECONDS } + } +} + +/// The messages waiting for the app to show them. +#[derive(Clone, Debug, Default)] +pub struct Queue(VecDeque); + +impl Session { + /// Queue `toast` for the app to show. With [`MAX_QUEUED`] waiting, the oldest one goes. + pub fn toast(&mut self, toast: Toast) { + while self.toasts.0.len() >= MAX_QUEUED { + self.toasts.0.pop_front(); + } + self.toasts.0.push_back(toast); + } + + /// Take the messages queued since the last call, oldest first. + pub fn take_toasts(&mut self) -> Vec { + self.toasts.0.drain(..).collect() + } +} + +pub fn specs() -> Vec { + vec![cmd!( + "app.toast", + "Show Message", + [], + None, + "{message: string (1 to 500 characters, not only spaces), level?: \"info\" | \"success\" | \"warning\" | \"error\" (default \"info\"), seconds?: number 0.5 to 60 (default 4)} show `message` over the window without stopping work: it goes away after `seconds` or when clicked; messages stack at the window's bottom right, the newest lowest, at most 5 at once; edits no document; an action records it as a step → {message, level, seconds}", + always, + run + )] +} + +fn run(s: &mut Session, p: &Value) -> Result { + let toast = parse(p)?; + let r = json!({"message": &toast.message, "level": toast.level.param(), "seconds": toast.seconds}); + s.toast(toast); + Ok(r) +} + +/// The message `p` asks for; an invalid value of any key is an error. +fn parse(p: &Value) -> Result { + let message = match p.get("message") { + Some(Value::String(m)) => m, + Some(_) => return Err(bad(ID, "`message` must be a string")), + None => return Err(bad(ID, "`message` is required")), + }; + if message.trim().is_empty() { + return Err(bad(ID, "`message` must have a character other than a space")); + } + let chars = message.chars().count(); + if chars > MAX_CHARS { + return Err(bad(ID, format!("`message` has {chars} characters; at most {MAX_CHARS} are allowed"))); + } + let level = match p.get("level") { + None => Level::default(), + Some(v) => v.as_str().and_then(Level::from_param).ok_or_else(|| { + let all: Vec<&str> = Level::ALL.iter().map(|l| l.param()).collect(); + bad(ID, format!("`level` must be one of {}", all.join(", "))) + })?, + }; + let seconds = match p.get("seconds") { + None => DEFAULT_SECONDS, + Some(v) => v + .as_f64() + .filter(|s| (MIN_SECONDS..=MAX_SECONDS).contains(s)) + .ok_or_else(|| bad(ID, format!("`seconds` must be a number from {MIN_SECONDS} to {MAX_SECONDS}")))?, + }; + Ok(Toast { message: message.clone(), level, seconds }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_message_is_queued_with_its_defaults() { + let mut s = Session::new(); + let r = s.execute(ID, &json!({"message": "Saved 3 files"})).unwrap(); + assert_eq!(r, json!({"message": "Saved 3 files", "level": "info", "seconds": 4.0})); + assert_eq!(s.take_toasts(), vec![Toast::new("Saved 3 files", Level::Info)]); + // Taken once. + assert_eq!(s.take_toasts(), vec![]); + } + + #[test] + fn level_and_seconds_are_kept() { + let mut s = Session::new(); + for level in Level::ALL { + s.execute(ID, &json!({"message": "m", "level": level.param(), "seconds": 0.5})).unwrap(); + } + s.execute(ID, &json!({"message": "long", "seconds": 60})).unwrap(); + let got: Vec<(Level, f64)> = s.take_toasts().iter().map(|t| (t.level, t.seconds)).collect(); + assert_eq!(got, vec![(Level::Info, 0.5), (Level::Success, 0.5), (Level::Warning, 0.5), (Level::Error, 0.5), (Level::Info, 60.0)]); + } + + #[test] + fn invalid_values_are_errors_and_queue_nothing() { + let mut s = Session::new(); + let long = "x".repeat(MAX_CHARS + 1); + for p in [ + json!({}), + json!({"message": 3}), + json!({"message": ""}), + json!({"message": " \n\t"}), + json!({"message": long}), + json!({"message": "m", "level": "loud"}), + json!({"message": "m", "level": 1}), + json!({"message": "m", "seconds": 0.4}), + json!({"message": "m", "seconds": 61}), + json!({"message": "m", "seconds": "4"}), + json!({"message": "m", "seconds": null}), + ] { + let e = s.execute(ID, &p).unwrap_err().to_string(); + assert!(e.contains(ID), "{p}: {e}"); + } + assert_eq!(s.take_toasts(), vec![]); + // The longest message is allowed, counted in characters, not bytes. + let most = "é".repeat(MAX_CHARS); + s.execute(ID, &json!({"message": most})).unwrap(); + assert_eq!(s.take_toasts().len(), 1); + } + + #[test] + fn the_oldest_waiting_message_goes_past_the_limit() { + let mut s = Session::new(); + for i in 0..MAX_QUEUED + 2 { + s.toast(Toast::new(format!("{i}"), Level::Info)); + } + let left: Vec = s.take_toasts().into_iter().map(|t| t.message).collect(); + assert_eq!(left.len(), MAX_QUEUED); + assert_eq!(left.first().map(String::as_str), Some("2")); + assert_eq!(left.last().map(String::as_str), Some("33")); + } + + #[test] + fn a_message_is_journaled_without_an_undo_step_or_a_document() { + let mut s = Session::new(); + // No document open. + s.execute(ID, &json!({"message": "no document"})).unwrap(); + assert_eq!(s.journal.last().unwrap(), &(ID.to_string(), json!({"message": "no document"}))); + s.execute("file.new", &json!({})).unwrap(); + let undo = s.active().unwrap().history.undo.len(); + let revision = s.active().unwrap().revision; + s.execute(ID, &json!({"message": "m", "level": "success"})).unwrap(); + assert_eq!(s.journal.last().unwrap(), &(ID.to_string(), json!({"message": "m", "level": "success"}))); + assert_eq!(s.active().unwrap().history.undo.len(), undo); + assert_eq!(s.active().unwrap().revision, revision); + } + + #[test] + fn a_script_raises_a_message_with_vc_run() { + let mut s = Session::new(); + let r = s + .execute( + "script.run", + &json!({"source": "vc.run('app.toast', {message: 'Done: ' + (1 + 1), level: 'success'});", "name": "t.js", "answers": []}), + ) + .unwrap(); + assert!(r.get("error").is_none_or(Value::is_null), "{r}"); + assert_eq!(s.take_toasts(), vec![Toast::new("Done: 2", Level::Success)]); + } + + #[test] + fn a_command_batch_raises_its_messages_in_order() { + let mut s = Session::new(); + s.execute("file.new", &json!({})).unwrap(); + s.execute( + "command.batch", + &json!({"commands": [ + {"command": "app.toast", "params": {"message": "one"}}, + {"command": "app.toast", "params": {"message": "two", "level": "warning"}}, + ]}), + ) + .unwrap(); + assert_eq!(s.take_toasts(), vec![Toast::new("one", Level::Info), Toast::new("two", Level::Warning)]); + } +} diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 4f7532108d..424fc9f6e9 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -356,6 +356,8 @@ pub struct Session { /// Set while [`Session::tool_typed_text`] passes keyboard input to the active tool /// ([`vectorcraft_tools::ToolContext::typed_from_keyboard`]). keyboard_text: bool, + /// The messages `app.toast` and [`Session::toast`] queued for the app to show; not saved. + pub(crate) toasts: cmd::toast::Queue, } impl Default for Session { diff --git a/crates/engine/src/session/documents.rs b/crates/engine/src/session/documents.rs index 4415566d13..cda550dfd1 100644 --- a/crates/engine/src/session/documents.rs +++ b/crates/engine/src/session/documents.rs @@ -148,6 +148,7 @@ impl Session { global_edit_options: Default::default(), select_similar: crate::cmd::SIMILAR[0].0, keyboard_text: false, + toasts: Default::default(), script_key: None, script_engines: crate::script::EnginesKey::new(), script_stop: vectorcraft_js::Interrupt::new(), diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index e3d2a13d64..b0d5f80020 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -161,6 +161,7 @@ impl VectorcraftApp { plugin_runs: Default::default(), placing: Default::default(), trace_runs: Default::default(), + toasts: Default::default(), recovery: Default::default(), host_modifiers: Default::default(), forwarded: Vec::new(), @@ -629,6 +630,7 @@ impl VectorcraftApp { trace_runs::show(self, &ctx); opening::show(self, &ctx); palette::show(self, &ctx); + crate::toasts::show(self, &ctx); // After every panel had its chance to draw in this pass. crate::panels::three_d::end_stale_drag(self, &ctx); if self.custom_titlebar { diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 0b8ee67183..9f3bf69197 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -79,6 +79,7 @@ pub mod sysclip; pub mod theme; pub mod thumb_worker; pub mod titlebar; +pub mod toasts; pub mod toolbar; mod tools_float; pub mod touch; @@ -291,6 +292,8 @@ pub struct VectorcraftApp { pub placing: placing::Placing, /// Image Traces running off the UI thread ([`trace_runs`]). pub trace_runs: trace_runs::TraceRuns, + /// The messages shown over the window ([`toasts`]). + pub toasts: toasts::Shown, /// Data Recovery's timer and startup question ([`recovery`]). pub recovery: recovery::Timer, /// Modifiers the keyboard holds (from the host's input), given back after synthetic input. diff --git a/crates/ui-egui/src/toasts.rs b/crates/ui-egui/src/toasts.rs new file mode 100644 index 0000000000..0d47c4e3b4 --- /dev/null +++ b/crates/ui-egui/src/toasts.rs @@ -0,0 +1,308 @@ +//! Messages that `app.toast` and the app's own code ([`vectorcraft_engine::Session::toast`]) queue, +//! shown over the window without taking the keyboard or stopping work: a stack at the window's +//! bottom right, the newest lowest. Each one goes after its time or when clicked; past +//! [`MAX_SHOWN`] the oldest goes first. A message shows at most [`MAX_ROWS`] lines, and the whole +//! text on hover; a stack taller than the window scrolls. + +use std::time::Duration; + +use vectorcraft_engine::cmd::toast::{Level, Toast}; + +use crate::VectorcraftApp; +use crate::theme::Tokens; + +/// The most messages shown at once. +pub const MAX_SHOWN: usize = 5; + +/// The widest a message is, in points; longer text wraps. +const WIDTH: f32 = 320.0; + +/// The most lines a message shows; the rest shows on hover. +const MAX_ROWS: usize = 6; + +/// The gap between the stack and the window's right and bottom edges, in points. +const MARGIN: f32 = 16.0; + +/// A message shown. +#[derive(Clone, Debug)] +pub(crate) struct Entry { + pub(crate) toast: Toast, + /// When it goes, in [`crate::clock::now_secs`] seconds. + until: f64, + id: u64, + /// Where the last pass drew it. + pub(crate) rect: Option, +} + +/// The messages shown, oldest first. +#[derive(Debug, Default)] +pub struct Shown { + pub(crate) list: Vec, + next_id: u64, +} + +impl Shown { + /// Show `new` from `now` on, dropping the oldest past [`MAX_SHOWN`]. + fn add(&mut self, new: Vec, now: f64) { + for toast in new { + let until = now + toast.seconds; + self.list.push(Entry { toast, until, id: self.next_id, rect: None }); + self.next_id = self.next_id.wrapping_add(1); + } + let over = self.list.len().saturating_sub(MAX_SHOWN); + self.list.drain(..over); + } + + /// Drop the messages whose time is up at `now`; the seconds until the next one's is. + fn expire(&mut self, now: f64) -> Option { + self.list.retain(|e| e.until > now); + self.list.iter().map(|e| e.until - now).reduce(f64::min) + } +} + +/// The color of a message's edge. +fn color(t: &Tokens, level: Level) -> egui::Color32 { + match level { + Level::Info => t.text_dim, + Level::Success => t.axis_y, + Level::Warning => t.warning, + Level::Error => t.error, + } +} + +/// Take the messages queued since the last pass and draw the ones shown. +pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { + show_at(app, ctx, crate::clock::now_secs()); +} + +/// [`show`] at `now`, in [`crate::clock::now_secs`] seconds. +pub(crate) fn show_at(app: &mut VectorcraftApp, ctx: &egui::Context, now: f64) { + // Messages whose time is up go before new ones count toward the limit. + app.toasts.expire(now); + let new = app.session.take_toasts(); + app.toasts.add(new, now); + let Some(left) = app.toasts.expire(now) else { + return; + }; + // Finite and positive: every message's time is 0.5 to 60 seconds. + ctx.request_repaint_after(Duration::from_secs_f64(left.clamp(0.0, 60.0))); + let t = Tokens::get(ctx); + let corner = egui::vec2(-MARGIN, -MARGIN); + let area = egui::Area::new(egui::Id::unique("toasts")).order(egui::Order::Foreground).anchor(egui::Align2::RIGHT_BOTTOM, corner); + // A stack taller than the window scrolls, kept at its newest message. + let height = (ctx.content_rect().height() - 2.0 * MARGIN).max(0.0); + let dismissed = area + .show(ctx, |ui| { + let scroll = egui::ScrollArea::vertical().max_height(height).stick_to_bottom(true); + scroll.show(ui, |ui| stack(ui, &mut app.toasts.list, &t)).inner + }) + .inner; + if let Some(id) = dismissed { + app.toasts.list.retain(|e| e.id != id); + ctx.request_repaint(); + } +} + +/// Draw `list`, oldest first; the id of the message clicked. +fn stack(ui: &mut egui::Ui, list: &mut [Entry], t: &Tokens) -> Option { + ui.set_max_width(WIDTH); + let mut clicked = None; + for e in list { + // Each message's widgets keep its id when the messages before it go, so a press and a + // release land on the same message. + let r = ui.push_id(e.id, |ui| message(ui, e, t)).inner; + if r.clicked() { + clicked = Some(e.id); + } + e.rect = Some(r.rect); + ui.add_space(6.0); + } + clicked +} + +/// Draw one message → its response to clicks. +fn message(ui: &mut egui::Ui, e: &Entry, t: &Tokens) -> egui::Response { + let frame = egui::Frame::new() + .fill(t.panel) + .stroke(egui::Stroke::new(1.0, color(t, e.toast.level))) + .corner_radius(t.radius) + .inner_margin(egui::Margin::symmetric(10, 8)) + .show(ui, |ui| { + ui.set_width(WIDTH - 20.0); + let format = egui::TextFormat::simple(egui::TextStyle::Body.resolve(ui.style()), t.text); + let mut job = egui::text::LayoutJob::single_section(e.toast.message.clone(), format); + job.wrap.max_width = WIDTH - 20.0; + job.wrap.max_rows = MAX_ROWS; + let galley = ui.painter().layout_job(job); + let elided = galley.elided; + ui.add(egui::Label::new(galley).selectable(false)); + elided + }); + let r = frame.response.interact(egui::Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand); + // A message cut short shows in full on hover. + if frame.inner { r.on_hover_text(&e.toast.message) } else { r } +} + +#[cfg(test)] +mod tests { + use serde_json::json; + use vectorcraft_engine::Session; + + use super::*; + + fn app() -> (VectorcraftApp, egui::Context) { + crate::i18n::set_current(crate::i18n::Lang::EN); + let app = VectorcraftApp::new(Session::new(), Default::default()); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + crate::theme::apply(&ctx, crate::theme::Brightness::Dark); + (app, ctx) + } + + /// One pass at `now` with `events`; the text the pass drew. + fn pass(app: &mut VectorcraftApp, ctx: &egui::Context, now: f64, events: Vec) -> Vec { + pass_in(app, ctx, now, events, 700.0) + } + + /// [`pass`] in a window `height` points tall. + fn pass_in(app: &mut VectorcraftApp, ctx: &egui::Context, now: f64, events: Vec, height: f32) -> Vec { + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1000.0, height)); + let input = egui::RawInput { screen_rect: Some(screen), events, ..Default::default() }; + let mut output = ctx.run_ui(input, |ui| show_at(app, ui.ctx(), now)); + output.textures_delta.clear(); + let mut texts = Vec::new(); + for clipped in &output.shapes { + if let egui::epaint::Shape::Text(text) = &clipped.shape { + texts.push(text.galley.text().to_string()); + } + } + texts + } + + fn messages(app: &VectorcraftApp) -> Vec<&str> { + app.toasts.list.iter().map(|e| e.toast.message.as_str()).collect() + } + + #[test] + fn a_message_shows_until_its_time_is_up() { + let (mut app, ctx) = app(); + app.run("app.toast", json!({"message": "Exported 4 files", "seconds": 2})).unwrap(); + // A new area measures itself in its first pass and draws from the next. + pass(&mut app, &ctx, 10.0, vec![]); + let texts = pass(&mut app, &ctx, 10.0, vec![]); + assert!(texts.iter().any(|t| t == "Exported 4 files"), "{texts:?}"); + let rect = app.toasts.list[0].rect.unwrap(); + assert!(rect.right() <= 1000.0 - MARGIN + 0.5 && rect.bottom() <= 700.0 - MARGIN + 0.5, "{rect:?}"); + assert!(pass(&mut app, &ctx, 11.9, vec![]).iter().any(|t| t == "Exported 4 files")); + assert!(!pass(&mut app, &ctx, 12.0, vec![]).iter().any(|t| t == "Exported 4 files")); + assert!(app.toasts.list.is_empty()); + } + + #[test] + fn newer_messages_show_below_older_ones_and_the_oldest_goes_past_the_limit() { + let (mut app, ctx) = app(); + for i in 0..MAX_SHOWN + 1 { + app.session.toast(Toast::new(format!("m{i}"), Level::Info)); + } + pass(&mut app, &ctx, 0.0, vec![]); + assert_eq!(messages(&app), vec!["m1", "m2", "m3", "m4", "m5"]); + let tops: Vec = app.toasts.list.iter().map(|e| e.rect.unwrap().top()).collect(); + assert!(tops.windows(2).all(|w| w[0] < w[1]), "{tops:?}"); + } + + #[test] + fn messages_whose_time_is_up_do_not_count_toward_the_limit() { + let (mut app, ctx) = app(); + app.session.toast(Toast { seconds: 60.0, ..Toast::new("long", Level::Info) }); + for i in 0..MAX_SHOWN - 1 { + app.session.toast(Toast { seconds: 0.5, ..Toast::new(format!("short{i}"), Level::Info) }); + } + pass(&mut app, &ctx, 0.0, vec![]); + app.session.toast(Toast::new("new", Level::Info)); + pass(&mut app, &ctx, 0.5, vec![]); + assert_eq!(messages(&app), vec!["long", "new"]); + } + + #[test] + fn a_click_dismisses_only_that_message() { + let (mut app, ctx) = app(); + app.session.toast(Toast::new("first", Level::Warning)); + app.session.toast(Toast::new("second", Level::Error)); + pass(&mut app, &ctx, 0.0, vec![]); + pass(&mut app, &ctx, 0.0, vec![]); + let at = app.toasts.list[0].rect.unwrap().center(); + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + pass(&mut app, &ctx, 0.1, vec![egui::Event::PointerMoved(at)]); + pass(&mut app, &ctx, 0.2, vec![press(true)]); + pass(&mut app, &ctx, 0.3, vec![press(false)]); + assert_eq!(messages(&app), vec!["second"]); + } + + #[test] + fn a_message_that_goes_between_press_and_release_closes_no_other() { + let (mut app, ctx) = app(); + for (message, seconds) in [("top", 60.0), ("pressed", 0.5), ("bottom", 60.0)] { + app.session.toast(Toast { seconds, ..Toast::new(message, Level::Info) }); + } + pass(&mut app, &ctx, 0.0, vec![]); + pass(&mut app, &ctx, 0.0, vec![]); + let at = app.toasts.list[1].rect.unwrap().center(); + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + pass(&mut app, &ctx, 0.1, vec![egui::Event::PointerMoved(at)]); + pass(&mut app, &ctx, 0.2, vec![press(true)]); + // "pressed" goes, and "top" moves down under the pointer. + pass(&mut app, &ctx, 0.6, vec![]); + pass(&mut app, &ctx, 0.7, vec![]); + pass(&mut app, &ctx, 0.8, vec![press(false)]); + assert_eq!(messages(&app), vec!["top", "bottom"]); + } + + #[test] + fn an_action_records_a_message_and_shows_it_again_when_played() { + use crate::panels::actions::{START_RECORDING, STOP_RECORDING, play}; + let (mut app, _) = app(); + app.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + app.run(START_RECORDING, json!({})).unwrap(); + app.run("app.toast", json!({"message": "Step done", "level": "success"})).unwrap(); + app.run(STOP_RECORDING, json!({})).unwrap(); + // The recording is the set's last action. + let last = app.ui.action_sets[0].actions.len() - 1; + let steps = &app.ui.action_sets[0].actions[last].steps; + assert_eq!(steps, &vec![("app.toast".to_string(), json!({"message": "Step done", "level": "success"}))]); + app.session.take_toasts(); + let undo = app.session.active().unwrap().history.undo.len(); + play(&mut app, 0, last).unwrap(); + assert_eq!(app.session.take_toasts(), vec![Toast::new("Step done", Level::Success)]); + assert_eq!(app.session.active().unwrap().history.undo.len(), undo, "a message adds no undo step"); + } + + #[test] + fn a_long_message_shows_its_first_lines_and_the_stack_stays_in_the_window() { + let (mut app, ctx) = app(); + app.run("app.toast", json!({"message": "line"})).unwrap(); + app.run("app.toast", json!({"message": "line\n".repeat(100)})).unwrap(); + pass(&mut app, &ctx, 0.0, vec![]); + pass(&mut app, &ctx, 0.0, vec![]); + let (short, long) = (app.toasts.list[0].rect.unwrap(), app.toasts.list[1].rect.unwrap()); + // 100 lines would make it about 100 times as tall as a message of one line. + assert!(long.height() > short.height() && long.height() < short.height() * MAX_ROWS as f32, "{short:?} {long:?}"); + app.toasts.list.remove(0); + // Five such messages in a short window: the newest shows whole at the bottom, and none + // reaches past the window's edges. + for _ in 0..MAX_SHOWN - 1 { + app.run("app.toast", json!({"message": "line\n".repeat(100)})).unwrap(); + } + let height = 300.0; + pass_in(&mut app, &ctx, 0.0, vec![], height); + pass_in(&mut app, &ctx, 0.0, vec![], height); + let newest = app.toasts.list.last().unwrap().rect.unwrap(); + assert!(newest.top() >= MARGIN - 0.5 && newest.bottom() <= height - MARGIN + 0.5, "{newest:?}"); + assert_eq!(app.toasts.list.len(), MAX_SHOWN); + } + + #[test] + fn no_message_draws_nothing() { + let (mut app, ctx) = app(); + assert!(pass(&mut app, &ctx, 0.0, vec![]).is_empty()); + } +} diff --git a/docs/mcp.md b/docs/mcp.md index a27f99feba..12f8376324 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3157,6 +3157,23 @@ enabled while the document has a saved view. In the desktop app the views are li checked when it opens: past 25, blank or repeated names, and views without a finite centre and a positive zoom are dropped. +## Messages over the window + +`app.toast {message, level?, seconds?}` shows a short message over the desktop app's window without stopping work +→ `{message, level, seconds}`. `message` is 1 to 500 characters and not only spaces. `level` is `info` (the +default), `success`, `warning` or `error`, and sets the color of the message's edge. `seconds` is how long it shows, +0.5 to 60 (4 by default); a click on it closes it sooner. Messages stack at the window's bottom right, the newest +lowest, at most 5 at once: a sixth closes the oldest. A message shows at most 6 lines, with the whole text on hover, +and a stack taller than the window scrolls. A missing `message` or a value outside these ranges is an error, +and nothing shows. The command edits no document and adds no undo step. Scripts raise one with `vc.run('app.toast', +{...})`, a plug-in whose manifest lists `app.toast` calls it like its other commands, and an action recording records it as a step that shows the message again when the action plays. A session +without a window (MCP, `vectorcraft-cli`) keeps the last 32 messages it was given and shows none. These limits are +VectorCraft's own values. + +```json +{"name":"run_command","arguments":{"command":"app.toast","params":{"message":"Exported 4 artboards","level":"success"}}} +``` + ## Navigator panel options The Navigator panel menu's Panel Options… opens the `navigatorPanelOptions` dialog (fields `color`, `solidDashes`), diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index db61a96f73..5b5f596a9f 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -904,6 +904,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Synthetic input validates complete gestures before queue mutation: at most 256 drag steps, 16 clicks and 1,024 pending events; up to 64 control requests per frame, with later requests retained for the next frame (#1709). - The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s. - Scripts: File › Scripts › Other Script… and `script.run` run a JavaScript file against the open documents as one transaction with one undo step for each changed document. A failed or stopped run puts every document back. `crates/engine/src/tests/script_run.rs`. + - Messages over the window: `app.toast {message, level?, seconds?}` shows a message at the window's bottom right that does not stop work and closes after its time (4 seconds by default) or when clicked; at most 5 show at once, the newest lowest. Scripts raise one through `vc.run`, MCP clients through the command, and an action records it as a step. The limits are VectorCraft's own values. Tests: `cmd::toast::tests` in `vectorcraft-engine`, `toasts::tests` in `vectorcraft-ui-egui`. - Scripts: Window › Script Console shows each run's `$.write` and `$.writeln` output, `vc.log` entries, uncaught error with the script's name, line and column, and a report of its time, host calls and slowest commands, keeping at most 2,048 lines and counting the lines it dropped. `script.run`'s report carries the same data, and `script.console`, `script.console.clear` and `ui.copyScriptConsole` read, clear and copy it. `crates/engine/src/tests/script_console.rs`. - Scripts: the `$` object has the other members the Dollar object page lists (https://extendscript.docsforadobe.dev/extendscript-tools-features/dollar-object/), from `$.about()` to `$.version`, and scripts have the global `localize(object, ...values)` (https://extendscript.docsforadobe.dev/extendscript-tools-features/localizing-extendscript-strings/), `toSource(value)` and `Object.prototype.toSource()`. Each run starts with the interface's locale, and what a script changes in `$` lasts only for that run. `crates/engine/src/tests/script_dollar.rs`, `crates/js/src/extension_tests.rs`. - Scripts: `toSource` throws a `TypeError` for a property that is not writable or not configurable, a sealed, frozen or non-extensible object or array, and an array with a read-only `length` (VectorCraft's own rule). `crates/js/src/extension_tests.rs`. From a2c91044e0651dacfd413c721f3eb0e5dd4f2d6c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 09:06:36 -0800 Subject: [PATCH 057/158] =?UTF-8?q?Layers:=20dragging=20a=20path=20into=20?= =?UTF-8?q?a=20Live=20Paint=20group=20adds=20it=20to=20the=20group=20as=20?= =?UTF-8?q?Live=20Paint=20=E2=80=BA=20Merge=20does?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A path, compound path or group of them dropped inside a Live Paint group in the Layers panel, or above or below one of its rows, now joins the group's paths as livePaint.merge adds them, in one "Merge Live Paint" undo step that selects the group. An Alt-drag adds copies, and node.move into the group does the same. With type, an image or another object among the rows, the drop is refused with Merge's message and nothing moves. A row moved into or out of the group's hidden sources makes the group's faces and edges again, keeping the paint of those that stay; with no path left the group has no faces until a path joins it again. Before, a dropped path became a plain child that cut no faces, and a source dragged out left stale faces behind. --- crates/engine/src/cmd/buildcmds.rs | 2 +- crates/engine/src/cmd/buildcmds/live_paint.rs | 130 ++++++++++++++++ crates/engine/src/cmd/layer.rs | 21 ++- crates/engine/src/tests/build.rs | 143 ++++++++++++++++++ docs/mcp.md | 8 +- docs/target-app-parity.md | 1 + 6 files changed, 299 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/buildcmds.rs b/crates/engine/src/cmd/buildcmds.rs index 65a07ceb50..f72c7d4ebb 100644 --- a/crates/engine/src/cmd/buildcmds.rs +++ b/crates/engine/src/cmd/buildcmds.rs @@ -38,7 +38,7 @@ mod shape_builder; mod trace; pub use live_paint::live_paint_gaps; -pub(crate) use live_paint::{isolated_live_paint, merge_drawn_in_isolation}; +pub(crate) use live_paint::{LivePaintMove, isolated_live_paint, merge_drawn_in_isolation}; use live_paint::{lp_expand, lp_fill, lp_gap_options, lp_info, lp_make, lp_merge, lp_release, lp_stroke_edge}; use shape_builder::{sb_merge, sb_regions}; pub(crate) use trace::TracePresetChanges; diff --git a/crates/engine/src/cmd/buildcmds/live_paint.rs b/crates/engine/src/cmd/buildcmds/live_paint.rs index 301ff55a4b..5067f3b031 100644 --- a/crates/engine/src/cmd/buildcmds/live_paint.rs +++ b/crates/engine/src/cmd/buildcmds/live_paint.rs @@ -259,6 +259,136 @@ pub(crate) fn merge_drawn_in_isolation(s: &mut Session, g: NodeId) -> Result) -> Spot { + let Some(p) = parent else { return Spot::Outside }; + for x in d.ancestry(p).unwrap_or_default().into_iter().rev() { + let n = d.node(x); + if n.is_some_and(is_live_paint) { + return if x == p { Spot::In(x) } else { Spot::Outside }; + } + if let Some(g) = d.parent_of(x) + && d.node(g).filter(|n| is_live_paint(n)).and_then(b::sources).is_some_and(|s| s.id == x) + { + return Spot::Source(g); + } + } + Spot::Outside +} + +/// What moving rows in the Layers panel (`layer.move`, `node.move`) does to Live Paint groups. +/// Rows that go into a Live Paint group from elsewhere are added to it as `livePaint.merge` adds +/// paths. Rows that go into or leave a group's paths (its sources group) change those paths, and +/// the group's faces and edges are made again from them, keeping the paint of the faces and edges +/// that stay. Rows moved within one group's paths, or among a group's own children, change no +/// faces. +pub(crate) struct LivePaintMove { + /// The Live Paint group the rows go into, and for each row whether it joins the group's paths. + join: Option<(NodeId, Vec)>, + /// The Live Paint groups whose paths change. + rebuild: Vec, +} + +impl LivePaintMove { + /// Plan moving `rows` (with `copy`, copies of them) into `parent`, before anything changes. + /// Refuses rows Live Paint can't take ([`b::live_paint_takes`]) that would go among a group's + /// paths, with the message Make and Merge give. + pub(crate) fn plan(d: &Document, rows: &[NodeId], parent: Option, copy: bool) -> Result { + let to = spot_in(d, parent); + let from: Vec = rows.iter().map(|r| if copy { Spot::Outside } else { spot_in(d, d.parent_of(*r)) }).collect(); + let mut rebuild = vec![]; + for f in &from { + if let Spot::Source(g) = *f + && *f != to + && !rebuild.contains(&g) + { + rebuild.push(g); + } + } + if let Spot::Source(g) = to + && from.iter().any(|f| *f != to) + && !rebuild.contains(&g) + { + rebuild.push(g); + } + let entering: Vec = rows.iter().zip(&from).filter(|(_, f)| **f != to).map(|(r, _)| *r).collect(); + let join = match to { + Spot::In(g) if !entering.is_empty() => Some((g, from.iter().map(|f| *f != to).collect())), + _ => None, + }; + if to != Spot::Outside { + check_live_paint_takes(d, &entering)?; + } + Ok(Self { join, rebuild }) + } + + /// Whether rows join a Live Paint group, which makes the move a "Merge Live Paint" step. + pub(crate) fn joins(&self) -> bool { + self.join.is_some() + } + + /// After the rows were moved, now `moved` (in the order [`LivePaintMove::plan`] took them), + /// make the faces and edges of the groups whose paths changed again, and add the rows that + /// joined a group to it. → `moved` with the joined rows replaced by their group, once, and + /// without the faces and edges that were made again. + pub(crate) fn finish(self, d: &mut Document, sel: &mut Selection, moved: &[NodeId]) -> Result> { + if self.join.is_none() && self.rebuild.is_empty() { + return Ok(moved.to_vec()); + } + for g in &self.rebuild { + rebuild_paths(d, *g)?; + } + let Some((g, mask)) = self.join else { return Ok(moved.iter().copied().filter(|r| d.node(*r).is_some()).collect()) }; + let joined = moved.iter().zip(&mask).filter(|(_, j)| **j).map(|(r, _)| *r); + let roots: Vec = std::iter::once(g).chain(joined).collect(); + merge_live(d, sel, &roots)?; + // `moved` holds each row once, so only the group can come twice. Faces and edges of the + // group moved along with the joining rows were made again, so they are left out. + let mut out = vec![]; + let mut listed = false; + for (r, j) in moved.iter().zip(&mask) { + if *j { + if !listed { + out.push(g); + listed = true; + } + } else if d.node(*r).is_some() { + out.push(*r); + } + } + Ok(out) + } +} + +/// Make Live Paint group `g`'s faces and edges again from the paths its sources group holds now, +/// with its Gap Options, carrying over the paint of the faces and edges that stay. With no path +/// left, the group keeps its sources group and its other children, and has no faces or edges. +fn rebuild_paths(d: &mut Document, g: NodeId) -> Result<()> { + let old = d.node(g).cloned().ok_or(EngineError::NoNode(g))?; + let sources = source_nodes(&old); + let mut n = old.clone(); + if source_shapes(&sources).0.is_empty() { + let src = b::sources(&old).cloned().ok_or(EngineError::NoNode(g))?; + set_parts(&mut n, vec![src], &[]); + } else { + let (children, _, _) = build_children(d, sources, old.gap_options().max_gap())?; + set_parts(&mut n, children, &[]); + repaint_from(&mut n, &old); + } + let mut changed = Beside::replacing(d, &[g]); + changed.put(d, g, vec![n])?; + changed.finish(d) +} + fn live_targets(s: &Session, p: &Value) -> Result> { let d = &s.doc()?.doc; let ids = root_ids(s, p)?; diff --git a/crates/engine/src/cmd/layer.rs b/crates/engine/src/cmd/layer.rs index 83f27cdd61..ace6793b77 100644 --- a/crates/engine/src/cmd/layer.rs +++ b/crates/engine/src/cmd/layer.rs @@ -13,6 +13,7 @@ use serde_json::{Value, json}; use vectorcraft_doc::{Artboard, ArtboardSide, Document, LAYER_COLORS, LayerColor, Node, NodeId, NodeKind, Scaling}; use vectorcraft_geom::{Affine, Rect}; +use super::buildcmds::LivePaintMove; use super::{ CommandSpec, Result, Session, bad, bool_or, check_numbers, check_switches, checked_id, checked_ids_param, checked_node, checked_nodes_param, cmd, color_value, f64_or, has_doc, has_selection, ids_param, index, object_param, ok, str_param, switch_or, @@ -110,7 +111,7 @@ pub fn specs() -> Vec { "Move Rows", [], None, - "{ids|id, target, place?: \"above\"|\"below\"|\"inside\" (default inside), copy?: bool} drag rows in the Layers panel: above or below the target row (beside it, in its layer or group), or inside a layer or group (on top of its contents). Layers go only in layers or at the top level, objects in layers and groups; an object placed beside a top-level layer goes inside it. A row never goes into itself; a locked layer or group takes nothing. `copy` (Alt-drag) moves copies. Every selected object left hidden or locked, such as one moved into a hidden layer or group, is deselected (the key object too). One undo step → {ids}", + "{ids|id, target, place?: \"above\"|\"below\"|\"inside\" (default inside), copy?: bool} drag rows in the Layers panel: above or below the target row (beside it, in its layer or group), or inside a layer or group (on top of its contents). Layers go only in layers or at the top level, objects in layers and groups; an object placed beside a top-level layer goes inside it. A row never goes into itself; a locked layer or group takes nothing. `copy` (Alt-drag) moves copies. A row that goes into a Live Paint group from elsewhere joins its paths as livePaint.merge adds them, and the group is selected (paths, compound paths, groups of them and Live Paint groups; anything else is refused and nothing moves); a row that goes into or leaves a Live Paint group's paths makes the group's faces and edges again, keeping the paint of those that stay. Every selected object left hidden or locked, such as one moved into a hidden layer or group, is deselected (the key object too). One undo step → {ids} (a row that joined a Live Paint group is listed as the group)", has_doc, move_rows ), @@ -119,7 +120,7 @@ pub fn specs() -> Vec { "Reorder", [], None, - "{id, parent?: id (null = top level), index} put a row at `index` (0 = bottom) of `parent` (layers only at the top level or in layers), deselecting every selected object left hidden or locked (the key object too)", + "{id, parent?: id (null = top level), index} put a row at `index` (0 = bottom) of `parent` (layers only at the top level or in layers), deselecting every selected object left hidden or locked (the key object too); a Live Paint group or its paths take a row as layer.move does", has_doc, move_node ), @@ -794,7 +795,15 @@ fn move_rows(s: &mut Session, p: &Value) -> Result { if parent.is_some_and(|p| locked_within(d, p)) { return Err(EngineError::Other("the layer or group is locked".into())); } - let label = if copy { "Duplicate Rows" } else { "Move Rows" }; + // Rows that go into a Live Paint group join its paths, as Live Paint › Merge adds them. + let live_paint = LivePaintMove::plan(d, &ids, parent, copy)?; + let label = if live_paint.joins() { + "Merge Live Paint" + } else if copy { + "Duplicate Rows" + } else { + "Move Rows" + }; let moved = s.edit(label, |d, sel| { let nodes = if copy { let mut nodes = vec![]; @@ -829,6 +838,7 @@ fn move_rows(s: &mut Session, p: &Value) -> Result { if copy { super::typecmd::refresh_bounds_of(d, &out); } + let out = live_paint.finish(d, sel, &out)?; sel.prune(d); sel.deselect_uneditable(d); Ok(out) @@ -848,8 +858,11 @@ fn move_node(s: &mut Session, p: &Value) -> Result { if !accepts(d, parent, n) { return Err(bad(C, "layers go only at the top level or in layers, objects in layers and groups")); } - s.edit("Reorder", |d, sel| { + let live_paint = LivePaintMove::plan(d, &[id], parent, false)?; + let label = if live_paint.joins() { "Merge Live Paint" } else { "Reorder" }; + s.edit(label, |d, sel| { d.move_node(id, parent, index)?; + live_paint.finish(d, sel, &[id])?; sel.deselect_uneditable(d); Ok(()) })?; diff --git a/crates/engine/src/tests/build.rs b/crates/engine/src/tests/build.rs index 553fb2fb21..ba6aaccb17 100644 --- a/crates/engine/src/tests/build.rs +++ b/crates/engine/src/tests/build.rs @@ -4978,6 +4978,149 @@ fn live_paint_isolation_adds_a_drawn_group_isolated_inside_it() { } } +/// A line from left of the [`live`] group to its right face, so it cuts the two faces left of it. +fn line_to_right_face(s: &mut Session, y: f64) -> NodeId { + let r = s.execute("path.create", &json!({"anchors": [{"x": -10, "y": y}, {"x": 105, "y": y}]})).unwrap(); + NodeId(r["id"].as_u64().unwrap()) +} + +fn undo_label(s: &Session) -> Option { + s.doc().unwrap().history.undo.last().map(|e| e.label.clone()) +} + +/// Paths dragged into a Live Paint group in the Layers panel join its paths as Live Paint › Merge +/// adds them: they go among its sources and cut the faces they cross, a painted face they do not +/// cross keeps its fill, and the drop is one "Merge Live Paint" undo step that selects the group. +#[test] +fn layers_drag_adds_paths_to_a_live_paint_group() { + use vectorcraft_tools::builder::{face_at, faces, sources}; + let green = Paint::solid(Color::from_hex("#00ff00").unwrap()); + let mut s = session(); + let g = live(&mut s); + s.execute("livePaint.fill", &json!({"group": g.0, "point": [125, 50], "color": "#00ff00"})).unwrap(); + let layer = s.doc().unwrap().doc.parent_of(g); + let (a, b) = (line_to_right_face(&mut s, 30.0), line_to_right_face(&mut s, 70.0)); + assert_eq!(s.doc().unwrap().doc.parent_of(a), layer); + let steps = s.doc().unwrap().history.undo.len(); + let r = s.execute("layer.move", &json!({"ids": [a.0, b.0], "target": g.0, "place": "inside"})).unwrap(); + assert_eq!(r["ids"], json!([g.0]), "the rows that joined are listed as the group"); + let d = s.doc().unwrap(); + assert_eq!(d.history.undo.len(), steps + 1, "both paths join in one undo step"); + assert_eq!(undo_label(&s).as_deref(), Some("Merge Live Paint")); + assert_eq!(s.doc().unwrap().selection.objects, vec![g]); + let n = node(&s, g); + let src = sources(&n).unwrap(); + assert_eq!(src.children().unwrap().len(), 4); + for id in [a, b] { + assert_eq!(s.doc().unwrap().doc.parent_of(id), Some(src.id), "{id} joined the sources"); + } + assert_eq!(faces(&n).len(), 7, "two lines cut each of the two faces they cross in three"); + assert_eq!(face_at(&n, Point::new(125.0, 50.0)).unwrap().appearance.fill_paint(), green, "the face the lines do not cross keeps its fill"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(faces(&node(&s, g)).len(), 3); + for id in [a, b] { + assert_eq!(s.doc().unwrap().doc.parent_of(id), layer, "Undo puts {id} back where it was"); + } + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(faces(&node(&s, g)).len(), 7); +} + +/// An Alt-drag into a Live Paint group adds a copy and leaves the path where it was; a drop above +/// one of the group's faces, and `node.move` into the group, add the path the same way. +#[test] +fn layers_drag_copy_and_drop_beside_a_part_add_to_a_live_paint_group() { + use vectorcraft_tools::builder::{faces, sources}; + let mut s = session(); + let g = live(&mut s); + let layer = s.doc().unwrap().doc.parent_of(g); + let a = line_to_right_face(&mut s, 30.0); + s.execute("layer.move", &json!({"ids": [a.0], "target": g.0, "copy": true})).unwrap(); + assert_eq!(s.doc().unwrap().doc.parent_of(a), layer, "the path itself stays"); + let n = node(&s, g); + assert_eq!(faces(&n).len(), 5); + let src = sources(&n).unwrap().children().unwrap().clone(); + assert_eq!(src.len(), 3); + assert!(src.iter().all(|c| c.id != a), "a copy joined"); + let (face, other_face) = (faces(&n)[0].id, faces(&n)[1].id); + let b = line_to_right_face(&mut s, 70.0); + // A face dragged along is made again with the others, so only the group is listed. + let r = s.execute("layer.move", &json!({"ids": [b.0, other_face.0], "target": face.0, "place": "above"})).unwrap(); + assert_eq!(r["ids"], json!([g.0])); + assert_eq!(s.doc().unwrap().layer_rows, vec![g]); + let n = node(&s, g); + assert_eq!(s.doc().unwrap().doc.parent_of(b), Some(sources(&n).unwrap().id), "a drop beside a face joins"); + assert_eq!(faces(&n).len(), 7); + let c = line_to_right_face(&mut s, 50.0); + s.execute("node.move", &json!({"id": c.0, "parent": g.0, "index": 0})).unwrap(); + assert_eq!(undo_label(&s).as_deref(), Some("Merge Live Paint")); + let n = node(&s, g); + assert_eq!(s.doc().unwrap().doc.parent_of(c), Some(sources(&n).unwrap().id), "node.move into the group joins"); + assert_eq!(faces(&n).len(), 9); +} + +/// Dragging type, or type with a path, into a Live Paint group is refused with Make's message and +/// moves nothing, as Merge refuses it; a drop beside the group is an ordinary move. +#[test] +fn layers_drag_refuses_type_into_a_live_paint_group() { + use vectorcraft_tools::builder::faces; + let mut s = session(); + let g = live(&mut s); + let layer = s.doc().unwrap().doc.parent_of(g); + let a = line_to_right_face(&mut s, 30.0); + let text = NodeId(s.execute("text.create", &json!({"x": 20, "y": 20, "text": "Hi"})).unwrap()["id"].as_u64().unwrap()); + let before = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()); + for p in [json!({"ids": [a.0, text.0], "target": g.0}), json!({"ids": [text.0], "target": g.0, "copy": true})] { + let err = s.execute("layer.move", &p).unwrap_err().to_string(); + assert!(err.contains("Live Paint takes paths and compound paths"), "{err}"); + } + assert!(s.execute("node.move", &json!({"id": text.0, "parent": g.0, "index": 0})).is_err()); + assert!(s.doc().unwrap().doc == before.0, "nothing moved"); + assert_eq!(s.doc().unwrap().history.undo.len(), before.1); + s.execute("layer.move", &json!({"ids": [a.0, text.0], "target": g.0, "place": "above"})).unwrap(); + assert_eq!(undo_label(&s).as_deref(), Some("Move Rows")); + assert_eq!(s.doc().unwrap().doc.parent_of(text), layer); + assert_eq!(faces(&node(&s, g)).len(), 3); +} + +/// A path dragged out of a Live Paint group's sources leaves its faces and edges: the group makes +/// them again from the paths left, and with none left it has no faces until a path joins it again. +/// Reordering the sources, or the group's own faces, makes nothing again. +#[test] +fn layers_drag_out_of_a_live_paint_group_makes_its_faces_again() { + use vectorcraft_tools::builder::{faces, sources}; + let mut s = session(); + let g = live(&mut s); + let layer = s.doc().unwrap().doc.parent_of(g).unwrap(); + let n = node(&s, g); + let src: Vec = sources(&n).unwrap().children().unwrap().iter().map(|c| c.id).collect(); + let face_ids: Vec = faces(&n).iter().map(|f| f.id).collect(); + s.execute("layer.move", &json!({"ids": [src[0].0], "target": src[1].0, "place": "above"})).unwrap(); + s.execute("layer.move", &json!({"ids": [face_ids[0].0], "target": face_ids[2].0, "place": "above"})).unwrap(); + let n = node(&s, g); + assert_eq!(sources(&n).unwrap().children().unwrap().len(), 2, "a reorder keeps the sources"); + let mut now: Vec = faces(&n).iter().map(|f| f.id).collect(); + now.sort(); + let mut was = face_ids.clone(); + was.sort(); + assert_eq!(now, was, "and the faces"); + s.execute("layer.move", &json!({"ids": [src[0].0], "target": layer.0})).unwrap(); + assert_eq!(undo_label(&s).as_deref(), Some("Move Rows")); + let n = node(&s, g); + assert_eq!(s.doc().unwrap().doc.parent_of(src[0]), Some(layer)); + assert_eq!(sources(&n).unwrap().children().unwrap().len(), 1); + assert_eq!(faces(&n).len(), 1, "one rectangle left"); + s.execute("node.move", &json!({"id": src[1].0, "parent": layer.0, "index": 0})).unwrap(); + let n = node(&s, g); + assert!(vectorcraft_tools::builder::is_live_paint(&n), "the group stays a Live Paint group"); + assert!(sources(&n).unwrap().children().unwrap().is_empty()); + assert!(faces(&n).is_empty() && vectorcraft_tools::builder::edges(&n).is_empty()); + s.execute("layer.move", &json!({"ids": [src[0].0], "target": g.0})).unwrap(); + assert_eq!(faces(&node(&s, g)).len(), 1, "a path joins the empty group"); + s.execute("edit.undo", &json!({})).unwrap(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(faces(&node(&s, g)).len(), 1); +} + /// Give Live Paint group `g` a lock, hidden state, appearance, knockout, opacity mask and /// graphic style link, and return it as it then is. fn dress_live_group(s: &mut Session, g: NodeId) -> Node { diff --git a/docs/mcp.md b/docs/mcp.md index 504256c382..4a6ddc23fa 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5374,7 +5374,13 @@ and `layerRows`, the rows highlighted in the panel. only in layers or at the top level and objects in layers and groups (an object placed beside a top-level layer goes inside it); a row never goes into itself or a row inside it, and a locked layer or group takes nothing. Dragging the selected-art square is `layer.move` with the selected objects. `node.move {id, parent?, index}` is the low-level - form with the same nesting rules; unlike `layer.move`, it also moves a row into a locked layer or group. + form with the same nesting rules; unlike `layer.move`, it also moves a row into a locked layer or group. A row that + either command puts into a Live Paint group from elsewhere (inside it, or above or below one of its rows) joins the + group's paths as `livePaint.merge` adds them, in one "Merge Live Paint" undo step, and the group is selected and + listed in `layer.move`'s `ids` in its place; paths, compound paths, groups of them and Live Paint groups can join, + and with anything else among the rows nothing moves. A row that goes into or leaves a Live Paint group's paths (its + hidden sources group) makes the group's faces and edges again, keeping the paint of those that stay; when no path is + left, the group has no faces or edges until a path joins it again. - **Buttons**: `layer.new {name?, top?, below?, …options}` (above the current layer at its level; `top` with Ctrl/Cmd; `below`, directly below the current layer at its level, with Ctrl/Cmd+Alt), `layer.newSublayer {parent?, bottom?, name?, …options}` (on top of the parent's contents; `bottom`, under them but diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 021014bf41..6d743a0f63 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1646,6 +1646,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The ignored centre-lines class measures that split on a mixed-width body scene: one disc with arms of 2, 3 and 5 px, at Stroke 6 px, traces as three stroked paths and one filled path in both the anti-aliased and hard input, with 100.0% of the arms' center samples found and 99.3% (anti-aliased) and 98.3% (hard) of the disc's pixels filled ([quality notes](image-trace-quality.md#centre-lines)). Test: `mixed_width_body_is_one_shape_traced_as_a_fill_and_strokes` in `vectorcraft-trace`. The Image Trace score and estimates are unchanged. Object › Live Paint › Merge adds the other selected paths and Live Paint groups to the bottom selected Live Paint group ([Live Paint groups](https://web.archive.org/web/20241230205225/https://helpx.adobe.com/illustrator/using/live-paint-groups.html)), which keeps its id, the paint of its faces and edges, and its name, lock, visibility, transparency, appearance, opacity mask and graphic style link. Object › Live Paint › Make with a Live Paint group selected, and a Live Paint Bucket click on a selected path beside a selected Live Paint group, add the paths to that group the same way. Make, Merge and the Live Paint Bucket take paths, compound paths and groups of them; with type, an image or another object among the selection they report that it has to be converted to paths first and change nothing, as type and raster images can't go into a Live Paint group directly ([Create Live Paint groups](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/create-live-paint-groups.html)); before, such an object went among the group's hidden sources and vanished from the canvas. Evidence: `tests_build::live_paint_refuses_type_and_images_and_changes_nothing`. Paths drawn in an isolated Live Paint group join it when isolation mode ends, as the [help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/modify-live-paint-groups.html) describes: drawing paths in the isolated group and pressing Esc adds them. `object.exitIsolation` (Esc, the Control bar and isolation bar exits, a double-click outside, the Layers panel and the canvas context menu) adds the shown, unlocked paths, compound paths and groups of them drawn in the group as Merge does, in one undo step, and `object.isolate` on a level outside the group does the same. As VectorCraft's own rules, type, images, hidden and locked objects drawn there, and groups holding one, stay in the group as they are, and Gap Options, Merge and Release keep them; an exit with nothing drawn records no undo step. Evidence: `tests::build::{live_paint_isolation_adds_drawn_paths_on_exit, live_paint_isolation_adds_only_paths_it_takes, live_paint_isolation_leaves_a_group_holding_a_locked_path, live_paint_isolation_adds_drawn_paths_when_isolating_a_level_outside, live_paint_isolation_adds_a_drawn_group_isolated_inside_it, live_paint_isolation_keeps_art_named_like_its_parts, live_paint_keeps_type_drawn_in_it_through_gap_options_merge_and_release}`. + Paths dragged into a Live Paint group in the Layers panel join it, as the [help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/modify-live-paint-groups.html) describes for adding paths to a group; older guides ([CS6, page 192](https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=192)) say several paths can be dragged at once. A drop inside the group, or above or below one of its rows (`layer.move`, and `node.move` into the group), adds the paths, compound paths, groups of them and Live Paint groups to it as Merge does, in one "Merge Live Paint" undo step that selects the group; an Alt-drag adds copies. As VectorCraft's own rules, type, an image or another object among the dragged rows refuses the whole drop with Merge's message, and a row dragged into or out of the group's hidden sources makes its faces and edges again, keeping the paint of those that stay; with no path left the group has no faces until a path joins it. Evidence: `tests::build::{layers_drag_adds_paths_to_a_live_paint_group, layers_drag_copy_and_drop_beside_a_part_add_to_a_live_paint_group, layers_drag_refuses_type_into_a_live_paint_group, layers_drag_out_of_a_live_paint_group_makes_its_faces_again}`. With the Live Paint Bucket selected, Alt-click on vector art samples its fill, stroke and stroke weight into the paint defaults ([Paint with the Live Paint Bucket tool](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/paint-with-the-live-paint-bucket-tool.html)). On a placed image it samples the image pixel as a solid fill with no stroke. Alt+Shift-click samples only the color under the pointer, including an intermediate gradient color or image pixels, into the active fill or stroke ([Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)). Neither click paints or changes the selection or selected art, and the next Bucket click paints with the sampled paint. Evidence: `tests_build::live_paint_bucket_alt_sample_paints_next_face_without_changing_selection`. Double-clicking the Live Paint Bucket opens Live Paint Bucket Options ([Paint with the Live Paint Bucket tool](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/paint-with-the-live-paint-bucket-tool.html)): Paint Fills (on) and Paint Strokes (off) set whether a click paints faces, edges or both, Highlight turns the outline of the face or edge under the pointer on or off, and Color and Width set it (red and 4 px by default). Faces are outlined at the Width and edges at half of it, as the page says faces are highlighted with a thick line and edges with a thin line. With both on, a click paints the edge within 4 px of the pointer, else the face, and Shift switches to Paint Fills only; with one on, Shift switches to the other. The options last across tool switches and are saved with the preferences (`tool.setOption {tool: "livePaintBucket"}`). Evidence: `builder::tests::{bucket_options_choose_what_a_click_paints, bucket_options_set_the_highlight, bucket_highlights_an_edge_thinner_than_a_face}`, `dialogs::live_paint_bucket::tests::double_clicking_the_tool_opens_its_options_and_ok_sets_them`. Live Paint Bucket double-click and triple-click, as [the help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/paint-with-the-live-paint-bucket-tool.html) describes them: a double-click on a face fills it and the faces reached across edges that draw no stroke, and on an edge it paints the edges joined to it with the same stroke; a triple-click fills every face of the group that has the face's fill, or paints every edge that draws with the edge's stroke paint, each with the bucket's paint (`livePaint.fill` and `livePaint.strokeEdge` `{scope: "connected" | "samePaint", match?}`; `pointer_gesture` and `ui.pointer` take `tripleclick`). Each click paints as it arrives, as its own undo step when it changes a paint, and the paint compared is the one the face or edge had before the first of its clicks that painted it, including a click whose drag or release crossed it; a first click that made the Live Paint group counts when the face it filled is the clicked face. With Space held for the view tools, a click, double-click or triple-click paints nothing and no face or edge is outlined, and with Cmd/Ctrl held a double-click or triple-click paints nothing. Which faces and edges join and which paints match are VectorCraft's own rules. Evidence: `tests_build::{live_paint_bucket_double_click_floods_across_unstroked_edges, live_paint_bucket_double_click_floods_curved_and_narrow_faces, live_paint_bucket_double_click_floods_across_hidden_edges_and_past_gaps, live_paint_bucket_triple_click_fills_every_face_of_the_same_fill, live_paint_bucket_triple_click_after_a_release_across_an_edge_matches_the_fill_before, live_paint_bucket_triple_click_released_from_another_face_matches_the_fill_before, live_paint_bucket_triple_click_after_making_the_group_across_an_edge_matches_the_made_fill, live_paint_bucket_triple_click_after_making_the_group_under_an_unfilled_path_matches_the_made_fill, live_paint_bucket_triple_click_after_merging_across_an_edge_matches_the_face_fill, live_paint_bucket_triple_click_after_merging_two_groups_matches_the_merged_fill, live_paint_bucket_triple_click_after_a_merge_splits_a_face_matches_the_part_fill, live_paint_bucket_triple_click_after_merging_matches_the_fixed_gradient, live_paint_bucket_triple_click_after_making_the_group_matches_the_made_fill, live_paint_bucket_double_and_triple_click_paint_joined_and_same_stroke_edges, live_paint_bucket_double_click_across_a_junction_paints_the_joined_edges, live_paint_bucket_double_click_released_back_on_the_first_edge_paints_the_joined_edges, live_paint_bucket_edge_double_click_after_filling_a_face_paints_the_joined_edges, live_paint_bucket_triple_click_with_a_cmd_press_between_matches_the_fill_before, live_paint_scope_and_match_are_checked}`, `builder::tests::{bucket_double_and_triple_click_widen_what_a_click_paints, bucket_triple_click_after_making_the_group_on_another_face_matches_its_own_face, bucket_triple_click_with_a_click_on_another_face_between_matches_the_first_fill, bucket_triple_click_with_a_view_tool_press_between_matches_the_first_fill, bucket_highlights_nothing_with_space_held}`, `canvas::tests::bucket_triple_click_with_a_view_tool_press_between_matches_the_fill_before`, `tests::build::{live_paint_scoped_fill_and_stroke_skip_parts_with_the_paint, live_paint_bucket_cmd_double_and_triple_click_paint_nothing}`, `tests::livepaint::{a_triple_click_fills_every_face_of_the_same_fill, clicks_with_space_held_paint_nothing}` (MCP). From 9e905635bf8aea572a98251a5b4938ae8af7965d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 09:32:25 -0800 Subject: [PATCH 058/158] Preferences: Slices settings show a sentence on hover and focus The line under the Preferences fields now shows a sentence for Show Slice Numbers and Line Color when the pointer is over the row or its control has the keyboard focus. A screen reader gets the same sentence as the control's description. Every complete catalog has a row for each one. Tests: the one-sentence test covers the Slices category, and new tests check the hover and keyboard-focus sentences. --- crates/ui-egui/src/i18n/bg.tsv | 2 + crates/ui-egui/src/i18n/bs.tsv | 2 + crates/ui-egui/src/i18n/ca.tsv | 2 + crates/ui-egui/src/i18n/cs.tsv | 2 + crates/ui-egui/src/i18n/da.tsv | 2 + crates/ui-egui/src/i18n/de.tsv | 2 + crates/ui-egui/src/i18n/el.tsv | 2 + crates/ui-egui/src/i18n/es.tsv | 2 + crates/ui-egui/src/i18n/fi.tsv | 2 + crates/ui-egui/src/i18n/fr.tsv | 2 + crates/ui-egui/src/i18n/gu.tsv | 2 + crates/ui-egui/src/i18n/hi.tsv | 2 + crates/ui-egui/src/i18n/hu.tsv | 2 + crates/ui-egui/src/i18n/id.tsv | 2 + crates/ui-egui/src/i18n/it.tsv | 2 + crates/ui-egui/src/i18n/ja.tsv | 2 + crates/ui-egui/src/i18n/ka.tsv | 2 + crates/ui-egui/src/i18n/ko.tsv | 2 + crates/ui-egui/src/i18n/nl.tsv | 2 + crates/ui-egui/src/i18n/pl.tsv | 2 + crates/ui-egui/src/i18n/pt-br.tsv | 2 + crates/ui-egui/src/i18n/ru.tsv | 2 + crates/ui-egui/src/i18n/sv.tsv | 2 + crates/ui-egui/src/i18n/tr.tsv | 2 + crates/ui-egui/src/i18n/uk.tsv | 2 + crates/ui-egui/src/i18n/vi.tsv | 2 + crates/ui-egui/src/i18n/zh-hans.tsv | 2 + crates/ui-egui/src/i18n/zh-hant.tsv | 2 + .../ui-egui/src/prefs_dialog/descriptions.rs | 3 + crates/ui-egui/src/prefs_dialog/tests.rs | 56 +++++++++++++++++-- docs/target-app-parity.md | 5 +- 31 files changed, 114 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index bb039bb08e..5e5287216c 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3072,6 +3072,8 @@ digits Malayalam Малаялам How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Колко близо на екрана показалецът или влачена точка трябва да стигне до обект, за да прилепнат интелигентните водачи; разстоянието е еднакво при всеки мащаб. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Прилепва края на линеен сегмент или окръжност, начертана от центъра си, така че да докосва близка крива. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Прилепва края на линеен сегмент така, че да среща близък прав сегмент под прав ъгъл. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Показва номера на всяка отрязана част в каре в горния ѝ ляв ъгъл върху платното; когато е изключено, контурите на отрязаните части остават видими. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Цветът на контурите на потребителските и обектните отрязани части и на каретата с номерата им; автоматичните отрязани части използват по-блед нюанс на този цвят. Reset all preferences to their defaults? Да се нулират ли всички настройки до стойностите по подразбиране? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Стойностите по подразбиране се прилагат, когато щракнете върху ОК в Настройки. Отказ там запазва текущите ви настройки. Restore Recovered Documents Възстановяване на възстановените документи diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 99f23d313c..3c7f5fe5f0 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -4509,6 +4509,8 @@ font-technology Variable Varijabilni How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Koliko blizu na ekranu pokazivač ili prevučena tačka mora doći do objekta da bi ga pametne vodilice uhvatile; udaljenost je ista pri svakom zumu. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Hvata kraj segmenta linije ili krug nacrtan iz središta tako da dodiruje obližnju krivu. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Hvata kraj segmenta linije tako da pod pravim uglom susreće obližnji ravni segment. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Prikazuje broj svakog isječka u okviru u njegovom gornjem lijevom uglu na platnu; kada je isključeno, obrisi isječaka i dalje se prikazuju. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Boja obrisa korisničkih i objektnih isječaka i okvira s njihovim brojevima; automatski isječci koriste blijeđu nijansu te boje. Reset all preferences to their defaults? Vratiti sve postavke na zadane vrijednosti? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Zadane vrijednosti primjenjuju se kada kliknete U redu u Postavkama. Otkaži tamo zadržava vaše trenutne postavke. Smaller ↔ Larger Manje ↔ veće diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index c54311799d..53b79504f9 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -3902,6 +3902,8 @@ digits Malayalam Malaiàlam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Com d’a prop a la pantalla han d’arribar el punter o un punt arrossegat a l’art perquè les guies intel·ligents s’hi ajustin; la distància és la mateixa a qualsevol zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Ajusta l’extrem d’un segment de línia, o un cercle dibuixat des del centre, perquè toqui una corba propera. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Ajusta l’extrem d’un segment de línia perquè trobi un segment recte proper en angle recte. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Mostra al llenç el número de cada tall en un requadre a la seva cantonada superior esquerra; si està desactivat, els contorns dels talls continuen visibles. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. El color dels contorns dels talls d’usuari i d’objecte i dels requadres amb el seu número; els talls automàtics fan servir un to més apagat d’aquest color. Reset all preferences to their defaults? Voleu restablir totes les preferències als valors predeterminats? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Els valors predeterminats s’apliquen quan feu clic a D’acord a Preferències. Cancel·la allà conserva les preferències actuals. Restore Recovered Documents Restaura els documents recuperats diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index a5d7bb948a..c652f79533 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4613,6 +4613,8 @@ font-technology Variable Variabilní How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Jak blízko na obrazovce musí ukazatel nebo tažený bod přijít ke kresbě, aby se chytrá vodítka přichytila; vzdálenost je stejná při každém zvětšení. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Přichytí konec úsečky nebo kružnici kreslenou od středu tak, aby se dotýkala blízké křivky. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Přichytí konec úsečky tak, aby se s blízkým rovným segmentem setkal v pravém úhlu. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Zobrazí na plátně číslo každého řezu v rámečku v jeho levém horním rohu; když je vypnuto, obrysy řezů zůstanou zobrazené. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Barva obrysů uživatelských a objektových řezů a rámečků s jejich čísly; automatické řezy používají tlumenější odstín této barvy. Reset all preferences to their defaults? Obnovit všechny předvolby na výchozí hodnoty? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Výchozí hodnoty se použijí po klepnutí na OK v Předvolbách. Zrušit tam zachová vaše současné předvolby. Smaller ↔ Larger Menší ↔ Větší diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 08100f593f..4c1b1de1ad 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -7012,6 +7012,8 @@ font-technology Variable Variable How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Hvor tæt på skærmen markøren eller et trukket punkt skal komme på grafik, for at de smarte hjælpelinjer fastgør til den; afstanden er den samme ved alle zoomniveauer. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Fastgør enden af et linjesegment eller en cirkel tegnet fra midten, så den rører en nærliggende kurve. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Fastgør enden af et linjesegment, så det møder et nærliggende lige segment i en ret vinkel. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Viser hvert udsnits nummer i en boks i dets øverste venstre hjørne på lærredet; når den er slået fra, vises udsnittenes konturer stadig. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Farven på konturerne af bruger- og objektudsnit og på boksene med deres numre; automatiske udsnit bruger en svagere nuance af den. Reset all preferences to their defaults? Nulstil alle præferencer til standard? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Standardværdierne anvendes, når du klikker på OK i Præferencer. Annullér der beholder dine nuværende præferencer. Smaller ↔ Larger Mindre ↔ Større diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 10147b2d45..cb081ef4e7 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3124,6 +3124,8 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Wie nah der Zeiger oder ein gezogener Punkt auf dem Bildschirm an Bildmaterial kommen muss, damit intelligente Hilfslinien einrasten; der Abstand ist bei jedem Zoom gleich. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Richtet das Ende eines Liniensegments oder einen von der Mitte aus gezeichneten Kreis so aus, dass er eine nahe Kurve berührt. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Richtet das Ende eines Liniensegments so aus, dass es ein nahes gerades Segment im rechten Winkel trifft. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Zeigt auf der Arbeitsfläche die Nummer jedes Slices in einem Kästchen oben links im Slice; ist die Option aus, werden die Slice-Umrisse weiterhin angezeigt. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Die Farbe der Umrisse von Benutzer- und Objekt-Slices und ihrer Nummernkästchen; automatische Slices verwenden einen blasseren Ton davon. Reset all preferences to their defaults? Alle Voreinstellungen auf ihre Standardwerte zurücksetzen? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Die Standardwerte werden angewendet, wenn Sie in den Voreinstellungen auf OK klicken. Abbrechen dort behält Ihre aktuellen Voreinstellungen. Restore Recovered Documents Wiederhergestellte Dokumente öffnen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 1ebf6e5684..868161b33e 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3942,6 +3942,8 @@ digits Malayalam Μαλαγιάλαμ How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Πόσο κοντά στην οθόνη πρέπει να φτάσει ο δείκτης ή ένα σημείο που σύρεται σε γραφικά για να προσκολληθούν οι έξυπνοι οδηγοί· η απόσταση είναι ίδια σε κάθε ζουμ. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Προσκολλά το άκρο ενός ευθύγραμμου τμήματος ή έναν κύκλο που σχεδιάζεται από το κέντρο του ώστε να αγγίζει μια κοντινή καμπύλη. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Προσκολλά το άκρο ενός ευθύγραμμου τμήματος ώστε να συναντά ένα κοντινό ευθύ τμήμα σε ορθή γωνία. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Εμφανίζει στον καμβά τον αριθμό κάθε τομής σε ένα πλαίσιο πάνω αριστερά της· όταν είναι απενεργοποιημένο, τα περιγράμματα των τομών εξακολουθούν να εμφανίζονται. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Το χρώμα των περιγραμμάτων των τομών χρήστη και αντικειμένου και των πλαισίων με τους αριθμούς τους· οι αυτόματες τομές χρησιμοποιούν μια πιο αχνή απόχρωσή του. Reset all preferences to their defaults? Επαναφορά όλων των προτιμήσεων στις προεπιλογές τους; The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Οι προεπιλογές εφαρμόζονται όταν κάνετε κλικ στο Εντάξει στις Προτιμήσεις. Το Ακύρωση εκεί διατηρεί τις τρέχουσες προτιμήσεις σας. Restore Recovered Documents Επαναφορά ανακτημένων εγγράφων diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index a456910a16..d4fc9d091a 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3162,6 +3162,8 @@ digits Malayalam Malayálam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Cuánto debe acercarse en pantalla el puntero o un punto arrastrado a la ilustración para que las guías inteligentes se ajusten a ella; la distancia es la misma con cualquier zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Ajusta el extremo de un segmento de línea, o un círculo dibujado desde su centro, para que toque una curva cercana. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Ajusta el extremo de un segmento de línea para que encuentre un segmento recto cercano en ángulo recto. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Muestra en el lienzo el número de cada sector en un recuadro en su esquina superior izquierda; si está desactivado, los contornos de los sectores siguen visibles. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. El color de los contornos de los sectores de usuario y de objeto y de los recuadros con su número; los sectores automáticos usan un tono más apagado de ese color. Reset all preferences to their defaults? ¿Restablecer todas las preferencias a sus valores predeterminados? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Los valores predeterminados se aplican al hacer clic en Aceptar en Preferencias. Cancelar ahí conserva sus preferencias actuales. Restore Recovered Documents Restaurar documentos recuperados diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index bff46fc0d7..56eb979c93 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4532,6 +4532,8 @@ font-technology Variable Muuttuvat How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Kuinka lähelle grafiikkaa osoittimen tai vedettävän pisteen on tultava näytöllä, jotta älykkäät apuviivat kohdistavat siihen; etäisyys on sama kaikilla zoomauksilla. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Kohdistaa janan pään tai keskipisteestä piirretyn ympyrän niin, että se koskettaa lähellä olevaa käyrää. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Kohdistaa janan pään niin, että se kohtaa lähellä olevan suoran segmentin suorassa kulmassa. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Näyttää piirtopinnalla kunkin viipaleen numeron ruudussa sen vasemmassa yläkulmassa; kun asetus on pois päältä, viipaleiden ääriviivat näkyvät edelleen. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Käyttäjä- ja objektiviipaleiden ääriviivojen ja niiden numeroruutujen väri; automaattiset viipaleet käyttävät siitä himmeämpää sävyä. Reset all preferences to their defaults? Palautetaanko kaikki asetukset oletuksiin? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Oletukset otetaan käyttöön, kun valitset Asetuksissa OK. Peruuta siellä säilyttää nykyiset asetuksesi. Smaller ↔ Larger Pienempi ↔ Suurempi diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3be3497f97..a43bd23842 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3150,6 +3150,8 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. La distance à l’écran à laquelle le pointeur ou un point déplacé doit approcher une illustration pour que les repères commentés s’y aimantent. Elle est la même à tous les zooms. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Aimante l’extrémité d’un segment de droite, ou un cercle tracé depuis son centre, pour qu’il touche une courbe proche. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Aimante l’extrémité d’un segment de droite pour qu’il rencontre un segment droit proche à angle droit. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Affiche sur la zone de travail le numéro de chaque tranche dans un cadre en haut à gauche de la tranche. Désactivée, les contours des tranches restent affichés. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. La couleur des contours des tranches utilisateur et objet et de leurs cadres de numéro. Les tranches automatiques utilisent une nuance plus terne de cette couleur. Reset all preferences to their defaults? Rétablir toutes les préférences à leur valeur par défaut ? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Les valeurs par défaut sont appliquées lorsque vous cliquez sur OK dans Préférences. Annuler y conserve vos préférences actuelles. Restore Recovered Documents Restaurer les documents récupérés diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index c427fc527c..0d0b05a041 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3236,6 +3236,8 @@ How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. સ્માર્ટ ગાઇડ સ્નેપ કરે તે માટે પોઇન્ટર અથવા ખેંચેલું બિંદુ સ્ક્રીન પર આર્ટની કેટલું નજીક આવવું જોઈએ; આ અંતર દરેક ઝૂમ પર સમાન રહે છે. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. લાઇન સેગમેન્ટના છેડાને, અથવા કેન્દ્રથી દોરેલા વર્તુળને, એ રીતે સ્નેપ કરે છે કે તે નજીકના વળાંકને સ્પર્શે. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. લાઇન સેગમેન્ટના છેડાને એ રીતે સ્નેપ કરે છે કે તે નજીકના સીધા સેગમેન્ટને કાટખૂણે મળે. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. કેનવાસ પર દરેક સ્લાઇસનો નંબર તેના ઉપરના ડાબા ખૂણે એક બૉક્સમાં બતાવે છે; બંધ હોય ત્યારે પણ સ્લાઇસની રૂપરેખાઓ દેખાય છે. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. યુઝર અને ઑબ્જેક્ટ સ્લાઇસની રૂપરેખાઓ અને તેમના નંબર બૉક્સનો રંગ; ઑટો સ્લાઇસ તેની ઝાંખી છાયા વાપરે છે. Restored documents open unsaved: save them to keep them. પુનઃસ્થાપિત દસ્તાવેજો અસાચવેલા ખુલશે: તેમને રાખવા માટે સાચવો. Restrict printing, editing and other tasks છાપકામ, સંપાદન અને અન્ય કાર્યો પર પ્રતિબંધ મૂકો Reticulation… રેટિક્યુલેશન… diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index cbfb4f51d1..2cf5747b24 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4272,6 +4272,8 @@ antiAlias Sharp शार्प How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. स्मार्ट गाइड्स के स्नैप करने के लिए पॉइंटर या ड्रैग किया गया पॉइंट स्क्रीन पर आर्ट के कितने पास आना चाहिए; यह दूरी हर ज़ूम पर समान रहती है। Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. लाइन सेगमेंट के सिरे को, या केंद्र से ड्रॉ किए गए वृत्त को, इस तरह स्नैप करता है कि वह पास के वक्र को छुए। Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. लाइन सेगमेंट के सिरे को इस तरह स्नैप करता है कि वह पास के सीधे सेगमेंट से समकोण पर मिले। + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. कैनवास पर हर स्लाइस का नंबर उसके ऊपरी बाएँ कोने में एक बॉक्स में दिखाता है; बंद होने पर भी स्लाइस की आउटलाइन दिखती रहती हैं। + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. यूज़र और ऑब्जेक्ट स्लाइस की आउटलाइन और उनके नंबर बॉक्स का रंग; ऑटो स्लाइस इसकी हल्की छाया इस्तेमाल करते हैं। Reset all preferences to their defaults? सभी प्रेफ़रेंसेज़ को उनके डिफ़ॉल्ट पर रीसेट करें? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. डिफ़ॉल्ट तब लागू होते हैं जब आप प्रेफ़रेंसेज़ में ठीक है पर क्लिक करते हैं। वहाँ रद्द करें आपकी मौजूदा प्रेफ़रेंसेज़ बनाए रखता है। Restore Recovered Documents पुनर्स्थापना डॉक्यूमेंट diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0f81a72036..f84b91da76 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3743,6 +3743,8 @@ mark-style Japanese Japán How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Milyen közel kell a mutatónak vagy egy húzott pontnak a képernyőn a grafikához érnie, hogy az intelligens segédvonalak illesszenek; a távolság minden nagyításnál azonos. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Egy szakasz végét vagy a középpontjából rajzolt kört úgy illeszti, hogy érintse a közeli görbét. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Egy szakasz végét úgy illeszti, hogy derékszögben találkozzon egy közeli egyenes szakasszal. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. A vásznon minden szelet számát egy keretben mutatja a szelet bal felső sarkában; kikapcsolva a szeletek körvonalai továbbra is látszanak. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. A felhasználói és objektumszeletek körvonalainak és számkereteinek színe; az automatikus szeletek ennek egy halványabb árnyalatát használják. Reset all preferences to their defaults? Visszaállítja az összes beállítást az alapértékre? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Az alapértékek akkor lépnek életbe, amikor a Beállításokban az OK gombra kattint. Az ottani Mégse megtartja a jelenlegi beállításokat. Restore Recovered Documents Helyreállított dokumentumok visszaállítása diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 28ea2b5ab3..0712bbe7d9 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -4264,6 +4264,8 @@ font-technology Variable Variabel How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Seberapa dekat penunjuk atau titik yang diseret harus mendekati karya di layar agar panduan cerdas menjepret; jaraknya sama pada setiap zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Menjepretkan ujung segmen garis, atau lingkaran yang digambar dari pusatnya, agar menyentuh kurva di dekatnya. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Menjepretkan ujung segmen garis agar bertemu segmen lurus di dekatnya pada sudut siku-siku. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Menampilkan nomor setiap irisan dalam kotak di sudut kiri atasnya di kanvas; saat nonaktif, garis tepi irisan tetap ditampilkan. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Warna garis tepi irisan pengguna dan objek serta kotak nomornya; irisan otomatis memakai nuansa yang lebih redup dari warna ini. Reset all preferences to their defaults? Atur ulang semua preferensi ke defaultnya? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Nilai default diterapkan saat Anda mengklik OK di Preferensi. Batal di sana mempertahankan preferensi Anda saat ini. Smaller ↔ Larger Lebih kecil ↔ Lebih besar diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 8f2ed3216c..0420007a89 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3205,6 +3205,8 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Quanto vicino sullo schermo il puntatore o un punto trascinato deve arrivare alla grafica perché le guide sensibili vi si aggancino; la distanza è la stessa a ogni zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Aggancia l’estremità di un segmento di linea, o un cerchio disegnato dal centro, in modo che tocchi una curva vicina. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Aggancia l’estremità di un segmento di linea in modo che incontri un segmento rettilineo vicino ad angolo retto. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Mostra sull’area di lavoro il numero di ogni sezione in un riquadro nel suo angolo in alto a sinistra; se è disattivata, i contorni delle sezioni restano visibili. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Il colore dei contorni delle sezioni utente e oggetto e dei riquadri con il loro numero; le sezioni automatiche usano una tonalità più tenue di questo colore. Reset all preferences to their defaults? Ripristinare tutte le preferenze ai valori predefiniti? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. I valori predefiniti vengono applicati quando fai clic su OK in Preferenze. Annulla lì mantiene le preferenze attuali. Restore Recovered Documents Ripristina documenti recuperati diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c429f204a1..88730a9db0 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3182,6 +3182,8 @@ mark-style Japanese 日本式 How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. スマートガイドがスナップするために、ポインターやドラッグしたポイントが画面上でアートにどこまで近づく必要があるかです。この距離はどのズームでも同じです。 Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. 直線セグメントの端、または中心から描いた円を、近くの曲線に接するようにスナップします。 Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. 直線セグメントの端を、近くの直線セグメントと直角に交わるようにスナップします。 + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. カンバス上で、各スライスの番号をスライスの左上のボックスに表示します。オフでもスライスの輪郭は表示されます。 + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. ユーザースライスとオブジェクトスライスの輪郭、およびその番号のボックスの色です。自動スライスにはこの色の淡い色合いが使われます。 Reset all preferences to their defaults? すべての環境設定を初期値に戻しますか? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. 初期値は環境設定で OK をクリックすると適用されます。そこでキャンセルすると現在の環境設定が保たれます。 Restored documents open unsaved: save them to keep them. 復元したドキュメントは未保存の状態で開きます。保存して残してください。 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 414f45171c..7128b09061 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6330,6 +6330,8 @@ font-technology Variable ცვლადი How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. რამდენად ახლოს უნდა მივიდეს ეკრანზე მაჩვენებელი ან გადათრეული წერტილი გრაფიკასთან, რომ ჭკვიანმა დამხმარე ხაზებმა მიაბან; მანძილი ყველა მასშტაბზე ერთნაირია. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. ხაზის სეგმენტის ბოლოს, ან ცენტრიდან დახატულ წრეწირს, ისე აბამს, რომ ახლომდებარე მრუდს შეეხოს. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. ხაზის სეგმენტის ბოლოს ისე აბამს, რომ ახლომდებარე სწორ სეგმენტს მართი კუთხით შეხვდეს. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. ტილოზე თითოეული ნაჭრის ნომერს აჩვენებს ჩარჩოში მის ზედა მარცხენა კუთხეში; გამორთულისას ნაჭრების კონტურები კვლავ ჩანს. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. მომხმარებლისა და ობიექტის ნაჭრების კონტურებისა და მათი ნომრების ჩარჩოების ფერი; ავტომატური ნაჭრები ამ ფერის უფრო მკრთალ ელფერს იყენებს. Reset all preferences to their defaults? დავაბრუნოთ ყველა პარამეტრი ნაგულისხმევ მნიშვნელობებზე? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. ნაგულისხმევი მნიშვნელობები გამოიყენება, როცა პარამეტრებში OK-ს დააჭერთ. იქ გაუქმება ინარჩუნებს თქვენს მიმდინარე პარამეტრებს. Smaller ↔ Larger უფრო პატარა ↔ უფრო დიდი diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index dbda53243f..4f6bb61416 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3171,6 +3171,8 @@ mark-style Japanese 일본식 How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. 스마트 안내선이 스냅하려면 포인터나 드래그한 점이 화면에서 아트에 얼마나 가까이 와야 하는지입니다. 이 거리는 모든 확대/축소에서 같습니다. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. 선 세그먼트의 끝이나 중심에서 그린 원을 가까운 곡선에 닿도록 스냅합니다. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. 선 세그먼트의 끝을 가까운 직선 세그먼트와 직각으로 만나도록 스냅합니다. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. 캔버스에서 각 슬라이스의 번호를 왼쪽 위의 상자에 표시합니다. 끄더라도 슬라이스 윤곽선은 계속 표시됩니다. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. 사용자 슬라이스와 개체 슬라이스의 윤곽선 및 번호 상자의 색상입니다. 자동 슬라이스에는 이 색상의 더 흐린 색조가 사용됩니다. Reset all preferences to their defaults? 모든 환경 설정을 기본값으로 재설정하시겠습니까? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. 기본값은 환경 설정에서 확인을 클릭하면 적용됩니다. 그곳에서 취소를 누르면 현재 환경 설정이 유지됩니다. Restored documents open unsaved: save them to keep them. 복원된 문서는 저장되지 않은 상태로 열립니다. 보존하려면 저장하세요. diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 69aef91cfc..50609fa2bc 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4886,6 +4886,8 @@ font-technology Variable Variabel How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Hoe dicht de aanwijzer of een gesleept punt op het scherm bij een illustratie moet komen voordat slimme hulplijnen erop uitlijnen; de afstand is bij elke zoom gelijk. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Lijnt het einde van een lijnsegment, of een cirkel getekend vanuit het middelpunt, zo uit dat het een curve in de buurt raakt. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Lijnt het einde van een lijnsegment zo uit dat het een recht segment in de buurt onder een rechte hoek raakt. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Toont op het canvas het nummer van elke slice in een vakje linksboven in de slice; staat dit uit, dan blijven de omtrekken van de slices zichtbaar. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. De kleur van de omtrekken van gebruikers- en objectslices en van hun nummervakjes; automatische slices gebruiken een vagere tint ervan. Reset all preferences to their defaults? Alle voorkeuren terugzetten naar de standaardwaarden? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. De standaardwaarden worden toegepast wanneer u in Voorkeuren op OK klikt. Annuleren daar behoudt uw huidige voorkeuren. Smaller ↔ Larger Kleiner ↔ Groter diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0147515ffe..581648df14 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4454,6 +4454,8 @@ font-technology Variable Zmienne How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Jak blisko na ekranie wskaźnik lub przeciągany punkt musi znaleźć się przy grafice, aby inteligentne linie pomocnicze go przyciągnęły; odległość jest taka sama przy każdym powiększeniu. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Przyciąga koniec odcinka lub okrąg rysowany od środka tak, aby dotykał pobliskiej krzywej. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Przyciąga koniec odcinka tak, aby spotykał pobliski prosty segment pod kątem prostym. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Pokazuje na obszarze roboczym numer każdego plasterka w ramce w jego lewym górnym rogu; po wyłączeniu kontury plasterków nadal są widoczne. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Kolor konturów plasterków użytkownika i obiektów oraz ramek z ich numerami; plasterki automatyczne używają bledszego odcienia tego koloru. Reset all preferences to their defaults? Przywrócić domyślne wartości wszystkich preferencji? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Wartości domyślne zostaną zastosowane po kliknięciu OK w Preferencjach. Anuluj w tym oknie zachowuje bieżące preferencje. Smaller ↔ Larger Mniejszy ↔ większy diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 8201db7ab6..5f8c7bcfc1 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2654,6 +2654,8 @@ digits Malayalam Malaiala How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Quão perto na tela o ponteiro ou um ponto arrastado precisa chegar da arte para que as guias inteligentes se ajustem a ela; a distância é a mesma em qualquer zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Ajusta a extremidade de um segmento de linha, ou um círculo desenhado a partir do centro, para que toque uma curva próxima. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Ajusta a extremidade de um segmento de linha para que encontre um segmento reto próximo em ângulo reto. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Mostra na tela o número de cada fatia em uma caixa no canto superior esquerdo dela; quando desativado, os contornos das fatias continuam visíveis. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. A cor dos contornos das fatias de usuário e de objeto e das caixas com seus números; as fatias automáticas usam um tom mais apagado dessa cor. Reset all preferences to their defaults? Redefinir todas as preferências para o padrão? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Os padrões são aplicados quando você clica em OK em Preferências. Cancelar ali mantém suas preferências atuais. Restored documents open unsaved: save them to keep them. Os documentos restaurados abrem sem salvar: salve-os para mantê-los. diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index d1593508d3..cec7190f40 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3192,6 +3192,8 @@ digits Malayalam Малаялам How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Насколько близко на экране указатель или перетаскиваемая точка должны подойти к объекту, чтобы умные направляющие привязали их; расстояние одинаково при любом масштабе. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Привязывает конец отрезка или окружность, нарисованную от центра, так, чтобы она касалась ближайшей кривой. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Привязывает конец отрезка так, чтобы он встречал ближайший прямой сегмент под прямым углом. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Показывает на холсте номер каждого фрагмента в рамке в его левом верхнем углу; если параметр выключен, контуры фрагментов по-прежнему видны. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Цвет контуров пользовательских и объектных фрагментов и рамок с их номерами; автоматические фрагменты используют более бледный оттенок этого цвета. Reset all preferences to their defaults? Сбросить все настройки до значений по умолчанию? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Значения по умолчанию применяются, когда вы нажимаете ОК в окне «Настройки». Отмена там сохраняет текущие настройки. Restore Recovered Documents Восстановить восстановленные документы diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 5c0420fcd3..061cbe7558 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3092,6 +3092,8 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Hur nära på skärmen pekaren eller en dragen punkt måste komma teckningen för att de smarta stödlinjerna ska fästa mot den; avståndet är detsamma vid alla zoomnivåer. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Fäster änden av ett linjesegment, eller en cirkel ritad från sin mitt, så att den rör en närliggande kurva. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Fäster änden av ett linjesegment så att det möter ett närliggande rakt segment i rät vinkel. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Visar varje skivas nummer i en ruta i dess övre vänstra hörn på arbetsytan; när det är avstängt visas skivornas konturer fortfarande. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Färgen på konturerna för användar- och objektskivor och på deras nummerrutor; automatiska skivor använder en blekare nyans av den. Reset all preferences to their defaults? Återställa alla inställningar till standard? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Standardvärdena verkställs när du klickar på OK i Inställningar. Avbryt där behåller dina nuvarande inställningar. Restore Recovered Documents Återställ återskapade dokument diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 910a7fc5b1..4cd965b6b9 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -2929,6 +2929,8 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Akıllı Kılavuzların yaslaması için işaretçinin veya sürüklenen noktanın ekranda çizime ne kadar yaklaşması gerektiği; mesafe her yakınlaştırmada aynıdır. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Bir çizgi parçasının ucunu veya merkezinden çizilen bir daireyi yakındaki bir eğriye değecek şekilde yaslar. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Bir çizgi parçasının ucunu yakındaki düz bir parçayla dik açıyla buluşacak şekilde yaslar. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Tuvalde her dilimin numarasını sol üst köşesindeki bir kutuda gösterir; kapalıyken dilimlerin dış çizgileri görünmeye devam eder. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Kullanıcı ve nesne dilimlerinin dış çizgilerinin ve numara kutularının rengi; otomatik dilimler bu rengin daha soluk bir tonunu kullanır. Reset all preferences to their defaults? Tüm tercihler varsayılanlarına sıfırlansın mı? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Varsayılanlar, Tercihler'de Tamam'a tıkladığınızda uygulanır. Oradaki İptal, mevcut tercihlerinizi korur. Restore Recovered Documents Kurtarılan Belgeleri Geri Yükle diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index dbd6d2609e..f68ac9fd66 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3197,6 +3197,8 @@ digits Malayalam Малаялам How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Наскільки близько на екрані вказівник або перетягувана точка мають підійти до об’єкта, щоб розумні напрямні їх прив’язали; відстань однакова за будь-якого масштабу. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Прив’язує кінець відрізка або коло, намальоване від центру, так, щоб воно торкалося найближчої кривої. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Прив’язує кінець відрізка так, щоб він зустрічав найближчий прямий сегмент під прямим кутом. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Показує на полотні номер кожного фрагмента в рамці в його лівому верхньому куті; коли параметр вимкнено, контури фрагментів і далі видно. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Колір контурів користувацьких і об’єктних фрагментів та рамок з їхніми номерами; автоматичні фрагменти використовують блідіший відтінок цього кольору. Reset all preferences to their defaults? Скинути всі налаштування до значень за промовчанням? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Значення за промовчанням застосовуються, коли ви натискаєте ОК у вікні «Налаштування». Скасувати там зберігає поточні налаштування. Restore Recovered Documents Відновити відновлені документи diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 519c5d8f0d..760a781be5 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3512,6 +3512,8 @@ mark-style Japanese Kiểu Nhật How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Con trỏ hoặc điểm đang kéo phải đến gần hình vẽ trên màn hình bao nhiêu để đường căn thông minh hút vào; khoảng cách này như nhau ở mọi mức thu phóng. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Hút đầu mút của đoạn thẳng, hoặc hình tròn vẽ từ tâm, để nó chạm vào một đường cong ở gần. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Hút đầu mút của đoạn thẳng để nó gặp một đoạn thẳng ở gần theo góc vuông. + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. Hiển thị trên khung vẽ số của mỗi lát cắt trong một ô ở góc trên bên trái của nó; khi tắt, đường viền của các lát cắt vẫn hiện. + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. Màu của đường viền lát cắt người dùng và lát cắt đối tượng cùng các ô số của chúng; lát cắt tự động dùng một sắc độ nhạt hơn của màu này. Reset all preferences to their defaults? Đặt lại tất cả tùy chọn về mặc định? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Giá trị mặc định được áp dụng khi bạn nhấn OK trong Tùy chọn. Hủy ở đó giữ nguyên các tùy chọn hiện tại của bạn. Restore Recovered Documents Khôi phục tài liệu đã phục hồi diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index c6696a9ec6..c02b0dbc5e 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3056,6 +3056,8 @@ digits Malayalam 马拉雅拉姆数字 How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. 指针或拖动的点在屏幕上需离图稿多近,智能参考线才会吸附;该距离在任何缩放比例下都相同。 Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. 吸附线段的端点或从中心绘制的圆,使其与附近的曲线相切。 Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. 吸附线段的端点,使其与附近的直线段成直角相交。 + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. 在画布上于每个切片左上角的方框中显示其编号;关闭时,切片轮廓仍会显示。 + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. 用户切片和对象切片的轮廓及其编号方框的颜色;自动切片使用此颜色较淡的色调。 Reset all preferences to their defaults? 将所有首选项重置为默认值? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. 在首选项中点击确定后才会应用默认值。在那里点击取消会保留当前首选项。 Restore Recovered Documents 恢复已恢复的文档 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 1480422931..823960e847 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4340,6 +4340,8 @@ digits Malayalam 馬來亞拉姆數字 How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. 指標或拖曳的點在螢幕上需離圖稿多近,智慧型參考線才會靠齊;此距離在任何縮放比例下都相同。 Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. 靠齊線段的端點或從中心繪製的圓,使其與附近的曲線相切。 Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. 靠齊線段的端點,使其與附近的直線段成直角相交。 + Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show. 在畫布上於每個切片左上角的方框中顯示其編號;關閉時,切片輪廓仍會顯示。 + The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it. 使用者切片和物件切片的輪廓及其編號方框的顏色;自動切片使用此顏色較淡的色調。 Reset all preferences to their defaults? 要將所有偏好設定重設為預設值嗎? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. 在偏好設定中按下確定後才會套用預設值。在那裡按下取消會保留目前的偏好設定。 Restore Recovered Documents 還原找回的文件 diff --git a/crates/ui-egui/src/prefs_dialog/descriptions.rs b/crates/ui-egui/src/prefs_dialog/descriptions.rs index eb8156f8dd..dd03a4de89 100644 --- a/crates/ui-egui/src/prefs_dialog/descriptions.rs +++ b/crates/ui-egui/src/prefs_dialog/descriptions.rs @@ -160,6 +160,9 @@ pub(crate) const DESCRIPTIONS: &[(&str, &str)] = &[ ), ("snapTangent", "Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve."), ("snapPerpendicular", "Snaps the end of a line segment so that it meets a nearby straight segment at a right angle."), + // Slices + ("showSliceNumbers", "Shows each slice's number in a box at its top left on the canvas; off, the slice outlines still show."), + ("sliceLineColor", "The color of user and object slice outlines and their number boxes; auto slices use a dimmer shade of it."), ]; /// The sentence that describes the setting `key`, in English, or `None` when it has none yet. diff --git a/crates/ui-egui/src/prefs_dialog/tests.rs b/crates/ui-egui/src/prefs_dialog/tests.rs index f7c676d441..fee3746078 100644 --- a/crates/ui-egui/src/prefs_dialog/tests.rs +++ b/crates/ui-egui/src/prefs_dialog/tests.rs @@ -1798,12 +1798,13 @@ fn a_row_without_a_description_leaves_the_line_empty() { assert_eq!(preferences_window(&ctx).size(), size); } -/// Every setting the General, Selection & Anchor Display, Guides & Grid and Smart Guides categories -/// show, the Smart Guides box included, has exactly one sentence, and no key has two. +/// Every setting the General, Selection & Anchor Display, Guides & Grid, Smart Guides and Slices +/// categories show, the Smart Guides box included, has exactly one sentence, and no key has two. #[test] -fn every_general_selection_guides_and_smart_guides_setting_has_one_description() { +fn every_general_selection_guides_smart_guides_and_slices_setting_has_one_description() { let mut bad = vec![]; - for s in settings().filter(|s| ["General", "Selection & Anchor Display", "Guides & Grid", "Smart Guides"].contains(&s.category)) { + let categories = ["General", "Selection & Anchor Display", "Guides & Grid", "Smart Guides", "Slices"]; + for s in settings().filter(|s| categories.contains(&s.category)) { match descriptions::DESCRIPTIONS.iter().filter(|(k, _)| *k == s.key).count() { 1 => {} n => bad.push(format!("`{}` ({}) has {n} sentences", s.key, s.label)), @@ -2019,6 +2020,53 @@ fn keyboard_focus_on_a_smart_guides_row_shows_its_description() { assert!(described.iter().any(|d| d == smart), "the focused control carries the sentence: {described:?}"); } +/// The pointer over Slices' Show Slice Numbers row and over its Line Color row shows each row's +/// sentence. +#[test] +fn hovering_a_slices_row_shows_its_description() { + let mut a = app(); + open(&mut a, Some("Slices")); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + description_frame(&mut a, &ctx, vec![]); + let (texts, _) = description_frame(&mut a, &ctx, vec![]); + let row = |texts: &[(String, egui::Rect)], label: &str| { + texts.iter().find(|(t, _)| t == label).map(|(_, r)| r.center()).unwrap_or_else(|| panic!("no `{label}` in {texts:?}")) + }; + let numbers = descriptions::description("showSliceNumbers").expect("Show Slice Numbers has a sentence"); + let color = descriptions::description("sliceLineColor").expect("Line Color has a sentence"); + description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(row(&texts, "Show Slice Numbers"))]); + let (after, _) = description_frame(&mut a, &ctx, vec![]); + assert!(painted(&after, numbers) && !painted(&after, color), "the Show Slice Numbers row's sentence shows: {after:?}"); + description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(row(&texts, "Line Color:"))]); + let (after, _) = description_frame(&mut a, &ctx, vec![]); + assert!(painted(&after, color) && !painted(&after, numbers), "the Line Color row's sentence shows: {after:?}"); +} + +/// Tab from the search field reaches Slices' first control, the Show Slice Numbers box: the line +/// shows its sentence and a screen reader gets it as the control's description. +#[test] +fn keyboard_focus_on_a_slices_row_shows_its_description() { + let mut a = app(); + open(&mut a, Some("Slices")); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + description_frame(&mut a, &ctx, vec![]); + description_frame(&mut a, &ctx, vec![]); + let numbers = descriptions::description("showSliceNumbers").expect("Show Slice Numbers has a sentence"); + let mut shown = None; + for _ in 0..40 { + let (texts, described) = description_frame(&mut a, &ctx, key_press(egui::Key::Tab, egui::Modifiers::NONE)); + if painted(&texts, numbers) { + shown = Some(described); + break; + } + } + let described = shown.expect("Tab reaches the Show Slice Numbers row and its sentence shows"); + assert!(described.iter().any(|d| d == numbers), "the focused control carries the sentence: {described:?}"); +} + /// A sentence shown when the dialog closed does not come back when it opens again with the /// pointer away from the rows. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e9fc9a6820..353d3a49cf 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -282,7 +282,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Export for Screens, Asset Export, slices, Save for Web | 3 | 85% | anti-aliasing ghost borders (#983); TIFF choices and settings are implemented | 2–4 | estimated | | Print, colour management, separations, flattener | 3 | 80% | print preview fidelity | 2–4 | estimated | | Automation (Actions, Variables, scripting, batch) | 3 | 60% | a scripting surface (Illustrator: JavaScript/ExtendScript), Batch, image and graph variables, dataset import/export | 8–14 | estimated; MCP `add_text` exposes existing vertical type; score and hours unchanged | -| UI chrome (panels, Properties, workspaces, preferences) | 6 | 80% | Properties per context, 2 Preferences options stored but unused (#394, audited 2026-10-30: Scratch Disks, legacy vector clipboard), context menus in the panels that have none, accessibility | 13–20 | estimated; floating panels in OS windows of their own on the desktop (#4135), score and hours unchanged; macOS save Format menu implemented (#866), score and hours unchanged; Eyedropper cursor and precise setting checked (#1269), OS visual QA unverified; the line under the Preferences fields describes each General, Selection & Anchor Display, Guides & Grid and Smart Guides setting on hover and keyboard focus (#8199, #8223, #8248), score and hours unchanged; numeric-field focus and normal text drags regression-tested (#1326); a focus click released more than 1 pt from its press keeps the caret and a tap within 1 pt selects all (#6659); artboard navigation synchronizes the tool selection before destructive actions; status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates (sample widths cached by language/unit/DPI; regression and contributor original-file evidence below; scores/hours unchanged); effect dialogs' colour fields show a swatch that opens the Color Picker (#5365), score and hours unchanged; icon-strip flyouts retain user sizes (#5713); floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), scores and hours unchanged ; interim macOS cursor delivery (#2292), headless coverage only; native validation pending, score and hours unchanged; Swatches item context menus have focused regressions and rendered-layout evidence below; scores and estimates unchanged | +| UI chrome (panels, Properties, workspaces, preferences) | 6 | 80% | Properties per context, 2 Preferences options stored but unused (#394, audited 2026-10-30: Scratch Disks, legacy vector clipboard), context menus in the panels that have none, accessibility | 13–20 | estimated; floating panels in OS windows of their own on the desktop (#4135), score and hours unchanged; macOS save Format menu implemented (#866), score and hours unchanged; Eyedropper cursor and precise setting checked (#1269), OS visual QA unverified; the line under the Preferences fields describes each General, Selection & Anchor Display, Guides & Grid, Smart Guides and Slices setting on hover and keyboard focus (#8199, #8223, #8248, #8264), score and hours unchanged; numeric-field focus and normal text drags regression-tested (#1326); a focus click released more than 1 pt from its press keeps the caret and a tap within 1 pt selects all (#6659); artboard navigation synchronizes the tool selection before destructive actions; status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates (sample widths cached by language/unit/DPI; regression and contributor original-file evidence below; scores/hours unchanged); effect dialogs' colour fields show a swatch that opens the Color Picker (#5365), score and hours unchanged; icon-strip flyouts retain user sizes (#5713); floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), scores and hours unchanged ; interim macOS cursor delivery (#2292), headless coverage only; native validation pending, score and hours unchanged; Swatches item context menus have focused regressions and rendered-layout evidence below; scores and estimates unchanged | | Libraries, Links, Package | 2 | 82% | shared libraries, linked graphics, gradients and patterns as library items (no cloud by design) | 2–3 | estimated | | Generative AI (Text to Vector, Generative Recolor, Shape Fill, Concept to Vector, Prompt to Edit, Rewrite Text) | 2 | 0% | a pluggable provider and the panels; needs an owner decision on models | 30–60 | measured (absent) | | **Feature depth** | **105** | **~75%** | | **~250–420** | | @@ -801,7 +801,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Preferences › General describes its settings:** the line under the Preferences fields shows a sentence for each of the 32 General settings, Enable Contextual Task Bar included, when the pointer is over the setting's row or its control has the keyboard focus, and a screen reader gets the same sentence. The sentences are VectorCraft's own and state what the app does with each setting. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Selection & Anchor Display describes its settings:** the line under the Preferences fields shows a sentence for each of the 14 Selection & Anchor Display settings, from Tolerance to the Curvature Tool rubber band, on hover and on keyboard focus, and a screen reader gets the same sentence. The Snap to Point sentence states that the Smart Guides Snapping Tolerance applies while Smart Guides is on. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Guides & Grid describes its settings:** the line under the Preferences fields shows a sentence for each of the 12 Guides & Grid settings, from Snap to Grid to Pattern Editing's Tile Edge Color, on hover and on keyboard focus, and a screen reader gets the same sentence. The Show Pixel Grid sentence states that the pixel grid shows from 600% zoom. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. -- **Preferences › Smart Guides describes its settings:** the line under the Preferences fields shows a sentence for the Smart Guides box and for each of the 14 Smart Guides settings, from Color to Snap to Perpendicular, on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: Pixel Preview turns Smart Guides off and Snap to Grid snaps instead; with Alignment Guides off, art still lines up without the line; Object Highlighting outlines only an unselected object while a selection tool is not dragging; Snapping Tolerance is a distance on screen at every zoom; Snap to Last Location does not return a copy. Units, General, Selection & Anchor Display, Guides & Grid and Smart Guides have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. +- **Preferences › Smart Guides describes its settings:** the line under the Preferences fields shows a sentence for the Smart Guides box and for each of the 14 Smart Guides settings, from Color to Snap to Perpendicular, on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: Pixel Preview turns Smart Guides off and Snap to Grid snaps instead; with Alignment Guides off, art still lines up without the line; Object Highlighting outlines only an unselected object while a selection tool is not dragging; Snapping Tolerance is a distance on screen at every zoom; Snap to Last Location does not return a copy. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. +- **Preferences › Slices describes its settings:** the line under the Preferences fields shows a sentence for Show Slice Numbers and for Line Color on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: each slice's number shows in a box at its top left on the canvas, the slice outlines still show with numbers off, and auto slices use a dimmer shade of the line color. Units, General, Selection & Anchor Display, Guides & Grid, Smart Guides and Slices have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Window › New Window (G7, #4116):** New Window (`window.newWindow`) opens another view of the current document ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html) describes showing one document in several windows at once), with its own zoom, center, rotation, artboard and Outline or Preview, as a tab of its own; an edit in one view shows in every view. Tile, Cascade, Float in Window, Float All in Windows and Consolidate All Windows arrange each view as they arrange a document, and Next and Previous Document step through the views. Closing a view leaves the document open; closing its last view closes the document, asking to save it first. The view's number after the name in its tab ("Name:2", while the document has more than one view) is VectorCraft's own. Tests: `crates/ui-egui/src/doc_windows/tests.rs`. - **Document Setup modal handoff:** Document Setup → Edit Artboards applies valid settings, closes the dialog and activates the Artboard tool. Pointer-click tests cover successful handoff, invalid settings, OK, Cancel and Undo in `dialogs/document_setup.rs`. From 70545c5e2ba5f993d1f369c42e11d8079409433e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 09:57:06 -0800 Subject: [PATCH 059/158] Shapes: a very long side widget drag stops at 3 or 11 sides without overflowing sides_after adds the drag steps with saturating arithmetic, so a drag to an extreme coordinate gives 3 or 11 sides instead of an overflow. A drag whose distance is too long to measure keeps its direction and also stops at 3 or 11, and a pointer position that is not finite leaves the count and the readout as they were. --- crates/tools/src/sidewidget.rs | 56 ++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-) diff --git a/crates/tools/src/sidewidget.rs b/crates/tools/src/sidewidget.rs index 5d338856a7..240fc5a706 100644 --- a/crates/tools/src/sidewidget.rs +++ b/crates/tools/src/sidewidget.rs @@ -80,11 +80,11 @@ pub fn over_widget(cx: &ToolContext, p: Point) -> bool { pub fn sides_after(from: u32, steps: i64) -> u32 { let (min, max) = (i64::from(MIN_SIDES), i64::from(MAX_SIDES)); let to = if from <= MAX_SIDES { - i64::from(from) + steps + i64::from(from).saturating_add(steps) } else if steps >= 0 { return from; } else { - max + 1 + steps + (max + 1).saturating_add(steps) }; to.clamp(min, max) as u32 } @@ -116,7 +116,12 @@ impl SideDrag { Some(Self { widget, bx, start: ev.pos, moved: false, began: false, sides: widget.sides, at: ev.pos }) } + /// A pointer position that is not finite leaves the count and the readout as they are. A drag + /// too long to measure counts as the most steps in its direction. pub fn drag(&mut self, cx: &ToolContext, p: Point) -> Vec { + if !p.x.is_finite() || !p.y.is_finite() { + return vec![]; + } self.at = p; if !self.moved { if p.distance(self.start) < cx.tol(3.0) { @@ -126,7 +131,11 @@ impl SideDrag { } let down = (self.bx.to_local(p).y - self.bx.to_local(self.start).y) * cx.zoom; let steps = (down / STEP_PX).trunc(); - let sides = sides_after(self.widget.sides, if steps.is_finite() { steps as i64 } else { 0 }); + if steps.is_nan() { + return vec![]; + } + // The cast saturates: an infinite count of steps becomes i64::MAX or i64::MIN. + let sides = sides_after(self.widget.sides, steps as i64); if sides == self.sides { return vec![]; } @@ -213,6 +222,47 @@ mod tests { assert_eq!(sides_after(1000, -100), 3); } + #[test] + fn the_longest_drags_stay_within_three_and_eleven() { + assert_eq!(sides_after(5, i64::MAX), 11); + assert_eq!(sides_after(5, i64::MIN), 3); + assert_eq!(sides_after(3, i64::MAX), 11); + assert_eq!(sides_after(11, i64::MAX), 11); + assert_eq!(sides_after(11, i64::MIN), 3); + assert_eq!(sides_after(40, i64::MAX), 40); + assert_eq!(sides_after(40, i64::MIN), 3); + } + + /// A drag far past the document, even one too long to measure, stops at 11 down and 3 up; a + /// pointer position that is not finite keeps the count it had. + #[test] + fn a_huge_or_invalid_drag_stays_within_three_and_eleven() { + let (d, _, s) = polygon_doc(5, Affine::translate((300.0, 300.0))); + let p = paint(); + // At zoom 1 the step count is finite and past i64; at zoom 4 the distance itself is infinite. + for zoom in [1.0, 4.0] { + let c = ToolContext { zoom, ..cx(&d, &s, &p) }; + let (w, _) = SideWidget::for_tool(&c).unwrap(); + let far = |y: f64| Point::new(w.at.x, y); + let mut t = SelectionTool::default(); + t.pointer(&c, &ev(PointerKind::Down, w.at)); + assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, far(1e308)))), [11], "zoom {zoom}"); + assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, far(-1e308)))), [3], "zoom {zoom}"); + assert_eq!(t.pointer(&c, &ev(PointerKind::Up, far(-1e308))), vec![Action::Commit]); + } + let c = cx(&d, &s, &p); + let (w, _) = SideWidget::for_tool(&c).unwrap(); + let mut t = SelectionTool::default(); + t.pointer(&c, &ev(PointerKind::Down, w.at)); + let shown = w.at + vectorcraft_geom::Vec2::new(0.0, 24.0); + assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, shown))), [7]); + for bad in [Point::new(f64::NAN, w.at.y), Point::new(w.at.x, f64::INFINITY), Point::new(w.at.x, f64::NEG_INFINITY)] { + assert!(t.pointer(&c, &ev(PointerKind::Drag, bad)).is_empty(), "{bad:?}"); + } + assert!(t.overlays(&c).iter().any(|o| matches!(o, Overlay::Measure { p, text } if *p == shown && text == "Sides: 7"))); + assert_eq!(t.pointer(&c, &ev(PointerKind::Up, shown)), vec![Action::Commit]); + } + /// The widget sits 16 px right of the middle of the box's right side, at any zoom; only one /// whole editable live polygon shows it. #[test] From f0d4abcdcca8c56fddc58a609148a6e42f910acd Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 10:07:22 -0800 Subject: [PATCH 060/158] Live Paint: paths in a Live Paint group can't take the names Face and Edge A path directly in a Live Paint group named Face or Edge is taken for one of the group's faces or edges, so the next rebuild (Merge, Gap Options, a path dragged in or out, leaving isolation mode) drops it. layer.setProps and object.setProps now return an error when they would give either name to a path in the group that does not have it already, and a path pasted directly into the group under either name is pasted without its name. --- crates/engine/src/cmd/buildcmds.rs | 2 +- crates/engine/src/cmd/buildcmds/live_paint.rs | 38 +++++++++++ crates/engine/src/cmd/edit.rs | 1 + crates/engine/src/cmd/layer.rs | 6 +- crates/engine/src/cmd/object/commands.rs | 2 +- crates/engine/src/cmd/object/props.rs | 3 + crates/engine/src/tests/build.rs | 67 +++++++++++++++++++ crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + docs/mcp.md | 4 +- 32 files changed, 143 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/buildcmds.rs b/crates/engine/src/cmd/buildcmds.rs index f72c7d4ebb..0f7cac48fb 100644 --- a/crates/engine/src/cmd/buildcmds.rs +++ b/crates/engine/src/cmd/buildcmds.rs @@ -38,7 +38,7 @@ mod shape_builder; mod trace; pub use live_paint::live_paint_gaps; -pub(crate) use live_paint::{LivePaintMove, isolated_live_paint, merge_drawn_in_isolation}; +pub(crate) use live_paint::{LivePaintMove, check_part_name, clear_part_name, isolated_live_paint, merge_drawn_in_isolation}; use live_paint::{lp_expand, lp_fill, lp_gap_options, lp_info, lp_make, lp_merge, lp_release, lp_stroke_edge}; use shape_builder::{sb_merge, sb_regions}; pub(crate) use trace::TracePresetChanges; diff --git a/crates/engine/src/cmd/buildcmds/live_paint.rs b/crates/engine/src/cmd/buildcmds/live_paint.rs index 502e5fb0ad..776f5f11b7 100644 --- a/crates/engine/src/cmd/buildcmds/live_paint.rs +++ b/crates/engine/src/cmd/buildcmds/live_paint.rs @@ -74,6 +74,44 @@ fn set_parts(g: &mut Node, mut parts: Vec>, gone: &[NodeId]) { } } +/// Whether a path named `name` directly in a Live Paint group is one of its faces or edges: the +/// name is [`FACE_NAME`] or [`EDGE_NAME`]. +fn part_name(name: Option<&str>) -> bool { + matches!(name, Some(FACE_NAME | EDGE_NAME)) +} + +/// Whether `n` is a path whose parent `parent` is a Live Paint group. +fn path_in_live_paint(d: &Document, parent: Option, n: &Node) -> bool { + n.path_data().is_some() && parent.and_then(|p| d.node(p)).is_some_and(is_live_paint) +} + +/// Clear the name of `n`, put directly in `parent`, when it is a path named like a face or an edge +/// ([`part_name`]) and `parent` is a Live Paint group, so that the group's other children +/// ([`others_in`]) keep it when its faces and edges are made again. Paste uses it. +pub(crate) fn clear_part_name(d: &Document, parent: Option, n: &mut Node) { + if part_name(n.name.as_deref()) && path_in_live_paint(d, parent, n) { + n.name = None; + } +} + +/// Refuse naming rows `ids` `name` when it is the name of a face or an edge ([`part_name`]) and one +/// of them is a path directly in a Live Paint group that is not named `name` already. Checked +/// before anything changes. +pub(crate) fn check_part_name(d: &Document, ids: &[NodeId], name: &str) -> Result<()> { + if !part_name(Some(name)) { + return Ok(()); + } + for id in ids { + if let Some(n) = d.node(*id) + && n.name.as_deref() != Some(name) + && path_in_live_paint(d, d.parent_of(*id), n) + { + return Err(EngineError::Other("`Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name".into())); + } + } + Ok(()) +} + /// Select `ids` alone, without an undo step, when they are not selected that way already. fn select_only(s: &mut Session, ids: &[NodeId]) -> Result<()> { let st = s.doc()?; diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index fbf5deb568..e73bd65563 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -1533,6 +1533,7 @@ fn paste_clip(s: &mut Session, p: &Value, mode: PasteMode, clip: &Clipboard, cho } } else { super::object::keep_pixel_aligned(&mut c, sc); + super::buildcmds::clear_part_name(d, par, &mut c); new_ids.push(d.insert(par, idx, c)?); } } diff --git a/crates/engine/src/cmd/layer.rs b/crates/engine/src/cmd/layer.rs index ae3d1fc5e1..134759a0d4 100644 --- a/crates/engine/src/cmd/layer.rs +++ b/crates/engine/src/cmd/layer.rs @@ -84,7 +84,7 @@ pub fn specs() -> Vec { "Layer Options…", ["Window", "Layers"], None, - "{ids?|id? (default: the highlighted rows, else the current layer), name? (with prefs.identifyObjectsBy xmlId: a valid XML ID, stored as the object name), visible?, locked?, template?, printable?, preview?, dimImages?: 0..100|false, color?: index 0..26|\"#rrggbb\"|preset name (a hex color with an alpha part, #rrggbbaa or #rgba, is an error)} Layer Options; rows that are not layers take name, visible and locked, and `ids` may name ruler guides (their `guide.list` id), which hide or lock on their own. Template on also locks the layer and dims its images to 50% (unless given); off unlocks it and stops dimming. One undo step", + "{ids?|id? (default: the highlighted rows, else the current layer), name? (with prefs.identifyObjectsBy xmlId: a valid XML ID, stored as the object name), visible?, locked?, template?, printable?, preview?, dimImages?: 0..100|false, color?: index 0..26|\"#rrggbb\"|preset name (a hex color with an alpha part, #rrggbbaa or #rgba, is an error)} Layer Options; rows that are not layers take name, visible and locked, and `ids` may name ruler guides (their `guide.list` id), which hide or lock on their own. Template on also locks the layer and dims its images to 50% (unless given); off unlocks it and stops dimming. A path directly in a Live Paint group can't take the name Face or Edge, which name the group's faces and edges, unless it has it already. One undo step", has_doc, set_props ), @@ -649,6 +649,10 @@ fn set_props(s: &mut Session, p: &Value) -> Result { if ids.is_empty() { return Err(bad(C, "no rows")); } + if let Some(v) = str_param(p, "name").filter(|v| !v.trim().is_empty()) { + let name = if xml_id { vectorcraft_doc::xml_id::to_object_name(v) } else { v.to_string() }; + super::buildcmds::check_part_name(&s.doc()?.doc, &ids, &name)?; + } s.edit("Layer Options", |d, sel| { for id in &ids { apply_options(d.node_mut(*id).ok_or(EngineError::NoNode(*id))?, p, xml_id); diff --git a/crates/engine/src/cmd/object/commands.rs b/crates/engine/src/cmd/object/commands.rs index 7b6f0fe783..fe9c3dd533 100644 --- a/crates/engine/src/cmd/object/commands.rs +++ b/crates/engine/src/cmd/object/commands.rs @@ -259,7 +259,7 @@ pub fn specs() -> Vec { "Object Properties", [], None, - "{ids?|id?, name?, visible?, locked? (visible: false or locked: true deselects every selected object hidden or locked after the call, the key object included), opacity?: 0..100, blend?: \"Multiply\"…, isolate?, knockout?: \"on\"|\"off\"|\"neutral\"|bool (true = on, false = neutral), knockoutShape?: bool, data?: {key: \"value\" | null (removes it)} (the object's own data, SVG data-* attributes: {pivot: \"100,180\"} is data-pivot; document.node → attrs.data)}. On a path directly in a graph series, the graph also stores the object's opacity and blend mode, and on a series group the group's opacity, blend mode, isolate, knockout and knockoutShape (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring, the graph stores that object's opacity and blend mode for every label or line of its kind", + "{ids?|id?, name?, visible?, locked? (visible: false or locked: true deselects every selected object hidden or locked after the call, the key object included), opacity?: 0..100, blend?: \"Multiply\"…, isolate?, knockout?: \"on\"|\"off\"|\"neutral\"|bool (true = on, false = neutral), knockoutShape?: bool, data?: {key: \"value\" | null (removes it)} (the object's own data, SVG data-* attributes: {pivot: \"100,180\"} is data-pivot; document.node → attrs.data)}. On a path directly in a graph series, the graph also stores the object's opacity and blend mode, and on a series group the group's opacity, blend mode, isolate, knockout and knockoutShape (exceptions: docs/mcp.md); on a graph label, or a graph's axis line, tick mark or radar ring, the graph stores that object's opacity and blend mode for every label or line of its kind. A path directly in a Live Paint group can't take the name Face or Edge, which name the group's faces and edges, unless it has it already", has_doc, set_props ), diff --git a/crates/engine/src/cmd/object/props.rs b/crates/engine/src/cmd/object/props.rs index 54ad23eb2f..f576435fe0 100644 --- a/crates/engine/src/cmd/object/props.rs +++ b/crates/engine/src/cmd/object/props.rs @@ -65,6 +65,9 @@ pub(super) fn set_props(s: &mut Session, p: &Value) -> Result { }) }; let d = &s.doc()?.doc; + if let Some(v) = str_param(p, "name") { + crate::cmd::buildcmds::check_part_name(d, &ids, v)?; + } // A graph keeps the object opacity and blend mode set on a mark of a series for the whole series, and set on a label // for its kind of label, so a value a mark or label already has still replaces the one another left on the graph. let transparency = opacity.is_some() || blend.is_some(); diff --git a/crates/engine/src/tests/build.rs b/crates/engine/src/tests/build.rs index 5e84f0d99e..0a53b659d0 100644 --- a/crates/engine/src/tests/build.rs +++ b/crates/engine/src/tests/build.rs @@ -4964,6 +4964,73 @@ fn live_paint_does_not_count_art_named_like_its_parts() { } } +/// A path drawn in an isolated Live Paint group can't be named Face or Edge, the names of the +/// group's faces and edges: `object.setProps` and `layer.setProps` return an error and rename +/// nothing, so Gap Options and a path dragged into the group keep the path. A face keeps its name. +#[test] +fn live_paint_refuses_part_names_for_paths_drawn_in_it() { + use vectorcraft_tools::builder::{EDGE_NAME, FACE_NAME, faces}; + let mut s = session(); + let g = live(&mut s); + let face = faces(&node(&s, g))[0].id; + s.execute("object.isolate", &json!({"id": g.0})).unwrap(); + let a = line_across(&mut s, 50.0); + // Hidden, the path stays in the group as drawn when isolation mode ends. + s.execute("object.setProps", &json!({"id": a.0, "visible": false})).unwrap(); + let before = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()); + for name in [FACE_NAME, EDGE_NAME] { + let calls = [ + ("object.setProps", json!({"id": a.0, "name": name})), + ("layer.setProps", json!({"id": a.0, "name": name})), + ("layer.setProps", json!({"ids": [face.0, a.0], "name": name})), + ]; + for (c, p) in calls { + let err = s.execute(c, &p).unwrap_err().to_string(); + assert!(err.contains("give the path another name"), "{c} {p}: {err}"); + } + } + assert!(s.doc().unwrap().doc == before.0, "nothing was renamed"); + assert_eq!(s.doc().unwrap().history.undo.len(), before.1); + s.execute("layer.setProps", &json!({"id": face.0, "name": FACE_NAME})).unwrap(); + s.execute("object.exitIsolation", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(g), "the hidden path stays in the group"); + s.execute("livePaint.gapOptions", &json!({"ids": [g.0], "detect": true})).unwrap(); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(g), "Gap Options keeps the path"); + let b = line_to_right_face(&mut s, 30.0); + s.execute("layer.move", &json!({"ids": [b.0], "target": g.0, "place": "inside"})).unwrap(); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(g), "a path dragged in keeps it"); + assert_eq!(faces(&node(&s, g)).len(), 5); +} + +/// A path pasted into an isolated Live Paint group under the name of a face or an edge loses the +/// name, so Gap Options keeps it and it joins the group's paths when isolation mode ends. +#[test] +fn live_paint_paste_clears_part_names() { + use vectorcraft_tools::builder::{EDGE_NAME, FACE_NAME, faces, sources}; + for name in [FACE_NAME, EDGE_NAME] { + let mut s = session(); + let g = live(&mut s); + let r = rect(&mut s, 20.0, 40.0, 60.0, 20.0); + s.execute("object.setProps", &json!({"id": r.0, "name": name})).unwrap(); + s.execute("select.set", &json!({"ids": [r.0]})).unwrap(); + s.execute("edit.copy", &json!({})).unwrap(); + s.execute("object.isolate", &json!({"id": g.0})).unwrap(); + s.execute("edit.pasteInPlace", &json!({})).unwrap(); + let pasted = s.doc().unwrap().selection.objects.clone(); + assert_eq!(pasted.len(), 1); + let d = &s.doc().unwrap().doc; + assert_eq!(d.parent_of(pasted[0]), Some(g), "{name}: the paste goes into the group"); + assert_eq!(d.node(pasted[0]).unwrap().name, None, "{name}: the paste loses the name"); + assert_eq!(d.node(r).unwrap().name.as_deref(), Some(name), "the path outside keeps its name"); + s.execute("livePaint.gapOptions", &json!({"ids": [g.0], "detect": true})).unwrap(); + assert_eq!(s.doc().unwrap().doc.parent_of(pasted[0]), Some(g), "{name}: Gap Options keeps the paste"); + s.execute("object.exitIsolation", &json!({})).unwrap(); + let n = node(&s, g); + assert_eq!(s.doc().unwrap().doc.parent_of(pasted[0]), Some(sources(&n).unwrap().id), "{name}: the paste joined"); + assert!(faces(&n).len() > 3); + } +} + /// With Real-time Drawing and Editing off, a rectangle still being drawn in a Live Paint group /// isolated in a pattern tile is drawn first when Exit Isolation Mode leaves pattern editing, and /// joins the group with the tile saved. diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index c54311799d..3a5d7f83a3 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -6111,6 +6111,7 @@ liquify-list-end {0}, {1} {0} i {1} @msg type used as a mask in linked areas, wraparound text or a compound path doesn't clip el text usat com a màscara en àrees enllaçades, en text ajustat o en un traçat compost no retalla @msg linked pictures with no preview in the file show a placeholder until their files are found: relink them in the Links panel les imatges enllaçades sense previsualització al fitxer mostren un marcador de posició fins que es trobin els seus fitxers: torneu-les a enllaçar al panell Enllaços @msg Live Paint Merge: select a Live Paint group and the paths to add Fusió de pintura interactiva: seleccioneu un grup de pintura interactiva i els traçats que voleu afegir +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` i `Edge` són els noms de les cares i les arestes d’un grup de pintura interactiva: doneu un altre nom al traçat @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first La pintura interactiva accepta traçats i traçats compostos: convertiu abans el text, les imatges i altres objectes a traçats @msg Live Paint: select paths or compound paths Pintura interactiva: seleccioneu traçats o traçats compostos @msg Live Paint: these paths are too degenerate to paint Pintura interactiva: aquests traçats són massa degenerats per pintar-los diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index a5d7bb948a..32c47148a7 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -5050,6 +5050,7 @@ liquify-list-end {0}, {1} {0} a {1} @msg Installed plug-in {_1} Nainstalován zásuvný modul {_1} @msg Internal error: {msg} (please report this bug) Vnitřní chyba: {msg} (nahlaste prosím tuto chybu) @msg Live Paint Merge: select a Live Paint group and the paths to add Sloučit živou malbu: vyberte skupinu živé malby a cesty, které chcete přidat +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` a `Edge` jsou názvy ploch a hran skupiny živé malby: dejte cestě jiný název @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Živá malba přijímá cesty a složené cesty: text, obrazy a jiné objekty nejprve převeďte na cesty @msg Live Paint: select paths or compound paths Živá malba: vyberte cesty nebo složené cesty @msg Live Paint: these paths are too degenerate to paint Živá malba: tyto cesty jsou příliš degenerované, aby je bylo možné malovat diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 08100f593f..29376d72b8 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -7286,6 +7286,7 @@ imageTrace Outline Kontur @msg Installed plug-in {_1} Installerede plug-in'en {_1} @msg Internal error: {msg} (please report this bug) Intern fejl: {msg} (meld venligst denne fejl) @msg Live Paint Merge: select a Live Paint group and the paths to add Live Paint-fletning: markér en Live Paint-gruppe og de kurver, der skal tilføjes +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` og `Edge` er navnene på fladerne og kanterne i en Live Paint-gruppe: giv kurven et andet navn @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Live Paint tager kurver og sammensatte kurver: konvertér først tekst, billeder og andre objekter til kurver @msg Live Paint: select paths or compound paths Live Paint: markér kurver eller sammensatte kurver @msg Live Paint: these paths are too degenerate to paint Live Paint: disse kurver er for degenererede til at blive malet diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 10147b2d45..4336d5785e 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -4650,6 +4650,7 @@ liquify-list-end {0}, {1} {0} und {1} @msg Installed plug-in {_1} Plug-in {_1} installiert @msg Internal error: {msg} (please report this bug) Interner Fehler: {msg} (bitte melden Sie diesen Fehler) @msg Live Paint Merge: select a Live Paint group and the paths to add Interaktiv malen – Zusammenfügen: Wählen Sie eine Interaktiv-malen-Gruppe und die hinzuzufügenden Pfade aus +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` und `Edge` benennen die Teilflächen und Kanten einer Interaktiv-malen-Gruppe: Geben Sie dem Pfad einen anderen Namen @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Interaktiv malen nimmt Pfade und zusammengesetzte Pfade an: Wandeln Sie Text, Bilder und andere Objekte zuerst in Pfade um @msg Live Paint: select paths or compound paths Interaktiv malen: Wählen Sie Pfade oder zusammengesetzte Pfade aus @msg Live Paint: these paths are too degenerate to paint Interaktiv malen: Diese Pfade sind zu entartet, um sie zu bemalen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 1ebf6e5684..06fb063092 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -2649,6 +2649,7 @@ liquify-list-end {0}, {1} {0} και {1} @msg Installed plug-in {_1} Εγκαταστάθηκε η επέκταση {_1} @msg Internal error: {msg} (please report this bug) Εσωτερικό σφάλμα: {msg} (παρακαλούμε αναφέρετε αυτό το σφάλμα) @msg Live Paint Merge: select a Live Paint group and the paths to add Συγχώνευση δυναμικής βαφής: επιλέξτε ομάδα δυναμικής βαφής και τις διαδρομές προς προσθήκη +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name Τα `Face` και `Edge` ονομάζουν τις επιφάνειες και τις ακμές μιας ομάδας δυναμικής βαφής: δώστε άλλο όνομα στη διαδρομή @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Η δυναμική βαφή δέχεται διαδρομές και σύνθετες διαδρομές: μετατρέψτε πρώτα κείμενο, εικόνες και άλλα αντικείμενα σε διαδρομές @msg Live Paint: select paths or compound paths Δυναμική βαφή: επιλέξτε διαδρομές ή σύνθετες διαδρομές @msg Live Paint: these paths are too degenerate to paint Δυναμική βαφή: αυτές οι διαδρομές είναι πολύ εκφυλισμένες για να χρωματιστούν diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index a456910a16..b8daf21a88 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4754,6 +4754,7 @@ liquify-list-end {0}, {1} {0}, {1} @msg Installed plug-in {_1} Se instaló el plugin {_1} @msg Internal error: {msg} (please report this bug) Error interno: {msg} (por favor, informa de este error) @msg Live Paint Merge: select a Live Paint group and the paths to add Combinar pintura interactiva: selecciona un grupo de pintura interactiva y los trazados que quieres agregar +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` y `Edge` son los nombres de las caras y los bordes de un grupo de pintura interactiva: ponle otro nombre al trazado @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first La pintura interactiva admite trazados y trazados compuestos: convierte primero el texto, las imágenes y otros objetos en trazados @msg Live Paint: select paths or compound paths Pintura interactiva: selecciona trazados o trazados compuestos @msg Live Paint: these paths are too degenerate to paint Pintura interactiva: estos trazados están demasiado degenerados para pintarlos diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index bff46fc0d7..4cadcfc6c8 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4987,6 +4987,7 @@ liquify-list-end {0}, {1} {0} ja {1} @msg Installed plug-in {_1} Asennettiin laajennus {_1} @msg Internal error: {msg} (please report this bug) Sisäinen virhe: {msg} (ilmoita tästä virheestä) @msg Live Paint Merge: select a Live Paint group and the paths to add Elävän maalauksen yhdistäminen: valitse elävän maalauksen ryhmä ja lisättävät polut +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` ja `Edge` ovat elävän maalauksen ryhmän pintojen ja reunojen nimiä: anna polulle toinen nimi @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Elävä maalaus ottaa polkuja ja yhdistelmäpolkuja: muunna teksti, kuvat ja muut objektit ensin poluiksi @msg Live Paint: select paths or compound paths Elävä maalaus: valitse polkuja tai yhdistelmäpolkuja @msg Live Paint: these paths are too degenerate to paint Elävä maalaus: nämä polut ovat liian surkastuneita maalattaviksi diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3be3497f97..43f7417523 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -4716,6 +4716,7 @@ liquify-list-end {0}, {1} {0} et {1} @msg Installed plug-in {_1} Module externe {_1} installé @msg Internal error: {msg} (please report this bug) Erreur interne : {msg} (merci de signaler ce bogue) @msg Live Paint Merge: select a Live Paint group and the paths to add Fusion de peinture dynamique : sélectionnez un groupe de peinture dynamique et les tracés à ajouter +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name Les noms `Face` et `Edge` sont réservés aux faces et aux bords d’un groupe de peinture dynamique, choisissez un autre nom pour le tracé @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first La peinture dynamique accepte les tracés et les tracés transparents : convertissez d’abord le texte, les images et les autres objets en tracés @msg Live Paint: select paths or compound paths Peinture dynamique : sélectionnez des tracés ou des tracés transparents @msg Live Paint: these paths are too degenerate to paint Peinture dynamique : ces tracés sont trop dégénérés pour être peints diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index cbfb4f51d1..dbd25b1690 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -7487,6 +7487,7 @@ liquify-list-end {0}, {1} {0} और {1} @msg linked pictures with no preview in the file show a placeholder until their files are found: relink them in the Links panel फ़ाइल में कोई प्रीव्यू के साथ जुड़े चित्र एक प्लेसहोल्डर दिखाते हैं जब तक कि उनकी फ़ाइलें नहीं मिलती: उन्हें लिंक पैनल में फिर से लिंक करें @msg linked type areas past VectorCraft's limits were left out VectorCraft की सीमाओं से आगे के लिंक्ड टाइप एरिया छोड़ दिए गए @msg Live Paint Merge: select a Live Paint group and the paths to add लाइव पेंट मर्ज: जोड़ने के लिए एक लाइव पेंट समूह और पाथ सिलेक्ट करें +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` और `Edge` लाइव पेंट समूह के फेस और एज के नाम हैं: पाथ को कोई दूसरा नाम दें @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first लाइव पेंट पाथ और कंपाउंड पाथ लेता है: पहले टाइप, इमेज और अन्य ऑब्जेक्ट्स को पाथ में बदलें @msg Live Paint: select paths or compound paths लाइव पेंट: पाथ या यौगिक पाथ सिलेक्ट करें @msg Live Paint: these paths are too degenerate to paint लाइव पेंट: इन पाथ को पेंट करने के लिए बहुत अलग किया जाता है diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0f81a72036..f05fbb7cb2 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5660,6 +5660,7 @@ liquify-list-end {0}, {1} {0} és {1} @msg line {line}: value for `{var}` must be true or false {line}. sor: a(z) `{var}` értéke csak true vagy false lehet @msg line {line}: value for `{var}` is longer than {MAX_GRAPH_CSV} bytes {line}. sor: a(z) `{var}` értéke hosszabb {MAX_GRAPH_CSV} bájtnál @msg Live Paint Merge: select a Live Paint group and the paths to add Élő festés egyesítése: jelölj ki egy élőfestés-csoportot és a hozzáadandó útvonalakat +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name A `Face` és az `Edge` az élőfestés-csoport felületeinek és éleinek neve: adj más nevet az útvonalnak @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Az élő festés útvonalakat és összetett útvonalakat fogad: előbb alakítsd útvonallá a szöveget, a képeket és a többi objektumot @msg Live Paint: select paths or compound paths Élő festés: jelölj ki útvonalakat vagy összetett útvonalakat @msg Live Paint: these paths are too degenerate to paint Élő festés: ezek az útvonalak túlságosan elfajultak a festéshez diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 8f2ed3216c..5171dbeb75 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4784,6 +4784,7 @@ liquify-list-end {0}, {1} {0} e {1} @msg Installed plug-in {_1} Plug-in installato: {_1} @msg Internal error: {msg} (please report this bug) Errore interno: {msg} (segnala questo bug) @msg Live Paint Merge: select a Live Paint group and the paths to add Fondi pittura dinamica: seleziona un gruppo di pittura dinamica e i tracciati da aggiungere +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` ed `Edge` sono i nomi delle facce e dei bordi di un gruppo di pittura dinamica: assegna un altro nome al tracciato @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first La pittura dinamica accetta tracciati e tracciati composti: converti prima in tracciati testo, immagini e altri oggetti @msg Live Paint: select paths or compound paths Pittura dinamica: seleziona tracciati o tracciati composti @msg Live Paint: these paths are too degenerate to paint Pittura dinamica: questi tracciati sono troppo degeneri per essere dipinti diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c429f204a1..fdf47686cf 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -4676,6 +4676,7 @@ swatch Bright Violet ビビッドバイオレット @msg the art has no bounds アートに境界がありません @msg Image Trace: the traced image is missing 画像トレース: トレース元の画像が見つかりません @msg Live Paint Merge: select a Live Paint group and the paths to add ライブペイントの結合: ライブペイントグループと、追加するパスを選択してください +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` と `Edge` はライブペイントグループの面とエッジの名前です: パスには別の名前を付けてください @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first ライブペイントで扱えるのはパスと複合パスです: テキスト、画像、その他のオブジェクトは先にパスに変換してください @msg Live Paint: select paths or compound paths ライブペイント: パスまたは複合パスを選択してください @msg Live Paint: these paths are too degenerate to paint ライブペイント: これらのパスは形状がつぶれすぎていてペイントできません diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 414f45171c..f68aecb9c6 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6587,6 +6587,7 @@ font-technology Variable ცვლადი @msg Installed plug-in {_1} დაინსტალირდა პლაგინი {_1} @msg Internal error: {msg} (please report this bug) შიდა შეცდომა: {msg} (გთხოვთ, შეგვატყობინოთ ამ ხარვეზის შესახებ) @msg Live Paint Merge: select a Live Paint group and the paths to add ცოცხალი შეღებვის შერწყმა: მონიშნეთ ცოცხალი შეღებვის ჯგუფი და დასამატებელი ტრაექტორიები +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` და `Edge` ცოცხალი შეღებვის ჯგუფის წახნაგებისა და კიდეების სახელებია: ტრაექტორიას სხვა სახელი დაარქვით @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first ცოცხალი შეღებვა იღებს ტრაექტორიებს და შედგენილ ტრაექტორიებს: ჯერ გადააქციეთ ტექსტი, გამოსახულებები და სხვა ობიექტები ტრაექტორიებად @msg Live Paint: select paths or compound paths ცოცხალი შეღებვა: მონიშნეთ ტრაექტორიები ან შედგენილი ტრაექტორიები @msg Live Paint: these paths are too degenerate to paint ცოცხალი შეღებვა: ეს ტრაექტორიები ზედმეტად გადაგვარებულია შესაღებად diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index dbda53243f..9f26f64691 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -4603,6 +4603,7 @@ theme Appearance 외관 @msg the art has no bounds 아트웍에 경계가 없습니다 @msg Image Trace: the traced image is missing 이미지 추적: 추적한 이미지가 없습니다 @msg Live Paint Merge: select a Live Paint group and the paths to add 라이브 페인트 병합: 라이브 페인트 그룹과 추가할 패스를 선택하세요 +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face`와 `Edge`는 라이브 페인트 그룹의 면과 가장자리 이름입니다: 패스에 다른 이름을 지정하세요 @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first 라이브 페인트는 패스와 컴파운드 패스만 사용할 수 있습니다: 텍스트, 이미지 및 기타 개체를 먼저 패스로 변환하세요 @msg Live Paint: select paths or compound paths 라이브 페인트: 패스 또는 컴파운드 패스를 선택하세요 @msg Live Paint: these paths are too degenerate to paint 라이브 페인트: 이 패스는 퇴화되어 칠할 수 없습니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 69aef91cfc..b2ffeab320 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5161,6 +5161,7 @@ imageTrace Outline Contour @msg Installed plug-in {_1} Plug-in {_1} geïnstalleerd @msg Internal error: {msg} (please report this bug) Interne fout: {msg} (meld deze bug alsjeblieft) @msg Live Paint Merge: select a Live Paint group and the paths to add Live Paint samenvoegen: selecteer een Live Paint-groep en de paden om toe te voegen +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` en `Edge` zijn de namen van de vlakken en randen van een Live Paint-groep: geef het pad een andere naam @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Live Paint neemt paden en samengestelde paden: zet tekst, afbeeldingen en andere objecten eerst om in paden @msg Live Paint: select paths or compound paths Live Paint: selecteer paden of samengestelde paden @msg Live Paint: these paths are too degenerate to paint Live Paint: deze paden zijn te gedegenereerd om te verven diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0147515ffe..cc5c471a9e 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4873,6 +4873,7 @@ liquify-list-end {0}, {1} {0} i {1} @msg Installed plug-in {_1} Zainstalowano wtyczkę {_1} @msg Internal error: {msg} (please report this bug) Błąd wewnętrzny: {msg} (zgłoś ten błąd) @msg Live Paint Merge: select a Live Paint group and the paths to add Scal aktywne malowanie: zaznacz grupę aktywnego malowania i ścieżki do dodania +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` i `Edge` to nazwy ścian i krawędzi grupy aktywnego malowania: nadaj ścieżce inną nazwę @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Aktywne malowanie przyjmuje ścieżki i ścieżki złożone: najpierw przekształć tekst, obrazy i inne obiekty w ścieżki @msg Live Paint: select paths or compound paths Aktywne malowanie: zaznacz ścieżki lub ścieżki złożone @msg Live Paint: these paths are too degenerate to paint Aktywne malowanie: te ścieżki są zbyt zdegenerowane, aby je malować diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 8201db7ab6..6562dd1fc7 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -4069,6 +4069,7 @@ axis Both Ambos @msg Installed plug-in {_1} Plug-in {_1} instalado @msg Internal error: {msg} (please report this bug) Erro interno: {msg} (relate este bug) @msg Live Paint Merge: select a Live Paint group and the paths to add Mesclar Pintura dinâmica: selecione um grupo de Pintura dinâmica e os traçados a adicionar +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` e `Edge` são os nomes das faces e arestas de um grupo de Pintura dinâmica: dê outro nome ao traçado @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first A pintura dinâmica aceita traçados e traçados compostos: converta primeiro texto, imagens e outros objetos em traçados @msg Live Paint: select paths or compound paths Pintura dinâmica: selecione traçados ou traçados compostos @msg Live Paint: these paths are too degenerate to paint Pintura dinâmica: estes traçados são degenerados demais para pintar diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index d1593508d3..9b9cffb801 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -4778,6 +4778,7 @@ liquify-list-end {0}, {1} {0} и {1} @msg Installed plug-in {_1} Установлен модуль {_1} @msg Internal error: {msg} (please report this bug) Внутренняя ошибка: {msg} (пожалуйста, сообщите об этой ошибке) @msg Live Paint Merge: select a Live Paint group and the paths to add Объединение быстрой заливки: выделите группу быстрой заливки и контуры для добавления +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name Имена `Face` и `Edge` носят грани и границы группы быстрой заливки: дайте контуру другое имя @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Быстрая заливка принимает контуры и составные контуры: сначала преобразуйте текст, изображения и другие объекты в контуры @msg Live Paint: select paths or compound paths Быстрая заливка: выделите контуры или составные контуры @msg Live Paint: these paths are too degenerate to paint Быстрая заливка: эти контуры слишком вырождены для заливки diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 5c0420fcd3..da3504668b 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -4660,6 +4660,7 @@ liquify-list-end {0}, {1} {0} och {1} @msg Installed plug-in {_1} Installerade pluginet {_1} @msg Internal error: {msg} (please report this bug) Internt fel: {msg} (rapportera gärna felet) @msg Live Paint Merge: select a Live Paint group and the paths to add Sammanfoga Live Paint: markera en Live Paint-grupp och de banor som ska läggas till +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` och `Edge` är namnen på ytorna och kanterna i en Live Paint-grupp: ge banan ett annat namn @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Live Paint tar banor och sammansatta banor: konvertera först text, bilder och andra objekt till banor @msg Live Paint: select paths or compound paths Live Paint: markera banor eller sammansatta banor @msg Live Paint: these paths are too degenerate to paint Live Paint: de här banorna är för degenererade för att målas diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 910a7fc5b1..0bd40bfe81 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -4493,6 +4493,7 @@ liquify-list-end {0}, {1} {0} ve {1} @msg Installed plug-in {_1} Yüklü eklenti {_1} @msg Internal error: {msg} (please report this bug) Dahili hata: {msg} (lütfen bu hatayı bildirin) @msg Live Paint Merge: select a Live Paint group and the paths to add Canlı Boyama Birleştirme: Canlı Boyama grubunu ve eklenecek yolları seçin +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` ve `Edge`, Canlı Boyama grubunun yüzlerinin ve kenarlarının adlarıdır: yola başka bir ad verin @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Canlı Boyama yolları ve bileşik yolları kabul eder: önce metni, görüntüleri ve diğer nesneleri yollara dönüştürün @msg Live Paint: select paths or compound paths Canlı Boyama: yolları veya bileşik yolları seçin @msg Live Paint: these paths are too degenerate to paint Canlı Boyama: Bu yollar boyanamayacak kadar yozlaşmış diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index dbd6d2609e..6f0ed435a2 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -4768,6 +4768,7 @@ liquify-list-end {0}, {1} {0} і {1} @msg Installed plug-in {_1} Встановлено модуль {_1} @msg Internal error: {msg} (please report this bug) Внутрішня помилка: {msg} (будь ласка, повідомте про цю помилку) @msg Live Paint Merge: select a Live Paint group and the paths to add Об’єднання швидкої заливки: виділіть групу швидкої заливки та контури для додавання +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name Імена `Face` і `Edge` мають грані та межі групи швидкої заливки: дайте контуру інше ім'я @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Швидка заливка приймає контури та складені контури: спершу перетворіть текст, зображення й інші об'єкти на контури @msg Live Paint: select paths or compound paths Швидка заливка: виділіть контури або складені контури @msg Live Paint: these paths are too degenerate to paint Швидка заливка: ці контури занадто вироджені для заливки diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 519c5d8f0d..62c0417ba3 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5343,6 +5343,7 @@ liquify-list-end {0}, {1} {0} và {1} @msg type used as a mask in linked areas, wraparound text or a compound path doesn't clip chữ dùng làm mặt nạ trong các vùng liên kết, chữ bao quanh hoặc đường dẫn phức không cắt xén @msg linked pictures with no preview in the file show a placeholder until their files are found: relink them in the Links panel ảnh liên kết không có bản xem trước trong tệp hiển thị ô giữ chỗ cho đến khi tìm thấy tệp gốc: liên kết lại trong bảng Liên kết @msg Live Paint Merge: select a Live Paint group and the paths to add Hợp nhất tô trực tiếp: chọn nhóm tô trực tiếp và các đường dẫn để thêm +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` và `Edge` là tên của các mặt và cạnh trong nhóm tô trực tiếp: hãy đặt tên khác cho đường dẫn @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Tô trực tiếp nhận đường dẫn và đường dẫn phức: hãy chuyển văn bản, hình ảnh và các đối tượng khác thành đường dẫn trước @msg Live Paint: select paths or compound paths Tô trực tiếp: chọn đường dẫn hoặc đường dẫn phức @msg Live Paint: these paths are too degenerate to paint Tô trực tiếp: các đường dẫn này quá suy biến để tô diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index c6696a9ec6..4838492b55 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -4390,6 +4390,7 @@ imageTrace Outline 轮廓 @msg the art has no bounds 图稿没有边界 @msg Image Trace: the traced image is missing 图像描摹:缺少所描摹的图像 @msg Live Paint Merge: select a Live Paint group and the paths to add 实时上色合并:请选择一个实时上色组以及要添加的路径 +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` 和 `Edge` 是实时上色组中表面和边缘的名称:请为路径另取一个名称 @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first 实时上色只接受路径和复合路径:请先将文字、图像和其他对象转换为路径 @msg Live Paint: select paths or compound paths 实时上色:请选择路径或复合路径 @msg Live Paint: these paths are too degenerate to paint 实时上色:这些路径过于退化,无法上色 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 1480422931..4e6e836422 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -1925,6 +1925,7 @@ file-filter Templates 範本 @msg the art has no bounds 圖稿沒有邊界 @msg Image Trace: the traced image is missing 影像描圖:找不到描圖的影像 @msg Live Paint Merge: select a Live Paint group and the paths to add 即時上色合併:請選取即時上色群組和要加入的路徑 +@msg `Face` and `Edge` name the faces and edges of a Live Paint group: give the path another name `Face` 和 `Edge` 是即時上色群組中表面和邊緣的名稱:請為路徑另取名稱 @msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first 即時上色只接受路徑和複合路徑:請先將文字、影像和其他物件轉換為路徑 @msg Live Paint: select paths or compound paths 即時上色:請選取路徑或複合路徑 @msg Live Paint: these paths are too degenerate to paint 即時上色:這些路徑過度退化,無法上色 diff --git a/docs/mcp.md b/docs/mcp.md index 219b44f622..1d24ac803a 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5435,7 +5435,9 @@ and `layerRows`, the rows highlighted in the panel. Paint group (`object.exitIsolation`, or `object.isolate` on a level outside it) adds the paths, compound paths and groups of them drawn in it, shown and unlocked with everything in them, to the group as `livePaint.merge` does, in one undo step; type, images and other objects stay in it as they are, and with nothing drawn no undo step is - recorded. + recorded. Face and Edge are the names of a Live Paint group's faces and edges: `layer.setProps` and + `object.setProps` return an error when they would give either name to another path directly in the group, and a + path pasted directly into the group under either name loses its name. - **Dialogs and panel state** (control channel and the app's MCP): `ui.layerOptions {ids?}` and `ui.newLayer {sublayer?}` open Layer Options (dialog `layerOptions`: name, color, template, locked, visible, printable, preview, dimImages, dimPercent; OK is one undo step; `ui.dialog.set` of `template` also sets `locked` and `dimImages`, as the From f1dba281bf5405a18bfc08b7d7114d83c24e34f8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 10:08:30 -0800 Subject: [PATCH 061/158] Shapes: a double-click on a polygon's side widget does nothing With the Selection tool, a double-click on the side widget went on to the art under it, or left isolation mode when no art was under it. The widget now takes the double-click, as the blend widget does. --- crates/tools/src/select.rs | 4 ++++ crates/tools/src/sidewidget.rs | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs index 898b55ca47..1373dfa2b5 100644 --- a/crates/tools/src/select.rs +++ b/crates/tools/src/select.rs @@ -1678,6 +1678,10 @@ impl SelectionTool { if blendwidget::over_widget(cx, p) { return vec![]; } + // A live polygon's side widget takes a plain double-click the same way. + if sidewidget::over_widget(cx, p) { + return vec![]; + } if crate::rulerguide::guide_at(cx, p).is_some() { return vec![]; } diff --git a/crates/tools/src/sidewidget.rs b/crates/tools/src/sidewidget.rs index 240fc5a706..7928238d51 100644 --- a/crates/tools/src/sidewidget.rs +++ b/crates/tools/src/sidewidget.rs @@ -360,6 +360,40 @@ mod tests { assert_eq!(sides_of(&t.pointer(&c, &ev(PointerKind::Drag, w.at - down * 13.0))), [4]); } + /// A double-click on the widget with the Selection tool does nothing: in isolation mode it does + /// not leave isolation, though no art is under the widget. + #[test] + fn a_double_click_on_the_widget_does_nothing() { + let live = LiveShape::Polygon { + radius: 100.0, + sides: 5, + xf: Affine::translate((300.0, 300.0)), + radii: vec![], + kinds: vec![], + radii_relative: false, + }; + let mut d = Document::new(800.0, 800.0); + let l = d.layers[0].id; + let id = d.alloc_id(); + let mut n = Node::path(id, live.to_path(), Appearance::default_art()); + if let NodeKind::Path { live: slot, .. } = &mut n.kind { + *slot = Some(Box::new(live)); + } + let group = d.alloc_id(); + d.insert(Some(l), 0, Node::group(group, vec![std::sync::Arc::new(n)])).unwrap(); + let mut s = Selection::default(); + s.add(id); + let p = paint(); + let c = ToolContext { isolation: Some(group), ..cx(&d, &s, &p) }; + let (w, _) = SideWidget::for_tool(&c).unwrap(); + assert!(vectorcraft_doc::hit::hit_test(&d, w.at, c.hit_options()).is_none()); + let mut t = SelectionTool::default(); + assert!(t.pointer(&c, &ev(PointerKind::DoubleClick, w.at)).is_empty()); + // Away from the widget and the art, the double-click leaves isolation. + let away = w.at + vectorcraft_geom::Vec2::new(40.0, 0.0); + assert_eq!(t.pointer(&c, &ev(PointerKind::DoubleClick, away)), vec![Action::Exec("object.exitIsolation".into(), json!({}))]); + } + /// A polygon of more than 11 sides keeps its count on a press and a drag down; the first step /// up gives 11. #[test] From 0aede64dbd7939d6713057b71fdb370d042fee19 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 10:29:05 -0800 Subject: [PATCH 062/158] Layers: a path dragged from a Live Paint group's paths into the group keeps its faces' paint Dragging one of a Live Paint group's own paths from its hidden sources into the group made the group's faces and edges again before adding the path back, so the merge read the paint from the rebuilt parts. With the path as the only source every face and edge was dropped; with others, the faces the path bounded lost their fill. The group the rows join is now made again by the merge alone, which carries the paint of the faces and edges as they were before the move. --- crates/engine/src/cmd/buildcmds/live_paint.rs | 5 +++- crates/engine/src/tests/build.rs | 25 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/buildcmds/live_paint.rs b/crates/engine/src/cmd/buildcmds/live_paint.rs index 776f5f11b7..c71e1d6f32 100644 --- a/crates/engine/src/cmd/buildcmds/live_paint.rs +++ b/crates/engine/src/cmd/buildcmds/live_paint.rs @@ -382,7 +382,10 @@ impl LivePaintMove { if self.join.is_none() && self.rebuild.is_empty() { return Ok(moved.to_vec()); } - for g in &self.rebuild { + // The group the rows join is made again by the merge below, from its paths as they are now + // and with the paint of its faces and edges as they were before the move. + let join_group = self.join.as_ref().map(|(g, _)| *g); + for g in self.rebuild.iter().filter(|g| Some(**g) != join_group) { rebuild_paths(d, *g)?; } let Some((g, mask)) = self.join else { return Ok(moved.iter().copied().filter(|r| d.node(*r).is_some()).collect()) }; diff --git a/crates/engine/src/tests/build.rs b/crates/engine/src/tests/build.rs index 0a53b659d0..61a4414599 100644 --- a/crates/engine/src/tests/build.rs +++ b/crates/engine/src/tests/build.rs @@ -5245,6 +5245,31 @@ fn layers_drag_out_of_a_live_paint_group_makes_its_faces_again() { assert_eq!(faces(&node(&s, g)).len(), 1); } +/// A path dragged from a Live Paint group's sources into the group itself stays among its paths, +/// and the faces it bounds keep their paint, also when it is the group's only path. +#[test] +fn layers_drag_a_source_path_into_its_own_live_paint_group_keeps_the_paint() { + use vectorcraft_tools::builder::{face_at, faces, sources}; + let green = Paint::solid(Color::from_hex("#00ff00").unwrap()); + let blue = Paint::solid(Color::from_hex("#0000ff").unwrap()); + let mut s = session(); + let g = live(&mut s); + let layer = s.doc().unwrap().doc.parent_of(g).unwrap(); + s.execute("livePaint.fill", &json!({"group": g.0, "point": [25, 50], "color": "#00ff00"})).unwrap(); + let src: Vec = sources(&node(&s, g)).unwrap().children().unwrap().iter().map(|c| c.id).collect(); + s.execute("layer.move", &json!({"ids": [src[0].0], "target": g.0, "place": "inside"})).unwrap(); + let n = node(&s, g); + assert_eq!(s.doc().unwrap().doc.parent_of(src[0]), Some(sources(&n).unwrap().id), "the path stays among the group's paths"); + assert_eq!(faces(&n).len(), 3); + assert_eq!(face_at(&n, Point::new(25.0, 50.0)).unwrap().appearance.fill_paint(), green, "the face it bounds keeps its fill"); + s.execute("layer.move", &json!({"ids": [src[1].0], "target": layer.0})).unwrap(); + s.execute("livePaint.fill", &json!({"group": g.0, "point": [50, 50], "color": "#0000ff"})).unwrap(); + s.execute("layer.move", &json!({"ids": [src[0].0], "target": g.0, "place": "inside"})).unwrap(); + let n = node(&s, g); + assert_eq!(faces(&n).len(), 1); + assert_eq!(face_at(&n, Point::new(50.0, 50.0)).unwrap().appearance.fill_paint(), blue, "the only path's face keeps its fill"); +} + /// Give Live Paint group `g` a lock, hidden state, appearance, knockout, opacity mask and /// graphic style link, and return it as it then is. fn dress_live_group(s: &mut Session, g: NodeId) -> Node { From 5af51906dcac12a298d5e3a2f2711cfc40205d7c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 11:00:58 -0800 Subject: [PATCH 063/158] Messages: a press on a message closes it when an older message goes first The click took the frame's automatic id, which follows its position among the messages, so a message pressed while an older one expired did not close on release. The click now takes an id from the message's own scope. --- crates/ui-egui/src/toasts.rs | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/toasts.rs b/crates/ui-egui/src/toasts.rs index 0d47c4e3b4..a8bdb46be5 100644 --- a/crates/ui-egui/src/toasts.rs +++ b/crates/ui-egui/src/toasts.rs @@ -138,7 +138,9 @@ fn message(ui: &mut egui::Ui, e: &Entry, t: &Tokens) -> egui::Response { ui.add(egui::Label::new(galley).selectable(false)); elided }); - let r = frame.response.interact(egui::Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand); + // The click takes its id from the message's own scope, not from the frame's position among + // the messages, so a press survives an older message going. + let r = ui.interact(frame.response.rect, ui.scope_id().with("toast"), egui::Sense::click()).on_hover_cursor(egui::CursorIcon::PointingHand); // A message cut short shows in full on hover. if frame.inner { r.on_hover_text(&e.toast.message) } else { r } } @@ -257,6 +259,26 @@ mod tests { assert_eq!(messages(&app), vec!["top", "bottom"]); } + #[test] + fn a_message_pressed_while_an_older_one_goes_still_closes_on_release() { + let (mut app, ctx) = app(); + for (message, seconds) in [("older", 0.5), ("pressed", 60.0), ("bottom", 60.0)] { + app.session.toast(Toast { seconds, ..Toast::new(message, Level::Info) }); + } + pass(&mut app, &ctx, 0.0, vec![]); + pass(&mut app, &ctx, 0.0, vec![]); + let at = app.toasts.list[1].rect.unwrap().center(); + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + pass(&mut app, &ctx, 0.1, vec![egui::Event::PointerMoved(at)]); + pass(&mut app, &ctx, 0.2, vec![press(true)]); + // "older" goes while the button is down; the newer messages stay where they were. + pass(&mut app, &ctx, 0.6, vec![]); + assert_eq!(messages(&app), vec!["pressed", "bottom"]); + pass(&mut app, &ctx, 0.7, vec![]); + pass(&mut app, &ctx, 0.8, vec![press(false)]); + assert_eq!(messages(&app), vec!["bottom"]); + } + #[test] fn an_action_records_a_message_and_shows_it_again_when_played() { use crate::panels::actions::{START_RECORDING, STOP_RECORDING, play}; From 0e2ac0b4f938d93e156b573ccb898ddba78673e4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 10:42:09 -0800 Subject: [PATCH 064/158] Layers: Locate Object locates the frontmost of several selected objects With several objects selected, Locate Object (and Locate Layer) now finds the one frontmost in the stacking order instead of the one selected last. Objects on different layers and sublayers compare by the layers' order, and a member selected with its group counts as in front of it. An id given to layer.locate still locates that object. --- crates/engine/src/cmd/layerpanel.rs | 5 ++-- crates/engine/src/tests/layers.rs | 37 +++++++++++++++++++++++++++++ crates/ui-egui/src/panels/layers.rs | 2 +- docs/mcp.md | 4 +++- docs/target-app-parity.md | 1 + 5 files changed, 45 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/layerpanel.rs b/crates/engine/src/cmd/layerpanel.rs index 4710966004..6c84a817af 100644 --- a/crates/engine/src/cmd/layerpanel.rs +++ b/crates/engine/src/cmd/layerpanel.rs @@ -132,7 +132,7 @@ pub fn specs() -> Vec { "Locate Object", ["Window", "Layers"], None, - "{id?, layersOnly?} (default: the last selected object) highlight the object's row; the Layers panel opens the layers around it and scrolls to it → {id, ancestry: [layer…, id]}. layersOnly (default false; the panel sends true while Show Layers Only is on, as Locate Layer) highlights the innermost layer or sublayer holding the object instead, or a layer id itself → {id: layer, objectId, ancestry: [layer…]}", + "{id?, layersOnly?} (default: the frontmost selected object in the stacking order) highlight the object's row; the Layers panel opens the layers around it and scrolls to it → {id, ancestry: [layer…, id]}. layersOnly (default false; the panel sends true while Show Layers Only is on, as Locate Layer) highlights the innermost layer or sublayer holding the object instead, or a layer id itself → {id: layer, objectId, ancestry: [layer…]}", has_doc, locate ), @@ -437,7 +437,8 @@ fn locate(s: &mut Session, p: &Value) -> Result { let id = object_param(p, "id", "layer.locate")?; let layers_only = switch_or(p, "layersOnly", false, "layer.locate")?; let st = s.doc_mut()?; - let id = id.or_else(|| st.selection.objects.last().copied()).ok_or_else(|| bad("layer.locate", "nothing selected"))?; + // With no id, the frontmost selected object in the stacking order, whatever order it was selected in. + let id = id.or_else(|| st.selection.in_paint_order(&st.doc).last().copied()).ok_or_else(|| bad("layer.locate", "nothing selected"))?; let mut ancestry = st.doc.ancestry(id).ok_or(EngineError::NoNode(id))?; if layers_only { // Locate Layer: the innermost layer or sublayer holding the object (a layer locates itself). diff --git a/crates/engine/src/tests/layers.rs b/crates/engine/src/tests/layers.rs index 186c5de6c1..b7006e6159 100644 --- a/crates/engine/src/tests/layers.rs +++ b/crates/engine/src/tests/layers.rs @@ -904,6 +904,43 @@ fn locate_object_highlights_its_row() { assert!(s.execute("layer.locate", &json!({})).is_err()); } +/// With several objects selected, Locate Object finds the frontmost one in the stacking order, +/// whatever order they were selected in; an `id` still wins. +#[test] +fn locate_object_finds_the_frontmost_selected_object() { + let mut s = session(); + let (_, sub, a, g, b, c) = tree(&mut s); + let top = id(&run(&mut s, "layer.new", json!({"top": true}))); + let d = rect(&mut s, 400.0); + let locate = |s: &mut Session, ids: &[NodeId]| { + run(s, "select.set", json!({"ids": ids.iter().map(|i| i.0).collect::>()})); + assert_eq!(s.doc().unwrap().selection.objects.last(), ids.last(), "selected in this order"); + run(s, "layer.locate", json!({}))["id"].clone() + }; + // In one sublayer, the group in front of the rectangle selected last. + assert_eq!(locate(&mut s, &[g, a]), json!(g.0)); + assert_eq!(s.doc().unwrap().highlighted_rows(), vec![g]); + // The sublayer sits in front of the art directly in its layer. + assert_eq!(locate(&mut s, &[a, c]), json!(a.0)); + // A higher layer wins over everything below it. + assert_eq!(locate(&mut s, &[d, b, c]), json!(d.0)); + assert_eq!(s.doc().unwrap().highlighted_rows(), vec![d]); + // A group and its member: the member paints after the group it is in. + assert_eq!(locate(&mut s, &[b, g]), json!(b.0)); + // Added one at a time, as by Shift-clicks. + run(&mut s, "select.set", json!({"ids": [d.0]})); + run(&mut s, "select.add", json!({"ids": [a.0]})); + assert_eq!(run(&mut s, "layer.locate", json!({}))["id"], d.0); + // An id still locates that object, behind the selection or not. + assert_eq!(run(&mut s, "layer.locate", json!({"id": c.0}))["id"], c.0); + assert_eq!(s.doc().unwrap().highlighted_rows(), vec![c]); + // Locate Layer takes the layer of the frontmost selected object. + run(&mut s, "select.set", json!({"ids": [d.0, a.0]})); + assert_eq!(run(&mut s, "layer.locate", json!({"layersOnly": true})), json!({"id": top.0, "objectId": d.0, "ancestry": [top.0]})); + run(&mut s, "select.set", json!({"ids": [a.0, c.0]})); + assert_eq!(run(&mut s, "layer.locate", json!({"layersOnly": true}))["id"], sub.0); +} + /// Locate Layer (`layersOnly`, sent while Show Layers Only is on) highlights the innermost layer /// or sublayer holding the object, through any groups; a layer locates itself. #[test] diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index 6e8c2648fa..2cf0808741 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -516,7 +516,7 @@ fn listed_when_opened(doc: &Document, open: &OpenRows, opts: &PanelOptions, quer rows.iter().any(|r| r.node.id == id && r.guide.is_none() && !r.spine) } -/// The active document's uid and its last selected object, the one Locate Object locates. +/// The active document's uid and its last selected object. fn last_selected(app: &VectorcraftApp) -> Option<(u64, Option)> { app.session.active().map(|st| (st.uid, st.selection.objects.last().copied())) } diff --git a/docs/mcp.md b/docs/mcp.md index b719d3352e..50ba6f5b60 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5413,7 +5413,9 @@ and `layerRows`, the rows highlighted in the panel. locked or nested art included, dialog `confirm` asks "Delete this layer and its artwork?" for one layer, else "Delete the selected items and their artwork?"; OK deletes the rows it asked about in that document, one undo step, and Cancel keeps them; an empty layer, a layer with only guides, and groups or objects alone are deleted at once), - `layer.locate {id?, layersOnly?}` (highlights the selected object's row; the panel opens the rows around it; + `layer.locate {id?, layersOnly?}` (highlights the selected object's row, or with several selected the row of the + one frontmost in the stacking order, whatever order they were selected in; an `id` locates that object instead; + the panel opens the rows around it; `layersOnly: true`, which the panel sends while Show Layers Only is on, as Locate Layer, highlights the innermost layer or sublayer holding the object instead, or a layer `id` itself, and returns `{id, objectId, ancestry}`) and `layer.clippingMask.toggle`. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 6bae94488f..89c8affc76 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1387,6 +1387,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur As VectorCraft's own rule, a layer color (`layer.setProps`, `layer.new`, `layer.newSublayer`) or a Live Paint Gap Preview Color (`livePaint.gapOptions`) given as a hex color with an alpha part (`#rrggbbaa` or `#rgba`) is an error and changes nothing, instead of being set without its alpha. Regression tests: `a_layer_color_with_an_alpha_part_is_refused` in `crates/engine/src/tests/layers.rs` and `a_gap_color_with_an_alpha_part_is_refused` in `crates/engine/src/tests/build.rs`. Panel Options › Locate Selected Objects (beyond Illustrator, off by default): when the last selected object changes on the canvas or by a command, the panel opens the layers and groups around it and scrolls to its row, as Locate Object does, without highlighting the row; when Show Layers Only, a search or the filter leaves the object without a row, the panel opens no rows for it and scrolls as with the option off. With Panel Options › Show Layers Only on, Locate Object is named Locate Layer and highlights the layer that holds the selected object instead of the object's own row, which that mode does not list (help page: https://helpx.adobe.com/illustrator/desktop/manage-layers/create-and-organize-layers/locate-objects-in-the-layers-panel.html). As VectorCraft's own rules, the bottom bar's button and a row's menu are renamed too, the innermost sublayer holding the object is the one highlighted, a layer row locates itself, and the panel opens the layers around it (`locate_layer_highlights_the_layer_holding_the_object` in `crates/engine/src/tests/layers.rs`, `with_show_layers_only_locate_object_becomes_locate_layer` in `crates/ui-egui/src/panels/layers/tests.rs`). + With several objects selected, Locate Object (and Locate Layer) finds the one frontmost in the stacking order, not the one selected last (help page: https://helpx.adobe.com/illustrator/desktop/manage-layers/create-and-organize-layers/locate-objects-in-the-layers-panel.html). Objects on different layers and sublayers are compared by the layers' order. As VectorCraft's own rules, a member selected along with its group counts as in front of the group, and an `id` given to `layer.locate` still wins (`locate_object_finds_the_frontmost_selected_object` in `crates/engine/src/tests/layers.rs`). - **Drawing aids:** Smart Guides and snapping (moving, with the Selection, Group Selection or Direct Selection tool, and resizing by the bounding-box handles with the Selection or Free Transform tool, Shift and Alt too: the dragged corner or side lands on the other objects' anchors and centres ("anchor", "center") or lines up with their edges and centres (a line and "align"); with Smart Guides › Spacing Guides, a moved selection that lines up with nothing along an axis lands as far from its neighbour as two other objects of its row or column are apart, or halfway between its two neighbours, the equal gaps marked; with View › Snap to Grid on, a moved selection lands on the grid instead, by whichever of its edges is nearest a gridline on each axis (the center does not snap), #740, #1816; the Rotate, Scale, Shear and Reflect tools drag from the anchor they grab and snap the pointer the same way, so a corner dragged onto another object's anchor scales exactly onto it, #482; anchors dragged with Direct Selection: the one pressed on lands on other anchors, its own path's that stay put among them, on path segments or in line with them, the others following, Shift keeps 45° steps, and with Smart Guides off Snap to Point pulls it onto anchors; the Artboard tool snaps artboards, and their bleed, to other artboards, bleeds and art, the grid or whole pixels while moving, copying and resizing them, and the Transform panel shows and edits the active artboard's X/Y/W/H; drawn points, #506: hovering shows where the press goes, the point lands on the other objects' anchors, centres and paths ("anchor", "center", "path") or lines up with their anchors, edges and centres ("align"), the Pen's on the path being drawn too, near a construction guide through the anchor before it on that guide (Preferences › Smart Guides › Construction Guides and Angles), and with Shift kept to its 45° step or a square's diagonal it slides along that way into line; the targets are gathered once per document state, from the art in the window, and the anchors, centres and lines near the pointer are found by bisection, so hovering never rescans the document), guides dragged out of the rulers (#451: they snap as moved guides do, Shift to the ruler's ticks; with the Artboard tool they are artboard guides, which run across their artboard only and move, copy and delete with it, `guide.add {artboard}`) that the Selection, Direct Selection and Group Selection tools then pick and drag (#414: the selected guides highlight and move together, Alt copies them, Shift snaps the dragged one to the ticks, otherwise it snaps to pixels, the grid or the edges, centres (so the sides' midpoints) and anchors of the art and the artboards, or with Smart Guides off Snap to Point pulls it onto anchors; Shift-clicked they join the selected art, and Shift-added art keeps them, so guides and art are selected together in either order, Delete then deleting both in one step; the arrow keys nudge them, Delete deletes them, dragging one back onto its ruler deletes it, Lock Guides and Hide Guides leave them alone; `guide.list`, `guide.select`, `guide.move` and `guide.remove` reach agents), a right-click on either ruler or the origin box to pick the document's units (the current one checked; `document.setUnits`, one undo step, #528), and Draw Normal / Behind / Inside modes. Smart Guides: a point drawn with the Pen or a shape tool, and an anchor dragged with Direct Selection, snaps to where paths and ruler guides cross, labelled "intersect" (#1658, part of #1602; a moved selection's own anchors don't, except the anchor the Selection tool grabbed it by). A selection the Selection tool grabs by one of its anchors snaps that anchor onto the other objects' paths ("path"), and where a path crosses another path or a ruler guide ("intersect"), in the order Direct Selection uses for a dragged anchor; when the anchor lands on a path, the selection's bounds do not also line up with other objects (#7411). The archived 2007 [user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=55) (page 49) says Smart Guides align the pointer of a moved object to existing paths. Snapping onto paths only when the selection was grabbed by an anchor is VectorCraft's own rule; a selection grabbed anywhere else still lines its bounds up. Tests: `select::tests::a_move_grabbed_by_an_anchor_lands_it_on_another_path`, `a_move_grabbed_by_an_anchor_lands_it_where_paths_cross` and `a_move_grabbed_by_an_anchor_lands_it_where_a_path_crosses_a_ruler_guide`. With Smart Guides › Measurement Labels on, the Line Segment tool labels the segment being drawn with its distance, angle and X and Y offsets (`D`, `Angle`, `dX`, `dY`), and the Pen, Curvature and Smart Pen tools label their rubber band the same way when Enable Rubber Band is on (#2983). A move that Shift keeps level, upright or diagonal stays on that line when it snaps, with the Selection, Group Selection or Direct Selection tool. It slides along the line until the selection lands on the grid or on whole pixels, lines up with the other objects or is spaced evenly with them, or until the line passes an anchor or crosses a ruler guide near the point the selection was grabbed by. A level or upright move snaps along its own axis only. Snap to Last Location: with Smart Guides on and Preferences › Smart Guides › Snap to Last Location on (off by default, VectorCraft's own choice), a selection moved by dragging with the Selection, Group Selection or Direct Selection tool, Shift too, goes back to where the move began while it is within Snapping Tolerance of it, labeled "last location"; an Alt copy is not pulled back onto its original, and with View › Snap to Grid or Snap to Pixel on the move snaps to the grid or to whole pixels instead (`prefs.set` key `snapToLastLocation`). The public [Smart Guides options](https://helpx.adobe.com/illustrator/desktop/measure-and-align/grids-and-guides/smart-guides-options.html) page lists the option as snapping objects back to their previous position; the distance, the label, the copy rule and the grid and pixel rule are VectorCraft's own. Tests: `select::tests::snap_to_last_location_puts_a_move_back_where_it_began`, `select::tests::snap_to_pixel_wins_over_snap_to_last_location`, `direct::tests::snap_to_last_location_puts_a_path_moved_by_its_anchor_back`, `direct::tests::snap_to_pixel_wins_over_snap_to_last_location_for_a_path_moved_by_its_anchor`, `tests_prefs::snap_to_last_location_puts_a_dragged_square_back`. From 556e1552d8e074e5167a48b514fde7e440378147 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 10:54:33 -0800 Subject: [PATCH 065/158] Print: an overprinting gradient keeps the ink below where it puts none on PostScript plates A PostScript plate has no blending modes, so an overprinting gradient whose stops mix zero and nonzero ink of a plate was drawn whole on it, and its paper-white part knocked out the ink below. On a plate, the EPS writer now clips an overprinting gradient to where it puts the plate's ink down. Linear, radial and diamond gradients leave out the stretches between paper-white stops and the padding past a paper-white end stop. Conic gradients leave out their paper-white wedges, and freeform gradients leave out their paper-white cells (masked at Level 3, clipped at Level 2). Fills, strokes (within, along and across) and characters are covered, on process and spot plates. Where the gradient puts ink down it is drawn as before, and a gradient with ink everywhere is written unchanged. On PostScript plates, a stop or point of an overprinting gradient whose color counts as black, with up to half a percent of another ink, now puts none of that other ink down, as a solid fill of that color already does. PDF plates are unchanged. --- crates/eps/src/print.rs | 2 +- crates/eps/src/print/tests.rs | 188 +++++++++++++++++++++- crates/eps/src/scene.rs | 279 +++++++++++++++++++++++++++++++-- crates/pdf/src/print/plates.rs | 73 +++++++-- crates/pdf/src/tests/print.rs | 36 +++++ docs/target-app-parity.md | 1 + 6 files changed, 546 insertions(+), 33 deletions(-) diff --git a/crates/eps/src/print.rs b/crates/eps/src/print.rs index 0ccd7a6331..1c85e2cf9c 100644 --- a/crates/eps/src/print.rs +++ b/crates/eps/src/print.rs @@ -70,7 +70,7 @@ fn sheet(p: &PrintPage, job: &PrintJob) -> Result<(String, Vec), String> { } let opts = |region: Rect| EpsOptions { level: job.level, region, ..EpsOptions::default() }; let art_opts = opts(r); - let art = Scene::new(p.doc, &art_opts).run(); + let art = Scene::new(p.doc, &art_opts).on_plate(p.ink.is_some()).run(); // The marks' area: the drawing space the page shows (within the tile). let paper = Rect::new(0.0, 0.0, w, h); let shown = if p.view.determinant().abs() > 1e-12 { p.view.inverse().transform_rect_bbox(paper) } else { paper }; diff --git a/crates/eps/src/print/tests.rs b/crates/eps/src/print/tests.rs index 29e7ca0536..d3685ad5ab 100644 --- a/crates/eps/src/print/tests.rs +++ b/crates/eps/src/print/tests.rs @@ -1,9 +1,12 @@ //! PostScript print jobs: DSC page comments, the setup of each sheet, and a file the PostScript //! reader reads back. -use vectorcraft_color::{Color, Paint}; -use vectorcraft_doc::{Appearance, Document, Node, NodeId}; -use vectorcraft_geom::{Affine, Rect, shapes}; +use vectorcraft_color::{ + Color, Freeform, FreeformPoint, Gradient, GradientGeom, GradientKind, GradientPaint, GradientSpread, GradientStop, Paint, Swatch, +}; +use vectorcraft_doc::{Appearance, CharStyle, Document, Node, NodeId, NodeKind, StrokeGradientMode, TextObject}; +use vectorcraft_geom::{Affine, Point, Rect, Vec2, shapes}; +use vectorcraft_testkit::raster::{Image, render_region}; use super::*; @@ -110,3 +113,182 @@ fn separations_screens_flatness_negatives_and_tiles() { assert!(print(&[], &[], &job).is_err()); assert!(print(&[PrintPage { size: (f64::NAN, 1.0), ..page(&d, None) }], &[0], &job).is_err()); } + +/// A 200 × 100 pt CMYK document with spot swatch `Ink` (100% K): a rectangle over the whole page +/// painted `under`, when there is one, then `art`. +fn over(under: Option, art: &[Node]) -> Document { + let mut d = Document::new(200.0, 100.0); + d.color_mode = vectorcraft_doc::ColorMode::Cmyk; + d.swatches.push(Swatch { name: "Ink".into(), paint: Paint::solid(Color::cmyk(0.0, 0.0, 0.0, 1.0)), global: true, spot: true }); + let layer = d.layers[0].id; + let under = under.map(|p| Node::path(NodeId(0), shapes::rectangle(Rect::new(0.0, 0.0, 200.0, 100.0)), Appearance::basic(p, Paint::None, 0.0))); + for mut n in under.into_iter().chain(art.iter().cloned()) { + n.id = d.alloc_id(); + d.insert(Some(layer), usize::MAX, n).unwrap(); + } + d +} + +/// Ink `ink`'s plate of `d` as the print plan separates it for PostScript, and as a PostScript +/// separation at `level` read back, both drawn at 1 px a point. +fn plate_of(d: &Document, ink: &str, level: Level) -> (Image, Image) { + let area = Rect::new(0.0, 0.0, 200.0, 100.0); + let settings = serde_json::from_value(serde_json::json!({"output": {"mode": "separations"}})).unwrap(); + let plan = vectorcraft_pdf::plan(d, &vectorcraft_pdf::PrintOptions { settings, postscript: true, ..Default::default() }).unwrap(); + let i = plan.sheets.iter().find(|s| s.ink.as_ref().is_some_and(|p| p.name == ink)).and_then(|s| s.plate).unwrap(); + let plate = &plan.plates[i]; + let page = PrintPage { + doc: plate, + size: (200.0, 100.0), + view: Affine::IDENTITY, + window: None, + place: Affine::IDENTITY, + copies: &[], + area, + marks: None, + negative: false, + ink: Some((ink, 85.0, 15.0)), + }; + let out = print(&[page], &[0], &PrintJob { level, ..PrintJob::default() }).unwrap(); + assert!(level == Level::Three || !text(&out).contains("shfill"), "Level 2 has no smooth shadings"); + let back = crate::import(&out.bytes).unwrap().document; + (render_region(plate, area, 1.0), render_region(&back, area, 1.0)) +} + +/// Ink `ink`'s PostScript plate of `art` over a page of 100% `ink` (`under`), checked against the +/// plate of `art` alone: where `art` puts none of the ink down, the ink under it prints, and +/// where it puts ink down, its own amount prints. The pixels of the page where `art` alone puts +/// no ink, those of them where the ink under it does not print, and the pixels where `art` puts +/// ink down that do not print its amount. +fn keeps_the_ink_below(art: &[Node], under: &Paint, ink: &str, level: Level) -> (usize, usize, usize) { + let (alone, _) = plate_of(&over(None, art), ink, level); + let (_, printed) = plate_of(&over(Some(under.clone()), art), ink, level); + // Pixels whose neighbors all have paper (or all have ink) on the plate of `art` alone: an + // edge falls on either side of a pixel's center, and the edge of the inked part is lightest. + let around = |x: u32, y: u32, paper: bool| { + (x.saturating_sub(1)..=(x + 1).min(alone.width - 1)) + .all(|i| (y.saturating_sub(1)..=(y + 1).min(alone.height - 1)).all(|j| (alone.over_white(i, j)[0] >= 254) == paper)) + }; + let (mut paper, mut knocked_out, mut wrong) = (0, 0, 0); + for y in 0..alone.height { + for x in 0..alone.width { + let (a, p) = (alone.over_white(x, y)[0], printed.over_white(x, y)[0]); + if around(x, y, true) { + paper += 1; + knocked_out += usize::from(p > 60); + } else if around(x, y, false) { + wrong += usize::from(a.abs_diff(p) > 48); + } + } + } + (paper, knocked_out, wrong) +} + +/// A rectangle from (20, 10) to (180, 90) with `fill` and `stroke` (16 pt), each set to +/// overprint. +fn overprinting(fill: Paint, stroke: Paint) -> Node { + let mut n = Node::path(NodeId(0), shapes::rectangle(Rect::new(20.0, 10.0, 180.0, 90.0)), Appearance::basic(fill, stroke, 16.0)); + for it in &mut n.appearance.items { + *it.overprint_mut() = true; + } + n +} + +/// `stops` (offset, color) as a `kind` gradient placed at `geom`, spreading as `spread`. +fn gradient(kind: GradientKind, stops: &[(f32, Color)], geom: GradientGeom, spread: GradientSpread) -> Paint { + let stops = stops.iter().map(|(o, c)| GradientStop::new(*o, *c)).collect(); + let mut g = GradientPaint::new(Gradient { spread, repeats: 2, ..Gradient::new(kind, stops) }); + g.geom = Some(geom); + Paint::Gradient(Box::new(g)) +} + +#[test] +fn an_overprinting_gradient_keeps_the_ink_below_where_it_puts_none_on_a_postscript_plate() { + // Cyan in the outer stops, none from 0.3 to 0.6 (magenta only there). + let (inked, none) = (Color::cmyk(0.6, 0.3, 0.0, 0.0), Color::cmyk(0.0, 0.3, 0.0, 0.0)); + let stops = [(0.0, inked), (0.3, none), (0.6, none), (1.0, inked)]; + let c = Point::new(100.0, 50.0); + let around = GradientGeom { start: c, end: c + Vec2::new(70.0, -20.0), aspect: 0.7, focal: None }; + let across = GradientGeom { start: Point::new(30.0, 40.0), end: Point::new(170.0, 60.0), aspect: 1.0, focal: None }; + let pad = GradientSpread::Pad; + let fills = [ + ("linear", gradient(GradientKind::Linear, &stops, across, pad)), + ("radial", gradient(GradientKind::Radial, &stops, around, pad)), + ("off-center radial", gradient(GradientKind::Radial, &stops, GradientGeom { focal: Some(c + Vec2::new(-20.0, 10.0)), ..around }, pad)), + ("conic", gradient(GradientKind::Conic, &stops, around, pad)), + ("diamond", gradient(GradientKind::Diamond, &stops, around, pad)), + ("repeating linear", gradient(GradientKind::Linear, &stops, across, GradientSpread::Repeat)), + ("reflecting radial", gradient(GradientKind::Radial, &stops, around, GradientSpread::Reflect)), + // A hard edge: two stops at 0.5, the inked half first. + ("hard edge", gradient(GradientKind::Linear, &[(0.0, inked), (0.5, inked), (0.5, none), (1.0, none)], across, pad)), + // Starting and ending with no cyan, padding past both ends. + ("none at the ends", gradient(GradientKind::Linear, &[(0.2, none), (0.4, none), (0.5, inked), (0.8, none)], across, pad)), + ]; + // Many stretches with no cyan. + let many: Vec<(f32, Color)> = (0..16).map(|i| (i as f32 / 15.0, if i % 4 < 2 { inked } else { none })).collect(); + let fills = fills.into_iter().chain([("many stops", gradient(GradientKind::Linear, &many, across, pad))]); + let cyan = Paint::solid(Color::cmyk(1.0, 0.0, 0.0, 0.0)); + let cases: Vec<_> = fills.map(|(name, fill)| (name, overprinting(fill, Paint::None), cyan.clone(), "Cyan")).collect(); + assert_keeps_the_ink_below(&cases); +} + +/// [`keeps_the_ink_below`] for each of `cases` (a name, the art, the paint under it and the ink +/// of the plate) at Level 3 and Level 2, with every case that fails named. +fn assert_keeps_the_ink_below(cases: &[(&str, Node, Paint, &str)]) { + let mut failed = vec![]; + for (name, art, under, ink) in cases { + for level in [Level::Three, Level::Two] { + let (paper, knocked_out, wrong) = keeps_the_ink_below(std::slice::from_ref(art), under, ink, level); + if knocked_out + wrong >= 100 { + failed.push(format!("{name} at level {level:?}: {knocked_out} of {paper} knocked out, {wrong} of the others differ")); + } + } + } + assert!(failed.is_empty(), "{failed:#?}"); +} + +#[test] +fn overprinting_gradient_strokes_type_freeforms_and_spot_inks_keep_the_ink_below_on_postscript_plates() { + let (inked, none) = (Color::cmyk(0.6, 0.3, 0.0, 0.0), Color::cmyk(0.0, 0.3, 0.0, 0.0)); + let stops = [(0.0, inked), (0.3, none), (0.6, none), (1.0, inked)]; + let across = GradientGeom { start: Point::new(30.0, 40.0), end: Point::new(170.0, 60.0), aspect: 1.0, focal: None }; + let linear = gradient(GradientKind::Linear, &stops, across, GradientSpread::Pad); + let stroked = |mode: StrokeGradientMode| { + let mut n = overprinting(Paint::None, linear.clone()); + if let Some(st) = n.appearance.stroke_mut() { + st.gradient_mode = mode; + } + n + }; + // Type: a gradient placed on the characters' bounds. + let on_type = GradientPaint::new(Gradient::new(GradientKind::Linear, stops.iter().map(|(o, c)| GradientStop::new(*o, *c)).collect())); + let style = CharStyle { fill: Paint::Gradient(Box::new(on_type)), overprint_fill: true, size: 80.0, ..Default::default() }; + let text = Node::new(NodeId(0), NodeKind::Text(Box::new(TextObject::point(Point::new(20.0, 85.0), "HIM", style)))); + // A freeform gradient with wide spreads of pure color around its points: none of the cyan + // around the left one. + let mut freeform = GradientPaint::new(Gradient::new(GradientKind::Freeform, vec![GradientStop::new(0.0, none), GradientStop::new(1.0, inked)])); + let pure = |at: Point, c: Color| FreeformPoint { spread: 0.9, ..FreeformPoint::new(at, c) }; + let points = vec![pure(Point::new(50.0, 50.0), none), pure(Point::new(150.0, 50.0), inked)]; + freeform.freeform = Some(Freeform { points, ..Default::default() }); + // A spot ink's own plate: its tints in the outer stops, none of it from 0.3 to 0.6. + let tint = |t: f32| GradientStop { swatch: Some("Ink".into()), tint: t, ..GradientStop::new(0.0, Color::cmyk(0.0, 0.0, 0.0, t)) }; + let spot = [ + GradientStop { offset: 0.0, ..tint(0.8) }, + GradientStop::new(0.3, none), + GradientStop::new(0.6, none), + GradientStop { offset: 1.0, ..tint(0.5) }, + ]; + let mut on_spot = GradientPaint::new(Gradient::new(GradientKind::Linear, spot.to_vec())); + on_spot.geom = Some(across); + let cyan = Paint::solid(Color::cmyk(1.0, 0.0, 0.0, 0.0)); + let full = Paint::Solid { color: Color::cmyk(0.0, 0.0, 0.0, 1.0), swatch: Some("Ink".into()), tint: 1.0 }; + let cases = [ + ("stroke within", stroked(StrokeGradientMode::Within), cyan.clone(), "Cyan"), + ("stroke along", stroked(StrokeGradientMode::Along), cyan.clone(), "Cyan"), + ("stroke across", stroked(StrokeGradientMode::Across), cyan.clone(), "Cyan"), + ("type", text, cyan.clone(), "Cyan"), + ("freeform", overprinting(Paint::Gradient(Box::new(freeform)), Paint::None), cyan, "Cyan"), + ("spot", overprinting(Paint::Gradient(Box::new(on_spot)), Paint::None), full, "Ink"), + ]; + assert_keeps_the_ink_below(&cases); +} diff --git a/crates/eps/src/scene.rs b/crates/eps/src/scene.rs index 5bbb1c9fed..9aae8bb98c 100644 --- a/crates/eps/src/scene.rs +++ b/crates/eps/src/scene.rs @@ -8,6 +8,7 @@ use std::sync::Arc; use kurbo::Shape; use vectorcraft_color::{BlendMode, Color, GradientKind, GradientPaint, Paint}; +use vectorcraft_doc::overprint::is_white; use vectorcraft_doc::{ AppearanceItem, ColorMode, Document, Effect, ImageBlob, LineCap, LineJoin, Node, NodeKind, StrokeAlign, StrokeLayer, SymbolBoxes, TextObject, }; @@ -213,6 +214,14 @@ impl GradientSpace { GradientSpace::Inks(_, n) => *n, } } + + /// Whether components `c` in this space are paper white: no ink, or full light. + fn paper(&self, c: &[f32]) -> bool { + match self { + GradientSpace::Process(Space::Gray | Space::Rgb) => c.iter().all(|v| *v >= 1.0), + GradientSpace::Process(Space::Cmyk) | GradientSpace::Inks(..) => c.iter().all(|v| *v <= 0.0), + } + } } /// A gradient's stops as written: offsets from 0 to 1 and the components in its space. @@ -287,6 +296,12 @@ pub(crate) struct Scene<'a> { max_body: usize, /// Symbols and brush art being written inside one another. nest: u32, + /// The document is a separation's plate: every color is the gray of one ink's coverage + /// ([`Self::on_plate`]). + plate: bool, + /// The gradient being painted overprints on a plate: where it is paper white it puts none of + /// the plate's ink down, and the plate below it is left as it is ([`Self::inked_spans`]). + keep_below: bool, } impl<'a> Scene<'a> { @@ -315,9 +330,19 @@ impl<'a> Scene<'a> { pending: 0, max_body: MAX_BODY, nest: 0, + plate: false, + keep_below: false, } } + /// This scene drawing a separation's plate when `plate` is true: an overprinting gradient + /// paints only where it puts the plate's ink down, as an overprinting solid color that puts + /// none down is drawn as nothing on it. + pub fn on_plate(mut self, plate: bool) -> Self { + self.plate = plate; + self + } + /// This scene with a page body of at most `max` bytes. #[cfg(test)] pub fn with_max_body(mut self, max: usize) -> Self { @@ -689,13 +714,20 @@ impl<'a> Scene<'a> { self.line("q"); push_path(&mut self.body, bp); self.body.push_str(clip_op(rule)); - self.paint_area(p, bounds, bp.bounding_box()); + self.paint_overprinting(overprint, p, bounds, bp.bounding_box()); self.line("Q"); } } self.overprint_off(on); } + /// [`Self::paint_area`] for a fill or stroke that overprints when `overprint` is true. + fn paint_overprinting(&mut self, overprint: bool, p: &Paint, bounds: Rect, area: Rect) { + let keep = std::mem::replace(&mut self.keep_below, self.plate && overprint); + self.paint_area(p, bounds, area); + self.keep_below = keep; + } + /// Paint all of `area` (inside the current clip) with gradient or pattern `p`, placed on /// `bounds`. fn paint_area(&mut self, p: &Paint, bounds: Rect, area: Rect) { @@ -786,7 +818,7 @@ impl<'a> Scene<'a> { self.line("q"); push_path(&mut self.body, bp); self.line("strokepath W"); - self.paint_area(p, paint_bounds, w.reach(st, bounds)); + self.paint_overprinting(st.overprint, p, paint_bounds, w.reach(st, bounds)); self.line("Q"); } } @@ -1152,7 +1184,8 @@ impl<'a> Scene<'a> { /// Paint all of `area` (inside the current clip) with linear, radial, conic or diamond gradient /// `g`, placed on `bounds`: a smooth shading at Level 3, else stepped fills (a conic: wedges at - /// both levels; a diamond: four linear gradients, [`Self::diamond_quadrants`]). + /// both levels; a diamond: four linear gradients, [`Self::diamond_quadrants`]). Overprinting + /// on a plate, it is clipped to the levels where it puts ink down ([`Self::inked_spans`]). fn gradient(&mut self, g: &GradientPaint, bounds: Rect, area: Rect) { let geom = g.resolve(bounds); // One mixed around the hue wheel that reflects is repeated from its curve's stops, which @@ -1185,7 +1218,7 @@ impl<'a> Scene<'a> { } let (space, stops) = self.gradient_stops(&g.gradient); if !stops.windows(2).any(|w| w[1].0 > w[0].0) { - if let Some((_, c)) = stops.first() { + if let Some((_, c)) = stops.first().filter(|(_, c)| !(self.keep_below && space.paper(c))) { self.set_comps(&space, c); self.rect_fill(area); } @@ -1193,20 +1226,47 @@ impl<'a> Scene<'a> { } let space = &space; let smooth = self.o.level == Level::Three && !self.o.compatible_gradients; + let spans = if g.gradient.kind == GradientKind::Conic { None } else { self.inked_spans(space, &stops) }; match g.gradient.kind { GradientKind::Conic => self.conic_steps(&geom, area, space, &stops, &g.gradient), - GradientKind::Diamond => self.diamond_quadrants(&geom, area, space, &stops, smooth), + GradientKind::Diamond => { + // Its levels are diamonds about the center, the square's edge at 1. + let frame = geom.diamond_frame(); + if let Some(spans) = &spans { + let Some(frame) = frame else { + // Without a frame it is its last stop everywhere. + if stops.last().is_some_and(|(_, c)| !space.paper(c)) { + self.diamond_quadrants(&geom, area, space, &stops, smooth); + } + return; + }; + let level = |t: f64| (t > 0.0).then(|| frame * BezPath::from_vec(diamond(t))); + self.line("q"); + let clipped = self.clip_rings(spans, area.inflate(1.0, 1.0), level); + if clipped { + self.diamond_quadrants(&geom, area, space, &stops, smooth); + } + self.line("Q"); + return; + } + self.diamond_quadrants(&geom, area, space, &stops, smooth); + } GradientKind::Radial => { let r = geom.length().max(1e-6); let squash = geom.radial_squash(); let inv = squash.inverse(); let (f, c) = (inv * geom.focal_point(), geom.start); + let local = inv.transform_rect_bbox(area); self.line("q"); let _ = writeln!(self.body, "{} cm", ps::matrix(squash)); - if smooth { - self.shading(3, space, &[f.x, f.y, 0.0, c.x, c.y, r], &stops); - } else { - self.radial_steps(f, c, r, inv.transform_rect_bbox(area), space, &stops); + // Its levels are circles from the focal point, at 1 the circle of radius `r`. + let level = |t: f64| (t > 0.0).then(|| kurbo::Circle::new(f + (c - f) * t, r * t).to_path(0.01)); + if spans.as_ref().is_none_or(|spans| self.clip_rings(spans, local.inflate(1.0, 1.0), level)) { + if smooth { + self.shading(3, space, &[f.x, f.y, 0.0, c.x, c.y, r], &stops); + } else { + self.radial_steps(f, c, r, local, space, &stops); + } } self.line("Q"); } @@ -1215,15 +1275,121 @@ impl<'a> Scene<'a> { if s.distance(e) < 1e-9 { e = s + Vec2::new(1.0, 0.0); } - if smooth { - self.shading(2, space, &[s.x, s.y, e.x, e.y], &stops); + if let Some(spans) = &spans { + self.line("q"); + if self.clip_strips(spans, s, e, area) { + self.linear(s, e, area, space, &stops, smooth); + } + self.line("Q"); } else { - self.linear_steps(s, e, area, space, &stops); + self.linear(s, e, area, space, &stops, smooth); } } } } + /// A linear gradient from `s` to `e` over `area`: a smooth shading, else stepped fills. + fn linear(&mut self, s: Point, e: Point, area: Rect, space: &GradientSpace, stops: &[(f64, Vec)], smooth: bool) { + if smooth { + self.shading(2, space, &[s.x, s.y, e.x, e.y], stops); + } else { + self.linear_steps(s, e, area, space, stops); + } + } + + /// Where an overprinting gradient with `stops` in `space` puts ink on a plate + /// ([`Self::keep_below`]): the spans of its levels outside every stretch between two stops of + /// paper white and outside the padding past an end whose stop is paper white, in order, an + /// end padding with ink unbounded. `None` when the gradient puts ink everywhere or does not + /// overprint on a plate; empty when it puts none down. + fn inked_spans(&self, space: &GradientSpace, stops: &[(f64, Vec)]) -> Option> { + if !self.keep_below { + return None; + } + let stretches: Vec<_> = stops.windows(2).filter(|w| w[1].0 > w[0].0).collect(); + let (first, last) = (stretches.first()?, stretches.last()?); + // The padding takes the end stop's color stepped and the end stretch's color smooth. + let before = stops.first().is_some_and(|s| space.paper(&s.1)) && space.paper(&first[0].1); + let after = stops.last().is_some_and(|s| space.paper(&s.1)) && space.paper(&last[1].1); + let mut blank: Vec<(f64, f64)> = vec![]; + let mut add = |a: f64, b: f64| match blank.last_mut() { + Some(l) if l.1 >= a => l.1 = l.1.max(b), + _ => blank.push((a, b)), + }; + if before { + add(f64::NEG_INFINITY, first[0].0); + } + for w in &stretches { + if space.paper(&w[0].1) && space.paper(&w[1].1) { + add(w[0].0, w[1].0); + } + } + if after { + add(last[1].0, f64::INFINITY); + } + if blank.is_empty() { + return None; + } + let mut inked = vec![]; + let mut from = f64::NEG_INFINITY; + for (a, b) in blank { + if a > from { + inked.push((from, a)); + } + from = b; + } + if from < f64::INFINITY { + inked.push((from, f64::INFINITY)); + } + Some(inked) + } + + /// Clip to the parts of `area` where a linear gradient from `s` to `e` has a level in `spans`: + /// a strip across the gradient for each. False, with nothing written, when no span reaches + /// into `area`. + fn clip_strips(&mut self, spans: &[(f64, f64)], s: Point, e: Point, area: Rect) -> bool { + let d = e - s; + let len = d.hypot(); + // Gradient space: x along the gradient (0 to 1), y across it in points. + let frame = Affine::new([d.x, d.y, -d.y / len, d.x / len, s.x, s.y]); + let local = frame.inverse().transform_rect_bbox(area.inflate(1.0, 1.0)); + let mut bp = BezPath::new(); + for &(a, b) in spans { + let (a, b) = (a.max(local.x0), b.min(local.x1)); + if a < b { + bp.extend((frame * Rect::new(a, local.y0, b, local.y1).to_path(0.1)).iter()); + } + } + self.clip_path(&bp, FillRule::NonZero) + } + + /// Clip to the levels in `spans` of a gradient whose level `t` is bounded by `level(t)` (a + /// closed path holding every lower level; `None` for a level without area): for each span + /// the ring between its levels, an unbounded end at `outer`, even-odd. False, with nothing + /// written, when no span has area. + fn clip_rings(&mut self, spans: &[(f64, f64)], outer: Rect, level: impl Fn(f64) -> Option) -> bool { + let mut bp = BezPath::new(); + for &(a, b) in spans { + let edge = if b.is_finite() { level(b) } else { Some(outer.to_path(0.1)) }; + let Some(edge) = edge else { continue }; + bp.extend(edge.iter()); + if let Some(inner) = level(a).filter(|_| a.is_finite()) { + bp.extend(inner.iter()); + } + } + self.clip_path(&bp, FillRule::EvenOdd) + } + + /// Clip to `bp` by `rule`. False, with nothing written, when `bp` is empty. + fn clip_path(&mut self, bp: &BezPath, rule: FillRule) -> bool { + if bp.elements().is_empty() { + return false; + } + push_path(&mut self.body, bp); + self.body.push_str(clip_op(rule)); + true + } + /// A conic gradient as [`CONIC_WEDGE_COUNT`] solid wedges about its center covering `area` /// (PostScript has no conic shading), each running on to the seam under the next, so no /// hairline shows between neighbors ([`vectorcraft_color::GradientGeom::conic_wedges`]). @@ -1243,7 +1409,24 @@ impl<'a> Scene<'a> { Some(w) => w[1].1.clone(), None => stops.last().map_or_else(Vec::new, |s| s.1.clone()), }; - for (pts, t) in geom.conic_wedges(area, g.conic_wedge_count(CONIC_WEDGE_COUNT), true) { + let count = g.conic_wedge_count(CONIC_WEDGE_COUNT); + // Overprinting on a plate: clipped to the wedges that put ink down, each up to the next. + let clipped = self.keep_below && { + let wedges = geom.conic_wedges(area, count, false); + let inked: Vec<_> = wedges.iter().filter(|(_, t)| !space.paper(&at(spread(*t)))).collect(); + if inked.is_empty() { + return; + } + inked.len() < wedges.len() && { + let mut bp = BezPath::new(); + for (pts, _) in inked { + bp.extend(BezPath::from_vec(polygon(pts)).iter()); + } + self.line("q"); + self.clip_path(&bp, FillRule::NonZero) + } + }; + for (pts, t) in geom.conic_wedges(area, count, true) { self.set_comps(space, &at(spread(t))); for (i, p) in pts.iter().enumerate() { push_nums(&mut self.body, &[p.x, p.y]); @@ -1251,6 +1434,9 @@ impl<'a> Scene<'a> { } self.line("closepath fill"); } + if clipped { + self.line("Q"); + } } /// A diamond gradient over `area` as four linear gradients, each clipped to a quadrant of its @@ -1442,20 +1628,68 @@ impl<'a> Scene<'a> { let field = g.freeform_on(b).model_field(spread_scale(b)); let q = |v: f32| (unit(v) * 255.0).round() as u8; let (w, h) = (u32::from(cols), u32::from(rows)); + // Overprinting on a plate: the cells of paper white put none of the ink down, so they are + // left out, as clear pixels at Level 3 and outside a clip of the other cells at Level 2. + let blank: Option> = self.keep_below.then(|| field.grid(area, cols, rows).map(|(c, _)| is_white(&Paint::solid(c))).collect()); + let blank = blank.filter(|b| b.contains(&true)); + if blank.as_ref().is_some_and(|b| !b.contains(&false)) { + return; + } + let keyed = self.o.level == Level::Three; + let clear = |i: usize, a: u8| if keyed && blank.as_ref().is_some_and(|b| b[i]) { 0 } else { a }; let image = if field.model() == Some(Model::Cmyk) || (self.cmyk && field.model() == Some(Model::Gray)) { let inks: Vec = field .grid(area, cols, rows) - .flat_map(|(color, a)| { + .enumerate() + .flat_map(|(i, (color, a))| { let [c, m, y, k] = color.to_cmyk(); - [q(c), q(m), q(y), q(k), q(a)] + [q(c), q(m), q(y), q(k), clear(i, q(a))] }) .collect(); self.encode_inks(&inks, w, h) } else { - let rgba: Vec = field.display_grid(area, cols, rows).flat_map(|(c, a)| [q(c[0]), q(c[1]), q(c[2]), q(a)]).collect(); + let rgba: Vec = + field.display_grid(area, cols, rows).enumerate().flat_map(|(i, (c, a))| [q(c[0]), q(c[1]), q(c[2]), clear(i, q(a))]).collect(); self.encode_image(&rgba, w, h) }; let Some(image) = image else { return }; + let cells = blank.filter(|_| !keyed).map(|b| { + let (cw, ch) = (area.width() / f64::from(cols), area.height() / f64::from(rows)); + let mut bp = BezPath::new(); + for (row, line) in b.chunks(usize::from(cols)).enumerate() { + let mut col = 0; + while col < line.len() { + let start = col; + while col < line.len() && !line[col] { + col += 1; + } + if col > start { + let (y0, y1) = (area.y0 + row as f64 * ch, area.y0 + (row + 1) as f64 * ch); + bp.extend(Rect::new(area.x0 + start as f64 * cw, y0, area.x0 + col as f64 * cw, y1).to_path(0.1).iter()); + } + col += 1; + } + } + bp + }); + if let Some(bp) = &cells { + // Each row's run of cells is a rectangle of five path elements, about 60 bytes. + if self.size().saturating_add(bp.elements().len().saturating_mul(12)).saturating_add(image.inline_len) > self.max_body { + self.warn(TOO_LARGE); + return; + } + self.line("q"); + self.clip_path(bp, FillRule::NonZero); + } + self.place_field(image, place); + if cells.is_some() { + self.line("Q"); + } + } + + /// Place freeform gradient image `image` on the unit square mapped by `place`, drawn from an + /// image already kept when one is encoded the same. + fn place_field(&mut self, image: ImageCode, place: Affine) { let key = image.content_key(); let found = self.fields.get(&key).and_then(|bucket| bucket.iter().copied().find(|&i| self.codes.get(i).is_some_and(|c| c.same_image(&image)))); @@ -1849,6 +2083,19 @@ fn image_code(prelude: String, dict: String, filter: &'static str, op: &'static code } +/// The closed polygon through `pts`. +fn polygon(pts: &[Point]) -> Vec { + let mut els: Vec = + pts.iter().enumerate().map(|(i, p)| if i == 0 { kurbo::PathEl::MoveTo(*p) } else { kurbo::PathEl::LineTo(*p) }).collect(); + els.push(kurbo::PathEl::ClosePath); + els +} + +/// The square with corners (±`t`, 0) and (0, ±`t`). +fn diamond(t: f64) -> Vec { + polygon(&[Point::new(t, 0.0), Point::new(0.0, t), Point::new(-t, 0.0), Point::new(0.0, -t)]) +} + /// `a` to `b` at `t`. fn mix(a: &[f32], b: &[f32], t: f32) -> Vec { a.iter().zip(b).map(|(x, y)| x + (y - x) * t).collect() diff --git a/crates/pdf/src/print/plates.rs b/crates/pdf/src/print/plates.rs index 74102373e5..6cf3dcc289 100644 --- a/crates/pdf/src/print/plates.rs +++ b/crates/pdf/src/print/plates.rs @@ -7,7 +7,7 @@ use std::sync::Arc; use vectorcraft_color::cms::{self, Cms, Model, ProfileKind}; use vectorcraft_color::swatch::REGISTRATION; -use vectorcraft_color::{BlendMode, Color, GradientKind, Paint}; +use vectorcraft_color::{BlendMode, Color, GradientKind, GradientStop, Paint}; use vectorcraft_doc::inks::{Link, StopPlates, inks, plates, spot_color, stop_inks, visit_node_colors}; use vectorcraft_doc::overprint::{darken_overprints, is_black_ink, is_white}; use vectorcraft_doc::{AppearanceItem, ColorMode, Document, ImageBlob, Node, NodeKind}; @@ -174,33 +174,74 @@ impl<'a> Separator<'a> { /// spot swatch, to Registration or to a swatch the document lacks: up to the half a percent of /// another ink such a black may carry counts as none. fn no_ink(&self, plate: &str, p: &Paint) -> bool { - let process = |swatch: Option<&str>| swatch.is_none_or(|n| n != REGISTRATION && self.doc.swatch(n).is_some_and(|w| !w.spot)); - let none = |c: &Color, process: bool, ink: f32| ink <= 0.0 || (self.postscript && process && ink <= 0.005 && is_black_ink(c, 1.0, false)); match p { Paint::Solid { color, swatch, tint } => { - none(color, process(swatch.as_deref()), self.ink(plate, color, swatch.as_deref().map(|s| (s, *tint)))) + self.none(color, self.process(swatch.as_deref()), self.ink(plate, color, swatch.as_deref().map(|s| (s, *tint)))) } Paint::Gradient(g) => match g.freeform.as_ref().filter(|f| g.gradient.kind == GradientKind::Freeform && !f.points.is_empty()) { - Some(f) => f.points.iter().all(|pt| none(&pt.color, true, self.ink(plate, &pt.color, None))), - None => { - !g.gradient.stops.is_empty() - && g.gradient.stops.iter().all(|s| { - let ink = self.stop_ink(plate, &s.color, s.swatch.as_deref().map(|n| (n, s.tint)), s.plates); - none(&s.color, s.plates.is_none() && process(s.swatch.as_deref()), ink) - }) - } + Some(f) => f.points.iter().all(|pt| self.point_none(plate, &pt.color)), + None => !g.gradient.stops.is_empty() && g.gradient.stops.iter().all(|s| self.stop_none(plate, s)), }, _ => false, } } + /// Whether a color linked to swatch `swatch` separates as process inks: no link, or a link + /// to a process swatch the document has, other than Registration. + fn process(&self, swatch: Option<&str>) -> bool { + swatch.is_none_or(|n| n != REGISTRATION && self.doc.swatch(n).is_some_and(|w| !w.spot)) + } + + /// Whether `ink` of color `c` (separating as process inks when `process` is true) counts as + /// none, as [`Self::no_ink`] says. + fn none(&self, c: &Color, process: bool, ink: f32) -> bool { + ink <= 0.0 || (self.postscript && process && ink <= 0.005 && is_black_ink(c, 1.0, false)) + } + + /// Whether gradient stop `s` puts none of ink `plate` down, as [`Self::no_ink`] says. + fn stop_none(&self, plate: &str, s: &GradientStop) -> bool { + let ink = self.stop_ink(plate, &s.color, s.swatch.as_deref().map(|n| (n, s.tint)), s.plates); + self.none(&s.color, s.plates.is_none() && self.process(s.swatch.as_deref()), ink) + } + + /// Whether a freeform gradient's point of color `c` puts none of ink `plate` down, as + /// [`Self::no_ink`] says. + fn point_none(&self, plate: &str, c: &Color) -> bool { + self.none(c, true, self.ink(plate, c, None)) + } + + /// On a PostScript plate, make paper white the stops and points of overprinting gradient `p` + /// that put none of ink `plate` down while others do ([`Self::no_ink`]'s rule for each): the + /// writer leaves the plate below as it is where the gradient is paper white. + fn clear_inkless_stops(&self, plate: &str, p: &mut Paint) { + let Paint::Gradient(g) = p else { return }; + if !self.postscript { + return; + } + let paper = Color::Gray { k: 0.0 }; + match g.freeform.as_mut().filter(|f| g.gradient.kind == GradientKind::Freeform && !f.points.is_empty()) { + Some(f) => { + for pt in f.points.iter_mut().filter(|pt| self.point_none(plate, &pt.color)) { + pt.color = paper; + } + } + None => { + for s in g.gradient.stops.iter_mut().filter(|s| self.stop_none(plate, s)) { + *s = GradientStop { color: paper, swatch: None, tint: 1.0, plates: None, ..s.clone() }; + } + } + } + } + /// Overprinting fills and strokes of `a`'s subtree with a Normal blending mode, and /// overprinting character fills and strokes, that put none of ink `plate` down leave its plate /// as it is: they are drawn as nothing on it (white ones with `discard_white` aside, which /// knock out). A writer without blending modes (PostScript) then keeps the ink below them, /// where it would draw their Darken as a knockout. One that puts any ink down is drawn, and on /// a PostScript plate its ink replaces the ink below, as a nonzero component of an overprinting - /// color replaces the backdrop's with overprint mode 1 (ISO 32000-1, 11.7.4.2). + /// color replaces the backdrop's with overprint mode 1 (ISO 32000-1, 11.7.4.2). On a + /// PostScript plate, the stops and points of such a gradient that put none of the ink down + /// become paper white ([`Self::clear_inkless_stops`]), which the writer leaves out there. fn clear_inkless_overprints(&self, plate: &str, a: &mut Arc, discard_white: bool) { let inkless = |overprint: bool, p: &Paint| overprint && !p.is_none() && !(discard_white && is_white(p)) && self.no_ink(plate, p); let n = Arc::make_mut(a); @@ -211,15 +252,21 @@ impl<'a> Separator<'a> { }; if normal && inkless(it.overprint(), it.paint()) { *it.paint_mut() = Paint::None; + } else if normal && it.overprint() { + self.clear_inkless_stops(plate, it.paint_mut()); } } if let NodeKind::Text(t) = &mut n.kind { for r in &mut t.runs { if inkless(r.style.overprint_fill, &r.style.fill) { r.style.fill = Paint::None; + } else if r.style.overprint_fill { + self.clear_inkless_stops(plate, &mut r.style.fill); } if inkless(r.style.overprint_stroke, &r.style.stroke) { r.style.stroke = Paint::None; + } else if r.style.overprint_stroke { + self.clear_inkless_stops(plate, &mut r.style.stroke); } } } diff --git a/crates/pdf/src/tests/print.rs b/crates/pdf/src/tests/print.rs index 49a34ff428..9b9c5ec92e 100644 --- a/crates/pdf/src/tests/print.rs +++ b/crates/pdf/src/tests/print.rs @@ -925,6 +925,42 @@ fn overprinting_paints_keep_their_faint_ink_on_postscript_plates() { } } +#[test] +fn a_near_black_stop_of_an_overprinting_gradient_puts_no_cyan_on_postscript_plates() { + // 0.4% cyan beside 100% K counts as black on a PostScript plate stop by stop, as a solid fill + // of it does: the cyan plate draws that stop of an overprinting gradient as paper white. A + // PDF plate and a gradient that does not overprint keep the 0.4%. + let stops = vec![GradientStop::new(0.0, Color::cmyk(0.004, 0.0, 0.0, 1.0)), GradientStop::new(1.0, Color::cmyk(0.5, 0.0, 0.0, 0.0))]; + let fade = Paint::Gradient(Box::new(GradientPaint::new(Gradient::new(GradientKind::Linear, stops)))); + let square = |x: f64, overprint: bool| { + let r = shapes::rectangle(Rect::new(x, 15.0, x + 20.0, 35.0)); + let mut n = Node::path(vectorcraft_doc::NodeId(0), r, Appearance::basic(fade.clone(), Paint::None, 0.0)); + if let Some(f) = n.appearance.fill_mut() { + f.overprint = overprint; + } + n + }; + let d = over_cyan(vec![square(10.0, true), square(40.0, false)]); + // The cyan plate's stops of each gradient, in thousandths of the ink. + let stops = |postscript: bool| { + let opts = PrintOptions { settings: settings(json!({"output": {"mode": "separations"}})), postscript, ..Default::default() }; + let p = plan(&d, &opts).unwrap(); + let mut all = vec![]; + p.plates[0].walk(|n| { + if let Some(Paint::Gradient(g)) = n.appearance.fill().map(|f| &f.paint) { + let gray = |s: &GradientStop| match s.color { + Color::Gray { k } if s.swatch.is_none() => (k * 1000.0).round(), + c => panic!("{c:?}"), + }; + all.push(g.gradient.stops.iter().map(gray).collect::>()); + } + }); + all + }; + assert_eq!(stops(true), [[0.0, 500.0], [4.0, 500.0]], "PostScript: the overprinting gradient, the other"); + assert_eq!(stops(false), [[4.0, 500.0], [4.0, 500.0]], "PDF"); +} + #[test] fn overprinting_type_leaves_the_inks_below_on_separations() { let style = vectorcraft_doc::CharStyle { fill: Paint::solid(Color::cmyk(0.0, 0.0, 0.0, 1.0)), ..Default::default() }; diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e9fc9a6820..f3e39caba1 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2067,6 +2067,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Desktop print transport uses `craft-print` for CUPS and modern Windows. Sheet composition, copies, separations and colour management remain in VectorCraft. The Print dialog's Media list also carries the Japanese papers — JIS B4 257 × 364 mm, JIS B5 182 × 257 mm and JIS B6 128 × 182 mm beside the ISO B4/B5 (250 × 353 and 176 × 250 mm, kept so settings and presets saved before them keep their paper), and はがき 100 × 148 mm, 往復はがき 148 × 200 mm, 封筒 長形3号 120 × 235 mm, 長形4号 90 × 225 mm, 角形2号 240 × 332 mm, 角形3号 216 × 277 mm and 四六判 127 × 188 mm; the JSON id or the dialog label names a paper, any case and spacing (`B5 (JIS)` or `b5jis`) (`crates/pdf/src/print/settings.rs`, `crates/pdf/src/tests/print.rs`). The print-preview and physical-device fidelity gaps remain, so print scores and hours are unchanged. - The Print dialog's Document Ink Options list shows an icon before each spot ink's name, and a click on it prints that one ink as process inks (on the Cyan, Magenta, Yellow and Black plates, with no plate of its own) or as a spot ink again, as [the help page](https://helpx.adobe.com/illustrator/using/printing-color-separations.html) describes for single spot colors. Other spot inks keep their plates, and spot gradient stops and DCS images' spot plates follow each ink's choice (`print.setup {settings: {output: {inks: [{name, convertToProcess: true}]}}}`, kept with the document and in print presets; `print.preview` lists every ink as `documentInks`). These are VectorCraft's own rules: Convert All Spot Colors to Process converts every spot ink and dims the icons while keeping each ink's own choice, a converted ink's Print, Frequency and Angle are dimmed and kept, and process inks and Registration have no icon. Evidence: `print::one_spot_ink_converts_to_process_and_the_others_keep_their_plates`, `print::converting_every_spot_ink_overrides_and_keeps_each_inks_own_choice`, `print::a_spot_gradient_stop_prints_its_process_plates`, `cmykimages::a_dcs_image_converts_only_the_spot_ink_chosen`, `tests::print::a_spot_ink_converted_to_process_is_saved_and_listed_without_a_plate`, `dialogs::tests_print::a_spot_inks_icon_converts_it_to_process_and_back`. Print scores and hours are unchanged. - The Print dialog's Output section has Overprint Black under Convert All Spot Colors to Process, off by default and available with Separations ([Print color separations](https://helpx.adobe.com/illustrator/using/printing-color-separations.html) lists it among the separation options): black art then leaves the inks under it on the other plates (`print.setup {settings: {output: {overprintBlack: true}}}`, kept with the document and in print presets). Solid 100% K or 100% gray fills, strokes and characters (to within half a percent, as Edit › Edit Colors › Overprint Black counts them), and gradients whose every stop (every color point of a freeform gradient) is, overprint; rich, RGB, Lab, spot-linked and lighter blacks are not marked, paints already set to overprint keep that setting, and only the printed copy is marked. These limits are VectorCraft's own rules. Characters set to overprint now also leave the inks below them on printed PDF plates, a type object's own fill in a PDF is drawn with its blending mode, and Edit › Edit Colors › Overprint Black counts a gradient with a stop linked to a spot swatch as a spot black, as it counts a solid one, and a freeform gradient by the color points it draws from. On a plate, an overprinting paint that puts none of that plate's ink down is drawn as nothing; on PostScript plates so is up to half a percent of another ink in a color that counts as black, and any other faint ink stays on the plate. Evidence: `print::overprint_black_keeps_the_inks_under_solid_black_on_separations`, `print::overprint_black_keeps_the_cyan_under_near_and_freeform_blacks_on_postscript_plates`, `print::overprinting_paints_keep_their_faint_ink_on_postscript_plates`, `print::overprinting_type_leaves_the_inks_below_on_separations`, `print::a_type_objects_own_black_fill_overprints_on_separations`, `tests::print::overprint_black_is_saved_with_the_setup_and_in_presets`, `overprint::tests::a_gradient_with_a_spot_linked_stop_is_black_only_with_spot`, `overprint::tests::a_freeform_gradient_is_black_when_every_point_is`. Print scores and hours are unchanged. + - On a PostScript plate, an overprinting gradient that puts the plate's ink down in some places and none in others leaves the ink below where it puts none: the stretches between stops of paper white and the padding past an end stop of paper white are clipped out of a linear, radial or diamond gradient, the wedges of paper white out of a conic one, and the cells of paper white out of a freeform one (masked at Level 3, clipped at Level 2). This holds for fills, strokes and characters, and on spot plates. Where the gradient puts ink down, its amount replaces the ink below as before. A stop or point with up to half a percent of another ink in a color that counts as black puts none down, as a solid fill of that color does. PDF plates are unchanged. These are VectorCraft's own rules. Evidence: `print::tests::an_overprinting_gradient_keeps_the_ink_below_where_it_puts_none_on_a_postscript_plate` and `print::tests::overprinting_gradient_strokes_type_freeforms_and_spot_inks_keep_the_ink_below_on_postscript_plates` (`vectorcraft-eps`), `tests::print::a_near_black_stop_of_an_overprinting_gradient_puts_no_cyan_on_postscript_plates`. - The Print dialog's General section (and the print preset editor) has a link button after Scale W and H, as the Custom scale has one on [the help page](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/print-documents-in-illustrator.html), where turning it off scales the width and height apart. While it is on, typing either percentage sets the other, and turning it on sets H to W. It is on for new settings, dimmed with the fields unless Scaling is Custom or a tiling choice, toggled with a click, Space or Enter, and named with its on or off state for screen readers. W and H take 1–1000% in the fields. The link is kept with the document's print settings and in print presets (`print.setup {settings: {scale: {linked}}}`); settings saved without it read it as off, so they print as before. Its default, the tiling choices and the agent rules are VectorCraft's own. Evidence: `print::the_scale_link_is_on_for_new_settings_and_off_for_a_saved_scale_without_it`, `tests::print::the_scale_link_keeps_width_and_height_equal`, `tests::print::a_scale_saved_without_the_link_keeps_its_width_and_height`, `dialogs::tests_print::the_scale_link_keeps_scale_width_and_height_equal`, `dialogs::tests_print::a_print_preset_keeps_the_scale_link`. Print scores and hours are unchanged. - A PDF, PDF-compatible `.ai` or `.ait` opened from its pages or its editing copy opens with the File Info that its XMP packet and its document information dictionary give: the title (`dc:title`, its `x-default` item first, else Info `Title`), the author, description, keywords, copyright status, notice and URL, and the created and modified dates, the XMP packet's value where both give one (`crates/pdf/src/tests/file_info.rs`, `crates/engine/src/tests/fileinfo.rs`). An SVG opens with the title of its root ``. The title is File Info's alone (`DocMetadata::title`): the document's name stays the file's name with its extension, a file that gives no title leaves File Info with that name, and exports (PDF, SVG, PNG, EPS, `.ai`) and native saves carry it; changing the title in File Info sets the document's name as before (#3626). - PDF export and PDF-compatible `.ai` and `.ait` saves write the document's File Info created date as the file's creation date, or the time of writing when the document has none, and the time of writing as its modification date; the page information mark still prints the time of writing (`crates/engine/src/tests/fileinfo.rs`, `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/marks.rs`). From 8887fc9d00046112e42577f226f59db3c2f2a0f7 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 11:14:38 -0800 Subject: [PATCH 066/158] Live Paint: leaving nested isolated Live Paint groups adds the drawn paths to each Leaving isolation mode in a Live Paint group drawn in another isolated Live Paint group, and that group too (object.exitIsolation, or object.isolate on a level outside both), now adds the drawn paths to each group, innermost first, one undo step each, so the inner group joins the outer one. Before, only the innermost group took its paths, and the inner group and the paths drawn directly in the outer group stayed beside the outer group's faces. A Live Paint group drawn in another one now counts as drawn art: its hidden sources group no longer keeps it out of the outer group. --- crates/engine/src/cmd/buildcmds.rs | 2 +- crates/engine/src/cmd/buildcmds/live_paint.rs | 17 ++++--- crates/engine/src/cmd/object/arrange.rs | 19 ++++--- crates/engine/src/cmd/object/commands.rs | 2 +- crates/engine/src/tests/build.rs | 49 +++++++++++++++++++ docs/mcp.md | 3 +- docs/target-app-parity.md | 2 +- 7 files changed, 76 insertions(+), 18 deletions(-) diff --git a/crates/engine/src/cmd/buildcmds.rs b/crates/engine/src/cmd/buildcmds.rs index 0f7cac48fb..36e04ff23b 100644 --- a/crates/engine/src/cmd/buildcmds.rs +++ b/crates/engine/src/cmd/buildcmds.rs @@ -38,7 +38,7 @@ mod shape_builder; mod trace; pub use live_paint::live_paint_gaps; -pub(crate) use live_paint::{LivePaintMove, check_part_name, clear_part_name, isolated_live_paint, merge_drawn_in_isolation}; +pub(crate) use live_paint::{LivePaintMove, check_part_name, clear_part_name, isolated_live_paints, merge_drawn_in_isolation}; use live_paint::{lp_expand, lp_fill, lp_gap_options, lp_info, lp_make, lp_merge, lp_release, lp_stroke_edge}; use shape_builder::{sb_merge, sb_regions}; pub(crate) use trace::TracePresetChanges; diff --git a/crates/engine/src/cmd/buildcmds/live_paint.rs b/crates/engine/src/cmd/buildcmds/live_paint.rs index c71e1d6f32..116ea0c929 100644 --- a/crates/engine/src/cmd/buildcmds/live_paint.rs +++ b/crates/engine/src/cmd/buildcmds/live_paint.rs @@ -265,19 +265,22 @@ pub(super) fn lp_merge(s: &mut Session, p: &Value) -> Result<Value> { Ok(json!({ "id": id.0, "faces": faces, "edges": edges })) } -/// The Live Paint group whose drawn art is added when isolation mode leaves `isolated`: the innermost -/// Live Paint group that is `isolated` or holds it, such as a group drawn in an isolated Live Paint -/// group and then isolated itself. None when `isolated` is not in a Live Paint group. -pub(crate) fn isolated_live_paint(d: &Document, isolated: NodeId) -> Option<NodeId> { - d.ancestry(isolated)?.into_iter().rev().find(|id| d.node(*id).is_some_and(is_live_paint)) +/// The Live Paint groups whose drawn art can be added when isolation mode leaves `isolated`, innermost +/// first: every Live Paint group that is `isolated` or holds it, such as a group drawn in an isolated +/// Live Paint group and then isolated itself, and the group it was drawn in. Empty when `isolated` is +/// not in a Live Paint group. +pub(crate) fn isolated_live_paints(d: &Document, isolated: NodeId) -> Vec<NodeId> { + d.ancestry(isolated).unwrap_or_default().into_iter().rev().filter(|id| d.node(*id).is_some_and(is_live_paint)).collect() } /// The children of Live Paint group `g` besides its parts ([`others_in`]) that Live Paint takes /// ([`b::live_paint_takes`]) and that are shown and unlocked with everything in them, back to -/// front: the paths drawn in it in isolation mode. +/// front: the paths drawn in it in isolation mode. A Live Paint group's sources group, which is +/// always hidden, does not count. fn drawn_in(g: &Node) -> Vec<NodeId> { fn open(n: &Node) -> bool { - n.visible && !n.locked && n.children().is_none_or(|ch| ch.iter().all(|c| open(c))) + let src = b::sources(n).filter(|_| is_live_paint(n)).map(|s| s.id); + n.visible && !n.locked && n.children().is_none_or(|ch| ch.iter().filter(|c| Some(c.id) != src).all(|c| open(c))) } others_in(g).filter(|c| open(c) && b::live_paint_takes(c)).map(|c| c.id).collect() } diff --git a/crates/engine/src/cmd/object/arrange.rs b/crates/engine/src/cmd/object/arrange.rs index 17568d50b9..3700dd2e9e 100644 --- a/crates/engine/src/cmd/object/arrange.rs +++ b/crates/engine/src/cmd/object/arrange.rs @@ -371,16 +371,21 @@ pub(super) fn isolate(s: &mut Session, p: &Value) -> Result<Value> { } /// Leaving isolation mode in `isolated` for `next` (None: out of isolation mode) adds the paths drawn -/// in the Live Paint group isolation put new art in to that group, as `livePaint.merge` does, in one -/// undo step ([`crate::cmd::buildcmds::merge_drawn_in_isolation`]), unless `next` is that group or is -/// inside it; → the group when paths were added. +/// in each Live Paint group that is `isolated` or holds it to that group, as `livePaint.merge` does, +/// innermost group first, one undo step per group ([`crate::cmd::buildcmds::merge_drawn_in_isolation`]). +/// A group that `next` is or is inside is skipped, since isolation stays in it. → the outermost group +/// that paths were added to. fn add_drawn_live_paint(s: &mut Session, isolated: NodeId, next: Option<NodeId>) -> Result<Option<NodeId>> { let d = &s.doc()?.doc; - let Some(g) = crate::cmd::buildcmds::isolated_live_paint(d, isolated) else { return Ok(None) }; - if next.is_some_and(|n| d.ancestry(n).is_some_and(|a| a.contains(&g))) { - return Ok(None); + let stays = next.and_then(|n| d.ancestry(n)).unwrap_or_default(); + let left: Vec<NodeId> = crate::cmd::buildcmds::isolated_live_paints(d, isolated).into_iter().filter(|g| !stays.contains(g)).collect(); + let mut added = None; + for g in left { + if crate::cmd::buildcmds::merge_drawn_in_isolation(s, g)? { + added = Some(g); + } } - Ok(crate::cmd::buildcmds::merge_drawn_in_isolation(s, g)?.then_some(g)) + Ok(added) } pub(super) fn exit_isolation(s: &mut Session, p: &Value) -> Result<Value> { diff --git a/crates/engine/src/cmd/object/commands.rs b/crates/engine/src/cmd/object/commands.rs index fe9c3dd533..0576dc00d9 100644 --- a/crates/engine/src/cmd/object/commands.rs +++ b/crates/engine/src/cmd/object/commands.rs @@ -250,7 +250,7 @@ pub fn specs() -> Vec<CommandSpec> { "Exit Isolation Mode", [], None, - "{} leave isolation mode; leaving an isolated Live Paint group adds the paths, compound paths and groups of them drawn in it (shown and unlocked with everything in them) to the group as livePaint.merge does, in one undo step, and leaves type, images and other objects in it as they are; object.isolate on a level outside the group does the same", + "{} leave isolation mode; leaving an isolated Live Paint group adds the paths, compound paths and groups of them drawn in it (shown and unlocked with everything in them) to the group as livePaint.merge does, in one undo step, and leaves type, images and other objects in it as they are; object.isolate on a level outside the group does the same. Leaving a Live Paint group drawn in another isolated Live Paint group, and that group too, does this for each, innermost first, one undo step each", has_doc, exit_isolation ), diff --git a/crates/engine/src/tests/build.rs b/crates/engine/src/tests/build.rs index 61a4414599..a3272f6fa9 100644 --- a/crates/engine/src/tests/build.rs +++ b/crates/engine/src/tests/build.rs @@ -5102,6 +5102,55 @@ fn live_paint_isolation_adds_a_drawn_group_isolated_inside_it() { } } +/// With Live Paint group `inner` made in isolated Live Paint group `outer` and then isolated itself, +/// leaving both levels (`object.exitIsolation`, or `object.isolate` on the layer) adds the path drawn +/// in `inner` to it and then `inner` and the path drawn directly in `outer` to `outer`, one undo step +/// each. Isolating `outer` from `inner` adds only `inner`'s drawn path, and `outer` keeps its own. +#[test] +fn live_paint_isolation_merges_nested_live_paint_groups_it_leaves() { + use vectorcraft_tools::builder::{faces, sources}; + for to in ["exit", "layer", "outer"] { + let mut s = session(); + let outer = live(&mut s); + let layer = s.doc().unwrap().doc.parent_of(outer).unwrap(); + s.execute("object.isolate", &json!({"id": outer.0})).unwrap(); + let a = line_across(&mut s, 50.0); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(outer)); + let inner = live(&mut s); + assert_eq!(s.doc().unwrap().doc.parent_of(inner), Some(outer), "the inner group is drawn in the outer one"); + s.execute("object.isolate", &json!({"id": inner.0})).unwrap(); + let b = line_across(&mut s, 30.0); + assert_eq!(s.doc().unwrap().doc.parent_of(b), Some(inner)); + let steps = s.doc().unwrap().history.undo.len(); + match to { + "exit" => s.execute("object.exitIsolation", &json!({})).unwrap(), + "layer" => s.execute("object.isolate", &json!({"id": layer.0})).unwrap(), + _ => s.execute("object.isolate", &json!({"id": outer.0})).unwrap(), + }; + let d = &s.doc().unwrap().doc; + if to == "outer" { + assert_eq!(s.doc().unwrap().isolation, Some(outer)); + assert_eq!(s.doc().unwrap().history.undo.len(), steps + 1, "only the inner group's path joins"); + let n = node(&s, inner); + assert_eq!(d.parent_of(b), Some(sources(&n).unwrap().id), "the path drawn in the inner group joined it"); + assert_eq!(d.parent_of(inner), Some(outer), "the inner group stays drawn in the outer one"); + assert_eq!(d.parent_of(a), Some(outer), "the path drawn in the outer group stays as drawn"); + continue; + } + assert_eq!(s.doc().unwrap().history.undo.len(), steps + 2, "{to}: one undo step for each group"); + assert!(d.node(inner).is_none(), "{to}: the inner group joined the outer one"); + let n = node(&s, outer); + let src = sources(&n).unwrap().id; + assert_eq!(d.parent_of(a), Some(src), "{to}: the path drawn in the outer group joined it"); + assert!(d.ancestry(b).unwrap().contains(&src), "{to}: the path drawn in the inner group is among the outer group's paths"); + assert!(n.children().unwrap().iter().all(|c| c.id == src || c.path_data().is_some()), "{to}: only parts are left in the outer group"); + assert!(faces(&n).len() > 3, "{to}: the added paths cut the outer group's faces"); + if to == "exit" { + assert_eq!(s.doc().unwrap().selection.objects, vec![outer]); + } + } +} + /// A line from left of the [`live`] group to its right face, so it cuts the two faces left of it. fn line_to_right_face(s: &mut Session, y: f64) -> NodeId { let r = s.execute("path.create", &json!({"anchors": [{"x": -10, "y": y}, {"x": 105, "y": y}]})).unwrap(); diff --git a/docs/mcp.md b/docs/mcp.md index 1d24ac803a..30fb854f19 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5435,7 +5435,8 @@ and `layerRows`, the rows highlighted in the panel. Paint group (`object.exitIsolation`, or `object.isolate` on a level outside it) adds the paths, compound paths and groups of them drawn in it, shown and unlocked with everything in them, to the group as `livePaint.merge` does, in one undo step; type, images and other objects stay in it as they are, and with nothing drawn no undo step is - recorded. Face and Edge are the names of a Live Paint group's faces and edges: `layer.setProps` and + recorded. When the isolated Live Paint group was drawn in another isolated Live Paint group, leaving both does this + for each group, innermost first, one undo step each, so the inner group joins the outer one. Face and Edge are the names of a Live Paint group's faces and edges: `layer.setProps` and `object.setProps` return an error when they would give either name to another path directly in the group, and a path pasted directly into the group under either name loses its name. - **Dialogs and panel state** (control channel and the app's MCP): `ui.layerOptions {ids?}` and `ui.newLayer diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 47c5b83267..af36070752 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1688,7 +1688,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Create Strokes decides stroke or fill per feature, as the [help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/image-trace-panel-options.html) describes the Strokes width: the widest feature of the image that can become a stroke. A shape wider than Stroke somewhere keeps as its area every disc wider than Stroke that fits in it, and each piece outside those discs that reaches out of them at least one and a half times its own width (and 3 px) is traced as a stroked center line, its end at the area carried to the cut so the line's cap closes the join. Corners and edge slivers stay in the area. Which pieces count as features is VectorCraft's own rule. Each line still has one width; without Fills, the area is a 1 px outline as before. Tests: `thin_features_of_a_wide_shape_are_strokes_and_its_body_a_fill`, `wide_shapes_without_thin_features_stay_one_fill` and `distances_to_seeds_equal_brute_force` in `vectorcraft-trace`. The Image Trace score and estimates are unchanged. - The ignored centre-lines class measures that split on a mixed-width body scene: one disc with arms of 2, 3 and 5 px, at Stroke 6 px, traces as three stroked paths and one filled path in both the anti-aliased and hard input, with 100.0% of the arms' center samples found and 99.3% (anti-aliased) and 98.3% (hard) of the disc's pixels filled ([quality notes](image-trace-quality.md#centre-lines)). Test: `mixed_width_body_is_one_shape_traced_as_a_fill_and_strokes` in `vectorcraft-trace`. The Image Trace score and estimates are unchanged. Object › Live Paint › Merge adds the other selected paths and Live Paint groups to the bottom selected Live Paint group ([Live Paint groups](https://web.archive.org/web/20241230205225/https://helpx.adobe.com/illustrator/using/live-paint-groups.html)), which keeps its id, the paint of its faces and edges, and its name, lock, visibility, transparency, appearance, opacity mask and graphic style link. Object › Live Paint › Make with a Live Paint group selected, and a Live Paint Bucket click on a selected path beside a selected Live Paint group, add the paths to that group the same way. Make, Merge and the Live Paint Bucket take paths, compound paths and groups of them; with type, an image or another object among the selection they report that it has to be converted to paths first and change nothing, as type and raster images can't go into a Live Paint group directly ([Create Live Paint groups](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/create-live-paint-groups.html)); before, such an object went among the group's hidden sources and vanished from the canvas. Evidence: `tests_build::live_paint_refuses_type_and_images_and_changes_nothing`. - Paths drawn in an isolated Live Paint group join it when isolation mode ends, as the [help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/modify-live-paint-groups.html) describes: drawing paths in the isolated group and pressing Esc adds them. `object.exitIsolation` (Esc, the Control bar and isolation bar exits, a double-click outside, the Layers panel and the canvas context menu) adds the shown, unlocked paths, compound paths and groups of them drawn in the group as Merge does, in one undo step, and `object.isolate` on a level outside the group does the same. As VectorCraft's own rules, type, images, hidden and locked objects drawn there, and groups holding one, stay in the group as they are, and Gap Options, Merge and Release keep them; an exit with nothing drawn records no undo step. Evidence: `tests::build::{live_paint_isolation_adds_drawn_paths_on_exit, live_paint_isolation_adds_only_paths_it_takes, live_paint_isolation_leaves_a_group_holding_a_locked_path, live_paint_isolation_adds_drawn_paths_when_isolating_a_level_outside, live_paint_isolation_adds_a_drawn_group_isolated_inside_it, live_paint_isolation_keeps_art_named_like_its_parts, live_paint_keeps_type_drawn_in_it_through_gap_options_merge_and_release}`. + Paths drawn in an isolated Live Paint group join it when isolation mode ends, as the [help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/modify-live-paint-groups.html) describes: drawing paths in the isolated group and pressing Esc adds them. `object.exitIsolation` (Esc, the Control bar and isolation bar exits, a double-click outside, the Layers panel and the canvas context menu) adds the shown, unlocked paths, compound paths and groups of them drawn in the group as Merge does, in one undo step, and `object.isolate` on a level outside the group does the same. As VectorCraft's own rules, type, images, hidden and locked objects drawn there, and groups holding one, stay in the group as they are, and Gap Options, Merge and Release keep them; an exit with nothing drawn records no undo step; leaving a Live Paint group drawn in another isolated Live Paint group, and that group too, adds the drawn paths to each, innermost first, one undo step each. Evidence: `tests::build::{live_paint_isolation_adds_drawn_paths_on_exit, live_paint_isolation_adds_only_paths_it_takes, live_paint_isolation_leaves_a_group_holding_a_locked_path, live_paint_isolation_adds_drawn_paths_when_isolating_a_level_outside, live_paint_isolation_adds_a_drawn_group_isolated_inside_it, live_paint_isolation_merges_nested_live_paint_groups_it_leaves, live_paint_isolation_keeps_art_named_like_its_parts, live_paint_keeps_type_drawn_in_it_through_gap_options_merge_and_release}`. Paths dragged into a Live Paint group in the Layers panel join it, as the [help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/modify-live-paint-groups.html) describes for adding paths to a group; older guides ([CS6, page 192](https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=192)) say several paths can be dragged at once. A drop inside the group, or above or below one of its rows (`layer.move`, and `node.move` into the group), adds the paths, compound paths, groups of them and Live Paint groups to it as Merge does, in one "Merge Live Paint" undo step that selects the group; an Alt-drag adds copies. As VectorCraft's own rules, type, an image or another object among the dragged rows refuses the whole drop with Merge's message, and a row dragged into or out of the group's hidden sources makes its faces and edges again, keeping the paint of those that stay; with no path left the group has no faces until a path joins it. Evidence: `tests::build::{layers_drag_adds_paths_to_a_live_paint_group, layers_drag_copy_and_drop_beside_a_part_add_to_a_live_paint_group, layers_drag_refuses_type_into_a_live_paint_group, layers_drag_out_of_a_live_paint_group_makes_its_faces_again}`. With the Live Paint Bucket selected, Alt-click on vector art samples its fill, stroke and stroke weight into the paint defaults ([Paint with the Live Paint Bucket tool](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/paint-with-the-live-paint-bucket-tool.html)). On a placed image it samples the image pixel as a solid fill with no stroke. Alt+Shift-click samples only the color under the pointer, including an intermediate gradient color or image pixels, into the active fill or stroke ([Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)). Neither click paints or changes the selection or selected art, and the next Bucket click paints with the sampled paint. Evidence: `tests_build::live_paint_bucket_alt_sample_paints_next_face_without_changing_selection`. Double-clicking the Live Paint Bucket opens Live Paint Bucket Options ([Paint with the Live Paint Bucket tool](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/paint-with-the-live-paint-bucket-tool.html)): Paint Fills (on) and Paint Strokes (off) set whether a click paints faces, edges or both, Highlight turns the outline of the face or edge under the pointer on or off, and Color and Width set it (red and 4 px by default). Faces are outlined at the Width and edges at half of it, as the page says faces are highlighted with a thick line and edges with a thin line. With both on, a click paints the edge within 4 px of the pointer, else the face, and Shift switches to Paint Fills only; with one on, Shift switches to the other. The options last across tool switches and are saved with the preferences (`tool.setOption {tool: "livePaintBucket"}`). Evidence: `builder::tests::{bucket_options_choose_what_a_click_paints, bucket_options_set_the_highlight, bucket_highlights_an_edge_thinner_than_a_face}`, `dialogs::live_paint_bucket::tests::double_clicking_the_tool_opens_its_options_and_ok_sets_them`. From a9ff12b7b4d1def00dcb3c2b2bff650a2a0d4148 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 11:15:28 -0800 Subject: [PATCH 067/158] i18n: remove the obsolete File Info control characters rows from ten catalogs File Info refuses a value with control characters with one of two whole messages, "{k} has control characters" and "{k} has control characters or line breaks". The cs, fr, hu, ja, ka, ko, nl, ru, tr and zh-hant catalogs still had a row for the single message those two replaced, "{k} has control characters{_1}", which no message uses. The rows are removed, and a test checks that no catalog has a row for that message. --- crates/ui-egui/src/i18n/cs.tsv | 1 - crates/ui-egui/src/i18n/fr.tsv | 1 - crates/ui-egui/src/i18n/hu.tsv | 1 - crates/ui-egui/src/i18n/ja.tsv | 1 - crates/ui-egui/src/i18n/ka.tsv | 1 - crates/ui-egui/src/i18n/ko.tsv | 1 - crates/ui-egui/src/i18n/nl.tsv | 1 - crates/ui-egui/src/i18n/ru.tsv | 1 - crates/ui-egui/src/i18n/tests.rs | 13 +++++++++++++ crates/ui-egui/src/i18n/tr.tsv | 1 - crates/ui-egui/src/i18n/zh-hant.tsv | 1 - docs/target-app-parity.md | 10 +++++----- 12 files changed, 18 insertions(+), 15 deletions(-) diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index a5d7bb948a..6785cdde24 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -9830,7 +9830,6 @@ breakText Glyphs Glyfy @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) soubory {kind} nemají průhlednost a soubor by obsahoval {what}: nejprve ji slučte (object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) obrázky {kind} nelze otevřít (viz document.formats) @msg {k} `{v}` is not one of the choices {k} `{v}` není jedna z nabízených voleb -@msg {k} has control characters{_1} {k} obsahuje řídicí znaky{_1} @msg {k} is too long (at most {MAX_TEXT} characters) {k} je příliš dlouhé (nejvýše {MAX_TEXT} znaků) @msg {k} must be > 0 {k} musí být > 0 @msg {k} must be a number (pt) or a length such as "210 mm" {k} musí být číslo (pt) nebo délka jako "210 mm" diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3be3497f97..c61a166a8b 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -9686,7 +9686,6 @@ breakText Glyphs Glyphes @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) les fichiers {kind} n’ont pas de transparence, et le fichier aurait {what} : aplatissez-la d’abord (object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) les images {kind} ne peuvent pas être ouvertes (voir document.formats) @msg {k} `{v}` is not one of the choices {k} `{v}` ne fait pas partie des choix -@msg {k} has control characters{_1} {k} contient des caractères de contrôle{_1} @msg {k} is too long (at most {MAX_TEXT} characters) {k} est trop long (au plus {MAX_TEXT} caractères) @msg {k} must be > 0 {k} doit être > 0 @msg {k} must be a number (pt) or a length such as "210 mm" {k} doit être un nombre (pt) ou une longueur comme "210 mm" diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0f81a72036..314f688a5a 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -9700,7 +9700,6 @@ breakText Glyphs Glifák @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind} fájlokban nincs átlátszóság, a fájlban viszont ez lenne: {what}; előbb lapítsd (object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) {kind} képek nem nyithatók meg (lásd: document.formats) @msg {k} `{v}` is not one of the choices {k} `{v}`: nem a választási lehetőségek egyike -@msg {k} has control characters{_1} {k}: vezérlőkaraktereket tartalmaz{_1} @msg {k} is too long (at most {MAX_TEXT} characters) {k}: túl hosszú (legfeljebb {MAX_TEXT} karakter) @msg {k} must be > 0 {k}: > 0 érték kell @msg {k} must be a number (pt) or a length such as "210 mm" {k}: szám (pt) vagy hosszúság kell, például "210 mm" diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c429f204a1..9986726dee 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -8502,7 +8502,6 @@ axis Y Axis Y 軸 @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind} ファイルは透明に対応していませんが、ファイルに {what} が含まれます: 先に分割・統合してください (object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) {kind} 画像は開けません (document.formats を参照) @msg {k} `{v}` is not one of the choices {k} `{v}` は選択肢にありません -@msg {k} has control characters{_1} {k} に制御文字{_1} が含まれています @msg {k} is too long (at most {MAX_TEXT} characters) {k} が長すぎます (最大 {MAX_TEXT} 文字) @msg {k} must be > 0 {k} には 0 より大きい値を指定してください @msg {k} must be a number (pt) or a length such as "210 mm" {k} には数値 (pt)、または "210 mm" のような長さを指定してください diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 414f45171c..482fb43044 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -1916,7 +1916,6 @@ @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind} ფაილებს გამჭვირვალობა არ აქვს, ფაილს კი ექნებოდა: {what}: ჯერ გააბრტყელეთ (object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) {kind} გამოსახულებების გახსნა შეუძლებელია (იხ. document.formats) @msg {k} `{v}` is not one of the choices {k} `{v}` შემოთავაზებულ ვარიანტებში არ არის -@msg {k} has control characters{_1} {k} შეიცავს მმართველ სიმბოლოებს{_1} @msg {k} is too long (at most {MAX_TEXT} characters) {k} ზედმეტად გრძელია (მაქსიმუმ {MAX_TEXT} სიმბოლო) @msg {k} must be > 0 {k} უნდა იყოს > 0 @msg {k} must be a number (pt) or a length such as "210 mm" {k} უნდა იყოს რიცხვი (pt) ან სიგრძე, მაგალითად "210 mm" diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index dbda53243f..cadf6768fd 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -9436,7 +9436,6 @@ breakText Glyphs 글리프 @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind} 파일에는 투명도가 없는데 이 파일에는 {what}이(가) 있게 됩니다: 먼저 병합하세요(object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) {kind} 이미지는 열 수 없습니다(document.formats 참조) @msg {k} `{v}` is not one of the choices {k} `{v}`은(는) 선택 항목 중 하나가 아닙니다 -@msg {k} has control characters{_1} {k}에 제어 문자가 있습니다{_1} @msg {k} is too long (at most {MAX_TEXT} characters) {k}이(가) 너무 깁니다(최대 {MAX_TEXT}자) @msg {k} must be > 0 {k}은(는) 0보다 커야 합니다 @msg {k} must be a number (pt) or a length such as "210 mm" {k}은(는) 숫자(pt) 또는 "210 mm" 같은 길이여야 합니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 69aef91cfc..408e2df2ae 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -7683,7 +7683,6 @@ imageTrace Outline Contour @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind}-bestanden hebben geen transparantie, en het bestand zou {what} bevatten: vlak het eerst af (object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) {kind}-afbeeldingen kunnen niet worden geopend (zie document.formats) @msg {k} `{v}` is not one of the choices {k} `{v}` is geen van de keuzes -@msg {k} has control characters{_1} {k} bevat besturingstekens{_1} @msg {k} is too long (at most {MAX_TEXT} characters) {k} is te lang (maximaal {MAX_TEXT} tekens) @msg {k} must be > 0 {k} moet > 0 zijn @msg {k} must be a number (pt) or a length such as "210 mm" {k} moet een getal (pt) of een lengte zoals "210 mm" zijn diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index d1593508d3..1ea95207c7 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -9815,7 +9815,6 @@ shape Open Открытый @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) в файлах {kind} нет прозрачности, а в файле оказалось бы {what}: сначала объедините прозрачность (object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) изображения {kind} невозможно открыть (см. document.formats) @msg {k} `{v}` is not one of the choices {k} `{v}` не входит в число допустимых вариантов -@msg {k} has control characters{_1} {k} содержит управляющие символы{_1} @msg {k} is too long (at most {MAX_TEXT} characters) {k} слишком длинно (не более {MAX_TEXT} символов) @msg {k} must be > 0 {k} должно быть > 0 @msg {k} must be a number (pt) or a length such as "210 mm" {k} должно быть числом (pt) или длиной, например "210 mm" diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 97fccd9167..daad687ebe 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -2517,6 +2517,19 @@ fn file_info_control_character_refusals_translate_in_every_complete_catalog() { } } +/// No catalog keeps a row for `{k} has control characters{_1}`, the single message that +/// `file.info`'s two control character refusals replaced. +#[test] +fn no_catalog_keeps_the_old_file_info_control_character_row() { + let literals = message_literals_in(&["engine"]); + let old = "{k} has control characters{_1}"; + assert!(!literals.contains(old), "the engine still makes {old:?}"); + for l in &LANGUAGES { + let (entries, _) = parse_entries(l.source); + assert!(!entries.iter().any(|(ctx, src, _)| ctx.starts_with("@msg") && src.split('|').any(|s| s == old)), "{}: {old:?}", l.code); + } +} + /// Every complete-message catalog has a row for each error that `type.compositeFonts.set`, /// `.export` and `.import`, the composite font checks behind them and the Composite Fonts dialog /// give, and translates them with the font name, the key and the class key kept, and the reason diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 910a7fc5b1..cedc55f1ee 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -8883,7 +8883,6 @@ axis Y Axis Y ekseni @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind} dosyalarında saydamlık yoktur ve dosyada {what} olurdu: önce düzleştirin (object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) {kind} görüntüleri açılamıyor (bkz. document.formats) @msg {k} `{v}` is not one of the choices {k} `{v}` seçeneklerden biri değil -@msg {k} has control characters{_1} {k} denetim karakterleri içeriyor{_1} @msg {k} is too long (at most {MAX_TEXT} characters) {k} çok uzun (en fazla {MAX_TEXT} karakter) @msg {k} must be > 0 {k} > 0 olmalıdır @msg {k} must be a number (pt) or a length such as "210 mm" {k} bir sayı (pt) veya "210 mm" gibi bir uzunluk olmalıdır diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 1480422931..ce91ac2241 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -9503,7 +9503,6 @@ breakText Glyphs 字符 @msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind} 檔案沒有透明度,而檔案中會有 {what}:請先將它平面化 (object.flattenTransparency) @msg {kind} images can't be opened (see document.formats) 無法開啟 {kind} 影像 (請參閱 document.formats) @msg {k} `{v}` is not one of the choices {k} `{v}` 不是選項之一 -@msg {k} has control characters{_1} {k} 含有控制字元{_1} @msg {k} is too long (at most {MAX_TEXT} characters) {k} 過長 (最多 {MAX_TEXT} 個字元) @msg {k} must be > 0 {k} 必須 > 0 @msg {k} must be a number (pt) or a length such as "210 mm" {k} 必須是數字 (pt) 或 "210 mm" 這類長度 diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e9fc9a6820..dc14aea2c6 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1014,13 +1014,13 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The status bar translates the limits a plug-in run can exceed (its instruction, time and memory budgets and its output size) and the error of a plug-in removal that leaves the plug-in's grant in the plug-in store, in every language that translates every message. The untranslated-strings report also lists messages that an error or a status takes from a `&str` constant (`plugin_limit_errors_are_translated`, `message_scan_reads_messages_held_in_constants`). - The status bar translates the plug-in host's other errors (manifest, module and run checks, the output an importer, exporter or effect returns, and the approval a plug-in's permissions need) in every language that translates every message. A JSON object or array inside a message stays as written, and a message that wraps another one, such as `plug-in manifest: {0}`, is matched by its own row before a row that starts with a placeholder. The reasons inside these errors (what is wrong with a parameter's spec or dialog keys, the value a parameter needs, what is wrong with an object, stroke, paint or effect in a plug-in's output) are translated with them, and the untranslated-strings report lists the reasons the plug-in host's error helpers take (`plugin_messages_are_translated_in_every_complete_catalog`, `plugin_errors_translate_with_their_values`, `plugin_error_reasons_are_translated_with_the_error`, `message_scan_reads_plugin_helpers`, `templates_that_start_with_text_match_first`). - The status bar translates `script.run`'s refusals of `answers` in every language that translates every message: a value that is not a list, more than 10,000 answers, more than 1 MiB, an answer at an index that is not an object, does not have exactly `kind` and `value`, has a `value` its kind of dialog does not take, holds a prompt's text longer than 16 KiB or has an unknown `kind`, and `answers` given to a run in the app. The index, the counts and the code names are shown as they are, and the command's error stays in English. The untranslated-strings report also lists the refusals of `script.run`'s parameters (`script_answers_errors_are_translated`, `message_scan_reads_script_run_param_refusals`). - - The Japanese catalog (`crates/ui-egui/src/i18n/ja.tsv`) has 3,562 `@msg` rows and 49 `@msgplural` rows (counted 2026-11-14). The untranslated report (`untranslated_report`) lists 98 status and error messages in the sources that have no Japanese row: 77 that every complete-message language lacks, and 21 more. Open #7211 translates 34 of them, among them the composite font errors, and open #7116 translates the justification order error. The status bar does not use the rows for ``unknown parameter `{within}{key}`; {why}`` and `{name} must be {lo}–{hi}{unit} (got {v})`, because a message with two placeholders in a row cannot be matched (`Template::parse` in `crates/ui-egui/src/i18n/catalog.rs`). The row for `{k} has control characters{_1}` does not match the File Info error for a multi-line field, where the last placeholder is empty. A native speaker has not reviewed the wording. + - The Japanese catalog (`crates/ui-egui/src/i18n/ja.tsv`) has 3,562 `@msg` rows and 49 `@msgplural` rows (counted 2026-11-14). The untranslated report (`untranslated_report`) lists 98 status and error messages in the sources that have no Japanese row: 77 that every complete-message language lacks, and 21 more. Open #7211 translates 34 of them, among them the composite font errors, and open #7116 translates the justification order error. The status bar does not use the rows for ``unknown parameter `{within}{key}`; {why}`` and `{name} must be {lo}–{hi}{unit} (got {v})`, because a message with two placeholders in a row cannot be matched (`Template::parse` in `crates/ui-egui/src/i18n/catalog.rs`). A native speaker has not reviewed the wording. - A status or error message whose braces are literal, such as a plug-in's `expected {"objects": [...]}` or a command's `quotes must be {double?, single?}`, is translated only when the whole message matches its row: the row writes those braces doubled and has no placeholder, so it no longer replaces a different message that starts with the same words, such as a JSON reason `expected value at line 1 column 1`, which stays in English. A row without placeholders is found at any message length (`plain_message_keys_double_their_braces`, `literal_brace_rows_match_only_their_message`). - The status bar translates the errors a script's `File` and `Folder` objects, `vc.run`, `$.evalFile`, the `$` object's properties and functions, `alert`, `confirm` and `prompt`, `vc.document` and `vc.log` raise, the limits a run can pass, and the errors of Drop Script Engine, and the line for a run that fails (a syntax error, a thrown error, a limit, a stop or an internal error, with the script's name, the line and column, the included file it is in and the files left written), in every language that translates every message. The script's name, paths, numbers, command ids and the text a script throws itself are shown as they are. A failure with no line and column, such as an error in code `eval` compiled, is shown with one colon after the script's name (`an_error_without_a_place_names_the_script_and_kind`). A message template that names a value twice matches only when both places hold the same text, so the line for a failed run is not taken for the message inside it (`a_repeated_placeholder_matches_the_same_text`). The untranslated-strings report also lists the messages the script host's `fail`, `value` and `over` helpers take and the errors the script interpreter throws, and a constant's text comes from the file or crate that declares it, so the Scripts menu's headers are not listed as messages (`script_errors_are_translated`, `script_host_errors_are_translated`, `message_scan_reads_script_interpreter_errors`, `message_scan_reads_constants_of_the_file_and_its_crate`, `message_scan_skips_test_modules_with_any_test_cfg`). - The status bar also translates the errors the script interpreter's core throws (an unknown name, a property of `null` or `undefined`, a property that cannot be defined, assigned or deleted and the reason, a value that is not a function or a constructor, an invalid array length, an invalid assignment target), on their own and in the line for a failed run, in every language that translates every message. Names, property names (a value a message quotes in `'…'` is shown as written, like one in `"…"`, even when it matches a translated message), `null`, `undefined`, `in`, `instanceof` and the error's type (`TypeError`, `ReferenceError` and the others) are shown as they are, and a script that catches the error still reads its English message. An error about a property of `null` or `undefined` names a computed property whose name is not an object and is at most 256 units long, and otherwise says only that the script read or set a property, instead of naming an empty property (`script_interpreter_core_errors_are_translated`, `errors_about_null_and_undefined_name_the_property`, `message_scan_reads_script_interpreter_errors`). - - The Turkish catalog (`crates/ui-egui/src/i18n/tr.tsv`) has an `@msg` row for all but 41 of the status and error messages the untranslated report (`untranslated_report`) finds in the sources, 3,446 `@msg` rows in all. The row for `{k} has control characters{_1}` does not match the File Info error for a multi-line field, where the last placeholder is empty. A native speaker has not reviewed the wording. - - The Hungarian catalog (`crates/ui-egui/src/i18n/hu.tsv`) has an `@msg` row for the status and error messages the untranslated report (`untranslated_report`) finds in the sources, 3,444 `@msg` rows in all: the errors of commands, scripts, file import and export and plug-ins. The report lists 40 Hungarian messages: the composite font, justification order and connect end errors that open #7211, #7116 and #7330 translate, and two messages that no catalog has a row for. The status bar does not use the rows for ``unknown parameter `{within}{key}`; {why}`` and `{name} must be {lo}–{hi}{unit} (got {v})`, because a message with two placeholders in a row cannot be matched (`Template::parse` in `crates/ui-egui/src/i18n/catalog.rs`). The row for `{k} has control characters{_1}` does not match the File Info error for a multi-line field, where the last placeholder is empty. A native speaker has not reviewed the wording. - - The Dutch catalog (`crates/ui-egui/src/i18n/nl.tsv`) has an `@msg` row for the status and error messages the untranslated report (`untranslated_report`) finds in the sources, 3,447 `@msg` rows in all. The report lists 41 Dutch messages: the composite font errors, the justification spacing error and the `connect` end error, which open #7211, #7116 and #7330 translate, and three unknown-parameter and range errors (``unknown parameter `{within}{key}`; {why}``, ``unknown parameter `{within}settings.{format}`; {why}`` and `{name} must be {lo}–{hi}{unit} (got {v})`), which open #7353 rewrites so that a catalog row can match them. The row for `{k} has control characters{_1}` does not match the File Info error for a multi-line field, where the last placeholder is empty. A native speaker has not reviewed the wording. + - The Turkish catalog (`crates/ui-egui/src/i18n/tr.tsv`) has an `@msg` row for all but 41 of the status and error messages the untranslated report (`untranslated_report`) finds in the sources, 3,446 `@msg` rows in all. A native speaker has not reviewed the wording. + - The Hungarian catalog (`crates/ui-egui/src/i18n/hu.tsv`) has an `@msg` row for the status and error messages the untranslated report (`untranslated_report`) finds in the sources, 3,444 `@msg` rows in all: the errors of commands, scripts, file import and export and plug-ins. The report lists 40 Hungarian messages: the composite font, justification order and connect end errors that open #7211, #7116 and #7330 translate, and two messages that no catalog has a row for. The status bar does not use the rows for ``unknown parameter `{within}{key}`; {why}`` and `{name} must be {lo}–{hi}{unit} (got {v})`, because a message with two placeholders in a row cannot be matched (`Template::parse` in `crates/ui-egui/src/i18n/catalog.rs`). A native speaker has not reviewed the wording. + - The Dutch catalog (`crates/ui-egui/src/i18n/nl.tsv`) has an `@msg` row for the status and error messages the untranslated report (`untranslated_report`) finds in the sources, 3,447 `@msg` rows in all. The report lists 41 Dutch messages: the composite font errors, the justification spacing error and the `connect` end error, which open #7211, #7116 and #7330 translate, and three unknown-parameter and range errors (``unknown parameter `{within}{key}`; {why}``, ``unknown parameter `{within}settings.{format}`; {why}`` and `{name} must be {lo}–{hi}{unit} (got {v})`), which open #7353 rewrites so that a catalog row can match them. A native speaker has not reviewed the wording. - The Danish catalog (`crates/ui-egui/src/i18n/da.tsv`) has 1,985 more status and error message rows, 3,702 `@msg` rows in all, and the untranslated report's missing Danish messages go from 2,066 to 81: 40 that open pull requests translate, 38 that no catalog has a row for, and three unknown-parameter and range errors (``unknown parameter `{within}{key}`; {why}``, ``unknown parameter `{within}settings.{format}`; {why}`` and `{name} must be {lo}–{hi}{unit} (got {v})`) that open #7353 rewrites so that a catalog row can match them. A native speaker has not reviewed the wording. - The Traditional Chinese catalog (`crates/ui-egui/src/i18n/zh-hant.tsv`) has an `@msg` row for the status and error messages the untranslated report (`untranslated_report`) finds in the sources, 3,438 `@msg` rows in all: the errors of commands, scripts, file import and export and plug-ins. The report lists 40 Traditional Chinese messages: open #7211, #7116 and #7330 add the rows for 38 of them, and the other 2 have no row in any catalog. A message with two placeholders in a row (`Template::parse` in `crates/ui-egui/src/i18n/catalog.rs`) is still shown in English. - Localised UI: menus (in-window and native), panels, dialogs, toolbar and Preferences read from per-language catalogs (`crates/ui-egui/src/i18n`, see `docs/development.md`); Traditional Chinese (Taiwan), Simplified Chinese (mainland), Japanese, Korean, Vietnamese, German, Spanish, French, Italian, Polish, Brazilian Portuguese, Russian, Ukrainian, Georgian and Catalan ship complete, and Czech covers every menu label (and more), with system-locale detection on macOS, Windows, Linux and the web (the browser's languages, or `?lang=`), a Language preference and, on macOS, a VectorCraft ▸ Language menu. Names are never translated (fonts and their styles, layers, artboards, saved presets, user libraries, custom workspaces, recent files, plug-ins). @@ -1063,7 +1063,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The errors of the 3D effects (Extrude & Bevel, Revolve, Inflate, Rotate and their Classic forms) show in the status bar in the interface language: the art a 3D effect cannot build a solid from, invalid light, graphics and surface settings, and the notes for an object that draws no 3D faces or more wireframe edges than the limit. Each has a row in every catalog that translates all status and error messages, and the effect's name and the values in the message are translated or kept as written (`three_d_refusals_are_translated_in_every_complete_catalog`, `three_d_refusals_translate_with_their_values`). - The errors of an SVG filter that the New or Edit button of Apply SVG Filter or an `svg.filter` effect refuses show in the status bar in the interface language: XML that cannot be read, a missing or too long id, an element or event attribute a filter does not take, an image that is not a `data:` URL, and the limits on primitives, `numOctaves`, `order`, `radius`, `stdDeviation`, `kernelUnitLength`, image pixels, nesting and size. Each has a row in every catalog that translates all status and error messages, and the limits, element and attribute names and the XML parser's position are kept as written (`svg_filter_refusals_are_translated_in_every_complete_catalog`, `svg_filter_refusals_translate_with_their_values`). Items side by side in a menu show different labels in every interface language (Effect › 3D and Materials › Revolve… and Rotate… in Turkish and Bulgarian, Effect › Warp and Distort, the Pathfinder effects, the Warp styles, Window › Attributes and Properties, and the whitespace characters), and no menu item shows a command id in place of its label (`menu_items_side_by_side_have_different_labels`, `menu_items_never_show_an_id`). - The errors of the parameter checks that many commands share show in the status bar in the interface language: a value that is not a number where a number goes (`object.move` with `"dx": "60 mm"`, and `object.rotate`, `object.setBounds` and the other commands that call `check_numbers`), a missing number or index, `ids` that are not a list of object ids, an object id that is not a non-negative integer or names no object, and a date that is not Unix seconds. Each has a row in every catalog that translates all status and error messages, and in Bulgarian, Danish, Indonesian and Dutch (`shared_param_check_errors_are_translated`). - - File Info's (`file.info`) error for a value with control characters shows in the status bar in the interface language for every field: "description has control characters" for Description and Copyright Notice, which take line breaks and tabs, and "title has control characters or line breaks" for the other text fields and each keyword in a list. Each is its own message with a row in every catalog that translates all status and error messages, and the field's key stays as written (`file_info_control_character_refusals_translate_in_every_complete_catalog`, `control_characters_are_refused_with_the_field_rule`). + - File Info's (`file.info`) error for a value with control characters shows in the status bar in the interface language for every field: "description has control characters" for Description and Copyright Notice, which take line breaks and tabs, and "title has control characters or line breaks" for the other text fields and each keyword in a list. Each is its own message with a row in every catalog that translates all status and error messages, and the field's key stays as written. No catalog keeps a row for `{k} has control characters{_1}`, the single message the two replaced (`file_info_control_character_refusals_translate_in_every_complete_catalog`, `no_catalog_keeps_the_old_file_info_control_character_row`, `control_characters_are_refused_with_the_field_rule`). - A parameter schema's errors show in the status bar with what the value must be in the interface language, for every type a schema has (a number with each kind of range and with a unit, an integer and its range, true or false, a string, a list of names, an object id, a list of object ids, a color, a point, an object and a list), in every catalog that translates all status and error messages; the path, the refused value, the bounds, the unit and the names stay as the English gives them. The error for a value that is not one of its names is also translated in Bulgarian, Bosnian, Danish, Indonesian and Dutch (`parameter_schema_expected_phrases_are_translated`, `bracketed_message_parts_translate_only_as_exact_messages`). - The error for an unknown key inside an options object (`marks.ofset` in `document.exportPdf`, a format under `settings` in `document.exportForScreens`), a PDF or print setting outside its range (`marks.weight must be 0.05–2 pt (got 9)`), the raster effect resolution warning for a named object, the note that VectorCraft started again on another graphics processor and the status after a print job is sent show in the status bar in the interface language, in every catalog: each message is made with one value for the key path, the range with its unit or the object with its name, so a catalog row can match it, and the English stays as before (`messages_with_joined_values_translate_whole`). A message or catalog row with two placeholders in a row fails `message_templates_have_text_between_their_placeholders` or `bundled_catalogs_have_no_message_row_they_leave_out`, and the untranslated report counts a row the catalog cannot use as missing. - A script's error about answers in `answers` that it did not use, and Liquify's warning about the objects under the brush that it left as they were, show in the status bar in the interface language for one answer or object as well as for several, with the count's own form in each catalog that translates all status and error messages; the English the commands return stays as it was (`messages_with_one_or_several_items_translate_in_every_complete_catalog`, `unused_answers_are_counted_in_the_singular_and_the_plural`, `liquify_warns_about_one_or_several_skipped_objects`). From 2a3019fcfe082e0177dfbd667093c5c89f2c1706 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 11:17:20 -0800 Subject: [PATCH 068/158] Type: editing type set in a missing font asks to confirm first A Type tool click, or a Selection or Direct Selection double-click, on type whose story is drawn in a font that isn't available as named (a missing family, or a style its family lacks) now opens a question that names those fonts instead of starting to edit. OK starts editing with the caret where the type was clicked; Cancel leaves the document, its undo history and the selection as they were. Each new edit asks again; a click within the type being edited, or in another frame of its story, does not. The fonts the type names are not changed. The check reads only the clicked story's runs. As in text.missingFonts, it leaves out CSS generic families and names over 256 bytes; it also skips inline graphics and empty runs. The CSS generic family list moves to vectorcraft-text so both share it. The question is the missingFontEdit dialog, answered through the Type tool's missingFontEdit option. --- crates/engine/src/cmd/fontfiles.rs | 21 +--- crates/text/src/fontdb.rs | 2 +- crates/text/src/fontdb/traits.rs | 23 ++++ crates/text/src/lib.rs | 8 +- crates/tools/src/text.rs | 63 ++++++++++- crates/tools/src/text/missing.rs | 83 ++++++++++++++ crates/tools/src/text/tests.rs | 154 ++++++++++++++++++++++++++ crates/tools/src/text/tool.rs | 22 +++- crates/ui-egui/src/canvas/tests.rs | 64 +++++++++++ crates/ui-egui/src/dialogs.rs | 4 + crates/ui-egui/src/dialogs/confirm.rs | 41 +++++++ crates/ui-egui/src/dialogs/tools.rs | 5 + crates/ui-egui/src/i18n/bg.tsv | 1 + crates/ui-egui/src/i18n/bs.tsv | 1 + crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/gu.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + docs/mcp.md | 12 ++ docs/target-app-parity.md | 1 + 42 files changed, 501 insertions(+), 30 deletions(-) create mode 100644 crates/tools/src/text/missing.rs diff --git a/crates/engine/src/cmd/fontfiles.rs b/crates/engine/src/cmd/fontfiles.rs index fde85dd92d..c13b256210 100644 --- a/crates/engine/src/cmd/fontfiles.rs +++ b/crates/engine/src/cmd/fontfiles.rs @@ -19,23 +19,6 @@ use crate::DocState; const MAX_FONTS: usize = 1_000; /// The longest family or style name listed or given (bytes). const MAX_NAME: usize = 256; -/// The CSS generic font families (CSS Fonts Module Level 4), which SVG and HTML files name in place -/// of a font and no font file provides; compared in any ASCII case. The list leaves out -/// `fangsong`, which is also the family name of a Chinese font (FangSong). -const GENERIC_FAMILIES: &[&str] = &[ - "serif", - "sans-serif", - "monospace", - "cursive", - "fantasy", - "system-ui", - "ui-serif", - "ui-sans-serif", - "ui-monospace", - "ui-rounded", - "math", - "emoji", -]; /// The longest folder path given (bytes). const MAX_PATH: usize = 4096; /// The most files one `text.addFontFiles` copies: as many as a search keeps. @@ -105,10 +88,10 @@ pub struct MissingFont { /// The fonts the type of `d` uses, in its layers, symbols and patterns, opacity masks included (a composite font's parts, those /// its characters are drawn in, in place of its name), that aren't available as named (sorted by family and style, each once whatever version its type names; at most 1000). CSS generic families such as `sans-serif` -/// ([`GENERIC_FAMILIES`]) and names longer than 256 bytes are left out. +/// ([`vectorcraft_text::GENERIC_FAMILIES`]) and names longer than 256 bytes are left out. pub fn missing_fonts(d: &Document) -> Vec<MissingFont> { let db = FontDb::global(); - let generic = |family: &str| GENERIC_FAMILIES.iter().any(|g| g.eq_ignore_ascii_case(family.trim())); + let generic = vectorcraft_text::is_generic_family; let mut used: Vec<(String, String)> = super::fonts::used_fonts(d).into_iter().map(|(family, style, _)| (family, style)).collect(); // Sorted by family and style: the versions type names of one face are neighbors. used.dedup(); diff --git a/crates/text/src/fontdb.rs b/crates/text/src/fontdb.rs index 59c99f8901..ccf9a3943c 100644 --- a/crates/text/src/fontdb.rs +++ b/crates/text/src/fontdb.rs @@ -74,7 +74,7 @@ pub use stylistic_sets::StylisticSet; use traits::Alias; #[cfg(test)] use traits::{FaceKeys, face_names}; -pub use traits::{FontClass, FontLikeness, FontMatch, FontTraits}; +pub use traits::{FontClass, FontLikeness, FontMatch, FontTraits, GENERIC_FAMILIES, is_generic_family}; #[cfg(test)] pub(crate) use traits::{alias_lists, face_styles, on_faces_published}; pub use wanted::{WantedFont, WantedFonts}; diff --git a/crates/text/src/fontdb/traits.rs b/crates/text/src/fontdb/traits.rs index abcfe863e7..6b6ac5c87e 100644 --- a/crates/text/src/fontdb/traits.rs +++ b/crates/text/src/fontdb/traits.rs @@ -433,6 +433,29 @@ impl FontMatch { } } +/// The CSS generic font families (CSS Fonts Module Level 4), which SVG and HTML files name in place +/// of a font and no font file provides; compared in any ASCII case ([`is_generic_family`]). The +/// list leaves out `fangsong`, which is also the family name of a Chinese font (FangSong). +pub const GENERIC_FAMILIES: &[&str] = &[ + "serif", + "sans-serif", + "monospace", + "cursive", + "fantasy", + "system-ui", + "ui-serif", + "ui-sans-serif", + "ui-monospace", + "ui-rounded", + "math", + "emoji", +]; + +/// Whether `family` (surrounding spaces ignored) is one of the [`GENERIC_FAMILIES`], in any ASCII case. +pub fn is_generic_family(family: &str) -> bool { + GENERIC_FAMILIES.iter().any(|g| g.eq_ignore_ascii_case(family.trim())) +} + /// A face's (family, style) names. pub(super) fn face_names(f: &skrifa::FontRef<'_>) -> Option<(String, String)> { let family = name(f, &[StringId::TYPOGRAPHIC_FAMILY_NAME, StringId::FAMILY_NAME])?; diff --git a/crates/text/src/lib.rs b/crates/text/src/lib.rs index f7f5d128ba..6156c90162 100644 --- a/crates/text/src/lib.rs +++ b/crates/text/src/lib.rs @@ -41,10 +41,10 @@ pub use features::{ EXTRA_FEATURES, LIGATURE_TRACKING_LIMITS, MAX_FEATURE_VALUE, MAX_STYLE_FEATURES, OtFeatures, explicit_ligatures, ligatures_suppressed_by, }; pub use fontdb::{ - CompositeCoverage, FALLBACK_FAMILY, FontClass, FontDb, FontFace, FontLikeness, FontMatch, FontTraits, GlyphAlternate, GlyphCategory, - GlyphCategoryKind, GlyphOrigin, IcfMargins, JoiningPosition, LentCompositeFonts, PlatformFontFiles, RECENTLY_ADDED_WITHIN, RecentlyAdded, - StylisticSet, Substitution, SubstitutionKind, WantedFont, WantedFonts, app_font_dir, is_font_file, is_suitcase, set_app_font_dir, - set_platform_font_files, set_user_font_dirs, set_user_font_dirs_confined, style_weight, system_font_dirs, user_font_dirs, + CompositeCoverage, FALLBACK_FAMILY, FontClass, FontDb, FontFace, FontLikeness, FontMatch, FontTraits, GENERIC_FAMILIES, GlyphAlternate, + GlyphCategory, GlyphCategoryKind, GlyphOrigin, IcfMargins, JoiningPosition, LentCompositeFonts, PlatformFontFiles, RECENTLY_ADDED_WITHIN, + RecentlyAdded, StylisticSet, Substitution, SubstitutionKind, WantedFont, WantedFonts, app_font_dir, is_font_file, is_generic_family, is_suitcase, + set_app_font_dir, set_platform_font_files, set_user_font_dirs, set_user_font_dirs_confined, style_weight, system_font_dirs, user_font_dirs, }; pub use hyphen::{hyphenation_exceptions, set_hyphenation_exceptions}; pub use layout::{envelope_ink, layout_inputs, register_envelope_ink}; diff --git a/crates/tools/src/text.rs b/crates/tools/src/text.rs index 763325f90e..1bf3313904 100644 --- a/crates/tools/src/text.rs +++ b/crates/tools/src/text.rs @@ -43,10 +43,13 @@ use vectorcraft_text::{FontDb, TextLayout, edit}; use crate::guides::DrawSnap; use crate::{Action, Cursor, ImeSurrounding, Mods, Overlay, PointerEvent, PointerKind, SurroundingUnit, Tool, ToolContext, ToolKey}; +mod missing; mod plain; mod ports; mod tool; +pub use missing::MISSING_FONT_EDIT; +use missing::PendingEdit; #[cfg(test)] use plain::char_range_to_bytes; use plain::common_affixes; @@ -219,6 +222,8 @@ pub struct TypeTool { stepped: bool, /// The state at the start of each `command.batch` still running, innermost last. batches: Vec<HistoryState>, + /// The edit of type set in fonts that aren't available whose question is open ([`missing`]). + pending_edit: Option<PendingEdit>, cache: Mutex<Option<CachedLayout>>, } @@ -781,18 +786,68 @@ impl TypeTool { /// Start editing the type under `p` with the caret there → the actions (ending the previous /// edit, selecting the type); None when no type is under `p`. A click among the characters - /// edits them, whatever Type Object Selection by Path Only says. + /// edits them, whatever Type Object Selection by Path Only says. When the story of that type is + /// drawn in a font that isn't available as named and is not the story being edited, nothing + /// starts yet: the action asks the UI to open the [`MISSING_FONT_EDIT`] question, and OK starts + /// the edit ([`Self::resume_edit`]). fn edit_at(&mut self, cx: &ToolContext, p: Point) -> Option<Vec<Action>> { + self.pending_edit = None; let h = hit_test(cx.doc, p, vectorcraft_doc::hit::HitOptions { type_path_only: false, ..cx.hit_options() })?; let Some(NodeKind::Text(t)) = cx.doc.node(h.leaf).map(|n| &n.kind) else { return None }; let lay = self.layout(t); let byte = vectorcraft_text::hit_byte(&lay, t.xf.inverse() * p); + let same_story = self.editing.is_some_and(|e| cx.doc.story_of(e).contains(&h.leaf)); + if !same_story { + let fonts = missing::unavailable_fonts(cx.doc, h.leaf); + if !fonts.0.is_empty() { + let token = next_edit_session(); + self.pending_edit = Some(PendingEdit { token, revision: cx.revision, id: h.leaf, byte, accepted: false }); + self.clicks = (None, 0); + return Some(vec![Action::Dialog(MISSING_FONT_EDIT.into(), missing::question(token, h.leaf, &fonts))]); + } + } + Some(self.begin_edit(cx, h.leaf, byte, p)) + } + + /// End the previous edit and edit type `id` with the caret at `byte` (clicked at `p`), selecting + /// it → the actions. + fn begin_edit(&mut self, cx: &ToolContext, id: NodeId, byte: usize, p: Point) -> Vec<Action> { let mut out = self.finish(cx); - self.start_editing(h.leaf, byte); + self.start_editing(id, byte); self.remember(cx); self.clicks = (Some(p), 1); - out.push(Action::Exec("select.set".into(), json!({"ids": [h.leaf.0]}))); - Some(out) + out.push(Action::Exec("select.set".into(), json!({"ids": [id.0]}))); + out + } + + /// The answer to the [`MISSING_FONT_EDIT`] question whose token is `token`: OK (`ok`) lets the + /// next [`Tool::poll`] start the edit, Cancel forgets it. An answer to another question is + /// ignored. + fn answer_edit(&mut self, token: u64, ok: bool) { + let Some(e) = self.pending_edit.as_mut().filter(|e| e.token == token) else { return }; + if ok { + e.accepted = true; + } else { + self.pending_edit = None; + } + } + + /// Start the edit OK accepted: the caret goes where the type was clicked. Nothing starts when + /// the document changed since the question, or the type is gone. + fn resume_edit(&mut self, cx: &ToolContext) -> Vec<Action> { + let Some(e) = self.pending_edit.take_if(|e| e.accepted) else { return vec![] }; + if e.revision != cx.revision { + return vec![]; + } + let Some(t) = Self::text(cx, e.id) else { return vec![] }; + let text = t.plain_text(); + let mut byte = e.byte.min(text.len()); + while !text.is_char_boundary(byte) { + byte -= 1; + } + let out = self.begin_edit(cx, e.id, byte, Point::ZERO); + self.clicks = (None, 0); + out } /// The button released after a press at `start` (new type goes at `at`). While type is being diff --git a/crates/tools/src/text/missing.rs b/crates/tools/src/text/missing.rs new file mode 100644 index 0000000000..7d14d635b4 --- /dev/null +++ b/crates/tools/src/text/missing.rs @@ -0,0 +1,83 @@ +//! Type set in fonts that aren't available as named asks before it is edited: a click or a +//! double-click that would start editing it opens a question ([`MISSING_FONT_EDIT`]) instead, and +//! editing starts at the clicked place only after OK (the tool option `missingFontEdit`). The +//! fonts are those `text.missingFonts` reads, for the story of the type clicked only. + +use std::collections::BTreeSet; + +use serde_json::{Value, json}; +use vectorcraft_doc::{Document, NodeId, NodeKind, TextRun}; +use vectorcraft_text::{FontDb, FontMatch}; + +/// The dialog kind of the question, with the fields `token`, `id`, `missing` and `style` (lists of +/// "family style" names) and `more` (how many more fonts the lists leave out). +pub const MISSING_FONT_EDIT: &str = "missingFontEdit"; + +/// The most fonts the question names. +const LISTED: usize = 8; + +/// The longest family or style name checked (bytes), as `text.missingFonts` reads them. +const MAX_NAME: usize = 256; + +/// An edit of type set in fonts that aren't available, waiting for the answer to its question. +#[derive(Clone, Debug, PartialEq)] +pub(super) struct PendingEdit { + /// The question's token, which its answer names. + pub token: u64, + /// The document (its uid) and its revision when the question was asked: an answer to a + /// document since changed starts no editing. + pub revision: (u64, u64), + /// The type clicked, and the caret's byte offset there. + pub id: NodeId, + pub byte: usize, + /// OK was chosen: the next [`crate::Tool::poll`] starts editing. + pub accepted: bool, +} + +/// The fonts (family, style) run `r` is drawn in: its own, or, set in a composite font, those of +/// the parts its characters fall in. An inline graphic and an empty run draw no glyphs. +fn run_fonts(db: &FontDb, r: &TextRun) -> Vec<(String, String)> { + if r.inline.is_some() || r.text.is_empty() { + return vec![]; + } + db.composite_fonts_for(&r.style.font_family, &r.text).unwrap_or_else(|| vec![(r.style.font_family.clone(), r.style.font_style.clone())]) +} + +/// The fonts that the story of type object `id` ([`Document::story_of`]: every frame threaded with +/// it) is drawn in and that aren't available as named, each once, in the order first used, with how +/// they resolve ([`FontMatch::Missing`] or [`FontMatch::Style`]); at most [`LISTED`], with how many +/// more there are. CSS generic families and names longer than 256 bytes are left out, as +/// `text.missingFonts` leaves them out. +pub(super) fn unavailable_fonts(doc: &Document, id: NodeId) -> (Vec<(String, String, FontMatch)>, usize) { + let db = FontDb::global(); + let mut seen = BTreeSet::new(); + let mut listed = Vec::new(); + let mut more = 0; + for frame in doc.story_of(id) { + let Some(NodeKind::Text(t)) = doc.node(frame).map(|n| &n.kind) else { continue }; + for (family, style) in t.runs.iter().flat_map(|r| run_fonts(db, r)) { + if family.trim().is_empty() || vectorcraft_text::is_generic_family(&family) || family.len() > MAX_NAME || style.len() > MAX_NAME { + continue; + } + if !seen.insert((family.clone(), style.clone())) { + continue; + } + let found = db.resolve(&family, &style).map_or(FontMatch::Missing, |(_, m)| m); + if found == FontMatch::Exact { + continue; + } + if listed.len() < LISTED { + listed.push((family, style, found)); + } else { + more += 1; + } + } + } + (listed, more) +} + +/// The question's fields for `fonts` ([`unavailable_fonts`]) and the edit `token` of type `id`. +pub(super) fn question(token: u64, id: NodeId, (fonts, more): &(Vec<(String, String, FontMatch)>, usize)) -> Value { + let names = |m: FontMatch| fonts.iter().filter(|f| f.2 == m).map(|(family, style, _)| format!("{family} {style}")).collect::<Vec<_>>(); + json!({"token": token, "id": id.0, "missing": names(FontMatch::Missing), "style": names(FontMatch::Style), "more": more}) +} diff --git a/crates/tools/src/text/tests.rs b/crates/tools/src/text/tests.rs index 94063166bc..afa43778e1 100644 --- a/crates/tools/src/text/tests.rs +++ b/crates/tools/src/text/tests.rs @@ -1897,3 +1897,157 @@ fn soft_return_in_a_list_item_keeps_tab_within_the_paragraph() { let acts = key(&mut tool, &d, ToolKey::Tab, Mods::default()); assert!(acts.iter().any(|a| matches!(a, Action::Exec(cmd, p) if cmd == "text.setFormat" && p["listLevel"] == 2))); } + +/// A family no computer has. +const NO_SUCH_FAMILY: &str = "Missing Test Family 7258"; + +/// Point type at (x, 100) whose runs are `runs` (text, family, style). +fn add_styled_text(d: &mut Document, x: f64, runs: &[(&str, &str, &str)]) -> NodeId { + let id = d.alloc_id(); + let style = + |family: &str, font_style: &str| CharStyle { size: 20.0, font_family: family.into(), font_style: font_style.into(), ..Default::default() }; + let mut t = TextObject::point(Point::new(x, 100.0), "", style(runs[0].1, runs[0].2)); + t.runs = runs.iter().map(|(text, family, font_style)| TextRun::new(*text, style(family, font_style))).collect(); + d.insert(Some(d.layers[0].id), 0, Node::new(id, NodeKind::Text(Box::new(t)))).unwrap(); + id +} + +/// Where the caret before byte `b` of type `id` is drawn (document space). +fn caret_at(c: &ToolContext, id: NodeId, b: usize) -> Point { + let t = TypeTool::text(c, id).unwrap(); + let lay = vectorcraft_text::layout(FontDb::global(), t); + let (a, bb) = vectorcraft_text::caret_position(&lay, b); + let at = t.xf * a.midpoint(bb); + Point::new(at.x + 0.1, at.y) +} + +/// The question a click asked → its token and fields. +fn asked(acts: &[Action]) -> (u64, Value) { + match acts { + [Action::Dialog(kind, p)] if kind == MISSING_FONT_EDIT => (p["token"].as_u64().unwrap(), p.clone()), + _ => panic!("expected only the missing-font question: {acts:?}"), + } +} + +/// A click on type set in a family that isn't available asks first and starts no edit; OK starts +/// it with the caret where the type was clicked, and the font the type names stays as it is. +#[test] +fn a_click_on_type_in_a_missing_font_asks_before_editing() { + let mut d = Document::new(500.0, 500.0); + let id = add_styled_text(&mut d, 100.0, &[("Hello", NO_SUCH_FAMILY, "Regular")]); + let mut tool = TypeTool::new("type"); + let (sel, p) = (Selection::default(), paint()); + let c = cx(&d, &sel, &p); + let at = caret_at(&c, id, 3); + let (token, q) = asked(&click(&mut tool, &c, at.x, at.y)); + assert_eq!( + (q["id"].as_u64(), &q["missing"], &q["style"], &q["more"]), + (Some(id.0), &json!([format!("{NO_SUCH_FAMILY} Regular")]), &json!([]), &json!(0)) + ); + assert_eq!(tool.editing, None); + assert!(!tool.waiting()); + // OK: the next poll starts the edit at the clicked character. + tool.set_option("missingFontEdit", &json!({"token": token, "ok": true})); + assert!(tool.waiting()); + let acts = tool.poll(&c, false); + assert_eq!(acts, vec![Action::Exec("select.set".into(), json!({"ids": [id.0]}))]); + assert_eq!((tool.editing, tool.caret, tool.anchor), (Some(id), 3, 3)); + assert!(!tool.waiting()); + let NodeKind::Text(t) = &d.node(id).unwrap().kind else { panic!("text") }; + assert_eq!(t.runs[0].style.font_family, NO_SUCH_FAMILY); + // A click within the type being edited moves the caret without asking again. + let at = caret_at(&c, id, 1); + let acts = click(&mut tool, &c, at.x, at.y); + assert!(!acts.iter().any(|a| matches!(a, Action::Dialog(..))), "{acts:?}"); + assert_eq!((tool.editing, tool.caret), (Some(id), 1)); +} + +/// Cancel starts no edit, and the edit in progress on other type goes on; an answer that names +/// another question, or one given to a document changed since, starts nothing either. +#[test] +fn cancel_or_a_stale_answer_starts_no_edit_in_missing_fonts() { + let (mut d, first, mut tool) = editing("First"); + tool.caret = 2; + let other = add_styled_text(&mut d, 300.0, &[("Second", NO_SUCH_FAMILY, "Bold")]); + let (sel, p) = (Selection::default(), paint()); + let c = cx(&d, &sel, &p); + let at = caret_at(&c, other, 2); + let (token, _) = asked(&click(&mut tool, &c, at.x, at.y)); + assert_eq!((tool.editing, tool.caret), (Some(first), 2), "the edit in progress goes on while the question is open"); + tool.set_option("missingFontEdit", &json!({"token": token + 1, "ok": true})); + assert!(!tool.waiting(), "another question's answer"); + tool.set_option("missingFontEdit", &json!({"token": token, "ok": false})); + assert!(tool.poll(&c, false).is_empty()); + assert_eq!((tool.editing, tool.caret), (Some(first), 2)); + // OK after the document changed: nothing starts. + let (token, _) = asked(&click(&mut tool, &c, at.x, at.y)); + tool.set_option("missingFontEdit", &json!({"token": token, "ok": true})); + let changed = ToolContext { revision: (0, 1), ..cx(&d, &sel, &p) }; + assert!(tool.poll(&changed, false).is_empty()); + assert_eq!(tool.editing, Some(first)); + assert!(!tool.waiting()); +} + +/// Every new edit of such type asks again, after an earlier OK too, and a style the family lacks +/// asks as a missing family does; type in available fonts is edited at once. +#[test] +fn each_new_edit_of_type_in_unavailable_fonts_asks() { + let mut d = Document::new(500.0, 500.0); + let styled = add_styled_text(&mut d, 100.0, &[("Wide", "Source Sans 3", "Ultra Condensed Oblique 7258")]); + let plain = add_styled_text(&mut d, 300.0, &[("Plain", "Source Sans 3", "Regular")]); + let mut tool = TypeTool::new("type"); + let (sel, p) = (Selection::default(), paint()); + let c = cx(&d, &sel, &p); + let at = caret_at(&c, styled, 1); + let (token, q) = asked(&click(&mut tool, &c, at.x, at.y)); + assert_eq!((&q["missing"], &q["style"]), (&json!([]), &json!(["Source Sans 3 Ultra Condensed Oblique 7258"]))); + tool.set_option("missingFontEdit", &json!({"token": token, "ok": true})); + tool.poll(&c, false); + assert_eq!(tool.editing, Some(styled)); + // Other type in an available font is edited at once. + let to = caret_at(&c, plain, 2); + let acts = click(&mut tool, &c, to.x, to.y); + assert!(acts.contains(&Action::Exec("select.set".into(), json!({"ids": [plain.0]}))), "{acts:?}"); + assert_eq!(tool.editing, Some(plain)); + // Back to the first type: a new edit, so the question comes again. + asked(&click(&mut tool, &c, at.x, at.y)); + assert_eq!(tool.editing, Some(plain)); +} + +/// The whole story counts: type with one run in a missing font asks even when the click lands in a +/// run in an available font, and the question names each font once. +#[test] +fn a_story_with_one_run_in_a_missing_font_asks() { + let mut d = Document::new(500.0, 500.0); + let id = add_styled_text( + &mut d, + 100.0, + &[("Here ", "Source Sans 3", "Regular"), ("gone ", NO_SUCH_FAMILY, "Regular"), ("again", NO_SUCH_FAMILY, "Regular")], + ); + let mut tool = TypeTool::new("type"); + let (sel, p) = (Selection::default(), paint()); + let c = cx(&d, &sel, &p); + let at = caret_at(&c, id, 1); + let (_, q) = asked(&click(&mut tool, &c, at.x, at.y)); + assert_eq!(q["missing"], json!([format!("{NO_SUCH_FAMILY} Regular")])); + assert_eq!(tool.editing, None); +} + +/// Type set in a CSS generic family is edited without a question, and a press dropped while the +/// question is open leaves the edit in progress as it was. +#[test] +fn generic_families_and_a_dropped_press_ask_nothing_more() { + let mut d = Document::new(500.0, 500.0); + let generic = add_styled_text(&mut d, 100.0, &[("Generic", "sans-serif", "Regular")]); + let missing = add_styled_text(&mut d, 300.0, &[("Missing", NO_SUCH_FAMILY, "Regular")]); + let mut tool = TypeTool::new("type"); + let (sel, p) = (Selection::default(), paint()); + let c = cx(&d, &sel, &p); + let at = caret_at(&c, generic, 1); + let acts = click(&mut tool, &c, at.x, at.y); + assert!(acts.contains(&Action::Exec("select.set".into(), json!({"ids": [generic.0]}))), "{acts:?}"); + let to = caret_at(&c, missing, 1); + asked(&tool.pointer(&c, &PointerEvent::new(PointerKind::Down, to.x, to.y))); + assert!(tool.drop_press(&c).is_empty()); + assert_eq!(tool.editing, Some(generic)); +} diff --git a/crates/tools/src/text/tool.rs b/crates/tools/src/text/tool.rs index e18754f0ca..3beb099f3d 100644 --- a/crates/tools/src/text/tool.rs +++ b/crates/tools/src/text/tool.rs @@ -73,8 +73,12 @@ impl Tool for TypeTool { } self.clicks = (None, 0); // A press on other type edits it from there, so a drag selects its text at once, - // as it does in the type being edited. + // as it does in the type being edited. While the question about its fonts is open, + // the press does nothing more, and the edit in progress goes on. if let Some(out) = self.edit_at(cx, ev.pos) { + if self.pending_edit.is_some() { + return out; + } self.selecting = true; self.before_press = Some(before); return out; @@ -472,8 +476,16 @@ impl Tool for TypeTool { } fn deactivate(&mut self, cx: &ToolContext) -> Vec<Action> { self.prev_tool = None; + self.pending_edit = None; self.finish(cx) } + /// OK on the question about type in missing fonts started an edit the next poll begins. + fn waiting(&self) -> bool { + self.pending_edit.as_ref().is_some_and(|e| e.accepted) + } + fn poll(&mut self, cx: &ToolContext, _wait: bool) -> Vec<Action> { + self.resume_edit(cx) + } /// Editing ends when a command takes the text out of the selection (Deselect, another object /// picked in the Layers panel) or removes it. After an Undo that takes back a list typed /// characters started, the caret goes on after the characters, and after its Redo the caret @@ -537,9 +549,15 @@ impl Tool for TypeTool { } } /// `select {start, end}` / `selectAll` / `copy` (with `runs` of the selection) / - /// `commitTyping` (the caller commits the engine interaction). + /// `commitTyping` (the caller commits the engine interaction) / `missingFontEdit {token, ok}` + /// (the answer to the question about type in missing fonts; never a saved setting). fn set_option(&mut self, key: &str, v: &Value) { match key { + "missingFontEdit" => { + if let (Some(token), Some(ok)) = (v.get("token").and_then(Value::as_u64), v.get("ok").and_then(Value::as_bool)) { + self.answer_edit(token, ok); + } + } // Transient selection transferred between Type and Eyedropper; never a saved setting. "textSelection" => { if let (Some(id), Some(a), Some(b)) = ( diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index cc65044dfb..e1605132a9 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -8661,6 +8661,11 @@ fn retype_all_of_a_copied_type(ime: bool) { frame(&mut app, vec![button(at, pressed, Modifiers::NONE)]); } frame(&mut app, vec![]); + // Without Georgia on this computer, the Type tool asks first; OK starts the edit. + if app.ui.dialog.as_ref().is_some_and(|d| d.kind == crate::dialogs::confirm::MISSING_FONT_EDIT) { + crate::dialogs::confirm(&mut app).unwrap(); + frame(&mut app, vec![]); + } assert_eq!(app.session.tool_options()["editing"], json!(copy)); // 3. Select all of its text and type over it. frame(&mut app, vec![key(Key::A, true, Modifiers::COMMAND)]); @@ -8748,6 +8753,65 @@ fn double_clicking_type_with_the_direct_selection_tool_puts_the_caret_there() { assert!(!app.session.tool_wants_text()); } +/// Double-clicking type set in a family that isn't available asks before the Type tool edits it: +/// Cancel leaves the document, its undo history and the selection as they were, with nothing +/// edited; OK puts the caret where the type was clicked, and typing edits the type, which keeps +/// the family it names. +#[test] +fn double_clicking_type_in_a_missing_font_asks_before_editing() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + let params = json!({"x": 100, "y": 150, "text": "Hello world", "size": 24, "font": "Missing Test Family 7258"}); + let id = app.session.execute("text.create", ¶ms).unwrap()["id"].as_u64().unwrap(); + app.session.execute("select.none", &json!({})).unwrap(); + app.select_tool("selection"); + let ctx = egui::Context::default(); + let timed = |app: &mut VectorcraftApp, time: f64, events: Vec<egui::Event>| { + let screen = egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0)); + let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), time: Some(time), events, ..Default::default() }, |ui| show(app, ui)); + out.textures_delta.clear(); + }; + timed(&mut app, 0.0, vec![]); + let xf = Xf::new(app.canvas_rect.unwrap(), app.view().unwrap()); + let node = |app: &VectorcraftApp| app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(id)).unwrap().clone(); + let b = node(&app).geometric_bounds().unwrap(); + let at = xf.to_screen(b.center()); + let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + let double_click = |app: &mut VectorcraftApp, time: f64| { + timed(app, time, vec![egui::Event::PointerMoved(at), button(true), button(false), button(true), button(false)]); + timed(app, time + 0.1, vec![]); + }; + let asking = |app: &VectorcraftApp| app.ui.dialog.as_ref().filter(|d| d.kind == crate::dialogs::confirm::MISSING_FONT_EDIT).cloned(); + double_click(&mut app, 1.0); + let d = asking(&app).expect("the question about the missing font"); + assert!(d.str("detail").contains("Missing Test Family 7258 Regular"), "{}", d.str("detail")); + assert_eq!(app.session.tool_options()["editing"], json!(null)); + // Cancel: nothing is edited, and the document, its undo history and the selection stay. + let (before, undo, selected) = + (node(&app), app.session.doc().unwrap().history.undo.len(), app.session.active().unwrap().selection.objects.clone()); + crate::dialogs::cancel(&mut app); + timed(&mut app, 1.5, vec![]); + assert_eq!(app.session.tool_options()["editing"], json!(null)); + assert!(!app.session.tool_wants_text()); + assert_eq!(node(&app), before); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo); + assert_eq!(app.session.active().unwrap().selection.objects, selected); + // A new double-click asks again; OK edits with the caret where the type was clicked. + double_click(&mut app, 3.0); + assert!(asking(&app).is_some(), "asked again"); + crate::dialogs::confirm(&mut app).unwrap(); + timed(&mut app, 3.5, vec![]); + assert!(app.ui.dialog.is_none()); + let o = app.session.tool_options(); + assert_eq!(o["editing"], json!(id)); + let caret = o["caret"].as_u64().unwrap(); + assert!((1..11).contains(&caret), "caret {caret}"); + app.session.tool_text("X", app.view_info()).unwrap(); + let NodeKind::Text(t) = &node(&app).kind else { panic!("not text") }; + assert_eq!(t.plain_text().find('X'), Some(caret as usize), "{}", t.plain_text()); + assert!(t.runs.iter().all(|r| r.style.font_family == "Missing Test Family 7258")); +} + #[test] fn escape_while_editing_in_isolation_returns_to_selection_tool_and_keeps_isolation_until_second_escape() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 9e54eb12f6..a03b772769 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -343,6 +343,7 @@ registry! { ReplaceFiles: [confirm::REPLACE_FILES] => confirm::REPLACE_FILES_SPEC, ResetPreferences: [confirm::RESET_PREFS] => confirm::RESET_PREFS_SPEC, ResetActions: [confirm::RESET_ACTIONS] => confirm::RESET_ACTIONS_SPEC, + MissingFontEdit: [confirm::MISSING_FONT_EDIT] => confirm::MISSING_FONT_EDIT_SPEC, NewSwatch: [new_swatch::KIND] => new_swatch::SPEC, NewColorGroup: [new_color_group::KIND] => new_color_group::SPEC, GraphData: [graph_data::KIND] => graph_data::SPEC, @@ -699,6 +700,9 @@ pub fn cancel(app: &mut VectorcraftApp) { if d.kind == safe_mode::STOPPED { safe_mode::cancel_stopped(app); } + if d.kind == confirm::MISSING_FONT_EDIT { + confirm::answer_missing_font_edit(app, &d, false); + } // The growth question's Cancel button is its Stop button. if d.kind == script_run::GROWTH_KIND { app.session.script_request_stop(); diff --git a/crates/ui-egui/src/dialogs/confirm.rs b/crates/ui-egui/src/dialogs/confirm.rs index 15b28c2d27..b4fd6f037e 100644 --- a/crates/ui-egui/src/dialogs/confirm.rs +++ b/crates/ui-egui/src/dialogs/confirm.rs @@ -156,6 +156,47 @@ fn reset_actions(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> app.run(crate::panels::actions::RESET, json!({ "mode": mode })) } +/// The dialog kind of the question a click or double-click asks before it edits type set in fonts +/// that aren't available as named ([`ask_missing_font_edit`]). Fields: `message`, `detail`, +/// `__token` (the Type tool's edit, which the answer names). +pub const MISSING_FONT_EDIT: &str = vectorcraft_tools::text::MISSING_FONT_EDIT; + +pub(super) const MISSING_FONT_EDIT_SPEC: DialogSpec = DialogSpec { confirm: edit_in_missing_fonts, ..SPEC }; + +/// Ask whether to edit type whose story is drawn in fonts that aren't available, which the Type +/// tool names in `p` (`token`, `missing` and `style`: "family style" names, `more`: how many more +/// there are). The detail names each font (family and style, the family's own names, which are +/// not translated). OK starts the edit where the type was clicked; Cancel and Escape start nothing. +pub(crate) fn ask_missing_font_edit(app: &mut VectorcraftApp, p: &Value) { + let names = |k: &str| p.get(k).and_then(Value::as_array).into_iter().flatten().filter_map(Value::as_str).map(str::to_string).collect::<Vec<_>>(); + let mut fonts = names("missing"); + fonts.extend(names("style")); + if p.get("more").and_then(Value::as_u64).is_some_and(|n| n > 0) { + fonts.push("…".to_string()); + } + let detail = format!("{}\n{}", fonts.join(", "), tl!("These fonts aren't available. Their text shows in another font.")); + let message = tl!("Edit type set in fonts that aren't available?"); + let fields = json!({"message": message, "detail": detail, "__token": p.get("token")}); + app.ui.dialog = Some(Dialog::new(MISSING_FONT_EDIT, fields)); +} + +/// OK on [`ask_missing_font_edit`]: closes, then the Type tool starts the edit. +fn edit_in_missing_fonts(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> { + app.ui.dialog = None; + answer_missing_font_edit(app, d, true); + Ok(Value::Null) +} + +/// Give the Type tool the answer to [`ask_missing_font_edit`]'s question `d`: with `ok` the edit +/// starts at once; without, the tool forgets it. +pub(super) fn answer_missing_font_edit(app: &mut VectorcraftApp, d: &Dialog, ok: bool) { + app.session.set_tool_option("missingFontEdit", &json!({"token": d.fields.get("__token"), "ok": ok})); + if ok { + let r = app.session.tool_poll(app.view_info(), false); + crate::canvas::apply_requests(app, r); + } +} + /// Most messages kept for later while a dialog is open ([`tell`]). const MAX_WAITING: usize = 16; diff --git a/crates/ui-egui/src/dialogs/tools.rs b/crates/ui-egui/src/dialogs/tools.rs index 6dbcfe28ce..978474c29c 100644 --- a/crates/ui-egui/src/dialogs/tools.rs +++ b/crates/ui-egui/src/dialogs/tools.rs @@ -166,6 +166,11 @@ pub fn open_tool_dialog(app: &mut VectorcraftApp, kind: &str, p: Value) { } return; } + // A click or double-click that would edit type set in fonts that aren't available. + vectorcraft_tools::text::MISSING_FONT_EDIT => { + super::confirm::ask_missing_font_edit(app, &p); + return; + } _ => return, }; app.ui.dialog = Some(d); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index bb039bb08e..29b7bf56e5 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3072,6 +3072,7 @@ digits Malayalam Малаялам How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Колко близо на екрана показалецът или влачена точка трябва да стигне до обект, за да прилепнат интелигентните водачи; разстоянието е еднакво при всеки мащаб. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Прилепва края на линеен сегмент или окръжност, начертана от центъра си, така че да докосва близка крива. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Прилепва края на линеен сегмент така, че да среща близък прав сегмент под прав ъгъл. + Edit type set in fonts that aren't available? Да се редактира ли текст с шрифтове, които не са налични? Reset all preferences to their defaults? Да се нулират ли всички настройки до стойностите по подразбиране? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Стойностите по подразбиране се прилагат, когато щракнете върху ОК в Настройки. Отказ там запазва текущите ви настройки. Restore Recovered Documents Възстановяване на възстановените документи diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 99f23d313c..5854b59997 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -4509,6 +4509,7 @@ font-technology Variable Varijabilni How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Koliko blizu na ekranu pokazivač ili prevučena tačka mora doći do objekta da bi ga pametne vodilice uhvatile; udaljenost je ista pri svakom zumu. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Hvata kraj segmenta linije ili krug nacrtan iz središta tako da dodiruje obližnju krivu. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Hvata kraj segmenta linije tako da pod pravim uglom susreće obližnji ravni segment. + Edit type set in fonts that aren't available? Urediti tekst u fontovima koji nisu dostupni? Reset all preferences to their defaults? Vratiti sve postavke na zadane vrijednosti? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Zadane vrijednosti primjenjuju se kada kliknete U redu u Postavkama. Otkaži tamo zadržava vaše trenutne postavke. Smaller ↔ Larger Manje ↔ veće diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index c54311799d..90e50fc790 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -3902,6 +3902,7 @@ digits Malayalam Malaiàlam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Com d’a prop a la pantalla han d’arribar el punter o un punt arrossegat a l’art perquè les guies intel·ligents s’hi ajustin; la distància és la mateixa a qualsevol zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Ajusta l’extrem d’un segment de línia, o un cercle dibuixat des del centre, perquè toqui una corba propera. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Ajusta l’extrem d’un segment de línia perquè trobi un segment recte proper en angle recte. + Edit type set in fonts that aren't available? Voleu editar el text en tipus de lletra que no estan disponibles? Reset all preferences to their defaults? Voleu restablir totes les preferències als valors predeterminats? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Els valors predeterminats s’apliquen quan feu clic a D’acord a Preferències. Cancel·la allà conserva les preferències actuals. Restore Recovered Documents Restaura els documents recuperats diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index a5d7bb948a..639ce515a7 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4613,6 +4613,7 @@ font-technology Variable Variabilní How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Jak blízko na obrazovce musí ukazatel nebo tažený bod přijít ke kresbě, aby se chytrá vodítka přichytila; vzdálenost je stejná při každém zvětšení. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Přichytí konec úsečky nebo kružnici kreslenou od středu tak, aby se dotýkala blízké křivky. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Přichytí konec úsečky tak, aby se s blízkým rovným segmentem setkal v pravém úhlu. + Edit type set in fonts that aren't available? Upravit text v písmech, která nejsou k dispozici? Reset all preferences to their defaults? Obnovit všechny předvolby na výchozí hodnoty? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Výchozí hodnoty se použijí po klepnutí na OK v Předvolbách. Zrušit tam zachová vaše současné předvolby. Smaller ↔ Larger Menší ↔ Větší diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 08100f593f..bec08fbff9 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -7012,6 +7012,7 @@ font-technology Variable Variable How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Hvor tæt på skærmen markøren eller et trukket punkt skal komme på grafik, for at de smarte hjælpelinjer fastgør til den; afstanden er den samme ved alle zoomniveauer. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Fastgør enden af et linjesegment eller en cirkel tegnet fra midten, så den rører en nærliggende kurve. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Fastgør enden af et linjesegment, så det møder et nærliggende lige segment i en ret vinkel. + Edit type set in fonts that aren't available? Rediger tekst i skrifttyper, der ikke er tilgængelige? Reset all preferences to their defaults? Nulstil alle præferencer til standard? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Standardværdierne anvendes, når du klikker på OK i Præferencer. Annullér der beholder dine nuværende præferencer. Smaller ↔ Larger Mindre ↔ Større diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 10147b2d45..9084a39aa4 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3124,6 +3124,7 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Wie nah der Zeiger oder ein gezogener Punkt auf dem Bildschirm an Bildmaterial kommen muss, damit intelligente Hilfslinien einrasten; der Abstand ist bei jedem Zoom gleich. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Richtet das Ende eines Liniensegments oder einen von der Mitte aus gezeichneten Kreis so aus, dass er eine nahe Kurve berührt. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Richtet das Ende eines Liniensegments so aus, dass es ein nahes gerades Segment im rechten Winkel trifft. + Edit type set in fonts that aren't available? Text in Schriften bearbeiten, die nicht verfügbar sind? Reset all preferences to their defaults? Alle Voreinstellungen auf ihre Standardwerte zurücksetzen? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Die Standardwerte werden angewendet, wenn Sie in den Voreinstellungen auf OK klicken. Abbrechen dort behält Ihre aktuellen Voreinstellungen. Restore Recovered Documents Wiederhergestellte Dokumente öffnen diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 1ebf6e5684..deed0eb790 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -3942,6 +3942,7 @@ digits Malayalam Μαλαγιάλαμ How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Πόσο κοντά στην οθόνη πρέπει να φτάσει ο δείκτης ή ένα σημείο που σύρεται σε γραφικά για να προσκολληθούν οι έξυπνοι οδηγοί· η απόσταση είναι ίδια σε κάθε ζουμ. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Προσκολλά το άκρο ενός ευθύγραμμου τμήματος ή έναν κύκλο που σχεδιάζεται από το κέντρο του ώστε να αγγίζει μια κοντινή καμπύλη. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Προσκολλά το άκρο ενός ευθύγραμμου τμήματος ώστε να συναντά ένα κοντινό ευθύ τμήμα σε ορθή γωνία. + Edit type set in fonts that aren't available? Επεξεργασία κειμένου σε γραμματοσειρές που δεν είναι διαθέσιμες; Reset all preferences to their defaults? Επαναφορά όλων των προτιμήσεων στις προεπιλογές τους; The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Οι προεπιλογές εφαρμόζονται όταν κάνετε κλικ στο Εντάξει στις Προτιμήσεις. Το Ακύρωση εκεί διατηρεί τις τρέχουσες προτιμήσεις σας. Restore Recovered Documents Επαναφορά ανακτημένων εγγράφων diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index a456910a16..73ecae41a9 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3162,6 +3162,7 @@ digits Malayalam Malayálam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Cuánto debe acercarse en pantalla el puntero o un punto arrastrado a la ilustración para que las guías inteligentes se ajusten a ella; la distancia es la misma con cualquier zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Ajusta el extremo de un segmento de línea, o un círculo dibujado desde su centro, para que toque una curva cercana. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Ajusta el extremo de un segmento de línea para que encuentre un segmento recto cercano en ángulo recto. + Edit type set in fonts that aren't available? ¿Editar el texto en fuentes que no están disponibles? Reset all preferences to their defaults? ¿Restablecer todas las preferencias a sus valores predeterminados? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Los valores predeterminados se aplican al hacer clic en Aceptar en Preferencias. Cancelar ahí conserva sus preferencias actuales. Restore Recovered Documents Restaurar documentos recuperados diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index bff46fc0d7..5ae67e0dda 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4532,6 +4532,7 @@ font-technology Variable Muuttuvat How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Kuinka lähelle grafiikkaa osoittimen tai vedettävän pisteen on tultava näytöllä, jotta älykkäät apuviivat kohdistavat siihen; etäisyys on sama kaikilla zoomauksilla. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Kohdistaa janan pään tai keskipisteestä piirretyn ympyrän niin, että se koskettaa lähellä olevaa käyrää. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Kohdistaa janan pään niin, että se kohtaa lähellä olevan suoran segmentin suorassa kulmassa. + Edit type set in fonts that aren't available? Muokataanko tekstiä, jonka fontit eivät ole käytettävissä? Reset all preferences to their defaults? Palautetaanko kaikki asetukset oletuksiin? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Oletukset otetaan käyttöön, kun valitset Asetuksissa OK. Peruuta siellä säilyttää nykyiset asetuksesi. Smaller ↔ Larger Pienempi ↔ Suurempi diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3be3497f97..7bc64569cc 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3150,6 +3150,7 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. La distance à l’écran à laquelle le pointeur ou un point déplacé doit approcher une illustration pour que les repères commentés s’y aimantent. Elle est la même à tous les zooms. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Aimante l’extrémité d’un segment de droite, ou un cercle tracé depuis son centre, pour qu’il touche une courbe proche. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Aimante l’extrémité d’un segment de droite pour qu’il rencontre un segment droit proche à angle droit. + Edit type set in fonts that aren't available? Modifier le texte composé dans des polices non disponibles ? Reset all preferences to their defaults? Rétablir toutes les préférences à leur valeur par défaut ? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Les valeurs par défaut sont appliquées lorsque vous cliquez sur OK dans Préférences. Annuler y conserve vos préférences actuelles. Restore Recovered Documents Restaurer les documents récupérés diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index c427fc527c..659d6f3477 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3130,6 +3130,7 @@ Reset all બધું રીસેટ કરો Reset all 3D settings to their defaults. બધી 3D સેટિંગ્સ ડિફોલ્ટ પર રીસેટ કરો. Reset all Revolve settings to their defaults. બધી રિવોલ્વ સેટિંગ્સ ડિફોલ્ટ પર રીસેટ કરો. + Edit type set in fonts that aren't available? ઉપલબ્ધ ન હોય તેવા ફૉન્ટમાં સેટ કરેલો ટેક્સ્ટ સંપાદિત કરીએ? Reset all preferences to their defaults? બધી પસંદગીઓ ડિફોલ્ટ પર રીસેટ કરીએ? Reset the rows to the artwork's colors પંક્તિઓ આર્ટવર્કના રંગો પર રીસેટ કરો Reset to Inverse ઊલટા પર રીસેટ કરો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index cbfb4f51d1..7bfd7a5476 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4272,6 +4272,7 @@ antiAlias Sharp शार्प How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. स्मार्ट गाइड्स के स्नैप करने के लिए पॉइंटर या ड्रैग किया गया पॉइंट स्क्रीन पर आर्ट के कितने पास आना चाहिए; यह दूरी हर ज़ूम पर समान रहती है। Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. लाइन सेगमेंट के सिरे को, या केंद्र से ड्रॉ किए गए वृत्त को, इस तरह स्नैप करता है कि वह पास के वक्र को छुए। Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. लाइन सेगमेंट के सिरे को इस तरह स्नैप करता है कि वह पास के सीधे सेगमेंट से समकोण पर मिले। + Edit type set in fonts that aren't available? जो फ़ॉन्ट उपलब्ध नहीं हैं, उनमें सेट टेक्स्ट एडिट करें? Reset all preferences to their defaults? सभी प्रेफ़रेंसेज़ को उनके डिफ़ॉल्ट पर रीसेट करें? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. डिफ़ॉल्ट तब लागू होते हैं जब आप प्रेफ़रेंसेज़ में ठीक है पर क्लिक करते हैं। वहाँ रद्द करें आपकी मौजूदा प्रेफ़रेंसेज़ बनाए रखता है। Restore Recovered Documents पुनर्स्थापना डॉक्यूमेंट diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0f81a72036..fa98b5489a 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -3743,6 +3743,7 @@ mark-style Japanese Japán How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Milyen közel kell a mutatónak vagy egy húzott pontnak a képernyőn a grafikához érnie, hogy az intelligens segédvonalak illesszenek; a távolság minden nagyításnál azonos. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Egy szakasz végét vagy a középpontjából rajzolt kört úgy illeszti, hogy érintse a közeli görbét. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Egy szakasz végét úgy illeszti, hogy derékszögben találkozzon egy közeli egyenes szakasszal. + Edit type set in fonts that aren't available? Szerkeszti a nem elérhető betűtípusokkal szedett szöveget? Reset all preferences to their defaults? Visszaállítja az összes beállítást az alapértékre? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Az alapértékek akkor lépnek életbe, amikor a Beállításokban az OK gombra kattint. Az ottani Mégse megtartja a jelenlegi beállításokat. Restore Recovered Documents Helyreállított dokumentumok visszaállítása diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 28ea2b5ab3..485f6b5c22 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -4264,6 +4264,7 @@ font-technology Variable Variabel How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Seberapa dekat penunjuk atau titik yang diseret harus mendekati karya di layar agar panduan cerdas menjepret; jaraknya sama pada setiap zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Menjepretkan ujung segmen garis, atau lingkaran yang digambar dari pusatnya, agar menyentuh kurva di dekatnya. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Menjepretkan ujung segmen garis agar bertemu segmen lurus di dekatnya pada sudut siku-siku. + Edit type set in fonts that aren't available? Edit teks dengan font yang tidak tersedia? Reset all preferences to their defaults? Atur ulang semua preferensi ke defaultnya? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Nilai default diterapkan saat Anda mengklik OK di Preferensi. Batal di sana mempertahankan preferensi Anda saat ini. Smaller ↔ Larger Lebih kecil ↔ Lebih besar diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 8f2ed3216c..85cb90d85f 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3205,6 +3205,7 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Quanto vicino sullo schermo il puntatore o un punto trascinato deve arrivare alla grafica perché le guide sensibili vi si aggancino; la distanza è la stessa a ogni zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Aggancia l’estremità di un segmento di linea, o un cerchio disegnato dal centro, in modo che tocchi una curva vicina. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Aggancia l’estremità di un segmento di linea in modo che incontri un segmento rettilineo vicino ad angolo retto. + Edit type set in fonts that aren't available? Modificare il testo in font non disponibili? Reset all preferences to their defaults? Ripristinare tutte le preferenze ai valori predefiniti? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. I valori predefiniti vengono applicati quando fai clic su OK in Preferenze. Annulla lì mantiene le preferenze attuali. Restore Recovered Documents Ripristina documenti recuperati diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c429f204a1..2dbb86c65e 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3182,6 +3182,7 @@ mark-style Japanese 日本式 How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. スマートガイドがスナップするために、ポインターやドラッグしたポイントが画面上でアートにどこまで近づく必要があるかです。この距離はどのズームでも同じです。 Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. 直線セグメントの端、または中心から描いた円を、近くの曲線に接するようにスナップします。 Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. 直線セグメントの端を、近くの直線セグメントと直角に交わるようにスナップします。 + Edit type set in fonts that aren't available? 使用できないフォントのテキストを編集しますか? Reset all preferences to their defaults? すべての環境設定を初期値に戻しますか? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. 初期値は環境設定で OK をクリックすると適用されます。そこでキャンセルすると現在の環境設定が保たれます。 Restored documents open unsaved: save them to keep them. 復元したドキュメントは未保存の状態で開きます。保存して残してください。 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 414f45171c..307711cf52 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -6330,6 +6330,7 @@ font-technology Variable ცვლადი How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. რამდენად ახლოს უნდა მივიდეს ეკრანზე მაჩვენებელი ან გადათრეული წერტილი გრაფიკასთან, რომ ჭკვიანმა დამხმარე ხაზებმა მიაბან; მანძილი ყველა მასშტაბზე ერთნაირია. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. ხაზის სეგმენტის ბოლოს, ან ცენტრიდან დახატულ წრეწირს, ისე აბამს, რომ ახლომდებარე მრუდს შეეხოს. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. ხაზის სეგმენტის ბოლოს ისე აბამს, რომ ახლომდებარე სწორ სეგმენტს მართი კუთხით შეხვდეს. + Edit type set in fonts that aren't available? დავარედაქტიროთ მიუწვდომელი შრიფტებით აწყობილი ტექსტი? Reset all preferences to their defaults? დავაბრუნოთ ყველა პარამეტრი ნაგულისხმევ მნიშვნელობებზე? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. ნაგულისხმევი მნიშვნელობები გამოიყენება, როცა პარამეტრებში OK-ს დააჭერთ. იქ გაუქმება ინარჩუნებს თქვენს მიმდინარე პარამეტრებს. Smaller ↔ Larger უფრო პატარა ↔ უფრო დიდი diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index dbda53243f..be8b75ec08 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3171,6 +3171,7 @@ mark-style Japanese 일본식 How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. 스마트 안내선이 스냅하려면 포인터나 드래그한 점이 화면에서 아트에 얼마나 가까이 와야 하는지입니다. 이 거리는 모든 확대/축소에서 같습니다. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. 선 세그먼트의 끝이나 중심에서 그린 원을 가까운 곡선에 닿도록 스냅합니다. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. 선 세그먼트의 끝을 가까운 직선 세그먼트와 직각으로 만나도록 스냅합니다. + Edit type set in fonts that aren't available? 사용할 수 없는 글꼴로 설정된 문자를 편집하시겠습니까? Reset all preferences to their defaults? 모든 환경 설정을 기본값으로 재설정하시겠습니까? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. 기본값은 환경 설정에서 확인을 클릭하면 적용됩니다. 그곳에서 취소를 누르면 현재 환경 설정이 유지됩니다. Restored documents open unsaved: save them to keep them. 복원된 문서는 저장되지 않은 상태로 열립니다. 보존하려면 저장하세요. diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 69aef91cfc..1475c48ac9 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4886,6 +4886,7 @@ font-technology Variable Variabel How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Hoe dicht de aanwijzer of een gesleept punt op het scherm bij een illustratie moet komen voordat slimme hulplijnen erop uitlijnen; de afstand is bij elke zoom gelijk. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Lijnt het einde van een lijnsegment, of een cirkel getekend vanuit het middelpunt, zo uit dat het een curve in de buurt raakt. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Lijnt het einde van een lijnsegment zo uit dat het een recht segment in de buurt onder een rechte hoek raakt. + Edit type set in fonts that aren't available? Tekst in lettertypen bewerken die niet beschikbaar zijn? Reset all preferences to their defaults? Alle voorkeuren terugzetten naar de standaardwaarden? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. De standaardwaarden worden toegepast wanneer u in Voorkeuren op OK klikt. Annuleren daar behoudt uw huidige voorkeuren. Smaller ↔ Larger Kleiner ↔ Groter diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0147515ffe..c43f81c008 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4454,6 +4454,7 @@ font-technology Variable Zmienne How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Jak blisko na ekranie wskaźnik lub przeciągany punkt musi znaleźć się przy grafice, aby inteligentne linie pomocnicze go przyciągnęły; odległość jest taka sama przy każdym powiększeniu. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Przyciąga koniec odcinka lub okrąg rysowany od środka tak, aby dotykał pobliskiej krzywej. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Przyciąga koniec odcinka tak, aby spotykał pobliski prosty segment pod kątem prostym. + Edit type set in fonts that aren't available? Edytować tekst złożony niedostępnymi czcionkami? Reset all preferences to their defaults? Przywrócić domyślne wartości wszystkich preferencji? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Wartości domyślne zostaną zastosowane po kliknięciu OK w Preferencjach. Anuluj w tym oknie zachowuje bieżące preferencje. Smaller ↔ Larger Mniejszy ↔ większy diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 8201db7ab6..c112185e47 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2654,6 +2654,7 @@ digits Malayalam Malaiala How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Quão perto na tela o ponteiro ou um ponto arrastado precisa chegar da arte para que as guias inteligentes se ajustem a ela; a distância é a mesma em qualquer zoom. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Ajusta a extremidade de um segmento de linha, ou um círculo desenhado a partir do centro, para que toque uma curva próxima. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Ajusta a extremidade de um segmento de linha para que encontre um segmento reto próximo em ângulo reto. + Edit type set in fonts that aren't available? Editar o texto em fontes que não estão disponíveis? Reset all preferences to their defaults? Redefinir todas as preferências para o padrão? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Os padrões são aplicados quando você clica em OK em Preferências. Cancelar ali mantém suas preferências atuais. Restored documents open unsaved: save them to keep them. Os documentos restaurados abrem sem salvar: salve-os para mantê-los. diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index d1593508d3..d035f3c676 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3192,6 +3192,7 @@ digits Malayalam Малаялам How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Насколько близко на экране указатель или перетаскиваемая точка должны подойти к объекту, чтобы умные направляющие привязали их; расстояние одинаково при любом масштабе. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Привязывает конец отрезка или окружность, нарисованную от центра, так, чтобы она касалась ближайшей кривой. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Привязывает конец отрезка так, чтобы он встречал ближайший прямой сегмент под прямым углом. + Edit type set in fonts that aren't available? Редактировать текст, набранный недоступными шрифтами? Reset all preferences to their defaults? Сбросить все настройки до значений по умолчанию? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Значения по умолчанию применяются, когда вы нажимаете ОК в окне «Настройки». Отмена там сохраняет текущие настройки. Restore Recovered Documents Восстановить восстановленные документы diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 5c0420fcd3..ce7c42227b 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3092,6 +3092,7 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Hur nära på skärmen pekaren eller en dragen punkt måste komma teckningen för att de smarta stödlinjerna ska fästa mot den; avståndet är detsamma vid alla zoomnivåer. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Fäster änden av ett linjesegment, eller en cirkel ritad från sin mitt, så att den rör en närliggande kurva. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Fäster änden av ett linjesegment så att det möter ett närliggande rakt segment i rät vinkel. + Edit type set in fonts that aren't available? Redigera text i typsnitt som inte är tillgängliga? Reset all preferences to their defaults? Återställa alla inställningar till standard? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Standardvärdena verkställs när du klickar på OK i Inställningar. Avbryt där behåller dina nuvarande inställningar. Restore Recovered Documents Återställ återskapade dokument diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 910a7fc5b1..9885158818 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -2929,6 +2929,7 @@ digits Malayalam Malayalam How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Akıllı Kılavuzların yaslaması için işaretçinin veya sürüklenen noktanın ekranda çizime ne kadar yaklaşması gerektiği; mesafe her yakınlaştırmada aynıdır. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Bir çizgi parçasının ucunu veya merkezinden çizilen bir daireyi yakındaki bir eğriye değecek şekilde yaslar. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Bir çizgi parçasının ucunu yakındaki düz bir parçayla dik açıyla buluşacak şekilde yaslar. + Edit type set in fonts that aren't available? Mevcut olmayan yazı tiplerindeki metin düzenlensin mi? Reset all preferences to their defaults? Tüm tercihler varsayılanlarına sıfırlansın mı? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Varsayılanlar, Tercihler'de Tamam'a tıkladığınızda uygulanır. Oradaki İptal, mevcut tercihlerinizi korur. Restore Recovered Documents Kurtarılan Belgeleri Geri Yükle diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index dbd6d2609e..2827529aff 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3197,6 +3197,7 @@ digits Malayalam Малаялам How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Наскільки близько на екрані вказівник або перетягувана точка мають підійти до об’єкта, щоб розумні напрямні їх прив’язали; відстань однакова за будь-якого масштабу. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Прив’язує кінець відрізка або коло, намальоване від центру, так, щоб воно торкалося найближчої кривої. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Прив’язує кінець відрізка так, щоб він зустрічав найближчий прямий сегмент під прямим кутом. + Edit type set in fonts that aren't available? Редагувати текст, набраний недоступними шрифтами? Reset all preferences to their defaults? Скинути всі налаштування до значень за промовчанням? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Значення за промовчанням застосовуються, коли ви натискаєте ОК у вікні «Налаштування». Скасувати там зберігає поточні налаштування. Restore Recovered Documents Відновити відновлені документи diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 519c5d8f0d..791cbebec8 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3512,6 +3512,7 @@ mark-style Japanese Kiểu Nhật How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. Con trỏ hoặc điểm đang kéo phải đến gần hình vẽ trên màn hình bao nhiêu để đường căn thông minh hút vào; khoảng cách này như nhau ở mọi mức thu phóng. Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. Hút đầu mút của đoạn thẳng, hoặc hình tròn vẽ từ tâm, để nó chạm vào một đường cong ở gần. Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. Hút đầu mút của đoạn thẳng để nó gặp một đoạn thẳng ở gần theo góc vuông. + Edit type set in fonts that aren't available? Chỉnh sửa văn bản dùng phông chữ không có sẵn? Reset all preferences to their defaults? Đặt lại tất cả tùy chọn về mặc định? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. Giá trị mặc định được áp dụng khi bạn nhấn OK trong Tùy chọn. Hủy ở đó giữ nguyên các tùy chọn hiện tại của bạn. Restore Recovered Documents Khôi phục tài liệu đã phục hồi diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index c6696a9ec6..3b82156b06 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3056,6 +3056,7 @@ digits Malayalam 马拉雅拉姆数字 How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. 指针或拖动的点在屏幕上需离图稿多近,智能参考线才会吸附;该距离在任何缩放比例下都相同。 Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. 吸附线段的端点或从中心绘制的圆,使其与附近的曲线相切。 Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. 吸附线段的端点,使其与附近的直线段成直角相交。 + Edit type set in fonts that aren't available? 要编辑使用了不可用字体的文字吗? Reset all preferences to their defaults? 将所有首选项重置为默认值? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. 在首选项中点击确定后才会应用默认值。在那里点击取消会保留当前首选项。 Restore Recovered Documents 恢复已恢复的文档 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 1480422931..e73f2754c1 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4340,6 +4340,7 @@ digits Malayalam 馬來亞拉姆數字 How near on screen the pointer or a dragged point must come to art for Smart Guides to snap to it; the distance is the same at every zoom. 指標或拖曳的點在螢幕上需離圖稿多近,智慧型參考線才會靠齊;此距離在任何縮放比例下都相同。 Snaps the end of a line segment, or a circle drawn from its center, so that it touches a nearby curve. 靠齊線段的端點或從中心繪製的圓,使其與附近的曲線相切。 Snaps the end of a line segment so that it meets a nearby straight segment at a right angle. 靠齊線段的端點,使其與附近的直線段成直角相交。 + Edit type set in fonts that aren't available? 要編輯使用了無法使用之字體的文字嗎? Reset all preferences to their defaults? 要將所有偏好設定重設為預設值嗎? The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. 在偏好設定中按下確定後才會套用預設值。在那裡按下取消會保留目前的偏好設定。 Restore Recovered Documents 還原找回的文件 diff --git a/docs/mcp.md b/docs/mcp.md index 092faabc4c..5431d539bb 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -11460,6 +11460,18 @@ Copy only fonts you own or are licensed to install. `command.batch` returns befo `text.findFontFiles {}`. `vectorcraft-cli run` stops the search when its last step ends. The web build has no Fonts folder and no folder search. +A Type tool click, or a Selection or Direct Selection double-click, that would start editing type whose story (every +frame threaded with it) is drawn in a font that isn't available as named, as `text.missingFonts` reads them, opens a +`missingFontEdit` question instead (fields `message`, `detail`, `__token`) and does not start editing. `ui.dialog.confirm` +starts the edit with the caret where the type was clicked; `ui.dialog.cancel` leaves the document, its undo history and +the selection as they were. Answering does not change the fonts the type names, install a font or open Find Font. The +question comes again for each new edit, and not for a click within the type being edited or in another frame of its +story. The Type tool's `missingFontEdit {token, ok}` option is how the question gives its answer. Commands that change +text (`text.editRange`, `text.setRangeStyle` and the others) do not ask. This follows the help page +https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/edit-text-without-replacing-missing-fonts.html, +which describes a warning shown when text with missing fonts is double-clicked, and editing after OK. Cancel, asking +again for each edit, the Type tool's single click and the style-only case are VectorCraft's own rules. + ```json {"name":"run_command","arguments":{"command":"text.missingFonts","params":{}}} {"name":"run_command","arguments":{"command":"text.findFontFiles","params":{"folder":"/Users/me/Downloads"}}} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e9fc9a6820..60315d65f4 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1887,6 +1887,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur The font menu's Recently Added filter (on its own row under Font Technology) lists only the installed families added in the last 30 days, the newest at the top, as the [user guide](https://web.archive.org/web/20210601162814/https://helpx.adobe.com/pdf/illustrator_reference.pdf#page=486) and the [font browser overview](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/font-options-overview.html) describe it (`vectorcraft_text::FontDb::recently_added`). It works together with the search, script, kind, Variable, ★ and Document filters, lists only the families every active filter matches, steers the closed field's wheel, and is shared by every font menu for the session like the other filters. VectorCraft's own rules: a family is dated by the creation time of its newest font file on this computer (a file the file system keeps no creation time for, or one dated in the future, does not count), the 30th day is included, families added at the same instant are in name order, the recently used families appear in that order without the Recent Fonts section, Show Similar Fonts orders only the families the filter lists, a family leaves the list when its 30 days end while the menu is open, an empty list keeps the filter on and says no fonts match, and fonts bundled with the app or loaded from documents are never listed. Measured by `font_menu::tests::the_recently_added_filter_lists_new_families_newest_first`, `font_menu::tests::the_recently_added_filter_drops_families_as_their_30_days_end`, `font_menu::tests::the_recently_added_filter_lists_a_font_installed_just_now`, `tests::recently_added::families_added_in_the_last_30_days_are_listed_newest_first`, `tests::recently_added::a_family_is_dated_by_its_newest_valid_file` and `tests::sysfonts::installed_fonts_are_recently_added_by_their_files_creation_time`. The font database looks up a name that is neither a loaded nor an installed family among the other names of the loaded and installed fonts once for each style it is asked in, and keeps the answer until fonts are added or rescanned. Laying out a story of 1,000 paragraphs set in a font that is not installed, with 400 more fonts loaded, takes a median of 56 to 71 ms instead of 409 to 507 ms on Windows 11 (`CRAFT_FONTS_DIR=<craft-fonts checkout> cargo test --release -p vectorcraft-text --lib missing_font_story_layout_timing -- --ignored --nocapture`). A font family removed while the app runs leaves the font menus when the app scans the font folders again (when its window comes to the front after a font folder changed, or Refresh Font List), also when type had used it: that type then draws in the fallback font and Find Font lists the font as missing, until the font is installed again and the folders are scanned. + Editing type set in a font that isn't available asks first: a Type tool click, or a Selection or Direct Selection double-click, on type whose story is drawn in a missing family or a style its family lacks opens a question naming those fonts, and OK starts editing where the type was clicked, as the [help page](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/edit-text-without-replacing-missing-fonts.html) describes for a double-click on such text. VectorCraft's own rules: Cancel leaves the document, its undo history and the selection as they were; each new edit asks again; the Type tool's single click and a style its family lacks ask too; the question does not change the fonts the type names. Tests: `text::tests::a_click_on_type_in_a_missing_font_asks_before_editing` and the tests after it (`crates/tools`), `canvas::tests::double_clicking_type_in_a_missing_font_asks_before_editing` (`crates/ui-egui`). - **Files (M4):** - PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. - PDF export and print composition use the optional shared guarded writer ([pdf-backend.md](pdf-backend.md)); app drawing and output policy and desktop printer submission remain in their existing layers. The shared reader keeps the app-owned import adapter; synthetic tests cover layer and overprint state across windows, long operands, inline images, failed decoding, document limits and incomplete tails. Empty and populated metadata key presence is regression-tested, and CI checks the immutable backend source. From 15b3aa1d687ab756be0948c570ba83218c7340d1 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 11:39:00 -0800 Subject: [PATCH 069/158] Brushes: Add original Pressure Sensitive library --- crates/engine/src/cmd/brushlib.rs | 42 +++++++++++++++ crates/engine/src/tests/brushlib.rs | 52 +++++++++++++++++-- crates/ui-egui/src/i18n/bg.tsv | 5 ++ crates/ui-egui/src/i18n/bs.tsv | 5 ++ crates/ui-egui/src/i18n/ca.tsv | 5 ++ crates/ui-egui/src/i18n/cs.tsv | 5 ++ crates/ui-egui/src/i18n/da.tsv | 5 ++ crates/ui-egui/src/i18n/de.tsv | 5 ++ crates/ui-egui/src/i18n/el.tsv | 5 ++ crates/ui-egui/src/i18n/es.tsv | 5 ++ crates/ui-egui/src/i18n/fi.tsv | 5 ++ crates/ui-egui/src/i18n/fr.tsv | 5 ++ crates/ui-egui/src/i18n/gu.tsv | 5 ++ crates/ui-egui/src/i18n/hi.tsv | 5 ++ crates/ui-egui/src/i18n/hu.tsv | 5 ++ crates/ui-egui/src/i18n/id.tsv | 5 ++ crates/ui-egui/src/i18n/it.tsv | 5 ++ crates/ui-egui/src/i18n/ja.tsv | 5 ++ crates/ui-egui/src/i18n/ka.tsv | 5 ++ crates/ui-egui/src/i18n/ko.tsv | 5 ++ crates/ui-egui/src/i18n/nl.tsv | 5 ++ crates/ui-egui/src/i18n/pl.tsv | 5 ++ crates/ui-egui/src/i18n/pt-br.tsv | 5 ++ crates/ui-egui/src/i18n/ru.tsv | 5 ++ crates/ui-egui/src/i18n/sv.tsv | 5 ++ crates/ui-egui/src/i18n/tests.rs | 3 +- crates/ui-egui/src/i18n/tr.tsv | 5 ++ crates/ui-egui/src/i18n/uk.tsv | 5 ++ crates/ui-egui/src/i18n/vi.tsv | 5 ++ crates/ui-egui/src/i18n/zh-hans.tsv | 5 ++ crates/ui-egui/src/i18n/zh-hant.tsv | 5 ++ .../src/panels/tests_brush_libraries.rs | 12 +++++ docs/mcp.md | 2 +- docs/target-app-parity.md | 5 +- 34 files changed, 248 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/cmd/brushlib.rs b/crates/engine/src/cmd/brushlib.rs index 34becd7c02..2f4d0388db 100644 --- a/crates/engine/src/cmd/brushlib.rs +++ b/crates/engine/src/cmd/brushlib.rs @@ -172,6 +172,7 @@ pub const BUILTIN: &[BuiltinBrushLibrary] = &[ BuiltinBrushLibrary { id: "art-ribbons", name: "Art Ribbons", make: art_ribbons }, BuiltinBrushLibrary { id: "ink-and-wash", name: "Ink and Wash", make: ink_and_wash }, BuiltinBrushLibrary { id: "calligraphic-nibs", name: "Calligraphic Nibs", make: calligraphic_nibs }, + BuiltinBrushLibrary { id: "pressure-sensitive", name: "Pressure Sensitive", make: pressure_sensitive }, BuiltinBrushLibrary { id: "bristle-brushes", name: "Bristle Brushes", make: bristle_brushes }, BuiltinBrushLibrary { id: "pattern-borders", name: "Pattern Borders", make: pattern_borders }, BuiltinBrushLibrary { id: "scatter-shapes", name: "Scatter Shapes", make: scatter_shapes }, @@ -374,6 +375,47 @@ fn bristle(name: &str, shape: BristleShape, [size, length, density, thickness, o Brush { name: name.into(), kind: BrushKind::Bristle(Bristle { shape, size, length, density, thickness, opacity, stiffness }) } } +/// Pressure Sensitive: four original marks whose art width or nib size responds to recorded pen +/// pressure. Mouse paths keep the engine's neutral middle-pressure rendering. +fn pressure_sensitive() -> BrushLibrary { + let flex = black(band(100.0, 5.0, 48, |x| 0.5 * (x / 100.0 * std::f64::consts::TAU).sin())); + let pulse = group(vec![ + black(band(100.0, 2.8, 64, |x| 1.4 * (x / 100.0 * 2.0 * std::f64::consts::TAU).sin())), + black(shapes::ellipse(Rect::new(46.0, -2.2, 54.0, 2.2))), + ]); + let art_pressure = |name: &str, art: Node, light: f64, heavy: f64| Brush { + name: name.into(), + kind: BrushKind::Art(ArtBrush { + art, + width: light, + width_mode: Some(Variation::Pressure), + width_max: Some(heavy), + colorization: Colorization::Tints, + ..Default::default() + }), + }; + let nib_pressure = |name: &str, angle: f64, roundness: f64, size: f64, variation: f64| Brush { + name: name.into(), + kind: BrushKind::Calligraphic(Calligraphic { + angle, + roundness, + size, + variation: [0.0, 0.0, variation], + modes: Some([Variation::Fixed, Variation::Fixed, Variation::Pressure]), + }), + }; + built( + "Pressure Sensitive", + Document::new(100.0, 100.0), + vec![ + art_pressure("Flex Ribbon", flex, 35.0, 250.0), + art_pressure("Pulse Stroke", pulse, 45.0, 280.0), + nib_pressure("Round Flow", 0.0, 100.0, 7.0, 5.0), + nib_pressure("Chisel Flow", 35.0, 25.0, 9.0, 7.0), + ], + ) +} + /// Bristle Brushes: one bristle brush for each tip shape, from a fine liner to wide fans for /// blending and texture. fn bristle_brushes() -> BrushLibrary { diff --git a/crates/engine/src/tests/brushlib.rs b/crates/engine/src/tests/brushlib.rs index 4f0b739951..e5f90d4538 100644 --- a/crates/engine/src/tests/brushlib.rs +++ b/crates/engine/src/tests/brushlib.rs @@ -110,6 +110,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() { "art-ribbons", "ink-and-wash", "calligraphic-nibs", + "pressure-sensitive", "bristle-brushes", "pattern-borders", "scatter-shapes", @@ -131,19 +132,19 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() { trails["brushes"].as_array().unwrap().iter().map(|b| b["name"].as_str().unwrap()).collect::<Vec<_>>(), ["Speed Line", "Dash Trail", "Burst Ray", "Zigzag"] ); - assert_eq!(libs[6]["count"].as_u64(), Some(4)); + assert_eq!(libs[7]["count"].as_u64(), Some(4)); let beams = run(&mut s, "brush.library", json!({"library": "energy-beams"})); assert_eq!( beams["brushes"].as_array().unwrap().iter().map(|b| b["name"].as_str().unwrap()).collect::<Vec<_>>(), ["Laser Bolt", "Plasma Arc", "Charge Wave", "Spark Trail"] ); - assert_eq!(libs[7]["count"].as_u64(), Some(4)); + assert_eq!(libs[8]["count"].as_u64(), Some(4)); let dry = run(&mut s, "brush.library", json!({"library": "Dry Media"})); assert_eq!( dry["brushes"].as_array().unwrap().iter().map(|b| (b["name"].as_str().unwrap(), b["type"].as_str().unwrap())).collect::<Vec<_>>(), [("Chalk Grain", "art"), ("Graphite Pencil", "art"), ("Wax Crayon", "art"), ("Charcoal Dust", "art")] ); - assert_eq!((libs[8]["name"].as_str(), libs[8]["count"].as_u64()), (Some("Dry Media"), Some(4))); + assert_eq!((libs[9]["name"].as_str(), libs[9]["count"].as_u64()), (Some("Dry Media"), Some(4))); run(&mut s, "file.new", json!({"width": 200, "height": 200})); let id = run(&mut s, "shape.rectangle", json!({"x": 10, "y": 20, "width": 40, "height": 8}))["id"].as_u64().unwrap(); let added = run(&mut s, "brush.addFromLibrary", json!({"library": "energy-beams", "name": "Laser Bolt", "apply": true, "ids": [id]})); @@ -154,6 +155,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() { ("art-ribbons", "art"), ("ink-and-wash", "art"), ("calligraphic-nibs", "calligraphic"), + ("pressure-sensitive", "art"), ("bristle-brushes", "bristle"), ("pattern-borders", "pattern"), ("scatter-shapes", "scatter"), @@ -164,7 +166,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() { let (_, lib) = cmd::brushlib::library(&s, id).unwrap(); assert!(lib.len() >= 4, "{id}"); for b in &lib.brushes { - let kind = if b.name == "Brush Pen" { "calligraphic" } else { kind }; + let kind = if ["Brush Pen", "Round Flow", "Chisel Flow"].contains(&b.name.as_str()) { "calligraphic" } else { kind }; assert_eq!(b.kind.type_id(), kind, "{}", b.name); let mut line = vectorcraft_geom::BezPath::new(); line.move_to((0.0, 0.0)); @@ -299,6 +301,48 @@ fn the_tech_circuit_library_constructs_adds_and_applies_each_brush() { assert_eq!(vectorcraft_brush::library(&reopened), lib.brushes); } +#[test] +fn pressure_sensitive_brushes_widen_with_pen_pressure_and_survive_a_saved_library() { + let mut s = session(); + let (_, lib) = cmd::brushlib::library(&s, "Pressure Sensitive").unwrap(); + let names = ["Flex Ribbon", "Pulse Stroke", "Round Flow", "Chisel Flow"]; + assert_eq!(lib.brushes.iter().map(|b| b.name.as_str()).collect::<Vec<_>>(), names); + let path = run(&mut s, "shape.line", json!({"x1": 10, "y1": 40, "x2": 190, "y2": 40}))["id"].as_u64().unwrap(); + let mut curve = line_to(20.0); + curve.curve_to((60.0, -25.0), (140.0, 25.0), (180.0, 0.0)); + for b in &lib.brushes { + let width_at = |pressure| { + let stroke = vectorcraft_doc::StrokeLayer { + pressure: Some(vectorcraft_doc::PressureProfile { points: vec![(0.0, pressure), (1.0, pressure)] }), + ..black_stroke() + }; + let pieces = vectorcraft_brush::stroke_pieces(&lib.doc, b, &line_to(180.0), &stroke); + let points = anchors(&pieces.iter().collect::<Vec<_>>()); + let min = points.iter().map(|p| p.y).fold(f64::INFINITY, f64::min); + let max = points.iter().map(|p| p.y).fold(f64::NEG_INFINITY, f64::max); + max - min + }; + let light = width_at(0.0); + let heavy = width_at(1.0); + assert!(light.is_finite() && heavy > light * 1.3, "{}: light={light}, heavy={heavy}", b.name); + for line in [line_to(2.0), curve.clone()] { + let pieces = vectorcraft_brush::stroke_pieces(&lib.doc, b, &line, &black_stroke()); + let points = anchors(&pieces.iter().collect::<Vec<_>>()); + assert!(!points.is_empty() && points.iter().all(|p| p.x.is_finite() && p.y.is_finite()), "{}", b.name); + } + let before = undo_len(&s); + let added = run(&mut s, "brush.addFromLibrary", json!({"library": "pressure-sensitive", "name": b.name, "apply": true, "ids": [path]})); + assert_eq!(strs(&added["added"]), [b.name.as_str()]); + assert_eq!(added["applied"], json!([path])); + assert_eq!(undo_len(&s), before + 1); + assert_eq!(doc(&s).node(NodeId(path)).unwrap().appearance.stroke().unwrap().brush.as_deref(), Some(b.name.as_str())); + } + let saved = run(&mut s, "brush.saveLibrary", json!({"names": names})); + let bytes = vectorcraft_format::base64_decode(saved["dataBase64"].as_str().unwrap()).unwrap(); + let reopened = vectorcraft_format::load(&bytes).unwrap(); + assert_eq!(vectorcraft_brush::library(&reopened), lib.brushes); +} + /// Ink and Wash: a tapered ink art brush, a brush pen whose size follows the pen pressure and two /// translucent washes, with names of their own and a few paths of art each. #[test] diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index bb039bb08e..f0eccef238 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -7237,3 +7237,8 @@ breakText Glyphs Глифи @msg A fold line is on a non-printing layer. Линия на сгъване е на слой, който не се печата. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Панели: {panels}, панти: {hinges}, грешки: {errors}, предупреждения: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer трябва да е "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine" + Pressure Sensitive Чувствителни на натиск + Flex Ribbon Гъвкава лента + Pulse Stroke Пулсиращ щрих + Round Flow Кръгъл поток + Chisel Flow Скосен поток diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 99f23d313c..7960149d6a 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -7291,3 +7291,8 @@ shape Open Otvoren @msg A fold line is on a non-printing layer. Linija savijanja je na sloju koji se ne štampa. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneli: {panels}, šarke: {hinges}, greške: {errors}, upozorenja: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer mora biti "singleLine", "everyLine", "standardSingleLine" ili "standardEveryLine" + Pressure Sensitive Osjetljivo na pritisak + Flex Ribbon Savijajuća traka + Pulse Stroke Pulsirajući potez + Round Flow Okrugli tok + Chisel Flow Kosi tok diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index c54311799d..c2b6d16623 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -8126,3 +8126,8 @@ breakText Glyphs Glifs @msg A fold line is on a non-printing layer. Una línia de plegat és en una capa que no s’imprimeix. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panells: {panels}, frontisses: {hinges}, errors: {errors}, avisos: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer ha de ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" + Pressure Sensitive Sensible a la pressió + Flex Ribbon Cinta flexible + Pulse Stroke Traç pulsant + Round Flow Flux rodó + Chisel Flow Flux bisellat diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index a5d7bb948a..20e6c33a6f 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -9917,3 +9917,8 @@ breakText Glyphs Glyfy @msg A panel is not joined to the rest by a crease. Panel není se zbytkem spojen žádnou linií bigu. @msg A fold line is on a non-printing layer. Linie skladu je na netisknutelné vrstvě. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panely: {panels}, panty: {hinges}, chyby: {errors}, upozornění: {warnings} + Pressure Sensitive Citlivé na tlak + Flex Ribbon Pružná stuha + Pulse Stroke Pulzující tah + Round Flow Kulatý tah + Chisel Flow Zkosený tah diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 08100f593f..b5796c0aec 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -10025,3 +10025,8 @@ breakText Glyphs Glyffer @msg A fold line is on a non-printing layer. En foldelinje ligger på et lag, der ikke udskrives. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneler: {panels}, hængsler: {hinges}, fejl: {errors}, advarsler: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer skal være "singleLine", "everyLine", "standardSingleLine" eller "standardEveryLine" + Pressure Sensitive Trykfølsom + Flex Ribbon Fleksibelt bånd + Pulse Stroke Pulserende strøg + Round Flow Rundt strøg + Chisel Flow Skråt strøg diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 10147b2d45..83cbeed483 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -9516,3 +9516,8 @@ breakText Glyphs Glyphen @msg A panel is not joined to the rest by a crease. Ein Feld ist durch keine Rilllinie mit den übrigen verbunden. @msg A fold line is on a non-printing layer. Eine Faltlinie liegt auf einer nicht druckbaren Ebene. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Felder: {panels}, Scharniere: {hinges}, Fehler: {errors}, Warnungen: {warnings} + Pressure Sensitive Druckempfindlich + Flex Ribbon Flexibles Band + Pulse Stroke Pulsierender Strich + Round Flow Runder Fluss + Chisel Flow Schräger Fluss diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 1ebf6e5684..18bd4f19cd 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -8100,3 +8100,8 @@ breakText Glyphs Γλύφοι @msg A fold line is on a non-printing layer. Μια γραμμή δίπλωσης βρίσκεται σε επίπεδο που δεν εκτυπώνεται. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Πάνελ: {panels}, μεντεσέδες: {hinges}, σφάλματα: {errors}, προειδοποιήσεις: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" το composer πρέπει να είναι "singleLine", "everyLine", "standardSingleLine" ή "standardEveryLine" + Pressure Sensitive Ευαίσθητα στην πίεση + Flex Ribbon Εύκαμπτη κορδέλα + Pulse Stroke Παλμική πινελιά + Round Flow Στρογγυλή ροή + Chisel Flow Λοξή ροή diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index a456910a16..905ff375ca 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -8087,3 +8087,8 @@ breakText Glyphs Glifos @msg A fold line is on a non-printing layer. Una línea de plegado está en una capa que no se imprime. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneles: {panels}, bisagras: {hinges}, errores: {errors}, advertencias: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer debe ser "singleLine", "everyLine", "standardSingleLine" o "standardEveryLine" + Pressure Sensitive Sensible a la presión + Flex Ribbon Cinta flexible + Pulse Stroke Trazo pulsante + Round Flow Flujo redondo + Chisel Flow Flujo biselado diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index bff46fc0d7..c3098d4a7d 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -8183,3 +8183,8 @@ breakText Glyphs Merkit @msg A fold line is on a non-printing layer. Taittoviiva on tasolla, jota ei tulosteta. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneelit: {panels}, saranat: {hinges}, virheet: {errors}, varoitukset: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer on oltava "singleLine", "everyLine", "standardSingleLine" tai "standardEveryLine" + Pressure Sensitive Paineherkkä + Flex Ribbon Joustava nauha + Pulse Stroke Sykkivä veto + Round Flow Pyöreä veto + Chisel Flow Viisto veto diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3be3497f97..ee929519c4 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -9902,3 +9902,8 @@ breakText Glyphs Glyphes @msg A fold line is on a non-printing layer. Une ligne de pliage se trouve sur un calque non imprimable. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} {panels} panneau(x), {hinges} charnière(s), {errors} erreur(s), {warnings} avertissement(s) @msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixels, c’est trop grand pour le GIF (65535 pixels par côté au plus) : réduisez la résolution + Pressure Sensitive Sensible à la pression + Flex Ribbon Ruban souple + Pulse Stroke Trait pulsé + Round Flow Flux rond + Chisel Flow Flux biseauté diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index c427fc527c..0c50eec7ff 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -4987,3 +4987,8 @@ swatch [Registration] [રજિસ્ટ્રેશન] Standard Single-line Composer સ્ટાન્ડર્ડ સિંગલ-લાઇન કમ્પોઝર Standard Every-line Composer સ્ટાન્ડર્ડ એવરી-લાઇન કમ્પોઝર @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer આમાંથી એક હોવું જોઈએ: "singleLine", "everyLine", "standardSingleLine" અથવા "standardEveryLine" + Pressure Sensitive દબાણ સંવેદનશીલ + Flex Ribbon લવચીક પટ્ટી + Pulse Stroke ધબકતો ઘસારો + Round Flow ગોળ પ્રવાહ + Chisel Flow ત્રાંસો પ્રવાહ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index cbfb4f51d1..37b34d7947 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -9524,3 +9524,8 @@ theme Appearance अपीयरेंस @msg A panel is not joined to the rest by a crease. कोई पैनल किसी क्रीज़ लाइन से बाकी से जुड़ा नहीं है। @msg A fold line is on a non-printing layer. एक फ़ोल्ड लाइन नॉन-प्रिंटिंग लेयर पर है। @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} पैनल: {panels}, हिंज: {hinges}, एरर: {errors}, वॉर्निंग: {warnings} + Pressure Sensitive दबाव संवेदनशील + Flex Ribbon लचीला फीता + Pulse Stroke स्पंदित रेखा + Round Flow गोल प्रवाह + Chisel Flow तिरछा प्रवाह diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0f81a72036..7fabba7f62 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -9905,3 +9905,8 @@ breakText Glyphs Glifák @msg A panel is not joined to the rest by a crease. Egy panelt egyetlen bigvonal sem köt a többihez. @msg A fold line is on a non-printing layer. Egy hajtásvonal nem nyomtatható rétegen van. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panelek: {panels}, zsanérok: {hinges}, hibák: {errors}, figyelmeztetések: {warnings} + Pressure Sensitive Nyomásérzékeny + Flex Ribbon Rugalmas szalag + Pulse Stroke Lüktető vonás + Round Flow Kerek vonás + Chisel Flow Ferde vonás diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 28ea2b5ab3..efbe2c50ae 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -7252,3 +7252,8 @@ breakText Glyphs Glif @msg A fold line is on a non-printing layer. Sebuah garis lipat berada di lapisan yang tidak dicetak. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panel: {panels}, engsel: {hinges}, galat: {errors}, peringatan: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer harus "singleLine", "everyLine", "standardSingleLine", atau "standardEveryLine" + Pressure Sensitive Peka Tekanan + Flex Ribbon Pita Lentur + Pulse Stroke Goresan Berdenyut + Round Flow Aliran Bulat + Chisel Flow Aliran Serong diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 8f2ed3216c..8af2760bfb 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -9550,3 +9550,8 @@ breakText Glyphs Glifi @msg A panel is not joined to the rest by a crease. Un pannello non è unito al resto da alcuna linea di cordonatura. @msg A fold line is on a non-printing layer. Una linea di piega si trova su un livello non stampabile. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Pannelli: {panels}, cerniere: {hinges}, errori: {errors}, avvisi: {warnings} + Pressure Sensitive Sensibile alla pressione + Flex Ribbon Nastro flessibile + Pulse Stroke Tratto pulsante + Round Flow Flusso tondo + Chisel Flow Flusso obliquo diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c429f204a1..e26401309d 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -9617,3 +9617,8 @@ breakText Glyphs 字形 @msg A panel is not joined to the rest by a crease. パネルがどの筋入れ線でも他とつながっていません。 @msg A fold line is on a non-printing layer. 折り線が印刷しないレイヤーにあります。 @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} パネル: {panels}、ヒンジ: {hinges}、エラー: {errors}、警告: {warnings} + Pressure Sensitive 筆圧対応 + Flex Ribbon しなやかなリボン + Pulse Stroke 脈打つ線 + Round Flow 丸筆の流れ + Chisel Flow 平筆の流れ diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 414f45171c..f41de6c601 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -10285,3 +10285,8 @@ font-script Japanese იაპონური @msg A fold line is on a non-printing layer. მოკეცვის ხაზი არაბეჭდვად შრეზეა. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} პანელები: {panels}, ანჯამები: {hinges}, შეცდომები: {errors}, გაფრთხილებები: {warnings} @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer უნდა იყოს "singleLine", "everyLine", "standardSingleLine" ან "standardEveryLine" + Pressure Sensitive წნევაზე მგრძნობიარე + Flex Ribbon მოქნილი ლენტი + Pulse Stroke პულსირებადი მონასმი + Round Flow მრგვალი ნაკადი + Chisel Flow დახრილი ნაკადი diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index dbda53243f..260603d620 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -9514,3 +9514,8 @@ breakText Glyphs 글리프 @msg A panel is not joined to the rest by a crease. 패널이 어떤 오시선으로도 나머지와 연결되어 있지 않습니다. @msg A fold line is on a non-printing layer. 접는 선이 인쇄되지 않는 레이어에 있습니다. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} 패널: {panels}, 힌지: {hinges}, 오류: {errors}, 경고: {warnings} + Pressure Sensitive 압력 감지 + Flex Ribbon 유연한 리본 + Pulse Stroke 맥동 획 + Round Flow 둥근 흐름 + Chisel Flow 비스듬한 흐름 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 69aef91cfc..d22e2c0e9a 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -9953,3 +9953,8 @@ breakText Glyphs Glyphs @msg A panel is not joined to the rest by a crease. Een paneel is door geen rillijn met de rest verbonden. @msg A fold line is on a non-printing layer. Een vouwlijn staat op een laag die niet wordt afgedrukt. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panelen: {panels}, scharnieren: {hinges}, fouten: {errors}, waarschuwingen: {warnings} + Pressure Sensitive Drukgevoelig + Flex Ribbon Flexibel lint + Pulse Stroke Pulserende streek + Round Flow Ronde vloei + Chisel Flow Schuine vloei diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0147515ffe..a71afbf92d 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -9770,3 +9770,8 @@ breakText Glyphs Glify @msg A panel is not joined to the rest by a crease. Panel nie jest połączony z resztą żadną linią bigowania. @msg A fold line is on a non-printing layer. Linia zgięcia znajduje się na warstwie niedrukowanej. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Panele: {panels}, zawiasy: {hinges}, błędy: {errors}, ostrzeżenia: {warnings} + Pressure Sensitive Czułe na nacisk + Flex Ribbon Elastyczna wstążka + Pulse Stroke Pulsujące pociągnięcie + Round Flow Okrągły ślad + Chisel Flow Skośny ślad diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 8201db7ab6..d6e5497efe 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -9988,3 +9988,8 @@ swatch Yellow Green Verde-amarelado @msg A panel is not joined to the rest by a crease. Um painel não está unido ao restante por nenhuma linha de vinco. @msg A fold line is on a non-printing layer. Uma linha de dobra está em uma camada não imprimível. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Painéis: {panels}, dobradiças: {hinges}, erros: {errors}, avisos: {warnings} + Pressure Sensitive Sensível à pressão + Flex Ribbon Fita flexível + Pulse Stroke Traço pulsante + Round Flow Fluxo redondo + Chisel Flow Fluxo chanfrado diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index d1593508d3..458488666f 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -10011,3 +10011,8 @@ shape Open Открытый @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Панели: {panels}, шарниры: {hinges}, ошибки: {errors}, предупреждения: {warnings} @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} пикселей — слишком большой размер для PSD (не более {MAX_SIDE} пикселей по стороне): уменьшите разрешение @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer должен быть "singleLine", "everyLine", "standardSingleLine" или "standardEveryLine" + Pressure Sensitive Чувствительные к нажиму + Flex Ribbon Гибкая лента + Pulse Stroke Пульсирующий штрих + Round Flow Круглый поток + Chisel Flow Косой поток diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 5c0420fcd3..52c949fd25 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -9601,3 +9601,8 @@ digits Hindi Hindi @msg A fold line is on a non-printing layer. En falslinje ligger på ett lager som inte skrivs ut. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneler: {panels}, gångjärn: {hinges}, fel: {errors}, varningar: {warnings} @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixlar är för stort för PSD (högst {MAX_SIDE} pixlar per sida): sänk upplösningen + Pressure Sensitive Tryckkänslig + Flex Ribbon Flexibelt band + Pulse Stroke Pulserande drag + Round Flow Runt flöde + Chisel Flow Snedflöde diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 97fccd9167..bf6fa61a89 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -501,8 +501,9 @@ fn built_in_library_brush_names_are_in_complete_catalogs() { .flat_map(|(_, lib)| lib.brushes.iter().map(|b| b.name.clone()).collect::<Vec<_>>()) .collect(); names.sort(); + let duplicates: Vec<&str> = names.windows(2).filter(|pair| pair[0] == pair[1]).map(|pair| pair[0].as_str()).collect(); + assert_eq!(duplicates, ["Zigzag"], "only the established Pattern Borders / Game Trails name is shared"); names.dedup(); - assert_eq!(names.len(), 46, "{names:?}"); let mut bad = vec![]; for lang in LANGUAGES.iter().filter(|lang| lang.complete_menus) { let missing: Vec<&String> = names.iter().filter(|n| lang.catalog().plain(n).is_none()).collect(); diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 910a7fc5b1..56b739cb4c 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -9875,3 +9875,8 @@ breakText Glyphs Glifler @msg A panel is not joined to the rest by a crease. Bir panel geri kalanlara hiçbir pilyaj çizgisiyle bağlı değil. @msg A fold line is on a non-printing layer. Bir katlama çizgisi yazdırılmayan bir katmanda. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Paneller: {panels}, menteşeler: {hinges}, hatalar: {errors}, uyarılar: {warnings} + Pressure Sensitive Basınca Duyarlı + Flex Ribbon Esnek Şerit + Pulse Stroke Atımlı Çizgi + Round Flow Yuvarlak Akış + Chisel Flow Eğimli Akış diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index dbd6d2609e..05171ace30 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -9526,3 +9526,8 @@ breakText Glyphs Гліфи @msg A panel is not joined to the rest by a crease. Панель не з’єднана з рештою жодною лінією біговки. @msg A fold line is on a non-printing layer. Лінія згину лежить на шарі, що не друкується. @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} Панелі: {panels}, шарніри: {hinges}, помилки: {errors}, попередження: {warnings} + Pressure Sensitive Чутливі до натиску + Flex Ribbon Гнучка стрічка + Pulse Stroke Пульсуючий штрих + Round Flow Круглий потік + Chisel Flow Косий потік diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 519c5d8f0d..c451e7e86c 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7759,3 +7759,8 @@ breakText Glyphs Glyph @msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} điểm ảnh quá lớn cho Targa (tối đa 65535 điểm ảnh mỗi cạnh): hãy giảm độ phân giải @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} điểm ảnh quá lớn cho PSD (tối đa {MAX_SIDE} điểm ảnh mỗi cạnh): hãy giảm độ phân giải @msg composer must be "singleLine", "everyLine", "standardSingleLine" or "standardEveryLine" composer phải là "singleLine", "everyLine", "standardSingleLine" hoặc "standardEveryLine" + Pressure Sensitive Nhạy áp lực + Flex Ribbon Dải mềm + Pulse Stroke Nét rung + Round Flow Nét tròn + Chisel Flow Nét vát diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index c6696a9ec6..93fc4a50f4 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -9758,3 +9758,8 @@ breakText Glyphs 字形 @msg A fold line is on a non-printing layer. 一条折线位于不打印的图层上。 @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} 面板:{panels},铰链:{hinges},错误:{errors},警告:{warnings} @msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} 像素对 PSD 而言过大 (每边最多 {MAX_SIDE} 像素):请降低分辨率 + Pressure Sensitive 压感画笔 + Flex Ribbon 柔韧色带 + Pulse Stroke 脉动笔触 + Round Flow 圆头流线 + Chisel Flow 斜头流线 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 1480422931..7745cb61ca 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -9568,3 +9568,8 @@ breakText Glyphs 字符 @msg A fold line is on a non-printing layer. 一條摺線位於不列印的圖層上。 @msg Panels: {panels}, hinges: {hinges}, errors: {errors}, warnings: {warnings} 面板:{panels},鉸鏈:{hinges},錯誤:{errors},警告:{warnings} @msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} 會列印在超過 {MAX_TILES} 個拼貼上:請縮小 + Pressure Sensitive 壓感筆刷 + Flex Ribbon 柔韌色帶 + Pulse Stroke 脈動筆觸 + Round Flow 圓頭流線 + Chisel Flow 斜頭流線 diff --git a/crates/ui-egui/src/panels/tests_brush_libraries.rs b/crates/ui-egui/src/panels/tests_brush_libraries.rs index 87fe34953f..91fa8fa3b1 100644 --- a/crates/ui-egui/src/panels/tests_brush_libraries.rs +++ b/crates/ui-egui/src/panels/tests_brush_libraries.rs @@ -195,6 +195,7 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() { json!("art-ribbons"), json!("ink-and-wash"), json!("calligraphic-nibs"), + json!("pressure-sensitive"), json!("bristle-brushes"), json!("pattern-borders"), json!("scatter-shapes"), @@ -232,6 +233,17 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() { click(&mut app, &ctx, "Circuit Trace", Modifiers::NONE, 2.0); assert!(has(&app, "Circuit Trace") && !has(&app, "Bus Lines")); assert_eq!(undo_len(&app), undo + 1); + let r = app.run("window.brushLibrary", json!({"library": "Pressure Sensitive"})).unwrap(); + assert_eq!((r["open"].as_str(), r["count"].as_u64()), (Some("pressure-sensitive"), Some(4))); + let path = app.run("shape.line", json!({"x1": 10, "y1": 100, "x2": 180, "y2": 100})).unwrap()["id"].as_u64().unwrap(); + let undo = undo_len(&app); + click(&mut app, &ctx, "Flex Ribbon", Modifiers::NONE, 3.0); + assert!(has(&app, "Flex Ribbon") && !has(&app, "Pulse Stroke")); + assert_eq!(undo_len(&app), undo + 1); + assert_eq!( + app.session.doc().unwrap().doc.node(vectorcraft_doc::NodeId(path)).unwrap().appearance.stroke().unwrap().brush.as_deref(), + Some("Flex Ribbon") + ); // Without brushes there is nothing to save. let all: Vec<String> = vectorcraft_brush::library(&app.session.doc().unwrap().doc).into_iter().map(|b| b.name).collect(); app.run("brush.delete", json!({ "names": all })).unwrap(); diff --git a/docs/mcp.md b/docs/mcp.md index 092faabc4c..2c6e5d67f6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5035,7 +5035,7 @@ error. ## Brush libraries -Brush libraries are read-only sets of brushes: ten generated in code (Art Ribbons, Ink and Wash, Calligraphic Nibs, Bristle +Brush libraries are read-only sets of brushes: eleven generated in code (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive with Flex Ribbon, Pulse Stroke, Round Flow and Chisel Flow, Bristle Brushes with one bristle brush for each tip shape, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, and Dry Media with the Chalk Grain, Graphite Pencil, Wax Crayon and Charcoal Dust art brushes, id `dry-media`, and Tech Circuit with Circuit Trace (art), Bus Lines and Terminal Nodes (pattern), id `tech-circuit`), the `.vectorcraft` files in the user library folder of the desktop app (User Defined) and the brushes of any document loaded with `brush.loadLibrary` (a document without brushes of its own has diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e9fc9a6820..a265ba3e02 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -576,7 +576,7 @@ since 2026-10-01. | **Interaction fidelity:** modifiers, cursors, small behaviours | ~30–40% | The dedicated pass hasn't started, and there has been no side-by-side session with Illustrator yet. A power user notices this first | | **Look & feel** | ~75–80% | Measured against Illustrator 2026 screenshots (2026-10-02); the panels added since haven't been re-measured | | **File interop** | ~85% | SVG/SVGZ, PDF and PDF-compatible `.ai` (and legacy version 7 `.ai` out, keeping layers, groups and type as text), EPS, DXF, EMF/WMF, raster formats, PSD export and PSD/PSB placement (merged image), Place and Links, Package, Print, clipboard flavours. Affinity documents (Affinity 1–3) open natively as editable art, checked against 51 pinned public files (33 current `.af`), with selected saved-thumbnail comparisons and every-board native/SVG/PDF/PSD checks for current files; Affinity export is missing and effects, adjustments and brushes don't import. Affinity isn't an Illustrator feature, so this doesn't raise the parity score. The editing copy inside an Illustrator EPS or `.ai` is read for its structure: layers, groups, names, hidden objects and type, colours, gradients, transparency, images and every artboard (see Out of scope for what it doesn't read yet); DWG has no open spec | -| **Bundled content:** brush, symbol, style and swatch libraries | ~46% | Ours are original and generated in code, and far fewer than Illustrator ships; symbol libraries have six (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons, Weather Icons), graphic style libraries eleven (including Game HUD, Status Effects and Neon & Glow) and brush libraries ten (Art Ribbons, Ink and Wash, Calligraphic Nibs, Bristle Brushes, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media, Tech Circuit) beside User Defined and Other Library… | +| **Bundled content:** brush, symbol, style and swatch libraries | ~46% | Ours are original and generated in code, and far fewer than Illustrator ships; symbol libraries have six (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons, Weather Icons), graphic style libraries eleven (including Game HUD, Status Effects and Neon & Glow) and brush libraries ten (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive, Bristle Brushes, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media, Tech Circuit) beside User Defined and Other Library… | | **Performance** | unverified | Multithreaded, off-thread rendering and caches are in place. The last budget run (2026-10-01, loaded machine) measured 290 ms for a 50k-path fit against a 16 ms budget. Re-run `vectorcraft-cli perf` on an idle machine | | **Robustness** | good, new | ~2,840 tests, property tests, no panics in shipped code (lints, the `guard` safety net, import fuzzing), Data Recovery. Missing: a corpus of real-world files, Windows/Linux/browser QA | | **Platforms and 1.0 polish** | ~60% | The macOS app and the web build work, and Finder opens every readable format with the macOS app (#295, #354); on macOS the menus are in the system menu bar, laid out as a Mac app's, with the in-window menus as a fallback (`--in-window-menus`; verified on Windows and by cross-compilation, not yet by hand on a Mac); hybrid-graphics laptops render on the power-saving GPU by default on Windows and macOS (#306), and Windows starts on Direct3D 12, falling back to OpenGL, and loads no Vulkan driver unless `WGPU_BACKEND` asks for it (#545: Vulkan flickered black on an Intel GPU, DX12 and OpenGL didn't; #806: a faulty Vulkan driver crashed the app before its window appeared; verified by unit tests and the reporter's runs with `WGPU_BACKEND`), and Linux on the GPU the desktop runs on, since a Wayland compositor may refuse frames from the other one; a window that fails on its GPU while starting up starts again on the next one instead of crashing (#502; the dual-GPU Wayland case is verified by unit tests and cross-compilation, not on such hardware); web drops land in the document they were dropped on (#359); desktop drops carry no pointer position (winit 0.30), so a dropped document opens as a tab of its own and a picture or text is placed in the middle of the view, while the web places anything dropped on the canvas and opens what is dropped off it, as Illustrator does (#472); a web page that loses its WebGPU device or WebGL context restarts its graphics with the same documents (#369); on Linux/Wayland the clipboard reads the compositor's own (data-control) and copied image files paste, but files can't be dropped on the window under native Wayland until eframe moves to winit 0.31 (#398; the Wayland side is verified by compilation only), so Preferences › Performance › Linux Display Server › X11 (XWayland) opens the window through XWayland, where drops work (#1151; verified by unit tests and cross-compilation, not on a Wayland desktop); on Linux the Paste menu checks the system clipboard on a background thread, so a clipboard owner that never answers no longer freezes the window, while Windows and macOS keep their quick in-line check (#510; the X11 hang verified by the contributor, here by headless tests); on KDE Plasma 6.3+ under Wayland, pens and pen displays reach the app only under XWayland (`WAYLAND_DISPLAY=`) or with KWin's `KWIN_WAYLAND_EMULATE_TABLET=1`, since winit 0.30 has no Wayland tablet input (#491, not verified on hardware); Windows/Linux packaging and accessibility are pending | @@ -1099,9 +1099,10 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Expand of symbol instances:** Object › Expand turns selected symbol instances (without effects, not in perspective, in groups or placed documents too) into their art as Break Link to Symbol places it, one level deep, as one undo step; the Expand dialog's Fill and Stroke reach that art (`object.expand`, `crates/engine/src/tests/expand_symbols.rs`; estimated, score unchanged). - **Reset Transformation** ([Transform symbols](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/transform-symbols.html), [Symbols panel options](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/symbols-panel-options.html)): the Symbols panel menu's Reset Transformation and the Control bar's Reset, shown while symbol instances are selected, give the selected instances their symbol's own scale again, without rotation or shear, as one undo step (`symbol.instance.resetTransform`); an instance in perspective is left as it is. VectorCraft's own rules: each instance keeps the center of its bounding box in place, reflection is removed too, and the menu item and the button are enabled only while a selected instance would change. Tests: `tests::brushsym::reset_transformation_restores_the_symbols_scale_and_keeps_the_center`, `reset_transformation_keeps_the_center_of_art_away_from_the_origin`, `reset_transformation_ignores_a_stored_size_that_is_not_positive`, `reset_transformation_leaves_unchanged_instances_and_refuses_bad_ids`, `panels::symbols::tests::reset_transformation_is_enabled_for_a_transformed_instance_and_resets_it`. - **Expand of dimensions:** Object › Expand, Expand Appearance, Create Outlines and Outline Stroke turn a dimension whose art they change into a plain group of that art, which stays as it is through later moves, scales and edits of what it measured; undo gives the live dimension back (`crates/engine/tests/it/dimensions.rs`; VectorCraft's own rule; estimated, score unchanged). - - **Brush libraries** ([public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html), [import](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html), [Brushes panel](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html)): Window › Brush Libraries, the Brushes panel's Brush Libraries Menu and its menu's Open Brush Library open each library in a library panel of its own, as swatch, graphic style and symbol libraries do. The built-in libraries (Art Ribbons, Ink and Wash, Calligraphic Nibs, Bristle Brushes, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media, Tech Circuit) are original brushes generated in code (`crates/engine/src/cmd/brushlib.rs`); Striped Ribbon's art is filled with the library's own pattern and Sparkles scatters the library's own symbol; Ink and Wash adds ink and wash brushes (the [help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html) lists an Ink brush library of strokes with varied thickness and texture; the names, shapes and opacities are VectorCraft's own): Tapered Ink, an art brush broad near its start that thins to a fine tip; Brush Pen, a calligraphic brush whose size follows the pen pressure; and Soft Wash and Pooling Wash, art brushes of translucent gray layers that take the stroke color as tints; Game Trails adds motion art brushes (Speed Line, Dash Trail, Burst Ray, Zigzag); Energy Beams adds laser and plasma art brushes (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail); Dry Media adds grainy art brushes (Chalk Grain, Graphite Pencil, Wax Crayon, Charcoal Dust). A click on a brush adds it to the document's Brushes as one undo step with every resource its art uses (patterns, symbols, swatches, graphic styles, images), makes it the current brush and, with paths selected, applies it to them in the same step; a brush the document already has is not added again and a different brush of the same name comes in numbered ("Wave 2"). Shift/Cmd-clicks select brushes for Add to Brushes; a brush dragged onto a path is added and applied to it, and one dragged onto the Brushes panel is added. Save Brushes… / the Brushes panel's Save Brush Library… write the document's brushes (or the selected ones) as a `.vectorcraft` library into the `Brushes` folder next to the preferences, listed under User Defined, or to a file; Other Library… reads the brushes of any document VectorCraft opens. Thumbnails, in the library panels, the Brushes panel and Brush Options, render brush art with the patterns and symbols it uses. Copying brushed art now carries the patterns and symbols its brush's art uses too. Tests: `crates/engine/src/tests/brushlib.rs`, `crates/ui-egui/src/panels/tests_brush_libraries.rs`, `panels::brushes::tests::library_brush_previews_show_the_patterns_their_art_uses`, `canvas::tests::a_library_brush_dropped_on_a_path_is_added_and_applied_in_one_step`. + - **Brush libraries** ([public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html), [import](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html), [Brushes panel](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html)): Window › Brush Libraries, the Brushes panel's Brush Libraries Menu and its menu's Open Brush Library open each library in a library panel of its own, as swatch, graphic style and symbol libraries do. The built-in libraries (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive, Bristle Brushes, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media, Tech Circuit) are original brushes generated in code (`crates/engine/src/cmd/brushlib.rs`); Striped Ribbon's art is filled with the library's own pattern and Sparkles scatters the library's own symbol; Ink and Wash adds ink and wash brushes (the [help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html) lists an Ink brush library of strokes with varied thickness and texture; the names, shapes and opacities are VectorCraft's own): Tapered Ink, an art brush broad near its start that thins to a fine tip; Brush Pen, a calligraphic brush whose size follows the pen pressure; and Soft Wash and Pooling Wash, art brushes of translucent gray layers that take the stroke color as tints; Game Trails adds motion art brushes (Speed Line, Dash Trail, Burst Ray, Zigzag); Energy Beams adds laser and plasma art brushes (Laser Bolt, Plasma Arc, Charge Wave, Spark Trail); Dry Media adds grainy art brushes (Chalk Grain, Graphite Pencil, Wax Crayon, Charcoal Dust). A click on a brush adds it to the document's Brushes as one undo step with every resource its art uses (patterns, symbols, swatches, graphic styles, images), makes it the current brush and, with paths selected, applies it to them in the same step; a brush the document already has is not added again and a different brush of the same name comes in numbered ("Wave 2"). Shift/Cmd-clicks select brushes for Add to Brushes; a brush dragged onto a path is added and applied to it, and one dragged onto the Brushes panel is added. Save Brushes… / the Brushes panel's Save Brush Library… write the document's brushes (or the selected ones) as a `.vectorcraft` library into the `Brushes` folder next to the preferences, listed under User Defined, or to a file; Other Library… reads the brushes of any document VectorCraft opens. Thumbnails, in the library panels, the Brushes panel and Brush Options, render brush art with the patterns and symbols it uses. Copying brushed art now carries the patterns and symbols its brush's art uses too. Tests: `crates/engine/src/tests/brushlib.rs`, `crates/ui-egui/src/panels/tests_brush_libraries.rs`, `panels::brushes::tests::library_brush_previews_show_the_patterns_their_art_uses`, `canvas::tests::a_library_brush_dropped_on_a_path_is_added_and_applied_in_one_step`. - **Bristle Brushes library** ([What's new](https://helpx.adobe.com/illustrator/desktop/new-features/whats-new.html), [About brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Bristle Brushes holds ten bristle brushes, one for each tip shape (Fine Liner, Pointed Flat, Stubby Round, Dry Scrub, Soft Dome, Filbert, Angled Round, Angled Flat, Fan Blender, Grass Fan). The brushes, their names and their values are VectorCraft's own, and every value lies inside the range the bristle brush keeps (`brush.libraries`, `brush.addFromLibrary`; `the_bristle_brushes_library_covers_every_tip_shape_within_the_bristle_ranges`). - **Tech Circuit library:** Circuit Trace is a chamfered art brush with 45-degree elbows and terminal pads; Bus Lines repeats three parallel conductor lanes; Terminal Nodes repeats solder pads, circular test points and connecting leads. Original vector geometry generated in code, with Tints colorization and continuous pattern tile edges. Evidence: `the_tech_circuit_library_constructs_adds_and_applies_each_brush` in `crates/engine/src/tests/brushlib.rs` covers listing, finite geometry on straight, curved, short and closed paths, add/apply, undo/redo, deduplication and saved-library round trips. G5 remaining estimate 3–13 h (estimated); area scores unchanged. + - **Pressure Sensitive library** ([About brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Pressure Sensitive offers Flex Ribbon, Pulse Stroke, Round Flow and Chisel Flow. The first two are art brushes whose width follows recorded pen pressure; the other two are calligraphic nibs whose size follows it. They use the engine's existing pressure input where the device and platform deliver it, and a neutral width for a mouse path. These presets and names are VectorCraft's own. Evidence: `pressure_sensitive_brushes_widen_with_pen_pressure_and_survive_a_saved_library` in `crates/engine/src/tests/brushlib.rs` checks light and heavy pressure, short and curved paths, add/apply and saved-library reopening; `the_window_menu_and_the_brushes_panel_open_brush_libraries` covers opening and clicking from the UI. - **Dry Media library** ([help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Dry Media holds four art brushes with textured strokes like dry drawing materials, each 100 pt long: Chalk Grain (about 8 pt high), Graphite Pencil (about 2.3 pt), Wax Crayon (about 5.5 pt) and Charcoal Dust (about 7 pt). The brushes, their names, sizes and art are VectorCraft's own: each is filled vector paths from a fixed seed, at most 80 paths and 500 anchors, stretched along the path with Tints colorization, and the chalk and crayon art has even-odd gaps where the paper shows (`brush.libraries`, `brush.addFromLibrary`; `the_dry_media_library_holds_grainy_art_brushes_with_bounded_art`). - **Brush names in library panels**: a built-in brush library's panel shows its brushes' names in the UI language, in its list rows and tooltips, and its Find field matches the name shown or the English name. This is VectorCraft's own rule. A User Defined or Other Library… library's brushes, and the document's Brushes panel, show names as they are stored. A click, a drag, Add to Brushes and `brush.addFromLibrary` still use the English name, so the brush comes into the document under that name (`built_in_library_brushes_are_listed_in_the_ui_language`, `built_in_library_brush_names_are_in_complete_catalogs`). - A canvas context menu: right-click selects the object under the pointer and lists what applies to the selection (Undo/Redo, clipboard, group, isolation, join, Remove Anchor Points when anchors are selected, masks, compound paths, guides, Transform, Arrange, Select, Export Selection, and on type Bullets and Numbering and Spelling › Auto Spell Check, checked while it is on), or the view commands on empty canvas. From 7f801a3ec350186794b28c4dde2f42c0c8750411 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 11:42:10 -0800 Subject: [PATCH 070/158] Panels: update native floating window geometry --- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/panel_docking.rs | 94 ++++++++++++++++++- .../ui-egui/src/panel_docking/native_tests.rs | 52 ++++++++++ docs/mcp.md | 5 +- docs/target-app-parity.md | 2 + 6 files changed, 152 insertions(+), 5 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index b6da21331e..ae25c345aa 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -666,7 +666,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "window.panel.float", "Float Panel", "", - "{panel: id or \"tools\", x?, y?, width?, height?, group?: bool, column?: bool or n, onto?: id, above?: id, below?: id, collapsed?: bool} float a panel (with `group`, its whole group; with `column`, its whole dock column or floating window) as a floating window with its top-left corner at x, y in window points (default: inside the dock area, cascaded), as dragging its tab out does; a whole floating window keeps its rect unless given one. `onto` makes it a tab of the floating group holding that panel instead; `above` / `below` a group of its own above or below the group holding that panel, in its floating window or dock column. `collapsed` then minimizes (true) or restores (false) its window or group. A hidden panel shows first. \"tools\" floats the Tools panel at x, y. Returns {layout, closed, floating}", + "{panel: id or \"tools\", x?, y?, width?, height?, group?: bool, column?: bool or n, onto?: id, above?: id, below?: id, collapsed?: bool} float a panel (with `group`, its whole group; with `column`, its whole dock column or floating window) as a floating window with its top-left corner at x, y in window points (default: inside the dock area, cascaded), as dragging its tab out does; a whole floating window keeps its rect unless given one. Supplied geometry also moves or resizes an existing native window; omitted components keep their current values. `onto` makes it a tab of the floating group holding that panel instead; `above` / `below` a group of its own above or below the group holding that panel, in its floating window or dock column. `collapsed` then minimizes (true) or restores (false) its window or group. A hidden panel shows first. \"tools\" floats the Tools panel at x, y. Returns {layout, closed, floating}", ), ( "window.panel.dock", diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 677b804720..be9b41d0b9 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -667,7 +667,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "window.panel.float", "Float Panel", "", - "{panel: id or \"tools\", x?, y?, width?, height?, group?: bool, column?: bool or n, onto?: id, above?: id, below?: id, collapsed?: bool} float a panel (with `group`, its whole group; with `column`, its whole dock column or floating window) as a floating window with its top-left corner at x, y in window points (default: inside the dock area, cascaded), as dragging its tab out does; a whole floating window keeps its rect unless given one. `onto` makes it a tab of the floating group holding that panel instead; `above` / `below` a group of its own above or below the group holding that panel, in its floating window or dock column. `collapsed` then minimizes (true) or restores (false) its window or group. A hidden panel shows first. \"tools\" floats the Tools panel at x, y. Returns {layout, closed, floating}", + "{panel: id or \"tools\", x?, y?, width?, height?, group?: bool, column?: bool or n, onto?: id, above?: id, below?: id, collapsed?: bool} float a panel (with `group`, its whole group; with `column`, its whole dock column or floating window) as a floating window with its top-left corner at x, y in window points (default: inside the dock area, cascaded), as dragging its tab out does; a whole floating window keeps its rect unless given one. Supplied geometry also moves or resizes an existing native window; omitted components keep their current values. `onto` makes it a tab of the floating group holding that panel instead; `above` / `below` a group of its own above or below the group holding that panel, in its floating window or dock column. `collapsed` then minimizes (true) or restores (false) its window or group. A hidden panel shows first. \"tools\" floats the Tools panel at x, y. Returns {layout, closed, floating}", ), ( "window.panel.dock", diff --git a/crates/ui-egui/src/panel_docking.rs b/crates/ui-egui/src/panel_docking.rs index 0a4f01879d..f79c829800 100644 --- a/crates/ui-egui/src/panel_docking.rs +++ b/crates/ui-egui/src/panel_docking.rs @@ -45,6 +45,8 @@ pub(crate) const PANEL_MIN_WIDTH: f32 = 220.0; /// Docking state that lives for the session only. #[derive(Default)] pub(crate) struct Runtime { + /// Geometry commands waiting for the main window's desktop origin, by floating window id. + native_geometry: BTreeMap<u64, (u64, Value)>, /// Where the dock area floats panels, as it was last drawn. space: Option<FloatSpace<String>>, /// A panel a command showed: its floating window comes forward on the next frame. @@ -745,7 +747,7 @@ fn shared_command_with(app: &mut VectorcraftApp, id: &str, params: &Value, legac if let Some(fields) = params.as_object_mut() { fields.insert("command".into(), Value::String(id.to_owned())); } - let command: DockCommand<String> = serde_json::from_value(params).map_err(|e| e.to_string())?; + let mut command: DockCommand<String> = serde_json::from_value(params).map_err(|e| e.to_string())?; match &command { DockCommand::Workspace { name } => return app.run("window.workspace", json!({"name": name})), DockCommand::NewWorkspace { name } => return app.run("window.workspace.new", json!({"name": name})), @@ -788,6 +790,7 @@ fn shared_command_with(app: &mut VectorcraftApp, id: &str, params: &Value, legac } _ => false, }; + let native = if legacy.is_none() { native_float_geometry(app, &mut command, &txn.workspace.layout) } else { None }; let mut actions = match (&command, &legacy) { (DockCommand::Float { panel, group, .. } | DockCommand::Dock { panel, group, .. }, Some(legacy)) => { legacy.actions(&txn.workspace.layout, panel, *group)? @@ -817,7 +820,77 @@ fn shared_command_with(app: &mut VectorcraftApp, id: &str, params: &Value, legac for action in actions { closed.extend(txn.apply(action)?); } - Ok(txn.commit(app, closed, reveal)) + if let Some(NativeFloatGeometry::Ready { panel, rect, .. }) = &native { + closed.extend(txn.apply(Action::SetNative { panel: panel.clone(), rect: Some(*rect) })?); + } + let result = txn.commit(app, closed, reveal); + match native { + Some(NativeFloatGeometry::Deferred { window, params }) => { + let layout = layout_of(&app.ui); + app.dock_rt + .native_geometry + .retain(|id, (generation, _)| *generation == app.ui.docking_generation && layout.floating.iter().any(|window| window.id == *id)); + app.dock_rt.native_geometry.insert(window, (app.ui.docking_generation, params)); + } + Some(NativeFloatGeometry::Ready { window, .. }) => { + app.dock_rt.native_geometry.remove(&window); + } + None => {} + } + Ok(result) +} + +enum NativeFloatGeometry { + Ready { window: u64, panel: String, rect: [f32; 4] }, + Deferred { window: u64, params: Value }, +} + +fn native_float_geometry(app: &VectorcraftApp, command: &mut DockCommand<String>, layout: &Layout<String>) -> Option<NativeFloatGeometry> { + let DockCommand::Float { panel, x, y, width, height, group, column } = command else { return None }; + if [*x, *y, *width, *height].iter().all(Option::is_none) { + return None; + } + let window = floating_window(layout, panel)?; + let whole = *column || window.panels().count() == 1 || (*group && matches!(window.root, Node::Tabs { .. } | Node::Stack { .. })); + if !whole { + return None; + } + let [old_x, old_y, old_width, old_height] = window.native?; + if let Some((_, params)) = app.dock_rt.native_geometry.get(&window.id).filter(|(generation, _)| *generation == app.ui.docking_generation) { + let previous = |name| params.get(name).and_then(Value::as_f64).map(|value| value as f32); + *x = x.or_else(|| previous("x")); + *y = y.or_else(|| previous("y")); + *width = width.or_else(|| previous("width")); + *height = height.or_else(|| previous("height")); + } + let origin = app + .ui_ctx + .as_ref() + .and_then(|ctx| ctx.input(|input| input.raw.viewports.get(&egui::ViewportId::ROOT).and_then(|v| v.inner_rect))) + .map(|rect| rect.min) + .filter(|origin| origin.is_finite()); + let Some(origin) = origin else { + let mut params = app + .dock_rt + .native_geometry + .get(&window.id) + .filter(|(generation, _)| *generation == app.ui.docking_generation) + .map_or_else(|| json!({}), |(_, params)| params.clone()); + let fields = params.as_object_mut()?; + fields.insert("panel".into(), json!(panel)); + fields.insert("group".into(), json!(group)); + fields.insert("column".into(), json!(column)); + for (name, value) in [("x", *x), ("y", *y), ("width", *width), ("height", *height)] { + if let Some(value) = value { + fields.insert(name.into(), json!(value)); + } + } + return Some(NativeFloatGeometry::Deferred { window: window.id, params }); + }; + // Native windows report desktop coordinates; float commands use the main window's points. + let rect = + [*x.get_or_insert(old_x - origin.x), *y.get_or_insert(old_y - origin.y), *width.get_or_insert(old_width), *height.get_or_insert(old_height)]; + Some(NativeFloatGeometry::Ready { window: window.id, panel: panel.clone(), rect: [origin.x + rect[0], origin.y + rect[1], rect[2], rect[3]] }) } /// One action from the renderer: the user's own gesture. @@ -1128,6 +1201,23 @@ fn known(action: &Action<String>) -> bool { pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui) { let area = area_id(); let ctx = ui.ctx().clone(); + let origin = ctx.input(|input| input.raw.viewports.get(&egui::ViewportId::ROOT).and_then(|v| v.inner_rect)).map(|rect| rect.min); + if origin.is_some_and(|origin| origin.is_finite()) { + for (window, (generation, mut params)) in std::mem::take(&mut app.dock_rt.native_geometry) { + if generation != app.ui.docking_generation { + continue; + } + let layout = layout_of(&app.ui); + let panel = layout.floating.iter().find(|floating| floating.id == window).and_then(|floating| floating.panels().next()).cloned(); + let (Some(panel), Some(fields)) = (panel, params.as_object_mut()) else { continue }; + // The original panel may have docked while other panels kept this native window. + fields.insert("panel".into(), json!(panel)); + fields.insert("column".into(), json!(true)); + if let Err(error) = shared_command(app, "window.panel.float", ¶ms) { + app.ui.status = error; + } + } + } let changed_workspace = ctx.data_mut(|data| { let previous = data.get_temp::<u64>(area.with("generation")); data.insert_temp(area.with("generation"), app.ui.docking_generation); diff --git a/crates/ui-egui/src/panel_docking/native_tests.rs b/crates/ui-egui/src/panel_docking/native_tests.rs index 368f7ebae8..e4e1abd4b5 100644 --- a/crates/ui-egui/src/panel_docking/native_tests.rs +++ b/crates/ui-egui/src/panel_docking/native_tests.rs @@ -306,6 +306,58 @@ impl egui::DroppedFile for MockDrop { } } +#[test] +fn an_explicit_float_command_updates_an_existing_native_windows_geometry() { + for mode in [json!({}), json!({"group": true}), json!({"column": true})] { + let mut h = Harness::new(); + h.app.run("window.panel.float", json!({"panel": "swatches", "x": 240, "y": 160, "width": 320, "height": 360})).unwrap(); + h.frames(3); + let viewport = h.viewport("swatches"); + assert_eq!(h.host.borrow().windows[&viewport].rect, Rect::from_min_size(ORIGIN + vec2(240.0, 160.0), vec2(320.0, 360.0))); + let mut params = json!({"panel": "swatches", "x": 280, "y": 190, "width": 350, "height": 390}); + params.as_object_mut().unwrap().extend(mode.as_object().unwrap().clone()); + h.app.run("window.panel.float", params).unwrap(); + h.frames(3); + assert_eq!(h.viewport("swatches"), viewport); + assert_eq!(h.host.borrow().windows[&viewport].rect, Rect::from_min_size(ORIGIN + vec2(280.0, 190.0), vec2(350.0, 390.0))); + let moved = Rect::from_min_size(pos2(-500.0, 120.0), vec2(380.0, 410.0)); + h.host.borrow_mut().windows.get_mut(&viewport).unwrap().rect = moved; + h.frames(3); + let mut params = json!({"panel": "swatches", "width": 400}); + params.as_object_mut().unwrap().extend(mode.as_object().unwrap().clone()); + h.app.run("window.panel.float", params).unwrap(); + h.frames(3); + let resized = Rect::from_min_size(moved.min, vec2(400.0, moved.height())); + assert_eq!(h.host.borrow().windows[&viewport].rect, resized); + let mut params = json!({"panel": "swatches"}); + params.as_object_mut().unwrap().extend(mode.as_object().unwrap().clone()); + h.app.run("window.panel.float", params).unwrap(); + h.frames(3); + assert_eq!(h.host.borrow().windows[&viewport].rect, resized); + } +} + +#[test] +fn saved_native_geometry_updates_before_viewport_metadata_is_available() { + let mut h = Harness::new(); + let viewport = h.float("swatches"); + h.app.ui_ctx = None; + h.app.run("window.panel.float", json!({"panel": "swatches", "x": 280, "y": 190, "height": 390})).unwrap(); + h.app.run("window.panel.float", json!({"panel": "swatches", "width": 350})).unwrap(); + h.frames(3); + assert_eq!(h.viewport("swatches"), viewport); + assert_eq!(h.host.borrow().windows[&viewport].rect, Rect::from_min_size(ORIGIN + vec2(280.0, 190.0), vec2(350.0, 390.0))); + h.app.run("window.panel.float", json!({"panel": "color", "onto": "swatches"})).unwrap(); + h.frames(3); + h.app.ui_ctx = None; + h.app.run("window.panel.float", json!({"panel": "swatches", "column": true, "x": 480, "y": 260})).unwrap(); + h.app.run("window.panel.dock", json!({"panel": "swatches", "anchor": "layers", "zone": "tab"})).unwrap(); + h.frames(3); + assert!(!floats(&h.app.ui, "swatches")); + assert_eq!(h.viewport("color"), viewport); + assert_eq!(h.host.borrow().windows[&viewport].rect.min, ORIGIN + vec2(480.0, 260.0)); +} + #[test] fn a_floated_panel_opens_its_own_os_window_where_the_backend_has_viewports() { let mut h = Harness::new(); diff --git a/docs/mcp.md b/docs/mcp.md index 092faabc4c..48ebb5a63f 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5068,7 +5068,10 @@ and several can be open at once. `window.swatchLibrary {library}`, `window.graph `{open, panel, name, count}`; `library: null` closes every panel of that kind. The panel id is `library:<kind>:<library id>` (`library:swatches:pastels`, `library:graphicStyles:hand-drawn`, `library:swatches:loaded/C:/Palettes/Brand.ase`), and the panel commands take it like any other panel's: -`window.panel.float {panel, onto?, x?, y?}` groups or moves it, `window.panel.dock {panel}` docks it, +`window.panel.float {panel, onto?, x?, y?, width?, height?}` groups, moves or resizes it. Supplied +geometry also updates an existing native panel window. Positions are relative to the main window's +content origin; omitted coordinates and dimensions keep the native window's current values. +`window.panel.dock {panel}` docks it, `window.panel.close {panel}` closes it. `window.swatchLibrary.other {path}`, `window.graphicStyleLibrary.other {path}`, `window.symbolLibrary.other {path}` and `window.brushLibrary.other {path}` load a file and open it the same way. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e9fc9a6820..f7d971ce4e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -20,6 +20,8 @@ ## Feature submission evidence +`window.panel.float` updates an existing native panel window's supplied position and size (#8391). Positions use the main window's content origin. Omitted coordinates and dimensions keep their current native values, including after an OS window move or resize. Evidence: `panel_docking::native_tests::an_explicit_float_command_updates_an_existing_native_windows_geometry` covers panel, group and column commands. Scores and estimates are unchanged. + EPS embedded fonts, 2026-11-09 (#6023–#6067): the fonts an EPS carries draw their glyphs instead of being set as type in an installed font: composite (Type 0) fonts with the 8/8 mapping, plain Type 42 fonts (characters from their glyph names or character map, widths from the font), CID-keyed fonts over CMaps (Type 0 and Type 2 CIDFonts, CIDFonts in a FontSet's Compact Font Format data, base-font CMaps, named CIDFonts over predefined Unicode CMaps set as type) and embedded Type 1 fonts; the show operators' spacing along the baseline is kept as tracking, `kshow` included. Each step is charged to the interpreter's budgets. Hand-written test files only (no corpus file uses these fonts); scores and estimates unchanged. Evidence: `crates/eps/src/import/tests_composite.rs`, `tests_type42.rs`, `tests_cid.rs`, `tests_type1.rs`; details in [file-format-parity.md](file-format-parity.md). Numeric fields step on wheel hover without taking keyboard focus (#5949). Arrow keys still require focus; modifiers, units, limits, mixed values and existing rounding stay in the shared stepping path. Headless regressions in `tests/numfields.rs` cover hovered unfocused fields, focused fields, trackpad accumulation and panel scroll exclusion. A canvas-first/panel-second regression also checks that a field turn cannot start a canvas zoom glide when the pointer enters the canvas on the next frame. Scores and estimates unchanged. From 987f8572c4227a9b73eee24650fc0baa46b762ce Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 12:03:28 -0800 Subject: [PATCH 071/158] Print: an overprinting gradient's paper-white padding at a hard end stop keeps the ink below When two stops share an end's offset, Level 2's stepped bands pad past that end with the end stop's color and a Level 3 shading pads with the color of the stretch next to it. The plate clip now decides whether the padding is paper white by the color the painter in use draws, so a paper-white padding no longer knocks out the ink below at Level 2, and an inked one is no longer drawn over the ink below at Level 3 where the shading pads with paper white. --- crates/eps/src/print/tests.rs | 51 ++++++++++++++++++++++++++++++----- crates/eps/src/scene.rs | 17 ++++++------ docs/target-app-parity.md | 2 +- 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/crates/eps/src/print/tests.rs b/crates/eps/src/print/tests.rs index d3685ad5ab..8d2f81851c 100644 --- a/crates/eps/src/print/tests.rs +++ b/crates/eps/src/print/tests.rs @@ -156,12 +156,14 @@ fn plate_of(d: &Document, ink: &str, level: Level) -> (Image, Image) { } /// Ink `ink`'s PostScript plate of `art` over a page of 100% `ink` (`under`), checked against the -/// plate of `art` alone: where `art` puts none of the ink down, the ink under it prints, and -/// where it puts ink down, its own amount prints. The pixels of the page where `art` alone puts -/// no ink, those of them where the ink under it does not print, and the pixels where `art` puts -/// ink down that do not print its amount. -fn keeps_the_ink_below(art: &[Node], under: &Paint, ink: &str, level: Level) -> (usize, usize, usize) { - let (alone, _) = plate_of(&over(None, art), ink, level); +/// plate of `art` alone (drawn from the print plan, or with `postscript` from its PostScript +/// plate): where `art` puts none of the ink down, the ink under it prints, and where it puts ink +/// down, its own amount prints. The pixels of the page where `art` alone puts no ink, those of +/// them where the ink under it does not print, and the pixels where `art` puts ink down that do +/// not print its amount. +fn keeps_the_ink_below(art: &[Node], under: &Paint, ink: &str, level: Level, postscript: bool) -> (usize, usize, usize) { + let (plan, own) = plate_of(&over(None, art), ink, level); + let alone = if postscript { own } else { plan }; let (_, printed) = plate_of(&over(Some(under.clone()), art), ink, level); // Pixels whose neighbors all have paper (or all have ink) on the plate of `art` alone: an // edge falls on either side of a pixel's center, and the edge of the inked part is lightest. @@ -232,13 +234,48 @@ fn an_overprinting_gradient_keeps_the_ink_below_where_it_puts_none_on_a_postscri assert_keeps_the_ink_below(&cases); } +#[test] +fn an_overprinting_gradient_with_a_hard_stop_at_an_end_keeps_the_ink_below_on_a_postscript_plate() { + // Two stops at an end, one with cyan and one without: Level 2's bands pad with the end stop, + // Level 3's shading with the stretch next to it, so each level is checked against its own + // plate of the gradient alone. + let (inked, none) = (Color::cmyk(0.6, 0.3, 0.0, 0.0), Color::cmyk(0.0, 0.3, 0.0, 0.0)); + let ends = [ + ("none then cyan at 0", [(0.0, none), (0.0, inked), (1.0, inked)]), + ("cyan then none at 1", [(0.0, inked), (1.0, inked), (1.0, none)]), + ("cyan then none at 0", [(0.0, inked), (0.0, none), (1.0, none)]), + ("none then cyan at 1", [(0.0, none), (1.0, none), (1.0, inked)]), + ]; + let c = Point::new(100.0, 50.0); + let around = GradientGeom { start: c, end: c + Vec2::new(50.0, -10.0), aspect: 0.7, focal: None }; + let across = GradientGeom { start: Point::new(40.0, 40.0), end: Point::new(160.0, 60.0), aspect: 1.0, focal: None }; + let pad = GradientSpread::Pad; + let cyan = Paint::solid(Color::cmyk(1.0, 0.0, 0.0, 0.0)); + let shapes = [(GradientKind::Linear, across, "linear"), (GradientKind::Radial, around, "radial"), (GradientKind::Diamond, around, "diamond")]; + let mut cases = vec![]; + for (name, stops) in &ends { + for (kind, geom, shape) in shapes { + let fill = gradient(kind, stops, geom, pad); + cases.push((format!("{shape}, {name}"), overprinting(fill, Paint::None), cyan.clone(), "Cyan")); + } + } + let cases: Vec<_> = cases.iter().map(|(name, art, under, ink)| (name.as_str(), art.clone(), under.clone(), *ink)).collect(); + assert_keeps_the_ink_below_of(&cases, true); +} + /// [`keeps_the_ink_below`] for each of `cases` (a name, the art, the paint under it and the ink /// of the plate) at Level 3 and Level 2, with every case that fails named. fn assert_keeps_the_ink_below(cases: &[(&str, Node, Paint, &str)]) { + assert_keeps_the_ink_below_of(cases, false); +} + +/// [`assert_keeps_the_ink_below`], checked against the PostScript plate of each case's art alone +/// with `postscript`. +fn assert_keeps_the_ink_below_of(cases: &[(&str, Node, Paint, &str)], postscript: bool) { let mut failed = vec![]; for (name, art, under, ink) in cases { for level in [Level::Three, Level::Two] { - let (paper, knocked_out, wrong) = keeps_the_ink_below(std::slice::from_ref(art), under, ink, level); + let (paper, knocked_out, wrong) = keeps_the_ink_below(std::slice::from_ref(art), under, ink, level, postscript); if knocked_out + wrong >= 100 { failed.push(format!("{name} at level {level:?}: {knocked_out} of {paper} knocked out, {wrong} of the others differ")); } diff --git a/crates/eps/src/scene.rs b/crates/eps/src/scene.rs index 9aae8bb98c..feee718176 100644 --- a/crates/eps/src/scene.rs +++ b/crates/eps/src/scene.rs @@ -1226,7 +1226,7 @@ impl<'a> Scene<'a> { } let space = &space; let smooth = self.o.level == Level::Three && !self.o.compatible_gradients; - let spans = if g.gradient.kind == GradientKind::Conic { None } else { self.inked_spans(space, &stops) }; + let spans = if g.gradient.kind == GradientKind::Conic { None } else { self.inked_spans(space, &stops, smooth) }; match g.gradient.kind { GradientKind::Conic => self.conic_steps(&geom, area, space, &stops, &g.gradient), GradientKind::Diamond => { @@ -1299,18 +1299,19 @@ impl<'a> Scene<'a> { /// Where an overprinting gradient with `stops` in `space` puts ink on a plate /// ([`Self::keep_below`]): the spans of its levels outside every stretch between two stops of - /// paper white and outside the padding past an end whose stop is paper white, in order, an - /// end padding with ink unbounded. `None` when the gradient puts ink everywhere or does not - /// overprint on a plate; empty when it puts none down. - fn inked_spans(&self, space: &GradientSpace, stops: &[(f64, Vec<f32>)]) -> Option<Vec<(f64, f64)>> { + /// paper white and outside the padding past an end painted paper white, in order, an end + /// padding with ink unbounded. The padding takes the end stop's color when stepped and the + /// end stretch's color when `smooth` ([`Self::shading`]); the two differ when two stops share + /// the end's offset. `None` when the gradient puts ink everywhere or does not overprint on a + /// plate; empty when it puts none down. + fn inked_spans(&self, space: &GradientSpace, stops: &[(f64, Vec<f32>)], smooth: bool) -> Option<Vec<(f64, f64)>> { if !self.keep_below { return None; } let stretches: Vec<_> = stops.windows(2).filter(|w| w[1].0 > w[0].0).collect(); let (first, last) = (stretches.first()?, stretches.last()?); - // The padding takes the end stop's color stepped and the end stretch's color smooth. - let before = stops.first().is_some_and(|s| space.paper(&s.1)) && space.paper(&first[0].1); - let after = stops.last().is_some_and(|s| space.paper(&s.1)) && space.paper(&last[1].1); + let (start, end) = if smooth { (&first[0].1, &last[1].1) } else { (&stops.first()?.1, &stops.last()?.1) }; + let (before, after) = (space.paper(start), space.paper(end)); let mut blank: Vec<(f64, f64)> = vec![]; let mut add = |a: f64, b: f64| match blank.last_mut() { Some(l) if l.1 >= a => l.1 = l.1.max(b), diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index f3e39caba1..d4a4aa28b5 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2067,7 +2067,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Desktop print transport uses `craft-print` for CUPS and modern Windows. Sheet composition, copies, separations and colour management remain in VectorCraft. The Print dialog's Media list also carries the Japanese papers — JIS B4 257 × 364 mm, JIS B5 182 × 257 mm and JIS B6 128 × 182 mm beside the ISO B4/B5 (250 × 353 and 176 × 250 mm, kept so settings and presets saved before them keep their paper), and はがき 100 × 148 mm, 往復はがき 148 × 200 mm, 封筒 長形3号 120 × 235 mm, 長形4号 90 × 225 mm, 角形2号 240 × 332 mm, 角形3号 216 × 277 mm and 四六判 127 × 188 mm; the JSON id or the dialog label names a paper, any case and spacing (`B5 (JIS)` or `b5jis`) (`crates/pdf/src/print/settings.rs`, `crates/pdf/src/tests/print.rs`). The print-preview and physical-device fidelity gaps remain, so print scores and hours are unchanged. - The Print dialog's Document Ink Options list shows an icon before each spot ink's name, and a click on it prints that one ink as process inks (on the Cyan, Magenta, Yellow and Black plates, with no plate of its own) or as a spot ink again, as [the help page](https://helpx.adobe.com/illustrator/using/printing-color-separations.html) describes for single spot colors. Other spot inks keep their plates, and spot gradient stops and DCS images' spot plates follow each ink's choice (`print.setup {settings: {output: {inks: [{name, convertToProcess: true}]}}}`, kept with the document and in print presets; `print.preview` lists every ink as `documentInks`). These are VectorCraft's own rules: Convert All Spot Colors to Process converts every spot ink and dims the icons while keeping each ink's own choice, a converted ink's Print, Frequency and Angle are dimmed and kept, and process inks and Registration have no icon. Evidence: `print::one_spot_ink_converts_to_process_and_the_others_keep_their_plates`, `print::converting_every_spot_ink_overrides_and_keeps_each_inks_own_choice`, `print::a_spot_gradient_stop_prints_its_process_plates`, `cmykimages::a_dcs_image_converts_only_the_spot_ink_chosen`, `tests::print::a_spot_ink_converted_to_process_is_saved_and_listed_without_a_plate`, `dialogs::tests_print::a_spot_inks_icon_converts_it_to_process_and_back`. Print scores and hours are unchanged. - The Print dialog's Output section has Overprint Black under Convert All Spot Colors to Process, off by default and available with Separations ([Print color separations](https://helpx.adobe.com/illustrator/using/printing-color-separations.html) lists it among the separation options): black art then leaves the inks under it on the other plates (`print.setup {settings: {output: {overprintBlack: true}}}`, kept with the document and in print presets). Solid 100% K or 100% gray fills, strokes and characters (to within half a percent, as Edit › Edit Colors › Overprint Black counts them), and gradients whose every stop (every color point of a freeform gradient) is, overprint; rich, RGB, Lab, spot-linked and lighter blacks are not marked, paints already set to overprint keep that setting, and only the printed copy is marked. These limits are VectorCraft's own rules. Characters set to overprint now also leave the inks below them on printed PDF plates, a type object's own fill in a PDF is drawn with its blending mode, and Edit › Edit Colors › Overprint Black counts a gradient with a stop linked to a spot swatch as a spot black, as it counts a solid one, and a freeform gradient by the color points it draws from. On a plate, an overprinting paint that puts none of that plate's ink down is drawn as nothing; on PostScript plates so is up to half a percent of another ink in a color that counts as black, and any other faint ink stays on the plate. Evidence: `print::overprint_black_keeps_the_inks_under_solid_black_on_separations`, `print::overprint_black_keeps_the_cyan_under_near_and_freeform_blacks_on_postscript_plates`, `print::overprinting_paints_keep_their_faint_ink_on_postscript_plates`, `print::overprinting_type_leaves_the_inks_below_on_separations`, `print::a_type_objects_own_black_fill_overprints_on_separations`, `tests::print::overprint_black_is_saved_with_the_setup_and_in_presets`, `overprint::tests::a_gradient_with_a_spot_linked_stop_is_black_only_with_spot`, `overprint::tests::a_freeform_gradient_is_black_when_every_point_is`. Print scores and hours are unchanged. - - On a PostScript plate, an overprinting gradient that puts the plate's ink down in some places and none in others leaves the ink below where it puts none: the stretches between stops of paper white and the padding past an end stop of paper white are clipped out of a linear, radial or diamond gradient, the wedges of paper white out of a conic one, and the cells of paper white out of a freeform one (masked at Level 3, clipped at Level 2). This holds for fills, strokes and characters, and on spot plates. Where the gradient puts ink down, its amount replaces the ink below as before. A stop or point with up to half a percent of another ink in a color that counts as black puts none down, as a solid fill of that color does. PDF plates are unchanged. These are VectorCraft's own rules. Evidence: `print::tests::an_overprinting_gradient_keeps_the_ink_below_where_it_puts_none_on_a_postscript_plate` and `print::tests::overprinting_gradient_strokes_type_freeforms_and_spot_inks_keep_the_ink_below_on_postscript_plates` (`vectorcraft-eps`), `tests::print::a_near_black_stop_of_an_overprinting_gradient_puts_no_cyan_on_postscript_plates`. + - On a PostScript plate, an overprinting gradient that puts the plate's ink down in some places and none in others leaves the ink below where it puts none: the stretches between stops of paper white and the padding past an end that is painted paper white (with the end stop's color at Level 2 and the color of the stretch next to it in a Level 3 smooth shading, which differ when two stops share the end's offset) are clipped out of a linear, radial or diamond gradient, the wedges of paper white out of a conic one, and the cells of paper white out of a freeform one (masked at Level 3, clipped at Level 2). This holds for fills, strokes and characters, and on spot plates. Where the gradient puts ink down, its amount replaces the ink below as before. A stop or point with up to half a percent of another ink in a color that counts as black puts none down, as a solid fill of that color does. PDF plates are unchanged. These are VectorCraft's own rules. Evidence: `print::tests::an_overprinting_gradient_keeps_the_ink_below_where_it_puts_none_on_a_postscript_plate`, `print::tests::an_overprinting_gradient_with_a_hard_stop_at_an_end_keeps_the_ink_below_on_a_postscript_plate` and `print::tests::overprinting_gradient_strokes_type_freeforms_and_spot_inks_keep_the_ink_below_on_postscript_plates` (`vectorcraft-eps`), `tests::print::a_near_black_stop_of_an_overprinting_gradient_puts_no_cyan_on_postscript_plates`. - The Print dialog's General section (and the print preset editor) has a link button after Scale W and H, as the Custom scale has one on [the help page](https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/print-documents-in-illustrator.html), where turning it off scales the width and height apart. While it is on, typing either percentage sets the other, and turning it on sets H to W. It is on for new settings, dimmed with the fields unless Scaling is Custom or a tiling choice, toggled with a click, Space or Enter, and named with its on or off state for screen readers. W and H take 1–1000% in the fields. The link is kept with the document's print settings and in print presets (`print.setup {settings: {scale: {linked}}}`); settings saved without it read it as off, so they print as before. Its default, the tiling choices and the agent rules are VectorCraft's own. Evidence: `print::the_scale_link_is_on_for_new_settings_and_off_for_a_saved_scale_without_it`, `tests::print::the_scale_link_keeps_width_and_height_equal`, `tests::print::a_scale_saved_without_the_link_keeps_its_width_and_height`, `dialogs::tests_print::the_scale_link_keeps_scale_width_and_height_equal`, `dialogs::tests_print::a_print_preset_keeps_the_scale_link`. Print scores and hours are unchanged. - A PDF, PDF-compatible `.ai` or `.ait` opened from its pages or its editing copy opens with the File Info that its XMP packet and its document information dictionary give: the title (`dc:title`, its `x-default` item first, else Info `Title`), the author, description, keywords, copyright status, notice and URL, and the created and modified dates, the XMP packet's value where both give one (`crates/pdf/src/tests/file_info.rs`, `crates/engine/src/tests/fileinfo.rs`). An SVG opens with the title of its root `<title>`. The title is File Info's alone (`DocMetadata::title`): the document's name stays the file's name with its extension, a file that gives no title leaves File Info with that name, and exports (PDF, SVG, PNG, EPS, `.ai`) and native saves carry it; changing the title in File Info sets the document's name as before (#3626). - PDF export and PDF-compatible `.ai` and `.ait` saves write the document's File Info created date as the file's creation date, or the time of writing when the document has none, and the time of writing as its modification date; the page information mark still prints the time of writing (`crates/engine/src/tests/fileinfo.rs`, `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/marks.rs`). From 12f7e34f2100dc6bea4ee135b1906e6f32b465f4 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 12:06:08 -0800 Subject: [PATCH 072/158] Messages: a success token, and the docs state the plug-in and rollback rules - The success level takes a new `success` theme token (the same green) instead of the 3D axis color. - docs/mcp.md names the plug-in conditions for `vc_call`, says no step is recorded while a drag or typing is in progress, says a failed script run keeps the messages it raised, and names the headless MCP server and `vectorcraft-cli run` as the sessions without a window. Lines wrap like the rest of the file. - The params text and the error say "whitespace", which is what the check rejects. - A new test runs a script that draws, raises a message and throws: the drawing is put back and the message is kept. - The long-message test also checks that the stack stays inside the window. - The evidence line in docs/target-app-parity.md moves after the Scripts entries. --- crates/engine/src/cmd/toast.rs | 34 ++++++++++++++++++++++++++++------ crates/ui-egui/src/theme.rs | 3 +++ crates/ui-egui/src/toasts.rs | 11 +++++++---- docs/mcp.md | 14 ++++++++------ docs/target-app-parity.md | 2 +- 5 files changed, 47 insertions(+), 17 deletions(-) diff --git a/crates/engine/src/cmd/toast.rs b/crates/engine/src/cmd/toast.rs index c692ad702d..bf6ed66fee 100644 --- a/crates/engine/src/cmd/toast.rs +++ b/crates/engine/src/cmd/toast.rs @@ -1,7 +1,8 @@ //! `app.toast`: a short message shown over the window that does not stop work and goes away by -//! itself (a toast). Scripts (`vc.run`), actions (a recorded step), MCP clients and the app's own -//! code ([`Session::toast`]) raise one. The engine queues the messages and the desktop app takes -//! them each frame ([`Session::take_toasts`]) and shows them. +//! itself (a toast). Scripts (`vc.run`), actions (a recorded step), MCP clients and plug-ins raise +//! one with the command, and the app's code can raise one with [`Session::toast`]. The engine +//! queues the messages and the desktop app takes them each frame ([`Session::take_toasts`]) and +//! shows them. A failed script run puts the documents back but keeps the messages it raised. use std::collections::VecDeque; @@ -22,7 +23,7 @@ pub const MIN_SECONDS: f64 = 0.5; pub const MAX_SECONDS: f64 = 60.0; /// The most messages waiting for the app to take them: past it the oldest one goes. A session -/// without a window (MCP, the command line) never takes them. +/// without a window (the headless MCP server, `vectorcraft-cli run`) never takes them. pub const MAX_QUEUED: usize = 32; /// What kind of news a message is, which sets its color. @@ -95,7 +96,7 @@ pub fn specs() -> Vec<CommandSpec> { "Show Message", [], None, - "{message: string (1 to 500 characters, not only spaces), level?: \"info\" | \"success\" | \"warning\" | \"error\" (default \"info\"), seconds?: number 0.5 to 60 (default 4)} show `message` over the window without stopping work: it goes away after `seconds` or when clicked; messages stack at the window's bottom right, the newest lowest, at most 5 at once; edits no document; an action records it as a step → {message, level, seconds}", + "{message: string (1 to 500 characters, not only whitespace), level?: \"info\" | \"success\" | \"warning\" | \"error\" (default \"info\"), seconds?: number 0.5 to 60 (default 4)} show `message` over the window without stopping work: it goes away after `seconds` or when clicked; messages stack at the window's bottom right, the newest lowest, at most 5 at once; edits no document; an action records it as a step → {message, level, seconds}", always, run )] @@ -116,7 +117,7 @@ fn parse(p: &Value) -> Result<Toast> { None => return Err(bad(ID, "`message` is required")), }; if message.trim().is_empty() { - return Err(bad(ID, "`message` must have a character other than a space")); + return Err(bad(ID, "`message` must have a character other than whitespace")); } let chars = message.chars().count(); if chars > MAX_CHARS { @@ -231,6 +232,27 @@ mod tests { assert_eq!(s.take_toasts(), vec![Toast::new("Done: 2", Level::Success)]); } + #[test] + fn a_failed_script_run_puts_the_documents_back_and_keeps_its_messages() { + let mut s = Session::new(); + s.execute("file.new", &json!({})).unwrap(); + let art = format!("{:?}", s.active().unwrap().doc.layers); + let e = s + .execute( + "script.run", + &json!({ + "source": "vc.run('shape.rectangle', {x: 0, y: 0, width: 10, height: 10}); vc.run('app.toast', {message: 'Failed: no artboard'}); throw new Error('stop');", + "name": "t.js", + "answers": [], + }), + ) + .unwrap_err() + .to_string(); + assert!(e.contains("stop"), "{e}"); + assert_eq!(format!("{:?}", s.active().unwrap().doc.layers), art, "the rectangle is put back"); + assert_eq!(s.take_toasts(), vec![Toast::new("Failed: no artboard", Level::Info)]); + } + #[test] fn a_command_batch_raises_its_messages_in_order() { let mut s = Session::new(); diff --git a/crates/ui-egui/src/theme.rs b/crates/ui-egui/src/theme.rs index eeb00ceb62..8e4a7267bf 100644 --- a/crates/ui-egui/src/theme.rs +++ b/crates/ui-egui/src/theme.rs @@ -163,6 +163,8 @@ pub struct Tokens { pub error: Color32, /// Warning marks (a modified linked file). pub warning: Color32, + /// Success marks (a message of level `success`). + pub success: Color32, /// Rotation gizmo axes, also labelled X, Y and Z. pub axis_x: Color32, pub axis_y: Color32, @@ -215,6 +217,7 @@ impl Tokens { artboard_mark: hex(0x808080), error: hex(0xe34850), warning: hex(0xf0a330), + success: hex(0x45af63), axis_x: hex(0xef6058), axis_y: hex(0x45af63), axis_z: hex(0x378ef0), diff --git a/crates/ui-egui/src/toasts.rs b/crates/ui-egui/src/toasts.rs index a8bdb46be5..d1f35f6326 100644 --- a/crates/ui-egui/src/toasts.rs +++ b/crates/ui-egui/src/toasts.rs @@ -1,6 +1,6 @@ -//! Messages that `app.toast` and the app's own code ([`vectorcraft_engine::Session::toast`]) queue, -//! shown over the window without taking the keyboard or stopping work: a stack at the window's -//! bottom right, the newest lowest. Each one goes after its time or when clicked; past +//! Messages that `app.toast` or a call of [`vectorcraft_engine::Session::toast`] queues, shown +//! over the window without taking the keyboard or stopping work: a stack at the window's bottom +//! right, the newest lowest. Each one goes after its time or when clicked; past //! [`MAX_SHOWN`] the oldest goes first. A message shows at most [`MAX_ROWS`] lines, and the whole //! text on hover; a stack taller than the window scrolls. @@ -64,7 +64,7 @@ impl Shown { fn color(t: &Tokens, level: Level) -> egui::Color32 { match level { Level::Info => t.text_dim, - Level::Success => t.axis_y, + Level::Success => t.success, Level::Warning => t.warning, Level::Error => t.error, } @@ -319,6 +319,9 @@ mod tests { pass_in(&mut app, &ctx, 0.0, vec![], height); let newest = app.toasts.list.last().unwrap().rect.unwrap(); assert!(newest.top() >= MARGIN - 0.5 && newest.bottom() <= height - MARGIN + 0.5, "{newest:?}"); + // The stack scrolls inside the window instead of growing past its top. + let stack = ctx.memory(|m| m.area_rect(egui::Id::unique("toasts"))).unwrap(); + assert!(stack.top() >= MARGIN - 0.5 && stack.bottom() <= height - MARGIN + 0.5, "{stack:?}"); assert_eq!(app.toasts.list.len(), MAX_SHOWN); } diff --git a/docs/mcp.md b/docs/mcp.md index 7c67124632..c780fceb17 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3160,15 +3160,17 @@ dropped. ## Messages over the window `app.toast {message, level?, seconds?}` shows a short message over the desktop app's window without stopping work -→ `{message, level, seconds}`. `message` is 1 to 500 characters and not only spaces. `level` is `info` (the +→ `{message, level, seconds}`. `message` is 1 to 500 characters and not only whitespace. `level` is `info` (the default), `success`, `warning` or `error`, and sets the color of the message's edge. `seconds` is how long it shows, 0.5 to 60 (4 by default); a click on it closes it sooner. Messages stack at the window's bottom right, the newest lowest, at most 5 at once: a sixth closes the oldest. A message shows at most 6 lines, with the whole text on hover, -and a stack taller than the window scrolls. A missing `message` or a value outside these ranges is an error, -and nothing shows. The command edits no document and adds no undo step. Scripts raise one with `vc.run('app.toast', -{...})`, a plug-in whose manifest lists `app.toast` calls it like its other commands, and an action recording records it as a step that shows the message again when the action plays. A session -without a window (MCP, `vectorcraft-cli`) keeps the last 32 messages it was given and shows none. These limits are -VectorCraft's own values. +and a stack taller than the window scrolls. A missing `message` or a value outside these ranges is an error, and +nothing shows. The command edits no document and adds no undo step. Scripts raise one with `vc.run('app.toast', +{...})`. A plug-in calls it through `vc_call` under the conditions in [Plug-ins](#plug-ins): API level 2, the +`commands` and `doc.read` permissions, and `app.toast` in its `commandAllowlist`. An action recording records it as a +step that shows the message again when the action plays, except while a drag or typing is in progress, when no +command is recorded. A script run that fails puts the documents back, and the messages it raised still show. The headless MCP server and `vectorcraft-cli run` have no window: they keep the last 32 messages they were +given and show none. These limits are VectorCraft's own values. ```json {"name":"run_command","arguments":{"command":"app.toast","params":{"message":"Exported 4 artboards","level":"success"}}} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 618b0f4be4..a3497e92c5 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -905,7 +905,6 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Synthetic input validates complete gestures before queue mutation: at most 256 drag steps, 16 clicks and 1,024 pending events; up to 64 control requests per frame, with later requests retained for the next frame (#1709). - The control server writes each reply through a 64 KiB buffer. On Windows 11 it sends the 17 MB `document.inspect` reply of a document with 50,000 objects on one layer to a client over loopback in 0.09 s instead of 34 s. - Scripts: File › Scripts › Other Script… and `script.run` run a JavaScript file against the open documents as one transaction with one undo step for each changed document. A failed or stopped run puts every document back. `crates/engine/src/tests/script_run.rs`. - - Messages over the window: `app.toast {message, level?, seconds?}` shows a message at the window's bottom right that does not stop work and closes after its time (4 seconds by default) or when clicked; at most 5 show at once, the newest lowest. Scripts raise one through `vc.run`, MCP clients through the command, and an action records it as a step. The limits are VectorCraft's own values. Tests: `cmd::toast::tests` in `vectorcraft-engine`, `toasts::tests` in `vectorcraft-ui-egui`. - Scripts: Window › Script Console shows each run's `$.write` and `$.writeln` output, `vc.log` entries, uncaught error with the script's name, line and column, and a report of its time, host calls and slowest commands, keeping at most 2,048 lines and counting the lines it dropped. `script.run`'s report carries the same data, and `script.console`, `script.console.clear` and `ui.copyScriptConsole` read, clear and copy it. `crates/engine/src/tests/script_console.rs`. - Scripts: the `$` object has the other members the Dollar object page lists (https://extendscript.docsforadobe.dev/extendscript-tools-features/dollar-object/), from `$.about()` to `$.version`, and scripts have the global `localize(object, ...values)` (https://extendscript.docsforadobe.dev/extendscript-tools-features/localizing-extendscript-strings/), `toSource(value)` and `Object.prototype.toSource()`. Each run starts with the interface's locale, and what a script changes in `$` lasts only for that run. `crates/engine/src/tests/script_dollar.rs`, `crates/js/src/extension_tests.rs`. - Scripts: `toSource` throws a `TypeError` for a property that is not writable or not configurable, a sealed, frozen or non-extensible object or array, and an array with a read-only `length` (VectorCraft's own rule). `crates/js/src/extension_tests.rs`. @@ -922,6 +921,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Scripts: `File` and `Folder` ([File object](https://extendscript.docsforadobe.dev/file-system-access/file-object/), [Folder object](https://extendscript.docsforadobe.dev/file-system-access/folder-object/)) name files and folders by platform or URI path, with `name`, `fsName`, `absoluteURI`, `relativeURI`, `parent`, `Folder.current` and `encode`/`decode`, and read them: `exists`, `length`, the dates, `getFiles` with a mask or a function, and `open('r')` with `read`, `readln`, `readch`, `seek`, `tell` and `close`, decoding by byte order mark, `encoding`, UTF-8 or CP1252. VectorCraft's own rules: a script reads only in its own folder and below (and inside the automation read roots when they are set); any other path and a network or device path are refused before anything is looked up, and a link that leads out is refused as well (`false` or `null`, with `error` set); a file is read whole up to 8 MiB and a run reads up to 32 MiB; writing, the file dialogs and `execute` are not available yet. `crates/engine/src/tests/script_io.rs`. - Scripts: `#strict on` (and `//@strict on`) runs the script with the checks the [`$` object](https://extendscript.docsforadobe.dev/extendscript-tools-features/dollar-object/) help page gives for `$.strict`: an assignment to a read-only property throws a `TypeError`, and so does a new property on an object that takes none. VectorCraft's own rules: a getter-only property counts as read-only, the objects that take no new properties are the non-extensible ones (`Object.preventExtensions`, `seal`, `freeze`, and the frozen `vc` and `$` objects), the last `#strict` line of the script and its includes sets the whole run, a file `$.evalFile` runs keeps its own line's checks for its code, and the rest of ES5 strict mode stays with `'use strict'`. Without the line, runs are unchanged. `crates/engine/src/tests/script_include.rs` (`strict_on_*`, `strict_mode_in_eval_file_is_scoped`), `crates/js/src/interp_tests.rs` (`strict_writes_are_separate_from_es5_strict`). - Scripts folder: File › Scripts lists the `.js` and `.jsx` files of the `Scripts` folder next to the preferences, each named after its file without the extension, with each subfolder as a submenu, above Check Script… and Other Script… (https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/install-and-run-scripts.html). VectorCraft's own rules: the folder is read again when the window becomes active and when the File menu opens (in the macOS menu bar, when any of its menus opens, and the new listing shows the next time the menu opens), links are not followed, and one read stops at 2,048 entries, 512 scripts, 128 subfolders, 4 levels or 250 ms. `script.listInstalled` returns the listing. `crates/engine/src/tests/script_folder.rs`, `crates/ui-egui/src/tests/scripts_menu.rs`. + - Messages over the window: `app.toast {message, level?, seconds?}` shows a message at the window's bottom right that does not stop work and closes after its time (4 seconds by default) or when clicked; at most 5 show at once, the newest lowest. Scripts raise one through `vc.run`, MCP clients through the command, and an action records it as a step. The limits are VectorCraft's own values. Tests: `cmd::toast::tests` in `vectorcraft-engine`, `toasts::tests` in `vectorcraft-ui-egui`. - Open Recent Files under `--automation-read-root`: the control channel's `ui.menu.list` and `file.recentFiles` leave out the recent files outside the read roots, the other rows keep their ids, and `file.openRecentN` for one outside them answers `no such recent file`, as an empty slot does. `crates/ui-egui/src/tests/automation.rs`. - Saves, Export for Screens and Package under `--automation-read-root`: a save without a path leaves the document's own file out of its reply, and a save without a path known leaves out the suggested folder, when they are outside the read roots; Export for Screens into an export preset's folder outside them lists its files relative to that folder and names that folder by its name in an error, and the export settings and saved presets leave out a folder outside them when read or exported; Package's report and warnings, and Document Info's linked images, name a file outside them by its file name. A path the client gives stays in the reply. `crates/engine/src/tests/save.rs`, `crates/engine/src/cmd/fileio/tests_screens.rs`, `crates/engine/src/tests/package.rs`, `crates/ui-egui/src/tests/automation.rs`. - Errors under `--automation-read-root`: a refused save without a path and `file.revert` (also as an `action.batch` step), `script.listInstalled` and `links.relink {copy}` name the document's own file, the Scripts folder or the document's folder by its file name when it is outside the read roots, and keep the roots and the reason; `links.relink`'s copies name such a file by its file name too. A path the client gives stays whole. `crates/engine/src/tests/save.rs` (`pathless_save_rejection_hides_document_folder`), `crates/engine/src/cmd/fileio/action_batch.rs`, `crates/engine/src/tests/links.rs`, `crates/engine/src/tests/script_folder.rs`. From 464bfe36da69fc9b81fbd9b940dbe8aa1e9482a3 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 12:24:33 -0800 Subject: [PATCH 073/158] Layers: a path dragged into a Live Paint group keeps the group's identity and paint A dropped path named "Live Paint Sources" that lands in front of the group's sources group made the group stop counting as a Live Paint group, so the drop failed. The group's own sources group now goes back in front before the paths are added. A dropped path named "Face" or "Edge" was read as one of the group's faces or edges and its paint overwrote the generated part's paint. The joining paths are now left out of the old parts. --- crates/engine/src/cmd/buildcmds/live_paint.rs | 35 +++++++++-- crates/engine/src/tests/build.rs | 58 +++++++++++++++++++ 2 files changed, 87 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/cmd/buildcmds/live_paint.rs b/crates/engine/src/cmd/buildcmds/live_paint.rs index 116ea0c929..411f98a9c6 100644 --- a/crates/engine/src/cmd/buildcmds/live_paint.rs +++ b/crates/engine/src/cmd/buildcmds/live_paint.rs @@ -1,8 +1,8 @@ use super::{ Appearance, AppearanceItem, Arc, Beside, Document, EDGE_NAME, EngineError, FACE_NAME, GapOptions, GapSize, LIVE_PAINT_NAME, Node, NodeId, - PathData, Point, Rect, Result, Selection, Session, SubPath, Value, b, bad, build_children, edge_near, face_at, finite, fit_to_old_edge, ids_json, - is_live_paint, json, number_or, object_param, paint_from, po, point_param, repaint_from, replace_roots, root_ids, source_nodes, source_shapes, - switch_or, + PathData, Point, Rect, Result, SOURCES_NAME, Selection, Session, SubPath, Value, b, bad, build_children, edge_near, face_at, finite, + fit_to_old_edge, ids_json, is_live_paint, json, number_or, object_param, paint_from, po, point_param, repaint_from, replace_roots, root_ids, + source_nodes, source_shapes, switch_or, }; /// `options` as stored on a Live Paint group: none for the defaults. @@ -187,11 +187,16 @@ fn merge_live(d: &mut Document, sel: &mut Selection, roots: &[NodeId]) -> Result .ok_or_else(|| EngineError::Other("Live Paint Merge: select a Live Paint group and the paths to add".into()))?; check_live_paint_takes(d, roots)?; let old = d.node(target).cloned().ok_or(EngineError::NoNode(target))?; + // The rows that join are children of the group already when Merge runs after a drag, and a joining + // path named like a face or an edge is not one of the group's parts. + let mut old_parts = old.clone(); + if let Some(ch) = old_parts.children_mut() { + ch.retain(|c| !roots.contains(&c.id)); + } // Paint to carry over: (point inside face, paint) for faces that draw; edges are matched to the // old edges below. let keep_faces: Vec<(Point, Carried)> = - b::faces(&old).iter().filter(|f| draws(f)).filter_map(|f| Some((po::interior_point(f.path_data()?)?, Carried::of(f)))).collect(); - let old_parts = old.clone(); + b::faces(&old_parts).iter().filter(|f| draws(f)).filter_map(|f| Some((po::interior_point(f.path_data()?)?, Carried::of(f)))).collect(); let mut sources = source_nodes(&old); // The objects drawn in the other Live Paint groups besides their parts stay in the merged group. let mut others = vec![]; @@ -335,6 +340,9 @@ fn spot_in(d: &Document, parent: Option<NodeId>) -> Spot { pub(crate) struct LivePaintMove { /// The Live Paint group the rows go into, and for each row whether it joins the group's paths. join: Option<(NodeId, Vec<bool>)>, + /// The Live Paint group the rows go among the children of, with its sources group as it is + /// before the move. + keep_sources: Option<(NodeId, NodeId)>, /// The Live Paint groups whose paths change. rebuild: Vec<NodeId>, } @@ -369,7 +377,11 @@ impl LivePaintMove { if to != Spot::Outside { check_live_paint_takes(d, &entering)?; } - Ok(Self { join, rebuild }) + let keep_sources = match to { + Spot::In(g) => d.node(g).and_then(b::sources).map(|s| (g, s.id)), + _ => None, + }; + Ok(Self { join, keep_sources, rebuild }) } /// Whether rows join a Live Paint group, which makes the move a "Merge Live Paint" step. @@ -382,6 +394,17 @@ impl LivePaintMove { /// joined a group to it. → `moved` with the joined rows replaced by their group, once, and /// without the faces and edges that were made again. pub(crate) fn finish(self, d: &mut Document, sel: &mut Selection, moved: &[NodeId]) -> Result<Vec<NodeId>> { + // A moved object named like the sources group may now sit before it, where a lookup by name + // finds the object first. The group's own sources group goes back in front. + if let Some((g, src)) = self.keep_sources { + let ch = d.children_mut(Some(g))?; + if let Some(at) = ch.iter().position(|c| c.id == src) + && ch[..at].iter().any(|c| c.name.as_deref() == Some(SOURCES_NAME)) + { + let s = ch.remove(at); + ch.insert(0, s); + } + } if self.join.is_none() && self.rebuild.is_empty() { return Ok(moved.to_vec()); } diff --git a/crates/engine/src/tests/build.rs b/crates/engine/src/tests/build.rs index a3272f6fa9..8a63bf659d 100644 --- a/crates/engine/src/tests/build.rs +++ b/crates/engine/src/tests/build.rs @@ -5198,6 +5198,64 @@ fn layers_drag_adds_paths_to_a_live_paint_group() { assert_eq!(faces(&node(&s, g)).len(), 7); } +/// A path named like a Live Paint group's sources group joins the group when it is dragged in, in +/// front of the sources group or behind it: the group keeps its own sources group and the path +/// goes among its paths. +#[test] +fn layers_drag_of_a_path_named_like_the_sources_group_joins_a_live_paint_group() { + use vectorcraft_tools::builder::{SOURCES_NAME, faces, sources}; + for index in [0, 99] { + let mut s = session(); + let g = live(&mut s); + let a = line_to_right_face(&mut s, 30.0); + s.execute("object.setProps", &json!({"id": a.0, "name": SOURCES_NAME})).unwrap(); + s.execute("node.move", &json!({"id": a.0, "parent": g.0, "index": index})).unwrap(); + assert_eq!(undo_label(&s).as_deref(), Some("Merge Live Paint"), "index {index}"); + let n = node(&s, g); + let src = sources(&n).unwrap(); + assert!(src.children().is_some(), "index {index}: the sources group is a group"); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(src.id), "index {index}: the path joined the sources"); + assert_eq!(faces(&n).len(), 5, "index {index}"); + } +} + +/// An object drawn in a Live Paint group and named like its sources group can be moved ahead of the +/// sources group: the group keeps its own sources group and stays a Live Paint group. +#[test] +fn layers_reorder_of_an_object_named_like_the_sources_group_keeps_the_live_paint_group() { + use vectorcraft_tools::builder::{SOURCES_NAME, is_live_paint, sources}; + let mut s = session(); + let g = live(&mut s); + let real = sources(&node(&s, g)).unwrap().id; + s.execute("object.isolate", &json!({"id": g.0})).unwrap(); + let a = line_across(&mut s, 50.0); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(g)); + s.execute("object.setProps", &json!({"id": a.0, "name": SOURCES_NAME})).unwrap(); + s.execute("node.move", &json!({"id": a.0, "parent": g.0, "index": 0})).unwrap(); + let n = node(&s, g); + assert!(is_live_paint(&n)); + assert_eq!(sources(&n).unwrap().id, real); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(g), "the object stays where it was drawn"); +} + +/// A path named `Face` that is dragged into a Live Paint group is not one of its faces: the face it +/// covers keeps its own fill. +#[test] +fn layers_drag_of_a_path_named_face_does_not_repaint_the_group() { + use vectorcraft_tools::builder::{face_at, faces}; + let green = Paint::solid(Color::from_hex("#00ff00").unwrap()); + let mut s = session(); + let g = live(&mut s); + s.execute("livePaint.fill", &json!({"group": g.0, "point": [25, 50], "color": "#00ff00"})).unwrap(); + let a = rect(&mut s, 0.0, 0.0, 50.0, 100.0); + set_fill(&mut s, a, Color::rgb(0.0, 0.0, 1.0)); + s.execute("object.setProps", &json!({"id": a.0, "name": "Face"})).unwrap(); + s.execute("node.move", &json!({"id": a.0, "parent": g.0, "index": 99})).unwrap(); + let n = node(&s, g); + assert_eq!(faces(&n).len(), 3); + assert_eq!(face_at(&n, Point::new(25.0, 50.0)).unwrap().appearance.fill_paint(), green); +} + /// An Alt-drag into a Live Paint group adds a copy and leaves the path where it was; a drop above /// one of the group's faces, and `node.move` into the group, add the path the same way. #[test] From 24a37f8ba33f1850cc7272eae15561d14cc116f1 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:20:06 +0530 Subject: [PATCH 074/158] =?UTF-8?q?M7/G4:=20Type=20=E2=80=BA=20Retype,=20p?= =?UTF-8?q?hase=201=20(#4934)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit type.retype turns selected outlined text back into live point text when each glyph shape is exactly a glyph of a loaded font, a font the document uses or a family named in fonts: the same up to uniform scale, rotation and translation. Matched glyphs map back to characters through the cmap and become point text in that font and size at the same baseline and turn, one object per line, with the first glyph's fill and stroke, in one undo step. Shapes that match no font stay and are reported. Matching (vectorcraft_text::retype) samples each contour at equal steps of arc length and fits a similarity transform; it is bounded (faces, glyphs, path elements, contours) and panic-free. Near matches, the ranked font list, installed fonts not yet loaded and images are phase 2. --- crates/engine/src/cmd.rs | 2 + crates/engine/src/cmd/retype.rs | 293 ++++++++++++++++++++ crates/engine/src/cmd/retype_tests.rs | 120 ++++++++ crates/text/src/fontdb/lookup.rs | 6 + crates/text/src/lib.rs | 1 + crates/text/src/retype.rs | 384 ++++++++++++++++++++++++++ docs/gaps.md | 5 +- docs/roadmap.md | 5 +- docs/target-app-parity.md | 19 +- docs/type-parity.md | 5 +- 10 files changed, 827 insertions(+), 13 deletions(-) create mode 100644 crates/engine/src/cmd/retype.rs create mode 100644 crates/engine/src/cmd/retype_tests.rs create mode 100644 crates/text/src/retype.rs diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index c4a86dd3a5..4fec3f90bd 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -105,6 +105,7 @@ pub mod textstyles; pub(crate) mod textwrap; pub(crate) mod threads; pub(crate) mod typecmd; +mod retype; mod typemenu; mod variablecmds; pub(crate) mod views; @@ -321,6 +322,7 @@ pub fn command_specs() -> &'static [CommandSpec] { v.extend(pathops::specs()); v.extend(compoundshape::specs()); v.extend(typecmd::specs()); + v.extend(retype::specs()); v.extend(menucmds::specs()); v.extend(live::specs()); v.extend(colorcmds::specs()); diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs new file mode 100644 index 0000000000..a5f3b98bde --- /dev/null +++ b/crates/engine/src/cmd/retype.rs @@ -0,0 +1,293 @@ +//! Type › Retype (#4934), phase 1: outlined text whose glyph shapes are glyphs of a font the app +//! has becomes live point text again, in that font and size, at the same baseline. +//! +//! Behaviour follows the public description of Illustrator's Retype +//! (<https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/identify-fonts-using-retype.html>, +//! <https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/apply-retype-suggested-fonts-to-live-text.html>): +//! select outlined text and Retype finds the fonts that match it, from the fonts on the device among +//! others, for use as live text. Illustrator ranks candidate fonts in a panel; this phase is local +//! and exact instead, and sets the text itself, as #4934 asks. Each selected glyph shape (a path or compound +//! path, inside groups too) is compared with the glyphs of the candidate fonts +//! ([`vectorcraft_text::retype`]), the same up to uniform scale, rotation and translation. Matched +//! glyphs map back to characters through the font's cmap and are rebuilt as point text, one object +//! per line of glyphs, with the first glyph's fill and stroke. Shapes that match no font stay as +//! they are and are reported. Near matches (another version of the font, simplified outlines, +//! merged glyphs) and images are phase 2. + +use std::sync::Arc; + +use kurbo::{BezPath, Point, Vec2}; +use serde_json::{Value, json}; +use vectorcraft_doc::{Appearance, CharStyle, Document, Node, NodeId, NodeKind, TextObject}; +use vectorcraft_text::FontDb; +use vectorcraft_text::retype::{GlyphMatch, RetypeIndex}; + +use super::edit::selected_roots; +use super::{CommandSpec, EngineError, Result, Session, bad, cmd, has_selected_path}; + +/// At most this many shapes are compared. +const MAX_PIECES: usize = 2048; +/// Groups deeper than this are not looked into. +const MAX_DEPTH: usize = 16; +/// Extra families named by `fonts`. +const MAX_FONT_PARAMS: usize = 32; + +pub fn specs() -> Vec<CommandSpec> { + vec![cmd!( + "type.retype", + "Retype", + ["Type"], + None, + "{fonts?: [family…]} turn the selected outlined text (glyph paths and compound paths, inside groups too) back into live point text: each shape is matched against the glyphs of the fonts the app has loaded, the document's fonts and the families in fonts, the same up to uniform scale, rotation and translation (exact matches only); matched glyphs become point text in that font and size at the same baseline, one object per line, with the first glyph's fill and stroke, in one undo step; shapes that match no font stay as they are → {ids (the new type), texts, fonts: [{family, style, size}], unmatched: [id…]}; an error when no shape matches", + has_selected_path, + retype + )] +} + +/// A shape to match: a path or compound path, in document space. +struct Piece { + id: NodeId, + path: BezPath, + appearance: Appearance, +} + +fn collect(n: &Node, depth: usize, out: &mut Vec<Piece>) { + if out.len() >= MAX_PIECES || depth > MAX_DEPTH { + return; + } + match &n.kind { + NodeKind::Group { children, clip: false } => { + for c in children { + collect(c, depth + 1, out); + } + } + NodeKind::Path { path, clipping: false, guide: false, .. } => { + out.push(Piece { id: n.id, path: path.to_bezpath(), appearance: (*n.appearance).clone() }) + } + NodeKind::Compound { children, .. } => { + let mut path = BezPath::new(); + for c in children { + if let NodeKind::Path { path: p, .. } = &c.kind { + path.extend(p.to_bezpath()); + } + } + out.push(Piece { id: n.id, path, appearance: (*n.appearance).clone() }); + } + _ => {} + } +} + +/// The faces to match against: the families in `fonts`, the document's fonts, then every loaded face. +fn candidate_faces(db: &FontDb, d: &Document, fonts: &[String]) -> Vec<Arc<vectorcraft_text::FontFace>> { + let mut families: Vec<String> = fonts.iter().take(MAX_FONT_PARAMS).cloned().collect(); + d.walk(|n| { + if let NodeKind::Text(t) = &n.kind { + for r in &t.runs { + if !families.contains(&r.style.font_family) && families.len() < vectorcraft_text::retype::MAX_FACES { + families.push(r.style.font_family.clone()); + } + } + } + }); + let mut faces = vec![]; + for f in &families { + for style in db.styles(f) { + if let Some(face) = db.face(f, &style) { + faces.push(face); + } + } + } + faces.extend(db.loaded_faces()); + faces +} + +/// One line of retyped glyphs. +struct Line { + pieces: Vec<NodeId>, + text: String, + face: Arc<vectorcraft_text::FontFace>, + scale: f64, + angle: f64, + origin: Point, + end: Point, + appearance: Appearance, +} + +impl Line { + fn dir(&self) -> Vec2 { + Vec2::new(self.angle.cos(), self.angle.sin()) + } + + /// Does glyph `m` continue this line (same font, size and turn, on its baseline, after its end)? + fn continues(&self, m: &GlyphMatch) -> bool { + let size = self.scale * self.face.units_per_em(); + let d = m.origin - self.origin; + let dir = self.dir(); + let across = d.cross(dir).abs(); + m.face.id() == self.face.id() + && (m.scale - self.scale).abs() <= self.scale * 0.005 + && (m.angle - self.angle).abs() < 1e-3 + && across < size * 0.05 + && (m.origin - self.end).dot(dir) > -size * 0.25 + } + + fn push(&mut self, id: NodeId, m: &GlyphMatch) { + // A gap wider than half a space before the glyph is spaces the outlines left no shape for. + let dir = self.dir(); + let gap = (m.origin - self.end).dot(dir); + let space = space_advance(&self.face) * self.scale; + if space > 0.0 && gap > space * 0.5 { + let n = ((gap / space).round() as usize).clamp(1, 64); + self.text.extend(std::iter::repeat_n(' ', n)); + } + self.text.push(m.ch); + self.pieces.push(id); + self.end = m.origin + dir * (m.face.advance(m.gid) * m.scale); + } +} + +fn space_advance(face: &vectorcraft_text::FontFace) -> f64 { + face.mapped_chars().iter().find(|(c, _)| *c == ' ').map(|(_, g)| face.advance(*g)).unwrap_or(0.0) +} + +fn new_line(id: NodeId, m: &GlyphMatch, appearance: &Appearance) -> Line { + let dir = Vec2::new(m.angle.cos(), m.angle.sin()); + Line { + pieces: vec![id], + text: m.ch.to_string(), + face: m.face.clone(), + scale: m.scale, + angle: m.angle, + origin: m.origin, + end: m.origin + dir * (m.face.advance(m.gid) * m.scale), + appearance: appearance.clone(), + } +} + +fn retype(s: &mut Session, p: &Value) -> Result<Value> { + const C: &str = "type.retype"; + let fonts: Vec<String> = match p.get("fonts") { + None | Some(Value::Null) => vec![], + Some(Value::Array(a)) => { + a.iter().map(|v| v.as_str().map(str::to_owned).ok_or_else(|| bad(C, "fonts must be a list of family names"))).collect::<Result<_>>()? + } + Some(_) => return Err(bad(C, "fonts must be a list of family names")), + }; + let roots = selected_roots(s)?; + let db = FontDb::global(); + let (lines, unmatched) = { + let d = &s.doc()?.doc; + let mut pieces = vec![]; + for r in &roots { + if let Some(n) = d.node(*r) { + collect(n, 0, &mut pieces); + } + } + if pieces.is_empty() { + return Err(EngineError::Other("Retype: select outlined text (paths or compound paths)".into())); + } + let index = RetypeIndex::build(db, candidate_faces(db, d, &fonts)); + let found: Vec<Vec<GlyphMatch>> = pieces.iter().map(|pc| index.matches(&pc.path)).collect(); + // The face most shapes match, so a glyph several fonts share is set in the same font as + // the glyphs around it. + let mut votes: Vec<(u32, usize)> = vec![]; + for m in found.iter().flatten() { + match votes.iter_mut().find(|(f, _)| *f == m.face.id()) { + Some(v) => v.1 += 1, + None => votes.push((m.face.id(), 1)), + } + } + let rank = |face: u32| votes.iter().find(|(f, _)| *f == face).map_or(0, |v| v.1); + let mut lines: Vec<Line> = vec![]; + let mut unmatched = vec![]; + for (pc, ms) in pieces.iter().zip(&found) { + // Earlier matches win ties: they are the closer fits. + let best = ms.iter().enumerate().max_by_key(|(i, m)| (rank(m.face.id()), std::cmp::Reverse(*i))).map(|(_, m)| m); + let Some(m) = best else { + unmatched.push(pc.id); + continue; + }; + match lines.last_mut() { + Some(l) if l.continues(m) => l.push(pc.id, m), + _ => lines.push(new_line(pc.id, m, &pc.appearance)), + } + } + (lines, unmatched) + }; + if lines.is_empty() { + return Err(EngineError::Other(format!("Retype: no selected shape matches a glyph of an available font ({} checked)", unmatched.len()))); + } + let system_layout = s.doc()?.doc.setup.system_layout; + let made = s.edit("Retype", |d, sel| { + let mut ids = vec![]; + let mut emptied = vec![]; + for l in &lines { + let Some(first) = l.pieces.first() else { continue }; + let (par, idx, _) = d.position(*first).ok_or(EngineError::NoNode(*first))?; + let style = CharStyle { + font_family: l.face.family.clone(), + font_style: l.face.style.clone(), + size: l.scale * l.face.units_per_em(), + fill: l.appearance.fill_paint(), + stroke: l.appearance.stroke_paint(), + stroke_width: l.appearance.stroke_width(), + ..Default::default() + }; + let mut t = TextObject::point(l.origin, &l.text, style); + if l.angle != 0.0 { + t.xf *= kurbo::Affine::rotate(l.angle); + } + t.para = super::create::new_type_para(); + t.system_layout = system_layout; + super::typecmd::refresh_bounds(&mut t); + let id = d.alloc_id(); + d.insert(par, idx, Node::new(id, NodeKind::Text(Box::new(t))))?; + for pc in &l.pieces { + if let Some((Some(parent), _, _)) = d.position(*pc) { + emptied.push(parent); + } + d.remove(*pc)?; + } + ids.push(id); + } + // A group left holding only the new type (Create Outlines' group) gives way to it, unless + // the group has transparency, effects, a mask or a name of its own, which then keep + // applying to the type inside it. A group left empty goes. + emptied.sort_unstable(); + emptied.dedup(); + for g in emptied { + let Some(n) = d.node(g) else { continue }; + let NodeKind::Group { children, clip: false } = &n.kind else { continue }; + let plain = n.opacity == 1.0 + && n.blend == vectorcraft_color::BlendMode::Normal + && *n.appearance == Appearance::default() + && n.name.is_none() + && n.extras().mask.is_none(); + let only_type = children.iter().all(|c| ids.contains(&c.id)); + if children.is_empty() { + d.remove(g)?; + } else if plain && only_type { + let kids: Vec<Arc<Node>> = children.clone(); + let (par, idx, _) = d.position(g).ok_or(EngineError::NoNode(g))?; + d.remove(g)?; + for (i, k) in kids.into_iter().enumerate() { + d.insert(par, idx + i, (*k).clone())?; + } + } + } + let mut keep: Vec<NodeId> = roots.iter().copied().filter(|r| d.node(*r).is_some()).collect(); + keep.extend(&ids); + sel.set(keep); + Ok(ids) + })?; + Ok(json!({ + "ids": made.iter().map(|i| i.0).collect::<Vec<_>>(), + "texts": lines.iter().map(|l| l.text.clone()).collect::<Vec<_>>(), + "fonts": lines.iter().map(|l| json!({"family": l.face.family, "style": l.face.style, "size": l.scale * l.face.units_per_em()})).collect::<Vec<_>>(), + "unmatched": unmatched.iter().map(|i| i.0).collect::<Vec<_>>(), + })) +} + +#[cfg(test)] +#[path = "retype_tests.rs"] +mod tests; diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs new file mode 100644 index 0000000000..6ed12289f4 --- /dev/null +++ b/crates/engine/src/cmd/retype_tests.rs @@ -0,0 +1,120 @@ +use serde_json::json; +use vectorcraft_doc::{NodeId, NodeKind, TextObject}; + +use crate::Session; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 600, "height": 400})).unwrap(); + s +} + +/// Point text, outlined: the id of the outlines' group. +fn outlined(s: &mut Session, p: serde_json::Value) -> u64 { + let id = s.execute("text.create", &p).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + s.execute("type.createOutlines", &json!({})).unwrap()["ids"][0].as_u64().unwrap() +} + +fn text_of(s: &Session, id: u64) -> TextObject { + let NodeKind::Text(t) = &s.doc().unwrap().doc.node(NodeId(id)).unwrap().kind else { panic!("text object") }; + (**t).clone() +} + +fn near(a: f64, b: f64, tol: f64) -> bool { + (a - b).abs() <= tol +} + +#[test] +fn outlined_point_text_retypes_to_the_same_text_font_size_and_place() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "Retype me, 42!", "size": 36, "font": "Source Sans 3", "style": "Regular"})); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["Retype me, 42!"]), "{r}"); + assert_eq!(r["unmatched"], json!([])); + let id = r["ids"][0].as_u64().unwrap(); + let t = text_of(&s, id); + assert_eq!(t.plain_text(), "Retype me, 42!"); + let st = t.first_style(); + assert_eq!((st.font_family.as_str(), st.font_style.as_str()), ("Source Sans 3", "Regular")); + assert!(near(st.size, 36.0, 0.01), "size {}", st.size); + let o = t.xf.translation(); + assert!(near(o.x, 40.0, 0.01) && near(o.y, 100.0, 0.01), "baseline start {o:?}"); + // The outlines are gone, in one undo step that brings them back. + let d = &s.doc().unwrap().doc; + assert!(d.node(NodeId(g)).is_none(), "the emptied group goes"); + s.execute("edit.undo", &json!({})).unwrap(); + let d = &s.doc().unwrap().doc; + assert!(d.node(NodeId(g)).is_some() && d.node(NodeId(id)).is_none()); +} + +#[test] +fn turned_bold_and_serif_type_keeps_its_font_and_angle() { + let mut s = session(); + let a = outlined(&mut s, json!({"x": 100, "y": 200, "text": "Bold", "size": 24, "font": "Source Sans 3", "style": "Bold", "rotation": 30})); + let b = outlined(&mut s, json!({"x": 300, "y": 80, "text": "Serif", "size": 18, "font": "Source Serif 4", "style": "Regular"})); + s.execute("select.set", &json!({"ids": [a, b]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["Bold", "Serif"]), "{r}"); + let ids: Vec<u64> = r["ids"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect(); + let bold = text_of(&s, ids[0]); + assert_eq!(bold.first_style().font_style, "Bold"); + assert!(near(bold.first_style().size, 24.0, 0.01)); + // text.create turns as kurbo does: compare the turn the new type has with the old one's. + let turned = kurbo::Affine::translate((100.0, 200.0)) * vectorcraft_geom::rotate_deg(30.0); + for (x, y) in bold.xf.as_coeffs().iter().zip(turned.as_coeffs()) { + assert!(near(*x, y, 1e-3), "{:?} vs {:?}", bold.xf, turned); + } + let serif = text_of(&s, ids[1]); + assert_eq!(serif.first_style().font_family, "Source Serif 4"); + assert!(near(serif.first_style().size, 18.0, 0.01)); +} + +#[test] +fn a_drawn_shape_is_reported_and_left_alone() { + let mut s = session(); + let rect = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 80, "height": 40})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [rect]})).unwrap(); + let before = s.doc().unwrap().doc.clone(); + let e = s.execute("type.retype", &json!({})).unwrap_err().to_string(); + assert!(e.contains("no selected shape matches"), "{e}"); + assert!(s.doc().unwrap().doc == before, "nothing changes"); + assert!(s.execute("type.retype", &json!({"fonts": "Source Sans 3"})).is_err(), "fonts is a list"); +} + +#[test] +fn mixed_selection_retypes_the_glyphs_and_keeps_the_rest() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "Mix", "size": 30})); + let rect = s.execute("shape.rectangle", &json!({"x": 10, "y": 200, "width": 80, "height": 40})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [g, rect]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["Mix"])); + assert_eq!(r["unmatched"], json!([rect])); + let d = &s.doc().unwrap().doc; + assert!(matches!(d.node(NodeId(rect)).unwrap().kind, NodeKind::Path { .. }), "the rectangle stays"); +} + +#[test] +fn two_words_keep_their_space() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 20, "y": 60, "text": "two words", "size": 20})); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["two words"])); +} + +#[test] +fn craft_fonts_glyphs_retype_too() { + let Some(f) = vectorcraft_text::CRAFT_FONTS.iter().find(|f| f.is_japanese()) else { + eprintln!("skipped: built without craft-fonts (set CRAFT_FONTS_DIR to a craft-fonts checkout to run it)"); + return; + }; + let mut s = session(); + let g = outlined(&mut s, json!({"x": 20, "y": 60, "text": "漢字です", "size": 20, "font": f.family, "style": f.style})); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({"fonts": [f.family]})).unwrap(); + assert_eq!(r["texts"], json!(["漢字です"]), "{r}"); + assert_eq!(r["fonts"][0]["family"], json!(f.family)); +} diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index 27302aed2f..ef394cb079 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -368,6 +368,12 @@ impl FontDb { loaded.or_else(|| self.instance_by_id(id)) } + /// The faces loaded so far (the bundled fonts and the installed ones type has used), in load + /// order. Installed fonts that nothing has asked for yet are not among them. + pub fn loaded_faces(&self) -> Vec<Arc<FontFace>> { + self.read_faces().clone() + } + /// The face of character style `st`: [`Self::face_version`] of its font, instanced at its /// Variable Font settings ([`Self::instance`]). pub fn style_face(&self, st: &vectorcraft_doc::CharStyle) -> Option<Arc<FontFace>> { diff --git a/crates/text/src/lib.rs b/crates/text/src/lib.rs index f7f5d128ba..4e84f5ecd4 100644 --- a/crates/text/src/lib.rs +++ b/crates/text/src/lib.rs @@ -26,6 +26,7 @@ mod justify; mod kashida; mod kept; mod layout; +pub mod retype; mod shape; #[cfg(not(target_arch = "wasm32"))] mod suitcase; diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs new file mode 100644 index 0000000000..6b3d07ec73 --- /dev/null +++ b/crates/text/src/retype.rs @@ -0,0 +1,384 @@ +//! Retype's glyph matching (Type › Retype, #4934): which glyph of which loaded font an outlined +//! glyph's shape is, the same up to uniform scale, rotation and translation. +//! +//! Phase 1 is exact matching only: a shape matches a glyph when, after the best similarity +//! transform (a Procrustes fit over points sampled at equal steps of arc length along each +//! contour), the leftover distance is a tiny fraction of the shape's size. That holds for outlines +//! made from a font the app has (Create Outlines' output, and other apps' that keep each glyph's +//! contours whole and in the font's order). Near matches (other versions of a font, hinted or +//! simplified outlines, faux styles, glyphs merged into one path) are left unmatched; fuzzy +//! identification is phase 2. + +use std::collections::HashMap; +use std::sync::Arc; + +use kurbo::{BezPath, CubicBez, Line, ParamCurve, ParamCurveArclen, PathEl, PathSeg, Point, QuadBez, Shape}; + +use crate::{FontDb, FontFace}; + +/// At most this many faces are indexed. +pub const MAX_FACES: usize = 96; +/// At most this many encoded characters of one face are indexed (in code point order). +pub const MAX_GLYPHS_PER_FACE: usize = 65_536; +/// At most this many glyphs are indexed in all: faces past it are left out. +pub const MAX_GLYPHS: usize = 262_144; +/// Shapes with more path elements than this are not matched. +pub const MAX_ELEMENTS: usize = 4096; +/// Shapes (and glyphs) with more contours than this are not matched. +const MAX_CONTOURS: usize = 48; +/// Points sampled along each contour. +const SAMPLES: usize = 32; +/// The largest leftover distance (root mean square over the samples) for a match, as a fraction of +/// the shape's spread about its centre. +const TOLERANCE: f64 = 2e-3; +/// How far apart two shapes' spread-to-length ratios may be and still be compared. +const INVARIANT_SLACK: f64 = 0.02; + +/// One glyph an outlined shape matched. +#[derive(Clone)] +pub struct GlyphMatch { + pub face: Arc<FontFace>, + pub gid: u32, + /// The character the face's cmap maps to the glyph (the lowest, when several do). + pub ch: char, + /// Document units per font unit: the font size is `scale` × units per em. + pub scale: f64, + /// The glyph's turn, radians (as [`kurbo::Affine::rotate`] turns). + pub angle: f64, + /// Where the glyph's origin (its baseline start) lies. + pub origin: Point, + /// The leftover distance, relative to the shape's spread. + pub residual: f64, +} + +/// A shape reduced for matching: points along each contour, centred. +struct Signature { + contours: usize, + /// Centred points, [`SAMPLES`] per contour. + pts: Vec<Point>, + centre: Point, + /// Root mean square distance of the points from the centre. + spread: f64, + /// `spread` / the total contour length: unchanged by scale, turn and move. + invariant: f64, +} + +struct Entry { + face: usize, + gid: u32, + ch: char, + sig: Signature, +} + +/// The glyphs of a set of faces, ready to match shapes against. +pub struct RetypeIndex { + faces: Vec<Arc<FontFace>>, + entries: Vec<Entry>, + /// Entry indices by contour count, sorted by invariant. + buckets: HashMap<usize, Vec<usize>>, +} + +impl RetypeIndex { + /// Index the outline glyphs of `faces` (the first [`MAX_FACES`], each face once). + pub fn build(db: &FontDb, faces: impl IntoIterator<Item = Arc<FontFace>>) -> Self { + let mut kept: Vec<Arc<FontFace>> = vec![]; + for f in faces { + if kept.len() >= MAX_FACES { + break; + } + if !kept.iter().any(|k| k.id() == f.id()) { + kept.push(f); + } + } + let mut entries = vec![]; + for (fi, face) in kept.iter().enumerate() { + if entries.len() >= MAX_GLYPHS { + break; + } + // One entry per glyph, under the lowest character that maps to it. + let mut by_gid: HashMap<u32, char> = HashMap::new(); + for &(c, gid) in face.mapped_chars().iter().take(MAX_GLYPHS_PER_FACE) { + if c.is_whitespace() || c.is_control() { + continue; + } + by_gid.entry(gid).and_modify(|e| *e = (*e).min(c)).or_insert(c); + } + let mut gids: Vec<(u32, char)> = by_gid.into_iter().collect(); + gids.sort_unstable(); + for (gid, ch) in gids { + let outline = db.outline(face, gid); + if let Some(sig) = signature(&outline) { + entries.push(Entry { face: fi, gid, ch, sig }); + } + } + } + let mut buckets: HashMap<usize, Vec<usize>> = HashMap::new(); + for (i, e) in entries.iter().enumerate() { + buckets.entry(e.sig.contours).or_default().push(i); + } + for list in buckets.values_mut() { + list.sort_by(|a, b| { + let (x, y) = (entries.get(*a).map_or(0.0, |e| e.sig.invariant), entries.get(*b).map_or(0.0, |e| e.sig.invariant)); + x.total_cmp(&y) + }); + } + RetypeIndex { faces: kept, entries, buckets } + } + + /// The faces indexed. + pub fn faces(&self) -> &[Arc<FontFace>] { + &self.faces + } + + /// How many glyphs are indexed. + pub fn len(&self) -> usize { + self.entries.len() + } + + pub fn is_empty(&self) -> bool { + self.entries.is_empty() + } + + /// The glyphs `shape` (in document space) is, the closest one per face, closest first; empty + /// when it is no glyph of the indexed faces. + pub fn matches(&self, shape: &BezPath) -> Vec<GlyphMatch> { + let Some(sig) = signature(shape) else { return vec![] }; + let Some(list) = self.buckets.get(&sig.contours) else { return vec![] }; + let lo = sig.invariant * (1.0 - INVARIANT_SLACK); + let hi = sig.invariant * (1.0 + INVARIANT_SLACK); + let start = list.partition_point(|i| self.entries.get(*i).is_some_and(|e| e.sig.invariant < lo)); + let mut best: HashMap<usize, GlyphMatch> = HashMap::new(); + for i in list.iter().skip(start) { + let Some(e) = self.entries.get(*i) else { continue }; + if e.sig.invariant > hi { + break; + } + let Some((z, residual)) = fit(&e.sig, &sig) else { continue }; + if residual > TOLERANCE { + continue; + } + let Some(face) = self.faces.get(e.face) else { continue }; + // The glyph's origin is (0, 0) in font units: it lands at centre − z·glyph centre. + let gc = mul(z, e.sig.centre); + let origin = Point::new(sig.centre.x - gc.x, sig.centre.y - gc.y); + let m = GlyphMatch { face: face.clone(), gid: e.gid, ch: e.ch, scale: z.0.hypot(z.1), angle: z.1.atan2(z.0), origin, residual }; + match best.get(&e.face) { + Some(b) if b.residual < m.residual || (b.residual == m.residual && b.ch <= m.ch) => {} + _ => { + best.insert(e.face, m); + } + } + } + let mut out: Vec<(usize, GlyphMatch)> = best.into_iter().collect(); + out.sort_by(|a, b| a.1.residual.total_cmp(&b.1.residual).then(a.0.cmp(&b.0))); + out.into_iter().map(|(_, m)| m).collect() + } +} + +/// Complex multiply: `z` (a scaled turn) applied to `p`. +fn mul(z: (f64, f64), p: Point) -> Point { + Point::new(z.0 * p.x - z.1 * p.y, z.1 * p.x + z.0 * p.y) +} + +/// The scaled turn `z` that best takes glyph `g`'s points onto shape `s`'s (both centred), and the +/// leftover distance relative to the shape's spread; `None` for degenerate shapes. +fn fit(g: &Signature, s: &Signature) -> Option<((f64, f64), f64)> { + if g.pts.len() != s.pts.len() || g.pts.is_empty() { + return None; + } + let (mut re, mut im, mut gg) = (0.0, 0.0, 0.0); + for (a, b) in g.pts.iter().zip(&s.pts) { + // Σ s · conj(g) + re += b.x * a.x + b.y * a.y; + im += b.y * a.x - b.x * a.y; + gg += a.x * a.x + a.y * a.y; + } + if gg <= 0.0 || !gg.is_finite() { + return None; + } + let z = (re / gg, im / gg); + let mut res = 0.0; + for (a, b) in g.pts.iter().zip(&s.pts) { + let p = mul(z, *a); + res += (p.x - b.x).powi(2) + (p.y - b.y).powi(2); + } + let n = s.pts.len() as f64; + let rel = (res / n).sqrt() / s.spread; + rel.is_finite().then_some((z, rel)) +} + +/// `path`'s contours as segments, the closing line included; `None` past the size caps. +fn contours(path: &BezPath) -> Option<Vec<Vec<PathSeg>>> { + if path.elements().len() > MAX_ELEMENTS { + return None; + } + let mut out: Vec<Vec<PathSeg>> = vec![]; + let mut cur: Vec<PathSeg> = vec![]; + let (mut start, mut last) = (Point::ZERO, Point::ZERO); + let mut flush = |cur: &mut Vec<PathSeg>, start: Point, last: Point| { + if last.distance(start) > 0.0 { + cur.push(PathSeg::Line(Line::new(last, start))); + } + if !cur.is_empty() { + out.push(std::mem::take(cur)); + } + }; + for el in path.elements() { + match *el { + PathEl::MoveTo(p) => { + flush(&mut cur, start, last); + start = p; + last = p; + } + PathEl::LineTo(p) => { + cur.push(PathSeg::Line(Line::new(last, p))); + last = p; + } + PathEl::QuadTo(a, p) => { + cur.push(PathSeg::Quad(QuadBez::new(last, a, p))); + last = p; + } + PathEl::CurveTo(a, b, p) => { + cur.push(PathSeg::Cubic(CubicBez::new(last, a, b, p))); + last = p; + } + PathEl::ClosePath => { + flush(&mut cur, start, last); + last = start; + } + } + } + flush(&mut cur, start, last); + (out.len() <= MAX_CONTOURS).then_some(out) +} + +fn signature(path: &BezPath) -> Option<Signature> { + let bounds = path.bounding_box(); + let size = bounds.width().hypot(bounds.height()); + if !size.is_finite() || size <= 0.0 { + return None; + } + let accuracy = size * 1e-6; + let mut pts = vec![]; + let mut total = 0.0; + let mut contours_n = 0; + for c in contours(path)? { + let lens: Vec<f64> = c.iter().map(|s| s.arclen(accuracy)).collect(); + let len: f64 = lens.iter().sum(); + // A contour with no length (a lone move) draws nothing. + if !(len > size * 1e-9) || !len.is_finite() { + continue; + } + total += len; + contours_n += 1; + let (mut si, mut before) = (0usize, 0.0); + for k in 0..SAMPLES { + let at = len * k as f64 / SAMPLES as f64; + while si + 1 < c.len() && before + lens.get(si).copied().unwrap_or(0.0) < at { + before += lens.get(si).copied().unwrap_or(0.0); + si += 1; + } + let (Some(seg), Some(l)) = (c.get(si), lens.get(si)) else { return None }; + let t = if *l > 0.0 { seg.inv_arclen((at - before).clamp(0.0, *l), accuracy) } else { 0.0 }; + pts.push(seg.eval(t)); + } + } + if pts.is_empty() { + return None; + } + let n = pts.len() as f64; + let centre = Point::new(pts.iter().map(|p| p.x).sum::<f64>() / n, pts.iter().map(|p| p.y).sum::<f64>() / n); + for p in &mut pts { + *p = Point::new(p.x - centre.x, p.y - centre.y); + } + let spread = (pts.iter().map(|p| p.x * p.x + p.y * p.y).sum::<f64>() / n).sqrt(); + if !(spread > 0.0) || !spread.is_finite() { + return None; + } + Some(Signature { contours: contours_n, pts, centre, spread, invariant: spread / total }) +} + +#[cfg(test)] +mod tests { + use super::*; + use kurbo::Affine; + + fn letter() -> BezPath { + // A hand-made "P"-like shape: an outer contour and a counter. + let mut p = BezPath::new(); + p.move_to((0.0, 0.0)); + p.line_to((0.0, -700.0)); + p.curve_to((300.0, -700.0), (450.0, -600.0), (450.0, -480.0)); + p.quad_to((450.0, -300.0), (120.0, -300.0)); + p.line_to((120.0, 0.0)); + p.close_path(); + p.move_to((120.0, -600.0)); + p.line_to((120.0, -400.0)); + p.quad_to((330.0, -400.0), (330.0, -500.0)); + p.quad_to((330.0, -600.0), (120.0, -600.0)); + p.close_path(); + p + } + + #[test] + fn a_shape_matches_itself_scaled_turned_and_moved() { + let g = signature(&letter()).unwrap(); + let xf = Affine::translate((300.0, 200.0)) * Affine::rotate(0.4) * Affine::scale(0.024); + let s = signature(&(xf * letter())).unwrap(); + let (z, res) = fit(&g, &s).unwrap(); + assert!(res < 1e-6, "{res}"); + assert!((z.0.hypot(z.1) - 0.024).abs() < 1e-9); + assert!((z.1.atan2(z.0) - 0.4).abs() < 1e-9); + let origin = s.centre - mul(z, g.centre).to_vec2(); + assert!(origin.distance(Point::new(300.0, 200.0)) < 1e-6, "{origin:?}"); + } + + #[test] + fn lines_written_as_curves_still_match() { + // Paths store lines as cubics with handles on their anchors, or the closing line explicitly. + let mut alt = BezPath::new(); + alt.move_to((0.0, 0.0)); + alt.curve_to((0.0, 0.0), (0.0, -700.0), (0.0, -700.0)); + alt.curve_to((300.0, -700.0), (450.0, -600.0), (450.0, -480.0)); + alt.extend([PathEl::QuadTo((450.0, -300.0).into(), (120.0, -300.0).into())]); + alt.line_to((120.0, 0.0)); + alt.line_to((0.0, 0.0)); + alt.close_path(); + alt.move_to((120.0, -600.0)); + alt.line_to((120.0, -400.0)); + alt.quad_to((330.0, -400.0), (330.0, -500.0)); + alt.quad_to((330.0, -600.0), (120.0, -600.0)); + alt.close_path(); + let (_, res) = fit(&signature(&letter()).unwrap(), &signature(&alt).unwrap()).unwrap(); + assert!(res < 1e-6, "{res}"); + } + + #[test] + fn another_shape_does_not_match() { + let mut o = BezPath::new(); + o.extend(kurbo::Circle::new((200.0, -350.0), 300.0).path_elements(0.1)); + let mut box_ = BezPath::new(); + box_.extend(kurbo::Rect::new(0.0, -700.0, 450.0, 0.0).path_elements(0.1)); + let (a, b) = (signature(&o).unwrap(), signature(&box_).unwrap()); + assert!(fit(&a, &b).is_none_or(|(_, r)| r > TOLERANCE)); + } + + #[test] + fn degenerate_and_hostile_shapes_give_none() { + assert!(signature(&BezPath::new()).is_none()); + let mut dot = BezPath::new(); + dot.move_to((5.0, 5.0)); + dot.close_path(); + assert!(signature(&dot).is_none()); + let mut nan = BezPath::new(); + nan.move_to((f64::NAN, 0.0)); + nan.line_to((1.0, 1.0)); + assert!(signature(&nan).is_none()); + let mut huge = BezPath::new(); + huge.move_to((0.0, 0.0)); + for i in 0..(MAX_ELEMENTS + 1) { + huge.line_to((i as f64, (i % 7) as f64)); + } + assert!(signature(&huge).is_none()); + } +} diff --git a/docs/gaps.md b/docs/gaps.md index a6f6defbb0..a4e0dcd57a 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-16 · **Change:** minor (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: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups <g>, or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; 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: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; 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; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (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: 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: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups <g>, or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; 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: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; 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: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; 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: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; 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, Pattern brush auto corners and Global Edit Shift-click leave-out moved from Missing to Done (code already shipped); 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; G9: EPS gradients drawn as abutting strips import as one gradient, without seams; Tools stays beside the canvas with left-side panels; new gradients follow document color mode; 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; Indian-language hyphenation review and license allowlist, #4947; opening a slow file shows a progress window, part of #5930; Hindi catalog and contributor loanword preferences; agent wording pass complete; wider native proofreading welcome; an image zoomed in on is separated, colorized or proofed only where it shows (#4155); scores and estimates unchanged; a document's first frame renders on the render worker, so opening a heavy file no longer freezes the window; scores and estimates unchanged; large images in CMYK documents are shrunk before they are separated into ink planes (#4155); scores and estimates unchanged; `.ai` paths with a Calligraphic brush open brushed, with the 6D Art Pen's channels, and Windows reads the pen's tilt and barrel rotation, #372; scores and estimates unchanged; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; a slow first frame is waited for instead of restarting without the graphics adapter, and the menu bar no longer waits for the installed fonts' scan; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -466,7 +466,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi - **Missing:** CJK vertical composition (custom mojikumi sets and the Mojikumi Settings dialog, kinsoku settings #633, manual tate-chu-yoko), Middle Eastern features beyond bidi, digit types, Character Direction and Kashidas (a split caret; the Middle Eastern & South Asian composers are done, #4935), - Touch Type, Retype, Snap to Glyph; optional preservation of font sizes during group scaling (#1034 enhancement). + Touch Type, Retype beyond exact matches of available fonts (phase 1 is in, #4934; near matches, the ranked font list and text in images remain), Snap to Glyph; optional preservation of font sizes during group scaling (#1034 enhancement). Itemized in [type-parity.md](type-parity.md). - **Impact:** professional typography and Japanese/Chinese publishing. - **Estimate:** 34–47 h (type core 14–19 h blocks beta). @@ -902,6 +902,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv | Date | Change | Summary | |---|---|---| +| 2026-11-18 | minor | G4 type: Retype phase 1 (#4934), `type.retype` for outlined text that exactly matches an available font; near matches, the ranked font list and images remain. Scores and estimates unchanged | | 2026-11-16 | minor | 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. | | 2026-11-14 | minor | Type: Middle Eastern & South Asian and Standard composers per paragraph (#4935): Paragraph panel menu, paragraph styles, `text.setFormat {composer}` and the native file; the Standard composers set Indic, Arabic and Hebrew type glyph by glyph. `.ai`, EPS and PDF files carry no composer. Scores and estimates unchanged. | | 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index 258b86d04a..d9c3f7cb65 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-17 · **Change:** minor (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; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip 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: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (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: 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; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip 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: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > > Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865). > @@ -163,7 +163,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300; estimates unchanged); PDF import: type filled and stroked by one text-showing operator comes in as one filled and stroked type object (#8015; not yet for type filled and stroked at less than full opacity, or a `TJ` whose kerning starts a new line part way through, which still come in as a filled object and a stroked one; estimates unchanged); PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) | | M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 | | M6 | Path operations (Pathfinder, Shape Builder, offset…) | ✅ mostly done (live compound shapes: Make, Alt-click a Shape Mode, member modes, Release, Expand (#4522); single-result Pathfinder names and SVG IDs retained (#1293); Divide open-cutting-path geometry, appearance and history verified (#1307; existing segment cap remains); Simplify preview/counts and rewritten-path component selection verified (#1272; the slider opens at the Auto-Simplify level; a Direct Selection part of a path simplifies on its own); Compound appearance and member fill-rule edits verified (#1197); Boolean precision on almost-horizontal edges fixed and the property tests made deterministic; Shape Builder gap detection, large-offset bug open); Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog | 3–6 | -| M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, the custom dictionary and Ignore All commands, Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, Spelling › Auto Spell Check in the context menu of type, the Edit Custom Dictionary dialog, and the modal Check Spelling dialog (Edit › Spelling › Check Spelling…, `Cmd+I`, `ui.checkSpelling`, #4936); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs (feature-valued alternates and unencoded glyphs applied in one Undo step while keeping Arabic joining, #5514), OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, vertical type pending | 45–60 | +| M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, the custom dictionary and Ignore All commands, Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, Spelling › Auto Spell Check in the context menu of type, the Edit Custom Dictionary dialog, and the modal Check Spelling dialog (Edit › Spelling › Check Spelling…, `Cmd+I`, `ui.checkSpelling`, #4936); 🟡 Retype phase 1: `type.retype` turns outlined text that exactly matches an available font back into point text (#4934); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs (feature-valued alternates and unencoded glyphs applied in one Undo step while keeping Arabic joining, #5514), OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, vertical type pending | 45–60 | | M8 | Transform & distort (Puppet Warp, Liquify tools, Envelopes, Blends, Perspective Grid) | ✅ done (M8.1–M8.20 on 2026-10-06, fidelity pass): Liquify Tool Options with one shared brush, pen pressure, hold-to-apply, a safe scope and incremental strokes; tool options that last; Puppet Warp rotation, multi-select, Control bar and a rest-shape session that follows Undo; Width tool on compound paths; Envelope dialogs with preview, Reset with Warp/Mesh, full Envelope Options, type/images/symbols/appearance/gradients/patterns distorted on canvas and in every export, warps that keep their frame, Edit Contents, mesh handles and Control bar; Blend Options, anchor-targeted Blend tool, editable spine, keys picked on the canvas, faithful interpolation and knockout; Anchor Point spine conversion/handle editing and selection priority (#2544), with #2425 Shift reshape preserved; Perspective Grid with Define Grid, presets, lock/snap/rulers, widgets, the 1–4 plane switch, movable planes, Perspective Selection scale/copy/perpendicular/Transform Again, and type and symbols truly projected with Edit Text. Left: Anti-Alias and Preserve Shape output, warp-envelope point editing, brush interpolation in blends, Free Transform/Scale/Reflect along a rotated box | 2–4 | | M9 | Live effects (+ 3D & Materials) | 🟡 2D effects done incl. Effect → Pathfinder, Color Adjustments and Document Raster Effects Settings; PDF export warns when the pixel cap lowers raster-effect resolution; Artistic › Colored Pencil, Cutout, Dry Brush, Film Grain, Fresco, Neon Glow, Paint Daubs, Palette Knife, Poster Edges, Rough Pastels, Smudge Stick, Sponge, Underpainting and Watercolor and Sketch › Halftone Pattern, Bas Relief, Charcoal, Conté Crayon, Photocopy, Stamp, Torn Edges and Water Paper done (57/57 Photoshop filters); Revolve with automatic smooth vector shading, default-on circular caps and continuous rims, Extrude & Bevel, Inflate and Rotate with one to ten colored directional lights and four original lighting presets; SVG Filters, remaining raster effects and 3D materials and shadows pending | 81–130 | | M10 | Brushes, symbols, patterns, Repeat | 🟡 pattern swatches (5 tile types, Pattern Options, editing mode, SVG `<pattern>`/PDF export) and live Repeat (radial/grid/mirror) done; interactive selected mirror axis implemented (focused and native checks passed; full CI blocked by an unrelated text test); symbol libraries done (Window › Symbol Libraries, six generated libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons, Weather Icons), User Defined, Other Library…, Save Symbols); brush libraries done (Window › Brush Libraries, ten generated libraries including Tech Circuit, Ink and Wash, Bristle Brushes and Dry Media, User Defined, Other Library…, Save Brushes); symbol editing shows draggable 9-slice guides (#5280), with guides outside the artwork still unsupported; brushes/symbols in progress | 23–37 | @@ -212,6 +212,7 @@ not take the artwork yet. Overflow-menu drag remains separate. Scores and hours | Date | Change | Summary | |---|---|---| +| 2026-11-18 | minor | M7/G4: Retype phase 1 (#4934): `type.retype` turns outlined text that exactly matches an available font back into point text. Scores and estimates unchanged | | 2026-11-17 | minor | PDF import (#8300): a glyph filled only (text rendering mode 0) right after one filled and stroked (mode 2) joined the stroked run and came in stroked too: `2 Tr (B) Tj 0 Tr (C) Tj` came in as `BC` stroked throughout. A glyph filled only now joins only a run drawn alike, so it starts a run of its own, filled only, in the same type object, and takes a stroke only when the file draws one over it (the #8015 matching); a word filled whole then stroked whole, and fill and stroke rendering glyph by glyph, still come in as one run filled and stroked. Tests: `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`, `glyphs_filled_and_stroked_one_by_one_stay_one_run`; scores and estimates unchanged. | | 2026-11-17 | minor | PDF import (#8015 follow-up): type filled and stroked at less than full opacity is no longer joined into one type object, since the file composites the fill and the stroke apiece, darker where they overlap, while one object's opacity applies to both together; it stays a filled object and a stroked one, as a fill and stroke at different opacities already did. An upright glyph (vertical type) filled and stroked is no longer kept as an outline for a line that comes in as its outlines, as glyphs filled only weren't, so such a line can't lose them. The #8015 entries now say what is left: translucent type filled and stroked, and a `TJ` whose kerning starts a new line part way through, still come in as two objects. Tests: `translucent_fill_and_stroke_text_stays_two_objects`, `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled`; scores and estimates unchanged. | | 2026-11-16 | minor | PDF import: fill and stroke rendering (text rendering modes 2 and 6) draws all the glyphs of a text-showing operator (`Tj`, `TJ`, `'`, `"`) filled, then the same glyphs stroked, so a word shown at once came in as two type objects: a stroke-only copy over a fill-only one. Each stroke is now matched, in order, to the glyph filled with the same placement (where, how large, how wide, slanted and turned) in the same font with the same text on the line, and only that glyph takes the stroke, so the word comes in as one type object, filled and stroked; glyphs stroked with another join part way through still split into runs of their own, and stroked type over no filled glyph (modes 1 and 5) stays stroke only (#8015; `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`, `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs`). Scores and estimates unchanged. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e9fc9a6820..0a663b7ea4 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-17 · **Change:** minor (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: #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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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-18 · **Change:** minor (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: 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: #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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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). > @@ -259,15 +259,15 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Appearance, transparency, graphic styles, masks | 5 | 97% | raster effect reach in preview bounds | 1–2 | estimated; Transform typing, sliders, preview, and undo are covered in `crates/ui-egui/src/panels/tests_appearance.rs` | | 3D and Materials (and Turntable) | 4 | ~25% | live Revolve with automatic smooth vector shading and default-on continuous circular caps, Extrude & Bevel (twist, taper, caps, five bevel shapes), Inflate and Rotate with Position presets (colored Inflate uses smooth membrane lighting; white-light Inflate retains its existing shading; Extrude & Bevel and Rotate retain planar shading; one to ten colored lights, shared neutral ambient, painter visibility); materials, light presets, shadows, ray tracing, the rest of 3D Classic (Map Art), Turntable views, textures, map art and shading in 3D export | 30–55 | estimated (Extrude & Bevel, Inflate and Rotate added 2026-10-12); every 3D seam has round joins (2026-11-12, [three-d.md](three-d.md#seams)), score, gaps and hours unchanged | | Type core | 9 | 80% | Auto-leading style resets are implemented; Hyphenation… and Justification… options are done (#2310, #2755), and a paragraph's Auto Leading also sets the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; remaining: Optical Margin Alignment, Middle Eastern features beyond bidi layout (the Middle Eastern & South Asian and Standard composers are done per paragraph, #4935; `.ai`/EPS/PDF files carry no composer), optional group font-size preservation; transformed character controls fixed (#1034), see [type-parity.md](type-parity.md) | 14–19 | estimated; eleven-language pattern hyphenation in both composers, with grapheme and shaping-cluster protection (#4947, `hyphen::tests` and `layout::wrapping_tests`); Sanskrit patterns pending an allowlisted source; recent-font groups in font pickers (#3515); full-name font matches regression-tested (#1258); mixed paragraph alignment indication implemented; headless regressions, full integration CI and visual review pass; localized legacy family-name fallback with loaded/catalog regressions (#2208); Fractional Widths per type object regression-tested; color emoji fonts with bitmap glyphs (`sbix`, `CBDT`) draw and export; threading ports: every selected area type and type on a path shows its in and out ports (empty, arrow, red "+"), and the Selection tool threads from either, the in port into a frame before it, and a double-click on a threaded port breaks the thread there (`threads::tests::break_splits_the_thread_and_the_story_flows_into_the_first_part`, `select::tests::a_double_click_on_a_threaded_port_breaks_the_thread`, `canvas::tests::a_double_click_on_a_threaded_out_port_breaks_the_thread`) (#2572; `select::tests::a_click_on_the_in_port_threads_into_a_frame_before_it`, `text::tests::selected_type_shows_its_ports_in_each_state`, `threads::tests::add_before_threads_the_story_from_the_new_frame_into_the_clicked_one`, live screenshot); the Glyphs panel highlights and scrolls to the character selected with the Type tool (#4908, `panels::glyphs` tests); the OpenType panel lists only `ss01`–`ss20` sets present in the selected font and uses its custom names when supplied; Type-range desktop Copy publishes styled art and keeps font family, size and color on canvas Paste after editing (#5636); paint-only Arabic harakat keep joining with conditional GDEF-mark ownership and Insert Kashidas base-letter paint (`tests::harakat`) | -| Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (ruby, mojikumi), variable font axes, tab leaders, Touch Type, Retype | 20–28 | estimated; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | +| Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (ruby, mojikumi), variable font axes, tab leaders, Touch Type, Retype beyond exact matches of available fonts | 20–28 | estimated; Retype phase 1 (`type.retype`, exact glyph matches, #4934); upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | | Symbols, blends, envelopes, Repeat, perspective | 5 | 88% | remaining: dynamic symbols' `.ai` round trip, further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons and Weather Icons are done), envelope Anti-Alias/Preserve Shape, 9-slice guides outside the art; Symbol Options › Registration, Export Type (Graphic / Movie Clip) and 9-slice guides (drawn and draggable during symbol editing, #5280) and Symbol Type (dynamic on-canvas fill/stroke including gradient/pattern, opacity and blend, #4938) are done | 4–7 | estimated; Blend panel Type and Ramp control step easing with a separate color Shift (#2539); Blend Options retains spacing and orientation; polynomial curves are original approximations; interactive selected mirror axis implemented; bounding-box handles take priority over the axis line (focused regression and native checks passed; full CI blocked by an unrelated text test); #2544 spine Anchor Point conversion and picking regression-tested | -| Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (ruby, mojikumi), tab leaders, Touch Type, Retype | 20–28 | estimated; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | +| Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (ruby, mojikumi), tab leaders, Touch Type, Retype beyond exact matches of available fonts | 20–28 | estimated; Retype phase 1 (`type.retype`, exact glyph matches, #4934); upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | | Symbols, blends, envelopes, Repeat, perspective | 5 | 88% | remaining: dynamic symbols' `.ai` round trip, further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons and Weather Icons are done), envelope Anti-Alias/Preserve Shape, 9-slice guides outside the art; Symbol Options › Registration, Export Type (Graphic / Movie Clip) and 9-slice guides (drawn and draggable during symbol editing, #5280) and Symbol Type (dynamic on-canvas fill/stroke including gradient/pattern, opacity and blend, #4938) are done | 4–7 | estimated; Blend panel Type and Ramp control step easing with a separate color Shift (#2539); Blend Options retains spacing and orientation; polynomial curves are original approximations; interactive selected mirror axis implemented; bounding-box handles take priority over the axis line (focused regression and native checks passed; full CI blocked by an unrelated text test); #2544 spine Anchor Point conversion and picking regression-tested | | Image Trace, graphs, image tools | 3 | 75% | graph Column designs, Image Trace Create Strokes depth (Create Object Mosaic is done; junction-returning piece survival has source-generated regressions in `image-trace-quality.md`; simpler contour walk, identical output; an edge's sub-pixel shift is the same from either side; notches read only their own piece; collapsed loops keep few segments, so Paths is monotone on the code-drawn sweep) | 5–8 | estimated (raised from 72%); quick presets reveal adjustment controls, Properties reopens them; Live trace result bounds and selection highlights exclude the retained bitmap except in source-image views (scores/hours unchanged) | | Live vector effects | 5 | 85% | Outline Object, SVG Filters | 4–8 | measured count 49/50 (Pathfinder 13/13 with Trap), depth estimated; Warp Options controls verified by focused checks and original-image review | | 3D and Materials (and Turntable) | 4 | ~25% | live Revolve with automatic smooth vector shading and default-on continuous circular caps, Extrude & Bevel (twist, taper, caps, five bevel shapes), Inflate and Rotate with Position presets (colored Inflate uses smooth membrane lighting; white-light Inflate retains its existing shading; Extrude & Bevel and Rotate retain planar shading; one to ten colored lights, shared neutral ambient, original lighting presets, painter visibility), Revolve (Classic) with Angle, Cap, Offset and the Plastic, Diffuse, No Shading and Wireframe surfaces, the Quick Actions › Expand as Wireframes command (#6354), the Render Settings › Wireframe mode on Extrude & Bevel, Revolve, Inflate and Rotate; materials, shadows, ray tracing, the rest of 3D Classic (Map Art), Turntable views, textures, map art and shading in 3D export | 30–55 | estimated (Extrude & Bevel, Inflate and Rotate added 2026-10-12); Revolve (Classic) is covered by the `revolve::classic` tests and `dialogs::revolve::tests::classic_revolve_shows_its_options_and_applies_as_one_step`; Expand as Wireframes is covered by `crates/effects/src/solids/wireframe/tests.rs` and `crates/engine/src/cmd/wireframe/tests.rs`, and Render Settings › Wireframe by `crates/effects/src/solids/wireframe/tests.rs` and `crates/ui-egui/src/panels/tests_three_d.rs` (score, gaps and hours unchanged); every 3D seam has round joins (2026-11-12, [three-d.md](three-d.md#seams)), score, gaps and hours unchanged | -| Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (mojikumi), variable font axes, tab leaders, Touch Type, Retype | 20–28 | estimated; No Break keeps marked characters on one line; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | -| Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (mojikumi), tab leaders, Touch Type, Retype | 20–28 | estimated; No Break keeps marked characters on one line; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | +| Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (mojikumi), variable font axes, tab leaders, Touch Type, Retype beyond exact matches of available fonts | 20–28 | estimated; Retype phase 1 (`type.retype`, exact glyph matches, #4934); No Break keeps marked characters on one line; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | +| Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 50% | CJK vertical composition (mojikumi), tab leaders, Touch Type, Retype beyond exact matches of available fonts | 20–28 | estimated; Retype phase 1 (`type.retype`, exact glyph matches, #4934); No Break keeps marked characters on one line; upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged | | Raster effects (Effect Gallery) | 4 | 55% | — | — | estimated (raised from 52%: the Effect Gallery's filter thumbnails and in-dialog preview, an original landscape drawing passed through each filter, [Filter Gallery overview](https://helpx.adobe.com/photoshop/desktop/effects-filters/get-started-with-filters/filter-gallery.html), `dialogs::effect_gallery::tests::gallery_shows_thumbnails_and_an_in_dialog_preview`; the gallery itself shipped in #2883, six categories, per-filter settings, ordered stack, live canvas preview, one undo step, `stack_ok_is_one_undo_step`, `stack_preview_is_one_interaction`); measured count 57/57 (Artistic complete with Colored Pencil, Fresco, Paint Daubs, Palette Knife, Rough Pastels and Underpainting; Sketch complete with Torn Edges and Conté Crayon, `pixel::tests_sketch::conte_crayon_*`); texture redraw distances optimized (#1257), pixels verified; the score stays under 100% because the filters are original approximations; depth estimated | | Symbols, blends, envelopes, Repeat, perspective | 5 | 88% | remaining: dynamic symbols' `.ai` round trip, further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons and Weather Icons are done), envelope Anti-Alias/Preserve Shape, 9-slice guides outside the art; Symbol Options › Registration, Export Type and Symbol Type (dynamic on-canvas fill/stroke including gradient/pattern, opacity and blend, #4938) and on-canvas 9-slice guides (#5280) are done | 4–7 | estimated | | Image Trace, graphs, image tools | 3 | 75% | graph Column designs, Image Trace Create Strokes depth (Create Object Mosaic is done; junction-returning piece survival has source-generated regressions in `image-trace-quality.md`; large images trace with a warning; Auto Color keeps rare distinct colours) | 5–8 | estimated (raised from 72%); quick presets reveal adjustment controls, Properties reopens them | @@ -528,10 +528,10 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Appearance, transparency, graphic styles, masks | 5 | 98% | Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); raster effect reach in preview bounds (flattener presets apply in PDF, EPS and print) | 1–2 | | Live vector effects | 5 | 85% | Outline Object, Pathfinder Hard/Soft Mix and Trap (since done: #3061, #3063, #3785), SVG Filters, Transform Patterns and Scale Strokes & Effects on a fill's or stroke's own Transform effect | 6–10 | | 3D and Materials | 4 | ~25% | Initial Revolve, Extrude & Bevel, Inflate and Rotate, with simple lighting; materials, light presets, shadows, ray tracing, Rotate (Classic), Map Art and more complete visibility remain | 25–45 | -| Type advanced | 4 | 50% | CJK composition for vertical type (ruby, mojikumi beyond Line-end Punctuation Half Width — the other sets (and their paragraph-start bracket and indent rules), custom kinsoku sets (beyond Hard, Soft and None) and the Mojikumi Settings dialog —, manual tate-chu-yoko), tab leaders, Touch Type, Retype; vertical point/area/path type and Type Orientation have initial support (beyond parity, not scored: inline symbols in text) | 20–28 | +| Type advanced | 4 | 50% | CJK composition for vertical type (ruby, mojikumi beyond Line-end Punctuation Half Width — the other sets (and their paragraph-start bracket and indent rules), custom kinsoku sets (beyond Hard, Soft and None) and the Mojikumi Settings dialog —, manual tate-chu-yoko), tab leaders, Touch Type, Retype beyond exact matches of available fonts (phase 1, #4934); vertical point/area/path type and Type Orientation have initial support (beyond parity, not scored: inline symbols in text) | 20–28 | | Raster effects (Effect Gallery, Document Raster Effects Settings) | 4 | 35% | ~36 Photoshop-style filters (Artistic, Brush Strokes, Sketch, Stylize) and Texturizer's Load Texture (since done, see the area table above, as is the Effect Gallery, #2883); Document Raster Effects Settings, raster effects in PDF, the pixel-filter pipeline, Radial Blur, Smart Blur (Normal, Edge Only and Overlay Edge), Unsharp Mask, Glowing Edges, Distort (Diffuse Glow, Glass, Ocean Ripple), Pixelate (Color Halftone, Crystallize, Mezzotint, Pointillize), Texture (Craquelure, Grain, Mosaic Tiles, Patchwork, Stained Glass, Texturizer) and Video (De-Interlace, NTSC Colors) are done | 8–14 | | 3D and Materials | 4 | ~25% | Initial Revolve, Extrude & Bevel, Inflate and Rotate, with simple lighting and four original lighting presets; materials, shadows, ray tracing, Rotate (Classic), Map Art and more complete visibility remain | 25–45 | -| Type advanced | 4 | 50% | CJK composition for vertical type (mojikumi beyond Line-end Punctuation Half Width — the other sets (and their paragraph-start bracket and indent rules), custom kinsoku sets (beyond Hard, Soft and None) and the Mojikumi Settings dialog —, manual tate-chu-yoko is done, its up/down settings remain; No Break is done), tab leaders, Touch Type, Retype; vertical point/area/path type and Type Orientation have initial support (beyond parity, not scored: inline symbols in text) | 20–28 | +| Type advanced | 4 | 50% | CJK composition for vertical type (mojikumi beyond Line-end Punctuation Half Width — the other sets (and their paragraph-start bracket and indent rules), custom kinsoku sets (beyond Hard, Soft and None) and the Mojikumi Settings dialog —, manual tate-chu-yoko is done, its up/down settings remain; No Break is done), tab leaders, Touch Type, Retype beyond exact matches of available fonts (phase 1, #4934); vertical point/area/path type and Type Orientation have initial support (beyond parity, not scored: inline symbols in text) | 20–28 | | Type core | 9 | 80% | Middle Eastern features beyond bidi layout, Paragraph Direction, digit types and Kashidas (editable bidirectional SVG text, a split caret where directions meet; the Middle Eastern & South Asian composers are done, #4935, but `.ai`/EPS/PDF files carry no composer); paint-only harakat keep joining with conditional GDEF-mark colour ownership, but fonts without GDEF mark classes and some AAT/`morx` ligatures can still leave marks painted as their letters; Every-line Composer fidelity for justified and ragged text (available per object; mixed type sizes in a paragraph still break single-line in non-rectangular area type and with text wrap), Optical Margin Alignment, paragraph spacing limit for vertically justified area type, hidden characters, paragraph attributes in the Type tool's copy and paste (the characters keep their styles, the paragraphs take the destination's), mixed-value display in the Paragraph panel for a selection across differing paragraphs, partial selection of type-area anchors by marquee, optional font-size preservation during group scaling (scaled character controls fixed in #1034). Hyphenation and Justification options, Fractional Widths, System Layout, styled Type-range canvas Paste (#5636), and pattern hyphenation for eleven Indian languages with grapheme/cluster protection (#4947) are done; Sanskrit automatic patterns remain pending an allowlisted source | 14–19 | | Symbols, blends, envelopes, Repeat, perspective | 5 | 90% | further built-in symbol libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons and Weather Icons are done), dynamic symbols' `.ai` round trip, envelope Anti-Alias/Preserve Shape output and warp point editing, brush interpolation in blends (M8 fidelity pass done); Symbol Options › Registration and Export Type and on-canvas dynamic part paint (gradient/pattern, opacity, blend) are done; symbol editing shows draggable 9-slice guides (#5280), while guides outside the artwork remain unsupported | 4–7 | | Image Trace, graphs, image tools | 3 | 72% | graph Column designs (Graph Design, Marker designs and series colours set with Group Selection are done), Create Object Mosaic, per-feature stroke/fill choice and varying widths in Image Trace's Create Strokes (Vector Halftone and the Image Trace View modes, Palette and Create Strokes are done) | 6–10 | @@ -2719,6 +2719,10 @@ Edit Custom Dictionary followed (2026-11-10), as the same page's "Edit the custo Check Spelling followed (2026-11-15): Edit › Spelling › Check Spelling… (`Cmd+I`, `ui.checkSpelling`) opens a modal dialog displaying the unrecognized word in its sentence context ("Not in Dictionary"), a list of suggestions with selection or double-click to replace into the "Change to" field, and action buttons: "Ignore" (skips current word), "Ignore All" (skips word in active document, `text.spelling.ignoreAll`), "Change" (replaces word in 1-step undo, `text.editRange`), "Change All" (replaces all occurrences in a single undo step via `command.batch`), "Add to Dictionary" (`text.spelling.addWord`), and "Done" / "Cancel". Supports keyboard navigation (Tab between controls, Enter to Change or Done, Escape to close) (#4936; `crates/ui-egui/src/dialogs/check_spelling.rs`). Spell check is complete. +## Retype, phase 1 (2026-11-18) + +The public pages describe Retype finding the fonts that match selected outlined text (or text in an image), from the fonts on the device among others, and applying them to live text ([identify fonts](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/identify-fonts-using-retype.html), [apply to live text](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/apply-retype-suggested-fonts-to-live-text.html)). Phase 1 (#4934) is local and exact: Type › Retype (`type.retype`) compares each selected glyph shape with the glyphs of the loaded fonts, the document's fonts and any families named in `fonts`, the same up to uniform scale, rotation and translation, and sets the matched characters as point text in that font and size at the same baseline, one object per line, in one undo step. Shapes that match no font stay and are reported. Tested by round trips through Create Outlines (plain, bold and turned, serif, word spaces), a drawn shape and a mixed selection (`crates/engine/src/cmd/retype_tests.rs`). Near matches, the ranked font list, installed fonts not yet loaded and images remain (phase 2). + ## Control bar: Paragraph section while type is selected (2026-11-06) With type selected, the Control bar shows a Paragraph: link and the Align left, Align center and Align right buttons after its Character controls, as the public documentation has the Control panel format paragraphs while the Type tool is in use, with a way to the Paragraph panel ([Paragraph panel overview](https://helpx.adobe.com/illustrator/using/formatting-paragraphs.html)), and its alignment buttons align text as the Paragraph panel's do ([Align text](https://helpx.adobe.com/illustrator/using/align-text.html)). A button aligns the selected type (`text.setStyle {justify}`, one undo step) and the shared alignment shows selected; the link opens the Paragraph panel in a popover under it, as Character: opens the Character panel. Keeping to the three alignments that don't justify is our choice, for the bar's room; the popover has all seven. Short of room the bar leaves controls out from its right end: the inline X/Y/W/H fields, the Distribute and Align buttons, area type's vertical alignment, then these buttons and last the link, keeping room for the Transform link; on a 1536 pt bar with one point type object, the buttons show (pinned by a headless test, #5372). @@ -2783,6 +2787,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | Date | Change | Summary | |---|---|---| +| 2026-11-18 | minor | Type advanced: Retype phase 1 (`type.retype`, #4934), exact matches of available fonts become point text again; evidence added; near matches, the ranked font list and images remain; score and hours unchanged | | 2026-11-16 | minor | Layers panel: rows or the selected-art square dragged over the list show the copy cursor while Alt is held, as the drop then copies, and the grabbing hand otherwise (#8217). Scores and estimates unchanged. | | 2026-11-16 | minor | Gradient panel: the strip under the ramp, where a click adds a stop, shows the white arrow with a plus on Windows and X11, where the system copy cursor showed as the plain arrow (#8241). Scores and estimates unchanged. | | 2026-11-16 | minor | Properties panel: while the Type tool edits text, the Character section shows the font family and style and the Variable Font button of the first selected character (or of the character before the caret), not those of the text object's first run (#8189). Evidence: `panels::properties::tests::character_section_shows_the_type_tool_selections_style`. Scores and estimates unchanged. | diff --git a/docs/type-parity.md b/docs/type-parity.md index 458788b1b6..5bf888b952 100644 --- a/docs/type-parity.md +++ b/docs/type-parity.md @@ -1,6 +1,6 @@ # Type parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-15 · **Change:** minor (modal Check Spelling dialog: Edit › Spelling › Check Spelling…, `ui.checkSpelling`, #4936; spell check complete; previously minor: 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; `.ai` and EPS files do not carry the choice; scores and estimates unchanged; previously minor: kerning at the Type tool's caret at the start of a line sets the space before the character after it, #5111; previously minor: type's strokes in an envelope paint along its bent glyph outlines at their own weight, Distort Appearance on or off, as users' `.ai` files draw them, #6644; previously minor: a centred or right-aligned line of tracked type is aligned without the tracking after its last character, as the page of users' `.ai` files aligns it, #6610; previously minor: tracking and manual kerning in horizontally scaled type are thousandths of the em as the Horizontal Scale draws it, as the page of users' `.ai` files spaces such type; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: Direct Selection shows and drags the direction handles of type on a path's path, #3565; 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: Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas base-letter paint; scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: right-aligned area type sets the text after a line's last tab against the right edge; a soft return in justified type no longer keeps its line from being justified; 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) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (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: modal Check Spelling dialog: Edit › Spelling › Check Spelling…, `ui.checkSpelling`, #4936; spell check complete; previously minor: 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; `.ai` and EPS files do not carry the choice; scores and estimates unchanged; previously minor: kerning at the Type tool's caret at the start of a line sets the space before the character after it, #5111; previously minor: type's strokes in an envelope paint along its bent glyph outlines at their own weight, Distort Appearance on or off, as users' `.ai` files draw them, #6644; previously minor: a centred or right-aligned line of tracked type is aligned without the tracking after its last character, as the page of users' `.ai` files aligns it, #6610; previously minor: tracking and manual kerning in horizontally scaled type are thousandths of the em as the Horizontal Scale draws it, as the page of users' `.ai` files spaces such type; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: Direct Selection shows and drags the direction handles of type on a path's path, #3565; 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: Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas base-letter paint; scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: right-aligned area type sets the text after a line's last tab against the right edge; a soft return in justified type no longer keeps its line from being justified; 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) · **Target:** Adobe Illustrator 2026 (30.x) Glyphs review (#6084): a positional variant no supported feature draws is accepted as a glyph choice. Entire Font respects the selection's variable axes and font version; the default cell can reset an unlisted choice without GSUB alternates. Contextual choices use the supplying face, including fallback. Feature-only boundaries preserve ligature clusters and Arabic mark attachment. Encoded characters insert unchanged except Arabic presentation forms with a joining base letter; normalization reports success only after insertion succeeds. Latest follow-up regressions await runtime verification. Scores and estimates unchanged. @@ -56,7 +56,7 @@ against Illustrator's public documentation; **estimated** unless noted. | Alt + numeric-keypad codes while typing (Windows: `Alt+0176` → °) | partial | #5108: on Windows the character Windows posts when Alt comes up after keypad digits is typed at the caret like any other, in the typing's undo step, and the keypad digits typed with Alt run no shortcut. With NumLock off the keypad keys (Insert, End, arrows, Clear, Home, Page Up/Down without the extended-key flag) count as digits too and don't move the caret (`windows_alt_codes` unit tests; neither NumLock on nor off has been tried on a Windows machine yet). `type.insert {code}` (Windows Alt+0 code, Windows-1252 for 128–159) and `{unicode}` (hex code point) insert a character by its code (`menucmds::insert_a_character_by_its_code`). macOS and Linux have no such system convention and egui reports a keypad digit as the top-row digit, so there it does nothing; a floating panel window doesn't receive the character | | Caret: the arrows and Delete step over whole clusters (Thai consonant with its marks, combining accents, emoji); Backspace removes one character | done | in text with right-to-left characters the arrows move in visual order and stop on both sides of a character drawn with no width, such as a zero width non-joiner | | Touch Type tool | done | moves, scales and rotates one character through its kerning, baseline shift, scales and rotation (`text.touchType`); a character with a preceding logical character on the same line can move along the line in either reading direction; the first logical character moves only up and down. Positive `dx` follows reading order. These direction rules are VectorCraft's choices. | -| Retype (identify fonts in outlines/images) | missing | Illustrator's uses a cloud model | +| Retype (identify fonts in outlines/images) | partial | Phase 1 (#4934): Type › Retype (`type.retype`) turns outlined glyphs back into point text when each shape is exactly a glyph of a loaded font, a font the document uses or a family named in `fonts` (the same up to uniform scale, rotation and translation): one object per line, in that font and size, at the same baseline and turn, with the first glyph's fill and stroke, in one undo step; shapes that match no font stay as they are and are reported. Missing (phase 2): near or fuzzy matches (another version of the font, simplified outlines, glyphs merged into one path), the ranked list of matching fonts with previews, installed fonts not yet loaded, area text for several lines, tracking, text in images. Public behaviour: [identify fonts](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/identify-fonts-using-retype.html), [apply to live text](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/apply-retype-suggested-fonts-to-live-text.html) | | Snap to Glyph | done | View › Snap to Glyph (`view.snapToGlyph`): with Smart Guides on, new point type and drawing tools snap to live-text baselines and glyph bounds, the corners of each glyph's box included, turning with rotated type (#5112; `guides::tests::a_drawn_point_lands_on_a_corner_of_a_glyphs_bounds`, `Targets::for_drawing`, `tools::text_tests::snap_to_glyph_lines_up_new_point_type_with_a_baseline`). With Alignment Guides on as well, and Snap to Grid and Snap to Pixel off, both ends of a Measure or Measure & Inspect drag snap to those guides and show them during the drag (`Targets::for_measure`, `xform::measure::tests::its_ends_land_on_glyph_guides_with_snap_to_glyph`). That the Measure tools take the guides is VectorCraft's choice; they leave out Anchor Point, which [the help page](https://helpx.adobe.com/illustrator/desktop/design-with-text/special-characters-glyphs/snap-to-glyph.html) limits to the Pen tool and objects moved with the Selection tool. Character panel menu › Show Snap to Glyph Options: Baseline, x-height, Glyph Bounds, Proximity Guides, Angular Guides and Anchor Point each turn their guides on or off (`view.snapToGlyph.options`, all on by default; #4232), after a Snap to Glyph checkbox for View › Snap to Glyph; showing them scrolls the panel to them (#5273) | | Thai, Lao, Khmer, Myanmar: shaping (marks, reordering), lines broken between words, word-by-word caret and double-click | done | words found by ICU4X's line segmenter: dictionaries on the desktop, LSTM models on the web | | Middle Eastern: bidirectional layout, Paragraph Direction | done | PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import still needs ActualText support (#6165); separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. | @@ -89,6 +89,7 @@ Character Styles menu New/Redefine and footer New capture the first selected cha | Date | Change | Summary | |---|---|---| +| 2026-11-18 | minor | Retype phase 1 (#4934): `type.retype` turns outlined glyphs that exactly match an available font back into point text (font, size, baseline, turn, paint), reporting the shapes it cannot match; the Retype row is now partial. Scores and estimates unchanged | | 2026-11-15 | minor | Check Spelling dialog (#4936): Edit › Spelling › Check Spelling… (`Cmd+I`, `ui.checkSpelling`) modal dialog with sentence context, suggestions, Ignore, Ignore All, Change, Change All, Add to Dictionary, Done/Cancel, keyboard navigation, and one-step Undo/Redo; spell check complete. Scores and estimates unchanged. | | 2026-11-14 | minor | Paragraph composers (#4935): `text.setFormat {composer}` and paragraph styles take `singleLine` and `everyLine` (the Middle Eastern & South Asian composers, what all type used and the default) and `standardSingleLine` and `standardEveryLine`, which break lines the same way and set a complex script (Indic, Arabic, Hebrew) glyph by glyph as the font maps its characters, with no conjuncts, reordering, marks placed or joining forms. The choice is per paragraph, saved in the native file only when it is not Every-line, and not written to `.ai`, EPS or PDF files, whose composer setting this app has no recorded format for. Scores and estimates unchanged. Tests `tests::composers`. | | 2026-11-12 | minor | Glyphs review (#6084): validate contextual glyph choices against their supplying face, including fallback and overflow; keep feature-only boundaries inside ligatures and Arabic mark clusters while retaining drawing-attribute splits; preserve insertion failures instead of reporting normalization success. Deterministic engine, shaping and panel regression sources added; ligature range assertions use the fixture's unencoded glyph identity. Runtime proof pending. Scores and estimates unchanged. | From a3bdb2871fbb73a465b3e4bb5c20c5d7b480aa07 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 12:58:21 -0800 Subject: [PATCH 075/158] EMF/WMF: export checks the chosen artboards before turning raster effects into images An EMF or WMF export with an empty or non-finite artboard among the chosen ones, or with no artboard to write, turned the document's raster effects into images before the writer refused it. The engine now checks the artboards first with the writer's own rule (vectorcraft_metafile::check_regions) and refuses with the same messages, "the export region is empty" and "the document has no artboard", without that work. Exports that go ahead write the same bytes. --- crates/engine/src/cmd/fileio/metafile.rs | 18 +++++- .../engine/src/cmd/fileio/tests_metafile.rs | 59 +++++++++++++++++++ crates/metafile/src/lib.rs | 15 ++++- docs/target-app-parity.md | 1 + 4 files changed, 89 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/fileio/metafile.rs b/crates/engine/src/cmd/fileio/metafile.rs index e9e1e882a7..3012f7c238 100644 --- a/crates/engine/src/cmd/fileio/metafile.rs +++ b/crates/engine/src/cmd/fileio/metafile.rs @@ -19,6 +19,18 @@ pub(super) const OPTIONS: &[FormatOption] = &[super::ARTBOARD, super::ARTBOARDS, /// Encode `doc` as `kind`: the chosen artboard (default the first), or with `use_artboards` one /// picture per chosen artboard (default all). pub(super) fn encode(doc: &Document, p: &Value, use_artboards: Option<bool>, kind: Kind) -> Result<Encoded> { + encode_flattening(doc, p, use_artboards, kind, crate::flatten_raster_effects) +} + +/// [`encode`] with `flatten` turning raster effects into images. The chosen artboards are checked +/// first, so an export that is refused does not call `flatten`. +pub(super) fn encode_flattening( + doc: &Document, + p: &Value, + use_artboards: Option<bool>, + kind: Kind, + flatten: impl FnOnce(&Document) -> Option<Document>, +) -> Result<Encoded> { let f = super::format(kind.id()).ok_or_else(|| bad(C, "no metafile format"))?; let pick: ArtboardPick = super::encode::options(f, p)?; let n = doc.artboards.len(); @@ -26,12 +38,16 @@ pub(super) fn encode(doc: &Document, p: &Value, use_artboards: Option<bool>, kin Some(true) => pick.resolve(n).map_err(|e| bad(C, e))?.unwrap_or_else(|| (0..n).collect()), _ => vec![pick.one(n).map_err(|e| bad(C, e))?], }; + if boards.is_empty() { + return Err(bad(C, "the document has no artboard")); + } let rects = boards .iter() .map(|&b| doc.artboards.get(b).map(|a| a.rect).ok_or_else(|| bad(C, format!("no artboard {}", b + 1)))) .collect::<Result<Vec<_>>>()?; + vectorcraft_metafile::check_regions(&rects).map_err(|e| bad(C, e))?; // Raster effects (shadows, glows, blurs) as images, as PDF export does. - let flat = crate::flatten_raster_effects(doc); + let flat = flatten(doc); let src = flat.as_ref().unwrap_or(doc); let outs = vectorcraft_metafile::export_regions(src, &rects, kind).map_err(|e| bad(C, e))?; let mut enc = Encoded::default(); diff --git a/crates/engine/src/cmd/fileio/tests_metafile.rs b/crates/engine/src/cmd/fileio/tests_metafile.rs index b02d16508b..941db4fe07 100644 --- a/crates/engine/src/cmd/fileio/tests_metafile.rs +++ b/crates/engine/src/cmd/fileio/tests_metafile.rs @@ -95,6 +95,65 @@ fn raster_effects_are_written_as_images() { assert!(kinds.contains(&114), "the shadow is an image with transparency"); } +/// An export refused for an empty or non-finite artboard among the chosen ones, or for no +/// artboard, gives the same error as before and turns no raster effect into an image; an export +/// that goes ahead does so once, and writes what `document.export` writes. +#[test] +fn a_refused_export_turns_no_raster_effects_into_images() { + use vectorcraft_geom::Rect; + use vectorcraft_metafile::Kind; + let mut s = two_boards(); + let id = s.execute("shape.rectangle", &json!({"x": 50, "y": 50, "width": 30, "height": 30})).unwrap()["id"].clone(); + s.execute("effect.apply", &json!({"effect": "stylize.dropShadow", "ids": [id]})).unwrap(); + let doc = s.doc().unwrap().doc.as_ref().clone(); + let run = |doc: &vectorcraft_doc::Document, p: Value, kind: Kind| { + let mut calls = 0; + let r = super::metafile::encode_flattening(doc, &p, Some(true), kind, |d| { + calls += 1; + crate::flatten_raster_effects(d) + }); + (r.map(|e| e.files).map_err(|e| e.to_string()), calls) + }; + for kind in [Kind::Emf, Kind::Wmf] { + let (files, calls) = run(&doc, json!({}), kind); + assert_eq!(calls, 1, "{kind:?}"); + let files = files.unwrap(); + assert_eq!(files.len(), 2, "{kind:?}"); + let r = s.execute("document.export", &json!({"format": kind.id(), "useArtboards": true})).unwrap(); + let written: Vec<Vec<u8>> = r["files"].as_array().unwrap().iter().map(b64).collect(); + assert_eq!(files.into_iter().map(|(_, b)| b).collect::<Vec<_>>(), written, "{kind:?}"); + // The first artboard is fine; the second is empty, or has a corner that isn't finite. + let x = doc.artboards[0].rect.x1 + 10.0; + for empty in [Rect::new(x, 0.0, x, 100.0), Rect::new(0.0, 0.0, f64::NAN, 100.0), Rect::new(0.0, 0.0, 100.0, f64::INFINITY)] { + let mut bad_doc = doc.clone(); + bad_doc.artboards[1].rect = empty; + for p in [json!({}), json!({"artboards": [0, 1]}), json!({"artboards": [1]})] { + let (files, calls) = run(&bad_doc, p.clone(), kind); + let e = files.err().unwrap_or_default(); + assert!(e.contains("the export region is empty"), "{kind:?} {p}: {e}"); + assert_eq!(calls, 0, "{kind:?} {p}"); + } + } + // Reversed corners are an artboard like any other. + let mut flipped = doc.clone(); + let r1 = flipped.artboards[1].rect; + flipped.artboards[1].rect = Rect::new(r1.x1, r1.y1, r1.x0, r1.y0); + let (files, calls) = run(&flipped, json!({}), kind); + assert_eq!((files.map(|f| f.len()), calls), (Ok(2), 1), "{kind:?}"); + // No artboard to write. + let mut none = doc.clone(); + none.artboards.clear(); + let (files, calls) = run(&none, json!({}), kind); + let e = files.err().unwrap_or_default(); + assert!(e.contains("the document has no artboard"), "{kind:?}: {e}"); + assert_eq!(calls, 0, "{kind:?}"); + } + // Through the command, the refusal reads as it did. + std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc).artboards[1].rect = Rect::new(0.0, 0.0, 0.0, 100.0); + let e = s.execute("document.export", &json!({"format": "emf", "useArtboards": true})).unwrap_err().to_string(); + assert!(e.contains("the export region is empty"), "{e}"); +} + /// Two placed images whose pixel data can't be decoded are left out of an EMF or WMF, and /// `warnings` holds the note raster exports give, once, without naming either image's key. #[test] diff --git a/crates/metafile/src/lib.rs b/crates/metafile/src/lib.rs index c4a84aa8e6..802d662818 100644 --- a/crates/metafile/src/lib.rs +++ b/crates/metafile/src/lib.rs @@ -83,14 +83,23 @@ pub fn export(doc: &Document, region: Rect, kind: Kind) -> Result<Output, String Ok(export_regions(doc, &[region], kind)?.pop().unwrap_or_default()) } +/// The error [`export_regions`] returns for `regions`, without writing anything: a region whose +/// corners are not all finite, or that has no width or no height, is empty. Corners in either +/// order are allowed. +pub fn check_regions(regions: &[Rect]) -> Result<(), String> { + let empty = |r: Rect| ![r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite()) || r.width() <= 0.0 || r.height() <= 0.0; + if regions.iter().any(|r| empty(r.abs())) { + return Err("the export region is empty".into()); + } + Ok(()) +} + /// Write the visible art of `doc` over each of `regions` as `kind`, one metafile per region in the /// same order, each as [`export`] writes it over that region. The live effects are applied once /// for all of them. When any region is empty, nothing is written and the result is an error. pub fn export_regions(doc: &Document, regions: &[Rect], kind: Kind) -> Result<Vec<Output>, String> { + check_regions(regions)?; let regions: Vec<Rect> = regions.iter().map(|r| r.abs()).collect(); - if regions.iter().any(|r| ![r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite()) || r.width() <= 0.0 || r.height() <= 0.0) { - return Err("the export region is empty".into()); - } if regions.is_empty() { return Ok(Vec::new()); } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index ee682dfcf7..ce8be8bb98 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1825,6 +1825,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Live effects inside a symbol's art (geometry effects, color adjustments and the rest that export bakes) are written where each instance places the art in PDF, print, EPS and DXF, as the canvas draws them: the art is placed first and its effects are applied after, so an instance that scales its art does not scale the distance a Transform effect moves it. Symbols nested in the art, a dynamic symbol instance's own paint changes and the stain an instance's fill gives its art are kept, and the art is stained before its effects apply. A linked instance's PDF link covers its art where the effects draw it. A symbol whose art holds itself stops at the nesting limit, and the symbols' own art keeps its effects. An instance stays an instance in these exports when the objects its art makes once baked (the copies a Transform effect makes included) would take the export's placed symbol art past 16,000,000 objects, or when its baked art would draw deeper than the 128 levels a document may draw; these are VectorCraft's own limits. Art baked for an instance that then stays an instance still counts toward that limit, and while an instance's art bakes, the art's own objects are held in the limit for the instances nested in it. Instances the export leaves out (hidden ones, those in hidden groups, on template layers, and on hidden layers or layers that do not print when the export leaves those out) are not placed and do not count toward that limit. Before, these exports wrote the art without its effects (effects `bake::placing_symbols_bakes_their_art_where_each_instance_places_it`, `placing_symbols_reaches_the_art_of_nested_instances`, `placing_a_symbol_that_holds_itself_stops`, `placing_symbols_keeps_dynamic_instances_changes`, `placing_symbols_keeps_the_instances_stain`, `placing_symbols_counts_the_baked_art`, `placing_symbols_counts_nested_art_once`, `placing_symbols_holds_the_outer_art_while_it_bakes`, `placing_symbols_counts_the_art_it_drops`, `placing_symbols_counts_art_dropped_for_depth_against_later_baked_art`, `placing_symbols_keeps_the_baked_art_within_the_drawn_depth`, `placing_symbols_skips_instances_the_export_leaves_out`; doc `depth::tests::drawn_heights_measure_objects_outside_the_layers`; PDF, print, EPS and DXF `symbol_art_effects_are_written_where_they_draw`, `symbol_art_effects_print_where_they_draw`; PDF `a_stained_instance_keeps_its_stain_when_its_art_has_effects`, `a_linked_instance_keeps_its_link_when_its_art_has_effects`). EMF, WMF and SVG export write the same symbol art the same way: an instance of a symbol whose art, or the art of a symbol nested in it, has such effects is written as that art placed by the instance and then baked, so a square that a Transform effect moves 100 pt right draws 100 pt right of where the instance places it at any scale or rotation, and art the effect moves onto the artboard is written. EMF and SVG clip 9-slice cells and WMF does not, as each places other instances. In SVG those instances use no `<symbol>`, and instances of symbols without such effects still share one; named objects in a symbol's art take no ids there, as in an instance with its own copy of the art, so two instances do not write the same id; with Hidden Layers on, hidden instances are placed too and written hidden. An SVG instance nested in another instance's art is shared through `<use>` only when the transform it is drawn with, the outer instances' included, keeps the shared art as the canvas draws it, so a nested stroke keeps its weight in a scaled instance. Preserve Editing still embeds the document with its live effects. Before, these exports wrote the art without its effects (metafile `tests::import::symbol_art_effects_are_written_where_they_draw`; SVG `symbols_layers::symbol_art_effects_are_written_where_the_canvas_draws_them`, `a_kept_hidden_instance_is_written_with_its_symbols_effects`, `instances_written_as_their_art_give_its_names_no_id`, `a_nested_instance_is_shared_only_under_the_transform_it_is_drawn_with`; effects `bake::placing_symbols_skips_instances_the_export_leaves_out`). EMF and WMF export with Use Artboards applies the document's live effects once for all the chosen artboards instead of once for each, and writes the same files byte for byte (metafile `tests::export_regions_writes_what_each_region_writes_alone`; `export_regions_perf` times it). + EMF and WMF export checks the chosen artboards before it turns raster effects into images: an empty or non-finite artboard, or no artboard at all, is refused with the same message without that work (engine `fileio::tests_metafile::a_refused_export_turns_no_raster_effects_into_images`). When an export bakes a symbol instance with geometry effects inside the art of another such instance, it counts the art the inner instance bakes to, the copies its symbol's effects make included, against the 262,144 objects of symbol art one export bakes that way; it counted only the symbol's art before its effects. An instance whose baked art would pass that count stays an instance with its effects, and the art baked for it still counts against the instances after it. These are VectorCraft's own limits (effects `bake::nested_reshape_counts_baked_art`, `nested_reshape_refusal_keeps_its_work_counted`, `nested_reshape_refused_siblings_bake_once`, `nested_reshape_counts_successful_descendants_once`). A raster effect (Drop Shadow, Outer Glow, Gaussian Blur and the other effects that paint pixels) on a symbol instance's topmost fill draws on each filled shape of the symbol's art, and one on its topmost stroke draws on each stroked shape, after any geometry effects listed before it, under the same rules as geometry effects: only a visible fill or stroke with an opacity above 0 counts, a group's own fills and strokes in the art take the effect, and an instance inside the art passes it on. Each shape gets its own shadow or glow, which is VectorCraft's own rule. The canvas, Use Preview Bounds and the drawn bounds, SVG and PDF export draw it, and Object › Expand Appearance is enabled for such an instance and makes the effect an image at the document's raster effects resolution, in one undo step (engine `expand::a_symbol_instance_fill_shadow_shadows_its_filled_art`, `a_symbol_instance_stroke_shadow_shadows_only_its_stroked_art`, `a_symbol_instance_fill_shadow_follows_the_fill_offset_before_it`, `a_nested_symbol_instance_takes_the_outer_fill_shadow`, `export_draws_a_symbol_instance_fill_shadow`). Existing documents with a raster effect on a symbol instance's fill or stroke draw differently: before, the effect drew nothing. Object › Expand Appearance turns a symbol instance whose topmost fill or stroke has only raster effects into its art as well, with the effect's image under the art (a shadow or glow) or in its place (a blur, feather or inner glow). A symbol instance inside the art whose topmost fill or stroke has a geometry or raster effect, its own or one the outer instance passes on, becomes its art and image the same way, and so do the instances in that art, within the nesting and symbol art limits; an instance of a missing symbol stays an instance. One Expand Appearance makes at most 1,024 images of raster effects, holding 256 megapixels in all (VectorCraft's own limits); an object or instance whose image would go past them stays as it is, with its raster effects, and the result reports how many with `rasterLeft` and a warning. Within those limits no live instance or raster effect is left from those effects, so the result no longer changes with the symbols; an instance left by the image limits still follows its symbol. The help page <https://helpx.adobe.com/illustrator/desktop/manage-objects/arrange-objects/expand-objects.html> describes Expand Appearance turning appearance attributes into objects, and the help page <https://helpx.adobe.com/illustrator/desktop/special-effects-styles/apply-filter-effects/vector-and-raster-effects.html> describes expanding an effect into permanent raster data; expanding nested instances this way is VectorCraft's own rule (engine `expand::a_nested_instance_fill_shadow_becomes_an_image_when_the_outer_art_expands`, `an_outer_fill_shadow_expands_the_instance_and_reaches_the_nested_art`, `a_nested_instance_fill_blur_becomes_an_image_when_the_outer_art_expands`, `a_hidden_nested_instance_fill_shadow_makes_no_image`, `a_nested_instance_of_a_missing_symbol_stays_an_instance`, `nested_instance_raster_effects_stop_at_the_image_limit`). Before, an instance whose fill or stroke had only a shadow or glow stayed an instance over the image, and a raster effect on an instance in the art stayed live. From 75d9d61ce99346add6bb01997923d5afa4a12ebb Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:36:38 +0530 Subject: [PATCH 076/158] M7/G4: rustfmt the retype module declaration (#4934) --- crates/engine/src/cmd.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index 4fec3f90bd..e0fe77ecda 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -101,11 +101,11 @@ mod textedit; mod xmlattrs; pub use textedit::effective_kerning; +mod retype; pub mod textstyles; pub(crate) mod textwrap; pub(crate) mod threads; pub(crate) mod typecmd; -mod retype; mod typemenu; mod variablecmds; pub(crate) mod views; From 957712ca718d027b3d646f56cb08ef7c4cce168a Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 02:48:38 +0530 Subject: [PATCH 077/158] M7/G4: retype float checks without negated comparisons (#4934) --- crates/text/src/retype.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs index 6b3d07ec73..9e3f2a3ec4 100644 --- a/crates/text/src/retype.rs +++ b/crates/text/src/retype.rs @@ -266,7 +266,7 @@ fn signature(path: &BezPath) -> Option<Signature> { let lens: Vec<f64> = c.iter().map(|s| s.arclen(accuracy)).collect(); let len: f64 = lens.iter().sum(); // A contour with no length (a lone move) draws nothing. - if !(len > size * 1e-9) || !len.is_finite() { + if !len.is_finite() || len <= size * 1e-9 { continue; } total += len; @@ -292,7 +292,7 @@ fn signature(path: &BezPath) -> Option<Signature> { *p = Point::new(p.x - centre.x, p.y - centre.y); } let spread = (pts.iter().map(|p| p.x * p.x + p.y * p.y).sum::<f64>() / n).sqrt(); - if !(spread > 0.0) || !spread.is_finite() { + if !spread.is_finite() || spread <= 0.0 { return None; } Some(Signature { contours: contours_n, pts, centre, spread, invariant: spread / total }) From 90b37ad2694bfc09455c51c0888d6227e92ccde0 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 03:02:33 +0530 Subject: [PATCH 078/158] M7/G4: retype keeps paint order, groups, transparency and font version (#4934) An unmatched shape between glyphs ends the line, so the type after it is still painted over it. Glyphs of different groups, paint or transparency never share a line, and the new type takes the glyphs' own opacity and blend mode. The type names the font version that matched. The glyph budget holds inside a face too. --- crates/engine/src/cmd/retype.rs | 58 +++++++++++++++++++-------- crates/engine/src/cmd/retype_tests.rs | 48 ++++++++++++++++++++++ crates/text/src/retype.rs | 4 ++ 3 files changed, 94 insertions(+), 16 deletions(-) diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index a5f3b98bde..395ce33b23 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -47,23 +47,28 @@ pub fn specs() -> Vec<CommandSpec> { /// A shape to match: a path or compound path, in document space. struct Piece { id: NodeId, + /// The group holding it (`None` for a selected shape at the top): glyphs of different + /// groups, which may composite differently, never share a line. + parent: Option<NodeId>, path: BezPath, appearance: Appearance, + /// The shape's own transparency, which the new type takes. + opacity: f32, + blend: vectorcraft_color::BlendMode, } -fn collect(n: &Node, depth: usize, out: &mut Vec<Piece>) { +fn collect(n: &Node, parent: Option<NodeId>, depth: usize, out: &mut Vec<Piece>) { if out.len() >= MAX_PIECES || depth > MAX_DEPTH { return; } + let piece = |path: BezPath| Piece { id: n.id, parent, path, appearance: (*n.appearance).clone(), opacity: n.opacity, blend: n.blend }; match &n.kind { NodeKind::Group { children, clip: false } => { for c in children { - collect(c, depth + 1, out); + collect(c, Some(n.id), depth + 1, out); } } - NodeKind::Path { path, clipping: false, guide: false, .. } => { - out.push(Piece { id: n.id, path: path.to_bezpath(), appearance: (*n.appearance).clone() }) - } + NodeKind::Path { path, clipping: false, guide: false, .. } => out.push(piece(path.to_bezpath())), NodeKind::Compound { children, .. } => { let mut path = BezPath::new(); for c in children { @@ -71,7 +76,7 @@ fn collect(n: &Node, depth: usize, out: &mut Vec<Piece>) { path.extend(p.to_bezpath()); } } - out.push(Piece { id: n.id, path, appearance: (*n.appearance).clone() }); + out.push(piece(path)); } _ => {} } @@ -111,6 +116,9 @@ struct Line { origin: Point, end: Point, appearance: Appearance, + parent: Option<NodeId>, + opacity: f32, + blend: vectorcraft_color::BlendMode, } impl Line { @@ -118,13 +126,18 @@ impl Line { Vec2::new(self.angle.cos(), self.angle.sin()) } - /// Does glyph `m` continue this line (same font, size and turn, on its baseline, after its end)? - fn continues(&self, m: &GlyphMatch) -> bool { + /// Does glyph `m` of shape `pc` continue this line (same group, paint and transparency, same + /// font, size and turn, on its baseline, after its end)? + fn continues(&self, pc: &Piece, m: &GlyphMatch) -> bool { let size = self.scale * self.face.units_per_em(); let d = m.origin - self.origin; let dir = self.dir(); let across = d.cross(dir).abs(); - m.face.id() == self.face.id() + pc.parent == self.parent + && pc.appearance == self.appearance + && pc.opacity == self.opacity + && pc.blend == self.blend + && m.face.id() == self.face.id() && (m.scale - self.scale).abs() <= self.scale * 0.005 && (m.angle - self.angle).abs() < 1e-3 && across < size * 0.05 @@ -150,17 +163,20 @@ fn space_advance(face: &vectorcraft_text::FontFace) -> f64 { face.mapped_chars().iter().find(|(c, _)| *c == ' ').map(|(_, g)| face.advance(*g)).unwrap_or(0.0) } -fn new_line(id: NodeId, m: &GlyphMatch, appearance: &Appearance) -> Line { +fn new_line(pc: &Piece, m: &GlyphMatch) -> Line { let dir = Vec2::new(m.angle.cos(), m.angle.sin()); Line { - pieces: vec![id], + pieces: vec![pc.id], text: m.ch.to_string(), face: m.face.clone(), scale: m.scale, angle: m.angle, origin: m.origin, end: m.origin + dir * (m.face.advance(m.gid) * m.scale), - appearance: appearance.clone(), + appearance: pc.appearance.clone(), + parent: pc.parent, + opacity: pc.opacity, + blend: pc.blend, } } @@ -180,7 +196,7 @@ fn retype(s: &mut Session, p: &Value) -> Result<Value> { let mut pieces = vec![]; for r in &roots { if let Some(n) = d.node(*r) { - collect(n, 0, &mut pieces); + collect(n, None, 0, &mut pieces); } } if pieces.is_empty() { @@ -200,17 +216,21 @@ fn retype(s: &mut Session, p: &Value) -> Result<Value> { let rank = |face: u32| votes.iter().find(|(f, _)| *f == face).map_or(0, |v| v.1); let mut lines: Vec<Line> = vec![]; let mut unmatched = vec![]; + // An unmatched shape between glyphs ends the line: the type after it is painted after it. + let mut open = false; for (pc, ms) in pieces.iter().zip(&found) { // Earlier matches win ties: they are the closer fits. let best = ms.iter().enumerate().max_by_key(|(i, m)| (rank(m.face.id()), std::cmp::Reverse(*i))).map(|(_, m)| m); let Some(m) = best else { unmatched.push(pc.id); + open = false; continue; }; match lines.last_mut() { - Some(l) if l.continues(m) => l.push(pc.id, m), - _ => lines.push(new_line(pc.id, m, &pc.appearance)), + Some(l) if open && l.continues(pc, m) => l.push(pc.id, m), + _ => lines.push(new_line(pc, m)), } + open = true; } (lines, unmatched) }; @@ -227,6 +247,8 @@ fn retype(s: &mut Session, p: &Value) -> Result<Value> { let style = CharStyle { font_family: l.face.family.clone(), font_style: l.face.style.clone(), + // The version that matched, when two of the family and style are loaded. + font_version: (!l.face.version.is_empty()).then(|| l.face.version.clone()), size: l.scale * l.face.units_per_em(), fill: l.appearance.fill_paint(), stroke: l.appearance.stroke_paint(), @@ -241,7 +263,11 @@ fn retype(s: &mut Session, p: &Value) -> Result<Value> { t.system_layout = system_layout; super::typecmd::refresh_bounds(&mut t); let id = d.alloc_id(); - d.insert(par, idx, Node::new(id, NodeKind::Text(Box::new(t))))?; + let mut node = Node::new(id, NodeKind::Text(Box::new(t))); + // The glyphs' own transparency (the group's, kept, still applies over it). + node.opacity = l.opacity; + node.blend = l.blend; + d.insert(par, idx, node)?; for pc in &l.pieces { if let Some((Some(parent), _, _)) = d.position(*pc) { emptied.push(parent); diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 6ed12289f4..af91b8442d 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -118,3 +118,51 @@ fn craft_fonts_glyphs_retype_too() { assert_eq!(r["texts"], json!(["漢字です"]), "{r}"); assert_eq!(r["fonts"][0]["family"], json!(f.family)); } + +fn children_of(s: &Session, g: u64) -> Vec<u64> { + s.doc().unwrap().doc.node(NodeId(g)).unwrap().children().unwrap().iter().map(|c| c.id.0).collect() +} + +#[test] +fn a_shape_between_glyphs_ends_the_line_so_paint_order_holds() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); + let rect = s.execute("shape.rectangle", &json!({"x": 30, "y": 60, "width": 80, "height": 50})).unwrap()["id"].as_u64().unwrap(); + // The rectangle goes between A and B, inside the outlines' group. + s.edit("test", |d, _| { + let n = d.node(NodeId(rect)).unwrap().clone(); + d.remove(NodeId(rect))?; + d.insert(Some(NodeId(g)), 1, n)?; + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["A", "B"]), "{r}"); + assert_eq!(r["unmatched"], json!([rect])); + let ids: Vec<u64> = r["ids"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect(); + assert_eq!(children_of(&s, g), vec![ids[0], rect, ids[1]], "A under the rectangle, B over it"); +} + +#[test] +fn glyphs_of_different_groups_and_transparency_stay_apart() { + let mut s = session(); + let a = outlined(&mut s, json!({"x": 40, "y": 100, "text": "ab", "size": 20})); + let b = outlined(&mut s, json!({"x": 120, "y": 100, "text": "cd", "size": 20})); + let first_d = children_of(&s, b)[1]; + s.edit("test", |d, _| { + d.node_mut(NodeId(b)).unwrap().opacity = 0.5; + d.node_mut(NodeId(first_d)).unwrap().opacity = 0.25; + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [a, b]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["ab", "c", "d"]), "same baseline, other group; d has its own opacity: {r}"); + let ids: Vec<u64> = r["ids"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect(); + let d = &s.doc().unwrap().doc; + assert!(d.node(NodeId(a)).is_none(), "a plain group gives way to its type"); + assert_eq!(d.node(NodeId(b)).unwrap().opacity, 0.5, "the half-transparent group stays"); + assert_eq!(children_of(&s, b), vec![ids[1], ids[2]]); + assert_eq!(s.doc().unwrap().doc.node(NodeId(ids[2])).unwrap().opacity, 0.25, "the glyph's own opacity carries over"); +} diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs index 9e3f2a3ec4..5a1894e2d0 100644 --- a/crates/text/src/retype.rs +++ b/crates/text/src/retype.rs @@ -106,6 +106,10 @@ impl RetypeIndex { let mut gids: Vec<(u32, char)> = by_gid.into_iter().collect(); gids.sort_unstable(); for (gid, ch) in gids { + // The budget holds inside a face too: no glyph is loaded past it. + if entries.len() >= MAX_GLYPHS { + break; + } let outline = db.outline(face, gid); if let Some(sig) = signature(&outline) { entries.push(Entry { face: fi, gid, ch, sig }); From 1b1f60ba8c04a57eaad6fabfc250f7ce22d5d937 Mon Sep 17 00:00:00 2001 From: dotCooCoo <RobertLeeLW@gmail.com> Date: Tue, 17 Nov 2026 13:27:17 -0800 Subject: [PATCH 079/158] SVG Options: Show in Browser opens the SVG in the default browser The SVG export options on the help page list a Show in browser option beside Show Code, which displays the image in the default web browser: https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/export-file-format-options-in-illustrator.html SVG Options gets a Show in Browser button beside Show Code. It writes the SVG of the dialog's current, unconfirmed choices for one page (the selection's crop under Export Selection, otherwise the first artboard the options choose) to a new folder inside "VectorCraft SVG Preview" in the system's temporary folder and opens it (file.export.svg.browser). The dialog stays open, the choices are not remembered, and nothing is written to the chosen file. The folder follows Save for Web's preview folders: a private folder per preview, and folders an hour old are removed; each kind removes only its own. The button is disabled on the web build, and control and MCP requests are refused, as Save for Web's Preview in Browser is. Show Code and Show in Browser share one encoding step, so Show Code changes in two ways. A range that OK refuses now shows OK's error: before, Show Code showed the first artboard's code for a range it could not read, and the first artboard named for a range such as "1, 9" when the document has no artboard 9. A range naming one missing artboard was already an error, with a different message. From Save As or Save a Copy, both keep hidden layers, as the save does. A document with no artboards shows the bounds of its art. --- crates/mcp/src/ui_catalog.rs | 6 + crates/ui-egui/src/dialogs/save_for_web.rs | 46 ++-- crates/ui-egui/src/dialogs/svg_options.rs | 300 ++++++++++++++++++--- crates/ui-egui/src/i18n/bg.tsv | 1 + crates/ui-egui/src/i18n/bs.tsv | 1 + crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/gu.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + crates/ui-egui/src/io.rs | 2 +- crates/ui-egui/src/io/export.rs | 2 +- crates/ui-egui/src/menus/run.rs | 1 + crates/ui-egui/src/menus/state.rs | 2 +- crates/ui-egui/src/menus/ui_commands.rs | 6 + docs/control-protocol.md | 2 +- docs/mcp.md | 3 +- docs/target-app-parity.md | 1 + 39 files changed, 345 insertions(+), 54 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index b6da21331e..0d5769f1cf 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -143,6 +143,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{} opens SVG Options; with params = document.export {path?, svg?: {…SVG options}, range?…} (a .svgz path writes it gzipped)", ), + ( + "file.export.svg.browser", + "Show in Browser", + "", + "{svg?: {…SVG options}, exportSelection?} SVG Options' Show in Browser: write the SVG of one page (with exportSelection the selection's crop, else the first artboard the options choose) and its linked images to a new temporary folder and open it in the default browser (desktop; refused for control and MCP requests) → {path, warnings}", + ), ("file.export.png", "Export As PNG…", "", "{path?, …document.export options}; no path: pick the file, then PNG Options"), ( "file.exportForScreens", diff --git a/crates/ui-egui/src/dialogs/save_for_web.rs b/crates/ui-egui/src/dialogs/save_for_web.rs index 589d1dfdce..bfe21b8482 100644 --- a/crates/ui-egui/src/dialogs/save_for_web.rs +++ b/crates/ui-egui/src/dialogs/save_for_web.rs @@ -237,29 +237,41 @@ pub(crate) fn browser_preview(app: &mut VectorcraftApp, p: &Value) -> Result<Val #[cfg(not(target_arch = "wasm32"))] const PREVIEW_KEEP: std::time::Duration = std::time::Duration::from_secs(3600); +/// The folder Save for Web's browser previews go to inside the system's temporary folder. +const ROOT: &str = "VectorCraft Save for Web"; + /// The folder a browser preview goes to: a new one for each preview, in the system's temporary -/// folder ([`preview_folder_in`]). -#[cfg(not(target_arch = "wasm32"))] +/// folder ([`temp_folder_under`]). fn temp_folder() -> Result<String, String> { - preview_folder_in(&std::env::temp_dir(), PREVIEW_KEEP) + temp_folder_under(ROOT) } -/// The name of a folder that a preview made in the temporary folder, beside a `VectorCraft Save -/// for Web` it couldn't use, before the process id and the count. +/// A new folder for a browser preview in the system's temporary folder, under the folder named +/// `root` ([`preview_folder_under`]). #[cfg(not(target_arch = "wasm32"))] -const BESIDE: &str = "VectorCraft Save for Web "; +pub(super) fn temp_folder_under(root: &str) -> Result<String, String> { + preview_folder_under(&std::env::temp_dir(), root, PREVIEW_KEEP) +} -/// A new folder for a browser preview in the temporary folder `tmp`: inside `VectorCraft Save for -/// Web` ([`preview_folder`]), or, when that folder can't be used, directly in `tmp`, named -/// [`BESIDE`] followed by the process id and a count. The log says why the shared folder wasn't -/// used. Each preview first removes the folders of that name in `tmp` last changed `keep` or longer -/// ago ([`remove_old`]). -#[cfg(not(target_arch = "wasm32"))] +/// A new folder for a Save for Web browser preview in the temporary folder `tmp` +/// ([`preview_folder_under`] with `VectorCraft Save for Web`). +#[cfg(all(test, not(target_arch = "wasm32")))] pub(super) fn preview_folder_in(tmp: &std::path::Path, keep: std::time::Duration) -> Result<String, String> { - remove_old(tmp, BESIDE, keep); - preview_folder(&tmp.join("VectorCraft Save for Web"), keep).or_else(|e| { - log::warn!("vectorcraft: Preview in Browser can't use {e}, so the preview goes to a new folder of its own"); - new_folder(tmp, BESIDE) + preview_folder_under(tmp, ROOT, keep) +} + +/// A new folder for a browser preview in the temporary folder `tmp`: inside the folder named `root` +/// ([`preview_folder`]), or, when that folder can't be used, directly in `tmp`, named `root`, a +/// space, the process id and a count. The log says why the shared folder wasn't used. Each preview +/// first removes the folders of that name in `tmp` last changed `keep` or longer ago +/// ([`remove_old`]). Previews under one `root` never remove the folders of another. +#[cfg(not(target_arch = "wasm32"))] +pub(super) fn preview_folder_under(tmp: &std::path::Path, root: &str, keep: std::time::Duration) -> Result<String, String> { + let beside = format!("{root} "); + remove_old(tmp, &beside, keep); + preview_folder(&tmp.join(root), keep).or_else(|e| { + log::warn!("vectorcraft: a browser preview can't use {e}, so the preview goes to a new folder of its own"); + new_folder(tmp, &beside) }) } @@ -381,7 +393,7 @@ fn is_preview_name(name: &std::ffi::OsStr, prefix: &str) -> bool { } #[cfg(target_arch = "wasm32")] -fn temp_folder() -> Result<String, String> { +pub(super) fn temp_folder_under(_: &str) -> Result<String, String> { Err("no file system here".into()) } diff --git a/crates/ui-egui/src/dialogs/svg_options.rs b/crates/ui-egui/src/dialogs/svg_options.rs index 13586ae3e1..c185a3d5cb 100644 --- a/crates/ui-egui/src/dialogs/svg_options.rs +++ b/crates/ui-egui/src/dialogs/svg_options.rs @@ -1,16 +1,19 @@ //! SVG Options (Export As SVG, Save As / Save a Copy to .svg): profile, styling, fonts, images, //! object ids, decimals, encoding, minify, responsive, embedded fonts, artboards (export) or //! editing data (save), and a read-only view of the code. OK remembers the choices for next time and runs the export or save command with -//! them as `svg: {…}`. +//! them as `svg: {…}`. Show in Browser (`file.export.svg.browser`) writes the SVG the choices give +//! to a temporary folder and opens it in the default browser, leaving the dialog open. +use std::borrow::Cow; use std::sync::Arc; use serde_json::{Map, Value, json}; +use vectorcraft_engine::cmd::fileio; use super::DialogSpec; use crate::state::Dialog; use crate::theme::{self, Tokens}; -use crate::{VectorcraftApp, widgets}; +use crate::{VectorcraftApp, io, widgets}; pub(super) const SPEC: DialogSpec = DialogSpec { heading: |_| tl!("SVG Options").into(), @@ -26,6 +29,12 @@ pub(super) const SPEC: DialogSpec = DialogSpec { /// `Dialog::kind` of this dialog. pub const KIND: &str = "svgOptions"; +/// The UI command of the dialog's Show in Browser button. +pub const BROWSER: &str = "file.export.svg.browser"; + +/// The folder in the system's temporary folder that Show in Browser's previews go to. +const PREVIEW_ROOT: &str = "VectorCraft SVG Preview"; + /// What OK does: Export As SVG, Save As or Save a Copy. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum Mode { @@ -196,8 +205,16 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { } ui.add_space(10.0); let show = d.bool("showCode"); - if widgets::secondary_button(ui, if show { tl!("Hide Code") } else { tl!("Show Code") }).clicked() { - d.fields.insert("showCode".into(), json!(!show)); + let mut browser = false; + ui.horizontal(|ui| { + if widgets::secondary_button(ui, if show { tl!("Hide Code") } else { tl!("Show Code") }).clicked() { + d.fields.insert("showCode".into(), json!(!show)); + } + let b = ui.add_enabled(!io::is_web(app), |ui: &mut egui::Ui| widgets::secondary_button(ui, tl!("Show in Browser"))); + browser = b.on_disabled_hover_text(tl!("Needs the desktop app")).clicked(); + }); + if browser && let Err(e) = app.run(BROWSER, preview_params(d)) { + app.status(e); } if show { ui.add_space(6.0); @@ -269,6 +286,102 @@ fn artboards(app: &VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { }); } +/// The SVG options the dialog `d`'s OK writes with: [`options`], with hidden layers kept (not +/// displayed) when OK saves, as a save keeps them unless told otherwise. +fn written_options(d: &Dialog) -> Value { + let mut o = options(d); + if Mode::of(d) != Mode::Export + && let Some(m) = o.as_object_mut() + { + m.entry("hiddenLayers").or_insert(json!(true)); + } + o +} + +/// The params of [`BROWSER`] for the dialog `d`: the SVG options OK writes with +/// ([`written_options`]), and `exportSelection` when Export Selection opened it. +fn preview_params(d: &Dialog) -> Value { + super::export_as::exported(d, json!({ "svg": written_options(d) })) +} + +/// The SVG file that the SVG options `svg` write for one page of the document `st`, and the +/// document it is drawn from. With `selection` (Export Selection) the page is the selection alone, +/// cropped to it. Otherwise it is the first artboard the options choose, checked against the +/// document's artboards as OK checks them, or what the options write without artboards (also for +/// a document that has none). Linked scripts and images are checked against the read roots in +/// force first. +fn encode_page<'a>( + st: &'a vectorcraft_engine::DocState, + svg: &Value, + selection: bool, +) -> Result<(Cow<'a, vectorcraft_doc::Document>, fileio::Encoded), String> { + let mut opts = svg.clone(); + if let Some(o) = opts.as_object_mut() { + if selection { + // Export Selection writes one crop, without artboards to choose. + for k in fileio::ARTBOARD_PARAMS.iter().chain(&["useArtboards"]) { + o.remove(*k); + } + } else if st.doc.artboards.is_empty() { + for k in fileio::ARTBOARD_PARAMS { + o.remove(k); + } + } else { + let pick: fileio::ArtboardPick = serde_json::from_value(Value::Object(o.clone())).map_err(|e| e.to_string())?; + if let Some(first) = pick.resolve(st.doc.artboards.len())?.and_then(|v| v.first().copied()) { + for k in fileio::ARTBOARD_PARAMS { + o.remove(k); + } + o.insert("artboard".into(), json!(first)); + } + } + } + let params = json!({ "svg": opts }); + fileio::check_linked_scripts("document.export", "svg", st, ¶ms).map_err(|e| e.to_string())?; + let doc = if selection { + Cow::Owned(fileio::selection_doc(st, "document.exportSelection", false).map_err(|e| e.to_string())?.0) + } else { + Cow::Borrowed(&*st.doc) + }; + fileio::check_linked_images("document.export", "svg", st, &doc, ¶ms).map_err(|e| e.to_string())?; + let enc = fileio::encode_all(&doc, "svg", ¶ms).map_err(|e| e.to_string())?; + Ok((doc, enc)) +} + +/// `file.export.svg.browser {svg?, exportSelection?}` (SVG Options' Show in Browser): the SVG file +/// that the SVG options `svg` write for one page ([`encode_page`]), written with its linked images +/// to a new folder inside `VectorCraft SVG Preview` in the system's temporary folder and opened in +/// the default browser (desktop) → `{path, warnings}`. Nothing is written to the chosen +/// destination, and the document, its path and the remembered choices are left as they were. +/// When the export has warnings, the status bar shows them as [`io::report_saved`] shows a save's +/// notes. Nothing opens when a check, the encoding or a write fails. +pub(crate) fn browser_preview(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> { + if io::is_web(app) { + return Err("no file system here".into()); + } + app.refuse_automation(BROWSER)?; + let (selection, p) = io::take_selection(p)?; + let svg = p.get("svg").cloned().unwrap_or_else(|| json!({})); + let (path, warnings) = { + let st = app.session.active().ok_or("no document")?; + let stem = fileio::file_stem(&st.doc.title); + let (doc, enc) = encode_page(st, &svg, selection)?; + let dir = super::save_for_web::temp_folder_under(PREVIEW_ROOT)?; + let target = format!("{dir}/{}.svg", super::save_for_web::preview_name(&stem)); + let named = enc.named(&doc, &target); + for (p, bytes) in &named { + io::write_to(&mut app.services, p, bytes)?; + } + (named.first().map_or(target, |(p, _)| p.clone()), enc.notes()) + }; + app.open_url(&io::file_url(&path)); + let r = json!({ "path": path, "warnings": warnings }); + if !warnings.is_empty() { + io::report_saved(app, &path, &r); + } + Ok(r) +} + /// The SVG the current options write for the first chosen artboard, or under Export Selection for /// the selection alone, cropped to it (read-only, selectable), encoded again only when the /// options, the document or the selection change. @@ -276,19 +389,7 @@ fn code_view(app: &VectorcraftApp, ui: &mut egui::Ui, d: &Dialog) { let t = Tokens::get(ui.ctx()); let Some(st) = app.session.active() else { return }; let selection = d.bool(super::export_as::SELECTION_FIELD); - let mut opts = options(d); - if let Some(o) = opts.as_object_mut() { - if selection { - // Export Selection writes one crop, without artboards to choose. - for k in vectorcraft_engine::cmd::fileio::ARTBOARD_PARAMS.iter().chain(&["useArtboards"]) { - o.remove(*k); - } - } else if let Some(r) = o.remove("range") { - // The first artboard of the range (or the first one). - let first = r.as_str().and_then(|r| r.split([',', '-', '\u{2013}']).next()).and_then(|n| n.trim().parse::<usize>().ok()); - o.insert("artboard".into(), json!(first.map_or(0, |n| n.saturating_sub(1)))); - } - } + let opts = written_options(d); // One cached text, replaced when the document, the options or the selection change. let key = egui::Id::unique("svg-code"); // The read roots in force and the document's folder decide whether the text may be shown. @@ -299,27 +400,15 @@ fn code_view(app: &VectorcraftApp, ui: &mut egui::Ui, d: &Dialog) { Some((_, c)) => c, None => { const MAX: usize = 200_000; - let params = json!({ "svg": opts }); - let encoded = vectorcraft_engine::cmd::fileio::check_linked_scripts("document.export", "svg", st, ¶ms).and_then(|()| { - let selected; - let doc = if selection { - selected = vectorcraft_engine::cmd::fileio::selection_doc(st, "document.exportSelection", false)?.0; - &selected - } else { - &st.doc - }; - vectorcraft_engine::cmd::fileio::check_linked_images("document.export", "svg", st, doc, ¶ms)?; - vectorcraft_engine::cmd::fileio::encode_all(doc, "svg", ¶ms) - }); - let mut text = match encoded { + let mut text = match encode_page(st, &opts, selection) { // Shown as text whatever the file's encoding. - Ok(enc) => enc + Ok((_, enc)) => enc .files .into_iter() .next() .map(|(_, b)| vectorcraft_svg::text_of(&b).map_or_else(|_| String::from_utf8_lossy(&b).into_owned(), |t| t.into_owned())) .unwrap_or_default(), - Err(e) => e.to_string(), + Err(e) => e, }; if text.len() > MAX { let cut = (0..=MAX).rev().find(|i| text.is_char_boundary(*i)).unwrap_or(0); @@ -389,6 +478,153 @@ mod tests { String::from_utf8(w.borrow()[i].1.clone()).unwrap() } + type Opened = Rc<RefCell<Vec<String>>>; + + /// [`app`] whose browser records each URL it is asked to open. + fn browsing(picked: &str) -> (VectorcraftApp, Written, Opened) { + let (mut app, written) = app(picked); + let opened = Opened::default(); + let o = opened.clone(); + app.services.open_url = Some(Box::new(move |u: &str| o.borrow_mut().push(u.to_string()))); + (app, written, opened) + } + + /// Show in Browser for the open dialog's current choices, as its button runs it. + fn show_in_browser(app: &mut VectorcraftApp) -> Result<Value, String> { + let p = preview_params(app.ui.dialog.as_ref().expect("SVG Options open")); + app.run(BROWSER, p) + } + + /// Show in Browser writes the SVG of the dialog's current, unconfirmed choices for the first + /// artboard of the range to a new temporary folder and opens that file once. The dialog stays + /// open, nothing is remembered, and OK then writes the same SVG to the chosen file. + #[test] + fn show_in_browser_opens_what_ok_writes_without_confirming() { + let (mut app, written, opened) = browsing("/tmp/out.svg"); + app.run("file.export.svg", Value::Null).unwrap(); + frame(&mut app); + let f = &mut app.ui.dialog.as_mut().unwrap().fields; + f.insert("decimals".into(), json!(1)); + f.insert("allArtboards".into(), json!(false)); + f.insert("range".into(), json!("2")); + let remembered = app.ui.svg_options.clone(); + let r = show_in_browser(&mut app).unwrap_or_else(|e| panic!("{e}")); + let path = r["path"].as_str().unwrap().to_string(); + assert!(path.contains("/VectorCraft SVG Preview/") && path.ends_with("/Untitled-1.svg"), "{path}"); + assert_eq!(*opened.borrow(), [io::file_url(&path)]); + assert_eq!(written.borrow().len(), 1); + assert_eq!(written.borrow()[0].0, path); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(KIND), "the dialog stays open"); + assert_eq!(app.ui.svg_options, remembered, "nothing is remembered"); + assert!(app.session.active().unwrap().path.is_none()); + frame(&mut app); + super::super::confirm(&mut app).unwrap(); + assert_eq!(written.borrow()[1].0, "/tmp/out.svg"); + assert_eq!(text(&written, 0), text(&written, 1), "the preview is the file OK writes"); + assert_eq!(opened.borrow().len(), 1); + } + + /// A range the document has no artboard for is refused, as OK refuses it: nothing is written + /// or opened, and the dialog stays open. + #[test] + fn show_in_browser_refuses_a_range_the_document_lacks() { + let (mut app, written, opened) = browsing("/tmp/out.svg"); + app.run("file.export.svg", Value::Null).unwrap(); + let f = &mut app.ui.dialog.as_mut().unwrap().fields; + f.insert("allArtboards".into(), json!(false)); + f.insert("range".into(), json!("5")); + assert!(show_in_browser(&mut app).is_err()); + assert!(written.borrow().is_empty() && opened.borrow().is_empty()); + assert!(app.ui.dialog.is_some()); + } + + /// Under Export Selection the preview is the selection alone, cropped to it, as OK writes it. + #[test] + fn show_in_browser_under_export_selection_shows_the_selection() { + let (mut app, written, opened) = browsing("/tmp/selection.svg"); + app.run("shape.rectangle", json!({"x": 70, "y": 40, "width": 20, "height": 20})).unwrap(); + app.run("document.exportSelection", Value::Null).unwrap(); + assert!(app.ui.dialog.as_ref().unwrap().bool(super::super::export_as::SELECTION_FIELD)); + show_in_browser(&mut app).unwrap_or_else(|e| panic!("{e}")); + super::super::confirm(&mut app).unwrap(); + assert_eq!(written.borrow()[1].0, "/tmp/selection.svg"); + assert_eq!(text(&written, 0), text(&written, 1)); + assert_eq!(text(&written, 0).matches("<rect").count(), 1, "{}", text(&written, 0)); + assert_eq!(opened.borrow().len(), 1); + } + + /// From Save As, the preview leaves the document's path and unsaved state alone, and OK still + /// saves to the chosen file. + #[test] + fn show_in_browser_from_save_as_leaves_the_document_unsaved() { + let (mut app, written, opened) = browsing("/tmp/doc.svg"); + app.run("file.saveAs", Value::Null).unwrap(); + let dirty = app.session.active().unwrap().is_dirty(); + show_in_browser(&mut app).unwrap_or_else(|e| panic!("{e}")); + let st = app.session.active().unwrap(); + assert_eq!((st.path.as_deref(), st.is_dirty()), (None, dirty)); + assert_eq!(opened.borrow().len(), 1); + super::super::confirm(&mut app).unwrap(); + assert_eq!(written.borrow()[1].0, "/tmp/doc.svg"); + assert_eq!(app.session.active().unwrap().path.as_deref(), Some("/tmp/doc.svg")); + } + + /// From Save As, a hidden layer is in the preview, kept hidden, as the save keeps it. The two + /// differ only in the title: the save takes it from the file's name, the preview from the + /// document's. + #[test] + fn show_in_browser_from_save_as_keeps_hidden_layers_as_the_save_does() { + let (mut app, written, _) = browsing("/tmp/doc.svg"); + let notes = app.run("layer.new", json!({"name": "Notes"})).unwrap()["id"].clone(); + app.run("shape.ellipse", json!({"x": 60, "y": 10, "width": 20, "height": 20})).unwrap(); + app.run("layer.setProps", json!({"id": notes, "visible": false})).unwrap(); + app.run("file.saveAs", Value::Null).unwrap(); + show_in_browser(&mut app).unwrap_or_else(|e| panic!("{e}")); + super::super::confirm(&mut app).unwrap(); + assert!(text(&written, 0).contains("id=\"Notes\""), "{}", text(&written, 0)); + assert_eq!(text(&written, 0).replace("<title>Untitled-1", "doc"), text(&written, 1)); + } + + /// A document with no artboards is previewed by the bounds of its art, as the SVG writer + /// writes it, rather than refused for its artboard range. + #[test] + fn show_in_browser_previews_a_document_without_artboards() { + let (mut app, written, opened) = browsing("/tmp/out.svg"); + app.run("file.export.svg", Value::Null).unwrap(); + std::sync::Arc::make_mut(&mut app.session.doc_mut().unwrap().doc).artboards.clear(); + show_in_browser(&mut app).unwrap_or_else(|e| panic!("{e}")); + assert_eq!(vectorcraft_testkit::svg_shapes(&text(&written, 0)), 1, "{}", text(&written, 0)); + assert_eq!(opened.borrow().len(), 1); + } + + /// The web build has no file to open, and a control or MCP request may not open another app: + /// both are refused before anything is written or opened. + #[test] + fn show_in_browser_is_refused_on_the_web_and_for_automation() { + let (mut app, written, opened) = browsing("/tmp/out.svg"); + app.run("file.export.svg", Value::Null).unwrap(); + app.ui.answering_control = true; + assert!(show_in_browser(&mut app).unwrap_err().contains("opens another app")); + app.ui.answering_control = false; + app.services.download = Some(Box::new(|_: &str, _: &[u8]| Ok(()))); + assert!(show_in_browser(&mut app).is_err()); + assert!(written.borrow().is_empty() && opened.borrow().is_empty()); + } + + /// SVG previews have their own folder: making one removes only old SVG preview folders and + /// leaves Save for Web's alone. + #[test] + fn svg_preview_folders_leave_save_for_web_previews_alone() { + let tmp = vectorcraft_testkit::temp_dir("svg-preview-folders"); + let web = super::super::save_for_web::preview_folder_in(&tmp, std::time::Duration::from_secs(3600)).unwrap(); + let old = super::super::save_for_web::preview_folder_under(&tmp, PREVIEW_ROOT, std::time::Duration::from_secs(3600)).unwrap(); + let new = super::super::save_for_web::preview_folder_under(&tmp, PREVIEW_ROOT, std::time::Duration::ZERO).unwrap(); + assert!(new.contains("/VectorCraft SVG Preview/"), "{new}"); + assert!(std::path::Path::new(&web).is_dir(), "Save for Web's preview is kept"); + assert!(!std::path::Path::new(&old).exists(), "the old SVG preview is removed"); + assert!(std::path::Path::new(&new).is_dir()); + } + #[test] fn export_as_svg_opens_the_options_and_remembers_them() { let (mut app, written) = app("/tmp/out.svg"); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index bb039bb08e..ec502dda1c 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -3430,6 +3430,7 @@ digits Malayalam Малаялам Show Brush Size Показване на размера на четката Show Center Показване на център Show Code Показване на код + Show in Browser Показване в браузър Show Color Groups Показване на цътни групи Show Color Swatches Показване на цветни образци Show Corner Widget Показване на уиджета за ъгъл diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 99f23d313c..a8cc3a9928 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -3238,6 +3238,7 @@ antiAlias Sharp Oštro Preserve Editing Capabilities Očuvaj mogućnosti uređivanja Responsive Responzivno Show Code Prikaži kod + Show in Browser Prikaži u pregledniku Style Attributes Atributi stila Style Attributes (Entity References) Atributi stila (reference entiteta) Styling: Stilizovanje: diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index c54311799d..fb29a07a52 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -4469,6 +4469,7 @@ digits Malayalam Malaiàlam Show Center Mostra el centre Show Center Mark Mostra la marca del centre Show Code Mostra el codi + Show in Browser Mostra al navegador Show Color Groups Mostra els grups de colors Show Color Swatches Mostra les mostres de color Show Corner Widget Mostra el giny de cantonada diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index a5d7bb948a..785c7e3473 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -3322,6 +3322,7 @@ antiAlias Sharp Ostré Preserve Editing Capabilities Zachovat možnosti úprav Responsive Responzivní Show Code Zobrazit kód + Show in Browser Zobrazit v prohlížeči Style Attributes Atributy stylu Style Attributes (Entity References) Atributy stylu (odkazy na entity) Styling: Stylování: diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 08100f593f..a2718fa359 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5795,6 +5795,7 @@ antiAlias Sharp Skarp Preserve Editing Capabilities Bevar redigeringsfunktioner Responsive Responsiv Show Code Vis kode + Show in Browser Vis i browser Style Attributes Stilattributter Style Attributes (Entity References) Stilattributter (enhedsreferencer) Styling: Styling: diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 10147b2d45..761255c76b 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -3496,6 +3496,7 @@ digits Malayalam Malayalam Show Brush Size Pinselgröße anzeigen Show Center Mittelpunkt anzeigen Show Code Code einblenden + Show in Browser Im Browser anzeigen Show Color Groups Farbgruppen einblenden Show Color Swatches Farbfelder einblenden Show Corner Widget Ecken-Widget einblenden diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 1ebf6e5684..62fc0cb6e2 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -4177,6 +4177,7 @@ digits Malayalam Μαλαγιάλαμ Show Brush Size Εμφάνιση μεγέθους πινέλου Show Center Εμφάνιση κέντρου Show Code Εμφάνιση κώδικα + Show in Browser Εμφάνιση στο πρόγραμμα περιήγησης Show Color Groups Εμφάνιση ομάδων χρωμάτων Show Color Swatches Εμφάνιση δειγμάτων χρωμάτων Show Corner Widget Εμφάνιση στοιχείου γωνιών diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index a456910a16..cdc2d11756 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -3532,6 +3532,7 @@ digits Malayalam Malayálam Show Brush Size Mostrar tamaño del pincel Show Center Mostrar centro Show Code Mostrar código + Show in Browser Mostrar en el navegador Show Color Groups Mostrar grupos de colores Show Color Swatches Mostrar muestras de color Show Corner Widget Mostrar widget de esquina diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index bff46fc0d7..d1a2a0bdbe 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -3266,6 +3266,7 @@ antiAlias Sharp Terävä Preserve Editing Capabilities Säilytä muokkausominaisuudet Responsive Responsiivinen Show Code Näytä koodi + Show in Browser Näytä selaimessa Style Attributes Tyyliattribuutit Style Attributes (Entity References) Tyyliattribuutit (entiteettiviittaukset) Styling: Tyylit: diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3be3497f97..1f5602d0eb 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -3520,6 +3520,7 @@ digits Malayalam Malayalam Show Brush Size Afficher la taille de la forme Show Center Afficher le centre Show Code Afficher le code + Show in Browser Afficher dans le navigateur Show Color Groups Afficher les groupes de couleurs Show Color Swatches Afficher les nuances de couleur Show Corner Widget Afficher le widget d’angle diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index c427fc527c..9b777e7543 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3663,6 +3663,7 @@ Show Center કેન્દ્ર બતાવો Show Center Mark કેન્દ્ર ચિહ્ન બતાવો Show Code કોડ બતાવો + Show in Browser બ્રાઉઝરમાં બતાવો Show Corner Widget કોર્નર વિજેટ બતાવો Show Cross Hairs ક્રોસ હેર બતાવો Show East Asian Options પૂર્વ એશિયન વિકલ્પો બતાવો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index cbfb4f51d1..efc6b79dcb 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -4792,6 +4792,7 @@ antiAlias Sharp शार्प Show Center केंद्र दिखाएँ Show Center Mark शो सेंटर मार्क Show Code कोड दिखाएं + Show in Browser ब्राउज़र में दिखाएँ Show color bars रंग सलाखों दिखाएँ Show brightness and hue on wheel व्हील पर ब्राइटनेस और ह्यू दिखाएँ Show saturation and hue on wheel व्हील पर सैचुरेशन और ह्यू दिखाएँ diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0f81a72036..741252cbcc 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4184,6 +4184,7 @@ mark-style Japanese Japán Show Brush Size Ecsetméret megjelenítése Show Center Középpont megjelenítése Show Code Kód megjelenítése + Show in Browser Megjelenítés böngészőben Show Color Groups Színcsoportok megjelenítése Show Color Swatches Színes színminták megjelenítése Show Corner Widget Sarokfogantyú megjelenítése diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 28ea2b5ab3..03622ea4c3 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3047,6 +3047,7 @@ antiAlias Sharp Tajam Preserve Editing Capabilities Pertahankan kemampuan pengeditan Responsive Responsif Show Code Tampilkan kode + Show in Browser Tampilkan di browser Style Attributes Atribut gaya Style Attributes (Entity References) Atribut gaya (referensi entitas) Styling: Penataan gaya: diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 8f2ed3216c..5b8f661ec2 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -3577,6 +3577,7 @@ digits Malayalam Malayalam Show Brush Size Mostra dimensione pennello Show Center Mostra centro Show Code Mostra codice + Show in Browser Mostra nel browser Show Color Groups Mostra gruppi colori Show Color Swatches Mostra campioni colore Show Corner Widget Mostra widget angolo diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c429f204a1..1a07fa59f2 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -3391,6 +3391,7 @@ mark-style Japanese 日本式 Show Brush Size ブラシサイズを表示 Show Center 中心を表示 Show Code コードを表示 + Show in Browser ブラウザーで表示 Show East Asian Options 東アジアのオプションを表示 Show Find Field 検索フィールドを表示 Show Font Names in English フォント名を英語で表示 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 414f45171c..4f9ba3a354 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5136,6 +5136,7 @@ antiAlias Sharp მკვეთრი Preserve Editing Capabilities რედაქტირების შესაძლებლობების შენარჩუნება Responsive ადაპტური Show Code კოდის ჩვენება + Show in Browser ბრაუზერში ჩვენება Style Attributes სტილის ატრიბუტები Style Attributes (Entity References) სტილის ატრიბუტები (ერთეულის მიმართვები) Styling: სტილი: diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index dbda53243f..580e38a041 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -3380,6 +3380,7 @@ mark-style Japanese 일본식 Show Brush Size 브러시 크기 표시 Show Center 중심 표시 Show Code 코드 표시 + Show in Browser 브라우저에서 보기 Show East Asian Options 동아시아 옵션 표시 Show Find Field 찾기 필드 표시 Show Font Names in English 글꼴 이름을 영어로 표시 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 69aef91cfc..ac8d6ace3b 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -3669,6 +3669,7 @@ antiAlias Sharp Scherp Preserve Editing Capabilities Bewerkbaarheid behouden Responsive Responsive Show Code Code weergeven + Show in Browser Tonen in browser Style Attributes Stijlattributen Style Attributes (Entity References) Stijlattributen (entiteitsverwijzingen) Styling: Stijl: diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0147515ffe..5fa7d6e783 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3207,6 +3207,7 @@ antiAlias Sharp Ostre Preserve Editing Capabilities Zachowaj możliwości edycji Responsive Responsywny Show Code Pokaż kod + Show in Browser Pokaż w przeglądarce Style Attributes Atrybuty stylu Style Attributes (Entity References) Atrybuty stylu (odwołania do encji) Styling: Stylizacja: diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 8201db7ab6..9fa8563f5d 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -2975,6 +2975,7 @@ digits Malayalam Malaiala Show Brush Size Mostrar Tamanho do Pincel Show Center Mostrar Centro Show Code Mostrar Código + Show in Browser Mostrar no Navegador Show Corner Widget Mostrar Widget de Canto Show East Asian Options Mostrar Opções do Leste Asiático Show Edges Mostrar Bordas diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index d1593508d3..e4909daf38 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -3564,6 +3564,7 @@ digits Malayalam Малаялам Show Brush Size Показать размер кисти Show Center Показать центр Show Code Показать код + Show in Browser Показать в браузере Show Color Groups Показать цветовые группы Show Color Swatches Показать цветовые образцы Show Corner Widget Показать угловой виджет diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 5c0420fcd3..5d24908f97 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -3450,6 +3450,7 @@ digits Malayalam Malayalam Show Brush Size Visa penselstorlek Show Center Visa mittpunkt Show Code Visa kod + Show in Browser Visa i webbläsare Show Color Groups Visa färggrupper Show Color Swatches Visa färgrutor Show Corner Widget Visa hörnwidget diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 910a7fc5b1..65df6b999c 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3322,6 +3322,7 @@ digits Malayalam Malayalam Show Brush Size Fırça Boyutunu Göster Show Center Gösteri Merkezi Show Code Kodu Göster + Show in Browser Tarayıcıda Göster Show Color Groups Renk Gruplarını Göster Show Color Swatches Renk Örneklerini Göster Show Corner Widget Köşe Widget'ını Göster diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index dbd6d2609e..e71983925d 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -3569,6 +3569,7 @@ digits Malayalam Малаялам Show Brush Size Показати розмір пензля Show Center Показати центр Show Code Показати код + Show in Browser Показати у браузері Show Color Groups Показати групи кольорів Show Color Swatches Показати колірні зразки Show Corner Widget Показати кутовий віджет diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 519c5d8f0d..143f008bf0 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -3934,6 +3934,7 @@ mark-style Japanese Kiểu Nhật Show Brush Size Hiện kích thước cọ Show Center Hiện tâm Show Code Hiện mã + Show in Browser Hiện trong trình duyệt Show Color Groups Hiện nhóm màu Show Color Swatches Hiện mẫu màu Show Corner Widget Hiện widget góc diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index c6696a9ec6..a97191f13c 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -3392,6 +3392,7 @@ digits Malayalam 马拉雅拉姆数字 Show Brush Size 显示画笔大小 Show Center 显示中心点 Show Code 显示代码 + Show in Browser 在浏览器中显示 Show Color Groups 显示颜色组 Show Color Swatches 显示颜色色板 Show Corner Widget 显示转角 Widget diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 1480422931..e9ed5469be 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -4710,6 +4710,7 @@ digits Malayalam 馬來亞拉姆數字 Show Brush Size 顯示筆刷大小 Show Center 顯示中心點 Show Code 顯示程式碼 + Show in Browser 在瀏覽器中顯示 Show Color Groups 顯示顏色群組 Show Color Swatches 顯示顏色色票 Show Corner Widget 顯示轉角 Widget diff --git a/crates/ui-egui/src/io.rs b/crates/ui-egui/src/io.rs index a2b1cbebab..a42ce0a656 100644 --- a/crates/ui-egui/src/io.rs +++ b/crates/ui-egui/src/io.rs @@ -24,7 +24,7 @@ mod tests_read_only_save; pub use export::{EXPORT_CANCELLED, cancel_exports, export, export_for_screens, export_pdf, hide_exports, reveal, save_command_output}; pub(crate) use export::{ EXPORT_SELECTION, export_files, exported_with_notes, file_url, open_in_app, open_original, reveal_path, run_to_file, save_command_output_named, - selection_path, + selection_path, take_selection, }; pub(crate) use open::report_installed; pub(crate) use open::{EXPORT_PRESETS, import_presets, open_notes, open_with_on, opened, opened_after_notice, show_opened}; diff --git a/crates/ui-egui/src/io/export.rs b/crates/ui-egui/src/io/export.rs index 32733d855c..18fbe487f7 100644 --- a/crates/ui-egui/src/io/export.rs +++ b/crates/ui-egui/src/io/export.rs @@ -15,7 +15,7 @@ pub(crate) const EXPORT_SELECTION: &str = "exportSelection"; /// `params` without [`EXPORT_SELECTION`], and whether it asked for the selection. A selection /// export writes one page, the selection's crop, so the artboard choices are left out too. -fn take_selection(params: &Value) -> Result<(bool, Value), String> { +pub(crate) fn take_selection(params: &Value) -> Result<(bool, Value), String> { let mut p = params.clone(); let Some(o) = p.as_object_mut() else { return Ok((false, p)) }; match o.remove(EXPORT_SELECTION) { diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index b4e1c668ac..6118aed51f 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -219,6 +219,7 @@ fn run_ui_part2(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option io::export(app, Some("svg"), s("path"), p), + "file.export.svg.browser" => crate::dialogs::svg_options::browser_preview(app, p), "file.exportForScreens" if p.as_object().is_none_or(|o| o.is_empty()) => { crate::dialogs::open_export_for_screens(app); Ok(Value::Null) diff --git a/crates/ui-egui/src/menus/state.rs b/crates/ui-egui/src/menus/state.rs index d4dda4698b..7df83ac0f3 100644 --- a/crates/ui-egui/src/menus/state.rs +++ b/crates/ui-egui/src/menus/state.rs @@ -317,7 +317,7 @@ pub fn enabled(app: &VectorcraftApp, id: &str) -> bool { "ui.packageDialog" | "docInfo.save" => app.session.active().is_some(), "ui.batchDialog" => !app.ui.action_sets.is_empty() && app.ui.action_sets.iter().any(|s| !s.actions.is_empty()), "ui.epsOptionsDialog" => app.session.active().is_some(), - "file.saveForWeb" | "file.saveForWeb.browser" => app.session.active().is_some(), + "file.saveForWeb" | "file.saveForWeb.browser" | "file.export.svg.browser" => app.session.active().is_some(), "file.exportSelection" => app.session.active().is_some_and(|d| !d.selection.is_empty()), "css.copy" | "css.exportFile" => app.session.active().is_some(), "print.printerSetup" => app.services.print.as_ref().is_some_and(|s| s.has_setup()), diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 677b804720..8d03abfb51 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -144,6 +144,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{} opens SVG Options; with params = document.export {path?, svg?: {…SVG options}, range?…} (a .svgz path writes it gzipped)", ), + ( + "file.export.svg.browser", + "Show in Browser", + "", + "{svg?: {…SVG options}, exportSelection?} SVG Options' Show in Browser: write the SVG of one page (with exportSelection the selection's crop, else the first artboard the options choose) and its linked images to a new temporary folder and open it in the default browser (desktop; refused for control and MCP requests) → {path, warnings}", + ), ("file.export.png", "Export As PNG…", "", "{path?, …document.export options}; no path: pick the file, then PNG Options"), ( "file.exportForScreens", diff --git a/docs/control-protocol.md b/docs/control-protocol.md index adac088a13..9b59d81647 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -112,7 +112,7 @@ the two can still win that race. | `ui.dialog.*` on `gradientStop` | `{field: "color" \| "opacity" \| "location", value}` | double-clicking a stop on the Gradient tool's annotator opens its popover (fields `index`, `x`, `y`, `tab`); set `color` (hex), `opacity` or `location` (percentages) and `ui.dialog.confirm` to apply them to the selected stop. `gradient.selectStop {index}` picks the stop the annotator, the panels and Delete/←/→ (`ui.key`) act on | | `engine.execute` `ui.savePdfDialog` | `{path?, preset?, range?, …document.exportPdf options}` | opens the Save PDF dialog (`file.export.pdf` with no params opens it too). Its fields are the `document.exportPdf` options: set `compatibility` with `ui.dialog.set {field: "compatibility", value: "1.5"}`, a whole section with `{field: "compression", value: {…}}`, the artboards with `__allArtboards: false` and `range`, the visible section with `__section` (General, Compression, Marks and Bleeds, Output, Advanced, Security, Summary). `useArtboards: false` opens it for one page of the visible art's bounds, as Export As with Use Artboards off does: the dialog has no Artboards section and its `__artBounds` field is true. `ui.dialog.confirm` writes `path` (else asks for one), returns `{path, bytes, warnings}` and opens the file when `viewAfterSaving` is set. With `useArtboards: false` it writes the page as `app.export` does and returns `{path, warnings}`, or `{background: true, status}` while Background Export writes it | | `file.save` / `file.saveAs` / `file.saveCopy` / `file.saveAsTemplate` (via `engine.execute`) | `{path?, format?, options?, svg?}` | Save writes the document's own file in its own format (a document opened from or saved as SVG/PDF saves as that again; the result's `warnings` say what the format loses). With `path` the file is written at once (Save As or a Copy to an SVG path without SVG options first opens SVG Options, below). Without one (never saved, a converted older file, Save As, a Copy, a Template) the app shows a save panel with one file type per save format (`vectorcraft`, `template`, `pdf`, `svg`, `svgz`, `ai`; for a Template, `template` and `ait`), then the format's options: SVG opens the `svgOptions` dialog (below; returns `{"pending": "svgOptions", "path"}`), PDF the `savePdf` dialog (its `__save` field names the save command); `ui.dialog.confirm` finishes the save. A name typed in the panel without the file type's extension gets it, and a name the panel returns with the extension of a format the panel does not list has it replaced (in a native save, `card.png` and `card.ait` are saved as `card.vectorcraft`, and `notes.v2`, whose extension names no format, is saved as `notes.v2.vectorcraft`); when a file of that name exists, which the panel did not ask about, the save (and every export or other write through a save panel) answers `cancelled` and opens a `replaceFile` dialog (fields `message`, `detail`, `path`): `ui.dialog.confirm` writes that file, `ui.dialog.cancel` writes nothing. A save or export that writes other files beside that path (a file per artboard, linked images, image maps) checks them before it writes anything: when any of them exists, it writes nothing and opens a `replaceFiles` dialog (fields `message`, `detail` (each file's name when there are several), `files`, `__command`, `__params`; the reply is `{"pending": "replaceFiles"}`, or comes once a Background Save or Export ends): `ui.dialog.confirm` runs the save or export again and replaces them, `ui.dialog.cancel` writes nothing; a dialog open when a background job asks stays open, and the question follows it. A save does not ask about the files the document's last Save or Save As in this session wrote. On the web a `saveOptions` dialog (fields `path`, `format`) first names the file and picks the format. `file.formatOptions {format?}` reads the options a save would use. `file.revert` opens a `confirm` dialog (`{"pending": "confirm"}`); `ui.dialog.confirm` reloads the saved file in the same tab. Location refusals return `READ_ONLY_LOCATION: ` without a fallback panel for automation; see [Save location errors](#save-location-errors). | -| SVG Options (`engine.execute` of `file.export.svg`, `file.saveAs`, `file.saveCopy`) | `{}` / `{path?, svg?: {…}}` | `file.export.svg` without params, and Save As or Save a Copy to an `.svg`/`.svgz` path without SVG options, open the `svgOptions` dialog (`ui.dialog.set` its fields: `styling`, `outlineText`, `images`, `objectIds`, `decimals`, `minify`, `responsive`, `fewerTspans`, `metadata`, `preserveEditing`, `useArtboards`, `allArtboards`, `range`, `showCode`, `profile` (`svg11`/`tiny12`), `encoding` (`utf8`/`utf16`/`latin1`), `embedFonts`; `ui.dialog.confirm` exports or saves and remembers the choices). With `svg: {…}` (the `document.formats` SVG options) they run directly. `app.save {path?, svg?}` takes the same options; a document saved as SVG saves as SVG again with the same options | +| SVG Options (`engine.execute` of `file.export.svg`, `file.saveAs`, `file.saveCopy`) | `{}` / `{path?, svg?: {…}}` | `file.export.svg` without params, and Save As or Save a Copy to an `.svg`/`.svgz` path without SVG options, open the `svgOptions` dialog (`ui.dialog.set` its fields: `styling`, `outlineText`, `images`, `objectIds`, `decimals`, `minify`, `responsive`, `fewerTspans`, `metadata`, `preserveEditing`, `useArtboards`, `allArtboards`, `range`, `showCode`, `profile` (`svg11`/`tiny12`), `encoding` (`utf8`/`utf16`/`latin1`), `embedFonts`; `ui.dialog.confirm` exports or saves and remembers the choices). The dialog's Show in Browser button (`file.export.svg.browser`) writes the SVG of the current choices for one page to a temporary folder and opens it in the default browser, leaving the dialog open; a request through `engine.execute` is refused because it opens another app. With `svg: {…}` (the `document.formats` SVG options) they run directly. `app.save {path?, svg?}` takes the same options; a document saved as SVG saves as SVG again with the same options | | `engine.execute` `file.place` | `{paths?}` / `{path \| name+dataBase64, …file.place params}` | with no file, picks files and opens the `place` dialog; with `paths`, opens it for them (fields `files`, `link`, `template`, `replace`; `__replace` says whether Replace applies, `__info` describes each file). `ui.dialog.confirm` places one file centered in the view (or in place of the selected object) and loads the place cursor with several (`file.place.queue`). In the desktop app the dialog reads its files off the UI thread: `__info` is empty until they are read, `ui.dialog.confirm` returns `{background: true, status}`, `ui.inspect` lists the files still being read in `placing`, and the file is placed (or the cursor loaded) once it is read. With a file, it runs `file.place` centered in the view, at once. Files dropped on the window with no document open open. On the web, files dropped on the canvas are placed at the drop point (linked; Shift embeds) and files dropped off it (the tab bar) open, as in Illustrator; desktop drops carry no pointer position, so documents (native, SVG, PDF, `.ai`, EPS, DXF, EMF/WMF) open as tabs of their own and pictures and text are placed in the middle of the view. Swatch libraries and color books (`.vcswatches`, `.gpl`, `.ase`, `.acb`), graphic style libraries (`.vcstyles`), Libraries panel files (`.vclibrary`), presets (`.vcflattener`, `.vcpdfpresets`, `.vcprintpresets`, `.vcperspective`, `.vcexportpresets`), plug-ins (`.wasm`) and shortcut sets (`.kys`, in Import Shortcut Set) open wherever they are dropped, as File › Open opens them. With the cursor loaded (`ui.inspect` → `tool: "place"`, `toolOptions: {count, current, name, names}`), `ui.pointer` clicks and drags place files (in the desktop app each file is read off the UI thread and placed once it is read, and `ui.inspect` lists it in `placing` until then) and `ui.key` ←/→/↑/↓ and Escape cycle and discard them | | `app.export` raster options | `{path?, format: png \| jpg \| webp, ppi?, width?, height?, background?, antiAlias?, interlaced?, quality?}` | `ppi` sets the pixel size (72 = one pixel per point) and is stored in PNG and JPEG files (WebP files store no resolution); `width` or `height` sets the size of each file in pixels instead (`width` wins), and PNG and JPEG files store the resolution that results; `background` is `transparent`, `white`, `black` or `"#rrggbb"`; `antiAlias` is `none`, `art` or `type` (text snapped to pixels); `interlaced` writes an Adam7 PNG. The PNG Options dialog (`pngOptions`; `jpgOptions` / `webpOptions` for the other raster formats) has the same fields: fill them with `ui.dialog.set` and press OK with `ui.dialog.confirm` | | `app.export` JPEG options | `{path?, format: jpg, quality?: 0–100, colorModel?: rgb \| cmyk \| gray, method?: baseline \| optimized \| progressive, scans?: 3–5, embedIcc?, imageMap?: none \| client \| server}` | `cmyk` writes ink amounts in the working CMYK space (CMYK colours keep their inks; RGB ones are separated with the colour settings); `embedIcc` (default true) embeds sRGB, the working CMYK profile or a grey profile, generated by the CMS; `imageMap` also writes `.html` (client-side ``) or `.map` (NCSA) beside the image for the objects with a URL and an Image Map shape (`attributes.set`), returned in `linked`. The `jpgOptions` dialog has these fields too (`quality` is shown 0–10; a CMYK document defaults to `cmyk`) | diff --git a/docs/mcp.md b/docs/mcp.md index 4c1b661f42..31be1bbd75 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -244,7 +244,8 @@ the suite) keep the agent to the folders you give it: `export`), `document.exportSelection`, `document.exportForScreens` and `assets.export` (before the folder is made or any row is written), `document.save`, `file.save`, `file.saveAs` and `file.saveCopy` (also a save without a path of a document whose own format is SVG or SVGZ), `file.exportAs`, and the SVG Options dialog's - Show Code. The same error refuses, before any file is written, every output that carries the native document, + Show Code. The dialog's Show in Browser (`file.export.svg.browser`) runs the same checks, and a control or MCP + request for it is refused before it writes a file, since it opens another app. The same error refuses, before any file is written, every output that carries the native document, which holds the link: a native file or template, an EPS file, a `.ai` or `.ait` file of every artboard (not a legacy version 7 `.ai` file; a save of a `.ai` file always has every artboard), a PDF of every artboard with Preserve Editing on (also from `document.exportPdf`), and `file.package` (also when a linked native document, diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index ef83de54ad..7a790d6ec0 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -891,6 +891,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Export for Screens with Include Bleed: a PDF row's page keeps the artboard as its TrimBox and puts the bleed around it once as the BleedBox (a 100 pt artboard with a 9 pt document bleed gives a 100 pt TrimBox in a 118 pt BleedBox, in one file per artboard, a single file and the Full Document), so printer's marks line up with the artboard's edge. The bleed is the row's own (zero included, which a PDF/X row warns about), else the document's when the row sets none and its PDF preset gives none or a bleed of 0; raster, SVG and EPS rows still write the grown artboard. Tests: `fileio::tests_screens::include_bleed_pdf_pages_trim_at_the_artboard` and `include_bleed_pdfx_rows_do_not_warn_about_the_bleed`. - Export for Screens refuses `pdfs: "single"` with `assets`, `layers` or `selection: "each"`, whose files each hold one item's art, instead of writing the first item alone as one PDF named after the document; `pdfs: "multiple"` writes a PDF of each item, and the selection as one file writes one PDF either way. The rule is VectorCraft's own. Tests: `fileio::tests_screens::single_file_pdfs_are_refused_for_assets_layers_and_each_object`. - Save for Web: Preview in Browser writes each preview's page and images to a folder of its own inside `VectorCraft Save for Web` in the system's temporary folder. A later preview, from the same app or another one running, does not overwrite an earlier one. Each preview first removes the preview folders there that are an hour old or older and, on Linux, macOS and FreeBSD, belong to the current user; it leaves other files and folders alone. The folders a preview makes there are open to their owner only on those systems. When `VectorCraft Save for Web` is a link or is not a folder, or on those systems belongs to another user or can be written by other users, the preview goes to a new folder of its own in the temporary folder, which a later preview removes once it is an hour old (`file.saveForWeb.browser`). + - SVG Options: Show in Browser opens the SVG in the default web browser, beside Show Code, which shows the code instead; the SVG export options on the help page (https://helpx.adobe.com/illustrator/desktop/save-and-export/export-files-to-different-formats/export-file-format-options-in-illustrator.html) list both. VectorCraft writes the SVG of the dialog's current choices for one page to a new folder inside `VectorCraft SVG Preview` in the system's temporary folder, which is kept and cleaned up as Save for Web's previews are, and the dialog stays open without remembering the choices or writing the chosen file. The page is VectorCraft's own choice: under Export Selection the selection's crop, otherwise the first artboard the options choose, and a range the document does not have is an error. The web build disables the button, and control and MCP requests for `file.export.svg.browser` are refused. `crates/ui-egui/src/dialogs/svg_options.rs` (`show_in_browser_opens_what_ok_writes_without_confirming`, `show_in_browser_is_refused_on_the_web_and_for_automation`, `svg_preview_folders_leave_save_for_web_previews_alone`). - Save for Web: Optimize to File Size… opens rows for a desired file size in K, Start With (Current Settings, Auto Select GIF/JPEG) and, with slices, Use (Total of All Slices, Each Slice, Current Slice); OK takes the settings whose files fit and shows the size found, or says that no setting tried fits ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=395)). The search lowers JPEG quality or palette colors (GIF then lossy) and encodes at most 32 trial settings; Auto Select chooses GIF for transparent art or art of at most 256 colors and JPEG otherwise. The slices share one setting, so every Use choice changes all of them (`webExport.optimizeToFileSize`). Scores and estimates are unchanged. - Save for Web: while Alt (Option on macOS) is held, the dialog's Cancel button reads Reset, which puts the remembered settings back on the document's active artboard and leaves the dialog open (`ui.dialogReset`). - Export for Screens, Save for Web (slice images, and files named after the document's title) and the Libraries panel name files with the characters Windows does not allow written as `-` and with a `-` after a Windows device name such as `CON`, on every platform (`document.exportForScreens`, `document.exportForWeb`, `library.create`). From cc759b0135df204899d229c92d031e2e2312656a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 13:44:53 -0800 Subject: [PATCH 080/158] Document Setup: the Transparency tab previews the grid A checkered box to the right of Grid Size and Grid Colors shows the grid the dialog holds before OK: the chosen square size and the two colors, the first in the top-left square. It is drawn with the canvas's own transparency grid tile and cell size, through the same display profile, so it matches the canvas for every size and color pair. It changes nothing in the document, and Simulate Colored Paper and View > Show Transparency Grid do not change it. A grid value the dialog cannot read shows as the document's setting. The canvas's tile code now takes the colors and a cache key, so the dialog's tile is cached apart from the canvas's. --- crates/ui-egui/src/canvas.rs | 2 +- crates/ui-egui/src/canvas/grid.rs | 19 ++- crates/ui-egui/src/dialogs/document_setup.rs | 165 +++++++++++++++++++ docs/target-app-parity.md | 1 + 4 files changed, 182 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 70c8834c2d..a7cc04f216 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -52,7 +52,7 @@ use fill::{fill_view, polygon_area}; #[cfg(test)] use grid::ruler_rects; use grid::{LineLook, PIXEL_GRID, PIXEL_GRID_ZOOM, checker, clip_segment, grid, ruler_input, rulers, rulers_hidden, textured_quad, view_bounds}; -pub(crate) use grid::{RulerScale, checker_texture, ruler_label, ruler_origin_dragging}; +pub(crate) use grid::{RulerScale, checker_texture, checker_tile, ruler_label, ruler_origin_dragging}; #[cfg(test)] pub(crate) use grid::{TRANSPARENCY_GRID, vertical_label_height}; use home::home; diff --git a/crates/ui-egui/src/canvas/grid.rs b/crates/ui-egui/src/canvas/grid.rs index 84adb0d861..21353fc529 100644 --- a/crates/ui-egui/src/canvas/grid.rs +++ b/crates/ui-egui/src/canvas/grid.rs @@ -11,20 +11,31 @@ pub(crate) fn checker_texture( setup: &vectorcraft_doc::DocSetup, display: Option<&vectorcraft_color::cms::display::DisplayTransform>, ) -> (egui::TextureHandle, f32) { - let colors = setup.grid_colors.map(|c| crate::display_profile::color32(display, crate::panels::c32(&c))); // A tile of its own with a display profile, so a preview drawn in sRGB beside the canvas // doesn't make the canvas's tile again each frame. let id = egui::Id::unique("transparency-grid-tile").with(display.is_some()); + (checker_tile(ctx, setup.grid_colors, display, id), setup.grid_size.cell()) +} + +/// The transparency grid's 2 × 2-cell tile in the colors `grid_colors` (the first in the top-left +/// and bottom-right cells), converted into the display profile `display` when there is one, and +/// cached under `id` until the colors change. +pub(crate) fn checker_tile( + ctx: &egui::Context, + grid_colors: [vectorcraft_color::Color; 2], + display: Option<&vectorcraft_color::cms::display::DisplayTransform>, + id: egui::Id, +) -> egui::TextureHandle { + let colors = grid_colors.map(|c| crate::display_profile::color32(display, crate::panels::c32(&c))); let cached = ctx.data(|d| d.get_temp::<([Color32; 2], egui::TextureHandle)>(id)).filter(|(c, _)| *c == colors); - let tex = cached.map(|(_, t)| t).unwrap_or_else(|| { + cached.map(|(_, t)| t).unwrap_or_else(|| { let [a, b] = colors; let img = egui::ColorImage::new([2, 2], vec![a, b, b, a]); let opts = egui::TextureOptions { wrap_mode: egui::TextureWrapMode::Repeat, ..egui::TextureOptions::NEAREST }; let t = ctx.load_texture(TRANSPARENCY_GRID, img, opts); ctx.data_mut(|d| d.insert_temp(id, (colors, t.clone()))); t - }); - (tex, setup.grid_size.cell()) + }) } /// Name of the transparency grid's texture. diff --git a/crates/ui-egui/src/dialogs/document_setup.rs b/crates/ui-egui/src/dialogs/document_setup.rs index f1fa79018c..f6feea4f91 100644 --- a/crates/ui-egui/src/dialogs/document_setup.rs +++ b/crates/ui-egui/src/dialogs/document_setup.rs @@ -180,9 +180,58 @@ fn grid_color_box_id(index: usize) -> egui::Id { egui::Id::unique(("grid-color-box", index)) } +/// The size of the Transparency tab's grid preview, in points. +const GRID_PREVIEW: egui::Vec2 = egui::vec2(112.0, 72.0); + +/// The grid size and the two colors the grid preview shows for the dialog's fields `fields`, read +/// as `document.setup` reads them (a preset name or two colors): a field that is missing or not a +/// valid value shows as `setup`, the document's setting. +fn preview_grid(fields: &Map, setup: &vectorcraft_doc::DocSetup) -> (GridSize, [vectorcraft_color::Color; 2]) { + let size = fields.get("gridSize").and_then(Value::as_str).and_then(GridSize::parse).unwrap_or(setup.grid_size); + let colors = match fields.get("gridColors") { + Some(Value::String(name)) => GRID_COLOR_PRESETS.iter().find(|(n, _)| n.eq_ignore_ascii_case(name)).map(|(_, pair)| *pair), + Some(Value::Array(a)) if a.len() == 2 => a.iter().map(vectorcraft_engine::cmd::color_value).collect::>>().map(|c| [c[0], c[1]]), + _ => None, + }; + (size, colors.unwrap_or(setup.grid_colors)) +} + +/// The checkered preview of the grid the dialog's Grid Size and Grid Colors hold, drawn with the +/// canvas's transparency grid tile and cell size: the first color in the top-left cell. It goes +/// beside the rows that start at `top`, against the right edge, or below them when they leave no +/// room. It shows the grid whatever Simulate Colored Paper and View › Show Transparency Grid are, +/// and changes nothing in the document. +fn grid_preview(app: &VectorcraftApp, ui: &mut egui::Ui, d: &Dialog, top: f32) { + let t = Tokens::get(ui.ctx()); + let fallback = vectorcraft_doc::DocSetup::default(); + let setup = app.session.active().map_or(&fallback, |st| &st.doc.setup); + let (size, colors) = preview_grid(&d.fields, setup); + let right = ui.max_rect().right(); + let rect = if ui.min_rect().right() + 16.0 + GRID_PREVIEW.x <= right { + egui::Rect::from_min_size(egui::pos2(right - GRID_PREVIEW.x, top), GRID_PREVIEW) + } else { + ui.add_space(4.0); + ui.allocate_exact_size(GRID_PREVIEW, egui::Sense::hover()).0 + }; + let resp = ui.interact(rect, grid_preview_id(), egui::Sense::hover()); + resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Image, true, tl!("Transparency Grid"))); + let display = app.display_profile.transform(app.session.prefs.monitor_profile_display); + let id = egui::Id::unique("document-setup-grid-preview").with(display.is_some()); + let tile = crate::canvas::checker_tile(ui.ctx(), colors, display.as_deref(), id); + let uv = egui::Rect::from_min_max(egui::Pos2::ZERO, (rect.size() / (2.0 * size.cell())).to_pos2()); + ui.painter().image(tile.id(), rect, uv, egui::Color32::WHITE); + ui.painter().rect_stroke(rect, 0.0, egui::Stroke::new(1.0, t.input_border), egui::StrokeKind::Outside); +} + +/// The id of the Transparency tab's grid preview. +fn grid_preview_id() -> egui::Id { + egui::Id::unique("grid-preview") +} + fn transparency(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { let t = Tokens::get(ui.ctx()); widgets::subheader(ui, tl!("Transparency Grid")); + let top = ui.cursor().top(); let sizes: Vec<(&str, &str)> = GridSize::ALL.iter().map(|g| (g.id(), g.label())).collect(); choice(ui, d, "gridSize", tl!("Grid Size:"), &sizes); let colors: Vec = d @@ -239,6 +288,7 @@ fn transparency(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { ui.add_space(10.0); } }); + grid_preview(app, ui, d, top); if let Some((i, c)) = pick { *d = super::color_picker::over_list_entry(d, "gridColors", i, c); } @@ -792,4 +842,119 @@ mod tests { assert_eq!(app.session.active().unwrap().doc.setup.grid_colors, LIGHT.map(hex)); assert_eq!(undo_steps(&app), 0); } + + /// The grid preview Document Setup draws, in a fresh context: its rect, the texture + /// coordinates of its bottom-right corner (two cells per unit) and the tile's four pixels. + fn grid_preview(app: &mut VectorcraftApp) -> (Rect, egui::Vec2, Vec) { + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + crate::theme::apply(&ctx, Default::default()); + let (mut mesh, mut pixels) = (None, None); + for _ in 0..3 { + let raw = egui::RawInput { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(1200.0, 900.0))), ..Default::default() }; + let mut out = ctx.run_ui(raw, |ui| crate::dialogs::show(app, ui.ctx())); + let tiles: Vec = + ctx.tex_manager().read().allocated().filter(|(_, m)| m.name == crate::canvas::TRANSPARENCY_GRID).map(|(id, _)| *id).collect(); + for (id, deltas) in &out.textures_delta.set { + if tiles.contains(id) + && let Some(d) = deltas.last() + { + let egui::ImageData::Color(img) = &d.image; + pixels = Some(img.pixels.clone()); + } + } + out.textures_delta.clear(); + mesh = out.shapes.iter().find_map(|c| match &c.shape { + egui::Shape::Mesh(m) if tiles.contains(&m.texture_id) => Some(m.clone()), + _ => None, + }); + } + let mesh = mesh.unwrap_or_else(|| panic!("no grid preview")); + let uv = mesh.vertices.iter().fold(vec2(0.0, 0.0), |a, v| a.max(v.uv.to_vec2())); + (mesh.calc_bounds(), uv, pixels.unwrap_or_else(|| panic!("no tile"))) + } + + /// The tile's pixels for the grid colors `a` and `b`: `a` in the top-left and bottom-right cells. + fn tile(a: &str, b: &str) -> Vec { + let c = |h| crate::panels::c32(&hex(h)); + vec![c(a), c(b), c(b), c(a)] + } + + /// The Transparency tab shows a checkered preview of the grid its Grid Size and Grid Colors + /// hold before OK: the canvas's cells, the first color in the top-left cell. Simulate Colored + /// Paper leaves it checkered, and neither it nor Cancel changes the document. + #[test] + fn the_transparency_tab_previews_the_pending_grid_size_and_colors() { + let (mut app, _) = transparency_tab(); + let (rect, uv, pixels) = grid_preview(&mut app); + assert_eq!(rect.size(), super::GRID_PREVIEW); + assert_eq!((uv, pixels), (rect.size() / 16.0, tile(LIGHT[0], LIGHT[1])), "Medium, Light"); + for (size, cell) in [("small", 4.0), ("large", 16.0)] { + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("gridSize".into(), json!(size)); + d.fields.insert("gridColors".into(), json!(["#ff0000", "#0000ff"])); + let (rect, uv, pixels) = grid_preview(&mut app); + assert_eq!((uv, pixels), (rect.size() / (2.0 * cell), tile("#ff0000", "#0000ff")), "{size}"); + } + app.ui.dialog.as_mut().unwrap().fields.insert("simulatePaper".into(), json!(true)); + let (rect, uv, pixels) = grid_preview(&mut app); + assert_eq!((uv, pixels), (rect.size() / 32.0, tile("#ff0000", "#0000ff")), "Simulate Colored Paper"); + let st = app.session.active().unwrap(); + assert_eq!((st.doc.setup.grid_size, st.doc.setup.grid_colors), (vectorcraft_doc::GridSize::Medium, LIGHT.map(hex))); + assert_eq!(undo_steps(&app), 0); + crate::dialogs::cancel(&mut app); + assert!(app.ui.dialog.is_none()); + let st = app.session.active().unwrap(); + assert_eq!( + (st.doc.setup.grid_size, st.doc.setup.grid_colors, st.doc.setup.simulate_paper), + (vectorcraft_doc::GridSize::Medium, LIGHT.map(hex), false) + ); + assert_eq!(undo_steps(&app), 0); + } + + /// The grid preview sits beside Grid Size, Grid Colors and the color boxes, inside the dialog, + /// and covers none of the tab's text or color boxes. + #[test] + fn the_grid_preview_sits_beside_the_grid_rows() { + let (mut app, ctx) = transparency_tab(); + let texts = dialog_frame(&mut app, &ctx, vec![]); + let (rect, _, _) = grid_preview(&mut app); + let label = texts.iter().find(|(t, _)| t == "Grid Size:").unwrap_or_else(|| panic!("no Grid Size: {texts:?}")).1; + assert!(rect.top() <= label.bottom() && rect.left() > label.right(), "{rect:?} beside {label:?}"); + for (text, r) in &texts { + assert!(!r.intersects(rect), "{text:?} at {r:?} under the preview {rect:?}"); + } + for i in 0..2 { + let r = ctx.read_response(super::grid_color_box_id(i)).unwrap().rect; + assert!(!r.intersects(rect), "box {i} at {r:?} under the preview {rect:?}"); + } + // The dialog's content is 540 points wide from its heading's left edge. + let left = texts.iter().find(|(t, _)| t == "Document Setup").unwrap_or_else(|| panic!("no heading: {texts:?}")).1.left(); + assert!(rect.right() <= left + 540.0 + 0.5, "{rect:?} inside the dialog from {left}"); + } + + /// A grid size or color pair the dialog holds that is not a valid value shows as the + /// document's setting. + #[test] + fn the_grid_preview_shows_the_document_setting_for_a_bad_field() { + let setup = vectorcraft_doc::DocSetup { + grid_size: vectorcraft_doc::GridSize::Large, + grid_colors: [hex("#111111"), hex("#222222")], + ..Default::default() + }; + let fields = |v: serde_json::Value| v.as_object().unwrap().clone(); + for bad in [ + json!({}), + json!({"gridSize": "huge", "gridColors": ["#ff0000"]}), + json!({"gridSize": 3, "gridColors": ["#ff0000", "zz"]}), + json!({"gridColors": "Plaid"}), + json!({"gridColors": ["#ff0000", "#00ff00", "#0000ff"]}), + ] { + assert_eq!(super::preview_grid(&fields(bad.clone()), &setup), (setup.grid_size, setup.grid_colors), "{bad}"); + } + let good = fields(json!({"gridSize": "small", "gridColors": ["#ff0000", "#0000ff"]})); + assert_eq!(super::preview_grid(&good, &setup), (vectorcraft_doc::GridSize::Small, [hex("#ff0000"), hex("#0000ff")])); + let preset = fields(json!({"gridColors": "blue"})); + assert_eq!(super::preview_grid(&preset, &setup), (vectorcraft_doc::GridSize::Large, [hex("#ffffff"), hex("#c4dcff")])); + } } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 233b38249e..14cb17daaa 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -811,6 +811,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Document Setup modal handoff:** Document Setup → Edit Artboards applies valid settings, closes the dialog and activates the Artboard tool. Pointer-click tests cover successful handoff, invalid settings, OK, Cancel and Undo in `dialogs/document_setup.rs`. - **Document Setup › Transparency grid color boxes:** a click on either color box beside Grid Colors opens the Color Picker on that color, as [the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/view-transparency-in-artworks.html) describes choosing a custom color for each of the grid's two alternating squares. The picker's OK sets only that color in the dialog, Grid Colors then names the pair (Custom unless it matches one of VectorCraft's presets), and Document Setup's OK applies it in one undo step; the picker's Cancel leaves both colors as they were. With the keyboard on a box, Enter or Space opens the picker. The keyboard handling and staging the color until Document Setup's OK are VectorCraft's own. Tests: `a_grid_color_box_opens_the_color_picker_and_its_ok_sets_that_color` and the other grid color tests in `dialogs/document_setup.rs`. +- **Document Setup › Transparency grid preview:** a checkered box to the right of Grid Size and Grid Colors shows the grid they hold before OK, as [the help page](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/view-transparency-in-artworks.html) describes a larger sample of the chosen square size and colors beside those settings. It is drawn with the canvas's transparency grid tile and cell size, through the same display profile, with the first color in the top-left square, and it changes nothing in the document. Its 112 × 72 point size, showing the grid whatever Simulate Colored Paper and View › Show Transparency Grid are, and showing the document's setting for a value the dialog cannot read are VectorCraft's own. Tests: `the_transparency_tab_previews_the_pending_grid_size_and_colors` and the other grid preview tests in `dialogs/document_setup.rs`. - **Document Setup › Color:** a Color tab shows the document color mode (RGB Color or CMYK Color), a Convert to CMYK or Convert to RGB box for a mode change (cleared: the colors keep their numbers), and the RGB and CMYK profiles assigned to the document, with a working-space entry for none. OK runs `edit.assignProfile` and then `file.documentColorMode` with the dialog's other changes in one `command.batch`, and the document's changes are one undo step. An unchanged Color tab adds no color commands, and Cancel, or OK with nothing changed, records no undo step. A Color tab field with a value of the wrong kind is an error, and the dialog stays open. The tab is VectorCraft's own layout; File › Document Color Mode and Edit › Assign Profile… stay as they are. Tests in `dialogs/document_setup.rs`. - **Assign Profile's three choices:** the Assign rows of Edit › Assign Profile… (the Separations panel's Color Settings section) offer Don't Color Manage This Document, the working space of the document's color mode (Working RGB or Working CMYK, with its name) and Profile with the other profiles of that kind, as [Assign or remove a color profile](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=150) lists them. They act on the profile of the document's color mode: an RGB document's RGB profile, a CMYK document's CMYK profile; the other model's profile stays as it is (VectorCraft's own rule; Document Setup › Color sets both). Picking the working space assigns its profile, which stays when the working space changes later. A choice the document already has runs nothing. Tests in `panels/separations.rs`. - **Canvas through the display's profile on Windows and X11:** Preferences › Performance › Use Monitor Profile for Canvas (on by default) converts the canvas's art, artboard paper and transparency grid from sRGB into the ICC profile of the display that shows most of the main window, after any proof, as the help page describes the monitor's profile translating the document's colors for the monitor ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=151)). Windows gives the display's default profile, and a display with Advanced Color on is left to Windows ([Microsoft Learn](https://learn.microsoft.com/en-us/windows/win32/wcs/advanced-color-icc-profiles)); X11 gives colord's profile for the output or the `_ICC_PROFILE` property. macOS converts the window itself, and a Wayland session stays sRGB. `ui.inspect` reports `displayProfile`. Tests in `color/src/cms/display.rs`, `ui-egui/src/display_profile.rs` and `canvas::tests::the_canvas_is_drawn_through_the_display_profile_while_the_preference_is_on`. From c064a899fd7eff5dd61bfb41a66839fc1ab77b07 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 13:47:14 -0800 Subject: [PATCH 081/158] Layers: a drag into or out of a nested Live Paint group's paths remakes the groups that hold it A Live Paint group among another group's paths gives that group its faces and edges. A row moved into or out of the inner group's paths now also makes the faces and edges of every Live Paint group that holds it among its paths again, innermost first, so the outer group no longer keeps faces and edges from the paths as they were. --- crates/engine/src/cmd/buildcmds/live_paint.rs | 46 ++++++++++++++++--- crates/engine/src/tests/build.rs | 34 ++++++++++++++ 2 files changed, 73 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/cmd/buildcmds/live_paint.rs b/crates/engine/src/cmd/buildcmds/live_paint.rs index 411f98a9c6..02ba081477 100644 --- a/crates/engine/src/cmd/buildcmds/live_paint.rs +++ b/crates/engine/src/cmd/buildcmds/live_paint.rs @@ -331,12 +331,27 @@ fn spot_in(d: &Document, parent: Option) -> Spot { Spot::Outside } +/// The Live Paint groups that hold Live Paint group `g` among their paths (in their sources group, +/// at any depth), innermost first. +fn enclosing_live_paints(d: &Document, g: NodeId) -> Vec { + let mut out = vec![]; + let mut at = g; + while let Spot::Source(o) = spot_in(d, d.parent_of(at)) { + if out.contains(&o) { + break; + } + out.push(o); + at = o; + } + out +} + /// What moving rows in the Layers panel (`layer.move`, `node.move`) does to Live Paint groups. /// Rows that go into a Live Paint group from elsewhere are added to it as `livePaint.merge` adds /// paths. Rows that go into or leave a group's paths (its sources group) change those paths, and /// the group's faces and edges are made again from them, keeping the paint of the faces and edges -/// that stay. Rows moved within one group's paths, or among a group's own children, change no -/// faces. +/// that stay, and so are those of every Live Paint group that holds a changed group among its +/// paths. Rows moved within one group's paths, or among a group's own children, change no faces. pub(crate) struct LivePaintMove { /// The Live Paint group the rows go into, and for each row whether it joins the group's paths. join: Option<(NodeId, Vec)>, @@ -411,13 +426,30 @@ impl LivePaintMove { // The group the rows join is made again by the merge below, from its paths as they are now // and with the paint of its faces and edges as they were before the move. let join_group = self.join.as_ref().map(|(g, _)| *g); - for g in self.rebuild.iter().filter(|g| Some(**g) != join_group) { - rebuild_paths(d, *g)?; + // A Live Paint group among another group's paths gives that group its faces and edges, so + // the groups holding a changed group among their paths are made again too, innermost first. + let mut groups: Vec = vec![]; + for g in self.rebuild.iter().copied().chain(join_group) { + for x in std::iter::once(g).chain(enclosing_live_paints(d, g)) { + if !groups.contains(&x) { + groups.push(x); + } + } + } + groups.sort_by_cached_key(|g| std::cmp::Reverse(d.ancestry(*g).map_or(0, |a| a.len()))); + let joined: Vec = match &self.join { + Some((_, mask)) => moved.iter().zip(mask).filter(|(_, j)| **j).map(|(r, _)| *r).collect(), + None => vec![], + }; + for g in groups { + if Some(g) == join_group { + let roots: Vec = std::iter::once(g).chain(joined.iter().copied()).collect(); + merge_live(d, sel, &roots)?; + } else if d.node(g).is_some() { + rebuild_paths(d, g)?; + } } let Some((g, mask)) = self.join else { return Ok(moved.iter().copied().filter(|r| d.node(*r).is_some()).collect()) }; - let joined = moved.iter().zip(&mask).filter(|(_, j)| **j).map(|(r, _)| *r); - let roots: Vec = std::iter::once(g).chain(joined).collect(); - merge_live(d, sel, &roots)?; // `moved` holds each row once, so only the group can come twice. Faces and edges of the // group moved along with the joining rows were made again, so they are left out. let mut out = vec![]; diff --git a/crates/engine/src/tests/build.rs b/crates/engine/src/tests/build.rs index 8a63bf659d..d1cd00c524 100644 --- a/crates/engine/src/tests/build.rs +++ b/crates/engine/src/tests/build.rs @@ -5377,6 +5377,40 @@ fn layers_drag_a_source_path_into_its_own_live_paint_group_keeps_the_paint() { assert_eq!(face_at(&n, Point::new(50.0, 50.0)).unwrap().appearance.fill_paint(), blue, "the only path's face keeps its fill"); } +/// A Live Paint group among another Live Paint group's paths gives it faces and edges: a path +/// dragged into or out of the inner group's paths, or from the outer group's paths into the inner +/// group's, makes the inner group's faces and edges again and then the outer group's. +#[test] +fn layers_drag_into_a_nested_live_paint_group_makes_the_outer_group_again() { + use vectorcraft_tools::builder::{faces, sources}; + let mut s = session(); + let outer = live(&mut s); + let inner = live(&mut s); + let layer = s.doc().unwrap().doc.parent_of(outer).unwrap(); + let first_source = |s: &Session, g: NodeId| sources(&node(s, g)).unwrap().children().unwrap()[0].id; + let into = |s: &mut Session, row: NodeId, g: NodeId| { + let target = first_source(s, g); + s.execute("layer.move", &json!({"ids": [row.0], "target": target.0, "place": "above"})).unwrap(); + }; + into(&mut s, inner, outer); + assert_eq!(s.doc().unwrap().doc.parent_of(inner), Some(sources(&node(&s, outer)).unwrap().id)); + let plain = faces(&node(&s, outer)).len(); + let a = line_to_right_face(&mut s, 30.0); + into(&mut s, a, inner); + assert_eq!(faces(&node(&s, inner)).len(), 5); + let cut = faces(&node(&s, outer)).len(); + assert!(cut > plain, "a path joining the inner group cuts the outer group's faces: {cut} faces, {plain} before"); + s.execute("layer.move", &json!({"ids": [a.0], "target": layer.0})).unwrap(); + assert_eq!(faces(&node(&s, inner)).len(), 3); + assert_eq!(faces(&node(&s, outer)).len(), plain, "a path leaving the inner group leaves the outer group's faces"); + into(&mut s, a, outer); + assert_eq!(faces(&node(&s, outer)).len(), cut); + into(&mut s, a, inner); + assert_eq!(s.doc().unwrap().doc.parent_of(a), Some(sources(&node(&s, inner)).unwrap().id)); + assert_eq!(faces(&node(&s, inner)).len(), 5); + assert_eq!(faces(&node(&s, outer)).len(), cut, "the outer group is made after the inner one"); +} + /// Give Live Paint group `g` a lock, hidden state, appearance, knockout, opacity mask and /// graphic style link, and return it as it then is. fn dress_live_group(s: &mut Session, g: NodeId) -> Node { From 322cc6049f0d83ca2aad213c1d492dd81ddb196e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 13:51:14 -0800 Subject: [PATCH 082/158] i18n: French Find and Replace match count avoids a colon without a no-break space --- crates/ui-egui/src/i18n/fr.tsv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 96d05a0ab9..d24a320e5e 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -1285,7 +1285,7 @@ font-technology Variable Variables Check Hidden Layers Vérifier les calques masqués Check Locked Layers Vérifier les calques verrouillés @msg No matches found Aucune occurrence trouvée -@msg Matches replaced: {n} Occurrences remplacées : {n} +@msg Matches replaced: {n} Occurrences remplacées ({n}) @msg no match of `find` at bytes {_1}..{_2} of object {_3} aucune occurrence de `find` aux octets {_1}..{_2} de l’objet {_3} Find Font Rechercher une police Find Font… Rechercher une police… From 11f1a28d1cbb957cece8a9010a06f353cc0d21e7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 14:16:36 -0800 Subject: [PATCH 083/158] Document Setup: grid color boxes read a preset name When Grid Colors held a preset name, the color boxes and hex fields were empty, a box opened the Color Picker on white, and the picker's OK failed with "no such color". A list shorter than two colors failed the same way, and typing a hex while a preset name was set lost the other color. The boxes, hex fields and Grid Colors menu now read the field as document.setup does (a preset name in any letter case, or two colors), showing the document's pair when it holds neither. Before a box opens the picker, a field that is not two colors is written as that pair, so the picker's OK sets one entry. --- crates/ui-egui/src/dialogs/document_setup.rs | 64 +++++++++++++++++--- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/dialogs/document_setup.rs b/crates/ui-egui/src/dialogs/document_setup.rs index f6feea4f91..410b554f77 100644 --- a/crates/ui-egui/src/dialogs/document_setup.rs +++ b/crates/ui-egui/src/dialogs/document_setup.rs @@ -188,12 +188,19 @@ const GRID_PREVIEW: egui::Vec2 = egui::vec2(112.0, 72.0); /// valid value shows as `setup`, the document's setting. fn preview_grid(fields: &Map, setup: &vectorcraft_doc::DocSetup) -> (GridSize, [vectorcraft_color::Color; 2]) { let size = fields.get("gridSize").and_then(Value::as_str).and_then(GridSize::parse).unwrap_or(setup.grid_size); + (size, grid_colors(fields, setup)) +} + +/// The two grid colors the dialog's fields `fields` hold, read as `document.setup` reads +/// `gridColors` (a preset name, in any letter case, or two colors): a field that is missing or not +/// a valid value gives `setup`'s colors, the document's setting. +fn grid_colors(fields: &Map, setup: &vectorcraft_doc::DocSetup) -> [vectorcraft_color::Color; 2] { let colors = match fields.get("gridColors") { Some(Value::String(name)) => GRID_COLOR_PRESETS.iter().find(|(n, _)| n.eq_ignore_ascii_case(name)).map(|(_, pair)| *pair), Some(Value::Array(a)) if a.len() == 2 => a.iter().map(vectorcraft_engine::cmd::color_value).collect::>>().map(|c| [c[0], c[1]]), _ => None, }; - (size, colors.unwrap_or(setup.grid_colors)) + colors.unwrap_or(setup.grid_colors) } /// The checkered preview of the grid the dialog's Grid Size and Grid Colors hold, drawn with the @@ -234,15 +241,17 @@ fn transparency(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { let top = ui.cursor().top(); let sizes: Vec<(&str, &str)> = GridSize::ALL.iter().map(|g| (g.id(), g.label())).collect(); choice(ui, d, "gridSize", tl!("Grid Size:"), &sizes); - let colors: Vec = d - .fields - .get("gridColors") - .and_then(Value::as_array) - .map(|a| a.iter().map(|c| c.as_str().unwrap_or("").to_string()).collect()) - .unwrap_or_default(); + // The pair the field holds as a preset name or two colors, or the document's pair when it holds + // neither, so each box and hex field shows a color and the picker and hex fields set an entry of + // a two-color list. + let colors: Vec = { + let fallback = vectorcraft_doc::DocSetup::default(); + let setup = app.session.active().map_or(&fallback, |st| &st.doc.setup); + grid_colors(&d.fields, setup).iter().map(vectorcraft_color::Color::to_hex).collect() + }; let preset = GRID_COLOR_PRESETS .iter() - .find(|(_, pair)| colors.len() == 2 && colors.iter().zip(pair).all(|(h, c)| h.eq_ignore_ascii_case(&c.to_hex()))) + .find(|(_, pair)| colors.iter().zip(pair).all(|(h, c)| h.eq_ignore_ascii_case(&c.to_hex()))) .map_or("Custom", |(n, _)| n); let names: Vec<&str> = GRID_COLOR_PRESETS.iter().map(|(n, _)| *n).chain(["Custom"]).collect(); widgets::label_row(ui, tl!("Grid Colors:"), LABEL, |ui| { @@ -252,7 +261,7 @@ fn transparency(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { }); // The two colours (the first is also the paper colour): editing either makes them Custom. A // click on a color's box, or Space or Enter with the keyboard on it, opens the Color Picker on - // that color (white when its hex is not a color), and the picker's OK sets that color. + // that color, and the picker's OK sets that color. let mut pick = None; widgets::label_row(ui, "", LABEL, |ui| { for i in 0..2 { @@ -281,7 +290,6 @@ fn transparency(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { } if let Some(c) = widgets::hex_field_named(ui, ("grid-color", i), Some(&name), hex).and_then(|h| vectorcraft_color::Color::from_hex(&h)) { let mut v = colors.clone(); - v.resize(2, "#ffffff".into()); v[i] = c.to_hex(); d.fields.insert("gridColors".into(), json!(v)); } @@ -290,6 +298,12 @@ fn transparency(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { }); grid_preview(app, ui, d, top); if let Some((i, c)) = pick { + // A preset name or a field that is not two colors becomes the pair the boxes show, so the + // picker's OK has an entry to set. + let entries = d.fields.get("gridColors").and_then(Value::as_array); + if !entries.is_some_and(|a| a.len() == 2 && a.iter().all(|c| vectorcraft_engine::cmd::color_value(c).is_some())) { + d.fields.insert("gridColors".into(), json!(colors)); + } *d = super::color_picker::over_list_entry(d, "gridColors", i, c); } ui.add_space(4.0); @@ -821,6 +835,36 @@ mod tests { } } + /// When Grid Colors holds a preset name (in any letter case) or a list that is not two colors, + /// the boxes and hex fields show the preset's pair or the document's, a box opens the Color + /// Picker on its color, and the picker's OK sets only that entry of a two-color list. + #[test] + fn a_grid_color_box_opens_on_a_preset_name_or_a_short_list() { + for (field, index, opens, kept, name) in [ + (json!("Blue"), 1, "#c4dcff", "#ffffff", "Blue"), + (json!("purple"), 0, "#ffffff", "#e2c9ff", "Purple"), + (json!(["#ff0000"]), 1, "#cccccc", "#ffffff", "Light"), + ] { + let (mut app, ctx) = transparency_tab(); + app.ui.dialog.as_mut().unwrap().fields.insert("gridColors".into(), field.clone()); + dialog_frame(&mut app, &ctx, vec![]); + let texts: Vec = dialog_frame(&mut app, &ctx, vec![]).into_iter().map(|(t, _)| t).collect(); + for shown in [name, opens.trim_start_matches('#'), kept.trim_start_matches('#')] { + assert!(texts.iter().any(|t| t.eq_ignore_ascii_case(shown)), "{field}: no {shown} in {texts:?}"); + } + click_grid_box(&mut app, &ctx, index); + assert_picker_over_setup(&app, opens, &field.to_string()); + app.ui.dialog.as_mut().unwrap().fields.insert("color".into(), json!("#00ff00")); + crate::dialogs::confirm(&mut app).unwrap(); + let d = app.ui.dialog.as_ref().unwrap(); + let mut pair = [hex(kept); 2]; + pair[index] = hex("#00ff00"); + assert_eq!((d.kind.as_str(), dialog_grid(d)), (super::KIND, pair.to_vec()), "{field}"); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(app.session.active().unwrap().doc.setup.grid_colors, pair, "{field}"); + } + } + /// The picker's OK sets nothing when the dialog under it has no such color or is gone: it is /// an error, and the picker stays open. #[test] From 2209a64dc2ccef4036df0b033ac6cbbc55ff5514 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 14:28:52 -0800 Subject: [PATCH 084/158] Save for Web: double-clicking a color-table swatch shifts that color Double-clicking an opaque GIF or PNG-8 color-table swatch opens the Color Picker. Its OK writes that color as the color picked wherever it appears in the image; Cancel changes nothing. A shifted swatch shows the original color at its upper left and the new one at its lower right, with the lock mark. Double-clicking it opens the picker on the original color, and OK on it takes the shift away. Unshift All Colors in the table's menu clears shifts and web shifts. - colorTable.shifted {"#source": "#rrggbb"} carries the shifts by source color, in the settings, the remembered settings and presets. A shifted color is kept when reducing, before locked colors, and wins over Web Shift, Web Snap and Lock; a color mapped to transparent stays transparent. Bad colors, duplicate keys and more than 256 entries are refused. The preview marks shifted colors. - GIF lossy compression compares pixels with the reduction's colors before the table's edits, so a shifted or web-shifted color does not take in the pixels of a nearby color. - Web Shift replaces a shift by hand, Lock stays on for a shifted color, and Delete Color drops a deleted color's shift. Docs: docs/mcp.md, docs/target-app-parity.md. --- crates/engine/src/cmd/webexport.rs | 79 ++++++++-- crates/engine/src/tests/webexport.rs | 100 +++++++++++++ crates/ui-egui/src/dialogs/save_for_web.rs | 141 ++++++++++++++++-- .../ui-egui/src/dialogs/tests_save_for_web.rs | 101 +++++++++++++ crates/ui-egui/src/i18n/bg.tsv | 2 + crates/ui-egui/src/i18n/bs.tsv | 2 + crates/ui-egui/src/i18n/ca.tsv | 2 + crates/ui-egui/src/i18n/cs.tsv | 2 + crates/ui-egui/src/i18n/da.tsv | 2 + crates/ui-egui/src/i18n/de.tsv | 2 + crates/ui-egui/src/i18n/el.tsv | 2 + crates/ui-egui/src/i18n/es.tsv | 2 + crates/ui-egui/src/i18n/fi.tsv | 2 + crates/ui-egui/src/i18n/fr.tsv | 2 + crates/ui-egui/src/i18n/gu.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 2 + crates/ui-egui/src/i18n/hu.tsv | 2 + crates/ui-egui/src/i18n/id.tsv | 2 + crates/ui-egui/src/i18n/it.tsv | 2 + crates/ui-egui/src/i18n/ja.tsv | 2 + crates/ui-egui/src/i18n/ka.tsv | 2 + crates/ui-egui/src/i18n/ko.tsv | 2 + crates/ui-egui/src/i18n/nl.tsv | 2 + crates/ui-egui/src/i18n/pl.tsv | 2 + crates/ui-egui/src/i18n/pt-br.tsv | 2 + crates/ui-egui/src/i18n/ru.tsv | 2 + crates/ui-egui/src/i18n/sv.tsv | 2 + crates/ui-egui/src/i18n/tr.tsv | 2 + crates/ui-egui/src/i18n/uk.tsv | 2 + crates/ui-egui/src/i18n/vi.tsv | 2 + crates/ui-egui/src/i18n/zh-hans.tsv | 2 + crates/ui-egui/src/i18n/zh-hant.tsv | 2 + docs/mcp.md | 21 ++- docs/target-app-parity.md | 1 + 34 files changed, 470 insertions(+), 28 deletions(-) diff --git a/crates/engine/src/cmd/webexport.rs b/crates/engine/src/cmd/webexport.rs index 897cd87c55..30aa9820ab 100644 --- a/crates/engine/src/cmd/webexport.rs +++ b/crates/engine/src/cmd/webexport.rs @@ -32,7 +32,7 @@ pub fn specs() -> Vec { "Save for Web", [], None, - "{path?, preset?: a webExport.presets name (its settings, then these keys), format?: gif (default)|jpg|png8|png24, reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray (gif/png8, as the next five), colors?: 128 (2–256), dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, webSnap?: 0 (0–100 %: colours that close to a web-safe one become it), lossy?: 0 (0–100, gif), colorTable?: {locked?: [\"#rrggbb\"…] (kept when reducing), transparent?: [\"#rrggbb\"…] (become transparent), webShift?: [\"#rrggbb\"…] (become web-safe), sort?: none|hue|luminance|popularity, deleted?: [\"#rrggbb\"…] (taken out of the table: their pixels take the nearest color left, and at least one color stays), customPalette?: [\"#rrggbb\"…] (a fixed palette used instead of the reduction's, at most `colors` entries; a new reduction without colorTable clears it and deleted)} (colours as the preview's colors[].source; #rrggbbaa and #rgba are refused here and in matte), transparency?: true (gif/png8/png24), matte?: white (default)|black|none|\"#rrggbb\" (what edges blend into; jpg and opaque png24: the background), interlaced?: false (gif/png8/png24), quality?: 60 (jpg: 0–100), progressive?: false (jpg), optimized?: true (jpg), embedProfile?: false (jpg: sRGB profile), width?: px | height?: px | percent?: 100 (the image size, proportional; width wins over height, height over percent), antiAlias?: none|art (default)|type, clipToArtboard?: true (the artboard; false: the art and the slices), artboard?: 0 (0-based), convertToSrgb?: true (PNG files say they are sRGB), metadata?: none|copyright (default)|contact|all (File Info written as PNG text, a GIF or JPEG comment), slices?: all (default)|selected|none (one image per slice: images/.), output?: images (default)|html (an HTML page placing the image or slices, .html)} → {path, files: [path…], bytes (total), width, height, warnings: [] or [a note that an image couldn't be decoded and is missing from the image]}; no path → {files: [{name, dataBase64}], bytes, width, height, warnings} (names such as page.html, images/page_01.gif). A single image without HTML is written at path itself", + "{path?, preset?: a webExport.presets name (its settings, then these keys), format?: gif (default)|jpg|png8|png24, reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray (gif/png8, as the next five), colors?: 128 (2–256), dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, webSnap?: 0 (0–100 %: colours that close to a web-safe one become it), lossy?: 0 (0–100, gif), colorTable?: {locked?: [\"#rrggbb\"…] (kept when reducing), transparent?: [\"#rrggbb\"…] (become transparent), webShift?: [\"#rrggbb\"…] (become web-safe), sort?: none|hue|luminance|popularity, deleted?: [\"#rrggbb\"…] (taken out of the table: their pixels take the nearest color left, and at least one color stays), customPalette?: [\"#rrggbb\"…] (a fixed palette used instead of the reduction's, at most `colors` entries; a new reduction without colorTable clears it and deleted), shifted?: {\"#source\": \"#rrggbb\"…} (each source color is written as the color given, wherever it is in the image; kept when reducing as a locked color is, before the locked ones, while one palette slot is left for the reduction; at most 256; a source the table does not hold shifts nothing; a color shifted to itself is removed; a shifted color is not web-shifted, and a transparent one stays transparent)} (colours as the preview's colors[].source; #rrggbbaa and #rgba are refused here and in matte), transparency?: true (gif/png8/png24), matte?: white (default)|black|none|\"#rrggbb\" (what edges blend into; jpg and opaque png24: the background), interlaced?: false (gif/png8/png24), quality?: 60 (jpg: 0–100), progressive?: false (jpg), optimized?: true (jpg), embedProfile?: false (jpg: sRGB profile), width?: px | height?: px | percent?: 100 (the image size, proportional; width wins over height, height over percent), antiAlias?: none|art (default)|type, clipToArtboard?: true (the artboard; false: the art and the slices), artboard?: 0 (0-based), convertToSrgb?: true (PNG files say they are sRGB), metadata?: none|copyright (default)|contact|all (File Info written as PNG text, a GIF or JPEG comment), slices?: all (default)|selected|none (one image per slice: images/.), output?: images (default)|html (an HTML page placing the image or slices, .html)} → {path, files: [path…], bytes (total), width, height, warnings: [] or [a note that an image couldn't be decoded and is missing from the image]}; no path → {files: [{name, dataBase64}], bytes, width, height, warnings} (names such as page.html, images/page_01.gif). A single image without HTML is written at path itself", has_doc, export ), @@ -41,7 +41,7 @@ pub fn specs() -> Vec { "Save for Web Preview", [], None, - "{…the settings of document.exportForWeb (preset?, format?…), slice?: n (1-based, from slice.list; default the whole image), kbps?: 56.6 (connection speed for the download time), image?: false (also the optimised file as dataBase64)} what Save writes for the whole image (or one slice) → {format, width, height, bytes (exactly the file's size), seconds (to download at kbps), kbps, colors?: [{color: \"#rrggbb\", source: \"#rrggbb\" (the colour the reduction made, as colorTable lists it), transparent, locked, webShifted, webSafe}] (gif/png8: the colour table in file order), mappedToTransparent?: [\"#rrggbb\"…], slices: images an export writes, warnings (as document.exportForWeb's), dataBase64?}", + "{…the settings of document.exportForWeb (preset?, format?…), slice?: n (1-based, from slice.list; default the whole image), kbps?: 56.6 (connection speed for the download time), image?: false (also the optimised file as dataBase64)} what Save writes for the whole image (or one slice) → {format, width, height, bytes (exactly the file's size), seconds (to download at kbps), kbps, colors?: [{color: \"#rrggbb\", source: \"#rrggbb\" (the colour the reduction made, as colorTable lists it), transparent, locked, webShifted, shifted (by colorTable.shifted; also locked), webSafe}] (gif/png8: the colour table in file order), mappedToTransparent?: [\"#rrggbb\"…], slices: images an export writes, warnings (as document.exportForWeb's), dataBase64?}", has_doc, preview ), @@ -331,8 +331,14 @@ pub struct ColorTable { /// A fixed palette (a Custom table) used instead of the reduction's own: the colors of the /// table when the first color was deleted. Empty: the reduction makes the palette. pub custom_palette: Vec, + /// Colors shifted by hand: each source color (`#rrggbb`) and the color it is written as. A + /// shifted color is locked, and a source the table does not hold shifts nothing. + pub shifted: std::collections::BTreeMap, } +/// A color shifted by hand: (source, color written). +type Shift = ([u8; 3], [u8; 3]); + /// The most colours a colour table list holds. const MAX_TABLE: usize = 256; @@ -352,6 +358,21 @@ impl ColorTable { list.iter().map(|h| Self::rgb(h).ok_or_else(|| format!("colorTable.{what}: `{h}` is not a colour such as \"#ff8800\""))).collect() } + /// The colors shifted by hand as (source, color written). An error names a value that is not a + /// color such as `#ff8800`, two keys that name one color, or more than 256 entries. + fn shifts(&self) -> std::result::Result, String> { + // One entry past the limit is enough for `colors` to refuse a longer map. + let (keys, values): (Vec, Vec) = self.shifted.iter().take(MAX_TABLE + 1).map(|(k, v)| (k.clone(), v.clone())).unzip(); + let sources = Self::colors(&keys, "shifted")?; + let to = Self::colors(&values, "shifted")?; + for (i, (s, k)) in sources.iter().zip(&keys).enumerate() { + if sources[..i].contains(s) { + return Err(format!("colorTable.shifted: `{k}` names a color another key names")); + } + } + Ok(sources.into_iter().zip(to).collect()) + } + /// `h` as RGB; `None` when it is not a color such as `#ff8800`. fn rgb(h: &str) -> Option<[u8; 3]> { vectorcraft_color::Color::from_hex(h).filter(|_| !super::hex_with_alpha(h)).map(|c| { @@ -487,13 +508,18 @@ impl WebSettings { { ColorTable::colors(list, what)?; } - // A deleted color is no longer locked, transparent or web-shifted. + // A deleted color is no longer locked, transparent, web-shifted or shifted. let deleted = ColorTable::colors(&table.deleted, "deleted")?; if !deleted.is_empty() { for list in [&mut table.locked, &mut table.transparent, &mut table.web_shift] { list.retain(|h| ColorTable::rgb(h).is_none_or(|c| !deleted.contains(&c))); } } + // Shifts are kept as `#rrggbb` in lowercase; a color shifted to itself is not shifted, and + // a color shifted by hand is not web-shifted. + let shifts: Vec = table.shifts()?.into_iter().filter(|(s, to)| s != to && !deleted.contains(s)).collect(); + table.web_shift.retain(|h| ColorTable::rgb(h).is_none_or(|c| !shifts.iter().any(|(s, _)| *s == c))); + table.shifted = shifts.into_iter().map(|(s, to)| (hex(s), hex(to))).collect(); Ok(self) } @@ -640,6 +666,8 @@ pub struct TableColor { pub transparent: bool, pub locked: bool, pub web_shifted: bool, + /// Shifted by hand (`colorTable.shifted`): written as `color` instead of `source`. + pub shifted: bool, } /// An optimised image file. @@ -759,6 +787,11 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 let locked = ColorTable::colors(&table.locked, "locked")?; let to_clear = ColorTable::colors(&table.transparent, "transparent")?; let shift = ColorTable::colors(&table.web_shift, "webShift")?; + let by_hand = table.shifts()?; + let shifted_to = |src: &[u8; 3]| by_hand.iter().find(|(s, _)| s == src).map(|(_, to)| *to); + // A color shifted by hand is kept when the colors are reduced, as a locked one is, and takes + // one of the slots kept for them before the locked colors do. + let kept: Vec<[u8; 3]> = by_hand.iter().map(|(s, _)| *s).chain(locked.iter().copied()).collect(); let o = PaletteOptions { colors: s.colors, reduction: s.reduction, @@ -767,7 +800,7 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 transparency: s.transparency, matte, }; - let mut ix = reduced(rgba, w, h, s, &o, &locked)?; + let mut ix = reduced(rgba, w, h, s, &o, &kept)?; // Map to transparent works on the colours the reduction made. let before = ix.palette.clone(); let clear = ix.transparent.map(usize::from); @@ -781,11 +814,23 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 *slot = *c; } } - // Web snap, then the colours shifted by hand (locked colours stay as they are). + // Lossy compares the pixels with the colors the reduction made, so that a shifted color does + // not take in the pixels of another color. + if s.format == WebFormat::Gif { + web::lossy(&mut ix, rgba, s.lossy); + } + // The colors shifted by hand, then web shift and web snap (locked colors stay as they are). let clear = ix.transparent.map(usize::from); for (i, c) in ix.palette.iter_mut().enumerate() { let src = sources.get(i).copied().unwrap_or(*c); - if Some(i) == clear || locked.contains(&src) { + if Some(i) == clear { + continue; + } + if let Some(to) = shifted_to(&src) { + *c = to; + continue; + } + if locked.contains(&src) { continue; } if shift.contains(&src) { @@ -794,9 +839,6 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 *c = snapped; } } - if s.format == WebFormat::Gif { - web::lossy(&mut ix, rgba, s.lossy); - } let order = web::sort(&mut ix, table.sort); let sources: Vec<[u8; 3]> = order.iter().map(|&i| sources.get(i).copied().unwrap_or_default()).collect(); let colors = ix @@ -804,12 +846,17 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 .iter() .zip(&sources) .enumerate() - .map(|(i, (c, src))| TableColor { - color: *c, - source: *src, - transparent: ix.transparent == u8::try_from(i).ok(), - locked: locked.contains(src), - web_shifted: shift.contains(src), + .map(|(i, (c, src))| { + let transparent = ix.transparent == u8::try_from(i).ok(); + let shifted = !transparent && shifted_to(src).is_some(); + TableColor { + color: *c, + source: *src, + transparent, + locked: locked.contains(src) || shifted, + web_shifted: shift.contains(src) && !shifted, + shifted, + } }) .collect(); Ok(PaletteImage { ix, colors, mapped }) @@ -1116,7 +1163,7 @@ fn preview(s: &mut Session, p: &Value) -> Result { .map(|c| { json!({ "color": hex(c.color), "source": hex(c.source), "transparent": c.transparent, "locked": c.locked, - "webShifted": c.web_shifted, "webSafe": quantize::web_safe(c.color) == c.color, + "webShifted": c.web_shifted, "shifted": c.shifted, "webSafe": quantize::web_safe(c.color) == c.color, }) }) .collect(); diff --git a/crates/engine/src/tests/webexport.rs b/crates/engine/src/tests/webexport.rs index 21ae0796d3..730c81dcd0 100644 --- a/crates/engine/src/tests/webexport.rs +++ b/crates/engine/src/tests/webexport.rs @@ -539,6 +539,106 @@ fn colour_table_delete_maps_pixels_to_the_nearest_color_left() { assert_eq!(sources(&preview(&mut s, json!({"preset": "No near red"}))), ["#0000ff", "#ff0000"]); } +/// A color shifted by hand (`colorTable.shifted`) is written as the color picked wherever it is in +/// the image, the other colors stay, the table shows it as shifted and locked, and the preview is +/// the file. +#[test] +fn colour_table_shift_writes_the_picked_color_wherever_the_source_is() { + let mut s = session(30.0, 10.0); + rect(&mut s, [0.0, 0.0, 10.0, 10.0], "#ff0000"); + rect(&mut s, [10.0, 0.0, 10.0, 10.0], "#0000ff"); + rect(&mut s, [20.0, 0.0, 10.0, 10.0], "#00ff00"); + let preview = |s: &mut Session, p: Value| run(s, "document.exportForWeb.preview", p); + let entry = |v: &Value, source: &str| v["colors"].as_array().unwrap().iter().find(|c| c["source"] == source).cloned().unwrap_or(Value::Null); + for format in ["gif", "png8"] { + let p = json!({"format": format, "dither": "none", "colorTable": {"shifted": {"#0000FF": "#FF8800"}}}); + let v = preview(&mut s, p.clone()); + let c = entry(&v, "#0000ff"); + assert_eq!( + (c["color"].as_str(), c["shifted"].as_bool(), c["locked"].as_bool(), c["webShifted"].as_bool()), + (Some("#ff8800"), Some(true), Some(true), Some(false)), + "{format}: {v}" + ); + assert_eq!((entry(&v, "#ff0000")["shifted"].as_bool(), entry(&v, "#ff0000")["color"].as_str()), (Some(false), Some("#ff0000"))); + let file = one(&mut s, p); + assert_eq!(v["bytes"].as_u64(), Some(file.len() as u64), "{format}: the preview is the file"); + let img = pixels(&file); + assert_eq!( + (img.get_pixel(5, 5).0, img.get_pixel(12, 2).0, img.get_pixel(18, 8).0, img.get_pixel(25, 5).0), + ([255, 0, 0, 255], [255, 136, 0, 255], [255, 136, 0, 255], [0, 255, 0, 255]), + "{format}" + ); + assert_eq!(distinct(&img), 3, "{format}"); + } + // A shifted color is kept when the colors are reduced, as a locked one is. + let two = preview(&mut s, json!({"colors": 2, "dither": "none", "colorTable": {"shifted": {"#00ff00": "#123456"}}})); + assert_eq!(entry(&two, "#00ff00")["color"], "#123456", "{two}"); + // With one slot to keep, the shifted color takes it before a locked one. + let p = json!({"colors": 2, "dither": "none", "colorTable": {"locked": ["#ff0000"], "shifted": {"#0000ff": "#123456"}}}); + let first = preview(&mut s, p); + assert_eq!(entry(&first, "#0000ff")["color"], "#123456", "{first}"); + // A source the table does not hold shifts nothing, and the shift stays with the settings. + let base = preview(&mut s, json!({"dither": "none"})); + let absent = preview(&mut s, json!({"dither": "none", "colorTable": {"shifted": {"#123456": "#000000"}}})); + assert_eq!(absent["colors"], base["colors"]); + // Two colors may be shifted to one color and keep their own sources. + let same = preview(&mut s, json!({"dither": "none", "colorTable": {"shifted": {"#ff0000": "#123456", "#0000ff": "#123456"}}})); + assert_eq!((entry(&same, "#ff0000")["color"].as_str(), entry(&same, "#0000ff")["color"].as_str()), (Some("#123456"), Some("#123456"))); + assert_eq!(entry(&same, "#00ff00")["shifted"], false); + // A shift by hand wins over web shift, web snap and a lock; transparency wins over it. + let p = + json!({"dither": "none", "webSnap": 100, "colorTable": {"shifted": {"#0000ff": "#fe0101"}, "webShift": ["#0000ff"], "locked": ["#0000ff"]}}); + let c = entry(&preview(&mut s, p), "#0000ff"); + assert_eq!((c["color"].as_str(), c["webShifted"].as_bool(), c["locked"].as_bool()), (Some("#fe0101"), Some(false), Some(true))); + let clear = json!({"dither": "none", "colorTable": {"shifted": {"#0000ff": "#fe0101"}, "transparent": ["#0000ff"]}}); + let v = preview(&mut s, clear.clone()); + assert!(v["colors"].as_array().unwrap().iter().all(|c| c["shifted"] == false), "{v}"); + assert_eq!(pixels(&one(&mut s, clear)).get_pixel(15, 5).0[3], 0); + // The settings keep the shifts in lowercase, drop a color shifted to itself, a deleted one and + // the web shift of a color shifted by hand. + let table = json!({"shifted": {"#0000FF": "#FE0101", "#FF0000": "#ff0000", "#00ff00": "#000000"}, "webShift": ["#0000ff", "#00ff00"], "deleted": ["#00ff00"]}); + let r = run(&mut s, "webExport.settings", json!({ "colorTable": table })); + let t = &r["settings"]["colorTable"]; + assert_eq!((&t["shifted"], &t["webShift"]), (&json!({"#0000ff": "#fe0101"}), &json!([]))); + // Another reduction keeps the shifts; a saved preset keeps them. + let r = run(&mut s, "webExport.settings", json!({"reduction": "adaptive"})); + assert_eq!(r["settings"]["colorTable"]["shifted"], json!({"#0000ff": "#fe0101"})); + run(&mut s, "webExport.presets.save", json!({"name": "Blue to red", "dither": "none", "colorTable": {"shifted": {"#0000ff": "#fe0101"}}})); + assert_eq!(entry(&preview(&mut s, json!({"preset": "Blue to red"})), "#0000ff")["color"], "#fe0101"); + // Bad shifts are refused and change nothing. + let many: serde_json::Map = (0..257).map(|i| (format!("#{i:06x}"), json!("#000000"))).collect(); + for bad in [ + json!({"nope": "#000000"}), + json!({"#ff0000": "nope"}), + json!({"#ff0000": "#ff000080"}), + json!({"#ff000080": "#000000"}), + json!({"#ff0000": "#000000", "#FF0000": "#ffffff"}), + json!({"#f00": "#000000", "#ff0000": "#ffffff"}), + Value::Object(many), + ] { + let p = json!({"colorTable": {"shifted": bad}}); + assert!(s.execute("document.exportForWeb", &p).is_err(), "{p}"); + assert!(s.execute("document.exportForWeb.preview", &p).is_err(), "{p}"); + assert!(s.execute("webExport.settings", &p).is_err(), "{p}"); + } + assert_eq!(run(&mut s, "webExport.settings", json!({}))["settings"]["colorTable"]["shifted"], json!({"#0000ff": "#fe0101"})); + // Settings saved before shifts existed still read. + let old: cmd::webexport::WebSettings = serde_json::from_value(json!({"colorTable": {"locked": ["#ff0000"]}})).unwrap(); + assert!(old.color_table.shifted.is_empty()); +} + +/// Lossy GIF compression compares the pixels with the colors the reduction made, so a color shifted +/// near another one does not take in that color's pixels. +#[test] +fn lossy_does_not_spread_a_shifted_color_into_another() { + let mut s = session(30.0, 10.0); + rect(&mut s, [0.0, 0.0, 10.0, 10.0], "#0000ff"); + rect(&mut s, [10.0, 0.0, 20.0, 10.0], "#c80000"); + let p = json!({"format": "gif", "dither": "none", "lossy": 100, "colorTable": {"shifted": {"#0000ff": "#be0000"}}}); + let img = pixels(&one(&mut s, p)); + assert_eq!((img.get_pixel(5, 5).0, img.get_pixel(20, 5).0, img.get_pixel(29, 5).0), ([190, 0, 0, 255], [200, 0, 0, 255], [200, 0, 0, 255])); +} + #[test] fn presets_and_remembered_settings() { let mut s = two_colours(); diff --git a/crates/ui-egui/src/dialogs/save_for_web.rs b/crates/ui-egui/src/dialogs/save_for_web.rs index 54ff2b7d0a..1fed4791e9 100644 --- a/crates/ui-egui/src/dialogs/save_for_web.rs +++ b/crates/ui-egui/src/dialogs/save_for_web.rs @@ -2,8 +2,9 @@ //! as the web image Save writes, beside the original (Original, Optimized, 2-Up and 4-Up views, //! each with its file size and download time), and the settings: format (GIF, JPEG, PNG-8, //! PNG-24), colour reduction, colours, dither, transparency and matte, interlacing, web snap, -//! lossy, JPEG quality, the colour table (lock, map to transparent, web shift, sort, Delete Color -//! and Restore Generated Table), image size and anti-aliasing, Clip to Artboard, sRGB, metadata, +//! lossy, JPEG quality, the colour table (lock, map to transparent, web shift, sort, Delete Color, +//! Restore Generated Table, a double-click that shifts a color to one picked in the Color Picker, +//! and Unshift All Colors), image size and anti-aliasing, Clip to Artboard, sRGB, metadata, //! slices and HTML output, and presets. //! //! Fields are the `document.exportForWeb` settings (`webExport.settings` gives them; set one with @@ -11,7 +12,8 @@ //! `optimized`, `2up`, `4up`), `__zoom` (`fit` or a percentage), `__kbps` (connection speed), //! `__color` (the colour table's selected colour, by source: the one Lock, Transparent and Web //! Shift edit, and where a Shift-click range starts), `__colors` (every selected color, by source, -//! which Delete Color deletes; when it is empty, `__color` alone), `__presetName` (shown while saving a +//! which Delete Color deletes; when it is empty, `__color` alone), `__editColor` (a source color: +//! the Color Picker opens on it, as a double-click on its swatch opens it), `__presetName` (shown while saving a //! preset) and `__hasSlices`. Optimize to File Size… (`__optimizeOpen: true`) shows `__optimizeK` (the desired size in K), //! `__optimizeStart` (`current`, `auto`) and with slices `__optimizeUse` (`allSlices`, //! `eachSlice`, `currentSlice`); `__optimizeGo: true` runs `webExport.optimizeToFileSize` and @@ -533,6 +535,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { { app.status(e); } + take_shift(d); let settings = settings_of(app, d); let mut browser = false; ui.horizontal_top(|ui| { @@ -550,6 +553,12 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { if browser && let Err(e) = app.run("file.saveForWeb.browser", params(d)) { app.status(e); } + // A double-clicked swatch (or an agent's `__editColor`) opens the Color Picker last, over the + // dialog as it now is. + if let Some(source) = d.fields.remove("__editColor").and_then(|v| v.as_str().map(String::from)) { + let start = d.fields.remove("__editStart").and_then(|v| v.as_str().map(String::from)).unwrap_or_else(|| source.clone()); + edit_color(d, &source, &start); + } false } @@ -1057,7 +1066,9 @@ fn matte_row(ui: &mut egui::Ui, d: &mut Dialog) { /// ones with a square, web-safe ones with a diamond, transparent ones over the grid), the buttons /// that edit the selected colour, Delete Color and the table's menu, plus the sort order. A click /// selects one color, a Shift-click the colors from the anchor, and a Ctrl-click -/// (Command-click on macOS) adds or removes one. Returns an error for a deletion that would leave +/// (Command-click on macOS) adds or removes one; a double-click on an opaque color asks for the +/// Color Picker (`__editColor`), and a color shifted by hand shows its source color at the upper +/// left and its new color at the lower right. Returns an error for a deletion that would leave /// no color. fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Result<(), String> { let t = Tokens::get(ui.ctx()); @@ -1086,15 +1097,20 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re .colors .iter() .map(|c| (*c, false)) - .chain(shot.mapped.iter().map(|c| (TableColor { color: *c, source: *c, transparent: true, locked: false, web_shifted: false }, true))) + .chain( + shot.mapped + .iter() + .map(|c| (TableColor { color: *c, source: *c, transparent: true, locked: false, web_shifted: false, shifted: false }, true)), + ) .collect(); const CELL: f32 = 15.0; let per_row = ((SIDE_W - 8.0) / (CELL + 2.0)).floor().max(1.0) as usize; let lines = rows.len().div_ceil(per_row).max(1); - let (area, resp) = ui.allocate_exact_size(egui::vec2(SIDE_W - 8.0, lines as f32 * (CELL + 2.0)), egui::Sense::click()); + let (area, _) = ui.allocate_exact_size(egui::vec2(SIDE_W - 8.0, lines as f32 * (CELL + 2.0)), egui::Sense::hover()); // The colors that can be selected, in table order (for Shift-click ranges). let order: Vec = rows.iter().filter(|(c, mapped)| !c.transparent || *mapped).map(|(c, _)| hex(c.source)).collect(); let mut clicked = None; + let mut edit = None; let p = ui.painter(); for (i, (c, mapped)) in rows.iter().enumerate() { let r = egui::Rect::from_min_size( @@ -1113,6 +1129,15 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re } } else { p.rect_filled(r, 0.0, fill); + if c.shifted { + // Shifted by hand: the source color at the upper left, the new one at the lower right. + let [red, g, b] = c.source; + p.add(egui::Shape::convex_polygon( + vec![r.left_top(), r.right_top(), r.left_bottom()], + egui::Color32::from_rgb(red, g, b), + egui::Stroke::NONE, + )); + } } let mark = if c.color.iter().map(|v| u32::from(*v)).sum::() > 380 { egui::Color32::BLACK } else { egui::Color32::WHITE }; if c.locked { @@ -1130,14 +1155,28 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re let pickable = !c.transparent || *mapped; let ringed = pickable && picked.iter().any(|h| h.eq_ignore_ascii_case(&hex(c.source))); p.rect_stroke(r, 0.0, egui::Stroke::new(if ringed { 2.0 } else { 1.0 }, if ringed { t.accent } else { t.border }), egui::StrokeKind::Outside); - if pickable && resp.clicked() && resp.interact_pointer_pos().is_some_and(|pos| r.contains(pos)) { + if !pickable { + continue; + } + let resp = ui.interact(r, swatch_id(&hex(c.source)), egui::Sense::click()); + if resp.clicked() { clicked = Some(hex(c.source)); } + // A double-click edits an opaque color: the picker opens on the color as shown, or on the + // source color for a color already shifted by hand. + if resp.double_clicked() && !c.transparent { + edit = Some((hex(c.source), hex(if c.shifted { c.source } else { c.color }))); + } } if let Some(c) = clicked { let m = ui.input(|i| i.modifiers); pick(d, &order, &c, m.shift, m.command); } + if let Some((source, start)) = edit { + d.fields.insert("__editColor".into(), json!(source)); + d.fields.insert("__editStart".into(), json!(start)); + } + let shifted = |c: &str| table.shifted.keys().any(|k| k.eq_ignore_ascii_case(c)); ui.add_space(4.0); let on = |list: &[String]| list.iter().any(|h| h.eq_ignore_ascii_case(&selected)); ui.horizontal(|ui| { @@ -1152,15 +1191,22 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re "webShift" => &table.web_shift, _ => &table.locked, }; - let is_on = on(current); - if widgets::flat_button(ui, if is_on { on_label } else { off_label }, 88.0).clicked() { + // A color shifted by hand stays locked until it is unshifted. + let fixed = list == "locked" && shifted(&selected); + let is_on = on(current) || fixed; + let label = if is_on { on_label } else { off_label }; + if ui.add_enabled(!fixed, |ui: &mut egui::Ui| widgets::flat_button(ui, label, 88.0)).clicked() { toggle(d, list, &selected, !is_on); + // Web Shift replaces a shift by hand. + if list == "webShift" && !is_on { + unshift(d, &selected); + } } } }); }); // Delete Color (the button and the table's menu) and Restore Generated Table. - let (mut delete, mut restore) = (false, false); + let (mut delete, mut restore, mut unshift_all) = (false, false, false); ui.horizontal(|ui| { delete |= widgets::icon_button_enabled(ui, "trash-2", tl!("Delete Color"), false, !picked.is_empty(), 24.0).clicked(); let menu = widgets::icon_button(ui, "menu", tl!("Color Table"), false, 24.0); @@ -1174,6 +1220,10 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re restore = true; ui.close(); } + if widgets::menu_item(ui, tl!("Unshift All Colors"), !table.shifted.is_empty() || !table.web_shift.is_empty(), false) { + unshift_all = true; + ui.close(); + } }); }); let sort = table.sort; @@ -1188,6 +1238,9 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re if restore { restore_table(d); } + if unshift_all { + unshift_all_colors(d); + } if delete { let palette: Vec = shot.colors.iter().filter(|c| !c.transparent).map(|c| hex(c.source)).chain(shot.mapped.iter().map(|c| hex(*c))).collect(); @@ -1285,6 +1338,9 @@ pub(super) fn delete_colors(d: &mut Dialog, palette: &[String]) -> Result<(), St } } } + for c in &picked { + unshift(d, c); + } set_table(d, "customPalette", json!(custom)); set_table(d, "deleted", json!(deleted)); d.fields.remove("__colors"); @@ -1299,6 +1355,71 @@ pub(super) fn restore_table(d: &mut Dialog) { set_table(d, "customPalette", json!([])); } +/// The id of the color table's swatch for the source color `source` (`#rrggbb`). +pub(super) fn swatch_id(source: &str) -> egui::Id { + egui::Id::unique(("sfw-swatch", source.to_ascii_lowercase())) +} + +/// The field of the Color Picker's OK over Save for Web: the color the edited swatch shifts to. +const SHIFT_TO: &str = "__shiftTo"; + +/// The Color Picker over the dialog for the color table's source color `source`, on `start`; its +/// OK shifts the color ([`shift_color`]) and its Cancel leaves the table as it was. Nothing opens +/// when either is not a color. +pub(super) fn edit_color(d: &mut Dialog, source: &str, start: &str) { + let (Some(_), Some(c)) = (vectorcraft_color::Color::from_hex(source), vectorcraft_color::Color::from_hex(start)) else { return }; + d.fields.insert("__shiftSource".into(), json!(source)); + *d = super::color_picker::over_effect(d, SHIFT_TO, c); +} + +/// Back from the Color Picker: its OK's color shifts the color it was opened for. +fn take_shift(d: &mut Dialog) { + let source = d.fields.remove("__shiftSource"); + if let (Some(to), Some(source)) = (d.fields.remove(SHIFT_TO), source) + && let (Some(to), Some(source)) = (to.as_str(), source.as_str()) + { + shift_color(d, source, to); + } +} + +/// Shift the source color `source` to `to` (`colorTable.shifted`), wherever it is in the image; it +/// is no longer web-shifted. Picking the source color itself takes the shift away. The color +/// becomes the selection. Nothing changes when either is not a color. +pub(super) fn shift_color(d: &mut Dialog, source: &str, to: &str) { + let hex = |h: &str| vectorcraft_color::Color::from_hex(h).map(|c| c.to_hex()); + let (Some(source), Some(to)) = (hex(source), hex(to)) else { return }; + unshift(d, &source); + if to != source { + let mut map = shifts(d); + map.insert(source.clone(), json!(to)); + set_table(d, "shifted", Value::Object(map)); + } + toggle(d, "webShift", &source, false); + d.fields.insert("__colors".into(), json!([source])); + d.fields.insert("__color".into(), json!(source)); +} + +/// The `colorTable.shifted` field. +fn shifts(d: &Dialog) -> Map { + d.fields.get("colorTable").and_then(|t| t.get("shifted")).and_then(Value::as_object).cloned().unwrap_or_default() +} + +/// Take the shift by hand of the source color `source` away. +pub(super) fn unshift(d: &mut Dialog, source: &str) { + let mut map = shifts(d); + let before = map.len(); + map.retain(|k, _| !k.eq_ignore_ascii_case(source)); + if map.len() != before { + set_table(d, "shifted", Value::Object(map)); + } +} + +/// Unshift All Colors: no color is shifted by hand or web-shifted. +pub(super) fn unshift_all_colors(d: &mut Dialog) { + set_table(d, "shifted", json!({})); + set_table(d, "webShift", json!([])); +} + /// Add `color` to the colour table's `list`, or take it out. pub(super) fn toggle(d: &mut Dialog, list: &str, color: &str, add: bool) { let mut v: Vec = d.fields.get("colorTable").and_then(|t| t.get(list)).and_then(Value::as_array).cloned().unwrap_or_default(); diff --git a/crates/ui-egui/src/dialogs/tests_save_for_web.rs b/crates/ui-egui/src/dialogs/tests_save_for_web.rs index e27f4b766c..b2a27ffeb5 100644 --- a/crates/ui-egui/src/dialogs/tests_save_for_web.rs +++ b/crates/ui-egui/src/dialogs/tests_save_for_web.rs @@ -783,6 +783,107 @@ fn colour_table_selection_and_delete_color() { assert_eq!((&d.fields["colorTable"]["deleted"], &d.fields["colorTable"]["customPalette"]), (&json!([]), &json!([]))); } +/// A shift by hand replaces a web shift and selects the color; a shift to the color itself takes it +/// away; Unshift All Colors clears both kinds; Delete Color takes a deleted color's shift away. +#[test] +fn colour_table_shift_unshift_and_unshift_all() { + let mut d = Dialog::new(save_for_web::KIND, json!({})); + save_for_web::toggle(&mut d, "webShift", "#123456", true); + save_for_web::shift_color(&mut d, "#123456", "#FF8800"); + assert_eq!(d.fields["colorTable"], json!({"webShift": [], "shifted": {"#123456": "#ff8800"}})); + assert_eq!(save_for_web::selection(&d), ["#123456"]); + // Not a color: nothing changes. + let before = d.fields.clone(); + save_for_web::shift_color(&mut d, "nope", "#000000"); + save_for_web::shift_color(&mut d, "#123456", "nope"); + assert_eq!(d.fields, before); + save_for_web::shift_color(&mut d, "#ABCDEF", "#00ff00"); + save_for_web::shift_color(&mut d, "#123456", "#123456"); + assert_eq!(d.fields["colorTable"]["shifted"], json!({"#abcdef": "#00ff00"})); + save_for_web::toggle(&mut d, "webShift", "#222222", true); + save_for_web::unshift_all_colors(&mut d); + assert_eq!((&d.fields["colorTable"]["shifted"], &d.fields["colorTable"]["webShift"]), (&json!({}), &json!([]))); + let order: Vec = ["#000000", "#222222"].map(String::from).to_vec(); + save_for_web::shift_color(&mut d, "#222222", "#ffffff"); + save_for_web::delete_colors(&mut d, &order).unwrap(); + assert_eq!((&d.fields["colorTable"]["shifted"], &d.fields["colorTable"]["deleted"]), (&json!({}), &json!(["#222222"]))); +} + +/// One frame of `app` in `ctx`, 50 ms after the last. +fn tick(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec) { + let time = ctx.input(|i| i.time) + 0.05; + let screen_rect = Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1400.0, 1000.0))); + let mut out = ctx.run_ui(egui::RawInput { screen_rect, events, time: Some(time), ..Default::default() }, |ui| show(app, ui.ctx())); + out.textures_delta.clear(); +} + +/// Double-click the color table's swatch of the source color `source`. +fn double_click_swatch(app: &mut VectorcraftApp, ctx: &egui::Context, source: &str) { + for _ in 0..3 { + tick(app, ctx, vec![]); + } + let pos = ctx.read_response(save_for_web::swatch_id(source)).unwrap_or_else(|| panic!("no swatch for {source}")).rect.center(); + let button = |pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + tick(app, ctx, vec![egui::Event::PointerMoved(pos), button(true)]); + tick(app, ctx, vec![button(false)]); + tick(app, ctx, vec![button(true)]); + tick(app, ctx, vec![button(false)]); + tick(app, ctx, vec![]); +} + +/// The color the open Color Picker shows. +fn picker_color(app: &VectorcraftApp) -> Option { + let d = app.ui.dialog.as_ref()?; + assert_eq!(d.kind, "colorPicker", "the Color Picker is open"); + d.fields.get("color").and_then(vectorcraft_engine::cmd::color_value).map(|c| c.to_hex()) +} + +/// A double-click on a swatch opens the Color Picker on its color. Cancel changes nothing; OK +/// shifts the color in the table and the saved file. A double-click on a shifted swatch opens the +/// picker on the source color, and Web Shift replaces the shift by hand. +#[test] +fn double_clicking_a_swatch_shifts_its_color() { + let dir = vectorcraft_testkit::temp_dir("sfw-shift-color"); + let (mut app, _) = app(&dir, false); + app.run("shape.rectangle", json!({"x": 40, "y": 0, "width": 20, "height": 40})).unwrap(); + app.run("paint.setFill", json!({"color": "#0000ff"})).unwrap(); + app.run("file.saveForWeb", json!({})).unwrap(); + for (k, v) in [("format", json!("gif")), ("antiAlias", json!("none")), ("dither", json!("none"))] { + set(&mut app, k, v); + } + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let shifted = |app: &VectorcraftApp| app.ui.dialog.as_ref().map(|d| d.fields["colorTable"]["shifted"].clone()); + double_click_swatch(&mut app, &ctx, "#0000ff"); + assert_eq!(picker_color(&app).as_deref(), Some("#0000ff")); + crate::dialogs::cancel(&mut app); + tick(&mut app, &ctx, vec![]); + assert_eq!((kind(&app), shifted(&app)), (Some(save_for_web::KIND), Some(json!({}))), "Cancel shifts nothing"); + double_click_swatch(&mut app, &ctx, "#0000ff"); + set(&mut app, "color", json!("#00ff00")); + confirm(&mut app).unwrap(); + tick(&mut app, &ctx, vec![]); + assert_eq!((kind(&app), shifted(&app)), (Some(save_for_web::KIND), Some(json!({"#0000ff": "#00ff00"}))), "OK shifts the color"); + // The shifted swatch opens on its source color. + double_click_swatch(&mut app, &ctx, "#0000ff"); + assert_eq!(picker_color(&app).as_deref(), Some("#0000ff")); + crate::dialogs::cancel(&mut app); + // Web Shift replaces the shift by hand. + click_text(&mut app, "Web Shift"); + let t = app.ui.dialog.as_ref().unwrap().fields["colorTable"].clone(); + assert_eq!((&t["shifted"], &t["webShift"]), (&json!({}), &json!(["#0000ff"]))); + // Shifted again, the color reaches the saved file and is remembered. + double_click_swatch(&mut app, &ctx, "#0000ff"); + set(&mut app, "color", json!("#00ff00")); + confirm(&mut app).unwrap(); + tick(&mut app, &ctx, vec![]); + let r = confirm(&mut app).unwrap(); + let image = image::open(r["path"].as_str().unwrap()).unwrap().to_rgba8(); + assert_eq!((image.get_pixel(50, 20).0, image.get_pixel(20, 14).0), ([0, 255, 0, 255], [204, 51, 0, 255])); + let remembered = app.session.last_web_settings().color_table; + assert_eq!((remembered.shifted.get("#0000ff").map(String::as_str), remembered.web_shift.len()), (Some("#00ff00"), 0)); +} + /// Click the dialog's text `label` with the pointer (frames a quarter second apart). fn click_text(app: &mut VectorcraftApp, label: &str) { let ctx = egui::Context::default(); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index cda439137f..8310a6fcd5 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -770,6 +770,7 @@ font-technology Variable Променливи Delete Brush Изтриване на четка Delete Color Изтриване на цвят Restore Generated Table Възстановяване на генерираната таблица + Unshift All Colors Преместване назад на всички цветове Delete Character Style Изтриване на стил за знаци Delete Empty Artboards Изтриване на празни работни области Delete Freeform Point Изтриване на свободна точка @@ -4586,6 +4587,7 @@ axis Both И двете @msg choose a location for the package изберете местоположение за пакета @msg clipboard is empty клипбордът е празен @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: поне един цвят трябва да остане в цветовата таблица +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` назовава цвят, който друг ключ също назовава @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` не е цвят като "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: най-много {MAX_TABLE} цвята @msg command `{0}` is not available right now: {1} команда `{0}` не е налична в момента: {1} diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 57ff2c9bad..b342c09b0b 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -3439,6 +3439,7 @@ theme Appearance Izgled Delete Brush Izbriši četkicu Delete Color Izbriši boju Restore Generated Table Vrati generisanu tabelu + Unshift All Colors Poništi pomak svih boja Delete Symbol Izbriši simbol Delete the selected symbol? Izbrisati odabrani simbol? Delete the selected symbols? Izbrisati odabrane simbole? @@ -4989,6 +4990,7 @@ imageTrace Outline Obris @msg choose a location for the package odaberite lokaciju za paket @msg clipboard is empty međuspremnik je prazan @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: barem jedna boja mora ostati u tabeli boja +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` imenuje boju koju imenuje i drugi ključ @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` nije boja poput "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: najviše {MAX_TABLE} boja @msg command `{0}` is not available right now: {1} naredba `{0}` trenutno nije dostupna: {1} diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 48c5b4c00b..a114fb2a72 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -1128,6 +1128,7 @@ antiAlias Sharp Nítid Delete Brush Suprimeix el pinzell Delete Color Suprimeix el color Restore Generated Table Restaura la taula generada + Unshift All Colors Desfés el desplaçament de tots els colors Delete Character Style Suprimeix l’estil de caràcter Delete Data Set Suprimeix el conjunt de dades Delete Data Sets Suprimeix els conjunts de dades @@ -5757,6 +5758,7 @@ digits Malayalam Malaiàlam @msg clipboard is empty el porta-retalls és buit @msg closing needs three anchors el tancament necessita tres punts d’ancoratge @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: almenys un color ha de quedar a la taula de colors +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` indica un color que també indica una altra clau @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` no és un color com "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: com a màxim {MAX_TABLE} colors @msg column docks a set as a dock column, with no anchor or icon column acobla un conjunt com a columna d’acoblament, sense àncora ni icona diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index fe259f7d2a..1e1e551f94 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -3537,6 +3537,7 @@ theme Appearance Motiv Delete Brush Odstranit štětec Delete Color Odstranit barvu Restore Generated Table Obnovit vygenerovanou tabulku + Unshift All Colors Zrušit posun všech barev Delete Symbol Odstranit symbol Delete the selected symbol? Odstranit vybraný symbol? Delete the selected symbols? Odstranit vybrané symboly? @@ -5249,6 +5250,7 @@ liquify-list-end {0}, {1} {0} a {1} @msg choose a location for the package zvolte umístění balíčku @msg clipboard is empty schránka je prázdná @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: v tabulce barev musí zůstat alespoň jedna barva +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` označuje barvu, kterou označuje i jiný klíč @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` není barva jako "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: nejvýše {MAX_TABLE} barev @msg command `{0}` is not available right now: {1} příkaz `{0}` nyní není k dispozici: {1} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 730d909f66..d3d84a0ef1 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5961,6 +5961,7 @@ theme Appearance Udseende Delete Brush Slet pensel Delete Color Slet farve Restore Generated Table Gendan genereret tabel + Unshift All Colors Fjern skift af alle farver Delete Symbol Slet symbol Delete the selected symbol? Vil du slette det markerede symbol? Delete the selected symbols? Vil du slette de markerede symboler? @@ -7449,6 +7450,7 @@ imageTrace Outline Kontur @msg choose a location for the package vælg en placering til pakken @msg clipboard is empty udklipsholderen er tom @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: mindst én farve skal blive i farvetabellen +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` angiver en farve, som en anden nøgle også angiver @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` er ikke en farve som "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: højst {MAX_TABLE} farver @msg command `{0}` is not available right now: {1} kommandoen `{0}` er ikke tilgængelig lige nu: {1} diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 89ab929ec9..f2c05d2dd1 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -773,6 +773,7 @@ font-technology Variable Variabel Delete Brush Pinsel löschen Delete Color Farbe löschen Restore Generated Table Generierte Tabelle wiederherstellen + Unshift All Colors Verschiebung aller Farben aufheben Delete Character Style Zeichenformat löschen Delete Empty Artboards Leere Zeichenflächen löschen Delete Freeform Point Freiformpunkt löschen @@ -4850,6 +4851,7 @@ liquify-list-end {0}, {1} {0} und {1} @msg choose a location for the package wählen Sie einen Speicherort für das Paket @msg clipboard is empty die Zwischenablage ist leer @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: Mindestens eine Farbe muss in der Farbtabelle bleiben +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` bezeichnet eine Farbe, die auch ein anderer Schlüssel bezeichnet @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` ist keine Farbe wie "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: höchstens {MAX_TABLE} Farben @msg command `{0}` is not available right now: {1} der Befehl `{0}` ist derzeit nicht verfügbar: {1} diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 1d67762e3a..4e9c040158 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -751,6 +751,7 @@ font-technology Variable Μεταβλητές Delete Brush Διαγραφή πινέλου Delete Color Διαγραφή χρώματος Restore Generated Table Επαναφορά του παραγόμενου πίνακα + Unshift All Colors Αναίρεση μετατόπισης όλων των χρωμάτων Delete Character Style Διαγραφή στυλ χαρακτήρων Delete Empty Artboards Διαγραφή κενών πινάκων σχεδίασης Delete Freeform Point Διαγραφή ελεύθερου σημείου @@ -4908,6 +4909,7 @@ digits Malayalam Μαλαγιάλαμ @msg choose a location for the package επιλέξτε τοποθεσία συσκευασίας @msg clipboard is empty το πρόχειρο είναι κενό @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: τουλάχιστον ένα χρώμα πρέπει να παραμείνει στον πίνακα χρωμάτων +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: το `{k}` ορίζει ένα χρώμα που ορίζει και άλλο κλειδί @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: το `{h}` δεν είναι έγκυρο χρώμα, όπως το "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: επιτρέπονται το πολύ {MAX_TABLE} χρώματα @msg command `{0}` is not available right now: {1} η εντολή `{0}` δεν είναι διαθέσιμη αυτήν τη στιγμή: {1} diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index f47a234d37..7c2fcc1d2b 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -792,6 +792,7 @@ font-technology Variable Variables Delete Brush Eliminar pincel Delete Color Eliminar color Restore Generated Table Restaurar tabla generada + Unshift All Colors Deshacer cambio de todos los colores Delete Character Style Eliminar estilo de carácter Delete Empty Artboards Eliminar mesas de trabajo vacías Delete Freeform Point Eliminar punto libre @@ -4954,6 +4955,7 @@ liquify-list-end {0}, {1} {0}, {1} @msg choose a location for the package elige una ubicación para el paquete @msg clipboard is empty el portapapeles está vacío @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: al menos un color debe quedar en la tabla de colores +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` indica un color que también indica otra clave @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` no es un color como "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: como máximo {MAX_TABLE} colores @msg command `{0}` is not available right now: {1} el comando `{0}` no está disponible ahora: {1} diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 401c184194..1469f2d824 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -3476,6 +3476,7 @@ theme Appearance Ulkoasu Delete Brush Poista sivellin Delete Color Poista väri Restore Generated Table Palauta luotu taulukko + Unshift All Colors Peru kaikkien värien siirto Delete Symbol Poista symboli Delete the selected symbol? Poistetaanko valittu symboli? Delete the selected symbols? Poistetaanko valitut symbolit? @@ -5178,6 +5179,7 @@ liquify-list-end {0}, {1} {0} ja {1} @msg choose a location for the package valitse paketin sijainti @msg clipboard is empty leikepöytä on tyhjä @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: väritaulukkoon on jäätävä vähintään yksi väri +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` nimeää värin, jonka myös toinen avain nimeää @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` ei ole väri, kuten "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: enintään {MAX_TABLE} väriä @msg command `{0}` is not available right now: {1} komento `{0}` ei ole nyt käytettävissä: {1} diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index c18264aab3..21c4a1581c 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -794,6 +794,7 @@ font-technology Variable Variables Delete Brush Supprimer la forme Delete Color Supprimer la couleur Restore Generated Table Restaurer la table générée + Unshift All Colors Annuler le décalage de toutes les couleurs Delete Character Style Supprimer le style de caractère Delete Empty Artboards Supprimer les plans de travail vides Delete Freeform Point Supprimer le point libre @@ -4916,6 +4917,7 @@ liquify-list-end {0}, {1} {0} et {1} @msg choose a location for the package choisissez un emplacement pour l’assemblage @msg clipboard is empty le presse-papiers est vide @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: au moins une couleur doit rester dans la table des couleurs +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` désigne une couleur qu’une autre clé désigne aussi @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what} : `{h}` n’est pas une couleur comme "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what} : {MAX_TABLE} couleurs au maximum @msg command `{0}` is not available right now: {1} la commande `{0}` n’est pas disponible pour le moment : {1} diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index ab25098e64..6881c14dce 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -905,6 +905,7 @@ Delete Brush બ્રશ કાઢી નાખો Delete Color રંગ કાઢી નાખો Restore Generated Table જનરેટ થયેલું ટેબલ પુનઃસ્થાપિત કરો + Unshift All Colors બધા રંગોનું શિફ્ટ રદ કરો Delete Character Style અક્ષર સ્ટાઇલ કાઢી નાખો Delete Data Set ડેટા સેટ કાઢી નાખો Delete Data Sets ડેટા સેટ્સ કાઢી નાખો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 4cfe7e623b..a30ae988a6 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -1291,6 +1291,7 @@ antiAlias Sharp शार्प Delete Brush ब्रश हटाएँ Delete Color रंग हटाएँ Restore Generated Table जनरेट की गई तालिका पुनर्स्थापित करें + Unshift All Colors सभी रंग अनशिफ़्ट करें Delete Character Style कैरेक्टर स्टाइल हटाएँ Delete Data Set डेटा सेट हटाएँ Delete Data Sets डेटा सेट्स हटाएँ @@ -6862,6 +6863,7 @@ antiAlias Sharp शार्प @msg colorMode must be rgb or cmyk, not `{m}` colorMode को rgb या cmyk होना चाहिए, `{m}` नहीं @msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel को {own} (डॉक्यूमेंट का मोड), grayscale या bitmap होना चाहिए @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: रंग तालिका में कम से कम एक रंग रहना चाहिए +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` वही रंग बताता है जो कोई दूसरी कुंजी भी बताती है @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}`, "#ff8800" जैसा रंग नहीं है @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: अधिकतम {MAX_TABLE} रंग @msg colour groups can't go into colour groups रंग समूह रंग समूहों में नहीं जा सकते हैं diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 9b86b896c6..a2a94fff96 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -1020,6 +1020,7 @@ font-technology Variable Változó Delete Brush Ecset törlése Delete Color Szín törlése Restore Generated Table Előállított tábla visszaállítása + Unshift All Colors Az összes szín eltolásának visszavonása Delete Character Style Karakterstílus törlése Delete Data Set Adatkészlet törlése Delete Empty Artboards Üres rajztáblák törlése @@ -5352,6 +5353,7 @@ imageTrace Outline Körvonal @msg clipboard is empty a vágólap üres @msg closing needs three anchors a lezáráshoz három horgonypont kell @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: legalább egy színnek a színtáblában kell maradnia +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: a(z) `{k}` olyan színt nevez meg, amelyet egy másik kulcs is megnevez @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` nem szín (például "#ff8800") @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: legfeljebb {MAX_TABLE} szín @msg column must be true or a number from 1 a column értéke true vagy 1-től kezdődő szám lehet diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 82205755a8..81736f2ac7 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -3213,6 +3213,7 @@ theme Appearance Tampilan Delete Brush Hapus kuas Delete Color Hapus warna Restore Generated Table Pulihkan tabel yang dibuat + Unshift All Colors Batalkan pergeseran semua warna Delete Symbol Hapus simbol Delete the selected symbol? Hapus simbol yang dipilih? Delete the selected symbols? Hapus simbol yang dipilih? @@ -4700,6 +4701,7 @@ imageTrace Outline Kontur @msg choose a location for the package pilih lokasi untuk paket @msg clipboard is empty papan klip kosong @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: setidaknya satu warna harus tetap ada di tabel warna +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` menyebut warna yang juga disebut kunci lain @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` bukan warna seperti "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: maksimal {MAX_TABLE} warna @msg command `{0}` is not available right now: {1} perintah `{0}` tidak tersedia saat ini: {1} diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index eba8303c86..81c662a41c 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -794,6 +794,7 @@ font-technology Variable Variabili Delete Brush Elimina pennello Delete Color Elimina colore Restore Generated Table Ripristina tabella generata + Unshift All Colors Annulla spostamento di tutti i colori Delete Character Style Elimina stile carattere Delete Empty Artboards Elimina tavole da disegno vuote Delete Freeform Point Elimina punto libero @@ -4984,6 +4985,7 @@ liquify-list-end {0}, {1} {0} e {1} @msg choose a location for the package scegli una posizione per il pacchetto @msg clipboard is empty gli appunti sono vuoti @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: almeno un colore deve restare nella tabella colori +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` indica un colore indicato anche da un’altra chiave @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` non è un colore come "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: al massimo {MAX_TABLE} colori @msg command `{0}` is not available right now: {1} il comando `{0}` non è disponibile in questo momento: {1} diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index a5f4afba8b..6fcd588abd 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -1481,6 +1481,7 @@ antiAlias Sharp シャープ Delete Brush ブラシを削除 Delete Color カラーを削除 Restore Generated Table 生成されたテーブルを復元 + Unshift All Colors すべてのカラーのシフトを戻す Delete Character Style 文字スタイルを削除 Delete Empty Artboards 空のアートボードを削除 Delete Freeform Point フリーフォームポイントを削除 @@ -4970,6 +4971,7 @@ swatch Bright Violet ビビッドバイオレット @msg paste unavailable 貼り付けを使用できません @msg Save for Web: the image is empty Web 用に保存: 画像が空です @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: カラーテーブルには少なくとも 1 つのカラーを残す必要があります +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` は別のキーと同じカラーを指しています @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` は「#ff8800」のような形式のカラーではありません @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: 指定できるカラーは {MAX_TABLE} 色までです @msg no artboard {i} (0-based; the document has {_1}) アートボード {i} はありません (番号は 0 始まり、このドキュメントには {_1} 個あります) diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 493ead6476..13f9657efe 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5303,6 +5303,7 @@ theme Appearance იერსახე Delete Brush ფუნჯის წაშლა Delete Color ფერის წაშლა Restore Generated Table გენერირებული ცხრილის აღდგენა + Unshift All Colors ყველა ფერის წანაცვლების მოხსნა Delete Symbol სიმბოლოს წაშლა Delete the selected symbol? წაიშალოს მონიშნული სიმბოლო? Delete the selected symbols? წაიშალოს მონიშნული სიმბოლოები? @@ -6767,6 +6768,7 @@ font-technology Variable ცვლადი @msg choose a location for the package აირჩიეთ შეფუთვის მდებარეობა @msg clipboard is empty გაცვლის ბუფერი ცარიელია @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: ფერების ცხრილში ერთი ფერი მაინც უნდა დარჩეს +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` ასახელებს ფერს, რომელსაც სხვა გასაღებიც ასახელებს @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` ფერი არ არის, მაგალითად "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: არაუმეტეს {MAX_TABLE} ფერი @msg command `{0}` is not available right now: {1} ბრძანება `{0}` ახლა ხელმისაწვდომი არ არის: {1} diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 497bc1a9d2..91e8ec8c89 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -1471,6 +1471,7 @@ antiAlias Sharp 날카롭게 Delete Brush 브러시 삭제 Delete Color 색상 삭제 Restore Generated Table 생성된 표 복원 + Unshift All Colors 모든 색상 이동 취소 Delete Character Style 문자 스타일 삭제 Delete Empty Artboards 빈 아트보드 삭제 Delete Freeform Point 자유 형태 포인트 삭제 @@ -4897,6 +4898,7 @@ theme Appearance 외관 @msg paste unavailable 붙여넣을 수 없습니다 @msg Save for Web: the image is empty 웹용으로 저장: 이미지가 비어 있습니다 @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: 색상 표에 색상이 하나 이상 남아 있어야 합니다 +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}`이(가) 다른 키와 같은 색상을 가리킵니다 @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}`은(는) "#ff8800" 같은 색상이 아닙니다 @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: 색상은 최대 {MAX_TABLE}개입니다 @msg no artboard {i} (0-based; the document has {_1}) 아트보드 {i}이(가) 없습니다(0부터 시작, 문서의 아트보드 수: {_1}) diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index c78d63f4f7..50b8f1f972 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -3835,6 +3835,7 @@ theme Appearance Vormgeving Delete Brush Penseel verwijderen Delete Color Kleur verwijderen Restore Generated Table Gegenereerde tabel herstellen + Unshift All Colors Verschuiving van alle kleuren ongedaan maken Delete Symbol Symbool verwijderen Delete the selected symbol? Het geselecteerde symbool verwijderen? Delete the selected symbols? De geselecteerde symbolen verwijderen? @@ -5324,6 +5325,7 @@ imageTrace Outline Contour @msg choose a location for the package kies een locatie voor het pakket @msg clipboard is empty het klembord is leeg @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: er moet ten minste één kleur in de kleurentabel blijven +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` noemt een kleur die ook een andere sleutel noemt @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` is geen kleur zoals "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: maximaal {MAX_TABLE} kleuren @msg command `{0}` is not available right now: {1} opdracht `{0}` is nu niet beschikbaar: {1} diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 9bfba7cfec..2e9e223ee4 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -3416,6 +3416,7 @@ theme Appearance Wygląd Delete Brush Usuń pędzel Delete Color Usuń kolor Restore Generated Table Przywróć wygenerowaną tablicę + Unshift All Colors Cofnij przesunięcie wszystkich kolorów Delete Symbol Usuń symbol Delete the selected symbol? Usunąć zaznaczony symbol? Delete the selected symbols? Usunąć zaznaczone symbole? @@ -5072,6 +5073,7 @@ liquify-list-end {0}, {1} {0} i {1} @msg choose a location for the package wybierz lokalizację pakietu @msg clipboard is empty schowek jest pusty @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: w tablicy kolorów musi zostać co najmniej jeden kolor +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` wskazuje kolor, który wskazuje też inny klucz @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` nie jest kolorem w rodzaju "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: maksymalnie {MAX_TABLE} kolorów @msg command `{0}` is not available right now: {1} polecenie `{0}` jest teraz niedostępne: {1} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 23cc28de85..9a671fb528 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -706,6 +706,7 @@ antiAlias Sharp Nítido Delete Brush Excluir Pincel Delete Color Excluir Cor Restore Generated Table Restaurar Tabela Gerada + Unshift All Colors Desfazer Mudança de Todas as Cores Delete Character Style Excluir Estilo de Caractere Delete Empty Artboards Excluir Mesas de Trabalho Vazias Delete Freeform Point Excluir Ponto Livre @@ -4259,6 +4260,7 @@ axis Both Ambos @msg choose a location for the package escolha um local para o pacote @msg clipboard is empty a área de transferência está vazia @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: pelo menos uma cor deve permanecer na tabela de cores +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` indica uma cor que outra chave também indica @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` não é uma cor como "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: no máximo {MAX_TABLE} cores @msg command `{0}` is not available right now: {1} o comando `{0}` não está disponível agora: {1} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index c48ae485d4..013835a0d3 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -790,6 +790,7 @@ font-technology Variable Вариативные Delete Brush Удалить кисть Delete Color Удалить цвет Restore Generated Table Восстановить созданную таблицу + Unshift All Colors Отменить сдвиг всех цветов Delete Character Style Удалить стиль символа Delete Empty Artboards Удалить пустые монтажные области Delete Freeform Point Удалить произвольную точку @@ -4978,6 +4979,7 @@ liquify-list-end {0}, {1} {0} и {1} @msg choose a location for the package выберите расположение для пакета @msg clipboard is empty буфер обмена пуст @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: в цветовой таблице должен остаться хотя бы один цвет +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` обозначает цвет, который обозначает и другой ключ @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` не является цветом, например "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: не более {MAX_TABLE} цветов @msg command `{0}` is not available right now: {1} команда `{0}` сейчас недоступна: {1} diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index f615d40d68..5ec4c83589 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -779,6 +779,7 @@ font-technology Variable Variabla Delete Brush Radera pensel Delete Color Radera färg Restore Generated Table Återställ genererad tabell + Unshift All Colors Ta bort förskjutning av alla färger Delete Character Style Radera teckenstil Delete Empty Artboards Radera tomma ritytor Delete Freeform Point Radera fri punkt @@ -4851,6 +4852,7 @@ liquify-list-end {0}, {1} {0} och {1} @msg choose a location for the package välj en plats för paketet @msg clipboard is empty urklippet är tomt @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: minst en färg måste finnas kvar i färgtabellen +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` anger en färg som även en annan nyckel anger @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` är inte en färg som "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: högst {MAX_TABLE} färger @msg command `{0}` is not available right now: {1} kommandot `{0}` är inte tillgängligt just nu: {1} diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 4f0d6c6894..7246c95df7 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -771,6 +771,7 @@ font-technology Variable Değişken Delete Brush Fırçayı Sil Delete Color Rengi Sil Restore Generated Table Oluşturulan Tabloyu Geri Yükle + Unshift All Colors Tüm Renklerin Kaydırmasını Kaldır Delete Character Style Karakter Stilini Sil Delete Empty Artboards Boş Çalışma Yüzeylerini Sil Delete Freeform Point Serbest Biçim Noktasını Sil @@ -4664,6 +4665,7 @@ liquify-list-end {0}, {1} {0} ve {1} @msg choose a location for the package paket için bir yer seçin @msg clipboard is empty pano boş @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: renk tablosunda en az bir renk kalmalı +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` başka bir anahtarın da belirttiği bir rengi belirtiyor @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}`, "#ff8800" gibi bir renk değil @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: en fazla {MAX_TABLE} renginde @msg command `{0}` is not available right now: {1} `{0}` komutu şu anda kullanılamıyor: {1} diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index fc4b4e9725..3e4e477a4a 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -788,6 +788,7 @@ font-technology Variable Варіативні Delete Brush Видалити пензель Delete Color Видалити колір Restore Generated Table Відновити створену таблицю + Unshift All Colors Скасувати зсув усіх кольорів Delete Character Style Видалити стиль символу Delete Empty Artboards Видалити порожні монтажні області Delete Freeform Point Видалити довільну точку @@ -4968,6 +4969,7 @@ liquify-list-end {0}, {1} {0} і {1} @msg choose a location for the package виберіть розташування для пакета @msg clipboard is empty буфер обміну порожній @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: у колірній таблиці має залишитися принаймні один колір +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` позначає колір, який позначає й інший ключ @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` не є кольором, наприклад "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: не більше {MAX_TABLE} кольорів @msg command `{0}` is not available right now: {1} команда `{0}` зараз недоступна: {1} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 0739521496..80b1f1726f 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -917,6 +917,7 @@ font-technology Variable Biến thiên Delete Brush Xóa cọ Delete Color Xóa màu Restore Generated Table Khôi phục bảng đã tạo + Unshift All Colors Bỏ dịch chuyển tất cả màu Delete Character Style Xóa kiểu ký tự Delete Data Set Xóa tập dữ liệu Delete Design Xóa thiết kế @@ -5010,6 +5011,7 @@ theme Appearance Giao diện @msg clipboard is empty khay nhớ tạm trống @msg closing needs three anchors đóng đường dẫn cần ba điểm neo @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted: phải giữ lại ít nhất một màu trong bảng màu +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted: `{k}` chỉ một màu mà khóa khác cũng chỉ @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` không phải là màu như "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: tối đa {MAX_TABLE} màu @msg column must be true or a number from 1 column phải là true hoặc số từ 1 diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index e9c3117ff4..254b6ab3fc 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -736,6 +736,7 @@ antiAlias Sharp 锐利 Delete Brush 删除画笔 Delete Color 删除颜色 Restore Generated Table 恢复生成的颜色表 + Unshift All Colors 取消偏移所有颜色 Delete Character Style 删除字符样式 Delete Empty Artboards 删除空白画板 Delete Freeform Point 删除自由点 @@ -4662,6 +4663,7 @@ imageTrace Outline 轮廓 @msg paste unavailable 无法粘贴 @msg Save for Web: the image is empty 存储为 Web 所用格式:图像为空 @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted:颜色表中至少要保留一种颜色 +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted:`{k}` 与另一个键指的是同一种颜色 @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}:`{h}` 不是颜色,例如 "#ff8800" @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}:最多 {MAX_TABLE} 种颜色 @msg no artboard {i} (0-based; the document has {_1}) 没有画板 {i} (从 0 开始计数;文档有 {_1} 个) diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 992162d8c9..44c42e6c91 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -756,6 +756,7 @@ font-technology Variable 可變 Delete Brush 刪除筆刷 Delete Color 刪除顏色 Restore Generated Table 還原產生的色彩表 + Unshift All Colors 取消位移所有顏色 Delete Character Style 刪除字元樣式 Delete Empty Artboards 刪除空白工作區域 Delete Freeform Point 刪除任意形狀錨點 @@ -2195,6 +2196,7 @@ file-filter Templates 範本 @msg paste unavailable 無法貼上 @msg Save for Web: the image is empty 儲存為網頁用:影像是空的 @msg colorTable.deleted: at least one color has to stay in the color table colorTable.deleted:色彩表中至少要保留一種顏色 +@msg colorTable.shifted: `{k}` names a color another key names colorTable.shifted:`{k}` 與另一個鍵指的是同一種顏色 @msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}:`{h}` 不是像 "#ff8800" 這樣的顏色 @msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}:最多 {MAX_TABLE} 種顏色 @msg no artboard {i} (0-based; the document has {_1}) 沒有工作區域 {i} (從 0 起算;文件有 {_1} 個) diff --git a/docs/mcp.md b/docs/mcp.md index ae470340e8..35bef291d8 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9018,7 +9018,7 @@ File → Export → Save for Web (Legacy) writes optimised web images: `document …}` renders the artboard (`clipToArtboard`, the default; `artboard` picks one) or the visible art and the slices, at `width`, `height` or `percent`, and encodes it with the format's settings: for GIF and PNG-8 `reduction`, `colors`, `dither`, `ditherAmount`, `transparency`, `matte`, `interlaced`, `webSnap`, `lossy` (GIF) and `colorTable {locked, -transparent, webShift, sort, deleted, customPalette}`; for JPEG `quality`, `progressive`, `optimized`, `embedProfile` and `matte`; for PNG-24 +transparent, webShift, sort, deleted, customPalette, shifted}`; for JPEG `quality`, `progressive`, `optimized`, `embedProfile` and `matte`; for PNG-24 `transparency`, `matte` and `interlaced`. `metadata` (none, copyright, contact, all) writes File Info as PNG text or a GIF/JPEG comment; `convertToSrgb` marks PNGs as sRGB. `` is the name of `path` without its extension, or without `path` the document's title with the characters Windows does not allow in a file name as `-` and a `-` after @@ -9031,7 +9031,7 @@ couldn't be decoded and is missing from the image; the files are written all the `document.exportForWeb.preview` returns what Save writes for the same settings without writing it: `bytes` (the exact file size), `seconds` to download at `kbps` (default 56.6), the size, and for palette formats the colour table -(`colors: [{color, source, transparent, locked, webShifted, webSafe}]`). The colour table's lists name colours by +(`colors: [{color, source, transparent, locked, webShifted, shifted, webSafe}]`). The colour table's lists name colours by `source` (the colour the reduction made), so a colour keeps its edits when it is web-shifted or snapped. `slice: n` previews one slice; `image: true` adds the file; `warnings` holds the export's warnings. @@ -9050,6 +9050,23 @@ clicked). The trash button and Delete Color in the table's menu delete the selec Table in that menu clears `deleted` and `customPalette`, and the table reads Custom while either is set. Choosing another reduction in the dialog also clears them. +Shifting a color is `colorTable.shifted: {"#source": "#rrggbb"…}`, by `source`: every pixel of that color is +written as the color given, in the preview and the file. The color is kept when the colors are reduced, as a +locked one is: the shifted and locked colors take the palette's slots first, shifted ones before locked ones, and at +least one slot is left for the reduction, so with `colors: 2` and transparent pixels none is kept and a color left out +shifts nothing. As with a locked color, a kept source stays in the palette when the art no longer has it, and the +pixels nearest to it are written in the new color. The preview marks it `shifted` and `locked`. A shift by hand wins over `webShift`, `webSnap` and +`locked`; a color mapped to transparent stays transparent. Two colors may be shifted to the same color. A source the +table does not hold shifts nothing, and the shift stays with the settings for when it comes back; another reduction +keeps it. The settings store the map in lowercase, drop a color shifted to itself or deleted, and drop the `webShift` +of a color shifted by hand. More than 256 entries, a key or value that is not a color such as `#ff8800` (`#rrggbbaa` +included), and two keys that name one color are errors. Presets and `webExport.settings` keep the map. In the dialog a double-click on an +opaque swatch opens the Color Picker on the color shown (on the source color for a color already shifted; an agent +sets `__editColor: "#source"`). Its OK shifts the color (picking the source color takes the shift away), and Cancel +leaves the table as it was. A shifted swatch shows the source color at its upper left and the new color at its lower +right, with the lock mark, and Lock stays on until the color is unshifted. Web Shift replaces a shift by hand, and +Unshift All Colors in the table's menu clears `shifted` and `webShift`. Only Web Colors in the picker starts off. + ```json {"name":"run_command","arguments":{"command":"document.exportForWeb.preview","params":{"format":"png8","colorTable":{"deleted":["#ff0000"],"customPalette":["#0000ff","#00ff00","#ff0000"]}}}} ``` diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index d9114d5d57..cdfcaea5fa 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -894,6 +894,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Save for Web: Optimize to File Size… opens rows for a desired file size in K, Start With (Current Settings, Auto Select GIF/JPEG) and, with slices, Use (Total of All Slices, Each Slice, Current Slice); OK takes the settings whose files fit and shows the size found, or says that no setting tried fits ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=395)). The search lowers JPEG quality or palette colors (GIF then lossy) and encodes at most 32 trial settings; Auto Select chooses GIF for transparent art or art of at most 256 colors and JPEG otherwise. The slices share one setting, so every Use choice changes all of them (`webExport.optimizeToFileSize`). Scores and estimates are unchanged. - Save for Web: while Alt (Option on macOS) is held, the dialog's Cancel button reads Reset, which puts the remembered settings back on the document's active artboard and leaves the dialog open (`ui.dialogReset`). - Save for Web: the color table's trash button and Delete Color in its menu remove the selected GIF or PNG-8 colors, and their pixels take the nearest color left in the palette ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=404)). Click selects one color, Shift-click a range and Ctrl-click (Command-click on macOS) adds or removes one ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=398)). After the first deletion the table is a fixed Custom palette, so deleted colors stay out when the preview updates. These rules are VectorCraft's own: a deleted color is no longer locked, transparent or web-shifted; deleting every opaque color is refused; Restore Generated Table in the menu, or another reduction, goes back to the generated palette; presets and the remembered settings keep the edit (`colorTable.deleted`, `colorTable.customPalette`). Fixed palettes can also use all 256 entries when nothing is transparent. Scores and estimates are unchanged. + - Save for Web: double-clicking a GIF or PNG-8 color-table swatch opens the Color Picker, and its OK changes that color to the one picked everywhere it appears in the image. The swatch then shows the original color in its upper-left half and the new one in its lower-right half, with the lock mark, and the color stays through a lower color count. Double-clicking a changed swatch opens the picker on the original color, and OK on it changes the color back; Unshift All Colors in the table's menu undoes every change, web shifts included ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=383)). These rules are VectorCraft's own: Cancel changes nothing; a changed color wins over Web Shift, Web Snap and Lock, and pressing Web Shift replaces it; a color mapped to transparent stays transparent; two colors may change to the same color; a changed color takes a kept palette slot before a locked one, and one slot always stays for the reduction; the change is kept by source color when the reduction changes and applies only while that source is in the table; presets and the remembered settings keep it; the picker opens with Only Web Colors off (`colorTable.shifted`). GIF lossy compression now compares pixels with the reduction's colors, so a changed color does not take in another color's pixels. Scores and estimates are unchanged. - Export for Screens, Save for Web (slice images, and files named after the document's title) and the Libraries panel name files with the characters Windows does not allow written as `-` and with a `-` after a Windows device name such as `CON`, on every platform (`document.exportForScreens`, `document.exportForWeb`, `library.create`). - Variables (data merge): text, visibility and image variables bound to objects (an object may carry several), dataset rows applied in one undo step (`variable.*`, `dataset.*`) from a Variables panel and Window › Variables, with dialogs to define, bind and edit, Make Text/Visibility/Image Dynamic, Capture/Update Data Set, CSV import/export (`dataset.import` / `dataset.export`), and a row in italics when an edit leaves the art not matching it; an image dataset value is a file path and apply keeps the object's bounds; bindings let go of deleted art and locked art is left alone except by visibility values; every command, like the rest, is drivable over MCP and the CLI. - Export for Screens numbers distinct row files whose names collide, compared without case, as `-2`, `-3`… instead of leaving them out; identical rows still write one file. It puts row folders that differ only in case into one folder (`document.exportForScreens`). From dedff4e91e8abe21343125bea67cc8f96514a9d1 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 14:48:43 -0800 Subject: [PATCH 085/158] Save for Web: ui.dialog.set accepts __editColor to open the Color Picker The color table's __editColor control opens the Color Picker on a source color, as a double-click on its swatch does. ui.dialog.set refused it as a protected field; Save for Web now lists it with its other controls. --- crates/ui-egui/src/dialogs.rs | 5 ++-- .../ui-egui/src/dialogs/tests_save_for_web.rs | 24 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 0d5d4d4559..2e3b4cc8ae 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -544,8 +544,9 @@ fn hidden_controls(d: &Dialog) -> &'static [&'static str] { } // The selected rows and Randomize's seed. Some(DialogKind::Recolor) => &["__seed", "__sel"], - // The view, zoom, download speed, selected color table entries and the preset name being typed. - Some(DialogKind::SaveForWeb) => &["__color", "__colors", "__kbps", "__presetName", "__view", "__zoom"], + // The view, zoom, download speed, selected color table entries, the color table entry whose + // Color Picker opens and the preset name being typed. + Some(DialogKind::SaveForWeb) => &["__color", "__colors", "__editColor", "__kbps", "__presetName", "__view", "__zoom"], // The link that keeps width and height in proportion. Some(DialogKind::Shape | DialogKind::TransformEach) => &["__constrain"], // The attention filter, the Keys section, the search text and the key being recorded. diff --git a/crates/ui-egui/src/dialogs/tests_save_for_web.rs b/crates/ui-egui/src/dialogs/tests_save_for_web.rs index b2a27ffeb5..b0d3fd6fdd 100644 --- a/crates/ui-egui/src/dialogs/tests_save_for_web.rs +++ b/crates/ui-egui/src/dialogs/tests_save_for_web.rs @@ -884,6 +884,30 @@ fn double_clicking_a_swatch_shifts_its_color() { assert_eq!((remembered.shifted.get("#0000ff").map(String::as_str), remembered.web_shift.len()), (Some("#00ff00"), 0)); } +/// `ui.dialog.set` accepts `__editColor`, and the next frame opens the Color Picker on that color, +/// whose OK shifts it. +#[test] +fn dialog_set_edit_color_opens_the_color_picker() { + let dir = vectorcraft_testkit::temp_dir("sfw-edit-color-set"); + let (mut app, _) = app(&dir, false); + app.run("shape.rectangle", json!({"x": 40, "y": 0, "width": 20, "height": 40})).unwrap(); + app.run("paint.setFill", json!({"color": "#0000ff"})).unwrap(); + app.run("file.saveForWeb", json!({})).unwrap(); + set(&mut app, "format", json!("gif")); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let (req, _) = crate::control::ControlRequest::new("ui.dialog.set", json!({"field": "__editColor", "value": "#0000ff"})); + let crate::control::Outcome::Done(r) = crate::control::handle(&mut app, &ctx, &req) else { panic!("not done") }; + assert_eq!(r["ok"], true, "{r}"); + tick(&mut app, &ctx, vec![]); + assert_eq!(picker_color(&app).as_deref(), Some("#0000ff")); + set(&mut app, "color", json!("#00ff00")); + confirm(&mut app).unwrap(); + tick(&mut app, &ctx, vec![]); + let shifted = app.ui.dialog.as_ref().map(|d| d.fields["colorTable"]["shifted"].clone()); + assert_eq!((kind(&app), shifted), (Some(save_for_web::KIND), Some(json!({"#0000ff": "#00ff00"})))); +} + /// Click the dialog's text `label` with the pointer (frames a quarter second apart). fn click_text(app: &mut VectorcraftApp, label: &str) { let ctx = egui::Context::default(); From 949171b7153e0ab7c6aac42adf0c12b8fafeeefb Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 15:32:51 -0800 Subject: [PATCH 086/158] Save for Web: GIF lossy moves no pixel into or out of a shifted color Lossy compression compared each pixel with the reduction's colors, so a pixel next to a color shifted by hand could join that color and be written in its new color, and a pixel of the shifted color could leave it. Lossy now leaves the entries of shifted colors alone, as it does the transparent entry. --- crates/engine/src/cmd/webexport.rs | 9 +++++---- crates/engine/src/tests/webexport.rs | 17 +++++++++++++++++ crates/render/src/encode/tests_web.rs | 9 +++++++-- crates/render/src/encode/web.rs | 11 ++++++++--- docs/mcp.md | 3 ++- 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/crates/engine/src/cmd/webexport.rs b/crates/engine/src/cmd/webexport.rs index 30aa9820ab..05a76ae982 100644 --- a/crates/engine/src/cmd/webexport.rs +++ b/crates/engine/src/cmd/webexport.rs @@ -32,7 +32,7 @@ pub fn specs() -> Vec { "Save for Web", [], None, - "{path?, preset?: a webExport.presets name (its settings, then these keys), format?: gif (default)|jpg|png8|png24, reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray (gif/png8, as the next five), colors?: 128 (2–256), dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, webSnap?: 0 (0–100 %: colours that close to a web-safe one become it), lossy?: 0 (0–100, gif), colorTable?: {locked?: [\"#rrggbb\"…] (kept when reducing), transparent?: [\"#rrggbb\"…] (become transparent), webShift?: [\"#rrggbb\"…] (become web-safe), sort?: none|hue|luminance|popularity, deleted?: [\"#rrggbb\"…] (taken out of the table: their pixels take the nearest color left, and at least one color stays), customPalette?: [\"#rrggbb\"…] (a fixed palette used instead of the reduction's, at most `colors` entries; a new reduction without colorTable clears it and deleted), shifted?: {\"#source\": \"#rrggbb\"…} (each source color is written as the color given, wherever it is in the image; kept when reducing as a locked color is, before the locked ones, while one palette slot is left for the reduction; at most 256; a source the table does not hold shifts nothing; a color shifted to itself is removed; a shifted color is not web-shifted, and a transparent one stays transparent)} (colours as the preview's colors[].source; #rrggbbaa and #rgba are refused here and in matte), transparency?: true (gif/png8/png24), matte?: white (default)|black|none|\"#rrggbb\" (what edges blend into; jpg and opaque png24: the background), interlaced?: false (gif/png8/png24), quality?: 60 (jpg: 0–100), progressive?: false (jpg), optimized?: true (jpg), embedProfile?: false (jpg: sRGB profile), width?: px | height?: px | percent?: 100 (the image size, proportional; width wins over height, height over percent), antiAlias?: none|art (default)|type, clipToArtboard?: true (the artboard; false: the art and the slices), artboard?: 0 (0-based), convertToSrgb?: true (PNG files say they are sRGB), metadata?: none|copyright (default)|contact|all (File Info written as PNG text, a GIF or JPEG comment), slices?: all (default)|selected|none (one image per slice: images/.), output?: images (default)|html (an HTML page placing the image or slices, .html)} → {path, files: [path…], bytes (total), width, height, warnings: [] or [a note that an image couldn't be decoded and is missing from the image]}; no path → {files: [{name, dataBase64}], bytes, width, height, warnings} (names such as page.html, images/page_01.gif). A single image without HTML is written at path itself", + "{path?, preset?: a webExport.presets name (its settings, then these keys), format?: gif (default)|jpg|png8|png24, reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray (gif/png8, as the next five), colors?: 128 (2–256), dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, webSnap?: 0 (0–100 %: colours that close to a web-safe one become it), lossy?: 0 (0–100, gif), colorTable?: {locked?: [\"#rrggbb\"…] (kept when reducing), transparent?: [\"#rrggbb\"…] (become transparent), webShift?: [\"#rrggbb\"…] (become web-safe), sort?: none|hue|luminance|popularity, deleted?: [\"#rrggbb\"…] (taken out of the table: their pixels take the nearest color left, and at least one color stays), customPalette?: [\"#rrggbb\"…] (a fixed palette used instead of the reduction's, at most `colors` entries; a new reduction without colorTable clears it and deleted), shifted?: {\"#source\": \"#rrggbb\"…} (each source color is written as the color given, wherever it is in the image; kept when reducing as a locked color is, before the locked ones, while one palette slot is left for the reduction; at most 256; a source the table does not hold shifts nothing; a color shifted to itself is removed; a shifted color is not web-shifted, and a transparent one stays transparent; GIF lossy moves no pixel into or out of a shifted color)} (colours as the preview's colors[].source; #rrggbbaa and #rgba are refused here and in matte), transparency?: true (gif/png8/png24), matte?: white (default)|black|none|\"#rrggbb\" (what edges blend into; jpg and opaque png24: the background), interlaced?: false (gif/png8/png24), quality?: 60 (jpg: 0–100), progressive?: false (jpg), optimized?: true (jpg), embedProfile?: false (jpg: sRGB profile), width?: px | height?: px | percent?: 100 (the image size, proportional; width wins over height, height over percent), antiAlias?: none|art (default)|type, clipToArtboard?: true (the artboard; false: the art and the slices), artboard?: 0 (0-based), convertToSrgb?: true (PNG files say they are sRGB), metadata?: none|copyright (default)|contact|all (File Info written as PNG text, a GIF or JPEG comment), slices?: all (default)|selected|none (one image per slice: images/.), output?: images (default)|html (an HTML page placing the image or slices, .html)} → {path, files: [path…], bytes (total), width, height, warnings: [] or [a note that an image couldn't be decoded and is missing from the image]}; no path → {files: [{name, dataBase64}], bytes, width, height, warnings} (names such as page.html, images/page_01.gif). A single image without HTML is written at path itself", has_doc, export ), @@ -814,10 +814,11 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 *slot = *c; } } - // Lossy compares the pixels with the colors the reduction made, so that a shifted color does - // not take in the pixels of another color. + // Lossy compares the pixels with the colors the reduction made, and moves no pixel into or out + // of a color shifted by hand. if s.format == WebFormat::Gif { - web::lossy(&mut ix, rgba, s.lossy); + let fixed: Vec = sources.iter().enumerate().filter(|(_, c)| shifted_to(c).is_some()).filter_map(|(i, _)| u8::try_from(i).ok()).collect(); + web::lossy(&mut ix, rgba, s.lossy, &fixed); } // The colors shifted by hand, then web shift and web snap (locked colors stay as they are). let clear = ix.transparent.map(usize::from); diff --git a/crates/engine/src/tests/webexport.rs b/crates/engine/src/tests/webexport.rs index 730c81dcd0..e3ea53fcac 100644 --- a/crates/engine/src/tests/webexport.rs +++ b/crates/engine/src/tests/webexport.rs @@ -639,6 +639,23 @@ fn lossy_does_not_spread_a_shifted_color_into_another() { assert_eq!((img.get_pixel(5, 5).0, img.get_pixel(20, 5).0, img.get_pixel(29, 5).0), ([190, 0, 0, 255], [200, 0, 0, 255], [200, 0, 0, 255])); } +/// Lossy GIF compression moves no pixel into or out of a color shifted by hand: the colors next to +/// a shifted one keep their own pixels, and the shifted color keeps all of its pixels. +#[test] +fn lossy_moves_no_pixel_into_or_out_of_a_shifted_color() { + let mut s = session(30.0, 10.0); + rect(&mut s, [0.0, 0.0, 10.0, 10.0], "#1414e6"); + rect(&mut s, [10.0, 0.0, 20.0, 10.0], "#0000ff"); + rect(&mut s, [20.0, 0.0, 30.0, 10.0], "#1414e6"); + let p = json!({"format": "gif", "dither": "none", "lossy": 100, "colorTable": {"shifted": {"#0000ff": "#ff0000"}}}); + let img = pixels(&one(&mut s, p)); + let near_blue = [20, 20, 230, 255]; + for x in 0..30 { + let want = if (10..20).contains(&x) { [255, 0, 0, 255] } else { near_blue }; + assert_eq!(img.get_pixel(x, 5).0, want, "x = {x}"); + } +} + #[test] fn presets_and_remembered_settings() { let mut s = two_colours(); diff --git a/crates/render/src/encode/tests_web.rs b/crates/render/src/encode/tests_web.rs index 10063a5da4..7eb480a414 100644 --- a/crates/render/src/encode/tests_web.rs +++ b/crates/render/src/encode/tests_web.rs @@ -80,14 +80,19 @@ fn lossy_makes_runs_and_smaller_gifs() { let px = image(96, 64, |x, y| [(x * 2 + y) as u8, (y * 3) as u8, ((x * y) % 255) as u8]); let ix = quantize(&px, 96, 64, &PaletteOptions { colors: 64, dither: Dither::Diffusion, ..Default::default() }); let mut lossy_ix = ix.clone(); - lossy(&mut lossy_ix, &px, 80); + lossy(&mut lossy_ix, &px, 80, &[]); let runs = |ix: &Indexed| ix.indices.windows(2).filter(|w| w[0] != w[1]).count(); assert!(runs(&lossy_ix) < runs(&ix)); let size = |ix: &Indexed| gif::encode(ix, false).unwrap().len(); assert!(size(&lossy_ix) < size(&ix), "{} vs {}", size(&lossy_ix), size(&ix)); let mut none = ix.clone(); - lossy(&mut none, &px, 0); + lossy(&mut none, &px, 0, &[]); assert_eq!(none, ix); + // A fixed entry keeps its pixels and takes no others. + let fixed: Vec = (0..ix.palette.len()).filter_map(|i| u8::try_from(i).ok()).collect(); + let mut kept = ix.clone(); + lossy(&mut kept, &px, 100, &fixed); + assert_eq!(kept, ix); } #[test] diff --git a/crates/render/src/encode/web.rs b/crates/render/src/encode/web.rs index 2a26a336d1..3d572cf9ce 100644 --- a/crates/render/src/encode/web.rs +++ b/crates/render/src/encode/web.rs @@ -83,19 +83,24 @@ pub fn to_transparent(ix: &mut Indexed, mapped: impl Fn(usize) -> bool) -> Vec().0; for (row, src) in ix.indices.chunks_mut(w).zip(px.chunks(w)) { for x in 1..row.len() { let (prev, cur) = (row[x - 1], row[x]); - if prev == cur || ix.transparent.is_some_and(|t| t == prev || t == cur) { + if prev == cur || held[usize::from(prev)] || held[usize::from(cur)] { continue; } let (Some(c), Some(p)) = (src.get(x), ix.palette.get(prev as usize)) else { continue }; diff --git a/docs/mcp.md b/docs/mcp.md index 35bef291d8..2975f64d03 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9056,7 +9056,8 @@ locked one is: the shifted and locked colors take the palette's slots first, shi least one slot is left for the reduction, so with `colors: 2` and transparent pixels none is kept and a color left out shifts nothing. As with a locked color, a kept source stays in the palette when the art no longer has it, and the pixels nearest to it are written in the new color. The preview marks it `shifted` and `locked`. A shift by hand wins over `webShift`, `webSnap` and -`locked`; a color mapped to transparent stays transparent. Two colors may be shifted to the same color. A source the +`locked`; a color mapped to transparent stays transparent. GIF `lossy` moves no pixel into or out of a shifted color. +Two colors may be shifted to the same color. A source the table does not hold shifts nothing, and the shift stays with the settings for when it comes back; another reduction keeps it. The settings store the map in lowercase, drop a color shifted to itself or deleted, and drop the `webShift` of a color shifted by hand. More than 256 entries, a key or value that is not a color such as `#ff8800` (`#rrggbbaa` From d0de7581559f64e0c6a93c7dcdd037c3a64fb33e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 16:30:39 -0800 Subject: [PATCH 087/158] Rerun CI From 8842a9d6eac3a4b34bc7ea7cf2c3703d2700eb18 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 16:30:43 -0800 Subject: [PATCH 088/158] Rerun CI From 52c696379c86bbe61c552d4b8b03636ac5747e46 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 16:31:28 -0800 Subject: [PATCH 089/158] Rerun CI From 03c8a4ba1bfa8e2fee4dd35ca715c64263608691 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 16:32:04 -0800 Subject: [PATCH 090/158] Rerun CI From bcc2a5ed37224a0c580c2752c869b31b7b1e0546 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 16:50:30 -0800 Subject: [PATCH 091/158] Pathfinder: warn when open subpaths cancel each other under the fill rule Make Compound Shape now also warns when a member's subpaths, all closed, enclose no area together: two open evenodd squares on top of each other, or an open evenodd square over the same closed square. Each subpath is still checked on its own, so a line beside a square still warns. A path with one subpath skips the combined check, and an area that can't be measured gives no warning. --- crates/engine/src/cmd/compoundshape.rs | 29 ++++++++++++++++------- crates/engine/src/tests/compound_shape.rs | 18 ++++++++++++-- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/crates/engine/src/cmd/compoundshape.rs b/crates/engine/src/cmd/compoundshape.rs index 74257b528f..b1c610d8bd 100644 --- a/crates/engine/src/cmd/compoundshape.rs +++ b/crates/engine/src/cmd/compoundshape.rs @@ -8,7 +8,7 @@ use std::sync::Arc; use serde_json::{Value, json}; use vectorcraft_doc::{Document, Node, NodeId, NodeKind, ShapeMode}; -use vectorcraft_geom::{FillRule, PathData}; +use vectorcraft_geom::{FillRule, PathData, SubPath}; use vectorcraft_pathops as po; use vectorcraft_render::effects; @@ -195,9 +195,11 @@ fn make(s: &mut Session, p: &Value) -> Result { /// Member `n` holds an open path that adds no area to a compound shape: one of the paths it takes /// part as ([`effects::member_leaves`]), inside a group or a compound path too, has an open subpath -/// that encloses no area once closed (a straight line, or an evenodd contour traced twice). The area -/// is the one the path's fill rule gives, which also keeps a self-crossing path whose signed area -/// is zero (a bow tie) from the warning, as Divide measures it. +/// that encloses no area once closed (a straight line, or an evenodd contour traced twice), or it +/// has an open subpath and its subpaths, all closed, enclose no area together (open evenodd +/// subpaths that cancel one another or a closed subpath). The area is the one the path's fill rule +/// gives, which also keeps a self-crossing path whose signed area is zero (a bow tie) from the +/// warning, as Divide measures it. An area that can't be measured gives no warning. fn adds_no_area(d: &Document, n: &Node, hook: effects::OutlineHook) -> bool { effects::member_leaves(Some(d), n, Some(hook)).iter().any(|leaf| { let (paths, rule): (Vec<&PathData>, FillRule) = match &leaf.kind { @@ -205,13 +207,22 @@ fn adds_no_area(d: &Document, n: &Node, hook: effects::OutlineHook) -> bool { NodeKind::Path { path, rule, .. } => (vec![path], *rule), _ => return false, }; - paths.iter().flat_map(|p| &p.subpaths).filter(|sp| !sp.closed).any(|sp| { - let mut closed = sp.clone(); - closed.closed = true; + let subpaths: Vec<&SubPath> = paths.iter().flat_map(|p| &p.subpaths).collect(); + if subpaths.iter().all(|sp| sp.closed) { + return false; + } + let closed = |sp: &SubPath| { + let mut sp = sp.clone(); + sp.closed = true; + sp + }; + // An area that can't be measured counts as an area, so a failed measurement gives no warning. + let no_area = |p: PathData| po::try_area(&p, rule).is_ok_and(|a| a <= 0.0); + subpaths.iter().filter(|sp| !sp.closed).any(|sp| { // The signed-area test alone only holds for nonzero: evenodd can fill nothing where // the signed area is not zero (a contour traced twice). - !(rule == FillRule::NonZero && po::encloses_area(sp)) && po::area(&PathData::single(closed), rule) <= 0.0 - }) + !(rule == FillRule::NonZero && po::encloses_area(sp)) && no_area(PathData::single(closed(sp))) + }) || (subpaths.len() > 1 && no_area(PathData::new(subpaths.iter().map(|sp| closed(sp)).collect()))) }) } diff --git a/crates/engine/src/tests/compound_shape.rs b/crates/engine/src/tests/compound_shape.rs index 8127ea5bcb..0057af9253 100644 --- a/crates/engine/src/tests/compound_shape.rs +++ b/crates/engine/src/tests/compound_shape.rs @@ -702,7 +702,8 @@ fn a_locked_or_hidden_layer_keeps_the_isolated_compound_shape_from_clicks() { /// place in the stack, and its reply carries a warning that names Outline Stroke. The shape draws /// the area the other members make in that mode: the square alone in Add, or on top in Subtract, /// and nothing in Intersect or when the line is the backmost member in Subtract. A line in a group, -/// beside a closed path too, and an open evenodd square traced twice are the same. An open path that encloses an area once closed (a bow tie +/// beside a closed path too, an open evenodd square traced twice, and open evenodd subpaths that cancel one another or a closed +/// subpath of the same path are the same. An open path that encloses an area once closed (a bow tie /// whose lobes cancel in signed area included) and closed shapes alone give no warning (#7849). #[test] fn lines_that_add_no_area_are_reported() { @@ -724,6 +725,17 @@ fn lines_that_add_no_area_are_reported() { run(s, "path.setFillRule", json!({"rule": "evenOdd"})); id } + fn evenodd_of(s: &mut Session, d: &str) -> NodeId { + let id = NodeId(run(s, "path.create", json!({ "d": d }))["id"].as_u64().unwrap()); + run(s, "path.setFillRule", json!({"rule": "evenOdd"})); + id + } + fn two_open_squares_of(s: &mut Session) -> NodeId { + evenodd_of(s, "M20 20 L80 20 L80 80 L20 80 M20 20 L80 20 L80 80 L20 80") + } + fn open_over_closed_of(s: &mut Session) -> NodeId { + evenodd_of(s, "M20 20 L80 20 L80 80 L20 80 Z M20 20 L80 20 L80 80 L20 80") + } fn group_of(s: &mut Session, ids: &[NodeId]) -> NodeId { run(s, "select.set", json!({"ids": ids.iter().map(|i| i.0).collect::>()})); NodeId(run(s, "object.group", json!({}))["id"].as_u64().unwrap()) @@ -731,8 +743,10 @@ fn lines_that_add_no_area_are_reported() { type Build = fn(&mut Session) -> NodeId; // (case, mode, the other member, whether it goes behind the 100 pt square, warned, area drawn) type Case = (&'static str, &'static str, Build, bool, bool, Option); - let cases: [Case; 11] = [ + let cases: [Case; 13] = [ ("an open evenodd square traced twice", "add", twice_around_of, false, true, Some(10_000.0)), + ("two open evenodd squares on one another", "add", two_open_squares_of, false, true, Some(10_000.0)), + ("an open evenodd square on the same closed square", "add", open_over_closed_of, false, true, Some(10_000.0)), ("a line", "add", line_of, false, true, Some(10_000.0)), ("a line, subtracting", "subtract", line_of, false, true, Some(10_000.0)), ("a line, intersecting", "intersect", line_of, false, true, Some(0.0)), From 375b2a23e1f13374f346b7aa735376515fdec6c6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 17:14:05 -0800 Subject: [PATCH 092/158] Preview Bristle brush tip for rotation-capable pens --- crates/tools/src/draw2/gesture.rs | 44 +++++++++++++-- crates/tools/src/draw2/gesture/tests.rs | 71 +++++++++++++++++++++++++ crates/ui-egui/src/canvas/input.rs | 2 +- crates/ui-egui/src/canvas/tests.rs | 29 ++++++++++ docs/target-app-parity.md | 1 + 5 files changed, 142 insertions(+), 5 deletions(-) diff --git a/crates/tools/src/draw2/gesture.rs b/crates/tools/src/draw2/gesture.rs index 502fd16dbd..c753745f3a 100644 --- a/crates/tools/src/draw2/gesture.rs +++ b/crates/tools/src/draw2/gesture.rs @@ -37,7 +37,7 @@ use std::collections::{BTreeMap, BTreeSet}; use std::sync::Arc; use serde_json::{Value, json}; -use vectorcraft_brush::{Calligraphic, Variation}; +use vectorcraft_brush::{BristleShape, BrushKind, Calligraphic, Variation}; use vectorcraft_doc::{NodeId, NodeKind}; use vectorcraft_geom::{Affine, BezPath, FillRule, ParamCurve, PathData, PathSeg, Point, Rect, Vec2, shapes}; use vectorcraft_pathops as po; @@ -200,6 +200,9 @@ pub struct GestureTool { /// Where the Blob Brush's or the Eraser's tip outline shows: the pointer over the canvas, /// unless Cmd/Ctrl lends a selection tool or Alt the Smooth tool. tip_at: Option, + /// The last rotation-capable pen over the Paintbrush's Bristle tip; a mouse or a pen without + /// barrel rotation has no tip annotator. + bristle_pen: Option<(PenPose, f64)>, /// A pen pressed less than fully at a point of the stroke whose pressure is kept. light: bool, /// Which way the pen leaned at the last point of the stroke where it leaned 1° or more from @@ -899,6 +902,7 @@ impl GestureTool { snap: DrawSnap::default(), pressed: Point::ZERO, tip_at: None, + bristle_pen: None, light: false, bearing: None, bearings: vec![], @@ -1088,12 +1092,46 @@ impl GestureTool { p } + fn pointer_tip(&mut self, cx: &ToolContext, ev: &PointerEvent) { + if self.varies_size() { + self.tip_at = (!ev.mods.cmd && !self.blob_alt_smooths(ev.mods)).then_some(ev.pos); + } else if self.id == "paintbrush" { + self.bristle_pen = + ev.pen.filter(|pen| pen.rotation.is_some()).map(|pen| (pen, if ev.kind == PointerKind::Move { 0.5 } else { f64::from(ev.pressure) })); + let borrows_smooth = !self.active && ev.mods.alt && has_selected_smooth_path(cx); + self.tip_at = self.bristle_pen.filter(|_| !ev.mods.cmd && !borrows_smooth).map(|_| ev.pos); + } + } + /// The Blob Brush's or the Eraser's tip at the pointer, before and while painting: its outline /// `size` across at its angle and roundness (the Eraser's as the pen varies them while it /// erases, [`Self::tip_now`]), at the zoom, black on a white halo so it reads on /// any art. Precise cursors show only the crosshair, and smoothing shows no tip. fn tip_outline(&self, cx: &ToolContext) -> Vec { let Some(at) = self.tip_at.filter(|_| !self.smoothing && !cx.precise_cursors) else { return vec![] }; + if self.id == "paintbrush" { + let Some((pose, pressure)) = self.bristle_pen else { return vec![] }; + let Some(name) = vectorcraft_brush::current(cx.doc) else { return vec![] }; + let Some(brush) = vectorcraft_brush::find(cx.doc, &name) else { return vec![] }; + let BrushKind::Bristle(bristle) = brush.kind else { return vec![] }; + let [pressure, tilt, bearing, rotation] = super::pen_controls(pressure, Some(pose), super::pen_bearing(pose)); + let size = bristle.size.max(0.1) * cx.paint.stroke_width.max(0.0) * (0.5 + pressure) * (1.25 - 0.5 * tilt); + if size <= 0.0 { + return vec![]; + } + let roundness = match bristle.shape { + BristleShape::RoundFan | BristleShape::FlatFan => 0.25, + BristleShape::FlatPoint | BristleShape::FlatBlunt | BristleShape::FlatCurve | BristleShape::FlatAngle => 0.45, + _ => 0.8, + }; + let angle = std::f64::consts::TAU * (bearing + rotation - 1.0); + let circle = kurbo::Shape::to_path(&kurbo::Circle::new(Point::ORIGIN, size / 2.0), size.max(0.1) * 0.05); + let path = Affine::translate(at.to_vec2()) * Affine::rotate(-angle) * Affine::scale_non_uniform(1.0, roundness) * circle; + return vec![ + Overlay::Path { path: path.clone(), color: [0xff, 0xff, 0xff], width: 3.0, dashed: false }, + Overlay::Path { path, color: [0, 0, 0], width: 1.0, dashed: false }, + ]; + } let [angle, roundness, size] = self.tip_now(); let tip = if self.id == "blobBrush" { blob_tip(angle, roundness) } else { eraser_tip(angle, roundness) }; let r = size / 2.0; @@ -1587,9 +1625,7 @@ impl Tool for GestureTool { } fn pointer(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec { let p = ev.pos; - if self.varies_size() { - self.tip_at = (!ev.mods.cmd && !self.blob_alt_smooths(ev.mods)).then_some(p); - } + self.pointer_tip(cx, ev); if let Some(out) = self.marquee_pointer(cx, ev) { return out; } diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index 550e7f9d32..5370b43825 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -3043,6 +3043,77 @@ fn the_blob_brush_and_the_eraser_show_their_tip_at_the_pointer() { } } +/// A rotation-capable pen shows the current Bristle brush's tip before and during a Paintbrush +/// stroke. A mouse, a pen without rotation, precise cursors and a borrowed selection tool do not. +#[test] +fn bristle_tip_annotator_follows_a_rotation_capable_pen() { + let (mut d, id) = doc_with_rect(); + d.unknown.insert(vectorcraft_brush::CURRENT_KEY.into(), json!("Bristle Flat Fan")); + let s = Selection::default(); + let p = paint(); + let view = cx(&d, &s, &p); + let bounds = |t: &GestureTool, cx: &ToolContext| { + let overlays = t.overlays(cx); + let Some(Overlay::Path { path, color: [0, 0, 0], width: 1.0, .. }) = overlays.last() else { return None }; + assert!(matches!(overlays.get(overlays.len() - 2), Some(Overlay::Path { color: [0xff, 0xff, 0xff], width: 3.0, .. }))); + Some(vectorcraft_geom::Shape::bounding_box(path)) + }; + let mut tool = GestureTool::new("paintbrush"); + let at = + |rotation| PointerEvent { pen: Some(PenPose { tilt: Some([30.0, 0.0]), rotation }), ..PointerEvent::new(PointerKind::Move, 100.0, 50.0) }; + assert!(bounds(&tool, &view).is_none()); + tool.pointer(&view, &PointerEvent::new(PointerKind::Move, 100.0, 50.0)); + assert!(bounds(&tool, &view).is_none(), "mouse"); + tool.pointer(&view, &at(None)); + assert!(bounds(&tool, &view).is_none(), "pen without rotation"); + tool.pointer(&view, &at(Some(0.0))); + let horizontal = bounds(&tool, &view).expect("rotating pen shows a tip"); + let mut selected = Selection::default(); + selected.set([id]); + let selected_view = cx(&d, &selected, &p); + tool.pointer(&selected_view, &at(Some(0.0)).with_mods(Mods { alt: true, ..Default::default() })); + assert!(bounds(&tool, &selected_view).is_none(), "Alt borrows Smooth for a selected path"); + tool.pointer(&view, &at(Some(0.0))); + let mut wider_paint = p.clone(); + wider_paint.stroke_width = 10.0; + let wider_view = cx(&d, &s, &wider_paint); + let wider = bounds(&tool, &wider_view).expect("stroke width scales the tip"); + assert!((wider.width() - horizontal.width() * 10.0).abs() < 1e-6, "{horizontal:?}, {wider:?}"); + wider_paint.stroke_width = 0.0; + assert!(bounds(&tool, &cx(&d, &s, &wider_paint)).is_none(), "a zero-width stroke has no tip"); + tool.pointer(&view, &at(Some(90.0))); + let vertical = bounds(&tool, &view).expect("tip turns with the barrel"); + assert!(horizontal.width() > horizontal.height() * 2.0, "{horizontal:?}"); + assert!(vertical.height() > vertical.width() * 2.0, "{vertical:?}"); + let mut light = at(Some(0.0)); + light.kind = PointerKind::Down; + light.pressure = 0.1; + tool.pointer(&view, &light); + let light_tip = bounds(&tool, &view).expect("light pressure shows a smaller tip"); + let mut heavy = light; + heavy.kind = PointerKind::Drag; + heavy.pressure = 0.9; + tool.pointer(&view, &heavy); + let heavy_tip = bounds(&tool, &view).expect("heavy pressure shows a larger tip"); + assert!(heavy_tip.width() > light_tip.width() * 1.5, "{light_tip:?}, {heavy_tip:?}"); + let mut release = heavy; + release.kind = PointerKind::Up; + tool.pointer(&view, &release); + let precise = ToolContext { precise_cursors: true, ..cx(&d, &s, &p) }; + assert!(bounds(&tool, &precise).is_none()); + tool.pointer(&view, &at(Some(0.0)).with_mods(Mods { cmd: true, ..Default::default() })); + assert!(bounds(&tool, &view).is_none(), "selection tool borrowed by Cmd"); + tool.pointer(&view, &at(Some(0.0))); + tool.hover_ended(&view); + assert!(bounds(&tool, &view).is_none(), "leaving the canvas"); + + let (mut d, _) = doc_with_rect(); + d.unknown.insert(vectorcraft_brush::CURRENT_KEY.into(), json!("3 pt. Round")); + let calligraphic = cx(&d, &s, &p); + tool.pointer(&calligraphic, &at(Some(0.0))); + assert!(bounds(&tool, &calligraphic).is_none(), "other brush types keep their cursor"); +} + /// Eraser Tool Options' Angle, Roundness and Size variation menus: the Eraser keeps each mode and /// Variation, the release sends them with the pen's readings along the drag, and while it erases /// its tip outline at the pointer takes the angle, roundness and size the pen gives there. The Blob diff --git a/crates/ui-egui/src/canvas/input.rs b/crates/ui-egui/src/canvas/input.rs index d811ad3bac..f711d4cb36 100644 --- a/crates/ui-egui/src/canvas/input.rs +++ b/crates/ui-egui/src/canvas/input.rs @@ -145,7 +145,7 @@ pub(super) fn handle_input(app: &mut VectorcraftApp, ui: &Ui, resp: &egui::Respo mods: mods(m, space), backquote: ui.input(|i| i.key_down(egui::Key::Backtick)), pressure: 1.0, - pen: None, + pen: pen_pose(app, &xf), }; dispatch(app, &ev, view); } diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 34d0777c51..91236c86bb 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -11004,6 +11004,35 @@ fn the_tip_brings_back_the_perspective_grid_tool_without_showing_the_grid() { assert!(!visible(&app), "the grid stays hidden"); } +/// The native pen feed's barrel rotation reaches the Paintbrush during canvas hover, before any +/// stroke begins. +#[test] +fn bristle_pen_tip_reaches_the_canvas_before_a_press() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + let feed = StylusFeed::default(); + app.services.stylus = Some(feed.clone()); + app.session.execute("file.new", &json!({"width": 800, "height": 600})).unwrap(); + app.session.execute("brush.setCurrent", &json!({"name": "Bristle Flat Fan"})).unwrap(); + app.select_tool("paintbrush"); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + let at = app.canvas_rect.unwrap().center(); + let tip = |app: &mut VectorcraftApp| { + app.session.overlays(app.view_info()).into_iter().find_map(|o| match o { + vectorcraft_tools::Overlay::Path { path, color: [0, 0, 0], width: 1.0, .. } => Some(path.bounding_box()), + _ => None, + }) + }; + feed.set_sample(Some(crate::stylus::PenSample { + pressure: 0.0, + pose: PenPose { rotation: Some(0.0), ..Default::default() }, + ..Default::default() + })); + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(at)]); + let horizontal = tip(&mut app).expect("hovering pen shows its brush tip"); + assert!(horizontal.width() > horizontal.height() * 2.0, "{horizontal:?}"); +} + /// #764: the pen's tilt and barrel rotation in the host's feed reach the Paintbrush's points, /// the tilt turned onto the page when the view is rotated; a mouse's points carry neither. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index ef83de54ad..4fe782d668 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1806,6 +1806,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Scatter, Art and Pattern Brush Options have the Tips button for Colorization that the [Brushes](https://web.archive.org/web/20241230205225/https://helpx.adobe.com/illustrator/using/brushes.html) page (archived copy) describes, beside Method. It opens Colorization Tips, which shows each method's name and what it does beside a sample of the brush, as OK would make it, painted with that method on a blue stroke; Hue Shift's sample uses the dialog's Key Color. `ui.dialog.set {field: "tips", value: true}` opens it. Screen readers name the button, the popover and each sample. Hue Shift set by `brush.new` or `brush.options` without a key color takes the color the art's fills and strokes use most, as Brush Options already offers it, following the Brushes page, where the key color defaults to the color that stands out most in the art (). The page does not state how prominence is measured. Counting the fills and strokes that use each solid color, with the first one found winning a tie and black for art with no solid color, is VectorCraft's own rule. A `brush.options` edit that gives only the method keeps the brush's key color, and one that gives only an art brush's start guide keeps its end guide. Evidence: `tests_brushsym::hue_shift_without_a_key_takes_the_most_used_art_color`, `tests_brushsym::art_brush_options_keep_the_scale_fields_an_edit_leaves_out`. Bristle Brush Options and `brush.new` take a bristle brush name of at most 31 characters, as the Brushes page states for the Bristle Brush Options. The Name field stops taking characters at 31, and `brush.new` and `brush.options` refuse a longer new name with an error that names the limit. The page does not say how the limit counts characters or what happens to longer names already saved; counting characters and the number added to a taken name, keeping longer saved names, and leaving `brush.duplicate` unlimited are VectorCraft's own rules. A bristle brush that a document or a saved file already holds under a longer name keeps it, and the other brush types take a name of any length. Test: `bristle_brush_names_have_at_most_31_characters` in `tests/brushsym.rs`. Public reference: [Brushes](https://web.archive.org/web/20241230205225/https://helpx.adobe.com/illustrator/using/brushes.html) (archived copy). + With a Bristle brush selected, the Paintbrush shows a tip outline at a rotation-capable pen's pointer: its width responds to pressure and the stroke weight, its long axis follows the pen's barrel rotation and bearing, and its aspect follows the selected tip shape. Mouse input and a pen without barrel rotation keep the regular Paintbrush cursor; Precise Cursors, the borrowed selection tool, smoothing and leaving the canvas hide the outline. This is VectorCraft's own approximate tip preview; the [Brushes guide](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=189) documents when a Bristle brush tip cursor appears, but does not define its geometry or pressure mapping. Tests: `draw2::gesture::tests::bristle_tip_annotator_follows_a_rotation_capable_pen` (vectorcraft-tools) and `canvas::tests::bristle_pen_tip_reaches_the_canvas_before_a_press` (vectorcraft-ui-egui). In the Brushes panel, Shift-click selects a range of brushes and Ctrl/Cmd-click adds or removes one. Delete Brush and Duplicate Brush then act on all of them (`brush.delete {names}`, `brush.duplicate {names}`). The Brushes panel's Delete Brush button and panel menu item ask "Delete the selected brushes?" with Yes and No when none of the brushes is in use. Alt-click (Option-click on macOS) on the button deletes them without asking, as the [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for panel deletion outside the Layers panel (archived copy). When a stroke uses one of the brushes, the button, Alt-click and the menu item all ask with Remove Strokes and Cancel; Remove Strokes deletes the brushes and the strokes that used them become plain strokes. Tests: `panels::brushes::tests`, `dialogs::brush_delete::tests`. Document Info has a Brushes category after Graphic Styles. It lists the names and types of the brushes applied to the artwork, as the [Document Info panel](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/document-info-panel.html) page describes, or with Selection Only the brushes that the selected objects' strokes use. The Document Info report and Package's report list them too (`document.info {category: "brushes"}`, `brushNames`, `brushes`). Listing each brush once, leaving out the Brushes panel's brushes no art uses (`panelBrushNames` lists the panel's brushes), hidden strokes, strokes at an opacity of 0, strokes with no paint or width, guides, paths with no segment, type that draws no characters, a group's or layer's own strokes, a compound path member's own strokes and an image's strokes without a shape, and listing a brush the panel does not hold as missing, are VectorCraft's own rules. Tests: `cmd::docinfo::tests::info_lists_the_brushes` and `info_brushes_skip_undrawn_strokes_and_name_missing_brushes` (vectorcraft-engine). From f6c512920a4047608d95f6f328de87b822619c2d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 17:29:11 -0800 Subject: [PATCH 093/158] Save for Web: a fixed palette keeps an opaque color when it maps colors to transparent With a fixed palette (Custom table), the colors listed in colorTable.transparent all become the one transparent entry, so together they now take a single slot of Colors, and the opaque colors fill the remaining slots in palette order. Before, the palette was cut to its first entries; when those were all mapped to transparent, every opaque pixel took one of them and the whole image turned transparent, and with a deleted color the export was refused although an opaque color was left past the cut. The check that a deletion leaves an opaque color now reads the whole palette. When no pixel is transparent and no pixel takes a color mapped to transparent, that slot goes to the next opaque color. At 256 colors one entry stays for a color mapped to transparent. --- crates/engine/src/cmd/webexport.rs | 35 +++++++++++++++++--- crates/engine/src/tests/webexport.rs | 49 ++++++++++++++++++++++++++++ docs/mcp.md | 4 ++- 3 files changed, 83 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/webexport.rs b/crates/engine/src/cmd/webexport.rs index 05a76ae982..19907dc084 100644 --- a/crates/engine/src/cmd/webexport.rs +++ b/crates/engine/src/cmd/webexport.rs @@ -32,7 +32,7 @@ pub fn specs() -> Vec { "Save for Web", [], None, - "{path?, preset?: a webExport.presets name (its settings, then these keys), format?: gif (default)|jpg|png8|png24, reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray (gif/png8, as the next five), colors?: 128 (2–256), dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, webSnap?: 0 (0–100 %: colours that close to a web-safe one become it), lossy?: 0 (0–100, gif), colorTable?: {locked?: [\"#rrggbb\"…] (kept when reducing), transparent?: [\"#rrggbb\"…] (become transparent), webShift?: [\"#rrggbb\"…] (become web-safe), sort?: none|hue|luminance|popularity, deleted?: [\"#rrggbb\"…] (taken out of the table: their pixels take the nearest color left, and at least one color stays), customPalette?: [\"#rrggbb\"…] (a fixed palette used instead of the reduction's, at most `colors` entries; a new reduction without colorTable clears it and deleted), shifted?: {\"#source\": \"#rrggbb\"…} (each source color is written as the color given, wherever it is in the image; kept when reducing as a locked color is, before the locked ones, while one palette slot is left for the reduction; at most 256; a source the table does not hold shifts nothing; a color shifted to itself is removed; a shifted color is not web-shifted, and a transparent one stays transparent; GIF lossy moves no pixel into or out of a shifted color)} (colours as the preview's colors[].source; #rrggbbaa and #rgba are refused here and in matte), transparency?: true (gif/png8/png24), matte?: white (default)|black|none|\"#rrggbb\" (what edges blend into; jpg and opaque png24: the background), interlaced?: false (gif/png8/png24), quality?: 60 (jpg: 0–100), progressive?: false (jpg), optimized?: true (jpg), embedProfile?: false (jpg: sRGB profile), width?: px | height?: px | percent?: 100 (the image size, proportional; width wins over height, height over percent), antiAlias?: none|art (default)|type, clipToArtboard?: true (the artboard; false: the art and the slices), artboard?: 0 (0-based), convertToSrgb?: true (PNG files say they are sRGB), metadata?: none|copyright (default)|contact|all (File Info written as PNG text, a GIF or JPEG comment), slices?: all (default)|selected|none (one image per slice: images/.), output?: images (default)|html (an HTML page placing the image or slices, .html)} → {path, files: [path…], bytes (total), width, height, warnings: [] or [a note that an image couldn't be decoded and is missing from the image]}; no path → {files: [{name, dataBase64}], bytes, width, height, warnings} (names such as page.html, images/page_01.gif). A single image without HTML is written at path itself", + "{path?, preset?: a webExport.presets name (its settings, then these keys), format?: gif (default)|jpg|png8|png24, reduction?: perceptual|selective (default)|adaptive|web|blackWhite|gray (gif/png8, as the next five), colors?: 128 (2–256), dither?: none|diffusion (default)|pattern|noise, ditherAmount?: 100, webSnap?: 0 (0–100 %: colours that close to a web-safe one become it), lossy?: 0 (0–100, gif), colorTable?: {locked?: [\"#rrggbb\"…] (kept when reducing), transparent?: [\"#rrggbb\"…] (become transparent), webShift?: [\"#rrggbb\"…] (become web-safe), sort?: none|hue|luminance|popularity, deleted?: [\"#rrggbb\"…] (taken out of the table: their pixels take the nearest color left, and at least one color stays), customPalette?: [\"#rrggbb\"…] (a fixed palette used instead of the reduction's, at most `colors` entries, its transparent colors taking one slot together; a new reduction without colorTable clears it and deleted), shifted?: {\"#source\": \"#rrggbb\"…} (each source color is written as the color given, wherever it is in the image; kept when reducing as a locked color is, before the locked ones, while one palette slot is left for the reduction; at most 256; a source the table does not hold shifts nothing; a color shifted to itself is removed; a shifted color is not web-shifted, and a transparent one stays transparent; GIF lossy moves no pixel into or out of a shifted color)} (colours as the preview's colors[].source; #rrggbbaa and #rgba are refused here and in matte), transparency?: true (gif/png8/png24), matte?: white (default)|black|none|\"#rrggbb\" (what edges blend into; jpg and opaque png24: the background), interlaced?: false (gif/png8/png24), quality?: 60 (jpg: 0–100), progressive?: false (jpg), optimized?: true (jpg), embedProfile?: false (jpg: sRGB profile), width?: px | height?: px | percent?: 100 (the image size, proportional; width wins over height, height over percent), antiAlias?: none|art (default)|type, clipToArtboard?: true (the artboard; false: the art and the slices), artboard?: 0 (0-based), convertToSrgb?: true (PNG files say they are sRGB), metadata?: none|copyright (default)|contact|all (File Info written as PNG text, a GIF or JPEG comment), slices?: all (default)|selected|none (one image per slice: images/.), output?: images (default)|html (an HTML page placing the image or slices, .html)} → {path, files: [path…], bytes (total), width, height, warnings: [] or [a note that an image couldn't be decoded and is missing from the image]}; no path → {files: [{name, dataBase64}], bytes, width, height, warnings} (names such as page.html, images/page_01.gif). A single image without HTML is written at path itself", has_doc, export ), @@ -866,7 +866,8 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 /// The pixels reduced to the palette `s` gives: the reduction's own (`locked` kept), or the /// color table's fixed one, without the deleted colors. The pixels of a deleted color take the /// nearest color left, with `o`'s dither. A deletion has to leave a color that is not mapped to -/// transparent. +/// transparent. A fixed palette keeps its colors mapped to transparent, which take one slot of +/// `colors` together, and its first opaque colors that fit in the rest. fn reduced(rgba: &[u8], w: u32, h: u32, s: &WebSettings, o: &PaletteOptions, locked: &[[u8; 3]]) -> std::result::Result { let table = &s.color_table; let deleted = ColorTable::colors(&table.deleted, "deleted")?; @@ -895,11 +896,37 @@ fn reduced(rgba: &[u8], w: u32, h: u32, s: &WebSettings, o: &PaletteOptions, loc left.push(c); } } - left.truncate(usize::from(s.colors.clamp(2, 256)) - usize::from(has_clear)); if left.is_empty() || (removed && !opaque_left(&left)) { return Err(KEEP_ONE.into()); } - Ok(quantize::quantize_to(rgba, w, h, o, &left)) + // The colors mapped to transparent all become the one transparent entry, so together they take + // one slot, and the opaque colors fill the rest in palette order. When no pixel takes one of + // them and no pixel is transparent, that slot goes to the next opaque color instead. + let ix = quantize::quantize_to(rgba, w, h, o, &fixed_palette(&left, &to_clear, s.colors, has_clear, true)); + if !has_clear && !ix.palette.iter().any(|c| to_clear.contains(c)) && left.iter().any(|c| to_clear.contains(c)) { + return Ok(quantize::quantize_to(rgba, w, h, o, &fixed_palette(&left, &to_clear, s.colors, has_clear, false))); + } + Ok(ix) +} + +/// The entries of the fixed palette `left` that fit in `colors`. With `clear`, the colors in +/// `to_clear` are kept and take one slot together; without it they are left out. The list holds +/// at most 256 entries, less one when `has_clear` (the transparent pixels' entry). +fn fixed_palette(left: &[[u8; 3]], to_clear: &[[u8; 3]], colors: u16, has_clear: bool, clear: bool) -> Vec<[u8; 3]> { + let any_clear = clear && left.iter().any(|c| to_clear.contains(c)); + let total = 256 - usize::from(has_clear); + let mut room = (usize::from(colors.clamp(2, 256)) - usize::from(has_clear || any_clear)).min(total - usize::from(any_clear)); + let opaque = left.iter().filter(|c| !to_clear.contains(c)).count().min(room); + let mut clear_room = if clear { total - opaque } else { 0 }; + left.iter() + .copied() + .filter(|c| { + let slots = if to_clear.contains(c) { &mut clear_room } else { &mut room }; + let keep = *slots > 0; + *slots = slots.saturating_sub(1); + keep + }) + .collect() } /// An optimised image as straight RGBA → `(pixels, width, height)` (the dialog's preview). diff --git a/crates/engine/src/tests/webexport.rs b/crates/engine/src/tests/webexport.rs index e3ea53fcac..9930e3e2fe 100644 --- a/crates/engine/src/tests/webexport.rs +++ b/crates/engine/src/tests/webexport.rs @@ -539,6 +539,55 @@ fn colour_table_delete_maps_pixels_to_the_nearest_color_left() { assert_eq!(sources(&preview(&mut s, json!({"preset": "No near red"}))), ["#0000ff", "#ff0000"]); } +/// The colors of a fixed palette mapped to transparent take one slot of Colors together with the +/// transparent pixels, so the opaque colors after them still fit: their pixels stay opaque, and the +/// pixels of the colors mapped to transparent become transparent. +#[test] +fn colour_table_fixed_palette_keeps_an_opaque_color() { + // 40×10: red, a near red and blue, and 10 px with nothing (transparent). + let mut s = session(40.0, 10.0); + rect(&mut s, [0.0, 0.0, 10.0, 10.0], "#ff0000"); + rect(&mut s, [10.0, 0.0, 10.0, 10.0], "#ee1100"); + rect(&mut s, [20.0, 0.0, 10.0, 10.0], "#0000ff"); + for table in [ + json!({"customPalette": ["#ff0000", "#ee1100", "#0000ff"], "deleted": ["#ee1100"], "transparent": ["#ff0000"]}), + json!({"customPalette": ["#ff0000", "#0000ff"], "transparent": ["#ff0000"]}), + ] { + let p = json!({"format": "png8", "dither": "none", "colors": 2, "colorTable": table}); + let v = run(&mut s, "document.exportForWeb.preview", p.clone()); + let opaque: Vec<&Value> = v["colors"].as_array().unwrap().iter().filter(|c| c["transparent"] == false).map(|c| &c["source"]).collect(); + assert_eq!((opaque, v["colors"].as_array().unwrap().len()), (vec![&json!("#0000ff")], 2), "{p}"); + let img = pixels(&one(&mut s, p.clone())); + let alpha = |x: u32| img.get_pixel(x, 5).0[3]; + assert_eq!((alpha(5), alpha(15), img.get_pixel(25, 5).0, alpha(35)), (0, 0, [0, 0, 255, 255], 0), "{p}"); + } + // A color mapped to transparent that no pixel takes leaves its slot to an opaque color. + let mut u = session(20.0, 10.0); + rect(&mut u, [0.0, 0.0, 10.0, 10.0], "#0000ff"); + rect(&mut u, [10.0, 0.0, 10.0, 10.0], "#00ff00"); + let p = json!({"format": "png8", "dither": "none", "colors": 2, "colorTable": {"customPalette": ["#0000ff", "#00ff00", "#ff0000"], "transparent": ["#ff0000"]}}); + let img = pixels(&one(&mut u, p)); + assert_eq!((img.get_pixel(5, 5).0, img.get_pixel(15, 5).0), ([0, 0, 255, 255], [0, 255, 0, 255])); + // At 256 colors a color mapped to transparent after 255 opaque ones still keeps an entry. + let full: Vec = + std::iter::once("#0000ff".to_string()).chain((1..255).map(|i| format!("#00{i:02x}00"))).chain(["#ff0000".to_string()]).collect(); + let p = json!({"format": "png8", "dither": "none", "colors": 256, "colorTable": {"customPalette": full, "transparent": ["#ff0000"]}}); + let img = pixels(&one(&mut s, p)); + assert_eq!((img.get_pixel(5, 5).0[3], img.get_pixel(25, 5).0, img.get_pixel(35, 5).0[3]), (0, [0, 0, 255, 255], 0)); + // Without transparent pixels the colors mapped to transparent still take one slot together. + let mut t = session(30.0, 10.0); + rect(&mut t, [0.0, 0.0, 10.0, 10.0], "#ff0000"); + rect(&mut t, [10.0, 0.0, 10.0, 10.0], "#ee1100"); + rect(&mut t, [20.0, 0.0, 10.0, 10.0], "#0000ff"); + let p = json!({"format": "png8", "dither": "none", "colors": 2, "colorTable": { + "customPalette": ["#ff0000", "#ee1100", "#0000ff", "#00ff00"], "transparent": ["#ff0000", "#ee1100"], + }}); + let v = run(&mut t, "document.exportForWeb.preview", p.clone()); + assert_eq!(v["colors"].as_array().unwrap().len(), 2, "{v}"); + let img = pixels(&one(&mut t, p)); + assert_eq!((img.get_pixel(5, 5).0[3], img.get_pixel(15, 5).0[3], img.get_pixel(25, 5).0), (0, 0, [0, 0, 255, 255])); +} + /// A color shifted by hand (`colorTable.shifted`) is written as the color picked wherever it is in /// the image, the other colors stay, the table shows it as shifted and locked, and the preview is /// the file. diff --git a/docs/mcp.md b/docs/mcp.md index 2975f64d03..370e9584f6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9041,7 +9041,9 @@ file agree. A deleted color also leaves `locked`, `transparent` and `webShift`. ignored. Deleting every opaque color is an error, and the settings, preview and files do not change; the transparent entry of transparent pixels cannot be deleted. `colorTable.customPalette: ["#rrggbb"…]` is a fixed palette (a Custom table) used instead of the reduction's own, at most `colors` entries with the transparent one included, so a color it -lacks is not made again; the dialog's Delete Color sets it to the table's colors on the first deletion. Both lists hold +lacks is not made again. Its colors in `transparent` all become the transparent entry and take one of the `colors` +slots together (when no pixel is transparent and no pixel takes one of them, that slot goes to its next color); its +other colors fill the remaining slots in order. The dialog's Delete Color sets it to the table's colors on the first deletion. Both lists hold at most 256 colors, and `#rrggbbaa` is refused. A `reduction` change without `colorTable` in the same params clears both lists. JPEG and PNG-24 have no color table and do not read them. Presets and `webExport.settings` keep them. In the dialog a click selects one color, Shift-click selects the colors between it and the last one clicked, and From e3672e958b6fbcd94aa45fa183cac448458c9427 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 17:44:15 -0800 Subject: [PATCH 094/158] Wake Bristle tip preview when a stationary pen turns --- crates/ui-egui/src/canvas/drag.rs | 2 ++ crates/ui-egui/src/canvas/input.rs | 17 ++++++++++---- crates/ui-egui/src/canvas/tests.rs | 13 ++++++++++- crates/ui-egui/src/stylus.rs | 37 +++++++++++++++++++++++++++++- 4 files changed, 63 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/canvas/drag.rs b/crates/ui-egui/src/canvas/drag.rs index 68f06c70cc..b1d15daa00 100644 --- a/crates/ui-egui/src/canvas/drag.rs +++ b/crates/ui-egui/src/canvas/drag.rs @@ -16,6 +16,8 @@ pub(super) struct HoverContext { pub(super) center: Point, pub(super) zoom: f64, pub(super) rotation: f64, + /// A pen turning in place changes a Bristle tip even when its pointer stays still. + pub(super) pen: Option, /// The active document's id and revision (which moves with every edit, undo and selection /// change). pub(super) doc: Option<(u64, u64)>, diff --git a/crates/ui-egui/src/canvas/input.rs b/crates/ui-egui/src/canvas/input.rs index f711d4cb36..9467596cf7 100644 --- a/crates/ui-egui/src/canvas/input.rs +++ b/crates/ui-egui/src/canvas/input.rs @@ -12,6 +12,9 @@ use super::{Color32, Drag, Mods, Point, PointerEvent, PointerKind, Pos2, Shape, /// Dispatch canvas pointer, keyboard and drop events through the active document view. pub(super) fn handle_input(app: &mut VectorcraftApp, ui: &Ui, resp: &egui::Response, rect: egui::Rect) { + if let Some(feed) = app.services.stylus.as_ref() { + feed.bind_repaint(ui.ctx()); + } // A modal dialog takes the canvas's presses, finger taps, long touches and view navigation, from the frame it opens. let modal = crate::panel_docking::modal_open(app, ui.ctx()); let (pointer, m, space, hover) = wheel_view(app, ui, resp, rect, modal); @@ -53,7 +56,7 @@ pub(super) fn handle_input(app: &mut VectorcraftApp, ui: &Ui, resp: &egui::Respo }); // What a hover means besides where the pointer is on screen: the tool, the canvas, the view // (scrolled, zoomed or turned by the wheel, a gesture, keys or a command) and the document and - // selection as they are (another tab, an edit, an undo). Under a still pointer, a tool switched + // selection as they are (another tab, an edit, an undo), and the pen's orientation. Under a still pointer, a tool switched // to is hovered at once, and when the rest changes, a tool that asks for it // ([`Session::tool_wants_rehover`]) is hovered again where the pointer is. let context = HoverContext { @@ -62,13 +65,14 @@ pub(super) fn handle_input(app: &mut VectorcraftApp, ui: &Ui, resp: &egui::Respo center: v.center, zoom: v.zoom, rotation: v.rotation, + pen: pen_pose(app, &xf), doc: app.session.active().map(|st| (st.uid, st.revision)), }; - let (tool_switched, context_changed) = ui.data_mut(|d| { + let (tool_switched, context_changed, pen_changed) = ui.data_mut(|d| { let id = egui::Id::unique("canvas-hover-context"); let prev = d.get_temp::(id); d.insert_temp(id, context); - prev.map_or((false, false), |prev| (prev.tool != context.tool, prev != context)) + prev.map_or((false, false, false), |prev| (prev.tool != context.tool, prev != context, prev.pen != context.pen)) }); if app.ui.screen_mode == 3 && matches!(drag, None | Some(Drag::Present | Drag::Gesture)) { @@ -137,7 +141,12 @@ pub(super) fn handle_input(app: &mut VectorcraftApp, ui: &Ui, resp: &egui::Respo } else if let Some(p) = hover_tool // A press on an artboard's name starts no drag: the moves while it is held are not hover. && !(pointer.primary_down() && ui.data(|d| d.get_temp::<(usize, bool)>(name_press_id()).is_some())) - && (pointer.is_moving() || mods_changed || !was_over || tool_switched || (context_changed && app.session.tool_wants_rehover())) + && (pointer.is_moving() + || mods_changed + || !was_over + || tool_switched + || (context_changed && app.session.tool_wants_rehover()) + || (pen_changed && context.tool == "paintbrush")) { let ev = PointerEvent { kind: PointerKind::Move, diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 91236c86bb..6b9a4e2da0 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -11005,7 +11005,7 @@ fn the_tip_brings_back_the_perspective_grid_tool_without_showing_the_grid() { } /// The native pen feed's barrel rotation reaches the Paintbrush during canvas hover, before any -/// stroke begins. +/// stroke begins. Turning the pen or replacing it with a mouse updates a still pointer too. #[test] fn bristle_pen_tip_reaches_the_canvas_before_a_press() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); @@ -11031,6 +11031,17 @@ fn bristle_pen_tip_reaches_the_canvas_before_a_press() { frame(&mut app, &ctx, vec![egui::Event::PointerMoved(at)]); let horizontal = tip(&mut app).expect("hovering pen shows its brush tip"); assert!(horizontal.width() > horizontal.height() * 2.0, "{horizontal:?}"); + feed.set_sample(Some(crate::stylus::PenSample { + pressure: 0.0, + pose: PenPose { rotation: Some(90.0), ..Default::default() }, + ..Default::default() + })); + frame(&mut app, &ctx, vec![]); + let vertical = tip(&mut app).expect("turning a still pen turns its tip"); + assert!(vertical.height() > vertical.width() * 2.0, "{vertical:?}"); + feed.set(None); + frame(&mut app, &ctx, vec![]); + assert!(tip(&mut app).is_none(), "a mouse clears a still pen's tip"); } /// #764: the pen's tilt and barrel rotation in the host's feed reach the Paintbrush's points, diff --git a/crates/ui-egui/src/stylus.rs b/crates/ui-egui/src/stylus.rs index 81ae382877..9791839c85 100644 --- a/crates/ui-egui/src/stylus.rs +++ b/crates/ui-egui/src/stylus.rs @@ -24,7 +24,7 @@ //! the tip selects the tool used before. use std::collections::VecDeque; -use std::sync::{Arc, Condvar, Mutex, MutexGuard}; +use std::sync::{Arc, Condvar, Mutex, MutexGuard, OnceLock}; use std::time::Duration; pub use vectorcraft_tools::PenPose; @@ -82,6 +82,8 @@ impl Pen { #[derive(Default)] struct Shared { pen: Mutex, + /// Wake the canvas for a pen that turns without a new window pointer event. + repaint: OnceLock, /// Signaled on every [`StylusFeed::set_sample`] ([`StylusFeed::set`] included). set: Condvar, /// Written on the UI thread itself ([`StylusFeed::on_ui_thread`]): a press never waits. @@ -104,6 +106,10 @@ impl StylusFeed { self.0.pen.lock().unwrap_or_else(std::sync::PoisonError::into_inner) } + pub(crate) fn bind_repaint(&self, ctx: &egui::Context) { + self.0.repaint.get_or_init(|| ctx.clone()); + } + /// A pen turned to its tip moved with `pressure`, or `None`: another pointer moved /// ([`Self::set_sample`]). pub fn set(&self, pressure: Option) { @@ -119,6 +125,7 @@ impl StylusFeed { let pressure = sample.map(|s| if s.pressure.is_finite() { s.pressure.clamp(0.0, 1.0) } else { 1.0 }); let eraser = sample.is_some_and(|s| s.eraser); let mut pen = self.lock(); + let before_pose = pen.pose; if eraser != pen.eraser { *pen = Pen::default(); } @@ -138,8 +145,12 @@ impl StylusFeed { } } pen.latest = pressure; + let pose_changed = pen.pose != before_pose; drop(pen); self.0.set.notify_all(); + if pose_changed && let Some(ctx) = self.0.repaint.get() { + ctx.request_repaint(); + } } /// Like [`Self::set_sample`], for a pen sample that comes with one pointer move of the window, @@ -282,6 +293,30 @@ pub(crate) fn sync_eraser_tool(app: &mut VectorcraftApp) -> bool { #[cfg(test)] mod tests { use super::*; + use std::sync::atomic::{AtomicUsize, Ordering}; + + #[test] + fn changing_a_still_pens_pose_wakes_the_canvas() { + let feed = StylusFeed::default(); + let ctx = egui::Context::default(); + let repaints = Arc::new(AtomicUsize::new(0)); + let count = repaints.clone(); + ctx.set_repaint_observer(move |_| { + count.fetch_add(1, Ordering::Relaxed); + }); + feed.bind_repaint(&ctx); + let pose = PenPose { rotation: Some(0.0), ..Default::default() }; + let sample = PenSample { pressure: 0.0, pose, ..Default::default() }; + let writer = feed.clone(); + std::thread::spawn(move || writer.set_sample(Some(sample))).join().unwrap(); + assert_eq!(repaints.load(Ordering::Relaxed), 1); + feed.set_sample(Some(sample)); + assert_eq!(repaints.load(Ordering::Relaxed), 1, "an unchanged pose needs no new frame"); + feed.set_sample(Some(PenSample { pose: PenPose { rotation: Some(90.0), ..pose }, ..sample })); + assert_eq!(repaints.load(Ordering::Relaxed), 2); + feed.set_sample(None); + assert_eq!(repaints.load(Ordering::Relaxed), 3, "mouse input clears the tip"); + } #[test] fn the_feed_keeps_the_last_pressure_within_0_to_1() { From 5cf3ac5beb847c6c227cdd84d3e2da70e7eba25a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 17:45:22 -0800 Subject: [PATCH 095/158] i18n: use a narrow no-break space before the semicolon in the French compound shape warning The French row for the Make Compound Shape warning had an ordinary space before ";", which french_catalog_uses_nonbreaking_prose_punctuation rejects on main. It now uses U+202F. --- crates/ui-egui/src/i18n/fr.tsv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 9d7d641b07..3f0f2ced04 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -9349,7 +9349,7 @@ breakText Glyphs Glyphes @msg the character's size can't be measured la taille du caractère ne peut pas être mesurée @msg the code runs past its last instruction le code s’exécute au-delà de sa dernière instruction @msg the compound shape is too complex to expand la forme composée est trop complexe pour être décomposée -@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first une ligne ou un autre tracé ouvert qui n’entoure aucune surface n’ajoute aucune surface à la forme composée ; pour l’inclure, appliquez-lui d’abord Objet › Tracé › Vectoriser le contour +@msg a line or other open path that encloses no area contributes no area to the compound shape; to include it, apply Object › Path › Outline Stroke to it first une ligne ou un autre tracé ouvert qui n’entoure aucune surface n’ajoute aucune surface à la forme composée ; pour l’inclure, appliquez-lui d’abord Objet › Tracé › Vectoriser le contour @msg the container of the listed objects is gone le conteneur des objets listés a disparu @msg the copy `{user_id}` can't be read as a library la copie `{user_id}` ne peut pas être lue comme une bibliothèque @msg the copy would leave the canvas la copie sortirait de la zone de travail From 688baab2dba9502f7f11a3fa0d6719ec2c4b9224 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 17:52:43 -0800 Subject: [PATCH 096/158] Layers: a Shift-click range looks rows up in a set instead of searching them for each row layer.highlight searched the highlighted rows once for every id it was given, so a range of n rows took about n^2/2 comparisons, and the panel's preview of the rows (apply_row_click) did the same before sending the command. Both now keep a set of the highlighted rows beside the ordered list. layer.highlight builds the set only for more than 8 ids, so a one-row Ctrl/Cmd-click toggle does not pay for it. The rows, their order, the returned rows, the current layer and the revision are unchanged; tests compare the command with the per-id search on 3,000 rows and the widget with it on 5,000 rows. --- crates/engine/src/cmd/layer.rs | 14 ++- crates/engine/src/tests/layers.rs | 177 +++++++++++++++++++++++++++++ crates/ui-egui/src/widgets/drag.rs | 33 +++++- docs/target-app-parity.md | 1 + 4 files changed, 221 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/layer.rs b/crates/engine/src/cmd/layer.rs index 237f0f9d49..8979a5f0c1 100644 --- a/crates/engine/src/cmd/layer.rs +++ b/crates/engine/src/cmd/layer.rs @@ -622,12 +622,22 @@ fn highlight(s: &mut Session, p: &Value) -> Result { "add" | "toggle" => {} other => return Err(bad(C, format!("mode is set, add or toggle, not `{other}`"))), } + // `rows` keeps the highlight order. With more than 8 ids, `held` holds the same rows as a set and + // answers each lookup; with fewer, each lookup searches `rows`. + let mut held: Option> = (ids.len() > 8).then(|| rows.iter().copied().collect()); let mut last = None; for id in ids { - if mode == "toggle" && rows.contains(&id) { + let has = held.as_ref().map_or_else(|| rows.contains(&id), |h| h.contains(&id)); + if mode == "toggle" && has { rows.retain(|r| *r != id); - } else if !rows.contains(&id) { + if let Some(h) = &mut held { + h.remove(&id); + } + } else if !has { rows.push(id); + if let Some(h) = &mut held { + h.insert(id); + } last = Some(id); } } diff --git a/crates/engine/src/tests/layers.rs b/crates/engine/src/tests/layers.rs index f6b35716f6..4b9045b8b3 100644 --- a/crates/engine/src/tests/layers.rs +++ b/crates/engine/src/tests/layers.rs @@ -167,6 +167,183 @@ fn clicking_rows_at_any_depth_highlights_them_and_sets_the_current_layer() { assert_eq!(document_rows(&s), vec![g.0, c.0], "document.inspect lists the rows"); } +/// Run `layer.highlight` with `ids` and `mode` → (the rows it returned, the current layer), after +/// checking that the call counted one revision and left the rows it returned highlighted. +fn highlight_rows(s: &mut Session, ids: &[NodeId], mode: &str) -> (Vec, Option) { + let revision = s.doc().unwrap().revision; + let r = run(s, "layer.highlight", json!({"ids": ids.iter().map(|i| i.0).collect::>(), "mode": mode})); + let st = s.doc().unwrap(); + assert_eq!(st.revision, revision + 1, "{mode} {ids:?}"); + let rows: Vec = r["rows"].as_array().unwrap().iter().map(|v| NodeId(v.as_u64().unwrap())).collect(); + assert_eq!(rows, st.layer_rows, "{mode} {ids:?}"); + (rows, st.active_layer) +} + +/// `layer.highlight` keeps the rows in highlight order: `set` and `add` take a repeated id once, +/// `toggle` takes an id listed twice off and on again (or on and off, and its layer becomes the +/// current one), unknown ids and ids after the first 100,000 are dropped, rows highlighted twice +/// stay as they are on `add`, and `toggle` takes every copy off. +#[test] +fn highlighting_rows_keeps_their_order_with_repeated_unknown_and_excess_ids() { + let mut s = session(); + let (layer, sub, a, g, b, c) = tree(&mut s); + let unknown = NodeId(9999); + assert_eq!(highlight_rows(&mut s, &[a, g, a, unknown, c], "set"), (vec![a, g, c], Some(layer))); + assert_eq!(highlight_rows(&mut s, &[g, b, a, b], "add"), (vec![a, g, c, b], Some(sub))); + assert_eq!(highlight_rows(&mut s, &[c, c], "toggle"), (vec![a, g, b, c], Some(layer))); + // `sub` goes on and off again; it was the last row added, so its layer is the current one. + assert_eq!(highlight_rows(&mut s, &[sub, sub], "toggle"), (vec![a, g, b, c], Some(sub))); + assert_eq!(highlight_rows(&mut s, &[a, unknown], "toggle"), (vec![g, b, c], Some(layer))); + assert_eq!(highlight_rows(&mut s, &[], "add"), (vec![g, b, c], Some(layer))); + assert_eq!(highlight_rows(&mut s, &[], "toggle"), (vec![g, b, c], Some(layer))); + s.doc_mut().unwrap().active_layer = Some(sub); + assert_eq!(highlight_rows(&mut s, &[], "set"), (vec![], Some(sub)), "no rows: the current layer stays"); + let mut excess = vec![unknown; 100_000]; + excess.push(a); + assert_eq!(highlight_rows(&mut s, &excess, "set"), (vec![], Some(sub)), "only the first 100,000 ids count"); + s.doc_mut().unwrap().layer_rows = vec![a, a, g]; + assert_eq!(highlight_rows(&mut s, &[a, c], "add"), (vec![a, a, g, c], Some(layer))); + assert_eq!(highlight_rows(&mut s, &[a], "toggle"), (vec![g, c], Some(layer))); + // The same with more than 8 ids. + s.doc_mut().unwrap().layer_rows = vec![a, a, g]; + assert_eq!(highlight_rows(&mut s, &[a, c, c, c, c, c, c, c, c], "add"), (vec![a, a, g, c], Some(layer))); + s.doc_mut().unwrap().layer_rows = vec![a, a, g]; + assert_eq!(highlight_rows(&mut s, &[a, b, b, b, b, b, b, b, b], "toggle"), (vec![g], Some(sub)), "`b` goes on and off 4 times"); + assert_eq!(highlight_rows(&mut s, &[c, g, sub, g, sub, a, unknown, a, c, layer], "toggle"), (vec![g, layer], Some(layer))); + let revision = s.doc().unwrap().revision; + assert!(s.execute("layer.highlight", &json!({"ids": [b.0], "mode": "nope"})).is_err()); + let st = s.doc().unwrap(); + assert_eq!((st.revision, st.layer_rows.clone()), (revision, vec![g, layer]), "a bad mode changes nothing"); +} + +/// `layer.highlight`'s rule as a search of the highlighted rows for each id in `p`. The tests +/// compare the command with it. +fn highlight_by_search(st: &mut DocState, p: &Value) -> Value { + let mut ids: Vec = p["ids"].as_array().unwrap().iter().map(|v| NodeId(v.as_u64().unwrap())).collect(); + ids.truncate(crate::cmd::layer::MAX_ROWS); + let mode = p["mode"].as_str().unwrap_or("set"); + ids.retain(|id| st.doc.node(*id).is_some()); + let mut rows = st.highlighted_rows(); + if mode == "set" { + rows.clear(); + } + let mut last = None; + for id in ids { + if mode == "toggle" && rows.contains(&id) { + rows.retain(|r| *r != id); + } else if !rows.contains(&id) { + rows.push(id); + last = Some(id); + } + } + if let Some(layer) = last.or(rows.last().copied()).and_then(|id| st.doc.layer_containing(id)) { + st.active_layer = Some(layer); + } + st.layer_rows = rows; + st.revision += 1; + json!({ "rows": st.layer_rows.iter().map(|i| i.0).collect::>() }) +} + +/// Two sessions with `n` squares on a layer and a sublayer after them, and the squares' ids. +fn highlight_pair(n: usize) -> (Session, Session, Vec, NodeId) { + let make = || { + let mut s = super::large_edits::session(n, super::large_edits::square); + let sub = id(&run(&mut s, "layer.newSublayer", json!({"name": "Sub"}))); + (s, sub) + }; + let ((cmd, sub), (search, other)) = (make(), make()); + assert_eq!(sub, other); + let squares = super::large_edits::layer(&cmd, 0).into_iter().filter(|i| *i != sub).collect(); + (cmd, search, squares, sub) +} + +/// `p` for `layer.highlight` with `ids` and `mode`. +fn highlight_params(ids: impl IntoIterator, mode: &str) -> Value { + json!({"ids": ids.into_iter().map(|i| i.0).collect::>(), "mode": mode}) +} + +/// On 3,000 rows `layer.highlight` gives what [`highlight_by_search`] gives: the same rows in the +/// same order, the same current layer and the same returned rows, with repeated, unknown and +/// toggled ids. +#[test] +fn layer_highlight_matches_a_search_of_the_rows_for_each_id() { + let (mut cmd, mut search, sq, sub) = highlight_pair(3_000); + let unknown = NodeId(u64::MAX); + let steps = [ + highlight_params(sq[..2_000].iter().copied(), "set"), + highlight_params(sq[1_000..].iter().copied().chain([sub, sq[0]]), "add"), + highlight_params([sq[5], sq[5], sub, sq[2_999], unknown, sub, sub], "toggle"), + highlight_params(sq[500..520].iter().chain(&sq[510..515]).copied(), "toggle"), + highlight_params(sq.iter().rev().step_by(7).copied(), "add"), + highlight_params(sq.iter().step_by(3).copied().chain([sub]), "toggle"), + highlight_params(Vec::new(), "add"), + highlight_params(sq.iter().rev().step_by(2).chain(&sq[..10]).copied(), "set"), + highlight_params(Vec::new(), "set"), + ]; + for p in &steps { + let r = run(&mut cmd, "layer.highlight", p.clone()); + let expected = highlight_by_search(search.doc_mut().unwrap(), p); + let (a, b) = (cmd.doc().unwrap(), search.doc().unwrap()); + assert_eq!(r, expected, "{}", p["mode"]); + assert_eq!((&a.layer_rows, a.active_layer, a.revision), (&b.layer_rows, b.active_layer, b.revision), "{}", p["mode"]); + } +} + +/// Time `layer.highlight` against [`highlight_by_search`] on one layer of 20,000 paths: `set` of +/// all of them, `add` of 10,000 already highlighted and `toggle` of one, 7 runs each, both checked +/// to give the same rows and current layer. +/// Run with `cargo test --release -p vectorcraft-engine --lib layer_highlight_timing -- --ignored --nocapture`. +#[test] +#[ignore = "manual timing probe; wall-clock performance depends on machine load"] +fn layer_highlight_timing() { + let (mut cmd, mut search, sq, _) = highlight_pair(20_000); + let steps = [ + ("set of 20,000", highlight_params(sq.iter().copied(), "set")), + ("add of 10,000", highlight_params(sq[5_000..15_000].iter().copied(), "add")), + ("toggle of 1", highlight_params([sq[10_000]], "toggle")), + ]; + let mut ms = vec![(Vec::new(), Vec::new()); steps.len()]; + for run_no in 0..7 { + for (i, (_, p)) in steps.iter().enumerate() { + let mut time_cmd = || { + let start = std::time::Instant::now(); + let r = cmd.execute("layer.highlight", p).unwrap(); + (start.elapsed().as_secs_f64() * 1000.0, r) + }; + let mut time_search = || { + let start = std::time::Instant::now(); + let r = highlight_by_search(search.doc_mut().unwrap(), p); + (start.elapsed().as_secs_f64() * 1000.0, r) + }; + // Alternate which goes first. + let ((tc, rc), (ts, rs)) = if run_no % 2 == 0 { + let c = time_cmd(); + (c, time_search()) + } else { + let s = time_search(); + (time_cmd(), s) + }; + assert_eq!(rc, rs); + let (a, b) = (cmd.doc().unwrap(), search.doc().unwrap()); + assert_eq!((&a.layer_rows, a.active_layer), (&b.layer_rows, b.active_layer)); + ms[i].0.push(ts); + ms[i].1.push(tc); + } + } + let median = |v: &[f64]| { + let mut v = v.to_vec(); + v.sort_by(f64::total_cmp); + v[v.len() / 2] + }; + for ((name, _), (search_ms, cmd_ms)) in steps.iter().zip(&ms) { + println!( + "{name}: search {:.3} ms, command {:.3} ms (median of 7); search runs {search_ms:.3?}, command runs {cmd_ms:.3?}", + median(search_ms), + median(cmd_ms) + ); + } +} + fn document_rows(s: &Session) -> Vec { crate::inspect::document(s)["layerRows"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect() } diff --git a/crates/ui-egui/src/widgets/drag.rs b/crates/ui-egui/src/widgets/drag.rs index a3df5a4098..1ea55e238c 100644 --- a/crates/ui-egui/src/widgets/drag.rs +++ b/crates/ui-egui/src/widgets/drag.rs @@ -1,3 +1,6 @@ +use std::collections::HashSet; +use std::hash::Hash; + use super::{Paint, Rect, Response, Stroke, StrokeKind, Tokens, Ui, Vec2}; /// What panels drag onto art and onto each other. One payload type, so the canvas has one drop @@ -135,10 +138,11 @@ pub fn row_click(order: &[K], highlighted: &[K], anchor: Op /// Apply `click` to the `highlighted` rows, kept in highlight order as `layer.highlight` keeps the /// Layers panel's: a toggled row is appended (or taken off, even the last one), a range replaces the /// rows or adds those not there yet, top-down. -pub fn apply_row_click(highlighted: &mut Vec, click: &RowClick) { +pub fn apply_row_click(highlighted: &mut Vec, click: &RowClick) { let add = |rows: &mut Vec, add: &[K]| { + let mut held: HashSet = rows.iter().copied().collect(); for k in add { - if !rows.contains(k) { + if held.insert(*k) { rows.push(*k); } } @@ -268,4 +272,29 @@ mod row_click_tests { assert_eq!(applied(vec![50], RowClick::Range(vec![20, 30])), [20, 30]); assert_eq!(applied(vec![30, 50], RowClick::AddRange(vec![20, 30, 40])), [30, 50, 20, 40]); } + + /// A large range gives the rows a search of the highlighted rows for each id gives, in the same + /// order, with repeated ids and rows already highlighted kept once. + #[test] + fn a_large_range_applies_as_a_search_of_the_rows_for_each_id_does() { + let searched = |mut rows: Vec, range: &[u32]| { + for k in range { + if !rows.contains(k) { + rows.push(*k); + } + } + rows + }; + let mut range: Vec = (0..5_000).collect(); + range.extend([7, 4_999, 0]); + let before = vec![4_000, 9_000, 2, 9_000]; + let mut added = before.clone(); + apply_row_click(&mut added, &RowClick::AddRange(range.clone())); + assert_eq!(added, searched(before.clone(), &range)); + assert_eq!(added.len(), 5_002, "the 5,000 ids, the row outside the range and its repeat"); + let mut set = before; + apply_row_click(&mut set, &RowClick::Range(range.clone())); + assert_eq!(set, searched(Vec::new(), &range)); + assert_eq!(set.len(), 5_000); + } } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index ef83de54ad..56401998a7 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1391,6 +1391,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Layer Options for several highlighted rows shows the first row's settings, and OK changes only the settings set in the dialog: each row keeps its own color, Template, Lock, Show, Print, Preview and Dim Images otherwise (`crates/ui-egui/src/dialogs/layer_options.rs` tests). As VectorCraft's own rule, a layer color (`layer.setProps`, `layer.new`, `layer.newSublayer`) or a Live Paint Gap Preview Color (`livePaint.gapOptions`) given as a hex color with an alpha part (`#rrggbbaa` or `#rgba`) is an error and changes nothing, instead of being set without its alpha. Regression tests: `a_layer_color_with_an_alpha_part_is_refused` in `crates/engine/src/tests/layers.rs` and `a_gap_color_with_an_alpha_part_is_refused` in `crates/engine/src/tests/build.rs`. Panel Options › Locate Selected Objects (beyond Illustrator, off by default): when the last selected object changes on the canvas or by a command, the panel opens the layers and groups around it and scrolls to its row, as Locate Object does, without highlighting the row; when Show Layers Only, a search or the filter leaves the object without a row, the panel opens no rows for it and scrolls as with the option off. + A Shift-click or Shift+Ctrl/Cmd-click range (`layer.highlight` with `set` or `add`, and the panel's preview of the rows before it sends the command) looks each row up in a set of the highlighted rows instead of searching the highlighted rows once for each row, as does a `toggle` of more than 8 ids; the work grows in step with the number of rows. The rows, their order, the returned rows and the current layer are the same as before. Tests: `tests::layers::layer_highlight_matches_a_search_of_the_rows_for_each_id`, `tests::layers::highlighting_rows_keeps_their_order_with_repeated_unknown_and_excess_ids` and `widgets::drag::row_click_tests::a_large_range_applies_as_a_search_of_the_rows_for_each_id_does`; timing: `cargo test --release -p vectorcraft-engine --lib layer_highlight_timing -- --ignored --nocapture`. - **Drawing aids:** Smart Guides and snapping (moving, with the Selection, Group Selection or Direct Selection tool, and resizing by the bounding-box handles with the Selection or Free Transform tool, Shift and Alt too: the dragged corner or side lands on the other objects' anchors and centres ("anchor", "center") or lines up with their edges and centres (a line and "align"); with Smart Guides › Spacing Guides, a moved selection that lines up with nothing along an axis lands as far from its neighbour as two other objects of its row or column are apart, or halfway between its two neighbours, the equal gaps marked; with View › Snap to Grid on, a moved selection lands on the grid instead, by whichever of its edges is nearest a gridline on each axis (the center does not snap), #740, #1816; the Rotate, Scale, Shear and Reflect tools drag from the anchor they grab and snap the pointer the same way, so a corner dragged onto another object's anchor scales exactly onto it, #482; anchors dragged with Direct Selection: the one pressed on lands on other anchors, its own path's that stay put among them, on path segments or in line with them, the others following, Shift keeps 45° steps, and with Smart Guides off Snap to Point pulls it onto anchors; the Artboard tool snaps artboards, and their bleed, to other artboards, bleeds and art, the grid or whole pixels while moving, copying and resizing them, and the Transform panel shows and edits the active artboard's X/Y/W/H; drawn points, #506: hovering shows where the press goes, the point lands on the other objects' anchors, centres and paths ("anchor", "center", "path") or lines up with their anchors, edges and centres ("align"), the Pen's on the path being drawn too, near a construction guide through the anchor before it on that guide (Preferences › Smart Guides › Construction Guides and Angles), and with Shift kept to its 45° step or a square's diagonal it slides along that way into line; the targets are gathered once per document state, from the art in the window, and the anchors, centres and lines near the pointer are found by bisection, so hovering never rescans the document), guides dragged out of the rulers (#451: they snap as moved guides do, Shift to the ruler's ticks; with the Artboard tool they are artboard guides, which run across their artboard only and move, copy and delete with it, `guide.add {artboard}`) that the Selection, Direct Selection and Group Selection tools then pick and drag (#414: the selected guides highlight and move together, Alt copies them, Shift snaps the dragged one to the ticks, otherwise it snaps to pixels, the grid or the edges, centres (so the sides' midpoints) and anchors of the art and the artboards, or with Smart Guides off Snap to Point pulls it onto anchors; Shift-clicked they join the selected art, and Shift-added art keeps them, so guides and art are selected together in either order, Delete then deleting both in one step; the arrow keys nudge them, Delete deletes them, dragging one back onto its ruler deletes it, Lock Guides and Hide Guides leave them alone; `guide.list`, `guide.select`, `guide.move` and `guide.remove` reach agents), a right-click on either ruler or the origin box to pick the document's units (the current one checked; `document.setUnits`, one undo step, #528), and Draw Normal / Behind / Inside modes. Smart Guides: a point drawn with the Pen or a shape tool, and an anchor dragged with Direct Selection, snaps to where paths and ruler guides cross, labelled "intersect" (#1658, part of #1602; a moved selection's own anchors don't, except the anchor the Selection tool grabbed it by). A selection the Selection tool grabs by one of its anchors snaps that anchor onto the other objects' paths ("path"), and where a path crosses another path or a ruler guide ("intersect"), in the order Direct Selection uses for a dragged anchor; when the anchor lands on a path, the selection's bounds do not also line up with other objects (#7411). The archived 2007 [user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=55) (page 49) says Smart Guides align the pointer of a moved object to existing paths. Snapping onto paths only when the selection was grabbed by an anchor is VectorCraft's own rule; a selection grabbed anywhere else still lines its bounds up. Tests: `select::tests::a_move_grabbed_by_an_anchor_lands_it_on_another_path`, `a_move_grabbed_by_an_anchor_lands_it_where_paths_cross` and `a_move_grabbed_by_an_anchor_lands_it_where_a_path_crosses_a_ruler_guide`. With Smart Guides › Measurement Labels on, the Line Segment tool labels the segment being drawn with its distance, angle and X and Y offsets (`D`, `Angle`, `dX`, `dY`), and the Pen, Curvature and Smart Pen tools label their rubber band the same way when Enable Rubber Band is on (#2983). A move that Shift keeps level, upright or diagonal stays on that line when it snaps, with the Selection, Group Selection or Direct Selection tool. It slides along the line until the selection lands on the grid or on whole pixels, lines up with the other objects or is spaced evenly with them, or until the line passes an anchor or crosses a ruler guide near the point the selection was grabbed by. A level or upright move snaps along its own axis only. Snap to Last Location: with Smart Guides on and Preferences › Smart Guides › Snap to Last Location on (off by default, VectorCraft's own choice), a selection moved by dragging with the Selection, Group Selection or Direct Selection tool, Shift too, goes back to where the move began while it is within Snapping Tolerance of it, labeled "last location"; an Alt copy is not pulled back onto its original, and with View › Snap to Grid or Snap to Pixel on the move snaps to the grid or to whole pixels instead (`prefs.set` key `snapToLastLocation`). The public [Smart Guides options](https://helpx.adobe.com/illustrator/desktop/measure-and-align/grids-and-guides/smart-guides-options.html) page lists the option as snapping objects back to their previous position; the distance, the label, the copy rule and the grid and pixel rule are VectorCraft's own. Tests: `select::tests::snap_to_last_location_puts_a_move_back_where_it_began`, `select::tests::snap_to_pixel_wins_over_snap_to_last_location`, `direct::tests::snap_to_last_location_puts_a_path_moved_by_its_anchor_back`, `direct::tests::snap_to_pixel_wins_over_snap_to_last_location_for_a_path_moved_by_its_anchor`, `tests_prefs::snap_to_last_location_puts_a_dragged_square_back`. From 5ac41ee0892ac2881233435baab28a5bedd208d8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 17:56:55 -0800 Subject: [PATCH 097/158] Save for Web: Delete Color skips selected colors the table no longer shows A selection made before the reduction or the color count changed, or set through ui.dialog.set, could name a color the table no longer holds. Delete Color stayed enabled for it, added the absent color to colorTable.deleted and fixed the table as a Custom palette although no shown color was deleted. Delete Color is now enabled only for selected colors the table shows and deletes only those; a selection with none of them is cleared and the table is left unchanged. --- crates/ui-egui/src/dialogs/save_for_web.rs | 26 +++++++++++++------ .../ui-egui/src/dialogs/tests_save_for_web.rs | 20 ++++++++++++++ docs/mcp.md | 4 ++- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/src/dialogs/save_for_web.rs b/crates/ui-egui/src/dialogs/save_for_web.rs index 1fed4791e9..8cfb7bc6f8 100644 --- a/crates/ui-egui/src/dialogs/save_for_web.rs +++ b/crates/ui-egui/src/dialogs/save_for_web.rs @@ -1205,14 +1205,18 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re } }); }); - // Delete Color (the button and the table's menu) and Restore Generated Table. + // Delete Color (the button and the table's menu) and Restore Generated Table. Delete Color + // takes only selected colors the table shows (`palette`, by source). + let palette: Vec = + shot.colors.iter().filter(|c| !c.transparent).map(|c| hex(c.source)).chain(shot.mapped.iter().map(|c| hex(*c))).collect(); + let deletable = !selected_in(d, &palette).is_empty(); let (mut delete, mut restore, mut unshift_all) = (false, false, false); ui.horizontal(|ui| { - delete |= widgets::icon_button_enabled(ui, "trash-2", tl!("Delete Color"), false, !picked.is_empty(), 24.0).clicked(); + delete |= widgets::icon_button_enabled(ui, "trash-2", tl!("Delete Color"), false, deletable, 24.0).clicked(); let menu = widgets::icon_button(ui, "menu", tl!("Color Table"), false, 24.0); let open = menu.clicked(); let _ = widgets::popover(&menu, open, |ui| { - if widgets::menu_item(ui, tl!("Delete Color"), !picked.is_empty(), false) { + if widgets::menu_item(ui, tl!("Delete Color"), deletable, false) { delete = true; ui.close(); } @@ -1242,13 +1246,16 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re unshift_all_colors(d); } if delete { - let palette: Vec = - shot.colors.iter().filter(|c| !c.transparent).map(|c| hex(c.source)).chain(shot.mapped.iter().map(|c| hex(*c))).collect(); delete_colors(d, &palette)?; } Ok(()) } +/// The selected colors (by source) that `palette`, the colors the table shows, holds. +pub(super) fn selected_in(d: &Dialog, palette: &[String]) -> Vec { + selection(d).into_iter().filter(|c| palette.iter().any(|p| p.eq_ignore_ascii_case(c))).collect() +} + /// The colour table's selected colors, by source: `__colors`, else `__color`. pub(super) fn selection(d: &Dialog) -> Vec { let many: Vec = @@ -1298,11 +1305,14 @@ pub(super) fn pick(d: &mut Dialog, order: &[String], color: &str, shift: bool, c /// Delete Color: the selected colors join the color table's `deleted` list and leave its other /// lists. The first deletion fixes the palette (`customPalette`) to `palette`, the table's colors /// (by source) with the deleted ones, so the colors left do not change. A deletion that leaves no -/// color, or only colors mapped to transparent, is refused with nothing changed. The selection is -/// cleared. +/// color, or only colors mapped to transparent, is refused with nothing changed. Only selected +/// colors that `palette` holds are deleted; when it holds none of them, the table is left as it is +/// and the selection is cleared. The selection is cleared after a deletion too. pub(super) fn delete_colors(d: &mut Dialog, palette: &[String]) -> Result<(), String> { - let picked = selection(d); + let picked = selected_in(d, palette); if picked.is_empty() { + d.fields.remove("__colors"); + d.fields.remove("__color"); return Ok(()); } let list = |d: &Dialog, key: &str| -> Vec { diff --git a/crates/ui-egui/src/dialogs/tests_save_for_web.rs b/crates/ui-egui/src/dialogs/tests_save_for_web.rs index b0d3fd6fdd..41894ee6dd 100644 --- a/crates/ui-egui/src/dialogs/tests_save_for_web.rs +++ b/crates/ui-egui/src/dialogs/tests_save_for_web.rs @@ -783,6 +783,26 @@ fn colour_table_selection_and_delete_color() { assert_eq!((&d.fields["colorTable"]["deleted"], &d.fields["colorTable"]["customPalette"]), (&json!([]), &json!([]))); } +/// Delete Color takes only selected colors the table shows: a selection the table no longer holds +/// (after a change of reduction or color count, or set through `ui.dialog.set`) deletes nothing, +/// fixes no palette and is cleared, and a selection partly in the table deletes only what it shows. +#[test] +fn delete_color_skips_selected_colors_the_table_does_not_show() { + let mut d = Dialog::new(save_for_web::KIND, json!({})); + let shown: Vec = ["#000000", "#111111"].map(String::from).to_vec(); + let table = |d: &Dialog, key: &str| d.fields.get("colorTable").and_then(|t| t.get(key)).cloned(); + d.fields.insert("__colors".into(), json!(["#ABCDEF"])); + d.fields.insert("__color".into(), json!("#abcdef")); + assert!(save_for_web::selected_in(&d, &shown).is_empty()); + save_for_web::delete_colors(&mut d, &shown).unwrap(); + assert_eq!((table(&d, "customPalette"), table(&d, "deleted")), (None, None)); + assert!(!d.fields.contains_key("__colors") && !d.fields.contains_key("__color")); + d.fields.insert("__colors".into(), json!(["#abcdef", "#111111"])); + assert_eq!(save_for_web::selected_in(&d, &shown), ["#111111"]); + save_for_web::delete_colors(&mut d, &shown).unwrap(); + assert_eq!((table(&d, "customPalette"), table(&d, "deleted")), (Some(json!(shown)), Some(json!(["#111111"])))); +} + /// A shift by hand replaces a web shift and selects the color; a shift to the color itself takes it /// away; Unshift All Colors clears both kinds; Delete Color takes a deleted color's shift away. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index 370e9584f6..5633e11788 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9048,7 +9048,9 @@ at most 256 colors, and `#rrggbbaa` is refused. A `reduction` change without `co both lists. JPEG and PNG-24 have no color table and do not read them. Presets and `webExport.settings` keep them. In the dialog a click selects one color, Shift-click selects the colors between it and the last one clicked, and Ctrl-click (Command-click on macOS) adds or removes one (`__colors` holds the selection, `__color` the last one -clicked). The trash button and Delete Color in the table's menu delete the selection in one edit, Restore Generated +clicked). The trash button and Delete Color in the table's menu delete the selected colors the table shows in one edit, +and are off when it shows none of them (a selected color can leave the table when the reduction or the color count +changes). Restore Generated Table in that menu clears `deleted` and `customPalette`, and the table reads Custom while either is set. Choosing another reduction in the dialog also clears them. From 0637f14bfd5251844ea2872fdf2be398b5fdf846 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 18:01:35 -0800 Subject: [PATCH 098/158] Keep Bristle tip in sync with Alt release --- crates/tools/src/draw2/gesture.rs | 4 ++++ crates/tools/src/draw2/gesture/tests.rs | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/crates/tools/src/draw2/gesture.rs b/crates/tools/src/draw2/gesture.rs index c753745f3a..64894379f7 100644 --- a/crates/tools/src/draw2/gesture.rs +++ b/crates/tools/src/draw2/gesture.rs @@ -1798,6 +1798,10 @@ impl Tool for GestureTool { self.close_to = None; self.connect_to.clear(); self.redraw = None; + if self.id == "paintbrush" { + // The release can change a drawing stroke into an Alt-borrowed Smooth hover. + self.pointer_tip(cx, ev); + } out } _ => vec![], diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index 5370b43825..871fab304a 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -3099,6 +3099,17 @@ fn bristle_tip_annotator_follows_a_rotation_capable_pen() { let mut release = heavy; release.kind = PointerKind::Up; tool.pointer(&view, &release); + let mut alt_stroke = light; + alt_stroke.pressure = 0.5; + tool.pointer(&selected_view, &alt_stroke); + alt_stroke.kind = PointerKind::Drag; + alt_stroke.mods.alt = true; + tool.pointer(&selected_view, &alt_stroke); + assert!(bounds(&tool, &selected_view).is_some(), "Alt during a drawing stroke keeps the tip"); + alt_stroke.kind = PointerKind::Up; + tool.pointer(&selected_view, &alt_stroke); + assert_eq!(tool.cursor(&selected_view, alt_stroke.pos, alt_stroke.mods), Cursor::Smooth); + assert!(bounds(&tool, &selected_view).is_none(), "Alt release borrows Smooth without a stale tip"); let precise = ToolContext { precise_cursors: true, ..cx(&d, &s, &p) }; assert!(bounds(&tool, &precise).is_none()); tool.pointer(&view, &at(Some(0.0)).with_mods(Mods { cmd: true, ..Default::default() })); From 21e0b780e7f35b9994593ee63a7e93191e68d1b5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 17:19:21 -0800 Subject: [PATCH 099/158] Path Precision Tools: Common Tangents draws the lines from a point to a closed path Common Tangents (addon.pathtools.commonTangents) now also takes a point, a path of one anchor, together with a convex closed path. The lines run from the point to where they touch the path: two from a point outside it, one from a point on its outline (centered on the point and as long as the path is wide along it, or the whole straight side the point lies on), and none from a point inside, which leaves the document unchanged and returns a warning. Centerline adds the line from the point to the path's center. Every Tangents value gives the same lines; two points are refused. The geometry treats the point as an outline whose support value is p . n, so the existing root search finds the lines. Docs: docs/mcp.md, docs/target-app-parity.md, ROADMAP. The new warning has a row in every catalog. --- ROADMAP.md | 1 + .../src/cmd/addons/pathtools/tangents.rs | 43 ++++-- .../cmd/addons/pathtools/tangents/tests.rs | 78 +++++++++++ .../pathops/src/addons/pathtools/tangents.rs | 122 ++++++++++++++++-- crates/ui-egui/src/i18n/bg.tsv | 1 + crates/ui-egui/src/i18n/bs.tsv | 1 + crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/gu.tsv | 1 + crates/ui-egui/src/i18n/hi.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + docs/mcp.md | 26 ++-- docs/target-app-parity.md | 2 +- 34 files changed, 272 insertions(+), 28 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 4358817b60..4c1137880e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -150,6 +150,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap - 2026-11-01: Document Tools, a built-in add-on (Object › Plug-ins › Document Tools), starts with Save a Timestamped Copy: a copy of the document named `_YYYY-MM-DD_HH-MM` (UTC; `-2`, `-3`… when that name is taken) goes next to it, or into a folder picked for a document never saved, written as File › Save a Copy writes it, so the document keeps its path, title and modified state. Off on the web, which has no clock. A VectorCraft addition: headline numbers unchanged. - 2026-11-01: Divide into Dashes joins the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): the selected paths, or only their direct-selected segments, are cut into separate open paths of a dash length measured along the curve, with an optional gap (left empty, or kept as pieces), each keeping the path's appearance; Fit to Corners and Ends stretches or squeezes the lengths so every run starts and ends on a dash. A dialog with Preview, one undo step, at most 100000 pieces. A VectorCraft addition: headline numbers unchanged. - 2026-11-15: Common Tangents in the Path Precision Tools add-on (Object › Plug-ins › Path Precision Tools): the straight lines that touch two selected convex closed paths (ellipses at any rotation and scale, or convex Bézier paths) without crossing either are added as open paths with the current stroke: external, internal or all, and the line joining the centers if asked; a path inside the other has none unless the two touch, and a message says why; a dialog with Preview, one undo step (`addon.pathtools.commonTangents`, #7845). A VectorCraft addition: headline numbers unchanged. +- 2026-11-18: Common Tangents also takes a point (a path of one anchor) and a convex closed path: the lines from the point that touch the path, and the line from the point to the path's center if asked; a point on the outline gets the one tangent there, and a point inside gets none, with a message (#7846). A VectorCraft addition: headline numbers unchanged. - 2026-11-15: With Smart Guides and Snap to Tangent on, a Line Segment drag pressed on one convex curved path and dragged near another lands on a common tangent of the two: both ends move to where the line touches the paths, each labeled "tangent" (#7845). A VectorCraft addition: headline numbers unchanged. - 2026-11-03: Text Tweaker, the first tool of the Type Tools add-on (Object › Plug-ins › Type Tools): one character attribute (size, baseline shift, rotation, horizontal or vertical scale, tracking, leading or stroke weight) goes letter by letter from a start value to an end value along a straight ramp, an ease, a bow, a spike or at random with a seed, set as the Character panel sets it, while the text stays live; a dialog with Preview, one undo step (`addon.type.textTweaker`, #4924). A VectorCraft addition: headline numbers unchanged. - 2026-11-01: Group Overlapping Objects joins the Arrange Tools add-on (Object › Plug-ins › Arrange Tools): the selected objects whose visual bounds overlap or touch, chains included, go into one group each, within their own layer or group, at the stacking place of their frontmost member; objects that overlap nothing stay as they are. One undo step, a sweep along x so thousands of loose pieces group quickly (at most 20000 objects). A VectorCraft addition: headline numbers unchanged. diff --git a/crates/engine/src/cmd/addons/pathtools/tangents.rs b/crates/engine/src/cmd/addons/pathtools/tangents.rs index 8102777687..1625bbe2e7 100644 --- a/crates/engine/src/cmd/addons/pathtools/tangents.rs +++ b/crates/engine/src/cmd/addons/pathtools/tangents.rs @@ -1,7 +1,8 @@ //! Common Tangents (`addon.pathtools.commonTangents`): the straight lines that touch two selected //! convex closed paths (ellipses at any rotation and scale, and convex Bézier paths) without //! crossing into either, added as separate open paths, with the line joining their centers if -//! asked. The geometry is `vectorcraft_pathops::addons::pathtools::common_tangents`. +//! asked. One of the two may be a point (a path of one anchor) instead: the lines then run from it +//! to where they touch the path. The geometry is `vectorcraft_pathops::addons::pathtools::common_tangents`. #[cfg(test)] mod tests; @@ -30,19 +31,24 @@ pub(super) fn specs() -> Vec { "Common Tangents", ["Object", "Plug-ins", "Path Precision Tools"], None, - "{tangents?: \"external\" (both paths on the same side of each line) | \"internal\" (the lines that run between them) | \"all\" (\"all\"), centerline?: bool (false: true also adds the line joining the two centers, an ellipse's center or a path's center of area), ids?: [id, id] (default: the selection)} add the common tangent lines of two convex closed paths as separate open paths, each from where it touches the first path to where it touches the second (the whole stretch where a straight side lies along it), stroked with the current stroke color and weight (black when the stroke is None) and unfilled, directly above the upper of the two, as one undo step; the new lines are selected. An ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse; any other path must be closed, have one outline, bend the same way all around and have at most 10000 segments. Separate paths have two external and two internal tangents; overlapping paths only external ones; one path inside the other has none. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it; paths that meet at a corner or along a shared stretch of outline get one such line, at the middle of the directions that touch both. Paths count as touching when the gap between them is less than a billionth of the larger of their sizes and the distance between their centers. When there is no tangent of the kind asked for, nothing changes and the result has a `warning` → {ids, external, internal, centerline (its id or null), warning?}", + "{tangents?: \"external\" (both paths on the same side of each line) | \"internal\" (the lines that run between them) | \"all\" (\"all\"), centerline?: bool (false: true also adds the line joining the two centers, an ellipse's center or a path's center of area), ids?: [id, id] (default: the selection)} add the common tangent lines of two convex closed paths as separate open paths, each from where it touches the first path to where it touches the second (the whole stretch where a straight side lies along it), stroked with the current stroke color and weight (black when the stroke is None) and unfilled, directly above the upper of the two, as one undo step; the new lines are selected. An ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse; any other path must be closed, have one outline, bend the same way all around and have at most 10000 segments. Separate paths have two external and two internal tangents; overlapping paths only external ones; one path inside the other has none. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it; paths that meet at a corner or along a shared stretch of outline get one such line, at the middle of the directions that touch both. Paths count as touching when the gap between them is less than a billionth of the larger of their sizes and the distance between their centers. One of the two may be a point (a path of one anchor): the lines then run from the point to where they touch the path, two when the point lies outside it (one that lies along a straight side covers the whole side), one when the point lies on its outline (centered on the point and as long as the path is wide along it, or the whole straight side the point lies on), none when it lies inside; every `tangents` value gives the same lines, counted as internal when `tangents` is \"internal\" and as external otherwise, and the centerline runs from the point to the path's center; two points are refused. When there is no tangent of the kind asked for, nothing changes and the result has a `warning` → {ids, external, internal, centerline (its id or null), warning?}", has_selection, common_tangents )] } -/// The outline of path `id` as the geometry takes it: an exact ellipse for a whole live ellipse, -/// else the path's one closed convex subpath. +/// The outline of path `id` as the geometry takes it: a point for a path of one anchor, an exact +/// ellipse for a whole live ellipse, else the path's one closed convex subpath. fn outline_of(d: &Document, id: NodeId) -> Result { const C: &str = COMMON_TANGENTS; let n = d.node(id).ok_or(EngineError::NoNode(id))?; let NodeKind::Path { path, live, .. } = &n.kind else { return Err(bad(C, "select two closed paths")) }; let [sp] = path.subpaths.as_slice() else { return Err(bad(C, "select two closed paths")) }; + if sp.anchors.len() == 1 + && let Some(only) = sp.anchors.first() + { + return pt::Outline::point(only.p).map_err(refusal); + } if let Some(LiveShape::Ellipse { w, h, pie, xf }) = live.as_deref() { let span = (pie.1 - pie.0).rem_euclid(360.0); if span < 1e-9 || 360.0 - span < 1e-9 { @@ -74,17 +80,36 @@ fn common_tangents(s: &mut Session, p: &Value) -> Result { let ordered = d.paint_order(roots.iter().copied()); let [first, second] = ordered.as_slice() else { return Err(bad(C, "select two closed paths")) }; let (a, b) = (outline_of(d, *first)?, outline_of(d, *second)?); + if a.is_point() && b.is_point() { + return Err(bad(C, "select two closed paths")); + } + // A point goes first, so that each line runs from it to where it touches the path. + let point = a.is_point() || b.is_point(); + let (a, b) = if b.is_point() { (b, a) } else { (a, b) }; let all = pt::common_tangents(&a, &b).map_err(|_| bad(C, "the two paths have the same outline"))?; let external = all.iter().filter(|t| t.kind == pt::TangentKind::External).count(); - let keep = |t: &&pt::Tangent| match kinds { - "external" => t.kind == pt::TangentKind::External, - "internal" => t.kind == pt::TangentKind::Internal, - _ => true, + // A point's external and internal tangents are the same lines: every kind keeps them. + let keep = |t: &&pt::Tangent| { + point + || match kinds { + "external" => t.kind == pt::TangentKind::External, + "internal" => t.kind == pt::TangentKind::Internal, + _ => true, + } }; let kept: Vec<&pt::Tangent> = all.iter().filter(keep).collect(); let count = |kind: pt::TangentKind| kept.iter().filter(|t| t.kind == kind).count(); - let (external_kept, internal_kept) = (count(pt::TangentKind::External), count(pt::TangentKind::Internal)); + let (external_kept, internal_kept) = match (point, kinds) { + (true, "internal") => (0, kept.len()), + (true, _) => (kept.len(), 0), + _ => (count(pt::TangentKind::External), count(pt::TangentKind::Internal)), + }; let lines: Vec<(Point, Point)> = kept.iter().map(|t| (t.from, t.to)).collect(); + if lines.is_empty() && point { + // Written as `EngineError::Other` so that the i18n message scan finds it. + let warning = EngineError::Other("The point lies inside the path, so it has no tangents".into()); + return Ok(json!({ "ids": [], "external": 0, "internal": 0, "centerline": null, "warning": warning.to_string() })); + } if lines.is_empty() { // Written as `EngineError::Other` so that the i18n message scan finds them. Exactly one // external tangent means one path lies inside the other and touches it there; paths that diff --git a/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs b/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs index aef694bbdd..7ab6b32838 100644 --- a/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs +++ b/crates/engine/src/cmd/addons/pathtools/tangents/tests.rs @@ -248,6 +248,84 @@ fn nested_and_overlapping_paths_change_nothing_and_say_why() { assert_eq!((r["external"].as_u64(), r["internal"].as_u64()), (Some(1), Some(0)), "{r}"); } +fn point(s: &mut Session, x: f64, y: f64) -> NodeId { + id_of(&s.execute("path.create", &json!({"anchors": [{"x": x, "y": y}]})).unwrap()) +} + +#[test] +fn a_point_and_an_ellipse_get_the_two_lines_from_the_point_and_the_centerline() { + let mut s = session(); + // The point is drawn after the oval, so it is the upper object; the lines still start at it. + let oval = id_of(&s.execute("shape.ellipse", &json!({"x": 260, "y": 170, "width": 80, "height": 60})).unwrap()); + let dot = point(&mut s, 100.0, 200.0); + select(&mut s, &[oval, dot]); + let before = steps(&s); + let r = s.execute(C, &json!({"centerline": true})).unwrap(); + assert_eq!((r["external"].as_u64(), r["internal"].as_u64()), (Some(2), Some(0)), "{r}"); + assert_eq!(steps(&s), before + 1); + let found = lines(&s, &r); + assert_eq!(found.len(), 3, "two tangents and the centerline"); + let (p, c) = (Point::new(100.0, 200.0), Point::new(300.0, 200.0)); + // From (-200, 0) to an ellipse with semi-axes 40 and 30 about the origin: the touching points + // are x = -a²/200 = -8, y = ±b √(1 - x²/a²). + let y = 30.0 * (1.0f64 - (8.0f64 / 40.0).powi(2)).sqrt(); + for sy in [1.0, -1.0] { + let touch = c + Vec2::new(-8.0, sy * y); + assert!(found[..2].iter().any(|(a, b)| near(*a, p) && near(*b, touch)), "{touch:?} in {found:?}"); + } + assert_eq!(r["centerline"], r["ids"][2]); + assert!(near(found[2].0, p) && near(found[2].1, c), "{:?}", found[2]); + // Every `tangents` value gives the same two lines. + for (kind, external, internal) in [("external", 2, 0), ("internal", 0, 2)] { + let r = s.execute(C, &json!({"ids": [oval.0, dot.0], "tangents": kind})).unwrap(); + assert_eq!((r["external"].as_u64(), r["internal"].as_u64()), (Some(external), Some(internal)), "{kind}: {r}"); + assert_eq!(lines(&s, &r).len(), 2, "{kind}"); + } +} + +#[test] +fn a_point_below_the_path_still_starts_the_lines() { + let mut s = session(); + // The point is drawn first, so it is the lower object and needs no swap. + let dot = point(&mut s, 100.0, 200.0); + let round = circle(&mut s, 300.0, 200.0, 50.0); + let r = s.execute(C, &json!({"ids": [round.0, dot.0], "centerline": true})).unwrap(); + assert_eq!((r["external"].as_u64(), r["internal"].as_u64()), (Some(2), Some(0)), "{r}"); + let found = lines(&s, &r); + assert_eq!(found.len(), 3, "two tangents and the centerline"); + let p = Point::new(100.0, 200.0); + assert!(found.iter().all(|(a, _)| near(*a, p)), "every line starts at the point: {found:?}"); + // From 200 away to a circle of radius 50, each tangent is √(200² - 50²) long. + let length = (200.0f64 * 200.0 - 50.0 * 50.0).sqrt(); + assert!(found[..2].iter().all(|(a, b)| (a.distance(*b) - length).abs() < 1e-6), "{found:?}"); + assert!(near(found[2].1, Point::new(300.0, 200.0)), "{:?}", found[2]); +} + +#[test] +fn a_point_on_or_inside_a_path_and_two_points() { + let mut s = session(); + let round = circle(&mut s, 200.0, 200.0, 50.0); + // On the circle: one line, centered on the point and as long as the circle is wide. + let on = point(&mut s, 250.0, 200.0); + let r = s.execute(C, &json!({"ids": [round.0, on.0]})).unwrap(); + assert_eq!(r["external"].as_u64(), Some(1), "{r}"); + let (p, q) = lines(&s, &r)[0]; + assert!((p.x - 250.0).abs() < 1e-5 && (q.x - 250.0).abs() < 1e-5 && (p.distance(q) - 100.0).abs() < 1e-5, "{p:?} {q:?}"); + // Inside: nothing changes, and the warning says why. + let inside = point(&mut s, 210.0, 190.0); + let before = (steps(&s), s.doc().unwrap().doc.node_count()); + let r = s.execute(C, &json!({"ids": [round.0, inside.0], "centerline": true})).unwrap(); + assert_eq!(r["ids"], json!([])); + assert!(r["warning"].as_str().unwrap().contains("point lies inside the path"), "{r}"); + assert_eq!((steps(&s), s.doc().unwrap().doc.node_count()), before, "nothing changes"); + // Two points, or a point and an open path, are refused. + let err = |s: &mut Session, p: Value| s.execute(C, &p).unwrap_err().to_string(); + assert!(err(&mut s, json!({"ids": [on.0, inside.0]})).contains("select two closed paths")); + let open = id_of(&s.execute("path.create", &json!({"anchors": [{"x": 0, "y": 0}, {"x": 50, "y": 0}, {"x": 50, "y": 50}]})).unwrap()); + assert!(err(&mut s, json!({"ids": [open.0, on.0]})).contains("open")); + assert_eq!((steps(&s), s.doc().unwrap().doc.node_count()), (before.0 + 1, before.1 + 1), "only the open path was added"); +} + #[test] fn bad_selections_and_params_are_refused() { let mut s = session(); diff --git a/crates/pathops/src/addons/pathtools/tangents.rs b/crates/pathops/src/addons/pathtools/tangents.rs index a42e628cad..b47b888302 100644 --- a/crates/pathops/src/addons/pathtools/tangents.rs +++ b/crates/pathops/src/addons/pathtools/tangents.rs @@ -8,6 +8,9 @@ //! Both are found as roots over the normal's angle: sampled, then refined by bisection, with //! sampled minima refined too so that a double root (outlines that touch) or two roots between //! neighboring samples are kept. +//! +//! One of the two may be a point instead ([`Outline::point`]): its support value is `p · n`, and +//! the tangents are the lines through it that touch the other outline. use std::f64::consts::TAU; @@ -60,7 +63,7 @@ pub enum OutlineError { #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct Coincide; -/// A convex closed outline that [`common_tangents`] takes. +/// A convex closed outline, or a point, that [`common_tangents`] takes. #[derive(Clone, Debug)] pub enum Outline { /// The unit circle under an affine map: the center is the map's translation, `m` its linear @@ -70,9 +73,19 @@ pub enum Outline { /// when the segments run counter-clockwise (y up); the segment where `p · n` is largest then /// comes later in the list as the angle of `n` grows. Convex { segments: Vec, center: Point, size: f64, ccw: bool }, + /// A single point. + Point { at: Point }, } impl Outline { + /// The point `at`, whose tangents are the lines through it. + pub fn point(at: Point) -> Result { + if !at.x.is_finite() || !at.y.is_finite() { + return Err(OutlineError::Empty); + } + Ok(Outline::Point { at }) + } + /// The ellipse that `unit` maps the unit circle onto. pub fn ellipse(unit: Affine) -> Result { let [a, b, c, d, e, f] = unit.as_coeffs(); @@ -183,6 +196,7 @@ impl Outline { size: *size, ccw: *ccw, }, + Outline::Point { at } => Outline::Point { at: *at + d }, } } @@ -203,7 +217,7 @@ impl Outline { /// The support value at `n` and the segment it is reached on, from every segment. fn support_scan(&self, n: Vec2) -> (f64, usize) { match self { - Outline::Ellipse { .. } => (self.support(n), 0), + Outline::Ellipse { .. } | Outline::Point { .. } => (self.support(n), 0), Outline::Convex { segments, .. } => { let mut best = (f64::MIN, 0); for (i, s) in segments.iter().enumerate() { @@ -222,7 +236,7 @@ impl Outline { /// where the support value was reached at a normal angle a little less than `n`'s. fn support_from(&self, n: Vec2, from: usize) -> (f64, usize) { match self { - Outline::Ellipse { .. } => (self.support(n), 0), + Outline::Ellipse { .. } | Outline::Point { .. } => (self.support(n), 0), Outline::Convex { segments, ccw, .. } => { let len = segments.len(); if len == 0 { @@ -251,14 +265,20 @@ impl Outline { } } - /// The center: an ellipse's, or a path's center of area. + /// The center: an ellipse's, a path's center of area, or the point itself. pub fn center(&self) -> Point { match self { Outline::Ellipse { center, .. } | Outline::Convex { center, .. } => *center, + Outline::Point { at } => *at, } } - /// The diagonal of the bounds (an ellipse's: of the box its axes span). + /// Whether this is a point. + pub fn is_point(&self) -> bool { + matches!(self, Outline::Point { .. }) + } + + /// The diagonal of the bounds (an ellipse's: of the box its axes span; a point's: 0). pub fn size(&self) -> f64 { match self { Outline::Ellipse { m, .. } => { @@ -266,6 +286,7 @@ impl Outline { 2.0 * (a.hypot(c).powi(2) + b.hypot(d).powi(2)).sqrt() } Outline::Convex { size, .. } => *size, + Outline::Point { .. } => 0.0, } } @@ -280,6 +301,7 @@ impl Outline { } best } + Outline::Point { at } => at.to_vec2().dot(n), } } @@ -320,6 +342,7 @@ impl Outline { let Some(&(peak, _)) = all.iter().max_by(|x, y| x.1.total_cmp(&y.1)) else { return vec![] }; all.into_iter().filter(|(p, v)| h - v <= tol + slope * (*p - peak).hypot()).map(|(p, _)| p).collect() } + Outline::Point { at } => vec![*at], } } } @@ -406,7 +429,14 @@ fn dir(angle: f64) -> Vec2 { /// the angle of its normal. Separate outlines have two of each; overlapping ones only external /// ones (two for ellipses, possibly more for paths whose outlines cross more often); one inside the /// other none; outlines that touch share one tangent where they touch. +/// +/// When one of them is a point, its external and internal tangents are the same lines, and they +/// come back as external ones: two when the point lies outside the other outline, one when it lies +/// on it, none inside. Two points have none. pub fn common_tangents(a: &Outline, b: &Outline) -> Result, Coincide> { + if a.is_point() && b.is_point() { + return Ok(vec![]); + } // Worked out about the point between the two centers. let origin = (a.center().to_vec2() + b.center().to_vec2()) / 2.0; let (a, b) = (&a.shifted(-origin), &b.shifted(-origin)); @@ -434,7 +464,11 @@ pub fn common_tangents(a: &Outline, b: &Outline) -> Result, Coincid let (ha, hb, hb_back) = (hints(a, 1.0), hints(b, 1.0), hints(b, -1.0)); let hint = |h: &[usize], k: usize| h.get(k).copied().unwrap_or(0); let external = roots(&at, &|t, k| a.support_from(dir(t), hint(&ha, k)).0 - b.support_from(dir(t), hint(&hb, k)).0, tol)?; - let internal = roots(&at, &|t, k| a.support_from(dir(t), hint(&ha, k)).0 + b.support_from(-dir(t), hint(&hb_back, k)).0, tol)?; + let internal = if a.is_point() || b.is_point() { + vec![] + } else { + roots(&at, &|t, k| a.support_from(dir(t), hint(&ha, k)).0 + b.support_from(-dir(t), hint(&hb_back, k)).0, tol)? + }; let (a, b) = (Hinted { o: a, at: &at, hints: &ha }, Hinted { o: b, at: &at, hints: &hb }); let mut out = Vec::with_capacity(external.len() + internal.len()); for (kind, list) in [(TangentKind::External, external), (TangentKind::Internal, internal)] { @@ -506,8 +540,13 @@ fn tangent_at(a: &Hinted, b: &Hinted, kind: TangentKind, angle: f64, double: boo // A double root's angle is found less exactly than a simple one's, so touching points may // stand a little apart. let (from, to) = if double && hi - lo <= 1e-6 * size { - // Touching at one point: the narrower outline's width along the line, centered there. - let width = [a, b].map(|o| o.support(angle + TAU / 4.0).0 + o.support(angle - TAU / 4.0).0).into_iter().fold(f64::MAX, f64::min); + // Touching at one point: the narrower outline's width along the line, centered there. A + // point on the other outline takes that outline's width. + let width = [a, b] + .into_iter() + .filter(|o| !o.o.is_point()) + .map(|o| o.support(angle + TAU / 4.0).0 + o.support(angle - TAU / 4.0).0) + .fold(f64::MAX, f64::min); let mid = (lo + hi) / 2.0; (mid - width / 2.0, mid + width / 2.0) } else if mean(&on_a) <= mean(&on_b) { @@ -975,6 +1014,73 @@ mod tests { assert!((best - 0.25).abs() < 1e-12, "{best}"); } + #[test] + fn a_point_outside_a_turned_ellipse_has_two_tangents_through_it() { + let m = ellipse_map(100.0, 50.0, 40.0, 15.0, 30.0); + let (oval, p) = (Outline::ellipse(m).unwrap(), Point::new(-60.0, 120.0)); + let samples = sample_ellipse(m, 5_000); + for point_first in [true, false] { + let point = Outline::point(p).unwrap(); + let all = if point_first { common_tangents(&point, &oval) } else { common_tangents(&oval, &point) }.unwrap(); + assert_eq!(all.len(), 2, "{all:?}"); + for t in &all { + assert_eq!(t.kind, TangentKind::External); + // Each runs from the first outline given to the second: from the point when it + // comes first. + let (at_point, on_oval) = if point_first { (t.from, t.to) } else { (t.to, t.from) }; + assert!((at_point - p).hypot() < 1e-9, "{t:?}"); + // Taken back to the unit circle, the far end lies on it and the line runs square to + // its radius there. + let inv = m.inverse(); + let (q, d) = ((inv * on_oval).to_vec2(), (inv * on_oval) - (inv * at_point)); + assert!((q.hypot() - 1.0).abs() < 1e-9, "{q:?}"); + assert!((q.dot(d) / d.hypot()).abs() < 1e-7, "{q:?} {d:?}"); + // The whole ellipse lies on one side of the line. + let dir = on_oval - at_point; + let n = Vec2::new(-dir.y, dir.x) / dir.hypot(); + let side: Vec = samples.iter().map(|s| (*s - at_point).dot(n)).collect(); + let (lo, hi) = side.iter().fold((f64::MAX, f64::MIN), |(lo, hi), v| (lo.min(*v), hi.max(*v))); + assert!(lo > -1e-6 || hi < 1e-6, "crosses: {lo} .. {hi}"); + } + } + } + + #[test] + fn a_point_on_inside_and_beside_a_path() { + // On a circle: the one tangent there, centered on the point and as long as the circle is + // wide. + let on = common_tangents(&Outline::point(Point::new(10.0, 0.0)).unwrap(), &circle(0.0, 0.0, 10.0)).unwrap(); + assert_eq!(on.len(), 1, "{on:?}"); + assert!(ends_within(&on[0], Point::new(10.0, -10.0), Point::new(10.0, 10.0), 1e-5), "{on:?}"); + // Inside, and two points: none. + assert!(common_tangents(&Outline::point(Point::new(3.0, 4.0)).unwrap(), &circle(0.0, 0.0, 10.0)).unwrap().is_empty()); + let two = (Outline::point(Point::new(0.0, 0.0)).unwrap(), Outline::point(Point::new(5.0, 0.0)).unwrap()); + assert!(common_tangents(&two.0, &two.1).unwrap().is_empty()); + // Beside a square, in line with its bottom side: that tangent covers the whole side, and + // the other one touches the corner at (10, 10). + let square = SubPath::polyline(&[(0.0, 0.0), (10.0, 0.0), (10.0, 10.0), (0.0, 10.0)].map(Point::from), true); + let sq = Outline::convex(&square).unwrap(); + let p = Point::new(20.0, 0.0); + let all = common_tangents(&Outline::point(p).unwrap(), &sq).unwrap(); + assert_eq!(all.len(), 2, "{all:?}"); + assert!(all.iter().any(|t| ends_at(t, p, Point::new(0.0, 0.0))), "{all:?}"); + assert!(all.iter().any(|t| ends_at(t, p, Point::new(10.0, 10.0))), "{all:?}"); + assert!(all.iter().all(|t| (t.from - p).hypot() < 1e-9), "from the point: {all:?}"); + // On a straight side, off its middle: the one tangent is that side, covered whole. + let side = common_tangents(&Outline::point(Point::new(2.0, 0.0)).unwrap(), &sq).unwrap(); + assert_eq!(side.len(), 1, "{side:?}"); + assert!(ends_at(&side[0], Point::new(0.0, 0.0), Point::new(10.0, 0.0)), "{side:?}"); + // At a corner of the square: one line through the corner, at the middle of the directions + // that touch there, as long as the square is wide along it. + let corner = common_tangents(&Outline::point(Point::new(10.0, 10.0)).unwrap(), &sq).unwrap(); + assert_eq!(corner.len(), 1, "{corner:?}"); + // The diagonal is 10√2 long, so each end lies 5√2 from the corner, along (1, -1). + assert!(ends_within(&corner[0], Point::new(15.0, 5.0), Point::new(5.0, 15.0), 1e-5), "{corner:?}"); + // A point that is not finite is refused. + assert_eq!(Outline::point(Point::new(f64::NAN, 0.0)).err(), Some(OutlineError::Empty)); + assert_eq!(Outline::point(Point::new(0.0, f64::INFINITY)).err(), Some(OutlineError::Empty)); + } + #[test] fn open_concave_empty_and_identical_outlines_are_refused() { let open = SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(10.0, 0.0), Point::new(10.0, 10.0)], false); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index bb039bb08e..7a8708f165 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -6905,6 +6905,7 @@ breakText Glyphs Глифи @msg One path lies inside the other, so they have no common tangents Единият път е вътре в другия, затова нямат общи допирателни @msg The paths overlap, so they have no internal tangents Пътищата се припокриват, затова нямат вътрешни допирателни @msg One path lies inside the other, so they have no internal tangents Единият път е вътре в другия, затова нямат вътрешни допирателни +@msg The point lies inside the path, so it has no tangents Точката е вътре в пътя, затова няма допирателни # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Разширяване на тиретата в пътища @msg select paths with dashed strokes to expand изберете пътища с прекъснат щрих за разширяване diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 99f23d313c..47daea1e10 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -6958,6 +6958,7 @@ shape Open Otvoren @msg One path lies inside the other, so they have no common tangents Jedna putanja leži unutar druge, pa nemaju zajedničkih tangenti @msg The paths overlap, so they have no internal tangents Putanje se preklapaju, pa nemaju unutrašnjih tangenti @msg One path lies inside the other, so they have no internal tangents Jedna putanja leži unutar druge, pa nemaju unutrašnjih tangenti +@msg The point lies inside the path, so it has no tangents Tačka leži unutar putanje, pa nema tangenti # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Proširi crtice u putanje @msg select paths with dashed strokes to expand odaberite putanje s isprekidanim potezom za proširivanje diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index c54311799d..8de2f8b0d0 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -7630,6 +7630,7 @@ breakText Glyphs Glifs @msg One path lies inside the other, so they have no common tangents Un camí és dins de l’altre, per tant no tenen tangents comunes @msg The paths overlap, so they have no internal tangents Els camins se superposen, per tant no tenen tangents internes @msg One path lies inside the other, so they have no internal tangents Un camí és dins de l’altre, per tant no tenen tangents internes +@msg The point lies inside the path, so it has no tangents El punt és dins del camí, per tant no té tangents # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Expandeix els guions en camins @msg select paths with dashed strokes to expand seleccioneu camins amb traç discontinu per expandir diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index a5d7bb948a..7160f9f6b0 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -7620,6 +7620,7 @@ breakText Glyphs Glyfy @msg One path lies inside the other, so they have no common tangents Jedna cesta leží uvnitř druhé, takže nemají žádné společné tečny @msg The paths overlap, so they have no internal tangents Cesty se překrývají, takže nemají žádné vnitřní tečny @msg One path lies inside the other, so they have no internal tangents Jedna cesta leží uvnitř druhé, takže nemají žádné vnitřní tečny +@msg The point lies inside the path, so it has no tangents Bod leží uvnitř cesty, takže nemá žádné tečny # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Rozložit čárky na cesty @msg select paths with dashed strokes to expand vyberte cesty s čárkovaným tahem k rozložení diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 08100f593f..dee35794a6 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -9680,6 +9680,7 @@ breakText Glyphs Glyffer @msg One path lies inside the other, so they have no common tangents Den ene sti ligger inden i den anden, så de har ingen fælles tangenter @msg The paths overlap, so they have no internal tangents Stierne overlapper, så de har ingen indre tangenter @msg One path lies inside the other, so they have no internal tangents Den ene sti ligger inden i den anden, så de har ingen indre tangenter +@msg The point lies inside the path, so it has no tangents Punktet ligger inden i stien, så det har ingen tangenter # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Udvid streger til stier @msg select paths with dashed strokes to expand vælg stier med stiplet streg, der skal udvides diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 10147b2d45..04652f40de 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -7213,6 +7213,7 @@ breakText Glyphs Glyphen @msg One path lies inside the other, so they have no common tangents Ein Pfad liegt im anderen, daher haben sie keine gemeinsamen Tangenten @msg The paths overlap, so they have no internal tangents Die Pfade überlappen sich, daher haben sie keine inneren Tangenten @msg One path lies inside the other, so they have no internal tangents Ein Pfad liegt im anderen, daher haben sie keine inneren Tangenten +@msg The point lies inside the path, so it has no tangents Der Punkt liegt im Pfad, daher hat er keine Tangenten # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Striche in Pfade umwandeln @msg select paths with dashed strokes to expand wählen Sie Pfade mit gestrichelter Kontur zum Umwandeln aus diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 1ebf6e5684..90f001c78a 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -7603,6 +7603,7 @@ breakText Glyphs Γλύφοι @msg One path lies inside the other, so they have no common tangents Η μία διαδρομή βρίσκεται μέσα στην άλλη, επομένως δεν έχουν κοινές εφαπτόμενες @msg The paths overlap, so they have no internal tangents Οι διαδρομές επικαλύπτονται, επομένως δεν έχουν εσωτερικές εφαπτόμενες @msg One path lies inside the other, so they have no internal tangents Η μία διαδρομή βρίσκεται μέσα στην άλλη, επομένως δεν έχουν εσωτερικές εφαπτόμενες +@msg The point lies inside the path, so it has no tangents Το σημείο βρίσκεται μέσα στη διαδρομή, επομένως δεν έχει εφαπτόμενες # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Επέκταση παυλών σε διαδρομές @msg select paths with dashed strokes to expand επιλέξτε διαδρομές με διακεκομμένο περίγραμμα για επέκταση diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index a456910a16..8b6368243c 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -7591,6 +7591,7 @@ breakText Glyphs Glifos @msg One path lies inside the other, so they have no common tangents Un trazado está dentro del otro, por lo que no tienen tangentes comunes @msg The paths overlap, so they have no internal tangents Los trazados se superponen, por lo que no tienen tangentes internas @msg One path lies inside the other, so they have no internal tangents Un trazado está dentro del otro, por lo que no tienen tangentes internas +@msg The point lies inside the path, so it has no tangents El punto está dentro del trazado, por lo que no tiene tangentes # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Expandir guiones en trazados @msg select paths with dashed strokes to expand seleccione trazados con trazo discontinuo para expandir diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index bff46fc0d7..4f91824ccd 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -7679,6 +7679,7 @@ breakText Glyphs Merkit @msg One path lies inside the other, so they have no common tangents Toinen polku on toisen sisällä, joten niillä ei ole yhteisiä tangentteja @msg The paths overlap, so they have no internal tangents Polut ovat päällekkäin, joten niillä ei ole sisäisiä tangentteja @msg One path lies inside the other, so they have no internal tangents Toinen polku on toisen sisällä, joten niillä ei ole sisäisiä tangentteja +@msg The point lies inside the path, so it has no tangents Piste on polun sisällä, joten sillä ei ole tangentteja # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Laajenna viivat poluiksi @msg select paths with dashed strokes to expand valitse laajennettavat polut, joissa on katkoviiva diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 3be3497f97..507c88d9cf 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -7615,6 +7615,7 @@ breakText Glyphs Glyphes @msg One path lies inside the other, so they have no common tangents Un tracé se trouve à l’intérieur de l’autre : ils n’ont donc aucune tangente commune @msg The paths overlap, so they have no internal tangents Les tracés se chevauchent : ils n’ont donc aucune tangente interne @msg One path lies inside the other, so they have no internal tangents Un tracé se trouve à l’intérieur de l’autre : ils n’ont donc aucune tangente interne +@msg The point lies inside the path, so it has no tangents Le point se trouve à l’intérieur du tracé et n’a donc aucune tangente # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Décomposer les tirets en tracés @msg select paths with dashed strokes to expand sélectionnez des tracés à contour pointillé à décomposer diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv index c427fc527c..6aecf796d9 100644 --- a/crates/ui-egui/src/i18n/gu.tsv +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -3046,6 +3046,7 @@ @msg One path lies inside the other, so they have no common tangents એક પાથ બીજાની અંદર છે, તેથી તેમની કોઈ સામાન્ય સ્પર્શરેખા નથી @msg The paths overlap, so they have no internal tangents પાથ એકબીજા પર ચઢેલા છે, તેથી તેમની કોઈ આંતરિક સ્પર્શરેખા નથી @msg One path lies inside the other, so they have no internal tangents એક પાથ બીજાની અંદર છે, તેથી તેમની કોઈ આંતરિક સ્પર્શરેખા નથી +@msg The point lies inside the path, so it has no tangents બિંદુ પાથની અંદર છે, તેથી તેની કોઈ સ્પર્શરેખા નથી Remove Guide ગાઇડ દૂર કરો Remove Item આઇટમ દૂર કરો Remove JavaScript File JavaScript ફાઇલ દૂર કરો diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index cbfb4f51d1..f80ee31e21 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -8283,6 +8283,7 @@ liquify-list-end {0}, {1} {0} और {1} @msg One path lies inside the other, so they have no common tangents एक पाथ दूसरे के अंदर है, इसलिए उनकी कोई उभयनिष्ठ स्पर्शरेखा नहीं है @msg The paths overlap, so they have no internal tangents पाथ एक-दूसरे पर चढ़े हुए हैं, इसलिए उनकी कोई आंतरिक स्पर्शरेखा नहीं है @msg One path lies inside the other, so they have no internal tangents एक पाथ दूसरे के अंदर है, इसलिए उनकी कोई आंतरिक स्पर्शरेखा नहीं है +@msg The point lies inside the path, so it has no tangents बिंदु पाथ के अंदर है, इसलिए उसकी कोई स्पर्शरेखा नहीं है @msg select plain rectangles, ellipses or regular polygons to convert बदलने के लिए सादे आयत, अंडाकार या नियमित बहुभुजों सिलेक्ट करें @msg Select point type पॉइंट टाइप सिलेक्ट करें @msg select two or three paths or compound paths दो या तीन पाथ या यौगिक पाथ सिलेक्ट करें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 0f81a72036..5d393bbcc0 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -7605,6 +7605,7 @@ breakText Glyphs Glifák @msg One path lies inside the other, so they have no common tangents Az egyik útvonal a másikon belül van, így nincsenek közös érintőik @msg The paths overlap, so they have no internal tangents Az útvonalak átfedik egymást, így nincsenek belső érintőik @msg One path lies inside the other, so they have no internal tangents Az egyik útvonal a másikon belül van, így nincsenek belső érintőik +@msg The point lies inside the path, so it has no tangents A pont az útvonalon belül van, így nincsenek érintői # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Szaggatások kibontása útvonalakká @msg select paths with dashed strokes to expand jelöljön ki szaggatott körvonalú útvonalakat a kibontáshoz diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 28ea2b5ab3..8ebc03d0a6 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -6920,6 +6920,7 @@ breakText Glyphs Glif @msg One path lies inside the other, so they have no common tangents Satu jalur berada di dalam jalur lainnya, sehingga tidak ada garis singgung persekutuan @msg The paths overlap, so they have no internal tangents Jalur-jalur saling tumpang tindih, sehingga tidak ada garis singgung dalam @msg One path lies inside the other, so they have no internal tangents Satu jalur berada di dalam jalur lainnya, sehingga tidak ada garis singgung dalam +@msg The point lies inside the path, so it has no tangents Titik berada di dalam jalur, sehingga tidak ada garis singgung # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Perluas garis putus menjadi jalur @msg select paths with dashed strokes to expand pilih jalur dengan stroke putus-putus yang akan diperluas diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 8f2ed3216c..3698d9688a 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -7249,6 +7249,7 @@ breakText Glyphs Glifi @msg One path lies inside the other, so they have no common tangents Un tracciato si trova dentro l’altro, quindi non hanno tangenti comuni @msg The paths overlap, so they have no internal tangents I tracciati si sovrappongono, quindi non hanno tangenti interne @msg One path lies inside the other, so they have no internal tangents Un tracciato si trova dentro l’altro, quindi non hanno tangenti interne +@msg The point lies inside the path, so it has no tangents Il punto si trova dentro il tracciato, quindi non ha tangenti # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Espandi trattini in tracciati @msg select paths with dashed strokes to expand seleziona tracciati con traccia tratteggiata da espandere diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index c429f204a1..eded12a369 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -9124,6 +9124,7 @@ breakText Glyphs 字形 @msg One path lies inside the other, so they have no common tangents 一方のパスがもう一方の内側にあるため、共通接線はありません @msg The paths overlap, so they have no internal tangents パスが重なっているため、内側の接線はありません @msg One path lies inside the other, so they have no internal tangents 一方のパスがもう一方の内側にあるため、内側の接線はありません +@msg The point lies inside the path, so it has no tangents 点がパスの内側にあるため、接線はありません # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths 破線をパスに拡張 @msg select paths with dashed strokes to expand 拡張する破線のパスを選択してください diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 414f45171c..d241087730 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -9834,6 +9834,7 @@ breakText Glyphs გლიფები @msg One path lies inside the other, so they have no common tangents ერთი ტრაექტორია მეორის შიგნითაა, ამიტომ მათ საერთო მხებები არ აქვთ @msg The paths overlap, so they have no internal tangents ტრაექტორიები ერთმანეთს ფარავს, ამიტომ მათ შიდა მხებები არ აქვთ @msg One path lies inside the other, so they have no internal tangents ერთი ტრაექტორია მეორის შიგნითაა, ამიტომ მათ შიდა მხებები არ აქვთ +@msg The point lies inside the path, so it has no tangents წერტილი ტრაექტორიის შიგნითაა, ამიტომ მას მხებები არ აქვს # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths ტირეების ტრაექტორიებად გაშლა @msg select paths with dashed strokes to expand აირჩიეთ გასაშლელი ტირეებიანი ხაზის კონტურები diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index dbda53243f..84e10c9b88 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -7213,6 +7213,7 @@ breakText Glyphs 글리프 @msg One path lies inside the other, so they have no common tangents 한 패스가 다른 패스 안에 있어 공통 접선이 없습니다 @msg The paths overlap, so they have no internal tangents 패스가 겹쳐 있어 내부 접선이 없습니다 @msg One path lies inside the other, so they have no internal tangents 한 패스가 다른 패스 안에 있어 내부 접선이 없습니다 +@msg The point lies inside the path, so it has no tangents 점이 패스 안에 있어 접선이 없습니다 # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths 대시를 패스로 확장 @msg select paths with dashed strokes to expand 확장할 점선 획의 패스를 선택하십시오 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 69aef91cfc..0ef0ede32e 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -9502,6 +9502,7 @@ breakText Glyphs Glyphs @msg One path lies inside the other, so they have no common tangents Het ene pad ligt binnen het andere, dus ze hebben geen gemeenschappelijke raaklijnen @msg The paths overlap, so they have no internal tangents De paden overlappen, dus ze hebben geen inwendige raaklijnen @msg One path lies inside the other, so they have no internal tangents Het ene pad ligt binnen het andere, dus ze hebben geen inwendige raaklijnen +@msg The point lies inside the path, so it has no tangents Het punt ligt binnen het pad, dus het heeft geen raaklijnen # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Streepjes uitbreiden tot paden @msg select paths with dashed strokes to expand selecteer paden met een streepjeslijn om uit te breiden diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 0147515ffe..4eb059fa0a 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -7476,6 +7476,7 @@ breakText Glyphs Glify @msg One path lies inside the other, so they have no common tangents Jedna ścieżka leży wewnątrz drugiej, więc nie mają wspólnych stycznych @msg The paths overlap, so they have no internal tangents Ścieżki nachodzą na siebie, więc nie mają stycznych wewnętrznych @msg One path lies inside the other, so they have no internal tangents Jedna ścieżka leży wewnątrz drugiej, więc nie mają stycznych wewnętrznych +@msg The point lies inside the path, so it has no tangents Punkt leży wewnątrz ścieżki, więc nie ma stycznych # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Rozszerz kreski na ścieżki @msg select paths with dashed strokes to expand zaznacz ścieżki z przerywanym konturem do rozszerzenia diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 8201db7ab6..87e4bf8f32 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -7652,6 +7652,7 @@ breakText Glyphs Glifos @msg One path lies inside the other, so they have no common tangents Um demarcador está dentro do outro, então eles não têm tangentes comuns @msg The paths overlap, so they have no internal tangents Os demarcadores se sobrepõem, então eles não têm tangentes internas @msg One path lies inside the other, so they have no internal tangents Um demarcador está dentro do outro, então eles não têm tangentes internas +@msg The point lies inside the path, so it has no tangents O ponto está dentro do demarcador, então ele não tem tangentes # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Expandir traços em demarcadores @msg select paths with dashed strokes to expand selecione demarcadores com traçado tracejado para expandir diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index d1593508d3..59f1e27b3f 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -7610,6 +7610,7 @@ breakText Glyphs Глифы @msg One path lies inside the other, so they have no common tangents Один контур лежит внутри другого, поэтому у них нет общих касательных @msg The paths overlap, so they have no internal tangents Контуры перекрываются, поэтому у них нет внутренних касательных @msg One path lies inside the other, so they have no internal tangents Один контур лежит внутри другого, поэтому у них нет внутренних касательных +@msg The point lies inside the path, so it has no tangents Точка лежит внутри контура, поэтому у неё нет касательных # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Разобрать штрихи на контуры @msg select paths with dashed strokes to expand выделите контуры со штриховой обводкой для разбора diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 5c0420fcd3..eab3c2f280 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -7648,6 +7648,7 @@ breakText Glyphs Glyfer @msg One path lies inside the other, so they have no common tangents Den ena banan ligger inuti den andra, så de har inga gemensamma tangenter @msg The paths overlap, so they have no internal tangents Banorna överlappar, så de har inga inre tangenter @msg One path lies inside the other, so they have no internal tangents Den ena banan ligger inuti den andra, så de har inga inre tangenter +@msg The point lies inside the path, so it has no tangents Punkten ligger inuti banan, så den har inga tangenter # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Expandera streck till banor @msg select paths with dashed strokes to expand markera banor med streckad kontur att expandera diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 910a7fc5b1..6532fd2e33 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -9501,6 +9501,7 @@ breakText Glyphs Glifler @msg One path lies inside the other, so they have no common tangents Bir yol diğerinin içinde, bu yüzden ortak teğetleri yok @msg The paths overlap, so they have no internal tangents Yollar örtüşüyor, bu yüzden iç teğetleri yok @msg One path lies inside the other, so they have no internal tangents Bir yol diğerinin içinde, bu yüzden iç teğetleri yok +@msg The point lies inside the path, so it has no tangents Nokta yolun içinde, bu yüzden teğeti yok # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Tireleri Yollara Genişlet @msg select paths with dashed strokes to expand genişletilecek kesikli konturlu yolları seçin diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index dbd6d2609e..af69f6c8d0 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -7231,6 +7231,7 @@ breakText Glyphs Гліфи @msg One path lies inside the other, so they have no common tangents Один контур лежить усередині іншого, тому вони не мають спільних дотичних @msg The paths overlap, so they have no internal tangents Контури перекриваються, тому вони не мають внутрішніх дотичних @msg One path lies inside the other, so they have no internal tangents Один контур лежить усередині іншого, тому вони не мають внутрішніх дотичних +@msg The point lies inside the path, so it has no tangents Точка лежить усередині контуру, тому вона не має дотичних # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Розібрати штрихи на контури @msg select paths with dashed strokes to expand виділіть контури зі штриховим обведенням для розбору diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 519c5d8f0d..30c2beba3c 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -7262,6 +7262,7 @@ breakText Glyphs Glyph @msg One path lies inside the other, so they have no common tangents Một đường dẫn nằm bên trong đường dẫn kia, nên chúng không có tiếp tuyến chung @msg The paths overlap, so they have no internal tangents Các đường dẫn chồng lên nhau, nên chúng không có tiếp tuyến trong @msg One path lies inside the other, so they have no internal tangents Một đường dẫn nằm bên trong đường dẫn kia, nên chúng không có tiếp tuyến trong +@msg The point lies inside the path, so it has no tangents Điểm nằm bên trong đường dẫn, nên nó không có tiếp tuyến # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths Mở rộng nét đứt thành đường dẫn @msg select paths with dashed strokes to expand chọn các đường dẫn có nét đứt để mở rộng diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index c6696a9ec6..23136fcc70 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -7463,6 +7463,7 @@ breakText Glyphs 字形 @msg One path lies inside the other, so they have no common tangents 一条路径位于另一条之内,因此它们没有公切线 @msg The paths overlap, so they have no internal tangents 路径相互重叠,因此它们没有内公切线 @msg One path lies inside the other, so they have no internal tangents 一条路径位于另一条之内,因此它们没有内公切线 +@msg The point lies inside the path, so it has no tangents 该点位于路径之内,因此没有切线 # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths 将短划线扩展为路径 @msg select paths with dashed strokes to expand 请选择要扩展的虚线描边路径 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 1480422931..fd1c33518e 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -7272,6 +7272,7 @@ breakText Glyphs 字符 @msg One path lies inside the other, so they have no common tangents 一條路徑位於另一條之內,因此它們沒有公切線 @msg The paths overlap, so they have no internal tangents 路徑互相重疊,因此它們沒有內公切線 @msg One path lies inside the other, so they have no internal tangents 一條路徑位於另一條之內,因此它們沒有內公切線 +@msg The point lies inside the path, so it has no tangents 該點位於路徑之內,因此沒有切線 # Path Precision Tools add-on: Expand Dashes into Paths. Expand Dashes into Paths 將短破折號展開為路徑 @msg select paths with dashed strokes to expand 請選取要展開的虛線筆畫路徑 diff --git a/docs/mcp.md b/docs/mcp.md index 4c1b661f42..7589d2ff1e 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -12723,16 +12723,22 @@ Commands: where it touches the upper one; where a straight side of a path lies along the line, the line covers the whole side. An ellipse drawn with the Ellipse tool, then moved, turned or scaled, is measured as an exact ellipse. Any other path must be closed, have one outline, bend the same way all around and have at most 10,000 segments; an open - path, a path that bends inward, a path without area, a group, a compound path or type is refused, and so are two - paths whose outlines are the same to within the touching tolerance given below. Two separate paths have two - external and two internal tangents. Overlapping paths have external tangents only. A path inside the other has - none. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point - where they touch and as long as the narrower path is wide along it. Paths that meet at a corner or along a shared - stretch of outline get one such line, at the middle of the directions that touch both. Paths count as touching when - the gap between them is less than the tolerance, a billionth of the larger of their sizes and the distance between - their centers. The lines are stroked with the current stroke color and weight (black when the stroke is None), have - no fill, go directly above the upper of the two paths and are selected; one undo step. When there is no tangent of - the kind asked for, nothing changes, and the result's `warning` says why. Common Tangents… + path, a path that bends inward, a path without area (other than a point, described below), a group, a compound + path or type is refused, and so are two paths whose outlines are the same to within the touching tolerance given + below. Two separate paths have two external and two internal tangents. Overlapping paths have external tangents + only. A path inside the other has none. Paths that touch, from outside or from inside, share one tangent there + instead: a line centered on the point where they touch and as long as the narrower path is wide along it. Paths + that meet at a corner or along a shared stretch of outline get one such line, at the middle of the directions that + touch both. Paths count as touching when the gap between them is less than the tolerance, a billionth of the larger + of their sizes and the distance between their centers. One of the two may be a point instead, a path of one + anchor: the lines then run from the point to where they touch the path, two when the point lies outside it (one + that lies along a straight side covers the whole side), one when the point lies on its outline (centered on the + point and as long as the path is wide along it, or the whole straight side the point lies on), and none when it + lies inside. Every `tangents` value gives the same lines, counted in `internal` when `tangents` is `internal` and + in `external` otherwise; the centerline runs from the point to the path's center. Two points are refused with + "select two closed paths". The lines are stroked with the current stroke color and weight (black when the stroke + is None), have no fill, go directly above the upper of the two paths and are selected; one undo step. When there + is no tangent of the kind asked for, nothing changes, and the result's `warning` says why. Common Tangents… opens a dialog (Tangents, Centerline) with Preview. → `{ids, external, internal, centerline, warning?}` (`centerline`: the centerline's id, or null). diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index ef83de54ad..a0ae1bcc7e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2645,7 +2645,7 @@ A VectorCraft addition, so no area score moves. Object › Plug-ins › Cutting ## Path Precision Tools add-on: Common Tangents (2026-11-15) -A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Common Tangents… (`addon.pathtools.commonTangents`) adds the common tangent lines of two convex closed paths ([tangent lines to circles](https://en.wikipedia.org/wiki/Tangent_lines_to_circles)) as separate open paths: external, internal or all, with the line joining the two centers if asked. The rest is VectorCraft's own: an ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse, and any other path must be closed, have one outline and bend the same way all around. Each line runs between the points where it touches the two paths. Separate paths have four tangents, overlapping paths only external ones (two for ellipses), and a path inside the other has none, in which case nothing changes and a message says why. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it. The lines take the current stroke and no fill; one undo step. The dialog has Preview. Tests: `addons::pathtools::tangents::tests` in `vectorcraft-pathops` (circles against the closed form, turned ellipses against a brute-force scan, nested, overlapping and touching circles, a convex Bézier path, flat sides, squares meeting at a corner, a curve touched beside an anchor, refused outlines), `cmd::addons::pathtools::tangents::tests` in `vectorcraft-engine`, `common_tangents_previews_cancels_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on. +A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Common Tangents… (`addon.pathtools.commonTangents`) adds the common tangent lines of two convex closed paths ([tangent lines to circles](https://en.wikipedia.org/wiki/Tangent_lines_to_circles)) as separate open paths: external, internal or all, with the line joining the two centers if asked. The rest is VectorCraft's own: an ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse, and any other path must be closed, have one outline and bend the same way all around. Each line runs between the points where it touches the two paths. Separate paths have four tangents, overlapping paths only external ones (two for ellipses), and a path inside the other has none, in which case nothing changes and a message says why. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it. Since 2026-11-18 one of the two may be a point (a path of one anchor): the lines run from the point to where they touch the path, two from a point outside it, one at a point on its outline (centered on the point, or covering the straight side it lies on), and none from a point inside, with a message; the centerline runs from the point to the path's center. The lines take the current stroke and no fill; one undo step. The dialog has Preview. Tests: `addons::pathtools::tangents::tests` in `vectorcraft-pathops` (circles against the closed form, turned ellipses against a brute-force scan, nested, overlapping and touching circles, a convex Bézier path, flat sides, squares meeting at a corner, a curve touched beside an anchor, a point outside a turned ellipse, on a circle, inside it, beside a square and at its corner, refused outlines), `cmd::addons::pathtools::tangents::tests` in `vectorcraft-engine`, `common_tangents_previews_cancels_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on. ## Path Precision Tools add-on: Divide into Dashes (2026-11-01) From 060eaf11b615163a1ae9d0f1eebacbb96d603275 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 18:12:30 -0800 Subject: [PATCH 100/158] i18n: Polish Artboard edge button tooltip calls the art kompozycja MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Alt-click tooltip said "wraz z grafiką" for the artboard's art; the Polish catalog's term for artwork is kompozycja. --- crates/ui-egui/src/i18n/pl.tsv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 1c0e128892..f71863dc67 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4219,7 +4219,7 @@ axis Both Obie Show Pokaż Copy Width Point Kopiuj punkt szerokości Duplicate Artboard Powiel obszar kompozycji - Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Kliknij, aby dodać obszar kompozycji po tej stronie, kliknij z Alt, aby powielić ten obszar kompozycji wraz z grafiką + Click to add an artboard on this side; Alt-click to duplicate this artboard with its art Kliknij, aby dodać obszar kompozycji po tej stronie, kliknij z Alt, aby powielić ten obszar kompozycji wraz z kompozycją Click to add an artboard on this side Kliknij, aby dodać obszar kompozycji po tej stronie Area / Path Type Tekst akapitowy / na ścieżce Decrease Font Size Zmniejsz rozmiar czcionki From 18cf1d7a93d2440fde01bbe2dd39e04b674cba92 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 18:13:58 -0800 Subject: [PATCH 101/158] Hide Bristle tip after post-commit selection --- crates/tools/src/draw2/gesture.rs | 8 ++++++++ crates/tools/src/draw2/gesture/tests.rs | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/crates/tools/src/draw2/gesture.rs b/crates/tools/src/draw2/gesture.rs index 64894379f7..d420e87475 100644 --- a/crates/tools/src/draw2/gesture.rs +++ b/crates/tools/src/draw2/gesture.rs @@ -200,6 +200,9 @@ pub struct GestureTool { /// Where the Blob Brush's or the Eraser's tip outline shows: the pointer over the canvas, /// unless Cmd/Ctrl lends a selection tool or Alt the Smooth tool. tip_at: Option, + /// Alt as it was at the last pointer event; the release can select a new path after the tool + /// returns, so the Bristle tip checks the current selection when overlays are drawn. + tip_alt: bool, /// The last rotation-capable pen over the Paintbrush's Bristle tip; a mouse or a pen without /// barrel rotation has no tip annotator. bristle_pen: Option<(PenPose, f64)>, @@ -902,6 +905,7 @@ impl GestureTool { snap: DrawSnap::default(), pressed: Point::ZERO, tip_at: None, + tip_alt: false, bristle_pen: None, light: false, bearing: None, @@ -1096,6 +1100,7 @@ impl GestureTool { if self.varies_size() { self.tip_at = (!ev.mods.cmd && !self.blob_alt_smooths(ev.mods)).then_some(ev.pos); } else if self.id == "paintbrush" { + self.tip_alt = ev.mods.alt; self.bristle_pen = ev.pen.filter(|pen| pen.rotation.is_some()).map(|pen| (pen, if ev.kind == PointerKind::Move { 0.5 } else { f64::from(ev.pressure) })); let borrows_smooth = !self.active && ev.mods.alt && has_selected_smooth_path(cx); @@ -1110,6 +1115,9 @@ impl GestureTool { fn tip_outline(&self, cx: &ToolContext) -> Vec { let Some(at) = self.tip_at.filter(|_| !self.smoothing && !cx.precise_cursors) else { return vec![] }; if self.id == "paintbrush" { + if !self.active && self.tip_alt && has_selected_smooth_path(cx) { + return vec![]; + } let Some((pose, pressure)) = self.bristle_pen else { return vec![] }; let Some(name) = vectorcraft_brush::current(cx.doc) else { return vec![] }; let Some(brush) = vectorcraft_brush::find(cx.doc, &name) else { return vec![] }; diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index 871fab304a..9fe8f24d51 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -3110,6 +3110,19 @@ fn bristle_tip_annotator_follows_a_rotation_capable_pen() { tool.pointer(&selected_view, &alt_stroke); assert_eq!(tool.cursor(&selected_view, alt_stroke.pos, alt_stroke.mods), Cursor::Smooth); assert!(bounds(&tool, &selected_view).is_none(), "Alt release borrows Smooth without a stale tip"); + // A completed stroke can select its new path after `pointer` returns its actions. The overlay + // must use that current selection even without a further pointer move. + let mut newly_selected = GestureTool::new("paintbrush"); + let mut new_stroke = light; + newly_selected.pointer(&view, &new_stroke); + new_stroke.kind = PointerKind::Drag; + new_stroke.mods.alt = true; + newly_selected.pointer(&view, &new_stroke); + new_stroke.kind = PointerKind::Up; + newly_selected.pointer(&view, &new_stroke); + assert!(bounds(&newly_selected, &view).is_some(), "no selected path borrows Smooth yet"); + assert_eq!(newly_selected.cursor(&selected_view, new_stroke.pos, new_stroke.mods), Cursor::Smooth); + assert!(bounds(&newly_selected, &selected_view).is_none(), "post-commit selection also hides the tip"); let precise = ToolContext { precise_cursors: true, ..cx(&d, &s, &p) }; assert!(bounds(&tool, &precise).is_none()); tool.pointer(&view, &at(Some(0.0)).with_mods(Mods { cmd: true, ..Default::default() })); From 958b5645f385efe28c0e25bfcf9a68ad6caa0192 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 18:11:11 -0800 Subject: [PATCH 102/158] Save PDF: a link button keeps the four bleed values the same Marks and Bleeds in the Save PDF dialog and the PDF preset editor gets a link button beside Top, Bottom, Left and Right. While it is on, editing one value sets all four; turning it on gives every side the top value. It opens on when the four values are equal, and choosing a preset or Reset sets it again from that preset's values. With Use Document Bleed Settings on, the button is grayed out and the custom values stay as they were. The link is not an export option or a preset setting; ui.dialog.set sets it as __bleedLinked and refuses anything other than true or false. --- crates/ui-egui/src/dialogs.rs | 14 +- crates/ui-egui/src/dialogs/save_pdf.rs | 109 ++++++++++-- crates/ui-egui/src/dialogs/save_pdf/tests.rs | 171 +++++++++++++++++++ docs/control-protocol.md | 4 +- docs/target-app-parity.md | 1 + 5 files changed, 277 insertions(+), 22 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 9e54eb12f6..f2c72aa852 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -537,10 +537,10 @@ fn hidden_controls(d: &Dialog) -> &'static [&'static str] { Some(DialogKind::Preferences) => &["__category", "__search", "__smartGuides", "__snapToGrid", "__taskBar"], // The section shown, the sheet the preview shows and the preset name being typed. Some(DialogKind::Print | DialogKind::PrintPreset) => &["__savePresetAs", "__section", "__sheet"], - // The section shown, All or a range of artboards, the two password checkboxes and the - // preset name being typed. + // The section shown, All or a range of artboards, the bleed link, the two password + // checkboxes and the preset name being typed. Some(DialogKind::SavePdf | DialogKind::PdfPreset) => { - &["__allArtboards", "__requireOpenPassword", "__restrictPermissions", "__savePresetAs", "__section"] + &["__allArtboards", "__bleedLinked", "__requireOpenPassword", "__restrictPermissions", "__savePresetAs", "__section"] } // The selected rows and Randomize's seed. Some(DialogKind::Recolor) => &["__seed", "__sel"], @@ -658,8 +658,9 @@ pub(crate) fn parent(d: &Dialog) -> Option { /// `ui.dialog.set` changed `field` of the open dialog from `old`: a choice that sets other fields /// sets them as choosing it in the dialog does (Export for Screens' `exportPreset`), a change /// to Export for Screens' sub-folder controls ends an applied preset's item folders, as it does in -/// the dialog, and Transform Each's Relative / Absolute keeps the Scale fields' size. A value -/// Composite Fonts' Show Sample can't take is refused. +/// the dialog, and Transform Each's Relative / Absolute keeps the Scale fields' size. Save PDF's +/// bleed link links the bleed as its button does. A value Composite Fonts' Show Sample or Save +/// PDF's bleed link can't take is refused. pub(crate) fn field_set(app: &mut VectorcraftApp, field: &str, old: Option<&Value>) -> Result<(), String> { if app.ui.dialog.as_ref().is_some_and(|d| d.kind == transform_each::KIND) { transform_each::field_set(app, field, old); @@ -668,6 +669,9 @@ pub(crate) fn field_set(app: &mut VectorcraftApp, field: &str, old: Option<&Valu if let Some(d) = app.ui.dialog.as_ref().filter(|d| d.kind == composite_fonts::KIND) { return composite_fonts::field_set(d, field); } + if let Some(d) = app.ui.dialog.as_mut().filter(|d| d.kind == save_pdf::KIND || d.kind == save_pdf::PRESET_KIND) { + return save_pdf::field_set(d, field, old); + } let Some(d) = app.ui.dialog.as_mut().filter(|d| d.kind == export_for_screens::KIND) else { return Ok(()) }; match field { "exportPreset" => export_for_screens::preset_set(app), diff --git a/crates/ui-egui/src/dialogs/save_pdf.rs b/crates/ui-egui/src/dialogs/save_pdf.rs index af047a4cc2..bac2d72d7e 100644 --- a/crates/ui-egui/src/dialogs/save_pdf.rs +++ b/crates/ui-egui/src/dialogs/save_pdf.rs @@ -522,10 +522,12 @@ fn apply_preset(app: &mut VectorcraftApp, d: &mut Dialog, name: &str) { const OPTION_FLAGS: [&str; 2] = ["__requireOpenPassword", "__restrictPermissions"]; /// Replace every option with `settings` (from [`settings_fields`]), the password checkboxes -/// included. The preset, the artboard choice, the path and the other UI-only fields (the section, -/// the Save Preset name) stay. +/// included, and let the bleed link follow the new values. The preset, the artboard choice, the +/// path and the other UI-only fields (the section, the Save Preset name) stay. fn replace_settings(d: &mut Dialog, settings: Map) { - d.fields.retain(|k, _| matches!(k.as_str(), "preset" | "range" | "path") || (k.starts_with("__") && !OPTION_FLAGS.contains(&k.as_str()))); + d.fields.retain(|k, _| { + matches!(k.as_str(), "preset" | "range" | "path") || (k.starts_with("__") && !OPTION_FLAGS.contains(&k.as_str()) && k != BLEED_LINKED) + }); d.fields.extend(settings); } @@ -656,25 +658,102 @@ pub(super) fn marks_and_bleeds(app: &VectorcraftApp, ui: &mut egui::Ui, d: &mut flag(ui, d, "bleed.useDocument", tl!("Use document bleed settings"), true); // With the document's bleed the fields show it (Document Setup's `[top, bottom, left, right]`). let document = (get(d, "bleed.useDocument").as_bool() == Some(true)).then(|| app.session.active().map_or([0.0; 4], |s| s.doc.setup.bleed)); - egui::Grid::new("pdf-bleed").num_columns(4).spacing([10.0, 6.0]).show(ui, |ui| { - for pair in [ - [(0, "bleed.top", tl!("Top:")), (1, "bleed.bottom", tl!("Bottom:"))], - [(2, "bleed.left", tl!("Left:")), (3, "bleed.right", tl!("Right:"))], - ] { - for (i, p, label) in pair { - ui.label(label); - match document { - Some(b) => { - ui.add_enabled_ui(false, |ui| widgets::num_field(ui, p, b.get(i).copied(), unit, 80.0)); + // Save PDF and the PDF preset editor link the four sides; Print's Marks and Bleed doesn't. + let pdf = d.kind == KIND || d.kind == PRESET_KIND; + ui.horizontal(|ui| { + egui::Grid::new("pdf-bleed").num_columns(4).spacing([10.0, 6.0]).show(ui, |ui| { + for pair in [ + [(0, "bleed.top", tl!("Top:")), (1, "bleed.bottom", tl!("Bottom:"))], + [(2, "bleed.left", tl!("Left:")), (3, "bleed.right", tl!("Right:"))], + ] { + for (i, p, label) in pair { + ui.label(label); + match document { + Some(b) => { + ui.add_enabled_ui(false, |ui| widgets::num_field(ui, p, b.get(i).copied(), unit, 80.0)); + } + None if pdf => { + if let Some(x) = widgets::num_field(ui, p, get(d, p).as_f64(), unit, 80.0) { + edit_bleed(d, i, x); + } + } + None => length(ui, d, p, unit, true), } - None => length(ui, d, p, unit, true), } + ui.end_row(); + } + }); + if pdf { + let linked = bleed_linked(d); + let tip = if linked { tl!("Make the bleed values differ") } else { tl!("Make all bleed settings the same") }; + // With the document's bleed the link is grayed out and keeps its state for the custom values. + let clicked = ui + .add_enabled_ui(document.is_none(), |ui| widgets::icon_button(ui, if linked { "link" } else { "link-2-off" }, tip, linked, 24.0)) + .inner + .clicked(); + if clicked { + link_bleed(d, !linked); } - ui.end_row(); } }); } +/// The custom bleed's sides in Save PDF and the PDF preset editor, `[top, bottom, left, right]`. +const BLEED_SIDES: [&str; 4] = ["bleed.top", "bleed.bottom", "bleed.left", "bleed.right"]; +/// The field holding whether the link keeps the four custom bleed values the same. Without it, +/// the sides are linked when they are equal (a preset's, or ones `ui.dialog.set` set). +const BLEED_LINKED: &str = "__bleedLinked"; + +/// Whether the custom bleed's sides are linked. +fn bleed_linked(d: &Dialog) -> bool { + d.fields.get(BLEED_LINKED).and_then(Value::as_bool).unwrap_or_else(|| { + let top = get(d, BLEED_SIDES[0]).as_f64(); + BLEED_SIDES[1..].iter().all(|p| get(d, p).as_f64() == top) + }) +} + +/// Link (every side takes the top's value) or unlink (the sides keep their values) the bleed. +fn link_bleed(d: &mut Dialog, on: bool) { + d.fields.insert(BLEED_LINKED.into(), json!(on)); + if on { + let top = get(d, BLEED_SIDES[0]).as_f64().unwrap_or(0.0); + for p in &BLEED_SIDES[1..] { + set(d, p, json!(top)); + } + } +} + +/// Side `side` of the custom bleed was edited to `value`: linked, every side takes it. +fn edit_bleed(d: &mut Dialog, side: usize, value: f64) { + if bleed_linked(d) { + for p in BLEED_SIDES { + set(d, p, json!(value)); + } + } else if let Some(p) = BLEED_SIDES.get(side) { + set(d, p, json!(value)); + } +} + +/// `ui.dialog.set` set `field` of Save PDF or the PDF preset editor: `__bleedLinked` links or +/// unlinks the bleed as its button does, and must be true or false; a new `bleed` drops the link's +/// state, so the link follows the values set. +pub(super) fn field_set(d: &mut Dialog, field: &str, old: Option<&Value>) -> Result<(), String> { + match field { + BLEED_LINKED => match d.fields.get(BLEED_LINKED).cloned() { + Some(Value::Bool(on)) => { + link_bleed(d, on); + Ok(()) + } + v => Err(format!("{BLEED_LINKED} must be true or false, not {}", v.unwrap_or(Value::Null))), + }, + "bleed" if d.fields.get("bleed") != old => { + d.fields.remove(BLEED_LINKED); + Ok(()) + } + _ => Ok(()), + } +} + /// A dropdown of names such as colour profiles or flattener presets (`names`, the first one /// standing for "" at `path`), showing the name at `path` (one that isn't among them too). The /// first `builtins` entries are ours (translated); the others (profiles, saved presets) are names. diff --git a/crates/ui-egui/src/dialogs/save_pdf/tests.rs b/crates/ui-egui/src/dialogs/save_pdf/tests.rs index 91442f111c..05b1b101d4 100644 --- a/crates/ui-egui/src/dialogs/save_pdf/tests.rs +++ b/crates/ui-egui/src/dialogs/save_pdf/tests.rs @@ -443,6 +443,177 @@ fn marks_and_bleeds_reach_the_pdf() { assert!(ellipse, "the non-printing layer is included"); } +/// The four custom bleed values, `[top, bottom, left, right]`. +fn bleed_of(d: &Dialog) -> [f64; 4] { + BLEED_SIDES.map(|p| get(d, p).as_f64().unwrap_or(f64::NAN)) +} + +/// Headless frames of the dialog layer with an accessibility tree, as a 1280 × 900 window. +struct LinkFrames(egui::Context); + +impl LinkFrames { + fn new() -> Self { + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + theme::install_fonts(&ctx); + Self(ctx) + } + + fn run(&self, app: &mut VectorcraftApp, events: Vec) -> egui::FullOutput { + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1280.0, 900.0)); + let input = egui::RawInput { events, screen_rect: Some(screen), ..Default::default() }; + let mut out = self.0.run_ui(input, |ui| super::super::show(app, ui.ctx())); + out.textures_delta.clear(); + out + } + + /// The bleed link's button once the dialog has settled: its name, whether it shows pressed, + /// whether it is grayed out, and its center. + fn link(&self, app: &mut VectorcraftApp) -> (String, bool, bool, egui::Pos2) { + self.run(app, vec![]); + let out = self.run(app, vec![]); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + let names = ["Make the bleed values differ", "Make all bleed settings the same"]; + let mut found = nodes.iter().filter(|(_, n)| n.role() == egui::accesskit::Role::Button && n.label().is_some_and(|l| names.contains(&l))); + let (_, n) = found.next().expect("a bleed link button"); + assert!(found.next().is_none(), "one bleed link button"); + let b = n.bounds().expect("bounds"); + let pressed = n.toggled() == Some(egui::accesskit::Toggled::True) || n.is_selected() == Some(true); + let center = egui::pos2((b.x0 + b.x1) as f32 * 0.5, (b.y0 + b.y1) as f32 * 0.5); + (n.label().unwrap_or_default().to_string(), pressed, n.is_disabled(), center) + } + + fn click(&self, app: &mut VectorcraftApp, at: egui::Pos2) { + let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + self.run(app, vec![egui::Event::PointerMoved(at), press(true)]); + self.run(app, vec![press(false)]); + } +} + +/// The link button beside the custom bleed values: the built-in presets' equal sides open linked, +/// an edit to one side sets all four while linked and only that one while unlinked, and linking +/// again gives every side the top's value. The link isn't an export option, and the linked values +/// reach the PDF's page boxes. +#[test] +fn the_bleed_link_keeps_the_four_sides_the_same() { + let (mut app, written, _) = app(); + app.run("ui.savePdfDialog", json!({"path": "/tmp/bleed.pdf"})).unwrap(); + set_field(&mut app, "__section", json!("Marks and Bleeds")); + let f = LinkFrames::new(); + let (name, pressed, disabled, at) = f.link(&mut app); + assert_eq!((name.as_str(), pressed, disabled), ("Make the bleed values differ", true, false), "equal sides open linked"); + edit_bleed(app.ui.dialog.as_mut().unwrap(), 2, 6.0); + assert_eq!(bleed_of(app.ui.dialog.as_ref().unwrap()), [6.0; 4], "linked: the left value sets all four"); + + f.click(&mut app, at); + let (name, pressed, ..) = f.link(&mut app); + assert_eq!((name.as_str(), pressed), ("Make all bleed settings the same", false), "the click unlinks"); + let d = app.ui.dialog.as_mut().unwrap(); + assert_eq!(d.fields.get(BLEED_LINKED), Some(&json!(false))); + edit_bleed(d, 1, 9.0); + edit_bleed(d, 3, 2.0); + assert_eq!(bleed_of(d), [6.0, 9.0, 6.0, 2.0], "unlinked: each side is its own"); + edit_bleed(d, 0, 4.0); + assert_eq!(bleed_of(d), [4.0, 9.0, 6.0, 2.0]); + + let (.., at) = f.link(&mut app); + f.click(&mut app, at); + let (name, pressed, ..) = f.link(&mut app); + assert_eq!((name.as_str(), pressed), ("Make the bleed values differ", true), "the click links again"); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!(bleed_of(d), [4.0; 4], "linking gives every side the top's value"); + let p = params(d); + assert_eq!(p["bleed"], json!({"useDocument": false, "top": 4.0, "bottom": 4.0, "left": 4.0, "right": 4.0})); + assert!(p.get(BLEED_LINKED).is_none() && preset_params(d).get(BLEED_LINKED).is_none(), "the link is the dialog's own"); + + super::super::confirm(&mut app).unwrap(); + let bytes = &written.borrow()[0].1; + let page = &vectorcraft_pdf::info(bytes, None).unwrap().pages[0]; + let bleed = page.boxes.iter().find(|(b, _)| *b == vectorcraft_pdf::CropTo::Bleed).expect("a bleed box").1; + let trim = page.boxes.iter().find(|(b, _)| *b == vectorcraft_pdf::CropTo::Trim).expect("a trim box").1; + assert_eq!((trim.x0 - bleed.x0, trim.y0 - bleed.y0, bleed.x1 - trim.x1, bleed.y1 - trim.y1), (4.0, 4.0, 4.0, 4.0)); +} + +/// A preset whose four bleed values differ opens unlinked; choosing a preset or Reset sets the link +/// from that preset's values rather than keeping the one shown before. +#[test] +fn presets_and_reset_set_the_bleed_link_from_their_values() { + let (mut app, _, _) = app(); + app.run("pdf.preset.save", json!({"name": "Uneven", "bleed": {"top": 3, "bottom": 5, "left": 3, "right": 3}})).unwrap(); + app.run("ui.savePdfDialog", json!({"preset": "Uneven"})).unwrap(); + let d = app.ui.dialog.as_ref().unwrap(); + assert!(!bleed_linked(d), "unequal sides open unlinked"); + assert_eq!(bleed_of(d), [3.0, 5.0, 3.0, 3.0], "opening leaves the values as they are"); + + let mut d = d.clone(); + link_bleed(&mut d, true); + apply_preset(&mut app, &mut d, "Uneven"); + assert!(!bleed_linked(&d) && bleed_of(&d) == [3.0, 5.0, 3.0, 3.0], "choosing the preset takes its values and its link"); + apply_preset(&mut app, &mut d, pdf::DEFAULT_PRESET); + assert!(bleed_linked(&d), "the default preset's sides are equal"); + link_bleed(&mut d, false); + app.ui.dialog = Some(d); + app.run("ui.dialogReset", json!({})).unwrap(); + assert!(bleed_linked(app.ui.dialog.as_ref().unwrap()), "Reset sets the link from the preset's values"); + + // The preset editor has the same link. + open_preset(&mut app, &json!({"name": "Uneven"})).unwrap(); + set_field(&mut app, "__section", json!("Marks and Bleeds")); + let f = LinkFrames::new(); + let (name, pressed, disabled, at) = f.link(&mut app); + assert_eq!((name.as_str(), pressed, disabled), ("Make all bleed settings the same", false, false)); + f.click(&mut app, at); + assert_eq!(bleed_of(app.ui.dialog.as_ref().unwrap()), [3.0; 4]); +} + +/// With Use Document Bleed Settings on, the fields show the document's bleed and the link is +/// grayed out; the custom values and the link stay as they were for when it is turned off. +#[test] +fn the_document_bleed_grays_the_link_and_keeps_the_custom_values() { + let (mut app, _, _) = app(); + app.run("document.setup", json!({"bleed": 9})).unwrap(); + app.run("ui.savePdfDialog", json!({"bleed": {"top": 3, "bottom": 5, "left": 3, "right": 3}})).unwrap(); + set_field(&mut app, "__section", json!("Marks and Bleeds")); + set_field(&mut app, "bleed.useDocument", json!(true)); + let f = LinkFrames::new(); + let (name, pressed, disabled, at) = f.link(&mut app); + assert_eq!((name.as_str(), pressed, disabled), ("Make all bleed settings the same", false, true)); + f.click(&mut app, at); + let d = app.ui.dialog.as_ref().unwrap(); + assert!(!d.fields.contains_key(BLEED_LINKED), "a grayed-out link does not change"); + assert_eq!(bleed_of(d), [3.0, 5.0, 3.0, 3.0]); + set_field(&mut app, "bleed.useDocument", json!(false)); + let (name, _, disabled, _) = f.link(&mut app); + assert_eq!((name.as_str(), disabled), ("Make all bleed settings the same", false)); +} + +/// `ui.dialog.set` can set the link (`__bleedLinked`) as its button does, refuses a value other +/// than true or false, and a new `bleed` lets the link follow its values. +#[test] +fn ui_dialog_set_links_the_bleed() { + let (mut app, _, _) = app(); + app.run("ui.savePdfDialog", json!({"bleed": {"top": 3, "bottom": 5, "left": 3, "right": 3}})).unwrap(); + let set = |app: &mut VectorcraftApp, field: &str, value: Value| { + let d = app.ui.dialog.as_mut().unwrap(); + assert!(super::super::accepts_field(d, field), "{field}"); + let old = d.fields.get(field).cloned(); + super::super::set_field(d, field.into(), value); + super::super::field_set(app, field, old.as_ref()) + }; + set(&mut app, BLEED_LINKED, json!(true)).unwrap(); + assert_eq!(bleed_of(app.ui.dialog.as_ref().unwrap()), [3.0; 4], "linking gives every side the top's value"); + for bad in [json!("yes"), json!(1), Value::Null] { + let e = set(&mut app, BLEED_LINKED, bad.clone()).unwrap_err(); + assert!(e.contains("__bleedLinked must be true or false"), "{bad}: {e}"); + } + set(&mut app, BLEED_LINKED, json!(false)).unwrap(); + set(&mut app, "bleed", json!({"top": 1, "bottom": 1, "left": 1, "right": 1})).unwrap(); + let d = app.ui.dialog.as_ref().unwrap(); + assert!(!d.fields.contains_key(BLEED_LINKED) && bleed_linked(d), "equal values set are linked"); + set(&mut app, "bleed", json!({"top": 1, "bottom": 2, "left": 1, "right": 1})).unwrap(); + assert!(!bleed_linked(app.ui.dialog.as_ref().unwrap()), "unequal values set are unlinked"); +} + #[test] fn option_labels_read_well() { assert_eq!(option_label("compression.color.abovePpi"), "Compression › Color › Above Ppi"); diff --git a/docs/control-protocol.md b/docs/control-protocol.md index adac088a13..dbfb47a35a 100644 --- a/docs/control-protocol.md +++ b/docs/control-protocol.md @@ -102,7 +102,7 @@ the two can still win that race. | `ui.click` / `ui.drag` | `{x, y, button?, count?, shift?, alt?, ctrl?, cmd?}` / `{x, y, toX, toY, steps?, count?, button?, shift?, alt?, ctrl?, cmd?}` | egui pointer input; see synthetic input budgets above | | `ui.wheel` | `{x, y, dy?, dx?, unit?: "line"\|"point", shift?, alt?, cmd?}` | a mouse wheel turn over screen point (x, y): `dy` notches up (+) or down, `dx` sideways. Over the canvas the wheel scrolls, Cmd-wheel (Ctrl on Windows and Linux) scrolls sideways and Alt-wheel (Option on the Mac) zooms about the pointer (with the `ctrlWheelScrollsSideways` preference off, Cmd-wheel zooms too); with the `zoomWithMouseWheel` preference the wheel and Alt-wheel zoom about the pointer, Shift-wheel scrolls up and down and Cmd-wheel (Ctrl on Windows and Linux) sideways. Over a focused numeric field (click it first) each notch steps its value as Up/Down do (Shift: ten, Cmd/Ctrl: a tenth) and the panel stays put; over anything else in a panel the wheel scrolls it. Over the canvas, the wheel preferences in `docs/mcp.md` change what these keys do | | `ui.set` | `{brightness?, panel?, rulers?, outline?, grid?, smartGuides?, boundingBox?, controlBar?, imageTracePreview?}` | `outline`: View › Outline for the active document only (each document has its own, a document opens in Preview, and `ui.inspect` shows it as `view.outline`; an error without a document). `imageTracePreview`: the Image Trace panel's Preview (`ui.inspect` shows it as `ui.image_trace_preview`) | -| `ui.dialog.set` / `.confirm` / `.cancel` | `{field, value, action?}` or `{fields: [{field, value}…], action?}` | fill and submit the open dialog. `ui.dialog.set` takes the fields the dialog has (`ui.inspect`) other than its `__` fields, the `__` fields that are controls of the dialog (such as `__section` and `__allArtboards` in Save PDF, `__constrain` in Transform Each and the shape dialogs, and `__search` and `__category` in Preferences; Save PDF's and Print's `__savePresetAs`, the preset name, only while Save Preset… asks for it, since OK then saves a preset), `discard` on a dialog with a discard button, `preview` on one with a live preview, the fields that the dialog reads but adds only when a control changes (such as `searchFolder`, or `copy` in the Transform dialogs), and the fields it passes to the command it runs: every parameter of the `command` dialog's command (`ui.paramDialog`), and the `textureImage` that Load Texture… sets in the Glass, Texturizer and Rough Pastels effects; any other field is an error that lists the dialog's fields, and the dialog stays as it was. Any other `__` field, held or not, holds what the dialog's OK acts on (such as the `__command` and `__params` of a `confirm` or `command` dialog) or the dialog's own state: setting it is the error "the `` dialog cannot set protected field ``", and the dialog stays as it was. `fields` sets the list (at most 256 items) in order (a missing `value` is `null`) and checks every item first: when one is refused, the call is an error and no field changes. `action: "confirm"` or `"cancel"` on `ui.dialog.set` then confirms or cancels the same dialog in the same request, as `ui.dialog.confirm` and `ui.dialog.cancel` do, and the reply is `{dialog, result}`: the dialog after the fields were set and the reply to confirm (`null` for cancel); any other `action` is an error and no field changes | +| `ui.dialog.set` / `.confirm` / `.cancel` | `{field, value, action?}` or `{fields: [{field, value}…], action?}` | fill and submit the open dialog. `ui.dialog.set` takes the fields the dialog has (`ui.inspect`) other than its `__` fields, the `__` fields that are controls of the dialog (such as `__section`, `__allArtboards` and `__bleedLinked` in Save PDF, `__constrain` in Transform Each and the shape dialogs, and `__search` and `__category` in Preferences; Save PDF's and Print's `__savePresetAs`, the preset name, only while Save Preset… asks for it, since OK then saves a preset), `discard` on a dialog with a discard button, `preview` on one with a live preview, the fields that the dialog reads but adds only when a control changes (such as `searchFolder`, or `copy` in the Transform dialogs), and the fields it passes to the command it runs: every parameter of the `command` dialog's command (`ui.paramDialog`), and the `textureImage` that Load Texture… sets in the Glass, Texturizer and Rough Pastels effects; any other field is an error that lists the dialog's fields, and the dialog stays as it was. Any other `__` field, held or not, holds what the dialog's OK acts on (such as the `__command` and `__params` of a `confirm` or `command` dialog) or the dialog's own state: setting it is the error "the `` dialog cannot set protected field ``", and the dialog stays as it was. `fields` sets the list (at most 256 items) in order (a missing `value` is `null`) and checks every item first: when one is refused, the call is an error and no field changes. `action: "confirm"` or `"cancel"` on `ui.dialog.set` then confirms or cancels the same dialog in the same request, as `ui.dialog.confirm` and `ui.dialog.cancel` do, and the reply is `{dialog, result}`: the dialog after the fields were set and the reply to confirm (`null` for cancel); any other `action` is an error and no field changes | | `ui.screenshot` | `{path?, data?}` | capture the window (PNG), written to `path`; `data: true` sends it back as `pngBase64` too. The inline PNG is capped at 64 MiB: with a `path` the file is still written and `pngBase64` is omitted when the image is larger, while a path-less `data: true` request fails if either the raw RGBA image or the encoded PNG exceeds the cap. Needs a presented frame: with the screen locked or the window minimized/covered it fails after ~8 s with an explanatory error | | `ui.render` | `{path?, scale?, artboard?, data?, traceViews?}` | render an artboard headlessly (PNG with the pixels of `app.export {format: "png", background: "white"}` at the same scale; `artboard`: its 0-based index, default the first; `traceViews: true`: Image Trace objects draw in their View, as on the canvas, instead of their tracing result): written to `path`, else (or with `data: true` as well) sent back as `pngBase64` | | `ui.resize` | `{width?, height?}` | request the window's inner size; omitted or null `width` and `height` default to 1440 and 900. Returns `null` | @@ -110,7 +110,7 @@ the two can still win that race. | `app.open` / `app.save` / `app.export` / `app.quit` | `{path, importer?, params?}` / `{path?}` / `{path?, format?, artboard?, range?, scale?, …}` | `app.open` reads every format `document.open` reads (see `document.formats`) and returns its result (`{index, title, format, warnings, …}`; `warnings` say what didn't come in as it was, such as an EPS shown as its preview image and why its PostScript couldn't be read), or null when a dialog asks first or a library loads. The status bar (`ui.inspect` → `ui.status`), after a line about the document's linked files when there is one (Missing linked files below), counts the `warnings` and names the first that says reading the file left something out (the notes that make Save ask before writing over it), else the first; with several, hovering it lists them in that order, as many as fit in the window (at most 30), then how many more. After `app.save`, and `app.export` with a `path`, the status bar counts the reply's `warnings` and names the first, and with several, hovering it lists them in the reply's order (a save's notes start with what the format loses). With `importer` (an importer plug-in's format id, `plugin.`) it runs `file.openWith`: the file opens with that importer, also when a built-in format reads its extension, with the importer's parameters `params` (their defaults when omitted; no dialog asks for them). Without `importer`, `params` go to the importer that opens the file, and a built-in format does not read them. `app.export` encodes through the engine's `document.export` (same options; the document keeps its path) and writes `path` through the host; without `path` it returns `{dataBase64, format, bytes}`, as headless mode does. It refuses a key that no format takes, and an unknown key inside a PDF or EPS option object, before it writes anything (`docs/mcp.md`, Parameter keys). It accepts a key that only another format takes and does not use it: the reply's `warnings` and the status bar name the key ("`quality` was not used: PDF files don't read it"). `app.save` refuses a key that no save format takes, beside the path or in `options`, the same way. `app.quit`, `file.close` and `file.closeAll` first open a `saveChanges` dialog for each modified document (they return `{"pending": "saveChanges"}`): `ui.dialog.confirm` saves, `ui.dialog.set {field: "discard", value: true}` then confirm discards, `ui.dialog.cancel` cancels the whole close or quit | | `app.export` with `useArtboards` | `{path, useArtboards: true, range? \| artboards?, …}` | Export As: PNG, JPEG and WebP write one file per chosen artboard (default all; SVG does so for a `range`), `-.`, and return `{path, files: [path…]}`; a PDF keeps them as pages of `path`. `useArtboards: false` covers the bounds of the visible art. The menu's Export As… is `file.exportAs`: the `exportAs` dialog (`format`, `useArtboards`, `all`, `range`), then a save dialog and the format's options: `pngOptions` / `jpgOptions` / `webpOptions`, `svgOptions`, or `savePdf` for a PDF | | `ui.dialog.*` on `gradientStop` | `{field: "color" \| "opacity" \| "location", value}` | double-clicking a stop on the Gradient tool's annotator opens its popover (fields `index`, `x`, `y`, `tab`); set `color` (hex), `opacity` or `location` (percentages) and `ui.dialog.confirm` to apply them to the selected stop. `gradient.selectStop {index}` picks the stop the annotator, the panels and Delete/←/→ (`ui.key`) act on | -| `engine.execute` `ui.savePdfDialog` | `{path?, preset?, range?, …document.exportPdf options}` | opens the Save PDF dialog (`file.export.pdf` with no params opens it too). Its fields are the `document.exportPdf` options: set `compatibility` with `ui.dialog.set {field: "compatibility", value: "1.5"}`, a whole section with `{field: "compression", value: {…}}`, the artboards with `__allArtboards: false` and `range`, the visible section with `__section` (General, Compression, Marks and Bleeds, Output, Advanced, Security, Summary). `useArtboards: false` opens it for one page of the visible art's bounds, as Export As with Use Artboards off does: the dialog has no Artboards section and its `__artBounds` field is true. `ui.dialog.confirm` writes `path` (else asks for one), returns `{path, bytes, warnings}` and opens the file when `viewAfterSaving` is set. With `useArtboards: false` it writes the page as `app.export` does and returns `{path, warnings}`, or `{background: true, status}` while Background Export writes it | +| `engine.execute` `ui.savePdfDialog` | `{path?, preset?, range?, …document.exportPdf options}` | opens the Save PDF dialog (`file.export.pdf` with no params opens it too). Its fields are the `document.exportPdf` options: set `compatibility` with `ui.dialog.set {field: "compatibility", value: "1.5"}`, a whole section with `{field: "compression", value: {…}}`, the artboards with `__allArtboards: false` and `range`, the visible section with `__section` (General, Compression, Marks and Bleeds, Output, Advanced, Security, Summary), and the bleed link with `__bleedLinked` (true gives every side the top value; any value other than true or false is an error; setting `bleed` turns the link on when its four sides are equal and off when they differ). `useArtboards: false` opens it for one page of the visible art's bounds, as Export As with Use Artboards off does: the dialog has no Artboards section and its `__artBounds` field is true. `ui.dialog.confirm` writes `path` (else asks for one), returns `{path, bytes, warnings}` and opens the file when `viewAfterSaving` is set. With `useArtboards: false` it writes the page as `app.export` does and returns `{path, warnings}`, or `{background: true, status}` while Background Export writes it | | `file.save` / `file.saveAs` / `file.saveCopy` / `file.saveAsTemplate` (via `engine.execute`) | `{path?, format?, options?, svg?}` | Save writes the document's own file in its own format (a document opened from or saved as SVG/PDF saves as that again; the result's `warnings` say what the format loses). With `path` the file is written at once (Save As or a Copy to an SVG path without SVG options first opens SVG Options, below). Without one (never saved, a converted older file, Save As, a Copy, a Template) the app shows a save panel with one file type per save format (`vectorcraft`, `template`, `pdf`, `svg`, `svgz`, `ai`; for a Template, `template` and `ait`), then the format's options: SVG opens the `svgOptions` dialog (below; returns `{"pending": "svgOptions", "path"}`), PDF the `savePdf` dialog (its `__save` field names the save command); `ui.dialog.confirm` finishes the save. A name typed in the panel without the file type's extension gets it, and a name the panel returns with the extension of a format the panel does not list has it replaced (in a native save, `card.png` and `card.ait` are saved as `card.vectorcraft`, and `notes.v2`, whose extension names no format, is saved as `notes.v2.vectorcraft`); when a file of that name exists, which the panel did not ask about, the save (and every export or other write through a save panel) answers `cancelled` and opens a `replaceFile` dialog (fields `message`, `detail`, `path`): `ui.dialog.confirm` writes that file, `ui.dialog.cancel` writes nothing. A save or export that writes other files beside that path (a file per artboard, linked images, image maps) checks them before it writes anything: when any of them exists, it writes nothing and opens a `replaceFiles` dialog (fields `message`, `detail` (each file's name when there are several), `files`, `__command`, `__params`; the reply is `{"pending": "replaceFiles"}`, or comes once a Background Save or Export ends): `ui.dialog.confirm` runs the save or export again and replaces them, `ui.dialog.cancel` writes nothing; a dialog open when a background job asks stays open, and the question follows it. A save does not ask about the files the document's last Save or Save As in this session wrote. On the web a `saveOptions` dialog (fields `path`, `format`) first names the file and picks the format. `file.formatOptions {format?}` reads the options a save would use. `file.revert` opens a `confirm` dialog (`{"pending": "confirm"}`); `ui.dialog.confirm` reloads the saved file in the same tab. Location refusals return `READ_ONLY_LOCATION: ` without a fallback panel for automation; see [Save location errors](#save-location-errors). | | SVG Options (`engine.execute` of `file.export.svg`, `file.saveAs`, `file.saveCopy`) | `{}` / `{path?, svg?: {…}}` | `file.export.svg` without params, and Save As or Save a Copy to an `.svg`/`.svgz` path without SVG options, open the `svgOptions` dialog (`ui.dialog.set` its fields: `styling`, `outlineText`, `images`, `objectIds`, `decimals`, `minify`, `responsive`, `fewerTspans`, `metadata`, `preserveEditing`, `useArtboards`, `allArtboards`, `range`, `showCode`, `profile` (`svg11`/`tiny12`), `encoding` (`utf8`/`utf16`/`latin1`), `embedFonts`; `ui.dialog.confirm` exports or saves and remembers the choices). With `svg: {…}` (the `document.formats` SVG options) they run directly. `app.save {path?, svg?}` takes the same options; a document saved as SVG saves as SVG again with the same options | | `engine.execute` `file.place` | `{paths?}` / `{path \| name+dataBase64, …file.place params}` | with no file, picks files and opens the `place` dialog; with `paths`, opens it for them (fields `files`, `link`, `template`, `replace`; `__replace` says whether Replace applies, `__info` describes each file). `ui.dialog.confirm` places one file centered in the view (or in place of the selected object) and loads the place cursor with several (`file.place.queue`). In the desktop app the dialog reads its files off the UI thread: `__info` is empty until they are read, `ui.dialog.confirm` returns `{background: true, status}`, `ui.inspect` lists the files still being read in `placing`, and the file is placed (or the cursor loaded) once it is read. With a file, it runs `file.place` centered in the view, at once. Files dropped on the window with no document open open. On the web, files dropped on the canvas are placed at the drop point (linked; Shift embeds) and files dropped off it (the tab bar) open, as in Illustrator; desktop drops carry no pointer position, so documents (native, SVG, PDF, `.ai`, EPS, DXF, EMF/WMF) open as tabs of their own and pictures and text are placed in the middle of the view. Swatch libraries and color books (`.vcswatches`, `.gpl`, `.ase`, `.acb`), graphic style libraries (`.vcstyles`), Libraries panel files (`.vclibrary`), presets (`.vcflattener`, `.vcpdfpresets`, `.vcprintpresets`, `.vcperspective`, `.vcexportpresets`), plug-ins (`.wasm`) and shortcut sets (`.kys`, in Import Shortcut Set) open wherever they are dropped, as File › Open opens them. With the cursor loaded (`ui.inspect` → `tool: "place"`, `toolOptions: {count, current, name, names}`), `ui.pointer` clicks and drags place files (in the desktop app each file is read off the UI thread and placed once it is read, and `ui.inspect` lists it in `placing` until then) and `ui.key` ←/→/↑/↓ and Escape cycle and discard them | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index ef83de54ad..b8f63883df 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2009,6 +2009,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur PDF export and `.ai` saves write a page with a side longer than 14,400 pt with a `UserUnit` (PDF 1.6), its longer side divided by 14,400 and rounded up to the next thousandth, so that no side is longer than 14,400 units (ISO 32000-1, Annex C.2); a PDF 1.5 file with such a page is written as PDF 1.6 with PDF 1.5's encryption, PDF/X files and PDF 1.3 and 1.4 files write it in points (in PDF 1.3 and 1.4, a page past 32,767 pt that needs a real number past 32,767 is refused with an error naming it), a page whose short side is 3 pt or longer but would be under 3 units at that `UserUnit` gets a smaller one that keeps the short side at 3 units, and the export's warnings give each such page's size and how it is written (#6382). The Save PDF dialog's "Write pages longer than 200 in at full size in points" (`longPagesInPoints`, on by default; `.ai` saves leave it off) writes such pages in points without a `UserUnit` at every PDF version, in files without a PDF/X or PDF/A standard, so readers that ignore `UserUnit` show them at full size. Export As PDF with Use Artboards off also opens the Save PDF dialog, without its Artboards section, and writes one page of the visible art's bounds with the dialog's options (`document.exportPdf {useArtboards: false}`; `crates/ui-egui/src/dialogs/tests_export.rs`, `crates/engine/src/cmd/fileio/tests_pdf.rs`). While Alt (Option on macOS) is held, the Save PDF dialog's Cancel button reads Reset, which puts every option back to the chosen preset's settings, passwords included, and leaves the dialog open; letting the key go shows Cancel again (`ui.dialogReset`). [The help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=283) says that holding Alt or Option and clicking Reset returns the options to their defaults. Resetting to the chosen preset's settings, and keeping the preset, path, artboard range and section, are VectorCraft's own rules (`crates/ui-egui/src/dialogs/save_pdf/tests.rs`, `crates/ui-egui/src/dialogs/tests.rs`). + The Save PDF dialog and the PDF preset editor have a link button beside the four bleed values in Marks and Bleeds: while it is on, editing one value sets the other three to it. [The help page](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=249) describes this button for the PDF dialog. VectorCraft's own rules: the link opens on when the four values are equal and off when they differ, also after choosing a preset or Reset; turning it on gives every side the top value; turning it off leaves the values as they are; with Use Document Bleed Settings on, the button is grayed out and the custom values and link stay as they were. The link is not a PDF option or a preset setting; `ui.dialog.set` sets it as `__bleedLinked` (`crates/ui-egui/src/dialogs/save_pdf/tests.rs`). `document.exportSelection` run without params (a shortcut) takes the same route after its save panel: a picked PDF opens the Save PDF dialog without its Artboards section, and SVG, the raster formats, EPS, DXF, text and exporter plug-ins with parameters open their options, whose OK writes the selection alone, cropped to it, with the chosen options (`crates/ui-egui/src/dialogs/tests_export_selection.rs`). A `.ai` export with Use Artboards off writes one page of the visible art's bounds without the native document or the editing copy for other apps, with a warning, so the file does not reopen with one artboard in place of the document's; without PDF content it is refused (`crates/engine/src/cmd/fileio/tests_pdfedit.rs`). That page, and an HP-GL plot of the art's bounds, are measured on the art the file draws: non-printing layers the PDF or `.ai` file leaves out do not make it larger, and nor do the non-printing layers, objects at 0% opacity, placed images, clear gradient meshes and unpainted paths a plot leaves out; Export As refuses an HP-GL plot of nothing it draws before the save dialog (`crates/engine/src/cmd/fileio/tests_pdf.rs`, `crates/engine/src/cmd/fileio/tests_hpgl.rs`, `crates/ui-egui/src/dialogs/tests_export.rs`). From 8486bd1892be40019d70fe3792e02ed6ac9dc865 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 18:27:15 -0800 Subject: [PATCH 103/158] Save for Web: pixels of a transparent color that does not fit in a fixed palette stay transparent With transparent pixels and Colors at 256, a custom palette of one opaque color and 255 colors mapped to transparent has no room for the last of those, and its pixels took the nearest entry left, which could be the opaque color. Such pixels now take the transparent entry when their nearest color is one that did not fit. --- crates/engine/src/cmd/webexport.rs | 35 +++++++++++++++++++++++++++- crates/engine/src/tests/webexport.rs | 10 ++++++++ crates/render/src/encode/quantize.rs | 15 ++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/webexport.rs b/crates/engine/src/cmd/webexport.rs index 19907dc084..f5b4164f86 100644 --- a/crates/engine/src/cmd/webexport.rs +++ b/crates/engine/src/cmd/webexport.rs @@ -902,7 +902,9 @@ fn reduced(rgba: &[u8], w: u32, h: u32, s: &WebSettings, o: &PaletteOptions, loc // The colors mapped to transparent all become the one transparent entry, so together they take // one slot, and the opaque colors fill the rest in palette order. When no pixel takes one of // them and no pixel is transparent, that slot goes to the next opaque color instead. - let ix = quantize::quantize_to(rgba, w, h, o, &fixed_palette(&left, &to_clear, s.colors, has_clear, true)); + let kept = fixed_palette(&left, &to_clear, s.colors, has_clear, true); + let mut ix = quantize::quantize_to(rgba, w, h, o, &kept); + clear_dropped(&mut ix, rgba, o, &kept, &left, &to_clear); if !has_clear && !ix.palette.iter().any(|c| to_clear.contains(c)) && left.iter().any(|c| to_clear.contains(c)) { return Ok(quantize::quantize_to(rgba, w, h, o, &fixed_palette(&left, &to_clear, s.colors, has_clear, false))); } @@ -929,6 +931,37 @@ fn fixed_palette(left: &[[u8; 3]], to_clear: &[[u8; 3]], colors: u16, has_clear: .collect() } +/// Makes transparent the pixels of `ix` whose nearest color is a color of `left` mapped to +/// transparent (`to_clear`) that does not fit in the fixed palette `kept`. Such a pixel takes the +/// transparent entry, or an entry mapped to transparent, which Map to Transparent clears later. +fn clear_dropped(ix: &mut Indexed, rgba: &[u8], o: &PaletteOptions, kept: &[[u8; 3]], left: &[[u8; 3]], to_clear: &[[u8; 3]]) { + let dropped: Vec<[u8; 3]> = left.iter().filter(|c| to_clear.contains(c) && !kept.contains(c)).copied().collect(); + if dropped.is_empty() { + return; + } + let all: Vec<[u8; 3]> = kept.iter().chain(&dropped).copied().collect(); + let near = quantize::nearest_entries(rgba, o, &all); + if !near.iter().any(|n| n.is_some_and(|n| n >= kept.len())) { + return; + } + let entry = match ix.transparent.or_else(|| ix.palette.iter().position(|c| to_clear.contains(c)).and_then(|i| u8::try_from(i).ok())) { + Some(i) => i, + None => { + // A kept color mapped to transparent that no pixel took; at most 255 entries are used then. + let (Some(c), Ok(i)) = (kept.iter().find(|c| to_clear.contains(c)), u8::try_from(ix.palette.len())) else { + return; + }; + ix.palette.push(*c); + i + } + }; + for (v, n) in ix.indices.iter_mut().zip(&near) { + if n.is_some_and(|n| n >= kept.len()) { + *v = entry; + } + } +} + /// An optimised image as straight RGBA → `(pixels, width, height)` (the dialog's preview). pub fn decode(o: &Optimized) -> std::result::Result<(Vec, u32, u32), String> { let img = craft_image_codecs::decode(o.display()).map_err(|e| format!("the optimised image can't be read back: {e}"))?; diff --git a/crates/engine/src/tests/webexport.rs b/crates/engine/src/tests/webexport.rs index 9930e3e2fe..62dd4d8612 100644 --- a/crates/engine/src/tests/webexport.rs +++ b/crates/engine/src/tests/webexport.rs @@ -574,6 +574,16 @@ fn colour_table_fixed_palette_keeps_an_opaque_color() { let p = json!({"format": "png8", "dither": "none", "colors": 256, "colorTable": {"customPalette": full, "transparent": ["#ff0000"]}}); let img = pixels(&one(&mut s, p)); assert_eq!((img.get_pixel(5, 5).0[3], img.get_pixel(25, 5).0, img.get_pixel(35, 5).0[3]), (0, [0, 0, 255, 255], 0)); + // With one opaque color and 255 mapped to transparent, the last of those does not fit, and its + // pixels still become transparent rather than taking the opaque color nearest them. + let mut d = session(30.0, 10.0); + rect(&mut d, [0.0, 0.0, 10.0, 10.0], "#0000ff"); + rect(&mut d, [10.0, 0.0, 10.0, 10.0], "#0000ee"); + let clear: Vec = (1..255).map(|i| format!("#00{i:02x}00")).chain(["#0000ee".to_string()]).collect(); + let palette: Vec = std::iter::once("#0000ff".to_string()).chain(clear.iter().cloned()).collect(); + let p = json!({"format": "png8", "dither": "none", "colors": 256, "colorTable": {"customPalette": palette, "transparent": clear}}); + let img = pixels(&one(&mut d, p)); + assert_eq!((img.get_pixel(5, 5).0, img.get_pixel(15, 5).0[3], img.get_pixel(25, 5).0[3]), ([0, 0, 255, 255], 0, 0)); // Without transparent pixels the colors mapped to transparent still take one slot together. let mut t = session(30.0, 10.0); rect(&mut t, [0.0, 0.0, 10.0, 10.0], "#ff0000"); diff --git a/crates/render/src/encode/quantize.rs b/crates/render/src/encode/quantize.rs index dc459d4331..fff66aa142 100644 --- a/crates/render/src/encode/quantize.rs +++ b/crates/render/src/encode/quantize.rs @@ -203,6 +203,21 @@ pub fn quantize_to(rgba: &[u8], width: u32, height: u32, o: &PaletteOptions, pal finish(px, &colors, width, height, &palette, o, o.dither) } +/// For each pixel of `rgba`, the entry of `palette` nearest its color, as [`quantize_to`] measures +/// it (the matte, transparency and `o.reduction`'s distance weights) without dither; `None` for a +/// pixel that becomes transparent, and for every pixel when `palette` is empty. +pub fn nearest_entries(rgba: &[u8], o: &PaletteOptions, palette: &[[u8; 3]]) -> Vec> { + let px = rgba.as_chunks::<4>().0; + let colors = opaque_colors(px, o, false); + let pal: Vec<[f32; 3]> = palette.iter().map(|c| c.map(f32::from)).collect(); + let index = PaletteIndex::new(&pal, o.reduction.weights()); + colors + .iter() + .zip(px) + .map(|(c, p)| if pal.is_empty() || (o.transparency && p[3] < 128) { None } else { Some(index.nearest(c.map(f32::from))) }) + .collect() +} + /// The color of each pixel when opaque: blended over the matte, and gray when `gray`. fn opaque_colors(px: &[[u8; 4]], o: &PaletteOptions, gray: bool) -> Vec<[u8; 3]> { let matte = o.matte.unwrap_or([255; 3]); From c3e17182e1810f7d951a3f94b1b61fb58ad0802a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 18:37:44 -0800 Subject: [PATCH 104/158] Docs: layer.highlight uses a set past 8 valid ids in every mode The line for layer.highlight said set and add always look rows up in a set. The command builds the set in every mode only when more than 8 ids name objects after the list is cut to 100,000; with fewer it searches the rows. The Layers panel's range preview always uses a set. --- docs/target-app-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 56401998a7..9857210554 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1391,7 +1391,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Layer Options for several highlighted rows shows the first row's settings, and OK changes only the settings set in the dialog: each row keeps its own color, Template, Lock, Show, Print, Preview and Dim Images otherwise (`crates/ui-egui/src/dialogs/layer_options.rs` tests). As VectorCraft's own rule, a layer color (`layer.setProps`, `layer.new`, `layer.newSublayer`) or a Live Paint Gap Preview Color (`livePaint.gapOptions`) given as a hex color with an alpha part (`#rrggbbaa` or `#rgba`) is an error and changes nothing, instead of being set without its alpha. Regression tests: `a_layer_color_with_an_alpha_part_is_refused` in `crates/engine/src/tests/layers.rs` and `a_gap_color_with_an_alpha_part_is_refused` in `crates/engine/src/tests/build.rs`. Panel Options › Locate Selected Objects (beyond Illustrator, off by default): when the last selected object changes on the canvas or by a command, the panel opens the layers and groups around it and scrolls to its row, as Locate Object does, without highlighting the row; when Show Layers Only, a search or the filter leaves the object without a row, the panel opens no rows for it and scrolls as with the option off. - A Shift-click or Shift+Ctrl/Cmd-click range (`layer.highlight` with `set` or `add`, and the panel's preview of the rows before it sends the command) looks each row up in a set of the highlighted rows instead of searching the highlighted rows once for each row, as does a `toggle` of more than 8 ids; the work grows in step with the number of rows. The rows, their order, the returned rows and the current layer are the same as before. Tests: `tests::layers::layer_highlight_matches_a_search_of_the_rows_for_each_id`, `tests::layers::highlighting_rows_keeps_their_order_with_repeated_unknown_and_excess_ids` and `widgets::drag::row_click_tests::a_large_range_applies_as_a_search_of_the_rows_for_each_id_does`; timing: `cargo test --release -p vectorcraft-engine --lib layer_highlight_timing -- --ignored --nocapture`. + When more than 8 of its ids name objects in the document (after the list is cut to 100,000), `layer.highlight` in each mode (`set`, `add` and `toggle`) looks each row up in a set of the highlighted rows instead of searching the highlighted rows once for each row; with 8 or fewer it searches them. The Layers panel's preview of a Shift-click or Shift+Ctrl/Cmd-click range, before it sends the command, always looks the rows up in a set. The work grows in step with the number of rows. The rows, their order, the returned rows and the current layer are the same as before. Tests: `tests::layers::layer_highlight_matches_a_search_of_the_rows_for_each_id`, `tests::layers::highlighting_rows_keeps_their_order_with_repeated_unknown_and_excess_ids` and `widgets::drag::row_click_tests::a_large_range_applies_as_a_search_of_the_rows_for_each_id_does`; timing: `cargo test --release -p vectorcraft-engine --lib layer_highlight_timing -- --ignored --nocapture`. - **Drawing aids:** Smart Guides and snapping (moving, with the Selection, Group Selection or Direct Selection tool, and resizing by the bounding-box handles with the Selection or Free Transform tool, Shift and Alt too: the dragged corner or side lands on the other objects' anchors and centres ("anchor", "center") or lines up with their edges and centres (a line and "align"); with Smart Guides › Spacing Guides, a moved selection that lines up with nothing along an axis lands as far from its neighbour as two other objects of its row or column are apart, or halfway between its two neighbours, the equal gaps marked; with View › Snap to Grid on, a moved selection lands on the grid instead, by whichever of its edges is nearest a gridline on each axis (the center does not snap), #740, #1816; the Rotate, Scale, Shear and Reflect tools drag from the anchor they grab and snap the pointer the same way, so a corner dragged onto another object's anchor scales exactly onto it, #482; anchors dragged with Direct Selection: the one pressed on lands on other anchors, its own path's that stay put among them, on path segments or in line with them, the others following, Shift keeps 45° steps, and with Smart Guides off Snap to Point pulls it onto anchors; the Artboard tool snaps artboards, and their bleed, to other artboards, bleeds and art, the grid or whole pixels while moving, copying and resizing them, and the Transform panel shows and edits the active artboard's X/Y/W/H; drawn points, #506: hovering shows where the press goes, the point lands on the other objects' anchors, centres and paths ("anchor", "center", "path") or lines up with their anchors, edges and centres ("align"), the Pen's on the path being drawn too, near a construction guide through the anchor before it on that guide (Preferences › Smart Guides › Construction Guides and Angles), and with Shift kept to its 45° step or a square's diagonal it slides along that way into line; the targets are gathered once per document state, from the art in the window, and the anchors, centres and lines near the pointer are found by bisection, so hovering never rescans the document), guides dragged out of the rulers (#451: they snap as moved guides do, Shift to the ruler's ticks; with the Artboard tool they are artboard guides, which run across their artboard only and move, copy and delete with it, `guide.add {artboard}`) that the Selection, Direct Selection and Group Selection tools then pick and drag (#414: the selected guides highlight and move together, Alt copies them, Shift snaps the dragged one to the ticks, otherwise it snaps to pixels, the grid or the edges, centres (so the sides' midpoints) and anchors of the art and the artboards, or with Smart Guides off Snap to Point pulls it onto anchors; Shift-clicked they join the selected art, and Shift-added art keeps them, so guides and art are selected together in either order, Delete then deleting both in one step; the arrow keys nudge them, Delete deletes them, dragging one back onto its ruler deletes it, Lock Guides and Hide Guides leave them alone; `guide.list`, `guide.select`, `guide.move` and `guide.remove` reach agents), a right-click on either ruler or the origin box to pick the document's units (the current one checked; `document.setUnits`, one undo step, #528), and Draw Normal / Behind / Inside modes. Smart Guides: a point drawn with the Pen or a shape tool, and an anchor dragged with Direct Selection, snaps to where paths and ruler guides cross, labelled "intersect" (#1658, part of #1602; a moved selection's own anchors don't, except the anchor the Selection tool grabbed it by). A selection the Selection tool grabs by one of its anchors snaps that anchor onto the other objects' paths ("path"), and where a path crosses another path or a ruler guide ("intersect"), in the order Direct Selection uses for a dragged anchor; when the anchor lands on a path, the selection's bounds do not also line up with other objects (#7411). The archived 2007 [user guide](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=55) (page 49) says Smart Guides align the pointer of a moved object to existing paths. Snapping onto paths only when the selection was grabbed by an anchor is VectorCraft's own rule; a selection grabbed anywhere else still lines its bounds up. Tests: `select::tests::a_move_grabbed_by_an_anchor_lands_it_on_another_path`, `a_move_grabbed_by_an_anchor_lands_it_where_paths_cross` and `a_move_grabbed_by_an_anchor_lands_it_where_a_path_crosses_a_ruler_guide`. With Smart Guides › Measurement Labels on, the Line Segment tool labels the segment being drawn with its distance, angle and X and Y offsets (`D`, `Angle`, `dX`, `dY`), and the Pen, Curvature and Smart Pen tools label their rubber band the same way when Enable Rubber Band is on (#2983). A move that Shift keeps level, upright or diagonal stays on that line when it snaps, with the Selection, Group Selection or Direct Selection tool. It slides along the line until the selection lands on the grid or on whole pixels, lines up with the other objects or is spaced evenly with them, or until the line passes an anchor or crosses a ruler guide near the point the selection was grabbed by. A level or upright move snaps along its own axis only. Snap to Last Location: with Smart Guides on and Preferences › Smart Guides › Snap to Last Location on (off by default, VectorCraft's own choice), a selection moved by dragging with the Selection, Group Selection or Direct Selection tool, Shift too, goes back to where the move began while it is within Snapping Tolerance of it, labeled "last location"; an Alt copy is not pulled back onto its original, and with View › Snap to Grid or Snap to Pixel on the move snaps to the grid or to whole pixels instead (`prefs.set` key `snapToLastLocation`). The public [Smart Guides options](https://helpx.adobe.com/illustrator/desktop/measure-and-align/grids-and-guides/smart-guides-options.html) page lists the option as snapping objects back to their previous position; the distance, the label, the copy rule and the grid and pixel rule are VectorCraft's own. Tests: `select::tests::snap_to_last_location_puts_a_move_back_where_it_began`, `select::tests::snap_to_pixel_wins_over_snap_to_last_location`, `direct::tests::snap_to_last_location_puts_a_path_moved_by_its_anchor_back`, `direct::tests::snap_to_pixel_wins_over_snap_to_last_location_for_a_path_moved_by_its_anchor`, `tests_prefs::snap_to_last_location_puts_a_dragged_square_back`. From fc5460d18ec675c427bf524e528da05f7302a097 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 18:57:53 -0800 Subject: [PATCH 105/158] Save for Web: GIF lossy compares pixels with the web-snapped colors Web shift and web snap now run before lossy compression again, so a pixel is compared with the color its neighbor's entry is written as. Colors shifted by hand are written after lossy, which still moves no pixel into or out of them. --- crates/engine/src/cmd/webexport.rs | 31 ++++++++++++++-------------- crates/engine/src/tests/webexport.rs | 18 ++++++++++++++-- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/crates/engine/src/cmd/webexport.rs b/crates/engine/src/cmd/webexport.rs index f5b4164f86..498982a7f9 100644 --- a/crates/engine/src/cmd/webexport.rs +++ b/crates/engine/src/cmd/webexport.rs @@ -814,24 +814,11 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 *slot = *c; } } - // Lossy compares the pixels with the colors the reduction made, and moves no pixel into or out - // of a color shifted by hand. - if s.format == WebFormat::Gif { - let fixed: Vec = sources.iter().enumerate().filter(|(_, c)| shifted_to(c).is_some()).filter_map(|(i, _)| u8::try_from(i).ok()).collect(); - web::lossy(&mut ix, rgba, s.lossy, &fixed); - } - // The colors shifted by hand, then web shift and web snap (locked colors stay as they are). + // Web shift and web snap (locked colors and colors shifted by hand stay as they are). let clear = ix.transparent.map(usize::from); for (i, c) in ix.palette.iter_mut().enumerate() { let src = sources.get(i).copied().unwrap_or(*c); - if Some(i) == clear { - continue; - } - if let Some(to) = shifted_to(&src) { - *c = to; - continue; - } - if locked.contains(&src) { + if Some(i) == clear || shifted_to(&src).is_some() || locked.contains(&src) { continue; } if shift.contains(&src) { @@ -840,6 +827,20 @@ fn palette_image(rgba: &[u8], w: u32, h: u32, s: &WebSettings, matte: Option<[u8 *c = snapped; } } + // Lossy compares the pixels with the colors written for them, and moves no pixel into or out of + // a color shifted by hand. + if s.format == WebFormat::Gif { + let fixed: Vec = sources.iter().enumerate().filter(|(_, c)| shifted_to(c).is_some()).filter_map(|(i, _)| u8::try_from(i).ok()).collect(); + web::lossy(&mut ix, rgba, s.lossy, &fixed); + } + // The colors shifted by hand. + for (i, c) in ix.palette.iter_mut().enumerate() { + if Some(i) != clear + && let Some(to) = sources.get(i).and_then(shifted_to) + { + *c = to; + } + } let order = web::sort(&mut ix, table.sort); let sources: Vec<[u8; 3]> = order.iter().map(|&i| sources.get(i).copied().unwrap_or_default()).collect(); let colors = ix diff --git a/crates/engine/src/tests/webexport.rs b/crates/engine/src/tests/webexport.rs index 62dd4d8612..fe3deecbef 100644 --- a/crates/engine/src/tests/webexport.rs +++ b/crates/engine/src/tests/webexport.rs @@ -686,8 +686,8 @@ fn colour_table_shift_writes_the_picked_color_wherever_the_source_is() { assert!(old.color_table.shifted.is_empty()); } -/// Lossy GIF compression compares the pixels with the colors the reduction made, so a color shifted -/// near another one does not take in that color's pixels. +/// Lossy GIF compression leaves the pixels of a color shifted by hand alone, so a color shifted near +/// another one does not take in that color's pixels. #[test] fn lossy_does_not_spread_a_shifted_color_into_another() { let mut s = session(30.0, 10.0); @@ -715,6 +715,20 @@ fn lossy_moves_no_pixel_into_or_out_of_a_shifted_color() { } } +/// Lossy GIF compression compares the pixels with the colors web snap writes, so a pixel does not +/// take a color that snaps far from it. +#[test] +fn lossy_compares_pixels_with_the_snapped_colors() { + let mut s = session(20.0, 10.0); + rect(&mut s, [0.0, 0.0, 10.0, 10.0], "#1a1a1a"); + rect(&mut s, [10.0, 0.0, 20.0, 10.0], "#000000"); + let img = pixels(&one(&mut s, json!({"format": "gif", "dither": "none", "webSnap": 100, "lossy": 50}))); + for x in 0..20 { + let want = if x < 10 { [51, 51, 51, 255] } else { [0, 0, 0, 255] }; + assert_eq!(img.get_pixel(x, 5).0, want, "x = {x}"); + } +} + #[test] fn presets_and_remembered_settings() { let mut s = two_colours(); From ae2e920cc1a61549b9d85c1ea71036dd0dccbeb6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 18:43:10 -0800 Subject: [PATCH 106/158] Toasts: messages narrow to fit a narrow window, and app messages keep the time limits In a window narrower than 352 points, messages narrow to the window's width less the stack's margins, with 32 points as the least, and the text wraps to that width. A message the app queues with Session::toast shows for 0.5 to 60 seconds, as app.toast allows; a time that is not a number shows for 4 seconds. --- crates/engine/src/cmd/toast.rs | 17 ++++++++++++-- crates/ui-egui/src/toasts.rs | 43 ++++++++++++++++++++++++++-------- 2 files changed, 48 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/cmd/toast.rs b/crates/engine/src/cmd/toast.rs index bf6ed66fee..e2eb41bd21 100644 --- a/crates/engine/src/cmd/toast.rs +++ b/crates/engine/src/cmd/toast.rs @@ -76,8 +76,11 @@ impl Toast { pub struct Queue(VecDeque); impl Session { - /// Queue `toast` for the app to show. With [`MAX_QUEUED`] waiting, the oldest one goes. - pub fn toast(&mut self, toast: Toast) { + /// Queue `toast` for the app to show. With [`MAX_QUEUED`] waiting, the oldest one goes. Its + /// time is held to [`MIN_SECONDS`] to [`MAX_SECONDS`], and a time that is not a number is + /// [`DEFAULT_SECONDS`]. + pub fn toast(&mut self, mut toast: Toast) { + toast.seconds = if toast.seconds.is_nan() { DEFAULT_SECONDS } else { toast.seconds.clamp(MIN_SECONDS, MAX_SECONDS) }; while self.toasts.0.len() >= MAX_QUEUED { self.toasts.0.pop_front(); } @@ -192,6 +195,16 @@ mod tests { assert_eq!(s.take_toasts().len(), 1); } + #[test] + fn a_message_queued_by_the_app_shows_for_0_5_to_60_seconds() { + let mut s = Session::new(); + for seconds in [f64::INFINITY, 1e9, f64::NEG_INFINITY, 0.0, f64::NAN, 10.0] { + s.toast(Toast { seconds, ..Toast::new("m", Level::Info) }); + } + let got: Vec = s.take_toasts().iter().map(|t| t.seconds).collect(); + assert_eq!(got, vec![MAX_SECONDS, MAX_SECONDS, MIN_SECONDS, MIN_SECONDS, DEFAULT_SECONDS, 10.0]); + } + #[test] fn the_oldest_waiting_message_goes_past_the_limit() { let mut s = Session::new(); diff --git a/crates/ui-egui/src/toasts.rs b/crates/ui-egui/src/toasts.rs index d1f35f6326..c6868e0cfc 100644 --- a/crates/ui-egui/src/toasts.rs +++ b/crates/ui-egui/src/toasts.rs @@ -17,6 +17,10 @@ pub const MAX_SHOWN: usize = 5; /// The widest a message is, in points; longer text wraps. const WIDTH: f32 = 320.0; +/// The narrowest a message gets in a narrow window, in points: its frame's margin and edge (22 +/// points) and room for one character. +const MIN_WIDTH: f32 = 32.0; + /// The most lines a message shows; the rest shows on hover. const MAX_ROWS: usize = 6; @@ -91,10 +95,12 @@ pub(crate) fn show_at(app: &mut VectorcraftApp, ctx: &egui::Context, now: f64) { let area = egui::Area::new(egui::Id::unique("toasts")).order(egui::Order::Foreground).anchor(egui::Align2::RIGHT_BOTTOM, corner); // A stack taller than the window scrolls, kept at its newest message. let height = (ctx.content_rect().height() - 2.0 * MARGIN).max(0.0); + // In a window narrower than a message, the messages narrow to fit it. + let width = WIDTH.min(ctx.content_rect().width() - 2.0 * MARGIN).max(MIN_WIDTH); let dismissed = area .show(ctx, |ui| { let scroll = egui::ScrollArea::vertical().max_height(height).stick_to_bottom(true); - scroll.show(ui, |ui| stack(ui, &mut app.toasts.list, &t)).inner + scroll.show(ui, |ui| stack(ui, &mut app.toasts.list, &t, width)).inner }) .inner; if let Some(id) = dismissed { @@ -103,14 +109,14 @@ pub(crate) fn show_at(app: &mut VectorcraftApp, ctx: &egui::Context, now: f64) { } } -/// Draw `list`, oldest first; the id of the message clicked. -fn stack(ui: &mut egui::Ui, list: &mut [Entry], t: &Tokens) -> Option { - ui.set_max_width(WIDTH); +/// Draw `list`, oldest first, `width` points wide; the id of the message clicked. +fn stack(ui: &mut egui::Ui, list: &mut [Entry], t: &Tokens, width: f32) -> Option { + ui.set_max_width(width); let mut clicked = None; for e in list { // Each message's widgets keep its id when the messages before it go, so a press and a // release land on the same message. - let r = ui.push_id(e.id, |ui| message(ui, e, t)).inner; + let r = ui.push_id(e.id, |ui| message(ui, e, t, width)).inner; if r.clicked() { clicked = Some(e.id); } @@ -120,18 +126,19 @@ fn stack(ui: &mut egui::Ui, list: &mut [Entry], t: &Tokens) -> Option { clicked } -/// Draw one message → its response to clicks. -fn message(ui: &mut egui::Ui, e: &Entry, t: &Tokens) -> egui::Response { +/// Draw one message `width` points wide → its response to clicks. +fn message(ui: &mut egui::Ui, e: &Entry, t: &Tokens, width: f32) -> egui::Response { let frame = egui::Frame::new() .fill(t.panel) .stroke(egui::Stroke::new(1.0, color(t, e.toast.level))) .corner_radius(t.radius) .inner_margin(egui::Margin::symmetric(10, 8)) .show(ui, |ui| { - ui.set_width(WIDTH - 20.0); + // The frame's margin and edge take 11 points on each side. + ui.set_width(width - 22.0); let format = egui::TextFormat::simple(egui::TextStyle::Body.resolve(ui.style()), t.text); let mut job = egui::text::LayoutJob::single_section(e.toast.message.clone(), format); - job.wrap.max_width = WIDTH - 20.0; + job.wrap.max_width = width - 22.0; job.wrap.max_rows = MAX_ROWS; let galley = ui.painter().layout_job(job); let elided = galley.elided; @@ -168,7 +175,12 @@ mod tests { /// [`pass`] in a window `height` points tall. fn pass_in(app: &mut VectorcraftApp, ctx: &egui::Context, now: f64, events: Vec, height: f32) -> Vec { - let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1000.0, height)); + pass_sized(app, ctx, now, events, egui::vec2(1000.0, height)) + } + + /// [`pass`] in a window of `size` points. + fn pass_sized(app: &mut VectorcraftApp, ctx: &egui::Context, now: f64, events: Vec, size: egui::Vec2) -> Vec { + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, size); let input = egui::RawInput { screen_rect: Some(screen), events, ..Default::default() }; let mut output = ctx.run_ui(input, |ui| show_at(app, ui.ctx(), now)); output.textures_delta.clear(); @@ -325,6 +337,17 @@ mod tests { assert_eq!(app.toasts.list.len(), MAX_SHOWN); } + #[test] + fn a_message_in_a_narrow_window_stays_inside_it() { + let (mut app, ctx) = app(); + app.run("app.toast", json!({"message": "A message long enough to wrap onto more than one line"})).unwrap(); + let size = egui::vec2(200.0, 700.0); + pass_sized(&mut app, &ctx, 0.0, vec![], size); + pass_sized(&mut app, &ctx, 0.0, vec![], size); + let rect = app.toasts.list[0].rect.unwrap(); + assert!(rect.left() >= MARGIN - 0.5 && rect.right() <= size.x - MARGIN + 0.5, "{rect:?}"); + } + #[test] fn no_message_draws_nothing() { let (mut app, ctx) = app(); From 290a58fc1865e4f407c3360bf4a94909f41087f5 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 08:38:40 +0530 Subject: [PATCH 107/158] M7/G4: retype review follow-ups (#4934) List type.retype among the commands plugins may call. Only closed shapes match glyphs. Live type, images and other art between glyphs, and unselected art between selected objects, end the line. Each selected object's own parent decides its group. Retyped type turns ligatures off, as the outlines drew each glyph on its own. --- crates/engine/src/cmd/plugin_call/reviewed.rs | 1 + crates/engine/src/cmd/retype.rs | 57 ++++++++++++++----- crates/engine/src/cmd/retype_tests.rs | 37 ++++++++++++ 3 files changed, 82 insertions(+), 13 deletions(-) diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index 6a0caf4cd6..28cce5a244 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -683,6 +683,7 @@ pub(super) const ALLOWED: &[&str] = &[ "type.pathOptions", "type.resetHorizontalScale", "type.resetTracking", + "type.retype", "type.ruby", "type.scaleTextAttributes", "type.size.decrease", diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index 395ce33b23..72ab30a711 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -47,9 +47,12 @@ pub fn specs() -> Vec { /// A shape to match: a path or compound path, in document space. struct Piece { id: NodeId, - /// The group holding it (`None` for a selected shape at the top): glyphs of different - /// groups, which may composite differently, never share a line. + /// The group or layer holding it: glyphs of different groups, which may composite + /// differently, never share a line. parent: Option, + /// Other art (not retyped) lies between it and the shape before it, so the type after that + /// art must stay painted after it: the line ends here. + after_barrier: bool, path: BezPath, appearance: Appearance, /// The shape's own transparency, which the new type takes. @@ -57,28 +60,45 @@ struct Piece { blend: vectorcraft_color::BlendMode, } -fn collect(n: &Node, parent: Option, depth: usize, out: &mut Vec) { +/// The shapes in `n` (held by `parent`), in paint order. `barrier` is set when art that is not a +/// shape lies before the next one; it starts set for a root that does not follow the last root. +fn collect(n: &Node, parent: Option, depth: usize, barrier: &mut bool, out: &mut Vec) { if out.len() >= MAX_PIECES || depth > MAX_DEPTH { + *barrier = true; return; } - let piece = |path: BezPath| Piece { id: n.id, parent, path, appearance: (*n.appearance).clone(), opacity: n.opacity, blend: n.blend }; + let piece = |path: BezPath, after_barrier: bool| Piece { + id: n.id, + parent, + after_barrier, + path, + appearance: (*n.appearance).clone(), + opacity: n.opacity, + blend: n.blend, + }; match &n.kind { NodeKind::Group { children, clip: false } => { for c in children { - collect(c, Some(n.id), depth + 1, out); + collect(c, Some(n.id), depth + 1, barrier, out); } } - NodeKind::Path { path, clipping: false, guide: false, .. } => out.push(piece(path.to_bezpath())), + // Only closed shapes can be glyphs: an open path stroked along a glyph's outline is not one. + NodeKind::Path { path, clipping: false, guide: false, .. } if path.is_closed() => out.push(piece(path.to_bezpath(), std::mem::take(barrier))), NodeKind::Compound { children, .. } => { let mut path = BezPath::new(); for c in children { - if let NodeKind::Path { path: p, .. } = &c.kind { - path.extend(p.to_bezpath()); + match &c.kind { + NodeKind::Path { path: p, .. } if p.is_closed() => path.extend(p.to_bezpath()), + _ => { + *barrier = true; + return; + } } } - out.push(piece(path)); + out.push(piece(path, std::mem::take(barrier))); } - _ => {} + // Live type, images, clip groups and the rest stay, and the type after them stays after them. + _ => *barrier = true, } } @@ -194,10 +214,16 @@ fn retype(s: &mut Session, p: &Value) -> Result { let (lines, unmatched) = { let d = &s.doc()?.doc; let mut pieces = vec![]; + let mut last: Option<(Option, usize)> = None; for r in &roots { - if let Some(n) = d.node(*r) { - collect(n, None, 0, &mut pieces); - } + let Some(n) = d.node(*r) else { continue }; + let parent = d.parent_of(*r); + let idx = d.position(*r).map(|(_, i, _)| i); + // A root right after the last one, in the same parent, continues its lines; unselected + // art between two roots is a barrier. + let mut barrier = !matches!((last, idx), (Some((p, i)), Some(j)) if p == parent && i + 1 == j); + last = idx.map(|i| (parent, i)); + collect(n, parent, 0, &mut barrier, &mut pieces); } if pieces.is_empty() { return Err(EngineError::Other("Retype: select outlined text (paths or compound paths)".into())); @@ -219,6 +245,9 @@ fn retype(s: &mut Session, p: &Value) -> Result { // An unmatched shape between glyphs ends the line: the type after it is painted after it. let mut open = false; for (pc, ms) in pieces.iter().zip(&found) { + if pc.after_barrier { + open = false; + } // Earlier matches win ties: they are the closer fits. let best = ms.iter().enumerate().max_by_key(|(i, m)| (rank(m.face.id()), std::cmp::Reverse(*i))).map(|(_, m)| m); let Some(m) = best else { @@ -249,6 +278,8 @@ fn retype(s: &mut Session, p: &Value) -> Result { font_style: l.face.style.clone(), // The version that matched, when two of the family and style are loaded. font_version: (!l.face.version.is_empty()).then(|| l.face.version.clone()), + // Each outlined glyph was drawn on its own; a ligature would draw another shape. + features: vec!["-liga".into()], size: l.scale * l.face.units_per_em(), fill: l.appearance.fill_paint(), stroke: l.appearance.stroke_paint(), diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index af91b8442d..57cb747414 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -166,3 +166,40 @@ fn glyphs_of_different_groups_and_transparency_stay_apart() { assert_eq!(children_of(&s, b), vec![ids[1], ids[2]]); assert_eq!(s.doc().unwrap().doc.node(NodeId(ids[2])).unwrap().opacity, 0.25, "the glyph's own opacity carries over"); } + +#[test] +fn live_type_between_glyphs_ends_the_line_too() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); + let live = s.execute("text.create", &json!({"x": 30, "y": 90, "text": "x", "size": 60})).unwrap()["id"].as_u64().unwrap(); + s.edit("test", |d, _| { + let n = d.node(NodeId(live)).unwrap().clone(); + d.remove(NodeId(live))?; + d.insert(Some(NodeId(g)), 1, n)?; + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["A", "B"]), "{r}"); + let ids: Vec = r["ids"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect(); + assert_eq!(children_of(&s, g), vec![ids[0], live, ids[1]], "B stays over the live type"); + let t = text_of(&s, ids[0]); + assert!(t.first_style().features.iter().any(|f| f == "-liga"), "glyphs drawn one by one: no ligatures"); +} + +#[test] +fn an_open_path_along_a_glyph_is_not_a_glyph() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "I", "size": 40})); + s.edit("test", |d, _| { + let glyph = d.node(NodeId(g)).unwrap().children().unwrap()[0].id; + for sp in &mut d.node_mut(glyph).unwrap().path_data_mut().unwrap().subpaths { + sp.closed = false; + } + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + assert!(s.execute("type.retype", &json!({})).is_err(), "nothing matches"); +} From d1e9fc67db17c91635603d1224992cf080bf33b9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 19:13:47 -0800 Subject: [PATCH 108/158] Save for Web: Lock, Transparent and Web Shift are off for a selected color the table no longer shows The three buttons act on the last color clicked (__color). After a change of reduction or color count, or through ui.dialog.set, that color can be one the table no longer shows, and a click added it to locked, transparent or webShift. The buttons are now enabled only when the table shows that color, the same check Delete Color uses. --- crates/ui-egui/src/dialogs/save_for_web.rs | 9 ++++--- .../ui-egui/src/dialogs/tests_save_for_web.rs | 26 +++++++++++++++++++ docs/mcp.md | 3 ++- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/dialogs/save_for_web.rs b/crates/ui-egui/src/dialogs/save_for_web.rs index 8cfb7bc6f8..f1ef2db34b 100644 --- a/crates/ui-egui/src/dialogs/save_for_web.rs +++ b/crates/ui-egui/src/dialogs/save_for_web.rs @@ -1177,10 +1177,15 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re d.fields.insert("__editStart".into(), json!(start)); } let shifted = |c: &str| table.shifted.keys().any(|k| k.eq_ignore_ascii_case(c)); + // The colors the table shows, by source: Lock, Transparent, Web Shift and Delete Color act only + // on these. + let palette: Vec = + shot.colors.iter().filter(|c| !c.transparent).map(|c| hex(c.source)).chain(shot.mapped.iter().map(|c| hex(*c))).collect(); + let shown = palette.iter().any(|p| p.eq_ignore_ascii_case(&selected)); ui.add_space(4.0); let on = |list: &[String]| list.iter().any(|h| h.eq_ignore_ascii_case(&selected)); ui.horizontal(|ui| { - ui.add_enabled_ui(!selected.is_empty(), |ui| { + ui.add_enabled_ui(shown, |ui| { for (list, on_label, off_label) in [ ("transparent", tl!("Restore"), tl!("Transparent")), ("webShift", tl!("Unshift"), tl!("Web Shift")), @@ -1207,8 +1212,6 @@ fn color_table(ui: &mut egui::Ui, d: &mut Dialog, s: Option<&WebSettings>) -> Re }); // Delete Color (the button and the table's menu) and Restore Generated Table. Delete Color // takes only selected colors the table shows (`palette`, by source). - let palette: Vec = - shot.colors.iter().filter(|c| !c.transparent).map(|c| hex(c.source)).chain(shot.mapped.iter().map(|c| hex(*c))).collect(); let deletable = !selected_in(d, &palette).is_empty(); let (mut delete, mut restore, mut unshift_all) = (false, false, false); ui.horizontal(|ui| { diff --git a/crates/ui-egui/src/dialogs/tests_save_for_web.rs b/crates/ui-egui/src/dialogs/tests_save_for_web.rs index 41894ee6dd..a965977b14 100644 --- a/crates/ui-egui/src/dialogs/tests_save_for_web.rs +++ b/crates/ui-egui/src/dialogs/tests_save_for_web.rs @@ -928,6 +928,32 @@ fn dialog_set_edit_color_opens_the_color_picker() { assert_eq!((kind(&app), shifted), (Some(save_for_web::KIND), Some(json!({"#0000ff": "#00ff00"})))); } +/// Lock, Transparent and Web Shift are off while the selected color (`__color`) is one the table +/// no longer shows, so a click adds it to no list; with a color the table shows, Lock locks it. +#[test] +fn table_buttons_skip_a_selected_color_the_table_does_not_show() { + let dir = vectorcraft_testkit::temp_dir("sfw-stale-anchor"); + let (mut app, _) = app(&dir, false); + app.run("shape.rectangle", json!({"x": 40, "y": 0, "width": 20, "height": 40})).unwrap(); + app.run("paint.setFill", json!({"color": "#0000ff"})).unwrap(); + app.run("file.saveForWeb", json!({})).unwrap(); + for (k, v) in [("format", json!("gif")), ("antiAlias", json!("none")), ("dither", json!("none"))] { + set(&mut app, k, v); + } + let table = |app: &VectorcraftApp| app.ui.dialog.as_ref().and_then(|d| d.fields.get("colorTable").cloned()).unwrap_or_default(); + let has = |app: &VectorcraftApp, list: &str, c: &str| table(app)[list].as_array().is_some_and(|l| l.iter().any(|v| v == c)); + set(&mut app, "__color", json!("#abcdef")); + for label in ["Lock", "Transparent", "Web Shift"] { + click_text(&mut app, label); + } + for list in ["locked", "transparent", "webShift"] { + assert!(!has(&app, list, "#abcdef"), "{list}: {}", table(&app)); + } + set(&mut app, "__color", json!("#0000ff")); + click_text(&mut app, "Lock"); + assert!(has(&app, "locked", "#0000ff"), "{}", table(&app)); +} + /// Click the dialog's text `label` with the pointer (frames a quarter second apart). fn click_text(app: &mut VectorcraftApp, label: &str) { let ctx = egui::Context::default(); diff --git a/docs/mcp.md b/docs/mcp.md index 5633e11788..6361e2d084 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9050,7 +9050,8 @@ the dialog a click selects one color, Shift-click selects the colors between it Ctrl-click (Command-click on macOS) adds or removes one (`__colors` holds the selection, `__color` the last one clicked). The trash button and Delete Color in the table's menu delete the selected colors the table shows in one edit, and are off when it shows none of them (a selected color can leave the table when the reduction or the color count -changes). Restore Generated +changes). The Lock, Transparent and Web Shift buttons act on the last color clicked, and are off when the table no longer +shows it. Restore Generated Table in that menu clears `deleted` and `customPalette`, and the table reads Custom while either is set. Choosing another reduction in the dialog also clears them. From fd079ceb2956318d93905d6f4fe991069ebf3e96 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 09:04:12 +0530 Subject: [PATCH 109/158] M7/G4: retype carries a line break across selected objects (#4934) A selected object that yields no shape between two selected glyphs (live type, an open path) ends the line, as it does inside a group. Tests for that and for glyphs selected inside different groups. --- crates/engine/src/cmd/retype.rs | 7 ++++- crates/engine/src/cmd/retype_tests.rs | 37 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index 72ab30a711..8634ca356e 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -215,13 +215,18 @@ fn retype(s: &mut Session, p: &Value) -> Result { let d = &s.doc()?.doc; let mut pieces = vec![]; let mut last: Option<(Option, usize)> = None; + // Carried across roots: a selected root that yields no shape (live type, an open path) still + // ends the line. + let mut barrier = true; for r in &roots { let Some(n) = d.node(*r) else { continue }; let parent = d.parent_of(*r); let idx = d.position(*r).map(|(_, i, _)| i); // A root right after the last one, in the same parent, continues its lines; unselected // art between two roots is a barrier. - let mut barrier = !matches!((last, idx), (Some((p, i)), Some(j)) if p == parent && i + 1 == j); + if !matches!((last, idx), (Some((p, i)), Some(j)) if p == parent && i + 1 == j) { + barrier = true; + } last = idx.map(|i| (parent, i)); collect(n, parent, 0, &mut barrier, &mut pieces); } diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 57cb747414..266a016ea7 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -203,3 +203,40 @@ fn an_open_path_along_a_glyph_is_not_a_glyph() { s.execute("select.set", &json!({"ids": [g]})).unwrap(); assert!(s.execute("type.retype", &json!({})).is_err(), "nothing matches"); } + +#[test] +fn live_type_selected_between_loose_glyphs_still_ends_the_line() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); + let live = s.execute("text.create", &json!({"x": 30, "y": 90, "text": "x", "size": 60})).unwrap()["id"].as_u64().unwrap(); + let (a, b) = (children_of(&s, g)[0], children_of(&s, g)[1]); + // A, the live type and B as siblings in the layer, as Ungroup leaves them. + s.edit("test", |d, _| { + let (par, idx, _) = d.position(NodeId(g)).unwrap(); + let live_n = d.node(NodeId(live)).unwrap().clone(); + let (an, bn) = (d.node(NodeId(a)).unwrap().clone(), d.node(NodeId(b)).unwrap().clone()); + d.remove(NodeId(live))?; + d.remove(NodeId(g))?; + d.insert(par, idx, an)?; + d.insert(par, idx + 1, live_n)?; + d.insert(par, idx + 2, bn)?; + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [a, live, b]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["A", "B"]), "the selected live type between them ends the line: {r}"); +} + +#[test] +fn glyphs_selected_inside_groups_join_only_their_siblings() { + let mut s = session(); + let g1 = outlined(&mut s, json!({"x": 40, "y": 100, "text": "ab", "size": 20})); + let g2 = outlined(&mut s, json!({"x": 70, "y": 100, "text": "cd", "size": 20})); + let (a, b, c) = (children_of(&s, g1)[0], children_of(&s, g1)[1], children_of(&s, g2)[0]); + s.execute("select.set", &json!({"ids": [a, b, c]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["ab", "c"]), "a and b are siblings; c is in another group: {r}"); + let d = &s.doc().unwrap().doc; + assert!(d.node(NodeId(g2)).is_some(), "d's group stays with c's type and d in it"); +} From 1999680fe2939385bf24cddda534b9039843401e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 19:47:28 -0800 Subject: [PATCH 110/158] Docs: Save for Web color shift line cites the shift page and states the lossy rule --- docs/target-app-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 84ac2c5e41..2c9e352982 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -900,7 +900,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Save for Web: Optimize to File Size… opens rows for a desired file size in K, Start With (Current Settings, Auto Select GIF/JPEG) and, with slices, Use (Total of All Slices, Each Slice, Current Slice); OK takes the settings whose files fit and shows the size found, or says that no setting tried fits ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=395)). The search lowers JPEG quality or palette colors (GIF then lossy) and encodes at most 32 trial settings; Auto Select chooses GIF for transparent art or art of at most 256 colors and JPEG otherwise. The slices share one setting, so every Use choice changes all of them (`webExport.optimizeToFileSize`). Scores and estimates are unchanged. - Save for Web: while Alt (Option on macOS) is held, the dialog's Cancel button reads Reset, which puts the remembered settings back on the document's active artboard and leaves the dialog open (`ui.dialogReset`). - Save for Web: the color table's trash button and Delete Color in its menu remove the selected GIF or PNG-8 colors, and their pixels take the nearest color left in the palette ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs4/illustrator_cs4_help.pdf#page=404)). Click selects one color, Shift-click a range and Ctrl-click (Command-click on macOS) adds or removes one ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=398)). After the first deletion the table is a fixed Custom palette, so deleted colors stay out when the preview updates. These rules are VectorCraft's own: a deleted color is no longer locked, transparent or web-shifted; deleting every opaque color is refused; Restore Generated Table in the menu, or another reduction, goes back to the generated palette; presets and the remembered settings keep the edit (`colorTable.deleted`, `colorTable.customPalette`). Fixed palettes can also use all 256 entries when nothing is transparent. Scores and estimates are unchanged. - - Save for Web: double-clicking a GIF or PNG-8 color-table swatch opens the Color Picker, and its OK changes that color to the one picked everywhere it appears in the image. The swatch then shows the original color in its upper-left half and the new one in its lower-right half, with the lock mark, and the color stays through a lower color count. Double-clicking a changed swatch opens the picker on the original color, and OK on it changes the color back; Unshift All Colors in the table's menu undoes every change, web shifts included ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=383)). These rules are VectorCraft's own: Cancel changes nothing; a changed color wins over Web Shift, Web Snap and Lock, and pressing Web Shift replaces it; a color mapped to transparent stays transparent; two colors may change to the same color; a changed color takes a kept palette slot before a locked one, and one slot always stays for the reduction; the change is kept by source color when the reduction changes and applies only while that source is in the table; presets and the remembered settings keep it; the picker opens with Only Web Colors off (`colorTable.shifted`). GIF lossy compression now compares pixels with the reduction's colors, so a changed color does not take in another color's pixels. Scores and estimates are unchanged. + - Save for Web: double-clicking a GIF or PNG-8 color-table swatch opens the Color Picker, and its OK changes that color to the one picked everywhere it appears in the image. The swatch then shows the original color in its upper-left half and the new one in its lower-right half, with the lock mark, and the color stays through a lower color count. Double-clicking a changed swatch opens the picker on the original color, and OK on it changes the color back; Unshift All Colors in the table's menu undoes every change, web shifts included ([the help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf#page=398)). These rules are VectorCraft's own: Cancel changes nothing; a changed color wins over Web Shift, Web Snap and Lock, and pressing Web Shift replaces it; a color mapped to transparent stays transparent; two colors may change to the same color; a changed color takes a kept palette slot before a locked one, and one slot always stays for the reduction; the change is kept by source color when the reduction changes and applies only while that source is in the table; presets and the remembered settings keep it; the picker opens with Only Web Colors off (`colorTable.shifted`). GIF lossy compression moves no pixel into or out of a changed color. Scores and estimates are unchanged. - Export for Screens, Save for Web (slice images, and files named after the document's title) and the Libraries panel name files with the characters Windows does not allow written as `-` and with a `-` after a Windows device name such as `CON`, on every platform (`document.exportForScreens`, `document.exportForWeb`, `library.create`). - Variables (data merge): text, visibility and image variables bound to objects (an object may carry several), dataset rows applied in one undo step (`variable.*`, `dataset.*`) from a Variables panel and Window › Variables, with dialogs to define, bind and edit, Make Text/Visibility/Image Dynamic, Capture/Update Data Set, CSV import/export (`dataset.import` / `dataset.export`), and a row in italics when an edit leaves the art not matching it; an image dataset value is a file path and apply keeps the object's bounds; bindings let go of deleted art and locked art is left alone except by visibility values; every command, like the rest, is drivable over MCP and the CLI. - Export for Screens numbers distinct row files whose names collide, compared without case, as `-2`, `-3`… instead of leaving them out; identical rows still write one file. It puts row folders that differ only in case into one folder (`document.exportForScreens`). From c42cfd23b7710d39e8aa651ef417ec209c941598 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:03:29 +0530 Subject: [PATCH 111/158] M7/G4: retype checks each line against its own layout (#4934) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each retyped line is laid out and compared glyph by glyph with the outlines; it splits where its type would draw another glyph or the same glyph elsewhere (tracking, manual spacing, font substitutions), and a glyph its type cannot draw stays an outline. Shapes with their own opacity mask stay outlines. Shapes past the limits are reported as truncated. Glyphs of plain-shape symbols (box drawing, blocks, geometric shapes, private use) are not matched, so drawn rectangles stay art. Type › Retype is in the Type menu. --- crates/engine/src/cmd/retype.rs | 150 +++++++++++++++++++++----- crates/engine/src/cmd/retype_tests.rs | 59 ++++++++++ crates/text/src/retype.rs | 23 +++- crates/ui-egui/src/menus/tree.rs | 1 + 4 files changed, 204 insertions(+), 29 deletions(-) diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index 8634ca356e..2c19ae10a5 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -38,7 +38,7 @@ pub fn specs() -> Vec { "Retype", ["Type"], None, - "{fonts?: [family…]} turn the selected outlined text (glyph paths and compound paths, inside groups too) back into live point text: each shape is matched against the glyphs of the fonts the app has loaded, the document's fonts and the families in fonts, the same up to uniform scale, rotation and translation (exact matches only); matched glyphs become point text in that font and size at the same baseline, one object per line, with the first glyph's fill and stroke, in one undo step; shapes that match no font stay as they are → {ids (the new type), texts, fonts: [{family, style, size}], unmatched: [id…]}; an error when no shape matches", + "{fonts?: [family…]} turn the selected outlined text (glyph paths and compound paths, inside groups too) back into live point text: each shape is matched against the glyphs of the fonts the app has loaded, the document's fonts and the families in fonts, the same up to uniform scale, rotation and translation (exact matches only); matched glyphs become point text in that font and size at the same baseline, one object per line, with the first glyph's fill, stroke, opacity and blend mode, in one undo step; a line splits where its type would not draw the outlines' glyphs in their places (tracking, manual spacing, font substitutions); shapes that match no font, glyphs type cannot draw as they are, and shapes with their own opacity mask stay as they are → {ids (the new type), texts, fonts: [{family, style, size}], unmatched: [id…], truncated (shapes past the limits of 2048 shapes or 16 nested groups were left out)}; an error when no shape matches", has_selected_path, retype )] @@ -58,13 +58,17 @@ struct Piece { /// The shape's own transparency, which the new type takes. opacity: f32, blend: vectorcraft_color::BlendMode, + /// The shape has an opacity mask of its own, which type cannot take: it stays an outline. + masked: bool, } /// The shapes in `n` (held by `parent`), in paint order. `barrier` is set when art that is not a /// shape lies before the next one; it starts set for a root that does not follow the last root. -fn collect(n: &Node, parent: Option, depth: usize, barrier: &mut bool, out: &mut Vec) { +/// `truncated` is set when shapes past [`MAX_PIECES`] or [`MAX_DEPTH`] were left out. +fn collect(n: &Node, parent: Option, depth: usize, barrier: &mut bool, truncated: &mut bool, out: &mut Vec) { if out.len() >= MAX_PIECES || depth > MAX_DEPTH { *barrier = true; + *truncated = true; return; } let piece = |path: BezPath, after_barrier: bool| Piece { @@ -75,11 +79,12 @@ fn collect(n: &Node, parent: Option, depth: usize, barrier: &mut bool, o appearance: (*n.appearance).clone(), opacity: n.opacity, blend: n.blend, + masked: n.extras().mask.is_some(), }; match &n.kind { NodeKind::Group { children, clip: false } => { for c in children { - collect(c, Some(n.id), depth + 1, barrier, out); + collect(c, Some(n.id), depth + 1, barrier, truncated, out); } } // Only closed shapes can be glyphs: an open path stroked along a glyph's outline is not one. @@ -129,6 +134,8 @@ fn candidate_faces(db: &FontDb, d: &Document, fonts: &[String]) -> Vec, + /// What each piece matched, as `pieces`. + matches: Vec, text: String, face: Arc, scale: f64, @@ -175,8 +182,110 @@ impl Line { } self.text.push(m.ch); self.pieces.push(id); + self.matches.push(m.clone()); self.end = m.origin + dir * (m.face.advance(m.gid) * m.scale); } + + /// The line of this one's glyphs `from..to`, with its group, paint and transparency. + fn part(&self, from: usize, to: usize) -> Option { + let (ids, ms) = (self.pieces.get(from..to)?, self.matches.get(from..to)?); + let (first, m) = (ids.first()?, ms.first()?); + let dir = Vec2::new(m.angle.cos(), m.angle.sin()); + let mut l = Line { + pieces: vec![*first], + matches: vec![m.clone()], + text: m.ch.to_string(), + face: m.face.clone(), + scale: m.scale, + angle: m.angle, + origin: m.origin, + end: m.origin + dir * (m.face.advance(m.gid) * m.scale), + appearance: self.appearance.clone(), + parent: self.parent, + opacity: self.opacity, + blend: self.blend, + }; + for (id, m) in ids.iter().zip(ms).skip(1) { + l.push(*id, m); + } + Some(l) + } + + /// The point type that sets this line. + fn text_object(&self, system_layout: bool) -> TextObject { + let style = CharStyle { + font_family: self.face.family.clone(), + font_style: self.face.style.clone(), + // The version that matched, when two of the family and style are loaded. + font_version: (!self.face.version.is_empty()).then(|| self.face.version.clone()), + // Each outlined glyph was drawn on its own; a ligature would draw another shape. + features: vec!["-liga".into()], + size: self.scale * self.face.units_per_em(), + fill: self.appearance.fill_paint(), + stroke: self.appearance.stroke_paint(), + stroke_width: self.appearance.stroke_width(), + ..Default::default() + }; + let mut t = TextObject::point(self.origin, &self.text, style); + if self.angle != 0.0 { + t.xf *= kurbo::Affine::rotate(self.angle); + } + t.para = super::create::new_type_para(); + t.system_layout = system_layout; + super::typecmd::refresh_bounds(&mut t); + t + } + + /// The first of this line's glyphs its type does not draw as the outlines did: another glyph + /// (a substitution the font makes) or the same glyph elsewhere (tracking, manual spacing, + /// more space than whole spaces make); `None` when the type draws every glyph in its place. + fn first_mismatch(&self, t: &TextObject) -> Option { + let lay = vectorcraft_text::layout(FontDb::global(), t); + let mut drawn = lay.glyphs.iter().filter(|g| !g.outline.elements().is_empty()); + let tol = (self.scale * self.face.units_per_em() * 0.01).max(0.01); + for (k, m) in self.matches.iter().enumerate() { + let Some(g) = drawn.next() else { return Some(k) }; + let at = t.xf * (g.xf * Point::ORIGIN); + if g.font_id != m.face.id() || g.gid != m.gid || at.distance(m.origin) > tol { + return Some(k); + } + } + // Ink the outlines did not have: the last glyph is where it went wrong. + drawn.next().map(|_| self.matches.len().saturating_sub(1)) + } +} + +/// `lines` checked against their own layout: a line splits where its type stops drawing the +/// outlines, and a glyph its type cannot draw even on its own stays an outline (`unmatched`). +/// The layouts are bounded by the number of glyphs. +fn verified(lines: Vec, system_layout: bool, unmatched: &mut Vec) -> Vec { + let mut budget = lines.iter().map(|l| l.pieces.len() * 2 + 2).sum::(); + let mut todo: std::collections::VecDeque = lines.into(); + let mut out = vec![]; + while let Some(l) = todo.pop_front() { + if budget == 0 { + // Unchecked glyphs stay outlines. + unmatched.extend(l.pieces); + continue; + } + budget -= 1; + let n = l.pieces.len(); + match l.first_mismatch(&l.text_object(system_layout)) { + None => out.push(l), + Some(0) => { + unmatched.extend(l.pieces.first().copied()); + if let Some(rest) = l.part(1, n) { + todo.push_front(rest); + } + } + Some(k) => { + for part in [l.part(k, n), l.part(0, k)].into_iter().flatten() { + todo.push_front(part); + } + } + } + } + out } fn space_advance(face: &vectorcraft_text::FontFace) -> f64 { @@ -187,6 +296,7 @@ fn new_line(pc: &Piece, m: &GlyphMatch) -> Line { let dir = Vec2::new(m.angle.cos(), m.angle.sin()); Line { pieces: vec![pc.id], + matches: vec![m.clone()], text: m.ch.to_string(), face: m.face.clone(), scale: m.scale, @@ -211,9 +321,11 @@ fn retype(s: &mut Session, p: &Value) -> Result { }; let roots = selected_roots(s)?; let db = FontDb::global(); - let (lines, unmatched) = { + let system_layout = s.doc()?.doc.setup.system_layout; + let (lines, unmatched, truncated) = { let d = &s.doc()?.doc; let mut pieces = vec![]; + let mut truncated = false; let mut last: Option<(Option, usize)> = None; // Carried across roots: a selected root that yields no shape (live type, an open path) still // ends the line. @@ -228,13 +340,13 @@ fn retype(s: &mut Session, p: &Value) -> Result { barrier = true; } last = idx.map(|i| (parent, i)); - collect(n, parent, 0, &mut barrier, &mut pieces); + collect(n, parent, 0, &mut barrier, &mut truncated, &mut pieces); } if pieces.is_empty() { return Err(EngineError::Other("Retype: select outlined text (paths or compound paths)".into())); } let index = RetypeIndex::build(db, candidate_faces(db, d, &fonts)); - let found: Vec> = pieces.iter().map(|pc| index.matches(&pc.path)).collect(); + let found: Vec> = pieces.iter().map(|pc| if pc.masked { vec![] } else { index.matches(&pc.path) }).collect(); // The face most shapes match, so a glyph several fonts share is set in the same font as // the glyphs around it. let mut votes: Vec<(u32, usize)> = vec![]; @@ -266,38 +378,19 @@ fn retype(s: &mut Session, p: &Value) -> Result { } open = true; } - (lines, unmatched) + let lines = verified(lines, system_layout, &mut unmatched); + (lines, unmatched, truncated) }; if lines.is_empty() { return Err(EngineError::Other(format!("Retype: no selected shape matches a glyph of an available font ({} checked)", unmatched.len()))); } - let system_layout = s.doc()?.doc.setup.system_layout; let made = s.edit("Retype", |d, sel| { let mut ids = vec![]; let mut emptied = vec![]; for l in &lines { let Some(first) = l.pieces.first() else { continue }; let (par, idx, _) = d.position(*first).ok_or(EngineError::NoNode(*first))?; - let style = CharStyle { - font_family: l.face.family.clone(), - font_style: l.face.style.clone(), - // The version that matched, when two of the family and style are loaded. - font_version: (!l.face.version.is_empty()).then(|| l.face.version.clone()), - // Each outlined glyph was drawn on its own; a ligature would draw another shape. - features: vec!["-liga".into()], - size: l.scale * l.face.units_per_em(), - fill: l.appearance.fill_paint(), - stroke: l.appearance.stroke_paint(), - stroke_width: l.appearance.stroke_width(), - ..Default::default() - }; - let mut t = TextObject::point(l.origin, &l.text, style); - if l.angle != 0.0 { - t.xf *= kurbo::Affine::rotate(l.angle); - } - t.para = super::create::new_type_para(); - t.system_layout = system_layout; - super::typecmd::refresh_bounds(&mut t); + let t = l.text_object(system_layout); let id = d.alloc_id(); let mut node = Node::new(id, NodeKind::Text(Box::new(t))); // The glyphs' own transparency (the group's, kept, still applies over it). @@ -347,6 +440,7 @@ fn retype(s: &mut Session, p: &Value) -> Result { "texts": lines.iter().map(|l| l.text.clone()).collect::>(), "fonts": lines.iter().map(|l| json!({"family": l.face.family, "style": l.face.style, "size": l.scale * l.face.units_per_em()})).collect::>(), "unmatched": unmatched.iter().map(|i| i.0).collect::>(), + "truncated": truncated, })) } diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 266a016ea7..7f9cd7ac5d 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -240,3 +240,62 @@ fn glyphs_selected_inside_groups_join_only_their_siblings() { let d = &s.doc().unwrap().doc; assert!(d.node(NodeId(g2)).is_some(), "d's group stays with c's type and d in it"); } + +#[test] +fn tracked_type_splits_where_its_spacing_cannot_be_set_again() { + let mut s = session(); + let id = s.execute("text.create", &json!({"x": 40, "y": 100, "text": "abc", "size": 30})).unwrap()["id"].as_u64().unwrap(); + // Less than half a space: no whole number of spaces makes up the gap (0.4 em would be two + // spaces in this font, and the outlines cannot tell those apart from tracking). + s.execute("text.setRangeStyle", &json!({"id": id, "start": 1, "end": 3, "tracking": 50})).unwrap(); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + let g = s.execute("type.createOutlines", &json!({})).unwrap()["ids"][0].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + let texts: Vec = r["texts"].as_array().unwrap().iter().map(|t| t.as_str().unwrap().to_owned()).collect(); + assert_eq!(texts.concat(), "abc", "{r}"); + assert!(texts.len() > 1, "the tracked glyphs are set where the outlines are, not where untracked type puts them: {r}"); + assert_eq!(r["unmatched"], json!([])); +} + +#[test] +fn a_masked_glyph_stays_an_outline() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); + let a = children_of(&s, g)[0]; + s.edit("test", |d, _| { + let art = vectorcraft_doc::Node::path(d.alloc_id(), vectorcraft_geom::PathData::default(), Default::default()); + d.node_mut(NodeId(a)).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new(art, true))); + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["B"]), "{r}"); + assert_eq!(r["unmatched"], json!([a])); + assert!(s.doc().unwrap().doc.node(NodeId(a)).unwrap().extras().mask.is_some(), "A keeps its mask"); +} + +#[test] +fn shapes_past_the_limits_are_reported_as_left_out() { + let mut s = session(); + let top = outlined(&mut s, json!({"x": 40, "y": 100, "text": "A", "size": 40})); + let deep = outlined(&mut s, json!({"x": 40, "y": 200, "text": "B", "size": 40})); + // B, deeper than Retype looks. + s.edit("test", |d, _| { + let (par, idx, _) = d.position(NodeId(deep)).unwrap(); + let mut n = d.node(NodeId(deep)).unwrap().clone(); + d.remove(NodeId(deep))?; + for _ in 0..20 { + n = vectorcraft_doc::Node::group(d.alloc_id(), vec![std::sync::Arc::new(n)]); + } + let wrapper = n.id.0; + d.insert(par, idx, n)?; + Ok(wrapper) + }) + .map(|w| s.execute("select.set", &json!({"ids": [top, w]})).unwrap()) + .unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["A"])); + assert_eq!(r["truncated"], json!(true), "{r}"); +} diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs index 5a1894e2d0..c014951008 100644 --- a/crates/text/src/retype.rs +++ b/crates/text/src/retype.rs @@ -98,7 +98,7 @@ impl RetypeIndex { // One entry per glyph, under the lowest character that maps to it. let mut by_gid: HashMap = HashMap::new(); for &(c, gid) in face.mapped_chars().iter().take(MAX_GLYPHS_PER_FACE) { - if c.is_whitespace() || c.is_control() { + if c.is_whitespace() || c.is_control() || is_shape_symbol(c) { continue; } by_gid.entry(gid).and_modify(|e| *e = (*e).min(c)).or_insert(c); @@ -179,6 +179,16 @@ impl RetypeIndex { } } +/// Characters whose glyphs are plain shapes (box drawing, blocks, geometric shapes, legacy +/// computing symbols) or a font's own icons (private use): a drawn rectangle or circle is the same +/// shape as one of them, so matching them would turn art into text. They are not matched. +fn is_shape_symbol(c: char) -> bool { + matches!( + u32::from(c), + 0x2500..=0x25FF | 0x2B00..=0x2BFF | 0x1F780..=0x1F7FF | 0x1FB00..=0x1FBFF | 0xE000..=0xF8FF | 0xF0000..=0x10FFFF + ) +} + /// Complex multiply: `z` (a scaled turn) applied to `p`. fn mul(z: (f64, f64), p: Point) -> Point { Point::new(z.0 * p.x - z.1 * p.y, z.1 * p.x + z.0 * p.y) @@ -367,6 +377,17 @@ mod tests { assert!(fit(&a, &b).is_none_or(|(_, r)| r > TOLERANCE)); } + #[test] + fn plain_shape_symbols_are_not_matched() { + // A block element (U+1FB89) drew as a rectangle and took a drawn rectangle for it. + for c in ['\u{1FB89}', '\u{25A0}', '\u{2588}', '\u{E000}'] { + assert!(is_shape_symbol(c), "{c:?}"); + } + for c in ['A', 'l', '-', '\u{6F22}', '\u{0915}'] { + assert!(!is_shape_symbol(c), "{c:?}"); + } + } + #[test] fn degenerate_and_hostile_shapes_give_none() { assert!(signature(&BezPath::new()).is_none()); diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index 19088a259a..7f5acd6e51 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -471,6 +471,7 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec)> { ), Sep, c("Create Outlines", "type.createOutlines"), + c("Retype", "type.retype"), c("Scale Text Attributes", "type.scaleTextAttributes"), c("Optical Margin Alignment", "type.opticalMarginAlignment"), Sep, From 6a3a7ad704ac0a439c928a437cf2c36905999fb9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 20:50:30 -0800 Subject: [PATCH 112/158] Path Precision Tools: test a point placed on a turned outline A point worked out on an outline lies a rounding error inside or outside it. The new test places a point at 37 angles on a turned ellipse, and on each anchor and three places along each segment of a turned and moved Bezier circle, and checks that each gets exactly one line through it. --- .../pathops/src/addons/pathtools/tangents.rs | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/crates/pathops/src/addons/pathtools/tangents.rs b/crates/pathops/src/addons/pathtools/tangents.rs index b47b888302..0a1b6ef715 100644 --- a/crates/pathops/src/addons/pathtools/tangents.rs +++ b/crates/pathops/src/addons/pathtools/tangents.rs @@ -1081,6 +1081,37 @@ mod tests { assert_eq!(Outline::point(Point::new(0.0, f64::INFINITY)).err(), Some(OutlineError::Empty)); } + #[test] + fn a_point_placed_on_a_turned_outline_has_one_tangent() { + // A point worked out on the outline lies a rounding error inside or outside it, and still + // gets the one line there. + let one = |p: Point, o: &Outline| { + let all = common_tangents(&Outline::point(p).unwrap(), o).unwrap(); + assert_eq!(all.len(), 1, "{p:?}: {all:?}"); + // The line runs through the point. + let (a, d) = (all[0].from, all[0].to - all[0].from); + assert!(d.hypot() > 1.0 && ((p - a).cross(d) / d.hypot()).abs() < 1e-6, "{p:?}: {all:?}"); + }; + let m = ellipse_map(100.0, 50.0, 40.0, 15.0, 30.0); + let oval = Outline::ellipse(m).unwrap(); + for k in 0..37 { + let a = 0.17 + k as f64 * TAU / 37.0; + one(m * Point::new(a.cos(), a.sin()), &oval); + } + // A closed Bézier circle, turned and moved: on each anchor and partway along each segment. + let turned = shapes::ellipse(Rect::new(-60.0, -60.0, 60.0, 60.0)).transformed(Affine::translate((37.3, -12.9)) * Affine::rotate(0.7)); + let sp = turned.subpaths[0].clone(); + let path = Outline::convex(&sp).unwrap(); + for an in sp.anchors.iter() { + one(an.p, &path); + } + for k in 0..sp.segment_count() { + for t in [0.21, 0.5, 0.83] { + one(sp.segment(k).eval(t), &path); + } + } + } + #[test] fn open_concave_empty_and_identical_outlines_are_refused() { let open = SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(10.0, 0.0), Point::new(10.0, 10.0)], false); From 5ed13b1249aad6914153ef892ae21402c1be54c9 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 10:20:55 +0530 Subject: [PATCH 113/158] M7/G4: retype keeps outlines whose paint type cannot take (#4934) Shapes with more than a basic appearance (several fills or strokes, effects, item transparency, brushes, width profiles, arrowheads) stay outlines. The stroke's caps, joins, miter limit, dashes and alignment carry over. A line's glyphs share one size and turn exactly, and a first glyph its line cannot draw is tried on its own. --- crates/engine/src/cmd/retype.rs | 37 +++++++++++++++++++-------- crates/engine/src/cmd/retype_tests.rs | 20 +++++++++++++++ 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index 2c19ae10a5..be7df50d95 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -58,8 +58,9 @@ struct Piece { /// The shape's own transparency, which the new type takes. opacity: f32, blend: vectorcraft_color::BlendMode, - /// The shape has an opacity mask of its own, which type cannot take: it stays an outline. - masked: bool, + /// The shape has what type cannot take (its own opacity mask, more than one fill or stroke, + /// effects, a brush, width profile or arrowheads): it stays an outline. + keeps_outline: bool, } /// The shapes in `n` (held by `parent`), in paint order. `barrier` is set when art that is not a @@ -79,7 +80,7 @@ fn collect(n: &Node, parent: Option, depth: usize, barrier: &mut bool, t appearance: (*n.appearance).clone(), opacity: n.opacity, blend: n.blend, - masked: n.extras().mask.is_some(), + keeps_outline: n.extras().mask.is_some() || !type_can_paint(&n.appearance), }; match &n.kind { NodeKind::Group { children, clip: false } => { @@ -107,6 +108,12 @@ fn collect(n: &Node, parent: Option, depth: usize, barrier: &mut bool, t } } +/// Can type's character style paint `ap` as it is: a basic appearance (at most one fill and one +/// stroke, no effects, no item opacity or blend), with a plain stroke? +fn type_can_paint(ap: &Appearance) -> bool { + ap.is_basic() && ap.stroke().is_none_or(|s| s.start_arrow.is_none() && s.end_arrow.is_none() && s.profile.is_none() && s.brush.is_none()) +} + /// The faces to match against: the families in `fonts`, the document's fonts, then every loaded face. fn candidate_faces(db: &FontDb, d: &Document, fonts: &[String]) -> Vec> { let mut families: Vec = fonts.iter().take(MAX_FONT_PARAMS).cloned().collect(); @@ -165,8 +172,9 @@ impl Line { && pc.opacity == self.opacity && pc.blend == self.blend && m.face.id() == self.face.id() - && (m.scale - self.scale).abs() <= self.scale * 0.005 - && (m.angle - self.angle).abs() < 1e-3 + // One size and turn for the whole line: the type sets every glyph at the first one's. + && (m.scale - self.scale).abs() <= self.scale * 1e-4 + && (m.angle - self.angle).abs() < 1e-5 && across < size * 0.05 && (m.origin - self.end).dot(dir) > -size * 0.25 } @@ -226,6 +234,14 @@ impl Line { stroke_width: self.appearance.stroke_width(), ..Default::default() }; + let mut style = style; + if let Some(st) = self.appearance.stroke() { + style.stroke_cap = st.cap; + style.stroke_join = st.join; + style.stroke_miter_limit = st.miter_limit; + style.stroke_dash = st.dash.clone(); + style.stroke_align = st.align; + } let mut t = TextObject::point(self.origin, &self.text, style); if self.angle != 0.0 { t.xf *= kurbo::Affine::rotate(self.angle); @@ -272,12 +288,13 @@ fn verified(lines: Vec, system_layout: bool, unmatched: &mut Vec) let n = l.pieces.len(); match l.first_mismatch(&l.text_object(system_layout)) { None => out.push(l), - Some(0) => { - unmatched.extend(l.pieces.first().copied()); - if let Some(rest) = l.part(1, n) { - todo.push_front(rest); + // The first glyph on its own may still be drawn as it was (a contextual form changed it). + Some(0) if n > 1 => { + for part in [l.part(1, n), l.part(0, 1)].into_iter().flatten() { + todo.push_front(part); } } + Some(0) => unmatched.extend(l.pieces.first().copied()), Some(k) => { for part in [l.part(k, n), l.part(0, k)].into_iter().flatten() { todo.push_front(part); @@ -346,7 +363,7 @@ fn retype(s: &mut Session, p: &Value) -> Result { return Err(EngineError::Other("Retype: select outlined text (paths or compound paths)".into())); } let index = RetypeIndex::build(db, candidate_faces(db, d, &fonts)); - let found: Vec> = pieces.iter().map(|pc| if pc.masked { vec![] } else { index.matches(&pc.path) }).collect(); + let found: Vec> = pieces.iter().map(|pc| if pc.keeps_outline { vec![] } else { index.matches(&pc.path) }).collect(); // The face most shapes match, so a glyph several fonts share is set in the same font as // the glyphs around it. let mut votes: Vec<(u32, usize)> = vec![]; diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 7f9cd7ac5d..4c331720a1 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -299,3 +299,23 @@ fn shapes_past_the_limits_are_reported_as_left_out() { assert_eq!(r["texts"], json!(["A"])); assert_eq!(r["truncated"], json!(true), "{r}"); } + +#[test] +fn a_glyph_painted_beyond_what_type_takes_stays_an_outline() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); + let a = children_of(&s, g)[0]; + s.edit("test", |d, _| { + let n = d.node_mut(NodeId(a)).unwrap(); + let mut ap = (*n.appearance).clone(); + let fill = ap.items.iter().find(|i| i.is_fill()).unwrap().clone(); + ap.items.push(fill); + n.appearance = ap.into(); + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["B"]), "two fills: A stays an outline: {r}"); + assert_eq!(r["unmatched"], json!([a])); +} From 7973b6254c8efdba139f2ddd40000b53732dca4e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 20:53:26 -0800 Subject: [PATCH 114/158] Keep precise-cursor regression meaningful --- crates/tools/src/draw2/gesture/tests.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index 9fe8f24d51..2d4dbf9400 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -3123,6 +3123,8 @@ fn bristle_tip_annotator_follows_a_rotation_capable_pen() { assert!(bounds(&newly_selected, &view).is_some(), "no selected path borrows Smooth yet"); assert_eq!(newly_selected.cursor(&selected_view, new_stroke.pos, new_stroke.mods), Cursor::Smooth); assert!(bounds(&newly_selected, &selected_view).is_none(), "post-commit selection also hides the tip"); + tool.pointer(&view, &at(Some(0.0))); + assert!(bounds(&tool, &view).is_some(), "a normal pen hover shows the tip before Precise Cursors hides it"); let precise = ToolContext { precise_cursors: true, ..cx(&d, &s, &p) }; assert!(bounds(&tool, &precise).is_none()); tool.pointer(&view, &at(Some(0.0)).with_mods(Mods { cmd: true, ..Default::default() })); From 1f704f2dc37a89613036763ba18f1df8fe69ad72 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 21:29:50 -0800 Subject: [PATCH 115/158] Palette: Find Next is listed, since a pick runs it as its menu item does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A pick of Edit › Find Next goes on from the last Find and Replace search or opens the dialog, so the palette lists it among the commands a pick still runs. --- crates/ui-egui/src/palette.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index b4e3190ee7..1af89b882a 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -40,8 +40,9 @@ const WRAPPED: &[(&str, &str)] = &[ /// selection's gradient matches, Pixel Snapping Options… /// opens its dialog, the three Asset Export commands open the Asset Export panel (#4864), New /// Symbol makes a symbol of the selection, Gradient Vector gives the selection the default -/// gradient, Define Perspective Grid makes the document's grid, and Select Slice deselects the -/// slices. +/// gradient, Define Perspective Grid makes the document's grid, Select Slice deselects the +/// slices, and Find Next goes on from the last Find and Replace search or opens its dialog, as +/// its menu item does. const PICK_RUNS: &[&str] = &[ "script.stop", "script.console.clear", @@ -65,6 +66,7 @@ const PICK_RUNS: &[&str] = &[ "paint.setGradientGeom", "perspective.grid.set", "object.slice.select", + "edit.findNext", ]; /// The menu path of a panel's result: a pick runs Show Panel (`window.panel`) for the panel. From dc9278118176c6c930e7693b6683bb5aaa1cb938 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 21:33:30 -0800 Subject: [PATCH 116/158] Part of #5590: Dimension tool lines line up with dimensions already drawn A linear dimension placed next to another one had its line exactly where the pointer was. Chained dimensions only lined up when the pointer hit the other line's level exactly, which at a normal zoom it rarely does. - With Smart Guides on, a linear dimension placed with its line within the Smart Guides snapping tolerance of the level of a parallel line of a visible, unlocked linear dimension already drawn has its line on that level. This applies to two clicked points and to a segment dragged out. - With Alignment Guides on, a guide runs along that level across both lines while the dimension is placed. - Smart Guides off, a level further off, a locked dimension or one that is not parallel leaves the line where the pointer puts it. Docs: docs/dimensions.md, docs/target-app-parity.md. --- crates/engine/tests/it/dimensions.rs | 85 ++++++++++++++++++++++++++++ crates/tools/src/dimension.rs | 64 ++++++++++++++++++++- docs/dimensions.md | 5 ++ docs/target-app-parity.md | 1 + 4 files changed, 154 insertions(+), 1 deletion(-) diff --git a/crates/engine/tests/it/dimensions.rs b/crates/engine/tests/it/dimensions.rs index 23bbdb0bee..75df307224 100644 --- a/crates/engine/tests/it/dimensions.rs +++ b/crates/engine/tests/it/dimensions.rs @@ -1933,6 +1933,91 @@ fn an_anchor_beside_a_drawn_dimension_takes_the_point() { assert_eq!(linear_marker(&mut s, zoomed, 125.5, 358.3), (Some((pt(126.0, 358.0), 10.0)), vec!["anchor".to_string()])); } +/// The Smart Guide lines a pointer move at (`x`, `y`) shows, as their ends. +fn guide_lines(s: &mut Session, view: ViewInfo, x: f64, y: f64) -> Vec<(vectorcraft_geom::Point, vectorcraft_geom::Point)> { + use vectorcraft_engine::tools::Overlay; + s.pointer(&PointerEvent::new(PointerKind::Move, x, y), view).unwrap(); + s.overlays(view).into_iter().filter_map(|o| if let Overlay::Line { a, b, .. } = o { Some((a, b)) } else { None }).collect() +} + +/// A dimension placed next to another, with its line within the Smart Guides snapping tolerance of +/// the level of the other's parallel line, has its line on that level, and an alignment guide +/// runs across both lines while it is placed. A level further off, Smart Guides off, a locked +/// dimension or one that is not parallel leaves the line where the pointer puts it. A dimension +/// dragged out from a segment lands on the level too. +#[test] +fn a_dimension_line_placed_beside_another_lands_on_its_level() { + let plain = ViewInfo::default(); + let off = ViewInfo { smart_guides: false, ..plain }; + let pt = vectorcraft_geom::Point::new; + // An edge with anchors at x 100, 200 and 300, and a dimension from 100 to 200 placed 30 points + // above it. + let start = |view: ViewInfo| { + let mut s = session(); + run(&mut s, "path.create", json!({"d": "M100 200 L200 200 L300 200 L300 300 L100 300 Z"})); + run(&mut s, "select.none", json!({})); + s.select_tool("dimension", view).unwrap(); + linear_click(&mut s, view, 100.0, 200.0); + linear_click(&mut s, view, 200.0, 200.0); + linear_click(&mut s, view, 150.0, 170.0); + let first = s.doc().unwrap().selection.objects[0].0; + assert_eq!(recipe(&s, first).line_ends(), (pt(100.0, 170.0), pt(200.0, 170.0))); + run(&mut s, "select.none", json!({})); + (s, first) + }; + // The next dimension, from 200 to 300, placed with the pointer at `y`: where its line lies. + let next = |s: &mut Session, view: ViewInfo, y: f64| { + linear_click(s, view, 200.0, 200.0); + linear_click(s, view, 300.0, 200.0); + linear_click(s, view, 250.0, y); + let id = s.doc().unwrap().selection.objects[0].0; + recipe(s, id).line_ends() + }; + // 2.5 points below the first line's level, and 3.5 above it: on the level. + for y in [172.5, 166.5] { + let (mut s, _) = start(plain); + assert_eq!(next(&mut s, plain, y), (pt(200.0, 170.0), pt(300.0, 170.0)), "pointer at y {y}"); + } + // While it is placed, one guide runs along the level from the first line's left end to the + // new line's right end. + let (mut s, _) = start(plain); + linear_click(&mut s, plain, 200.0, 200.0); + linear_click(&mut s, plain, 300.0, 200.0); + let guides = guide_lines(&mut s, plain, 250.0, 172.5); + assert!(guides.iter().any(|(a, b)| near(*a, pt(100.0, 170.0)) && near(*b, pt(300.0, 170.0))), "{guides:?}"); + assert!(guide_lines(&mut s, plain, 250.0, 180.0).is_empty(), "no guide off the level"); + // 10 points off: where the pointer is. + let (mut s, _) = start(plain); + assert_eq!(next(&mut s, plain, 180.0), (pt(200.0, 180.0), pt(300.0, 180.0))); + // Smart Guides off: where the pointer is. + let (mut s, _) = start(off); + assert_eq!(next(&mut s, off, 172.5), (pt(200.0, 172.5), pt(300.0, 172.5))); + // A locked dimension does not pull the line. + let (mut s, first) = start(plain); + run(&mut s, "select.set", json!({"ids":[first]})); + run(&mut s, "object.lock", json!({})); + assert_eq!(next(&mut s, plain, 172.5), (pt(200.0, 172.5), pt(300.0, 172.5))); + // A dimension of the right edge has a vertical line, which is not parallel to the first: the + // pointer 2.5 points below the first line's level places it where the pointer is. + let (mut s, _) = start(plain); + linear_click(&mut s, plain, 300.0, 200.0); + linear_click(&mut s, plain, 300.0, 300.0); + linear_click(&mut s, plain, 330.0, 172.5); + let id = s.doc().unwrap().selection.objects[0].0; + assert_eq!(recipe(&s, id).line_ends(), (pt(330.0, 200.0), pt(330.0, 300.0))); + // The bottom edge dragged out to 2 points below the level of the first line, 130 points + // above the edge: on the level. + let (mut s, _) = start(plain); + for (kind, y) in + [(PointerKind::Move, 300.0), (PointerKind::Down, 300.0), (PointerKind::Drag, 240.0), (PointerKind::Drag, 172.0), (PointerKind::Up, 172.0)] + { + s.pointer(&PointerEvent::new(kind, 160.0, y), plain).unwrap(); + } + let id = s.doc().unwrap().selection.objects[0].0; + let (a, b) = recipe(&s, id).line_ends(); + assert!(near(a, pt(300.0, 170.0)) && near(b, pt(100.0, 170.0)) || near(a, pt(100.0, 170.0)) && near(b, pt(300.0, 170.0)), "{a:?} {b:?}"); +} + /// The page content streams of exported PDF `v`, inflated. fn pdf_content(v: &Value) -> String { let bytes = vectorcraft_format::base64_decode(v["dataBase64"].as_str().unwrap()).unwrap(); diff --git a/crates/tools/src/dimension.rs b/crates/tools/src/dimension.rs index d78850e78e..79f316e14e 100644 --- a/crates/tools/src/dimension.rs +++ b/crates/tools/src/dimension.rs @@ -76,6 +76,9 @@ pub struct DimensionTool { /// for that click (a snap or Shift can move the point away from it): placed with the pointer /// still at either, it is aligned. second: Option<(Point, Point)>, + /// While a Linear dimension is placed with its line on the level of another dimension's line: + /// the ends of that other line. A Smart Guide runs along the level across both lines. + level_guide: Option<(Point, Point)>, } /// What a linear dimension between `a` and `b` measures with the pointer at `p` while it is @@ -285,6 +288,44 @@ fn on_dimensions(cx: &ToolContext, p: Point) -> Option<(Point, bool)> { best.end.map(|(_, q)| (q, true)).or_else(|| best.line.map(|(_, q)| (q, false))) } +/// Where the line of the linear dimension `d`, placed through `p`, lands on the level of the line +/// of a visible, unlocked linear dimension already drawn that runs parallel to it, within `reach` +/// of `p` across the line (the nearest level wins, then the nearest line): the point to place `d` +/// through, and the ends of that other line. A dimension that measures the same two points as `d` +/// is skipped, because the preview of `d` itself is one. Bounded work, as in [`on_dimensions`]. +fn line_level(cx: &ToolContext, d: &Dimension, p: Point, reach: f64) -> Option<(Point, (Point, Point))> { + type Best = Option<(f64, f64, f64, (Point, Point))>; + fn visit(n: &Node, d: &Dimension, p: Point, reach: f64, budget: &mut usize, best: &mut Best) { + if *budget == 0 || !n.visible || n.locked { + return; + } + *budget -= 1; + if let Some(other) = &n.extras().dimension { + let (u, normal) = (d.direction(), d.normal()); + if other.mode == DimensionMode::Linear && (other.a, other.b) != (d.a, d.b) && u.cross(other.direction()).abs() <= 1e-6 { + let ends = other.line_ends(); + let shift = (ends.0 - p).dot(normal); + let along = (ends.0 - p).dot(u).abs().min((ends.1 - p).dot(u).abs()); + if shift.is_finite() && shift.abs() <= reach && best.is_none_or(|(s, a, _, _)| (shift.abs(), along) < (s, a)) { + *best = Some((shift.abs(), along, shift, ends)); + } + } + return; + } + for c in n.children().into_iter().flatten().rev() { + visit(c, d, p, reach, budget, best); + } + } + if d.mode != DimensionMode::Linear { + return None; + } + let (mut budget, mut best) = (20_000usize, None); + for n in cx.doc.layers.iter().rev() { + visit(n, d, p, reach, &mut budget, &mut best); + } + best.map(|(_, _, shift, ends)| (p + d.normal() * shift, ends)) +} + /// The point of `edge` closest to `p`. fn nearest_on(cx: &ToolContext, edge: &SegmentRef, p: Point) -> Option { use vectorcraft_geom::kurbo::ParamCurveNearest; @@ -435,6 +476,7 @@ impl DimensionTool { p } fn preview(&mut self, cx: &ToolContext, p: Point) -> Vec { + self.level_guide = None; let Some(d) = &mut self.pending else { return vec![] }; if matches!(d.mode, DimensionMode::Radius | DimensionMode::Diameter) && let Some(Target::Radial { center, radius, .. }) = self.press.as_ref().and_then(|(_, t)| t.as_ref()) @@ -462,10 +504,14 @@ impl DimensionTool { if d.resolve(cx.doc).is_err() { return vec![]; } - d.place(p); + // With Smart Guides on, a linear dimension's line lands on the level of a parallel + // dimension line already drawn within the Smart Guides snapping tolerance. + let level = if cx.smart_guides { line_level(cx, d, p, cx.tol(cx.snapping_tolerance)) } else { None }; + d.place(level.map_or(p, |(on_level, _)| on_level)); if d.validate().is_err() { return vec![]; } + self.level_guide = level.map(|(_, ends)| ends); let mut actions = vec![]; if !self.began { actions.push(Action::Begin("Create Dimension".into())); @@ -495,6 +541,7 @@ impl DimensionTool { self.snap.clear(); self.snapped = None; self.second = None; + self.level_guide = None; } /// A plain click: picks a point or a line, or measures a circle's radius. fn click(&mut self, cx: &ToolContext, p: Point, target: Option, mods: Mods) -> Vec { @@ -734,6 +781,21 @@ impl Tool for DimensionTool { if linear_pick { out.extend(self.snap.guides().iter().cloned()); } + // A dimension line placed on the level of another: one alignment guide across both lines, + // unless Alignment Guides are off. + if cx.alignment_guides + && let (Some(d), Some((c, e))) = (&self.pending, self.level_guide) + { + let (a, b) = d.line_ends(); + let u = d.direction(); + let along = |q: &Point| q.to_vec2().dot(u); + let ends = [a, b, c, e]; + if let (Some(lo), Some(hi)) = + (ends.iter().min_by(|p, q| along(p).total_cmp(&along(q))), ends.iter().max_by(|p, q| along(p).total_cmp(&along(q)))) + { + out.push(Overlay::Line { a: *lo, b: *hi, color: cx.smart_guide_color, dashed: false }); + } + } out } } diff --git a/docs/dimensions.md b/docs/dimensions.md index 35e164d4f9..6f2d8ba18b 100644 --- a/docs/dimensions.md +++ b/docs/dimensions.md @@ -51,6 +51,11 @@ The **Dimension Tool** is in the Modify section of the toolbar. Its strip offers point as before. An unlinked dimension that turns has its line where the turn puts it, or, when that would put it between the points, as far past the outermost point as before. + With Smart Guides on, a linear dimension placed with its line within the Smart Guides snapping + tolerance of the level of a parallel line of a visible, unlocked linear dimension already drawn + has its line on that level, so chained dimensions line up. This is VectorCraft's own rule. With + Alignment Guides on, a guide runs along the level across both lines while the dimension is + placed. - **Angular:** hover a corner where two straight segments meet and drag outwards. Or click two straight lines that meet (or would, extended), then click to place. - **Radial:** hover a circle, or a segment that is a perfect arc, and drag: outwards gives its diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 1a4de32fa2..29622fdf1d 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -630,6 +630,7 @@ since 2026-10-01. **Drawing tools, Dimension tool points on a Smart Guide stay on the guide:** By VectorCraft's own rule, a clicked point that lies on a Smart Guide already, such as one in line with an object's center, stays where the pointer is when no anchor is within 8 pixels and no segment is within the Smart Guides snapping tolerance, instead of moving onto a segment farther than that tolerance and within 8 pixels; with Snap to Grid or Snap to Pixel on, a point stays on the grid or the whole pixel those options give. `a_point_on_a_guide_stays_on_the_guide` covers it. **Drawing tools, Dimension tool second point without construction guides through a first point off the anchors:** By VectorCraft's own rule, with Smart Guides on, the second Linear point does not snap to the construction guides through a first point that is not on an anchor, so a click beside a segment straight below such a first point lands on the segment; after a first point picked on an anchor, the construction guides through it still apply. The second point still snaps to anchors, centers and alignment lines, and with Snap to Perpendicular or Snap to Tangent on, it lands where the line from the first point meets a segment square or grazes a curve. `a_point_on_a_guide_stays_on_the_guide`, `the_second_point_after_an_anchor_lands_on_construction_guides`, `the_second_point_lands_square_to_a_segment_or_grazing_a_curve` and `linear_picks_show_and_snap_to_smart_guides` cover it. **Drawing tools, Dimension tool points land on dimensions already drawn (#8063):** By VectorCraft's own rule, with Smart Guides or Snap to Point on, a Linear point that no anchor of the art within 8 pixels takes lands on the end of a visible, unlocked dimension's dimension line, or on the far end of its extension line, within 8 pixels, and a point that nothing else places lands on the closest point of such a line within 8 pixels, so at any zoom a dimension can start where another one ends. The end of an extension line next to the point it measures does not pull points away from that anchor. With Smart Guides and Anchor/Path Labels on, a point on an anchor or line end shows the "anchor" label and a point on a segment or line shows the "path" label. `linear_picks_land_on_anchors_paths_and_drawn_dimensions` and `an_anchor_beside_a_drawn_dimension_takes_the_point` cover it. +**Drawing tools, Dimension tool lines line up with dimensions already drawn (#8063, #5590):** By VectorCraft's own rule, with Smart Guides on, a linear dimension placed with its line within the Smart Guides snapping tolerance of the level of a parallel line of a visible, unlocked linear dimension already drawn has its line on that level, and with Alignment Guides on a guide runs along the level across both lines while it is placed. `a_dimension_line_placed_beside_another_lands_on_its_level` covers it. **Drawing tools, Dimension tool dimensions selected with their art keep their lines and label:** Object › Expand, Object › Expand Appearance and Object › Path › Outline Stroke leave a dimension selected with art it measures, directly or in selected groups without fills, strokes or effects of their own, as it is and change only the other art; when the new art no longer fits its link, the dimension stays where it was, no longer linked, and undo links it again. `expand_leaves_a_dimension_selected_with_its_art_as_it_is`, `expand_appearance_leaves_a_dimension_selected_with_its_art_as_it_is`, `outline_stroke_leaves_a_dimension_selected_with_its_art_as_it_is`, `a_dimension_selected_with_art_that_has_nothing_to_expand_changes_nothing`, `a_group_effect_expanded_reaches_the_dimension_it_holds`, `expand_keeps_a_dimension_in_its_asset_and_its_variable_binding`, `a_dimension_keeps_no_link_to_the_art_expand_replaced`, `a_dimension_outlasts_the_art_outline_stroke_or_expand_appearance_replaced`, `a_dimension_outlasts_the_stroke_expand_outlined` and `expand_appearance_in_safe_mode_leaves_a_dimension_selected_with_its_art` cover it. **Drawing tools, Line Segment from one curve onto a common tangent of another:** By VectorCraft's own rule, with Smart Guides and Snap to Tangent on, a Line Segment drag pressed anywhere on a convex closed path with curves and dragged to within the snapping tolerance of another such path lands on a common tangent of the two ([tangent lines to circles](https://en.wikipedia.org/wiki/Tangent_lines_to_circles)): both ends move to where the line touches the paths, the start sliding along the first path, and each end shows the "tangent" label when Anchor/Path Labels is on, with the line drawn as a guide when Alignment Guides is on. The line is the tangent whose touch point on the second path is nearest the pointer, so moving the pointer around the second path switches between the outer tangent and the one crossing between the paths. The start stays where it was pressed when Shift, Alt or Space is held, when an anchor, center or crossing lies nearer the pointer than the second path does, when the press snapped to an anchor, center or crossing off the first path, when Snap to Tangent is off, when Snap to Grid or pixel snapping places drawn points, or when either path bends inward somewhere or has more than 512 segments. `a_line_from_one_circle_to_another_lands_on_their_common_tangent`, `a_line_from_a_turned_ellipse_lands_on_its_tangent_with_a_circle`, `a_line_near_the_second_path_takes_the_tangent_touching_it_nearest`, `a_line_keeps_its_start_without_a_tangent_snap`, `a_line_to_a_crescent_or_from_an_anchor_beside_the_curve_keeps_its_start` and `a_line_segment_drag_draws_the_common_tangent_as_one_undo_step` cover it. **Live trace result bounds and selection highlights exclude the retained bitmap except in source-image views:** `live_trace_result_bounds_exclude_the_retained_bitmap_at_any_angle` checks every TraceView, geometric and visual bounds and rotated result bounds. `live_trace_selection_highlight_excludes_the_retained_source_rectangle` checks result highlights and the existing ordinary-group policy. Shared editing-child traversal also preserves Shaper handling. From d4b1ff8f603fbdde4e33ff2bd6c456de777bfb83 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 21:53:34 -0800 Subject: [PATCH 117/158] Find and Replace: a dialog field of the wrong type is an error ui.paramDialog for edit.findReplace used to drop a field of the wrong type, such as a number for find, and open on the last search. It now returns an error and leaves the dialog closed. A null field still gives none, as the menu item's does. --- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/dialogs/find_replace.rs | 11 +++++++++-- .../ui-egui/src/dialogs/find_replace/tests.rs | 19 +++++++++++++++++++ crates/ui-egui/src/menus/ui_commands.rs | 2 +- docs/mcp.md | 3 ++- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 05116b02ec..25fb02285e 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -847,7 +847,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.paramDialog", "Command Dialog", "", - "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place, and Edit › Find Next goes on from it in the same document while the dialog is closed", + "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error), and Edit › Find Next goes on from it in the same document while the dialog is closed", ), ( "ui.recolorDialog", diff --git a/crates/ui-egui/src/dialogs/find_replace.rs b/crates/ui-egui/src/dialogs/find_replace.rs index a43e737e18..458b7a2184 100644 --- a/crates/ui-egui/src/dialogs/find_replace.rs +++ b/crates/ui-egui/src/dialogs/find_replace.rs @@ -79,8 +79,8 @@ fn active_uid(app: &VectorcraftApp) -> Option { } /// Open Find and Replace on the last search when there has been one, with the fields that -/// `params` gives in its place. A value of another type than the field's, such as the menu item's -/// null `find` ([`menu_params`]), gives none. +/// `params` gives in its place. A null value, such as the menu item's `find` ([`menu_params`]), +/// gives none. A field given a value of another type is an error, and the dialog does not open. pub fn open(app: &mut VectorcraftApp, params: &Map) -> Result { let mut fields = Map::new(); fields.insert("find".into(), json!("")); @@ -88,6 +88,13 @@ pub fn open(app: &mut VectorcraftApp, params: &Map) -> Result return Err(format!("`{k}` must be a string")), + Some(Value::Bool(_)) if !v.is_boolean() => return Err(format!("`{k}` must be true or false")), + _ => {} + } + } let last = app.ui.last_find.as_ref().and_then(Value::as_object).cloned().unwrap_or_default(); for (k, v) in last.iter().chain(params) { // Only the dialog's own fields, each of its own type. diff --git a/crates/ui-egui/src/dialogs/find_replace/tests.rs b/crates/ui-egui/src/dialogs/find_replace/tests.rs index a55e1c0085..e0e6031668 100644 --- a/crates/ui-egui/src/dialogs/find_replace/tests.rs +++ b/crates/ui-egui/src/dialogs/find_replace/tests.rs @@ -131,6 +131,25 @@ fn the_edit_menu_opens_the_find_and_replace_dialog() { } } +/// A field given a value of another type than its own is an error and the dialog does not open; a +/// null value gives no field. +#[test] +fn the_dialog_rejects_a_field_of_the_wrong_type() { + let (mut app, _) = app_with(&["cat"]); + let open = |app: &mut VectorcraftApp, params: Value| app.run("ui.paramDialog", json!({"command": super::COMMAND, "params": params})); + for (params, want) in [ + (json!({"find": 17}), "`find` must be a string"), + (json!({"replace": true}), "`replace` must be a string"), + (json!({"matchCase": "yes"}), "`matchCase` must be true or false"), + (json!({"backwards": 1}), "`backwards` must be true or false"), + ] { + assert_eq!(open(&mut app, params.clone()).unwrap_err(), want, "{params}"); + assert!(app.ui.dialog.is_none(), "{params}"); + } + open(&mut app, json!({"find": null, "replace": "dog", "wholeWord": true})).unwrap(); + assert_eq!((field(&app, "find"), field(&app, "replace"), field(&app, "wholeWord")), (json!(""), json!("dog"), json!(true))); +} + /// The dialog stays open from match to match: Find goes to the next match and selects its /// object, Replace changes that match, Replace & Find changes it and goes on, Replace All changes /// the rest, and Done closes. Each Replace is one undo step, and so is Replace All; finding and a diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 013f519f0c..b1db0a7f0e 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -848,7 +848,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.paramDialog", "Command Dialog", "", - "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place, and Edit › Find Next goes on from it in the same document while the dialog is closed", + "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error), and Edit › Find Next goes on from it in the same document while the dialog is closed", ), ( "ui.recolorDialog", diff --git a/docs/mcp.md b/docs/mcp.md index e367f19671..1d077aa478 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9996,7 +9996,8 @@ the options as they are now, and find one otherwise. Enter runs Find. Edit › F search while the dialog is closed, and opens the dialog when there has been none. A place the search reached in one document is not used in another, nor once the Find text or an option that decides a match changes: the search then starts again as it does without `from`. `ui.paramDialog` opens -the dialog on the last search, with the fields its `params` give in its place. +the dialog on the last search, with the fields its `params` give in its place. A null field gives none, and a field of +the wrong type is an error that leaves the dialog closed. ## Justification options From 783437f7754e7bc1084e52af6008e29c1c0fa08a Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 11:58:41 +0530 Subject: [PATCH 118/158] M7/G4: retype review: hidden art, compositing, half turns, cost (#4934) Hidden and locked shapes stay outlines and end the line. Isolated and knockout groups keep their type inside. Type turned 180 degrees stays one object (angles compared wrapped). A lone one-contour glyph beside other shapes stays an outline unless it is the only shape selected. The index samples only glyphs whose key (segments per contour) a selected shape has, reads outlines past the shared outline cache, keeps each face's keys once worked out, and loads no more faces than it takes. With Microsoft YaHei (29,905 glyphs) loaded: 877 ms the first time, 23 ms after. --- crates/engine/src/cmd/retype.rs | 44 +++++++++-- crates/engine/src/cmd/retype_tests.rs | 104 ++++++++++++++++++++++++-- crates/text/src/fontdb/lookup.rs | 12 +++ crates/text/src/retype.rs | 90 ++++++++++++++++++---- 4 files changed, 222 insertions(+), 28 deletions(-) diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index be7df50d95..28a74ac6a9 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -14,6 +14,7 @@ //! they are and are reported. Near matches (another version of the font, simplified outlines, //! merged glyphs) and images are phase 2. +use std::f64::consts::{PI, TAU}; use std::sync::Arc; use kurbo::{BezPath, Point, Vec2}; @@ -72,6 +73,11 @@ fn collect(n: &Node, parent: Option, depth: usize, barrier: &mut bool, t *truncated = true; return; } + // Hidden and locked art is left as it is: a hidden glyph must not come back as visible type. + if !n.visible || n.locked { + *barrier = true; + return; + } let piece = |path: BezPath, after_barrier: bool| Piece { id: n.id, parent, @@ -126,15 +132,20 @@ fn candidate_faces(db: &FontDb, d: &Document, fonts: &[String]) -> Vec= cap { + break 'families; + } if let Some(face) = db.face(f, &style) { faces.push(face); } } } - faces.extend(db.loaded_faces()); + faces.extend(db.loaded_faces().into_iter().take(cap.saturating_sub(faces.len()))); faces } @@ -174,7 +185,8 @@ impl Line { && m.face.id() == self.face.id() // One size and turn for the whole line: the type sets every glyph at the first one's. && (m.scale - self.scale).abs() <= self.scale * 1e-4 - && (m.angle - self.angle).abs() < 1e-5 + // Wrapped: type turned 180° has angles near +π and −π. + && ((m.angle - self.angle + PI).rem_euclid(TAU) - PI).abs() < 1e-5 && across < size * 0.05 && (m.origin - self.end).dot(dir) > -size * 0.25 } @@ -362,7 +374,11 @@ fn retype(s: &mut Session, p: &Value) -> Result { if pieces.is_empty() { return Err(EngineError::Other("Retype: select outlined text (paths or compound paths)".into())); } - let index = RetypeIndex::build(db, candidate_faces(db, d, &fonts)); + // Only glyphs with a selected shape's key (segments per contour) can match one: the others are + // not sampled. + let wanted: std::collections::BTreeSet> = + pieces.iter().filter(|pc| !pc.keeps_outline).filter_map(|pc| vectorcraft_text::retype::shape_key(&pc.path)).collect(); + let index = RetypeIndex::build(db, candidate_faces(db, d, &fonts), &wanted); let found: Vec> = pieces.iter().map(|pc| if pc.keeps_outline { vec![] } else { index.matches(&pc.path) }).collect(); // The face most shapes match, so a glyph several fonts share is set in the same font as // the glyphs around it. @@ -395,7 +411,19 @@ fn retype(s: &mut Session, p: &Value) -> Result { } open = true; } - let lines = verified(lines, system_layout, &mut unmatched); + let mut lines = verified(lines, system_layout, &mut unmatched); + // A lone one-contour glyph (a period, a hyphen, a bullet) is too plain to tell from drawn + // art (a dot, a bar): beside other shapes it stays an outline. Selected on its own, it is + // what was asked for. + if pieces.len() > 1 { + lines.retain(|l| { + let lone = matches!(l.matches.as_slice(), [m] if m.contours == 1); + if lone { + unmatched.extend(l.pieces.iter().copied()); + } + !lone + }); + } (lines, unmatched, truncated) }; if lines.is_empty() { @@ -434,7 +462,11 @@ fn retype(s: &mut Session, p: &Value) -> Result { && n.blend == vectorcraft_color::BlendMode::Normal && *n.appearance == Appearance::default() && n.name.is_none() - && n.extras().mask.is_none(); + && n.extras().mask.is_none() + // Isolation and knockout change how the group composites its type. + && !n.isolate + && n.knockout == vectorcraft_doc::Knockout::default() + && !n.knockout_shape; let only_type = children.iter().all(|c| ids.contains(&c.id)); if children.is_empty() { d.remove(g)?; diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 4c331720a1..cbbf1e0302 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -148,7 +148,7 @@ fn a_shape_between_glyphs_ends_the_line_so_paint_order_holds() { fn glyphs_of_different_groups_and_transparency_stay_apart() { let mut s = session(); let a = outlined(&mut s, json!({"x": 40, "y": 100, "text": "ab", "size": 20})); - let b = outlined(&mut s, json!({"x": 120, "y": 100, "text": "cd", "size": 20})); + let b = outlined(&mut s, json!({"x": 120, "y": 100, "text": "ed", "size": 20})); let first_d = children_of(&s, b)[1]; s.edit("test", |d, _| { d.node_mut(NodeId(b)).unwrap().opacity = 0.5; @@ -158,7 +158,7 @@ fn glyphs_of_different_groups_and_transparency_stay_apart() { .unwrap(); s.execute("select.set", &json!({"ids": [a, b]})).unwrap(); let r = s.execute("type.retype", &json!({})).unwrap(); - assert_eq!(r["texts"], json!(["ab", "c", "d"]), "same baseline, other group; d has its own opacity: {r}"); + assert_eq!(r["texts"], json!(["ab", "e", "d"]), "same baseline, other group; d has its own opacity: {r}"); let ids: Vec = r["ids"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect(); let d = &s.doc().unwrap().doc; assert!(d.node(NodeId(a)).is_none(), "a plain group gives way to its type"); @@ -232,11 +232,11 @@ fn live_type_selected_between_loose_glyphs_still_ends_the_line() { fn glyphs_selected_inside_groups_join_only_their_siblings() { let mut s = session(); let g1 = outlined(&mut s, json!({"x": 40, "y": 100, "text": "ab", "size": 20})); - let g2 = outlined(&mut s, json!({"x": 70, "y": 100, "text": "cd", "size": 20})); + let g2 = outlined(&mut s, json!({"x": 70, "y": 100, "text": "ed", "size": 20})); let (a, b, c) = (children_of(&s, g1)[0], children_of(&s, g1)[1], children_of(&s, g2)[0]); s.execute("select.set", &json!({"ids": [a, b, c]})).unwrap(); let r = s.execute("type.retype", &json!({})).unwrap(); - assert_eq!(r["texts"], json!(["ab", "c"]), "a and b are siblings; c is in another group: {r}"); + assert_eq!(r["texts"], json!(["ab", "e"]), "a and b are siblings; e is in another group: {r}"); let d = &s.doc().unwrap().doc; assert!(d.node(NodeId(g2)).is_some(), "d's group stays with c's type and d in it"); } @@ -244,7 +244,7 @@ fn glyphs_selected_inside_groups_join_only_their_siblings() { #[test] fn tracked_type_splits_where_its_spacing_cannot_be_set_again() { let mut s = session(); - let id = s.execute("text.create", &json!({"x": 40, "y": 100, "text": "abc", "size": 30})).unwrap()["id"].as_u64().unwrap(); + let id = s.execute("text.create", &json!({"x": 40, "y": 100, "text": "abe", "size": 30})).unwrap()["id"].as_u64().unwrap(); // Less than half a space: no whole number of spaces makes up the gap (0.4 em would be two // spaces in this font, and the outlines cannot tell those apart from tracking). s.execute("text.setRangeStyle", &json!({"id": id, "start": 1, "end": 3, "tracking": 50})).unwrap(); @@ -253,7 +253,7 @@ fn tracked_type_splits_where_its_spacing_cannot_be_set_again() { s.execute("select.set", &json!({"ids": [g]})).unwrap(); let r = s.execute("type.retype", &json!({})).unwrap(); let texts: Vec = r["texts"].as_array().unwrap().iter().map(|t| t.as_str().unwrap().to_owned()).collect(); - assert_eq!(texts.concat(), "abc", "{r}"); + assert_eq!(texts.concat(), "abe", "{r}"); assert!(texts.len() > 1, "the tracked glyphs are set where the outlines are, not where untracked type puts them: {r}"); assert_eq!(r["unmatched"], json!([])); } @@ -319,3 +319,95 @@ fn a_glyph_painted_beyond_what_type_takes_stays_an_outline() { assert_eq!(r["texts"], json!(["B"]), "two fills: A stays an outline: {r}"); assert_eq!(r["unmatched"], json!([a])); } + +#[test] +fn a_hidden_or_locked_glyph_stays_an_outline() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "ABD", "size": 40})); + let k = children_of(&s, g); + s.edit("test", |d, _| { + d.node_mut(NodeId(k[0])).unwrap().visible = false; + d.node_mut(NodeId(k[2])).unwrap().locked = true; + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["B"]), "{r}"); + let d = &s.doc().unwrap().doc; + assert!(!d.node(NodeId(k[0])).unwrap().visible, "A stays a hidden outline"); + assert!(d.node(NodeId(k[2])).unwrap().locked, "D stays a locked outline"); +} + +#[test] +fn an_isolated_or_knockout_group_keeps_its_type_inside() { + for knock in [false, true] { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); + s.edit("test", |d, _| { + let n = d.node_mut(NodeId(g)).unwrap(); + if knock { + n.knockout = vectorcraft_doc::Knockout::On; + } else { + n.isolate = true; + } + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + let id = r["ids"][0].as_u64().unwrap(); + assert_eq!(children_of(&s, g), vec![id], "knockout {knock}: the group stays, holding the type"); + } +} + +#[test] +fn type_turned_half_round_stays_one_object() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 300, "y": 200, "text": "Upside", "size": 30, "rotation": 180})); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["Upside"]), "{r}"); +} + +#[test] +fn a_drawn_dot_or_bar_beside_type_stays_art() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); + let dot = s.execute("shape.ellipse", &json!({"x": 300, "y": 60, "width": 8, "height": 8})).unwrap()["id"].as_u64().unwrap(); + // A bar that is exactly a hyphen of the font, somewhere else: the worst case. + let bar = outlined(&mut s, json!({"x": 200, "y": 300, "text": "-", "size": 50})); + s.execute("select.set", &json!({"ids": [g, dot, bar]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["AB"]), "{r}"); + let un = r["unmatched"].as_array().unwrap(); + assert!(un.contains(&json!(dot)) && un.len() == 2, "the dot and the bar stay art: {r}"); + // Selected on its own, the hyphen is what was asked for. + s.execute("select.set", &json!({"ids": [bar]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["-"]), "{r}"); +} + +/// How long Retype takes with a large CJK face to match against (run with `--ignored +/// --nocapture`; skips when no such face is installed). Not a pass/fail budget: it prints. +#[test] +#[ignore = "timing: needs an installed CJK font"] +fn timing_with_a_large_cjk_face() { + let db = vectorcraft_text::FontDb::global(); + let Some(family) = ["Microsoft YaHei", "Yu Gothic", "MS Gothic", "Noto Sans CJK JP", "Hiragino Sans"].into_iter().find(|f| db.has_family(f)) + else { + eprintln!("skipped: no large CJK font installed"); + return; + }; + let face = db.resolve(family, "Regular").map(|(f, _)| f).unwrap(); + let mut s = session(); + let g = outlined(&mut s, json!({"x": 20, "y": 80, "text": "漢字のテスト ABC", "size": 24, "font": family, "style": face.style})); + for run in ["cold", "warm"] { + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let t0 = std::time::Instant::now(); + let r = s.execute("type.retype", &json!({"fonts": [family]})).unwrap(); + let ms = t0.elapsed().as_secs_f64() * 1000.0; + eprintln!("{run}: Retype with {family} ({} encoded glyphs) loaded: {ms:.0} ms → {}", face.mapped_chars().len(), r["texts"]); + s.execute("edit.undo", &json!({})).unwrap(); + } +} diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index ef394cb079..99844220f5 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -675,6 +675,18 @@ impl FontDb { p } + /// [`Self::outline`] without the cache: for reading many glyphs once (Retype's index), which + /// would otherwise push out the outlines the canvas keeps there. + pub fn outline_uncached(&self, face: &FontFace, gid: u32) -> BezPath { + let mut pen = FlipPen(BezPath::new()); + if let Some(f) = face.skrifa() + && let Some(g) = f.outline_glyphs().get(GlyphId::new(gid)) + { + let _ = g.draw(DrawSettings::unhinted(Size::unscaled(), face.location()), &mut pen); + } + pen.0 + } + /// Glyph `gid`'s colour bitmap (`sbix`, `CBDT`) in `face`, cached per (face, glyph). pub fn glyph_image(&self, face: &FontFace, gid: u32) -> Option> { if !face.colour_bitmaps { diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs index c014951008..30a640c3c7 100644 --- a/crates/text/src/retype.rs +++ b/crates/text/src/retype.rs @@ -49,6 +49,8 @@ pub struct GlyphMatch { pub origin: Point, /// The leftover distance, relative to the shape's spread. pub residual: f64, + /// How many contours the glyph has. + pub contours: usize, } /// A shape reduced for matching: points along each contour, centred. @@ -79,8 +81,11 @@ pub struct RetypeIndex { } impl RetypeIndex { - /// Index the outline glyphs of `faces` (the first [`MAX_FACES`], each face once). - pub fn build(db: &FontDb, faces: impl IntoIterator>) -> Self { + /// Index the outline glyphs of `faces` (the first [`MAX_FACES`], each face once) that have one + /// of the shape keys in `keys` (the selected shapes' [`shape_key`]s): the others could match no + /// shape, so they are not sampled. Outlines are read past the shared outline + /// cache, which keeps the canvas's glyphs. + pub fn build(db: &FontDb, faces: impl IntoIterator>, keys: &std::collections::BTreeSet>) -> Self { let mut kept: Vec> = vec![]; for f in faces { if kept.len() >= MAX_FACES { @@ -95,22 +100,16 @@ impl RetypeIndex { if entries.len() >= MAX_GLYPHS { break; } - // One entry per glyph, under the lowest character that maps to it. - let mut by_gid: HashMap = HashMap::new(); - for &(c, gid) in face.mapped_chars().iter().take(MAX_GLYPHS_PER_FACE) { - if c.is_whitespace() || c.is_control() || is_shape_symbol(c) { - continue; - } - by_gid.entry(gid).and_modify(|e| *e = (*e).min(c)).or_insert(c); - } - let mut gids: Vec<(u32, char)> = by_gid.into_iter().collect(); - gids.sort_unstable(); - for (gid, ch) in gids { - // The budget holds inside a face too: no glyph is loaded past it. + for (gid, ch, key) in face_keys(db, face).iter() { + // The budget holds inside a face too: no glyph is sampled past it. if entries.len() >= MAX_GLYPHS { break; } - let outline = db.outline(face, gid); + if !keys.contains(key) { + continue; + } + let (gid, ch) = (*gid, *ch); + let outline = db.outline_uncached(face, gid); if let Some(sig) = signature(&outline) { entries.push(Entry { face: fi, gid, ch, sig }); } @@ -165,7 +164,16 @@ impl RetypeIndex { // The glyph's origin is (0, 0) in font units: it lands at centre − z·glyph centre. let gc = mul(z, e.sig.centre); let origin = Point::new(sig.centre.x - gc.x, sig.centre.y - gc.y); - let m = GlyphMatch { face: face.clone(), gid: e.gid, ch: e.ch, scale: z.0.hypot(z.1), angle: z.1.atan2(z.0), origin, residual }; + let m = GlyphMatch { + face: face.clone(), + gid: e.gid, + ch: e.ch, + scale: z.0.hypot(z.1), + angle: z.1.atan2(z.0), + origin, + residual, + contours: e.sig.contours, + }; match best.get(&e.face) { Some(b) if b.residual < m.residual || (b.residual == m.residual && b.ch <= m.ch) => {} _ => { @@ -179,6 +187,41 @@ impl RetypeIndex { } } +/// A face's glyphs as the index looks them up: (glyph, character, [`shape_key`]), one per glyph +/// under the lowest character that maps to it. +type FaceKeys = Arc)>>; + +/// How many faces' keys [`face_keys`] keeps. +const KEPT_FACE_KEYS: usize = 32; + +/// [`FaceKeys`] of `face`, worked out once per face (each glyph drawn once, past the outline +/// cache) and kept: a later Retype samples only the glyphs whose key a selected shape has. +fn face_keys(db: &FontDb, face: &FontFace) -> FaceKeys { + type Kept = std::sync::Mutex>; + static KEPT: std::sync::OnceLock = std::sync::OnceLock::new(); + let kept = KEPT.get_or_init(Default::default); + let at = (db.id(), face.id()); + if let Some(k) = kept.lock().unwrap_or_else(|e| e.into_inner()).get(&at) { + return k.clone(); + } + let mut by_gid: HashMap = HashMap::new(); + for &(c, gid) in face.mapped_chars().iter().take(MAX_GLYPHS_PER_FACE) { + if c.is_whitespace() || c.is_control() || is_shape_symbol(c) { + continue; + } + by_gid.entry(gid).and_modify(|e| *e = (*e).min(c)).or_insert(c); + } + let mut gids: Vec<(u32, char)> = by_gid.into_iter().collect(); + gids.sort_unstable(); + let keys: FaceKeys = Arc::new(gids.into_iter().filter_map(|(gid, ch)| Some((gid, ch, shape_key(&db.outline_uncached(face, gid))?))).collect()); + let mut kept = kept.lock().unwrap_or_else(|e| e.into_inner()); + if kept.len() >= KEPT_FACE_KEYS { + kept.clear(); + } + kept.insert(at, keys.clone()); + keys +} + /// Characters whose glyphs are plain shapes (box drawing, blocks, geometric shapes, legacy /// computing symbols) or a font's own icons (private use): a drawn rectangle or circle is the same /// shape as one of them, so matching them would turn art into text. They are not matched. @@ -266,6 +309,21 @@ fn contours(path: &BezPath) -> Option>> { (out.len() <= MAX_CONTOURS).then_some(out) } +/// How many contours with length `path` has, as matching counts them; `None` past the size caps. +/// A cheap key two shapes share when one is the other scaled, turned and moved: how many segments +/// each of its contours has, in order (segments that go nowhere left out, a closing line counted +/// once whether the path draws it or closes onto it). Glyphs whose key no selected shape has are +/// not sampled. `None` past the size caps. +pub fn shape_key(path: &BezPath) -> Option> { + let moves = |s: &PathSeg| match s { + PathSeg::Line(l) => l.p0 != l.p1, + PathSeg::Quad(q) => q.p0 != q.p1 || q.p1 != q.p2, + PathSeg::Cubic(c) => c.p0 != c.p1 || c.p1 != c.p2 || c.p2 != c.p3, + }; + let key: Vec = contours(path)?.iter().map(|c| c.iter().filter(|s| moves(s)).count()).filter(|n| *n > 0).collect(); + (!key.is_empty()).then_some(key) +} + fn signature(path: &BezPath) -> Option { let bounds = path.bounding_box(); let size = bounds.width().hypot(bounds.height()); From 2275ca2fe00c5ec2a50804fa873a4fabb1ddfe7d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 22:36:13 -0800 Subject: [PATCH 119/158] Find and Replace: confirming with a field of the wrong type runs no action ui.dialog.confirm used to read a replace that is not a string as empty text, so Replace All could delete every match, and a switch that is not true or false as off. It now returns the error, which shows under the match found, and runs nothing; the match stays for Replace once the field is set right. --- crates/mcp/src/ui_catalog.rs | 2 +- crates/ui-egui/src/dialogs/find_replace.rs | 36 ++++++++++++++----- .../ui-egui/src/dialogs/find_replace/tests.rs | 30 ++++++++++++++-- crates/ui-egui/src/menus/ui_commands.rs | 2 +- docs/mcp.md | 3 +- 5 files changed, 58 insertions(+), 15 deletions(-) diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index 25fb02285e..43ead3f6c2 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -847,7 +847,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.paramDialog", "Command Dialog", "", - "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error), and Edit › Find Next goes on from it in the same document while the dialog is closed", + "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error, and ui.dialog.confirm then runs no action), and Edit › Find Next goes on from it in the same document while the dialog is closed", ), ( "ui.recolorDialog", diff --git a/crates/ui-egui/src/dialogs/find_replace.rs b/crates/ui-egui/src/dialogs/find_replace.rs index 458b7a2184..523586d1a9 100644 --- a/crates/ui-egui/src/dialogs/find_replace.rs +++ b/crates/ui-egui/src/dialogs/find_replace.rs @@ -88,13 +88,7 @@ pub fn open(app: &mut VectorcraftApp, params: &Map) -> Result return Err(format!("`{k}` must be a string")), - Some(Value::Bool(_)) if !v.is_boolean() => return Err(format!("`{k}` must be true or false")), - _ => {} - } - } + check_types(params, true)?; let last = app.ui.last_find.as_ref().and_then(Value::as_object).cloned().unwrap_or_default(); for (k, v) in last.iter().chain(params) { // Only the dialog's own fields, each of its own type. @@ -115,6 +109,21 @@ pub fn open(app: &mut VectorcraftApp, params: &Map) -> Result, null_gives_none: bool) -> Result<(), String> { + for (k, v) in fields.iter().filter(|(_, v)| !(null_gives_none && v.is_null())) { + if matches!(k.as_str(), "find" | "replace") && !v.is_string() { + return Err(format!("`{k}` must be a string")); + } + if (k == "backwards" || SWITCHES.contains(&k.as_str())) && !v.is_boolean() { + return Err(format!("`{k}` must be true or false")); + } + } + Ok(()) +} + /// Edit › Find Next with no text to find: the next match of the last search, from the place it /// reached, with the options the dialog had. With no search yet, it opens the dialog. pub fn find_next(app: &mut VectorcraftApp) -> Result { @@ -249,10 +258,17 @@ fn replace_all(app: &mut VectorcraftApp, d: &mut Dialog) -> Result Result { let mut d = d.clone(); let action = d.fields.insert("action".into(), json!("find")).and_then(|a| a.as_str().map(str::to_string)).unwrap_or_default(); + if let Err(e) = check_types(&d.fields, false) { + d.fields.insert(NOTE.into(), json!(e)); + app.ui.dialog = Some(d); + return Err(e); + } let r = match action.as_str() { "done" => { remember(app, &d); @@ -345,7 +361,9 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> DialogAc ui.colored_label(t.text_strong, egui::RichText::new(hit).strong().underline()); widgets::dim_name(ui, &after); }); - } else if let Some(note) = d.fields.get(NOTE).and_then(Value::as_str) { + } + // Find and Replace remove the note, so it shows under a match only when an action was refused. + if let Some(note) = d.fields.get(NOTE).and_then(Value::as_str) { widgets::dim_name(ui, &crate::i18n::message(crate::i18n::current(), note)); } // Enter finds, as the Find button does. diff --git a/crates/ui-egui/src/dialogs/find_replace/tests.rs b/crates/ui-egui/src/dialogs/find_replace/tests.rs index e0e6031668..0e38820877 100644 --- a/crates/ui-egui/src/dialogs/find_replace/tests.rs +++ b/crates/ui-egui/src/dialogs/find_replace/tests.rs @@ -132,10 +132,34 @@ fn the_edit_menu_opens_the_find_and_replace_dialog() { } /// A field given a value of another type than its own is an error and the dialog does not open; a -/// null value gives no field. +/// null value gives no field. A field set to such a value once the dialog is open runs no action: +/// the error is the note, shown under the match found, and the text, the match and the last search +/// stay as they were. #[test] fn the_dialog_rejects_a_field_of_the_wrong_type() { - let (mut app, _) = app_with(&["cat"]); + let (mut app, ids) = app_with(&["cat"]); + choose(&mut app); + set(&mut app, "find", json!("cat")); + crate::dialogs::confirm(&mut app).unwrap(); + let last = app.ui.last_find.clone(); + for (k, v, want) in [ + ("replace", json!(5), "`replace` must be a string"), + ("replace", Value::Null, "`replace` must be a string"), + ("matchCase", json!("yes"), "`matchCase` must be true or false"), + ] { + set(&mut app, k, v.clone()); + set(&mut app, "action", json!("replaceAll")); + assert_eq!(crate::dialogs::confirm(&mut app).unwrap_err(), want, "{k}: {v}"); + assert_eq!((plain(&app, ids[0]), field(&app, "__note"), app.ui.last_find.clone()), ("cat".to_string(), json!(want), last.clone())); + assert_eq!(matched(&app), Some((ids[0], 0, 3)), "Replace still changes the match found"); + let ctx = context(); + frame(&mut app, &ctx, vec![]); + let texts: Vec = frame(&mut app, &ctx, vec![]).into_iter().map(|(t, _)| t).collect(); + assert!(texts.iter().any(|t| t == want) && texts.iter().any(|t| t == "cat"), "the note shows under the match: {texts:?}"); + set(&mut app, k, if k == "replace" { json!("dog") } else { json!(false) }); + } + set(&mut app, "action", json!("done")); + crate::dialogs::confirm(&mut app).unwrap(); let open = |app: &mut VectorcraftApp, params: Value| app.run("ui.paramDialog", json!({"command": super::COMMAND, "params": params})); for (params, want) in [ (json!({"find": 17}), "`find` must be a string"), @@ -147,7 +171,7 @@ fn the_dialog_rejects_a_field_of_the_wrong_type() { assert!(app.ui.dialog.is_none(), "{params}"); } open(&mut app, json!({"find": null, "replace": "dog", "wholeWord": true})).unwrap(); - assert_eq!((field(&app, "find"), field(&app, "replace"), field(&app, "wholeWord")), (json!(""), json!("dog"), json!(true))); + assert_eq!((field(&app, "find"), field(&app, "replace"), field(&app, "wholeWord")), (json!("cat"), json!("dog"), json!(true))); } /// The dialog stays open from match to match: Find goes to the next match and selects its diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index b1db0a7f0e..4408654daa 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -848,7 +848,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.paramDialog", "Command Dialog", "", - "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error), and Edit › Find Next goes on from it in the same document while the dialog is closed", + "{command, label?, params} open a parameter dialog for any command. For edit.findReplace it opens Find and Replace (dialog `findReplace`), which stays open: fields find, replace, matchCase, wholeWord, backwards, hiddenLayers, lockedLayers, and action, which ui.dialog.confirm runs: find (the next match, edit.findNext, shown in the dialog with its place among the matches), replace (the match found, edit.replaceMatch), replaceFind (both), replaceAll (edit.findReplace) or done (close). After each one action is find again. Replace and Replace & Find change a match that find reached with the find text and options as they are now, and find one otherwise. The dialog opens on the last search, with the fields params gives in its place (a null field gives none; a field of the wrong type is an error, and ui.dialog.confirm then runs no action), and Edit › Find Next goes on from it in the same document while the dialog is closed", ), ( "ui.recolorDialog", diff --git a/docs/mcp.md b/docs/mcp.md index 1d077aa478..accd19856e 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9997,7 +9997,8 @@ search while the dialog is closed, and opens the dialog when there has been none document is not used in another, nor once the Find text or an option that decides a match changes: the search then starts again as it does without `from`. `ui.paramDialog` opens the dialog on the last search, with the fields its `params` give in its place. A null field gives none, and a field of -the wrong type is an error that leaves the dialog closed. +the wrong type is an error that leaves the dialog closed. Once it is open, `ui.dialog.confirm` with a field of the +wrong type runs no action and returns the error. ## Justification options From 1d9ba0dc0a79d981efd99d0b32446c9a8552fef1 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 22:39:13 -0800 Subject: [PATCH 120/158] Path Precision Tools: state when a point counts as on the outline A point counts as on the path's outline when it is less than the touching tolerance from it, with its distance from the path's center in place of the distance between centers. The params text, docs/mcp.md and the progress doc now say so, and say that every Tangents choice in the dialog gives the same lines for a point. Tests: a point half the tolerance inside and outside a circle gets the one line there, and farther off gets none or two; a point placed on a turned outline gets a line as long as the outline is wide along it; the dialog previews the same two lines for every Tangents choice and keeps them as one step, and a point inside changes nothing and says why. --- .../src/cmd/addons/pathtools/tangents.rs | 2 +- .../pathops/src/addons/pathtools/tangents.rs | 37 ++++++++++++---- crates/ui-egui/src/addons/pathtools/tests.rs | 42 +++++++++++++++++++ docs/mcp.md | 16 +++---- docs/target-app-parity.md | 2 +- 5 files changed, 83 insertions(+), 16 deletions(-) diff --git a/crates/engine/src/cmd/addons/pathtools/tangents.rs b/crates/engine/src/cmd/addons/pathtools/tangents.rs index 1625bbe2e7..e45e736109 100644 --- a/crates/engine/src/cmd/addons/pathtools/tangents.rs +++ b/crates/engine/src/cmd/addons/pathtools/tangents.rs @@ -31,7 +31,7 @@ pub(super) fn specs() -> Vec { "Common Tangents", ["Object", "Plug-ins", "Path Precision Tools"], None, - "{tangents?: \"external\" (both paths on the same side of each line) | \"internal\" (the lines that run between them) | \"all\" (\"all\"), centerline?: bool (false: true also adds the line joining the two centers, an ellipse's center or a path's center of area), ids?: [id, id] (default: the selection)} add the common tangent lines of two convex closed paths as separate open paths, each from where it touches the first path to where it touches the second (the whole stretch where a straight side lies along it), stroked with the current stroke color and weight (black when the stroke is None) and unfilled, directly above the upper of the two, as one undo step; the new lines are selected. An ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse; any other path must be closed, have one outline, bend the same way all around and have at most 10000 segments. Separate paths have two external and two internal tangents; overlapping paths only external ones; one path inside the other has none. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it; paths that meet at a corner or along a shared stretch of outline get one such line, at the middle of the directions that touch both. Paths count as touching when the gap between them is less than a billionth of the larger of their sizes and the distance between their centers. One of the two may be a point (a path of one anchor): the lines then run from the point to where they touch the path, two when the point lies outside it (one that lies along a straight side covers the whole side), one when the point lies on its outline (centered on the point and as long as the path is wide along it, or the whole straight side the point lies on), none when it lies inside; every `tangents` value gives the same lines, counted as internal when `tangents` is \"internal\" and as external otherwise, and the centerline runs from the point to the path's center; two points are refused. When there is no tangent of the kind asked for, nothing changes and the result has a `warning` → {ids, external, internal, centerline (its id or null), warning?}", + "{tangents?: \"external\" (both paths on the same side of each line) | \"internal\" (the lines that run between them) | \"all\" (\"all\"), centerline?: bool (false: true also adds the line joining the two centers, an ellipse's center or a path's center of area), ids?: [id, id] (default: the selection)} add the common tangent lines of two convex closed paths as separate open paths, each from where it touches the first path to where it touches the second (the whole stretch where a straight side lies along it), stroked with the current stroke color and weight (black when the stroke is None) and unfilled, directly above the upper of the two, as one undo step; the new lines are selected. An ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse; any other path must be closed, have one outline, bend the same way all around and have at most 10000 segments. Separate paths have two external and two internal tangents; overlapping paths only external ones; one path inside the other has none. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it; paths that meet at a corner or along a shared stretch of outline get one such line, at the middle of the directions that touch both. Paths count as touching when the gap between them is less than a billionth of the larger of their sizes and the distance between their centers. One of the two may be a point (a path of one anchor): the lines then run from the point to where they touch the path, two when the point lies outside it (one that lies along a straight side covers the whole side), one when the point lies on its outline, that is, less than the touching tolerance from it, with the point's distance from the path's center in place of the distance between centers (centered on the point and as long as the path is wide along it, or the whole straight side the point lies on), none when it lies inside; every `tangents` value gives the same lines, counted as internal when `tangents` is \"internal\" and as external otherwise, and the centerline runs from the point to the path's center; two points are refused. When there is no tangent of the kind asked for, nothing changes and the result has a `warning` → {ids, external, internal, centerline (its id or null), warning?}", has_selection, common_tangents )] diff --git a/crates/pathops/src/addons/pathtools/tangents.rs b/crates/pathops/src/addons/pathtools/tangents.rs index 0a1b6ef715..655e84e311 100644 --- a/crates/pathops/src/addons/pathtools/tangents.rs +++ b/crates/pathops/src/addons/pathtools/tangents.rs @@ -1084,34 +1084,57 @@ mod tests { #[test] fn a_point_placed_on_a_turned_outline_has_one_tangent() { // A point worked out on the outline lies a rounding error inside or outside it, and still - // gets the one line there. - let one = |p: Point, o: &Outline| { + // gets the one line there, as long as the outline is wide along it. + let one = |p: Point, o: &Outline, samples: &[Point]| { let all = common_tangents(&Outline::point(p).unwrap(), o).unwrap(); assert_eq!(all.len(), 1, "{p:?}: {all:?}"); // The line runs through the point. let (a, d) = (all[0].from, all[0].to - all[0].from); assert!(d.hypot() > 1.0 && ((p - a).cross(d) / d.hypot()).abs() < 1e-6, "{p:?}: {all:?}"); + // Its length is the outline's width along it, measured on dense samples. + let u = d / d.hypot(); + let (lo, hi) = samples.iter().map(|s| s.to_vec2().dot(u)).fold((f64::MAX, f64::MIN), |(lo, hi), v| (lo.min(v), hi.max(v))); + assert!((d.hypot() - (hi - lo)).abs() < 1e-3, "{p:?}: {} against {}", d.hypot(), hi - lo); }; let m = ellipse_map(100.0, 50.0, 40.0, 15.0, 30.0); - let oval = Outline::ellipse(m).unwrap(); + let (oval, oval_samples) = (Outline::ellipse(m).unwrap(), sample_ellipse(m, 20_000)); for k in 0..37 { let a = 0.17 + k as f64 * TAU / 37.0; - one(m * Point::new(a.cos(), a.sin()), &oval); + one(m * Point::new(a.cos(), a.sin()), &oval, &oval_samples); } // A closed Bézier circle, turned and moved: on each anchor and partway along each segment. let turned = shapes::ellipse(Rect::new(-60.0, -60.0, 60.0, 60.0)).transformed(Affine::translate((37.3, -12.9)) * Affine::rotate(0.7)); let sp = turned.subpaths[0].clone(); - let path = Outline::convex(&sp).unwrap(); + let (path, path_samples) = (Outline::convex(&sp).unwrap(), sample_path(&sp, 5_000)); for an in sp.anchors.iter() { - one(an.p, &path); + one(an.p, &path, &path_samples); } for k in 0..sp.segment_count() { for t in [0.21, 0.5, 0.83] { - one(sp.segment(k).eval(t), &path); + one(sp.segment(k).eval(t), &path, &path_samples); } } } + #[test] + fn a_point_within_the_touching_tolerance_counts_as_on_the_outline() { + // The tolerance is a billionth of the larger of the circle's size and the point's distance + // from its center: closer than that, inside or outside, the point gets the one line there. + let round = circle(0.0, 0.0, 10.0); + let tol = 1e-9 * round.size().max(10.0); + let at = |dx: f64| common_tangents(&Outline::point(Point::new(10.0 + dx, 0.0)).unwrap(), &round).unwrap(); + for dx in [-0.5 * tol, 0.5 * tol] { + let on = at(dx); + assert_eq!(on.len(), 1, "{dx}: {on:?}"); + assert!(ends_within(&on[0], Point::new(10.0, -10.0), Point::new(10.0, 10.0), 1e-5), "{dx}: {on:?}"); + } + // Farther than that, a point inside gets none and a point outside gets two. + assert!(at(-100.0 * tol).is_empty()); + assert_eq!(at(100.0 * tol).len(), 2); + assert!(at(-1e-6).is_empty()); + assert_eq!(at(1e-6).len(), 2); + } + #[test] fn open_concave_empty_and_identical_outlines_are_refused() { let open = SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(10.0, 0.0), Point::new(10.0, 10.0)], false); diff --git a/crates/ui-egui/src/addons/pathtools/tests.rs b/crates/ui-egui/src/addons/pathtools/tests.rs index 3f7006e536..e714b85aa2 100644 --- a/crates/ui-egui/src/addons/pathtools/tests.rs +++ b/crates/ui-egui/src/addons/pathtools/tests.rs @@ -329,3 +329,45 @@ fn common_tangents_previews_cancels_and_runs_on_ok() { assert_eq!((steps(&app), count(&app)), (n, nodes)); assert!(app.ui.status.contains("inside the other"), "{}", app.ui.status); } + +/// Common Tangents… on a point and an ellipse: every Tangents choice previews the same two lines +/// from the point, OK keeps them as one step, and a point inside the ellipse changes nothing and +/// says why. +#[test] +fn common_tangents_on_a_point_gives_the_same_lines_for_every_choice() { + let mut app = app(); + let oval = app.run("shape.ellipse", json!({"x": 180.0, "y": 120.0, "width": 80.0, "height": 60.0})).unwrap()["id"].as_u64().unwrap(); + let point = + |app: &mut VectorcraftApp, x: f64, y: f64| app.run("path.create", json!({"anchors": [{"x": x, "y": y}]})).unwrap()["id"].as_u64().unwrap(); + let dot = point(&mut app, 40.0, 150.0); + app.run("select.set", json!({"ids": [oval, dot]})).unwrap(); + let steps = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len(); + let count = |app: &VectorcraftApp| app.session.doc().unwrap().doc.node_count(); + let (n, nodes) = (steps(&app), count(&app)); + let open = |app: &mut VectorcraftApp| { + let entries = menus::menu_entries(app); + let item = entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Path Precision Tools"] && e.label == "Common Tangents…").unwrap(); + assert!(item.enabled); + let (cmd, p) = menus::click_target(&item.label, item.command.as_deref().unwrap(), &item.params); + menus::invoke(app, &cmd, p); + }; + + open(&mut app); + crate::dialogs::set_field(app.ui.dialog.as_mut().unwrap(), "preview".into(), json!(true)); + for (_, kind) in super::TANGENT_KINDS { + crate::dialogs::set_field(app.ui.dialog.as_mut().unwrap(), "tangents".into(), json!(kind)); + painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx())); + assert_eq!(count(&app), nodes + 2, "{kind}: the two lines from the point"); + } + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((steps(&app), count(&app)), (n + 1, nodes + 2), "one undo step"); + + // A point inside the ellipse: nothing changes, and a message says why. + let inside = point(&mut app, 220.0, 150.0); + app.run("select.set", json!({"ids": [oval, inside]})).unwrap(); + let (n, nodes) = (steps(&app), count(&app)); + open(&mut app); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((steps(&app), count(&app)), (n, nodes)); + assert!(app.ui.status.contains("The point lies inside the path"), "{}", app.ui.status); +} diff --git a/docs/mcp.md b/docs/mcp.md index 7589d2ff1e..79ab9876d8 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -12734,13 +12734,15 @@ Commands: anchor: the lines then run from the point to where they touch the path, two when the point lies outside it (one that lies along a straight side covers the whole side), one when the point lies on its outline (centered on the point and as long as the path is wide along it, or the whole straight side the point lies on), and none when it - lies inside. Every `tangents` value gives the same lines, counted in `internal` when `tangents` is `internal` and - in `external` otherwise; the centerline runs from the point to the path's center. Two points are refused with - "select two closed paths". The lines are stroked with the current stroke color and weight (black when the stroke - is None), have no fill, go directly above the upper of the two paths and are selected; one undo step. When there - is no tangent of the kind asked for, nothing changes, and the result's `warning` says why. Common Tangents… - opens a dialog (Tangents, Centerline) with Preview. → `{ids, external, internal, centerline, warning?}` - (`centerline`: the centerline's id, or null). + lies inside. The point counts as on the outline when it is less than the touching tolerance from it, with the + point's distance from the path's center in place of the distance between centers. Every `tangents` value gives + the same lines, counted in `internal` when `tangents` is `internal` and in `external` otherwise; the centerline + runs from the point to the path's center. Two points are refused with "select two closed paths". The lines are + stroked with the current stroke color and weight (black when the stroke is None), have no fill, go directly above + the upper of the two paths and are selected; one undo step. When there is no tangent of the kind asked for, + nothing changes, and the result's `warning` says why. Common Tangents… opens a dialog (Tangents, Centerline) with + Preview; with a point selected, every Tangents choice gives the same lines. → `{ids, external, internal, + centerline, warning?}` (`centerline`: the centerline's id, or null). A parametric shape is an ordinary path. It keeps its numbers, with a fingerprint of the outline they drew, in one entry of its object data (`vc-pathtools-shape`, as `document.node` lists `attrs.data`), which SVG export leaves out; diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index a0ae1bcc7e..859deb9f5b 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2645,7 +2645,7 @@ A VectorCraft addition, so no area score moves. Object › Plug-ins › Cutting ## Path Precision Tools add-on: Common Tangents (2026-11-15) -A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Common Tangents… (`addon.pathtools.commonTangents`) adds the common tangent lines of two convex closed paths ([tangent lines to circles](https://en.wikipedia.org/wiki/Tangent_lines_to_circles)) as separate open paths: external, internal or all, with the line joining the two centers if asked. The rest is VectorCraft's own: an ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse, and any other path must be closed, have one outline and bend the same way all around. Each line runs between the points where it touches the two paths. Separate paths have four tangents, overlapping paths only external ones (two for ellipses), and a path inside the other has none, in which case nothing changes and a message says why. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it. Since 2026-11-18 one of the two may be a point (a path of one anchor): the lines run from the point to where they touch the path, two from a point outside it, one at a point on its outline (centered on the point, or covering the straight side it lies on), and none from a point inside, with a message; the centerline runs from the point to the path's center. The lines take the current stroke and no fill; one undo step. The dialog has Preview. Tests: `addons::pathtools::tangents::tests` in `vectorcraft-pathops` (circles against the closed form, turned ellipses against a brute-force scan, nested, overlapping and touching circles, a convex Bézier path, flat sides, squares meeting at a corner, a curve touched beside an anchor, a point outside a turned ellipse, on a circle, inside it, beside a square and at its corner, refused outlines), `cmd::addons::pathtools::tangents::tests` in `vectorcraft-engine`, `common_tangents_previews_cancels_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on. +A VectorCraft addition, so no area score moves. Object › Plug-ins › Path Precision Tools › Common Tangents… (`addon.pathtools.commonTangents`) adds the common tangent lines of two convex closed paths ([tangent lines to circles](https://en.wikipedia.org/wiki/Tangent_lines_to_circles)) as separate open paths: external, internal or all, with the line joining the two centers if asked. The rest is VectorCraft's own: an ellipse drawn with the Ellipse tool, turned or scaled, is measured as an exact ellipse, and any other path must be closed, have one outline and bend the same way all around. Each line runs between the points where it touches the two paths. Separate paths have four tangents, overlapping paths only external ones (two for ellipses), and a path inside the other has none, in which case nothing changes and a message says why. Paths that touch, from outside or from inside, share one tangent there instead: a line centered on the point where they touch and as long as the narrower path is wide along it. Since 2026-11-18 one of the two may be a point (a path of one anchor): the lines run from the point to where they touch the path, two from a point outside it, one at a point on its outline or less than the touching tolerance from it (centered on the point, or covering the straight side it lies on), and none from a point inside, with a message; the centerline runs from the point to the path's center, and every Tangents choice gives the same lines. The lines take the current stroke and no fill; one undo step. The dialog has Preview. Tests: `addons::pathtools::tangents::tests` in `vectorcraft-pathops` (circles against the closed form, turned ellipses against a brute-force scan, nested, overlapping and touching circles, a convex Bézier path, flat sides, squares meeting at a corner, a curve touched beside an anchor, a point outside a turned ellipse, on a circle, inside it, beside a square and at its corner, on a turned outline, within the touching tolerance, refused outlines), `cmd::addons::pathtools::tangents::tests` in `vectorcraft-engine`, `common_tangents_previews_cancels_and_runs_on_ok` and `common_tangents_on_a_point_gives_the_same_lines_for_every_choice` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on. ## Path Precision Tools add-on: Divide into Dashes (2026-11-01) From d27a9e94667721c895c2605758a986c7b4c2616a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:12:58 -0800 Subject: [PATCH 121/158] Find and Replace: an action that is not a string runs no action Confirming the dialog with a number, null or list as its action used to run Find, which moved the match found, the selection and the last search. It is now an error, shown as the note, like a field of the wrong type. --- crates/ui-egui/src/dialogs/find_replace.rs | 13 ++++++++---- .../ui-egui/src/dialogs/find_replace/tests.rs | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/dialogs/find_replace.rs b/crates/ui-egui/src/dialogs/find_replace.rs index 523586d1a9..f56d07c722 100644 --- a/crates/ui-egui/src/dialogs/find_replace.rs +++ b/crates/ui-egui/src/dialogs/find_replace.rs @@ -260,16 +260,21 @@ fn replace_all(app: &mut VectorcraftApp, d: &mut Dialog) -> Result Result { let mut d = d.clone(); - let action = d.fields.insert("action".into(), json!("find")).and_then(|a| a.as_str().map(str::to_string)).unwrap_or_default(); - if let Err(e) = check_types(&d.fields, false) { + let action = d.fields.insert("action".into(), json!("find")); + let checked = match &action { + Some(a) if !a.is_string() => Err("`action` must be a string".to_string()), + _ => check_types(&d.fields, false), + }; + if let Err(e) = checked { d.fields.insert(NOTE.into(), json!(e)); app.ui.dialog = Some(d); return Err(e); } - let r = match action.as_str() { + let r = match action.as_ref().and_then(Value::as_str).unwrap_or_default() { "done" => { remember(app, &d); app.ui.dialog = None; diff --git a/crates/ui-egui/src/dialogs/find_replace/tests.rs b/crates/ui-egui/src/dialogs/find_replace/tests.rs index 0e38820877..59dbe4937b 100644 --- a/crates/ui-egui/src/dialogs/find_replace/tests.rs +++ b/crates/ui-egui/src/dialogs/find_replace/tests.rs @@ -174,6 +174,27 @@ fn the_dialog_rejects_a_field_of_the_wrong_type() { assert_eq!((field(&app, "find"), field(&app, "replace"), field(&app, "wholeWord")), (json!("cat"), json!("dog"), json!(true))); } +/// An `action` that is not a string runs no action, Find included: the error is the note, and the +/// match found, the selection and the last search stay as they were. +#[test] +fn an_action_of_the_wrong_type_runs_no_action() { + let (mut app, _) = app_with(&["cat", "cat"]); + choose(&mut app); + set(&mut app, "find", json!("cat")); + crate::dialogs::confirm(&mut app).unwrap(); + let (at, sel, last) = (matched(&app), selected(&app), app.ui.last_find.clone()); + assert!(at.is_some()); + for v in [json!(5), Value::Null, json!(["find"])] { + set(&mut app, "action", v.clone()); + assert_eq!(crate::dialogs::confirm(&mut app).unwrap_err(), "`action` must be a string", "{v}"); + assert_eq!((matched(&app), selected(&app), app.ui.last_find.clone()), (at, sel.clone(), last.clone()), "{v}"); + assert_eq!(field(&app, "__note"), json!("`action` must be a string"), "{v}"); + } + set(&mut app, "action", json!("find")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_ne!(matched(&app), at, "a string action still runs"); +} + /// The dialog stays open from match to match: Find goes to the next match and selects its /// object, Replace changes that match, Replace & Find changes it and goes on, Replace All changes /// the rest, and Done closes. Each Replace is one undo step, and so is Replace All; finding and a From 255cdcb6cac62f46c9d251900a6619a60a947d79 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:21:57 -0800 Subject: [PATCH 122/158] Shapes: switching tools during a widget drag puts the shape back Switching away from the Selection tool or a shape tool during a drag of a corner, pie or side widget left the drag's interaction open with its preview in the document. Both tools now cancel the drag on deactivate, as Escape does, as the Selection tool already did for a blend widget. --- crates/tools/src/select.rs | 8 +++-- crates/tools/src/shape.rs | 6 ++++ crates/tools/src/shape/tests.rs | 63 +++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs index cb5f1dd207..b6510f0be4 100644 --- a/crates/tools/src/select.rs +++ b/crates/tools/src/select.rs @@ -900,11 +900,15 @@ impl Tool for SelectionTool { out } - /// Switching tools during a blend widget's drag cancels it, as Escape does: its value goes back. + /// Switching tools during a drag of a blend widget, a corner widget, a pie widget or a + /// polygon's side widget cancels it, as Escape does: its value goes back. fn deactivate(&mut self, _cx: &ToolContext) -> Vec { match std::mem::take(&mut self.state) { State::BlendWidget(d) if d.adjusting() => vec![Action::Cancel], - State::BlendWidget(_) => vec![], + State::Corner(c) if c.adjusting() => vec![Action::Cancel], + State::Pie(d) if d.adjusting() => vec![Action::Cancel], + State::Sides(d) => d.cancel(), + State::BlendWidget(_) | State::Corner(_) | State::Pie(_) => vec![], other => { self.state = other; vec![] diff --git a/crates/tools/src/shape.rs b/crates/tools/src/shape.rs index dc04cc96d5..6685dd20f2 100644 --- a/crates/tools/src/shape.rs +++ b/crates/tools/src/shape.rs @@ -831,6 +831,12 @@ impl Tool for ShapeTool { _ => vec![], } } + /// Switching tools during a drag of a corner, pie or side widget cancels it, as Escape does: + /// the shape goes back. + fn deactivate(&mut self, cx: &ToolContext) -> Vec { + if self.widget.is_some() { self.key(cx, ToolKey::Escape, Mods::default()) } else { vec![] } + } + /// ↑/↓ change a polygon's sides, a star's points or the rounded rectangle's radius while it is /// drawn; Escape turns a widget or selection drag back. fn key(&mut self, cx: &ToolContext, key: ToolKey, _mods: Mods) -> Vec { diff --git a/crates/tools/src/shape/tests.rs b/crates/tools/src/shape/tests.rs index 2b27de29ff..d52cf374d4 100644 --- a/crates/tools/src/shape/tests.rs +++ b/crates/tools/src/shape/tests.rs @@ -1354,6 +1354,69 @@ fn a_shape_tool_drags_a_polygons_side_widget() { assert!(matches!(a.last(), Some(Action::Preview(cmd, _)) if cmd == "shape.line"), "{a:?}"); } +/// Switching away from a shape tool or the Selection tool during a drag of a corner, pie or side +/// widget cancels it, as Escape does: the shape goes back. After a press that has not moved there +/// is nothing to put back. +#[test] +fn a_tool_switch_cancels_a_widget_drag() { + use vectorcraft_doc::{Appearance, LiveShape, Node, NodeKind}; + let live = |shape: LiveShape| { + let mut d = vectorcraft_doc::Document::new(500.0, 500.0); + let (l, id) = (d.layers[0].id, d.alloc_id()); + let mut n = Node::path(id, shape.to_path(), Appearance::default_art()); + if let NodeKind::Path { live: slot, .. } = &mut n.kind { + *slot = Some(Box::new(shape)); + } + d.insert(Some(l), 0, n).unwrap(); + let mut s = Selection::default(); + s.add(id); + (d, s) + }; + let xf = Affine::translate((100.0, 100.0)); + let rect = live(LiveShape::Rectangle { w: 100.0, h: 100.0, radii: [0.0; 4], kinds: Default::default(), radii_relative: false, xf }); + let ellipse = live(LiveShape::Ellipse { w: 200.0, h: 100.0, pie: (0.0, 360.0), xf }); + let polygon = live(LiveShape::Polygon { + radius: 80.0, + sides: 5, + xf: Affine::translate((250.0, 250.0)), + radii: vec![], + kinds: vec![], + radii_relative: false, + }); + let p = paint(); + let side = crate::sidewidget::SideWidget::for_tool(&cx(&polygon.0, &polygon.1, &p)).expect("a side widget").0.at; + // The corner widget at (110, 110), the pie widget 12 px right of (300, 150), the side widget. + let drags = [ + (&rect, Point::new(110.0, 110.0), Point::new(130.0, 130.0)), + (&ellipse, Point::new(312.0, 150.0), Point::new(200.0, 20.0)), + (&polygon, side, side + Vec2::new(0.0, 25.0)), + ]; + for ((d, s), at, to) in drags { + let c = cx(d, s, &p); + let tools: [Box; 6] = [ + Box::new(crate::select::SelectionTool::default()), + Box::new(ShapeTool::new("rectangle")), + Box::new(ShapeTool::new("roundedRectangle")), + Box::new(ShapeTool::new("ellipse")), + Box::new(ShapeTool::new("polygon")), + Box::new(ShapeTool::new("star")), + ]; + for mut t in tools { + let id = t.id(); + assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Down, at.x, at.y)).is_empty(), "{id} at {at:?}"); + let a = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, to.x, to.y)); + assert!(matches!(a.first(), Some(Action::Begin(_))), "{id} at {at:?}: {a:?}"); + assert_eq!(t.deactivate(&c), vec![Action::Cancel], "{id} at {at:?}"); + assert!(!t.busy() && !t.transforming(), "{id} at {at:?}"); + assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, to.x, to.y)).is_empty(), "{id} at {at:?}"); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, at.x, at.y)); + assert!(t.busy(), "{id} at {at:?}"); + assert!(t.deactivate(&c).is_empty(), "{id} at {at:?}"); + assert!(!t.busy(), "{id} at {at:?}"); + } + } +} + /// A double-click on a corner widget of a selected live shape, with a shape tool that shows the /// widgets, asks for the Transform panel and nothing else: neither click draws, edits or begins an /// undo step, and the tool stays idle. Line Segment, a plain path, a pie widget, a hidden or From 7d3f7d1fa1f37de9838e6e0428904fb06bb4766b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:22:23 -0800 Subject: [PATCH 123/158] MCP: transform refuses a mistyped reflect, copy or origin before any step `transform` read `reflect` with `as_str`, `copy` with `as_bool` and passed `origin` through unchecked. A `reflect` of `42` or `true` skipped the reflect step and reported success for the steps before it, a `copy` of `"yes"` transformed the original instead of a copy, and an `origin` that was not two numbers fell back to the selection centre. The handler now checks all three before it selects `ids` or runs a step, and returns an error that names the argument. A null value of any of the three is left out. The tool description and the `transform` row in docs/mcp.md say so. Fixes #6448 --- crates/mcp/src/tests.rs | 31 +++++++++++++++++++++++++++++ crates/mcp/src/tools/definitions.rs | 2 +- crates/mcp/src/tools/handlers.rs | 21 ++++++++++++++++--- docs/mcp.md | 2 +- 4 files changed, 51 insertions(+), 5 deletions(-) diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs index a8d6cc86e6..2c16587227 100644 --- a/crates/mcp/src/tests.rs +++ b/crates/mcp/src/tests.rs @@ -1663,6 +1663,37 @@ fn transform_refused_by_a_later_operation_changes_nothing() { assert_eq!(count(&mut s), base, "one undo removes the rectangle"); } +#[test] +fn transform_rejects_a_mistyped_reflect_copy_or_origin_before_editing() { + let inspect = |s: &mut Server, id| serde_json::from_str::(&text_of(&call(s, id, "doc_inspect", json!({})))).unwrap(); + let mut s = server(); + let first = id_of(&call(&mut s, 1, "draw_path", json!({"d": "M10 10 L30 10 L30 25 Z"}))); + let second = id_of(&call(&mut s, 2, "draw_path", json!({"d": "M40 40 L60 40 L60 55 Z"}))); + let before = inspect(&mut s, 3); + let cases = [ + ("object.reflect", json!({"dx": 10, "reflect": 42, "copy": true})), + ("object.reflect", json!({"dx": 10, "reflect": true})), + ("copy", json!({"dx": 10, "copy": "yes"})), + ("origin", json!({"dx": 10, "rotate": 30, "origin": "center", "copy": true})), + ("origin", json!({"dx": 10, "rotate": 30, "origin": [5]})), + ("origin", json!({"dx": 10, "rotate": 30, "origin": [5, "a"]})), + ]; + for (index, (says, mut args)) in cases.into_iter().enumerate() { + args["ids"] = json!([first]); + let request_id = 4 + index as u64 * 2; + let rejected = call(&mut s, request_id, "transform", args.clone()); + assert_eq!(rejected["isError"], true, "{args}: {rejected}"); + assert!(text_of(&rejected).contains(says), "{args}: {rejected}"); + // The document, the selection and the undo history are as they were. + assert_eq!(inspect(&mut s, request_id + 1), before, "{args}"); + } + // A null `reflect`, `copy` or `origin` is left out. + let applied = call(&mut s, 20, "transform", json!({"ids": [second], "dx": 10, "reflect": null, "copy": null, "origin": null})); + assert_eq!(applied["isError"], false, "{applied}"); + let applied: Value = serde_json::from_str(&text_of(&applied)).unwrap(); + assert_eq!(applied["applied"], json!(["move"])); +} + #[test] fn add_text_rejects_invalid_path_effects_before_editing() { let mut s = server(); diff --git a/crates/mcp/src/tools/definitions.rs b/crates/mcp/src/tools/definitions.rs index d730f8deaf..5cd48e145b 100644 --- a/crates/mcp/src/tools/definitions.rs +++ b/crates/mcp/src/tools/definitions.rs @@ -466,7 +466,7 @@ pub fn tool_definitions() -> Vec { tool( "transform", "Transform", - "Move, rotate, scale, reflect or shear the selection (or `ids`); several may be combined and run in that order. Angles in degrees (counter-clockwise), scale in %. Scale and reflect act along the selection's bounding box, turned with rotated objects until Reset Bounding Box. `origin` [x,y] defaults to the selection centre; `copy` transforms a copy. A scale, reflect or shear its command refuses returns that error before any step runs, and nothing changes.", + "Move, rotate, scale, reflect or shear the selection (or `ids`); several may be combined and run in that order. Angles in degrees (counter-clockwise), scale in %. Scale and reflect act along the selection's bounding box, turned with rotated objects until Reset Bounding Box. `origin` [x,y] defaults to the selection centre; `copy` transforms a copy. A scale, reflect or shear its command refuses, or an argument of the wrong type, returns that error before any step runs, and nothing changes.", obj( json!({ "ids": {"type": "array", "items": {"type": "integer"}}, diff --git a/crates/mcp/src/tools/handlers.rs b/crates/mcp/src/tools/handlers.rs index 619af2e12e..cd7a0fc20b 100644 --- a/crates/mcp/src/tools/handlers.rs +++ b/crates/mcp/src/tools/handlers.rs @@ -303,7 +303,8 @@ pub(super) fn add_text(b: &mut dyn Backend, a: &Args) -> Result { pub(super) fn transform(b: &mut dyn Backend, a: &Args) -> Result { // Each operation is its own command: check the params the later ones refuse before the first - // runs, so a refused request changes nothing. + // runs, so a refused request changes nothing. The `transform` arm of `dispatch` has already + // refused a `dx`, `dy`, `rotate`, `scale`, `scaleX`, `scaleY` or `shear` that is not a number. fn bad(cmd: &'static str) -> impl Fn(String) -> String { move |e| format!("invalid parameters for `{cmd}`: {e}") } @@ -312,7 +313,12 @@ pub(super) fn transform(b: &mut dyn Backend, a: &Args) -> Result if sx.is_some() || sy.is_some() { vectorcraft_engine::cmd::scale_factors(sx.unwrap_or(100.0), sy.unwrap_or(100.0)).map_err(bad("object.scale"))?; } - let reflect = a.get("reflect").and_then(Value::as_str); + // A null `reflect`, `copy` or `origin` is left out. + let reflect = match a.get("reflect") { + None | Some(Value::Null) => None, + Some(Value::String(axis)) => Some(axis.as_str()), + Some(v) => return Err(format!("invalid parameters for `object.reflect`: axis must be \"vertical\" or \"horizontal\", not `{v}`")), + }; if let Some(axis) = reflect { vectorcraft_engine::cmd::reflect_axis(Some(&json!(axis))).map_err(bad("object.reflect"))?; } @@ -320,9 +326,18 @@ pub(super) fn transform(b: &mut dyn Backend, a: &Args) -> Result if let Some(sh) = shear { vectorcraft_engine::cmd::shear_tangent(sh).map_err(bad("object.shear"))?; } + let copy = match a.get("copy") { + None | Some(Value::Null) => false, + Some(v) => v.as_bool().ok_or_else(|| format!("`copy` must be true or false, not {v}"))?, + }; + if let Some(o) = a.get("origin").filter(|o| !o.is_null()) + && !o.as_array().is_some_and(|xy| xy.len() == 2 && xy.iter().all(Value::is_number)) + { + return Err(format!("`origin` must be [x, y], not {o}")); + } select_ids(b, a)?; // With `copy`, the first operation duplicates and the rest transform the copy (the new selection). - let copy = std::cell::Cell::new(a.get("copy").and_then(Value::as_bool).unwrap_or(false)); + let copy = std::cell::Cell::new(copy); let with = |mut p: Value| { if let Some(o) = a.get("origin") { p["origin"] = o.clone(); diff --git a/docs/mcp.md b/docs/mcp.md index 655efa1b4c..54dc29fedd 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -724,7 +724,7 @@ ends the wait, so the sampler can be shown again. The BSDs and headless sessions | `add_text` | `{text, x?, y?, width?, height?, fit?, fitMinPercent?, path?, mode?, pathEffect?, size?, font?, color?, justify?, vertical?}` | Point type at (x, y) (`justify`: `left`, `center` or `right` starts, centres or ends each line on x); area type with `width`/`height` (`fit`: `none`, `autoHeight`, `shrinkText`, as `text.areaOptions`); or `path` + `mode` (`area`/`onPath`) to flow text in or along a path, with `pathEffect` for type on a path (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`; SVG export writes type on a path with any effect other than `rainbow` as outlines, with a warning). An invalid effect is rejected before editing. `justify` (also `auto`, `justifyAll`) aligns the paragraphs of every kind, as `text.setStyle` does later. `vertical: true` uses the existing vertical writing mode for every kind (default `false`, horizontal). Returns `{id}`, with `overflow: true` when the text doesn't fit its frame or path. | | `apply_effect` | `{effect?, params?, ids?}` | Appends a live effect. Without `effect`, returns the effect catalogue with parameters and defaults. | | `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). In remote desktop mode, `run_command` and `invoke_menu` can both call `pathfinder.repeat` with `{}`. Successful panel operations, direct `object.pathfinder.*` commands, and `command.batch` steps (including Actions panel playback) set its history. Repeat applies it to the current selection using current Pathfinder Options. Trap, compound-shape edits, live effects and `action.batch` do not set history. With no history it returns "no Pathfinder operation applied yet". | -| `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. `rotate` is in degrees counter-clockwise; a positive `shear` moves the top to the right. With `copy`, the first step duplicates. A `scale`, `reflect` or `shear` that its command would refuse returns that error before any step runs; nothing changes and no undo step is recorded. | +| `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. `rotate` is in degrees counter-clockwise; a positive `shear` moves the top to the right. With `copy`, the first step duplicates. A `scale`, `reflect` or `shear` that its command would refuse returns that error before any step runs; nothing changes and no undo step is recorded. The same holds for a step that is not a number, a `reflect` that is not a string, a `copy` that is not true or false, and an `origin` that is not two numbers; a null `reflect`, `copy` or `origin` is left out. | | `create_graph` | `{type?, x, y, width, height, csv? \| series?, categories?, rows?}` | The nine Illustrator graph types: column, stacked column, bar, stacked bar, line, area, scatter, pie and radar. An empty CSV cell or a `null` in `rows` is a blank value; a number in straight quotes is a label. Edit later with `graph.setData` / `graph.setType` via `run_command`. `graph.column {design, columnType: vertical\|uniform\|repeating\|sliding, each, fractions: chop\|scale}` draws the columns or bars of the series picked with Group Selection (or `seriesIndexes`, or all of them) with a graph design saved by `graph.design`; with no `design` it returns the series' current design and options. Type in the design that holds a `%` followed by two digits shows each column's value, with at least the first digit's places before the decimal point and the second digit's places after it. | | `text_wrap` | `{ids?, offset?, invert?, release?}` | Area type below the objects (same layer) flows around them. `offset` is in points, from -1000 to 1000 (default 6). An offset outside that range or not a number, or an `invert` or `release` that is not true or false, is an error and changes nothing; `object.textWrap.make` and `object.textWrap.options` refuse the same values. | | `undo` / `redo` | `{}` | Many calls that change nothing record no undo step, for example `object.align` with nothing to move, `object.move` by 0 without `copy` and `object.showAll` with nothing hidden. `undo` (`edit.undo`) after such a call undoes the step before it. Settings that change without an undo step stay as they are when `undo` or `redo` brings back a step that did not change them: the perspective grid's view options and active plane, the grid preferences (`gridlineEvery`, `gridSubdivisions`), the export settings (`assets.settings.set`), and the current brush and symbol. A step that changed one of them, such as a perspective grid preset that shows the grid, takes that change back. The point Automatic Plane Positioning holds comes back with the step, and is let go when the active plane kept is another one. `inspect_document` lists the undo steps as `history`. `run_command` with `edit.clearHistory` removes every undo and redo step of the active document and returns `{cleared}`, the number of steps removed; the document stays as it is, and the command records no undo step. `run_command` with `edit.newDocumentFromState` and `{index?, created?}` makes a new document holding the art as it was at that state and makes it the active document, and returns `{index, title}`. `index` is a row of the History panel, with 0 the oldest state kept, and an omitted or null `index` uses the current state. An `index` that names no state fails with `no history state N`, one that is not a whole number with `` `index` must be a whole number ``, and either changes nothing. `created` is File Info's created date in Unix seconds or null, and defaults to now. The new document takes the next `Untitled-N` name, is marked unsaved, has nothing selected and has no steps to undo or redo. It is out of symbol, opacity-mask and pattern editing, and the art drawn in a pattern's tile is stored in the pattern, as `object.pattern.done` stores it. The source document and its steps stay as they are, except that typing or a drag in progress is first kept as a step. When a command keeps a drag whose preview Real-time Drawing off had not applied yet (`edit.undo`, `edit.redo`, `edit.clearHistory`, `edit.newDocumentFromState` and the other commands that end a drag first), and applying that preview gives a warning, the command's result carries it as `previewWarning`, and as `warning` too when the command gives no warning of its own; the app's status bar shows `warning`. While the Type tool edits type, `undo` and `redo` put its caret, with no characters selected, at the end of the text the step changed: after the text it puts back or retypes, or where the text it takes out was. A step that changes no characters, such as a formatting change, leaves the caret and the selection where they are. | From edeb24b113614ed77c780a300420d898f666933c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:30:36 -0800 Subject: [PATCH 124/158] Recolor Artwork: OK keeps a color group's gradient and pattern swatches recolor.apply with `group` rewrote the group by place: the new colors went to its swatches in order, so a gradient, pattern or None swatch in the group took a color or was removed, at OK and in the live preview. The group's colors, from the rows or from `groupColors`, now go to its color swatches in order, and every other swatch keeps its place and its paint. `groupColors` counts the color swatches only, as the dialog already does when it lists a group's colors. swatch.editGroup is unchanged. --- crates/engine/src/cmd/recolor.rs | 31 ++++++++------- crates/engine/src/cmd/swatch.rs | 55 +++++++++++++++++++-------- crates/engine/src/tests/recolor.rs | 43 +++++++++++++++++++++ crates/ui-egui/src/dialogs/recolor.rs | 7 ++-- docs/mcp.md | 9 +++-- 5 files changed, 108 insertions(+), 37 deletions(-) diff --git a/crates/engine/src/cmd/recolor.rs b/crates/engine/src/cmd/recolor.rs index cb179148cc..1c3acf4e73 100644 --- a/crates/engine/src/cmd/recolor.rs +++ b/crates/engine/src/cmd/recolor.rs @@ -34,7 +34,7 @@ pub fn specs() -> Vec { "Recolor Artwork", ["Edit", "Edit Colors"], None, - "{map: rows [{from: [colour keys (recolor.colors) or \"#rrggbb\" (every colour shown as that hex); may be empty: an empty row recolours nothing, adds no library swatch and gives `group` no colour unless `added`], to: colour (hex, key, {c,m,y,k} or {l,a,b}) | null (in from, to and groupColors, #rrggbbaa and #rgba are refused), exclude?: false (the row's colours are kept), tint?: 100 (percent; with limitTo, art linked to the global or spot swatch the new color is takes this share of its tint), added?: false (an empty row's new color is a color added to `group`)}] | {\"key or #rrggbb\": colour, …} (one row per colour), method?: \"exact\" (default)|\"preserveTints\"|\"scaleTints\"|\"tintsShades\"|\"hueShift\" (how a row's colours take its new colour, relative to the row's darkest, average or most saturated colour), limitTo?: swatch library id or name; or \"document\" (the document's swatches): new colours snap to its nearest colour, group?: colour group to rewrite, groupColors?: [colour | null | \"keep\"] (what `group` is rewritten with, a null removing the group's swatch at its place and \"keep\" leaving that swatch its colour, without the Global Adjust (past the swatches it adds nothing; refused for a swatch that is not a colour); default: the new colors of the rows with current colors, in order, then those of the empty rows with `added`, excluded rows left out), rename?: the group's new name, includeImages?: true, includePatterns?: true, globalAdjust?: {saturation?: 0, brightness?: 0, temperature?: 0, luminosity?: 0} (Global Adjust: percent from -100 to 100, 0 changes nothing; every colour a row that isn't excluded recolours, and the group's new colours, take the same change after the row's new colour: saturation scales HSB saturation by 1 + saturation/100, brightness moves HSB brightness that share of the way to full or to black, temperature adds 0.2 × temperature/100 to red and takes it from blue, luminosity moves Lab lightness that share of the way to 100 or 0 keeping a and b; with limitTo each row's new colour takes the change before it snaps to the library)} recolour the selection (gradients, text, meshes, image pixels and pattern tiles included; each new colour keeps the model of the one it replaces (model?: \"keep\" default | \"new\" (the new colour's own model, so a CMYK colour replacing RGB art gives CMYK art) | \"document\" (the document's colour mode)), except a library swatch's with limitTo: art takes the swatch itself, linked to a global or spot colour at its tints, and the swatch joins the document's swatches; art linked to a global swatch of `group` that is rewritten with its row's new color stays linked to it, at its tint, unless the row converts the color into the art's model; other recolored art, and art in a row linked to a global swatch of `group` that is rewritten with another color, keeps its row's new color and loses its swatch link) and the group, as one undo step (none when nothing changes). On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke, and on a graph label the new paint of its characters and rows for every label of its kind, and on a graph's axis line, tick mark or radar ring its rows for every line of its kind (docs/mcp.md) → {changed, swatches: [names added to the document's swatches], relinked?: with group, the other paints linked to its global swatches that took their new colors, note?: set when a colour kept a model other than its new colour's (see model), notChanged: {locked, hidden} (as edit.colors.invert), warning?: set when notChanged counts any object}", + "{map: rows [{from: [colour keys (recolor.colors) or \"#rrggbb\" (every colour shown as that hex); may be empty: an empty row recolours nothing, adds no library swatch and gives `group` no colour unless `added`], to: colour (hex, key, {c,m,y,k} or {l,a,b}) | null (in from, to and groupColors, #rrggbbaa and #rgba are refused), exclude?: false (the row's colours are kept), tint?: 100 (percent; with limitTo, art linked to the global or spot swatch the new color is takes this share of its tint), added?: false (an empty row's new color is a color added to `group`)}] | {\"key or #rrggbb\": colour, …} (one row per colour), method?: \"exact\" (default)|\"preserveTints\"|\"scaleTints\"|\"tintsShades\"|\"hueShift\" (how a row's colours take its new colour, relative to the row's darkest, average or most saturated colour), limitTo?: swatch library id or name; or \"document\" (the document's swatches): new colours snap to its nearest colour, group?: colour group to rewrite, groupColors?: [colour | null | \"keep\"] (what the color swatches of `group` are rewritten with, in order: a gradient, pattern or None swatch keeps its place and paint; a null removing the color swatch at its place and \"keep\" leaving that swatch its colour, without the Global Adjust (past the color swatches it adds nothing); default: the new colors of the rows with current colors, in order, then those of the empty rows with `added`, excluded rows left out), rename?: the group's new name, includeImages?: true, includePatterns?: true, globalAdjust?: {saturation?: 0, brightness?: 0, temperature?: 0, luminosity?: 0} (Global Adjust: percent from -100 to 100, 0 changes nothing; every colour a row that isn't excluded recolours, and the group's new colours, take the same change after the row's new colour: saturation scales HSB saturation by 1 + saturation/100, brightness moves HSB brightness that share of the way to full or to black, temperature adds 0.2 × temperature/100 to red and takes it from blue, luminosity moves Lab lightness that share of the way to 100 or 0 keeping a and b; with limitTo each row's new colour takes the change before it snaps to the library)} recolour the selection (gradients, text, meshes, image pixels and pattern tiles included; each new colour keeps the model of the one it replaces (model?: \"keep\" default | \"new\" (the new colour's own model, so a CMYK colour replacing RGB art gives CMYK art) | \"document\" (the document's colour mode)), except a library swatch's with limitTo: art takes the swatch itself, linked to a global or spot colour at its tints, and the swatch joins the document's swatches; art linked to a global swatch of `group` that is rewritten with its row's new color stays linked to it, at its tint, unless the row converts the color into the art's model; other recolored art, and art in a row linked to a global swatch of `group` that is rewritten with another color, keeps its row's new color and loses its swatch link) and the group, as one undo step (none when nothing changes). On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke, and on a graph label the new paint of its characters and rows for every label of its kind, and on a graph's axis line, tick mark or radar ring its rows for every line of its kind (docs/mcp.md) → {changed, swatches: [names added to the document's swatches], relinked?: with group, the other paints linked to its global swatches that took their new colors, note?: set when a colour kept a model other than its new colour's (see model), notChanged: {locked, hidden} (as edit.colors.invert), warning?: set when notChanged counts any object}", has_doc, apply ), @@ -1680,12 +1680,18 @@ fn apply(s: &mut Session, p: &Value) -> Result { Some(Value::Array(cs)) => Some(cs), Some(_) => return Err(bad(C, "`groupColors` must be an array")), }; - // A null in groupColors removes the group's swatch at its place, and "keep" leaves the swatch - // at its place its color, without the Global Adjust. - let own: Vec> = match group { - Some(g) => { - s.doc()?.doc.swatch_groups.iter().find(|x| x.name == g).map(|g| g.swatches.iter().map(|w| w.paint.color()).collect()).unwrap_or_default() - } + // The places of groupColors are those of the group's color swatches: a gradient, pattern or + // None swatch keeps its place and paint. A null removes the color swatch at its place, and + // "keep" leaves it its color, without the Global Adjust. + let own: Vec = match group { + Some(g) => s + .doc()? + .doc + .swatch_groups + .iter() + .find(|x| x.name == g) + .map(|g| g.swatches.iter().filter_map(|w| w.paint.color()).collect()) + .unwrap_or_default(), None => vec![], }; let new: Vec> = match group_colors { @@ -1694,12 +1700,8 @@ fn apply(s: &mut Session, p: &Value) -> Result { .enumerate() .map(|(i, v)| match v { Value::Null => Ok(None), - // Past the group's swatches it adds nothing. - Value::String(k) if k == "keep" => match own.get(i) { - Some(Some(c)) => Ok(Some(*c)), - Some(None) => Err(bad(C, format!("the swatch at place {i} of groupColors is not a colour to keep"))), - None => Ok(None), - }, + // Past the group's color swatches it adds nothing. + Value::String(k) if k == "keep" => Ok(own.get(i).copied()), v => color_value(v) .map(|c| adjust.apply(c)) .map(|c| Some(in_doc_model(palette.as_ref().map_or(c, |pl| pl.nearest(c))))) @@ -1747,6 +1749,7 @@ fn apply(s: &mut Session, p: &Value) -> Result { .map(|g| { g.swatches .iter() + .filter(|w| w.paint.color().is_some()) .zip(&new) .filter(|(w, _)| w.global && !w.is_reserved()) .filter_map(|(w, c)| Some((w, (*c)?))) @@ -1766,7 +1769,7 @@ fn apply(s: &mut Session, p: &Value) -> Result { .collect(); map.converted.set(false); let changed = keeping_series_paint(d, &ids, |d| Ok(Recolor::with_links(scope, &f, &lf).run(d, &ids)))?; - let edit = group.map(|g| super::swatch::rewrite_group(d, g, &new, rename, C)).transpose()?; + let edit = group.map(|g| super::swatch::rewrite_group(d, g, &new, true, rename, C)).transpose()?; super::paint::check_colorized_kept(colorized_ok, d).map_err(|e| bad(C, e))?; // Rewriting the group's swatches can change the colors of art linked to them, left out or // not, and of the patterns it uses. Art that only loses its link keeps its colors and is diff --git a/crates/engine/src/cmd/swatch.rs b/crates/engine/src/cmd/swatch.rs index 2b746b7634..b93c378fea 100644 --- a/crates/engine/src/cmd/swatch.rs +++ b/crates/engine/src/cmd/swatch.rs @@ -1279,40 +1279,63 @@ impl GroupEdit { /// Rewrite colour group `group` with `colors`: its swatches take them in order (keeping their /// names, kinds and global or spot flags), a `None` removes the swatch at its place, extra colors -/// are added as new swatches and swatches past the end are removed. Paints linked to its global +/// are added as new swatches and swatches past the end are removed. With `colors_only`, a swatch +/// that is not a color (a gradient, pattern or None swatch) keeps its place and paint and takes no +/// entry of `colors`, which go to the group's color swatches in order. Paints linked to its global /// swatches follow (a removed swatch's are unlinked); `rename` renames the group. A built-in swatch /// (None, Registration) it would change or remove is refused. -pub(super) fn rewrite_group(d: &mut Document, group: &str, colors: &[Option], rename: Option<&str>, cmd: &str) -> Result { +pub(super) fn rewrite_group( + d: &mut Document, + group: &str, + colors: &[Option], + colors_only: bool, + rename: Option<&str>, + cmd: &str, +) -> Result { let gi = d.swatch_groups.iter().position(|g| g.name == group).ok_or_else(|| bad(cmd, format!("no colour group `{group}`")))?; let name = match rename.map(str::trim).filter(|n| !n.is_empty() && *n != group) { Some(n) => d.free_swatch_name(n), None => group.to_string(), }; let old = &d.swatch_groups[gi].swatches; + // The place in `colors` of each swatch's new color; none for a swatch kept as it is. + let mut taken = 0; + let places: Vec> = old + .iter() + .map(|w| { + (!colors_only || w.paint.color().is_some()).then(|| { + taken += 1; + taken - 1 + }) + }) + .collect(); + let new_color = |place: Option| place.and_then(|i| colors.get(i).copied().flatten()); if let Some(w) = old .iter() - .enumerate() - .find(|(i, w)| w.is_reserved() && colors.get(*i).copied().flatten().is_none_or(|c| w.paint.color() != Some(c))) - .map(|x| x.1) + .zip(&places) + .find(|(w, place)| place.is_some() && w.is_reserved() && new_color(**place).is_none_or(|c| w.paint.color() != Some(c))) + .map(|x| x.0) { return Err(bad(cmd, format!("`{}` can't be edited or removed", w.name))); } let colorized_ok = super::paint::check_colorized(d).is_ok(); let mut relinks = vec![]; let old = std::mem::take(&mut d.swatch_groups[gi].swatches); - let old_len = old.len(); - // The swatches that stay, each with its new color. - let mut kept: Vec<(Swatch, Color)> = vec![]; - for (i, w) in old.into_iter().enumerate() { - match colors.get(i).copied().flatten() { - Some(c) => kept.push((w, c)), - None if w.global => relinks.push(Relink { from: w.name.clone(), to: w.name, color: None, keep: false }), - None => {} + // The swatches that stay, each with its new color (none for one kept as it is). + let mut kept: Vec<(Swatch, Option)> = vec![]; + for (w, place) in old.into_iter().zip(places) { + match (place, new_color(place)) { + (None, _) => kept.push((w, None)), + (_, Some(c)) => kept.push((w, Some(c))), + (_, None) if w.global => relinks.push(Relink { from: w.name.clone(), to: w.name, color: None, keep: false }), + (_, None) => {} } } let mut swatches = Vec::with_capacity(kept.len()); for (mut w, c) in kept { - if w.paint.color() != Some(c) { + if let Some(c) = c + && w.paint.color() != Some(c) + { // A tint swatch becomes a colour of its own. w.paint = Paint::solid(c); if w.global { @@ -1325,7 +1348,7 @@ pub(super) fn rewrite_group(d: &mut Document, group: &str, colors: &[Option Result { { return Ok(json!({"name": group, "swatches": g.swatches.iter().map(|w| w.name.clone()).collect::>(), "relinked": 0})); } - let e = s.edit("Edit Color Group", |d, _| rewrite_group(d, group, &colors, rename, C))?; + let e = s.edit("Edit Color Group", |d, _| rewrite_group(d, group, &colors, false, rename, C))?; e.defaults(s)?; Ok(json!({"name": e.name, "swatches": e.swatches, "relinked": e.relinked})) } diff --git a/crates/engine/src/tests/recolor.rs b/crates/engine/src/tests/recolor.rs index dae6a1729f..10c2edcc17 100644 --- a/crates/engine/src/tests/recolor.rs +++ b/crates/engine/src/tests/recolor.rs @@ -836,6 +836,49 @@ fn a_null_in_group_colors_removes_that_swatch_and_the_ones_after_it_keep_their_p assert_eq!(link(&s, green), ("#00ff00".into(), Some(names[2].clone())), "art linked to a swatch that stays keeps its link"); } +/// A gradient or pattern swatch of the group keeps its place and its paint when `recolor.apply` +/// rewrites the group: the group's colors, from the rows or from `groupColors`, go to its color +/// swatches in order. +#[test] +fn apply_with_a_group_keeps_its_gradient_swatch() { + let mut s = session(); + run(&mut s, "swatch.newGroup", json!({"name": "Brand", "colors": ["#ff0000", "#0000ff"]})); + let fade = vectorcraft_color::Paint::Gradient(Box::new(vectorcraft_color::GradientPaint::new(vectorcraft_color::Gradient::default()))); + s.edit("test", |d, _| { + let w = vectorcraft_color::Swatch { name: "Fade".into(), paint: fade.clone(), global: false, spot: false }; + d.swatch_groups.iter_mut().find(|g| g.name == "Brand").unwrap().swatches.insert(1, w); + Ok(()) + }) + .unwrap(); + let group = |s: &Session| -> Vec<(String, Option)> { + let g = s.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Brand").unwrap().swatches.clone(); + g.iter().map(|w| (w.name.clone(), w.paint.color().map(|c| c.to_hex()))).collect() + }; + let names: Vec = group(&s).into_iter().map(|(n, _)| n).collect(); + rect(&mut s, json!("#ff0000")); + rect(&mut s, json!("#0000ff")); + select_all(&mut s); + // The rows' new colors go to the red and blue swatches; the gradient stays between them. + let map = json!([{"from": ["#ff0000"], "to": "#00ff00"}, {"from": ["#0000ff"], "to": "#ffff00"}]); + run(&mut s, "recolor.apply", json!({"map": map, "group": "Brand"})); + let want = |a: &str, b: &str| vec![(names[0].clone(), Some(a.to_string())), (names[1].clone(), None), (names[2].clone(), Some(b.to_string()))]; + assert_eq!(group(&s), want("#00ff00", "#ffff00")); + assert_eq!(gradient_at(&s, 1), fade, "the gradient swatch keeps its paint"); + // `groupColors` counts the color swatches only: "keep" is the first, and the second color is + // the blue swatch's. + run(&mut s, "recolor.apply", json!({"map": [], "group": "Brand", "groupColors": ["keep", "#123456"]})); + assert_eq!(group(&s), want("#00ff00", "#123456")); + // A null removes the color swatch at its place and leaves the gradient. + run(&mut s, "recolor.apply", json!({"map": [], "group": "Brand", "groupColors": [null, "#123456"]})); + assert_eq!(group(&s), [(names[1].clone(), None), (names[2].clone(), Some("#123456".into()))]); + assert_eq!(gradient_at(&s, 0), fade); +} + +/// The paint of the swatch at place `i` of the group "Brand". +fn gradient_at(s: &Session, i: usize) -> vectorcraft_color::Paint { + s.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Brand").unwrap().swatches[i].paint.clone() +} + /// A row whose new color was removed keeps its art's colors: art in it linked to another swatch of /// the group, which the rewrite gives another color, loses the link instead of following it. #[test] diff --git a/crates/ui-egui/src/dialogs/recolor.rs b/crates/ui-egui/src/dialogs/recolor.rs index cfa699b7b9..b3cb557b61 100644 --- a/crates/ui-egui/src/dialogs/recolor.rs +++ b/crates/ui-egui/src/dialogs/recolor.rs @@ -3600,7 +3600,7 @@ mod tests { vectorcraft_color::Swatch { name: "Fade".into(), paint, global: false, spot: false } } - /// With art, the preview rewrites the group being edited, its other swatch included; Save + /// With art, the preview rewrites the group being edited and keeps its other swatch; Save /// Changes is still refused, as the group is without the preview, and Cancel leaves it as it was. #[test] fn saving_a_group_with_a_swatch_that_is_not_a_color_is_refused_while_previewing() { @@ -3623,8 +3623,9 @@ mod tests { d.fields.insert("rows".into(), Value::Array(rs)); frame(&mut app, &ctx, 0.1, vec![], 0); assert!(app.session.in_interaction(), "the art previews"); - let previewed = app.session.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Mixed").map(|g| g.swatches.len()); - assert_eq!(previewed, Some(2), "the preview's rewrite of the group leaves out its other swatch"); + let previewed = app.session.doc().unwrap().doc.swatch_groups.iter().find(|g| g.name == "Mixed").map(|g| g.swatches.clone()); + assert_eq!(previewed.as_ref().map(Vec::len), Some(3), "the preview's rewrite of the group keeps its other swatch"); + assert_eq!(previewed.and_then(|s| s.last().cloned()), Some(fade_swatch()), "with its paint"); let refused: Result<(), String> = Err("color group `Mixed` holds swatches that are not colors, which Save Changes can't keep".into()); assert_eq!(act(&mut app, &ctx, 0.2, "save"), refused); crate::dialogs::cancel(&mut app); diff --git a/docs/mcp.md b/docs/mcp.md index 655efa1b4c..7a65e100c6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5090,10 +5090,11 @@ moves a row's `tint` with its new color and removes it from a color it changes, step (art linked to its global swatches follows); a `null` in `colors` removes the group's swatch at that place, and given the group's own colors in order and no new name, it records no undo step. A color key (`recolor.colors`) that names a swatch's color, rounded to the key's steps, counts as that color, and the swatch keeps its color unrounded. And `recolor.apply` with `group` recolours the art and rewrites the -group together. A `null` in `groupColors` removes the group's swatch at that place, and the swatches after it keep -their colors and names; art linked to a removed global swatch keeps its color and is no longer linked to it. `"keep"` in -`groupColors` leaves the swatch at that place its color, without the Global Adjust; past the group's swatches it adds -nothing, and it is refused for a swatch that is not a color. Art linked to one of the group's global swatches stays linked when the swatch is rewritten with its +group together. The group's colors, from the rows or from `groupColors`, go to its color swatches in order; a gradient, +pattern or None swatch in the group keeps its place and its paint. A `null` in `groupColors` removes the color swatch at +that place, and the swatches after it keep their colors and names; art linked to a removed global swatch keeps its color +and is no longer linked to it. `"keep"` in `groupColors` leaves the color swatch at that place its color, without the +Global Adjust; past the group's color swatches it adds nothing. Art linked to one of the group's global swatches stays linked when the swatch is rewritten with its row's new color (the default without `groupColors` when the rows follow the group's order), so a later `swatch.edit` still reaches it; the reply's `relinked` counts the other linked paints that took the group's new colors. Art in a row that is linked to a swatch rewritten with another color keeps its row's new color, even an unchanged one, and is no longer From 7dc76c4f3967488c9d844a8bea20ceaa1bc2ce5a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:31:26 -0800 Subject: [PATCH 125/158] Tests: point the empty description line test at a row that has no sentence Show Slice Numbers now has a sentence. The test goes to the first category other than Units that still has a row without one (Slices when none is left) and points at that row. --- crates/ui-egui/src/prefs_dialog/tests.rs | 27 ++++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/src/prefs_dialog/tests.rs b/crates/ui-egui/src/prefs_dialog/tests.rs index aa94c8b190..cc7e452b30 100644 --- a/crates/ui-egui/src/prefs_dialog/tests.rs +++ b/crates/ui-egui/src/prefs_dialog/tests.rs @@ -1836,8 +1836,11 @@ fn a_row_without_a_description_leaves_the_line_empty() { description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(at(&texts, "General:"))]); let (texts, _) = description_frame(&mut a, &ctx, vec![]); assert!(painted(&texts, general), "the General row's sentence shows: {texts:?}"); - // Go to the Slices category and point at a row with no sentence. - let button = at(&texts, "Slices"); + // Go to the first other category that still has a row with no sentence (Slices when none is + // left) and point at that row. + let bare = settings().find(|s| s.category != "Units" && descriptions::description(s.key).is_none()); + let category = bare.map_or("Slices", |s| s.category); + let button = at(&texts, category); let press = |pressed| egui::Event::PointerButton { pos: button, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(button), press(true), press(false)]); let (texts, _) = description_frame(&mut a, &ctx, vec![]); @@ -1851,13 +1854,19 @@ fn a_row_without_a_description_leaves_the_line_empty() { description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(line.center())]); let (after, _) = description_frame(&mut a, &ctx, vec![]); empty(&after, "on the line after changing category"); - assert_eq!(descriptions::description("showSliceNumbers"), None); - description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(at(&texts, "Show Slice Numbers"))]); - let (after, _) = description_frame(&mut a, &ctx, vec![]); - empty(&after, "on Show Slice Numbers"); - description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(line.center())]); - let (after, _) = description_frame(&mut a, &ctx, vec![]); - empty(&after, "on the line after Show Slice Numbers"); + if bare.is_some() { + // A checkbox shows its label as it is; other rows show it with a colon. + let (label, pos) = settings() + .filter(|s| s.category == category && descriptions::description(s.key).is_none()) + .find_map(|s| texts.iter().find(|(t, _)| *t == s.label || *t == format!("{}:", s.label)).map(|(_, r)| (s.label, r.center()))) + .unwrap_or_else(|| panic!("no row of {category} without a sentence is drawn: {texts:?}")); + description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(pos)]); + let (after, _) = description_frame(&mut a, &ctx, vec![]); + empty(&after, &format!("on {label}")); + description_frame(&mut a, &ctx, vec![egui::Event::PointerMoved(line.center())]); + let (after, _) = description_frame(&mut a, &ctx, vec![]); + empty(&after, &format!("on the line after {label}")); + } assert_eq!(preferences_window(&ctx).size(), size); } From b4afcadc5ce4ec1176e491176f6bc43295d78b60 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:32:12 -0800 Subject: [PATCH 126/158] Object Mosaic: a size out of range stays when percentages switch Resize Using Percentages now checks the new size as it is before converting it. A width or height the command refuses (outside 0.1 to 1,000,000) stays, with the mode unchanged and the reason shown, even when the converted value would be in range, for example 0.05 pt of a 10 pt wide image, which is 0.5%. --- crates/ui-egui/src/dialogs/object_mosaic.rs | 37 ++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/dialogs/object_mosaic.rs b/crates/ui-egui/src/dialogs/object_mosaic.rs index eac36e9095..0ee49a194a 100644 --- a/crates/ui-egui/src/dialogs/object_mosaic.rs +++ b/crates/ui-egui/src/dialogs/object_mosaic.rs @@ -173,8 +173,8 @@ fn derived(d: &Dialog) -> Option<(&'static str, f64)> { /// Resize Using Percentages turned on or off: the new size shown the other way, so it stays the /// same size. When a size field does not hold a number, or a size the command takes (all but the -/// side Constrain Ratio sets) falls outside what the command accepts the other way, the fields and -/// the mode stay as they are and the dialog shows why. With no image selected, nothing changes and +/// side Constrain Ratio sets) falls outside what the command accepts either as it is or the other +/// way, the fields and the mode stay as they are and the dialog shows why. With no image selected, nothing changes and /// the dialog asks for one. fn switch_percentages(d: &mut Dialog, on: bool) { if d.bool(NO_IMAGE) { @@ -190,13 +190,19 @@ fn switch_percentages(d: &mut Dialog, on: bool) { return; } }; - let (w, h) = if on { (w / iw * 100.0, h / ih * 100.0) } else { (iw * w / 100.0, ih * h / 100.0) }; let skip = follower(d); - if let Some((key, v)) = [("width", w), ("height", h)].into_iter().find(|(k, v)| skip != Some(*k) && !SIZE_RANGE.contains(v)) { - let why = format!("`{key}` must be between {} and {} (got {v})", SIZE_RANGE.start(), SIZE_RANGE.end()); + let checked = |key: &str| skip != Some(key) || d.bool(&kept(key)); + let refused = |w: f64, h: f64| { + let (key, v) = [("width", w), ("height", h)].into_iter().find(|(k, v)| checked(k) && !SIZE_RANGE.contains(v))?; + Some(format!("`{key}` must be between {} and {} (got {v})", SIZE_RANGE.start(), SIZE_RANGE.end())) + }; + // A size the command refuses as it is stays refused, even when it falls in range the other way. + let converted = if on { (w / iw * 100.0, h / ih * 100.0) } else { (iw * w / 100.0, ih * h / 100.0) }; + if let Some(why) = refused(w, h).or_else(|| refused(converted.0, converted.1)) { d.fields.insert(form::REFUSED.into(), json!(why)); return; } + let (w, h) = converted; d.fields.remove(form::REFUSED); d.fields.remove(&kept("percentages")); d.fields.insert("width".into(), json!(w)); @@ -683,6 +689,27 @@ mod tests { assert_eq!(mosaic(&app), None); } + /// A size `ui.dialog.set` gave that the command refuses stays when Resize Using Percentages + /// switches, even when it is in range the other way (0.05 pt of a 10 pt wide image is 0.5%, and + /// 0.05% of a 1,000 pt wide image is 0.5 pt), with the mode unchanged and the reason shown, and + /// OK refuses it. + #[test] + fn a_size_out_of_range_stays_when_percentages_switch() { + for (scale, given, on) in [(10, json!({}), true), (1000, json!({"percentages": true}), false)] { + let mut app = app_with_image(); + app.run("object.scale", json!({"sx": scale, "sy": scale})).unwrap(); + open(&mut app, &given).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + crate::dialogs::set_field(d, "width".into(), json!(0.05)); + crate::dialogs::set_field(d, "percentages".into(), json!(on)); + assert_eq!((d.f64("width", 0.0), d.bool("percentages")), (0.05, !on), "{given}"); + assert!(d.str(form::REFUSED).contains("`width` must be between 0.1"), "{given}: {}", d.str(form::REFUSED)); + let e = crate::dialogs::confirm(&mut app).unwrap_err(); + assert!(e.contains("width"), "{given}: {e}"); + assert_eq!(mosaic(&app), None, "{given}"); + } + } + /// The image scaled from 100 × 50 pt to 200 × 100 pt while the dialog is open: Current Size shows /// the new size, and Resize Using Percentages, by `ui.dialog.set` or by its checkbox, converts /// New Size against it, so OK makes the size shown. With no image selected, switching is refused. From bdd0f6149a50efeece974a410ea8b10e38029c0d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:32:33 -0800 Subject: [PATCH 127/158] Symbols: New, Redefine and Delete Symbol read Shift and Alt as the button goes up The New Symbol button, the panel menu's New Symbol... and Redefine Symbol read Shift, and the Delete Symbol button and a symbol dropped on it read Alt, from the modifiers held at the end of the frame. A key let go after the primary button in the same frame dropped Shift, so OK made the art an instance, or dropped Alt, so an unused symbol asked first. They now read the modifiers that the primary button's release carries, as art dropped on the panel already does, and fall back to the current modifiers when no release happened in the frame (keyboard activation). The drag test helper sends its release with the modifiers held. --- crates/ui-egui/src/panels/symbols.rs | 81 ++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 17 deletions(-) diff --git a/crates/ui-egui/src/panels/symbols.rs b/crates/ui-egui/src/panels/symbols.rs index b50b7876cc..048260b45e 100644 --- a/crates/ui-egui/src/panels/symbols.rs +++ b/crates/ui-egui/src/panels/symbols.rs @@ -457,7 +457,8 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } else if new.clicked() { // Alt skips Symbol Options: the symbol is made under the default name, dynamic as the // dialog's default. Shift keeps the selected art as ordinary art, with or without Alt. - let m = ui.input(|i| i.modifiers); + // Both are read as the primary button went up, when it did in this frame. + let m = modifiers_at_release(ui); let (cmd, mut p) = if m.alt { ("symbol.new", json!({"type": "dynamic"})) } else { ("ui.symbolOptions", json!({})) }; if m.shift { p["keepArt"] = json!(true); @@ -470,9 +471,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { // it: the dragged symbol, or every symbol Select All Unused picked when it is one of them. if let Some(name) = symbol_dropped(ui, &trash, &names, uid) { let picked = if marked.contains(&name) { &marked[..] } else { &[] }; - delete(app, picked, Some(&name), super::alt_held(ui)); + delete(app, picked, Some(&name), alt_at_release(ui)); } else if trash.clicked() { - delete(app, &marked, sel.as_deref(), super::alt_held(ui)); + delete(app, &marked, sel.as_deref(), alt_at_release(ui)); } }); } @@ -485,8 +486,9 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { let has_sel = app.session.active().is_some_and(|d| !d.selection.is_empty()); let inst = has_instances_selected(app); let name = json!({"name": sel}); - // Shift keeps the selected art as ordinary art instead of making it an instance. - let shift = ui.input(|i| i.modifiers.shift); + // Shift keeps the selected art as ordinary art instead of making it an instance. It is read as + // the primary button went up, when it did in this frame. + let shift = modifiers_at_release(ui).shift; let redefine = if shift { json!({"name": sel, "keepArt": true}) } else { name.clone() }; let new = if shift { json!({"keepArt": true}) } else { json!({}) }; let items: [(&str, bool, &str, Value); 3] = [ @@ -594,13 +596,13 @@ fn art_redefine_drop(ui: &Ui, item: &egui::Response, doc: &Document, uid: Option item.dnd_release_payload::().map(|_| ids.iter().map(|id| id.0).collect()) } -/// Whether Alt (Option) is held for a drop: when the primary button went up in this frame, as it +/// Whether Alt (Option) is held for a drop or a click: when the primary button went up in this frame, as it /// went up, else now. fn alt_at_release(ui: &Ui) -> bool { modifiers_at_release(ui).alt } -/// The modifiers held for a drop: when the primary button went up in this frame, as it went up, +/// The modifiers held for a drop or a click: when the primary button went up in this frame, as it went up, /// else now. fn modifiers_at_release(ui: &Ui) -> egui::Modifiers { ui.input(|i| { @@ -932,12 +934,20 @@ mod tests { /// Clicks the menu item labeled `label` with `modifiers` held. fn click_menu_held(ctx: &egui::Context, app: &mut VectorcraftApp, label: &str, modifiers: egui::Modifiers) { + click_menu_held_then(ctx, app, label, modifiers, vec![]); + } + + /// Clicks the menu item labeled `label` with `modifiers` held, `after` following the release in + /// its frame. + fn click_menu_held_then(ctx: &egui::Context, app: &mut VectorcraftApp, label: &str, modifiers: egui::Modifiers, after: Vec) { let held = egui::Event::ModifiersChanged(modifiers); let labels = menu_frame(ctx, app, vec![held.clone()]); let item = labels.iter().find(|(t, _)| t.trim() == label).map(|(_, r)| r.center()).unwrap_or_else(|| panic!("{label} in the menu")); let press = |pressed| egui::Event::PointerButton { pos: item, button: egui::PointerButton::Primary, pressed, modifiers }; menu_frame(ctx, app, vec![held.clone(), egui::Event::PointerMoved(item), press(true)]); - menu_frame(ctx, app, vec![held, press(false)]); + let mut last = vec![held, press(false)]; + last.extend(after); + menu_frame(ctx, app, last); } /// Redefine Symbol in the panel menu with Shift held updates the symbol and leaves the @@ -995,12 +1005,53 @@ mod tests { /// Clicks the panel's New Symbol button with `modifiers` held. fn click_new(app: &mut VectorcraftApp, modifiers: egui::Modifiers) { + click_button_then(app, "New Symbol", modifiers, vec![]); + } + + /// Clicks the panel's button labeled `label` with `modifiers` held, `after` following the + /// release in its frame. + fn click_button_then(app: &mut VectorcraftApp, label: &str, modifiers: egui::Modifiers, after: Vec) { let ctx = egui::Context::default(); ctx.enable_accesskit(); let out = frame_held(&ctx, app, vec![], modifiers); - let at = clickable(&out).into_iter().find(|(l, _)| l == "New Symbol").expect("a New Symbol button").1; + let at = clickable(&out).into_iter().find(|(l, _)| l == label).unwrap_or_else(|| panic!("a {label} button")).1; let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers }; - frame_held(&ctx, app, vec![egui::Event::PointerMoved(at), press(true), press(false)], modifiers); + let mut events = vec![egui::Event::PointerMoved(at), press(true), press(false)]; + events.extend(after); + frame_held(&ctx, app, events, modifiers); + } + + /// Shift held as the primary button goes up on New Symbol, on the panel's button or in its + /// menu, or on Redefine Symbol in the menu, keeps the selected art as ordinary art, though Shift + /// is let go later in the same frame. Alt held as the button goes up on Delete Symbol deletes + /// an unused symbol without asking, in the same case. + #[test] + fn shift_or_alt_let_go_after_the_release_in_the_same_frame_still_counts() { + let let_go = || vec![egui::Event::ModifiersChanged(egui::Modifiers::NONE)]; + let menu_ctx = || { + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + ctx + }; + let (mut app, _) = leaf_dot_and_rect(); + click_button_then(&mut app, "New Symbol", egui::Modifiers::SHIFT, let_go()); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(art(&app, "New Symbol"), (0, 1), "New Symbol button with Shift: the rectangle stays ordinary art"); + let (mut app, _) = leaf_dot_and_rect(); + click_button_then(&mut app, "New Symbol", egui::Modifiers::SHIFT | egui::Modifiers::ALT, let_go()); + assert_eq!(dialog_kind(&app), None, "Alt skips Symbol Options"); + assert_eq!(art(&app, "New Symbol"), (0, 1), "New Symbol button with Shift and Alt: the rectangle stays ordinary art"); + let (mut app, _) = leaf_dot_and_rect(); + click_menu_held_then(&menu_ctx(), &mut app, "New Symbol…", egui::Modifiers::SHIFT, let_go()); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(art(&app, "New Symbol"), (0, 1), "New Symbol… with Shift: the rectangle stays ordinary art"); + let (mut app, _) = leaf_dot_and_rect(); + click_menu_held_then(&menu_ctx(), &mut app, "Redefine Symbol", egui::Modifiers::SHIFT, let_go()); + assert_eq!(art(&app, "Dot"), (0, 1), "Redefine Symbol with Shift: the rectangle stays ordinary art"); + let mut app = leaf_and_dot(); + click_button_then(&mut app, "Delete Symbol", egui::Modifiers::ALT, let_go()); + assert!(app.ui.dialog.is_none(), "Alt deletes an unused symbol without asking"); + assert_eq!(symbols(&mut app), ["Leaf"]); } /// The New Symbol button with Shift held opens Symbol Options, whose OK keeps the selected art @@ -1846,12 +1897,7 @@ mod tests { /// Clicks the panel's Delete Symbol button with `modifiers` held. fn click_delete(app: &mut VectorcraftApp, modifiers: egui::Modifiers) { - let ctx = egui::Context::default(); - ctx.enable_accesskit(); - let out = frame_held(&ctx, app, vec![], modifiers); - let at = clickable(&out).into_iter().find(|(l, _)| l == "Delete Symbol").expect("a Delete Symbol button").1; - let press = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers }; - frame_held(&ctx, app, vec![egui::Event::PointerMoved(at), press(true), press(false)], modifiers); + click_button_then(app, "Delete Symbol", modifiers, vec![]); } /// Clicks the panel menu's Delete Symbol item. @@ -2482,7 +2528,8 @@ mod tests { frame(ctx, app, vec![egui::Event::PointerMoved(from + vec2(40.0, 40.0))]); frame(ctx, app, vec![egui::Event::PointerMoved(from + vec2(80.0, 80.0))]); let held = frame_held(ctx, app, vec![egui::Event::PointerMoved(to)], egui::Modifiers::NONE); - frame_held(ctx, app, vec![button(to, false)], modifiers); + let release = egui::Event::PointerButton { pos: to, button: egui::PointerButton::Primary, pressed: false, modifiers }; + frame_held(ctx, app, vec![release], modifiers); held } From 348f098b5f1e25bb4685886355b4e0a813b82a23 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:34:11 -0800 Subject: [PATCH 128/158] Docs: keep the list of categories that have sentences, with Slices added --- docs/target-app-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index bfcbc5018a..89096c3a57 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -821,7 +821,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Preferences › General describes its settings:** the line under the Preferences fields shows a sentence for each of the 32 General settings, Enable Contextual Task Bar included, when the pointer is over the setting's row or its control has the keyboard focus, and a screen reader gets the same sentence. The sentences are VectorCraft's own and state what the app does with each setting. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Selection & Anchor Display describes its settings:** the line under the Preferences fields shows a sentence for each of the 14 Selection & Anchor Display settings, from Tolerance to the Curvature Tool rubber band, on hover and on keyboard focus, and a screen reader gets the same sentence. The Snap to Point sentence states that the Smart Guides Snapping Tolerance applies while Smart Guides is on. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Guides & Grid describes its settings:** the line under the Preferences fields shows a sentence for each of the 12 Guides & Grid settings, from Snap to Grid to Pattern Editing's Tile Edge Color, on hover and on keyboard focus, and a screen reader gets the same sentence. The Show Pixel Grid sentence states that the pixel grid shows from 600% zoom. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. -- **Preferences › Smart Guides describes its settings:** the line under the Preferences fields shows a sentence for the Smart Guides box and for each of the 14 Smart Guides settings, from Color to Snap to Perpendicular, on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: Pixel Preview turns Smart Guides off and Snap to Grid snaps instead; with Alignment Guides off, art still lines up without the line; Object Highlighting outlines only an unselected object while a selection tool is not dragging; Snapping Tolerance is a distance on screen at every zoom; Snap to Last Location does not return a copy. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. +- **Preferences › Smart Guides describes its settings:** the line under the Preferences fields shows a sentence for the Smart Guides box and for each of the 14 Smart Guides settings, from Color to Snap to Perpendicular, on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: Pixel Preview turns Smart Guides off and Snap to Grid snaps instead; with Alignment Guides off, art still lines up without the line; Object Highlighting outlines only an unselected object while a selection tool is not dragging; Snapping Tolerance is a distance on screen at every zoom; Snap to Last Location does not return a copy. Units, General, Selection & Anchor Display, Guides & Grid, Smart Guides, Slices and Type have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Slices describes its settings:** the line under the Preferences fields shows a sentence for Show Slice Numbers and for Line Color on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: each slice's number shows in a box at its top left on the canvas, the slice outlines still show with numbers off, and auto slices use a dimmer shade of the line color. Units, General, Selection & Anchor Display, Guides & Grid, Smart Guides and Slices have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Type describes its settings:** the same line shows a sentence for each of the 23 Type settings, from Size/Leading to Measure Type by Glyph Bounds, when the pointer is over the setting's row or its control has the keyboard focus, and a screen reader gets the same sentence. Each sentence is VectorCraft's own and states what the app does with the setting: for example, which keys step by each increment, which panels show the East Asian and Indic options, and that the two pink highlights show only on screen. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Window › New Window (G7, #4116):** New Window (`window.newWindow`) opens another view of the current document ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html) describes showing one document in several windows at once), with its own zoom, center, rotation, artboard and Outline or Preview, as a tab of its own; an edit in one view shows in every view. Tile, Cascade, Float in Window, Float All in Windows and Consolidate All Windows arrange each view as they arrange a document, and Next and Previous Document step through the views. Closing a view leaves the document open; closing its last view closes the document, asking to save it first. The view's number after the name in its tab ("Name:2", while the document has more than one view) is VectorCraft's own. Tests: `crates/ui-egui/src/doc_windows/tests.rs`. From 06e8ce62b950128190951d135b68bea6141faa32 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:07:47 +0530 Subject: [PATCH 129/158] M7/G4: retype matching reads contours as drawn, checks whole outlines (#4934) Contours are read from a starting corner that does not depend on where the path starts (every tied corner tried), with straight edges split in two, degenerate curves and empty segments read as one line. A sampled fit only shortlists a glyph: its whole outline, turned onto the shape, must lie on it. Face keys are compact hashes, kept per process within a budget; kept keys stay when new ones do not fit, and go when fonts are added or rescanned. A compound path with a locked or hidden part stays whole. A group with an Attributes note, or any other extra, keeps its type inside. Faces are counted once against the cap, and no font is read when every shape stays an outline. --- crates/engine/src/cmd/retype.rs | 28 +- crates/engine/src/cmd/retype_tests.rs | 46 +++ crates/text/src/retype.rs | 434 +++++++++++++++++++++----- 3 files changed, 417 insertions(+), 91 deletions(-) diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index 28a74ac6a9..df0d88a489 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -100,7 +100,8 @@ fn collect(n: &Node, parent: Option, depth: usize, barrier: &mut bool, t let mut path = BezPath::new(); for c in children { match &c.kind { - NodeKind::Path { path: p, .. } if p.is_closed() => path.extend(p.to_bezpath()), + // A hidden or locked path keeps its whole compound as it is. + NodeKind::Path { path: p, .. } if p.is_closed() && c.visible && !c.locked => path.extend(p.to_bezpath()), _ => { *barrier = true; return; @@ -140,12 +141,21 @@ fn candidate_faces(db: &FontDb, d: &Document, fonts: &[String]) -> Vec= cap { break 'families; } - if let Some(face) = db.face(f, &style) { + if let Some(face) = db.face(f, &style) + && !faces.iter().any(|k: &Arc| k.id() == face.id()) + { faces.push(face); } } } - faces.extend(db.loaded_faces().into_iter().take(cap.saturating_sub(faces.len()))); + for face in db.loaded_faces() { + if faces.len() >= cap { + break; + } + if !faces.iter().any(|k| k.id() == face.id()) { + faces.push(face); + } + } faces } @@ -376,9 +386,10 @@ fn retype(s: &mut Session, p: &Value) -> Result { } // Only glyphs with a selected shape's key (segments per contour) can match one: the others are // not sampled. - let wanted: std::collections::BTreeSet> = + let wanted: std::collections::BTreeSet = pieces.iter().filter(|pc| !pc.keeps_outline).filter_map(|pc| vectorcraft_text::retype::shape_key(&pc.path)).collect(); - let index = RetypeIndex::build(db, candidate_faces(db, d, &fonts), &wanted); + // Nothing to match (every shape stays an outline): no font is read. + let index = if wanted.is_empty() { RetypeIndex::default() } else { RetypeIndex::build(db, candidate_faces(db, d, &fonts), &wanted) }; let found: Vec> = pieces.iter().map(|pc| if pc.keeps_outline { vec![] } else { index.matches(&pc.path) }).collect(); // The face most shapes match, so a glyph several fonts share is set in the same font as // the glyphs around it. @@ -462,7 +473,12 @@ fn retype(s: &mut Session, p: &Value) -> Result { && n.blend == vectorcraft_color::BlendMode::Normal && *n.appearance == Appearance::default() && n.name.is_none() - && n.extras().mask.is_none() + // Its mask, Attributes note and the rest of what few objects have stay with it. + && { + let mut ex = n.extras().clone(); + ex.type_outlines = false; + ex == vectorcraft_doc::NodeExtras::default() + } // Isolation and knockout change how the group composites its type. && !n.isolate && n.knockout == vectorcraft_doc::Knockout::default() diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index cbbf1e0302..7812fc8e65 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -411,3 +411,49 @@ fn timing_with_a_large_cjk_face() { s.execute("edit.undo", &json!({})).unwrap(); } } + +#[test] +fn a_compound_with_a_locked_or_hidden_part_stays_whole() { + let mut s = session(); + // "B" outlines as a compound path of three contours. + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); + let b = children_of(&s, g)[1]; + let part = children_of(&s, b)[1]; + s.edit("test", |d, _| { + d.node_mut(NodeId(part)).unwrap().locked = true; + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + assert_eq!(r["texts"], json!(["A"]), "{r}"); + let d = &s.doc().unwrap().doc; + assert!(d.node(NodeId(part)).unwrap().locked, "B's locked part, and B, stay as they are"); +} + +#[test] +fn a_group_with_an_attributes_note_keeps_its_type_inside() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); + s.execute("attributes.set", &json!({"ids": [g], "note": "logo, keep"})).unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + let id = r["ids"][0].as_u64().unwrap(); + assert_eq!(children_of(&s, g), vec![id], "the group and its note stay, holding the type"); +} + +#[test] +fn nothing_retypable_reads_no_font() { + let mut s = session(); + let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "A", "size": 40})); + let a = children_of(&s, g)[0]; + s.edit("test", |d, _| { + let art = vectorcraft_doc::Node::path(d.alloc_id(), vectorcraft_geom::PathData::default(), Default::default()); + d.node_mut(NodeId(a)).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new(art, true))); + Ok(()) + }) + .unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let e = s.execute("type.retype", &json!({})).unwrap_err().to_string(); + assert!(e.contains("(1 checked)"), "the masked shape is reported, and no font was indexed: {e}"); +} diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs index 30a640c3c7..80fed5f33a 100644 --- a/crates/text/src/retype.rs +++ b/crates/text/src/retype.rs @@ -1,18 +1,20 @@ //! Retype's glyph matching (Type › Retype, #4934): which glyph of which loaded font an outlined //! glyph's shape is, the same up to uniform scale, rotation and translation. //! -//! Phase 1 is exact matching only: a shape matches a glyph when, after the best similarity -//! transform (a Procrustes fit over points sampled at equal steps of arc length along each -//! contour), the leftover distance is a tiny fraction of the shape's size. That holds for outlines -//! made from a font the app has (Create Outlines' output, and other apps' that keep each glyph's -//! contours whole and in the font's order). Near matches (other versions of a font, hinted or -//! simplified outlines, faux styles, glyphs merged into one path) are left unmatched; fuzzy -//! identification is phase 2. +//! Phase 1 is exact matching only. Each contour is read from a starting corner that does not +//! depend on where the path happens to start (the corner farthest from the shape's corners' +//! centre; every such corner is tried when several tie), with straight edges split in two read as +//! one. Points sampled at equal steps of arc length along the contours shortlist the glyphs whose +//! best similarity transform (a Procrustes fit) leaves a tiny leftover distance, and the whole +//! outline, turned onto the shape, must then lie on it. That holds for outlines made from a font +//! the app has (Create Outlines' output, and other apps' that keep each glyph's contours whole and +//! in the font's order). Near matches (other versions of a font, hinted or simplified outlines, +//! faux styles, glyphs merged into one path) are left unmatched; fuzzy identification is phase 2. -use std::collections::HashMap; +use std::collections::{BTreeSet, HashMap}; use std::sync::Arc; -use kurbo::{BezPath, CubicBez, Line, ParamCurve, ParamCurveArclen, PathEl, PathSeg, Point, QuadBez, Shape}; +use kurbo::{Affine, BezPath, CubicBez, Line, ParamCurve, ParamCurveArclen, ParamCurveNearest, PathEl, PathSeg, Point, QuadBez, Shape}; use crate::{FontDb, FontFace}; @@ -28,9 +30,16 @@ pub const MAX_ELEMENTS: usize = 4096; const MAX_CONTOURS: usize = 48; /// Points sampled along each contour. const SAMPLES: usize = 32; +/// The most readings of a shape (one per choice of tied starting corners) that are tried. +const MAX_VARIANTS: usize = 64; /// The largest leftover distance (root mean square over the samples) for a match, as a fraction of /// the shape's spread about its centre. const TOLERANCE: f64 = 2e-3; +/// How far the whole outline, turned onto the shape, may lie from it (both ways), as a fraction of +/// the shape's spread. +const OUTLINE_TOLERANCE: f64 = 5e-3; +/// Points of a flattened outline past which the whole-outline check gives up (and so rejects). +const MAX_OUTLINE_POINTS: usize = 8192; /// How far apart two shapes' spread-to-length ratios may be and still be compared. const INVARIANT_SLACK: f64 = 0.02; @@ -70,9 +79,12 @@ struct Entry { gid: u32, ch: char, sig: Signature, + /// The glyph's outline in font units, for the whole-outline check. + outline: BezPath, } /// The glyphs of a set of faces, ready to match shapes against. +#[derive(Default)] pub struct RetypeIndex { faces: Vec>, entries: Vec, @@ -81,11 +93,11 @@ pub struct RetypeIndex { } impl RetypeIndex { - /// Index the outline glyphs of `faces` (the first [`MAX_FACES`], each face once) that have one - /// of the shape keys in `keys` (the selected shapes' [`shape_key`]s): the others could match no - /// shape, so they are not sampled. Outlines are read past the shared outline - /// cache, which keeps the canvas's glyphs. - pub fn build(db: &FontDb, faces: impl IntoIterator>, keys: &std::collections::BTreeSet>) -> Self { + /// Index the outline glyphs of `faces` (the first [`MAX_FACES`], each face once) whose + /// [`shape_key`] is in `keys` (the selected shapes' keys): the others could match no shape, so + /// they are not sampled. Outlines are read past the shared outline cache, which keeps the + /// canvas's glyphs. + pub fn build(db: &FontDb, faces: impl IntoIterator>, keys: &BTreeSet) -> Self { let mut kept: Vec> = vec![]; for f in faces { if kept.len() >= MAX_FACES { @@ -96,22 +108,18 @@ impl RetypeIndex { } } let mut entries = vec![]; - for (fi, face) in kept.iter().enumerate() { - if entries.len() >= MAX_GLYPHS { - break; - } - for (gid, ch, key) in face_keys(db, face).iter() { + 'faces: for (fi, face) in kept.iter().enumerate() { + for &(gid, ch, key) in face_keys(db, face).iter() { // The budget holds inside a face too: no glyph is sampled past it. if entries.len() >= MAX_GLYPHS { - break; + break 'faces; } - if !keys.contains(key) { + if !keys.contains(&key) { continue; } - let (gid, ch) = (*gid, *ch); let outline = db.outline_uncached(face, gid); - if let Some(sig) = signature(&outline) { - entries.push(Entry { face: fi, gid, ch, sig }); + if let Some(sig) = signatures(&outline, false).into_iter().next() { + entries.push(Entry { face: fi, gid, ch, sig, outline }); } } } @@ -145,10 +153,11 @@ impl RetypeIndex { /// The glyphs `shape` (in document space) is, the closest one per face, closest first; empty /// when it is no glyph of the indexed faces. pub fn matches(&self, shape: &BezPath) -> Vec { - let Some(sig) = signature(shape) else { return vec![] }; - let Some(list) = self.buckets.get(&sig.contours) else { return vec![] }; - let lo = sig.invariant * (1.0 - INVARIANT_SLACK); - let hi = sig.invariant * (1.0 + INVARIANT_SLACK); + let variants = signatures(shape, true); + let Some(first) = variants.first() else { return vec![] }; + let Some(list) = self.buckets.get(&first.contours) else { return vec![] }; + let lo = first.invariant * (1.0 - INVARIANT_SLACK); + let hi = first.invariant * (1.0 + INVARIANT_SLACK); let start = list.partition_point(|i| self.entries.get(*i).is_some_and(|e| e.sig.invariant < lo)); let mut best: HashMap = HashMap::new(); for i in list.iter().skip(start) { @@ -156,7 +165,11 @@ impl RetypeIndex { if e.sig.invariant > hi { break; } - let Some((z, residual)) = fit(&e.sig, &sig) else { continue }; + // The reading of the shape (its tied starting corners) that fits the glyph best. + let Some((sig, z, residual)) = variants.iter().filter_map(|s| fit(&e.sig, s).map(|(z, r)| (s, z, r))).min_by(|a, b| a.2.total_cmp(&b.2)) + else { + continue; + }; if residual > TOLERANCE { continue; } @@ -164,6 +177,12 @@ impl RetypeIndex { // The glyph's origin is (0, 0) in font units: it lands at centre − z·glyph centre. let gc = mul(z, e.sig.centre); let origin = Point::new(sig.centre.x - gc.x, sig.centre.y - gc.y); + // The samples can step over a detail (a notch between two of them): the whole outline, + // turned onto the shape, must lie on it. + let onto = Affine::new([z.0, z.1, -z.1, z.0, origin.x, origin.y]); + if !outlines_agree(&(onto * e.outline.clone()), shape, sig.spread * OUTLINE_TOLERANCE) { + continue; + } let m = GlyphMatch { face: face.clone(), gid: e.gid, @@ -189,20 +208,36 @@ impl RetypeIndex { /// A face's glyphs as the index looks them up: (glyph, character, [`shape_key`]), one per glyph /// under the lowest character that maps to it. -type FaceKeys = Arc)>>; +type FaceKeys = Arc>; -/// How many faces' keys [`face_keys`] keeps. -const KEPT_FACE_KEYS: usize = 32; +/// How many glyph keys [`face_keys`] keeps in all (16 bytes each). +const KEPT_KEYS: usize = 1 << 20; + +/// The faces' keys [`face_keys`] keeps, for the database generation they were read in. +#[derive(Default)] +struct KeptKeys { + generation: u64, + glyphs: usize, + faces: HashMap<(u64, u32), FaceKeys>, +} /// [`FaceKeys`] of `face`, worked out once per face (each glyph drawn once, past the outline -/// cache) and kept: a later Retype samples only the glyphs whose key a selected shape has. +/// cache) and kept: a later Retype samples only the glyphs whose key a selected shape has. Keys +/// already kept stay while new faces' keys would not fit, so a run over more faces than fit still +/// finds the same ones kept the next time; they are let go when fonts are added or rescanned. fn face_keys(db: &FontDb, face: &FontFace) -> FaceKeys { - type Kept = std::sync::Mutex>; - static KEPT: std::sync::OnceLock = std::sync::OnceLock::new(); + static KEPT: std::sync::OnceLock> = std::sync::OnceLock::new(); let kept = KEPT.get_or_init(Default::default); let at = (db.id(), face.id()); - if let Some(k) = kept.lock().unwrap_or_else(|e| e.into_inner()).get(&at) { - return k.clone(); + let generation = db.generation(); + { + let mut k = kept.lock().unwrap_or_else(|e| e.into_inner()); + if k.generation != generation { + *k = KeptKeys { generation, ..Default::default() }; + } + if let Some(keys) = k.faces.get(&at) { + return keys.clone(); + } } let mut by_gid: HashMap = HashMap::new(); for &(c, gid) in face.mapped_chars().iter().take(MAX_GLYPHS_PER_FACE) { @@ -214,11 +249,11 @@ fn face_keys(db: &FontDb, face: &FontFace) -> FaceKeys { let mut gids: Vec<(u32, char)> = by_gid.into_iter().collect(); gids.sort_unstable(); let keys: FaceKeys = Arc::new(gids.into_iter().filter_map(|(gid, ch)| Some((gid, ch, shape_key(&db.outline_uncached(face, gid))?))).collect()); - let mut kept = kept.lock().unwrap_or_else(|e| e.into_inner()); - if kept.len() >= KEPT_FACE_KEYS { - kept.clear(); + let mut k = kept.lock().unwrap_or_else(|e| e.into_inner()); + if k.generation == generation && k.glyphs + keys.len() <= KEPT_KEYS { + k.glyphs += keys.len(); + k.faces.insert(at, keys.clone()); } - kept.insert(at, keys.clone()); keys } @@ -264,7 +299,68 @@ fn fit(g: &Signature, s: &Signature) -> Option<((f64, f64), f64)> { rel.is_finite().then_some((z, rel)) } -/// `path`'s contours as segments, the closing line included; `None` past the size caps. +/// Do outlines `a` and `b` (in one space) lie on each other: every point of each, flattened, within +/// `tol` of the other? `false` when either is too large to check. +fn outlines_agree(a: &BezPath, b: &BezPath, tol: f64) -> bool { + if !tol.is_finite() || tol <= 0.0 { + return false; + } + let flat = |p: &BezPath| -> Option> { + let mut segs = vec![]; + let (mut start, mut last) = (Point::ZERO, Point::ZERO); + let mut too_many = false; + kurbo::flatten(p.iter(), tol / 4.0, |el| { + if segs.len() > MAX_OUTLINE_POINTS { + too_many = true; + return; + } + match el { + PathEl::MoveTo(q) => (start, last) = (q, q), + PathEl::LineTo(q) => { + segs.push((last, q)); + last = q; + } + PathEl::ClosePath => { + segs.push((last, start)); + last = start; + } + _ => {} + } + }); + (!too_many).then_some(segs) + }; + let (Some(sa), Some(sb)) = (flat(a), flat(b)) else { return false }; + let near = |p: Point, segs: &[(Point, Point)]| segs.iter().any(|(s, e)| Line::new(*s, *e).nearest(p, 1e-9).distance_sq <= tol * tol); + sa.iter().all(|(p, _)| near(*p, &sb)) && sb.iter().all(|(p, _)| near(*p, &sa)) +} + +/// `seg` as a line when it is one (a curve with its handles on its ends or on its line), else as it is. +fn as_line(seg: PathSeg) -> PathSeg { + let on_line = |a: Point, b: Point, p: Point| { + let ab = b - a; + let len = ab.hypot(); + len > 0.0 && (ab.cross(p - a)).abs() <= len * len * 1e-12 && (p - a).dot(ab) >= 0.0 && (p - b).dot(ab) <= 0.0 + }; + match seg { + PathSeg::Quad(q) if q.p1 == q.p0 || q.p1 == q.p2 || on_line(q.p0, q.p2, q.p1) => PathSeg::Line(Line::new(q.p0, q.p2)), + PathSeg::Cubic(c) if (c.p1 == c.p0 || on_line(c.p0, c.p3, c.p1)) && (c.p2 == c.p3 || on_line(c.p0, c.p3, c.p2)) => { + PathSeg::Line(Line::new(c.p0, c.p3)) + } + s => s, + } +} + +/// Lines `a` then `b` run on in one direction: one edge split in two. +fn runs_on(a: &PathSeg, b: &PathSeg) -> bool { + let (PathSeg::Line(a), PathSeg::Line(b)) = (a, b) else { return false }; + let (u, v) = (a.p1 - a.p0, b.p1 - b.p0); + let (lu, lv) = (u.hypot(), v.hypot()); + lu > 0.0 && lv > 0.0 && u.cross(v).abs() <= lu * lv * 1e-9 && u.dot(v) > 0.0 +} + +/// `path`'s contours as segments, the closing line included, read the same however the path was +/// written: segments that go nowhere are dropped, curves that are straight read as lines, and a +/// straight edge split in two (around the start too) reads as one. `None` past the size caps. fn contours(path: &BezPath) -> Option>> { if path.elements().len() > MAX_ELEMENTS { return None; @@ -272,9 +368,29 @@ fn contours(path: &BezPath) -> Option>> { let mut out: Vec> = vec![]; let mut cur: Vec = vec![]; let (mut start, mut last) = (Point::ZERO, Point::ZERO); - let mut flush = |cur: &mut Vec, start: Point, last: Point| { + let push = |cur: &mut Vec, seg: PathSeg| { + let seg = as_line(seg); + if seg.start() == seg.end() && matches!(seg, PathSeg::Line(_)) { + return; + } + match cur.last_mut() { + Some(prev) if runs_on(prev, &seg) => *prev = PathSeg::Line(Line::new(prev.start(), seg.end())), + _ => cur.push(seg), + } + }; + let flush = |cur: &mut Vec, start: Point, last: Point, out: &mut Vec>| { if last.distance(start) > 0.0 { - cur.push(PathSeg::Line(Line::new(last, start))); + push(cur, PathSeg::Line(Line::new(last, start))); + } + // An edge split at the contour's start: its two halves are the last and first segments. + if cur.len() > 1 + && let (Some(l), Some(f)) = (cur.last().copied(), cur.first().copied()) + && runs_on(&l, &f) + { + cur.pop(); + if let Some(first) = cur.first_mut() { + *first = PathSeg::Line(Line::new(l.start(), f.end())); + } } if !cur.is_empty() { out.push(std::mem::take(cur)); @@ -283,74 +399,135 @@ fn contours(path: &BezPath) -> Option>> { for el in path.elements() { match *el { PathEl::MoveTo(p) => { - flush(&mut cur, start, last); + flush(&mut cur, start, last, &mut out); start = p; last = p; } PathEl::LineTo(p) => { - cur.push(PathSeg::Line(Line::new(last, p))); + push(&mut cur, PathSeg::Line(Line::new(last, p))); last = p; } PathEl::QuadTo(a, p) => { - cur.push(PathSeg::Quad(QuadBez::new(last, a, p))); + push(&mut cur, PathSeg::Quad(QuadBez::new(last, a, p))); last = p; } PathEl::CurveTo(a, b, p) => { - cur.push(PathSeg::Cubic(CubicBez::new(last, a, b, p))); + push(&mut cur, PathSeg::Cubic(CubicBez::new(last, a, b, p))); last = p; } PathEl::ClosePath => { - flush(&mut cur, start, last); + flush(&mut cur, start, last, &mut out); last = start; } } + if out.len() > MAX_CONTOURS { + return None; + } } - flush(&mut cur, start, last); + flush(&mut cur, start, last, &mut out); (out.len() <= MAX_CONTOURS).then_some(out) } -/// How many contours with length `path` has, as matching counts them; `None` past the size caps. /// A cheap key two shapes share when one is the other scaled, turned and moved: how many segments -/// each of its contours has, in order (segments that go nowhere left out, a closing line counted -/// once whether the path draws it or closes onto it). Glyphs whose key no selected shape has are -/// not sampled. `None` past the size caps. -pub fn shape_key(path: &BezPath) -> Option> { - let moves = |s: &PathSeg| match s { - PathSeg::Line(l) => l.p0 != l.p1, - PathSeg::Quad(q) => q.p0 != q.p1 || q.p1 != q.p2, - PathSeg::Cubic(c) => c.p0 != c.p1 || c.p1 != c.p2 || c.p2 != c.p3, - }; - let key: Vec = contours(path)?.iter().map(|c| c.iter().filter(|s| moves(s)).count()).filter(|n| *n > 0).collect(); - (!key.is_empty()).then_some(key) +/// each of its contours has, in order, as [`contours`] reads them, hashed. Glyphs whose key no +/// selected shape has are not sampled. `None` past the size caps or for an empty shape. +pub fn shape_key(path: &BezPath) -> Option { + let cs = contours(path)?; + if cs.is_empty() { + return None; + } + // FNV-1a over the counts: equal keys for equal counts; a rare clash only samples a glyph more. + let mut h: u64 = 0xcbf2_9ce4_8422_2325; + for n in std::iter::once(cs.len()).chain(cs.iter().map(Vec::len)) { + for b in (n as u64).to_le_bytes() { + h ^= u64::from(b); + h = h.wrapping_mul(0x0000_0100_0000_01b3); + } + } + Some(h) } -fn signature(path: &BezPath) -> Option { +/// `path` read for matching: one reading per choice of starting corners (the corner of each contour +/// farthest from the centre of all the shape's corners; every tied corner when `all_ties`, else the +/// first), at most [`MAX_VARIANTS`]. Empty for a shape with nothing to match. +fn signatures(path: &BezPath, all_ties: bool) -> Vec { let bounds = path.bounding_box(); let size = bounds.width().hypot(bounds.height()); if !size.is_finite() || size <= 0.0 { - return None; + return vec![]; } let accuracy = size * 1e-6; - let mut pts = vec![]; - let mut total = 0.0; - let mut contours_n = 0; - for c in contours(path)? { - let lens: Vec = c.iter().map(|s| s.arclen(accuracy)).collect(); - let len: f64 = lens.iter().sum(); - // A contour with no length (a lone move) draws nothing. - if !len.is_finite() || len <= size * 1e-9 { - continue; + let Some(cs) = contours(path) else { return vec![] }; + // Each contour with length, with its segments' lengths. + let cs: Vec<(Vec, Vec)> = cs + .into_iter() + .map(|c| { + let lens: Vec = c.iter().map(|s| s.arclen(accuracy)).collect(); + (c, lens) + }) + .filter(|(_, lens)| { + let len: f64 = lens.iter().sum(); + len.is_finite() && len > size * 1e-9 + }) + .collect(); + let corners: Vec = cs.iter().flat_map(|(c, _)| c.iter().map(|s| s.start())).collect(); + if corners.is_empty() { + return vec![]; + } + let n = corners.len() as f64; + let mid = Point::new(corners.iter().map(|p| p.x).sum::() / n, corners.iter().map(|p| p.y).sum::() / n); + // Each contour's starting corners: those farthest from `mid`, ties within a hair. + let starts: Vec> = cs + .iter() + .map(|(c, _)| { + let d: Vec = c.iter().map(|s| s.start().distance(mid)).collect(); + let far = d.iter().copied().fold(0.0, f64::max); + let tied: Vec = d.iter().enumerate().filter(|(_, v)| **v >= far - size * 1e-7).map(|(i, _)| i).collect(); + if all_ties { tied } else { tied.into_iter().take(1).collect() } + }) + .collect(); + let mut out = vec![]; + let mut pick = vec![0usize; cs.len()]; + loop { + if out.len() >= MAX_VARIANTS { + break; } - total += len; - contours_n += 1; - let (mut si, mut before) = (0usize, 0.0); - for k in 0..SAMPLES { - let at = len * k as f64 / SAMPLES as f64; - while si + 1 < c.len() && before + lens.get(si).copied().unwrap_or(0.0) < at { - before += lens.get(si).copied().unwrap_or(0.0); - si += 1; + if let Some(sig) = sample(&cs, &starts, &pick, accuracy) { + out.push(sig); + } + // The next choice of tied corners (a counter in mixed radix). + let mut i = 0; + loop { + let Some((p, s)) = pick.get_mut(i).zip(starts.get(i)) else { return out }; + *p += 1; + if *p < s.len() { + break; } - let (Some(seg), Some(l)) = (c.get(si), lens.get(si)) else { return None }; + *p = 0; + i += 1; + } + } + out +} + +/// One reading of the contours `cs`, contour `i` starting at segment `starts[i][pick[i]]`. +fn sample(cs: &[(Vec, Vec)], starts: &[Vec], pick: &[usize], accuracy: f64) -> Option { + let mut pts = Vec::with_capacity(cs.len() * SAMPLES); + let mut total = 0.0; + for (((c, lens), s), p) in cs.iter().zip(starts).zip(pick) { + let from = *s.get(*p)?; + let m = c.len(); + let len: f64 = lens.iter().sum(); + total += len; + let (mut k, mut before) = (0usize, 0.0); + let at_k = |k: usize| (from + k) % m; + for j in 0..SAMPLES { + let at = len * j as f64 / SAMPLES as f64; + while k + 1 < m && before + lens.get(at_k(k)).copied().unwrap_or(0.0) < at { + before += lens.get(at_k(k)).copied().unwrap_or(0.0); + k += 1; + } + let (Some(seg), Some(l)) = (c.get(at_k(k)), lens.get(at_k(k))) else { return None }; let t = if *l > 0.0 { seg.inv_arclen((at - before).clamp(0.0, *l), accuracy) } else { 0.0 }; pts.push(seg.eval(t)); } @@ -364,16 +541,21 @@ fn signature(path: &BezPath) -> Option { *p = Point::new(p.x - centre.x, p.y - centre.y); } let spread = (pts.iter().map(|p| p.x * p.x + p.y * p.y).sum::() / n).sqrt(); - if !spread.is_finite() || spread <= 0.0 { + if !spread.is_finite() || spread <= 0.0 || !total.is_finite() || total <= 0.0 { return None; } - Some(Signature { contours: contours_n, pts, centre, spread, invariant: spread / total }) + Some(Signature { contours: cs.len(), pts, centre, spread, invariant: spread / total }) +} + +/// The first reading of `path` (for tests). +#[cfg(test)] +fn signature(path: &BezPath) -> Option { + signatures(path, false).into_iter().next() } #[cfg(test)] mod tests { use super::*; - use kurbo::Affine; fn letter() -> BezPath { // A hand-made "P"-like shape: an outer contour and a counter. @@ -464,4 +646,86 @@ mod tests { } assert!(signature(&huge).is_none()); } + + /// The best fit of `shape`'s readings onto `glyph`'s first one. + fn best_fit(glyph: &BezPath, shape: &BezPath) -> f64 { + let g = signature(glyph).unwrap(); + signatures(shape, true).iter().filter_map(|s| fit(&g, s)).map(|(_, r)| r).fold(f64::INFINITY, f64::min) + } + + #[test] + fn a_contour_started_at_another_corner_still_matches() { + // The counter of letter(), started at its second corner instead of its first. + let mut p = BezPath::new(); + p.move_to((0.0, 0.0)); + p.line_to((0.0, -700.0)); + p.curve_to((300.0, -700.0), (450.0, -600.0), (450.0, -480.0)); + p.quad_to((450.0, -300.0), (120.0, -300.0)); + p.line_to((120.0, 0.0)); + p.close_path(); + p.move_to((120.0, -400.0)); + p.quad_to((330.0, -400.0), (330.0, -500.0)); + p.quad_to((330.0, -600.0), (120.0, -600.0)); + p.line_to((120.0, -400.0)); + p.close_path(); + let shape = Affine::translate((40.0, 90.0)) * Affine::rotate(-1.1) * Affine::scale(0.03) * p; + assert_eq!(shape_key(&shape), shape_key(&letter())); + assert!(best_fit(&letter(), &shape) < 1e-6); + // A triangle started at each of its corners. + let tri = |a: (f64, f64), b: (f64, f64), c: (f64, f64)| { + let mut t = BezPath::new(); + t.move_to(a); + t.line_to(b); + t.line_to(c); + t.close_path(); + t + }; + let g = tri((0.0, 0.0), (300.0, 0.0), (0.0, -400.0)); + for s in [tri((300.0, 0.0), (0.0, -400.0), (0.0, 0.0)), tri((0.0, -400.0), (0.0, 0.0), (300.0, 0.0))] { + assert!(best_fit(&g, &s) < 1e-6); + } + } + + #[test] + fn an_edge_split_in_two_reads_as_one() { + let mut p = BezPath::new(); + p.move_to((0.0, 0.0)); + p.line_to((0.0, -350.0)); + p.line_to((0.0, -700.0)); + p.curve_to((300.0, -700.0), (450.0, -600.0), (450.0, -480.0)); + p.quad_to((450.0, -300.0), (120.0, -300.0)); + p.line_to((120.0, 0.0)); + p.line_to((60.0, 0.0)); + p.close_path(); + p.move_to((120.0, -600.0)); + p.line_to((120.0, -400.0)); + p.quad_to((330.0, -400.0), (330.0, -500.0)); + p.quad_to((330.0, -600.0), (120.0, -600.0)); + p.close_path(); + assert_eq!(shape_key(&p), shape_key(&letter()), "split edges, the closing one too, read as one"); + assert!(best_fit(&letter(), &p) < 1e-6); + } + + #[test] + fn a_detail_between_samples_fails_the_whole_outline_check() { + let bar = |notch: f64| { + let mut p = BezPath::new(); + p.move_to((0.0, 0.0)); + p.line_to((1000.0, 0.0)); + p.line_to((1000.0, -100.0)); + // A notch 2 units wide, in or out, between two samples along the top edge. + p.line_to((501.0, -100.0)); + p.line_to((501.0, -100.0 + notch)); + p.line_to((499.0, -100.0 + notch)); + p.line_to((499.0, -100.0)); + p.line_to((0.0, -100.0)); + p.close_path(); + p + }; + let (out, inn) = (bar(-10.0), bar(10.0)); + assert_eq!(shape_key(&out), shape_key(&inn), "same key"); + let tol = signature(&inn).unwrap().spread * OUTLINE_TOLERANCE; + assert!(!outlines_agree(&out, &inn, tol), "the whole outline does"); + assert!(outlines_agree(&out, &out, tol)); + } } From 405490a52a5d9126c7692edf349fc10bbc7a0da2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:39:59 -0800 Subject: [PATCH 130/158] Pen: the rubber band after a smooth anchor is the curve a click adds The preview segment from an anchor with an outgoing handle was drawn as a quadratic curve through that handle, while a click appends a corner anchor, which makes the cubic curve that leaves along the handle and arrives without one. The segment changed shape when the anchor went down. The rubber band now draws that cubic curve. Part of #8296. --- crates/tools/src/pen.rs | 4 +++- crates/tools/src/pen/tests.rs | 21 +++++++++++++++++++++ docs/target-app-parity.md | 1 + 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/crates/tools/src/pen.rs b/crates/tools/src/pen.rs index b1077d5a12..0322c82ca3 100644 --- a/crates/tools/src/pen.rs +++ b/crates/tools/src/pen.rs @@ -525,10 +525,12 @@ impl Tool for PenTool { && let (Some((id, _, _, last, out)), Some(h)) = (self.active(cx), self.hover) { if cx.pen_rubber_band { + // The segment a click at `h` adds: it leaves the last anchor along its outgoing + // handle and arrives at the new corner anchor without a handle. let mut bp = BezPath::new(); bp.move_to(last); if out.distance(last) > 1e-9 { - bp.quad_to(out, h); + bp.curve_to(out, h, h); } else { bp.line_to(h); } diff --git a/crates/tools/src/pen/tests.rs b/crates/tools/src/pen/tests.rs index 710c39ae7a..7b804685b3 100644 --- a/crates/tools/src/pen/tests.rs +++ b/crates/tools/src/pen/tests.rs @@ -865,6 +865,27 @@ fn anchors_snap_to_smart_guides() { assert_eq!(a[1], Action::Preview("path.create".into(), json!({"anchors": [{"x": 100.0, "y": 100.0}]}))); } +/// The rubber band after a smooth anchor is the curve the click then adds: it leaves along the +/// anchor's outgoing handle and arrives at the new corner anchor without a handle, so the segment +/// keeps its shape when the anchor goes down (#8296). +#[test] +fn rubber_band_is_the_segment_a_click_adds() { + let (last, out) = (Point::new(60.0, 300.0), Point::new(110.0, 250.0)); + let sub = vectorcraft_geom::SubPath::new(vec![Anchor::corner(Point::new(10.0, 300.0)), Anchor::smooth(last, out)], false); + let (d, id, s) = drawing(sub); + let p = paint(); + let cx = ToolContext { zoom: 1.0, smart_guides: false, snap_to_point: false, snap_to_pixel: false, snap_to_grid: false, ..cx(&d, &s, &p) }; + let h = Point::new(237.0, 361.0); + let mut t = PenTool { drawing: true, ..PenTool::default() }; + t.pointer(&cx, &PointerEvent::new(PointerKind::Move, h.x, h.y)); + let band: Vec<_> = + t.overlays(&cx).into_iter().filter_map(|o| if let Overlay::Path { path, .. } = o { Some(path.elements().to_vec()) } else { None }).collect(); + assert_eq!(band, vec![vec![vectorcraft_geom::PathEl::MoveTo(last), vectorcraft_geom::PathEl::CurveTo(out, h, h)]]); + // The click adds a corner anchor there: the segment drawn is the one previewed. + let a = click(&mut t, &cx, h.x, h.y, Mods::default()); + assert_eq!(a[1], Action::Preview("path.appendAnchor".into(), json!({"id": id.0, "x": h.x, "y": h.y, "subpath": 0}))); +} + /// With Enable Rubber Band off, the preview segment is hidden but Measurement Labels still shows /// the D / Angle / dX / dY readout at the snapped point before the next click. #[test] diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 749dce93d3..2a4b546c81 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1169,6 +1169,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Measure tools and Snap to Glyph:** with Snap to Glyph, Smart Guides and Alignment Guides on, and Snap to Grid and Snap to Pixel off, both ends of a Measure or Measure & Inspect drag land within the snapping tolerance on the guides of live type that the Character panel's options allow, except Anchor Point, and a Shift-drag's end slides along its 45° step to them. The guide shows during the drag. This is VectorCraft's own rule (`Targets::for_measure`, `xform::measure::tests::its_ends_land_on_glyph_guides_with_snap_to_glyph`); scores and estimates unchanged. - **Drawing readout without the rubber band:** with Enable Rubber Band for the Pen or Curvature tool off and Measurement Labels on, the Pen, the Smart Pen and the Curvature tool hide the preview segment but still show the D / Angle / dX / dY readout at the snapped pointer before the next click, and the Curvature tool also shows it when going on from the current end of a selected path. Measurement Labels show distance and placement while drawing ([the help page](https://helpx.adobe.com/illustrator/desktop/measure-and-align/grids-and-guides/smart-guides-options.html)), and the rubber band preference turns off the path preview ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/preview-paths-drawn.html)). Showing the readout with the rubber band off is VectorCraft's own rule (`pen::tests::measurement_label_shows_with_the_rubber_band_off`, and `the_measurement_label_shows_with_the_rubber_band_off` in `draw2::curvature::tests` and `addons::smart_pen::tests`); scores and estimates unchanged. - **Pen handle drags in the Info panel:** while a Pen drag pulls a handle out of an anchor, the Info panel shows the change in x and y (W, H), the distance (D) and the angle, as the Info panel overview in the [archived user guide](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=76) describes for the Pen. The values run from the anchor being shaped to the end of the handle the drag shapes: the outgoing handle of a new or added anchor or of the last anchor, and the incoming handle of the first anchor when the drag closes the path. Shift gives the constrained handle, Space moves the anchor with its handle, and the readout starts past the 3-pixel drag threshold and ends when the button comes up, the press is dropped or the tool changes. These details are VectorCraft's own rules. Tests: the `info_readout_*` tests in `pen::tests`; scores and estimates unchanged. + - **Pen rubber band after a smooth anchor:** the preview segment to the pointer is the curve a click there adds, leaving the last anchor along its outgoing handle and arriving at the new corner anchor without a handle, so the segment keeps its shape when the anchor is placed, as [the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/preview-paths-drawn.html) describes. Before, the preview was a different curve, and the segment changed shape at the click (#8296, in part; `pen::tests::rubber_band_is_the_segment_a_click_adds`); scores and estimates unchanged. - The desktop app keeps the Color panel's Show Options or Hide Options between sessions, and `ui.colorPanel` sets its mode and options as its panel menu does. - Preferences that act (#394, in part): Show Tool Tips, Double Click To Isolate, Zoom with Mouse Wheel (the wheel zooms about the pointer, Shift-wheel scrolls up and down, Cmd/Ctrl-wheel sideways; Alt/Option-wheel and a trackpad pinch zoom about the pointer either way), Use Precise Cursors; Selection & Anchor Display › Tolerance (objects, anchors and handles), Object Selection by Path Only, Command Click to Select Objects Behind (cycling down the stack), Zoom to Selection, anchor Size, Highlight anchors on mouse over; Type › Number of Recent Fonts (up to 15); Guides & Grid › guide and grid Color and Style (lines or dots) and Grids In Back. Then Snap to Point (its distance, for moves, drawn points and reference points), Move Locked and Hidden Artwork with Artboard, Enable Rubber Band for the Pen and Curvature tools, Handles style, Show handles when multiple anchors are selected, Hide Corner Widget for angles greater than; General › Transform Pattern Tiles (the transforms' and dialogs' Transform Patterns, Align and Distribute, art moved or duplicated with an artboard, and objects moved whole with direct-selected anchors) and Select Same Tint %; Type › Size/Leading, Tracking and Baseline Shift increments (`type.step`, Cmd+Shift+. and Cmd+Shift+, for the size, the Type tool's Alt+arrows), Enable Missing Glyph Protection and Fill New Type Objects With Placeholder Text. Then Smart Guides › Color, Alignment Guides, Anchor/Path Labels, Measurement Labels, Transform Tools, Object Highlighting (with Smart Guides on) and Snapping Tolerance (4 px by default, for every smart guide snap), then Construction Guides and their Angles (#506: a drawn point near a line at one of those angles through the point it leaves from lands on it). Then Type › Type Object Selection by Path Only (type is picked on the baseline of any of its lines, area type's frame or the path of type on a path, no longer anywhere in its bounds; the Type tools and the Eyedropper still take a click among the characters). Then General › Anti-aliased Artwork (off, the canvas draws the art with hard edges). Then Guides & Grid › Show Pixel Grid (Above 600% Zoom), a line at every document pixel over the art in Pixel Preview, turning with a rotated view as the document grid now does too. Then General › Show The Home Screen When No Documents Are Open (off, closing the last document leaves an empty window; the Home button still opens the screen). Then Units › Numbers Without Units Are Points (on by default: a number typed with no unit into a field in picas is read in points, a typed unit still wins; dimmed unless a unit is Picas). Then User Interface › Auto-Collapse Iconic Panels (off by default: on, a click away from a panel popped out of the icon column puts it away). Then Performance › Animated Zoom (on, with GPU Performance, which it needs and which dims it when off: the Zoom tool dragged sideways zooms about the press, right in and left out, and held still zooms on, Alt out; off, a drag zooms to the area dragged across, now drawn as a marquee), User Interface › Large Tabs (taller document tabs) and Scale Cursor Proportional to UI (off, the tool cursors keep their size whatever the UI Scaling), and File Handling › Display Bitmaps as Anti-aliased Images in Pixel Preview (off by default: Pixel Preview draws images with each pixel taking its nearest image pixel). Type › Auto Size New Area Type works too (new area type gets Auto Size). They reach agents too (`prefs.set`, then `pointer_gesture` or `press_key`; `ui.wheel` on the control channel). Then Smart Guides › Spacing Guides (moves space the selection evenly with its row or column, see Drawing aids). Then Hyphenation › Exceptions (comma-separated words that never break, or break only at their hyphens; `prefs.set` and restore push them into the hyphenator, #394). Then Type › Show Font Names in English (off, font menus label a family by its native-language name when the font has one; documents still use the English family, #394). Then General › Display Print Size at 100% Zoom (off by default: View › Actual Size is one document point per screen point; on, one document inch fills 96 screen points, an inch at the reference density display scaling is set against; `view.actualSize` / `prefs.set`, #394). Then Guides & Grid › Gridline every and Subdivisions (changing either sets the grid of every open document; new and opened documents take that grid too, except a native file and the native document an SVG, PDF, `.ai` or EPS file carries, which open with the grid they were saved with; `file.new`, `document.open`, `file.newFromTemplate`, `file.revert`, #394). Then Appearance of Black › On Screen (Display All Blacks Accurately by default: pure CMYK black shows through the CMYK profile, a dark grey; Display All Blacks as Rich Black shows it on the canvas as RGB black, also in CMYK documents drawn by ink planes, while rich blacks, black tints and images show as before; `RenderOptions::rich_black`, #394). Then Appearance of Black › Printing / Exporting (Output All Blacks Accurately by default; Output All Blacks as Rich Black draws pure CMYK black as RGB black in RGB raster exports and Print as Bitmap; CMYK ink exports and the document stay unchanged; `prefs.blackOutput` / `richBlack`, #394). Then Units › Identify Objects By (Object Name by default: Layers, Variables and Layer Options show and edit free names; XML ID shows and edits AI-style XML ids, `_` for a space and `_xHH_` escapes, and `layer.setProps` / rename refuse invalid ids; the document still stores the object name, #394). Then Type › Highlight Alternate Glyphs (off by default; on, pink shows behind OpenType substitutions on screen, such as ligatures and contextual forms; Document Setup's Highlight Substituted Glyphs stays separate; `prefs.set` key `highlightAlternateGlyphs`, #394). Then Units › East Asian Type (the bullet below). Then User Interface › Open Documents As Tabs (see Window › Arrange). Two stored options still do nothing yet: Plug-ins & Scratch Disks › Primary and Secondary, and Clipboard Handling › Legacy vector clipboard (the audit below). - Preferences › General › Scroll Sideways with Cmd/Ctrl + Wheel (on by default; dimmed while Zoom with Mouse Wheel is on): while Zoom with Mouse Wheel is off, Cmd/Ctrl with a mouse wheel's whole notches scrolls the canvas sideways instead of zooming. Alt + Cmd/Ctrl-wheel and a pinch on a Mac trackpad, on a touch screen or in the web build still zoom about the pointer, and once a trackpad gesture holds Alt, it zooms until it ends, also after Alt is let go. Under either wheel preference, Cmd/Ctrl with a touchpad zooms about the pointer. From 18a7f7b84b55d7c6f2cf4ec9d96ef643a42105c5 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:40:21 -0800 Subject: [PATCH 131/158] Dimension tool: a dimension of the same points lines up too The level a new dimension line lands on now comes from the dimension lines in the document before the dimension's first preview, so its own preview is never a level. A dimension drawn earlier between the same two points now acts as a level as well; before, every dimension of those points was skipped. - Of two lines on one level, a line the pointer lies across wins over a line whose end is nearer the pointer. - A dropped press while placing removes the level guide with the preview. - The reach uses the Smart Guides snapping tolerance helper. - docs/dimensions.md says the rule applies to a dimension anywhere in the document. - The tests are split by behavior, with new tests for the same points, pointer moves in small steps, the guide after a dropped press and with Alignment Guides off, and the tie-break. --- crates/engine/tests/it/dimensions.rs | 148 +++++++++++++++++++-------- crates/tools/src/dimension.rs | 86 +++++++++++----- docs/dimensions.md | 2 +- docs/target-app-parity.md | 2 +- 4 files changed, 167 insertions(+), 71 deletions(-) diff --git a/crates/engine/tests/it/dimensions.rs b/crates/engine/tests/it/dimensions.rs index 75df307224..cc0f6420b9 100644 --- a/crates/engine/tests/it/dimensions.rs +++ b/crates/engine/tests/it/dimensions.rs @@ -1940,74 +1940,132 @@ fn guide_lines(s: &mut Session, view: ViewInfo, x: f64, y: f64) -> Vec<(vectorcr s.overlays(view).into_iter().filter_map(|o| if let Overlay::Line { a, b, .. } = o { Some((a, b)) } else { None }).collect() } +/// An edge with anchors at x 100, 200 and 300, and a dimension from 100 to 200 placed 30 points +/// above it, with the Dimension tool active and nothing selected: the session and the dimension. +fn level_start(view: ViewInfo) -> (Session, u64) { + let pt = vectorcraft_geom::Point::new; + let mut s = session(); + run(&mut s, "path.create", json!({"d": "M100 200 L200 200 L300 200 L300 300 L100 300 Z"})); + run(&mut s, "select.none", json!({})); + s.select_tool("dimension", view).unwrap(); + linear_click(&mut s, view, 100.0, 200.0); + linear_click(&mut s, view, 200.0, 200.0); + linear_click(&mut s, view, 150.0, 170.0); + let first = s.doc().unwrap().selection.objects[0].0; + assert_eq!(recipe(&s, first).line_ends(), (pt(100.0, 170.0), pt(200.0, 170.0))); + run(&mut s, "select.none", json!({})); + (s, first) +} + +/// The next dimension, from 200 to 300, placed with the pointer at `y`: where its line lies. +fn level_next(s: &mut Session, view: ViewInfo, y: f64) -> (vectorcraft_geom::Point, vectorcraft_geom::Point) { + linear_click(s, view, 200.0, 200.0); + linear_click(s, view, 300.0, 200.0); + linear_click(s, view, 250.0, y); + let id = s.doc().unwrap().selection.objects[0].0; + recipe(s, id).line_ends() +} + /// A dimension placed next to another, with its line within the Smart Guides snapping tolerance of -/// the level of the other's parallel line, has its line on that level, and an alignment guide -/// runs across both lines while it is placed. A level further off, Smart Guides off, a locked -/// dimension or one that is not parallel leaves the line where the pointer puts it. A dimension -/// dragged out from a segment lands on the level too. +/// the level of the other's parallel line, has its line on that level. A level further off, Smart +/// Guides off, a locked dimension or one that is not parallel leaves the line where the pointer +/// puts it. #[test] fn a_dimension_line_placed_beside_another_lands_on_its_level() { let plain = ViewInfo::default(); let off = ViewInfo { smart_guides: false, ..plain }; let pt = vectorcraft_geom::Point::new; - // An edge with anchors at x 100, 200 and 300, and a dimension from 100 to 200 placed 30 points - // above it. - let start = |view: ViewInfo| { - let mut s = session(); - run(&mut s, "path.create", json!({"d": "M100 200 L200 200 L300 200 L300 300 L100 300 Z"})); - run(&mut s, "select.none", json!({})); - s.select_tool("dimension", view).unwrap(); - linear_click(&mut s, view, 100.0, 200.0); - linear_click(&mut s, view, 200.0, 200.0); - linear_click(&mut s, view, 150.0, 170.0); - let first = s.doc().unwrap().selection.objects[0].0; - assert_eq!(recipe(&s, first).line_ends(), (pt(100.0, 170.0), pt(200.0, 170.0))); - run(&mut s, "select.none", json!({})); - (s, first) - }; - // The next dimension, from 200 to 300, placed with the pointer at `y`: where its line lies. - let next = |s: &mut Session, view: ViewInfo, y: f64| { - linear_click(s, view, 200.0, 200.0); - linear_click(s, view, 300.0, 200.0); - linear_click(s, view, 250.0, y); - let id = s.doc().unwrap().selection.objects[0].0; - recipe(s, id).line_ends() - }; // 2.5 points below the first line's level, and 3.5 above it: on the level. for y in [172.5, 166.5] { - let (mut s, _) = start(plain); - assert_eq!(next(&mut s, plain, y), (pt(200.0, 170.0), pt(300.0, 170.0)), "pointer at y {y}"); + let (mut s, _) = level_start(plain); + assert_eq!(level_next(&mut s, plain, y), (pt(200.0, 170.0), pt(300.0, 170.0)), "pointer at y {y}"); } - // While it is placed, one guide runs along the level from the first line's left end to the - // new line's right end. - let (mut s, _) = start(plain); - linear_click(&mut s, plain, 200.0, 200.0); - linear_click(&mut s, plain, 300.0, 200.0); - let guides = guide_lines(&mut s, plain, 250.0, 172.5); - assert!(guides.iter().any(|(a, b)| near(*a, pt(100.0, 170.0)) && near(*b, pt(300.0, 170.0))), "{guides:?}"); - assert!(guide_lines(&mut s, plain, 250.0, 180.0).is_empty(), "no guide off the level"); // 10 points off: where the pointer is. - let (mut s, _) = start(plain); - assert_eq!(next(&mut s, plain, 180.0), (pt(200.0, 180.0), pt(300.0, 180.0))); + let (mut s, _) = level_start(plain); + assert_eq!(level_next(&mut s, plain, 180.0), (pt(200.0, 180.0), pt(300.0, 180.0))); // Smart Guides off: where the pointer is. - let (mut s, _) = start(off); - assert_eq!(next(&mut s, off, 172.5), (pt(200.0, 172.5), pt(300.0, 172.5))); + let (mut s, _) = level_start(off); + assert_eq!(level_next(&mut s, off, 172.5), (pt(200.0, 172.5), pt(300.0, 172.5))); // A locked dimension does not pull the line. - let (mut s, first) = start(plain); + let (mut s, first) = level_start(plain); run(&mut s, "select.set", json!({"ids":[first]})); run(&mut s, "object.lock", json!({})); - assert_eq!(next(&mut s, plain, 172.5), (pt(200.0, 172.5), pt(300.0, 172.5))); + assert_eq!(level_next(&mut s, plain, 172.5), (pt(200.0, 172.5), pt(300.0, 172.5))); // A dimension of the right edge has a vertical line, which is not parallel to the first: the // pointer 2.5 points below the first line's level places it where the pointer is. - let (mut s, _) = start(plain); + let (mut s, _) = level_start(plain); linear_click(&mut s, plain, 300.0, 200.0); linear_click(&mut s, plain, 300.0, 300.0); linear_click(&mut s, plain, 330.0, 172.5); let id = s.doc().unwrap().selection.objects[0].0; assert_eq!(recipe(&s, id).line_ends(), (pt(330.0, 200.0), pt(330.0, 300.0))); +} + +/// While a dimension is placed with its line on the level of another, one alignment guide runs +/// along the level across both lines. Off the level, after a dropped press and with Alignment +/// Guides off, no guide shows. +#[test] +fn a_dimension_line_on_another_level_shows_one_guide_across_both() { + let plain = ViewInfo::default(); + let pt = vectorcraft_geom::Point::new; + let (mut s, _) = level_start(plain); + linear_click(&mut s, plain, 200.0, 200.0); + linear_click(&mut s, plain, 300.0, 200.0); + let guides = guide_lines(&mut s, plain, 250.0, 172.5); + assert!(guides.iter().any(|(a, b)| near(*a, pt(100.0, 170.0)) && near(*b, pt(300.0, 170.0))), "{guides:?}"); + assert!(guide_lines(&mut s, plain, 250.0, 180.0).is_empty(), "no guide off the level"); + // A press on the level that the app drops cancels the preview, and its guide goes with it. + assert!(!guide_lines(&mut s, plain, 250.0, 172.5).is_empty()); + s.pointer(&PointerEvent::new(PointerKind::Down, 250.0, 172.5), plain).unwrap(); + s.drop_tool_press(plain).unwrap(); + assert!(s.overlays(plain).iter().all(|o| !matches!(o, vectorcraft_engine::tools::Overlay::Line { .. })), "{:?}", s.overlays(plain)); + // Alignment Guides off: the line still lands on the level, with no guide. + let (mut s, _) = level_start(plain); + run(&mut s, "prefs.set", json!({"key": "alignmentGuides", "value": false})); + linear_click(&mut s, plain, 200.0, 200.0); + linear_click(&mut s, plain, 300.0, 200.0); + assert!(guide_lines(&mut s, plain, 250.0, 172.5).is_empty()); + linear_click(&mut s, plain, 250.0, 172.5); + let id = s.doc().unwrap().selection.objects[0].0; + assert_eq!(recipe(&s, id).line_ends(), (pt(200.0, 170.0), pt(300.0, 170.0))); +} + +/// A second dimension of the same two points as a dimension already drawn lands on its level too. +/// Off every level, a pointer moved in small steps while it is placed puts the line at each step, +/// with no pull from the preview of the dimension itself. +#[test] +fn a_dimension_of_the_same_points_lines_up_and_the_line_follows_the_pointer() { + let plain = ViewInfo::default(); + let pt = vectorcraft_geom::Point::new; + let (mut s, first) = level_start(plain); + linear_click(&mut s, plain, 100.0, 200.0); + linear_click(&mut s, plain, 200.0, 200.0); + linear_click(&mut s, plain, 150.0, 172.5); + let id = s.doc().unwrap().selection.objects[0].0; + assert_ne!(id, first); + assert_eq!(recipe(&s, id).line_ends(), (pt(100.0, 170.0), pt(200.0, 170.0))); + let (mut s, _) = level_start(plain); + linear_click(&mut s, plain, 200.0, 200.0); + linear_click(&mut s, plain, 300.0, 200.0); + for y in [190.0, 189.0, 188.0, 187.0, 186.0] { + s.pointer(&PointerEvent::new(PointerKind::Move, 250.0, y), plain).unwrap(); + } + for kind in [PointerKind::Down, PointerKind::Up] { + s.pointer(&PointerEvent::new(kind, 250.0, 186.0), plain).unwrap(); + } + let id = s.doc().unwrap().selection.objects[0].0; + assert_eq!(recipe(&s, id).line_ends(), (pt(200.0, 186.0), pt(300.0, 186.0))); +} + +/// A dimension dragged out from a segment, with its line within the Smart Guides snapping +/// tolerance of the level of another dimension's parallel line, lands on that level. +#[test] +fn a_dimension_dragged_out_beside_another_lands_on_its_level() { + let plain = ViewInfo::default(); + let pt = vectorcraft_geom::Point::new; // The bottom edge dragged out to 2 points below the level of the first line, 130 points // above the edge: on the level. - let (mut s, _) = start(plain); + let (mut s, _) = level_start(plain); for (kind, y) in [(PointerKind::Move, 300.0), (PointerKind::Down, 300.0), (PointerKind::Drag, 240.0), (PointerKind::Drag, 172.0), (PointerKind::Up, 172.0)] { diff --git a/crates/tools/src/dimension.rs b/crates/tools/src/dimension.rs index 79f316e14e..a30685b601 100644 --- a/crates/tools/src/dimension.rs +++ b/crates/tools/src/dimension.rs @@ -79,6 +79,9 @@ pub struct DimensionTool { /// While a Linear dimension is placed with its line on the level of another dimension's line: /// the ends of that other line. A Smart Guide runs along the level across both lines. level_guide: Option<(Point, Point)>, + /// While a dimension is placed: the lines of the visible, unlocked linear dimensions in the + /// document before its first preview ([`dimension_lines`]), which its line can line up with. + levels: Vec, } /// What a linear dimension between `a` and `b` measures with the pointer at `p` while it is @@ -288,42 +291,56 @@ fn on_dimensions(cx: &ToolContext, p: Point) -> Option<(Point, bool)> { best.end.map(|(_, q)| (q, true)).or_else(|| best.line.map(|(_, q)| (q, false))) } -/// Where the line of the linear dimension `d`, placed through `p`, lands on the level of the line -/// of a visible, unlocked linear dimension already drawn that runs parallel to it, within `reach` -/// of `p` across the line (the nearest level wins, then the nearest line): the point to place `d` -/// through, and the ends of that other line. A dimension that measures the same two points as `d` -/// is skipped, because the preview of `d` itself is one. Bounded work, as in [`on_dimensions`]. -fn line_level(cx: &ToolContext, d: &Dimension, p: Point, reach: f64) -> Option<(Point, (Point, Point))> { - type Best = Option<(f64, f64, f64, (Point, Point))>; - fn visit(n: &Node, d: &Dimension, p: Point, reach: f64, budget: &mut usize, best: &mut Best) { +/// The line of a linear dimension already drawn: its ends and its direction. +type DimensionLine = ((Point, Point), Vec2); + +/// The lines of the visible, unlocked linear dimensions in the document. Bounded work, as in +/// [`on_dimensions`]. +fn dimension_lines(cx: &ToolContext) -> Vec { + fn visit(n: &Node, budget: &mut usize, out: &mut Vec) { if *budget == 0 || !n.visible || n.locked { return; } *budget -= 1; - if let Some(other) = &n.extras().dimension { - let (u, normal) = (d.direction(), d.normal()); - if other.mode == DimensionMode::Linear && (other.a, other.b) != (d.a, d.b) && u.cross(other.direction()).abs() <= 1e-6 { - let ends = other.line_ends(); - let shift = (ends.0 - p).dot(normal); - let along = (ends.0 - p).dot(u).abs().min((ends.1 - p).dot(u).abs()); - if shift.is_finite() && shift.abs() <= reach && best.is_none_or(|(s, a, _, _)| (shift.abs(), along) < (s, a)) { - *best = Some((shift.abs(), along, shift, ends)); - } + if let Some(d) = &n.extras().dimension { + if d.mode == DimensionMode::Linear { + out.push((d.line_ends(), d.direction())); } return; } for c in n.children().into_iter().flatten().rev() { - visit(c, d, p, reach, budget, best); + visit(c, budget, out); } } + let (mut budget, mut out) = (20_000usize, vec![]); + for n in cx.doc.layers.iter().rev() { + visit(n, &mut budget, &mut out); + } + out +} + +/// Where the line of the linear dimension `d`, placed through `p`, lands on the level of one of +/// the `levels` that runs parallel to it, within `reach` of `p` across the line: the point to +/// place `d` through, and the ends of that other line. The nearest level wins, then the line +/// nearest `p` along it (none nearer than a line that `p` lies across). +fn line_level(levels: &[DimensionLine], d: &Dimension, p: Point, reach: f64) -> Option<(Point, (Point, Point))> { if d.mode != DimensionMode::Linear { return None; } - let (mut budget, mut best) = (20_000usize, None); - for n in cx.doc.layers.iter().rev() { - visit(n, d, p, reach, &mut budget, &mut best); + let (u, normal) = (d.direction(), d.normal()); + let mut best: Option<(f64, f64, f64, (Point, Point))> = None; + for &(ends, direction) in levels { + if u.cross(direction).abs() > 1e-6 { + continue; + } + let shift = (ends.0 - p).dot(normal); + let (s0, s1) = ((ends.0 - p).dot(u), (ends.1 - p).dot(u)); + let along = if s0 * s1 <= 0.0 { 0.0 } else { s0.abs().min(s1.abs()) }; + if shift.is_finite() && along.is_finite() && shift.abs() <= reach && best.is_none_or(|(s, a, _, _)| (shift.abs(), along) < (s, a)) { + best = Some((shift.abs(), along, shift, ends)); + } } - best.map(|(_, _, shift, ends)| (p + d.normal() * shift, ends)) + best.map(|(_, _, shift, ends)| (p + normal * shift, ends)) } /// The point of `edge` closest to `p`. @@ -505,8 +522,12 @@ impl DimensionTool { return vec![]; } // With Smart Guides on, a linear dimension's line lands on the level of a parallel - // dimension line already drawn within the Smart Guides snapping tolerance. - let level = if cx.smart_guides { line_level(cx, d, p, cx.tol(cx.snapping_tolerance)) } else { None }; + // dimension line already drawn within the Smart Guides snapping tolerance. The lines are + // read before the first preview, so the preview of this dimension is not one of them. + if !self.began { + self.levels = dimension_lines(cx); + } + let level = if cx.smart_guides { line_level(&self.levels, d, p, cx.snap_tol()) } else { None }; d.place(level.map_or(p, |(on_level, _)| on_level)); if d.validate().is_err() { return vec![]; @@ -542,6 +563,7 @@ impl DimensionTool { self.snapped = None; self.second = None; self.level_guide = None; + self.levels.clear(); } /// A plain click: picks a point or a line, or measures a circle's radius. fn click(&mut self, cx: &ToolContext, p: Point, target: Option, mods: Mods) -> Vec { @@ -704,6 +726,7 @@ impl Tool for DimensionTool { self.press = None; if self.pending.is_some() && self.began { self.began = false; + self.level_guide = None; vec![Action::Cancel] } else { vec![] @@ -833,6 +856,21 @@ mod tests { assert!(t.pointer(&c, &ev(PointerKind::Up, 150.0, 60.0)).is_empty(), "the release places nothing"); } + /// Of two dimension lines on one level, a line the pointer lies across wins over a line whose + /// end is nearer the pointer. + #[test] + fn a_line_the_pointer_lies_across_wins_on_one_level() { + let pt = Point::new; + let d = DimensionTool::default().recipe(DimensionMode::Linear, pt(200.0, 200.0), pt(300.0, 200.0), pt(250.0, 200.0), None); + let across = ((pt(0.0, 170.0), pt(400.0, 170.0)), Vec2::new(1.0, 0.0)); + let beside = ((pt(100.0, 170.0), pt(200.0, 170.0)), Vec2::new(1.0, 0.0)); + for levels in [[beside, across], [across, beside]] { + let (at, ends) = line_level(&levels, &d, pt(250.0, 172.0), 4.0).expect("on the level"); + assert!(at.distance(pt(250.0, 170.0)) < 1e-9, "{at:?}"); + assert_eq!(ends, across.0); + } + } + #[test] fn a_dropped_placement_press_does_not_commit_the_dimension() { let (d, _) = doc_with_rect(); diff --git a/docs/dimensions.md b/docs/dimensions.md index 6f2d8ba18b..762575379b 100644 --- a/docs/dimensions.md +++ b/docs/dimensions.md @@ -53,7 +53,7 @@ The **Dimension Tool** is in the Modify section of the toolbar. Its strip offers far past the outermost point as before. With Smart Guides on, a linear dimension placed with its line within the Smart Guides snapping tolerance of the level of a parallel line of a visible, unlocked linear dimension already drawn - has its line on that level, so chained dimensions line up. This is VectorCraft's own rule. With + anywhere in the document has its line on that level. This is VectorCraft's own rule. With Alignment Guides on, a guide runs along the level across both lines while the dimension is placed. - **Angular:** hover a corner where two straight segments meet and drag outwards. Or click two diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 29622fdf1d..060ad34f18 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -630,7 +630,7 @@ since 2026-10-01. **Drawing tools, Dimension tool points on a Smart Guide stay on the guide:** By VectorCraft's own rule, a clicked point that lies on a Smart Guide already, such as one in line with an object's center, stays where the pointer is when no anchor is within 8 pixels and no segment is within the Smart Guides snapping tolerance, instead of moving onto a segment farther than that tolerance and within 8 pixels; with Snap to Grid or Snap to Pixel on, a point stays on the grid or the whole pixel those options give. `a_point_on_a_guide_stays_on_the_guide` covers it. **Drawing tools, Dimension tool second point without construction guides through a first point off the anchors:** By VectorCraft's own rule, with Smart Guides on, the second Linear point does not snap to the construction guides through a first point that is not on an anchor, so a click beside a segment straight below such a first point lands on the segment; after a first point picked on an anchor, the construction guides through it still apply. The second point still snaps to anchors, centers and alignment lines, and with Snap to Perpendicular or Snap to Tangent on, it lands where the line from the first point meets a segment square or grazes a curve. `a_point_on_a_guide_stays_on_the_guide`, `the_second_point_after_an_anchor_lands_on_construction_guides`, `the_second_point_lands_square_to_a_segment_or_grazing_a_curve` and `linear_picks_show_and_snap_to_smart_guides` cover it. **Drawing tools, Dimension tool points land on dimensions already drawn (#8063):** By VectorCraft's own rule, with Smart Guides or Snap to Point on, a Linear point that no anchor of the art within 8 pixels takes lands on the end of a visible, unlocked dimension's dimension line, or on the far end of its extension line, within 8 pixels, and a point that nothing else places lands on the closest point of such a line within 8 pixels, so at any zoom a dimension can start where another one ends. The end of an extension line next to the point it measures does not pull points away from that anchor. With Smart Guides and Anchor/Path Labels on, a point on an anchor or line end shows the "anchor" label and a point on a segment or line shows the "path" label. `linear_picks_land_on_anchors_paths_and_drawn_dimensions` and `an_anchor_beside_a_drawn_dimension_takes_the_point` cover it. -**Drawing tools, Dimension tool lines line up with dimensions already drawn (#8063, #5590):** By VectorCraft's own rule, with Smart Guides on, a linear dimension placed with its line within the Smart Guides snapping tolerance of the level of a parallel line of a visible, unlocked linear dimension already drawn has its line on that level, and with Alignment Guides on a guide runs along the level across both lines while it is placed. `a_dimension_line_placed_beside_another_lands_on_its_level` covers it. +**Drawing tools, Dimension tool lines line up with dimensions already drawn (#8063, #5590):** By VectorCraft's own rule, with Smart Guides on, a linear dimension placed with its line within the Smart Guides snapping tolerance of the level of a parallel line of a visible, unlocked linear dimension already drawn has its line on that level, and with Alignment Guides on a guide runs along the level across both lines while it is placed. `a_dimension_line_placed_beside_another_lands_on_its_level`, `a_dimension_line_on_another_level_shows_one_guide_across_both`, `a_dimension_of_the_same_points_lines_up_and_the_line_follows_the_pointer`, `a_dimension_dragged_out_beside_another_lands_on_its_level` and `a_line_the_pointer_lies_across_wins_on_one_level` cover it. **Drawing tools, Dimension tool dimensions selected with their art keep their lines and label:** Object › Expand, Object › Expand Appearance and Object › Path › Outline Stroke leave a dimension selected with art it measures, directly or in selected groups without fills, strokes or effects of their own, as it is and change only the other art; when the new art no longer fits its link, the dimension stays where it was, no longer linked, and undo links it again. `expand_leaves_a_dimension_selected_with_its_art_as_it_is`, `expand_appearance_leaves_a_dimension_selected_with_its_art_as_it_is`, `outline_stroke_leaves_a_dimension_selected_with_its_art_as_it_is`, `a_dimension_selected_with_art_that_has_nothing_to_expand_changes_nothing`, `a_group_effect_expanded_reaches_the_dimension_it_holds`, `expand_keeps_a_dimension_in_its_asset_and_its_variable_binding`, `a_dimension_keeps_no_link_to_the_art_expand_replaced`, `a_dimension_outlasts_the_art_outline_stroke_or_expand_appearance_replaced`, `a_dimension_outlasts_the_stroke_expand_outlined` and `expand_appearance_in_safe_mode_leaves_a_dimension_selected_with_its_art` cover it. **Drawing tools, Line Segment from one curve onto a common tangent of another:** By VectorCraft's own rule, with Smart Guides and Snap to Tangent on, a Line Segment drag pressed anywhere on a convex closed path with curves and dragged to within the snapping tolerance of another such path lands on a common tangent of the two ([tangent lines to circles](https://en.wikipedia.org/wiki/Tangent_lines_to_circles)): both ends move to where the line touches the paths, the start sliding along the first path, and each end shows the "tangent" label when Anchor/Path Labels is on, with the line drawn as a guide when Alignment Guides is on. The line is the tangent whose touch point on the second path is nearest the pointer, so moving the pointer around the second path switches between the outer tangent and the one crossing between the paths. The start stays where it was pressed when Shift, Alt or Space is held, when an anchor, center or crossing lies nearer the pointer than the second path does, when the press snapped to an anchor, center or crossing off the first path, when Snap to Tangent is off, when Snap to Grid or pixel snapping places drawn points, or when either path bends inward somewhere or has more than 512 segments. `a_line_from_one_circle_to_another_lands_on_their_common_tangent`, `a_line_from_a_turned_ellipse_lands_on_its_tangent_with_a_circle`, `a_line_near_the_second_path_takes_the_tangent_touching_it_nearest`, `a_line_keeps_its_start_without_a_tangent_snap`, `a_line_to_a_crescent_or_from_an_anchor_beside_the_curve_keeps_its_start` and `a_line_segment_drag_draws_the_common_tangent_as_one_undo_step` cover it. **Live trace result bounds and selection highlights exclude the retained bitmap except in source-image views:** `live_trace_result_bounds_exclude_the_retained_bitmap_at_any_angle` checks every TraceView, geometric and visual bounds and rotated result bounds. `live_trace_selection_highlight_excludes_the_retained_source_rectangle` checks result highlights and the existing ordinary-group policy. Shared editing-child traversal also preserves Shaper handling. From e2f68da7fbc26f54476dfbe524ee879e9d779210 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:40:42 -0800 Subject: [PATCH 132/158] Docs: Slices line names Type among the categories with sentences The Slices line in the progress list now names Type with the other categories that have sentences, and the UI chrome row cites #8360. --- docs/target-app-parity.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 89096c3a57..a2ad13bf86 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -285,7 +285,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Export for Screens, Asset Export, slices, Save for Web | 3 | 85% | anti-aliasing ghost borders (#983); TIFF choices and settings are implemented | 2–4 | estimated | | Print, colour management, separations, flattener | 3 | 80% | print preview fidelity | 2–4 | estimated | | Automation (Actions, Variables, scripting, batch) | 3 | 60% | a scripting surface (Illustrator: JavaScript/ExtendScript), Batch, image and graph variables, dataset import/export | 8–14 | estimated; MCP `add_text` exposes existing vertical type; score and hours unchanged | -| UI chrome (panels, Properties, workspaces, preferences) | 6 | 80% | Properties per context, 2 Preferences options stored but unused (#394, audited 2026-10-30: Scratch Disks, legacy vector clipboard), context menus in the panels that have none, accessibility | 13–20 | estimated; floating panels in OS windows of their own on the desktop (#4135), score and hours unchanged; macOS save Format menu implemented (#866), score and hours unchanged; Eyedropper cursor and precise setting checked (#1269), OS visual QA unverified; the line under the Preferences fields describes each General, Selection & Anchor Display, Guides & Grid, Smart Guides and Slices setting on hover and keyboard focus (#8199, #8223, #8248, #8264), score and hours unchanged; numeric-field focus and normal text drags regression-tested (#1326); a focus click released more than 1 pt from its press keeps the caret and a tap within 1 pt selects all (#6659); artboard navigation synchronizes the tool selection before destructive actions; status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates (sample widths cached by language/unit/DPI; regression and contributor original-file evidence below; scores/hours unchanged); effect dialogs' colour fields show a swatch that opens the Color Picker (#5365), score and hours unchanged; icon-strip flyouts retain user sizes (#5713); floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), scores and hours unchanged ; interim macOS cursor delivery (#2292), headless coverage only; native validation pending, score and hours unchanged; Swatches item context menus have focused regressions and rendered-layout evidence below; scores and estimates unchanged | +| UI chrome (panels, Properties, workspaces, preferences) | 6 | 80% | Properties per context, 2 Preferences options stored but unused (#394, audited 2026-10-30: Scratch Disks, legacy vector clipboard), context menus in the panels that have none, accessibility | 13–20 | estimated; floating panels in OS windows of their own on the desktop (#4135), score and hours unchanged; macOS save Format menu implemented (#866), score and hours unchanged; Eyedropper cursor and precise setting checked (#1269), OS visual QA unverified; the line under the Preferences fields describes each General, Selection & Anchor Display, Guides & Grid, Smart Guides and Slices setting on hover and keyboard focus (#8199, #8223, #8248, #8264, #8360), score and hours unchanged; numeric-field focus and normal text drags regression-tested (#1326); a focus click released more than 1 pt from its press keeps the caret and a tap within 1 pt selects all (#6659); artboard navigation synchronizes the tool selection before destructive actions; status messages and readouts use stable responsive allocations sized for localized labels and ordinary coordinates (sample widths cached by language/unit/DPI; regression and contributor original-file evidence below; scores/hours unchanged); effect dialogs' colour fields show a swatch that opens the Color Picker (#5365), score and hours unchanged; icon-strip flyouts retain user sizes (#5713); floating tab groups collapse into the side icon rail and opened rail panels fold back into it (#5925, in part), scores and hours unchanged ; interim macOS cursor delivery (#2292), headless coverage only; native validation pending, score and hours unchanged; Swatches item context menus have focused regressions and rendered-layout evidence below; scores and estimates unchanged | | Libraries, Links, Package | 2 | 82% | shared libraries, linked graphics, gradients and patterns as library items (no cloud by design) | 2–3 | estimated | | Generative AI (Text to Vector, Generative Recolor, Shape Fill, Concept to Vector, Prompt to Edit, Rewrite Text) | 2 | 0% | a pluggable provider and the panels; needs an owner decision on models | 30–60 | measured (absent) | | **Feature depth** | **105** | **~75%** | | **~250–420** | | @@ -822,7 +822,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Preferences › Selection & Anchor Display describes its settings:** the line under the Preferences fields shows a sentence for each of the 14 Selection & Anchor Display settings, from Tolerance to the Curvature Tool rubber band, on hover and on keyboard focus, and a screen reader gets the same sentence. The Snap to Point sentence states that the Smart Guides Snapping Tolerance applies while Smart Guides is on. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Guides & Grid describes its settings:** the line under the Preferences fields shows a sentence for each of the 12 Guides & Grid settings, from Snap to Grid to Pattern Editing's Tile Edge Color, on hover and on keyboard focus, and a screen reader gets the same sentence. The Show Pixel Grid sentence states that the pixel grid shows from 600% zoom. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Smart Guides describes its settings:** the line under the Preferences fields shows a sentence for the Smart Guides box and for each of the 14 Smart Guides settings, from Color to Snap to Perpendicular, on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: Pixel Preview turns Smart Guides off and Snap to Grid snaps instead; with Alignment Guides off, art still lines up without the line; Object Highlighting outlines only an unselected object while a selection tool is not dragging; Snapping Tolerance is a distance on screen at every zoom; Snap to Last Location does not return a copy. Units, General, Selection & Anchor Display, Guides & Grid, Smart Guides, Slices and Type have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. -- **Preferences › Slices describes its settings:** the line under the Preferences fields shows a sentence for Show Slice Numbers and for Line Color on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: each slice's number shows in a box at its top left on the canvas, the slice outlines still show with numbers off, and auto slices use a dimmer shade of the line color. Units, General, Selection & Anchor Display, Guides & Grid, Smart Guides and Slices have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. +- **Preferences › Slices describes its settings:** the line under the Preferences fields shows a sentence for Show Slice Numbers and for Line Color on hover and on keyboard focus, and a screen reader gets the same sentence. The sentences state VectorCraft's own behavior: each slice's number shows in a box at its top left on the canvas, the slice outlines still show with numbers off, and auto slices use a dimmer shade of the line color. Units, General, Selection & Anchor Display, Guides & Grid, Smart Guides, Slices and Type have sentences, and the other categories leave the line empty. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Preferences › Type describes its settings:** the same line shows a sentence for each of the 23 Type settings, from Size/Leading to Measure Type by Glyph Bounds, when the pointer is over the setting's row or its control has the keyboard focus, and a screen reader gets the same sentence. Each sentence is VectorCraft's own and states what the app does with the setting: for example, which keys step by each increment, which panels show the East Asian and Indic options, and that the two pink highlights show only on screen. Sentences: `crates/ui-egui/src/prefs_dialog/descriptions.rs`. Tests: `crates/ui-egui/src/prefs_dialog/tests.rs`. - **Window › New Window (G7, #4116):** New Window (`window.newWindow`) opens another view of the current document ([public source](https://helpx.adobe.com/illustrator/using/viewing-artwork.html) describes showing one document in several windows at once), with its own zoom, center, rotation, artboard and Outline or Preview, as a tab of its own; an edit in one view shows in every view. Tile, Cascade, Float in Window, Float All in Windows and Consolidate All Windows arrange each view as they arrange a document, and Next and Previous Document step through the views. Closing a view leaves the document open; closing its last view closes the document, asking to save it first. The view's number after the name in its tab ("Name:2", while the document has more than one view) is VectorCraft's own. Tests: `crates/ui-egui/src/doc_windows/tests.rs`. From efc36481b174be967bbbf3d94be5a6c7e5e12c5a Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:46:57 -0800 Subject: [PATCH 133/158] Find and Replace: Find with other Find text starts at the first match With no place to go on from, the dialog left out edit.findNext's from, so the search went on after the selected type object and passed over its matches: after Find selected a type object, changing the Find text skipped the matches in it. edit.findNext now starts at the first match for a null from, and the dialog sends one. --- crates/engine/src/cmd/typemenu.rs | 12 +++++++----- crates/engine/src/tests/menucmds.rs | 4 ++++ crates/ui-egui/src/dialogs/find_replace.rs | 5 ++--- .../ui-egui/src/dialogs/find_replace/tests.rs | 17 +++++++++++++++++ docs/mcp.md | 6 ++++-- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/crates/engine/src/cmd/typemenu.rs b/crates/engine/src/cmd/typemenu.rs index 85bc20926a..f9c6471812 100644 --- a/crates/engine/src/cmd/typemenu.rs +++ b/crates/engine/src/cmd/typemenu.rs @@ -129,7 +129,7 @@ pub fn specs() -> Vec { "Find Next", ["Edit"], None, - "{find, matchCase?: false, wholeWord?: false, backwards?: false, hiddenLayers?: false, lockedLayers?: false, from?: {id, start, end} (a match this command returned, or the range edit.replaceMatch returned)} find the next match of `find` in the type edit.findReplace reaches and select its type object → {id, start, end (the match's bytes in the object's plain text), index (its place among all the matches, from 1), count, selected} or {id: null, count: 0}. The search visits type objects from the top of the stacking order down and each object's matches in reading order; backwards visits the objects from the bottom up and each object's matches from the last. It goes on after `from` and, past the last match, starts again at the first. Without `from` it goes on after the first selected type object, and with no type selected it starts at the first match. A match on a hidden or locked layer is returned with selected false and the selection stays as it is. Nothing is recorded for undo.", + "{find, matchCase?: false, wholeWord?: false, backwards?: false, hiddenLayers?: false, lockedLayers?: false, from?: {id, start, end} (a match this command returned, or the range edit.replaceMatch returned)} find the next match of `find` in the type edit.findReplace reaches and select its type object → {id, start, end (the match's bytes in the object's plain text), index (its place among all the matches, from 1), count, selected} or {id: null, count: 0}. The search visits type objects from the top of the stacking order down and each object's matches in reading order; backwards visits the objects from the bottom up and each object's matches from the last. It goes on after `from` and, past the last match, starts again at the first. Without `from` it goes on after the first selected type object, and with no type selected, or with a null `from`, it starts at the first match. A match on a hidden or locked layer is returned with selected false and the selection stays as it is. Nothing is recorded for undo.", has_doc, find_next ), @@ -1856,10 +1856,12 @@ fn find_next(s: &mut Session, p: &Value) -> Result { let q = Query::of(p, C)?; let backwards = switch_or(p, "backwards", false, C)?; let (hidden, locked) = (switch_or(p, "hiddenLayers", false, C)?, switch_or(p, "lockedLayers", false, C)?); - // A `from` that is no object gives no `id`, and is refused as one without it. + // A `from` that is no object gives no `id`, and is refused as one without it. A null `from` + // starts at the first match, whatever is selected. let from = match p.get("from") { - None | Some(Value::Null) => None, - Some(v) => Some(Match::of(v, C)?), + None => None, + Some(Value::Null) => Some(None), + Some(v) => Some(Some(Match::of(v, C)?)), }; let st = s.doc()?; // The objects in the order the search visits them: from the top of the stacking order down, @@ -1885,7 +1887,7 @@ fn find_next(s: &mut Session, p: &Value) -> Result { // The search goes on from `from`, or from the whole of the first selected type object it // visits, so that the same call again reaches the next object. From anywhere else it starts // at the first match. - let from = from.or_else(|| { + let from = from.unwrap_or_else(|| { st.selection.objects.iter().filter(|id| order.contains(id)).find_map(|id| match &st.doc.node(*id)?.kind { NodeKind::Text(t) => Some(Match { id: *id, start: 0, end: t.runs.iter().map(|r| r.text.len()).sum() }), _ => None, diff --git a/crates/engine/src/tests/menucmds.rs b/crates/engine/src/tests/menucmds.rs index dbbf9e803d..9c03205ee7 100644 --- a/crates/engine/src/tests/menucmds.rs +++ b/crates/engine/src/tests/menucmds.rs @@ -2476,6 +2476,10 @@ fn find_next_steps_through_the_matches_in_both_directions() { // A `from` in an object the search does not visit starts at the first match. let r = s.execute("edit.findNext", &json!({"find": "cat", "from": {"id": 999_999, "start": 0, "end": 0}})).unwrap(); assert_eq!(found(&r), (top.0, 2, 5, 1, 3)); + // So does a null `from`, with a type object selected. + sel(&mut s, &[top]); + let r = s.execute("edit.findNext", &json!({"find": "cat", "from": null})).unwrap(); + assert_eq!(found(&r), (top.0, 2, 5, 1, 3)); // Nothing found: no match, and the selection stays. let r = s.execute("edit.findNext", &json!({"find": "zebra"})).unwrap(); assert_eq!((r, selected(&s)), (json!({"id": null, "count": 0}), vec![top])); diff --git a/crates/ui-egui/src/dialogs/find_replace.rs b/crates/ui-egui/src/dialogs/find_replace.rs index f56d07c722..8e229980e6 100644 --- a/crates/ui-egui/src/dialogs/find_replace.rs +++ b/crates/ui-egui/src/dialogs/find_replace.rs @@ -204,9 +204,8 @@ fn remember(app: &mut VectorcraftApp, d: &Dialog) { fn find(app: &mut VectorcraftApp, d: &mut Dialog) -> Result { let mut p = query(d); p["backwards"] = json!(d.bool("backwards")); - if let Some(at) = place(app, d) { - p["from"] = at.clone(); - } + // With no place, the search starts at the first match, not after the selected type object. + p["from"] = place(app, d).cloned().unwrap_or(Value::Null); d.fields.remove(FOUND); d.fields.remove(NOTE); let r = app.run(NEXT, p)?; diff --git a/crates/ui-egui/src/dialogs/find_replace/tests.rs b/crates/ui-egui/src/dialogs/find_replace/tests.rs index 59dbe4937b..1f2bb756ab 100644 --- a/crates/ui-egui/src/dialogs/find_replace/tests.rs +++ b/crates/ui-egui/src/dialogs/find_replace/tests.rs @@ -195,6 +195,23 @@ fn an_action_of_the_wrong_type_runs_no_action() { assert_ne!(matched(&app), at, "a string action still runs"); } +/// Find with other Find text starts again at the first match, the matches in the type object the +/// last Find selected included. +#[test] +fn find_with_other_text_starts_at_the_first_match() { + let (mut app, ids) = app_with(&["dog", "cat dog"]); + let (bottom, top) = (ids[0], ids[1]); + choose(&mut app); + set(&mut app, "find", json!("cat")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((matched(&app), selected(&app)), (Some((top, 0, 3)), vec![top])); + set(&mut app, "find", json!("dog")); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!((matched(&app), selected(&app)), (Some((top, 4, 7)), vec![top])); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(matched(&app), Some((bottom, 0, 3))); +} + /// The dialog stays open from match to match: Find goes to the next match and selects its /// object, Replace changes that match, Replace & Find changes it and goes on, Replace All changes /// the rest, and Done closes. Each Replace is one undo step, and so is Replace All; finding and a diff --git a/docs/mcp.md b/docs/mcp.md index accd19856e..1b0bcf1ef0 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9969,8 +9969,10 @@ recorded for undo. - These rules are VectorCraft's own. Inside a type object the matches come in reading order, or from the last with `backwards`. `from: {id, start, end}`, a match the command returned or the range `edit.replaceMatch` returned, is where the search goes on from; past the last match it starts again at the first. Without `from` it goes on after the - first selected type object, and with no type selected it starts at the first match. A match on a hidden or locked - layer comes back with `selected: false` and the selection stays as it is. A match stays inside one style run. + first selected type object, and with no type selected, or with `from: null`, it starts at the first match. The Find + and Replace dialog sends `from: null` when it has no place to go on from, as when its Find text or a switch changed + since its last match. A match on a hidden or locked layer comes back with `selected: false` and the selection stays + as it is. A match stays inside one style run. `edit.replaceMatch {find, replace?, matchCase?, wholeWord?, id, start, end}` replaces that one match with `replace` as one undo step and returns `{id, start, end, replaced}`, with `start` and `end` the replacement's bytes. Bytes that From a51e94f337c01670c12d1350e2158b78c1d014bd Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:50:20 -0800 Subject: [PATCH 134/158] MCP: transform's description spells center in American English The `transform` tool description now says `origin` defaults to the selection center. --- crates/mcp/src/tools/definitions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/mcp/src/tools/definitions.rs b/crates/mcp/src/tools/definitions.rs index 5cd48e145b..642f65fbfe 100644 --- a/crates/mcp/src/tools/definitions.rs +++ b/crates/mcp/src/tools/definitions.rs @@ -466,7 +466,7 @@ pub fn tool_definitions() -> Vec { tool( "transform", "Transform", - "Move, rotate, scale, reflect or shear the selection (or `ids`); several may be combined and run in that order. Angles in degrees (counter-clockwise), scale in %. Scale and reflect act along the selection's bounding box, turned with rotated objects until Reset Bounding Box. `origin` [x,y] defaults to the selection centre; `copy` transforms a copy. A scale, reflect or shear its command refuses, or an argument of the wrong type, returns that error before any step runs, and nothing changes.", + "Move, rotate, scale, reflect or shear the selection (or `ids`); several may be combined and run in that order. Angles in degrees (counter-clockwise), scale in %. Scale and reflect act along the selection's bounding box, turned with rotated objects until Reset Bounding Box. `origin` [x,y] defaults to the selection center; `copy` transforms a copy. A scale, reflect or shear its command refuses, or an argument of the wrong type, returns that error before any step runs, and nothing changes.", obj( json!({ "ids": {"type": "array", "items": {"type": "integer"}}, From 1d974067ce015863ce3e56903b8bc82528f73559 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 17 Nov 2026 22:57:51 -0800 Subject: [PATCH 135/158] Fix #8537: Dimension tool points land on preview bounds corners With Use Preview Bounds on, W and H measure a stroked path from the outside of its stroke, while the Dimension tool's Linear points only snapped to the path's anchors, on the stroke's centerline. A dimension between the corners of a 12 x 6 mm rectangle with a 0.4 mm stroke then read 11.6 x 5.6 mm. - With Use Preview Bounds on, a Linear click within 8 pixels of a corner of the preview bounds of a path or compound path (strokes and effects included) lands on that corner instead of on that object's anchors, whatever the snapping options. An anchor of other art nearer the pointer than the corner takes the point, and a corner that is also an anchor takes the anchor. - The point is held against the anchors of the path whose bounds reach that corner, also when the corner lies far from the path or on another path's segment. It moves with the path; a later change to the stroke weight does not move it. - A press on such a corner picks it when the pointer moves a few pixels before the release, as on an anchor. - Hovering by such a corner shows the anchor ring. The ring now also shows when the pointer is exactly on the point a pick lands on, which it did not for the end of a dimension's line. Docs: docs/dimensions.md, docs/target-app-parity.md. --- crates/tools/src/dimension.rs | 384 ++++++++++++++++++++++++++++++++-- docs/dimensions.md | 15 +- docs/target-app-parity.md | 1 + 3 files changed, 379 insertions(+), 21 deletions(-) diff --git a/crates/tools/src/dimension.rs b/crates/tools/src/dimension.rs index 3e50415434..edb12b1db1 100644 --- a/crates/tools/src/dimension.rs +++ b/crates/tools/src/dimension.rs @@ -4,11 +4,12 @@ //! a click on a circle or arc gives its radius. Escape cancels without leaving any artwork. use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey}; use serde_json::{Value, json}; +use std::collections::HashMap; use vectorcraft_doc::{ - Node, NodeId, + Node, NodeId, NodeKind, dimension::{self, Dimension, DimensionMode, DimensionOptions, DimensionSource, FreePoint, Orientation, PointRef, SegmentRef}, }; -use vectorcraft_geom::{BezPath, Point, Vec2}; +use vectorcraft_geom::{BezPath, Point, Rect, Vec2}; /// The three kinds of dimension the tool draws. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] @@ -68,7 +69,7 @@ pub struct DimensionTool { /// Where the next Linear pick lands, as last worked out for the pointer (for the overlays). snapped: Option<(Point, Option)>, /// Whether the last Linear pick worked out landed on the end of a line of a dimension already - /// drawn (shown as an anchor). + /// drawn, or on a corner of a path's preview bounds (shown as an anchor). on_end: bool, /// Whether the press under way began on an anchor a Linear click picks. press_on_anchor: bool, @@ -76,6 +77,8 @@ pub struct DimensionTool { /// for that click (a snap or Shift can move the point away from it): placed with the pointer /// still at either, it is aligned. second: Option<(Point, Point)>, + /// The preview bounds the Linear picks measured, for the document's revision. + preview_boxes: PreviewBoxes, } /// What a linear dimension between `a` and `b` measures with the pointer at `p` while it is @@ -170,9 +173,14 @@ fn anchor_near(cx: &ToolContext, edge: &SegmentRef, p: Point) -> Option<(usize, /// The anchor nearest `p` within reach, on any editable path (the topmost on a tie), as a link to /// its path. Bounded work, and dimension artwork is skipped, as in [`pick`]. fn anchor_under(cx: &ToolContext, p: Point) -> Option<(Point, PointRef)> { + anchor_under_where(cx, p, |_| true) +} + +/// [`anchor_under`] outside the objects `keep` turns down, and outside everything in them. +fn anchor_under_where(cx: &ToolContext, p: Point, keep: impl Fn(NodeId) -> bool) -> Option<(Point, PointRef)> { type Best = Option<(f64, Point, PointRef)>; - fn visit(n: &Node, p: Point, reach: f64, budget: &mut usize, best: &mut Best) { - if *budget == 0 || !n.visible || n.locked || n.extras().dimension.is_some() { + fn visit(n: &Node, p: Point, reach: f64, keep: &dyn Fn(NodeId) -> bool, budget: &mut usize, best: &mut Best) { + if *budget == 0 || !n.visible || n.locked || n.extras().dimension.is_some() || !keep(n.id) { return; } if let Some(path) = n.path_data() { @@ -191,17 +199,140 @@ fn anchor_under(cx: &ToolContext, p: Point) -> Option<(Point, PointRef)> { } if let Some(ch) = n.children() { for c in ch.iter().rev() { - visit(c, p, reach, budget, best); + visit(c, p, reach, keep, budget, best); } } } let (reach, mut budget, mut best) = (cx.tol(ANCHOR_REACH), 20_000usize, None); for n in cx.doc.layers.iter().rev() { - visit(n, p, reach, &mut budget, &mut best); + visit(n, p, reach, &keep, &mut budget, &mut best); } best.map(|(_, at, r)| (at, r)) } +/// The geometric bounds of the paths [`preview_corner`] looked at, and the preview bounds of +/// those it measured, kept while the document is unchanged, so that the pointer moving over the +/// art measures each path once. +#[derive(Default)] +struct PreviewBoxes { + revision: Option<(u64, u64)>, + geometric: HashMap>, + preview: HashMap>, +} + +/// A corner of an object's preview bounds that a Linear pick can land on. +#[derive(Clone, Copy, Debug)] +struct PreviewCorner { + at: Point, + /// The path the point is held against. + holder: NodeId, + /// The path or compound path whose preview bounds have the corner. + object: NodeId, +} + +/// With Use Preview Bounds on, the corner of a path's or compound path's preview bounds (its +/// strokes and effects included) nearest `p` within reach, on any editable one whose preview +/// bounds differ from its geometric bounds. In a compound path, the member whose own box reaches +/// nearest to the corner holds it. The work is bounded, and dimension artwork is skipped, as in +/// [`pick`]. `cache` keeps the bounds measured for the document's revision. +fn preview_corner(cx: &ToolContext, p: Point, cache: &mut PreviewBoxes) -> Option { + struct Walk<'a, 'c> { + symbols: Option>, + doc: &'a vectorcraft_doc::Document, + cache: &'c mut PreviewBoxes, + p: Point, + reach: f64, + budget: usize, + best: Option<(f64, PreviewCorner)>, + } + fn visit(n: &Node, w: &mut Walk) { + if w.budget == 0 || !n.visible || n.locked || n.extras().dimension.is_some() { + return; + } + w.budget -= 1; + // Only effects, on the object or on one of its fills or strokes, paint further out than + // its strokes reach. + let effects = !n.appearance.effects.is_empty() || n.appearance.items.iter().any(|i| !i.effects().is_empty()); + let reach = n.appearance.outset() + w.reach; + let corners = |r: Rect| [Point::new(r.x0, r.y0), Point::new(r.x1, r.y0), Point::new(r.x1, r.y1), Point::new(r.x0, r.y1)]; + // A path is its own member; a compound path's members are its paths. + let compound = match &n.kind { + NodeKind::Compound { children, .. } => Some(children.as_slice()), + _ => None, + }; + let members = + || compound.into_iter().flatten().map(|c| c.as_ref()).chain(compound.is_none().then_some(n)).filter(|m| m.path_data().is_some()); + if members().next().is_some() + && let Some(geometric) = *w.cache.geometric.entry(n.id).or_insert_with(|| n.geometric_bounds()) + && (effects || geometric.inflate(reach, reach).contains(w.p)) + { + let doc = w.doc; + let measured = match w.cache.preview.get(&n.id) { + Some(r) => *r, + None => { + let symbols = w.symbols.get_or_insert_with(|| doc.symbol_boxes()); + let r = vectorcraft_effects::preview::visual_bounds(symbols, n); + w.cache.preview.insert(n.id, r); + r + } + }; + if let Some(r) = measured + && r != geometric + { + for (k, q) in corners(r).into_iter().enumerate() { + let d = q.distance(w.p); + if d > w.reach || w.best.is_some_and(|(nearest, ..)| d >= nearest) { + continue; + } + // The path whose own box reaches furthest towards the corner holds it: in a + // compound path, the member that puts that corner where it is. + let mut holder = None; + for m in members() { + let Some(b) = *w.cache.geometric.entry(m.id).or_insert_with(|| m.geometric_bounds()) else { continue }; + let gap = corners(b).get(k).map_or(f64::INFINITY, |c| c.distance(q)); + if holder.is_none_or(|(near, _)| gap < near) { + holder = Some((gap, m.id)); + } + } + if let Some((_, holder)) = holder { + w.best = Some((d, PreviewCorner { at: q, holder, object: n.id })); + } + } + } + } + if let Some(ch) = n.children() { + for c in ch.iter().rev() { + visit(c, w); + } + } + } + // Anchors take a pick whatever the snapping options, and so do the corners standing in for them. + if !cx.preview_bounds { + return None; + } + if cache.revision != Some(cx.revision) { + *cache = PreviewBoxes { revision: Some(cx.revision), ..Default::default() }; + } + let mut w = Walk { symbols: None, doc: cx.doc, cache, p, reach: cx.tol(ANCHOR_REACH), budget: 20_000, best: None }; + for n in cx.doc.layers.iter().rev() { + visit(n, &mut w); + } + w.best.map(|(_, corner)| corner) +} + +/// The anchor a pick at `p` lands on instead of `corner`, given `anchor`, the nearest anchor +/// within reach; `None` when the corner takes it. The corner takes the pick from the anchors of +/// the object whose preview bounds have it, which sit on the stroke's centerline. An anchor right +/// on the corner takes it, and so does the nearest anchor of other art when that anchor is nearer +/// the pointer than the corner. +fn anchor_over_corner(cx: &ToolContext, p: Point, corner: &PreviewCorner, anchor: Option<(Point, PointRef)>) -> Option<(Point, PointRef)> { + let (at, _) = anchor.as_ref()?; + if at.distance(corner.at) <= 1e-9 { + return anchor; + } + anchor_under_where(cx, p, |id| id != corner.object).filter(|(other, _)| other.distance(p) < corner.at.distance(p)) +} + /// Where a pick at `p` lands on the artwork of the visible, unlocked dimensions already drawn, /// with no link to it: the nearest end of one of their lines (dimension and extension lines) /// within the anchor reach, as an anchor (`true`); else the nearest point of one of those lines @@ -303,10 +434,24 @@ fn nearest_on(cx: &ToolContext, edge: &SegmentRef, p: Point) -> Option { /// A point on a segment keeps its place along the segment. Any other point is held /// against the anchors of the path under it, or, with no path under it, the path of the other /// point, so that it moves with that path. None when neither point has a path to link to. -fn points_source(cx: &ToolContext, (a, ra): (Point, &Option), (b, rb): (Point, &Option)) -> Option { - let (edge_a, edge_b) = (pick(cx, a), pick(cx, b)); - let node = |r: &Option, e: &Option| r.as_ref().map(|r| r.node).or_else(|| e.as_ref().map(|e| e.node)); - let (path_a, path_b) = (node(ra, &edge_a), node(rb, &edge_b)); +fn points_source( + cx: &ToolContext, + boxes: &mut PreviewBoxes, + (a, ra): (Point, &Option), + (b, rb): (Point, &Option), +) -> Option { + // A point on a corner of a path's preview bounds is held against that path, however far its + // strokes or effects put the corner from the path and whatever other segment lies there. + let mut corner_of = |p: Point, r: &Option| { + r.is_none().then(|| preview_corner(cx, p, boxes)).flatten().filter(|c| c.at.distance(p) <= 1e-9).map(|c| c.holder) + }; + let (corner_a, corner_b) = (corner_of(a, ra), corner_of(b, rb)); + let edge = |p: Point, corner: Option| if corner.is_some() { None } else { pick(cx, p) }; + let (edge_a, edge_b) = (edge(a, corner_a), edge(b, corner_b)); + let node = |r: &Option, corner: Option, e: &Option| { + r.as_ref().map(|r| r.node).or(corner).or_else(|| e.as_ref().map(|e| e.node)) + }; + let (path_a, path_b) = (node(ra, corner_a, &edge_a), node(rb, corner_b, &edge_b)); let free = |p: Point, r: &Option, edge: &Option, own: Option, other: Option| { if r.is_some() { return None; @@ -324,7 +469,10 @@ fn points_source(cx: &ToolContext, (a, ra): (Point, &Option), (b, rb): } impl DimensionTool { - /// Where a Linear pick at `p` lands: on the nearest anchor of any path, within reach (kept as + /// Where a Linear pick at `p` lands: with Use Preview Bounds on, on the nearest corner of a + /// path's preview bounds within reach, where they differ from its anchors, unless an anchor of + /// other art is nearer (held against the path, labeled "anchor"; [`anchor_over_corner`]); else on the + /// nearest anchor of any path, within reach (kept as /// a link to its path), labeled "anchor"; else on the nearest end of a line of a dimension /// already drawn, within the same reach (no link), also labeled "anchor"; else where Smart Guides put it (another object's anchor or centre, in /// line with one, or for the second point square to a segment or grazing a curve from the @@ -341,7 +489,16 @@ impl DimensionTool { }); let guided = self.snap.hover(cx, p, &[], leave.as_ref()); self.on_end = false; - if let Some((point, reference)) = anchor_under(cx, p) { + let mut anchor = anchor_under(cx, p); + if let Some(corner) = preview_corner(cx, p, &mut self.preview_boxes) { + anchor = anchor_over_corner(cx, p, &corner, anchor); + if anchor.is_none() { + self.on_end = true; + self.snap.label(corner.at, "anchor"); + return (corner.at, None); + } + } + if let Some((point, reference)) = anchor { self.snap.label(point, "anchor"); return (point, Some(reference)); } @@ -509,7 +666,7 @@ impl DimensionTool { } self.points.push((at, reference)); if let [(a, ra), (b, rb)] = self.points.as_slice() { - let source = points_source(cx, (*a, ra), (*b, rb)); + let source = points_source(cx, &mut self.preview_boxes, (*a, ra), (*b, rb)); let mut d = self.recipe(DimensionMode::Linear, *a, *b, Point::ZERO, source); if d.resolve(cx.doc).is_ok() { self.second = Some((*b, p)); @@ -609,11 +766,14 @@ impl Tool for DimensionTool { self.press = Some((ev.pos, None)); return self.preview(cx, ev.pos); } - // A Linear press on an anchor, or on the end of a dimension's line, picks it unless - // it drags past the anchor's reach: moving a few pixels before the release does not - // drag out the dimension of a segment under the pointer. - self.press_on_anchor = - self.kind == Kind::Linear && (anchor_under(cx, ev.pos).is_some() || on_dimensions(cx, ev.pos).is_some_and(|(_, end)| end)); + // A Linear press on an anchor, on a corner of preview bounds or on the end of a + // dimension's line, picks it unless it drags past the anchor's reach: moving a few + // pixels before the release does not drag out the dimension of a segment under the + // pointer. + self.press_on_anchor = self.kind == Kind::Linear + && (anchor_under(cx, ev.pos).is_some() + || preview_corner(cx, ev.pos, &mut self.preview_boxes).is_some() + || on_dimensions(cx, ev.pos).is_some_and(|(_, end)| end)); self.press = Some((ev.pos, self.target(cx, ev.pos))); vec![] } @@ -727,7 +887,7 @@ impl Tool for DimensionTool { let linear_pick = self.kind == Kind::Linear && self.pending.is_none() && self.lines.is_empty(); let snapped = self.snapped.clone().filter(|_| linear_pick); if let Some((q, reference)) = &snapped - && (reference.is_some() || q.distance(self.at) > 1e-9) + && (reference.is_some() || self.on_end || q.distance(self.at) > 1e-9) { let on_anchor = reference.is_some() || self.on_end; out.push(Overlay::Anchor { p: *q, color, filled: !on_anchor, size: if on_anchor { 10.0 } else { 6.0 } }); @@ -937,6 +1097,190 @@ mod tests { assert!(at.distance(pending.b) < 1e-9, "{at:?} {:?}", pending.b); } + /// With Use Preview Bounds on, clicks by the corners of a stroked path land on the corners of + /// its preview bounds, held against the path, so the dimension measures the outside of the + /// stroke as W and H do. Without a stroke, or with the preference off, the anchors are picked. + #[test] + fn with_preview_bounds_points_land_on_the_corners_of_the_stroke() { + use vectorcraft_doc::dimension::FreePoint; + let (d, id) = doc_with_rect(); + let (s, p) = (Selection::default(), paint()); + let pick = |c: &ToolContext| { + let mut t = DimensionTool::default(); + for (x, y) in [(101.0, 101.0), (199.0, 199.0)] { + t.pointer(c, &PointerEvent::new(PointerKind::Move, x, y)); + t.pointer(c, &PointerEvent::new(PointerKind::Down, x, y)); + t.pointer(c, &PointerEvent::new(PointerKind::Up, x, y)); + } + t.pending.expect("both points were picked") + }; + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + let pending = pick(&c); + let near = |a: Point, b: Point| a.distance(b) < 1e-9; + assert!(near(pending.a, Point::new(99.5, 99.5)) && near(pending.b, Point::new(200.5, 200.5)), "{:?} {:?}", pending.a, pending.b); + let Some(DimensionSource::Points { a: None, b: None, free_a: Some(free_a), free_b: Some(free_b), .. }) = &pending.source else { + panic!("{:?}", pending.source) + }; + for (free, at) in [(free_a, pending.a), (free_b, pending.b)] { + assert!(matches!(free, FreePoint::Anchors { node, .. } if *node == id), "{free:?}"); + assert!(free.position(&d).expect("the anchors that hold it exist").distance(at) < 1e-9); + } + // A line of another path through the corner leaves the point held against the rectangle. + let mut crossed = d.clone(); + let (l, line) = (crossed.layers[0].id, crossed.alloc_id()); + let path = vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(0.0, 99.5), Point::new(300.0, 99.5)], false)); + crossed.insert(Some(l), 1, Node::path(line, path, vectorcraft_doc::Appearance::default_art())).expect("the line"); + let pending = pick(&ToolContext { preview_bounds: true, ..cx(&crossed, &s, &p) }); + assert!(near(pending.a, Point::new(99.5, 99.5)), "{:?}", pending.a); + let Some(DimensionSource::Points { free_a: Some(free_a), .. }) = &pending.source else { panic!("{:?}", pending.source) }; + assert!(matches!(free_a, FreePoint::Anchors { node, .. } if *node == id), "{free_a:?}"); + let anchors = |pending: &Dimension| (pending.a, pending.b, pending.source.clone()); + let anchor = |anchor| Some(PointRef { node: id, subpath: 0, anchor }); + let linked = DimensionSource::Points { a: anchor(0), b: anchor(2), vertex: None, free_a: None, free_b: None }; + let off = pick(&cx(&d, &s, &p)); + assert_eq!(anchors(&off), (Point::new(100.0, 100.0), Point::new(200.0, 200.0), Some(linked.clone())), "preference off"); + let mut bare = d.clone(); + bare.node_mut(id).expect("the rectangle").appearance = vectorcraft_doc::Appearance::default().into(); + let c = ToolContext { preview_bounds: true, ..cx(&bare, &s, &p) }; + assert_eq!(anchors(&pick(&c)), (Point::new(100.0, 100.0), Point::new(200.0, 200.0), Some(linked)), "no stroke"); + // A compound path's stroke: the points are held against the member that reaches the + // corner, not the small hole drawn first. + let mut compound = vectorcraft_doc::Document::new(500.0, 500.0); + let (l, hole, part, whole) = (compound.layers[0].id, compound.alloc_id(), compound.alloc_id(), compound.alloc_id()); + let square = |id, a: f64, b: f64| { + std::sync::Arc::new(Node::path(id, vectorcraft_geom::shapes::rectangle(vectorcraft_geom::Rect::new(a, a, b, b)), Default::default())) + }; + let children = vec![square(hole, 140.0, 160.0), square(part, 100.0, 200.0)]; + let mut n = Node::new(whole, NodeKind::Compound { children, rule: Default::default() }); + n.appearance = vectorcraft_doc::Appearance::default_art().into(); + compound.insert(Some(l), 0, n).expect("the compound path"); + let pending = pick(&ToolContext { preview_bounds: true, ..cx(&compound, &s, &p) }); + assert!(near(pending.a, Point::new(99.5, 99.5)) && near(pending.b, Point::new(200.5, 200.5)), "{:?} {:?}", pending.a, pending.b); + let Some(DimensionSource::Points { free_a: Some(free_a), free_b: Some(free_b), .. }) = &pending.source else { + panic!("{:?}", pending.source) + }; + for free in [free_a, free_b] { + assert!(matches!(free, FreePoint::Anchors { node, .. } if *node == part), "{free:?}"); + } + // A 40 point stroke, and an Offset Path effect on the fill, put the corners further from + // the path than a click on the path reaches: the points still land there and stay linked. + let mut wide = vectorcraft_doc::Appearance::default_art(); + wide.stroke_mut().expect("a stroke").width = 40.0; + let mut offset = vectorcraft_doc::Appearance::default_art(); + let effect = + vectorcraft_doc::Effect { id: "path.offsetPath".into(), params: serde_json::json!({"offset": 30, "joins": "miter"}), visible: true }; + offset.effects_mut(Some(0)).expect("the fill").push(effect); + for (appearance, out) in [(wide, 20.0), (offset, 30.0)] { + let mut d = d.clone(); + d.node_mut(id).expect("the rectangle").appearance = appearance.into(); + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + let mut t = DimensionTool::default(); + for (x, y) in [(101.0 - out, 101.0 - out), (199.0 + out, 199.0 + out)] { + t.pointer(&c, &PointerEvent::new(PointerKind::Move, x, y)); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, x, y)); + t.pointer(&c, &PointerEvent::new(PointerKind::Up, x, y)); + } + let pending = t.pending.expect("both points were picked"); + let (a, b) = (Point::new(100.0 - out, 100.0 - out), Point::new(200.0 + out, 200.0 + out)); + assert!(near(pending.a, a) && near(pending.b, b), "{out}: {:?} {:?}", pending.a, pending.b); + let Some(DimensionSource::Points { free_a: Some(free_a), free_b: Some(free_b), .. }) = &pending.source else { + panic!("{out}: {:?}", pending.source) + }; + for free in [free_a, free_b] { + assert!(matches!(free, FreePoint::Anchors { node, .. } if *node == id), "{out}: {free:?}"); + } + } + // A press on a corner over another path's segment picks the corner when the pointer moves + // a few pixels before the release, as on an anchor. + let mut d = d.clone(); + let mut wide = vectorcraft_doc::Appearance::default_art(); + wide.stroke_mut().expect("a stroke").width = 40.0; + d.node_mut(id).expect("the rectangle").appearance = wide.into(); + let (l, line) = (d.layers[0].id, d.alloc_id()); + let path = vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(0.0, 82.0), Point::new(95.0, 82.0)], false)); + d.insert(Some(l), 1, Node::path(line, path, Default::default())).expect("the line"); + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + let mut t = DimensionTool::default(); + assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Down, 81.0, 81.0)).is_empty()); + assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 85.0, 81.0)).is_empty(), "no segment dimension is dragged out"); + assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, 85.0, 81.0)).is_empty()); + assert!(t.points.first().is_some_and(|(q, _)| near(*q, Point::new(80.0, 80.0))), "{:?}", t.points); + } + + /// With Use Preview Bounds on, hovering by a corner of a stroked path's preview bounds, or + /// right on it, shows the anchor ring there. + #[test] + fn hovering_a_corner_of_the_preview_bounds_shows_the_anchor_ring() { + let (d, _) = doc_with_rect(); + let (s, p) = (Selection::default(), paint()); + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + for (x, y) in [(101.0, 101.0), (99.5, 99.5)] { + let mut t = DimensionTool::default(); + t.pointer(&c, &PointerEvent::new(PointerKind::Move, x, y)); + let ring = t + .overlays(&c) + .into_iter() + .any(|o| matches!(o, Overlay::Anchor { p, filled: false, size, .. } if p.distance(Point::new(99.5, 99.5)) < 1e-9 && size == 10.0)); + assert!(ring, "({x}, {y})"); + } + } + + /// With Use Preview Bounds on, a corner of the preview bounds takes a pick with Smart Guides and + /// Snap to Point off, as an anchor does, and an anchor of other art nearer the pointer than the + /// corner takes it from the corner. The point moves with the path, and a later change to the + /// stroke weight leaves it where it was. + #[test] + fn preview_bounds_corners_take_picks_as_anchors_do() { + let (d, id) = doc_with_rect(); + let (s, p) = (Selection::default(), paint()); + let near = |a: Point, b: Point| a.distance(b) < 1e-9; + let pick = |c: &ToolContext, at: [(f64, f64); 2]| { + let mut t = DimensionTool::default(); + for (x, y) in at { + t.pointer(c, &PointerEvent::new(PointerKind::Move, x, y)); + t.pointer(c, &PointerEvent::new(PointerKind::Down, x, y)); + t.pointer(c, &PointerEvent::new(PointerKind::Up, x, y)); + } + t.pending.expect("both points were picked") + }; + let unsnapped = ToolContext { preview_bounds: true, smart_guides: false, snap_to_point: false, ..cx(&d, &s, &p) }; + let pending = pick(&unsnapped, [(101.0, 101.0), (199.0, 199.0)]); + assert!(near(pending.a, Point::new(99.5, 99.5)) && near(pending.b, Point::new(200.5, 200.5)), "{:?} {:?}", pending.a, pending.b); + // An unstroked line whose end lies 2.5 points outside the corner. + let mut other = d.clone(); + let (l, line) = (other.layers[0].id, other.alloc_id()); + let path = vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(97.0, 97.0), Point::new(50.0, 50.0)], false)); + other.insert(Some(l), 1, Node::path(line, path, Default::default())).expect("the line"); + let c = ToolContext { preview_bounds: true, ..cx(&other, &s, &p) }; + let pending = pick(&c, [(97.5, 97.5), (199.0, 199.0)]); + assert!(near(pending.a, Point::new(97.0, 97.0)), "the line's end is nearer: {:?}", pending.a); + let Some(DimensionSource::Points { a: Some(a), .. }) = &pending.source else { panic!("{:?}", pending.source) }; + assert_eq!(a.node, line); + let pending = pick(&c, [(99.0, 99.0), (199.0, 199.0)]); + assert!(near(pending.a, Point::new(99.5, 99.5)), "the corner is nearer: {:?}", pending.a); + // Right on the rectangle's anchor, with another path's anchor nearer than the corner: that + // anchor takes the point, not the rectangle's own anchor on the stroke's centerline. + let mut beside = d.clone(); + let (l, line) = (beside.layers[0].id, beside.alloc_id()); + let path = + vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(100.5, 100.0), Point::new(150.0, 50.0)], false)); + beside.insert(Some(l), 1, Node::path(line, path, Default::default())).expect("the line"); + let pending = pick(&ToolContext { preview_bounds: true, ..cx(&beside, &s, &p) }, [(100.0, 100.0), (199.0, 199.0)]); + let Some(DimensionSource::Points { a: Some(a), .. }) = &pending.source else { panic!("{:?}", pending.source) }; + assert!(near(pending.a, Point::new(100.5, 100.0)) && a.node == line, "{:?} {a:?}", pending.a); + // The point held against the rectangle moves with it and stays put when the stroke changes. + let pending = pick(&ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }, [(101.0, 101.0), (199.0, 199.0)]); + let Some(DimensionSource::Points { free_a: Some(free), .. }) = &pending.source else { panic!("{:?}", pending.source) }; + let mut moved = d.clone(); + moved.node_mut(id).expect("the rectangle").transform(vectorcraft_geom::Affine::translate((10.0, 0.0)), false); + assert!(free.position(&moved).is_some_and(|q| near(q, Point::new(109.5, 99.5))), "{:?}", free.position(&moved)); + let mut wider = d.clone(); + let mut wide = vectorcraft_doc::Appearance::default_art(); + wide.stroke_mut().expect("a stroke").width = 40.0; + wider.node_mut(id).expect("the rectangle").appearance = wide.into(); + assert!(free.position(&wider).is_some_and(|q| near(q, Point::new(99.5, 99.5))), "{:?}", free.position(&wider)); + } + /// The anchors of a live rectangle are picked the same way. #[test] fn a_press_on_a_live_shapes_anchor_picks_it() { diff --git a/docs/dimensions.md b/docs/dimensions.md index 35e164d4f9..b15d8f8727 100644 --- a/docs/dimensions.md +++ b/docs/dimensions.md @@ -20,7 +20,8 @@ The **Dimension Tool** is in the Modify section of the toolbar. Its strip offers first point was picked on an anchor, the second also snaps onto the construction guides through it; any other first point has no construction guides through it. The guides show while hovering, before each click. VectorCraft's own rules decide where a point lands: an - anchor within 8 pixels takes it first; with Smart Guides or Snap to Point on, the end of a line + anchor within 8 pixels takes it first (with Use Preview Bounds on, after a corner of a path's + preview bounds, as below); with Smart Guides or Snap to Point on, the end of a line of a visible, unlocked dimension already drawn (its dimension line, or the far end of an extension line) within 8 pixels takes it next, without a link to that dimension; a point on a guide stays on the guide where the pointer @@ -31,6 +32,18 @@ The **Dimension Tool** is in the Modify section of the toolbar. Its strip offers line of a dimension already drawn, within 8 pixels. With Smart Guides and Anchor/Path Labels on, a point on an anchor or a line end shows the "anchor" label, and a point on a segment or line shows the "path" label. These rules apply to the Linear points. + With Use Preview Bounds on (Preferences › General), a click within 8 pixels of a corner of the + preview bounds of a path or compound path, its strokes and effects included, lands on that + corner instead of on that object's anchors, as the + [linear dimensions help](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/plot-linear-dimensions-of-objects.html) + describes for measuring a stroked segment. An anchor of other art that is nearer the pointer + than the corner takes the point instead. The point is linked to the path (in a compound path, + to the member whose own bounds reach nearest to the corner), held against its anchors, and + shows the "anchor" label. It moves with the path, and a later change to the stroke weight does + not move it. For an object that is not rotated, a horizontal or vertical dimension between two + such corners measures the outside of the stroke, the width or height that W and H show in the + Transform and Properties panels. A corner that is also an anchor, as on a path without a + stroke, takes the anchor. A linear dimension is aligned, horizontal or vertical, as the [linear dimensions help](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/plot-linear-dimensions-of-objects.html) describes: after the second click, clicking again places an aligned dimension, and moving the diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b6f0207e69..cb2da583b9 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -635,6 +635,7 @@ since 2026-10-01. **Drawing tools, Dimension tool points on a Smart Guide stay on the guide:** By VectorCraft's own rule, a clicked point that lies on a Smart Guide already, such as one in line with an object's center, stays where the pointer is when no anchor is within 8 pixels and no segment is within the Smart Guides snapping tolerance, instead of moving onto a segment farther than that tolerance and within 8 pixels; with Snap to Grid or Snap to Pixel on, a point stays on the grid or the whole pixel those options give. `a_point_on_a_guide_stays_on_the_guide` covers it. **Drawing tools, Dimension tool second point without construction guides through a first point off the anchors:** By VectorCraft's own rule, with Smart Guides on, the second Linear point does not snap to the construction guides through a first point that is not on an anchor, so a click beside a segment straight below such a first point lands on the segment; after a first point picked on an anchor, the construction guides through it still apply. The second point still snaps to anchors, centers and alignment lines, and with Snap to Perpendicular or Snap to Tangent on, it lands where the line from the first point meets a segment square or grazes a curve. `a_point_on_a_guide_stays_on_the_guide`, `the_second_point_after_an_anchor_lands_on_construction_guides`, `the_second_point_lands_square_to_a_segment_or_grazing_a_curve` and `linear_picks_show_and_snap_to_smart_guides` cover it. **Drawing tools, Dimension tool points land on dimensions already drawn (#8063):** By VectorCraft's own rule, with Smart Guides or Snap to Point on, a Linear point that no anchor of the art within 8 pixels takes lands on the end of a visible, unlocked dimension's dimension line, or on the far end of its extension line, within 8 pixels, and a point that nothing else places lands on the closest point of such a line within 8 pixels, so at any zoom a dimension can start where another one ends. The end of an extension line next to the point it measures does not pull points away from that anchor. With Smart Guides and Anchor/Path Labels on, a point on an anchor or line end shows the "anchor" label and a point on a segment or line shows the "path" label. `linear_picks_land_on_anchors_paths_and_drawn_dimensions` and `an_anchor_beside_a_drawn_dimension_takes_the_point` cover it. +**Drawing tools, Dimension tool points on preview bounds (#8537):** With Use Preview Bounds on, a Linear point clicked within 8 pixels of a corner of the preview bounds of a path or compound path with a stroke or effects lands on that corner instead of on that object's anchors, as the [linear dimensions help](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/plot-linear-dimensions-of-objects.html) describes, unless an anchor of other art is nearer the pointer; for an object that is not rotated, a horizontal or vertical dimension between two such corners measures the size that W and H show. `with_preview_bounds_points_land_on_the_corners_of_the_stroke`, `preview_bounds_corners_take_picks_as_anchors_do` and `hovering_a_corner_of_the_preview_bounds_shows_the_anchor_ring` cover it. **Drawing tools, Dimension tool dimensions selected with their art keep their lines and label:** Object › Expand, Object › Expand Appearance and Object › Path › Outline Stroke leave a dimension selected with art it measures, directly or in selected groups without fills, strokes or effects of their own, as it is and change only the other art; when the new art no longer fits its link, the dimension stays where it was, no longer linked, and undo links it again. `expand_leaves_a_dimension_selected_with_its_art_as_it_is`, `expand_appearance_leaves_a_dimension_selected_with_its_art_as_it_is`, `outline_stroke_leaves_a_dimension_selected_with_its_art_as_it_is`, `a_dimension_selected_with_art_that_has_nothing_to_expand_changes_nothing`, `a_group_effect_expanded_reaches_the_dimension_it_holds`, `expand_keeps_a_dimension_in_its_asset_and_its_variable_binding`, `a_dimension_keeps_no_link_to_the_art_expand_replaced`, `a_dimension_outlasts_the_art_outline_stroke_or_expand_appearance_replaced`, `a_dimension_outlasts_the_stroke_expand_outlined` and `expand_appearance_in_safe_mode_leaves_a_dimension_selected_with_its_art` cover it. **Drawing tools, Line Segment from one curve onto a common tangent of another:** By VectorCraft's own rule, with Smart Guides and Snap to Tangent on, a Line Segment drag pressed anywhere on a convex closed path with curves and dragged to within the snapping tolerance of another such path lands on a common tangent of the two ([tangent lines to circles](https://en.wikipedia.org/wiki/Tangent_lines_to_circles)): both ends move to where the line touches the paths, the start sliding along the first path, and each end shows the "tangent" label when Anchor/Path Labels is on, with the line drawn as a guide when Alignment Guides is on. The line is the tangent whose touch point on the second path is nearest the pointer, so moving the pointer around the second path switches between the outer tangent and the one crossing between the paths. The start stays where it was pressed when Shift, Alt or Space is held, when an anchor, center or crossing lies nearer the pointer than the second path does, when the press snapped to an anchor, center or crossing off the first path, when Snap to Tangent is off, when Snap to Grid or pixel snapping places drawn points, or when either path bends inward somewhere or has more than 512 segments. `a_line_from_one_circle_to_another_lands_on_their_common_tangent`, `a_line_from_a_turned_ellipse_lands_on_its_tangent_with_a_circle`, `a_line_near_the_second_path_takes_the_tangent_touching_it_nearest`, `a_line_keeps_its_start_without_a_tangent_snap`, `a_line_to_a_crescent_or_from_an_anchor_beside_the_curve_keeps_its_start` and `a_line_segment_drag_draws_the_common_tangent_as_one_undo_step` cover it. **Live trace result bounds and selection highlights exclude the retained bitmap except in source-image views:** `live_trace_result_bounds_exclude_the_retained_bitmap_at_any_angle` checks every TraceView, geometric and visual bounds and rotated result bounds. `live_trace_selection_highlight_excludes_the_retained_source_rectangle` checks result highlights and the existing ordinary-group policy. Shared editing-child traversal also preserves Shaper handling. From 4074065b2de3a89167d0e6ca95a3e1cd2451dca0 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 01:55:39 -0800 Subject: [PATCH 136/158] Docs: restore the Japanese catalog line --- docs/target-app-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 5de5ec322a..b84c9b7f75 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1055,7 +1055,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - The status bar translates the plug-in host's other errors (manifest, module and run checks, the output an importer, exporter or effect returns, and the approval a plug-in's permissions need) in every language that translates every message. A JSON object or array inside a message stays as written, and a message that wraps another one, such as `plug-in manifest: {0}`, is matched by its own row before a row that starts with a placeholder. The reasons inside these errors (what is wrong with a parameter's spec or dialog keys, the value a parameter needs, what is wrong with an object, stroke, paint or effect in a plug-in's output) are translated with them, and the untranslated-strings report lists the reasons the plug-in host's error helpers take (`plugin_messages_are_translated_in_every_complete_catalog`, `plugin_errors_translate_with_their_values`, `plugin_error_reasons_are_translated_with_the_error`, `message_scan_reads_plugin_helpers`, `templates_that_start_with_text_match_first`). - The status bar translates `script.run`'s refusals of `answers` in every language that translates every message: a value that is not a list, more than 10,000 answers, more than 1 MiB, an answer at an index that is not an object, does not have exactly `kind` and `value`, has a `value` its kind of dialog does not take, holds a prompt's text longer than 16 KiB or has an unknown `kind`, and `answers` given to a run in the app. The index, the counts and the code names are shown as they are, and the command's error stays in English. The untranslated-strings report also lists the refusals of `script.run`'s parameters (`script_answers_errors_are_translated`, `message_scan_reads_script_run_param_refusals`). - The status bar also translates `script.run`'s other refusals of its parameters in every language that translates every message: a `maxFuel` outside 1 to 100,000,000,000, `args` nested more than 64 levels deep (with the place in `args`), `args` that is not an object or is larger than 1 MiB, an empty `path`, a `source` given with `installed`, a `path` that does not name a .js or .jsx file, and neither or both of `path` and `source`. The code names, the place in `args`, the file suffixes and the limits are shown as they are, and the command's error stays in English (`script_run_param_errors_are_translated`). - - The Japanese catalog (`crates/ui-egui/src/i18n/ja.tsv`) has 3,562 `@msg` rows and 49 `@msgplural` rows (counted 2026-11-14). The untranslated report (`untranslated_report`) lists 98 status and error messages in the sources that have no Japanese row: 77 that every complete-message language lacks, and 21 more. Open #7211 translates 34 of them, among them the composite font errors, and open #7116 translates the justification order error. The status bar does not use the rows for ``unknown parameter `{within}{key}`; {why}`` and `{name} must be {lo}–{hi}{unit} (got {v})`, because a message with two placeholders in a row cannot be matched (`Template::parse` in `crates/ui-egui/src/i18n/catalog.rs`). The row for `{k} has control characters{_1}` does not match the File Info error for a multi-line field, where the last placeholder is empty. A native speaker has not reviewed the wording. + - The Japanese catalog (`crates/ui-egui/src/i18n/ja.tsv`) has 3,562 `@msg` rows and 49 `@msgplural` rows (counted 2026-11-14). The untranslated report (`untranslated_report`) lists 98 status and error messages in the sources that have no Japanese row: 77 that every complete-message language lacks, and 21 more. Open #7211 translates 34 of them, among them the composite font errors, and open #7116 translates the justification order error. The status bar does not use the rows for ``unknown parameter `{within}{key}`; {why}`` and `{name} must be {lo}–{hi}{unit} (got {v})`, because a message with two placeholders in a row cannot be matched (`Template::parse` in `crates/ui-egui/src/i18n/catalog.rs`). A native speaker has not reviewed the wording. - A status or error message whose braces are literal, such as a plug-in's `expected {"objects": [...]}` or a command's `quotes must be {double?, single?}`, is translated only when the whole message matches its row: the row writes those braces doubled and has no placeholder, so it no longer replaces a different message that starts with the same words, such as a JSON reason `expected value at line 1 column 1`, which stays in English. A row without placeholders is found at any message length (`plain_message_keys_double_their_braces`, `literal_brace_rows_match_only_their_message`). - Every complete-message catalog translates five more messages with literal braces through such a row: the composite font errors `each font must be {name, parts}` and `give fonts: [{name, parts}…]`, `select.font`'s `` `scope` must be "document", {artboards: [index, …]} or {layers: [id, …]} ``, the script regular expression error `numbers out of order in {} quantifier` and `the paint is not a freeform gradient (apply one with paint.editGradient {kind: "freeform"})`. Each translation keeps the braced example as written, and no catalog keeps the older rows with a placeholder in place of the braces, which also translated other text with the same start and end (`literal_brace_messages_have_exact_rows_in_complete_languages`). - The status bar translates the errors a script's `File` and `Folder` objects, `vc.run`, `$.evalFile`, the `$` object's properties and functions, `alert`, `confirm` and `prompt`, `vc.document` and `vc.log` raise, the limits a run can pass, and the errors of Drop Script Engine, and the line for a run that fails (a syntax error, a thrown error, a limit, a stop or an internal error, with the script's name, the line and column, the included file it is in and the files left written), in every language that translates every message. The script's name, paths, numbers, command ids and the text a script throws itself are shown as they are. A failure with no line and column, such as an error in code `eval` compiled, is shown with one colon after the script's name (`an_error_without_a_place_names_the_script_and_kind`). A message template that names a value twice matches only when both places hold the same text, so the line for a failed run is not taken for the message inside it (`a_repeated_placeholder_matches_the_same_text`). The untranslated-strings report also lists the messages the script host's `fail`, `value` and `over` helpers take and the errors the script interpreter throws, and a constant's text comes from the file or crate that declares it, so the Scripts menu's headers are not listed as messages (`script_errors_are_translated`, `script_host_errors_are_translated`, `message_scan_reads_script_interpreter_errors`, `message_scan_reads_constants_of_the_file_and_its_crate`, `message_scan_skips_test_modules_with_any_test_cfg`). From c1613f2bf52add27100ae36ed00f537ded08ebc6 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:25:41 +0530 Subject: [PATCH 137/158] M7/G4: retype checks points along every edge; keys charged once (#4934) The whole-outline check tests points along every edge, so outlines with the same corners joined another way do not match; past a work limit it rejects. Face keys another Retype kept meanwhile are reused and charged once. The fonts parameter test uses outlines that would match. The parity note states the search limits. --- crates/engine/src/cmd/retype_tests.rs | 10 +++++- crates/text/src/retype.rs | 45 +++++++++++++++++++++++++-- docs/target-app-parity.md | 2 +- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 7812fc8e65..1c8cf5c2f2 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -80,7 +80,15 @@ fn a_drawn_shape_is_reported_and_left_alone() { let e = s.execute("type.retype", &json!({})).unwrap_err().to_string(); assert!(e.contains("no selected shape matches"), "{e}"); assert!(s.doc().unwrap().doc == before, "nothing changes"); - assert!(s.execute("type.retype", &json!({"fonts": "Source Sans 3"})).is_err(), "fonts is a list"); + // With outlines that would match, a bad `fonts` is refused for itself, and nothing changes. + let g = outlined(&mut s, json!({"x": 40, "y": 200, "text": "AB", "size": 40})); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let before = s.doc().unwrap().doc.clone(); + for bad in [json!("Source Sans 3"), json!([1]), json!({"family": "x"})] { + let e = s.execute("type.retype", &json!({"fonts": bad})).unwrap_err().to_string(); + assert!(e.contains("fonts must be a list of family names"), "{e}"); + } + assert!(s.doc().unwrap().doc == before); } #[test] diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs index 80fed5f33a..5ef5073909 100644 --- a/crates/text/src/retype.rs +++ b/crates/text/src/retype.rs @@ -40,6 +40,8 @@ const TOLERANCE: f64 = 2e-3; const OUTLINE_TOLERANCE: f64 = 5e-3; /// Points of a flattened outline past which the whole-outline check gives up (and so rejects). const MAX_OUTLINE_POINTS: usize = 8192; +/// Points along an outline past which the whole-outline check gives up (and so rejects). +const MAX_CHECKED_POINTS: usize = 65_536; /// How far apart two shapes' spread-to-length ratios may be and still be compared. const INVARIANT_SLACK: f64 = 0.02; @@ -250,7 +252,14 @@ fn face_keys(db: &FontDb, face: &FontFace) -> FaceKeys { gids.sort_unstable(); let keys: FaceKeys = Arc::new(gids.into_iter().filter_map(|(gid, ch)| Some((gid, ch, shape_key(&db.outline_uncached(face, gid))?))).collect()); let mut k = kept.lock().unwrap_or_else(|e| e.into_inner()); - if k.generation == generation && k.glyphs + keys.len() <= KEPT_KEYS { + if k.generation != generation { + return keys; + } + // Another Retype may have worked them out meanwhile: keep and charge one list. + if let Some(already) = k.faces.get(&at) { + return already.clone(); + } + if k.glyphs + keys.len() <= KEPT_KEYS { k.glyphs += keys.len(); k.faces.insert(at, keys.clone()); } @@ -331,7 +340,22 @@ fn outlines_agree(a: &BezPath, b: &BezPath, tol: f64) -> bool { }; let (Some(sa), Some(sb)) = (flat(a), flat(b)) else { return false }; let near = |p: Point, segs: &[(Point, Point)]| segs.iter().any(|(s, e)| Line::new(*s, *e).nearest(p, 1e-9).distance_sq <= tol * tol); - sa.iter().all(|(p, _)| near(*p, &sb)) && sb.iter().all(|(p, _)| near(*p, &sa)) + // Points along every edge, not only its ends: two outlines with the same corners joined in + // another order differ between them. Spaced `tol` apart; past the work limit, not a match. + let along = |segs: &[(Point, Point)]| -> Option> { + let mut pts = vec![]; + for (s, e) in segs { + let steps = (s.distance(*e) / tol).ceil(); + if !steps.is_finite() || pts.len() as f64 + steps > MAX_CHECKED_POINTS as f64 { + return None; + } + let steps = (steps as usize).max(1); + pts.extend((0..steps).map(|i| s.lerp(*e, i as f64 / steps as f64))); + } + Some(pts) + }; + let (Some(pa), Some(pb)) = (along(&sa), along(&sb)) else { return false }; + pa.iter().all(|p| near(*p, &sb)) && pb.iter().all(|p| near(*p, &sa)) } /// `seg` as a line when it is one (a curve with its handles on its ends or on its line), else as it is. @@ -728,4 +752,21 @@ mod tests { assert!(!outlines_agree(&out, &inn, tol), "the whole outline does"); assert!(outlines_agree(&out, &out, tol)); } + + #[test] + fn the_same_corners_joined_another_way_are_another_outline() { + let poly = |pts: &[(f64, f64)]| { + let mut p = BezPath::new(); + p.move_to(pts[0]); + for q in &pts[1..] { + p.line_to(*q); + } + p.close_path(); + p + }; + let square = poly(&[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (0.0, 100.0)]); + let bow = poly(&[(0.0, 0.0), (100.0, 100.0), (100.0, 0.0), (0.0, 100.0)]); + assert!(!outlines_agree(&square, &bow, 1.0), "every corner lies on the other, the edges do not"); + assert!(outlines_agree(&square, &square, 1.0)); + } } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index dbb538c08d..b845378576 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -2861,7 +2861,7 @@ Check Spelling followed (2026-11-15): Edit › Spelling › Check Spelling… (` ## Retype, phase 1 (2026-11-18) -The public pages describe Retype finding the fonts that match selected outlined text (or text in an image), from the fonts on the device among others, and applying them to live text ([identify fonts](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/identify-fonts-using-retype.html), [apply to live text](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/apply-retype-suggested-fonts-to-live-text.html)). Phase 1 (#4934) is local and exact: Type › Retype (`type.retype`) compares each selected glyph shape with the glyphs of the loaded fonts, the document's fonts and any families named in `fonts`, the same up to uniform scale, rotation and translation, and sets the matched characters as point text in that font and size at the same baseline, one object per line, in one undo step. Shapes that match no font stay and are reported. Tested by round trips through Create Outlines (plain, bold and turned, serif, word spaces), a drawn shape and a mixed selection (`crates/engine/src/cmd/retype_tests.rs`). Near matches, the ranked font list, installed fonts not yet loaded and images remain (phase 2). +The public pages describe Retype finding the fonts that match selected outlined text (or text in an image), from the fonts on the device among others, and applying them to live text ([identify fonts](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/identify-fonts-using-retype.html), [apply to live text](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/apply-retype-suggested-fonts-to-live-text.html)). Phase 1 (#4934) is local and exact: Type › Retype (`type.retype`) compares each selected glyph shape with the glyphs of the loaded fonts, the document's fonts and any families named in `fonts`, the same up to uniform scale, rotation and translation, and sets the matched characters as point text in that font and size at the same baseline, one object per line, in one undo step. Shapes that match no font stay and are reported. The search is bounded, not exhaustive: at most 96 faces (named families first, then the document's fonts, then the other loaded faces), the first 65,536 encoded characters of each, and glyphs of plain-shape characters (box drawing, blocks, geometric shapes, private use) are left out; a glyph outside those limits is reported as matching no font. Exact matching also reads a curve an exporter split in two as a different shape (phase 2, with the other near matches). Tested by round trips through Create Outlines (plain, bold and turned, serif, word spaces), a drawn shape and a mixed selection (`crates/engine/src/cmd/retype_tests.rs`). Near matches, the ranked font list, installed fonts not yet loaded and images remain (phase 2). ## Control bar: Paragraph section while type is selected (2026-11-06) From fac3cb8013de2d5518e067ce23b78a01a8874600 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 02:00:11 -0800 Subject: [PATCH 138/158] Shapes: a batch step that switches tools keeps the batch's earlier steps A batch run during a widget drag settles the drag first. A tool or document switch inside the batch then ended the drag with a Cancel, which undid the batch's open interaction and its earlier steps in that document. Deactivating a tool in a batch now leaves the Cancel out, for the blend, corner, pie and side widgets alike. --- crates/engine/src/session/documents.rs | 3 +-- crates/engine/src/tooling.rs | 20 ++++++++++++---- crates/mcp/src/tests/shapewidgets.rs | 33 ++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/session/documents.rs b/crates/engine/src/session/documents.rs index 23dbe66e71..709be444b4 100644 --- a/crates/engine/src/session/documents.rs +++ b/crates/engine/src/session/documents.rs @@ -204,8 +204,7 @@ impl Session { let _ = self.finish_tool_edit_later(); // The switch goes on whatever the lent tool's last actions did, as for the deactivation. let _ = self.give_back_tool(view); - let acts = self.with_tool_cx(view, |t, cx| t.deactivate(cx)); - let _ = self.apply_actions(acts); + let _ = self.deactivate_tool(view); // A batch leaves its interaction open in the document it leaves, to keep or roll back with // the rest of the batch; anything else in progress (a drag) is cancelled. if self.batch_stash.is_none() { diff --git a/crates/engine/src/tooling.rs b/crates/engine/src/tooling.rs index 794cc7a2a3..65ea837527 100644 --- a/crates/engine/src/tooling.rs +++ b/crates/engine/src/tooling.rs @@ -188,8 +188,7 @@ impl Session { .then(|| self.tool.options().get("meshPoints").cloned()) .flatten() .filter(|v| v.as_array().is_some_and(|a| !a.is_empty())); - let acts = self.with_tool_cx(view, |t, cx| t.deactivate(cx)); - self.apply_actions(acts)?; + self.deactivate_tool(view)?; self.keep_tool_settings(); self.tool = self.make_tool(id); if let Some(selection) = text_selection { @@ -205,6 +204,18 @@ impl Session { Ok(()) } + /// Deactivate the tool and apply the actions it returns. In a batch, a Cancel is left out: the + /// batch settled the tool's drag when it began, and the open interaction holds the batch's + /// steps, which the batch keeps or rolls back as a whole. + pub(crate) fn deactivate_tool(&mut self, view: ViewInfo) -> Result<()> { + let mut acts = self.with_tool_cx(view, |t, cx| t.deactivate(cx)); + if self.batch_stash.is_some() { + acts.retain(|a| !matches!(a, Action::Cancel)); + } + self.apply_actions(acts)?; + Ok(()) + } + /// The selection tools other than Direct Selection pick whole objects: with one of them chosen, /// an object selected in a symbol instance's art gives way to the instance. The revision /// changes with it, so panels that cache by revision show the instance. @@ -297,8 +308,7 @@ impl Session { // them all (#8090). Group Selection picks no mesh points, so the Eyedropper keeps its own. let mesh_points = (lender.id() == "eyedropper" && self.tool.id() != "groupSelection").then(|| self.tool.options().get("meshPoints").cloned()).flatten(); - let acts = self.with_tool_cx(view, |t, cx| t.deactivate(cx)); - let r = self.apply_actions(acts); + let r = self.deactivate_tool(view); self.keep_tool_settings(); self.tool = lender; if let Some(points) = mesh_points { @@ -311,7 +321,7 @@ impl Session { self.lent_selection = left; } self.after_command(None); - r.map(drop) + r } /// A fresh `id` tool with the options it keeps ([`settings`]): its last values, from this diff --git a/crates/mcp/src/tests/shapewidgets.rs b/crates/mcp/src/tests/shapewidgets.rs index ce8eaea001..bce666d484 100644 --- a/crates/mcp/src/tests/shapewidgets.rs +++ b/crates/mcp/src/tests/shapewidgets.rs @@ -67,3 +67,36 @@ fn a_side_widget_drag_changes_a_polygons_sides_in_one_undo_step() { assert_eq!(polygon(&mut h), before); assert_eq!(h.session.doc().unwrap().history.undo.len(), steps); } + +/// A batch run during a side widget drag settles the drag first. A batch step that switches +/// documents then ends the drag without undoing the batch's own steps in the document it leaves. +#[test] +fn a_batch_that_switches_documents_during_a_side_widget_drag_keeps_its_steps() { + let mut h = Headless::new(); + for _ in 0..2 { + h.call("engine.execute", json!({"command": "file.new", "params": {"width": 300, "height": 300}})).unwrap(); + } + h.call("engine.execute", json!({"command": "shape.polygon", "params": {"cx": 150, "cy": 150, "radius": 60, "sides": 5}})).unwrap(); + let st = h.session.doc().unwrap(); + let (uid, id) = (st.uid, st.selection.objects[0]); + let b = st.doc.node(id).unwrap().geometric_bounds_with(&st.doc.symbol_boxes()).expect("bounds"); + let bx = vectorcraft_doc::OrientedBox::aligned(b); + let w = vectorcraft_tools::sidewidget::SideWidget::of(&st.doc, &st.selection, &bx, h.view.zoom).expect("a side widget"); + let steps = st.history.undo.len(); + let zoom = h.view.zoom; + let ev = |kind: &str, dy: f64| json!({"kind": kind, "x": w.at.x, "y": w.at.y + dy / zoom}); + // The drag stays held: no `up`. + ok(&mut h, "pointer_gesture", json!({"tool": "selection", "events": [ev("down", 0.0), ev("drag", 13.0), ev("drag", 25.0)]})); + let batch = json!({"commands": [ + {"command": "shape.rectangle", "params": {"x": 10, "y": 10, "width": 20, "height": 20}}, + {"command": "document.activate", "params": {"index": 0}} + ]}); + h.call("engine.execute", json!({"command": "command.batch", "params": batch})).unwrap(); + let st = h.session.documents().iter().find(|d| d.uid == uid).expect("the polygon's document"); + let vectorcraft_doc::NodeKind::Path { live, .. } = &st.doc.node(id).unwrap().kind else { panic!("not a path") }; + assert!(matches!(live.as_deref(), Some(vectorcraft_doc::LiveShape::Polygon { sides: 7, .. })), "the settled drag: {live:?}"); + assert_eq!(st.history.undo.len(), steps + 2, "the drag and the batch, each one undo step"); + let rect = st.selection.objects[0]; + assert_ne!(rect, id, "the batch's rectangle is selected"); + assert!(st.doc.node(rect).is_some(), "the batch's rectangle stays"); +} From f1189ca4e2f8f163223d5ff1b7407f52a0a60c22 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 02:03:18 -0800 Subject: [PATCH 139/158] Brushes: check both pressure samples and count eleven brush libraries The Pressure Sensitive test now requires finite anchors and a positive, finite width at both light and heavy pressure before it compares them. The current brush-library inventories in docs/target-app-parity.md, docs/gaps.md, docs/roadmap.md and docs/ui-parity.md list Pressure Sensitive and count eleven built-in libraries. --- crates/engine/src/tests/brushlib.rs | 6 +++++- docs/gaps.md | 2 +- docs/roadmap.md | 2 +- docs/target-app-parity.md | 6 +++--- docs/ui-parity.md | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/tests/brushlib.rs b/crates/engine/src/tests/brushlib.rs index e5f90d4538..f960ca91d3 100644 --- a/crates/engine/src/tests/brushlib.rs +++ b/crates/engine/src/tests/brushlib.rs @@ -318,13 +318,17 @@ fn pressure_sensitive_brushes_widen_with_pen_pressure_and_survive_a_saved_librar }; let pieces = vectorcraft_brush::stroke_pieces(&lib.doc, b, &line_to(180.0), &stroke); let points = anchors(&pieces.iter().collect::>()); + assert!(!points.is_empty() && points.iter().all(|p| p.x.is_finite() && p.y.is_finite()), "{} at pressure {pressure}", b.name); let min = points.iter().map(|p| p.y).fold(f64::INFINITY, f64::min); let max = points.iter().map(|p| p.y).fold(f64::NEG_INFINITY, f64::max); max - min }; let light = width_at(0.0); let heavy = width_at(1.0); - assert!(light.is_finite() && heavy > light * 1.3, "{}: light={light}, heavy={heavy}", b.name); + for width in [light, heavy] { + assert!(width.is_finite() && width > 0.0, "{}: light={light}, heavy={heavy}", b.name); + } + assert!(heavy > light * 1.3, "{}: light={light}, heavy={heavy}", b.name); for line in [line_to(2.0), curve.clone()] { let pieces = vectorcraft_brush::stroke_pieces(&lib.doc, b, &line, &black_stroke()); let points = anchors(&pieces.iter().collect::>()); diff --git a/docs/gaps.md b/docs/gaps.md index 304535dacb..b2f9ed4723 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -676,7 +676,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi libraries ([public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html), [import](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html)): Window › Brush Libraries and the Brushes panel's Brush Libraries Menu open each library in a library panel of - its own (ten original libraries generated in code: Art Ribbons, Ink and Wash, Calligraphic Nibs, Bristle Brushes (one + its own (eleven original libraries generated in code: Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive, Bristle Brushes (one bristle brush for each tip shape), Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media (grainy chalk, pencil, crayon and charcoal art brushes) and Tech Circuit (Circuit Trace, Bus Lines and Terminal Nodes); User Defined; Other Library… reads the brushes of any document VectorCraft opens); a click adds a brush to the document's Brushes with the patterns, symbols and other resources its art uses, as one undo diff --git a/docs/roadmap.md b/docs/roadmap.md index 2e9fe39fe9..280330e6dd 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -170,7 +170,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule | M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, the custom dictionary and Ignore All commands, Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, Spelling › Auto Spell Check in the context menu of type, the Edit Custom Dictionary dialog, and the modal Check Spelling dialog (Edit › Spelling › Check Spelling…, `Cmd+I`, `ui.checkSpelling`, #4936); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs (feature-valued alternates and unencoded glyphs applied in one Undo step while keeping Arabic joining, #5514), OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, vertical type pending | 45–60 | | M8 | Transform & distort (Puppet Warp, Liquify tools, Envelopes, Blends, Perspective Grid) | ✅ done (M8.1–M8.20 on 2026-10-06, fidelity pass): Liquify Tool Options with one shared brush, pen pressure, hold-to-apply, a safe scope and incremental strokes; tool options that last; Puppet Warp rotation, multi-select, Control bar and a rest-shape session that follows Undo; Width tool on compound paths; Envelope dialogs with preview, Reset with Warp/Mesh, full Envelope Options, type/images/symbols/appearance/gradients/patterns distorted on canvas and in every export, warps that keep their frame, Edit Contents, mesh handles and Control bar; Blend Options, anchor-targeted Blend tool, editable spine, keys picked on the canvas, faithful interpolation and knockout; Anchor Point spine conversion/handle editing and selection priority (#2544), with #2425 Shift reshape preserved; Perspective Grid with Define Grid, presets, lock/snap/rulers, widgets, the 1–4 plane switch, movable planes, Perspective Selection scale/copy/perpendicular/Transform Again, and type and symbols truly projected with Edit Text. Left: Anti-Alias and Preserve Shape output, warp-envelope point editing, brush interpolation in blends, Free Transform/Scale/Reflect along a rotated box | 2–4 | | M9 | Live effects (+ 3D & Materials) | 🟡 2D effects done incl. Effect → Pathfinder, Color Adjustments and Document Raster Effects Settings; PDF export warns when the pixel cap lowers raster-effect resolution; Artistic › Colored Pencil, Cutout, Dry Brush, Film Grain, Fresco, Neon Glow, Paint Daubs, Palette Knife, Poster Edges, Rough Pastels, Smudge Stick, Sponge, Underpainting and Watercolor and Sketch › Halftone Pattern, Bas Relief, Charcoal, Conté Crayon, Photocopy, Stamp, Torn Edges and Water Paper done (57/57 Photoshop filters); Revolve with automatic smooth vector shading, default-on circular caps and continuous rims, Extrude & Bevel, Inflate and Rotate with one to ten colored directional lights and four original lighting presets; SVG Filters, remaining raster effects and 3D materials and shadows pending | 81–130 | -| M10 | Brushes, symbols, patterns, Repeat | 🟡 pattern swatches (5 tile types, Pattern Options, editing mode, SVG ``/PDF export) and live Repeat (radial/grid/mirror) done; interactive selected mirror axis implemented (focused and native checks passed; full CI blocked by an unrelated text test); symbol libraries done (Window › Symbol Libraries, six generated libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons, Weather Icons), User Defined, Other Library…, Save Symbols); brush libraries done (Window › Brush Libraries, ten generated libraries including Tech Circuit, Ink and Wash, Bristle Brushes and Dry Media, User Defined, Other Library…, Save Brushes); symbol editing shows draggable 9-slice guides (#5280), with guides outside the artwork still unsupported; brushes/symbols in progress | 23–37 | +| M10 | Brushes, symbols, patterns, Repeat | 🟡 pattern swatches (5 tile types, Pattern Options, editing mode, SVG ``/PDF export) and live Repeat (radial/grid/mirror) done; interactive selected mirror axis implemented (focused and native checks passed; full CI blocked by an unrelated text test); symbol libraries done (Window › Symbol Libraries, six generated libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons, Weather Icons), User Defined, Other Library…, Save Symbols); brush libraries done (Window › Brush Libraries, eleven generated libraries including Tech Circuit, Pressure Sensitive, Ink and Wash, Bristle Brushes and Dry Media, User Defined, Other Library…, Save Brushes); symbol editing shows draggable 9-slice guides (#5280), with guides outside the artwork still unsupported; brushes/symbols in progress | 23–37 | | M11 | Artboards & views (selected-set deletion shared by Artboards menu, trash and Properties, retaining artboard 1 when all are selected; Artboard deletion keys keep the first of an all-selected set and protect artwork; history prunes invalid indices while preserving valid multiselection (history tests and full workspace CI pass); click-to-fit objects with the Artboard tool (#1227), artboard escape routing and document setup modal handoff done; artboard panel/tool with Move Artwork for X/Y fields and Artboard Options, Trim View, middle-button pan, print tiling and the status bar's artboard navigator with synchronized Artboard tool selection done; Window › Arrange › Tile and Consolidate All Windows done; multiple windows, presentation polish) (cached canvas reprojection preserves scale during resize, rotation and DPI changes; regression-tested and contributor-confirmed 2026-10-19; estimates unchanged) (cached canvas dimensions match the renderer limit before cache-key creation, view construction and worker submission; regression-tested; estimates unchanged); status-bar pointer coordinates follow the active ruler origin and General units | 🟡; Artboard Options shares existing presets and orientation controls and can fit artwork without moving it; artwork fitting includes all drawn document art across artboards and off-board; artwork bounds are cached by active document and revision, and selection uses the shared bounds cache across artboards | 15–25 | | M12 | Advanced color & art (CMYK/ICC, separations, Gradient Mesh, Live Paint, Image Trace, Graphs) | 🟡 Gradient Mesh, Live Paint, Image Trace (junction-returning pieces retain their positioned boundaries; a simpler contour walk with identical output; an edge's sub-pixel shift is the same from either side; notches read only their own piece; collapsed loops keep few segments; large images trace with a warning; Auto Color keeps rare distinct colours; quick presets trace at once and the Image Trace button opens the adjustment controls; Properties reopens them; tiny fitted contours retain islands and holes; Create Strokes: exact crop EDT, Guo–Hall thinning and maximal-disc graph simplification; 15 presets, the 14 documented ones each with an enhanced version; Ignore Color, Shapes, Auto Grouping and Gradients options; measured in `image-trace-quality.md`; closed outlines retain their interior after straightening; the Flat Logo mode places edges to a fraction of a pixel, restores sharp corners, snaps lines and circles, and refuses gradients; live trace result bounds and selection highlights exclude the retained bitmap except in source-image views), Recolor Artwork, colour management (ICC, soft proofing, separations preview), Graphs (all 9 tools, Graph Data/Type, group-selected series colours persist through regenerate/save/open) done; Graph Design and Marker designs, Transpose and Switch x/y, `\|` label line breaks, the pie options, drop shadows, the legend across the top, overlapping widths, First Row/Column in Front, filled lines, kept label formatting and the Graph Data worksheet done; graph Column designs pending; Vector Halftone Preview keeps the selection box without drawing dot selection marks (#6369); Live Paint Bucket fills faces crossed in one drag (#6373) | 6–10 | | M13 | Automation (Actions ✅ record/playback, persisted; variables, scripting, batch) | 🟡 MCP `add_text` exposes existing vertical point, area and path type; `script.run` and File › Scripts › Other Script… run JavaScript files, and Window › Script Console shows their output; the script document model and batch work remain | 18–27 | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 1b00b39ab2..5ac0285f13 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -258,7 +258,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; the Pen, Smart Pen and Curvature tool show the measurement readout with the rubber band off (#7043), score, gaps and hours unchanged | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522); Live Paint Bucket face drags, including narrow faces and one Undo, regression-tested (#6373) | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | Picker Lab entry, picker libraries and Assign-row menus complete the deferred #4028 UI paths (#8031); scores and estimates unchanged; Eyedropper copies effective character dimensions across text transforms (#6404); 30.0's gradient additions are done (dither, perceptual blending, presets); freeform gradients in SVG/PDF, mixed spot/process gradients in SVG, PDF gradients mixing a spot color with RGB or Lab stops, and dithered spot gradient fills and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, which PDF export writes as images in process colors| 4–7 | estimated; Recolor model selection is available through the engine and MCP (#2520), and the dialog's color sliders (HSB, RGB, CMYK, Lab, Tint for a spot color) edit the selected row's new color in its mode, and the Edit tab's Global Adjust sliders (Saturation, Brightness, Temperature, Luminosity, -100% to 100%) change every recolored color at once (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged; a point on a gradient mesh's outline locates on its edge on every side (#7006: `mesh_locate_takes_a_point_on_any_side_of_the_outline`, `mesh_add_line_exactly_on_the_edge_needs_no_tolerance`), score and hours unchanged; Color panel spectrum grows with the resized panel (#8005) | -| Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (ten generated libraries including Tech Circuit, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | +| Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (eleven generated libraries including Tech Circuit, Pressure Sensitive, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, Stylus Wheel, more built-in brush libraries, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | | Appearance, transparency, graphic styles, masks | 5 | 97% | raster effect reach in preview bounds | 1–2 | estimated; Transform typing, sliders, preview, and undo are covered in `crates/ui-egui/src/panels/tests_appearance.rs` | | 3D and Materials (and Turntable) | 4 | ~25% | live Revolve with automatic smooth vector shading and default-on continuous circular caps, Extrude & Bevel (twist, taper, caps, five bevel shapes), Inflate and Rotate with Position presets (colored Inflate uses smooth membrane lighting; white-light Inflate retains its existing shading; Extrude & Bevel and Rotate retain planar shading; one to ten colored lights, shared neutral ambient, painter visibility); materials, light presets, shadows, ray tracing, the rest of 3D Classic (Map Art), Turntable views, textures, map art and shading in 3D export | 30–55 | estimated (Extrude & Bevel, Inflate and Rotate added 2026-10-12); every 3D seam has round joins (2026-11-12, [three-d.md](three-d.md#seams)), score, gaps and hours unchanged | | Type core | 9 | 80% | Auto-leading style resets are implemented; Hyphenation… and Justification… options are done (#2310, #2755), and a paragraph's Auto Leading also sets the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; remaining: Optical Margin Alignment, Middle Eastern features beyond bidi layout (the Middle Eastern & South Asian and Standard composers are done per paragraph, #4935; `.ai`/EPS/PDF files carry no composer), optional group font-size preservation; transformed character controls fixed (#1034), see [type-parity.md](type-parity.md) | 14–19 | estimated; eleven-language pattern hyphenation in both composers, with grapheme and shaping-cluster protection (#4947, `hyphen::tests` and `layout::wrapping_tests`); Sanskrit patterns pending an allowlisted source; recent-font groups in font pickers (#3515); full-name font matches regression-tested (#1258); mixed paragraph alignment indication implemented; headless regressions, full integration CI and visual review pass; localized legacy family-name fallback with loaded/catalog regressions (#2208); Fractional Widths per type object regression-tested; color emoji fonts with bitmap glyphs (`sbix`, `CBDT`) draw and export; threading ports: every selected area type and type on a path shows its in and out ports (empty, arrow, red "+"), and the Selection tool threads from either, the in port into a frame before it, and a double-click on a threaded port breaks the thread there (`threads::tests::break_splits_the_thread_and_the_story_flows_into_the_first_part`, `select::tests::a_double_click_on_a_threaded_port_breaks_the_thread`, `canvas::tests::a_double_click_on_a_threaded_out_port_breaks_the_thread`) (#2572; `select::tests::a_click_on_the_in_port_threads_into_a_frame_before_it`, `text::tests::selected_type_shows_its_ports_in_each_state`, `threads::tests::add_before_threads_the_story_from_the_new_frame_into_the_clicked_one`, live screenshot); the Glyphs panel highlights and scrolls to the character selected with the Type tool (#4908, `panels::glyphs` tests); the OpenType panel lists only `ss01`–`ss20` sets present in the selected font and uses its custom names when supplied; Type-range desktop Copy publishes styled art and keeps font family, size and color on canvas Paste after editing (#5636); paint-only Arabic harakat keep joining with conditional GDEF-mark ownership and Insert Kashidas base-letter paint (`tests::harakat`) | @@ -527,7 +527,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Drawing tools | 7 | 86% | rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 86% | Live Paint gap options, Shape Builder gap detection, options (Tool Options dialog, clicking a stroke in merge mode) and Shift-drag marquee | 3–6 | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 96% | Picker Lab entry, picker libraries and Assign-row menus complete the deferred #4028 UI paths (#8031); scores and estimates unchanged; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); freeform gradients in SVG/PDF and mixed spot/process gradients in SVG (exported as stops; PDF export keeps the spot inks in a DeviceN shading, except next to RGB or Lab stops; dithered fills and Perceptual gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve are written as images in process colors), pattern fills in Expand | 2–4; Eyedropper source reads regression-tested (#1251) | -| Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (ten generated in code including Tech Circuit, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | +| Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (eleven generated in code including Tech Circuit, Pressure Sensitive, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation for Art, Pattern and Bristle brushes and on native Wayland and the web | 8–15 | | Appearance, transparency, graphic styles, masks | 5 | 98% | Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); raster effect reach in preview bounds (flattener presets apply in PDF, EPS and print) | 1–2 | | Live vector effects | 5 | 85% | Outline Object, Pathfinder Hard/Soft Mix and Trap (since done: #3061, #3063, #3785), SVG Filters, Transform Patterns and Scale Strokes & Effects on a fill's or stroke's own Transform effect | 6–10 | | 3D and Materials | 4 | ~25% | Initial Revolve, Extrude & Bevel, Inflate and Rotate, with simple lighting; materials, light presets, shadows, ray tracing, Rotate (Classic), Map Art and more complete visibility remain | 25–45 | @@ -579,7 +579,7 @@ since 2026-10-01. | **Interaction fidelity:** modifiers, cursors, small behaviours | ~30–40% | The dedicated pass hasn't started, and there has been no side-by-side session with Illustrator yet. A power user notices this first | | **Look & feel** | ~75–80% | Measured against Illustrator 2026 screenshots (2026-10-02); the panels added since haven't been re-measured | | **File interop** | ~85% | SVG/SVGZ, PDF and PDF-compatible `.ai` (and legacy version 7 `.ai` out, keeping layers, groups and type as text), EPS, DXF, EMF/WMF, raster formats, PSD export and PSD/PSB placement (merged image), Place and Links, Package, Print, clipboard flavours. Affinity documents (Affinity 1–3) open natively as editable art, checked against 51 pinned public files (33 current `.af`), with selected saved-thumbnail comparisons and every-board native/SVG/PDF/PSD checks for current files; Affinity export is missing and effects, adjustments and brushes don't import. Affinity isn't an Illustrator feature, so this doesn't raise the parity score. The editing copy inside an Illustrator EPS or `.ai` is read for its structure: layers, groups, names, hidden objects and type, colours, gradients, transparency, images and every artboard (see Out of scope for what it doesn't read yet); DWG has no open spec | -| **Bundled content:** brush, symbol, style and swatch libraries | ~46% | Ours are original and generated in code, and far fewer than Illustrator ships; symbol libraries have six (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons, Weather Icons), graphic style libraries eleven (including Game HUD, Status Effects and Neon & Glow) and brush libraries ten (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive, Bristle Brushes, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media, Tech Circuit) beside User Defined and Other Library… | +| **Bundled content:** brush, symbol, style and swatch libraries | ~46% | Ours are original and generated in code, and far fewer than Illustrator ships; symbol libraries have six (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons, Weather Icons), graphic style libraries eleven (including Game HUD, Status Effects and Neon & Glow) and brush libraries eleven (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive, Bristle Brushes, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media, Tech Circuit) beside User Defined and Other Library… | | **Performance** | unverified | Multithreaded, off-thread rendering and caches are in place. The last budget run (2026-10-01, loaded machine) measured 290 ms for a 50k-path fit against a 16 ms budget. Re-run `vectorcraft-cli perf` on an idle machine | | **Robustness** | good, new | ~2,840 tests, property tests, no panics in shipped code (lints, the `guard` safety net, import fuzzing), Data Recovery. Missing: a corpus of real-world files, Windows/Linux/browser QA | | **Platforms and 1.0 polish** | ~60% | The macOS app and the web build work, and Finder opens every readable format with the macOS app (#295, #354); on macOS the menus are in the system menu bar, laid out as a Mac app's, with the in-window menus as a fallback (`--in-window-menus`; verified on Windows and by cross-compilation, not yet by hand on a Mac); hybrid-graphics laptops render on the power-saving GPU by default on Windows and macOS (#306), and Windows starts on Direct3D 12, falling back to OpenGL, and loads no Vulkan driver unless `WGPU_BACKEND` asks for it (#545: Vulkan flickered black on an Intel GPU, DX12 and OpenGL didn't; #806: a faulty Vulkan driver crashed the app before its window appeared; verified by unit tests and the reporter's runs with `WGPU_BACKEND`), and Linux on the GPU the desktop runs on, since a Wayland compositor may refuse frames from the other one; a window that fails on its GPU while starting up starts again on the next one instead of crashing (#502; the dual-GPU Wayland case is verified by unit tests and cross-compilation, not on such hardware); web drops land in the document they were dropped on (#359); desktop drops carry no pointer position (winit 0.30), so a dropped document opens as a tab of its own and a picture or text is placed in the middle of the view, while the web places anything dropped on the canvas and opens what is dropped off it, as Illustrator does (#472); a web page that loses its WebGPU device or WebGL context restarts its graphics with the same documents (#369); on Linux/Wayland the clipboard reads the compositor's own (data-control) and copied image files paste, but files can't be dropped on the window under native Wayland until eframe moves to winit 0.31 (#398; the Wayland side is verified by compilation only), so Preferences › Performance › Linux Display Server › X11 (XWayland) opens the window through XWayland, where drops work (#1151; verified by unit tests and cross-compilation, not on a Wayland desktop); on Linux the Paste menu checks the system clipboard on a background thread, so a clipboard owner that never answers no longer freezes the window, while Windows and macOS keep their quick in-line check (#510; the X11 hang verified by the contributor, here by headless tests); on KDE Plasma 6.3+ under Wayland, pens and pen displays reach the app only under XWayland (`WAYLAND_DISPLAY=`) or with KWin's `KWIN_WAYLAND_EMULATE_TABLET=1`, since winit 0.30 has no Wayland tablet input (#491, not verified on hardware); Windows/Linux packaging and accessibility are pending | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e44a28165c..7a7eb50821 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -457,7 +457,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Info panel follows the tool in use: W and H show the change in x and y, with the distance and the angle, while the selection moves, the Gradient tool draws a vector or a Pen drag pulls out an anchor's handle; the Scale tool's percentages; the center and angles of a Rotate, Reflect or Shear tool drag; the Zoom tool's magnification; the Paintbrush's brush. W and H follow Use Preview Bounds, several selected objects show only the paint and type they share, and Show Options names a tint or a gradient swatch | done | `info.readout`; `Tool::readout`; behavior from the Info panel overview in the [archived user guide](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=76); number formats, the rows shown between drags and the Direct Selection and Group Selection readouts are VectorCraft's own | | Make Compound Path on a group (such as outlined type) keeps its backmost path's paint; compound paths joined into one keep their holes | done | #1537 | | Symbol libraries: Window › Symbol Libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons, User Defined, Other Library…, Save Symbols…) and the Symbols panel's Symbol Libraries Menu button and its menu's Open Symbol Library / Save Symbol Library…; a click on a library symbol adds it to the document's Symbols (one undo step, it becomes the current symbol), Shift/Cmd-clicks select for Add to Symbols, and a symbol dragged onto the canvas is added and placed where it is dropped | done | [public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-or-import-symbol-libraries.html), [Symbols panel options](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/symbols-panel-options.html), [placing from a library](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-and-place-symbols.html); `window.symbolLibrary`, `window.symbolLibrary.other`, `ui.saveSymbolLibrary` (dialog `saveSymbolLibrary`), `window.userSymbolLibrary1`…`10`; `panels::tests_symbol_libraries`; five built-in libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons; original, generated in code) | -| Brush libraries: Window › Brush Libraries (Art Ribbons, Ink and Wash, Calligraphic Nibs, Bristle Brushes, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media, Tech Circuit, User Defined, Other Library…, Save Brushes…) and the Brushes panel's Brush Libraries Menu button and its menu's Open Brush Library / Save Brush Library…; a click on a library brush adds it to the document's Brushes (one undo step, it becomes the current brush, and selected paths take it in the same step), Shift/Cmd-clicks select for Add to Brushes, a brush dragged onto a path is added and applied to it and one dragged onto the Brushes panel is added; thumbnails render with the library's patterns and symbols | done | [public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html), [import brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html), [Brushes panel overview](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html); `window.brushLibrary`, `window.brushLibrary.other`, `ui.saveBrushLibrary` (dialog `saveBrushLibrary`), `window.userBrushLibrary1`…`10`; `panels::tests_brush_libraries`; ten built-in libraries (original, generated in code) | +| Brush libraries: Window › Brush Libraries (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive, Bristle Brushes, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media, Tech Circuit, User Defined, Other Library…, Save Brushes…) and the Brushes panel's Brush Libraries Menu button and its menu's Open Brush Library / Save Brush Library…; a click on a library brush adds it to the document's Brushes (one undo step, it becomes the current brush, and selected paths take it in the same step), Shift/Cmd-clicks select for Add to Brushes, a brush dragged onto a path is added and applied to it and one dragged onto the Brushes panel is added; thumbnails render with the library's patterns and symbols | done | [public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html), [import brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html), [Brushes panel overview](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html); `window.brushLibrary`, `window.brushLibrary.other`, `ui.saveBrushLibrary` (dialog `saveBrushLibrary`), `window.userBrushLibrary1`…`10`; `panels::tests_brush_libraries`; eleven built-in libraries (original, generated in code) | | Brushes panel menu › Options of Selected Object…: changes the selected brushed paths' brush settings on those paths only, leaving the brush and its other strokes as they are; the brush type's options dialog opens without the Name row (and without an art brush's scale and direction options or a pattern brush's tiles), and OK sends only the values changed in it | done | [Modify brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/modify-brushes.html), [Brushes panel overview](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html); `brush.objectOptions`, `ui.brushObjectOptions`; which fields a path can set is VectorCraft's own choice (calligraphic, scatter, art and pattern brushes; not bristle); `options_of_selected_object_*` tests in `crates/engine/src/tests/brushsym.rs` and `crates/ui-egui/src/dialogs/brush_options/tests.rs`, brush tests in `crates/brush/src/tests.rs` | | Symbols panel: New Symbol opens Symbol Options (Name) before making the symbol; Alt-click skips it | partial | #1560 (#1566); Registration 9-point grid in Symbol Options (`symbol.new` / `symbol.place`); Export Type (Graphic / Movie Clip) and Enable Guides for 9-Slice Scaling (scaled instances keep their corners; in symbol editing mode the guides are drawn over the art and the Selection tool drags them); Symbol Type (Dynamic Symbol / Static Symbol, new symbols dynamic; #4938); Align to Pixel Grid (`alignToPixelGrid` on `symbol.new` / `symbol.options`: the art snaps at the symbol's natural size and instances at that size stay on whole points; [Aligning symbols to pixel grid](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=28)) | | Dynamic symbols: an instance changes the fill, stroke, opacity and blend of objects in its symbol's art and stays linked; Reset in the Properties panel's Quick Actions and the Symbols panel menu (Reset Symbol Instance) | partial | #4938; `symbol.instance.setAppearance` (by child-index path) and `symbol.instance.reset`; redefining keeps the changes, Break Link bakes them; Direct Selection of a path, compound path or type object inside an instance, with the Fill/Stroke controls setting its solid fill or stroke, is on canvas; on-canvas editing beyond a solid fill and stroke, and `.ai` read and write, remain | From c6a419a097bb520f41a8ddaa728f753c2f070f5b Mon Sep 17 00:00:00 2001 From: HassanKhan Date: Wed, 18 Nov 2026 15:24:38 +0500 Subject: [PATCH 140/158] Lock Guides: a marquee skips guides in groups, a group's transform leaves them While guides were locked, a guide path inside a group was still touched by a selection marquee, so the marquee selected the group and moving the group moved the guide (#8538). Clicks already skip guides (#3074). - hit: marquee_in_view and enclosure_candidates take skip_guides; the Selection, Direct Selection, Group Selection and Enclosing Lasso tools pass !cx.guides, and the marquee then touches no guide path at any depth. - doc: Scaling::keep_guides leaves the guide paths among a group's, layer's or Intertwine group's children in place, as a ruler guide in a transformed layer already stays. - engine: transforms (apply_transform), Transform Each and Align and Distribute set it while Lock Guides is on; a copy takes a copy of the guide with the copied art and leaves the original. Fixes #8538 --- crates/doc/src/hit.rs | 57 +++++++++++++++++++--- crates/doc/src/hit/tests.rs | 49 +++++++++++++++++-- crates/doc/src/node/live_shape.rs | 4 ++ crates/doc/src/node/ops.rs | 11 +++-- crates/doc/src/node/tests.rs | 11 ++++- crates/engine/src/cmd/menucmds.rs | 1 + crates/engine/src/cmd/object.rs | 2 +- crates/engine/src/cmd/object/align.rs | 5 +- crates/engine/src/cmd/object/transform.rs | 8 +++ crates/engine/src/tests/expand.rs | 2 +- crates/engine/src/tests/menucmds.rs | 47 ++++++++++++++++++ crates/eps/src/import/native/build.rs | 11 ++++- crates/tools/src/addons/enclosing_lasso.rs | 2 +- crates/tools/src/direct.rs | 4 +- crates/tools/src/select.rs | 2 +- crates/tools/src/select/tests.rs | 41 +++++++++++++++- docs/roadmap.md | 3 +- docs/target-app-parity.md | 3 +- docs/ui-parity.md | 5 +- 19 files changed, 235 insertions(+), 33 deletions(-) diff --git a/crates/doc/src/hit.rs b/crates/doc/src/hit.rs index 93baa85ed8..aaee5a7b6c 100644 --- a/crates/doc/src/hit.rs +++ b/crates/doc/src/hit.rs @@ -2106,20 +2106,50 @@ pub fn compound_part_at(n: &Node, p: Point, tol: f64) -> Option { /// the members of a group or layer with geometry effects of its own, are touched where the art those /// effects draw lies ([`set_drawn_art`]), as clicks hit them. pub fn marquee(doc: &Document, r: Rect, scope: Option, leaves: bool) -> Vec { - marquee_with(doc, r, scope, leaves, false, false) + marquee_with(doc, r, scope, leaves, false, false, false) } /// [`marquee`] in the view the canvas shows: with `outline` (Outline view), and below a layer /// whose Preview is off, a clipping path counts by its plain shapes, without its live effects, as -/// the clicks of [`HitOptions::outline`] do. -pub fn marquee_in_view(doc: &Document, r: Rect, scope: Option, leaves: bool, outline: bool) -> Vec { - marquee_with(doc, r, scope, leaves, false, outline) +/// the clicks of [`HitOptions::outline`] do. With `skip_guides` (Lock Guides is on or the guides +/// are hidden, as [`HitOptions::skip_guides`]), the paths made into guides are not touched, at the +/// top or inside a group, so a group is not taken for a guide in it (#8538). +pub fn marquee_in_view(doc: &Document, r: Rect, scope: Option, leaves: bool, outline: bool, skip_guides: bool) -> Vec { + marquee_with(doc, r, scope, leaves, false, outline, skip_guides) } /// Candidates for whole-object enclosure by a loop bounded by `r`. Eligibility and group /// traversal follow [`marquee_in_view`]; compounds contribute the complete path they paint. -pub fn enclosure_candidates(doc: &Document, r: Rect, scope: Option, outline: bool) -> Vec { - marquee_with(doc, r, scope, true, true, outline) +pub fn enclosure_candidates(doc: &Document, r: Rect, scope: Option, outline: bool, skip_guides: bool) -> Vec { + marquee_with(doc, r, scope, true, true, outline, skip_guides) +} + +thread_local! { + /// Whether the marquee under way leaves out the paths made into guides ([`GuidesOff`]). + static GUIDES_OFF: std::cell::Cell = const { std::cell::Cell::new(false) }; +} + +/// While a guard lives, a marquee ([`marquee_with`]) touches no path made into a guide, at any +/// level: [`HitOptions::skip_guides`] for the marquee. +struct GuidesOff { + was: bool, +} + +impl GuidesOff { + fn set() -> Self { + Self { was: GUIDES_OFF.replace(true) } + } + + /// Is `n` a path made into a guide that the marquee under way leaves out? + fn skips(n: &Node) -> bool { + GUIDES_OFF.get() && matches!(n.kind, NodeKind::Path { guide: true, .. }) + } +} + +impl Drop for GuidesOff { + fn drop(&mut self) { + GUIDES_OFF.set(self.was); + } } /// Is `n` a layer whose Preview is off (its art is drawn and clicked in outline)? @@ -2127,8 +2157,17 @@ fn previews_off(n: &Node) -> bool { matches!(n.kind, NodeKind::Layer { preview: false, .. }) } -fn marquee_with(doc: &Document, r: Rect, scope: Option, leaves: bool, whole_compounds: bool, outline: bool) -> Vec { +fn marquee_with( + doc: &Document, + r: Rect, + scope: Option, + leaves: bool, + whole_compounds: bool, + outline: bool, + skip_guides: bool, +) -> Vec { let _walk = ArtWalk::open(); + let _guides = skip_guides.then(GuidesOff::set); let mut out = Vec::new(); // The locks first: they copy the kept art boxes that `symbols` takes, and `symbols` keeps theirs. let locks = doc.locked_artboards_kept(); @@ -2272,6 +2311,10 @@ fn marquee_with(doc: &Document, r: Rect, scope: Option, leaves: bool, wh /// path is touched by its own geometry ([`mask_marquee`]) and on the edge of its region /// ([`clip_edge_touches`]). fn touches(n: &Node, s: &SymbolBoxes, r: Rect, scope: Option, whole_compounds: bool, outline: bool) -> bool { + // Locked or hidden guides are not touched ([`GuidesOff`]). + if GuidesOff::skips(n) { + return false; + } // A path or compound path whose geometry effects reshape it, or a group or layer whose own // geometry effects reshape its members, is touched where that art is drawn ([`drawn_art`]). if let Some(art) = drawn_art(s, n, outline || previews_off(n)) { diff --git a/crates/doc/src/hit/tests.rs b/crates/doc/src/hit/tests.rs index 9d0133ec60..a5cbbebb79 100644 --- a/crates/doc/src/hit/tests.rs +++ b/crates/doc/src/hit/tests.rs @@ -164,8 +164,8 @@ fn clicks_in_a_clip_group_evaluate_its_clipping_paths_region_once_until_it_chang // So with a marquee across the art's left edge: in the view, only in Outline view. The // clipping path's own left edge lies there too, and counts in both. let edge = Rect::new(-5.0, 40.0, 5.0, 60.0); - assert_eq!(marquee_in_view(&d, edge, None, true, false), [mask_id]); - assert_eq!(marquee_in_view(&d, edge, None, true, true), [mask_id, art_id]); + assert_eq!(marquee_in_view(&d, edge, None, true, false, false), [mask_id]); + assert_eq!(marquee_in_view(&d, edge, None, true, true, false), [mask_id, art_id]); // `marquee_in` measures by the plain shapes, as its callers clip by them. assert!(marquee_in(d.node(g).unwrap(), edge).is_some()); // Hidden, the effect no longer moves the region. @@ -489,8 +489,8 @@ fn a_marquee_touches_a_paths_shifted_art_not_its_source() { for leaves in [false, true] { assert_eq!(marquee(&d, drawn, None, leaves), [a], "where it is drawn"); assert!(marquee(&d, own, None, leaves).is_empty(), "its own place"); - assert!(marquee_in_view(&d, drawn, None, leaves, true).is_empty(), "outline: no drawn art"); - assert_eq!(marquee_in_view(&d, own, None, leaves, true), [a], "outline: its own place"); + assert!(marquee_in_view(&d, drawn, None, leaves, true, false).is_empty(), "outline: no drawn art"); + assert_eq!(marquee_in_view(&d, own, None, leaves, true, false), [a], "outline: its own place"); } } @@ -870,6 +870,45 @@ fn a_selected_guide_hidden_by_a_mask_counts_only_while_guides_can_be_clicked() { assert_eq!(selected_hidden_at(&d, hidden, HitOptions { skip_guides: true, ..opt }, &[guide_id]), None); } +/// #8538: while guides are locked or hidden (`skip_guides`), a marquee touches no guide path, at +/// the top of a layer or in a group (the group is not taken for it), nor in a group in a group, +/// with leaves or without. The group's other members still take it, and with the guides unlocked +/// the guide does. +#[test] +fn a_marquee_skips_guide_paths_in_groups_while_guides_are_locked() { + let mut d = Document::new(300.0, 200.0); + let l = d.layers[0].id; + let guide = |d: &mut Document, r: Rect| { + let mut n = Node::path(d.alloc_id(), shapes::rectangle(r), Appearance::default_art()); + if let NodeKind::Path { guide, .. } = &mut n.kind { + *guide = true; + } + n + }; + let top = guide(&mut d, Rect::new(0.0, 0.0, 20.0, 20.0)); + let inner = guide(&mut d, Rect::new(100.0, 0.0, 120.0, 20.0)); + let art = Node::path(d.alloc_id(), shapes::rectangle(Rect::new(200.0, 0.0, 220.0, 20.0)), Appearance::default_art()); + let (top_id, inner_id, art_id) = (top.id, inner.id, art.id); + let (outer_id, nested_id) = (d.alloc_id(), d.alloc_id()); + let nested = Node::group(nested_id, vec![Arc::new(inner)]); + d.insert(Some(l), 0, top).unwrap(); + d.insert(Some(l), 1, Node::group(outer_id, vec![Arc::new(nested), Arc::new(art)])).unwrap(); + let (on_top, on_inner, on_art) = (Rect::new(-5.0, 5.0, 5.0, 10.0), Rect::new(95.0, 5.0, 105.0, 10.0), Rect::new(195.0, 5.0, 205.0, 10.0)); + for leaves in [false, true] { + let m = |r: Rect, skip: bool| marquee_in_view(&d, r, None, leaves, false, skip); + assert!(m(on_top, true).is_empty(), "a guide at the top, leaves {leaves}"); + assert!(m(on_inner, true).is_empty(), "a guide in a group in a group, leaves {leaves}"); + assert!(m(Rect::new(0.0, 0.0, 300.0, 200.0), true).iter().all(|id| ![top_id, inner_id].contains(id)), "all, leaves {leaves}"); + assert_eq!(m(on_art, true), [if leaves { art_id } else { outer_id }], "the group's art, leaves {leaves}"); + // Unlocked: the guides are touched. + assert_eq!(m(on_top, false), [top_id], "unlocked, leaves {leaves}"); + assert_eq!(m(on_inner, false), [if leaves { inner_id } else { outer_id }], "unlocked, leaves {leaves}"); + } + // An enclosing loop's candidates leave them out alike. + assert!(enclosure_candidates(&d, on_inner, None, false, true).is_empty()); + assert_eq!(enclosure_candidates(&d, on_inner, None, false, false), [inner_id]); +} + /// A selected path in a Shaper group's original shapes, where an outer mask hides it, counts only /// while those shapes can be clicked (Construction mode, with them isolated), however deep it /// lies in them. @@ -2674,7 +2713,7 @@ fn a_symbol_instance_is_hit_where_a_moved_clipping_path_in_its_art_shows_the_art assert_eq!(marquee(&d, edge, None, false), [g], "layer {layer}"); assert_eq!(marquee(&d, edge, None, true), [inst], "layer {layer}"); assert!(marquee(&d, past, None, false).is_empty()); - assert!(marquee_in_view(&d, edge, None, false, true).is_empty(), "Outline view"); + assert!(marquee_in_view(&d, edge, None, false, true, false).is_empty(), "Outline view"); } // Preview off for the layer the instance is on. let (mut d, _, _) = build("test.move", Affine::IDENTITY, false, true, false); diff --git a/crates/doc/src/node/live_shape.rs b/crates/doc/src/node/live_shape.rs index a384836442..bce20637a0 100644 --- a/crates/doc/src/node/live_shape.rs +++ b/crates/doc/src/node/live_shape.rs @@ -375,6 +375,10 @@ pub struct Scaling { /// a point (no area left), as a Transform effect leaves them, instead of being fixed to their /// fit and flattened to one color with the object. pub keep_fit_when_flat: bool, + /// The paths made into guides inside a transformed group, layer or Intertwine group stay + /// where they are, as a ruler guide in a transformed layer does: View › Guides › Lock Guides + /// is on (#8538). A guide transformed by itself still moves. + pub keep_guides: bool, } impl Scaling { diff --git a/crates/doc/src/node/ops.rs b/crates/doc/src/node/ops.rs index 42978c81b0..577bcde4cb 100644 --- a/crates/doc/src/node/ops.rs +++ b/crates/doc/src/node/ops.rs @@ -527,10 +527,13 @@ impl Node { } } } - NodeKind::Layer { children, .. } - | NodeKind::Group { children, .. } - | NodeKind::Compound { children, .. } - | NodeKind::Intertwine { children } => { + NodeKind::Layer { children, .. } | NodeKind::Group { children, .. } | NodeKind::Intertwine { children } => { + // Locked guides stay where they are ([`Scaling::keep_guides`]). + for c in children.iter_mut().filter(|c| !(sc.keep_guides && matches!(c.kind, NodeKind::Path { guide: true, .. }))) { + Arc::make_mut(c).transform_scaled(a, sc); + } + } + NodeKind::Compound { children, .. } => { for c in children.iter_mut() { Arc::make_mut(c).transform_scaled(a, sc); } diff --git a/crates/doc/src/node/tests.rs b/crates/doc/src/node/tests.rs index 789e0f66b2..c7137fb1a9 100644 --- a/crates/doc/src/node/tests.rs +++ b/crates/doc/src/node/tests.rs @@ -227,8 +227,15 @@ fn assert_round_corners(n: &Node, back: Affine, r: f64) { } } -const KEEP_CORNERS: Scaling = - Scaling { strokes: false, effects: None, keep_type_strokes: false, keep_corners: true, patterns: false, keep_fit_when_flat: false }; +const KEEP_CORNERS: Scaling = Scaling { + strokes: false, + effects: None, + keep_type_strokes: false, + keep_corners: true, + patterns: false, + keep_fit_when_flat: false, + keep_guides: false, +}; #[test] fn uneven_scales_keep_live_corners_circular() { diff --git a/crates/engine/src/cmd/menucmds.rs b/crates/engine/src/cmd/menucmds.rs index defc405514..90ae524da8 100644 --- a/crates/engine/src/cmd/menucmds.rs +++ b/crates/engine/src/cmd/menucmds.rs @@ -637,6 +637,7 @@ fn transform_each_as(s: &mut Session, p: &Value, label: &str) -> Result { let mut rng = Rng(whole_or(p, "seed", 0x9E37_79B9_7F4A_7C15, "object.transformEach")?.max(1)); let mut sc = if !relative || sh != Some(100.0) || sv != Some(100.0) { super::object::scaling(s, p) } else { Default::default() }; sc.patterns = super::object::transform_patterns(s, p, &roots)?; + sc.keep_guides = super::object::keeps_guides(s, copy); // With no object to transform, or without a copy when nothing would change (both scales 100% // or, with Absolute, the size each object already has, and no move, rotation or reflection, // with or without Random), the document and its undo history stay as they are. diff --git a/crates/engine/src/cmd/object.rs b/crates/engine/src/cmd/object.rs index fd0aece164..f52830995b 100644 --- a/crates/engine/src/cmd/object.rs +++ b/crates/engine/src/cmd/object.rs @@ -41,5 +41,5 @@ pub(crate) use pixelgrid::{ snap_if_aligned, snap_symbol_art, }; pub(super) use shape::recut; -pub(crate) use transform::{apply_transform, preview_copies, scaling, transform_node, transform_patterns, transforms_objects}; +pub(crate) use transform::{apply_transform, keeps_guides, preview_copies, scaling, transform_node, transform_patterns, transforms_objects}; pub use transform::{reflect_axis, scale_factors, shear_tangent}; diff --git a/crates/engine/src/cmd/object/align.rs b/crates/engine/src/cmd/object/align.rs index d55fdda7b2..7f7afcfb64 100644 --- a/crates/engine/src/cmd/object/align.rs +++ b/crates/engine/src/cmd/object/align.rs @@ -1,4 +1,4 @@ -use super::transform::transform_patterns; +use super::transform::{keeps_guides, transform_patterns}; use super::{ Affine, Document, EngineError, NodeId, OrientedBox, Point, Rect, Result, Scaling, Session, Value, Vec2, bad, check_numbers, check_switches, effects, has_multi, ok, selected_roots, str_param, @@ -107,7 +107,8 @@ fn items_bounds(d: &Document, ids: &[NodeId], m: Measure) -> Vec<(NodeId, Rect)> /// so for `ids`. When every move is a rounding error (1e-9 pt or less on both axes), the document /// and its undo history stay as they are. fn apply_moves(s: &mut Session, label: &str, p: &Value, ids: &[NodeId], moves: &[(NodeId, Vec2)], guides: &[(NodeId, f64)]) -> Result { - let sc = Scaling { patterns: transform_patterns(s, p, ids)?, ..Scaling::default() }; + // Locked guides inside the groups moved stay where they are, as a move leaves them (#8538). + let sc = Scaling { patterns: transform_patterns(s, p, ids)?, keep_guides: keeps_guides(s, false), ..Scaling::default() }; let guides: Vec<(NodeId, f64)> = { let d = &s.doc()?.doc; guides.iter().copied().filter(|&(i, pos)| d.ruler_guide(i).is_some_and(|g| (g.pos - pos).abs() > 1e-9)).collect() diff --git a/crates/engine/src/cmd/object/transform.rs b/crates/engine/src/cmd/object/transform.rs index 7b1a97b4b3..acd38f12b4 100644 --- a/crates/engine/src/cmd/object/transform.rs +++ b/crates/engine/src/cmd/object/transform.rs @@ -65,6 +65,13 @@ pub(crate) fn transforms_objects(p: &Value) -> bool { bool_or(p, "objects", true) } +/// Do the locked guides inside the groups a transform moves stay where they are +/// ([`Scaling::keep_guides`])? While View › Guides › Lock Guides is on, unless the transform makes +/// copies: the original guides stay then, and the copies go with the copied art (#8538). +pub(crate) fn keeps_guides(s: &Session, copy: bool) -> bool { + s.menu.guides_locked && !copy +} + /// The on/off params of the transform commands that [`apply_transform`], [`scaling`], /// [`transform_patterns`] and [`transforms_objects`] read. The transform commands in this file /// check them with [`check_switches`] before they change anything. @@ -111,6 +118,7 @@ fn apply_transform_moving_guides( let objects = transforms_objects(p); let mut sc = if Scaling::factor(xf).is_some() { scaling(s, p) } else { Scaling::default() }; sc.patterns = transform_patterns(s, p, &ids)?; + sc.keep_guides = keeps_guides(s, copy); let c = xf.as_coeffs(); let is_translation = (c[0] - 1.0).abs() < 1e-9 && c[1].abs() < 1e-9 && c[2].abs() < 1e-9 && (c[3] - 1.0).abs() < 1e-9; let delta = guides.unwrap_or(Vec2::new(c[4], c[5])); diff --git a/crates/engine/src/tests/expand.rs b/crates/engine/src/tests/expand.rs index e728754655..b9a90f55c7 100644 --- a/crates/engine/src/tests/expand.rs +++ b/crates/engine/src/tests/expand.rs @@ -407,7 +407,7 @@ fn image_with_shaped_fill(s: &mut Session) -> NodeId { /// outline with `outline`. fn marquee_at(s: &Session, x0: f64, x1: f64, outline: bool) -> Vec { let r = vectorcraft_geom::Rect::new(x0, 90.0, x1, 110.0); - vectorcraft_doc::hit::marquee_in_view(&s.doc().unwrap().doc, r, None, true, outline) + vectorcraft_doc::hit::marquee_in_view(&s.doc().unwrap().doc, r, None, true, outline, false) } /// A marquee touches a symbol instance where the geometry effects of its fill or stroke paint its diff --git a/crates/engine/src/tests/menucmds.rs b/crates/engine/src/tests/menucmds.rs index 2656d8c4f8..467502b353 100644 --- a/crates/engine/src/tests/menucmds.rs +++ b/crates/engine/src/tests/menucmds.rs @@ -4442,6 +4442,53 @@ fn locked_guides_lock_guide_paths() { assert_eq!(selected(&s), vec![b]); } +/// #8538: while guides are locked, a transform of a group leaves the guide paths in it where they +/// are and transforms its other members: a move, Transform Each and Align. A copy leaves the +/// original guide and takes a copy of it with the copied group. With guides unlocked, the guide +/// moves with its group. +#[test] +fn transforming_a_group_leaves_its_locked_guide_paths_in_place() { + let mut s = session(); + let (guide, x) = (rect(&mut s, 0.0, 0.0, 10.0, 10.0), rect(&mut s, 20.0, 0.0, 10.0, 10.0)); + sel(&mut s, &[guide, x]); + let g = id_of(&s.execute("object.group", &json!({})).unwrap()); + sel(&mut s, &[guide]); + s.execute("view.guides.make", &json!({})).unwrap(); + s.execute("view.guides.lock", &json!({"locked": true})).unwrap(); + sel(&mut s, &[g]); + assert_eq!(selected(&s), vec![g], "the group stays selected"); + let x0 = |s: &Session| (bounds(s, guide).x0, bounds(s, x).x0); + s.execute("object.move", &json!({"dx": 50, "dy": 0})).unwrap(); + assert_eq!(x0(&s), (0.0, 70.0), "a move"); + s.execute("object.transformEach", &json!({"moveH": 10})).unwrap(); + assert_eq!(x0(&s), (0.0, 80.0), "Transform Each"); + s.execute("object.align", &json!({"horizontal": "right", "to": "artboard"})).unwrap(); + assert_eq!(bounds(&s, guide).x0, 0.0, "Align"); + let after_align = bounds(&s, x).x0; + assert_ne!(after_align, 80.0, "Align moves the art"); + // A copy: the original guide stays, the copy's guide goes with the copied group. + let guides = |s: &Session| { + let mut out = vec![]; + for l in &s.doc().unwrap().doc.layers { + l.walk(&mut |n| { + if matches!(n.kind, NodeKind::Path { guide: true, .. }) { + out.push(n.id); + } + }); + } + out + }; + s.execute("object.move", &json!({"dx": 0, "dy": 50, "copy": true})).unwrap(); + let copied: Vec = guides(&s).into_iter().filter(|id| *id != guide).collect(); + assert_eq!(copied.len(), 1); + assert_eq!((bounds(&s, guide).y0, bounds(&s, copied[0]).y0), (0.0, 50.0), "a copy"); + // Unlocked, the guide moves with its group. + s.execute("view.guides.lock", &json!({"locked": false})).unwrap(); + sel(&mut s, &[g]); + s.execute("object.move", &json!({"dx": 5, "dy": 0})).unwrap(); + assert_eq!(x0(&s), (5.0, after_align + 5.0), "unlocked"); +} + /// A rectangle at (`x`, 0), 10 pt wide, made into a guide; nothing is selected after. fn guide_path(s: &mut Session, x: f64) -> NodeId { let g = rect(s, x, 0.0, 10.0, 10.0); diff --git a/crates/eps/src/import/native/build.rs b/crates/eps/src/import/native/build.rs index 86d6976d89..8b4a21778f 100644 --- a/crates/eps/src/import/native/build.rs +++ b/crates/eps/src/import/native/build.rs @@ -33,8 +33,15 @@ impl Page { /// How art moved from a page to its place in the layers' document transforms: its pattern tiles /// move with it. -pub(super) const PAGE_MOVE: Scaling = - Scaling { strokes: false, effects: None, keep_type_strokes: false, keep_corners: false, patterns: true, keep_fit_when_flat: false }; +pub(super) const PAGE_MOVE: Scaling = Scaling { + strokes: false, + effects: None, + keep_type_strokes: false, + keep_corners: false, + patterns: true, + keep_fit_when_flat: false, + keep_guides: false, +}; /// The page (`visible`, the file read as its page) and the place of its area in the layers' /// document. diff --git a/crates/tools/src/addons/enclosing_lasso.rs b/crates/tools/src/addons/enclosing_lasso.rs index 0f674aead9..e8b228f86f 100644 --- a/crates/tools/src/addons/enclosing_lasso.rs +++ b/crates/tools/src/addons/enclosing_lasso.rs @@ -134,7 +134,7 @@ impl Tool for EnclosingLassoTool { let symbols = cx.doc.symbol_boxes(); let region = (points.len() >= 3).then(|| Region::new(polygon(&points, true))).flatten(); let mut ids = if let Some(region) = region { - enclosure_candidates(cx.doc, region.path.bounding_box(), cx.isolation, cx.outline) + enclosure_candidates(cx.doc, region.path.bounding_box(), cx.isolation, cx.outline, !cx.guides) .into_iter() .filter(|id| cx.doc.node(*id).is_some_and(|n| node_inside(n, &symbols, ®ion))) .collect() diff --git a/crates/tools/src/direct.rs b/crates/tools/src/direct.rs index 66cc842a53..8240de21d9 100644 --- a/crates/tools/src/direct.rs +++ b/crates/tools/src/direct.rs @@ -1674,7 +1674,7 @@ impl DirectSelectionTool { // marquee or an Alt-marquee, every object it touches, each whole (#8047). if enclosed || whole || self.group { (self.spine, self.spine_more) = (None, vec![]); - let mut touched = vectorcraft_doc::hit::marquee_in_view(cx.doc, r, cx.isolation, true, cx.outline); + let mut touched = vectorcraft_doc::hit::marquee_in_view(cx.doc, r, cx.isolation, true, cx.outline, !cx.guides); let editable = cx.doc.editable(); touched.retain(|id| editable(*id)); let picked = if enclosed { crate::select::inside(cx, r, touched) } else { touched }; @@ -1773,7 +1773,7 @@ impl DirectSelectionTool { } // Objects without anchors to pick (type, images, symbols…) are selected whole when // the marquee touches them, as with the Selection tool (#927). - for id in vectorcraft_doc::hit::marquee_in_view(cx.doc, r, cx.isolation, true, cx.outline) { + for id in vectorcraft_doc::hit::marquee_in_view(cx.doc, r, cx.isolation, true, cx.outline, !cx.guides) { let whole = cx.doc.node(id).is_some_and(|n| !matches!(n.kind, NodeKind::Path { .. } | NodeKind::Compound { .. })); if whole && !sel.iter().any(|(s, _)| *s == id) && !framed.iter().any(|(f, _)| *f == id) && !meshed.contains(&id) && spined != Some(id) { sel.push((id, vec![])); diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs index 700c045d3f..931ef34822 100644 --- a/crates/tools/src/select.rs +++ b/crates/tools/src/select.rs @@ -1199,7 +1199,7 @@ impl Tool for SelectionTool { if r.width() < Self::drag_threshold(cx) && r.height() < Self::drag_threshold(cx) { return if toggle { vec![] } else { vec![Action::Exec("select.none".into(), json!({}))] }; } - let touched = marquee_in_view(cx.doc, r, cx.isolation, false, cx.outline); + let touched = marquee_in_view(cx.doc, r, cx.isolation, false, cx.outline, !cx.guides); let enclosed = marquee_enclosed(cx, enclosed, marquee_direction(cx, start, p, directional_inside)); let ids = if enclosed { inside(cx, r, touched) } else { touched }; let art = Action::Exec(if toggle { "select.toggle" } else { "select.set" }.into(), json!({ "ids": json_ids(&ids) })); diff --git a/crates/tools/src/select/tests.rs b/crates/tools/src/select/tests.rs index a8e1f8acee..3b55aa8de2 100644 --- a/crates/tools/src/select/tests.rs +++ b/crates/tools/src/select/tests.rs @@ -1,6 +1,6 @@ use super::*; use crate::testutil::*; -use vectorcraft_doc::Selection; +use vectorcraft_doc::{Document, NodeKind, Selection}; /// While an opacity mask is edited, a press on a selected Shaper original shape moves it, over the /// art the group shows and over a part of the shape the group does not show. A press on an original @@ -146,6 +146,45 @@ fn a_press_where_a_mask_hides_a_selected_object_drags_it() { assert!(a.iter().any(|a| matches!(a, Action::Exec(c, v) if c == "select.set" && v["ids"] == json!([front.0]))), "{a:?}"); } +/// #8538: while guides are locked or hidden (`guides` off), a Selection tool marquee that touches +/// only a guide path in a group selects nothing, so a drag can't move the guide; one that touches +/// the group's other member selects the group. With guides unlocked, the guide takes the group. +#[test] +fn a_marquee_over_a_locked_guide_in_a_group_selects_nothing() { + let mut d = Document::new(800.0, 600.0); + let l = d.layers[0].id; + let (gid, guide_id, art_id) = (d.alloc_id(), d.alloc_id(), d.alloc_id()); + let mut guide = vectorcraft_doc::Node::path( + guide_id, + vectorcraft_geom::shapes::rectangle(Rect::new(100.0, 100.0, 120.0, 120.0)), + vectorcraft_doc::Appearance::default_art(), + ); + if let NodeKind::Path { guide, .. } = &mut guide.kind { + *guide = true; + } + let art = vectorcraft_doc::Node::path( + art_id, + vectorcraft_geom::shapes::rectangle(Rect::new(300.0, 100.0, 320.0, 120.0)), + vectorcraft_doc::Appearance::default_art(), + ); + d.insert(Some(l), 0, vectorcraft_doc::Node::group(gid, vec![std::sync::Arc::new(guide), std::sync::Arc::new(art)])).unwrap(); + let (none, p) = (Selection::default(), paint()); + let marquee = |guides: bool, x0: f64, x1: f64| { + let c = ToolContext { guides, ..cx(&d, &none, &p) }; + let mut t = SelectionTool::default(); + t.pointer(&c, &ev(PointerKind::Down, x0, 50.0)); + t.pointer(&c, &ev(PointerKind::Drag, x1, 110.0)); + let up = t.pointer(&c, &ev(PointerKind::Up, x1, 110.0)); + up.iter().find_map(|a| match a { + Action::Exec(c, v) if c == "select.set" => Some(v["ids"].clone()), + _ => None, + }) + }; + assert_eq!(marquee(false, 90.0, 130.0), Some(json!([])), "locked: only the guide"); + assert_eq!(marquee(false, 290.0, 330.0), Some(json!([gid.0])), "locked: the group's art"); + assert_eq!(marquee(true, 90.0, 130.0), Some(json!([gid.0])), "unlocked: the guide"); +} + /// #955: grabbed by an anchor and dropped near another object's anchor, the anchor lands /// exactly on it with Smart Guides, even where lining the bounds up would leave it beside it. #[test] diff --git a/docs/roadmap.md b/docs/roadmap.md index 2e9fe39fe9..4616aade03 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; 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; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip 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: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#8538); PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; 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; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip 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: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > > Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865). > @@ -216,6 +216,7 @@ not take the artwork yet. Overflow-menu drag remains separate. Scores and hours | Date | Change | Summary | |---|---|---| +| 2026-11-18 | minor | M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#8538). Scores and estimates unchanged. | | 2026-11-17 | minor | PDF import (#8300): a glyph filled only (text rendering mode 0) right after one filled and stroked (mode 2) joined the stroked run and came in stroked too: `2 Tr (B) Tj 0 Tr (C) Tj` came in as `BC` stroked throughout. A glyph filled only now joins only a run drawn alike, so it starts a run of its own, filled only, in the same type object, and takes a stroke only when the file draws one over it (the #8015 matching); a word filled whole then stroked whole, and fill and stroke rendering glyph by glyph, still come in as one run filled and stroked. Tests: `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`, `glyphs_filled_and_stroked_one_by_one_stay_one_run`; scores and estimates unchanged. | | 2026-11-17 | minor | PDF import (#8015 follow-up): type filled and stroked at less than full opacity is no longer joined into one type object, since the file composites the fill and the stroke apiece, darker where they overlap, while one object's opacity applies to both together; it stays a filled object and a stroked one, as a fill and stroke at different opacities already did. An upright glyph (vertical type) filled and stroked is no longer kept as an outline for a line that comes in as its outlines, as glyphs filled only weren't, so such a line can't lose them. The #8015 entries now say what is left: translucent type filled and stroked, and a `TJ` whose kerning starts a new line part way through, still come in as two objects. Tests: `translucent_fill_and_stroke_text_stays_two_objects`, `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled`; scores and estimates unchanged. | | 2026-11-16 | minor | M1: an Alt-drag in the Layers panel copies a row above or below its own place (`layer.move` with `copy` and that row as the target), so the top layer dragged up, the bottom layer dragged down and a document's only layer are copied (#8237). Scores and estimates unchanged. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 749dce93d3..0e394b9382 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-18 · **Change:** minor (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: #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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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-18 · **Change:** minor (Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#8538); 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: #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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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). > @@ -2923,6 +2923,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | Date | Change | Summary | |---|---|---| +| 2026-11-18 | minor | Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#8538). Scores and estimates unchanged. | | 2026-11-16 | minor | Layers panel: an Alt-drag copies a row above or below its own place (`layer.move` with `copy` and that row as the target), so the top layer dragged up, the bottom layer dragged down and a document's only layer are copied (#8237). Scores and estimates unchanged. | | 2026-11-16 | minor | Layers panel: rows or the selected-art square dragged over the list show the copy cursor while Alt is held, as the drop then copies, and the grabbing hand otherwise (#8217). Scores and estimates unchanged. | | 2026-11-16 | minor | Gradient panel: the strip under the ramp, where a click adds a stop, shows the white arrow with a plus on Windows and X11, where the system copy cursor showed as the plain arrow (#8241). Scores and estimates unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e44a28165c..2300b9d0c7 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-16 · **Change:** minor (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: #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-18 · **Change:** minor (Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#8538); 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: #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). > @@ -273,7 +273,7 @@ tools, never checked side by side) isn't captured row by row. | Escape cancels an existing ruler-guide press, move or copy | done | Selection and Direct/Group Selection; app-input regressions cover preselected guides, document/interaction-start selection, Undo/Redo and saved state, later on-canvas motion/release and temporary borrowing from idle Pen. All eight checks and the Direct Selection Escape control passed in current full CI. [Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area) | | Ruler origin: corner drag with preview, snapped as a drawn point is (Smart Guides, Snap to Point and the ruler guides, pixels, the grid), double-click reset to the active artboard, relative X/Y fields, native save/reopen | done | #1212; `document.setRulerOrigin`, `document.resetRulerOrigin`; geometry and command coordinates stay absolute | | Ruler guides as Layers rows: shown, hidden, locked and deleted with their layer; rows dragged to another layer; each row's own eye and lock; a row dropped on the trash deletes its guide; a plain click on another row lets go of the guide | done | `guide.setLayer`; guides from older files go on a layer; `layer.setProps` on a guide's id hides or locks it alone; Object › Lock/Hide › Selection, Unlock All and Show All reach guides; `guide.remove {indexes}`; #7340 | -| Objects made into guides: drawn in the guide colour and style of Preferences; Lock Guides locks them too (no select, move or delete); a dragged selection snaps to ruler guides with Smart Guides on, by the nearest point of the path when pressed on its stroke or beside its edge, so the path lands exactly on the guide | done | #1534 (#1543, #1583); #3701 | +| Objects made into guides: drawn in the guide colour and style of Preferences; Lock Guides locks them too (no select, move or delete), in groups as well: a marquee skips them and a transform of their group leaves them in place; a dragged selection snaps to ruler guides with Smart Guides on, by the nearest point of the path when pressed on its stroke or beside its edge, so the path lands exactly on the guide | done | #1534 (#1543, #1583); #3701; #8538 | | A selected ruler guide's X or Y in the Transform panel; typing a value moves it | not scored | #1659 (part of #1597); several guides move together; not in Properties or the Control bar. Not established by the documentation we could find: the help pages on guides, rulers and the Transform, Control and Properties panels (read again on 2026-10-14) don't describe it, and the one public statement is a user's [community answer](https://community.adobe.com/questions-652/adding-a-new-custom-guide-785586), which is not documentation. Kept as a convenience pending the owner's decision; no parity claim | | Alt swaps a ruler guide's orientation while dragging | missing | Alt-drag copies the selected guides ([Use rulers](https://helpx.adobe.com/illustrator/desktop/measure-and-align/grids-and-guides/use-rulers.html)); `guide.move` `{copy: true}` | | Alt swaps a new ruler guide's orientation while dragging | done | Both rulers; preview, snapping and final placement follow the current modifier ([public shortcut reference](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)). | @@ -579,6 +579,7 @@ before release (#6373). [Paint faces and edges](https://helpx.adobe.com/illustra | Date | Change | Summary | |---|---|---| +| 2026-11-18 | minor | Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#8538). Scores and estimates unchanged. | | 2026-11-16 | minor | 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. | | 2026-11-16 | minor | Recolor Artwork › Assign: native Lab entry in the Color Picker, swatch libraries access in the picker, and row context menu options (Pick from Swatches, Limit to Library) (#4028). Scores and estimates unchanged. | | 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. | From 1c275797a717b160dc39a826c27e42085f1b700f Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 15:58:18 +0530 Subject: [PATCH 141/158] M7/G4: re-run CI after the runner shut down mid-build (#4934) From 41f7d4e06a2899403768d080482b4618527df911 Mon Sep 17 00:00:00 2001 From: HassanKhan Date: Wed, 18 Nov 2026 16:15:04 +0500 Subject: [PATCH 142/158] #8538 review: drop kept guides on transform, finish the marquee rule A transform no longer leaves locked guide paths in place: a guide in a group moves with its group again, as on main. Keeping them put made Align, Transform Each, the pixel-grid snap and Objects on Path measure or place art the transform did not move. Scaling::keep_guides and its engine wiring and test are removed. The marquee rule now covers the rest of the selection side, while guides are locked or hidden: - the guide rule goes down the walk as an explicit Rules value instead of a thread-local guard; - an Enclosing Lasso loop does not take a compound path for its guide contours; - an enclosing marquee measures a group without its guide paths (Node::without_guides); - Direct Selection's marquee takes no anchor or crossed segment of a guide path. Docs: the Guides area row, its evidence entry and the M1 row describe the marquee behaviour; status lines and revision rows say a guide in a group still moves with it. --- crates/doc/src/hit.rs | 101 +++++++++------------- crates/doc/src/hit/tests.rs | 23 +++++ crates/doc/src/node/live_shape.rs | 4 - crates/doc/src/node/ops.rs | 47 ++++++++-- crates/doc/src/node/tests.rs | 11 +-- crates/engine/src/cmd/menucmds.rs | 1 - crates/engine/src/cmd/object.rs | 2 +- crates/engine/src/cmd/object/align.rs | 5 +- crates/engine/src/cmd/object/transform.rs | 8 -- crates/engine/src/tests/menucmds.rs | 47 ---------- crates/eps/src/import/native/build.rs | 11 +-- crates/tools/src/direct.rs | 8 +- crates/tools/src/direct/tests.rs | 27 ++++++ crates/tools/src/select.rs | 7 +- crates/tools/src/select/tests.rs | 21 +++++ docs/roadmap.md | 6 +- docs/target-app-parity.md | 8 +- docs/ui-parity.md | 6 +- 18 files changed, 181 insertions(+), 162 deletions(-) diff --git a/crates/doc/src/hit.rs b/crates/doc/src/hit.rs index aaee5a7b6c..83b2a60446 100644 --- a/crates/doc/src/hit.rs +++ b/crates/doc/src/hit.rs @@ -2124,31 +2124,20 @@ pub fn enclosure_candidates(doc: &Document, r: Rect, scope: Option, outl marquee_with(doc, r, scope, true, true, outline, skip_guides) } -thread_local! { - /// Whether the marquee under way leaves out the paths made into guides ([`GuidesOff`]). - static GUIDES_OFF: std::cell::Cell = const { std::cell::Cell::new(false) }; +/// What a marquee ([`marquee_with`]) takes, besides where it is: whether a compound path is +/// touched by every path it paints (`whole_compounds`, for an enclosing loop's candidates), and +/// whether the paths made into guides are left out (`skip_guides`: Lock Guides is on or the +/// guides are hidden, [`HitOptions::skip_guides`] for the marquee). +#[derive(Clone, Copy)] +struct Rules { + whole_compounds: bool, + skip_guides: bool, } -/// While a guard lives, a marquee ([`marquee_with`]) touches no path made into a guide, at any -/// level: [`HitOptions::skip_guides`] for the marquee. -struct GuidesOff { - was: bool, -} - -impl GuidesOff { - fn set() -> Self { - Self { was: GUIDES_OFF.replace(true) } - } - - /// Is `n` a path made into a guide that the marquee under way leaves out? - fn skips(n: &Node) -> bool { - GUIDES_OFF.get() && matches!(n.kind, NodeKind::Path { guide: true, .. }) - } -} - -impl Drop for GuidesOff { - fn drop(&mut self) { - GUIDES_OFF.set(self.was); +impl Rules { + /// Is `n` a path made into a guide that the marquee leaves out? + fn skips(self, n: &Node) -> bool { + self.skip_guides && matches!(n.kind, NodeKind::Path { guide: true, .. }) } } @@ -2167,7 +2156,7 @@ fn marquee_with( skip_guides: bool, ) -> Vec { let _walk = ArtWalk::open(); - let _guides = skip_guides.then(GuidesOff::set); + let rules = Rules { whole_compounds, skip_guides }; let mut out = Vec::new(); // The locks first: they copy the kept art boxes that `symbols` takes, and `symbols` keeps theirs. let locks = doc.locked_artboards_kept(); @@ -2181,7 +2170,7 @@ fn marquee_with( Some(c) => { // In an isolated clip group, its members by their own geometry, as clicks take // them ([`edits_inside`]). - let drawn = if s.clips() { None } else { touched_in_art(s, &symbols, r, whole_compounds, outline || previews_off(s)) }; + let drawn = if s.clips() { None } else { touched_in_art(s, &symbols, r, rules, outline || previews_off(s)) }; c.iter() .enumerate() .filter(|(i, c)| !c.is_ruler_guide() && !shaper_hides(s, *i, scope)) @@ -2203,7 +2192,7 @@ fn marquee_with( .layers .iter() .filter(|l| l.visible && !l.locked && !l.is_template() && doc.pattern_edit.as_ref().is_none_or(|e| e.layer == l.id)) - .flat_map(|l| layer_objects(l, &symbols, r, outline, whole_compounds, None)) + .flat_map(|l| layer_objects(l, &symbols, r, outline, rules, None)) .collect(), }; /// The objects of layer `l`, each with the part of `r` that the clipping masks of `l` and of @@ -2212,17 +2201,10 @@ fn marquee_with( /// shapes ([`mask_marquee`]). In a layer whose own geometry effects reshape its art, each object /// comes with the objects that art touches ([`touched_in_art`]), `drawn` when a layer around /// `l` has such effects. - fn layer_objects<'a>( - l: &'a Node, - s: &SymbolBoxes, - r: Rect, - outline: bool, - whole_compounds: bool, - drawn: Option>>, - ) -> Vec> { + fn layer_objects<'a>(l: &'a Node, s: &SymbolBoxes, r: Rect, outline: bool, rules: Rules, drawn: Option>>) -> Vec> { let mut out = vec![]; let outline = outline || previews_off(l); - let drawn = drawn.or_else(|| touched_in_art(l, s, r, whole_compounds, outline)); + let drawn = drawn.or_else(|| touched_in_art(l, s, r, rules, outline)); let inner = marquee_in_parent(l, r, outline); for (i, c) in l.children().into_iter().flatten().enumerate() { if c.is_layer() { @@ -2231,7 +2213,7 @@ fn marquee_with( && !c.locked && !c.is_template() { - out.extend(layer_objects(c, s, inner, outline, whole_compounds, drawn.clone())); + out.extend(layer_objects(c, s, inner, outline, rules, drawn.clone())); } } else if !c.is_ruler_guide() { if drawn.is_some() { @@ -2248,12 +2230,12 @@ fn marquee_with( /// The ids of the objects of the art that group or layer `n` draws with its own geometry /// effects ([`drawn_art`]) that the marquee `r` touches, as [`collect_leaves`] collects them. /// `None` in outline and when it has no such effects. - fn touched_in_art(n: &Node, s: &SymbolBoxes, r: Rect, whole_compounds: bool, outline: bool) -> Option>> { + fn touched_in_art(n: &Node, s: &SymbolBoxes, r: Rect, rules: Rules, outline: bool) -> Option>> { let art = drawn_art(s, n, outline)?; let _off = DrawnOff::set(); let mut ids = vec![]; for a in art.iter().filter(|a| a.visible) { - collect_leaves(a, s, r, None, whole_compounds, false, &mut ids); + collect_leaves(a, s, r, None, rules, false, &mut ids); } Some(Rc::new(ids.into_iter().collect())) } @@ -2310,16 +2292,16 @@ fn marquee_with( /// instance also where its fills and strokes paint outside it ([`painted_touches`]). A clipping /// path is touched by its own geometry ([`mask_marquee`]) and on the edge of its region /// ([`clip_edge_touches`]). - fn touches(n: &Node, s: &SymbolBoxes, r: Rect, scope: Option, whole_compounds: bool, outline: bool) -> bool { - // Locked or hidden guides are not touched ([`GuidesOff`]). - if GuidesOff::skips(n) { + fn touches(n: &Node, s: &SymbolBoxes, r: Rect, scope: Option, rules: Rules, outline: bool) -> bool { + // Locked or hidden guides are not touched ([`Rules::skips`]). + if rules.skips(n) { return false; } // A path or compound path whose geometry effects reshape it, or a group or layer whose own // geometry effects reshape its members, is touched where that art is drawn ([`drawn_art`]). if let Some(art) = drawn_art(s, n, outline || previews_off(n)) { let _off = DrawnOff::set(); - return art.iter().any(|a| a.visible && touches(a, s, r, None, whole_compounds, false)); + return art.iter().any(|a| a.visible && touches(a, s, r, None, rules, false)); } match &n.kind { NodeKind::Path { path, .. } => vectorcraft_geom::hit::intersects_rect(path, r), @@ -2330,25 +2312,26 @@ fn marquee_with( c.visible && !shaper_hides(n, i, scope) && if i == 0 && n.clips() { - plain(true, || mask_marquee(n, r).is_some_and(|r| touches(c, s, r, scope, whole_compounds, outline))) + plain(true, || mask_marquee(n, r).is_some_and(|r| touches(c, s, r, scope, rules, outline))) || clip_edge_touches(c, r, outline) } else { - inner.is_some_and(|r| touches(c, s, r, scope, whole_compounds, outline)) + inner.is_some_and(|r| touches(c, s, r, scope, rules, outline)) } }) } - NodeKind::Compound { children, .. } if whole_compounds => { - children.iter().filter_map(|c| c.path_data()).any(|path| vectorcraft_geom::hit::intersects_rect(path, r)) + NodeKind::Compound { children, .. } if rules.whole_compounds => { + // Guide contours left out ([`Rules::skips`]) don't make the compound a candidate. + children.iter().filter(|c| !rules.skips(c)).filter_map(|c| c.path_data()).any(|path| vectorcraft_geom::hit::intersects_rect(path, r)) } - NodeKind::Compound { children, .. } => children.iter().any(|c| c.visible && touches(c, s, r, scope, whole_compounds, outline)), - NodeKind::Repeat(spec) => spec.expand(Some(s.document())).iter().any(|copy| touches(copy, s, r, scope, whole_compounds, outline)), + NodeKind::Compound { children, .. } => children.iter().any(|c| c.visible && touches(c, s, r, scope, rules, outline)), + NodeKind::Repeat(spec) => spec.expand(Some(s.document())).iter().any(|copy| touches(copy, s, r, scope, rules, outline)), // A symbol instance is touched by its box, and outside it where the live geometry // effects of a clipping path in its art show the art, or where the geometry effects of // its active fill or stroke reshape the art ([`painted_touches`]). In the art of another // instance walked outside that instance's box, it is touched only by its own art // ([`ArtOnly`]) and those shapes. NodeKind::SymbolInstance { .. } => { - !ArtOnly::on() && box_touches(n, s, r) || !outline && (instance_art_touches(n, s, r, whole_compounds) || painted_touches(n, s, r)) + !ArtOnly::on() && box_touches(n, s, r) || !outline && (instance_art_touches(n, s, r, rules) || painted_touches(n, s, r)) } // An image is touched by its box, and outside it where its own fills and strokes paint. NodeKind::Image(_) => box_touches(n, s, r) || !outline && painted_touches(n, s, r), @@ -2377,7 +2360,7 @@ fn marquee_with( /// ([`SymbolBoxes::art`]), or for any art while [`ArtOnly`] is on, and only when `r` meets the /// instance's reach ([`Node::reach_bounds_with`]): elsewhere the art lies within the instance's /// box. Not once the marquee has placed as many objects of symbol art as [`ArtWalk`] allows. - fn instance_art_touches(n: &Node, s: &SymbolBoxes, r: Rect, whole_compounds: bool) -> bool { + fn instance_art_touches(n: &Node, s: &SymbolBoxes, r: Rect, rules: Rules) -> bool { let NodeKind::SymbolInstance { symbol, .. } = &n.kind else { return false }; let meets = |b: Rect| b.x0 <= r.x1 && r.x0 <= b.x1 && b.y0 <= r.y1 && r.y0 <= b.y1; if s.art(symbol).is_none_or(|a| a.reshaped.is_none() && !ArtOnly::on()) || !n.reach_bounds_with(s).is_some_and(meets) { @@ -2394,15 +2377,15 @@ fn marquee_with( #[cfg(test)] ARTS_WALKED.with(|c| c.set(c.get() + 1)); let _art_only = ArtOnly::set(); - art.place(&art.art, None).is_some_and(|placed| placed.visible && touches(&placed, s, r, None, whole_compounds, false)) + art.place(&art.art, None).is_some_and(|placed| placed.visible && touches(&placed, s, r, None, rules, false)) } - fn collect_leaves(n: &Node, s: &SymbolBoxes, r: Rect, scope: Option, whole_compounds: bool, outline: bool, out: &mut Vec) { + fn collect_leaves(n: &Node, s: &SymbolBoxes, r: Rect, scope: Option, rules: Rules, outline: bool, out: &mut Vec) { match &n.kind { NodeKind::Layer { children, .. } | NodeKind::Group { children, .. } | NodeKind::Intertwine { children } => { let outline = outline || previews_off(n); // The members that the art its own geometry effects draw touches, and a group whose // own fills and strokes that art paints, as clicks hit it ([`member_chain`]). - if let Some(drawn) = touched_in_art(n, s, r, whole_compounds, outline) { + if let Some(drawn) = touched_in_art(n, s, r, rules, outline) { if drawn.contains(&n.id) && !n.is_layer() { out.push(n.id); } @@ -2417,18 +2400,18 @@ fn marquee_with( if i == 0 && n.clips() { let before = out.len(); if let Some(r) = mask_marquee(n, r) { - plain(true, || collect_leaves(c, s, r, scope, whole_compounds, outline, out)); + plain(true, || collect_leaves(c, s, r, scope, rules, outline, out)); } if out.len() == before && is_leaf(c) && clip_edge_touches(c, r, outline) { out.push(c.id); } } else if let Some(r) = inner { - collect_leaves(c, s, r, scope, whole_compounds, outline, out); + collect_leaves(c, s, r, scope, rules, outline, out); } } } _ => { - if touches(n, s, r, scope, whole_compounds, outline) { + if touches(n, s, r, scope, rules, outline) { out.push(n.id); } } @@ -2463,14 +2446,12 @@ fn marquee_with( if leaves { let before = out.len(); if let Some(r) = r { - collect_leaves(t, &symbols, r, scope, whole_compounds, outline, &mut out); + collect_leaves(t, &symbols, r, scope, rules, outline, &mut out); } if edge.is_some_and(|e| out.len() == before && is_leaf(t) && clip_edge_touches(t, e, outline)) { out.push(t.id); } - } else if r.is_some_and(|r| touches(t, &symbols, r, scope, whole_compounds, outline)) - || edge.is_some_and(|e| clip_edge_touches(t, e, outline)) - { + } else if r.is_some_and(|r| touches(t, &symbols, r, scope, rules, outline)) || edge.is_some_and(|e| clip_edge_touches(t, e, outline)) { out.push(t.id); } } diff --git a/crates/doc/src/hit/tests.rs b/crates/doc/src/hit/tests.rs index a5cbbebb79..a38f36f166 100644 --- a/crates/doc/src/hit/tests.rs +++ b/crates/doc/src/hit/tests.rs @@ -909,6 +909,29 @@ fn a_marquee_skips_guide_paths_in_groups_while_guides_are_locked() { assert_eq!(enclosure_candidates(&d, on_inner, None, false, false), [inner_id]); } +/// #8538: an enclosing loop's candidates leave out a compound path whose touched contours are all +/// locked or hidden guides, as the marquee does. +#[test] +fn guide_contours_do_not_make_a_compound_an_enclosure_candidate() { + let mut d = Document::new(300.0, 200.0); + let l = d.layers[0].id; + let part = |d: &mut Document, r: Rect| { + let mut n = Node::path(d.alloc_id(), shapes::rectangle(r), Appearance::default_art()); + if let NodeKind::Path { guide, .. } = &mut n.kind { + *guide = true; + } + Arc::new(n) + }; + let (a, b) = (part(&mut d, Rect::new(10.0, 10.0, 50.0, 50.0)), part(&mut d, Rect::new(20.0, 20.0, 40.0, 40.0))); + let id = d.alloc_id(); + let mut compound = Node::group(id, vec![]); + compound.kind = NodeKind::Compound { children: vec![a, b], rule: Default::default() }; + d.insert(Some(l), 0, compound).unwrap(); + let r = Rect::new(0.0, 0.0, 60.0, 60.0); + assert!(enclosure_candidates(&d, r, None, false, true).is_empty(), "locked or hidden"); + assert_eq!(enclosure_candidates(&d, r, None, false, false), [id], "shown and unlocked"); +} + /// A selected path in a Shaper group's original shapes, where an outer mask hides it, counts only /// while those shapes can be clicked (Construction mode, with them isolated), however deep it /// lies in them. diff --git a/crates/doc/src/node/live_shape.rs b/crates/doc/src/node/live_shape.rs index bce20637a0..a384836442 100644 --- a/crates/doc/src/node/live_shape.rs +++ b/crates/doc/src/node/live_shape.rs @@ -375,10 +375,6 @@ pub struct Scaling { /// a point (no area left), as a Transform effect leaves them, instead of being fixed to their /// fit and flattened to one color with the object. pub keep_fit_when_flat: bool, - /// The paths made into guides inside a transformed group, layer or Intertwine group stay - /// where they are, as a ruler guide in a transformed layer does: View › Guides › Lock Guides - /// is on (#8538). A guide transformed by itself still moves. - pub keep_guides: bool, } impl Scaling { diff --git a/crates/doc/src/node/ops.rs b/crates/doc/src/node/ops.rs index 577bcde4cb..6f72655c1d 100644 --- a/crates/doc/src/node/ops.rs +++ b/crates/doc/src/node/ops.rs @@ -90,6 +90,42 @@ impl Node { matches!(self.kind, NodeKind::RulerGuide { .. } | NodeKind::Path { guide: true, .. }) } + /// This object without the paths made into guides among the members of its groups, layers, + /// Intertwine groups and compound paths, at any depth, for measuring the art around them while + /// Lock Guides or Hide Guides leaves them out (#8538). The clipping path of a clip group or + /// layer and the original shapes of a Shaper group stay, guides or not, so the object keeps + /// its structure. `None` when it holds no such guide. + pub fn without_guides(&self) -> Option { + let (NodeKind::Layer { children, .. } + | NodeKind::Group { children, .. } + | NodeKind::Intertwine { children } + | NodeKind::Compound { children, .. }) = &self.kind + else { + return None; + }; + let keep = usize::from(self.clips() || self.extras().shaper.is_some()); + let mut changed = false; + let mut out = Vec::with_capacity(children.len()); + for (i, c) in children.iter().enumerate() { + if i >= keep && matches!(c.kind, NodeKind::Path { guide: true, .. }) { + changed = true; + } else if let Some(stripped) = c.without_guides() { + changed = true; + out.push(Arc::new(stripped)); + } else { + out.push(c.clone()); + } + } + if !changed { + return None; + } + let mut n = self.clone(); + if let Some(c) = n.children_mut() { + *c = out; + } + Some(n) + } + /// A template layer (Layer Options → Template). pub fn is_template(&self) -> bool { matches!(self.kind, NodeKind::Layer { template: true, .. }) @@ -527,13 +563,10 @@ impl Node { } } } - NodeKind::Layer { children, .. } | NodeKind::Group { children, .. } | NodeKind::Intertwine { children } => { - // Locked guides stay where they are ([`Scaling::keep_guides`]). - for c in children.iter_mut().filter(|c| !(sc.keep_guides && matches!(c.kind, NodeKind::Path { guide: true, .. }))) { - Arc::make_mut(c).transform_scaled(a, sc); - } - } - NodeKind::Compound { children, .. } => { + NodeKind::Layer { children, .. } + | NodeKind::Group { children, .. } + | NodeKind::Compound { children, .. } + | NodeKind::Intertwine { children } => { for c in children.iter_mut() { Arc::make_mut(c).transform_scaled(a, sc); } diff --git a/crates/doc/src/node/tests.rs b/crates/doc/src/node/tests.rs index c7137fb1a9..789e0f66b2 100644 --- a/crates/doc/src/node/tests.rs +++ b/crates/doc/src/node/tests.rs @@ -227,15 +227,8 @@ fn assert_round_corners(n: &Node, back: Affine, r: f64) { } } -const KEEP_CORNERS: Scaling = Scaling { - strokes: false, - effects: None, - keep_type_strokes: false, - keep_corners: true, - patterns: false, - keep_fit_when_flat: false, - keep_guides: false, -}; +const KEEP_CORNERS: Scaling = + Scaling { strokes: false, effects: None, keep_type_strokes: false, keep_corners: true, patterns: false, keep_fit_when_flat: false }; #[test] fn uneven_scales_keep_live_corners_circular() { diff --git a/crates/engine/src/cmd/menucmds.rs b/crates/engine/src/cmd/menucmds.rs index 90ae524da8..defc405514 100644 --- a/crates/engine/src/cmd/menucmds.rs +++ b/crates/engine/src/cmd/menucmds.rs @@ -637,7 +637,6 @@ fn transform_each_as(s: &mut Session, p: &Value, label: &str) -> Result { let mut rng = Rng(whole_or(p, "seed", 0x9E37_79B9_7F4A_7C15, "object.transformEach")?.max(1)); let mut sc = if !relative || sh != Some(100.0) || sv != Some(100.0) { super::object::scaling(s, p) } else { Default::default() }; sc.patterns = super::object::transform_patterns(s, p, &roots)?; - sc.keep_guides = super::object::keeps_guides(s, copy); // With no object to transform, or without a copy when nothing would change (both scales 100% // or, with Absolute, the size each object already has, and no move, rotation or reflection, // with or without Random), the document and its undo history stay as they are. diff --git a/crates/engine/src/cmd/object.rs b/crates/engine/src/cmd/object.rs index f52830995b..fd0aece164 100644 --- a/crates/engine/src/cmd/object.rs +++ b/crates/engine/src/cmd/object.rs @@ -41,5 +41,5 @@ pub(crate) use pixelgrid::{ snap_if_aligned, snap_symbol_art, }; pub(super) use shape::recut; -pub(crate) use transform::{apply_transform, keeps_guides, preview_copies, scaling, transform_node, transform_patterns, transforms_objects}; +pub(crate) use transform::{apply_transform, preview_copies, scaling, transform_node, transform_patterns, transforms_objects}; pub use transform::{reflect_axis, scale_factors, shear_tangent}; diff --git a/crates/engine/src/cmd/object/align.rs b/crates/engine/src/cmd/object/align.rs index 7f7afcfb64..d55fdda7b2 100644 --- a/crates/engine/src/cmd/object/align.rs +++ b/crates/engine/src/cmd/object/align.rs @@ -1,4 +1,4 @@ -use super::transform::{keeps_guides, transform_patterns}; +use super::transform::transform_patterns; use super::{ Affine, Document, EngineError, NodeId, OrientedBox, Point, Rect, Result, Scaling, Session, Value, Vec2, bad, check_numbers, check_switches, effects, has_multi, ok, selected_roots, str_param, @@ -107,8 +107,7 @@ fn items_bounds(d: &Document, ids: &[NodeId], m: Measure) -> Vec<(NodeId, Rect)> /// so for `ids`. When every move is a rounding error (1e-9 pt or less on both axes), the document /// and its undo history stay as they are. fn apply_moves(s: &mut Session, label: &str, p: &Value, ids: &[NodeId], moves: &[(NodeId, Vec2)], guides: &[(NodeId, f64)]) -> Result { - // Locked guides inside the groups moved stay where they are, as a move leaves them (#8538). - let sc = Scaling { patterns: transform_patterns(s, p, ids)?, keep_guides: keeps_guides(s, false), ..Scaling::default() }; + let sc = Scaling { patterns: transform_patterns(s, p, ids)?, ..Scaling::default() }; let guides: Vec<(NodeId, f64)> = { let d = &s.doc()?.doc; guides.iter().copied().filter(|&(i, pos)| d.ruler_guide(i).is_some_and(|g| (g.pos - pos).abs() > 1e-9)).collect() diff --git a/crates/engine/src/cmd/object/transform.rs b/crates/engine/src/cmd/object/transform.rs index acd38f12b4..7b1a97b4b3 100644 --- a/crates/engine/src/cmd/object/transform.rs +++ b/crates/engine/src/cmd/object/transform.rs @@ -65,13 +65,6 @@ pub(crate) fn transforms_objects(p: &Value) -> bool { bool_or(p, "objects", true) } -/// Do the locked guides inside the groups a transform moves stay where they are -/// ([`Scaling::keep_guides`])? While View › Guides › Lock Guides is on, unless the transform makes -/// copies: the original guides stay then, and the copies go with the copied art (#8538). -pub(crate) fn keeps_guides(s: &Session, copy: bool) -> bool { - s.menu.guides_locked && !copy -} - /// The on/off params of the transform commands that [`apply_transform`], [`scaling`], /// [`transform_patterns`] and [`transforms_objects`] read. The transform commands in this file /// check them with [`check_switches`] before they change anything. @@ -118,7 +111,6 @@ fn apply_transform_moving_guides( let objects = transforms_objects(p); let mut sc = if Scaling::factor(xf).is_some() { scaling(s, p) } else { Scaling::default() }; sc.patterns = transform_patterns(s, p, &ids)?; - sc.keep_guides = keeps_guides(s, copy); let c = xf.as_coeffs(); let is_translation = (c[0] - 1.0).abs() < 1e-9 && c[1].abs() < 1e-9 && c[2].abs() < 1e-9 && (c[3] - 1.0).abs() < 1e-9; let delta = guides.unwrap_or(Vec2::new(c[4], c[5])); diff --git a/crates/engine/src/tests/menucmds.rs b/crates/engine/src/tests/menucmds.rs index 467502b353..2656d8c4f8 100644 --- a/crates/engine/src/tests/menucmds.rs +++ b/crates/engine/src/tests/menucmds.rs @@ -4442,53 +4442,6 @@ fn locked_guides_lock_guide_paths() { assert_eq!(selected(&s), vec![b]); } -/// #8538: while guides are locked, a transform of a group leaves the guide paths in it where they -/// are and transforms its other members: a move, Transform Each and Align. A copy leaves the -/// original guide and takes a copy of it with the copied group. With guides unlocked, the guide -/// moves with its group. -#[test] -fn transforming_a_group_leaves_its_locked_guide_paths_in_place() { - let mut s = session(); - let (guide, x) = (rect(&mut s, 0.0, 0.0, 10.0, 10.0), rect(&mut s, 20.0, 0.0, 10.0, 10.0)); - sel(&mut s, &[guide, x]); - let g = id_of(&s.execute("object.group", &json!({})).unwrap()); - sel(&mut s, &[guide]); - s.execute("view.guides.make", &json!({})).unwrap(); - s.execute("view.guides.lock", &json!({"locked": true})).unwrap(); - sel(&mut s, &[g]); - assert_eq!(selected(&s), vec![g], "the group stays selected"); - let x0 = |s: &Session| (bounds(s, guide).x0, bounds(s, x).x0); - s.execute("object.move", &json!({"dx": 50, "dy": 0})).unwrap(); - assert_eq!(x0(&s), (0.0, 70.0), "a move"); - s.execute("object.transformEach", &json!({"moveH": 10})).unwrap(); - assert_eq!(x0(&s), (0.0, 80.0), "Transform Each"); - s.execute("object.align", &json!({"horizontal": "right", "to": "artboard"})).unwrap(); - assert_eq!(bounds(&s, guide).x0, 0.0, "Align"); - let after_align = bounds(&s, x).x0; - assert_ne!(after_align, 80.0, "Align moves the art"); - // A copy: the original guide stays, the copy's guide goes with the copied group. - let guides = |s: &Session| { - let mut out = vec![]; - for l in &s.doc().unwrap().doc.layers { - l.walk(&mut |n| { - if matches!(n.kind, NodeKind::Path { guide: true, .. }) { - out.push(n.id); - } - }); - } - out - }; - s.execute("object.move", &json!({"dx": 0, "dy": 50, "copy": true})).unwrap(); - let copied: Vec = guides(&s).into_iter().filter(|id| *id != guide).collect(); - assert_eq!(copied.len(), 1); - assert_eq!((bounds(&s, guide).y0, bounds(&s, copied[0]).y0), (0.0, 50.0), "a copy"); - // Unlocked, the guide moves with its group. - s.execute("view.guides.lock", &json!({"locked": false})).unwrap(); - sel(&mut s, &[g]); - s.execute("object.move", &json!({"dx": 5, "dy": 0})).unwrap(); - assert_eq!(x0(&s), (5.0, after_align + 5.0), "unlocked"); -} - /// A rectangle at (`x`, 0), 10 pt wide, made into a guide; nothing is selected after. fn guide_path(s: &mut Session, x: f64) -> NodeId { let g = rect(s, x, 0.0, 10.0, 10.0); diff --git a/crates/eps/src/import/native/build.rs b/crates/eps/src/import/native/build.rs index 8b4a21778f..86d6976d89 100644 --- a/crates/eps/src/import/native/build.rs +++ b/crates/eps/src/import/native/build.rs @@ -33,15 +33,8 @@ impl Page { /// How art moved from a page to its place in the layers' document transforms: its pattern tiles /// move with it. -pub(super) const PAGE_MOVE: Scaling = Scaling { - strokes: false, - effects: None, - keep_type_strokes: false, - keep_corners: false, - patterns: true, - keep_fit_when_flat: false, - keep_guides: false, -}; +pub(super) const PAGE_MOVE: Scaling = + Scaling { strokes: false, effects: None, keep_type_strokes: false, keep_corners: false, patterns: true, keep_fit_when_flat: false }; /// The page (`visible`, the file read as its page) and the place of its area in the layers' /// document. diff --git a/crates/tools/src/direct.rs b/crates/tools/src/direct.rs index 8240de21d9..9323bfb20f 100644 --- a/crates/tools/src/direct.rs +++ b/crates/tools/src/direct.rs @@ -1684,8 +1684,11 @@ impl DirectSelectionTool { } // Anchors inside the rect, on editable paths inside isolation mode. let mut sel: Vec<(NodeId, Vec)> = vec![]; + // Guide paths only while guides can be picked: not while they are locked or hidden (#8538). walk_pickable(cx.doc, cx.isolation, |n| { - if let NodeKind::Path { path, .. } = &n.kind { + if let NodeKind::Path { path, guide, .. } = &n.kind + && (cx.guides || !*guide) + { let v: Vec = path.anchors().filter(|(_, _, a)| r.contains(a.p)).map(|(s, i, _)| (s, i)).collect(); if !v.is_empty() { sel.push((n.id, v)); @@ -1785,7 +1788,8 @@ impl DirectSelectionTool { let mut crossed: Vec<(NodeId, Vec)> = vec![]; if !self.group { walk_pickable(cx.doc, cx.isolation, |n| { - if let NodeKind::Path { path, .. } = &n.kind + if let NodeKind::Path { path, guide, .. } = &n.kind + && (cx.guides || !*guide) && editable(n.id) { let segs = crossed_segments(path, r); diff --git a/crates/tools/src/direct/tests.rs b/crates/tools/src/direct/tests.rs index 50244eb260..4f3b795921 100644 --- a/crates/tools/src/direct/tests.rs +++ b/crates/tools/src/direct/tests.rs @@ -2767,3 +2767,30 @@ fn outline_view_marquees_measure_clipped_art_by_the_plain_clipping_path() { let a = marquee(false); assert!(!selects(&a), "preview: {a:?}"); } + +/// #8538: while guides are locked or hidden (`guides` off), a Direct Selection marquee takes +/// neither the anchors nor the crossed segments of a guide path; while guides can be picked, it +/// takes them as on any path. +#[test] +fn a_marquee_skips_the_anchors_and_segments_of_guides_that_cannot_be_picked() { + let (mut d, id) = doc_with_rect(); + if let Some(NodeKind::Path { guide, .. }) = d.node_mut(id).map(|n| &mut n.kind) { + *guide = true; + } + let (s, p) = (Selection::default(), paint()); + let marquee = |guides: bool, from: (f64, f64), to: (f64, f64)| { + let cx = ToolContext { guides, ..cx(&d, &s, &p) }; + let mut t = DirectSelectionTool::new(false); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, from.0, from.1)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, to.0, to.1)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, to.0, to.1)) + }; + let anchors = |items: Value| vec![Action::Exec("select.anchorsMany".into(), json!({"items": items, "mode": "set"}))]; + // Over the corner at (200, 100). + assert_eq!(marquee(false, (150.0, 50.0), (250.0, 150.0)), anchors(json!([])), "locked or hidden: no anchor"); + assert_eq!(marquee(true, (150.0, 50.0), (250.0, 150.0)), anchors(json!([{"id": id.0, "anchors": [[0, 1]]}])), "shown and unlocked"); + // Across the middle of the top edge. + let crossed = |a: &[Action]| a.iter().any(|a| matches!(a, Action::Exec(c, _) if c == "select.segments")); + assert!(!crossed(&marquee(false, (140.0, 80.0), (160.0, 120.0))), "locked or hidden: no segment"); + assert!(crossed(&marquee(true, (140.0, 80.0), (160.0, 120.0))), "shown and unlocked"); +} diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs index 931ef34822..079de9ed06 100644 --- a/crates/tools/src/select.rs +++ b/crates/tools/src/select.rs @@ -596,7 +596,12 @@ fn with_object_bounds(cx: &ToolContext, walk: impl FnOnce(&mut dyn FnMut(Node pub(crate) fn inside(cx: &ToolContext, r: Rect, ids: Vec) -> Vec { let symbols = cx.doc.symbol_boxes(); let within = |b: Rect| r.min_x() <= b.min_x() && b.max_x() <= r.max_x() && r.min_y() <= b.min_y() && b.max_y() <= r.max_y(); - ids.into_iter().filter(|id| cx.doc.node(*id).and_then(|n| n.geometric_bounds_with(&symbols)).is_some_and(within)).collect() + // Locked or hidden guides, which the marquee leaves out, don't count toward a group's box (#8538). + let measure = |n: &vectorcraft_doc::Node| match n.without_guides().filter(|_| !cx.guides) { + Some(art) => art.geometric_bounds_with(&symbols), + None => n.geometric_bounds_with(&symbols), + }; + ids.into_iter().filter(|id| cx.doc.node(*id).and_then(measure).is_some_and(within)).collect() } /// What of the bounding box is under the pointer. diff --git a/crates/tools/src/select/tests.rs b/crates/tools/src/select/tests.rs index 3b55aa8de2..a39c528a1d 100644 --- a/crates/tools/src/select/tests.rs +++ b/crates/tools/src/select/tests.rs @@ -185,6 +185,27 @@ fn a_marquee_over_a_locked_guide_in_a_group_selects_nothing() { assert_eq!(marquee(true, 90.0, 130.0), Some(json!([gid.0])), "unlocked: the guide"); } +/// #8538: an enclosing marquee measures a group without the locked or hidden guides in it, as the +/// marquee leaves them out: a group whose art lies inside is taken though a guide in it reaches +/// past the marquee. While guides can be picked, the guide counts. +#[test] +fn an_enclosing_marquee_measures_a_group_without_its_locked_guides() { + let mut d = Document::new(800.0, 600.0); + let l = d.layers[0].id; + let (gid, guide_id, art_id) = (d.alloc_id(), d.alloc_id(), d.alloc_id()); + let square = |id, r| vectorcraft_doc::Node::path(id, vectorcraft_geom::shapes::rectangle(r), vectorcraft_doc::Appearance::default_art()); + let mut guide = square(guide_id, Rect::new(500.0, 100.0, 520.0, 120.0)); + if let NodeKind::Path { guide, .. } = &mut guide.kind { + *guide = true; + } + let art = square(art_id, Rect::new(100.0, 100.0, 120.0, 120.0)); + d.insert(Some(l), 0, vectorcraft_doc::Node::group(gid, vec![std::sync::Arc::new(guide), std::sync::Arc::new(art)])).unwrap(); + let (none, p) = (Selection::default(), paint()); + let r = Rect::new(50.0, 50.0, 200.0, 200.0); + assert_eq!(crate::select::inside(&ToolContext { guides: false, ..cx(&d, &none, &p) }, r, vec![gid]), [gid], "locked or hidden"); + assert!(crate::select::inside(&ToolContext { guides: true, ..cx(&d, &none, &p) }, r, vec![gid]).is_empty(), "shown and unlocked"); +} + /// #955: grabbed by an anchor and dropped near another object's anchor, the anchor lands /// exactly on it with Smart Guides, even where lining the bounds up would leave it beside it. #[test] diff --git a/docs/roadmap.md b/docs/roadmap.md index 80493e963d..1b0eba0986 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,6 +1,6 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#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; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; 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; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip 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: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (M1: 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; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; 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; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip 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: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: 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; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; 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: 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; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; 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: G2: Effect Gallery thumbnails and in-dialog preview are in; 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; 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; 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; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; 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; 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; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) > > Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865). > @@ -161,7 +161,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule | # | Milestone | Status | Est. remaining, one agent (h) | |---|---|---|---| | M0 | Skeleton + vertical slice | ✅ done | — | -| M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (path and compound-path interior selection follows enabled fill rows (#6625); hidden-fill and no-fill stroke cap/join CPU regressions passed; document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | +| M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (path and compound-path interior selection follows enabled fill rows (#6625); a marquee leaves locked or hidden guide paths out inside groups, as clicks do (#8538); hidden-fill and no-fill stroke cap/join CPU regressions passed; document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 | | M2 | Drawing tools + smart guides | ✅ mostly done (#3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 | | M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel (its spectrum grows with a resized panel, #8005), Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416; native Lab entry and swatch libraries in the picker, Assign-row menus, #8031/#4028); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); | 4–8 | | M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | Production Preflight checks fonts, overflow, links and image resolution with clickable findings and automatic rechecking (VectorCraft addition; estimates unchanged); PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300; estimates unchanged); PDF import: type filled and stroked by one text-showing operator comes in as one filled and stroked type object (#8015; not yet for type filled and stroked at less than full opacity, or a `TJ` whose kerning starts a new line part way through, which still come in as a filled object and a stroked one; estimates unchanged); PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) | @@ -216,7 +216,7 @@ not take the artwork yet. Overflow-menu drag remains separate. Scores and hours | Date | Change | Summary | |---|---|---| -| 2026-11-18 | minor | M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#8538). Scores and estimates unchanged. | +| 2026-11-18 | minor | M1: 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. | | 2026-11-18 | minor | Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged. See [production-preflight.md](production-preflight.md) for scope and limits. | | 2026-11-17 | minor | PDF import (#8300): a glyph filled only (text rendering mode 0) right after one filled and stroked (mode 2) joined the stroked run and came in stroked too: `2 Tr (B) Tj 0 Tr (C) Tj` came in as `BC` stroked throughout. A glyph filled only now joins only a run drawn alike, so it starts a run of its own, filled only, in the same type object, and takes a stroke only when the file draws one over it (the #8015 matching); a word filled whole then stroked whole, and fill and stroke rendering glyph by glyph, still come in as one run filled and stroked. Tests: `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`, `glyphs_filled_and_stroked_one_by_one_stay_one_run`; scores and estimates unchanged. | | 2026-11-17 | minor | PDF import (#8015 follow-up): type filled and stroked at less than full opacity is no longer joined into one type object, since the file composites the fill and the stroke apiece, darker where they overlap, while one object's opacity applies to both together; it stays a filled object and a stroked one, as a fill and stroke at different opacities already did. An upright glyph (vertical type) filled and stroked is no longer kept as an outline for a line that comes in as its outlines, as glyphs filled only weren't, so such a line can't lose them. The #8015 entries now say what is left: translucent type filled and stroked, and a `TJ` whose kerning starts a new line part way through, still come in as two objects. Tests: `translucent_fill_and_stroke_text_stays_two_objects`, `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled`; scores and estimates unchanged. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 5c6e2b57ff..9c49d1de4a 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-18 · **Change:** minor (Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#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: #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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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-18 · **Change:** 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); 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: #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 whose pieces are all one curve split at anchors follows that curve's parameter, so a top object saved with its sides' curves in pieces draws as its `.ai` drawn art, #7097; 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). > @@ -540,7 +540,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Image Trace, graphs, image tools | 3 | 72% | graph Column designs (Graph Design, Marker designs and series colours set with Group Selection are done), Create Object Mosaic, per-feature stroke/fill choice and varying widths in Image Trace's Create Strokes (Vector Halftone and the Image Trace View modes, Palette and Create Strokes are done) | 6–10 | | Layers, artboards, document setup | 5 | 82% | Layers panel: a confirmation before deleting layers that hold art, row menu commands beyond Collect for Export (now on every layer, sublayer, group and object row), menus on guide and blend spine rows, the Layer Options dialog for several rows with mixed values, Paste Remembers Layers for sublayers; artboard preset polish (artboard escape routing and document setup modal handoff done; Move Artwork for artboard X/Y edits, Rearrange All Artboards, Document Setup, New Document and the rest of the Layers panel are done) | 4–7 | | View & navigation | 3 | 70% | New View/Edit Views, multiple windows/arrange, Snap to Pixel/Glyph (print tiling is done) | 9–14 | -| Guides, grids, smart guides, snapping, rulers | 3 | 85% | global/video rulers, Spacing Guides' distance readouts and spacing for resized or drawn art, Alt swapping a ruler guide's orientation, ruler guides selected together with art (marquee, Shift-click), ruler guides as Layers rows with their own lock and hide (#451: Lock Guides locks them all; Make Guides paths are Layers rows already) (dragging existing guides is done, #414; new guides snapping to side midpoints and artboards, and artboard guides, #451; the drawing tools snapping, with Construction Guides, #506; Spacing Guides for moves, #394; moves snapping to the grid, #740; ruler guides pulling drawn points with Smart Guides on, and "center" and "anchor" labels while hovering with the Selection tool, #812; distance and angle labels while drawing, #2983) | 2–4; status-bar X/Y uses the active ruler origin and General units | +| Guides, grids, smart guides, snapping, rulers | 3 | 85% | global/video rulers, Spacing Guides' distance readouts and spacing for resized or drawn art, Alt swapping a ruler guide's orientation, ruler guides selected together with art (marquee, Shift-click), ruler guides as Layers rows with their own lock and hide (#451: Lock Guides locks them all; Make Guides paths are Layers rows already; a marquee leaves locked or hidden guide paths out inside groups too, #8538) (dragging existing guides is done, #414; new guides snapping to side midpoints and artboards, and artboard guides, #451; the drawing tools snapping, with Construction Guides, #506; Spacing Guides for moves, #394; moves snapping to the grid, #740; ruler guides pulling drawn points with Smart Guides on, and "center" and "anchor" labels while hovering with the Selection tool, #812; distance and angle labels while drawing, #2983) | 2–4; status-bar X/Y uses the active ruler origin and General units | | File formats | 6 | 85% | PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300; scores and estimates unchanged); PDF import: type filled and stroked by one text-showing operator comes in as one filled and stroked type object (#8015; not yet for type filled and stroked at less than full opacity, or a `TJ` whose kerning starts a new line part way through, which still come in as a filled object and a stroked one; scores and estimates unchanged); PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; scores and estimates unchanged); PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); Explicit editing-data oversized single-artboard import fixed (#6865); scores and estimates unchanged. Legacy `.ai` files that name but omit their prolog open with their layers, or with their art on one layer when the format has no layers; graph data and settings in these files still come in only as drawn art. Affinity export, and the rest of Affinity import (adjustments, blur and bevel effects, brushes, live symbol instances, text threading), DWG (no open spec: DXF instead), PSD placement as layers (Photoshop Import Options; the merged image is done), EPS checked against more real files users send (Inkscape files open as vectors; other generators' constructs are tested with programs written from the PostScript Language Reference only; CID-keyed CJK type and `CCITTFaxDecode` images not read), the rest of Illustrator's editing data (appearances and live effects, symbols, pattern fills, brushes, placed files: #637), the remaining fidelity polish; EPS, DXF, EMF/WMF, TIFF, BMP, Targa, PSD export, SVGZ, PDF security, PDF/X, PDF layers, presets and Affinity import are done | 6–10 (existing scope; Affinity export unestimated) | | Export for Screens, Asset Export, slices, Save for Web | 3 | 85% | polish only (all four are done) | 2–4 | | Print, colour management, separations, flattener | 3 | 80% | Production Preflight available; print preview fidelity remains (flattener presets in PDF and print, overprint in PDF and composite print, Print dialog, presets, PostScript, marks, separations, Print Tiling, print overprint/flattener/bitmap options and printer profile are done, as are the Japanese papers in its Media list: JIS B4/B5/B6, はがき, 往復はがき, 封筒 長形3号/長形4号/角形2号/角形3号 and 四六判, beside the ISO B4/B5 that settings saved before them keep) | 1–2 | @@ -1437,7 +1437,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur The Blob Brush Tool Options also have Fidelity, which the reference app's [Blob Brush options](https://web.archive.org/web/20261012042029/https://helpx.adobe.com/illustrator/desktop/paint-and-fill/learn-painting-basics/blob-brush-options-and-best-practices.html) list as setting how far the pointer moves before the path gets a new anchor point. The range and default are VectorCraft's own values: the Pencil's logarithmic slider from Accurate (0.01 pt) to Smooth (20 pt) and its field (up to 100 pt), 1.5 pt by default and kept with the tool's options. The brush follows the stroke fitted at the Fidelity, as a Pencil stroke is fitted: a low value follows the drag closely, jitter included, and a higher one gives smoother curves (`path.blob` `fidelity`). `path.blob` rejects an Angle outside −180° to 180°, a Roundness outside 0% to 100% and a Fidelity outside 0.01 to 100 pt with an error and leaves the document unchanged; a key left out or null takes its default (0°, 100% and no fitting). A Blob Brush stroke merges with the topmost path of its fill color and no stroke that it touches, and with the other such paths it touches in the same group or layer that are next to that path in stacking order with no other kind of object between them; matching paths in other groups or layers are left alone, as the Blob Brush tool guidelines in [Paint with fills and strokes](https://web.archive.org/web/20241219085603/https://helpx.adobe.com/illustrator/using/painting-fills-strokes.html) describe (`path.blob`). -- **Ruler guides as layer objects:** a guide goes on the current layer, shows, hides, locks and is deleted with it, is listed in the Layers panel (its row selects it) and moves to another layer (`guide.setLayer`, or its row dragged onto that layer's rows); guides on a hidden or locked layer can't be selected, moved or deleted, Duplicate copies a layer's guides and Merge Selected and Flatten Artwork keep them on the merged layer; guides from files saved before guides had layers go on the top visible, unlocked layer when the document opens. A guide's row has its own eye and lock, which hide or lock that guide alone in one undo step and take part in a drag down either column ([help page](https://helpx.adobe.com/in_hi/tutorial-builder/user-guide/illustrator-tutorial-builder/-ai--examples-of-common-coach-marks.html) lists a Guide among the Layers panel's items); a hidden guide is not drawn and does not snap, a locked one is drawn and snaps but can't be selected, moved or deleted, and its own state is kept through save and reopen and while its layer is hidden or locked (`layer.setProps` on its `guide.list` id). Object › Lock › Selection and Object › Hide › Selection lock or hide a selected guide with the selected art, and Unlock All and Show All unlock or show such guides and select them ([help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) for Lock and Hide Selection). A guide row dropped on the panel's trash deletes its guide, the trash deletes a guide its row selected, and after a click on a guide row Delete deletes the guide rather than the rows highlighted before ([help page](https://helpx.adobe.com/illustrator/desktop/measure-and-align/grids-and-guides/align-graphic-objects-with-guides.html) for deleting a selected guide). A plain click on another row lets go of a guide its row selected, keeping the selected art, as a plain click on a row picks that row alone; a Ctrl/Cmd or Shift click keeps it (#7340, `panels::layers` test `a_plain_row_click_lets_go_of_the_selected_guide`). Not done: guides stacked among the art of their layer (they are listed above it). Lock Guides also locks the objects made into guides: they can't be selected, moved or deleted (#1543); they are drawn in the guide colour and style of Preferences, and a dragged selection snaps to ruler guides with Smart Guides on (#1583, fixes #1534). Preferences › Guides & Grid › Lock Guides by Default locks guides when the app starts; it is off by default, and new guides can still be dragged out of a ruler while guides are locked. The Transform panel shows a selected ruler guide's X or Y, and typing a value moves it (#1659, part of #1597). This is not established by the documentation we could find: the public help pages on guides, rulers and the Transform, Control and Properties panels (read again on 2026-10-14) describe selecting and dragging unlocked guides and the panels' X and Y for a selection, not a guide's position in a panel, and the one public statement of it is a user's [community answer](https://community.adobe.com/questions-652/adding-a-new-custom-guide-785586), which is not documentation. It is kept as a convenience pending the owner's decision, with no parity claim and nothing counted towards a score. +- **Ruler guides as layer objects:** a guide goes on the current layer, shows, hides, locks and is deleted with it, is listed in the Layers panel (its row selects it) and moves to another layer (`guide.setLayer`, or its row dragged onto that layer's rows); guides on a hidden or locked layer can't be selected, moved or deleted, Duplicate copies a layer's guides and Merge Selected and Flatten Artwork keep them on the merged layer; guides from files saved before guides had layers go on the top visible, unlocked layer when the document opens. A guide's row has its own eye and lock, which hide or lock that guide alone in one undo step and take part in a drag down either column ([help page](https://helpx.adobe.com/in_hi/tutorial-builder/user-guide/illustrator-tutorial-builder/-ai--examples-of-common-coach-marks.html) lists a Guide among the Layers panel's items); a hidden guide is not drawn and does not snap, a locked one is drawn and snaps but can't be selected, moved or deleted, and its own state is kept through save and reopen and while its layer is hidden or locked (`layer.setProps` on its `guide.list` id). Object › Lock › Selection and Object › Hide › Selection lock or hide a selected guide with the selected art, and Unlock All and Show All unlock or show such guides and select them ([help page](https://help.adobe.com/archive/en_US/illustrator/cs3/illustrator_cs3_help.pdf) for Lock and Hide Selection). A guide row dropped on the panel's trash deletes its guide, the trash deletes a guide its row selected, and after a click on a guide row Delete deletes the guide rather than the rows highlighted before ([help page](https://helpx.adobe.com/illustrator/desktop/measure-and-align/grids-and-guides/align-graphic-objects-with-guides.html) for deleting a selected guide). A plain click on another row lets go of a guide its row selected, keeping the selected art, as a plain click on a row picks that row alone; a Ctrl/Cmd or Shift click keeps it (#7340, `panels::layers` test `a_plain_row_click_lets_go_of_the_selected_guide`). Not done: guides stacked among the art of their layer (they are listed above it). Lock Guides also locks the objects made into guides: they can't be selected, moved or deleted (#1543); they are drawn in the guide colour and style of Preferences, and a dragged selection snaps to ruler guides with Smart Guides on (#1583, fixes #1534). Preferences › Guides & Grid › Lock Guides by Default locks guides when the app starts; it is off by default, and new guides can still be dragged out of a ruler while guides are locked. The Transform panel shows a selected ruler guide's X or Y, and typing a value moves it (#1659, part of #1597). This is not established by the documentation we could find: the public help pages on guides, rulers and the Transform, Control and Properties panels (read again on 2026-10-14) describe selecting and dragging unlocked guides and the panels' X and Y for a selection, not a guide's position in a panel, and the one public statement of it is a user's [community answer](https://community.adobe.com/questions-652/adding-a-new-custom-guide-785586), which is not documentation. It is kept as a convenience pending the owner's decision, with no parity claim and nothing counted towards a score. While Lock Guides is on or the guides are hidden, a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out the paths made into guides inside groups and compound paths, as clicks do, so a locked guide does not select its group; an enclosing marquee measures a group without them (#8538; `a_marquee_skips_guide_paths_in_groups_while_guides_are_locked` in `crates/doc/src/hit/tests.rs`, `a_marquee_over_a_locked_guide_in_a_group_selects_nothing` in `crates/tools/src/select/tests.rs`). - **Releasing ruler guides:** View › Guides › Release Guides turns the selected ruler guides into paths with no fill or stroke. An artboard guide becomes a line across its artboard, and a canvas guide becomes a line across the artboards (`view.guides.release {index?, ids?}`). A Cmd/Ctrl+Shift double-click with the Selection, Direct Selection or Group Selection tool releases the ruler guide or guide path under the pointer. - **Layers panel:** every layer, sublayer, group and object is a clickable row at any depth: a click highlights it and makes its layer current (new art goes there), Shift-click a range, Ctrl/Cmd-click toggles. Sublayers are no longer treated as objects: clicks, marquees, Select All and the Select menu take the art inside them, and each sublayer selects in its own colour. Selection squares on rows with selected art (click selects a row's art, Shift adds or removes; dragging the square moves the selection to another row, Alt copies), the eye and lock on every row with drag-down-the-column (one undo step), Ctrl/Cmd-click an eye for per-layer Outline, Alt-click an eye or lock to hide or lock the other layers (again: show or unlock them all), triangles with Alt to open or close everything inside, drag and drop rows above, below or into layers and groups with a drop line (Alt copies) and a dimmed copy of the row under the pointer (layers dropped in the empty space under the last row go below the bottom layer, #2260; dropped on the trash rows are deleted, on New Layer duplicated, as in Illustrator), inline rename, Delete key on highlighted rows. Buttons and the full panel menu: New Layer/Sublayer (Alt: options, Ctrl: on top), Duplicate, Delete, Options for Selection, clipping mask, isolation, Locate Object, Merge Selected, Flatten Artwork, Collect in New Layer, Collect for Export (As Single Asset, As Multiple Assets), Release to Layers (Sequence and Build), Reverse Order, Template, Hide/Outline/Lock Others and Show/Preview/Unlock All, Paste Remembers Layers, Panel Options (row size, thumbnails per kind, Show Layers Only). Right-clicking a layer, sublayer, group or object row offers Collect for Export for that row, or for every highlighted row when it is one of them; guide and blend spine rows have no context menu. Layer Options: name, colour (presets, each with a chip of its colour, or custom), Template, Lock, Show, Print, Preview (outline drawing and clicking) and Dim Images to %. Every operation is a command (`layer.move`, `layer.highlight`, `layer.merge`…) with validation against cycles and invalid nesting. A document opens with only its top-level layers open; the rows left open are saved in the native file (nothing is written for the default) and reopen that way. Only the rows scrolled into view are laid out, from a row list made once per change: a layer of 5,000 groups of 10 paths, all open, draws the panel in 0.4 ms a frame instead of about 29 s (#638). With Paste Remembers Layers on, art copied from a sublayer pastes back into that sublayer, as [the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=223) describes art going back to the layer it was copied from: in the same document while the sublayer is still there, two sublayers of the same name in different layers kept apart; in another document by the names of the sublayer and the layers around it. These rules are VectorCraft's own: a missing sublayer is made inside its layer (a missing layer on top, with the sublayer inside it), in the paste's one undo step; of layers with the same names, the topmost chain that matches the most names wins, a shown and unlocked one first; a matched layer that is hidden or locked, or inside one that is, refuses the paste, and nothing is pasted. @@ -2925,7 +2925,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s | Date | Change | Summary | |---|---|---| -| 2026-11-18 | minor | Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#8538). Scores and estimates unchanged. | +| 2026-11-18 | 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. | | 2026-11-18 | minor | Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged. See [production-preflight.md](production-preflight.md) for scope and limits. | | 2026-11-16 | minor | Layers panel: an Alt-drag copies a row above or below its own place (`layer.move` with `copy` and that row as the target), so the top layer dragged up, the bottom layer dragged down and a document's only layer are copied (#8237). Scores and estimates unchanged. | | 2026-11-16 | minor | Layers panel: rows or the selected-art square dragged over the list show the copy cursor while Alt is held, as the drop then copies, and the grabbing hand otherwise (#8217). Scores and estimates unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index b36961ad37..452b4abbfd 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-18 · **Change:** minor (Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#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: #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-18 · **Change:** 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: #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). > @@ -273,7 +273,7 @@ tools, never checked side by side) isn't captured row by row. | Escape cancels an existing ruler-guide press, move or copy | done | Selection and Direct/Group Selection; app-input regressions cover preselected guides, document/interaction-start selection, Undo/Redo and saved state, later on-canvas motion/release and temporary borrowing from idle Pen. All eight checks and the Direct Selection Escape control passed in current full CI. [Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area) | | Ruler origin: corner drag with preview, snapped as a drawn point is (Smart Guides, Snap to Point and the ruler guides, pixels, the grid), double-click reset to the active artboard, relative X/Y fields, native save/reopen | done | #1212; `document.setRulerOrigin`, `document.resetRulerOrigin`; geometry and command coordinates stay absolute | | Ruler guides as Layers rows: shown, hidden, locked and deleted with their layer; rows dragged to another layer; each row's own eye and lock; a row dropped on the trash deletes its guide; a plain click on another row lets go of the guide | done | `guide.setLayer`; guides from older files go on a layer; `layer.setProps` on a guide's id hides or locks it alone; Object › Lock/Hide › Selection, Unlock All and Show All reach guides; `guide.remove {indexes}`; #7340 | -| Objects made into guides: drawn in the guide colour and style of Preferences; Lock Guides locks them too (no select, move or delete), in groups as well: a marquee skips them and a transform of their group leaves them in place; a dragged selection snaps to ruler guides with Smart Guides on, by the nearest point of the path when pressed on its stroke or beside its edge, so the path lands exactly on the guide | done | #1534 (#1543, #1583); #3701; #8538 | +| Objects made into guides: drawn in the guide colour and style of Preferences; Lock Guides locks them too (no select, move or delete), in groups as well: a marquee leaves them out, so it does not take their group, and they still move with their group; a dragged selection snaps to ruler guides with Smart Guides on, by the nearest point of the path when pressed on its stroke or beside its edge, so the path lands exactly on the guide | done | #1534 (#1543, #1583); #3701; #8538 | | A selected ruler guide's X or Y in the Transform panel; typing a value moves it | not scored | #1659 (part of #1597); several guides move together; not in Properties or the Control bar. Not established by the documentation we could find: the help pages on guides, rulers and the Transform, Control and Properties panels (read again on 2026-10-14) don't describe it, and the one public statement is a user's [community answer](https://community.adobe.com/questions-652/adding-a-new-custom-guide-785586), which is not documentation. Kept as a convenience pending the owner's decision; no parity claim | | Alt swaps a ruler guide's orientation while dragging | missing | Alt-drag copies the selected guides ([Use rulers](https://helpx.adobe.com/illustrator/desktop/measure-and-align/grids-and-guides/use-rulers.html)); `guide.move` `{copy: true}` | | Alt swaps a new ruler guide's orientation while dragging | done | Both rulers; preview, snapping and final placement follow the current modifier ([public shortcut reference](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)). | @@ -581,7 +581,7 @@ before release (#6373). [Paint faces and edges](https://helpx.adobe.com/illustra | Date | Change | Summary | |---|---|---| -| 2026-11-18 | minor | Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) skips paths made into guides in groups too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; moving or transforming a group (Move, Rotate, Scale, Reflect, Shear, Transform Each, Align) leaves its locked guides in place, and a copy takes a copy of the guide with it (#8538). Scores and estimates unchanged. | +| 2026-11-18 | 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. | | 2026-11-18 | minor | Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged. See [production-preflight.md](production-preflight.md) for scope and limits. | | 2026-11-16 | minor | 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. | | 2026-11-16 | minor | Recolor Artwork › Assign: native Lab entry in the Color Picker, swatch libraries access in the picker, and row context menu options (Pick from Swatches, Limit to Library) (#4028). Scores and estimates unchanged. | From 56b4fcb8c6072733364eba79efe45e83841678a3 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Wed, 18 Nov 2026 03:19:27 -0800 Subject: [PATCH 143/158] Fix redraw bounds for rotated Blend effects Measure effect-bearing Align to Path content after spine placement, retaining the conservative envelope and covering damage containment with original software-rendered move and Undo controls. --- .../engine/tests/blend_render_consistency.rs | 57 +++++++++++++++++++ crates/render/src/fx/bounds.rs | 27 ++++++++- 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/crates/engine/tests/blend_render_consistency.rs b/crates/engine/tests/blend_render_consistency.rs index 4fc6327152..fdc2fb3b93 100644 --- a/crates/engine/tests/blend_render_consistency.rs +++ b/crates/engine/tests/blend_render_consistency.rs @@ -141,3 +141,60 @@ fn blend_5179_replace_spine_move_undo_matches_fresh_cpu() { let restored = frame(&s, &mut retained, "undo-replace"); same_pixels(&restored, &warm); } + +// A fixed ordinary anisotropic Transform, evaluated after Align to Path turns the key. +// 200% is the legitimate control; 400% is the single source-derived witness. +fn rotated_transform_damage(scale_h: f64) { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": WIDTH, "height": HEIGHT})).unwrap(); + let mut rectangle = |x: f64, color: &str| { + let id = NodeId(s.execute("shape.rectangle", &json!({"x": x, "y": 200.0, "width": 8.0, "height": 80.0})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"color": color})).unwrap(); + s.execute("paint.setStroke", &json!({"none": true})).unwrap(); + s.execute("effect.apply", &json!({"effect": "distort.transform", "params": {"scaleH": scale_h, "scaleV": 100.0, "reference": 4}})).unwrap(); + let n = s.doc().unwrap().doc.node(id).unwrap(); + let b = n.geometric_bounds().unwrap(); + assert!((b.width() - 8.0).abs() < 1e-8 && (b.height() - 80.0).abs() < 1e-8, "INPUT: the Transform must remain live on the narrow key"); + assert_eq!(n.appearance.effects.len(), 1); + assert_eq!(n.appearance.effects[0].params["scaleH"], json!(scale_h)); + id + }; + let keys = [rectangle(260.0, "#d52c38"), rectangle(460.0, "#25b453")]; + let blend = NodeId( + s.execute("object.blend.make", &json!({"ids": [keys[0].0, keys[1].0], "steps": 3, "orientation": "path"})).unwrap()["id"].as_u64().unwrap(), + ); + live(&s, blend, keys, false); + let path = NodeId(s.execute("path.create", &json!({"d": "M264 160 L264 320"})).unwrap()["id"].as_u64().unwrap()); + s.execute("select.set", &json!({"ids": [blend.0, path.0]})).unwrap(); + let before = serde_json::to_value(s.doc().unwrap().doc.as_ref()).unwrap(); + let mut retained = (cpu(), None); + let warm = frame(&s, &mut retained, "anisotropic-before-replace"); + s.execute("object.blend.replaceSpine", &json!({})).unwrap(); + live(&s, blend, keys, false); + assert!(s.doc().unwrap().doc.node(path).is_none()); + assert_eq!(s.doc().unwrap().selection.objects, vec![blend]); + let n = s.doc().unwrap().doc.node(blend).unwrap(); + let NodeKind::Blend { spec, .. } = &n.kind else { panic!("INPUT: the fixture must remain a live blend") }; + let spine = spec.spine.as_ref().unwrap().bounds().unwrap(); + assert!(spine.width().abs() < 1e-8 && (spine.height() - 160.0).abs() < 1e-8, "INPUT: this is the fixed vertical rail"); + let expanded = vectorcraft_render::expand_live(n); + let placed = expanded.iter().find(|n| n.id == keys[0]).unwrap(); + let b = placed.geometric_bounds().unwrap(); + assert!((b.width() - 80.0).abs() < 1e-8 && (b.height() - 8.0).abs() < 1e-8, "INPUT: Align to Path must really turn the key by 90 degrees"); + assert_eq!(placed.appearance.effects.len(), 1); + assert_eq!(placed.appearance.effects[0].params["scaleH"], json!(scale_h)); + let replaced = frame(&s, &mut retained, &format!("rotated-transform-{scale_h}-replace")); + assert!(replaced.pixels != warm.pixels, "INPUT: the replacement must really change the painted frame"); + move_and_undo(&mut s, &mut retained, blend, keys, false, &replaced); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(serde_json::to_value(s.doc().unwrap().doc.as_ref()).unwrap(), before); + let restored = frame(&s, &mut retained, "anisotropic-undo-replace"); + same_pixels(&restored, &warm); +} + +#[test] +fn blend_5179_rotated_transform_damage_contains_painted_pixels() { + // The control completes every render, move and history check before the witness runs. + rotated_transform_damage(200.0); + rotated_transform_damage(400.0); +} diff --git a/crates/render/src/fx/bounds.rs b/crates/render/src/fx/bounds.rs index 34eda0e1aa..2a554a3d92 100644 --- a/crates/render/src/fx/bounds.rs +++ b/crates/render/src/fx/bounds.rs @@ -730,7 +730,7 @@ fn cull_bounds_in(symbols: &SymbolBoxes, n: &Node, after_reshape: bool, brush: b NodeKind::Blend { .. } => { let b = n.reach_bounds_with(symbols)?; let a = live_content_reach(symbols, n); - Some(b.inflate(a, a)) + vectorcraft_geom::union_opt(Some(b.inflate(a, a)), placed_blend_effect_bounds(symbols, n)) } _ => { let b = n.visual_bounds_with(symbols)?; @@ -815,7 +815,7 @@ pub(crate) fn with_own_raster_reach(symbols: &SymbolBoxes, n: &Node, b: Rect) -> /// (Revolve builds no art from type). fn own_box(symbols: &SymbolBoxes, n: &Node) -> Option { let b = match &n.kind { - NodeKind::Blend { .. } => n.reach_bounds_with(symbols), + NodeKind::Blend { .. } => vectorcraft_geom::union_opt(n.reach_bounds_with(symbols), placed_blend_effect_bounds(symbols, n)), _ => n.visual_bounds_with(symbols), }?; Some(match &n.kind { @@ -824,6 +824,29 @@ fn own_box(symbols: &SymbolBoxes, n: &Node) -> Option { }) } +/// A rotated blend's effect-bearing content, measured after spine placement. Geometry effects +/// run on the placed shapes, so their reach on the original keys need not cover what they paint. +/// Effect-free blends keep the quick rail envelope without evaluating their steps. +fn placed_blend_effect_bounds(symbols: &SymbolBoxes, n: &Node) -> Option { + let NodeKind::Blend { spec, .. } = &n.kind else { return None }; + if spec.orientation != vectorcraft_doc::BlendOrientation::AlignToPath { + return None; + } + let mut has_effects = false; + n.walk(&mut |c| { + has_effects |= has_fx(c) + || has_object_fx(c) + || match &c.kind { + NodeKind::SymbolInstance { symbol, .. } => symbols.has_effects(symbol), + _ => false, + }; + }); + if !has_effects { + return None; + } + effects::expand_live(Some(symbols.document()), n).iter().fold(None, |acc, c| vectorcraft_geom::union_opt(acc, cull_bounds(symbols, c))) +} + /// The box of type `t`'s glyphs as laid out (its layout bounds, else laid out now), grown by its /// characters' strokes, miter spikes included, and by `outset`: on a path they stand above it and /// run past its ends, in an area they can hang past its frame, where its own box From 242695b1a1686d04506a7c2bfd78713f43c969b1 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Wed, 18 Nov 2026 03:28:38 -0800 Subject: [PATCH 144/158] Add fixed pinning-only paint preservation witnesses --- crates/engine/tests/eraser_open_fill.rs | 187 ++++++++++++++++++++++++ 1 file changed, 187 insertions(+) diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index 790c0b7cf8..543386a82e 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -1835,3 +1835,190 @@ fn eraser_ancestor_stroke_scene(container: &str, stroke: &str) -> Session { s.execute("select.set", &json!({"ids": [selected.0]})).unwrap(); s } + +// Pinning-only checks: no Eraser operation or other geometry edit is performed below. +fn eraser_pinning_only_same_pixels(a: &vectorcraft_render::Rendered, b: &vectorcraft_render::Rendered, label: &str) { + let changed = (0..300).find_map(|y| (0..300).find(|&x| a.pixel(x, y) != b.pixel(x, y)).map(|x| (x, y, a.pixel(x, y), b.pixel(x, y)))); + assert_eq!(changed, None, "{label}: first changed pixel"); +} + +fn eraser_pinning_only_nested_scene(placed: bool, parent_offset: bool) -> (Session, NodeId) { + let mut s = session(); + let (_, _, owner, _) = eraser_container_gradient_fixture(&mut s, false, false); + s.execute("select.set", &json!({"ids": [owner.0]})).unwrap(); + let outer = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + if parent_offset { + s.execute( + "effect.apply", + &json!({"ids": [outer.0], "target": "object", "item": null, + "effect": "path.offsetPath", "params": {"offset": 10, "joins": "round"}}), + ) + .unwrap(); + } + // These are the retained ordinary fit and the existing +10 pt evaluated fit. + let (bottom, top) = if parent_offset { (210.0, 90.0) } else { (200.0, 100.0) }; + s.execute( + "appearance.setItem", + &json!({"ids": [owner.0], "target": "object", "index": 0, + "gradient": eraser_placement_ramp(placed, bottom, top)}), + ) + .unwrap(); + let doc = &s.doc().unwrap().doc; + assert_eq!(doc.parent_of(owner), Some(outer), "INPUT: the gradient owner is nested in the effect owner"); + assert_eq!(doc.node(owner).unwrap().geometric_bounds().unwrap(), vectorcraft_geom::Rect::new(100.0, 100.0, 220.0, 200.0)); + assert!(doc.node(owner).unwrap().appearance.effects.is_empty(), "INPUT: the offset belongs to the enclosing Group only"); + let effects = &doc.node(outer).unwrap().appearance.effects; + assert_eq!(effects.len(), usize::from(parent_offset)); + if parent_offset { + assert_eq!(effects[0].id, "path.offsetPath"); + assert!(effects[0].visible); + assert_eq!(effects[0].params["offset"].as_f64(), Some(10.0)); + assert_eq!(effects[0].params["joins"], json!("round")); + } + let vectorcraft_doc::color::Paint::Gradient(g) = doc.node(owner).unwrap().appearance.fill_paint() else { + panic!("INPUT: the nested Group owns the gradient") + }; + assert_eq!(g.geom.is_some(), placed); + assert!(!g.gradient.dither); + (s, owner) +} + +fn eraser_pinning_only_nested_case(parent_offset: bool) { + let (s, owner) = eraser_pinning_only_nested_scene(false, parent_offset); + let (placed, placed_owner) = eraser_pinning_only_nested_scene(true, parent_offset); + let before = eraser_gradient_image(&s); + let explicit = eraser_gradient_image(&placed); + assert_eq!(before.pixel(190, 175)[3], 255, "INPUT: the retained sibling is painted"); + assert_eq!(before.pixel(190, 185)[3], 255); + assert_ne!(before.pixel(190, 175), before.pixel(190, 185), "INPUT: the fitted ramp is nonconstant"); + if parent_offset { + assert_eq!(before.pixel(190, 205)[3], 255, "INPUT: the enclosing positive offset reaches beyond the raw box"); + } + eraser_pinning_only_same_pixels(&before, &explicit, "INPUT: the independently placed control matches before pinning"); + let placed_doc = &placed.doc().unwrap().doc; + assert!( + vectorcraft_render::pinned_appearance_for_geometry_edit(placed_doc, placed_doc.node(placed_owner).unwrap()).is_none(), + "INPUT: an already explicit placement needs no pinning" + ); + let label = if parent_offset { "PINNING_ONLY: nested Group under positive Offset Path" } else { "CONTROL: nested Group without enclosing effects" }; + eraser_pinning_only_store(&s.doc().unwrap().doc, owner, &before, !parent_offset, label); +} + +fn eraser_pinning_only_store(doc: &vectorcraft_doc::Document, owner: NodeId, before: &vectorcraft_render::Rendered, required: bool, label: &str) { + let original = serde_json::to_value(doc).unwrap(); + let node = doc.node(owner).unwrap(); + let Some(pinned) = vectorcraft_render::pinned_appearance_for_geometry_edit(doc, node) else { + assert!(!required, "INPUT: the ordinary control must pin reproducibly: {label}"); + assert_eq!(serde_json::to_value(doc).unwrap(), original); + println!("PINNING_FALLBACK: {label} remains fitted; no pixel failure established"); + return; + }; + assert_eq!(serde_json::to_value(doc).unwrap(), original, "INPUT: the public helper leaves its input unchanged"); + let vectorcraft_doc::color::Paint::Gradient(g) = pinned.fill_paint() else { panic!("INPUT: returned paint is a gradient") }; + assert!(g.geom.is_some(), "INPUT: the returned fitted gradient has an explicit placement"); + // The fixed linear fixture permits only stored gradient geometry to change, not effects or other row data. + let mut normalized = pinned.clone(); + assert_eq!(normalized.items.len(), node.appearance.items.len()); + for (after, before) in normalized.items.iter_mut().zip(&node.appearance.items) { + if let (vectorcraft_doc::color::Paint::Gradient(a), vectorcraft_doc::color::Paint::Gradient(b)) = (after.paint_mut(), before.paint()) { + a.geom = b.geom; + } + } + assert_eq!(serde_json::to_value(&normalized).unwrap(), serde_json::to_value(&node.appearance).unwrap(), "INPUT: only placement changes"); + let mut only_paint = doc.clone(); + only_paint.node_mut(owner).unwrap().appearance = pinned.into(); + let mut restored = only_paint.clone(); + restored.node_mut(owner).unwrap().appearance = node.appearance.clone(); + assert_eq!(serde_json::to_value(&restored).unwrap(), original, "INPUT: geometry, effects and every other source field are unchanged"); + let after = vectorcraft_render::Renderer::new().render(&only_paint, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()); + eraser_pinning_only_same_pixels(before, &after, label); +} + +#[test] +fn eraser_pinning_only_nested_gradient_matches_unchanged_render() { + // Establish the ordinary nested Group without an enclosing geometry effect FIRST. + eraser_pinning_only_nested_case(false); + // One retained positive offset, no cut, parameter search or timing measurement. + eraser_pinning_only_nested_case(true); +} + +fn eraser_pinning_only_text_clip_case(stroked: bool) { + // Original clippaint.rs text, paint, font defaults and geometry; one retained ordinary scale. + let mut s = session(); + let art = s.execute("shape.rectangle", &json!({"x": 0, "y": 50, "width": 30, "height": 100})).unwrap()["id"].as_u64().unwrap(); + s.execute("paint.setFill", &json!({"ids": [art], "color": "#ff0000"})).unwrap(); + let text = NodeId(s.execute("text.create", &json!({"x": 10, "y": 120, "text": "Clip", "size": 72})).unwrap()["id"].as_u64().unwrap()); + s.execute("select.all", &json!({})).unwrap(); + let owner = NodeId(s.execute("object.clippingMask.make", &json!({})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"ids": [text.0], "color": "#0000ff"})).unwrap(); + if stroked { + s.execute("paint.setStroke", &json!({"ids": [text.0], "color": "#00ff00"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [text.0], "weight": 2})).unwrap(); + } else { + s.execute("paint.setStroke", &json!({"ids": [text.0], "none": true})).unwrap(); + } + s.execute("appearance.addFill", &json!({"ids": [owner.0], "target": "object"})).unwrap(); + s.execute( + "appearance.setItem", + &json!({"ids": [owner.0], "target": "object", "index": 0, "gradient": eraser_placement_ramp(false, 200.0, 100.0)}), + ) + .unwrap(); + s.execute( + "effect.apply", + &json!({"ids": [owner.0], "target": "object", "item": null, "effect": "distort.transform", + "params": {"scaleH": 100, "scaleV": 150, "reference": 8, "objects": true, "copies": 0, + "random": false, "rotate": 0, "moveH": 0, "moveV": 0, "patterns": false, "strokes": false}}), + ) + .unwrap(); + let doc = &s.doc().unwrap().doc; + let node = doc.node(owner).unwrap(); + assert!(node.clips(), "INPUT: the source is a clipping Group"); + assert_eq!(node.children().unwrap()[0].id, text); + let t = doc.node(text).unwrap(); + let NodeKind::Text(type_) = &t.kind else { panic!("INPUT: the clipping object is type") }; + assert_eq!(type_.plain_text(), "Clip"); + assert_eq!(t.clip_paint().stroke.is_some(), stroked, "INPUT: only the character-stroke paint distinguishes the control"); + let bounds = t.geometric_bounds().unwrap(); + assert!(bounds.width() > 0.0 && bounds.height() > 0.0, "INPUT: actual font setup supplies nonempty glyph geometry"); + let effects = &node.appearance.effects; + assert_eq!(effects.len(), 1); + assert_eq!(effects[0].id, "distort.transform"); + assert!(effects[0].visible); + for (key, expected) in [("scaleH", 100.0), ("scaleV", 150.0), ("reference", 8.0), ("copies", 0.0)] { + assert_eq!(effects[0].params[key].as_f64(), Some(expected), "INPUT: accepted Transform {key}"); + } + let evaluated = vectorcraft_effects::evaluate_container(Some(doc), node).expect("INPUT: the real container pass evaluates the fixture"); + if stroked { + let children = evaluated.children().unwrap(); + assert!(!evaluated.clips() && children.len() >= 2, "INPUT: painted clipping strokes create an outer wrapper"); + assert!(children[0].clips()); + assert_eq!(children[0].id, owner); + assert_eq!(children[0].children().unwrap()[0].id, text); + assert_eq!(children[1].id, text); + assert!(!children[1].clips(), "INPUT: the second piece paints the stroke outside the clip"); + } else { + assert!(evaluated.clips(), "INPUT: the same glyph/scale without character stroke has no painted-clip wrapper"); + } + let before = eraser_gradient_image(&s); + let mut ramp = std::collections::BTreeSet::new(); + let mut green = 0; + for y in 0..300 { + for x in 0..300 { + let p = before.pixel(x, y); + if p[3] == 255 && p[0] > 0 && p[2] > 0 && p[1] == 0 { + ramp.insert(p); + } + green += usize::from(p[3] > 0 && p[1] > 200 && p[0] < 60 && p[2] < 60); + } + } + assert!(ramp.len() > 1, "INPUT: the fitted container gradient paints actual nonconstant glyph pixels"); + assert_eq!(green > 0, stroked, "INPUT: the painted-character stroke is actually visible only in the subject"); + let label = if stroked { "PINNING_ONLY: painted clipping text under nonuniform scale" } else { "CONTROL: same glyph/scale without painted-clip wrapper" }; + eraser_pinning_only_store(doc, owner, &before, !stroked, label); +} + +#[test] +fn eraser_pinning_only_painted_text_clip_matches_unchanged_render() { + eraser_pinning_only_text_clip_case(false); + eraser_pinning_only_text_clip_case(true); +} From c076b85fcf28cf71875186633d17e99bdf10fb6b Mon Sep 17 00:00:00 2001 From: yoriswind Date: Wed, 18 Nov 2026 04:04:44 -0800 Subject: [PATCH 145/158] Use rendered clip paint to verify witness setup --- crates/engine/tests/eraser_open_fill.rs | 33 +++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index 543386a82e..59e77bd810 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -1942,7 +1942,8 @@ fn eraser_pinning_only_nested_gradient_matches_unchanged_render() { eraser_pinning_only_nested_case(true); } -fn eraser_pinning_only_text_clip_case(stroked: bool) { +fn eraser_pinning_only_text_clip_case(stroked: bool, no_stroke: Option<&vectorcraft_render::Rendered>) -> vectorcraft_render::Rendered { + assert_eq!(stroked, no_stroke.is_some(), "INPUT: the subject follows its no-stroke control"); // Original clippaint.rs text, paint, font defaults and geometry; one retained ordinary scale. let mut s = session(); let art = s.execute("shape.rectangle", &json!({"x": 0, "y": 50, "width": 30, "height": 100})).unwrap()["id"].as_u64().unwrap(); @@ -1987,38 +1988,38 @@ fn eraser_pinning_only_text_clip_case(stroked: bool) { for (key, expected) in [("scaleH", 100.0), ("scaleV", 150.0), ("reference", 8.0), ("copies", 0.0)] { assert_eq!(effects[0].params[key].as_f64(), Some(expected), "INPUT: accepted Transform {key}"); } - let evaluated = vectorcraft_effects::evaluate_container(Some(doc), node).expect("INPUT: the real container pass evaluates the fixture"); - if stroked { - let children = evaluated.children().unwrap(); - assert!(!evaluated.clips() && children.len() >= 2, "INPUT: painted clipping strokes create an outer wrapper"); - assert!(children[0].clips()); - assert_eq!(children[0].id, owner); - assert_eq!(children[0].children().unwrap()[0].id, text); - assert_eq!(children[1].id, text); - assert!(!children[1].clips(), "INPUT: the second piece paints the stroke outside the clip"); - } else { - assert!(evaluated.clips(), "INPUT: the same glyph/scale without character stroke has no painted-clip wrapper"); - } let before = eraser_gradient_image(&s); + let background = before.pixel(299, 299); + assert_eq!(background[3], 0, "INPUT: the retained background sample is clear"); + if let Some(control) = no_stroke { + assert_eq!(control.pixel(299, 299), background, "INPUT: both unchanged renders use the same background"); + } let mut ramp = std::collections::BTreeSet::new(); let mut green = 0; + let mut outside_green = 0; for y in 0..300 { for x in 0..300 { let p = before.pixel(x, y); if p[3] == 255 && p[0] > 0 && p[2] > 0 && p[1] == 0 { ramp.insert(p); } - green += usize::from(p[3] > 0 && p[1] > 200 && p[0] < 60 && p[2] < 60); + let painted_stroke = p[3] > 0 && p[1] > 200 && p[0] < 60 && p[2] < 60; + green += usize::from(painted_stroke); + outside_green += usize::from(painted_stroke && no_stroke.is_some_and(|control| control.pixel(x, y) == background)); } } assert!(ramp.len() > 1, "INPUT: the fitted container gradient paints actual nonconstant glyph pixels"); assert_eq!(green > 0, stroked, "INPUT: the painted-character stroke is actually visible only in the subject"); + if stroked { + assert!(outside_green > 0, "INPUT: the actual character stroke paints where the no-stroke control has only clear background"); + } let label = if stroked { "PINNING_ONLY: painted clipping text under nonuniform scale" } else { "CONTROL: same glyph/scale without painted-clip wrapper" }; eraser_pinning_only_store(doc, owner, &before, !stroked, label); + before } #[test] fn eraser_pinning_only_painted_text_clip_matches_unchanged_render() { - eraser_pinning_only_text_clip_case(false); - eraser_pinning_only_text_clip_case(true); + let control = eraser_pinning_only_text_clip_case(false, None); + eraser_pinning_only_text_clip_case(true, Some(&control)); } From 1d28f45f58e3ad65ceb4642e11f3648ddfff02b4 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Wed, 18 Nov 2026 04:39:25 -0800 Subject: [PATCH 146/158] 6582: retain fitted gradients beneath enclosing geometry effects --- crates/engine/tests/eraser_open_fill.rs | 41 +++++++++++++++++++++++-- crates/render/src/fx/placement.rs | 9 ++++++ 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/crates/engine/tests/eraser_open_fill.rs b/crates/engine/tests/eraser_open_fill.rs index 59e77bd810..a0ab760660 100644 --- a/crates/engine/tests/eraser_open_fill.rs +++ b/crates/engine/tests/eraser_open_fill.rs @@ -1900,7 +1900,8 @@ fn eraser_pinning_only_nested_case(parent_offset: bool) { vectorcraft_render::pinned_appearance_for_geometry_edit(placed_doc, placed_doc.node(placed_owner).unwrap()).is_none(), "INPUT: an already explicit placement needs no pinning" ); - let label = if parent_offset { "PINNING_ONLY: nested Group under positive Offset Path" } else { "CONTROL: nested Group without enclosing effects" }; + let label = + if parent_offset { "PINNING_ONLY: nested Group under positive Offset Path" } else { "CONTROL: nested Group without enclosing effects" }; eraser_pinning_only_store(&s.doc().unwrap().doc, owner, &before, !parent_offset, label); } @@ -2013,7 +2014,8 @@ fn eraser_pinning_only_text_clip_case(stroked: bool, no_stroke: Option<&vectorcr if stroked { assert!(outside_green > 0, "INPUT: the actual character stroke paints where the no-stroke control has only clear background"); } - let label = if stroked { "PINNING_ONLY: painted clipping text under nonuniform scale" } else { "CONTROL: same glyph/scale without painted-clip wrapper" }; + let label = + if stroked { "PINNING_ONLY: painted clipping text under nonuniform scale" } else { "CONTROL: same glyph/scale without painted-clip wrapper" }; eraser_pinning_only_store(doc, owner, &before, !stroked, label); before } @@ -2023,3 +2025,38 @@ fn eraser_pinning_only_painted_text_clip_matches_unchanged_render() { let control = eraser_pinning_only_text_clip_case(false, None); eraser_pinning_only_text_clip_case(true, Some(&control)); } + +#[test] +fn eraser_pinning_only_keeps_hidden_geometry_and_raster_ancestors_supported() { + for raster in [false, true] { + let (mut s, owner) = eraser_pinning_only_nested_scene(false, !raster); + let outer = s.doc().unwrap().doc.parent_of(owner).unwrap(); + if raster { + s.execute( + "effect.apply", + &json!({"ids": [outer.0], "target": "object", "item": null, "effect": "blur.gaussian", "params": {"radius": 3}}), + ) + .unwrap(); + } + let mut doc = (*s.doc().unwrap().doc).clone(); + if !raster { + let ancestor = doc.node_mut(outer).unwrap(); + ancestor.appearance.effects[0].visible = false; + } + let effect = &doc.node(outer).unwrap().appearance.effects[0]; + assert_eq!(doc.node(outer).unwrap().appearance.effects.len(), 1); + assert_eq!(effect.visible, raster); + if raster { + assert_eq!(effect.id, "blur.gaussian"); + assert_eq!(effect.params["radius"].as_f64(), Some(3.0)); + } else { + assert_eq!(effect.id, "path.offsetPath"); + assert_eq!(effect.params["offset"].as_f64(), Some(10.0)); + } + let before = vectorcraft_render::Renderer::new().render(&doc, 300, 300, vectorcraft_geom::Affine::IDENTITY, &Default::default()); + assert_eq!(before.pixel(190, 175)[3], 255, "INPUT: ordinary gradient art remains visible"); + assert_ne!(before.pixel(190, 175), before.pixel(190, 185), "INPUT: the paint is nonconstant"); + let label = if raster { "CONTROL: visible Gaussian ancestor" } else { "CONTROL: hidden Offset Path ancestor" }; + eraser_pinning_only_store(&doc, owner, &before, true, label); + } +} diff --git a/crates/render/src/fx/placement.rs b/crates/render/src/fx/placement.rs index eaaa8eb83d..b5dc86a443 100644 --- a/crates/render/src/fx/placement.rs +++ b/crates/render/src/fx/placement.rs @@ -18,6 +18,15 @@ pub fn pinned_appearance_for_geometry_edit(doc: &Document, n: &Node) -> Option effects::pinned_container_appearance(doc, n), NodeKind::Path { guide: false, .. } | NodeKind::Compound { .. } => pinned_shape(doc, n), From 1cffa0b862fff4e98f8ce96a0d96bf9cfeccded5 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 18:58:52 +0530 Subject: [PATCH 147/158] M7/G4: retype review: tracked letters, outline check cost, poses (#4934) The lone-glyph rule looks at lines as the outlines lie, before the layout check splits them, so tracked one-contour letters (L, I, T, H, E) become type. A shape keeps every glyph and pose it fits exactly, upright first (an L, and a turned L half round; an I upright or upside down), and the line around it chooses; a one-glyph line may turn to another candidate to take the next glyph. The whole-outline check flattens the shape once per shape, samples every corner and points twice the tolerance apart, and asks a flat uniform grid of segments. With Microsoft YaHei loaded: 300 CJK outlines in 350 ms (1.9 s before), one line in 25 ms. FontDb::outline reuses outline_uncached, and the compositing test covers knockout_shape. --- crates/engine/src/cmd/retype.rs | 101 ++++++++++-- crates/engine/src/cmd/retype_tests.rs | 65 +++++++- crates/text/src/fontdb/lookup.rs | 8 +- crates/text/src/retype.rs | 219 ++++++++++++++++++++------ 4 files changed, 314 insertions(+), 79 deletions(-) diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index df0d88a489..2ce951f812 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -164,6 +164,9 @@ struct Line { pieces: Vec, /// What each piece matched, as `pieces`. matches: Vec, + /// Every glyph the first piece fits, while the line holds only it: the next glyph may tell + /// which one it is (see [`join`]). + first_cands: Vec, text: String, face: Arc, scale: f64, @@ -224,6 +227,7 @@ impl Line { let mut l = Line { pieces: vec![*first], matches: vec![m.clone()], + first_cands: vec![], text: m.ch.to_string(), face: m.face.clone(), scale: m.scale, @@ -331,11 +335,64 @@ fn space_advance(face: &vectorcraft_text::FontFace) -> f64 { face.mapped_chars().iter().find(|(c, _)| *c == ' ').map(|(_, g)| face.advance(*g)).unwrap_or(0.0) } -fn new_line(pc: &Piece, m: &GlyphMatch) -> Line { +/// Add shape `pc` to line `l` when one of its candidate glyphs `cands`, in one of its poses, +/// continues it (one shape can be several glyphs, and a glyph that looks the same turned fits in +/// more than one pose). A line of one shape may turn to another of that shape's candidates to take +/// the next one: an L or a turned L half round, an I upright or upside down, and the glyph after it +/// tells which. Whether it was added. +fn join(l: &mut Line, pc: &Piece, cands: &[GlyphMatch]) -> bool { + let fits = |l: &Line| cands.iter().flat_map(|c| c.poses()).find(|mp| l.continues(pc, mp)); + if let Some(mp) = fits(l) { + l.push(pc.id, &mp); + return true; + } + let (Some(id), [current]) = (l.pieces.first().copied(), l.matches.as_slice()) else { return false }; + let current = current.clone(); + let others: Vec = l + .first_cands + .iter() + .flat_map(|c| c.poses()) + .filter(|fp| !(fp.gid == current.gid && fp.face.id() == current.face.id() && fp.angle == current.angle)) + .collect(); + for fp in others { + let mut turned = reposed(l, id, &fp); + if let Some(mp) = fits(&turned) { + turned.push(pc.id, &mp); + *l = turned; + return true; + } + } + false +} + +/// Line `l`'s group, paint and transparency with glyph `m` (shape `id`) alone on it. +fn reposed(l: &Line, id: NodeId, m: &GlyphMatch) -> Line { let dir = Vec2::new(m.angle.cos(), m.angle.sin()); Line { + pieces: vec![id], + matches: vec![m.clone()], + first_cands: l.first_cands.clone(), + text: m.ch.to_string(), + face: m.face.clone(), + scale: m.scale, + angle: m.angle, + origin: m.origin, + end: m.origin + dir * (m.face.advance(m.gid) * m.scale), + appearance: l.appearance.clone(), + parent: l.parent, + opacity: l.opacity, + blend: l.blend, + } +} + +/// A new line of shape `pc` alone, as the first of its candidate glyphs `cands` (none: `None`). +fn new_line(pc: &Piece, cands: &[GlyphMatch]) -> Option { + let m = cands.first()?; + let dir = Vec2::new(m.angle.cos(), m.angle.sin()); + Some(Line { pieces: vec![pc.id], matches: vec![m.clone()], + first_cands: cands.to_vec(), text: m.ch.to_string(), face: m.face.clone(), scale: m.scale, @@ -346,7 +403,7 @@ fn new_line(pc: &Piece, m: &GlyphMatch) -> Line { parent: pc.parent, opacity: pc.opacity, blend: pc.blend, - } + }) } fn retype(s: &mut Session, p: &Value) -> Result { @@ -394,10 +451,16 @@ fn retype(s: &mut Session, p: &Value) -> Result { // The face most shapes match, so a glyph several fonts share is set in the same font as // the glyphs around it. let mut votes: Vec<(u32, usize)> = vec![]; - for m in found.iter().flatten() { - match votes.iter_mut().find(|(f, _)| *f == m.face.id()) { - Some(v) => v.1 += 1, - None => votes.push((m.face.id(), 1)), + for ms in &found { + // Each shape votes once for each face it fits. + let mut faces: Vec = ms.iter().map(|m| m.face.id()).collect(); + faces.sort_unstable(); + faces.dedup(); + for f in faces { + match votes.iter_mut().find(|(v, _)| *v == f) { + Some(v) => v.1 += 1, + None => votes.push((f, 1)), + } } } let rank = |face: u32| votes.iter().find(|(f, _)| *f == face).map_or(0, |v| v.1); @@ -409,26 +472,34 @@ fn retype(s: &mut Session, p: &Value) -> Result { if pc.after_barrier { open = false; } - // Earlier matches win ties: they are the closer fits. - let best = ms.iter().enumerate().max_by_key(|(i, m)| (rank(m.face.id()), std::cmp::Reverse(*i))).map(|(_, m)| m); - let Some(m) = best else { + // The shape's candidates in the face most shapes fit (the first such face, as the + // matches come upright and closest first). + let face = ms.iter().enumerate().max_by_key(|(i, m)| (rank(m.face.id()), std::cmp::Reverse(*i))).map(|(_, m)| m.face.id()); + let cands: Vec = ms.iter().filter(|m| Some(m.face.id()) == face).cloned().collect(); + if cands.is_empty() { unmatched.push(pc.id); open = false; continue; + } + let joined = match lines.last_mut() { + Some(l) if open => join(l, pc, &cands), + _ => false, }; - match lines.last_mut() { - Some(l) if open && l.continues(pc, m) => l.push(pc.id, m), - _ => lines.push(new_line(pc, m)), + if !joined { + lines.extend(new_line(pc, &cands)); } open = true; } - let mut lines = verified(lines, system_layout, &mut unmatched); // A lone one-contour glyph (a period, a hyphen, a bullet) is too plain to tell from drawn // art (a dot, a bar): beside other shapes it stays an outline. Selected on its own, it is - // what was asked for. + // what was asked for. Lone means alone on its baseline as the outlines lie, before the + // layout check splits lines (tracking and manual kerning split them glyph by glyph). + let lone_pieces: std::collections::HashSet = + lines.iter().filter(|l| matches!(l.matches.as_slice(), [m] if m.contours == 1)).flat_map(|l| l.pieces.iter().copied()).collect(); + let mut lines = verified(lines, system_layout, &mut unmatched); if pieces.len() > 1 { lines.retain(|l| { - let lone = matches!(l.matches.as_slice(), [m] if m.contours == 1); + let lone = matches!(l.pieces.as_slice(), [id] if lone_pieces.contains(id)); if lone { unmatched.extend(l.pieces.iter().copied()); } diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 1c8cf5c2f2..98736c5a4f 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -349,15 +349,15 @@ fn a_hidden_or_locked_glyph_stays_an_outline() { #[test] fn an_isolated_or_knockout_group_keeps_its_type_inside() { - for knock in [false, true] { + for case in ["isolate", "knockout", "knockout_shape"] { let mut s = session(); let g = outlined(&mut s, json!({"x": 40, "y": 100, "text": "AB", "size": 40})); s.edit("test", |d, _| { let n = d.node_mut(NodeId(g)).unwrap(); - if knock { - n.knockout = vectorcraft_doc::Knockout::On; - } else { - n.isolate = true; + match case { + "isolate" => n.isolate = true, + "knockout" => n.knockout = vectorcraft_doc::Knockout::On, + _ => n.knockout_shape = true, } Ok(()) }) @@ -365,7 +365,7 @@ fn an_isolated_or_knockout_group_keeps_its_type_inside() { s.execute("select.set", &json!({"ids": [g]})).unwrap(); let r = s.execute("type.retype", &json!({})).unwrap(); let id = r["ids"][0].as_u64().unwrap(); - assert_eq!(children_of(&s, g), vec![id], "knockout {knock}: the group stays, holding the type"); + assert_eq!(children_of(&s, g), vec![id], "{case}: the group stays, holding the type"); } } @@ -465,3 +465,56 @@ fn nothing_retypable_reads_no_font() { let e = s.execute("type.retype", &json!({})).unwrap_err().to_string(); assert!(e.contains("(1 checked)"), "the masked shape is reported, and no font was indexed: {e}"); } + +#[test] +fn tracked_one_contour_letters_still_become_type() { + for text in ["LIT", "HELLO", "LIST"] { + let mut s = session(); + let id = s.execute("text.create", &json!({"x": 40, "y": 100, "text": text, "size": 30})).unwrap()["id"].as_u64().unwrap(); + let n = text.len() as u64; + s.execute("text.setRangeStyle", &json!({"id": id, "start": 0, "end": n, "tracking": 50})).unwrap(); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + let g = s.execute("type.createOutlines", &json!({})).unwrap()["ids"][0].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let r = s.execute("type.retype", &json!({})).unwrap(); + let texts: Vec = r["texts"].as_array().unwrap().iter().map(|t| t.as_str().unwrap().to_owned()).collect(); + assert_eq!(texts.concat(), text, "split by the tracking, every letter still becomes type: {r}"); + assert!(texts.len() > 1, "the tracking splits the line: {r}"); + assert_eq!(r["unmatched"], json!([]), "{r}"); + } +} + +/// How long Retype takes on a few hundred CJK outlines at once (run with `--ignored --nocapture`; +/// skips when no large CJK font is installed). Not a pass/fail budget: it prints. +#[test] +#[ignore = "timing: needs an installed CJK font"] +fn timing_with_hundreds_of_cjk_outlines() { + let db = vectorcraft_text::FontDb::global(); + let Some(family) = ["Microsoft YaHei", "Yu Gothic", "MS Gothic", "Noto Sans CJK JP", "Hiragino Sans"].into_iter().find(|f| db.has_family(f)) + else { + eprintln!("skipped: no large CJK font installed"); + return; + }; + let face = db.resolve(family, "Regular").map(|(f, _)| f).unwrap(); + // 300 common ideographs, ten lines of thirty. + let chars: Vec = (0x4E00u32..).filter_map(char::from_u32).filter(|c| face.covers(*c)).take(300).collect(); + let mut s = session(); + let mut groups = vec![]; + for (i, line) in chars.chunks(30).enumerate() { + let text: String = line.iter().collect(); + groups.push(outlined(&mut s, json!({"x": 20, "y": 40 + 30 * i, "text": text, "size": 20, "font": family, "style": face.style}))); + } + for run in ["cold", "warm"] { + s.execute("select.set", &json!({"ids": groups})).unwrap(); + let t0 = std::time::Instant::now(); + let r = s.execute("type.retype", &json!({"fonts": [family]})).unwrap(); + let ms = t0.elapsed().as_secs_f64() * 1000.0; + let typed: usize = r["texts"].as_array().unwrap().iter().map(|t| t.as_str().unwrap().chars().count()).sum(); + eprintln!( + "{run}: Retype of {} {family} outlines: {ms:.0} ms → {typed} characters typed, {} unmatched", + chars.len(), + r["unmatched"].as_array().unwrap().len() + ); + s.execute("edit.undo", &json!({})).unwrap(); + } +} diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index 99844220f5..3c2a613b56 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -660,13 +660,7 @@ impl FontDb { if let Some(p) = self.outlines.lock().unwrap_or_else(|e| e.into_inner()).get(&key) { return p.clone(); } - let mut pen = FlipPen(BezPath::new()); - if let Some(f) = face.skrifa() - && let Some(g) = f.outline_glyphs().get(GlyphId::new(gid)) - { - let _ = g.draw(DrawSettings::unhinted(Size::unscaled(), face.location()), &mut pen); - } - let p = Arc::new(pen.0); + let p = Arc::new(self.outline_uncached(face, gid)); let mut cache = self.outlines.lock().unwrap_or_else(|e| e.into_inner()); if cache.len() >= OUTLINE_CACHE_MAX { cache.clear(); diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs index 5ef5073909..b778ce47dd 100644 --- a/crates/text/src/retype.rs +++ b/crates/text/src/retype.rs @@ -42,6 +42,8 @@ const OUTLINE_TOLERANCE: f64 = 5e-3; const MAX_OUTLINE_POINTS: usize = 8192; /// Points along an outline past which the whole-outline check gives up (and so rejects). const MAX_CHECKED_POINTS: usize = 65_536; +/// The most glyphs one shape is reported to be ([`RetypeIndex::matches`]). +pub const MAX_CANDIDATES: usize = 16; /// How far apart two shapes' spread-to-length ratios may be and still be compared. const INVARIANT_SLACK: f64 = 0.02; @@ -62,6 +64,32 @@ pub struct GlyphMatch { pub residual: f64, /// How many contours the glyph has. pub contours: usize, + /// Other poses the glyph fits the shape in equally (a glyph that looks the same turned). + pub alts: Vec, +} + +/// Where and how a glyph lies: its size, turn and origin. +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct Pose { + /// Document units per font unit. + pub scale: f64, + /// Radians, as [`kurbo::Affine::rotate`] turns. + pub angle: f64, + /// Where the glyph's origin lies. + pub origin: Point, +} + +impl GlyphMatch { + /// This match in each pose it fits: its own first, then [`Self::alts`]. + pub fn poses(&self) -> impl Iterator + '_ { + let own = Pose { scale: self.scale, angle: self.angle, origin: self.origin }; + std::iter::once(own).chain(self.alts.iter().copied()).map(move |p| GlyphMatch { + scale: p.scale, + angle: p.angle, + origin: p.origin, + ..self.clone() + }) + } } /// A shape reduced for matching: points along each contour, centred. @@ -152,8 +180,12 @@ impl RetypeIndex { self.entries.is_empty() } - /// The glyphs `shape` (in document space) is, the closest one per face, closest first; empty - /// when it is no glyph of the indexed faces. + /// The glyphs `shape` (in document space) is: every glyph that fits it exactly, upright ones + /// first, then the closest; empty when it is no glyph of the indexed faces. One shape can be + /// several glyphs: an L, and a turned L (U+A780) turned half round; a u, and an n upside down. + /// A glyph that looks the same turned (an I, an O, a hyphen) also fits in more than one pose: + /// the upright-most comes first and the others are kept in [`GlyphMatch::alts`]. The line + /// around the shape chooses among them. At most [`MAX_CANDIDATES`]. pub fn matches(&self, shape: &BezPath) -> Vec { let variants = signatures(shape, true); let Some(first) = variants.first() else { return vec![] }; @@ -161,53 +193,70 @@ impl RetypeIndex { let lo = first.invariant * (1.0 - INVARIANT_SLACK); let hi = first.invariant * (1.0 + INVARIANT_SLACK); let start = list.partition_point(|i| self.entries.get(*i).is_some_and(|e| e.sig.invariant < lo)); - let mut best: HashMap = HashMap::new(); + let tol = first.spread * OUTLINE_TOLERANCE; + // The shape flattened for the whole-outline check, once, when a glyph first gets that far. + let mut shape_flat: Option> = None; + let mut out: Vec<(usize, GlyphMatch)> = vec![]; for i in list.iter().skip(start) { let Some(e) = self.entries.get(*i) else { continue }; if e.sig.invariant > hi { break; } - // The reading of the shape (its tied starting corners) that fits the glyph best. - let Some((sig, z, residual)) = variants.iter().filter_map(|s| fit(&e.sig, s).map(|(z, r)| (s, z, r))).min_by(|a, b| a.2.total_cmp(&b.2)) - else { - continue; - }; - if residual > TOLERANCE { - continue; - } let Some(face) = self.faces.get(e.face) else { continue }; - // The glyph's origin is (0, 0) in font units: it lands at centre − z·glyph centre. - let gc = mul(z, e.sig.centre); - let origin = Point::new(sig.centre.x - gc.x, sig.centre.y - gc.y); - // The samples can step over a detail (a notch between two of them): the whole outline, - // turned onto the shape, must lie on it. - let onto = Affine::new([z.0, z.1, -z.1, z.0, origin.x, origin.y]); - if !outlines_agree(&(onto * e.outline.clone()), shape, sig.spread * OUTLINE_TOLERANCE) { - continue; + // Each reading of the shape (its tied starting corners) that fits the glyph is a pose. + let mut poses: Vec<(Pose, f64)> = vec![]; + for sig in &variants { + let Some((z, residual)) = fit(&e.sig, sig) else { continue }; + if residual > TOLERANCE { + continue; + } + // The glyph's origin is (0, 0) in font units: it lands at centre − z·glyph centre. + let gc = mul(z, e.sig.centre); + let pose = Pose { scale: z.0.hypot(z.1), angle: z.1.atan2(z.0), origin: Point::new(sig.centre.x - gc.x, sig.centre.y - gc.y) }; + if poses.iter().any(|(p, _)| wrapped(p.angle - pose.angle).abs() < 1e-6) { + continue; + } + // The samples can step over a detail (a notch between two of them): the whole + // outline, turned onto the shape, must lie on it. + let flat = shape_flat.get_or_insert_with(|| Flat::new(shape, tol)); + let Some(flat) = flat.as_ref() else { break }; + let onto = Affine::new([z.0, z.1, -z.1, z.0, pose.origin.x, pose.origin.y]); + if !Flat::new(&(onto * e.outline.clone()), tol).is_some_and(|g| g.agrees(flat)) { + continue; + } + poses.push((pose, residual)); } + // The upright-most pose first. + poses.sort_by(|a, b| wrapped(a.0.angle).abs().total_cmp(&wrapped(b.0.angle).abs())); + let Some(((pose, _), rest)) = poses.split_first() else { continue }; + let residual = poses.iter().map(|(_, r)| *r).fold(f64::INFINITY, f64::min); let m = GlyphMatch { face: face.clone(), gid: e.gid, ch: e.ch, - scale: z.0.hypot(z.1), - angle: z.1.atan2(z.0), - origin, + scale: pose.scale, + angle: pose.angle, + origin: pose.origin, residual, contours: e.sig.contours, + alts: rest.iter().map(|(p, _)| *p).collect(), }; - match best.get(&e.face) { - Some(b) if b.residual < m.residual || (b.residual == m.residual && b.ch <= m.ch) => {} - _ => { - best.insert(e.face, m); - } - } + out.push((e.face, m)); } - let mut out: Vec<(usize, GlyphMatch)> = best.into_iter().collect(); - out.sort_by(|a, b| a.1.residual.total_cmp(&b.1.residual).then(a.0.cmp(&b.0))); + let upright = |m: &GlyphMatch| wrapped(m.angle).abs() >= 1e-3; + out.sort_by(|a, b| { + upright(&a.1).cmp(&upright(&b.1)).then(a.1.residual.total_cmp(&b.1.residual)).then(a.0.cmp(&b.0)).then(a.1.ch.cmp(&b.1.ch)) + }); + out.truncate(MAX_CANDIDATES); out.into_iter().map(|(_, m)| m).collect() } } +/// `a` wrapped into −π..π. +fn wrapped(a: f64) -> f64 { + (a + std::f64::consts::PI).rem_euclid(std::f64::consts::TAU) - std::f64::consts::PI +} + /// A face's glyphs as the index looks them up: (glyph, character, [`shape_key`]), one per glyph /// under the lowest character that maps to it. type FaceKeys = Arc>; @@ -308,17 +357,38 @@ fn fit(g: &Signature, s: &Signature) -> Option<((f64, f64), f64)> { rel.is_finite().then_some((z, rel)) } -/// Do outlines `a` and `b` (in one space) lie on each other: every point of each, flattened, within -/// `tol` of the other? `false` when either is too large to check. -fn outlines_agree(a: &BezPath, b: &BezPath, tol: f64) -> bool { - if !tol.is_finite() || tol <= 0.0 { - return false; - } - let flat = |p: &BezPath| -> Option> { +/// An outline flattened for the whole-outline check: its segments, points along them (every +/// corner, and points twice `tol` apart between corners: a detail narrower than that has corners +/// of its own), and a uniform grid listing each segment under every cell its box, grown by `tol`, +/// touches, so whether a point lies within `tol` of the outline is asked of the few segments +/// around it. +struct Flat { + segs: Vec<(Point, Point)>, + pts: Vec, + origin: Point, + cell: f64, + cols: usize, + rows: usize, + /// Segment indices per cell, row by row. + cells: Vec>, + tol: f64, +} + +impl Flat { + /// Cells along the longer side, at most. + const MAX_SIDE: f64 = 48.0; + /// Segment listings in all, at most: past it (or past [`MAX_OUTLINE_POINTS`] segments or + /// [`MAX_CHECKED_POINTS`] points), `None`, and so no match. + const MAX_LISTINGS: usize = 1 << 18; + + fn new(path: &BezPath, tol: f64) -> Option { + if !tol.is_finite() || tol <= 0.0 { + return None; + } let mut segs = vec![]; let (mut start, mut last) = (Point::ZERO, Point::ZERO); let mut too_many = false; - kurbo::flatten(p.iter(), tol / 4.0, |el| { + kurbo::flatten(path.iter(), tol / 2.0, |el| { if segs.len() > MAX_OUTLINE_POINTS { too_many = true; return; @@ -336,26 +406,73 @@ fn outlines_agree(a: &BezPath, b: &BezPath, tol: f64) -> bool { _ => {} } }); - (!too_many).then_some(segs) - }; - let (Some(sa), Some(sb)) = (flat(a), flat(b)) else { return false }; - let near = |p: Point, segs: &[(Point, Point)]| segs.iter().any(|(s, e)| Line::new(*s, *e).nearest(p, 1e-9).distance_sq <= tol * tol); - // Points along every edge, not only its ends: two outlines with the same corners joined in - // another order differ between them. Spaced `tol` apart; past the work limit, not a match. - let along = |segs: &[(Point, Point)]| -> Option> { + if too_many { + return None; + } let mut pts = vec![]; - for (s, e) in segs { - let steps = (s.distance(*e) / tol).ceil(); + for (s, e) in &segs { + let steps = (s.distance(*e) / (2.0 * tol)).ceil(); if !steps.is_finite() || pts.len() as f64 + steps > MAX_CHECKED_POINTS as f64 { return None; } let steps = (steps as usize).max(1); pts.extend((0..steps).map(|i| s.lerp(*e, i as f64 / steps as f64))); } - Some(pts) - }; - let (Some(pa), Some(pb)) = (along(&sa), along(&sb)) else { return false }; - pa.iter().all(|p| near(*p, &sb)) && pb.iter().all(|p| near(*p, &sa)) + let (first, _) = segs.first()?; + let mut bb = kurbo::Rect::from_points(*first, *first); + for (s, e) in &segs { + bb = bb.union_pt(*s).union_pt(*e); + } + let bb = bb.inflate(tol, tol); + let cell = (bb.width().max(bb.height()) / Self::MAX_SIDE).max(2.0 * tol); + if !cell.is_finite() || cell <= 0.0 { + return None; + } + let at = |v: f64, o: f64| (((v - o) / cell).floor().max(0.0) as usize).min(Self::MAX_SIDE as usize); + let (cols, rows) = (at(bb.x1, bb.x0) + 1, at(bb.y1, bb.y0) + 1); + let mut cells: Vec> = vec![vec![]; cols * rows]; + let mut listings = 0usize; + for (i, (s, e)) in segs.iter().enumerate() { + let r = kurbo::Rect::from_points(*s, *e).inflate(tol, tol); + for cy in at(r.y0, bb.y0)..=at(r.y1, bb.y0).min(rows - 1) { + for cx in at(r.x0, bb.x0)..=at(r.x1, bb.x0).min(cols - 1) { + listings += 1; + if listings > Self::MAX_LISTINGS { + return None; + } + if let Some(c) = cells.get_mut(cy * cols + cx) { + c.push(u32::try_from(i).ok()?); + } + } + } + } + Some(Flat { segs, pts, origin: Point::new(bb.x0, bb.y0), cell, cols, rows, cells, tol }) + } + + /// Does `p` lie within `tol` of a segment? + fn near(&self, p: Point) -> bool { + let (fx, fy) = ((p.x - self.origin.x) / self.cell, (p.y - self.origin.y) / self.cell); + if !(fx >= 0.0 && fy >= 0.0) || fx >= self.cols as f64 || fy >= self.rows as f64 { + return false; + } + let (cx, cy) = (fx as usize, fy as usize); + let tol2 = self.tol * self.tol; + self.cells.get(cy * self.cols + cx).is_some_and(|list| { + list.iter().filter_map(|i| self.segs.get(*i as usize)).any(|(s, e)| Line::new(*s, *e).nearest(p, 1e-9).distance_sq <= tol2) + }) + } + + /// Do the two outlines lie on each other: every point of each within `tol` of the other? + fn agrees(&self, other: &Flat) -> bool { + self.pts.iter().all(|p| other.near(*p)) && other.pts.iter().all(|p| self.near(*p)) + } +} + +/// Do outlines `a` and `b` (in one space) lie on each other: every point of each, flattened, within +/// `tol` of the other? `false` when either is too large to check. +#[cfg(test)] +fn outlines_agree(a: &BezPath, b: &BezPath, tol: f64) -> bool { + matches!((Flat::new(a, tol), Flat::new(b, tol)), (Some(fa), Some(fb)) if fa.agrees(&fb)) } /// `seg` as a line when it is one (a curve with its handles on its ends or on its line), else as it is. From 4fe27f830cb373bfd80a9929f2eac955ac48a05e Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 19:39:40 +0530 Subject: [PATCH 148/158] M7/G4: retype bounds readings tried and glyphs laid out (#4934) Readings of a shape are capped by those tried, not those kept, so a shape whose every reading fails stops at the cap. The layout check grows a window from each line start, doubling while the type draws the outlines, and starts the next line at a mismatch, so a line split at every glyph costs about twice its glyphs, not half their square; a glyph budget leaves anything past it as outlines. A tracked line of 450 glyphs: 259 ms. --- crates/engine/src/cmd/retype.rs | 74 +++++++++++++++++++-------- crates/engine/src/cmd/retype_tests.rs | 19 +++++++ crates/text/src/retype.rs | 26 +++++++++- 3 files changed, 95 insertions(+), 24 deletions(-) diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index 2ce951f812..b3a19862da 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -299,31 +299,61 @@ impl Line { /// `lines` checked against their own layout: a line splits where its type stops drawing the /// outlines, and a glyph its type cannot draw even on its own stays an outline (`unmatched`). -/// The layouts are bounded by the number of glyphs. +/// The glyphs laid out are bounded by a multiple of the number of glyphs. fn verified(lines: Vec, system_layout: bool, unmatched: &mut Vec) -> Vec { - let mut budget = lines.iter().map(|l| l.pieces.len() * 2 + 2).sum::(); - let mut todo: std::collections::VecDeque = lines.into(); + // Glyphs laid out in all, at most: past it, the glyphs left unchecked stay outlines. + let mut budget = lines.iter().map(|l| l.pieces.len()).sum::().saturating_mul(8).saturating_add(256); let mut out = vec![]; - while let Some(l) = todo.pop_front() { - if budget == 0 { - // Unchecked glyphs stay outlines. - unmatched.extend(l.pieces); - continue; - } - budget -= 1; + for l in lines { let n = l.pieces.len(); - match l.first_mismatch(&l.text_object(system_layout)) { - None => out.push(l), - // The first glyph on its own may still be drawn as it was (a contextual form changed it). - Some(0) if n > 1 => { - for part in [l.part(1, n), l.part(0, 1)].into_iter().flatten() { - todo.push_front(part); - } - } - Some(0) => unmatched.extend(l.pieces.first().copied()), - Some(k) => { - for part in [l.part(k, n), l.part(0, k)].into_iter().flatten() { - todo.push_front(part); + // Each new line starts at `s`. Its type is laid out over a window from `s` that doubles + // while the type draws the window's glyphs as the outlines do, so finding where it stops + // costs about twice the glyphs before that point, not the whole rest of the line each time. + let mut s = 0; + while s < n { + let mut w = 8usize; + loop { + let e = n.min(s.saturating_add(w)); + let Some(part) = l.part(s, e) else { + s = n; + break; + }; + let Some(left) = budget.checked_sub(e - s) else { + // Unchecked glyphs stay outlines. + unmatched.extend(l.pieces.get(s..).unwrap_or_default().iter().copied()); + s = n; + break; + }; + budget = left; + match part.first_mismatch(&part.text_object(system_layout)) { + // The rest of the line is drawn as it was: one object. + None if e == n => { + out.push(part); + s = n; + break; + } + None => w = w.saturating_mul(2), + // The first glyph on its own may still be drawn as it was (a contextual form + // changed it in the line); else it stays an outline. + Some(0) => { + let alone = if e - s > 1 { l.part(s, s + 1) } else { Some(part) }; + match alone { + Some(a) if budget > 0 && a.first_mismatch(&a.text_object(system_layout)).is_none() => { + budget -= 1; + out.push(a); + } + _ => unmatched.extend(l.pieces.get(s).copied()), + } + s += 1; + break; + } + // The glyphs before the mismatch are drawn as they were: one object; the next + // line starts at the mismatch. + Some(k) => { + out.extend(l.part(s, s + k)); + s += k; + break; + } } } } diff --git a/crates/engine/src/cmd/retype_tests.rs b/crates/engine/src/cmd/retype_tests.rs index 98736c5a4f..d691ab34fa 100644 --- a/crates/engine/src/cmd/retype_tests.rs +++ b/crates/engine/src/cmd/retype_tests.rs @@ -518,3 +518,22 @@ fn timing_with_hundreds_of_cjk_outlines() { s.execute("edit.undo", &json!({})).unwrap(); } } + +#[test] +fn a_long_tracked_line_is_checked_in_time() { + // Tracking splits the line at every glyph: the layout check must not lay out the rest of the + // line again after each split. + let text = "abe".repeat(150); + let mut s = session(); + let id = s.execute("text.create", &json!({"x": 10, "y": 100, "text": text, "size": 4})).unwrap()["id"].as_u64().unwrap(); + s.execute("text.setRangeStyle", &json!({"id": id, "start": 0, "end": text.len(), "tracking": 50})).unwrap(); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + let g = s.execute("type.createOutlines", &json!({})).unwrap()["ids"][0].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [g]})).unwrap(); + let t0 = std::time::Instant::now(); + let r = s.execute("type.retype", &json!({})).unwrap(); + let texts: Vec = r["texts"].as_array().unwrap().iter().map(|t| t.as_str().unwrap().to_owned()).collect(); + assert_eq!(texts.concat(), text); + assert_eq!(r["unmatched"], json!([])); + eprintln!("450 tracked glyphs: {:?}, {} objects", t0.elapsed(), texts.len()); +} diff --git a/crates/text/src/retype.rs b/crates/text/src/retype.rs index b778ce47dd..4c636aa1cd 100644 --- a/crates/text/src/retype.rs +++ b/crates/text/src/retype.rs @@ -590,7 +590,7 @@ pub fn shape_key(path: &BezPath) -> Option { /// `path` read for matching: one reading per choice of starting corners (the corner of each contour /// farthest from the centre of all the shape's corners; every tied corner when `all_ties`, else the -/// first), at most [`MAX_VARIANTS`]. Empty for a shape with nothing to match. +/// first), at most [`MAX_VARIANTS`] tried. Empty for a shape with nothing to match. fn signatures(path: &BezPath, all_ties: bool) -> Vec { let bounds = path.bounding_box(); let size = bounds.width().hypot(bounds.height()); @@ -629,10 +629,14 @@ fn signatures(path: &BezPath, all_ties: bool) -> Vec { .collect(); let mut out = vec![]; let mut pick = vec![0usize; cs.len()]; + // Readings tried, kept or not: a shape whose readings all fail (its sums run past what f64 + // holds) tries no more than this either. + let mut tried = 0usize; loop { - if out.len() >= MAX_VARIANTS { + if tried >= MAX_VARIANTS { break; } + tried += 1; if let Some(sig) = sample(&cs, &starts, &pick, accuracy) { out.push(sig); } @@ -870,6 +874,24 @@ mod tests { assert!(outlines_agree(&out, &out, tol)); } + #[test] + fn readings_that_all_fail_stop_at_the_cap() { + // 48 concentric squares (four tied corners each: 4^48 choices) so large that every reading + // overflows: the tries stop at the cap instead of running through the choices. + let mut p = BezPath::new(); + for i in 1..=48 { + let r = 1e153 * f64::from(i); + p.move_to((-r, -r)); + p.line_to((r, -r)); + p.line_to((r, r)); + p.line_to((-r, r)); + p.close_path(); + } + let t0 = std::time::Instant::now(); + assert!(signatures(&p, true).is_empty()); + assert!(t0.elapsed() < std::time::Duration::from_secs(5), "{:?}", t0.elapsed()); + } + #[test] fn the_same_corners_joined_another_way_are_another_outline() { let poly = |pts: &[(f64, f64)]| { From b0e4302b64591b6a141d1aa90f8a6382e1a5c791 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 06:27:31 -0800 Subject: [PATCH 149/158] MCP: transform's schema accepts the null arguments it already takes The transform tool treats a null reflect, copy or origin, and a null numeric step, as given, but its inputSchema allowed only the non-null types, so a client that validates against the schema could not send them. Each of those properties now also allows null. The transform row in docs/mcp.md says a step that is neither a number nor null is an error, and that a null dx or dy counts as 0 and still runs the move. --- crates/mcp/src/tests.rs | 8 ++++++++ crates/mcp/src/tools/definitions.rs | 25 +++++++++++++++---------- docs/mcp.md | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/crates/mcp/src/tests.rs b/crates/mcp/src/tests.rs index 2c16587227..58c9c42e45 100644 --- a/crates/mcp/src/tests.rs +++ b/crates/mcp/src/tests.rs @@ -1692,6 +1692,14 @@ fn transform_rejects_a_mistyped_reflect_copy_or_origin_before_editing() { assert_eq!(applied["isError"], false, "{applied}"); let applied: Value = serde_json::from_str(&text_of(&applied)).unwrap(); assert_eq!(applied["applied"], json!(["move"])); + let applied = call(&mut s, 21, "transform", json!({"ids": [second], "rotate": 90, "origin": null})); + assert_eq!(applied["isError"], false, "{applied}"); + // The schema allows null for every argument but `ids`. + let tools = tool_definitions(); + let props = &tools.iter().find(|t| t["name"] == "transform").unwrap()["inputSchema"]["properties"]; + for key in ["dx", "dy", "rotate", "scale", "scaleX", "scaleY", "shear", "reflect", "copy", "origin"] { + assert!(props[key]["anyOf"].as_array().is_some_and(|a| a.contains(&json!({"type": "null"}))), "{key}: {}", props[key]); + } } #[test] diff --git a/crates/mcp/src/tools/definitions.rs b/crates/mcp/src/tools/definitions.rs index 642f65fbfe..ce9cac1e02 100644 --- a/crates/mcp/src/tools/definitions.rs +++ b/crates/mcp/src/tools/definitions.rs @@ -8,6 +8,11 @@ fn num(desc: &str) -> Value { json!({"type": "number", "description": desc}) } +/// A number or null. +fn num_or_null(desc: &str) -> Value { + json!({"description": desc, "anyOf": [{"type": "number"}, {"type": "null"}]}) +} + fn string(desc: &str) -> Value { json!({"type": "string", "description": desc}) } @@ -470,16 +475,16 @@ pub fn tool_definitions() -> Vec { obj( json!({ "ids": {"type": "array", "items": {"type": "integer"}}, - "dx": num("Move right"), - "dy": num("Move down"), - "rotate": num("Rotation in degrees counter-clockwise"), - "scale": num("Uniform scale in %"), - "scaleX": num("Horizontal scale in %"), - "scaleY": num("Vertical scale in %"), - "reflect": {"type": "string", "enum": ["vertical", "horizontal"]}, - "shear": num("Shear angle in degrees (horizontal axis: positive moves the top to the right, turning the vertical edges clockwise)"), - "origin": {"type": "array", "items": {"type": "number"}, "minItems": 2, "maxItems": 2}, - "copy": {"type": "boolean"}, + "dx": num_or_null("Move right (null: 0)"), + "dy": num_or_null("Move down (null: 0)"), + "rotate": num_or_null("Rotation in degrees counter-clockwise"), + "scale": num_or_null("Uniform scale in %"), + "scaleX": num_or_null("Horizontal scale in %"), + "scaleY": num_or_null("Vertical scale in %"), + "reflect": {"anyOf": [{"type": "string", "enum": ["vertical", "horizontal"]}, {"type": "null"}]}, + "shear": num_or_null("Shear angle in degrees (horizontal axis: positive moves the top to the right, turning the vertical edges clockwise)"), + "origin": {"anyOf": [{"type": "array", "items": {"type": "number"}, "minItems": 2, "maxItems": 2}, {"type": "null"}]}, + "copy": {"anyOf": [{"type": "boolean"}, {"type": "null"}]}, }), &[], ), diff --git a/docs/mcp.md b/docs/mcp.md index 8fbc770ca7..0e9a6d202d 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -724,7 +724,7 @@ ends the wait, so the sampler can be shown again. The BSDs and headless sessions | `add_text` | `{text, x?, y?, width?, height?, fit?, fitMinPercent?, path?, mode?, pathEffect?, size?, font?, color?, justify?, vertical?}` | Point type at (x, y) (`justify`: `left`, `center` or `right` starts, centres or ends each line on x); area type with `width`/`height` (`fit`: `none`, `autoHeight`, `shrinkText`, as `text.areaOptions`); or `path` + `mode` (`area`/`onPath`) to flow text in or along a path, with `pathEffect` for type on a path (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`; SVG export writes type on a path with any effect other than `rainbow` as outlines, with a warning). An invalid effect is rejected before editing. `justify` (also `auto`, `justifyAll`) aligns the paragraphs of every kind, as `text.setStyle` does later. `vertical: true` uses the existing vertical writing mode for every kind (default `false`, horizontal). Returns `{id}`, with `overflow: true` when the text doesn't fit its frame or path. | | `apply_effect` | `{effect?, params?, ids?}` | Appends a live effect. Without `effect`, returns the effect catalogue with parameters and defaults. | | `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). In remote desktop mode, `run_command` and `invoke_menu` can both call `pathfinder.repeat` with `{}`. Successful panel operations, direct `object.pathfinder.*` commands, and `command.batch` steps (including Actions panel playback) set its history. Repeat applies it to the current selection using current Pathfinder Options. Trap, compound-shape edits, live effects and `action.batch` do not set history. With no history it returns "no Pathfinder operation applied yet". | -| `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. `rotate` is in degrees counter-clockwise; a positive `shear` moves the top to the right. With `copy`, the first step duplicates. A `scale`, `reflect` or `shear` that its command would refuse returns that error before any step runs; nothing changes and no undo step is recorded. The same holds for a step that is not a number, a `reflect` that is not a string, a `copy` that is not true or false, and an `origin` that is not two numbers; a null `reflect`, `copy` or `origin` is left out. | +| `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. `rotate` is in degrees counter-clockwise; a positive `shear` moves the top to the right. With `copy`, the first step duplicates. A `scale`, `reflect` or `shear` that its command would refuse returns that error before any step runs; nothing changes and no undo step is recorded. The same holds for a step that is neither a number nor null, a `reflect` that is not a string, a `copy` that is not true or false, and an `origin` that is not two numbers. A null `rotate`, `scale`, `scaleX`, `scaleY`, `shear`, `reflect`, `copy` or `origin` is left out; a null `dx` or `dy` counts as 0, so it still runs the move. | | `create_graph` | `{type?, x, y, width, height, csv? \| series?, categories?, rows?}` | The nine Illustrator graph types: column, stacked column, bar, stacked bar, line, area, scatter, pie and radar. An empty CSV cell or a `null` in `rows` is a blank value; a number in straight quotes is a label. Edit later with `graph.setData` / `graph.setType` via `run_command`. `graph.column {design, columnType: vertical\|uniform\|repeating\|sliding, each, fractions: chop\|scale}` draws the columns or bars of the series picked with Group Selection (or `seriesIndexes`, or all of them) with a graph design saved by `graph.design`; with no `design` it returns the series' current design and options. Type in the design that holds a `%` followed by two digits shows each column's value, with at least the first digit's places before the decimal point and the second digit's places after it. | | `text_wrap` | `{ids?, offset?, invert?, release?}` | Area type below the objects (same layer) flows around them. `offset` is in points, from -1000 to 1000 (default 6). An offset outside that range or not a number, or an `invert` or `release` that is not true or false, is an error and changes nothing; `object.textWrap.make` and `object.textWrap.options` refuse the same values. | | `undo` / `redo` | `{}` | Many calls that change nothing record no undo step, for example `object.align` with nothing to move, `object.move` by 0 without `copy` and `object.showAll` with nothing hidden. `undo` (`edit.undo`) after such a call undoes the step before it. Settings that change without an undo step stay as they are when `undo` or `redo` brings back a step that did not change them: the perspective grid's view options and active plane, the grid preferences (`gridlineEvery`, `gridSubdivisions`), the export settings (`assets.settings.set`), and the current brush and symbol. A step that changed one of them, such as a perspective grid preset that shows the grid, takes that change back. The point Automatic Plane Positioning holds comes back with the step, and is let go when the active plane kept is another one. `inspect_document` lists the undo steps as `history`. `run_command` with `edit.clearHistory` removes every undo and redo step of the active document and returns `{cleared}`, the number of steps removed; the document stays as it is, and the command records no undo step. `run_command` with `edit.newDocumentFromState` and `{index?, created?}` makes a new document holding the art as it was at that state and makes it the active document, and returns `{index, title}`. `index` is a row of the History panel, with 0 the oldest state kept, and an omitted or null `index` uses the current state. An `index` that names no state fails with `no history state N`, one that is not a whole number with `` `index` must be a whole number ``, and either changes nothing. `created` is File Info's created date in Unix seconds or null, and defaults to now. The new document takes the next `Untitled-N` name, is marked unsaved, has nothing selected and has no steps to undo or redo. It is out of symbol, opacity-mask and pattern editing, and the art drawn in a pattern's tile is stored in the pattern, as `object.pattern.done` stores it. The source document and its steps stay as they are, except that typing or a drag in progress is first kept as a step. When a command keeps a drag whose preview Real-time Drawing off had not applied yet (`edit.undo`, `edit.redo`, `edit.clearHistory`, `edit.newDocumentFromState` and the other commands that end a drag first), and applying that preview gives a warning, the command's result carries it as `previewWarning`, and as `warning` too when the command gives no warning of its own; the app's status bar shows `warning`. While the Type tool edits type, `undo` and `redo` put its caret, with no characters selected, at the end of the text the step changed: after the text it puts back or retypes, or where the text it takes out was. A step that changes no characters, such as a formatting change, leaves the caret and the selection where they are. | From db525996f0bee66e041c53df40971d26bfbb6077 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Wed, 18 Nov 2026 20:05:47 +0530 Subject: [PATCH 150/158] M7/G4: retype checks the part before a mismatch on its own (#4934) A font can place a glyph by the glyph after it, so the glyphs before a mismatch are laid out again as a line of their own before they replace their outlines. The glyph budget covers that second check. --- crates/engine/src/cmd/retype.rs | 100 +++++++++++++++++--------------- 1 file changed, 52 insertions(+), 48 deletions(-) diff --git a/crates/engine/src/cmd/retype.rs b/crates/engine/src/cmd/retype.rs index b3a19862da..23774aaaa7 100644 --- a/crates/engine/src/cmd/retype.rs +++ b/crates/engine/src/cmd/retype.rs @@ -302,58 +302,47 @@ impl Line { /// The glyphs laid out are bounded by a multiple of the number of glyphs. fn verified(lines: Vec, system_layout: bool, unmatched: &mut Vec) -> Vec { // Glyphs laid out in all, at most: past it, the glyphs left unchecked stay outlines. - let mut budget = lines.iter().map(|l| l.pieces.len()).sum::().saturating_mul(8).saturating_add(256); + let mut budget = lines.iter().map(|l| l.pieces.len()).sum::().saturating_mul(16).saturating_add(256); + let mut todo: std::collections::VecDeque = lines.into(); let mut out = vec![]; - for l in lines { + while let Some(l) = todo.pop_front() { let n = l.pieces.len(); - // Each new line starts at `s`. Its type is laid out over a window from `s` that doubles - // while the type draws the window's glyphs as the outlines do, so finding where it stops - // costs about twice the glyphs before that point, not the whole rest of the line each time. - let mut s = 0; - while s < n { - let mut w = 8usize; - loop { - let e = n.min(s.saturating_add(w)); - let Some(part) = l.part(s, e) else { - s = n; + // The line's type is laid out over a window from its start that doubles while the type + // draws the window's glyphs as the outlines do, so finding where it stops costs about + // twice the glyphs before that point, not the whole rest of the line each time. + let mut w = 8usize; + loop { + let e = n.min(w); + let Some(part) = l.part(0, e) else { break }; + let Some(left) = budget.checked_sub(e) else { + // Unchecked glyphs stay outlines. + unmatched.extend(l.pieces.iter().copied()); + break; + }; + budget = left; + match part.first_mismatch(&part.text_object(system_layout)) { + // The whole line is drawn as it was: one object. + None if e == n => { + out.push(part); break; - }; - let Some(left) = budget.checked_sub(e - s) else { - // Unchecked glyphs stay outlines. - unmatched.extend(l.pieces.get(s..).unwrap_or_default().iter().copied()); - s = n; + } + None => w = w.saturating_mul(2), + // The first glyph on its own may still be drawn as it was (a contextual form + // changed it in the line); else it stays an outline. Checked again either way. + Some(0) if n > 1 => { + todo.extend_front_parts(&l, [(0, 1), (1, n)]); + break; + } + Some(0) => { + unmatched.extend(l.pieces.first().copied()); + break; + } + // The glyphs before the mismatch, then the rest, each checked as a line of its + // own: the type before the mismatch may draw otherwise without what follows it (a + // font can place a glyph by the glyph after it). + Some(k) => { + todo.extend_front_parts(&l, [(0, k), (k, n)]); break; - }; - budget = left; - match part.first_mismatch(&part.text_object(system_layout)) { - // The rest of the line is drawn as it was: one object. - None if e == n => { - out.push(part); - s = n; - break; - } - None => w = w.saturating_mul(2), - // The first glyph on its own may still be drawn as it was (a contextual form - // changed it in the line); else it stays an outline. - Some(0) => { - let alone = if e - s > 1 { l.part(s, s + 1) } else { Some(part) }; - match alone { - Some(a) if budget > 0 && a.first_mismatch(&a.text_object(system_layout)).is_none() => { - budget -= 1; - out.push(a); - } - _ => unmatched.extend(l.pieces.get(s).copied()), - } - s += 1; - break; - } - // The glyphs before the mismatch are drawn as they were: one object; the next - // line starts at the mismatch. - Some(k) => { - out.extend(l.part(s, s + k)); - s += k; - break; - } } } } @@ -361,6 +350,21 @@ fn verified(lines: Vec, system_layout: bool, unmatched: &mut Vec) out } +/// Puts parts of a line at the front of the work list, in order. +trait FrontParts { + fn extend_front_parts(&mut self, l: &Line, ranges: [(usize, usize); N]); +} + +impl FrontParts for std::collections::VecDeque { + fn extend_front_parts(&mut self, l: &Line, ranges: [(usize, usize); N]) { + for (a, b) in ranges.into_iter().rev() { + if let Some(p) = l.part(a, b) { + self.push_front(p); + } + } + } +} + fn space_advance(face: &vectorcraft_text::FontFace) -> f64 { face.mapped_chars().iter().find(|(c, _)| *c == ' ').map(|(_, g)| face.advance(*g)).unwrap_or(0.0) } From 38bceaa22a8a23308dd95d8f17c03dd9a62f57b4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 06:38:30 -0800 Subject: [PATCH 151/158] Command Palette: the catalog check reports a word two search rows add to different groups A catalog's search rows are now checked together: a word that two rows add to different groups fails the i18n test, naming the word and both groups. A word repeated for one group, and a catalog with no search rows, still pass. --- crates/ui-egui/src/i18n/tests.rs | 9 ++++---- crates/ui-egui/src/palette/words.rs | 33 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 1ef955c627..9e3cf16398 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -805,16 +805,15 @@ fn anti_aliasing_method_labels_are_in_complete_catalogs() { } /// Each row in the `search` context, which adds a language's words to a group of words with the same -/// meaning for the command palette, names a group and adds single words of no other group. No -/// catalog has to have these rows. +/// meaning for the command palette, names a group and adds single words of no other group, and no +/// two rows of a catalog add one word to different groups. No catalog has to have these rows. #[test] fn search_rows_name_a_group_and_add_single_words() { let mut bad = Vec::new(); for l in LANGUAGES.iter().filter(|l| !l.source.is_empty()) { let (entries, _) = parse_entries(l.source); - for (_, src, tr) in entries.iter().filter(|(ctx, _, _)| ctx == crate::palette::words::CONTEXT) { - bad.extend(crate::palette::words::row_problems(src, tr).into_iter().map(|p| format!("{}: {p}", l.code))); - } + let rows = entries.iter().filter(|(ctx, _, _)| ctx == crate::palette::words::CONTEXT).map(|(_, src, tr)| (src.as_str(), tr.as_str())); + bad.extend(crate::palette::words::catalog_problems(rows).into_iter().map(|p| format!("{}: {p}", l.code))); } assert!(bad.is_empty(), "{bad:#?}"); } diff --git a/crates/ui-egui/src/palette/words.rs b/crates/ui-egui/src/palette/words.rs index 44176dbd24..86c03bfb8c 100644 --- a/crates/ui-egui/src/palette/words.rs +++ b/crates/ui-egui/src/palette/words.rs @@ -91,6 +91,27 @@ pub(crate) fn row_problems(source: &str, text: &str) -> Vec { problems } +/// What is wrong with one catalog's `search` rows, each a group's `source` and its translation +/// `text`: each row's [`row_problems`], and a word that rows add to two different groups. +#[cfg(test)] +pub(crate) fn catalog_problems<'a>(rows: impl IntoIterator) -> Vec { + let mut problems = vec![]; + let mut groups: std::collections::HashMap = std::collections::HashMap::new(); + for (source, text) in rows { + problems.extend(row_problems(source, text)); + for (w, _) in row_words(text).filter(|(_, single)| *single) { + match groups.get(w.as_str()) { + Some(&first) if first != source => problems.push(format!("{w:?} is a word of {first:?} and {source:?}")), + Some(_) => {} + None => { + groups.insert(w, source); + } + } + } + } + problems +} + #[cfg(test)] mod tests { use super::*; @@ -122,4 +143,16 @@ mod tests { assert_eq!(row_problems("remove, delete, erase, clear", "ganz entfernen").len(), 1, "two words"); assert_eq!(row_problems("remove, delete, erase, clear", "Text").len(), 1, "a word of another group once lowercased"); } + + /// A catalog's rows fail when they add one word to two groups, and pass when a word is repeated + /// for one group or the catalog has no rows. + #[test] + fn a_word_in_two_groups_of_a_catalog_is_checked() { + let (remove, artboard) = ("remove, delete, erase, clear", "artboard, canvas"); + let problems = catalog_problems([(remove, "retrait"), (artboard, "plan, Retrait")]); + assert_eq!(problems.len(), 1, "{problems:?}"); + assert!(problems.iter().all(|p| p.contains("retrait") && p.contains(remove) && p.contains(artboard)), "{problems:?}"); + assert!(catalog_problems([(remove, "retrait, retrait"), (remove, "Retrait"), (artboard, "plan")]).is_empty()); + assert!(catalog_problems([]).is_empty()); + } } From 269c6fced877a9eb7b6bd8f0a2dbdc064e4b3441 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 06:48:12 -0800 Subject: [PATCH 152/158] Save PDF: an unlinked edit keeps the bleed link off, and every bleed write sets it An edit to one side while the link is off now keeps it off when the four values become equal, so the next edit changes one side only. Writing `bleed` through ui.dialog.set lets the link follow the values each time, also when the same values are written again. --- crates/ui-egui/src/dialogs.rs | 2 +- crates/ui-egui/src/dialogs/save_pdf.rs | 16 ++++++++----- crates/ui-egui/src/dialogs/save_pdf/tests.rs | 24 ++++++++++++++++++++ 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 38626a8842..6224b271da 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -692,7 +692,7 @@ pub(crate) fn field_set(app: &mut VectorcraftApp, field: &str, old: Option<&Valu return composite_fonts::field_set(d, field); } if let Some(d) = app.ui.dialog.as_mut().filter(|d| d.kind == save_pdf::KIND || d.kind == save_pdf::PRESET_KIND) { - return save_pdf::field_set(d, field, old); + return save_pdf::field_set(d, field); } if let Some(d) = app.ui.dialog.as_mut().filter(|d| d.kind == eps_options::KIND) { eps_options::field_set(d, field); diff --git a/crates/ui-egui/src/dialogs/save_pdf.rs b/crates/ui-egui/src/dialogs/save_pdf.rs index 32dab2a445..85ff601db0 100644 --- a/crates/ui-egui/src/dialogs/save_pdf.rs +++ b/crates/ui-egui/src/dialogs/save_pdf.rs @@ -754,9 +754,13 @@ fn link_bleed(d: &mut Dialog, on: bool) { } } -/// Side `side` of the custom bleed was edited to `value`: linked, every side takes it. +/// Side `side` of the custom bleed was edited to `value`: linked, every side takes it. The link +/// keeps the state it had before the edit, so an unlinked edit that makes the sides equal leaves +/// it off. fn edit_bleed(d: &mut Dialog, side: usize, value: f64) { - if bleed_linked(d) { + let linked = bleed_linked(d); + d.fields.insert(BLEED_LINKED.into(), json!(linked)); + if linked { for p in BLEED_SIDES { set(d, p, json!(value)); } @@ -766,9 +770,9 @@ fn edit_bleed(d: &mut Dialog, side: usize, value: f64) { } /// `ui.dialog.set` set `field` of Save PDF or the PDF preset editor: `__bleedLinked` links or -/// unlinks the bleed as its button does, and must be true or false; a new `bleed` drops the link's -/// state, so the link follows the values set. -pub(super) fn field_set(d: &mut Dialog, field: &str, old: Option<&Value>) -> Result<(), String> { +/// unlinks the bleed as its button does, and must be true or false; every write of `bleed`, the +/// same values included, drops the link's state, so the link follows the values set. +pub(super) fn field_set(d: &mut Dialog, field: &str) -> Result<(), String> { match field { BLEED_LINKED => match d.fields.get(BLEED_LINKED).cloned() { Some(Value::Bool(on)) => { @@ -777,7 +781,7 @@ pub(super) fn field_set(d: &mut Dialog, field: &str, old: Option<&Value>) -> Res } v => Err(format!("{BLEED_LINKED} must be true or false, not {}", v.unwrap_or(Value::Null))), }, - "bleed" if d.fields.get("bleed") != old => { + "bleed" => { d.fields.remove(BLEED_LINKED); Ok(()) } diff --git a/crates/ui-egui/src/dialogs/save_pdf/tests.rs b/crates/ui-egui/src/dialogs/save_pdf/tests.rs index 10cfa57ce0..1f04c8c912 100644 --- a/crates/ui-egui/src/dialogs/save_pdf/tests.rs +++ b/crates/ui-egui/src/dialogs/save_pdf/tests.rs @@ -633,6 +633,30 @@ fn ui_dialog_set_links_the_bleed() { assert!(!d.fields.contains_key(BLEED_LINKED) && bleed_linked(d), "equal values set are linked"); set(&mut app, "bleed", json!({"top": 1, "bottom": 2, "left": 1, "right": 1})).unwrap(); assert!(!bleed_linked(app.ui.dialog.as_ref().unwrap()), "unequal values set are unlinked"); + + // Writing the same `bleed` again also lets the link follow its values; a `__bleedLinked` set + // after it in the same request still decides. + set(&mut app, "bleed", json!({"top": 1, "bottom": 1, "left": 1, "right": 1})).unwrap(); + set(&mut app, BLEED_LINKED, json!(false)).unwrap(); + set(&mut app, "bleed", json!({"top": 1, "bottom": 1, "left": 1, "right": 1})).unwrap(); + assert!(bleed_linked(app.ui.dialog.as_ref().unwrap()), "the same equal values set again are linked"); + set(&mut app, BLEED_LINKED, json!(false)).unwrap(); + let d = app.ui.dialog.as_ref().unwrap(); + assert!(!bleed_linked(d) && bleed_of(d) == [1.0; 4], "a later __bleedLinked unlinks them"); +} + +/// An unlinked edit that makes the four sides equal leaves the link off, so the next edit +/// changes one side only. +#[test] +fn an_unlinked_edit_that_evens_the_sides_keeps_the_link_off() { + let (mut app, _, _) = app(); + app.run("ui.savePdfDialog", json!({"bleed": {"top": 3, "bottom": 5, "left": 3, "right": 3}})).unwrap(); + let d = app.ui.dialog.as_mut().unwrap(); + assert!(!bleed_linked(d)); + edit_bleed(d, 1, 3.0); + assert!(!bleed_linked(d), "the link stays off"); + edit_bleed(d, 2, 6.0); + assert_eq!(bleed_of(d), [3.0, 3.0, 6.0, 3.0], "the next edit changes one side"); } #[test] From 585c0aaa70be212b8201ed41b560c2a7c51facf9 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 18 Nov 2026 21:52:24 +0700 Subject: [PATCH 153/158] fmt: reflow the fontdb lookup imports after #7877 --- crates/text/src/fontdb/lookup.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index b40001e380..3cf25abfe6 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -11,8 +11,8 @@ use super::names::{norm, norm_chars, script_families}; use super::scan::{enumerate_faces, font_files}; use super::traits::{Alias, FontMatch, FontTraits, regular_rank}; use super::{ - Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, FontDb, GlyphId, GlyphImage, MetadataProvider, NEXT_ID, OUTLINE_CACHE_MAX, - Ordering, Size, + Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, FontDb, GlyphId, GlyphImage, MetadataProvider, NEXT_ID, OUTLINE_CACHE_MAX, Ordering, + Size, }; /// The most faces [`FontDb::postscript_faces`] gives, and the most families it loads. From 11b6ae8203f28162883b1171e84e4de1b788fe7e Mon Sep 17 00:00:00 2001 From: bflatastic Date: Wed, 18 Nov 2026 22:02:41 +0700 Subject: [PATCH 154/158] text: pin craft-font-catalog to craft-libs main and restore the shared outline call --- Cargo.lock | 4 +++- crates/text/Cargo.toml | 4 ++-- crates/text/src/fontdb/lookup.rs | 12 ++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3fc5fec6c9..832dec20d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1047,12 +1047,14 @@ source = "git+https://github.com/storytold/craft-libs?rev=64b181977a0488e4d1e167 [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=d0a9c79933a54883cd5bc3dfe839f1dd699f2c69#d0a9c79933a54883cd5bc3dfe839f1dd699f2c69" +source = "git+https://github.com/storytold/craft-libs?rev=23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3#23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3" dependencies = [ "harfrust 0.13.3", "kurbo 0.13.1", "skrifa 0.47.0", "thiserror 2.0.21", + "unicode-bidi", + "unicode-segmentation", "windows-registry", ] diff --git a/crates/text/Cargo.toml b/crates/text/Cargo.toml index da69b80a29..c0fc17876a 100644 --- a/crates/text/Cargo.toml +++ b/crates/text/Cargo.toml @@ -9,8 +9,8 @@ description = "VectorCraft text: font database, shaping, layout, glyph outlines" workspace = true [dependencies] -# Pending shared extraction; pin the immutable official PR head until it merges. -craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "d0a9c79933a54883cd5bc3dfe839f1dd699f2c69", default-features = false } +# The shared font catalog from craft-libs main (it has the outline, bidi and caret helpers used here). +craft-font-catalog = { git = "https://github.com/storytold/craft-libs", rev = "23acc704933a9a5619a5cd1cddc9bb1fb5a9b2d3", default-features = false } vectorcraft-geom = { workspace = true } vectorcraft-doc = { workspace = true } kurbo = { workspace = true } diff --git a/crates/text/src/fontdb/lookup.rs b/crates/text/src/fontdb/lookup.rs index d9a97128ab..8bc4634f49 100644 --- a/crates/text/src/fontdb/lookup.rs +++ b/crates/text/src/fontdb/lookup.rs @@ -10,10 +10,7 @@ use super::names::{norm, norm_chars, script_families}; #[cfg(not(target_arch = "wasm32"))] use super::scan::{enumerate_faces, font_files}; use super::traits::{Alias, FontMatch, FontTraits, regular_rank}; -use super::{ - Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, FontDb, GlyphId, GlyphImage, MetadataProvider, NEXT_ID, OUTLINE_CACHE_MAX, Ordering, - Size, -}; +use super::{Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, FontDb, GlyphImage, MetadataProvider, NEXT_ID, OUTLINE_CACHE_MAX, Ordering}; /// The most faces [`FontDb::postscript_faces`] gives, and the most families it loads. const MAX_POSTSCRIPT_FACES: usize = 16; @@ -655,10 +652,9 @@ impl FontDb { return p.clone(); } let mut pen = FlipPen(BezPath::new()); - if let Some(f) = face.skrifa() - && let Some(g) = f.outline_glyphs().get(GlyphId::new(gid)) - { - let _ = g.draw(DrawSettings::unhinted(Size::unscaled(), face.location()), &mut pen); + if let Ok(font) = craft_font_catalog::FontOutline::from_bytes(face.data(), face.index(), face.variations()) { + // As before, keep the prefix emitted before a malformed glyph reports an error. + let _ = font.draw_to(gid, &mut pen); } let p = Arc::new(pen.0); let mut cache = self.outlines.lock().unwrap_or_else(|e| e.into_inner()); From dcc684f8ffa9039c7778dd7575bf1e51dc4a6076 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 07:04:53 -0800 Subject: [PATCH 155/158] Part of #5941: a dialog keeps its scroll under a window opened over it and its alert A window opened over a dialog (Import Shortcut Set over Keyboard Shortcuts) held only the modal window drawn last in the pass before it opened. When the dialog had an alert of its own drawn after it, the new window held the alert instead, and when the new window closed the dialog started again at its top. A second modal window that opened in the same pass, such as an alert of the new window, was also counted as opened over the dialog. - A window opened over others holds every modal window drawn in the pass before it opened. Only the first modal window drawn after `over_parent` is counted as opened over them. - `modal::drawn_this_pass` reads the pass from the record of the windows drawn in each pass, in place of a key of its own. - Save for Web measures Preview in Browser with `widgets::button_width`, as the button is drawn, and translates the label once. - The reopen test covers an alert drawn after the dialog before the other window opens and checks which windows each one holds. The Save for Web test compares Preview in Browser with the frame of the download speed list instead of its text. The test of buttons inside a dialog's body also covers a stop's message box. --- crates/ui-egui/src/dialogs/modal.rs | 97 +++++++++++++--------- crates/ui-egui/src/dialogs/save_for_web.rs | 6 +- crates/ui-egui/src/dialogs/tests_scroll.rs | 67 +++++++++++---- 3 files changed, 110 insertions(+), 60 deletions(-) diff --git a/crates/ui-egui/src/dialogs/modal.rs b/crates/ui-egui/src/dialogs/modal.rs index c5acd64e18..950f28d6e4 100644 --- a/crates/ui-egui/src/dialogs/modal.rs +++ b/crates/ui-egui/src/dialogs/modal.rs @@ -26,8 +26,7 @@ pub(crate) fn show_at(ctx: &egui::Context, title: &str, id: Id, initial: Vec2 // Not focusable (`Sense::click()` is): Tab goes through the dialog's controls, not the backdrop. ui.allocate_rect(ctx.content_rect(), egui::Sense::CLICK); }); - let pass = ctx.cumulative_pass_nr(); - ctx.data_mut(|d| d.insert_temp(drawn_pass_id(), pass)); + let opened = opened(ctx, id); let shown = egui::Window::new(title) .id(id) .order(egui::Order::Foreground) @@ -39,7 +38,7 @@ pub(crate) fn show_at(ctx: &egui::Context, title: &str, id: Id, initial: Vec2 .show(ctx, |ui| { // Just opened: what scrolls in the window starts at its top, wherever it was left when // the window last closed. - if opened(ctx, id) { + if opened { ctx.data_mut(|m| { m.insert_temp(id.with(TOP_ROWS_KEY), true); m.insert_temp(id.with(TOP_WHOLE_KEY), true); @@ -76,16 +75,18 @@ pub(crate) fn show_at(ctx: &egui::Context, title: &str, id: Id, initial: Vec2 shown.inner } -/// Mark the modal window drawn next in this pass as opened over the one drawn in the pass before, -/// which it hides until it closes and shows that one again (Import Shortcut Set over Keyboard -/// Shortcuts). The window under it keeps where it was scrolled to. +/// Mark the modal window drawn next in this pass as opened over the windows drawn in the pass +/// before (a dialog and any alert of its own), which it hides until it closes and shows them again +/// (Import Shortcut Set over Keyboard Shortcuts). The windows under it keep where they were +/// scrolled to. pub(crate) fn over_parent(ctx: &egui::Context) { let pass = ctx.cumulative_pass_nr(); ctx.data_mut(|m| m.insert_temp(Id::unique(OVER_KEY), pass)); } -/// Whether modal window `id`, drawn in this pass, opened in it: it was not drawn in the pass before, -/// and none of the windows drawn in the pass before was one opened over it ([`over_parent`]). +/// Record that modal window `id` is drawn in this pass, and return whether it opened in it: it was +/// not drawn in the pass before, and none of the windows drawn in the pass before was one opened +/// over it ([`over_parent`]). fn opened(ctx: &egui::Context, id: Id) -> bool { let pass = ctx.cumulative_pass_nr(); ctx.data_mut(|m| { @@ -101,27 +102,32 @@ fn opened(ctx: &egui::Context, id: Id) -> bool { let before: Vec = prev.iter().copied().filter(|&other| other != id).collect(); now.push(id); m.insert_temp(Id::unique(LAST_KEY), (pass, now, prev)); + // Only the window drawn next after `over_parent` is opened over the others. + let over = m.remove_temp::(Id::unique(OVER_KEY)) == Some(pass); let last = std::mem::replace(m.get_temp_mut_or(id.with(SHOWN_KEY), u64::MAX), pass); if last != u64::MAX && last.saturating_add(1) >= pass { return false; } // Shown again as the window opened over it closed. - if before.iter().any(|over| m.get_temp::(over.with(HOLDS_KEY)) == Some(id)) { + if before.iter().any(|under| m.get_temp::>(under.with(HOLDS_KEY)).is_some_and(|held| held.contains(&id))) { return false; } - // Opened over the window drawn last in the pass before, it holds that one; otherwise none. - match before.last().copied().filter(|_| m.get_temp::(Id::unique(OVER_KEY)) == Some(pass)) { - Some(under) => { - m.insert_temp(id.with(HOLDS_KEY), under); - } - None => { - m.remove::(id.with(HOLDS_KEY)); - } + // Opened over the windows drawn in the pass before, it holds them; otherwise none. + if over && !before.is_empty() { + m.insert_temp(id.with(HOLDS_KEY), before); + } else { + m.remove::>(id.with(HOLDS_KEY)); } true }) } +/// The windows modal window `id` was opened over and hides ([`over_parent`]). +#[cfg(test)] +fn holds(ctx: &egui::Context, id: Id) -> Vec { + ctx.data(|m| m.get_temp::>(id.with(HOLDS_KEY))).unwrap_or_default() +} + /// The room for the contents of a modal window with `margin` inside its frame. fn whole_room(ctx: &egui::Context, margin: i8) -> Vec2 { (ctx.content_rect().size() - Vec2::splat(2.0 * (super::EDGE_GAP + f32::from(margin)))).max(Vec2::ZERO) @@ -133,15 +139,11 @@ pub(crate) fn backdrop() -> egui::LayerId { egui::LayerId::new(egui::Order::Middle, Id::unique("modal-dim")) } -/// The key of the pass in which [`show_at`] last drew a modal window. -fn drawn_pass_id() -> Id { - Id::unique("modal-drawn-pass") -} - /// Whether [`show_at`] drew a modal window in this pass. Unlike the backdrop's visibility, which /// also counts the last pass, it is false in the pass after the window closes. pub(crate) fn drawn_this_pass(ctx: &egui::Context) -> bool { - ctx.data(|d| d.get_temp::(drawn_pass_id())) == Some(ctx.cumulative_pass_nr()) + let pass = ctx.cumulative_pass_nr(); + ctx.data_mut(|d| d.get_temp_mut_or::<(u64, Vec, Vec)>(Id::unique(LAST_KEY), (u64::MAX, vec![], vec![])).0 == pass) } /// The dialog's heading, which also moves the window ([`drag_band`]). @@ -197,9 +199,10 @@ const SHOWN_KEY: &str = "modal-shown"; const TOP_ROWS_KEY: &str = "modal-top-rows"; const TOP_WHOLE_KEY: &str = "modal-top-whole"; /// For all modal windows: the pass the last one was drawn in, the ids of those drawn in that pass -/// and of those drawn in the pass before it (`LAST_KEY`), and the pass -/// in which the window drawn next was marked as opened over another ([`over_parent`], `OVER_KEY`). -/// Under a modal window's id: the window it was opened over and hides (`HOLDS_KEY`). +/// and of those drawn in the pass before it (`LAST_KEY`, which [`drawn_this_pass`] also reads), and +/// the pass in which the window drawn next was marked as opened over others ([`over_parent`], +/// `OVER_KEY`, taken by that window). Under a modal window's id: the windows it was opened over and +/// hides (`HOLDS_KEY`). const LAST_KEY: &str = "modal-last"; const OVER_KEY: &str = "modal-over"; const HOLDS_KEY: &str = "modal-holds"; @@ -446,24 +449,36 @@ mod tests { #[test] fn a_window_hidden_under_one_opened_over_it_keeps_its_scroll() { // As Keyboard Shortcuts is while Import Shortcut Set is open over it: it is not drawn, but it - // did not close. A window that another replaced did close. Either may have shown an alert - // of its own, drawn after it in the same passes. + // did not close. A window that another replaced did close. Any of them may have shown an + // alert of its own, drawn after it in the same passes: A before B or C opens, or B or C. let others: [(&[&str], bool); 4] = [(&["over B"], true), (&["over B", "Alert"], true), (&["C"], false), (&["C", "Alert"], false)]; + let id = |name: &str| Id::unique(("modal-reopen-test", name)); let mut wrong = vec![]; for in_rows in [false, true] { - for (other, kept) in others { - let ctx = egui::Context::default(); - crate::theme::apply(&ctx, Default::default()); - let mut time = 0.0; - first_row_seen(&ctx, &["A"], in_rows, vec![], &mut time, 4); - if first_row_seen(&ctx, &["A"], in_rows, wheel_down(), &mut time, 60) { - wrong.push(format!("rows {in_rows}: the wheel does not scroll A")); - } - if !first_row_seen(&ctx, other, in_rows, vec![], &mut time, 4) { - wrong.push(format!("rows {in_rows}: {other:?} does not open at its top")); - } - if first_row_seen(&ctx, &["A"], in_rows, vec![], &mut time, 4) == kept { - wrong.push(format!("rows {in_rows}: after {other:?}, A {} where it was scrolled to", if kept { "is not" } else { "is still" })); + for lead in [&["A"][..], &["A", "Alert"][..]] { + for (other, kept) in others { + let ctx = egui::Context::default(); + crate::theme::apply(&ctx, Default::default()); + let mut time = 0.0; + first_row_seen(&ctx, &["A"], in_rows, vec![], &mut time, 4); + if first_row_seen(&ctx, &["A"], in_rows, wheel_down(), &mut time, 60) { + wrong.push(format!("rows {in_rows}: the wheel does not scroll A")); + } + first_row_seen(&ctx, lead, in_rows, vec![], &mut time, 4); + if !first_row_seen(&ctx, other, in_rows, vec![], &mut time, 4) { + wrong.push(format!("rows {in_rows}: after {lead:?}, {other:?} does not open at its top")); + } + // Only the window opened over A holds it; an alert drawn after that window holds none. + let held: Vec> = other.iter().map(|&name| holds(&ctx, id(name))).collect(); + let want: Vec> = + other.iter().map(|&name| if name.starts_with("over ") { lead.iter().map(|&l| id(l)).collect() } else { vec![] }).collect(); + if held != want { + wrong.push(format!("rows {in_rows}: after {lead:?}, {other:?} hold {held:?}, not {want:?}")); + } + if first_row_seen(&ctx, &["A"], in_rows, vec![], &mut time, 4) == kept { + let state = if kept { "is not" } else { "is still" }; + wrong.push(format!("rows {in_rows}: after {lead:?} and {other:?}, A {state} where it was scrolled to")); + } } } } diff --git a/crates/ui-egui/src/dialogs/save_for_web.rs b/crates/ui-egui/src/dialogs/save_for_web.rs index 6ff967f95a..8762c65daf 100644 --- a/crates/ui-egui/src/dialogs/save_for_web.rs +++ b/crates/ui-egui/src/dialogs/save_for_web.rs @@ -632,9 +632,9 @@ fn preview_area(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog, set ui.add_space(6.0); let mut browser = false; // Preview in Browser goes on a row of its own when the panes are too narrow for it beside the - // two lists (its width as `widgets::secondary_button` draws it). - let label = tl!("Preview in Browser"); - let button_w = (ui.painter().layout_no_wrap(label.to_string(), crate::theme::semibold(12.5), t.text).size().x + 32.0).max(72.0); + // two lists. + let label = "Preview in Browser"; + let button_w = widgets::button_width(ui, label); let mut beside = false; let mut button = |ui: &mut egui::Ui| { ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| { diff --git a/crates/ui-egui/src/dialogs/tests_scroll.rs b/crates/ui-egui/src/dialogs/tests_scroll.rs index bb013802ed..3f24dcaba1 100644 --- a/crates/ui-egui/src/dialogs/tests_scroll.rs +++ b/crates/ui-egui/src/dialogs/tests_scroll.rs @@ -239,9 +239,10 @@ fn save_for_web_in_the_smallest_window_keeps_its_settings_and_buttons_in_view() if !matches!((controls, settings), (Some(c), Some(s)) if c < s) { wrong.push(format!("{size:?}: Preview in Browser ({controls:?}) is left of the settings ({settings:?})")); } - // Preview in Browser is right of the download speed list or on a row below it, not over it. + // Preview in Browser is right of the download speed list's frame or on a row below it, not + // over it. let button = text_rects(&shown, "Preview in Browser").first().copied(); - let speed = text_rects(&shown, "56.6 Kbps").first().copied(); + let speed = text_rects(&shown, "56.6 Kbps").first().and_then(|r| frame_around(&shown, *r)); if !matches!((button, speed), (Some(b), Some(s)) if b.left() > s.right() + 16.0 || b.top() > s.bottom() + 8.0) { wrong.push(format!("{size:?}: Preview in Browser ({button:?}) clears the download speed list ({speed:?})")); } @@ -249,6 +250,21 @@ fn save_for_web_in_the_smallest_window_keeps_its_settings_and_buttons_in_view() assert!(wrong.is_empty(), "{wrong:#?}"); } +/// The frame of the control that drew the text at `inner`: the widest rectangle shape around it +/// that is at most 240 by 40 pt. +fn frame_around(shown: &Shown, inner: Rect) -> Option { + fn walk(s: &Shape, inner: Rect, out: &mut Vec) { + match s { + Shape::Rect(r) if r.rect.contains_rect(inner) && r.rect.width() <= 240.0 && r.rect.height() <= 40.0 => out.push(r.rect), + Shape::Vec(v) => v.iter().for_each(|s| walk(s, inner, out)), + _ => {} + } + } + let mut out = vec![]; + shown.shapes.iter().for_each(|c| walk(&c.shape, inner, &mut out)); + out.into_iter().max_by(|a, b| a.width().total_cmp(&b.width())) +} + /// The rectangles of the texts `label` the dialog drew. fn text_rects(shown: &Shown, label: &str) -> Vec { fn walk(s: &Shape, label: &str, out: &mut Vec) { @@ -432,18 +448,37 @@ fn texts(shown: &Shown) -> Vec<(String, Rect, Rect)> { #[test] fn a_dialog_with_buttons_in_its_body_scrolls_them_with_the_body() { - // Check Spelling draws its buttons inside its body: in a window too short for it, the heading - // stays in view and the buttons scroll with the body. - let open: Open = |app| { - check_spelling::open(app).unwrap(); - }; - let tall = show_in(open, vec2(1280.0, 900.0), false); - let screen = Rect::from_min_size(Pos2::ZERO, vec2(1024.0, (0.6 * tall.window.height()).round())); - let shown = show_in(open, screen.size(), false); - let scrolled = show_in(open, screen.size(), true); - let seen = |shown: &Shown, label: &str| buttons(shown, screen, &[label]).iter().any(|(_, seen)| *seen); - assert!(screen.contains_rect(shown.window), "the dialog stays on the screen: {:?}", shown.window); - assert!(body_bar(&shown).is_some() && shown.whole == [false; 2], "only the body scrolls ({:?}, {:?})", shown.body, shown.whole); - assert!(seen(&shown, "Check Spelling") && seen(&scrolled, "Check Spelling"), "the heading stays in view"); - assert!(!seen(&shown, "Cancel") && seen(&scrolled, "Cancel"), "Cancel is out of view until the body is scrolled down"); + // Check Spelling and a stop's message box draw their buttons inside their body: in a window too + // short for the dialog, the heading stays in view and the buttons scroll with the body. + let opens: [(&str, Open, &str); 2] = [ + ( + "Check Spelling", + |app| { + check_spelling::open(app).unwrap(); + }, + "Cancel", + ), + ("Action 1", |app| action_stop::open_message(app, "Action 1", &"Check the art. ".repeat(40), true), "Stop"), + ]; + let mut wrong = vec![]; + for (heading, open, button) in opens { + let tall = show_in(open, vec2(1280.0, 900.0), false); + let screen = Rect::from_min_size(Pos2::ZERO, vec2(1024.0, (0.6 * tall.window.height()).round())); + let shown = show_in(open, screen.size(), false); + let scrolled = show_in(open, screen.size(), true); + let seen = |shown: &Shown, label: &str| buttons(shown, screen, &[label]).iter().any(|(_, seen)| *seen); + if !screen.contains_rect(shown.window) { + wrong.push(format!("{heading}: the dialog leaves the screen: {:?}", shown.window)); + } + if body_bar(&shown).is_none() || shown.whole != [false; 2] { + wrong.push(format!("{heading}: not only the body scrolls ({:?}, {:?})", shown.body, shown.whole)); + } + if !seen(&shown, heading) || !seen(&scrolled, heading) { + wrong.push(format!("{heading}: the heading leaves the view")); + } + if seen(&shown, button) || !seen(&scrolled, button) { + wrong.push(format!("{heading}: {button} is not out of view until the body is scrolled down")); + } + } + assert!(wrong.is_empty(), "{wrong:#?}"); } From 62c015d393fd98ce3f8c9cf7fc05a23b254ad42d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 07:06:54 -0800 Subject: [PATCH 156/158] Dimension: a preview bounds corner takes only the anchor it stands for A corner of a path's preview bounds took a Linear pick from every anchor of its own object within 8 pixels, so the top, left, right and bottom anchors of a small stroked circle, and the anchors of a rotated stroked shape when zoomed out, could no longer be picked. - The corner now takes the pick only from the holding path's anchor at the same corner of the object's geometric bounds. Any other anchor, of that object or of other art, that is nearer the pointer takes the point, and the nearest anchor wins a tie as the topmost. - The path that holds a point picked on a corner is kept from the pick, instead of being worked out again from the point's position, so a point that only happens to lie on a corner links to what is under it. A path deleted between the clicks holds nothing. - A corner of a compound path whose supplying member is hidden or locked is not snapped to. - The hovering test checks the "anchor" label at the corner, and a new test covers the anchor ring right on the end of a dimension's line. Docs: docs/dimensions.md and docs/target-app-parity.md say that only the four corners are snapped to, by VectorCraft's own rule, not the edges of the preview bounds, a group's own strokes or effects, or type; that a corner point starts no construction guides; and that the dimension measures W and H when it is drawn, since a later stroke weight change or a scale with Scale Strokes off moves the point with the anchors. --- crates/tools/src/dimension.rs | 200 +++++++++++++++++++++++++++++----- docs/dimensions.md | 31 +++--- docs/target-app-parity.md | 2 +- 3 files changed, 192 insertions(+), 41 deletions(-) diff --git a/crates/tools/src/dimension.rs b/crates/tools/src/dimension.rs index edb12b1db1..4a4aa33f77 100644 --- a/crates/tools/src/dimension.rs +++ b/crates/tools/src/dimension.rs @@ -71,6 +71,12 @@ pub struct DimensionTool { /// Whether the last Linear pick worked out landed on the end of a line of a dimension already /// drawn, or on a corner of a path's preview bounds (shown as an anchor). on_end: bool, + /// The path that holds the last Linear pick worked out, when it landed on a corner of that + /// path's preview bounds. + corner: Option, + /// The path that holds the first Linear point, when it was picked on a corner of that path's + /// preview bounds. + first_corner: Option, /// Whether the press under way began on an anchor a Linear click picks. press_on_anchor: bool, /// The second point clicked for the Linear dimension being placed, and where the pointer was @@ -226,8 +232,9 @@ struct PreviewCorner { at: Point, /// The path the point is held against. holder: NodeId, - /// The path or compound path whose preview bounds have the corner. - object: NodeId, + /// The same corner of the object's geometric bounds: an anchor of `holder` there is the + /// anchor the corner stands in for. + stands_for: Point, } /// With Use Preview Bounds on, the corner of a path's or compound path's preview bounds (its @@ -285,17 +292,20 @@ fn preview_corner(cx: &ToolContext, p: Point, cache: &mut PreviewBoxes) -> Optio continue; } // The path whose own box reaches furthest towards the corner holds it: in a - // compound path, the member that puts that corner where it is. - let mut holder = None; + // compound path, the member that puts that corner where it is. A hidden or + // locked member gives no corner. + let mut holder: Option<(f64, NodeId, bool)> = None; for m in members() { let Some(b) = *w.cache.geometric.entry(m.id).or_insert_with(|| m.geometric_bounds()) else { continue }; let gap = corners(b).get(k).map_or(f64::INFINITY, |c| c.distance(q)); - if holder.is_none_or(|(near, _)| gap < near) { - holder = Some((gap, m.id)); + let editable = m.visible && !m.locked; + if holder.is_none_or(|(near, _, was)| gap < near || (gap == near && editable && !was)) { + holder = Some((gap, m.id, editable)); } } - if let Some((_, holder)) = holder { - w.best = Some((d, PreviewCorner { at: q, holder, object: n.id })); + let holder = holder.filter(|(.., editable)| *editable).map(|(gap, id, _)| (gap, id)); + if let Some(((_, holder), stands_for)) = holder.zip(corners(geometric).get(k).copied()) { + w.best = Some((d, PreviewCorner { at: q, holder, stands_for })); } } } @@ -321,16 +331,34 @@ fn preview_corner(cx: &ToolContext, p: Point, cache: &mut PreviewBoxes) -> Optio } /// The anchor a pick at `p` lands on instead of `corner`, given `anchor`, the nearest anchor -/// within reach; `None` when the corner takes it. The corner takes the pick from the anchors of -/// the object whose preview bounds have it, which sit on the stroke's centerline. An anchor right -/// on the corner takes it, and so does the nearest anchor of other art when that anchor is nearer -/// the pointer than the corner. +/// within reach; `None` when the corner takes it (VectorCraft's own rule). The corner takes the +/// pick from the anchors of the path holding it at the same corner of the object's geometric +/// bounds, which sit on the stroke's centerline. An anchor right on the corner takes it, and so +/// does the nearest other anchor, of this object or of other art, when it is nearer the pointer +/// than the corner. The holder's anchors and the other art are searched with a budget each, and +/// `anchor` wins a tie, as the topmost. fn anchor_over_corner(cx: &ToolContext, p: Point, corner: &PreviewCorner, anchor: Option<(Point, PointRef)>) -> Option<(Point, PointRef)> { - let (at, _) = anchor.as_ref()?; - if at.distance(corner.at) <= 1e-9 { + if anchor.as_ref().is_some_and(|(at, _)| at.distance(corner.at) <= 1e-9) { return anchor; } - anchor_under_where(cx, p, |id| id != corner.object).filter(|(other, _)| other.distance(p) < corner.at.distance(p)) + let stands_in = |(at, nearest): &(Point, PointRef)| nearest.node == corner.holder && at.distance(corner.stands_for) <= 1e-9; + let first = anchor.filter(|a| !stands_in(a)); + let reach = cx.tol(ANCHOR_REACH); + let own = cx.doc.node(corner.holder).and_then(|n| n.path_data()).and_then(|path| { + let anchors = path.subpaths.iter().enumerate().flat_map(|(subpath, sp)| sp.anchors.iter().enumerate().map(move |(i, a)| (subpath, i, a.p))); + anchors + .take(20_000) + .filter(|(.., q)| q.distance(p) <= reach && q.distance(corner.stands_for) > 1e-9) + .min_by(|(.., a), (.., b)| a.distance(p).total_cmp(&b.distance(p))) + .map(|(subpath, anchor, q)| (q, PointRef { node: corner.holder, subpath, anchor })) + }); + let other = anchor_under_where(cx, p, |id| id != corner.holder); + first + .into_iter() + .chain(other) + .chain(own) + .filter(|(q, _)| q.distance(p) < corner.at.distance(p)) + .min_by(|(a, _), (b, _)| a.distance(p).total_cmp(&b.distance(p))) } /// Where a pick at `p` lands on the artwork of the visible, unlocked dimensions already drawn, @@ -434,18 +462,17 @@ fn nearest_on(cx: &ToolContext, edge: &SegmentRef, p: Point) -> Option { /// A point on a segment keeps its place along the segment. Any other point is held /// against the anchors of the path under it, or, with no path under it, the path of the other /// point, so that it moves with that path. None when neither point has a path to link to. +/// `held_a` and `held_b` name the path holding a point picked on a corner of that path's +/// preview bounds: such a point is held against that path, however far its strokes or effects +/// put the corner from the path and whatever other segment lies there. fn points_source( cx: &ToolContext, - boxes: &mut PreviewBoxes, - (a, ra): (Point, &Option), - (b, rb): (Point, &Option), + (a, ra, held_a): (Point, &Option, Option), + (b, rb, held_b): (Point, &Option, Option), ) -> Option { - // A point on a corner of a path's preview bounds is held against that path, however far its - // strokes or effects put the corner from the path and whatever other segment lies there. - let mut corner_of = |p: Point, r: &Option| { - r.is_none().then(|| preview_corner(cx, p, boxes)).flatten().filter(|c| c.at.distance(p) <= 1e-9).map(|c| c.holder) - }; - let (corner_a, corner_b) = (corner_of(a, ra), corner_of(b, rb)); + // A path deleted since the pick holds nothing. + let holder = |held: Option| held.filter(|node| cx.doc.node(*node).is_some()); + let (corner_a, corner_b) = (holder(held_a), holder(held_b)); let edge = |p: Point, corner: Option| if corner.is_some() { None } else { pick(cx, p) }; let (edge_a, edge_b) = (edge(a, corner_a), edge(b, corner_b)); let node = |r: &Option, corner: Option, e: &Option| { @@ -470,8 +497,8 @@ fn points_source( impl DimensionTool { /// Where a Linear pick at `p` lands: with Use Preview Bounds on, on the nearest corner of a - /// path's preview bounds within reach, where they differ from its anchors, unless an anchor of - /// other art is nearer (held against the path, labeled "anchor"; [`anchor_over_corner`]); else on the + /// path's preview bounds within reach, where they differ from its anchors, unless another + /// anchor is nearer (held against the path, labeled "anchor"; [`anchor_over_corner`]); else on the /// nearest anchor of any path, within reach (kept as /// a link to its path), labeled "anchor"; else on the nearest end of a line of a dimension /// already drawn, within the same reach (no link), also labeled "anchor"; else where Smart Guides put it (another object's anchor or centre, in @@ -489,11 +516,13 @@ impl DimensionTool { }); let guided = self.snap.hover(cx, p, &[], leave.as_ref()); self.on_end = false; + self.corner = None; let mut anchor = anchor_under(cx, p); if let Some(corner) = preview_corner(cx, p, &mut self.preview_boxes) { anchor = anchor_over_corner(cx, p, &corner, anchor); if anchor.is_none() { self.on_end = true; + self.corner = Some(corner.holder); self.snap.label(corner.at, "anchor"); return (corner.at, None); } @@ -645,6 +674,8 @@ impl DimensionTool { self.press = None; self.press_on_anchor = false; self.on_end = false; + self.corner = None; + self.first_corner = None; self.points.clear(); self.lines.clear(); self.dragging = false; @@ -658,15 +689,22 @@ impl DimensionTool { match self.kind { Kind::Linear => { let (mut at, mut reference) = self.snap_linear(cx, p); + let mut corner = self.corner; if mods.shift && let Some((last, _)) = self.points.last() { + let snapped = at; at = constrained(cx, *last, at); reference = reference.filter(|r| r.position(cx.doc) == Some(at)); + corner = corner.filter(|_| at.distance(snapped) <= 1e-9); } self.points.push((at, reference)); + if self.points.len() == 1 { + self.first_corner = corner; + } if let [(a, ra), (b, rb)] = self.points.as_slice() { - let source = points_source(cx, &mut self.preview_boxes, (*a, ra), (*b, rb)); + let source = points_source(cx, (*a, ra, self.first_corner), (*b, rb, corner)); + self.first_corner = None; let mut d = self.recipe(DimensionMode::Linear, *a, *b, Point::ZERO, source); if d.resolve(cx.doc).is_ok() { self.second = Some((*b, p)); @@ -1222,6 +1260,12 @@ mod tests { .into_iter() .any(|o| matches!(o, Overlay::Anchor { p, filled: false, size, .. } if p.distance(Point::new(99.5, 99.5)) < 1e-9 && size == 10.0)); assert!(ring, "({x}, {y})"); + let label = t + .snap + .guides() + .iter() + .any(|o| matches!(o, Overlay::Label { p, text, .. } if text == "anchor" && p.distance(Point::new(99.5, 99.5)) < 1e-9)); + assert!(label, "({x}, {y}): {:?}", t.snap.guides()); } } @@ -1279,6 +1323,108 @@ mod tests { wide.stroke_mut().expect("a stroke").width = 40.0; wider.node_mut(id).expect("the rectangle").appearance = wide.into(); assert!(free.position(&wider).is_some_and(|q| near(q, Point::new(99.5, 99.5))), "{:?}", free.position(&wider)); + // Scaled 200% with Scale Strokes off, the point moves with the anchors and no longer sits + // on the corner of the preview bounds, which the 1 point stroke puts at (199.5, 199.5). + let mut scaled = d.clone(); + scaled.node_mut(id).expect("the rectangle").transform(vectorcraft_geom::Affine::scale(2.0), false); + assert!(free.position(&scaled).is_some_and(|q| near(q, Point::new(199.0, 199.0))), "{:?}", free.position(&scaled)); + } + + /// With Use Preview Bounds on, a corner takes the pick only from the anchors at the same corner + /// of its object's geometric bounds. The other anchors of a small stroked circle stay + /// pickable, so does the end of another line lying on the anchor the corner stands in for, and + /// of two stroked rectangles sharing an edge, each corner of the shared anchors is held against + /// its own rectangle. + #[test] + fn a_corner_takes_only_the_anchor_it_stands_for() { + let (s, p) = (Selection::default(), paint()); + let near = |a: Point, b: Point| a.distance(b) < 1e-9; + let mut d = vectorcraft_doc::Document::new(500.0, 500.0); + let (l, circle) = (d.layers[0].id, d.alloc_id()); + let path = vectorcraft_geom::shapes::ellipse(Rect::new(296.0, 296.0, 304.0, 304.0)); + d.insert(Some(l), 0, Node::path(circle, path, vectorcraft_doc::Appearance::default_art())).expect("the circle"); + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + let mut t = DimensionTool::default(); + let (q, reference) = t.snap_linear(&c, Point::new(300.0, 296.0)); + assert!(near(q, Point::new(300.0, 296.0)) && reference.is_some_and(|r| r.node == circle), "{q:?}"); + let (q, reference) = t.snap_linear(&c, Point::new(296.5, 296.5)); + assert!(near(q, Point::new(295.5, 295.5)) && reference.is_none() && t.corner == Some(circle), "{q:?}"); + // An unstroked line ending right on the rectangle's anchor: a click there picks the line's + // end, and a click nearer the corner picks the corner. + let (mut d, id) = doc_with_rect(); + let (l, line) = (d.layers[0].id, d.alloc_id()); + let path = + vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(100.0, 100.0), Point::new(50.0, 20.0)], false)); + d.insert(Some(l), 1, Node::path(line, path, Default::default())).expect("the line"); + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + let mut t = DimensionTool::default(); + let (q, reference) = t.snap_linear(&c, Point::new(100.0, 100.0)); + assert!(near(q, Point::new(100.0, 100.0)) && reference.is_some_and(|r| r.node == line), "{q:?}"); + let (q, reference) = t.snap_linear(&c, Point::new(99.6, 99.6)); + assert!(near(q, Point::new(99.5, 99.5)) && reference.is_none() && t.corner == Some(id), "{q:?}"); + // Two stroked rectangles sharing the edge x = 200; the right one is on top. + let (mut d, left) = doc_with_rect(); + let (l, right) = (d.layers[0].id, d.alloc_id()); + let path = vectorcraft_geom::shapes::rectangle(Rect::new(200.0, 100.0, 300.0, 200.0)); + d.insert(Some(l), 1, Node::path(right, path, vectorcraft_doc::Appearance::default_art())).expect("the right rectangle"); + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + for (pointer, corner, holder) in [((200.4, 99.6), (200.5, 99.5), left), ((199.6, 99.6), (199.5, 99.5), right)] { + let mut t = DimensionTool::default(); + for kind in [PointerKind::Move, PointerKind::Down, PointerKind::Up] { + t.pointer(&c, &PointerEvent::new(kind, pointer.0, pointer.1)); + } + for kind in [PointerKind::Move, PointerKind::Down, PointerKind::Up] { + t.pointer(&c, &PointerEvent::new(kind, 250.0, 300.0)); + } + let pending = t.pending.expect("both points were picked"); + assert!(near(pending.a, Point::new(corner.0, corner.1)), "{pointer:?}: {:?}", pending.a); + let Some(DimensionSource::Points { a: None, free_a: Some(free), .. }) = &pending.source else { panic!("{:?}", pending.source) }; + assert!(matches!(free, FreePoint::Anchors { node, .. } if *node == holder), "{pointer:?}: {free:?}"); + } + } + + /// A point is held against a path for a corner of its preview bounds only when it was picked + /// there: the same position picked another way links to the segment under it. + #[test] + fn a_point_is_held_for_a_corner_only_when_picked_on_it() { + let (mut d, id) = doc_with_rect(); + let (l, line) = (d.layers[0].id, d.alloc_id()); + let path = vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(0.0, 99.5), Point::new(300.0, 99.5)], false)); + d.insert(Some(l), 1, Node::path(line, path, Default::default())).expect("the line"); + let (s, p) = (Selection::default(), paint()); + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + let (corner, b) = (Point::new(99.5, 99.5), Point::new(250.0, 99.5)); + for (held, node) in [(Some(id), id), (None, line)] { + let source = points_source(&c, (corner, &None, held), (b, &None, None)); + let Some(DimensionSource::Points { free_a: Some(free), .. }) = &source else { panic!("{source:?}") }; + let linked = match free { + FreePoint::Anchors { node, .. } => *node, + FreePoint::OnSegment { edge, .. } => edge.node, + }; + assert_eq!(linked, node, "{held:?}: {free:?}"); + } + } + + /// Hovering right on the end of a dimension's line shows the anchor ring there. + #[test] + fn hovering_right_on_a_dimension_lines_end_shows_the_anchor_ring() { + let mut d = vectorcraft_doc::Document::new(500.0, 500.0); + let (l, id) = (d.layers[0].id, d.alloc_id()); + let path = + vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(300.0, 300.0), Point::new(400.0, 300.0)], false)); + let mut n = Node::path(id, path, Default::default()); + let recipe = DimensionTool::default().recipe(DimensionMode::Linear, Point::new(0.0, 0.0), Point::new(50.0, 0.0), Point::ZERO, None); + n.extras_mut().dimension = Some(Box::new(recipe)); + d.insert(Some(l), 0, n).expect("the dimension's line"); + let (s, p) = (Selection::default(), paint()); + let c = ToolContext { smart_guides: true, snap_to_point: true, ..cx(&d, &s, &p) }; + let mut t = DimensionTool::default(); + t.pointer(&c, &PointerEvent::new(PointerKind::Move, 300.0, 300.0)); + let ring = t + .overlays(&c) + .into_iter() + .any(|o| matches!(o, Overlay::Anchor { p, filled: false, size, .. } if p.distance(Point::new(300.0, 300.0)) < 1e-9 && size == 10.0)); + assert!(ring, "{:?}", t.overlays(&c)); } /// The anchors of a live rectangle are picked the same way. diff --git a/docs/dimensions.md b/docs/dimensions.md index b15d8f8727..d275ee9f4a 100644 --- a/docs/dimensions.md +++ b/docs/dimensions.md @@ -20,8 +20,8 @@ The **Dimension Tool** is in the Modify section of the toolbar. Its strip offers first point was picked on an anchor, the second also snaps onto the construction guides through it; any other first point has no construction guides through it. The guides show while hovering, before each click. VectorCraft's own rules decide where a point lands: an - anchor within 8 pixels takes it first (with Use Preview Bounds on, after a corner of a path's - preview bounds, as below); with Smart Guides or Snap to Point on, the end of a line + anchor within 8 pixels takes it first (with Use Preview Bounds on, except where a corner of a + path's preview bounds takes it, as below); with Smart Guides or Snap to Point on, the end of a line of a visible, unlocked dimension already drawn (its dimension line, or the far end of an extension line) within 8 pixels takes it next, without a link to that dimension; a point on a guide stays on the guide where the pointer @@ -32,18 +32,23 @@ The **Dimension Tool** is in the Modify section of the toolbar. Its strip offers line of a dimension already drawn, within 8 pixels. With Smart Guides and Anchor/Path Labels on, a point on an anchor or a line end shows the "anchor" label, and a point on a segment or line shows the "path" label. These rules apply to the Linear points. - With Use Preview Bounds on (Preferences › General), a click within 8 pixels of a corner of the - preview bounds of a path or compound path, its strokes and effects included, lands on that - corner instead of on that object's anchors, as the + With Use Preview Bounds on (Preferences › General), a Linear point can land on a corner of the + preview bounds of a path or compound path whose strokes or effects reach past its anchors. The [linear dimensions help](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/plot-linear-dimensions-of-objects.html) - describes for measuring a stroked segment. An anchor of other art that is nearer the pointer - than the corner takes the point instead. The point is linked to the path (in a compound path, - to the member whose own bounds reach nearest to the corner), held against its anchors, and - shows the "anchor" label. It moves with the path, and a later change to the stroke weight does - not move it. For an object that is not rotated, a horizontal or vertical dimension between two - such corners measures the outside of the stroke, the width or height that W and H show in the - Transform and Properties panels. A corner that is also an anchor, as on a path without a - stroke, takes the anchor. + describes measuring a stroked segment by snapping onto its preview bounds. VectorCraft snaps to + the four corners of those bounds only, not to their edges, by its own rules: a click within 8 + pixels of a corner lands on it instead of on the anchor at the same corner of the object's + geometric bounds, and any other anchor, of that object or of other art, that is nearer the + pointer than the corner takes the point instead. A corner that is also an anchor, as on a path + without a stroke, takes the anchor. The corners of a group's own strokes or effects, and of + type, are not snapped to. The point is linked to the path (in a compound path, to the member + whose own bounds reach nearest to the corner), is held against its anchors and shows the + "anchor" label. It does not start construction guides for the second point. For an object that + is not rotated, a horizontal or vertical dimension between two such corners measures, when it + is drawn, the outside of the stroke, the width or height that W and H show in the Transform and + Properties panels. The point then moves with the path's anchors, so a later change to the + stroke weight, or a scale with Scale Strokes off, does not move it with the outside of the + stroke. A linear dimension is aligned, horizontal or vertical, as the [linear dimensions help](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/plot-linear-dimensions-of-objects.html) describes: after the second click, clicking again places an aligned dimension, and moving the diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index cb2da583b9..603b469b87 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -635,7 +635,7 @@ since 2026-10-01. **Drawing tools, Dimension tool points on a Smart Guide stay on the guide:** By VectorCraft's own rule, a clicked point that lies on a Smart Guide already, such as one in line with an object's center, stays where the pointer is when no anchor is within 8 pixels and no segment is within the Smart Guides snapping tolerance, instead of moving onto a segment farther than that tolerance and within 8 pixels; with Snap to Grid or Snap to Pixel on, a point stays on the grid or the whole pixel those options give. `a_point_on_a_guide_stays_on_the_guide` covers it. **Drawing tools, Dimension tool second point without construction guides through a first point off the anchors:** By VectorCraft's own rule, with Smart Guides on, the second Linear point does not snap to the construction guides through a first point that is not on an anchor, so a click beside a segment straight below such a first point lands on the segment; after a first point picked on an anchor, the construction guides through it still apply. The second point still snaps to anchors, centers and alignment lines, and with Snap to Perpendicular or Snap to Tangent on, it lands where the line from the first point meets a segment square or grazes a curve. `a_point_on_a_guide_stays_on_the_guide`, `the_second_point_after_an_anchor_lands_on_construction_guides`, `the_second_point_lands_square_to_a_segment_or_grazing_a_curve` and `linear_picks_show_and_snap_to_smart_guides` cover it. **Drawing tools, Dimension tool points land on dimensions already drawn (#8063):** By VectorCraft's own rule, with Smart Guides or Snap to Point on, a Linear point that no anchor of the art within 8 pixels takes lands on the end of a visible, unlocked dimension's dimension line, or on the far end of its extension line, within 8 pixels, and a point that nothing else places lands on the closest point of such a line within 8 pixels, so at any zoom a dimension can start where another one ends. The end of an extension line next to the point it measures does not pull points away from that anchor. With Smart Guides and Anchor/Path Labels on, a point on an anchor or line end shows the "anchor" label and a point on a segment or line shows the "path" label. `linear_picks_land_on_anchors_paths_and_drawn_dimensions` and `an_anchor_beside_a_drawn_dimension_takes_the_point` cover it. -**Drawing tools, Dimension tool points on preview bounds (#8537):** With Use Preview Bounds on, a Linear point clicked within 8 pixels of a corner of the preview bounds of a path or compound path with a stroke or effects lands on that corner instead of on that object's anchors, as the [linear dimensions help](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/plot-linear-dimensions-of-objects.html) describes, unless an anchor of other art is nearer the pointer; for an object that is not rotated, a horizontal or vertical dimension between two such corners measures the size that W and H show. `with_preview_bounds_points_land_on_the_corners_of_the_stroke`, `preview_bounds_corners_take_picks_as_anchors_do` and `hovering_a_corner_of_the_preview_bounds_shows_the_anchor_ring` cover it. +**Drawing tools, Dimension tool points on preview bounds corners (#8537):** With Use Preview Bounds on, a Linear point can land on a corner of the preview bounds of a path or compound path with a stroke or effects; the [linear dimensions help](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/plot-linear-dimensions-of-objects.html) describes measuring a stroked segment by snapping onto its preview bounds. By VectorCraft's own rule, only the four corners are snapped to: a click within 8 pixels of a corner lands on it instead of on the anchor at the same corner of the object's geometric bounds, and any other anchor nearer the pointer takes the point; for an object that is not rotated, a horizontal or vertical dimension between two such corners measures, when it is drawn, the size that W and H show. The edges of the preview bounds, a group's own strokes or effects and type are not snapped to. `with_preview_bounds_points_land_on_the_corners_of_the_stroke`, `preview_bounds_corners_take_picks_as_anchors_do`, `a_corner_takes_only_the_anchor_it_stands_for`, `a_point_is_held_for_a_corner_only_when_picked_on_it` and `hovering_a_corner_of_the_preview_bounds_shows_the_anchor_ring` cover it. **Drawing tools, Dimension tool dimensions selected with their art keep their lines and label:** Object › Expand, Object › Expand Appearance and Object › Path › Outline Stroke leave a dimension selected with art it measures, directly or in selected groups without fills, strokes or effects of their own, as it is and change only the other art; when the new art no longer fits its link, the dimension stays where it was, no longer linked, and undo links it again. `expand_leaves_a_dimension_selected_with_its_art_as_it_is`, `expand_appearance_leaves_a_dimension_selected_with_its_art_as_it_is`, `outline_stroke_leaves_a_dimension_selected_with_its_art_as_it_is`, `a_dimension_selected_with_art_that_has_nothing_to_expand_changes_nothing`, `a_group_effect_expanded_reaches_the_dimension_it_holds`, `expand_keeps_a_dimension_in_its_asset_and_its_variable_binding`, `a_dimension_keeps_no_link_to_the_art_expand_replaced`, `a_dimension_outlasts_the_art_outline_stroke_or_expand_appearance_replaced`, `a_dimension_outlasts_the_stroke_expand_outlined` and `expand_appearance_in_safe_mode_leaves_a_dimension_selected_with_its_art` cover it. **Drawing tools, Line Segment from one curve onto a common tangent of another:** By VectorCraft's own rule, with Smart Guides and Snap to Tangent on, a Line Segment drag pressed anywhere on a convex closed path with curves and dragged to within the snapping tolerance of another such path lands on a common tangent of the two ([tangent lines to circles](https://en.wikipedia.org/wiki/Tangent_lines_to_circles)): both ends move to where the line touches the paths, the start sliding along the first path, and each end shows the "tangent" label when Anchor/Path Labels is on, with the line drawn as a guide when Alignment Guides is on. The line is the tangent whose touch point on the second path is nearest the pointer, so moving the pointer around the second path switches between the outer tangent and the one crossing between the paths. The start stays where it was pressed when Shift, Alt or Space is held, when an anchor, center or crossing lies nearer the pointer than the second path does, when the press snapped to an anchor, center or crossing off the first path, when Snap to Tangent is off, when Snap to Grid or pixel snapping places drawn points, or when either path bends inward somewhere or has more than 512 segments. `a_line_from_one_circle_to_another_lands_on_their_common_tangent`, `a_line_from_a_turned_ellipse_lands_on_its_tangent_with_a_circle`, `a_line_near_the_second_path_takes_the_tangent_touching_it_nearest`, `a_line_keeps_its_start_without_a_tangent_snap`, `a_line_to_a_crescent_or_from_an_anchor_beside_the_curve_keeps_its_start` and `a_line_segment_drag_draws_the_common_tangent_as_one_undo_step` cover it. **Live trace result bounds and selection highlights exclude the retained bitmap except in source-image views:** `live_trace_result_bounds_exclude_the_retained_bitmap_at_any_angle` checks every TraceView, geometric and visual bounds and rotated result bounds. `live_trace_selection_highlight_excludes_the_retained_source_rectangle` checks result highlights and the existing ordinary-group policy. Shared editing-child traversal also preserves Shaper handling. From c609e56b8703e5780fa1867932baad45eea497c0 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 07:22:30 -0800 Subject: [PATCH 157/158] Dimension: no preview bounds corners for guides or compound members - A path made into a guide draws without its strokes or effects, so its preview bounds give no corners. - The members of a compound path draw with the compound path's own appearance, so only the compound path's preview bounds give corners. - Another path's anchor right on a preview bounds corner takes a click on the anchor that corner stands in for, so the point links to that path. - A corner that its path cannot hold a point at, as on a stroked dot whose anchors all coincide, is not snapped to, so a click by the dot picks its anchor. - The pointer test before measuring a path includes the right and bottom edges, as the 8 pixel distance test does. Docs: docs/dimensions.md and docs/target-app-parity.md name paths made into guides and compound path members among the art without corners. --- crates/tools/src/dimension.rs | 73 +++++++++++++++++++++++++++++++++-- docs/dimensions.md | 5 ++- docs/target-app-parity.md | 2 +- 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/crates/tools/src/dimension.rs b/crates/tools/src/dimension.rs index c42dfb980d..894e75ed3d 100644 --- a/crates/tools/src/dimension.rs +++ b/crates/tools/src/dimension.rs @@ -230,6 +230,8 @@ struct PreviewBoxes { revision: Option<(u64, u64)>, geometric: HashMap>, preview: HashMap>, + /// Whether a point at each corner (by object and corner number) can be held against its path. + holdable: HashMap<(NodeId, usize), bool>, } /// A corner of an object's preview bounds that a Linear pick can land on. @@ -275,9 +277,13 @@ fn preview_corner(cx: &ToolContext, p: Point, cache: &mut PreviewBoxes) -> Optio }; let members = || compound.into_iter().flatten().map(|c| c.as_ref()).chain(compound.is_none().then_some(n)).filter(|m| m.path_data().is_some()); - if members().next().is_some() + // A path made into a guide draws as a guide, without its strokes or effects. The pointer + // test includes the right and bottom edges, as the distance test below does. + let within = |r: Rect| (r.x0..=r.x1).contains(&w.p.x) && (r.y0..=r.y1).contains(&w.p.y); + if !n.is_guide() + && members().next().is_some() && let Some(geometric) = *w.cache.geometric.entry(n.id).or_insert_with(|| n.geometric_bounds()) - && (effects || geometric.inflate(reach, reach).contains(w.p)) + && (effects || within(geometric.inflate(reach, reach))) { let doc = w.doc; let measured = match w.cache.preview.get(&n.id) { @@ -310,13 +316,23 @@ fn preview_corner(cx: &ToolContext, p: Point, cache: &mut PreviewBoxes) -> Optio } } let holder = holder.filter(|(.., editable)| *editable).map(|(gap, id, _)| (gap, id)); + // A path that cannot hold a point at the corner (a stroked dot, whose anchors + // all coincide) gives no corner. + let holdable = |id: NodeId, cache: &mut PreviewBoxes| { + *cache.holdable.entry((n.id, k)).or_insert_with(|| FreePoint::on(doc, id, q).is_some()) + }; + let holder = holder.filter(|(_, id)| holdable(*id, w.cache)); if let Some(((_, holder), stands_for)) = holder.zip(corners(geometric).get(k).copied()) { w.best = Some((d, PreviewCorner { at: q, holder, stands_for })); } } } } - if let Some(ch) = n.children() { + // A compound path draws its members with its own appearance: they give no corners of + // their own. + if compound.is_none() + && let Some(ch) = n.children() + { for c in ch.iter().rev() { visit(c, w); } @@ -363,7 +379,7 @@ fn anchor_over_corner(cx: &ToolContext, p: Point, corner: &PreviewCorner, anchor .into_iter() .chain(other) .chain(own) - .filter(|(q, _)| q.distance(p) < corner.at.distance(p)) + .filter(|(q, _)| q.distance(p) < corner.at.distance(p) || q.distance(corner.at) <= 1e-9) .min_by(|(a, _), (b, _)| a.distance(p).total_cmp(&b.distance(p))) } @@ -1462,6 +1478,55 @@ mod tests { assert!(near(q, Point::new(100.0, 100.0)) && reference.is_some_and(|r| r.node == line), "{q:?}"); let (q, reference) = t.snap_linear(&c, Point::new(99.6, 99.6)); assert!(near(q, Point::new(99.5, 99.5)) && reference.is_none() && t.corner == Some(id), "{q:?}"); + // Another path's end right on the corner: a click on the rectangle's anchor picks that end. + let (mut d, _) = doc_with_rect(); + let (l, line) = (d.layers[0].id, d.alloc_id()); + let path = vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(99.5, 99.5), Point::new(50.0, 20.0)], false)); + d.insert(Some(l), 0, Node::path(line, path, Default::default())).expect("the line"); + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + let mut t = DimensionTool::default(); + let (q, reference) = t.snap_linear(&c, Point::new(100.0, 100.0)); + assert!(near(q, Point::new(99.5, 99.5)) && reference.as_ref().is_some_and(|r| r.node == line), "{q:?} {reference:?}"); + // A stroked dot, a path whose two anchors coincide, cannot hold a point at a corner: a + // click by it picks its anchor. + let mut d = vectorcraft_doc::Document::new(500.0, 500.0); + let (l, dot) = (d.layers[0].id, d.alloc_id()); + let path = + vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[Point::new(300.0, 300.0), Point::new(300.0, 300.0)], false)); + let mut round = vectorcraft_doc::Appearance::default_art(); + let stroke = round.stroke_mut().expect("a stroke"); + (stroke.width, stroke.cap) = (10.0, vectorcraft_doc::LineCap::Round); + d.insert(Some(l), 0, Node::path(dot, path, round)).expect("the dot"); + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + let mut t = DimensionTool::default(); + let (q, reference) = t.snap_linear(&c, Point::new(296.0, 296.0)); + assert!(near(q, Point::new(300.0, 300.0)) && reference.is_some_and(|r| r.node == dot) && t.corner.is_none(), "{q:?}"); + // A stroked rectangle made into a guide, and a stroked member of a compound path without + // a stroke of its own, give no corners. + for kind in ["guide", "member"] { + let (mut d, id) = doc_with_rect(); + let mut wide = vectorcraft_doc::Appearance::default_art(); + wide.stroke_mut().expect("a stroke").width = 40.0; + if kind == "guide" { + let n = d.node_mut(id).expect("the rectangle"); + n.appearance = wide.into(); + if let NodeKind::Path { guide, .. } = &mut n.kind { + *guide = true; + } + } else { + let mut fresh = vectorcraft_doc::Document::new(500.0, 500.0); + let (l, part, whole) = (fresh.layers[0].id, fresh.alloc_id(), fresh.alloc_id()); + let mut member = Node::path(part, vectorcraft_geom::shapes::rectangle(Rect::new(100.0, 100.0, 200.0, 200.0)), Default::default()); + member.appearance = wide.into(); + let n = Node::new(whole, NodeKind::Compound { children: vec![std::sync::Arc::new(member)], rule: Default::default() }); + fresh.insert(Some(l), 0, n).expect("the compound path"); + d = fresh; + } + let c = ToolContext { preview_bounds: true, ..cx(&d, &s, &p) }; + let mut t = DimensionTool::default(); + let (q, _) = t.snap_linear(&c, Point::new(81.0, 81.0)); + assert!(!near(q, Point::new(80.0, 80.0)) && t.corner.is_none(), "{kind}: {q:?}"); + } // Two stroked rectangles sharing the edge x = 200; the right one is on top. let (mut d, left) = doc_with_rect(); let (l, right) = (d.layers[0].id, d.alloc_id()); diff --git a/docs/dimensions.md b/docs/dimensions.md index f339ca22b4..b5a15d1f11 100644 --- a/docs/dimensions.md +++ b/docs/dimensions.md @@ -40,8 +40,9 @@ The **Dimension Tool** is in the Modify section of the toolbar. Its strip offers pixels of a corner lands on it instead of on the anchor at the same corner of the object's geometric bounds, and any other anchor, of that object or of other art, that is nearer the pointer than the corner takes the point instead. A corner that is also an anchor, as on a path - without a stroke, takes the anchor. The corners of a group's own strokes or effects, and of - type, are not snapped to. The point is linked to the path (in a compound path, to the member + without a stroke, takes the anchor, and so does another path's anchor right on the corner. The + corners of a group's own strokes or effects, of type, of paths made into guides and of the + members of a compound path on their own are not snapped to. The point is linked to the path (in a compound path, to the member whose own bounds reach nearest to the corner), is held against its anchors and shows the "anchor" label. It does not start construction guides for the second point. For an object that is not rotated, a horizontal or vertical dimension between two such corners measures, when it diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 32dd3dd376..449c484b59 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -646,7 +646,7 @@ since 2026-10-01. **Drawing tools, Dimension tool points on a Smart Guide stay on the guide:** By VectorCraft's own rule, a clicked point that lies on a Smart Guide already, such as one in line with an object's center, stays where the pointer is when no anchor is within 8 pixels and no segment is within the Smart Guides snapping tolerance, instead of moving onto a segment farther than that tolerance and within 8 pixels; with Snap to Grid or Snap to Pixel on, a point stays on the grid or the whole pixel those options give. `a_point_on_a_guide_stays_on_the_guide` covers it. **Drawing tools, Dimension tool second point without construction guides through a first point off the anchors:** By VectorCraft's own rule, with Smart Guides on, the second Linear point does not snap to the construction guides through a first point that is not on an anchor, so a click beside a segment straight below such a first point lands on the segment; after a first point picked on an anchor, the construction guides through it still apply. The second point still snaps to anchors, centers and alignment lines, and with Snap to Perpendicular or Snap to Tangent on, it lands where the line from the first point meets a segment square or grazes a curve. `a_point_on_a_guide_stays_on_the_guide`, `the_second_point_after_an_anchor_lands_on_construction_guides`, `the_second_point_lands_square_to_a_segment_or_grazing_a_curve` and `linear_picks_show_and_snap_to_smart_guides` cover it. **Drawing tools, Dimension tool points land on dimensions already drawn (#8063):** By VectorCraft's own rule, with Smart Guides or Snap to Point on, a Linear point that no anchor of the art within 8 pixels takes lands on the end of a visible, unlocked dimension's dimension line, or on the far end of its extension line, within 8 pixels, and a point that nothing else places lands on the closest point of such a line within 8 pixels, so at any zoom a dimension can start where another one ends. The end of an extension line next to the point it measures does not pull points away from that anchor. With Smart Guides and Anchor/Path Labels on, a point on an anchor or line end shows the "anchor" label and a point on a segment or line shows the "path" label. `linear_picks_land_on_anchors_paths_and_drawn_dimensions` and `an_anchor_beside_a_drawn_dimension_takes_the_point` cover it. -**Drawing tools, Dimension tool points on preview bounds corners (#8537):** With Use Preview Bounds on, a Linear point can land on a corner of the preview bounds of a path or compound path with a stroke or effects; the [linear dimensions help](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/plot-linear-dimensions-of-objects.html) describes measuring a stroked segment by snapping onto its preview bounds. By VectorCraft's own rule, only the four corners are snapped to: a click within 8 pixels of a corner lands on it instead of on the anchor at the same corner of the object's geometric bounds, and any other anchor nearer the pointer takes the point; for an object that is not rotated, a horizontal or vertical dimension between two such corners measures, when it is drawn, the size that W and H show. The edges of the preview bounds, a group's own strokes or effects and type are not snapped to. `with_preview_bounds_points_land_on_the_corners_of_the_stroke`, `preview_bounds_corners_take_picks_as_anchors_do`, `a_corner_takes_only_the_anchor_it_stands_for`, `a_point_is_held_for_a_corner_only_when_picked_on_it` and `hovering_a_corner_of_the_preview_bounds_shows_the_anchor_ring` cover it. +**Drawing tools, Dimension tool points on preview bounds corners (#8537):** With Use Preview Bounds on, a Linear point can land on a corner of the preview bounds of a path or compound path with a stroke or effects; the [linear dimensions help](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/plot-linear-dimensions-of-objects.html) describes measuring a stroked segment by snapping onto its preview bounds. By VectorCraft's own rule, only the four corners are snapped to: a click within 8 pixels of a corner lands on it instead of on the anchor at the same corner of the object's geometric bounds, and any other anchor nearer the pointer takes the point; for an object that is not rotated, a horizontal or vertical dimension between two such corners measures, when it is drawn, the size that W and H show. The edges of the preview bounds, a group's own strokes or effects, type and paths made into guides are not snapped to. `with_preview_bounds_points_land_on_the_corners_of_the_stroke`, `preview_bounds_corners_take_picks_as_anchors_do`, `a_corner_takes_only_the_anchor_it_stands_for`, `a_point_is_held_for_a_corner_only_when_picked_on_it` and `hovering_a_corner_of_the_preview_bounds_shows_the_anchor_ring` cover it. **Drawing tools, Dimension tool lines line up with dimensions already drawn (#8063, #5590):** By VectorCraft's own rule, with Smart Guides on, a linear dimension placed with its line within the Smart Guides snapping tolerance of the level of a parallel line of a visible, unlocked linear dimension already drawn has its line on that level, and with Alignment Guides on a guide runs along the level across both lines while it is placed. `a_dimension_line_placed_beside_another_lands_on_its_level`, `a_dimension_line_on_another_level_shows_one_guide_across_both`, `a_dimension_of_the_same_points_lines_up_and_the_line_follows_the_pointer`, `a_dimension_dragged_out_beside_another_lands_on_its_level` and `a_line_the_pointer_lies_across_wins_on_one_level` cover it. **Drawing tools, Dimension tool dimensions selected with their art keep their lines and label:** Object › Expand, Object › Expand Appearance and Object › Path › Outline Stroke leave a dimension selected with art it measures, directly or in selected groups without fills, strokes or effects of their own, as it is and change only the other art; when the new art no longer fits its link, the dimension stays where it was, no longer linked, and undo links it again. `expand_leaves_a_dimension_selected_with_its_art_as_it_is`, `expand_appearance_leaves_a_dimension_selected_with_its_art_as_it_is`, `outline_stroke_leaves_a_dimension_selected_with_its_art_as_it_is`, `a_dimension_selected_with_art_that_has_nothing_to_expand_changes_nothing`, `a_group_effect_expanded_reaches_the_dimension_it_holds`, `expand_keeps_a_dimension_in_its_asset_and_its_variable_binding`, `a_dimension_keeps_no_link_to_the_art_expand_replaced`, `a_dimension_outlasts_the_art_outline_stroke_or_expand_appearance_replaced`, `a_dimension_outlasts_the_stroke_expand_outlined` and `expand_appearance_in_safe_mode_leaves_a_dimension_selected_with_its_art` cover it. **Drawing tools, Dimension tool Arrow Style shows each arrowhead (#8049):** The Arrow Style dropdown in Dimension Tool Options and in the Properties panel's Dimension section draws each style's arrowhead at the end of a short line before its name, in the open list and in the closed field, using the Stroke panel's arrowhead previews. Filled, Open, Tick and None are the same four styles, saved as before. `arrow_style_shows_a_drawn_arrowhead` and `each_arrow_style_draws_its_stroke_arrowhead_at_both_ends` cover it. From a08ffe592c9f50d7f21605b454579860e1808721 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 19 Nov 2026 00:53:32 +0700 Subject: [PATCH 158/158] script: the unwritten-files error says it isn't the script's own Two merges crossed: one added RunError::authored, the other built a RunError for files a run couldn't write without it, so main stopped compiling. --- crates/engine/src/script/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/engine/src/script/mod.rs b/crates/engine/src/script/mod.rs index 14618a6108..d811da6e2e 100644 --- a/crates/engine/src/script/mod.rs +++ b/crates/engine/src/script/mod.rs @@ -2190,7 +2190,7 @@ impl Session { let unwritten = job.host.flush_files(); if !unwritten.is_empty() { let message = format!("{UNWRITTEN_FILES}: {}", unwritten.join(", ")); - let e = RunError { kind: RunErrorKind::Thrown, message, line: 0, column: 0 }; + let e = RunError { kind: RunErrorKind::Thrown, message, line: 0, column: 0, authored: false }; return self.script_failed(job, &e); } // The working copy goes into the session; `job.world` holds the state before the run.