From 5294f0560d5ba26af0550f72368d31ad91eb18c0 Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Fri, 6 Nov 2026 14:36:02 +0530 Subject: [PATCH 001/540] 5547: show missing-link markers on canvas --- ROADMAP.md | 5 +- crates/engine/src/cmd/links.rs | 58 +++++++++ crates/engine/src/doc_state.rs | 30 +++++ crates/engine/src/link_watch.rs | 37 ++++-- crates/engine/src/tests.rs | 1 + crates/engine/src/tests/missing_links.rs | 135 +++++++++++++++++++++ crates/mcp/src/tests/links.rs | 9 ++ crates/ui-egui/src/canvas.rs | 4 + crates/ui-egui/src/canvas/missing_links.rs | 98 +++++++++++++++ crates/ui-egui/src/canvas/panes.rs | 1 + crates/ui-egui/src/keymap.rs | 1 + crates/ui-egui/src/menus/labels.rs | 5 + crates/ui-egui/src/menus/tree.rs | 1 + crates/ui-egui/src/panels/links.rs | 5 + docs/gaps.md | 5 +- docs/mcp.md | 20 +++ docs/roadmap.md | 7 +- docs/target-app-parity.md | 7 +- docs/ui-parity.md | 6 +- 19 files changed, 421 insertions(+), 14 deletions(-) create mode 100644 crates/engine/src/tests/missing_links.rs create mode 100644 crates/ui-egui/src/canvas/missing_links.rs diff --git a/ROADMAP.md b/ROADMAP.md index 74909b123a..6e06b62d1b 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,5 +1,7 @@ # VectorCraft Roadmap +**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. + - Contour add-on (beyond Illustrator): drag a selected shape's edge outward or inward for a live, editable offset copy, with a floating bar for distance and Sharp, Round or Square corners; Bake turns it into paths. Scores and estimates unchanged. - Compound Shapes add-on (beyond Illustrator): a menu for Make, Release and Expand Compound Shape and a setting, off by default, that makes the Pathfinder panel's Shape Mode buttons create compound shapes on a click. Scores and estimates unchanged. @@ -14,7 +16,7 @@ **Stage: alpha** · next: beta, ~13 points (ready for real work ~62% → ~75%, and reliable `.ai` exchange) and ~170–270 h away -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged VectorCraft is a clean-room, open-source, pure-Rust reimplementation of the Adobe Illustrator workflow. It runs on macOS, Windows, Linux, FreeBSD and the web (WASM), and agents can drive all of it over MCP, the CLI and a JSON @@ -223,6 +225,7 @@ The full earlier record of what landed is kept in [docs/roadmap.md](docs/roadmap | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | | 2026-11-06 | minor | Hindi (`hi`): 7,877-row machine-assisted catalog, zero/one singular plurals, desktop font fallback and optional Devanagari craft-fonts fallback; all 55 translation tests pass; native review and a web font remain; scores and estimates unchanged | | 2026-11-05 | minor | Progress log row for the Type Tools add-on's Release Type on a Path (#5532); headline numbers unchanged. | | 2026-11-03 | minor | Progress log row for the Type Tools add-on's Text Tweaker (#4924); headline numbers unchanged. | diff --git a/crates/engine/src/cmd/links.rs b/crates/engine/src/cmd/links.rs index bcda11c2bd..6608b0f4fd 100644 --- a/crates/engine/src/cmd/links.rs +++ b/crates/engine/src/cmd/links.rs @@ -35,6 +35,12 @@ use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, has_do pub fn specs() -> Vec { vec![ + cmd!(query "view.showMissingLinks", "Show Missing Links", ["View"], None, + "{on?: bool (default: toggle)} show non-printing red outlines and badges on missing linked images and placed documents in the active document; transient view state, no undo step → {on}", + has_doc, show_missing_links), + cmd!(query "links.marked", "Marked Missing Links", [], None, + "{} inspect missing links now; only visible image objects and placed documents are marked, and none when the toggle is off → {on, images: [{id, bounds: [x0, y0, x1, y1]}]}", + has_doc, marked), cmd!( query "links.check", "Check Links", @@ -895,6 +901,7 @@ fn update(s: &mut Session, p: &Value) -> Result { if !reads.is_empty() { s.edit("Update Links", |d, _| reads.into_iter().try_for_each(|(ids, read)| install_read(d, &ids, read, None)))?; } + clear_markers(s, &updated)?; Ok(json!({ "updated": updated, "missing": missing })) } @@ -1015,6 +1022,7 @@ fn relink(s: &mut Session, p: &Value) -> Result { } not_found.sort(); not_found.dedup(); + clear_markers(s, &relinked)?; let mut out = json!({ "relinked": relinked, "notFound": not_found }); if copy_to.is_some() { out["copied"] = json!(copied); @@ -1121,6 +1129,56 @@ pub(crate) fn statuses(st: &crate::DocState) -> BTreeMap) -> Vec { + groups(doc, None) + .iter() + .filter(|g| !g.ids.is_empty() && probe(g, path).0 == Status::Missing) + .flat_map(|g| g.ids.iter().copied()) + .filter(|id| doc.is_visible(*id)) + .collect() +} + +fn show_missing_links(s: &mut Session, p: &Value) -> Result { + let st = s.doc_mut()?; + let on = super::switch_or(p, "on", !st.show_missing_links, "view.showMissingLinks")?; + // An explicit command answers immediately. Subsequent external changes are scanned by + // the existing link watch worker, even when the Links panel is closed. + if on { + st.missing_link_markers = Some((st.doc.clone(), missing_markers(&st.doc, st.path.as_deref()))); + } else { + st.missing_link_markers = None; + } + st.show_missing_links = on; + Ok(json!({"on": on})) +} + +fn marked(s: &mut Session, _: &Value) -> Result { + let st = s.doc_mut()?; + let ids = if st.show_missing_links { missing_markers(&st.doc, st.path.as_deref()) } else { vec![] }; + let images: Vec = ids + .iter() + .filter_map(|id| { + let b = st.doc.node(*id)?.geometric_bounds()?; + Some(json!({"id": id.0, "bounds": [b.x0, b.y0, b.x1, b.y1]})) + }) + .collect(); + st.missing_link_markers = Some((st.doc.clone(), ids)); + Ok(json!({"on": st.show_missing_links, "images": images})) +} + +/// Successful repair clears its decoration even when the file's metadata is unchanged. +fn clear_markers(s: &mut Session, repaired: &[u64]) -> Result<()> { + if !repaired.is_empty() + && let Some((_, ids)) = &mut s.doc_mut()?.missing_link_markers + { + let repaired: std::collections::HashSet<_> = repaired.iter().copied().collect(); + ids.retain(|id| !repaired.contains(&id.0)); + } + Ok(()) +} + /// The format of the file image `im` of `d` shows: its link's extension, else its pixels' type. fn format_label(d: &Document, im: &ImageObject) -> &'static str { im.link diff --git a/crates/engine/src/doc_state.rs b/crates/engine/src/doc_state.rs index 3d1c4be89b..f06765f480 100644 --- a/crates/engine/src/doc_state.rs +++ b/crates/engine/src/doc_state.rs @@ -60,6 +60,10 @@ pub struct DocState { pub mask_view: Option, /// View → Show Transparency Grid, per document (saved view state, not undoable). pub transparency_grid: bool, + /// View → Show Missing Links: transient canvas decoration, never document artwork. + pub show_missing_links: bool, + /// Last worker scan, tied to the exact document snapshot it inspected. + pub missing_link_markers: Option<(Arc, Vec)>, /// The format Save writes ([`cmd::fileio::SAVE_FORMATS`]): the one the document was opened /// from or last saved as. pub format: &'static str, @@ -230,6 +234,30 @@ impl SameContent { } impl DocState { + /// Cached missing links still present and visible in the current art. Geometry-only edits + /// keep their markers moving with the objects; relinking or embedding drops them immediately. + pub fn marked_missing_links(&self) -> Vec { + if !self.show_missing_links { + return vec![]; + } + let Some((before, ids)) = &self.missing_link_markers else { return vec![] }; + fn link(n: &vectorcraft_doc::Node) -> Option<&vectorcraft_doc::LinkInfo> { + match &n.kind { + NodeKind::Image(im) => im.link.as_ref(), + NodeKind::PlacedDocument(p) => Some(&p.link), + _ => None, + } + } + ids.iter() + .copied() + .filter(|id| { + let old = before.node(*id).and_then(link); + let now = self.doc.node(*id).and_then(link); + now.is_some() && now == old && self.doc.is_visible(*id) + }) + .collect() + } + pub fn new(mut doc: Document, path: Option) -> Self { let active_layer = doc.default_layer(); // Saved view state lives here while the document is open (saves write it back). @@ -261,6 +289,8 @@ impl DocState { opened_as_tab: true, mask_view: None, transparency_grid, + show_missing_links: false, + missing_link_markers: None, format: "vectorcraft", save_options: Default::default(), save_artboards: vec![], diff --git a/crates/engine/src/link_watch.rs b/crates/engine/src/link_watch.rs index 44b1bd86a9..ce4f2677ee 100644 --- a/crates/engine/src/link_watch.rs +++ b/crates/engine/src/link_watch.rs @@ -27,9 +27,16 @@ use crate::{Result, Session}; /// A file's size and modification time (nanoseconds since 1970). pub type Stamp = (u64, u128); -/// Stamps of a document's linked files taken on a worker thread: (document uid, [(file, -/// object ids, stamp)]), the condition the worker signals when it ends, and whether it has. -pub type LinkScan = Arc<(Mutex, Option)>)>>, Condvar, AtomicBool)>; +/// A document's linked-file scan, the condition the worker signals when it ends, and whether +/// it has. Includes missing-link marker ids when their view toggle is enabled. +pub type LinkScan = Arc<(Mutex>, Condvar, AtomicBool)>; + +/// A worker's stamps and optional missing-link overlay scan of the same document snapshot. +pub struct LinkScanResult { + uid: u64, + stamps: Vec<(String, Vec, Option)>, + markers: Option<(Arc, Vec)>, +} /// Held by a look's worker: marks the look as ended and wakes [`Session::wait_link_scan`] when /// dropped, whether the worker returned or unwound. @@ -86,7 +93,11 @@ impl Session { // A confined caller's roots, else what the caller that opened the document may read (the // desktop frame is unconfined). let opened_by = st.opened_by.clone(); + let marker_doc = st.show_missing_links.then(|| st.doc.clone()); if files.is_empty() { + if let Some(st) = self.docs.iter_mut().find(|st| st.uid == uid) { + st.missing_link_markers = None; + } return; } let slot: LinkScan = Arc::default(); @@ -95,12 +106,17 @@ impl Session { let spawned = std::thread::Builder::new().name("link-watch".into()).spawn(move || { // Marks the look as ended when the worker returns or unwinds. let _ended = Ended(out.clone()); - let stamps = scope.run(|| { + let (stamps, markers) = scope.run(|| { crate::file_access::confine(crate::file_access::current().or(opened_by).as_ref(), || { - files.into_iter().map(|(p, ids)| (p.clone(), ids, stamp(&p, doc_path.as_deref()))).collect() + let stamps = files.into_iter().map(|(p, ids)| (p.clone(), ids, stamp(&p, doc_path.as_deref()))).collect(); + let markers = marker_doc.map(|doc| { + let ids = crate::cmd::links::missing_markers(&doc, doc_path.as_deref()); + (doc, ids) + }); + (stamps, markers) }) }); - *out.0.lock().unwrap_or_else(PoisonError::into_inner) = Some((uid, stamps)); + *out.0.lock().unwrap_or_else(PoisonError::into_inner) = Some(LinkScanResult { uid, stamps, markers }); }); if spawned.is_ok() { self.link_scan = Some(slot); @@ -110,8 +126,15 @@ impl Session { /// Apply a finished look (`None` while there is none, or it is still running): see /// [`Session::apply_link_stamps`]. pub fn poll_link_scan(&mut self) -> Option> { - let (uid, stamps) = self.link_scan.as_ref()?.0.lock().unwrap_or_else(PoisonError::into_inner).take()?; + let LinkScanResult { uid, stamps, markers } = self.link_scan.as_ref()?.0.lock().unwrap_or_else(PoisonError::into_inner).take()?; self.link_scan = None; + if let Some(st) = self.docs.iter_mut().find(|st| st.uid == uid) + && st.show_missing_links + && let Some((doc, ids)) = markers + && Arc::ptr_eq(&st.doc, &doc) + { + st.missing_link_markers = Some((doc, ids)); + } Some(self.apply_link_stamps(uid, stamps, false)) } diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 812a6282f2..3c5c149ce1 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -95,6 +95,7 @@ mod live; mod livecorners; mod maskview; pub(super) mod menucmds; +mod missing_links; mod nativefile; mod newart; mod newdoc; diff --git a/crates/engine/src/tests/missing_links.rs b/crates/engine/src/tests/missing_links.rs new file mode 100644 index 0000000000..be7244e532 --- /dev/null +++ b/crates/engine/src/tests/missing_links.rs @@ -0,0 +1,135 @@ +//! Canvas marker state and command API, independent of artwork and link update preferences. + +use serde_json::json; + +use crate::tests_links::{Folder, RED, place, png, session, write}; +use crate::*; + +fn marked(s: &mut Session) -> Vec { + s.execute("links.marked", &json!({})).unwrap()["images"].as_array().unwrap().iter().map(|r| r["id"].as_u64().unwrap()).collect() +} + +#[test] +fn missing_link_toggle_is_transient_per_document_and_validated() { + let mut s = session(); + let before = s.doc().unwrap().doc.clone(); + let undo = s.doc().unwrap().history.undo.len(); + assert!(marked(&mut s).is_empty()); + assert_eq!(s.execute("view.showMissingLinks", &json!({"on": true})).unwrap(), json!({"on": true})); + for p in [json!({"on": "false"}), json!({"on": 1}), json!({"on": []})] { + assert!(s.execute("view.showMissingLinks", &p).is_err()); + assert!(s.doc().unwrap().show_missing_links); + } + assert!(std::sync::Arc::ptr_eq(&before, &s.doc().unwrap().doc)); + assert_eq!(s.doc().unwrap().history.undo.len(), undo); + assert!(!s.doc().unwrap().is_dirty()); + s.execute("file.new", &json!({})).unwrap(); + assert!(!s.doc().unwrap().show_missing_links); + s.execute("document.activate", &json!({"index": 0})).unwrap(); + assert!(s.doc().unwrap().show_missing_links); + assert_eq!(s.execute("view.showMissingLinks", &json!({})).unwrap(), json!({"on": false})); + assert!(s.doc().unwrap().missing_link_markers.is_none()); +} + +#[test] +fn missing_link_markers_follow_files_relink_update_and_embed() { + let dir = Folder::new("marker-lifecycle"); + let path = dir.file("art.png"); + let replacement = dir.file("replacement.png"); + let bytes = png(40, 40, RED); + write(&path, &bytes); + write(&replacement, &bytes); + let mut s = session(); + let id = place(&mut s, &path); + s.execute("view.showMissingLinks", &json!({"on": true})).unwrap(); + assert!(marked(&mut s).is_empty()); + std::fs::remove_file(&path).unwrap(); + assert_eq!(marked(&mut s), vec![id.0]); + let doc = s.doc().unwrap().doc.clone(); + let selection = s.doc().unwrap().selection.clone(); + let undo = s.doc().unwrap().history.undo.len(); + let saved = vectorcraft_format::save_file(&doc); + let pixels = vectorcraft_render::Renderer::new().render_region(&doc, vectorcraft_geom::Rect::new(0.0, 0.0, 400.0, 300.0), 1.0, true).pixels; + s.execute("view.showMissingLinks", &json!({"on": false})).unwrap(); + assert!(marked(&mut s).is_empty()); + s.execute("view.showMissingLinks", &json!({"on": true})).unwrap(); + assert_eq!(marked(&mut s), vec![id.0]); + let st = s.doc().unwrap(); + assert_eq!(st.selection, selection); + assert_eq!(st.history.undo.len(), undo); + assert_eq!(vectorcraft_format::save_file(&st.doc), saved); + assert_eq!( + vectorcraft_render::Renderer::new().render_region(&st.doc, vectorcraft_geom::Rect::new(0.0, 0.0, 400.0, 300.0), 1.0, true).pixels, + pixels + ); + s.execute("links.relink", &json!({"ids": [id.0], "path": replacement})).unwrap(); + assert!(s.doc().unwrap().marked_missing_links().is_empty()); + assert!(marked(&mut s).is_empty()); + std::fs::remove_file(&replacement).unwrap(); + assert_eq!(marked(&mut s), vec![id.0]); + write(&replacement, &bytes); + s.execute("links.update", &json!({"ids": [id.0]})).unwrap(); + assert!(s.doc().unwrap().marked_missing_links().is_empty()); + assert!(marked(&mut s).is_empty()); + s.execute("links.embed", &json!({"ids": [id.0]})).unwrap(); + std::fs::remove_file(&replacement).unwrap(); + assert!(marked(&mut s).is_empty()); +} + +#[test] +fn missing_link_worker_refreshes_without_the_panel_and_ignores_old_art() { + for mode in ["automatically", "askWhenModified", "manually"] { + let dir = Folder::new(&format!("marker-watch-{mode}")); + let path = dir.file("art.png"); + let bytes = png(20, 20, RED); + write(&path, &bytes); + let mut s = session(); + s.prefs.update_links = mode.into(); + let id = place(&mut s, &path); + s.execute("view.showMissingLinks", &json!({"on": true})).unwrap(); + let undo = s.doc().unwrap().history.undo.len(); + std::fs::remove_file(&path).unwrap(); + s.start_link_scan(); + s.wait_link_scan(); + s.poll_link_scan().unwrap().unwrap(); + assert_eq!(s.doc().unwrap().missing_link_markers.as_ref().unwrap().1, vec![id]); + write(&path, &bytes); + s.start_link_scan(); + s.wait_link_scan(); + s.poll_link_scan().unwrap().unwrap(); + assert!(s.doc().unwrap().missing_link_markers.as_ref().unwrap().1.is_empty()); + assert_eq!(s.doc().unwrap().history.undo.len(), undo); + std::fs::remove_file(&path).unwrap(); + s.start_link_scan(); + s.wait_link_scan(); + let seen = s.doc().unwrap().missing_link_markers.as_ref().unwrap().0.clone(); + s.execute("shape.rectangle", &json!({"x": 1, "y": 1, "width": 3, "height": 4})).unwrap(); + s.poll_link_scan().unwrap().unwrap(); + assert!(std::sync::Arc::ptr_eq(&seen, &s.doc().unwrap().missing_link_markers.as_ref().unwrap().0)); + assert!(s.doc().unwrap().marked_missing_links().is_empty()); + s.start_link_scan(); + s.wait_link_scan(); + // Switching the toggle off while a look is pending must not resurrect its markers. + s.execute("view.showMissingLinks", &json!({"on": false})).unwrap(); + s.poll_link_scan().unwrap().unwrap(); + assert!(s.doc().unwrap().missing_link_markers.is_none()); + } +} + +#[test] +fn missing_link_markers_include_placed_documents_and_exclude_hidden_art() { + let dir = Folder::new("marker-placed"); + let path = dir.file("placed.vectorcraft"); + write(&path, &vectorcraft_format::save_file(&vectorcraft_doc::Document::new(40.0, 20.0))); + let mut s = session(); + let id = place(&mut s, &path); + assert!(matches!(s.doc().unwrap().doc.node(id).unwrap().kind, vectorcraft_doc::NodeKind::PlacedDocument(_))); + std::fs::remove_file(&path).unwrap(); + s.execute("view.showMissingLinks", &json!({"on": true})).unwrap(); + assert_eq!(marked(&mut s), vec![id.0]); + s.execute("object.move", &json!({"ids": [id.0], "dx": 15, "dy": 10})).unwrap(); + assert_eq!(s.doc().unwrap().marked_missing_links(), vec![id]); + s.execute("object.hide", &json!({"ids": [id.0]})).unwrap(); + assert!(s.doc().unwrap().marked_missing_links().is_empty()); + assert!(marked(&mut s).is_empty()); +} diff --git a/crates/mcp/src/tests/links.rs b/crates/mcp/src/tests/links.rs index 20298fc612..ffb2f8d986 100644 --- a/crates/mcp/src/tests/links.rs +++ b/crates/mcp/src/tests/links.rs @@ -27,8 +27,17 @@ fn headless_links_report_missing_files_and_relink() { let r = run(&mut h, "document.open", json!({"path": file("doc.vectorcraft")})); assert_eq!(r["missingLinks"][0]["ids"], json!([id]), "{r}"); assert_eq!(run(&mut h, "links.check", json!({}))["missing"], 1); + assert_eq!(run(&mut h, "links.marked", json!({})), json!({"on": false, "images": []})); + assert_eq!(run(&mut h, "view.showMissingLinks", json!({"on": true})), json!({"on": true})); + let markers = run(&mut h, "links.marked", json!({})); + assert_eq!(markers["images"][0]["id"], id); + assert_eq!(markers["images"][0]["bounds"].as_array().unwrap().len(), 4); + run(&mut h, "view.showMissingLinks", json!({"on": false})); + assert_eq!(run(&mut h, "links.marked", json!({}))["images"], json!([])); + run(&mut h, "view.showMissingLinks", json!({"on": true})); let r = run(&mut h, "links.relink", json!({"ids": [id], "path": file("b.png")})); assert_eq!(r["relinked"], json!([id])); assert_eq!(run(&mut h, "links.check", json!({}))["links"][0]["status"], "ok"); + assert_eq!(run(&mut h, "links.marked", json!({}))["images"], json!([])); let _ = std::fs::remove_dir_all(dir); } diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 8e3315e357..9cb17deeae 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -24,6 +24,7 @@ mod fill; mod grid; mod home; mod input; +mod missing_links; mod outline; mod overlays; mod panes; @@ -341,6 +342,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { if !revolve_edit { shaper_widget_overlay(app, &painter, &xf); } + if let Some(st) = app.session.active() { + missing_links::paint(st, &painter, &xf, &t); + } } ime_geometry(app, ui.ctx(), &xf); crate::place::paint_drop_highlight(app, ui.ctx(), &painter, rect); diff --git a/crates/ui-egui/src/canvas/missing_links.rs b/crates/ui-egui/src/canvas/missing_links.rs new file mode 100644 index 0000000000..7a25af311e --- /dev/null +++ b/crates/ui-egui/src/canvas/missing_links.rs @@ -0,0 +1,98 @@ +//! Transient, non-interactive decoration. Only canvas painters call this; artwork renderers, +//! printing and export never see it. The link watch worker refreshes the ids off the UI thread. + +use super::{Point, Shape, Stroke, Tokens, Xf}; + +pub(super) fn paint(st: &vectorcraft_engine::DocState, p: &egui::Painter, xf: &Xf, t: &Tokens) { + for id in st.marked_missing_links() { + let Some(b) = st.doc.node(id).and_then(vectorcraft_doc::Node::geometric_bounds) else { continue }; + let pts = xf.quad(b); + let rect = egui::Rect::from_points(&pts); + if !p.clip_rect().intersects(rect.expand(8.0)) { + continue; + } + p.add(Shape::closed_line(pts, Stroke::new(2.0, t.error))); + let at = xf.to_screen(Point::new(b.x0, b.y0)); + p.circle_filled(at, 7.0, t.error); + p.text(at, egui::Align2::CENTER_CENTER, "?", crate::theme::semibold(11.0), egui::Color32::WHITE); + } +} + +#[cfg(test)] +mod tests { + use super::*; + use vectorcraft_doc::{Document, ImageObject, LinkInfo, Node, NodeKind}; + + fn state() -> vectorcraft_engine::DocState { + let mut doc = Document::new(200.0, 150.0); + let layer = doc.layers[0].id; + let id = doc.alloc_id(); + doc.insert( + Some(layer), + 0, + Node::new( + id, + NodeKind::Image(Box::new(ImageObject { + key: "original-test-image".into(), + width: 40, + height: 20, + xf: vectorcraft_geom::Affine::IDENTITY, + link: Some(LinkInfo { path: "missing-marker-test.png".into(), ..Default::default() }), + placement: Default::default(), + pixels: None, + })), + ), + ) + .unwrap(); + let mut st = vectorcraft_engine::DocState::new(doc, None); + st.show_missing_links = true; + st.missing_link_markers = Some((st.doc.clone(), vec![id])); + st + } + + #[test] + fn missing_link_canvas_decoration_tracks_the_view_and_can_be_cleared() { + let mut st = state(); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + for (zoom, rotation) in [(0.25, 0.0), (1.0, 37.0), (8.0, 90.0)] { + let rect = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0)); + let bounds = st.doc.node(st.marked_missing_links()[0]).unwrap().geometric_bounds().unwrap(); + let view = crate::state::View { zoom, rotation, center: bounds.center(), ..Default::default() }; + let xf = Xf::new(rect, &view); + let raw = egui::RawInput { screen_rect: Some(rect), ..Default::default() }; + let mut out = ctx.run_ui(raw, |ui| paint(&st, ui.painter(), &xf, &Tokens::get(ui.ctx()))); + let outline = out + .shapes + .iter() + .find_map(|s| match &s.shape { + Shape::Path(path) if path.closed && path.stroke.width == 2.0 => Some(path), + _ => None, + }) + .expect("missing image has a red closed outline"); + assert_eq!(outline.points, xf.quad(bounds)); + assert_eq!(outline.stroke.color, egui::epaint::ColorMode::Solid(Tokens::get(&ctx).error)); + assert!(out.shapes.iter().any(|s| matches!(&s.shape, Shape::Circle(c) if c.radius == 7.0)), "fixed-size badge at every zoom"); + out.textures_delta.clear(); + } + st.show_missing_links = false; + let mut out = ctx.run_ui(Default::default(), |ui| { + let xf = Xf::new(ui.max_rect(), &Default::default()); + paint(&st, ui.painter(), &xf, &Tokens::get(ui.ctx())); + }); + assert!(!out.shapes.iter().any(|s| matches!(&s.shape, Shape::Path(_) | Shape::Circle(_)))); + out.textures_delta.clear(); + } + + #[test] + fn missing_link_menu_command_uses_the_engine_toggle() { + let mut app = crate::VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", serde_json::json!({})).unwrap(); + assert_eq!(crate::menus::dynamic_label(&app, "view.showMissingLinks", ""), "Show Missing Links"); + app.run("view.showMissingLinks", serde_json::json!({"on": true})).unwrap(); + assert!(app.session.active().unwrap().show_missing_links); + assert_eq!(crate::menus::dynamic_label(&app, "view.showMissingLinks", ""), "Hide Missing Links"); + app.run("view.showMissingLinks", serde_json::json!({"on": false})).unwrap(); + assert!(!app.session.active().unwrap().show_missing_links); + } +} diff --git a/crates/ui-egui/src/canvas/panes.rs b/crates/ui-egui/src/canvas/panes.rs index 5bd974bf92..8fb597488f 100644 --- a/crates/ui-egui/src/canvas/panes.rs +++ b/crates/ui-egui/src/canvas/panes.rs @@ -323,6 +323,7 @@ pub(crate) fn pane(app: &mut VectorcraftApp, ui: &Ui, w: Win, cell: egui::Rect) if app.ui.view.edges { selected_objects(st, &painter, &xf); } + super::missing_links::paint(st, &painter, &xf, &t); if app.ui.view.rulers && app.ui.screen_mode < 3 { rulers(ui, full, &xf, None, RulerScale::document(app.session.general_unit(), st.doc.ruler_origin_for(v.artboard)), &t); } diff --git a/crates/ui-egui/src/keymap.rs b/crates/ui-egui/src/keymap.rs index 572c6b175d..e3d23a1aaa 100644 --- a/crates/ui-egui/src/keymap.rs +++ b/crates/ui-egui/src/keymap.rs @@ -26,6 +26,7 @@ pub const TOGGLES: &[&str] = &[ "view.rulers", "view.boundingBox", "view.transparencyGrid", + "view.showMissingLinks", "view.guides", "view.grid", "view.slices.hide", diff --git a/crates/ui-egui/src/menus/labels.rs b/crates/ui-egui/src/menus/labels.rs index 5820ded942..26353c0bcf 100644 --- a/crates/ui-egui/src/menus/labels.rs +++ b/crates/ui-egui/src/menus/labels.rs @@ -48,6 +48,9 @@ fn window_toggle_label(app: &VectorcraftApp, id: &str) -> Option { "view.transparencyGrid" => { if app.session.active().is_some_and(|d| d.transparency_grid) { "Hide Transparency Grid" } else { "Show Transparency Grid" }.into() } + "view.showMissingLinks" => { + if app.session.active().is_some_and(|d| d.show_missing_links) { "Hide Missing Links" } else { "Show Missing Links" }.into() + } "view.guides" => if v.guides { "Hide Guides" } else { "Show Guides" }.into(), "view.grid" => if v.grid { "Hide Grid" } else { "Show Grid" }.into(), "view.guides.lock" => if app.session.guides_locked() { "Unlock Guides" } else { "Lock Guides" }.into(), @@ -270,6 +273,8 @@ pub const DYNAMIC_LABELS: &[&str] = &[ "Show Bounding Box", "Hide Transparency Grid", "Show Transparency Grid", + "Show Missing Links", + "Hide Missing Links", "Hide Guides", "Show Guides", "Hide Grid", diff --git a/crates/ui-egui/src/menus/tree.rs b/crates/ui-egui/src/menus/tree.rs index 3a55ab37c0..3d6201eb60 100644 --- a/crates/ui-egui/src/menus/tree.rs +++ b/crates/ui-egui/src/menus/tree.rs @@ -560,6 +560,7 @@ pub fn menu_tree_named(english_names: bool) -> Vec<(&'static str, Vec)> { ), c("Hide Bounding Box", "view.boundingBox"), c("Show Transparency Grid", "view.transparencyGrid"), + c("Show Missing Links", "view.showMissingLinks"), c("Hide Text Threads", "view.textThreads"), c("Hide Gradient Annotator", "view.gradientAnnotator"), c("Hide Corner Widget", "view.cornerWidget"), diff --git a/crates/ui-egui/src/panels/links.rs b/crates/ui-egui/src/panels/links.rs index a7fe30185f..0743dc83b7 100644 --- a/crates/ui-egui/src/panels/links.rs +++ b/crates/ui-egui/src/panels/links.rs @@ -538,6 +538,11 @@ fn link_info(ui: &mut Ui, info: Option<&Value>, units: vectorcraft_doc::Unit) { /// The panel's flyout menu: the link commands for the selected rows, Select Linked / Embedded / /// Missing / Modified for the whole document, and the Show, Sort and thumbnail options. pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { + let on = app.session.active().is_some_and(|st| st.show_missing_links); + if menu_item(ui, tl!("Show Missing Links"), app.session.active().is_some(), on) { + crate::menus::invoke(app, "view.showMissingLinks", json!({"on": !on})); + } + ui.separator(); let o = options(ui.ctx()); // The rows the panel shows (the menu opens from it). let list = pstate::(ui.ctx(), "links-cache").list; diff --git a/docs/gaps.md b/docs/gaps.md index adb50d60fe..f29697d26f 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,9 +1,11 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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-06 · **Change:** minor (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) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged ## Feature submission evidence +**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. + Raster rendering fits and preflattens curved stroke outlines more tightly only below four times the raster tolerance, retaining thin-band coverage without changing stroke weight or vector export geometry. Current cached character/object outlines, cropped long strokes, gradient clips and effect rasters share the helper; cropped-region reuse and guarded flattening remain. The unchanged `fractional_curved_strokes_retain_coverage_between_notches` regression covers fractional weights, rotation, phase, opacity and f32-rounded endpoints. This is a quality/cost tradeoff, not a speed claim. Scores and estimates unchanged. **PR #3273 revision — 2026-11-04:** Thin curved stroke coverage ported to the current raster-only cache, cropped-long-stroke and effect paths with guarded flattening; vector export geometry unchanged. Scores and estimates unchanged. @@ -36,6 +38,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | | 2026-11-05 | minor | G15: long open strokes with an undashed width profile are outlined near the view while keeping profile positions on the full path; a 200,000-segment outline took 59.95 ms before and 8.44 ms after in local median runs. Closed and dashed profile strokes remain whole; estimate unchanged. | | 2026-11-05 | minor | G15: Direct Selection reuses one document hit result when choosing the cursor over a path; a 200,000-anchor path's segment cursor took 58.15 ms before and 29.33 ms after in local median runs. Cursor behavior is unchanged; estimate unchanged. | | 2026-11-05 | minor | G15: Selection skips building corner and pie widgets when the pointer is well outside a large selection; empty-canvas hover with 20,000 selected paths took 28.72 ms before and 16.41 ms after in local median runs. Other cursor targets remain active; estimate unchanged. | diff --git a/docs/mcp.md b/docs/mcp.md index 6400a90994..d9bace9acb 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -14,6 +14,26 @@ It has two backends: With no flag, the server tries `127.0.0.1:7979` and falls back to headless. Logs go to stderr; stdout carries only protocol messages. +## Missing-link canvas markers + +Use `run_command` (or its `command_run` alias) with these engine commands: + +```json +{"command":"view.showMissingLinks","params":{"on":true}} +{"command":"links.marked","params":{}} +{"command":"view.showMissingLinks","params":{"on":false}} +``` + +`links.marked` refreshes file status and returns `{on, images: [{id, bounds: [x0, y0, +x1, y1]}]}` for visible missing linked images and placed documents in the active document. +When the toggle is off, `images` is empty; `links.list {show: "missing"}` still lists missing +links independently. Neither command changes selection or undo history. The desktop canvas +draws a red outline and badge, checks files in the background about every two seconds even +with the Links panel closed, and removes markers after repair. The toggle is per open +document and starts off on reopen. Markers are never saved as artwork, rendered into exports +or printing, or exposed as selectable objects. Headless mode exposes the same state and +queries; it has no canvas on which to draw decorations. + ## Install and register From the repository root, with Rust 1.95+ and the platform's source-build prerequisites installed: diff --git a/docs/roadmap.md b/docs/roadmap.md index f3ad64942a..b7758f7036 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,9 +1,11 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged ## Feature submission evidence +**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. + Raster rendering fits and preflattens curved stroke outlines more tightly only below four times the raster tolerance, retaining thin-band coverage without changing stroke weight or vector export geometry. Current cached character/object outlines, cropped long strokes, gradient clips and effect rasters share the helper; cropped-region reuse and guarded flattening remain. The unchanged `fractional_curved_strokes_retain_coverage_between_notches` regression covers fractional weights, rotation, phase, opacity and f32-rounded endpoints. This is a quality/cost tradeoff, not a speed claim. Scores and estimates unchanged. **PR #3273 revision — 2026-11-04:** Thin curved stroke coverage ported to the current raster-only cache, cropped-long-stroke and effect paths with guarded flattening; vector export geometry unchanged. Scores and estimates unchanged. @@ -36,6 +38,7 @@ M7 type: Touch Type moves a right-to-left character along its line and up from i | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | | 2026-11-05 | minor | Effect dialogs: a colour swatch beside a hex colour field follows typed values, and a double-click opens the Color Picker over the dialog, whose OK fills the field (#5365); scores and estimates unchanged. | | 2026-11-05 | minor | Selection Tools add-on: Select Linked, Embedded, Missing and Modified select the images and placed documents with that link status (Object › Plug-ins › Selection Tools and the Links panel menu; Shift adds), and Select by Link Status… lists them by name, status and format to pick from, optionally zooming to them; what is hidden, locked, on a template layer or outside the isolated group is left out and the status bar says how many (#5526, a VectorCraft addition); scores and estimates unchanged (estimated). | | 2026-11-05 | minor | Pencil and Paintbrush: a new stroke with Keep selected off leaves nothing selected, the earlier selection included, while Keep selected on selects only the new path (#5752); scores and estimates unchanged. | @@ -121,7 +124,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l | M2 | Drawing tools + smart guides | ✅ mostly done (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); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537); no View submenu | 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 | | M2 | Drawing tools + smart guides | ✅ mostly done (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) | 12–18 | -| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | ✅ 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 | 3–6 (existing scope; Affinity export unestimated) | +| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | ✅ 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; #5547 adds transient missing-link canvas markers with View/Links controls and command access (focused tests, visual check and full CI pass) | 3–6 (existing scope; Affinity export unestimated) | | 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), 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 | 4–8 | | 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 | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 49824735f9..0976bc79a0 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,9 +1,11 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged ## Feature submission evidence +**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. + Raster rendering fits and preflattens curved stroke outlines more tightly only below four times the raster tolerance, retaining thin-band coverage without changing stroke weight or vector export geometry. Current cached character/object outlines, cropped long strokes, gradient clips and effect rasters share the helper; cropped-region reuse and guarded flattening remain. The unchanged `fractional_curved_strokes_retain_coverage_between_notches` regression covers fractional weights, rotation, phase, opacity and f32-rounded endpoints. This is a quality/cost tradeoff, not a speed claim. Scores and estimates unchanged. **PR #3273 revision — 2026-11-04:** Thin curved stroke coverage ported to the current raster-only cache, cropped-long-stroke and effect paths with guarded flattening; vector export geometry unchanged. Scores and estimates unchanged. @@ -31,6 +33,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | | 2026-11-05 | minor | A nearby hit on a plain long stroke or outline avoids assembling its whole path. A hit near the middle of a 200,000-anchor path took about 11–13 ms before and 1.0–1.4 ms after in paired runs on a busy Windows machine; a miss inside the path's box fell from 18.7 ms to 1.6 ms, while a distant miss was unchanged. Other stroke styles and fill hits keep their existing checks. Scores and estimates unchanged; idle performance budgets remain unverified. | | 2026-11-05 | minor | Translating a type object without changing its text or formatting reuses glyph geometry and expanded character-stroke outlines between frames. The text appears at its new position with unchanged pixels. Scaling the type, editing its content or formatting, or changing installed fonts rebuilds the geometry; scores and estimates unchanged. | | 2026-11-05 | minor | Moving a large selection reuses the object locations found during command validation. A 20,000-object nudge took 58.07 ms before and 51.26 ms after in paired median runs; object positions, selection, and undo behavior stay the same. Scores and estimates unchanged. | @@ -208,7 +211,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | 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, 3 Preferences options stored but unused (#394, audited 2026-10-30: Open Documents As Tabs, Scratch Disks, legacy vector clipboard), SVG Interactivity, context menus beyond the canvas, 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; numeric-field focus and normal text drags regression-tested (#1326, in part); movements below the click threshold still select all; 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 | -| Libraries, Links, Package | 2 | 82% | shared libraries, linked graphics, gradients and patterns as library items (no cloud by design) | 2–3 | estimated | +| Libraries, Links, Package | 2 | 82% | shared libraries, linked graphics, gradients and patterns as library items (no cloud by design) | 2–3 | estimated; #5547: missing-link canvas outlines and badges, View/Links toggles and command API; focused regressions, headless visual check and full CI pass; score and hours unchanged | | 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** | | | Interaction-fidelity pass (every tool's modifiers, cursors, Properties per context) | | | [ui-parity.md](ui-parity.md) | 60–90 | estimated | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index abe967692d..15c2f7bd8e 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,9 +1,11 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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; 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-06 · **Change:** minor (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; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged ## Feature submission evidence +**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. + Raster rendering fits and preflattens curved stroke outlines more tightly only below four times the raster tolerance, retaining thin-band coverage without changing stroke weight or vector export geometry. Current cached character/object outlines, cropped long strokes, gradient clips and effect rasters share the helper; cropped-region reuse and guarded flattening remain. The unchanged `fractional_curved_strokes_retain_coverage_between_notches` regression covers fractional weights, rotation, phase, opacity and f32-rounded endpoints. This is a quality/cost tradeoff, not a speed claim. Scores and estimates unchanged. **PR #3273 revision — 2026-11-04:** Thin curved stroke coverage ported to the current raster-only cache, cropped-long-stroke and effect paths with guarded flattening; vector export geometry unchanged. Scores and estimates unchanged. @@ -38,6 +40,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | | 2026-11-06 | minor | Properties panel in Edit Artboards (Shift+O): a Transform section with the shared reference point, X, Y, W and H, the preset and orientation, and Move and Scale Artwork with Artboard, above the Artboards section with the name, Artboard Options and Fill (#5219); scores and estimates unchanged | | 2026-11-06 | minor | Scrubby labels: the Control bar's Stroke: and Opacity: and the Properties panel's Stroke, links to their panels, scrub the field after them as other labels do; a click still opens the panel (#4088); scores and estimates unchanged | | 2026-11-05 | minor | Direct Selection: Shift-click picks several points of a blend's spine and dragging one moves them all, with the key objects on them, in one undo step (#5285); scores and estimates unchanged | @@ -419,6 +422,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Artwork Cleanup add-on text tools (VectorCraft addition): the panel's Text row, which the panel can hide, and Object › Plug-ins › Artwork Cleanup set the alignment of point type keeping its place, break type into lines (Shift-click: paragraphs), words or glyphs, split type at the cursor, reset a text transform (Alt-click: and its horizontal scale), combine point type, remove line or paragraph breaks and replace missing fonts, each one undo step | done | `addon.cleanup.*` text commands, `crates/ui-egui/src/addons/cleanup.rs` and its tests; a VectorCraft addition, so it is not scored | | Color Effects add-on (VectorCraft addition): live Exposure, Desaturate and Invert Colors in Effect › Color Effects and Object › Plug-ins › Color Effects; its panel picks a colour adjustment and its values and adds it as a live effect or applies it as a filter, into the colours, as one undo step; Select by Color Kind selects the objects that use spot colours, carry colour effects, or are RGB, CMYK or grayscale images; Vector Halftone draws an object as halftone dots live (the dots Object › Vector Halftone makes), which Expand Appearance and the exporters write as paths; Duotone prints each colour's tone with one to four inks (a tint of a spot tone's swatch, or the CMYK mix of several), live or as a filter, its dialog a row per tone and the picked tone's curve; Print Ink Fixes (a CMYK document's ink limit, white overprint removed, black overprint set) opens its options from the submenu and the panel's Inks | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not a feature of the reference app, so it is not scored | | Color Effects add-on (VectorCraft addition): Object › Plug-ins › Color Effects › Find Nearest Swatch… picks a Library (Document Swatches, a built-in library, or a library or colour book the user saved or loaded) and Fill and Stroke, lists each colour of the selection with its three closest swatches (chip, name, ΔE 2000), and Apply gives each colour its nearest swatch (global and spot swatches linked; a library's swatches added to the document first), one undo step | done | #4923; `addon.color.nearestSwatch`, `addon.color.applyNearestSwatch`, `crates/engine/src/cmd/addons/color/nearest.rs`, `crates/ui-egui/src/addons/color/nearest.rs` and their tests; not a feature of the reference app, so it is not scored | +| Missing linked images and placed documents can show red canvas bounds and a badge; View and Links panel toggles share transient per-document state; command API can set and list markers | done | #5547; `cmd/links.rs`, `link_watch.rs`, `canvas/missing_links.rs`; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass | | Selection Tools add-on (VectorCraft addition): Object › Plug-ins › Selection Tools › Select by Artboards… lists every artboard (number, name, width × height in the document's units), filters them by name, chooses several (click, Shift-click for a range, Cmd/Ctrl-click to toggle; Select All / None act on the rows shown; a count of those chosen), fits a row's artboard in the window on double-click and makes it active, and on OK selects the objects overlapping, fully inside or fully outside the chosen artboards (Overlapping is All on Active Artboard's test) | done | #5525, #5548, #5549; `addon.select.byArtboards`, `crates/engine/src/cmd/addons/select.rs`, `crates/ui-egui/src/addons/select.rs` and their tests; not a feature of the reference app | | Selection Tools add-on (VectorCraft addition): Select Linked, Select Embedded, Select Missing and Select Modified in Object › Plug-ins › Selection Tools and the Links panel menu (off when no image has that status; Shift adds to the selection) select the images and placed documents with that link status, leaving out hidden, locked, template-layer and outside-isolation ones, which the status bar counts (e.g. "Selected 9 missing images; 3 more are hidden or locked"); Select by Link Status… lists them with name, status and format, searches by name, filters by status, picks with checkboxes and All / None, and selects with Zoom to Selection on by default | done | #5526; `addon.select.byLinkStatus`, `crates/engine/src/cmd/addons/select.rs`, `crates/ui-egui/src/addons/select/link_status.rs` and their tests; not a feature of the reference app | From 8767f7c5726a590e35fb09a78aafe724807ed2fd Mon Sep 17 00:00:00 2001 From: ruchirguitar <113586074+ruchirguitar@users.noreply.github.com> Date: Fri, 6 Nov 2026 14:44:07 +0530 Subject: [PATCH 002/540] 5547: replace local drafting notes with revision entries --- ROADMAP.md | 6 ++---- docs/gaps.md | 6 ++---- docs/roadmap.md | 8 +++----- docs/target-app-parity.md | 6 ++---- docs/ui-parity.md | 6 ++---- 5 files changed, 11 insertions(+), 21 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 6e06b62d1b..7701b6fe72 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,7 +1,5 @@ # VectorCraft Roadmap -**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. - - Contour add-on (beyond Illustrator): drag a selected shape's edge outward or inward for a live, editable offset copy, with a floating bar for distance and Sharp, Round or Square corners; Bake turns it into paths. Scores and estimates unchanged. - Compound Shapes add-on (beyond Illustrator): a menu for Make, Release and Expand Compound Shape and a setting, off by default, that makes the Pathfinder panel's Shape Mode buttons create compound shapes on a click. Scores and estimates unchanged. @@ -16,7 +14,7 @@ **Stage: alpha** · next: beta, ~13 points (ready for real work ~62% → ~75%, and reliable `.ai` exchange) and ~170–270 h away -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) VectorCraft is a clean-room, open-source, pure-Rust reimplementation of the Adobe Illustrator workflow. It runs on macOS, Windows, Linux, FreeBSD and the web (WASM), and agents can drive all of it over MCP, the CLI and a JSON @@ -225,7 +223,7 @@ The full earlier record of what landed is kept in [docs/roadmap.md](docs/roadmap | Date | Change | Summary | |---|---|---| -| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | +| 2026-11-06 | minor | Show Missing Links in View and the Links panel marks missing linked images and placed documents on the canvas; transient overlays stay out of artwork, export and undo history; command API controls and lists markers (#5547). Regression, visual and full CI checks passed; scores and estimates unchanged. | | 2026-11-06 | minor | Hindi (`hi`): 7,877-row machine-assisted catalog, zero/one singular plurals, desktop font fallback and optional Devanagari craft-fonts fallback; all 55 translation tests pass; native review and a web font remain; scores and estimates unchanged | | 2026-11-05 | minor | Progress log row for the Type Tools add-on's Release Type on a Path (#5532); headline numbers unchanged. | | 2026-11-03 | minor | Progress log row for the Type Tools add-on's Text Tweaker (#4924); headline numbers unchanged. | diff --git a/docs/gaps.md b/docs/gaps.md index f29697d26f..8a4e5f9f0f 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,11 +1,9 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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 -**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. - Raster rendering fits and preflattens curved stroke outlines more tightly only below four times the raster tolerance, retaining thin-band coverage without changing stroke weight or vector export geometry. Current cached character/object outlines, cropped long strokes, gradient clips and effect rasters share the helper; cropped-region reuse and guarded flattening remain. The unchanged `fractional_curved_strokes_retain_coverage_between_notches` regression covers fractional weights, rotation, phase, opacity and f32-rounded endpoints. This is a quality/cost tradeoff, not a speed claim. Scores and estimates unchanged. **PR #3273 revision — 2026-11-04:** Thin curved stroke coverage ported to the current raster-only cache, cropped-long-stroke and effect paths with guarded flattening; vector export geometry unchanged. Scores and estimates unchanged. @@ -38,7 +36,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| -| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | +| 2026-11-06 | minor | Show Missing Links in View and the Links panel marks missing linked images and placed documents on the canvas; transient overlays stay out of artwork, export and undo history; command API controls and lists markers (#5547). Regression, visual and full CI checks passed; scores and estimates unchanged. | | 2026-11-05 | minor | G15: long open strokes with an undashed width profile are outlined near the view while keeping profile positions on the full path; a 200,000-segment outline took 59.95 ms before and 8.44 ms after in local median runs. Closed and dashed profile strokes remain whole; estimate unchanged. | | 2026-11-05 | minor | G15: Direct Selection reuses one document hit result when choosing the cursor over a path; a 200,000-anchor path's segment cursor took 58.15 ms before and 29.33 ms after in local median runs. Cursor behavior is unchanged; estimate unchanged. | | 2026-11-05 | minor | G15: Selection skips building corner and pie widgets when the pointer is well outside a large selection; empty-canvas hover with 20,000 selected paths took 28.72 ms before and 16.41 ms after in local median runs. Other cursor targets remain active; estimate unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index b7758f7036..06c12a3b8a 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -1,11 +1,9 @@ # Roadmap: milestones and what's next -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence -**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. - Raster rendering fits and preflattens curved stroke outlines more tightly only below four times the raster tolerance, retaining thin-band coverage without changing stroke weight or vector export geometry. Current cached character/object outlines, cropped long strokes, gradient clips and effect rasters share the helper; cropped-region reuse and guarded flattening remain. The unchanged `fractional_curved_strokes_retain_coverage_between_notches` regression covers fractional weights, rotation, phase, opacity and f32-rounded endpoints. This is a quality/cost tradeoff, not a speed claim. Scores and estimates unchanged. **PR #3273 revision — 2026-11-04:** Thin curved stroke coverage ported to the current raster-only cache, cropped-long-stroke and effect paths with guarded flattening; vector export geometry unchanged. Scores and estimates unchanged. @@ -38,7 +36,7 @@ M7 type: Touch Type moves a right-to-left character along its line and up from i | Date | Change | Summary | |---|---|---| -| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | +| 2026-11-06 | minor | Show Missing Links in View and the Links panel marks missing linked images and placed documents on the canvas; transient overlays stay out of artwork, export and undo history; command API controls and lists markers (#5547). Regression, visual and full CI checks passed; scores and estimates unchanged. | | 2026-11-05 | minor | Effect dialogs: a colour swatch beside a hex colour field follows typed values, and a double-click opens the Color Picker over the dialog, whose OK fills the field (#5365); scores and estimates unchanged. | | 2026-11-05 | minor | Selection Tools add-on: Select Linked, Embedded, Missing and Modified select the images and placed documents with that link status (Object › Plug-ins › Selection Tools and the Links panel menu; Shift adds), and Select by Link Status… lists them by name, status and format to pick from, optionally zooming to them; what is hidden, locked, on a template layer or outside the isolated group is left out and the status bar says how many (#5526, a VectorCraft addition); scores and estimates unchanged (estimated). | | 2026-11-05 | minor | Pencil and Paintbrush: a new stroke with Keep selected off leaves nothing selected, the earlier selection included, while Keep selected on selects only the new path (#5752); scores and estimates unchanged. | @@ -124,7 +122,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l | M2 | Drawing tools + smart guides | ✅ mostly done (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); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537); no View submenu | 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 | | M2 | Drawing tools + smart guides | ✅ mostly done (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) | 12–18 | -| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | ✅ 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; #5547 adds transient missing-link canvas markers with View/Links controls and command access (focused tests, visual check and full CI pass) | 3–6 (existing scope; Affinity export unestimated) | +| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | ✅ 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; View and Links controls and command access for transient missing-link canvas markers (#5547) | 3–6 (existing scope; Affinity export unestimated) | | 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), 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 | 4–8 | | 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 | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 0976bc79a0..287983bf9a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,11 +1,9 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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) ## Feature submission evidence -**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. - Raster rendering fits and preflattens curved stroke outlines more tightly only below four times the raster tolerance, retaining thin-band coverage without changing stroke weight or vector export geometry. Current cached character/object outlines, cropped long strokes, gradient clips and effect rasters share the helper; cropped-region reuse and guarded flattening remain. The unchanged `fractional_curved_strokes_retain_coverage_between_notches` regression covers fractional weights, rotation, phase, opacity and f32-rounded endpoints. This is a quality/cost tradeoff, not a speed claim. Scores and estimates unchanged. **PR #3273 revision — 2026-11-04:** Thin curved stroke coverage ported to the current raster-only cache, cropped-long-stroke and effect paths with guarded flattening; vector export geometry unchanged. Scores and estimates unchanged. @@ -33,7 +31,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| -| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | +| 2026-11-06 | minor | Show Missing Links in View and the Links panel marks missing linked images and placed documents on the canvas; transient overlays stay out of artwork, export and undo history; command API controls and lists markers (#5547). Regression, visual and full CI checks passed; scores and estimates unchanged. | | 2026-11-05 | minor | A nearby hit on a plain long stroke or outline avoids assembling its whole path. A hit near the middle of a 200,000-anchor path took about 11–13 ms before and 1.0–1.4 ms after in paired runs on a busy Windows machine; a miss inside the path's box fell from 18.7 ms to 1.6 ms, while a distant miss was unchanged. Other stroke styles and fill hits keep their existing checks. Scores and estimates unchanged; idle performance budgets remain unverified. | | 2026-11-05 | minor | Translating a type object without changing its text or formatting reuses glyph geometry and expanded character-stroke outlines between frames. The text appears at its new position with unchanged pixels. Scaling the type, editing its content or formatting, or changing installed fonts rebuilds the geometry; scores and estimates unchanged. | | 2026-11-05 | minor | Moving a large selection reuses the object locations found during command validation. A 20,000-object nudge took 58.07 ms before and 51.26 ms after in paired median runs; object positions, selection, and undo behavior stay the same. Scores and estimates unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 15c2f7bd8e..8c3ecf8eeb 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,11 +1,9 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) · **Local draft:** #5547; full CI and headless visual check pass; scores unchanged +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (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; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x; Units › East Asian Type acts, with Q and Ha units; scores unchanged) ## Feature submission evidence -**#5547 local feature draft — 2026-11-06:** Show Missing Links in View and the Links panel decorates missing linked images and placed documents with a red outline and badge. Markers are transient canvas state; `view.showMissingLinks {on}` controls them and `links.marked` lists their ids and bounds. File checks refresh on the link watch worker with the panel closed; repair clears markers, and artwork rendering, save and undo stay separate. Engine, canvas and MCP focused regressions pass; headless canvas renders with markers on and off were inspected. All 12 `cargo xtask ci` steps pass, including WebAssembly. Scores and estimates unchanged. - Raster rendering fits and preflattens curved stroke outlines more tightly only below four times the raster tolerance, retaining thin-band coverage without changing stroke weight or vector export geometry. Current cached character/object outlines, cropped long strokes, gradient clips and effect rasters share the helper; cropped-region reuse and guarded flattening remain. The unchanged `fractional_curved_strokes_retain_coverage_between_notches` regression covers fractional weights, rotation, phase, opacity and f32-rounded endpoints. This is a quality/cost tradeoff, not a speed claim. Scores and estimates unchanged. **PR #3273 revision — 2026-11-04:** Thin curved stroke coverage ported to the current raster-only cache, cropped-long-stroke and effect paths with guarded flattening; vector export geometry unchanged. Scores and estimates unchanged. @@ -40,8 +38,8 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| -| 2026-11-06 | minor | #5547: missing-link canvas markers, View/Links toggles and command API drafted locally; focused engine/canvas/MCP regressions, headless visual check and full CI (including WebAssembly) pass; scores and estimates unchanged. | | 2026-11-06 | minor | Properties panel in Edit Artboards (Shift+O): a Transform section with the shared reference point, X, Y, W and H, the preset and orientation, and Move and Scale Artwork with Artboard, above the Artboards section with the name, Artboard Options and Fill (#5219); scores and estimates unchanged | +| 2026-11-06 | minor | Show Missing Links in View and the Links panel marks missing linked images and placed documents on the canvas; transient overlays stay out of artwork, export and undo history; command API controls and lists markers (#5547). Regression, visual and full CI checks passed; scores and estimates unchanged. | | 2026-11-06 | minor | Scrubby labels: the Control bar's Stroke: and Opacity: and the Properties panel's Stroke, links to their panels, scrub the field after them as other labels do; a click still opens the panel (#4088); scores and estimates unchanged | | 2026-11-05 | minor | Direct Selection: Shift-click picks several points of a blend's spine and dragging one moves them all, with the key objects on them, in one undo step (#5285); scores and estimates unchanged | | 2026-11-05 | minor | Direct Selection: Cmd/Ctrl held lends the Selection tool, whose bounding box shows while the key is down over objects selected whole; its handles scale and rotate, and a Cmd drag moves the whole object with its direct-selected anchors kept (#3901); scores and estimates unchanged | From 73bef68024b329c0efd8518f83e2bb33d01381ad Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 12 Nov 2026 20:41:06 -0800 Subject: [PATCH 003/540] Concept to Vector: offline Image Trace styles behind a provider boundary Object > Concept to Vector... (also Window, the context menu, the Contextual Task Bar, Properties and the Control bar) opens a panel for one selected image or unexpanded Image Trace object. It makes 1 to 8 styles of the image side by side and Insert Selected puts the ticked ones to the right of the image as one undo step, leaving the image as it is. - Providers register by id in the engine (crates/engine/src/concept_vector.rs). The host checks every result (counts, anchors, coordinates, paints) before it is previewed or inserted, and never uses another provider in place of the one named. The only provider is built in, offline.traceStyles: five styles made with Image Trace (Outline, Ink Lines, Flat Color, Detailed Color, Gray Tones), with Detail 0 to 100. It takes no prompt and makes vector art only. The registry reads a provider's id, name and capabilities once, when it is registered, and refuses a provider that panics then. - Commands: conceptVector.providers, generate, results, cancel and insert. Generate keeps a session job and changes nothing in the document; insert refuses a job whose image, pixels or placement changed. - Results go above a clip group or opacity-masked group around the image; an image on a layer with a clipping mask or an opacity mask is refused. Variations wider than the image keep 24 pt between them. - Previews keep the image's proportions and paint the paths in their order, each path's fill and then its stroke at its width, up to 40,000 points. - On the web build the run is made a part at a time across frames (the image decoded, a style's color layers found, one layer traced), so Cancel takes effect inside a style. vectorcraft_trace::TraceSteps traces one layer a step. The help page: https://helpx.adobe.com/illustrator/desktop/use-generative-ai/generate-vector-artwork-from-images.html --- crates/engine/src/cmd.rs | 2 + crates/engine/src/cmd/conceptvector.rs | 606 +++++++++++++ crates/engine/src/cmd/plugin_call/reviewed.rs | 9 +- crates/engine/src/concept_vector.rs | 259 ++++++ crates/engine/src/concept_vector/offline.rs | 280 ++++++ crates/engine/src/concept_vector/tests.rs | 816 ++++++++++++++++++ crates/engine/src/lib.rs | 4 + crates/engine/src/session/documents.rs | 1 + crates/trace/src/lib.rs | 2 +- crates/trace/src/pipeline.rs | 284 ++++-- crates/trace/src/tests.rs | 40 + crates/ui-egui/src/app.rs | 3 + crates/ui-egui/src/canvas/task_bar.rs | 2 + crates/ui-egui/src/canvas/tests.rs | 25 + crates/ui-egui/src/i18n/bg.tsv | 16 + crates/ui-egui/src/i18n/bs.tsv | 16 + crates/ui-egui/src/i18n/ca.tsv | 38 + crates/ui-egui/src/i18n/cs.tsv | 38 + crates/ui-egui/src/i18n/da.tsv | 16 + crates/ui-egui/src/i18n/de.tsv | 38 + crates/ui-egui/src/i18n/el.tsv | 38 + crates/ui-egui/src/i18n/es.tsv | 38 + crates/ui-egui/src/i18n/fi.tsv | 38 + crates/ui-egui/src/i18n/fr.tsv | 38 + crates/ui-egui/src/i18n/hi.tsv | 38 + crates/ui-egui/src/i18n/hu.tsv | 38 + crates/ui-egui/src/i18n/id.tsv | 16 + crates/ui-egui/src/i18n/it.tsv | 38 + crates/ui-egui/src/i18n/ja.tsv | 38 + crates/ui-egui/src/i18n/ka.tsv | 38 + crates/ui-egui/src/i18n/ko.tsv | 38 + crates/ui-egui/src/i18n/nl.tsv | 16 + crates/ui-egui/src/i18n/pl.tsv | 38 + crates/ui-egui/src/i18n/pt-br.tsv | 38 + crates/ui-egui/src/i18n/ru.tsv | 38 + crates/ui-egui/src/i18n/sv.tsv | 38 + crates/ui-egui/src/i18n/tr.tsv | 38 + crates/ui-egui/src/i18n/uk.tsv | 38 + crates/ui-egui/src/i18n/vi.tsv | 38 + crates/ui-egui/src/i18n/zh-hans.tsv | 38 + crates/ui-egui/src/i18n/zh-hant.tsv | 38 + crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/menus/context.rs | 3 + crates/ui-egui/src/menus/run.rs | 1 + crates/ui-egui/src/menus/state.rs | 1 + crates/ui-egui/src/menus/tree.rs | 3 + crates/ui-egui/src/menus/ui_commands.rs | 6 + crates/ui-egui/src/opening.rs | 1 + crates/ui-egui/src/panels.rs | 2 + crates/ui-egui/src/panels/concept_vector.rs | 582 +++++++++++++ .../src/panels/concept_vector/tests.rs | 413 +++++++++ crates/ui-egui/src/panels/properties.rs | 1 + crates/ui-egui/src/place.rs | 1 + crates/ui-egui/src/state.rs | 1 + docs/gaps.md | 8 +- docs/mcp.md | 30 + docs/roadmap.md | 2 +- docs/target-app-parity.md | 1 + docs/ui-parity.md | 1 + 59 files changed, 4241 insertions(+), 67 deletions(-) create mode 100644 crates/engine/src/cmd/conceptvector.rs create mode 100644 crates/engine/src/concept_vector.rs create mode 100644 crates/engine/src/concept_vector/offline.rs create mode 100644 crates/engine/src/concept_vector/tests.rs create mode 100644 crates/ui-egui/src/panels/concept_vector.rs create mode 100644 crates/ui-egui/src/panels/concept_vector/tests.rs diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index e02382b6b1..63aa779030 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -17,6 +17,7 @@ pub mod colormgmt; pub mod colortheme; pub mod compositefonts; mod compoundshape; +pub mod conceptvector; pub(crate) mod create; mod css; mod cut; @@ -341,6 +342,7 @@ pub fn command_specs() -> &'static [CommandSpec] { v.extend(panelcmds::specs()); v.extend(artboardalign::specs()); v.extend(buildcmds::specs()); + v.extend(conceptvector::specs()); v.extend(shaper::specs()); v.extend(brushsym::specs()); v.extend(patterncmds::specs()); diff --git a/crates/engine/src/cmd/conceptvector.rs b/crates/engine/src/cmd/conceptvector.rs new file mode 100644 index 0000000000..1092b1111c --- /dev/null +++ b/crates/engine/src/cmd/conceptvector.rs @@ -0,0 +1,606 @@ +//! Concept to Vector (`conceptVector.*`): vector variations of one selected image, made by a +//! provider ([`crate::concept_vector`]), compared, and inserted beside the image. +//! +//! `conceptVector.generate` asks the named provider for one variation per style and keeps them as a +//! job of this session; it changes nothing in the document. `conceptVector.insert` puts the chosen +//! variations to the right of the image as one undo step. A job is kept until it is canceled, its +//! document closes, or [`KEEP_JOBS`] newer ones replace it; it is never saved. + +use std::collections::VecDeque; +use std::sync::Arc; + +use serde_json::{Value, json}; +use vectorcraft_color::{Color, Paint}; +use vectorcraft_doc::appearance::{AppearanceItem, FillLayer, LineCap, LineJoin, StrokeLayer}; +use vectorcraft_doc::{Appearance, ImageObject, Node, NodeId, NodeKind}; +use vectorcraft_geom::{Affine, Rect}; + +use super::buildcmds::TRACE_NAME; +use super::edit::selected_roots; +use super::pathops::shape_node; +use super::{CommandSpec, EngineError, Result, Session, always, bad, checked_id, cmd, has_doc, text_param}; +use crate::concept_vector::{self as cv, MAX_STYLES, Output, Provider, ProviderError, Request, Variation}; + +/// The most jobs a session keeps; a new one drops the oldest. +pub const KEEP_JOBS: usize = 4; + +/// The gap, in points, between the image and the first inserted variation, and between variations. +pub const GAP: f64 = 24.0; + +/// A job's variations, or that it was canceled. +enum Outcome { + Done(Vec), + Canceled, +} + +/// What `conceptVector.generate` made, and what it was made of. +struct Job { + id: u64, + /// The document ([`crate::DocState::uid`]) and the object (an image or an Image Trace object). + doc: u64, + source: NodeId, + image: ImageObject, + bytes: Arc>, + provider: String, + outcome: Outcome, +} + +/// The session's providers and jobs. +pub(crate) struct ConceptState { + pub(crate) registry: cv::Registry, + jobs: VecDeque, + next: u64, +} + +impl Default for ConceptState { + fn default() -> Self { + Self { registry: cv::Registry::default(), jobs: VecDeque::new(), next: 1 } + } +} + +impl Session { + /// The Concept to Vector providers this session calls by id. + pub fn concept_providers(&self) -> &cv::Registry { + &self.concept.registry + } + + /// The providers, to register another ([`cv::Registry::register`]). + pub fn concept_providers_mut(&mut self) -> &mut cv::Registry { + &mut self.concept.registry + } + + /// Job `job`'s variations and the size in pixels of the image they were made of; `None` for a + /// job this session does not keep, or one that was canceled. + pub fn concept_variations(&self, job: u64) -> Option<(&[Variation], (u32, u32))> { + let j = self.concept.jobs.iter().find(|j| j.id == job)?; + match &j.outcome { + Outcome::Done(v) => Some((v.as_slice(), (j.image.width, j.image.height))), + Outcome::Canceled => None, + } + } + + /// Drops the jobs whose document is closed. + fn prune_concept_jobs(&mut self) { + let open: Vec = self.documents().iter().map(|d| d.uid).collect(); + self.concept.jobs.retain(|j| open.contains(&j.doc)); + } +} + +/// The image `n` shows: its own, or the source image of an Image Trace object that wasn't expanded. +fn shown_image(n: &Node) -> Option<&ImageObject> { + match &n.kind { + NodeKind::Image(i) => Some(i), + NodeKind::Group { clip: false, .. } if n.name.as_deref() == Some(TRACE_NAME) => match &n.children()?.first()?.kind { + NodeKind::Image(i) => Some(i), + _ => None, + }, + _ => None, + } +} + +const NO_SOURCE: &str = "select one image or an unexpanded Image Trace object"; + +const LOCKED: &str = "the image is locked or hidden"; + +/// The object `id` names, else the one selected: an image or an unexpanded Image Trace object, +/// shown and unlocked with every layer and group around it, and not on a locked artboard → it, its +/// image and the image's bytes. +fn source(s: &Session, c: &str, p: &Value) -> Result<(NodeId, ImageObject, Arc>)> { + let id = match p.get("id").filter(|v| !v.is_null()) { + Some(v) => checked_id(s, v, c)?, + None => match selected_roots(s)?.as_slice() { + [one] => *one, + _ => return Err(bad(c, NO_SOURCE)), + }, + }; + let d = &s.doc()?.doc; + let n = d.node(id).ok_or(EngineError::NoNode(id))?; + let image = shown_image(n).ok_or_else(|| bad(c, NO_SOURCE))?; + if !d.is_editable(id) { + return Err(bad(c, LOCKED)); + } + let blob = d.images.get(&image.key).ok_or_else(|| EngineError::Other(format!("image data `{}` is missing", image.key)))?; + Ok((id, image.clone(), Arc::clone(&blob.bytes))) +} + +/// A generation prepared from the session, which runs without it ([`ConceptRun::run`]), on any +/// thread, and is kept as a job with [`ConceptRun::finish`]. +pub struct ConceptRun { + provider: Arc, + /// The provider's id, as it was registered. + provider_id: &'static str, + request: Request, + doc: u64, + source: NodeId, + image: ImageObject, +} + +impl ConceptRun { + /// What `conceptVector.generate` with params `p` makes in the active document, checked as the + /// command checks it. + pub fn prepare(s: &Session, p: &Value) -> Result { + const C: &str = "conceptVector.generate"; + let name = text_param(p, "provider", C)?.ok_or_else(|| bad(C, "missing `provider` (see conceptVector.providers)"))?; + let found = + s.concept.registry.get(name).ok_or_else(|| bad(C, format!("no Concept to Vector provider `{name}` (see conceptVector.providers)")))?; + let (caps, pid, provider) = (&found.capabilities, found.id, Arc::clone(&found.provider)); + let styles_error = || bad(C, format!("`styles` must list 1 to 8 different style ids of `{pid}` (see conceptVector.providers)")); + let styles: Vec = match p.get("styles") { + Some(Value::Array(a)) => a.iter().map(|v| v.as_str().map(str::to_string)).collect::>().ok_or_else(styles_error)?, + _ => return Err(styles_error()), + }; + let known = |id: &String| caps.styles.iter().any(|st| st.id == id); + let unique = styles.iter().enumerate().all(|(i, id)| !styles.get(..i).unwrap_or_default().contains(id)); + if styles.is_empty() || styles.len() > MAX_STYLES || !unique || !styles.iter().all(known) { + return Err(styles_error()); + } + let prompt = text_param(p, "prompt", C)?.map(str::trim).filter(|t| !t.is_empty()).map(str::to_string); + // Results are vector paths, inserted as vector art, whatever else a provider makes. + let output = match text_param(p, "output", C)? { + None | Some("vector") => Output::Vector, + Some(_) => return Err(bad(C, "`output` must be \"vector\"")), + }; + let unsupported = (prompt.is_some() && !caps.prompt) || !caps.vector_output; + if unsupported || !caps.image_input { + return Err(bad(C, format!("`{pid}` takes no prompt and makes vector art only"))); + } + let detail = match p.get("detail") { + None | Some(Value::Null) => 50, + Some(v) => v.as_u64().filter(|d| *d <= 100).ok_or_else(|| bad(C, "`detail` must be a whole number from 0 to 100"))? as u8, + }; + let (source, image, bytes) = source(s, C, p)?; + let request = Request { image: bytes, width: image.width, height: image.height, prompt, styles, detail, output }; + Ok(ConceptRun { provider, provider_id: pid, request, doc: s.doc()?.uid, source, image }) + } + + /// The document it was prepared in ([`crate::DocState::uid`]). + pub fn doc(&self) -> u64 { + self.doc + } + + /// The image or Image Trace object it makes variations of. + pub fn source(&self) -> NodeId { + self.source + } + + /// Asks the provider for the variations and checks them ([`cv::check_result`]), telling `steps` + /// how far it has got; it touches no document. A panic in the provider is an error. + pub fn run(&self, steps: cv::Steps) -> std::result::Result, ProviderError> { + let made = crate::guard::catch_panic(|| self.provider.generate(&self.request, steps)).map_err(ProviderError::Internal)??; + cv::check_result(&self.request, &made)?; + Ok(made) + } + + /// How many styles it makes. + pub fn style_count(&self) -> usize { + self.request.styles.len() + } + + /// Does the next part of the run kept in `run`, for a caller with no thread for + /// [`ConceptRun::run`] (the web build), which can run other work, or stop, between the parts + /// → whether every style is made ([`PartRun::made`]). A provider that makes parts + /// ([`cv::Provider::parts`]) does one of its own; the others make one style alone, and the + /// styles made so far are checked together ([`cv::check_result`]) after each one, so the + /// totals stop the run as soon as they are passed. A panic in the provider is an error. + pub fn run_part(&self, run: &mut PartRun, steps: cv::Steps) -> std::result::Result { + let guard = ProviderError::Internal; + if run.parts.is_none() { + run.parts = Some(crate::guard::catch_panic(|| self.provider.parts(&self.request)).map_err(guard)?); + } + if let Some(Some(parts)) = &mut run.parts { + if !steps(parts.styles_done() as u64, self.style_count() as u64) { + return Err(ProviderError::Canceled); + } + let Some(made) = crate::guard::catch_panic(|| parts.step()).map_err(guard)?? else { return Ok(false) }; + cv::check_result(&self.request, &made)?; + run.made = made; + return Ok(true); + } + let Some(style) = self.request.styles.get(run.made.len()) else { return Ok(true) }; + let one = Request { styles: vec![style.clone()], ..self.request.clone() }; + let next = crate::guard::catch_panic(|| self.provider.generate(&one, steps)).map_err(guard)??; + cv::check_result(&one, &next)?; + run.made.extend(next); + let so_far = Request { styles: self.request.styles.get(..run.made.len()).unwrap_or_default().to_vec(), ..one }; + cv::check_result(&so_far, &run.made)?; + Ok(run.made.len() == self.request.styles.len()) + } + + /// Keeps `variations` as a new job of `s` → the job, as `conceptVector.results` gives it; + /// `None`, keeping nothing, when the document it was prepared in has closed. + pub fn finish(self, s: &mut Session, variations: Vec) -> Option { + s.prune_concept_jobs(); + if !s.documents().iter().any(|d| d.uid == self.doc) { + return None; + } + let id = s.concept.next; + s.concept.next += 1; + let job = Job { + id, + doc: self.doc, + source: self.source, + image: self.image, + bytes: self.request.image, + provider: self.provider_id.to_string(), + outcome: Outcome::Done(variations), + }; + let out = job_json(&s.concept.registry, &job); + s.concept.jobs.push_back(job); + while s.concept.jobs.len() > KEEP_JOBS { + s.concept.jobs.pop_front(); + } + Some(out) + } +} + +/// How far a run made a part at a time ([`ConceptRun::run_part`]) has got. +#[derive(Default)] +pub struct PartRun { + /// The provider's parts, once asked for (`None` inside: it makes one style at a time). + parts: Option>>, + made: Vec, +} + +impl PartRun { + /// The styles made so far. + pub fn styles_done(&self) -> usize { + match &self.parts { + Some(Some(parts)) if self.made.is_empty() => parts.styles_done(), + _ => self.made.len(), + } + } + + /// The variations made: all of them once [`ConceptRun::run_part`] has said so. + pub fn made(self) -> Vec { + self.made + } +} + +/// `e` as the engine's error. +pub fn provider_error(e: ProviderError) -> EngineError { + match e { + ProviderError::Canceled => EngineError::Cancelled, + e => EngineError::Other(e.to_string()), + } +} + +/// The English name of style `style` of provider `provider`, else the id. +fn style_label(registry: &cv::Registry, provider: &str, style: &str) -> String { + let caps = registry.get(provider).map(|p| &p.capabilities); + caps.and_then(|c| c.styles.iter().find(|s| s.id == style).map(|s| s.label.to_string())).unwrap_or_else(|| style.to_string()) +} + +/// Where `image`'s pixels lie in the document. +fn image_rect(image: &ImageObject) -> Option { + let r = Rect::new(0.0, 0.0, f64::from(image.width.max(1)), f64::from(image.height.max(1))); + let pts = [(r.x0, r.y0), (r.x1, r.y0), (r.x1, r.y1), (r.x0, r.y1)].map(|(x, y)| image.xf * kurbo::Point::new(x, y)); + let mut out = Rect::from_points(pts[0], pts[0]); + for q in &pts[1..] { + out = out.union_pt(*q); + } + [out.x0, out.y0, out.x1, out.y1].iter().all(|v| v.is_finite()).then_some(out) +} + +fn job_json(registry: &cv::Registry, j: &Job) -> Value { + let (state, variations) = match &j.outcome { + Outcome::Done(v) => ("done", v.as_slice()), + Outcome::Canceled => ("canceled", &[][..]), + }; + let variations: Vec = variations + .iter() + .map(|v| { + let bounds = v.paths.iter().filter_map(|p| p.path.bounds()).reduce(|a, b| a.union(b)); + json!({ + "style": v.style, + "label": style_label(registry, &j.provider, &v.style), + "paths": v.paths.len(), + "anchors": v.anchors(), + "bounds": bounds.map(|b| [b.x0, b.y0, b.x1, b.y1]), + "warnings": v.warnings, + }) + }) + .collect(); + json!({ "job": j.id, "provider": j.provider, "source": j.source.0, "state": state, "variations": variations }) +} + +/// The `job` param of command `c`. +fn job_param(c: &str, p: &Value) -> Result { + p.get("job").and_then(Value::as_u64).ok_or_else(|| bad(c, "`job` must be a job number from conceptVector.generate")) +} + +/// The error of command `c` for a job the session does not keep. +fn no_job(c: &str, job: u64) -> EngineError { + bad(c, format!("no Concept to Vector job {job}: it was never made, or was dropped (see conceptVector.results)")) +} + +/// The index of job `job` among those `s` keeps. +fn job_index(s: &mut Session, c: &str, job: u64) -> Result { + s.prune_concept_jobs(); + s.concept.jobs.iter().position(|j| j.id == job).ok_or_else(|| no_job(c, job)) +} + +fn providers(s: &mut Session, _: &Value) -> Result { + let list: Vec = s + .concept + .registry + .iter() + .map(|p| { + let c = &p.capabilities; + json!({ + "id": p.id, + "name": p.name, + "available": true, + "offline": c.offline, + "imageInput": c.image_input, + "vectorOutput": c.vector_output, + "prompt": c.prompt, + "rasterOutput": c.raster_output, + "maxStyles": MAX_STYLES, + "styles": c.styles, + }) + }) + .collect(); + let selected = s.concept.registry.iter().next().map(|p| p.id); + Ok(json!({ "providers": list, "selected": selected })) +} + +fn generate(s: &mut Session, p: &Value) -> Result { + let run = ConceptRun::prepare(s, p)?; + let made = run.run(&|_, _| true).map_err(provider_error)?; + run.finish(s, made).ok_or(EngineError::NoDocument) +} + +fn results(s: &mut Session, p: &Value) -> Result { + const C: &str = "conceptVector.results"; + let job = job_param(C, p)?; + let at = job_index(s, C, job)?; + let j = s.concept.jobs.get(at).ok_or_else(|| no_job(C, job))?; + Ok(job_json(&s.concept.registry, j)) +} + +fn cancel(s: &mut Session, p: &Value) -> Result { + const C: &str = "conceptVector.cancel"; + let job = job_param(C, p)?; + let at = job_index(s, C, job)?; + if let Some(j) = s.concept.jobs.get_mut(at) { + j.outcome = Outcome::Canceled; + } + Ok(json!({ "job": job, "state": "canceled" })) +} + +/// The appearance of variation path `p`, its widths scaled by `unit` (points per pixel). +fn appearance_of(p: &cv::VectorPath, unit: f64) -> Appearance { + let solid = |c: [u8; 3]| Paint::solid(Color::rgb8(c[0], c[1], c[2])); + let mut items = vec![]; + if let Some(c) = p.fill { + items.push(AppearanceItem::Fill(FillLayer::new(solid(c)))); + } + if let Some((c, w)) = p.stroke { + items.push(AppearanceItem::Stroke(StrokeLayer { cap: LineCap::Round, join: LineJoin::Round, ..StrokeLayer::new(solid(c), w * unit) })); + } + Appearance { items, ..Default::default() } +} + +fn insert(s: &mut Session, p: &Value) -> Result { + const C: &str = "conceptVector.insert"; + let job = job_param(C, p)?; + let at = job_index(s, C, job)?; + let list_error = || bad(C, format!("`variations` must list different style ids of job {job}")); + let chosen: Vec = match p.get("variations") { + Some(Value::Array(a)) if !a.is_empty() => a.iter().map(|v| v.as_str().map(str::to_string)).collect::>().ok_or_else(list_error)?, + _ => return Err(list_error()), + }; + let stale = || bad(C, format!("job {job} no longer applies: its document, image or image placement changed, so generate again")); + let (doc, source, image, bytes, picked, label_of) = { + let j = s.concept.jobs.get(at).ok_or_else(|| no_job(C, job))?; + let Outcome::Done(all) = &j.outcome else { return Err(bad(C, format!("job {job} has no results to insert: it was canceled"))) }; + let unique = chosen.iter().enumerate().all(|(i, id)| !chosen.get(..i).unwrap_or_default().contains(id)); + // In the provider's order, whatever order they were listed in. + let picked: Vec = all.iter().filter(|v| chosen.contains(&v.style)).cloned().collect(); + if !unique || picked.len() != chosen.len() { + return Err(list_error()); + } + let labels: Vec = picked.iter().map(|v| style_label(&s.concept.registry, &j.provider, &v.style)).collect(); + (j.doc, j.source, j.image.clone(), Arc::clone(&j.bytes), picked, labels) + }; + // The same document, the same object showing the same pixels where they were. + let st = s.doc()?; + let now = st.doc.node(source).and_then(shown_image); + let same_pixels = || st.doc.images.get(&image.key).is_some_and(|b| Arc::ptr_eq(&b.bytes, &bytes) || *b.bytes == *bytes); + let current = st.uid == doc && now.is_some_and(|i| i.key == image.key && i.xf == image.xf && i.width == image.width && i.height == image.height); + if !current || !same_pixels() { + return Err(stale()); + } + if !st.doc.is_editable(source) { + return Err(bad(C, LOCKED)); + } + // The results go above the outermost group around the image that clips or masks it, so that + // it hides none of them; a layer that clips or masks its art leaves them nowhere to go. + let mut anchor = source; + for &id in st.doc.ancestry(source).ok_or_else(stale)?.iter().rev().skip(1) { + let n = st.doc.node(id).ok_or_else(stale)?; + let masked = n.extras().mask.as_ref().is_some_and(|m| !m.disabled); + if matches!(n.kind, NodeKind::Layer { clip: true, .. }) { + return Err(bad(C, "the image is on a layer with a clipping mask, which would hide the results")); + } + if n.is_layer() && masked { + return Err(bad(C, "the image is on a layer with an opacity mask, which would hide the results")); + } + if !n.is_layer() && (masked || matches!(n.kind, NodeKind::Group { clip: true, .. })) { + anchor = id; + } + } + let src = image_rect(&image).ok_or_else(stale)?; + let unit = image.xf.determinant().abs().sqrt(); + // Each chosen variation's box over the image: the image's box and the variation's painted + // bounds, which may reach past it. + let boxes: Vec = picked + .iter() + .map(|v| { + v.paths + .iter() + .filter_map(|vp| { + let half = vp.stroke.map_or(0.0, |(_, w)| w * unit / 2.0); + vp.path.transformed(image.xf).bounds().map(|b| b.inflate(half, half)) + }) + .fold(src, |a, b| a.union(b)) + }) + .collect(); + // How far each variation's box is moved past the first's: each box starts GAP to the right of + // the one before it (`width + GAP` further right for boxes the image's size). + let mut offsets = Vec::with_capacity(boxes.len()); + let mut next = 0.0; + for (k, b) in boxes.iter().enumerate() { + if let Some(prev) = k.checked_sub(1).and_then(|j| boxes.get(j)) { + next += prev.x1 - b.x0 + GAP; + } + offsets.push(next); + } + // The first box's left edge, which may lie left of the image's where its variation paints there. + let first = boxes.first().map_or(src.x0, |b| b.x0); + // The boxes with the first one's left edge moved to `x0`, the others after it. + let row = |x0: f64| -> Vec { + boxes + .iter() + .zip(&offsets) + .map(|(b, off)| { + let dx = x0 + off - first; + Rect::new(b.x0 + dx, b.y0, b.x1 + dx, b.y1) + }) + .collect() + }; + // The painted bounds of every other visible object, by its outermost object in each layer, + // and the image's own box. + let mut obstacles: Vec = vec![src]; + let mut stack: Vec<&Arc> = st.doc.layers.iter().collect(); + while let Some(node) = stack.pop() { + if !node.visible || node.id == source { + continue; + } + if node.is_layer() { + stack.extend(node.children().into_iter().flatten()); + } else if let Some(b) = vectorcraft_render::painted_bounds(&st.doc, node) { + obstacles.push(b); + } + } + let meets = |a: &Rect, b: &Rect| a.x0 < b.x1 && b.x0 < a.x1 && a.y0 < b.y1 && b.y0 < a.y1; + // Only objects level with some box can be in the row's way. + let top = boxes.iter().map(|b| b.y0).fold(src.y0, f64::min); + let bottom = boxes.iter().map(|b| b.y1).fold(src.y1, f64::max); + obstacles.retain(|o| o.y0 < bottom && top < o.y1); + let mut x0 = src.x1 + GAP; + let mut placed = false; + // Each move takes one box past one obstacle for good, as the row only moves right. + for _ in 0..=obstacles.len() * boxes.len() { + // The first box in the way, moved past the rightmost object it meets. + let shift = + row(x0).iter().find_map(|r| obstacles.iter().filter(|o| meets(o, r)).map(|o| o.x1).reduce(f64::max).map(|right| right + GAP - r.x0)); + match shift { + None => { + placed = true; + break; + } + Some(by) => x0 += by, + } + } + let right = row(x0).iter().map(|r| r.x1).fold(f64::NEG_INFINITY, f64::max); + let room = || bad(C, "there is no room for the results to the right of the image"); + if !placed || !x0.is_finite() || right > crate::MAX_COORD { + return Err(room()); + } + let ids = s.edit("Concept to Vector", |d, sel| { + let mut groups = vec![]; + for ((v, label), off) in picked.into_iter().zip(label_of).zip(&offsets) { + let dx = x0 + off - first; + let xf = Affine::translate((dx, 0.0)) * image.xf; + let mut members = Vec::with_capacity(v.paths.len()); + for vp in &v.paths { + let path = vp.path.transformed(xf); + if path.bounds().is_some_and(|b| [b.x0, b.y0, b.x1, b.y1].iter().any(|c| c.abs() > crate::MAX_COORD)) { + return Err(room()); + } + let mut node = shape_node(d, path, None); + node.appearance = appearance_of(vp, unit).into(); + members.push(Arc::new(node)); + } + let mut g = Node::group(d.alloc_id(), members); + g.name = Some(label); + groups.push(g); + } + let ids: Vec = groups.iter().map(|g| g.id).collect(); + d.insert_beside(vec![(anchor, groups)], false)?; + sel.set(ids.iter().copied()); + Ok(ids) + })?; + Ok(json!({ "ids": ids.iter().map(|i| i.0).collect::>() })) +} + +pub fn specs() -> Vec { + vec![ + cmd!( + query "conceptVector.providers", + "Concept to Vector Providers", + [], + None, + "{} → {providers: [{id, name, available, offline, imageInput, vectorOutput, prompt, rasterOutput, maxStyles: 8, styles: [{id, label}]}], selected: the id the panel uses} the providers conceptVector.generate can call by id; the built-in offline.traceStyles makes its styles with Image Trace on this computer (outline, inkLines, flatColor, detailedColor, grayTones), takes no prompt and makes vector art only", + always, + providers + ), + cmd!( + query "conceptVector.generate", + "Generate Concept to Vector Styles", + [], + None, + "{id?: image or unexpanded Image Trace object (default: the one selected object), provider: id (conceptVector.providers; no other provider is used in its place), styles: [style id…] (1 to 8 different ids of that provider), detail?: 0-100 (50: how much of the image's detail each style keeps), prompt?: text (an error for a provider without prompts unless empty), output?: \"vector\" (the only output; any other value is an error)} one variation of the image for each style, kept by this session as a job and not put in the document; an object that is locked or hidden, itself or by a layer or group around it, or on a locked artboard, is refused → {job, provider, source: id, state: \"done\", variations: [{style, label, paths, anchors, bounds: [x0,y0,x1,y1] in the image's pixels, warnings: [text…]}]}", + has_doc, + generate + ), + cmd!( + query "conceptVector.results", + "Concept to Vector Results", + [], + None, + "{job} a job conceptVector.generate made, as it returned it, or with state \"canceled\" and no variations; the session keeps the 4 newest jobs, until their document closes → {job, provider, source, state, variations}", + has_doc, + results + ), + cmd!( + query "conceptVector.cancel", + "Cancel Concept to Vector Job", + [], + None, + "{job} drop a job's variations, so that it can't be inserted; canceling it again does the same → {job, state: \"canceled\"}", + has_doc, + cancel + ), + cmd!( + "conceptVector.insert", + "Insert Concept to Vector Styles", + [], + None, + "{job, variations: [style id…] (different styles of the job)} put a group of each chosen variation, named after its style and in the provider's order, in a row to the right of the job's image, each the image's size with 24 pt between them, moved further right past other visible art in their way, where a variation reaches past its box too (the next one then starts 24 pt past what it paints); the groups go above the outermost clip group or opacity-masked group around the image; the image and other art stay as they are; one undo step; an error when the job's document is not the active one, the object, its image or its placement changed, the object is now locked or hidden, or it is on a layer with a clipping mask or an opacity mask → {ids: the groups, selected}", + has_doc, + insert + ), + ] +} diff --git a/crates/engine/src/cmd/plugin_call/reviewed.rs b/crates/engine/src/cmd/plugin_call/reviewed.rs index c4b21b1cb4..ba2424786d 100644 --- a/crates/engine/src/cmd/plugin_call/reviewed.rs +++ b/crates/engine/src/cmd/plugin_call/reviewed.rs @@ -687,12 +687,17 @@ pub(super) const ALLOWED: &[&str] = &[ ]; /// Commands a plug-in may not call although no rule refuses them, in order: they change the -/// preferences, a tool's options, a drag's state or the font names the whole app knows, or run -/// plug-ins again. +/// preferences, a tool's options, a drag's state or the font names the whole app knows, run +/// plug-ins again, or hand an image to a Concept to Vector provider and its results. pub(super) const DENIED: &[&str] = &[ "addon.cleanup.splitText", "addon.pathtools.movePointsTogether", "addon.pen.nextSegment", + "conceptVector.cancel", + "conceptVector.generate", + "conceptVector.insert", + "conceptVector.providers", + "conceptVector.results", "effect.refreshDeferred", "graphicStyle.setOptions", "object.blend.createSpine", diff --git a/crates/engine/src/concept_vector.rs b/crates/engine/src/concept_vector.rs new file mode 100644 index 0000000000..53884eff0f --- /dev/null +++ b/crates/engine/src/concept_vector.rs @@ -0,0 +1,259 @@ +//! Concept to Vector providers: what makes vector variations of a selected image. +//! +//! A provider ([`Provider`]) takes one image's encoded pixels and up to [`MAX_STYLES`] of its own +//! style ids ([`Request`]), and returns one [`Variation`] per style, in the order asked, as paths +//! in the image's pixel space with explicit paints. It sees nothing else of the session or the +//! document. The session keeps the providers in a [`Registry`] and calls one only by its id: an +//! unknown or incapable provider is an error, never a substitute. +//! +//! The host checks every result again ([`check_result`]) before it keeps it, whatever provider +//! made it: the number and order of the variations, finite coordinates and widths within bounds, +//! and the totals [`MAX_ANCHORS`] and [`MAX_PATHS`] across all styles. +//! +//! The one built-in provider ([`offline::ID`]) makes its styles with Image Trace, on this +//! computer: it takes no prompt and makes vector art only. + +pub mod offline; +#[cfg(test)] +mod tests; + +use std::sync::Arc; + +use vectorcraft_geom::{PathData, Point}; + +/// The most styles one request may ask for. +pub const MAX_STYLES: usize = 8; + +/// The most anchor points all the variations of one request may hold together. +pub const MAX_ANCHORS: usize = 1_000_000; + +/// The most paths all the variations of one request may hold together. +pub const MAX_PATHS: usize = 250_000; + +/// The most warnings a variation may carry, and the most characters in each. +pub const MAX_WARNINGS: usize = 16; +const MAX_WARNING_CHARS: usize = 500; + +/// One of a provider's styles: its stable id and its English name. +#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize)] +pub struct Style { + pub id: &'static str, + pub label: &'static str, +} + +/// What a provider takes and makes. +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct Capabilities { + /// It takes an image as its input. + pub image_input: bool, + /// It makes editable vector paths. + pub vector_output: bool, + /// It takes a text prompt. + pub prompt: bool, + /// It makes raster images. + pub raster_output: bool, + /// It runs on this computer without a network. + pub offline: bool, + /// Its styles, in the order it lists them. + pub styles: Vec