From 1ca3db1b518038d19c003dc1a504c2bf462f2f89 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 16:00:38 +0700 Subject: [PATCH 001/227] =?UTF-8?q?Add-ons:=20Smart=20Pen=20=E2=80=94=20dr?= =?UTF-8?q?aw=20and=20edit=20paths=20with=20one=20tool,=20panel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A built-in add-on under Object › Plug-ins › Smart Pen: - The Smart Pen Tool draws and edits Bézier paths without switching tools: a click adds the next segment straight or curved (a panel toggle; Tab flips the segment being placed or the last one), a drag makes a smooth point (Alt breaks the handle, Shift snaps to 45°, Space moves the point), a curve after a straight segment joins it tangent. - On existing paths it selects and moves points, removes a point keeping the shape (Alt-click), toggles smooth/corner (double-click), drags handles, reshapes a segment by dragging it and inserts a point on it (Alt-click); it closes, continues and joins open paths. - The Smart Pen panel: next segment straight or curved, remove points keeping shape, make smooth, make corner, retract handles, close or join. The tool stays out of both toolbars as shipped; the All Tools drawer lists it under the add-on's heading. Commands are addon.pen.*; the existing Pen tool, commands and menus are unchanged. --- crates/engine/src/cmd/addons.rs | 2 + crates/engine/src/cmd/addons/pathtools.rs | 4 +- crates/engine/src/cmd/addons/pen.rs | 349 ++++++++++++ crates/engine/src/cmd/addons/pen/tests.rs | 287 ++++++++++ crates/engine/src/cmd/path.rs | 4 +- crates/engine/tests/command_sweep.rs | 16 + crates/pathops/src/addons.rs | 6 + crates/pathops/src/addons/pathtools.rs | 2 +- crates/pathops/src/addons/pen.rs | 196 +++++++ crates/pathops/src/addons/segment_reshape.rs | 208 +++++++ crates/tools/src/addons.rs | 17 +- crates/tools/src/addons/smart_pen.rs | 553 +++++++++++++++++++ crates/tools/src/addons/smart_pen/tests.rs | 310 +++++++++++ crates/tools/src/catalog.rs | 2 +- crates/tools/src/cursor.rs | 7 +- crates/tools/src/cursors.toml | 6 + crates/tools/src/pen.rs | 39 +- crates/tools/src/settings.rs | 1 + crates/ui-egui/src/addons.rs | 2 + crates/ui-egui/src/addons/pen.rs | 75 +++ crates/ui-egui/src/addons/pen/tests.rs | 57 ++ crates/ui-egui/src/canvas/cursor.rs | 3 +- crates/ui-egui/src/cursors.rs | 3 +- crates/ui-egui/src/edit_toolbar/tests.rs | 16 +- crates/ui-egui/src/i18n/bg.tsv | 22 + crates/ui-egui/src/i18n/ca.tsv | 22 + crates/ui-egui/src/i18n/cs.tsv | 22 + crates/ui-egui/src/i18n/da.tsv | 22 + crates/ui-egui/src/i18n/de.tsv | 22 + crates/ui-egui/src/i18n/el.tsv | 22 + crates/ui-egui/src/i18n/es.tsv | 22 + crates/ui-egui/src/i18n/fi.tsv | 22 + crates/ui-egui/src/i18n/fr.tsv | 22 + crates/ui-egui/src/i18n/hu.tsv | 22 + crates/ui-egui/src/i18n/id.tsv | 22 + crates/ui-egui/src/i18n/it.tsv | 22 + crates/ui-egui/src/i18n/ja.tsv | 22 + crates/ui-egui/src/i18n/ka.tsv | 22 + crates/ui-egui/src/i18n/ko.tsv | 22 + crates/ui-egui/src/i18n/nl.tsv | 22 + crates/ui-egui/src/i18n/pl.tsv | 22 + crates/ui-egui/src/i18n/pt-br.tsv | 22 + crates/ui-egui/src/i18n/ru.tsv | 22 + crates/ui-egui/src/i18n/sv.tsv | 22 + crates/ui-egui/src/i18n/tr.tsv | 22 + crates/ui-egui/src/i18n/uk.tsv | 22 + crates/ui-egui/src/i18n/vi.tsv | 22 + crates/ui-egui/src/i18n/zh-hans.tsv | 22 + crates/ui-egui/src/i18n/zh-hant.tsv | 22 + crates/ui-egui/src/panels.rs | 1 + crates/ui-egui/src/shortcuts.rs | 6 + crates/ui-egui/src/state.rs | 1 + docs/mcp.md | 60 ++ docs/target-app-parity.md | 18 +- docs/ui-parity.md | 4 +- 55 files changed, 2767 insertions(+), 38 deletions(-) create mode 100644 crates/engine/src/cmd/addons/pen.rs create mode 100644 crates/engine/src/cmd/addons/pen/tests.rs create mode 100644 crates/pathops/src/addons/pen.rs create mode 100644 crates/pathops/src/addons/segment_reshape.rs create mode 100644 crates/tools/src/addons/smart_pen.rs create mode 100644 crates/tools/src/addons/smart_pen/tests.rs create mode 100644 crates/ui-egui/src/addons/pen.rs create mode 100644 crates/ui-egui/src/addons/pen/tests.rs diff --git a/crates/engine/src/cmd/addons.rs b/crates/engine/src/cmd/addons.rs index 8741abdfd8..ca6625540e 100644 --- a/crates/engine/src/cmd/addons.rs +++ b/crates/engine/src/cmd/addons.rs @@ -4,6 +4,7 @@ mod cleanup; mod color; mod pathtools; +mod pen; use super::CommandSpec; @@ -12,5 +13,6 @@ pub fn specs() -> Vec { let mut v = cleanup::specs(); v.extend(color::specs()); v.extend(pathtools::specs()); + v.extend(pen::specs()); v } diff --git a/crates/engine/src/cmd/addons/pathtools.rs b/crates/engine/src/cmd/addons/pathtools.rs index 1020c46a74..6c5ef24c5c 100644 --- a/crates/engine/src/cmd/addons/pathtools.rs +++ b/crates/engine/src/cmd/addons/pathtools.rs @@ -430,7 +430,7 @@ fn edit_anchors(s: &mut Session, label: &str, cmd: &str, f: impl Fn(&mut SubPath } /// A smoothing `ratio` param (default [`pt::SMOOTH_RATIO`]). -fn ratio(p: &Value, cmd: &str) -> Result { +pub(super) fn ratio(p: &Value, cmd: &str) -> Result { let r = number_or(p, "ratio", pt::SMOOTH_RATIO, cmd)?; let (lo, hi) = pt::SMOOTH_RATIO_RANGE; if !(lo..=hi).contains(&r) { @@ -575,7 +575,7 @@ fn add_points(s: &mut Session, p: &Value) -> Result { Ok(json!({ "added": added })) } -fn close(s: &mut Session, p: &Value) -> Result { +pub(super) fn close(s: &mut Session, p: &Value) -> Result { const C: &str = "addon.pathtools.close"; let mode = match text_param(p, "mode", C)? { None => pt::CloseMode::Handles, diff --git a/crates/engine/src/cmd/addons/pen.rs b/crates/engine/src/cmd/addons/pen.rs new file mode 100644 index 0000000000..35d0ea5b5d --- /dev/null +++ b/crates/engine/src/cmd/addons/pen.rs @@ -0,0 +1,349 @@ +//! Smart Pen (`addon.pen.*`), a built-in add-on: one tool that draws paths and edits their points, +//! handles and segments without switching tools, and a panel. The commands here are what the tool +//! and the panel do that the standard path commands don't: anchors added with a straight or curved +//! segment into them, segments switched between straight and curved, anchors removed with or +//! without refitting their neighbours, smooth/corner toggles, segments bent by a dragged point, and +//! the panel's next-segment choice and Close or Join. The tool, panel and submenu (Object › +//! Plug-ins › Smart Pen) are the tools crate's and the UI's. + +#[cfg(test)] +mod tests; + +use std::collections::BTreeSet; + +use serde_json::{Map, Value, json}; +use vectorcraft_doc::NodeId; +use vectorcraft_geom::{Anchor, AnchorKind, Point, SubPath, Vec2}; +use vectorcraft_pathops::addons::{self as po, pathtools as pt, pen}; +use vectorcraft_tools::addons::smart_pen; + +use super::super::draw2::usize_opt; +use super::super::path::{compound_or_self, join, path_mut}; +use super::super::{CommandSpec, always, bad, checked_id, cmd, finite_numbers, has_doc, has_selection, number_or, switch_or, text_param}; +use crate::{EngineError, Result, Session}; + +/// The largest coordinate or move (pt) the commands take. +const LIMIT: f64 = 1e9; + +pub fn specs() -> Vec { + vec![ + cmd!( + "addon.pen.append", + "Smart Pen", + [], + None, + "{id, subpath?: index (default: the last open subpath), x, y, in?: [x, y], out?: [x, y], segment?: \"straight\" (the segment into the new anchor is a line: the previous anchor's handle on it goes, and the new anchor's incoming one)|\"curved\" (the previous anchor gets a handle on it if it has none: in line with its other handle, or with a straight segment before it)} add an anchor at the end of an open subpath of path id (default: the handles as given, the previous anchor as it is), as one undo step; the new anchor is selected → {anchor}", + has_doc, + append + ), + cmd!( + "addon.pen.close", + "Close Path", + [], + None, + "{id, subpath?: index (default: the last open subpath), segment?: \"straight\"|\"curved\" (default: the closing segment takes the handles its ends have)} close an open subpath of two anchors or more, as one undo step", + has_doc, + close + ), + cmd!( + "addon.pen.segment", + "Straight or Curved Segment", + [], + None, + "{id, subpath?: index (0), segment: index, curved: bool} make a segment straight (its handles retracted) or curved (each end without a handle on it gets one, in line with its other handle or with a straight segment before it), as one undo step → {changed}", + has_doc, + segment + ), + cmd!( + "addon.pen.removePoint", + "Remove Points, Keep Shape", + [], + None, + "{id, subpath?: index (0), anchor: index, plain?: bool (false: the handles beside it are refitted so the outline keeps its shape, and an open end takes its segment with it; true: it goes and the handles beside it stay as they are)} remove one anchor, as one undo step; a subpath keeps two anchors (three when closed)", + has_doc, + remove_point + ), + cmd!( + "addon.pen.togglePoint", + "Convert Anchor Point", + [], + None, + "{id, subpath?: index (0), anchor: index, ratio?: 0.1..0.5 (0.3905)} a smooth anchor becomes a corner with its handles where they are; any other anchor is made smooth by the auto-smooth rule (a lone handle mirrored; without handles both at right angles to the bisector of the angle at it, ratio × the nearer neighbour's distance long). One undo step → {smooth}", + has_doc, + toggle_point + ), + cmd!( + "addon.pen.reshape", + "Reshape Segment", + [], + None, + "{id, subpath?: index (0), segment: index, t?: 0..1 (where it was grabbed, 0.5; held to 0.05..0.95), dx, dy: pt, mode?: \"free\" (both handles move, the one nearer the grab more)|\"keepAngles\" (each handle keeps its direction)|\"symmetric\" (both handles at right angles to the chord, at one length) (\"free\")} bend a segment so the point grabbed moves by (dx, dy); missing handles grow out of their anchors and a smooth anchor stays smooth. One undo step", + has_doc, + reshape + ), + cmd!( + "addon.pen.nextSegment", + "Next Segment", + ["Object", "Plug-ins", "Smart Pen"], + None, + "{curved: bool} whether a click with the Smart Pen Tool adds a curved segment or a straight one (the tool's `next` option, kept with the preferences) → {next: \"straight\"|\"curved\"}", + always, + next_segment + ), + cmd!( + "addon.pen.closeJoin", + "Close or Join", + ["Object", "Plug-ins", "Smart Pen"], + None, + "{} with exactly two open path ends direct-selected, join them as path.join does; else close the selected open paths keeping their ends' handles, as addon.pathtools.close does. One undo step", + has_selection, + close_join + ), + ] +} + +/// The `segment` param: straight (false) or curved (true), `None` when not given. +fn segment_kind(p: &Value, cmd: &str) -> Result> { + match text_param(p, "segment", cmd)? { + None => Ok(None), + Some("straight") => Ok(Some(false)), + Some("curved") => Ok(Some(true)), + Some(_) => Err(bad(cmd, "`segment` must be \"straight\" or \"curved\"")), + } +} + +/// An index param that must be given. +fn index_req(p: &Value, key: &str, cmd: &str) -> Result { + usize_opt(p, key, cmd)?.ok_or_else(|| bad(cmd, format!("missing integer `{key}`"))) +} + +/// A true or false param that must be given. +fn switch_req(p: &Value, key: &str, cmd: &str) -> Result { + p.get(key).and_then(Value::as_bool).ok_or_else(|| bad(cmd, format!("`{key}` must be true or false"))) +} + +/// Two number params that must be given, finite and within [`LIMIT`]. +fn pair(p: &Value, (a, b): (&str, &str), cmd: &str) -> Result<(f64, f64)> { + let (x, y) = (number_or(p, a, f64::NAN, cmd)?, number_or(p, b, f64::NAN, cmd)?); + if !(x.abs() < LIMIT && y.abs() < LIMIT) { + return Err(bad(cmd, format!("give `{a}` and `{b}`"))); + } + Ok((x, y)) +} + +/// The subpath a request names: its path (`id`, editable), its index (`subpath`; without one the +/// last open subpath with `open`, else the first) and its data. +fn subpath_of(s: &Session, p: &Value, cmd: &str, open: bool) -> Result<(NodeId, usize, SubPath)> { + let id = checked_id(s, p.get("id").unwrap_or(&Value::Null), cmd)?; + let d = &s.doc()?.doc; + if !d.is_editable(id) { + return Err(bad(cmd, "the path is locked or hidden")); + } + let path = d.node(id).and_then(|n| n.path_data()).ok_or_else(|| bad(cmd, "`id` is not a path"))?; + let si = match usize_opt(p, "subpath", cmd)? { + Some(si) => si, + None if open => path.subpaths.iter().rposition(|sp| !sp.closed).ok_or_else(|| bad(cmd, "the path has no open subpath"))?, + None => 0, + }; + let sp = path.subpaths.get(si).ok_or_else(|| bad(cmd, "no such subpath"))?; + Ok((id, si, sp.clone())) +} + +/// What the selection becomes once a subpath is edited. +enum Pick { + /// As it was (no anchor moved to another index). + Keep, + /// The path (its compound path) selected whole. + Whole, + /// Only this anchor of the subpath, direct-selected. + Anchor(usize), +} + +/// Put `sp` in place of subpath `si` of path `id`, as one undo step labelled `label`. +fn put(s: &mut Session, label: &str, id: NodeId, si: usize, sp: SubPath, pick: Pick) -> Result<()> { + s.edit(label, |d, sel| { + let slot = path_mut(d, id)?.subpaths.get_mut(si).ok_or_else(|| EngineError::Other("no such subpath".into()))?; + *slot = sp; + let top = compound_or_self(d, id); + match pick { + Pick::Keep => {} + Pick::Whole => sel.set([top]), + Pick::Anchor(ai) => { + sel.set([top]); + sel.anchors.insert(id, BTreeSet::from([(si, ai)])); + } + } + Ok(()) + }) +} + +/// An optional `[x, y]` param, finite and within [`LIMIT`]. +fn point_opt(p: &Value, key: &str, cmd: &str) -> Result> { + match p.get(key).filter(|v| !v.is_null()) { + None => Ok(None), + Some(v) => finite_numbers::<2>(v) + .filter(|[x, y]| x.abs() < LIMIT && y.abs() < LIMIT) + .map(|[x, y]| Some(Point::new(x, y))) + .ok_or_else(|| bad(cmd, format!("`{key}` must be [x, y]"))), + } +} + +fn append(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pen.append"; + let (x, y) = pair(p, ("x", "y"), C)?; + let at = Point::new(x, y); + let (h_in, h_out) = (point_opt(p, "in", C)?.unwrap_or(at), point_opt(p, "out", C)?.unwrap_or(at)); + let curved = segment_kind(p, C)?; + let (id, si, mut sp) = subpath_of(s, p, C, true)?; + if sp.closed { + return Err(bad(C, "the subpath is closed")); + } + sp.anchors.push(Anchor::with_handles(at, h_in, h_out)); + let k = sp.anchors.len() - 1; + if let Some(prev) = k.checked_sub(1) { + match curved { + Some(true) => { + pen::leave_handle(&mut sp, prev, true, pt::SMOOTH_RATIO); + } + Some(false) => { + pen::straighten_segment(&mut sp, prev); + } + None => {} + } + } + put(s, "Smart Pen", id, si, sp, Pick::Anchor(k))?; + Ok(json!({ "anchor": k })) +} + +fn close(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pen.close"; + let curved = segment_kind(p, C)?; + let (id, si, mut sp) = subpath_of(s, p, C, true)?; + if sp.closed || sp.anchors.len() < 2 { + return Err(bad(C, "the subpath is closed or too short to close")); + } + sp.closed = true; + let last = sp.anchors.len() - 1; + match curved { + Some(true) => { + pen::curve_segment(&mut sp, last, pt::SMOOTH_RATIO); + } + Some(false) => { + pen::straighten_segment(&mut sp, last); + } + None => {} + } + put(s, "Close Path", id, si, sp, Pick::Whole)?; + Ok(json!({})) +} + +fn segment(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pen.segment"; + let seg = index_req(p, "segment", C)?; + let curved = switch_req(p, "curved", C)?; + let (id, si, mut sp) = subpath_of(s, p, C, false)?; + if seg >= sp.segment_count() { + return Err(bad(C, "no such segment")); + } + let changed = if curved { pen::curve_segment(&mut sp, seg, pt::SMOOTH_RATIO) } else { pen::straighten_segment(&mut sp, seg) }; + if changed { + put(s, "Smart Pen", id, si, sp, Pick::Keep)?; + } + Ok(json!({ "changed": changed })) +} + +fn remove_point(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pen.removePoint"; + let ai = index_req(p, "anchor", C)?; + let plain = switch_or(p, "plain", false, C)?; + let (id, si, mut sp) = subpath_of(s, p, C, false)?; + let n = sp.anchors.len(); + if ai >= n { + return Err(bad(C, "no such anchor")); + } + let end = !sp.closed && (ai == 0 || ai + 1 == n); + let removed = if plain { + pen::delete_anchor(&mut sp, ai) + } else if let Some((out, _)) = po::remove_anchor_keep_shape(&sp, ai) { + sp = out; + true + } else { + // An open end takes its segment with it. + end && n > 2 && vectorcraft_pathops::remove_anchor(&mut sp, ai) + }; + if !removed { + return Err(bad(C, "the path is too short to remove a point from")); + } + let label = if plain { "Delete Anchor Point" } else { "Remove Points, Keep Shape" }; + put(s, label, id, si, sp, Pick::Whole)?; + Ok(json!({})) +} + +fn toggle_point(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pen.togglePoint"; + let ai = index_req(p, "anchor", C)?; + let r = super::pathtools::ratio(p, C)?; + let (id, si, mut sp) = subpath_of(s, p, C, false)?; + if ai >= sp.anchors.len() { + return Err(bad(C, "no such anchor")); + } + let changed = pen::toggle_smooth(&mut sp, ai, r); + let smooth = sp.anchors.get(ai).is_some_and(|a| a.kind == AnchorKind::Smooth); + if changed { + put(s, "Convert Anchor Point", id, si, sp, Pick::Keep)?; + } + Ok(json!({ "smooth": smooth })) +} + +fn reshape(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pen.reshape"; + let seg = index_req(p, "segment", C)?; + let t = number_or(p, "t", 0.5, C)?; + if !(0.0..=1.0).contains(&t) { + return Err(bad(C, "`t` must be from 0 to 1")); + } + let (dx, dy) = pair(p, ("dx", "dy"), C)?; + let dv = Vec2::new(dx, dy); + let mode = match text_param(p, "mode", C)? { + None => po::ReshapeMode::Free, + Some(m) => po::ReshapeMode::parse(m).ok_or_else(|| bad(C, "`mode` must be \"free\", \"keepAngles\" or \"symmetric\""))?, + }; + let (id, si, mut sp) = subpath_of(s, p, C, false)?; + if seg >= sp.segment_count() { + return Err(bad(C, "no such segment")); + } + if !po::reshape_segment(&mut sp, seg, t, dv, mode) { + return Err(bad(C, "the segment can't be bent that far")); + } + put(s, "Reshape Segment", id, si, sp, Pick::Keep)?; + Ok(json!({})) +} + +fn next_segment(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pen.nextSegment"; + let curved = switch_req(p, "curved", C)?; + let next = if curved { "curved" } else { "straight" }; + let values = Map::from_iter([("next".to_string(), json!(next))]); + s.set_tool_options(Some(smart_pen::ID), &values); + Ok(json!({ "next": next })) +} + +fn close_join(s: &mut Session, _: &Value) -> Result { + let st = s.doc()?; + let d = &st.doc; + // The direct-selected anchors that are ends of open subpaths. + let mut picked = 0; + let mut ends = 0; + for (id, set) in &st.selection.anchors { + let path = d.node(*id).and_then(|n| n.path_data()); + for &(si, ai) in set { + picked += 1; + let sp = path.and_then(|pd| pd.subpaths.get(si)); + ends += usize::from(sp.is_some_and(|sp| !sp.closed && (ai == 0 || ai + 1 == sp.anchors.len()))); + } + } + if picked == 2 && ends == 2 { + return join(s, &json!({})); + } + super::pathtools::close(s, &json!({ "mode": "handles" })) +} diff --git a/crates/engine/src/cmd/addons/pen/tests.rs b/crates/engine/src/cmd/addons/pen/tests.rs new file mode 100644 index 0000000000..1bb9f3345e --- /dev/null +++ b/crates/engine/src/cmd/addons/pen/tests.rs @@ -0,0 +1,287 @@ +//! Smart Pen's commands: each one undo step, bad params refused, and the tool's gestures through +//! the session. + +use std::collections::BTreeSet; + +use serde_json::{Value, json}; +use vectorcraft_doc::NodeId; +use vectorcraft_geom::{AnchorKind, PathData, Point, Vec2}; +use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey}; + +use crate::{Session, ViewInfo}; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + s +} + +fn line(s: &mut Session, pts: &[(f64, f64)]) -> NodeId { + let anchors: Vec = pts.iter().map(|(x, y)| json!({"x": x, "y": y})).collect(); + NodeId(s.execute("path.create", &json!({"anchors": anchors, "closed": false})).unwrap()["id"].as_u64().unwrap()) +} + +fn path(s: &Session, id: NodeId) -> PathData { + s.doc().unwrap().doc.node(id).unwrap().path_data().unwrap().clone() +} + +fn steps(s: &Session) -> usize { + s.doc().unwrap().history.undo.len() +} + +/// Each of `bad` is refused and leaves the document as it was. +fn refuses(s: &mut Session, cmd: &str, bad: &[Value]) { + let (before, n) = (s.doc().unwrap().doc.clone(), steps(s)); + for p in bad { + assert!(s.execute(cmd, p).is_err(), "{cmd} {p}"); + } + assert_eq!(steps(s), n, "{cmd}"); + assert!(*s.doc().unwrap().doc == *before, "{cmd} changed the document"); +} + +fn parallel(a: Vec2, b: Vec2) -> bool { + a.cross(b).abs() < 1e-9 && a.dot(b) > 0.0 +} + +#[test] +fn append_adds_a_straight_or_curved_segment() { + let mut s = session(); + let id = line(&mut s, &[(0.0, 100.0), (100.0, 100.0)]); + let n = steps(&s); + let r = s.execute("addon.pen.append", &json!({"id": id.0, "x": 150, "y": 150, "segment": "curved"})).unwrap(); + assert_eq!(r["anchor"], json!(2)); + assert_eq!(steps(&s), n + 1, "one undo step"); + let sp = &path(&s, id).subpaths[0]; + // The curve leaves (100, 100) along the straight segment before it. + let a = sp.anchors[1]; + assert!(a.has_out() && !a.has_in() && parallel(a.h_out - a.p, Vec2::new(1.0, 0.0)), "{a:?}"); + assert!(sp.segment_is_line(0) && !sp.segment_is_line(1)); + // The new anchor is the one selected. + let sel = &s.doc().unwrap().selection; + assert_eq!(sel.anchors.get(&id), Some(&BTreeSet::from([(0, 2)]))); + // Straight: the previous anchor's handle on it goes, and the new anchor's incoming one. + s.execute("addon.pen.append", &json!({"id": id.0, "subpath": 0, "x": 250, "y": 150, "in": [200, 100], "out": [300, 200], "segment": "straight"})) + .unwrap(); + let sp = &path(&s, id).subpaths[0]; + assert!(sp.segment_is_line(2) && sp.anchors[3].has_out() && !sp.anchors[3].has_in()); + assert_eq!(sp.anchors[3].kind, AnchorKind::Corner); + // Without a segment, the handles as given. + s.execute("addon.pen.append", &json!({"id": id.0, "x": 350, "y": 150, "in": [330, 140], "out": [370, 160]})).unwrap(); + assert_eq!(path(&s, id).subpaths[0].anchors[4].kind, AnchorKind::Smooth); + let closed = line(&mut s, &[(0.0, 0.0), (10.0, 0.0), (10.0, 10.0)]); + s.execute("path.close", &json!({"id": closed.0})).unwrap(); + refuses( + &mut s, + "addon.pen.append", + &[ + json!({}), + json!({"id": id.0}), + json!({"id": id.0, "x": 1, "y": f64::MAX}), + json!({"id": id.0, "x": 1, "y": 1, "segment": "wavy"}), + json!({"id": id.0, "x": 1, "y": 1, "in": [1]}), + json!({"id": id.0, "x": 1, "y": 1, "subpath": 3}), + json!({"id": closed.0, "x": 1, "y": 1}), + json!({"id": closed.0, "x": 1, "y": 1, "subpath": 0}), + json!({"id": 999_999, "x": 1, "y": 1}), + ], + ); +} + +#[test] +fn close_makes_the_closing_segment_straight_or_curved() { + let mut s = session(); + let id = line(&mut s, &[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0)]); + let n = steps(&s); + s.execute("addon.pen.close", &json!({"id": id.0, "segment": "curved"})).unwrap(); + let sp = &path(&s, id).subpaths[0]; + assert!(sp.closed && !sp.segment_is_line(2)); + assert_eq!(steps(&s), n + 1); + s.execute("edit.undo", &json!({})).unwrap(); + s.execute("addon.pen.close", &json!({"id": id.0, "segment": "straight"})).unwrap(); + assert!(path(&s, id).subpaths[0].segment_is_line(2)); + let dot = line(&mut s, &[(5.0, 5.0)]); + refuses(&mut s, "addon.pen.close", &[json!({}), json!({"id": id.0}), json!({"id": dot.0}), json!({"id": id.0, "segment": 1})]); +} + +#[test] +fn segment_switches_between_straight_and_curved() { + let mut s = session(); + let id = line(&mut s, &[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0)]); + let n = steps(&s); + let r = s.execute("addon.pen.segment", &json!({"id": id.0, "segment": 1, "curved": true})).unwrap(); + assert_eq!(r["changed"], json!(true)); + assert!(!path(&s, id).subpaths[0].segment_is_line(1)); + s.execute("addon.pen.segment", &json!({"id": id.0, "segment": 1, "curved": false})).unwrap(); + assert!(path(&s, id).subpaths[0].segment_is_line(1)); + assert_eq!(steps(&s), n + 2); + // Already straight: no step. + let r = s.execute("addon.pen.segment", &json!({"id": id.0, "segment": 1, "curved": false})).unwrap(); + assert_eq!((r["changed"].clone(), steps(&s)), (json!(false), n + 2)); + refuses( + &mut s, + "addon.pen.segment", + &[ + json!({"id": id.0, "segment": 1}), + json!({"id": id.0, "segment": 2, "curved": true}), + json!({"id": id.0, "curved": true}), + json!({"id": id.0, "segment": -1, "curved": true}), + ], + ); +} + +#[test] +fn remove_point_keeps_the_shape_or_deletes_plainly() { + let mut s = session(); + let e = NodeId(s.execute("shape.ellipse", &json!({"x": 50, "y": 50, "width": 100, "height": 100})).unwrap()["id"].as_u64().unwrap()); + s.execute("object.path.addAnchorPoints", &json!({})).unwrap(); + let before = path(&s, e); + let n = steps(&s); + s.execute("addon.pen.removePoint", &json!({"id": e.0, "anchor": 1})).unwrap(); + let after = path(&s, e); + assert_eq!(after.anchor_count(), 7); + assert_eq!(steps(&s), n + 1); + // The outline barely moved: its bounds are the circle's. + let (b0, b1) = (before.bounds().unwrap(), after.bounds().unwrap()); + assert!((b0.width() - b1.width()).abs() < 2.0 && (b0.height() - b1.height()).abs() < 2.0, "{b0:?} {b1:?}"); + // Plain: the handles beside it stay as they were. + s.execute("edit.undo", &json!({})).unwrap(); + s.execute("addon.pen.removePoint", &json!({"id": e.0, "anchor": 1, "plain": true})).unwrap(); + let plain = path(&s, e); + assert_eq!( + (plain.subpaths[0].anchors[0].h_out, plain.subpaths[0].anchors[1].h_in), + (before.subpaths[0].anchors[0].h_out, before.subpaths[0].anchors[2].h_in) + ); + // An open end goes with its segment; two anchors stay. + let l = line(&mut s, &[(0.0, 0.0), (50.0, 0.0), (100.0, 0.0)]); + s.execute("addon.pen.removePoint", &json!({"id": l.0, "anchor": 2})).unwrap(); + assert_eq!(path(&s, l).subpaths[0].anchors.len(), 2); + refuses( + &mut s, + "addon.pen.removePoint", + &[ + json!({"id": l.0, "anchor": 0}), + json!({"id": l.0, "anchor": 0, "plain": true}), + json!({"id": l.0, "anchor": 5}), + json!({"id": l.0}), + json!({"id": l.0, "anchor": 1, "plain": 1}), + ], + ); +} + +#[test] +fn toggle_point_and_reshape() { + let mut s = session(); + let id = line(&mut s, &[(0.0, 0.0), (100.0, 0.0), (100.0, 100.0)]); + let n = steps(&s); + assert_eq!(s.execute("addon.pen.togglePoint", &json!({"id": id.0, "anchor": 1})).unwrap()["smooth"], json!(true)); + let smooth = path(&s, id).subpaths[0].anchors[1]; + assert_eq!(s.execute("addon.pen.togglePoint", &json!({"id": id.0, "anchor": 1})).unwrap()["smooth"], json!(false)); + let corner = path(&s, id).subpaths[0].anchors[1]; + assert_eq!((corner.h_in, corner.h_out), (smooth.h_in, smooth.h_out), "nothing moved"); + assert_eq!(steps(&s), n + 2); + refuses(&mut s, "addon.pen.togglePoint", &[json!({"id": id.0, "anchor": 9}), json!({"id": id.0, "anchor": 1, "ratio": 2})]); + // The grabbed point follows the drag. + let l = line(&mut s, &[(0.0, 200.0), (100.0, 200.0)]); + for mode in ["free", "keepAngles", "symmetric"] { + s.execute("addon.pen.reshape", &json!({"id": l.0, "segment": 0, "t": 0.5, "dx": 0, "dy": -40, "mode": mode})).unwrap(); + let p = kurbo::ParamCurve::eval(&path(&s, l).subpaths[0].segment(0), 0.5); + assert!(p.distance(Point::new(50.0, 160.0)) < 1e-6, "{mode}: {p:?}"); + s.execute("edit.undo", &json!({})).unwrap(); + } + refuses( + &mut s, + "addon.pen.reshape", + &[ + json!({"id": l.0, "segment": 0}), + json!({"id": l.0, "segment": 1, "dx": 1, "dy": 1}), + json!({"id": l.0, "segment": 0, "dx": 1, "dy": 1, "t": 2}), + json!({"id": l.0, "segment": 0, "dx": 1e300, "dy": 1}), + json!({"id": l.0, "segment": 0, "dx": 1, "dy": 1, "mode": "twist"}), + ], + ); +} + +#[test] +fn the_panel_commands_set_the_next_segment_and_close_or_join() { + let mut s = session(); + assert_eq!(s.execute("addon.pen.nextSegment", &json!({"curved": true})).unwrap()["next"], json!("curved")); + assert_eq!(s.tool_options_of("smartPen")["next"], json!("curved")); + assert!(s.execute("addon.pen.nextSegment", &json!({})).is_err()); + // Two open ends direct-selected: joined. + let a = line(&mut s, &[(0.0, 0.0), (100.0, 0.0)]); + let b = line(&mut s, &[(110.0, 0.0), (200.0, 0.0)]); + s.select(|_, sel| { + sel.set([a, b]); + sel.anchors.insert(a, BTreeSet::from([(0, 1)])); + sel.anchors.insert(b, BTreeSet::from([(0, 0)])); + }) + .unwrap(); + let n = steps(&s); + s.execute("addon.pen.closeJoin", &json!({})).unwrap(); + assert_eq!(steps(&s), n + 1); + assert!(s.doc().unwrap().doc.node(b).is_none() || s.doc().unwrap().doc.node(a).is_none(), "one path is left"); + // Otherwise the selected open paths close. + let c = line(&mut s, &[(0.0, 100.0), (100.0, 100.0), (100.0, 200.0)]); + s.execute("addon.pen.closeJoin", &json!({})).unwrap(); + assert!(path(&s, c).subpaths[0].closed); +} + +fn view() -> ViewInfo { + ViewInfo { smart_guides: false, ..ViewInfo::default() } +} + +/// A gesture of the active tool, `m` held throughout: press at the first point, drag through the +/// others, release at the last. +fn gesture(s: &mut Session, pts: &[(f64, f64)], m: Mods) { + let mut kinds = vec![PointerKind::Down]; + kinds.extend(pts.iter().skip(1).map(|_| PointerKind::Drag)); + for (k, (x, y)) in kinds.into_iter().zip(pts.iter().copied()) { + s.pointer(&PointerEvent::new(k, x, y).with_mods(m), view()).unwrap(); + } + let (x, y) = pts.last().copied().unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Up, x, y).with_mods(m), view()).unwrap(); +} + +/// The one path of the session's document. +fn only_path(s: &Session) -> (NodeId, PathData) { + let mut found = vec![]; + s.doc().unwrap().doc.walk(|n| { + if let Some(p) = n.path_data() { + found.push((n.id, p.clone())); + } + }); + assert_eq!(found.len(), 1, "{found:?}"); + found.remove(0) +} + +#[test] +fn the_tool_draws_a_path_one_step_per_anchor_and_closes_it() { + let mut s = session(); + s.select_tool("smartPen", view()).unwrap(); + let n = steps(&s); + gesture(&mut s, &[(50.0, 50.0)], Mods::default()); + gesture(&mut s, &[(150.0, 50.0)], Mods::default()); + s.execute("addon.pen.nextSegment", &json!({"curved": true})).unwrap(); + gesture(&mut s, &[(150.0, 150.0)], Mods::default()); + let (id, p) = only_path(&s); + let sp = &p.subpaths[0]; + assert_eq!(sp.anchors.len(), 3); + assert!(sp.segment_is_line(0) && !sp.segment_is_line(1), "a straight segment, then a curved one leaving it tangent"); + assert!(parallel(sp.anchors[1].h_out - sp.anchors[1].p, Vec2::new(1.0, 0.0))); + // A drag makes a smooth anchor. + gesture(&mut s, &[(50.0, 150.0), (30.0, 170.0)], Mods::default()); + assert_eq!(path(&s, id).subpaths[0].anchors[3].kind, AnchorKind::Smooth); + // Tab between anchors: the last segment straight again. + s.tool_key(ToolKey::Tab, Mods::default(), view()).unwrap(); + assert!(path(&s, id).subpaths[0].segment_is_line(2)); + gesture(&mut s, &[(50.0, 50.0)], Mods::default()); + assert!(path(&s, id).subpaths[0].closed); + assert_eq!(steps(&s), n + 6, "one step per anchor, the Tab and the close"); + // Edits with the same tool: a drag on an anchor moves it, Alt-click removes one keeping the shape. + s.select(|_, sel| sel.set([id])).unwrap(); + gesture(&mut s, &[(150.0, 50.0), (160.0, 40.0)], Mods::default()); + assert_eq!(path(&s, id).subpaths[0].anchors[1].p, Point::new(160.0, 40.0)); + gesture(&mut s, &[(160.0, 40.0)], Mods { alt: true, ..Mods::default() }); + assert_eq!(path(&s, id).subpaths[0].anchors.len(), 3); + assert_eq!(steps(&s), n + 8); +} diff --git a/crates/engine/src/cmd/path.rs b/crates/engine/src/cmd/path.rs index 24757213b9..5450f3d3c4 100644 --- a/crates/engine/src/cmd/path.rs +++ b/crates/engine/src/cmd/path.rs @@ -341,7 +341,7 @@ fn set_anchors(s: &mut Session, p: &Value) -> Result { } /// The compound path enclosing `id`, or `id` itself if it is not inside a compound path. -fn compound_or_self(d: &Document, id: NodeId) -> NodeId { +pub(super) fn compound_or_self(d: &Document, id: NodeId) -> NodeId { d.parent_of(id).filter(|p| matches!(d.node(*p).map(|n| &n.kind), Some(NodeKind::Compound { .. }))).unwrap_or(id) } @@ -547,7 +547,7 @@ fn join_subpaths_in_node(d: &mut Document, id: NodeId, (sa, sb): (usize, usize), } /// Join open paths into a single path, or close an open path, preserving compound path structure. -fn join(s: &mut Session, p: &Value) -> Result { +pub(super) fn join(s: &mut Session, p: &Value) -> Result { const C: &str = "path.join"; let join_kind = match p.get("to").and_then(Value::as_str) { None => None, diff --git a/crates/engine/tests/command_sweep.rs b/crates/engine/tests/command_sweep.rs index 1881fafc49..4bc82c4397 100644 --- a/crates/engine/tests/command_sweep.rs +++ b/crates/engine/tests/command_sweep.rs @@ -510,6 +510,22 @@ fn structured_junk() { ("shapeBuilder.regions", json!({"ids": [2, 3], "gap": "x"})), ("shapeBuilder.regions", json!({"gap": true})), ("shapeBuilder.regions", json!({"gap": 12, "ids": [u64::MAX]})), + // Smart Pen add-on. + ("addon.pen.append", json!({"id": 2, "x": 1e308, "y": 0, "in": [1e308, -1e308]})), + ("addon.pen.append", json!({"id": 2, "subpath": u64::MAX, "x": 0, "y": 0, "segment": "curved"})), + ("addon.pen.append", json!({"id": 2, "x": 9.9e8, "y": -9.9e8, "in": [-9.9e8, 9.9e8], "out": [9.9e8, 9.9e8], "segment": "curved"})), + ("addon.pen.close", json!({"id": 2, "subpath": u64::MAX, "segment": "curved"})), + ("addon.pen.close", json!({"id": 3, "segment": "straight"})), + ("addon.pen.segment", json!({"id": 2, "segment": u64::MAX, "curved": true})), + ("addon.pen.segment", json!({"id": 2, "subpath": 0, "segment": 0, "curved": "yes"})), + ("addon.pen.removePoint", json!({"id": 2, "anchor": u64::MAX, "plain": true})), + ("addon.pen.removePoint", json!({"id": 2, "anchor": 0})), + ("addon.pen.togglePoint", json!({"id": 2, "anchor": 0, "ratio": 1e308})), + ("addon.pen.togglePoint", json!({"id": 2, "subpath": 0, "anchor": 1})), + ("addon.pen.reshape", json!({"id": 2, "segment": 0, "t": 0.0, "dx": 9.9e8, "dy": -9.9e8, "mode": "keepAngles"})), + ("addon.pen.reshape", json!({"id": 2, "segment": 0, "t": "x", "dx": 1, "dy": 1, "mode": "symmetric"})), + ("addon.pen.nextSegment", json!({"curved": "yes"})), + ("addon.pen.closeJoin", json!({"ids": [u64::MAX]})), ]; let mut failures = vec![]; for fx in Fixture::ALL { diff --git a/crates/pathops/src/addons.rs b/crates/pathops/src/addons.rs index b60e4a33ae..bb821df062 100644 --- a/crates/pathops/src/addons.rs +++ b/crates/pathops/src/addons.rs @@ -6,12 +6,18 @@ //! handles, nearly closed paths) and Rejoin Path Pieces. //! - [`pathtools`]: Path Precision Tools' anchor edits, path readouts, extending open paths and //! finding where paths cross. +//! - [`segment_reshape`]: bending a segment by dragging a point on it (shared by the tools that +//! reshape segments directly). +//! - [`pen`]: the Smart Pen's straight and curved segments and its point edits. pub mod cleanup; pub mod keep_shape; pub mod pathtools; +pub mod pen; +pub mod segment_reshape; pub use cleanup::{ Rejoined, close_nearly_closed, merge_duplicate_anchors, near_point_groups, rejoin, remove_collinear_anchors, retract_tiny_handles, }; pub use keep_shape::{SHARP_CORNER_DEG, remove_anchor_keep_shape, simplify_anchors_keep_shape, simplify_keep_shape}; +pub use segment_reshape::{ReshapeMode, reshape_segment}; diff --git a/crates/pathops/src/addons/pathtools.rs b/crates/pathops/src/addons/pathtools.rs index c7444fab6b..7ab2809469 100644 --- a/crates/pathops/src/addons/pathtools.rs +++ b/crates/pathops/src/addons/pathtools.rs @@ -37,7 +37,7 @@ fn unit(v: Vec2) -> Option { } /// The indices of anchor `i`'s neighbours in `sp` (`None` past an open end). -fn neighbours(sp: &SubPath, i: usize) -> (Option, Option) { +pub(crate) fn neighbours(sp: &SubPath, i: usize) -> (Option, Option) { let n = sp.anchors.len(); let prev = if i > 0 { Some(i - 1) } else { (sp.closed && n > 1).then(|| n - 1) }; let next = if i + 1 < n { Some(i + 1) } else { (sp.closed && n > 1).then_some(0) }; diff --git a/crates/pathops/src/addons/pen.rs b/crates/pathops/src/addons/pen.rs new file mode 100644 index 0000000000..57db044c39 --- /dev/null +++ b/crates/pathops/src/addons/pen.rs @@ -0,0 +1,196 @@ +//! Smart Pen geometry: making a segment straight or curved (the curve leaving its ends tangent to +//! what comes before them), toggling an anchor between smooth and corner, and deleting an anchor +//! without refitting the handles beside it. + +use kurbo::Vec2; +use vectorcraft_geom::{AnchorKind, SubPath}; + +use super::pathtools::{auto_smooth, make_corner, neighbours}; + +fn unit(v: Vec2) -> Option { + let l = v.hypot(); + (l > 1e-9 && l.is_finite()).then(|| v / l) +} + +/// Give anchor `i` the handle facing its next anchor (`out`) or its previous one, when it has none, +/// so the segment between them curves; `ratio` × the distance to that anchor long. The handle is +/// in line with the anchor's other handle (the anchor becomes smooth); else, after a straight +/// segment, in line with that segment (a straight-to-curved joint, the curve leaving tangent); +/// else the anchor is smoothed by the auto-smooth rule. False when nothing changes. +pub fn leave_handle(sp: &mut SubPath, i: usize, out: bool, ratio: f64) -> bool { + let (prev, next) = neighbours(sp, i); + let (Some(facing), back) = (if out { (next, prev) } else { (prev, next) }) else { return false }; + let at = |j: usize| sp.anchors.get(j).copied(); + let (Some(a), Some(f)) = (at(i), at(facing)) else { return false }; + if (out && a.has_out()) || (!out && a.has_in()) { + return false; + } + let len = a.p.distance(f.p) * ratio; + let opposite = if out { a.h_in } else { a.h_out }; + // The back segment is straight when the back anchor's handle toward `i` is retracted too. + let straight_back = back.and_then(at).filter(|b| if out { !b.has_out() } else { !b.has_in() }); + let (dir, kind) = match (unit(a.p - opposite), straight_back) { + (Some(d), _) => (d, AnchorKind::Smooth), + (None, Some(b)) => match unit(a.p - b.p) { + Some(d) => (d, a.kind), + None => return false, + }, + (None, None) => return auto_smooth(sp, i, ratio), + }; + let Some(a) = sp.anchors.get_mut(i) else { return false }; + let h = a.p + dir * len; + if out { + a.h_out = h; + } else { + a.h_in = h; + } + a.kind = kind; + true +} + +/// Make segment `seg` curved: each of its ends without a handle on it gets one ([`leave_handle`]). +/// False when nothing changes. +pub fn curve_segment(sp: &mut SubPath, seg: usize, ratio: f64) -> bool { + let n = sp.anchors.len(); + if seg >= sp.segment_count() { + return false; + } + let from = leave_handle(sp, seg % n, true, ratio); + let to = leave_handle(sp, (seg + 1) % n, false, ratio); + from || to +} + +/// Make segment `seg` straight: the handles its two ends have on it are retracted, and an end left +/// with one handle is a corner. False when it was straight already. +pub fn straighten_segment(sp: &mut SubPath, seg: usize) -> bool { + let n = sp.anchors.len(); + if seg >= sp.segment_count() || sp.segment_is_line(seg) { + return false; + } + if let Some(a) = sp.anchors.get_mut(seg % n) { + a.h_out = a.p; + a.kind = AnchorKind::Corner; + } + if let Some(b) = sp.anchors.get_mut((seg + 1) % n) { + b.h_in = b.p; + b.kind = AnchorKind::Corner; + } + true +} + +/// Toggle anchor `i` between smooth and corner: a smooth anchor becomes a corner with its handles +/// where they are (nothing moves); any other is smoothed by the auto-smooth rule at `ratio`. +/// False when nothing changes. +pub fn toggle_smooth(sp: &mut SubPath, i: usize, ratio: f64) -> bool { + let Some(a) = sp.anchors.get(i) else { return false }; + if a.kind == AnchorKind::Smooth && a.has_in() && a.has_out() { make_corner(sp, i, false) } else { auto_smooth(sp, i, ratio) } +} + +/// Delete anchor `i`, leaving the handles of its neighbours as they are (the segment between them +/// takes their handles as they stand). False, leaving `sp` alone, when there is no such anchor or +/// the subpath would keep fewer than two anchors (three when closed). +pub fn delete_anchor(sp: &mut SubPath, i: usize) -> bool { + let min = if sp.closed { 3 } else { 2 }; + if i >= sp.anchors.len() || sp.anchors.len() <= min { + return false; + } + sp.anchors.remove(i); + if !sp.closed { + // A new end has nothing beyond it. + if let Some(a) = sp.anchors.first_mut() { + a.h_in = a.p; + } + if let Some(a) = sp.anchors.last_mut() { + a.h_out = a.p; + } + } + true +} + +#[cfg(test)] +mod tests { + use kurbo::Point; + use vectorcraft_geom::{Anchor, AnchorKind, SubPath}; + + use super::*; + use crate::addons::pathtools::SMOOTH_RATIO; + + fn pt(x: f64, y: f64) -> Point { + Point::new(x, y) + } + + fn parallel(a: Vec2, b: Vec2) -> bool { + a.cross(b).abs() < 1e-9 && a.dot(b) > 0.0 + } + + #[test] + fn a_curve_after_a_straight_segment_leaves_tangent_to_it() { + // (0,0) → (100,0) straight, then a curve on to (150,50). + let mut sp = SubPath::polyline(&[pt(0.0, 0.0), pt(100.0, 0.0), pt(150.0, 50.0)], false); + assert!(leave_handle(&mut sp, 1, true, SMOOTH_RATIO)); + let a = sp.anchors[1]; + assert!(parallel(a.h_out - a.p, Vec2::new(1.0, 0.0)), "{:?}", a.h_out); + assert!(((a.h_out - a.p).hypot() - 50f64.hypot(50.0) * SMOOTH_RATIO).abs() < 1e-9); + assert!(!a.has_in(), "the straight segment stays straight"); + assert!(sp.segment_is_line(0) && !sp.segment_is_line(1)); + assert!(!leave_handle(&mut sp, 1, true, SMOOTH_RATIO), "it has one already"); + } + + #[test] + fn a_lone_handle_is_continued_and_corners_between_curves_are_smoothed() { + let mut sp = SubPath::new( + vec![Anchor::corner(pt(0.0, 0.0)), Anchor::with_handles(pt(50.0, 0.0), pt(30.0, -10.0), pt(50.0, 0.0)), Anchor::corner(pt(100.0, 0.0))], + false, + ); + assert!(leave_handle(&mut sp, 1, true, SMOOTH_RATIO)); + let a = sp.anchors[1]; + assert_eq!(a.kind, AnchorKind::Smooth); + assert!(parallel(a.h_out - a.p, a.p - a.h_in)); + // A corner without handles after a curved segment: smoothed by the auto-smooth rule. + let mut sp = SubPath::new( + vec![Anchor::with_handles(pt(0.0, 0.0), pt(0.0, 0.0), pt(20.0, -30.0)), Anchor::corner(pt(50.0, 0.0)), Anchor::corner(pt(100.0, 0.0))], + false, + ); + assert!(leave_handle(&mut sp, 1, true, SMOOTH_RATIO)); + assert!(sp.anchors[1].has_in() && sp.anchors[1].has_out() && sp.anchors[1].kind == AnchorKind::Smooth); + } + + #[test] + fn segments_toggle_between_straight_and_curved() { + let mut sp = SubPath::polyline(&[pt(0.0, 0.0), pt(100.0, 0.0), pt(100.0, 100.0), pt(0.0, 100.0)], false); + assert!(curve_segment(&mut sp, 1, SMOOTH_RATIO)); + assert!(!sp.segment_is_line(1) && sp.segment_is_line(0) && sp.segment_is_line(2)); + assert!(!curve_segment(&mut sp, 1, SMOOTH_RATIO), "curved already"); + assert!(straighten_segment(&mut sp, 1)); + assert!(sp.segment_is_line(1)); + assert!(!straighten_segment(&mut sp, 1)); + assert!(!curve_segment(&mut sp, 3, SMOOTH_RATIO) && !straighten_segment(&mut sp, 3), "no such segment"); + } + + #[test] + fn toggling_a_point_moves_nothing_one_way_and_smooths_the_other() { + let mut sp = SubPath::polyline(&[pt(0.0, 0.0), pt(100.0, 0.0), pt(100.0, 100.0)], false); + assert!(toggle_smooth(&mut sp, 1, SMOOTH_RATIO)); + let smooth = sp.anchors[1]; + assert_eq!(smooth.kind, AnchorKind::Smooth); + assert!(toggle_smooth(&mut sp, 1, SMOOTH_RATIO)); + let corner = sp.anchors[1]; + assert_eq!((corner.kind, corner.h_in, corner.h_out), (AnchorKind::Corner, smooth.h_in, smooth.h_out)); + assert!(!toggle_smooth(&mut sp, 9, SMOOTH_RATIO)); + } + + #[test] + fn delete_keeps_the_neighbours_handles() { + let mut sp = SubPath::new( + vec![Anchor::smooth(pt(0.0, 0.0), pt(10.0, 10.0)), Anchor::corner(pt(50.0, 0.0)), Anchor::smooth(pt(100.0, 0.0), pt(110.0, -10.0))], + false, + ); + assert!(delete_anchor(&mut sp, 1)); + assert_eq!(sp.anchors.len(), 2); + assert_eq!((sp.anchors[0].h_out, sp.anchors[1].h_in), (pt(10.0, 10.0), pt(90.0, 10.0))); + assert_eq!((sp.anchors[0].h_in, sp.anchors[1].h_out), (pt(0.0, 0.0), pt(100.0, 0.0)), "the ends have nothing beyond them"); + assert!(!delete_anchor(&mut sp, 0), "two anchors stay"); + let mut tri = SubPath::polyline(&[pt(0.0, 0.0), pt(1.0, 0.0), pt(0.0, 1.0)], true); + assert!(!delete_anchor(&mut tri, 1) && !delete_anchor(&mut tri, 7)); + } +} diff --git a/crates/pathops/src/addons/segment_reshape.rs b/crates/pathops/src/addons/segment_reshape.rs new file mode 100644 index 0000000000..41acf44196 --- /dev/null +++ b/crates/pathops/src/addons/segment_reshape.rs @@ -0,0 +1,208 @@ +//! Reshaping a segment by dragging a point on it, shared by the add-on tools that bend segments +//! directly. The grabbed point follows the pointer; how the two handles share the move depends on +//! where the segment was grabbed (the nearer end's handle moves more) and on the [`ReshapeMode`]. +//! A missing handle grows out of its anchor, and a smooth anchor's other handle turns with the one +//! moved, so the path stays smooth there. + +use kurbo::Vec2; +use vectorcraft_geom::SubPath; + +/// The range the grab position `t` is held to: right at an end, the handle beside it would have +/// to grow without bound to move the point. +pub const T_RANGE: (f64, f64) = (0.05, 0.95); + +/// How [`reshape_segment`] moves the handles. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum ReshapeMode { + /// Both handles move in the direction of the drag, the one nearer the grab more. + Free, + /// Each handle keeps its direction and only changes length (a missing one points along the + /// segment's chord). A segment whose two directions are parallel can't bend that way, and is + /// reshaped [`ReshapeMode::Free`]. + KeepAngles, + /// Both handles stand at right angles to the chord, on one side and at one length. + Symmetric, +} + +impl ReshapeMode { + pub const ALL: [Self; 3] = [Self::Free, Self::KeepAngles, Self::Symmetric]; + + pub fn id(self) -> &'static str { + match self { + Self::Free => "free", + Self::KeepAngles => "keepAngles", + Self::Symmetric => "symmetric", + } + } + + pub fn parse(s: &str) -> Option { + Self::ALL.into_iter().find(|m| m.id() == s) + } +} + +fn unit(v: Vec2) -> Option { + let l = v.hypot(); + (l > 1e-9 && l.is_finite()).then(|| v / l) +} + +/// Bend segment `seg` of `sp` so its point at `t` (held to [`T_RANGE`]) moves by `dv`, the way +/// `mode` says. False, leaving `sp` as it was, when there is no such segment, an input isn't +/// finite or the result wouldn't be. +pub fn reshape_segment(sp: &mut SubPath, seg: usize, t: f64, dv: Vec2, mode: ReshapeMode) -> bool { + if seg >= sp.segment_count() || !t.is_finite() || !dv.x.is_finite() || !dv.y.is_finite() { + return false; + } + let t = t.clamp(T_RANGE.0, T_RANGE.1); + let mut out = sp.clone(); + let bent = match mode { + ReshapeMode::Symmetric => out.bend_segment_perpendicular(seg, t, dv), + ReshapeMode::KeepAngles => keep_angles(&mut out, seg, t, dv) || free(&mut out, seg, t, dv), + ReshapeMode::Free => free(&mut out, seg, t, dv), + }; + let finite = out.anchors.iter().all(|a| a.p.is_finite() && a.h_in.is_finite() && a.h_out.is_finite()); + if !bent || !finite { + return false; + } + *sp = out; + true +} + +/// The weights the segment's two inner control points have at `t`. +fn weights(t: f64) -> (f64, f64) { + let s = 1.0 - t; + (3.0 * s * s * t, 3.0 * s * t * t) +} + +/// Move the two handles by shares of `dv` weighted by the grab position: the share each gets is in +/// proportion to how near its end the grab is, scaled so the point at `t` lands exactly `dv` away +/// (the smallest move of the two that does it). +fn free(sp: &mut SubPath, seg: usize, t: f64, dv: Vec2) -> bool { + let n = sp.anchors.len(); + let (w1, w2) = weights(t); + let (a, b) = (1.0 - t, t); + let k = 1.0 / (w1 * a + w2 * b); + if let Some(p) = sp.anchors.get_mut(seg % n) { + p.set_handle(true, p.h_out + dv * (k * a), false); + } + if let Some(q) = sp.anchors.get_mut((seg + 1) % n) { + q.set_handle(false, q.h_in + dv * (k * b), false); + } + true +} + +/// Lengthen or shorten the two handles along their own directions so the point at `t` moves by +/// `dv`; a handle that would turn back on itself is retracted. False when the directions are +/// parallel (no such move exists). +fn keep_angles(sp: &mut SubPath, seg: usize, t: f64, dv: Vec2) -> bool { + let n = sp.anchors.len(); + let c = sp.segment(seg); + let (Some(u1), Some(u2)) = (unit(c.p1 - c.p0).or_else(|| unit(c.p3 - c.p0)), unit(c.p2 - c.p3).or_else(|| unit(c.p0 - c.p3))) else { + return false; + }; + let det = u1.cross(u2); + if det.abs() < 1e-6 { + return false; + } + let (w1, w2) = weights(t); + // Cramer's rule for x·u1 + y·u2 = dv, then each handle's change of length. + let (x, y) = (dv.cross(u2) / det, u1.cross(dv) / det); + let len1 = ((c.p1 - c.p0).dot(u1) + x / w1).max(0.0); + let len2 = ((c.p2 - c.p3).dot(u2) + y / w2).max(0.0); + if let Some(p) = sp.anchors.get_mut(seg % n) { + p.set_handle(true, c.p0 + u1 * len1, false); + } + if let Some(q) = sp.anchors.get_mut((seg + 1) % n) { + q.set_handle(false, c.p3 + u2 * len2, false); + } + true +} + +#[cfg(test)] +mod tests { + use kurbo::{ParamCurve, Point, Vec2}; + use vectorcraft_geom::{Anchor, AnchorKind, SubPath}; + + use super::*; + + fn pt(x: f64, y: f64) -> Point { + Point::new(x, y) + } + + fn line() -> SubPath { + SubPath::polyline(&[pt(0.0, 0.0), pt(100.0, 0.0)], false) + } + + #[test] + fn the_grabbed_point_follows_the_drag_and_the_nearer_handle_moves_more() { + for t in [0.2, 0.5, 0.8] { + let mut sp = line(); + let before = sp.segment(0).eval(t); + assert!(reshape_segment(&mut sp, 0, t, Vec2::new(0.0, 30.0), ReshapeMode::Free)); + let after = sp.segment(0).eval(t); + assert!((after - before - Vec2::new(0.0, 30.0)).hypot() < 1e-9, "t {t}: {after:?}"); + // The handles grew out of the anchors, the one nearer the grab the longer. + let (h1, h2) = ((sp.anchors[0].h_out - sp.anchors[0].p).hypot(), (sp.anchors[1].h_in - sp.anchors[1].p).hypot()); + assert!(h1 > 0.0 && h2 > 0.0); + assert_eq!(h1 > h2, t < 0.5, "t {t}: {h1} {h2}"); + } + } + + #[test] + fn a_smooth_neighbour_stays_smooth() { + let mut sp = + SubPath::new(vec![Anchor::corner(pt(0.0, 0.0)), Anchor::smooth(pt(100.0, 0.0), pt(130.0, 0.0)), Anchor::corner(pt(200.0, 0.0))], false); + assert!(reshape_segment(&mut sp, 0, 0.7, Vec2::new(0.0, -20.0), ReshapeMode::Free)); + let a = sp.anchors[1]; + assert_eq!(a.kind, AnchorKind::Smooth); + assert!((a.h_out - a.p).cross(a.p - a.h_in).abs() < 1e-9, "the handles stay in line"); + assert!(((a.h_out - a.p).hypot() - 30.0).abs() < 1e-9, "the other handle keeps its length"); + } + + #[test] + fn keep_angles_only_changes_lengths() { + let mut sp = SubPath::new( + vec![ + Anchor::with_handles(pt(0.0, 0.0), pt(0.0, 0.0), pt(20.0, -20.0)), + Anchor::with_handles(pt(100.0, 0.0), pt(80.0, -20.0), pt(100.0, 0.0)), + ], + false, + ); + let before = sp.segment(0).eval(0.5); + assert!(reshape_segment(&mut sp, 0, 0.5, Vec2::new(0.0, -10.0), ReshapeMode::KeepAngles)); + let (a, b) = (sp.anchors[0], sp.anchors[1]); + assert!((a.h_out - a.p).cross(Vec2::new(1.0, -1.0)).abs() < 1e-9 && (b.h_in - b.p).cross(Vec2::new(-1.0, -1.0)).abs() < 1e-9); + assert!((sp.segment(0).eval(0.5) - before - Vec2::new(0.0, -10.0)).hypot() < 1e-9); + // A straight segment has parallel directions: it bends freely instead. + let mut sp = line(); + assert!(reshape_segment(&mut sp, 0, 0.5, Vec2::new(0.0, 10.0), ReshapeMode::KeepAngles)); + assert!((sp.segment(0).eval(0.5) - pt(50.0, 10.0)).hypot() < 1e-9); + } + + #[test] + fn symmetric_makes_the_handles_square_to_the_chord() { + let mut sp = line(); + assert!(reshape_segment(&mut sp, 0, 0.3, Vec2::new(5.0, 20.0), ReshapeMode::Symmetric)); + let (a, b) = (sp.anchors[0], sp.anchors[1]); + assert!((a.h_out.x - a.p.x).abs() < 1e-9 && (b.h_in.x - b.p.x).abs() < 1e-9); + assert!(((a.h_out - a.p).hypot() - (b.h_in - b.p).hypot()).abs() < 1e-9); + } + + #[test] + fn bad_input_changes_nothing() { + let mut sp = line(); + for (seg, t, dv) in [ + (1, 0.5, Vec2::new(0.0, 1.0)), + (0, f64::NAN, Vec2::new(0.0, 1.0)), + (0, 0.5, Vec2::new(f64::INFINITY, 0.0)), + (0, 0.05, Vec2::new(1e308, 1e308)), + ] { + assert!(!reshape_segment(&mut sp, seg, t, dv, ReshapeMode::Free), "{seg} {t} {dv:?}"); + assert_eq!(sp, line()); + } + assert!(!reshape_segment(&mut SubPath::default(), 0, 0.5, Vec2::new(1.0, 1.0), ReshapeMode::KeepAngles)); + // A grab at an end is held inside the range, so the handles stay finite. + assert!(reshape_segment(&mut sp, 0, 0.0, Vec2::new(0.0, 1.0), ReshapeMode::Free)); + assert_eq!(ReshapeMode::parse("keepAngles"), Some(ReshapeMode::KeepAngles)); + assert_eq!(ReshapeMode::parse("sideways"), None); + } +} diff --git a/crates/tools/src/addons.rs b/crates/tools/src/addons.rs index b34cfb1f57..8c5c9909ba 100644 --- a/crates/tools/src/addons.rs +++ b/crates/tools/src/addons.rs @@ -5,6 +5,7 @@ pub mod anchor_eraser; pub mod extend_path; pub mod measure_inspect; +pub mod smart_pen; use crate::{Tool, ToolInfo}; @@ -15,12 +16,19 @@ pub const PATH_TOOLS: &[ToolInfo] = &[ ToolInfo { id: measure_inspect::ID, label: "Measure & Inspect Tool", shortcut: None, icon: "ruler" }, ]; +/// Smart Pen's tool, a flyout group of its own. +pub const SMART_PEN: &[ToolInfo] = &[ToolInfo { id: smart_pen::ID, label: "Smart Pen Tool", shortcut: None, icon: "spline-pointer" }]; + +/// The add-ons' tool groups, after the toolbar's own ([`crate::TOOL_GROUPS`]), each with the +/// heading the All Tools drawer lists it under (its add-on's name). +const HEADED: &[(&[ToolInfo], &str)] = &[(PATH_TOOLS, "Path Precision Tools"), (SMART_PEN, "Smart Pen")]; + /// The add-ons' tool groups, after the toolbar's own ([`crate::TOOL_GROUPS`]). -pub const GROUPS: &[&[ToolInfo]] = &[PATH_TOOLS]; +pub const GROUPS: &[&[ToolInfo]] = &[PATH_TOOLS, SMART_PEN]; /// The heading the All Tools drawer lists tool `id` under: its add-on's name. pub fn heading(id: &str) -> Option<&'static str> { - PATH_TOOLS.iter().any(|t| t.id == id).then_some("Path Precision Tools") + HEADED.iter().find(|(g, _)| g.iter().any(|t| t.id == id)).map(|(_, h)| *h) } /// Create an add-on tool by id (None = not one of them). @@ -29,6 +37,7 @@ pub fn create(id: &str) -> Option> { anchor_eraser::ID => Box::new(anchor_eraser::AnchorEraserTool::default()), extend_path::ID => Box::new(extend_path::ExtendPathTool::default()), measure_inspect::ID => Box::new(measure_inspect::MeasureInspectTool::default()), + smart_pen::ID => Box::new(smart_pen::SmartPenTool::default()), _ => return None, }) } @@ -45,8 +54,10 @@ mod tests { assert!(crate::create(t.id).id() == t.id); assert!(t.shortcut.is_none(), "no default shortcut"); assert!(!crate::TOOL_GROUPS.iter().any(|g| g.iter().any(|x| x.id == t.id)), "{} is not in the toolbar's groups", t.id); - assert_eq!(heading(t.id), Some("Path Precision Tools")); } + assert!(PATH_TOOLS.iter().all(|t| heading(t.id) == Some("Path Precision Tools"))); + assert_eq!(heading(smart_pen::ID), Some("Smart Pen")); + assert_eq!(GROUPS.len(), HEADED.len()); assert!(crate::catalog::all_tools().any(|t| t.id == extend_path::ID)); assert!(create("pen").is_none() && heading("pen").is_none()); } diff --git a/crates/tools/src/addons/smart_pen.rs b/crates/tools/src/addons/smart_pen.rs new file mode 100644 index 0000000000..b4cc0ea051 --- /dev/null +++ b/crates/tools/src/addons/smart_pen.rs @@ -0,0 +1,553 @@ +//! Smart Pen Tool (Smart Pen add-on): one tool that draws paths and edits them without switching +//! tools or holding a key for it. +//! +//! Drawing: a click adds the next anchor with a straight or a curved segment into it, as the +//! `next` option says (the Smart Pen panel's choice; a curve after a straight segment leaves it +//! tangent); a drag makes a smooth anchor (Alt held breaks the outgoing handle off, Shift keeps it +//! to 45° steps, Space moves the anchor); Tab switches the segment into the anchor being placed, or +//! the last one drawn, between straight and curved. A rubber band shows the next segment. A click +//! on the first anchor closes the path, on an end of another open path joins the two, and away +//! from paths, with no path being drawn, starts a new one. Enter or Esc ends the path. +//! +//! Editing the shown paths' points: a click selects a point (an end of an open path is then drawn +//! on from), Shift-click adds it to the selection or takes it out; a drag moves it (Shift: 45°); +//! Alt-drag pulls out its outgoing handle; Alt-click removes it keeping the shape, Shift+Alt-click +//! deletes it leaving the handles beside it; a double-click toggles it between smooth and corner. +//! A selected point's handle drags (Shift: 45°, Alt: keeps its angle); a double-click on it toggles +//! its point. A segment drags to reshape it (Shift: handles square to its chord, Alt: handles keep +//! their angles), Alt-click adds a point on it; a click on a path that isn't selected selects it. +//! +//! Each gesture is one undo step (`addon.pen.*`, and `path.*` where the standard command does it). + +use serde_json::{Value, json}; +use vectorcraft_doc::{NodeId, NodeKind}; +use vectorcraft_geom::{Anchor, BezPath, Point, SubPath, Vec2, constrain_angle_from}; +use vectorcraft_pathops::addons::pathtools::SMOOTH_RATIO; +use vectorcraft_pathops::addons::pen::{leave_handle, straighten_segment}; + +use crate::direct::hit_handle; +use crate::draw2::{anchor_in, hit_segment, segment_in, shown_paths}; +use crate::guides::{DrawSnap, Leave}; +use crate::pen::{active_path, continue_from, open_end_at}; +use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey}; + +/// The tool's id. +pub const ID: &str = "smartPen"; +/// Screen pixels the pointer must move after a press before it drags instead of clicking. +const DRAG_THRESHOLD: f64 = 3.0; + +#[derive(Default)] +pub struct SmartPenTool { + /// A click adds a curved segment (else a straight one): the `next` option. + curved: bool, + /// A path is being drawn... + drawing: bool, + /// ...this subpath of this path, once the engine made it. + path: Option<(NodeId, usize)>, + /// The press under way. + press: Option, + hover: Option, + /// The pointer at the last press or drag (Space moves an anchor being placed by its moves). + last: Point, + snap: DrawSnap, +} + +/// A press: where it went down, what it is on and whether it has become a drag (and started its +/// undo step). +struct Press { + at: Point, + mods: Mods, + dragged: bool, + begun: bool, + what: Target, +} + +/// An anchor being placed at `at`, its handles `h_in` and `h_out`, on `path` (none: the first +/// anchor of a new path); `seg` is the segment into it (straight, curved, or as its handles make +/// it), `tabbed` once Tab chose it. +#[derive(Clone, Copy, Debug, PartialEq)] +struct Place { + at: Point, + h_in: Point, + h_out: Point, + path: Option<(NodeId, usize)>, + seg: Option, + tabbed: bool, +} + +#[derive(Clone, Copy, Debug, PartialEq)] +enum Target { + Place(Place), + /// Closing the path being drawn on its first anchor, at `first`. + Close { + id: NodeId, + si: usize, + first: Point, + }, + /// An anchor of a shown path at `p`; `n` anchors in its subpath, `closed` or not. + Point { + id: NodeId, + si: usize, + ai: usize, + p: Point, + n: usize, + closed: bool, + }, + /// A handle of a selected anchor at `anchor`, the handle at `h`. + Handle { + id: NodeId, + si: usize, + ai: usize, + out: bool, + anchor: Point, + h: Point, + }, + /// A segment, grabbed at `t`. + Segment { + id: NodeId, + si: usize, + seg: usize, + t: f64, + }, +} + +/// What lies under the pointer, in the order a press takes it. +#[derive(Clone, Copy, Debug, PartialEq)] +enum Hit { + /// The first anchor of the path being drawn: a click closes it. + Close(NodeId, usize, Point), + /// A handle of a selected anchor: (path, subpath, anchor, outgoing). + Handle(NodeId, usize, usize, bool), + /// An anchor of a shown path. + Anchor(NodeId, usize, usize), + /// An end of another open path, while one is drawn: a click joins the two. + Join(NodeId, usize, bool), + /// A segment: (path, subpath, segment, t). + Segment(NodeId, usize, usize, f64), + /// An end of an open path, while none is drawn: a click draws on from it. + Continue(NodeId, usize, bool), + Nothing, +} + +fn xy(p: Point) -> Value { + json!([p.x, p.y]) +} + +/// Is `id` selected as the path drawn on: itself, or the compound path it is in? +fn selected_alone(cx: &ToolContext, id: NodeId) -> bool { + let sel = cx.selection.objects.as_slice(); + sel == [id] || cx.doc.parent_of(id).is_some_and(|p| sel == [p] && cx.doc.node(p).is_some_and(|n| matches!(n.kind, NodeKind::Compound { .. }))) +} + +impl SmartPenTool { + /// The open subpath being drawn: (path, subpath, its data), while it is selected and editable. + fn active<'a>(&self, cx: &'a ToolContext) -> Option<(NodeId, usize, &'a SubPath)> { + let (id, si) = self.path.filter(|_| self.drawing)?; + if !selected_alone(cx, id) || !cx.doc.is_editable(id) { + return None; + } + let sp = cx.doc.node(id)?.path_data()?.subpaths.get(si)?; + (!sp.closed && !sp.anchors.is_empty()).then_some((id, si, sp)) + } + + /// The path a press began is the selected one by the next event. + fn sync(&mut self, cx: &ToolContext) { + if self.drawing + && self.path.is_none() + && let Some((id, si, ..)) = active_path(cx) + { + self.path = Some((id, si)); + } + } + + fn stop(&mut self) { + (self.drawing, self.path) = (false, None); + } + + /// What a press at `p` is on. + fn hit(&self, cx: &ToolContext, p: Point) -> Hit { + let tol = cx.tol(5.0).max(cx.point_tol()); + let point = cx.point_tol(); + let active = self.active(cx); + if let Some((id, si, sp)) = active + && sp.anchors.len() > 1 + && let (Some(first), Some(last)) = (sp.anchors.first(), sp.anchors.last()) + && first.p.distance(p) <= tol + && first.p.distance(p) <= last.p.distance(p) + { + return Hit::Close(id, si, first.p); + } + if let Some((id, si, ai, out)) = hit_handle(cx, p, point) { + return Hit::Handle(id, si, ai, out); + } + let shown = shown_paths(cx); + if let Some((id, si, ai)) = anchor_in(cx, shown.iter().copied(), p, point) { + return Hit::Anchor(id, si, ai); + } + if let Some((id, si, _)) = active + && let Some((other, osi, first)) = open_end_at(cx, p, tol, Some((id, si))) + { + return Hit::Join(other, osi, first); + } + if active.is_none() + && let Some((id, si, first)) = open_end_at(cx, p, tol, None) + { + return Hit::Continue(id, si, first); + } + // Drawing, only the shown paths' segments take a press; else any path's. + let seg = if active.is_some() { segment_in(cx, shown, p, cx.pick_tol()) } else { hit_segment(cx, p, cx.pick_tol()) }; + seg.map_or(Hit::Nothing, |(id, si, seg, t)| Hit::Segment(id, si, seg, t)) + } + + /// The command that previews the anchor being placed: with its handles once `dragged`. + fn place_preview(&self, pl: &Place, dragged: bool) -> Action { + let Place { at, h_in, h_out, path, seg, tabbed } = *pl; + let Some((id, si)) = path else { + let mut a = json!({"x": at.x, "y": at.y}); + if dragged { + (a["in"], a["out"]) = (xy(h_in), xy(h_out)); + } + return Action::Preview("path.create".into(), json!({"anchors": [a]})); + }; + let mut p = json!({"id": id.0, "subpath": si, "x": at.x, "y": at.y}); + if dragged { + (p["in"], p["out"]) = (xy(h_in), xy(h_out)); + } + // A click adds the segment the option asks for; a drag shapes it with its handles. + let seg = if tabbed || dragged { seg } else { Some(self.curved) }; + if let Some(curved) = seg { + p["segment"] = json!(if curved { "curved" } else { "straight" }); + } + Action::Preview("addon.pen.append".into(), p) + } + + /// Where the drag puts handle `h` of the anchor at `anchor`: Shift turns it in 45° steps; with + /// `keep` it keeps the direction of `was` and only its length follows. + fn handle_to(cx: &ToolContext, anchor: Point, pos: Point, was: Point, shift: bool, keep: bool) -> Point { + let v = pos - anchor; + let dir = was - anchor; + if keep && dir.hypot() > 1e-9 { + let u = dir / dir.hypot(); + return anchor + u * v.dot(u).max(0.0); + } + if shift { anchor + constrain_angle_from(v, 45.0, cx.constrain_angle) } else { pos } + } + + fn press_down(&mut self, cx: &ToolContext, ev: &PointerEvent, p: Point) -> Vec { + let press = |what| Press { at: ev.pos, mods: ev.mods, dragged: false, begun: false, what }; + match self.hit(cx, ev.pos) { + Hit::Close(id, si, first) => { + self.press = Some(Press { begun: true, ..press(Target::Close { id, si, first }) }); + let seg = if self.curved { "curved" } else { "straight" }; + vec![ + Action::Begin("Close Path".into()), + Action::Preview("addon.pen.close".into(), json!({"id": id.0, "subpath": si, "segment": seg})), + ] + } + Hit::Handle(id, si, ai, out) => { + let Some(a) = cx.doc.node(id).and_then(|n| n.path_data()).and_then(|pd| pd.subpaths.get(si)?.anchors.get(ai).copied()) else { + return vec![]; + }; + self.press = Some(press(Target::Handle { id, si, ai, out, anchor: a.p, h: if out { a.h_out } else { a.h_in } })); + vec![] + } + Hit::Anchor(id, si, ai) => { + let Some(sp) = cx.doc.node(id).and_then(|n| n.path_data()).and_then(|pd| pd.subpaths.get(si)) else { return vec![] }; + let Some(a) = sp.anchors.get(ai) else { return vec![] }; + self.press = Some(press(Target::Point { id, si, ai, p: a.p, n: sp.anchors.len(), closed: sp.closed })); + if ev.mods.alt { + // Alt: a click removes it, a drag pulls out a handle (decided on the way). + return vec![]; + } + let mode = if ev.mods.shift { "toggle" } else { "set" }; + vec![Action::Exec("select.anchors".into(), json!({"id": id.0, "anchors": [[si, ai]], "mode": mode}))] + } + Hit::Join(other, osi, first) => { + let Some((id, si, _)) = self.active(cx) else { return vec![] }; + self.stop(); + let end = if first { "first" } else { "last" }; + vec![Action::Exec("path.join".into(), json!({"ids": [id.0, other.0], "ends": ["last", end], "subpaths": [si, osi]}))] + } + Hit::Segment(id, si, seg, t) => { + self.press = Some(press(Target::Segment { id, si, seg, t })); + vec![] + } + Hit::Continue(id, si, first) => { + (self.drawing, self.path) = (true, Some((id, si))); + continue_from(cx, id, si, first) + } + Hit::Nothing => { + let path = self.active(cx).map(|(id, si, _)| (id, si)); + if path.is_none() { + // A new path: the engine makes it, and the next event picks it up. + (self.drawing, self.path) = (true, None); + } + let pl = Place { at: p, h_in: p, h_out: p, path, seg: self.curved.then_some(true), tabbed: false }; + self.press = Some(Press { begun: true, ..press(Target::Place(pl)) }); + vec![Action::Begin("Smart Pen".into()), self.place_preview(&pl, false)] + } + } + } + + fn press_drag(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec { + let Some(mut pr) = self.press.take() else { return vec![] }; + if !pr.dragged && ev.pos.distance(pr.at) < cx.tol(DRAG_THRESHOLD) { + self.last = ev.pos; + self.press = Some(pr); + return vec![]; + } + let first = !pr.dragged; + pr.dragged = true; + let (shift, alt) = (ev.mods.shift, ev.mods.alt); + let (label, act) = match pr.what { + Target::Place(mut pl) => { + if ev.mods.space { + let d = ev.pos - self.last; + pl.at += d; + pl.h_in += d; + } + pl.h_out = Self::handle_to(cx, pl.at, ev.pos, pl.at, shift, false); + // Alt keeps the incoming handle where it is: only the outgoing one follows. + if !alt { + pl.h_in = pl.at - (pl.h_out - pl.at); + } + pr.what = Target::Place(pl); + ("", self.place_preview(&pl, true)) + } + Target::Close { id, si, first } => { + let out = Self::handle_to(cx, first, ev.pos, first, shift, false); + let h_in = first - (out - first); + ("", Action::Preview("path.close".into(), json!({"id": id.0, "subpath": si, "in": xy(h_in), "independent": alt}))) + } + Target::Point { id, si, ai, p, .. } if pr.mods.alt => { + let h = Self::handle_to(cx, p, ev.pos, p, shift, false); + let params = json!({"id": id.0, "subpath": si, "anchor": ai, "which": "out", "x": h.x, "y": h.y}); + ("Move Direction Handle", Action::Preview("path.setHandle".into(), params)) + } + Target::Point { id, si, ai, p, .. } => { + let to = if shift { p + constrain_angle_from(ev.pos - pr.at, 45.0, cx.constrain_angle) } else { p + (ev.pos - pr.at) }; + ( + "Move Anchor Point", + Action::Preview("path.moveAnchor".into(), json!({"id": id.0, "subpath": si, "anchor": ai, "x": to.x, "y": to.y})), + ) + } + Target::Handle { id, si, ai, out, anchor, h } => { + let to = Self::handle_to(cx, anchor, h + (ev.pos - pr.at), h, shift, alt); + let which = if out { "out" } else { "in" }; + let params = json!({"id": id.0, "subpath": si, "anchor": ai, "which": which, "x": to.x, "y": to.y}); + ("Move Direction Handle", Action::Preview("path.setHandle".into(), params)) + } + Target::Segment { id, si, seg, t } => { + let d = ev.pos - pr.at; + let mode = if shift { + "symmetric" + } else if alt { + "keepAngles" + } else { + "free" + }; + let params = json!({"id": id.0, "subpath": si, "segment": seg, "t": t, "dx": d.x, "dy": d.y, "mode": mode}); + ("Reshape Segment", Action::Preview("addon.pen.reshape".into(), params)) + } + }; + self.last = ev.pos; + let mut out = vec![]; + if first && !pr.begun { + pr.begun = true; + out.push(Action::Begin(label.into())); + } + out.push(act); + self.press = Some(pr); + out + } + + fn press_up(&mut self, cx: &ToolContext) -> Vec { + self.snap.clear(); + let Some(pr) = self.press.take() else { return vec![] }; + if pr.begun { + if matches!(pr.what, Target::Close { .. }) { + self.stop(); + } + return vec![Action::Commit]; + } + match pr.what { + Target::Point { id, si, ai, .. } if pr.mods.alt => { + vec![Action::Exec("addon.pen.removePoint".into(), json!({"id": id.0, "subpath": si, "anchor": ai, "plain": pr.mods.shift}))] + } + // A click on an end of an open path draws on from it; on any other point it ends the + // path being drawn. + Target::Point { id, si, ai, n, closed, .. } => { + if closed || (ai != 0 && ai + 1 != n) || pr.mods.shift { + self.stop(); + return vec![]; + } + (self.drawing, self.path) = (true, Some((id, si))); + if ai + 1 == n { + return vec![]; + } + let reverse = Action::Exec("path.reverse".into(), json!({"ids": [id.0], "subpath": si})); + vec![reverse, Action::Exec("select.anchors".into(), json!({"id": id.0, "anchors": [[si, n - 1]], "mode": "set"}))] + } + Target::Segment { id, si, seg, t } if pr.mods.alt => { + vec![Action::Exec("path.insertAnchor".into(), json!({"id": id.0, "subpath": si, "segment": seg, "t": t}))] + } + Target::Segment { id, .. } if !cx.selection.contains(id) && self.active(cx).is_none() => { + let top = cx.doc.parent_of(id).filter(|p| cx.doc.node(*p).is_some_and(|n| matches!(n.kind, NodeKind::Compound { .. }))).unwrap_or(id); + vec![Action::Exec("select.set".into(), json!({"ids": [top.0]}))] + } + _ => vec![], + } + } + + /// Tab: the segment into the anchor being placed, or else the last one drawn, switches + /// between straight and curved. + fn tab(&mut self, cx: &ToolContext) -> Vec { + if let Some(pr) = &mut self.press + && let Target::Place(pl) = &mut pr.what + { + pl.seg = Some(pl.seg == Some(false)); + pl.tabbed = true; + let (pl, dragged) = (*pl, pr.dragged); + return vec![self.place_preview(&pl, dragged)]; + } + let Some((id, si, sp)) = self.active(cx) else { return vec![] }; + let Some(seg) = sp.segment_count().checked_sub(1) else { return vec![] }; + vec![Action::Exec("addon.pen.segment".into(), json!({"id": id.0, "subpath": si, "segment": seg, "curved": sp.segment_is_line(seg)}))] + } + + /// The next segment as a click at `h` would add it. + fn rubber_band(&self, sp: &SubPath, h: Point) -> Option { + let mut sp = sp.clone(); + sp.anchors.push(Anchor::corner(h)); + let prev = sp.anchors.len().checked_sub(2)?; + if self.curved { + leave_handle(&mut sp, prev, true, SMOOTH_RATIO); + } else { + straighten_segment(&mut sp, prev); + } + let tail = sp.anchors.get(prev..)?; + let mut bp = BezPath::new(); + SubPath::new(tail.to_vec(), false).to_bezpath_into(&mut bp); + Some(bp) + } +} + +impl Tool for SmartPenTool { + fn id(&self) -> &'static str { + ID + } + + fn busy(&self) -> bool { + self.press.is_some() + } + + fn pointer(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec { + self.sync(cx); + let active = self.active(cx); + if self.drawing && active.is_none() && ev.kind == PointerKind::Down { + self.stop(); + } + // Anchors placed snap to Smart Guides; Shift keeps them to 45° steps from the last one. + let drawn = active.map(|a| a.0); + let from = active.and_then(|(.., sp)| sp.anchors.last()).map(|a| { + let leave = Leave::segment(cx, a.p, ev.mods.shift); + if a.has_out() { leave.without_contact() } else { leave } + }); + match ev.kind { + PointerKind::Move => { + self.hover = Some(self.snap.hover(cx, ev.pos, drawn.as_slice(), from.as_ref())); + vec![] + } + PointerKind::Down => { + self.last = ev.pos; + let p = self.snap.press(cx, ev.pos, drawn.as_slice(), from.as_ref()); + self.press_down(cx, ev, p) + } + PointerKind::Drag => self.press_drag(cx, ev), + PointerKind::Up => self.press_up(cx), + PointerKind::DoubleClick => match self.hit(cx, ev.pos) { + Hit::Handle(id, si, ai, _) | Hit::Anchor(id, si, ai) => { + vec![Action::Exec("addon.pen.togglePoint".into(), json!({"id": id.0, "subpath": si, "anchor": ai}))] + } + _ => vec![], + }, + } + } + + fn key(&mut self, cx: &ToolContext, key: ToolKey, _mods: Mods) -> Vec { + self.sync(cx); + match key { + ToolKey::Tab => self.tab(cx), + ToolKey::Enter | ToolKey::Escape => self.deactivate(cx), + _ => vec![], + } + } + + fn claims_key(&self, cx: &ToolContext, key: ToolKey) -> bool { + key == ToolKey::Tab && (self.press.is_some() || self.active(cx).is_some()) + } + + fn deactivate(&mut self, _cx: &ToolContext) -> Vec { + self.stop(); + self.snap.clear(); + match self.press.take() { + Some(pr) if pr.begun => vec![Action::Commit], + _ => vec![], + } + } + + fn hover_ended(&mut self, _cx: &ToolContext) { + self.hover = None; + } + + fn overlays(&self, cx: &ToolContext) -> Vec { + let mut o = vec![]; + if cx.pen_rubber_band + && self.press.is_none() + && let (Some((id, _, sp)), Some(h)) = (self.active(cx), self.hover) + && let Some(path) = self.rubber_band(sp, h) + { + o.push(Overlay::Path { path, color: cx.doc.layer_color(id), width: 1.0, dashed: false }); + if let Some(last) = sp.anchors.last().map(|a| a.p) + && cx.measurement_labels + && last.distance(h) > 1e-9 + { + o.push(Overlay::Measure { p: h + Vec2::new(cx.tol(12.0), cx.tol(12.0)), text: cx.segment_measure_label(last, h) }); + } + } + o.extend_from_slice(self.snap.guides()); + o + } + + fn cursor(&self, cx: &ToolContext, p: Point, m: Mods) -> Cursor { + match self.hit(cx, p) { + Hit::Close(..) => Cursor::PenClose, + Hit::Handle(..) => Cursor::AnchorPoint, + Hit::Anchor(..) if m.alt => Cursor::PenDelete, + Hit::Anchor(..) => Cursor::DirectAnchorSelected, + Hit::Join(..) => Cursor::PenJoin, + Hit::Segment(..) if m.alt => Cursor::PenAdd, + Hit::Segment(..) => Cursor::ReshapeSegment, + Hit::Continue(..) => Cursor::PenContinue, + Hit::Nothing if self.active(cx).is_some() => Cursor::PenDrawing, + Hit::Nothing => Cursor::SmartPen, + } + } + + fn options(&self) -> Value { + json!({ "next": if self.curved { "curved" } else { "straight" } }) + } + + fn set_option(&mut self, key: &str, v: &Value) { + if key == "next" { + match v.as_str() { + Some("curved") => self.curved = true, + Some("straight") => self.curved = false, + _ => {} + } + } + } +} + +#[cfg(test)] +mod tests; diff --git a/crates/tools/src/addons/smart_pen/tests.rs b/crates/tools/src/addons/smart_pen/tests.rs new file mode 100644 index 0000000000..df093ac319 --- /dev/null +++ b/crates/tools/src/addons/smart_pen/tests.rs @@ -0,0 +1,310 @@ +use super::*; +use crate::testutil::{cx, paint}; +use vectorcraft_doc::{Appearance, Document, Node, Selection}; +use vectorcraft_geom::{PathData, SubPath}; + +const NO: Mods = Mods { shift: false, alt: false, cmd: false, ctrl: false, space: false }; +const ALT: Mods = Mods { alt: true, ..NO }; +const SHIFT: Mods = Mods { shift: true, ..NO }; + +/// A document with the open path `pts` (selected): the document, the path and the selection. +fn doc(sp: SubPath) -> (Document, NodeId, Selection) { + let mut d = Document::new(500.0, 500.0); + let l = d.layers[0].id; + let id = d.alloc_id(); + d.insert(Some(l), 0, Node::path(id, PathData::single(sp), Appearance::default_art())).unwrap(); + let mut s = Selection::default(); + s.set([id]); + (d, id, s) +} + +fn line() -> SubPath { + SubPath::polyline(&[Point::new(100.0, 100.0), Point::new(200.0, 100.0)], false) +} + +fn ev(kind: PointerKind, x: f64, y: f64, m: Mods) -> PointerEvent { + PointerEvent::new(kind, x, y).with_mods(m) +} + +/// A context without Smart Guides, so points land where they are pressed. +fn plain<'a>(d: &'a Document, s: &'a Selection, p: &'a crate::PaintDefaults) -> ToolContext<'a> { + ToolContext { smart_guides: false, snap_to_point: false, ..cx(d, s, p) } +} + +/// A click: press and release at (x, y). +fn click(t: &mut SmartPenTool, cx: &ToolContext, x: f64, y: f64, m: Mods) -> Vec { + let mut out = t.pointer(cx, &ev(PointerKind::Down, x, y, m)); + out.extend(t.pointer(cx, &ev(PointerKind::Up, x, y, m))); + out +} + +/// A tool drawing on from the last anchor of the selected path. +fn drawing(cx: &ToolContext, end: Point) -> SmartPenTool { + let mut t = SmartPenTool::default(); + click(&mut t, cx, end.x, end.y, NO); + assert!(t.active(cx).is_some(), "the end clicked is drawn on from"); + t +} + +/// The last preview among `acts`: its command and params. +fn preview(acts: &[Action]) -> (String, Value) { + match acts.iter().rev().find(|a| matches!(a, Action::Preview(..))) { + Some(Action::Preview(c, p)) => (c.clone(), p.clone()), + _ => panic!("no preview in {acts:?}"), + } +} + +#[test] +fn a_click_away_from_paths_starts_a_new_path() { + let (d, s, p) = (Document::new(500.0, 500.0), Selection::default(), paint()); + let cx = plain(&d, &s, &p); + let mut t = SmartPenTool::default(); + assert_eq!(t.cursor(&cx, Point::new(50.0, 50.0), NO), Cursor::SmartPen); + let down = t.pointer(&cx, &ev(PointerKind::Down, 50.0, 50.0, NO)); + assert_eq!(down.first(), Some(&Action::Begin("Smart Pen".into()))); + assert_eq!(preview(&down), ("path.create".into(), json!({"anchors": [{"x": 50.0, "y": 50.0}]}))); + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 50.0, 50.0, NO)), vec![Action::Commit]); + assert!(t.drawing && !t.busy()); +} + +#[test] +fn clicks_add_straight_or_curved_segments_as_the_option_says() { + let (d, _, s) = doc(line()); + let p = paint(); + let cx = plain(&d, &s, &p); + let mut t = drawing(&cx, Point::new(200.0, 100.0)); + assert_eq!(t.cursor(&cx, Point::new(300.0, 200.0), NO), Cursor::PenDrawing); + let acts = click(&mut t, &cx, 300.0, 200.0, NO); + assert_eq!(acts.first(), Some(&Action::Begin("Smart Pen".into()))); + let (c, params) = preview(&acts); + assert_eq!((c.as_str(), params["segment"].as_str(), params["x"].as_f64()), ("addon.pen.append", Some("straight"), Some(300.0))); + assert!(params.get("in").is_none(), "a click gives the anchor no handles"); + assert_eq!(acts.last(), Some(&Action::Commit)); + t.set_option("next", &json!("curved")); + assert_eq!(t.options(), json!({"next": "curved"})); + let (_, params) = preview(&click(&mut t, &cx, 300.0, 200.0, NO)); + assert_eq!(params["segment"], json!("curved")); + t.set_option("next", &json!("wavy")); + assert_eq!(t.options(), json!({"next": "curved"}), "an unknown value changes nothing"); +} + +#[test] +fn a_drag_makes_a_smooth_point_and_alt_breaks_the_outgoing_handle() { + let (d, _, s) = doc(line()); + let p = paint(); + let cx = plain(&d, &s, &p); + let mut t = drawing(&cx, Point::new(200.0, 100.0)); + t.pointer(&cx, &ev(PointerKind::Down, 300.0, 200.0, NO)); + // Inside the drag threshold nothing happens yet. + assert!(t.pointer(&cx, &ev(PointerKind::Drag, 301.0, 200.0, NO)).is_empty()); + let acts = t.pointer(&cx, &ev(PointerKind::Drag, 340.0, 210.0, NO)); + let (c, params) = preview(&acts); + assert_eq!(c, "addon.pen.append"); + assert_eq!((params["out"].clone(), params["in"].clone()), (json!([340.0, 210.0]), json!([260.0, 190.0]))); + assert!(params.get("segment").is_none(), "a drag shapes the segment with its handles"); + // Alt: the incoming handle stays, only the outgoing one follows. + let acts = t.pointer(&cx, &ev(PointerKind::Drag, 300.0, 250.0, ALT)); + let (_, params) = preview(&acts); + assert_eq!((params["out"].clone(), params["in"].clone()), (json!([300.0, 250.0]), json!([260.0, 190.0]))); + // Shift: the handle in 45° steps. + let acts = t.pointer(&cx, &ev(PointerKind::Drag, 340.0, 205.0, SHIFT)); + let (_, params) = preview(&acts); + let out = params["out"].as_array().unwrap(); + assert!((out[1].as_f64().unwrap() - 200.0).abs() < 1e-9, "{out:?}"); + // Space moves the anchor with the pointer. + let acts = t.pointer(&cx, &ev(PointerKind::Drag, 350.0, 215.0, Mods { space: true, ..NO })); + let (_, params) = preview(&acts); + assert_eq!((params["x"].as_f64(), params["y"].as_f64()), (Some(310.0), Some(210.0))); + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 350.0, 215.0, NO)), vec![Action::Commit]); +} + +#[test] +fn tab_switches_the_segment_being_placed_and_the_last_one_drawn() { + let (d, id, s) = doc(line()); + let p = paint(); + let cx = plain(&d, &s, &p); + let mut t = drawing(&cx, Point::new(200.0, 100.0)); + assert!(t.claims_key(&cx, ToolKey::Tab)); + t.pointer(&cx, &ev(PointerKind::Down, 300.0, 200.0, NO)); + t.pointer(&cx, &ev(PointerKind::Drag, 340.0, 210.0, NO)); + for want in ["straight", "curved", "straight"] { + let acts = t.key(&cx, ToolKey::Tab, NO); + assert_eq!(preview(&acts).1["segment"], json!(want)); + } + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 340.0, 210.0, NO)), vec![Action::Commit]); + // Between anchors, Tab switches the last segment drawn: the line here becomes curved. + assert_eq!( + t.key(&cx, ToolKey::Tab, NO), + vec![Action::Exec("addon.pen.segment".into(), json!({"id": id.0, "subpath": 0, "segment": 0, "curved": true}))] + ); + // Not drawing, Tab is not the tool's. + let mut idle = SmartPenTool::default(); + assert!(!idle.claims_key(&cx, ToolKey::Tab) && idle.key(&cx, ToolKey::Tab, NO).is_empty()); +} + +#[test] +fn a_press_on_the_first_anchor_closes_the_path() { + let (d, id, s) = doc(SubPath::polyline(&[Point::new(100.0, 100.0), Point::new(200.0, 100.0), Point::new(200.0, 200.0)], false)); + let p = paint(); + let cx = plain(&d, &s, &p); + let mut t = drawing(&cx, Point::new(200.0, 200.0)); + assert_eq!(t.cursor(&cx, Point::new(101.0, 100.0), NO), Cursor::PenClose); + let down = t.pointer(&cx, &ev(PointerKind::Down, 101.0, 100.0, NO)); + assert_eq!( + down, + vec![Action::Begin("Close Path".into()), Action::Preview("addon.pen.close".into(), json!({"id": id.0, "subpath": 0, "segment": "straight"}))] + ); + // A drag shapes the closing curve. + let (c, params) = preview(&t.pointer(&cx, &ev(PointerKind::Drag, 130.0, 100.0, NO))); + assert_eq!((c.as_str(), params["in"].clone()), ("path.close", json!([70.0, 100.0]))); + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 130.0, 100.0, NO)), vec![Action::Commit]); + assert!(!t.drawing, "the path is finished"); +} + +#[test] +fn point_edits_without_switching_tools() { + let (d, id, s) = doc(SubPath::polyline(&[Point::new(100.0, 100.0), Point::new(200.0, 100.0), Point::new(300.0, 100.0)], false)); + let p = paint(); + let cx = plain(&d, &s, &p); + let mut t = SmartPenTool::default(); + let select = |mode: &str| Action::Exec("select.anchors".into(), json!({"id": id.0, "anchors": [[0, 1]], "mode": mode})); + assert_eq!(t.cursor(&cx, Point::new(200.0, 100.0), NO), Cursor::DirectAnchorSelected); + assert_eq!(t.cursor(&cx, Point::new(200.0, 100.0), ALT), Cursor::PenDelete); + // A click selects the point (an inner one: nothing is drawn on from it); Shift toggles it. + assert_eq!(click(&mut t, &cx, 200.0, 100.0, NO), vec![select("set")]); + assert!(!t.drawing); + assert_eq!(click(&mut t, &cx, 200.0, 100.0, SHIFT), vec![select("toggle")]); + // Alt-click removes it keeping the shape; Shift+Alt-click deletes it plainly. + let remove = |plain: bool| vec![Action::Exec("addon.pen.removePoint".into(), json!({"id": id.0, "subpath": 0, "anchor": 1, "plain": plain}))]; + assert_eq!(click(&mut t, &cx, 200.0, 100.0, ALT), remove(false)); + assert_eq!(click(&mut t, &cx, 200.0, 100.0, Mods { shift: true, ..ALT }), remove(true)); + // A drag moves it (Shift: 45° steps from where it was). + t.pointer(&cx, &ev(PointerKind::Down, 200.0, 100.0, NO)); + let acts = t.pointer(&cx, &ev(PointerKind::Drag, 230.0, 104.0, SHIFT)); + assert_eq!(acts.first(), Some(&Action::Begin("Move Anchor Point".into()))); + let (c, params) = preview(&acts); + assert_eq!((c.as_str(), params["anchor"].as_u64(), params["y"].as_f64()), ("path.moveAnchor", Some(1), Some(100.0))); + assert!((params["x"].as_f64().unwrap() - 230.0).abs() < 0.5, "{params}"); + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 230.0, 104.0, NO)), vec![Action::Commit]); + // Alt-drag pulls out the outgoing handle. + t.pointer(&cx, &ev(PointerKind::Down, 200.0, 100.0, ALT)); + let acts = t.pointer(&cx, &ev(PointerKind::Drag, 220.0, 120.0, ALT)); + assert_eq!(acts.first(), Some(&Action::Begin("Move Direction Handle".into()))); + assert_eq!(preview(&acts), ("path.setHandle".into(), json!({"id": id.0, "subpath": 0, "anchor": 1, "which": "out", "x": 220.0, "y": 120.0}))); + t.pointer(&cx, &ev(PointerKind::Up, 220.0, 120.0, ALT)); + // A double-click toggles smooth and corner. + assert_eq!( + t.pointer(&cx, &ev(PointerKind::DoubleClick, 200.0, 100.0, NO)), + vec![Action::Exec("addon.pen.togglePoint".into(), json!({"id": id.0, "subpath": 0, "anchor": 1}))] + ); + // A click on the first anchor of the open path draws on from it, the path reversed. + let acts = click(&mut t, &cx, 100.0, 100.0, NO); + assert_eq!(acts.get(1), Some(&Action::Exec("path.reverse".into(), json!({"ids": [id.0], "subpath": 0})))); + assert_eq!(acts.last(), Some(&Action::Exec("select.anchors".into(), json!({"id": id.0, "anchors": [[0, 2]], "mode": "set"})))); + assert!(t.drawing); +} + +#[test] +fn handles_drag_and_keep_their_angle_with_alt() { + let sp = SubPath::new( + vec![ + Anchor::corner(Point::new(100.0, 100.0)), + Anchor::smooth(Point::new(200.0, 100.0), Point::new(240.0, 100.0)), + Anchor::corner(Point::new(300.0, 200.0)), + ], + false, + ); + let (d, id, mut s) = doc(sp); + s.anchors.insert(id, [(0, 1)].into_iter().collect()); + let p = paint(); + let cx = plain(&d, &s, &p); + let mut t = SmartPenTool::default(); + assert_eq!(t.cursor(&cx, Point::new(240.0, 100.0), NO), Cursor::AnchorPoint); + assert!(t.pointer(&cx, &ev(PointerKind::Down, 240.0, 100.0, NO)).is_empty()); + let acts = t.pointer(&cx, &ev(PointerKind::Drag, 250.0, 130.0, ALT)); + assert_eq!(acts.first(), Some(&Action::Begin("Move Direction Handle".into()))); + // Alt keeps the handle's direction: only its length follows the pointer. + assert_eq!(preview(&acts), ("path.setHandle".into(), json!({"id": id.0, "subpath": 0, "anchor": 1, "which": "out", "x": 250.0, "y": 100.0}))); + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 250.0, 130.0, NO)), vec![Action::Commit]); + // A click without a drag changes nothing; a double-click toggles its point. + assert!(click(&mut t, &cx, 160.0, 100.0, NO).is_empty()); + assert_eq!( + t.pointer(&cx, &ev(PointerKind::DoubleClick, 160.0, 100.0, NO)), + vec![Action::Exec("addon.pen.togglePoint".into(), json!({"id": id.0, "subpath": 0, "anchor": 1}))] + ); +} + +#[test] +fn segments_reshape_by_dragging_and_alt_click_adds_a_point() { + let (d, id, s) = doc(line()); + let p = paint(); + let cx = plain(&d, &s, &p); + let mut t = SmartPenTool::default(); + assert_eq!(t.cursor(&cx, Point::new(150.0, 100.0), NO), Cursor::ReshapeSegment); + assert_eq!(t.cursor(&cx, Point::new(150.0, 100.0), ALT), Cursor::PenAdd); + assert!(t.pointer(&cx, &ev(PointerKind::Down, 150.0, 100.0, NO)).is_empty()); + for (m, mode) in [(NO, "free"), (ALT, "keepAngles"), (SHIFT, "symmetric")] { + let acts = t.pointer(&cx, &ev(PointerKind::Drag, 150.0, 130.0, m)); + let (c, params) = preview(&acts); + assert_eq!( + (c.as_str(), params["mode"].as_str(), params["dy"].as_f64(), params["segment"].as_u64()), + ("addon.pen.reshape", Some(mode), Some(30.0), Some(0)) + ); + assert!((params["t"].as_f64().unwrap() - 0.5).abs() < 1e-6); + } + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 150.0, 130.0, NO)), vec![Action::Commit]); + let acts = click(&mut t, &cx, 125.0, 100.0, ALT); + let [Action::Exec(c, params)] = acts.as_slice() else { panic!("{acts:?}") }; + assert_eq!((c.as_str(), params["id"].as_u64(), params["segment"].as_u64()), ("path.insertAnchor", Some(id.0), Some(0))); + assert!(click(&mut t, &cx, 150.0, 100.0, NO).is_empty(), "a click on a selected path's segment does nothing"); + // A click on a path that isn't selected selects it. + let none = Selection::default(); + let cx = plain(&d, &none, &p); + assert_eq!(click(&mut t, &cx, 150.0, 100.0, NO), vec![Action::Exec("select.set".into(), json!({"ids": [id.0]}))]); +} + +#[test] +fn ends_of_other_open_paths_continue_or_join() { + let (mut d, id, s) = doc(line()); + let l = d.layers[0].id; + let other = d.alloc_id(); + let sp = SubPath::polyline(&[Point::new(100.0, 300.0), Point::new(200.0, 300.0)], false); + d.insert(Some(l), 1, Node::path(other, PathData::single(sp), Appearance::default_art())).unwrap(); + let p = paint(); + // Not drawing, nothing selected: a click on an end draws on from it. + let none = Selection::default(); + let cx = plain(&d, &none, &p); + let mut t = SmartPenTool::default(); + assert_eq!(t.cursor(&cx, Point::new(200.0, 300.0), NO), Cursor::PenContinue); + assert_eq!(click(&mut t, &cx, 200.0, 300.0, NO), vec![Action::Exec("select.set".into(), json!({"ids": [other.0]}))]); + assert!(t.drawing); + // Drawing the selected path, a press on the other's end joins the two. + let cx = plain(&d, &s, &p); + let mut t = drawing(&cx, Point::new(200.0, 100.0)); + assert_eq!(t.cursor(&cx, Point::new(100.0, 300.0), NO), Cursor::PenJoin); + assert_eq!( + t.pointer(&cx, &ev(PointerKind::Down, 100.0, 300.0, NO)), + vec![Action::Exec("path.join".into(), json!({"ids": [id.0, other.0], "ends": ["last", "first"], "subpaths": [0, 0]}))] + ); + assert!(!t.drawing); +} + +#[test] +fn the_rubber_band_shows_the_next_segment_and_ending_the_path() { + let (d, _, s) = doc(line()); + let p = paint(); + let cx = plain(&d, &s, &p); + let mut t = drawing(&cx, Point::new(200.0, 100.0)); + t.pointer(&cx, &ev(PointerKind::Move, 300.0, 200.0, NO)); + assert!(t.overlays(&cx).iter().any(|o| matches!(o, Overlay::Path { .. }))); + // Curved, the band leaves the last anchor along the straight segment before it. + t.set_option("next", &json!("curved")); + let band = t.overlays(&cx).into_iter().find_map(|o| if let Overlay::Path { path, .. } = o { Some(path) } else { None }).unwrap(); + assert!( + band.elements().iter().any(|e| matches!(e, vectorcraft_geom::PathEl::CurveTo(p1, ..) if (p1.y - 100.0).abs() < 1e-9 && p1.x > 200.0)), + "{band:?}" + ); + assert!(t.key(&cx, ToolKey::Escape, NO).is_empty()); + assert!(t.active(&cx).is_none()); + assert!(t.overlays(&cx).is_empty()); +} diff --git a/crates/tools/src/catalog.rs b/crates/tools/src/catalog.rs index 4ec7c0753f..ac18d6beb4 100644 --- a/crates/tools/src/catalog.rs +++ b/crates/tools/src/catalog.rs @@ -164,7 +164,7 @@ pub fn is_selection_tool(id: &str) -> bool { /// The tools that show a selected path's anchors and handles as Direct Selection does, and drag /// them: a Cmd drag with one of them is a Direct Selection drag until a selection tool is chosen. pub fn edits_anchors(id: &str) -> bool { - matches!(id, "directSelection" | "pen" | "addAnchor" | "deleteAnchor" | "anchorPoint" | "curvature") + matches!(id, "directSelection" | "pen" | "addAnchor" | "deleteAnchor" | "anchorPoint" | "curvature" | crate::addons::smart_pen::ID) } #[cfg(test)] diff --git a/crates/tools/src/cursor.rs b/crates/tools/src/cursor.rs index 1b5097e0be..f7974e82dc 100644 --- a/crates/tools/src/cursor.rs +++ b/crates/tools/src/cursor.rs @@ -177,6 +177,9 @@ pub enum Cursor { ExtendPath, /// The Measure & Inspect tool (Path Precision Tools add-on). MeasureInspect, + /// The Smart Pen Tool (Smart Pen add-on) away from paths, where a click starts a new path (over + /// a path or while drawing it shows the Pen's and Direct Selection's cursors). + SmartPen, } impl Cursor { @@ -270,7 +273,8 @@ impl Cursor { | Cursor::PuppetPin | Cursor::AnchorEraser | Cursor::ExtendPath - | Cursor::MeasureInspect => Cursor::Crosshair, + | Cursor::MeasureInspect + | Cursor::SmartPen => Cursor::Crosshair, c => c, } } @@ -310,6 +314,7 @@ impl Cursor { | Cursor::MeasureInspect => Some(Cursor::Crosshair), Cursor::TypeVertical => Some(Cursor::Text), Cursor::MeshAdd | Cursor::PuppetPin => Some(Cursor::PenAdd), + Cursor::SmartPen => Some(Cursor::Pen), Cursor::ScissorsNotAllowed => Some(Cursor::NotAllowed), _ => None, } diff --git a/crates/tools/src/cursors.toml b/crates/tools/src/cursors.toml index 30fd82c750..5304377b31 100644 --- a/crates/tools/src/cursors.toml +++ b/crates/tools/src/cursors.toml @@ -666,6 +666,12 @@ group = "Drawing and editing tools" shown_when = ["The Measure tool: drag to measure distance and angle."] hotspot = "Exact, because precision matters here (an open centre suits it)." +[[cursor]] +id = "SmartPen" +group = "Drawing and editing tools" +shown_when = ["The Smart Pen Tool (Smart Pen add-on) away from paths, where a click starts a new path. Over a path, or while a path is drawn, the tool shows the Pen's and Direct Selection's cursors for what a click there does."] +hotspot = "The nib's tip." + [[cursor]] id = "PrintTiling" group = "Drawing and editing tools" diff --git a/crates/tools/src/pen.rs b/crates/tools/src/pen.rs index 9acefa895d..a2e9d38814 100644 --- a/crates/tools/src/pen.rs +++ b/crates/tools/src/pen.rs @@ -80,7 +80,7 @@ struct Place { /// The open path the pen is extending: the single selected open path, or the single open path of a /// single selected compound path. -fn active_path(cx: &ToolContext) -> Option<(NodeId, usize, Point, Point, Point)> { +pub(crate) fn active_path(cx: &ToolContext) -> Option<(NodeId, usize, Point, Point, Point)> { if cx.selection.objects.len() != 1 { return None; } @@ -135,7 +135,7 @@ fn endpoint_on(cx: &ToolContext, id: NodeId, p: Point, tol: f64, except: Option< /// An end of an open path (any editable path, including inside groups and compound paths, not `except`) /// under `p`, within `tol`: the path the Pen continues or joins to, and whether it's the path's first anchor. -fn open_end_at(cx: &ToolContext, p: Point, tol: f64, except: Option<(NodeId, usize)>) -> Option<(NodeId, usize, bool)> { +pub(crate) fn open_end_at(cx: &ToolContext, p: Point, tol: f64, except: Option<(NodeId, usize)>) -> Option<(NodeId, usize, bool)> { let mut best: Option<((NodeId, usize, bool), f64)> = None; // 1. Shown paths (anchors visible because object, group, or compound path is selected). for id in shown_paths(cx) { @@ -352,22 +352,7 @@ impl Tool for PenTool { // Continue any other open path from the end clicked, selecting it. if let Some((id, si, at_first)) = open_end_at(cx, at, tol, None) { (self.drawing, self.path, self.subpath) = (true, Some(id), Some(si)); - let top = cx - .doc - .parent_of(id) - .filter(|p| matches!(cx.doc.node(*p).map(|n| &n.kind), Some(NodeKind::Compound { .. }))) - .unwrap_or(id); - let mut out = vec![]; - if cx.selection.objects.as_slice() != [top] { - out.push(Action::Exec("select.set".into(), json!({"ids": [top.0]}))); - } - if at_first { - // Name the path: the `select.set` above may have just put its compound - // parent in the selection, and a reverse addressed through the - // selection would flip this subpath of every member of it. - out.push(Action::Exec("path.reverse".into(), json!({"ids": [id.0], "subpath": si}))); - } - return out; + return continue_from(cx, id, si, at_first); } } if let Some(act) = auto_add_delete(cx, ev.pos, ev.mods, tol) { @@ -594,6 +579,24 @@ impl PenTool { } } +/// Go on drawing subpath `si` of open path `id` from its last anchor, or from its first +/// (`at_first`, the subpath reversed so that it is the last): the path (its compound path) is +/// selected. +pub(crate) fn continue_from(cx: &ToolContext, id: NodeId, si: usize, at_first: bool) -> Vec { + let top = cx.doc.parent_of(id).filter(|p| matches!(cx.doc.node(*p).map(|n| &n.kind), Some(NodeKind::Compound { .. }))).unwrap_or(id); + let mut out = vec![]; + if cx.selection.objects.as_slice() != [top] { + out.push(Action::Exec("select.set".into(), json!({"ids": [top.0]}))); + } + if at_first { + // Name the path: the `select.set` above may have just put its compound parent in the + // selection, and a reverse addressed through the selection would flip this subpath of + // every member of it. + out.push(Action::Exec("path.reverse".into(), json!({"ids": [id.0], "subpath": si}))); + } + out +} + /// Auto Add/Delete: what a click at `p` does to a selected path. On one of its anchors it deletes /// it; else, where one of its segments passes within `tol`, it adds an anchor. None when the /// preference turns it off, Shift is held, or no selected path is there. diff --git a/crates/tools/src/settings.rs b/crates/tools/src/settings.rs index f27f56330d..2d13db548a 100644 --- a/crates/tools/src/settings.rs +++ b/crates/tools/src/settings.rs @@ -69,6 +69,7 @@ const ROWS: &[Row] = &[ // The add-ons' tools (`crate::addons`). (&[crate::addons::anchor_eraser::ID], None, &["size", "tolerance", "pressure"]), (&[crate::addons::extend_path::ID], None, &["mode"]), + (&[crate::addons::smart_pen::ID], None, &["next"]), // Flare Tool Options (`extra::FLARE_OPTIONS` and the Rays and Rings checkboxes). ( &["flare"], diff --git a/crates/ui-egui/src/addons.rs b/crates/ui-egui/src/addons.rs index 850ab59762..36106b72b6 100644 --- a/crates/ui-egui/src/addons.rs +++ b/crates/ui-egui/src/addons.rs @@ -4,6 +4,7 @@ pub mod cleanup; pub mod color; pub mod pathtools; +pub mod pen; use crate::menus::Item; @@ -13,6 +14,7 @@ pub fn plugin_menu() -> Vec { Item::Sub("Artwork Cleanup", cleanup::menu()), Item::Sub("Color Effects", color::menu()), Item::Sub("Path Precision Tools", pathtools::menu()), + Item::Sub("Smart Pen", pen::menu()), Item::Sep, ] } diff --git a/crates/ui-egui/src/addons/pen.rs b/crates/ui-egui/src/addons/pen.rs new file mode 100644 index 0000000000..9e1a2e3d3c --- /dev/null +++ b/crates/ui-egui/src/addons/pen.rs @@ -0,0 +1,75 @@ +//! Smart Pen in the interface: its submenu (Object › Plug-ins › Smart Pen), which selects the +//! Smart Pen Tool and opens the Smart Pen panel; and the panel: whether a click with the tool adds +//! a straight or a curved segment, and the point and path edits it shares with the tool. Everything +//! acts through `addon.pen.*` and the `addon.pathtools.*` anchor edits. + +use egui::Ui; +use serde_json::{Value, json}; +use vectorcraft_tools::addons::smart_pen; + +use crate::VectorcraftApp; +use crate::menus::Item; +use crate::panels::empty_state; +use crate::widgets::{self, dim_label}; + +/// The Smart Pen panel's id (`window.panel {panel: "smartPen"}`). +pub const ID: &str = "smartPen"; + +/// Object › Plug-ins › Smart Pen. +pub fn menu() -> Vec { + vec![ + Item::Cmd("Smart Pen Tool", "tool.select", json!({ "tool": smart_pen::ID })), + Item::Cmd("Smart Pen Panel", "window.panel", json!({ "panel": ID })), + ] +} + +/// The panel's point and path edits: (label, command, params). +fn edits() -> [(&'static str, &'static str, Value); 5] { + [ + (tl!("Remove Points, Keep Shape"), "addon.pathtools.removeKeepShape", json!({})), + (tl!("Make Smooth"), "addon.pathtools.smooth", json!({})), + // Nothing moves: the handles stay where they are. + (tl!("Make Corner"), "addon.pathtools.corner", json!({ "retract": false })), + (tl!("Retract Handles"), "addon.pathtools.corner", json!({ "retract": true })), + (tl!("Close or Join"), "addon.pen.closeJoin", json!({})), + ] +} + +pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { + let Some(st) = app.session.active() else { + empty_state(ui, "spline-pointer", tl!("No document"), tl!("Open a document to draw with the Smart Pen.")); + return; + }; + let selected = !st.selection.is_empty(); + let curved = app.session.tool_options_of(smart_pen::ID)["next"] == json!("curved"); + let mut action: Option<(&str, Value)> = None; + // The label above its buttons, so a long translation stays within the dock's width. + widgets::subheader(ui, tl!("Next Segment")); + ui.horizontal(|ui| { + for (icon, tip, on) in [("dc-line", tl!("Straight"), false), ("spline", tl!("Curved"), true)] { + if widgets::icon_button(ui, icon, tip, curved == on, 24.0).clicked() { + action = Some(("addon.pen.nextSegment", json!({ "curved": on }))); + } + } + }); + widgets::divider(ui); + if !selected { + dim_label(ui, tl!("Direct-select anchor points to edit them.")); + } + let width = ui.available_width(); + ui.add_enabled_ui(selected, |ui| { + for (label, id, p) in edits() { + if widgets::flat_button(ui, label, width).clicked() { + action = Some((id, p)); + } + } + }); + if let Some((id, p)) = action + && let Err(e) = app.run(id, p) + { + app.status(e); + } +} + +#[cfg(test)] +mod tests; diff --git a/crates/ui-egui/src/addons/pen/tests.rs b/crates/ui-egui/src/addons/pen/tests.rs new file mode 100644 index 0000000000..db0983b79f --- /dev/null +++ b/crates/ui-egui/src/addons/pen/tests.rs @@ -0,0 +1,57 @@ +use serde_json::json; +use vectorcraft_engine::Session; + +use super::{ID, show}; +use crate::tests_labels::painted_text; +use crate::{VectorcraftApp, menus}; + +fn app() -> VectorcraftApp { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 300})).unwrap(); + app +} + +#[test] +fn the_plugins_submenu_selects_the_tool_and_opens_the_panel() { + let mut app = app(); + let entries = menus::menu_entries(&app); + let under = |label: &str| entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Smart Pen"] && e.label == label); + let tool = under("Smart Pen Tool").expect("listed"); + assert_eq!((tool.command.as_deref(), &tool.params), (Some("tool.select"), &json!({ "tool": "smartPen" }))); + menus::invoke(&mut app, "tool.select", tool.params.clone()); + assert_eq!(app.session.tool_id(), "smartPen"); + let panel = under("Smart Pen Panel").expect("listed"); + assert!(!crate::panel_docking::showing(&app.ui, ID)); + menus::invoke(&mut app, "window.panel", panel.params.clone()); + assert!(crate::panel_docking::showing(&app.ui, ID), "the panel opens"); + // The other add-ons' submenus are still there, and the tool has no shortcut. + assert!(entries.iter().any(|e| e.path == ["Object", "Plug-ins", "Path Precision Tools"])); + assert!(vectorcraft_tools::tool_info("smartPen").is_some_and(|t| t.shortcut.is_none())); +} + +#[test] +fn the_panel_sets_the_next_segment_and_its_buttons_edit() { + let mut app = app(); + let text = painted_text(&mut app, show); + for label in [ + "Next Segment", + "Direct-select anchor points to edit them.", + "Remove Points, Keep Shape", + "Make Smooth", + "Make Corner", + "Retract Handles", + "Close or Join", + ] { + assert!(text.contains(label), "{label}: {text}"); + } + assert_eq!(app.session.tool_options_of("smartPen")["next"], json!("straight")); + app.run("addon.pen.nextSegment", json!({"curved": true})).unwrap(); + assert_eq!(app.session.tool_options_of("smartPen")["next"], json!("curved")); + // Close or Join closes an open path selected whole, as one undo step. + let r = app.run("path.create", json!({"anchors": [{"x": 10, "y": 10}, {"x": 110, "y": 10}, {"x": 110, "y": 110}], "closed": false})).unwrap(); + let id = vectorcraft_doc::NodeId(r["id"].as_u64().unwrap()); + let steps = app.session.doc().unwrap().history.undo.len(); + app.run("addon.pen.closeJoin", json!({})).unwrap(); + assert!(app.session.doc().unwrap().doc.node(id).unwrap().path_data().unwrap().subpaths[0].closed); + assert_eq!(app.session.doc().unwrap().history.undo.len(), steps + 1); +} diff --git a/crates/ui-egui/src/canvas/cursor.rs b/crates/ui-egui/src/canvas/cursor.rs index 6987dcb6d3..84c7bea8f8 100644 --- a/crates/ui-egui/src/canvas/cursor.rs +++ b/crates/ui-egui/src/canvas/cursor.rs @@ -150,6 +150,7 @@ pub(super) fn cursor_icon(c: Cursor) -> egui::CursorIcon { | Cursor::PuppetPin | Cursor::AnchorEraser | Cursor::ExtendPath - | Cursor::MeasureInspect => cursor_icon(c.stand_in().unwrap_or(Cursor::Crosshair)), + | Cursor::MeasureInspect + | Cursor::SmartPen => cursor_icon(c.stand_in().unwrap_or(Cursor::Crosshair)), } } diff --git a/crates/ui-egui/src/cursors.rs b/crates/ui-egui/src/cursors.rs index 5461767bd7..df9008210f 100644 --- a/crates/ui-egui/src/cursors.rs +++ b/crates/ui-egui/src/cursors.rs @@ -440,7 +440,7 @@ fn magnifier(p: &mut Ink, o: Pos2, out: bool) { /// Every cursor with a glyph: its own, drawn here, or the one it borrows. #[cfg(test)] -const GLYPHS: [Cursor; 84] = [ +const GLYPHS: [Cursor; 85] = [ Cursor::Hand, Cursor::HandGrab, Cursor::ZoomIn, @@ -525,6 +525,7 @@ const GLYPHS: [Cursor; 84] = [ Cursor::AnchorEraser, Cursor::ExtendPath, Cursor::MeasureInspect, + Cursor::SmartPen, ]; /// The shapes of cursor `c` with its hotspot at `p`; `None` for cursors that stay system cursors diff --git a/crates/ui-egui/src/edit_toolbar/tests.rs b/crates/ui-egui/src/edit_toolbar/tests.rs index 4184e4e557..d4bc5e25ac 100644 --- a/crates/ui-egui/src/edit_toolbar/tests.rs +++ b/crates/ui-egui/src/edit_toolbar/tests.rs @@ -379,16 +379,20 @@ fn drop_targets_follow_the_buttons_edges() { fn addon_tools_are_in_the_drawer_not_the_toolbars() { let mut app = app(); let addon: Vec<&str> = vectorcraft_tools::addons::GROUPS.iter().flat_map(|g| g.iter().map(|t| t.id)).collect(); - assert_eq!(addon, ["anchorEraserBrush", "extendPath", "measureInspect"]); + assert_eq!(addon, ["anchorEraserBrush", "extendPath", "measureInspect", "smartPen"]); for advanced in [false, true] { if advanced { app.run("window.toolbarAdvanced", json!({})).unwrap(); } assert!(addon.iter().all(|id| slot_of(&app, id).is_none()), "advanced: {advanced}"); } - let (heading, tools) = sections().iter().find(|(_, tools)| tools.iter().any(|t| t.id == "extendPath")).expect("listed"); - assert_eq!(*heading, "Path Precision Tools"); - assert_eq!(tools.iter().map(|t| t.id).collect::>(), addon); - app.run("toolbar.addTool", json!({"tool": "extendPath"})).unwrap(); - assert!(slot_of(&app, "extendPath").is_some()); + let listed = |id: &str| { + sections().iter().find(|(_, tools)| tools.iter().any(|t| t.id == id)).map(|(h, tools)| (*h, tools.iter().map(|t| t.id).collect::>())) + }; + assert_eq!(listed("extendPath"), Some(("Path Precision Tools", addon[..3].to_vec()))); + assert_eq!(listed("smartPen"), Some(("Smart Pen", vec!["smartPen"]))); + for tool in ["extendPath", "smartPen"] { + app.run("toolbar.addTool", json!({"tool": tool})).unwrap(); + assert!(slot_of(&app, tool).is_some(), "{tool}"); + } } diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 82ab44160b..09d7063dc2 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5687,3 +5687,25 @@ anchor Points: Точки: @msg select open paths to close изберете отворени пътища за затваряне @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) пътищата са твърде много или твърде заплетени, за да се намерят пресичанията им (най-много 10000 сегмента) @msg the paths have too many anchors to edit at once пътищата имат твърде много опорни точки, за да се редактират наведнъж +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Интелигентно перо + Smart Pen Tool Инструмент „Интелигентно перо“ + Smart Pen Panel Панел „Интелигентно перо“ + Next Segment Следващ сегмент + Curved Крив + Retract Handles Прибиране на дръжките + Close or Join Затваряне или свързване + Open a document to draw with the Smart Pen. Отворете документ, за да рисувате с интелигентното перо. + Straight or Curved Segment Прав или крив сегмент +@msg the path is locked or hidden пътят е заключен или скрит +@msg `id` is not a path `id` не е път +@msg the path has no open subpath пътят няма отворен подпът +@msg the subpath is closed подпътят е затворен +@msg the subpath is closed or too short to close подпътят е затворен или е твърде къс, за да се затвори +@msg the path is too short to remove a point from пътят е твърде къс, за да се премахне точка от него +@msg the segment can't be bent that far сегментът не може да се огъне толкова +@msg give `{a}` and `{b}` задайте `{a}` и `{b}` +@msg `t` must be from 0 to 1 `t` трябва да е от 0 до 1 +@msg `segment` must be "straight" or "curved" `segment` трябва да е "straight" или "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` трябва да е "free", "keepAngles" или "symmetric" +@msg `{key}` must be [x, y] `{key}` трябва да е [x, y] diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index f25027869f..c6cfb2d9ff 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5788,3 +5788,25 @@ anchor Points: Punts: @msg select open paths to close seleccioneu traçats oberts per tancar-los @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) massa traçats, o massa enredats, per trobar-ne els encreuaments (10000 segments com a màxim) @msg the paths have too many anchors to edit at once els traçats tenen massa punts d’ancoratge per editar-los alhora +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Ploma intel·ligent + Smart Pen Tool Eina de ploma intel·ligent + Smart Pen Panel Tauler de ploma intel·ligent + Next Segment Segment següent + Curved Corbat + Retract Handles Retrau les nanses + Close or Join Tanca o uneix + Open a document to draw with the Smart Pen. Obriu un document per dibuixar amb la ploma intel·ligent. + Straight or Curved Segment Segment recte o corbat +@msg the path is locked or hidden el traçat està bloquejat o ocult +@msg `id` is not a path `id` no és un traçat +@msg the path has no open subpath el traçat no té cap subtraçat obert +@msg the subpath is closed el subtraçat és tancat +@msg the subpath is closed or too short to close el subtraçat és tancat o massa curt per tancar-lo +@msg the path is too short to remove a point from el traçat és massa curt per treure’n un punt +@msg the segment can't be bent that far el segment no es pot corbar tant +@msg give `{a}` and `{b}` indiqueu `{a}` i `{b}` +@msg `t` must be from 0 to 1 `t` ha de ser de 0 a 1 +@msg `segment` must be "straight" or "curved" `segment` ha de ser "straight" o "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` ha de ser "free", "keepAngles" o "symmetric" +@msg `{key}` must be [x, y] `{key}` ha de ser [x, y] diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 894d77f6e9..6282e305c9 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -5797,3 +5797,25 @@ anchor Points: Body: @msg select open paths to close vyberte otevřené cesty k uzavření @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) příliš mnoho nebo příliš spletených cest pro nalezení jejich křížení (nejvýše 10000 segmentů) @msg the paths have too many anchors to edit at once cesty mají příliš mnoho kotevních bodů na úpravu najednou +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Chytré pero + Smart Pen Tool Nástroj Chytré pero + Smart Pen Panel Panel Chytré pero + Next Segment Další segment + Curved Zakřivený + Retract Handles Zasunout úchyty + Close or Join Uzavřít nebo spojit + Open a document to draw with the Smart Pen. Otevřete dokument a kreslete chytrým perem. + Straight or Curved Segment Přímý nebo zakřivený segment +@msg the path is locked or hidden cesta je zamčená nebo skrytá +@msg `id` is not a path `id` není cesta +@msg the path has no open subpath cesta nemá žádnou otevřenou dílčí cestu +@msg the subpath is closed dílčí cesta je uzavřená +@msg the subpath is closed or too short to close dílčí cesta je uzavřená nebo příliš krátká k uzavření +@msg the path is too short to remove a point from cesta je příliš krátká na odebrání bodu +@msg the segment can't be bent that far segment nelze ohnout tak daleko +@msg give `{a}` and `{b}` zadejte `{a}` a `{b}` +@msg `t` must be from 0 to 1 `t` musí být od 0 do 1 +@msg `segment` must be "straight" or "curved" `segment` musí být "straight" nebo "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` musí být "free", "keepAngles" nebo "symmetric" +@msg `{key}` must be [x, y] `{key}` musí být [x, y] diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index bac02b2ad1..b969e9572b 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5702,3 +5702,25 @@ anchor Points: Punkter: @msg select open paths to close vælg åbne stier at lukke @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) for mange eller for sammenfiltrede stier til at finde deres krydsninger (højst 10000 segmenter) @msg the paths have too many anchors to edit at once stierne har for mange ankerpunkter til at blive redigeret på én gang +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Smart pen + Smart Pen Tool Smart pen-værktøj + Smart Pen Panel Smart pen-panel + Next Segment Næste segment + Curved Buet + Retract Handles Træk håndtag ind + Close or Join Luk eller forbind + Open a document to draw with the Smart Pen. Åbn et dokument for at tegne med smart pen. + Straight or Curved Segment Lige eller buet segment +@msg the path is locked or hidden stien er låst eller skjult +@msg `id` is not a path `id` er ikke en sti +@msg the path has no open subpath stien har ingen åben delsti +@msg the subpath is closed delstien er lukket +@msg the subpath is closed or too short to close delstien er lukket eller for kort til at lukke +@msg the path is too short to remove a point from stien er for kort til at fjerne et punkt +@msg the segment can't be bent that far segmentet kan ikke bøjes så langt +@msg give `{a}` and `{b}` angiv `{a}` og `{b}` +@msg `t` must be from 0 to 1 `t` skal være fra 0 til 1 +@msg `segment` must be "straight" or "curved" `segment` skal være "straight" eller "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` skal være "free", "keepAngles" eller "symmetric" +@msg `{key}` must be [x, y] `{key}` skal være [x, y] diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 6adaa3f3a7..ac48208a1d 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -5380,3 +5380,25 @@ anchor Points: Punkte: @msg select open paths to close offene Pfade zum Schließen auswählen @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) zu viele oder zu verschlungene Pfade, um ihre Kreuzungen zu finden (höchstens 10000 Segmente) @msg the paths have too many anchors to edit at once die Pfade haben zu viele Ankerpunkte, um sie auf einmal zu bearbeiten +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Intelligenter Zeichenstift + Smart Pen Tool Intelligenter-Zeichenstift-Werkzeug + Smart Pen Panel Bedienfeld „Intelligenter Zeichenstift“ + Next Segment Nächstes Segment + Curved Gebogen + Retract Handles Griffe einziehen + Close or Join Schließen oder zusammenfügen + Open a document to draw with the Smart Pen. Öffnen Sie ein Dokument, um mit dem intelligenten Zeichenstift zu zeichnen. + Straight or Curved Segment Gerades oder gebogenes Segment +@msg the path is locked or hidden der Pfad ist gesperrt oder ausgeblendet +@msg `id` is not a path `id` ist kein Pfad +@msg the path has no open subpath der Pfad hat keinen offenen Teilpfad +@msg the subpath is closed der Teilpfad ist geschlossen +@msg the subpath is closed or too short to close der Teilpfad ist geschlossen oder zu kurz zum Schließen +@msg the path is too short to remove a point from der Pfad ist zu kurz, um einen Punkt zu entfernen +@msg the segment can't be bent that far das Segment lässt sich nicht so weit biegen +@msg give `{a}` and `{b}` geben Sie `{a}` und `{b}` an +@msg `t` must be from 0 to 1 `t` muss zwischen 0 und 1 liegen +@msg `segment` must be "straight" or "curved" `segment` muss "straight" oder "curved" sein +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` muss "free", "keepAngles" oder "symmetric" sein +@msg `{key}` must be [x, y] `{key}` muss [x, y] sein diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index d30ffaa194..0a18dae9dc 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5749,3 +5749,25 @@ anchor Points: Σημεία: @msg select open paths to close επιλέξτε ανοιχτές διαδρομές για κλείσιμο @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) οι διαδρομές είναι πάρα πολλές ή πολύ μπλεγμένες για να βρεθούν οι διασταυρώσεις τους (έως 10000 τμήματα) @msg the paths have too many anchors to edit at once οι διαδρομές έχουν πάρα πολλά σημεία αγκύρωσης για επεξεργασία με μία φορά +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Έξυπνη πένα + Smart Pen Tool Έξυπνη πένα (Smart Pen Tool) + Smart Pen Panel Πίνακας έξυπνης πένας + Next Segment Επόμενο τμήμα + Curved Καμπύλο + Retract Handles Σύμπτυξη λαβών + Close or Join Κλείσιμο ή ένωση + Open a document to draw with the Smart Pen. Ανοίξτε ένα έγγραφο για να σχεδιάσετε με την έξυπνη πένα. + Straight or Curved Segment Ευθύ ή καμπύλο τμήμα +@msg the path is locked or hidden η διαδρομή είναι κλειδωμένη ή κρυφή +@msg `id` is not a path Το `id` δεν είναι διαδρομή +@msg the path has no open subpath η διαδρομή δεν έχει ανοιχτή υποδιαδρομή +@msg the subpath is closed η υποδιαδρομή είναι κλειστή +@msg the subpath is closed or too short to close η υποδιαδρομή είναι κλειστή ή πολύ μικρή για να κλείσει +@msg the path is too short to remove a point from η διαδρομή είναι πολύ μικρή για να αφαιρεθεί σημείο +@msg the segment can't be bent that far το τμήμα δεν μπορεί να καμφθεί τόσο +@msg give `{a}` and `{b}` δώστε `{a}` και `{b}` +@msg `t` must be from 0 to 1 Το `t` πρέπει να είναι από 0 έως 1 +@msg `segment` must be "straight" or "curved" Το `segment` πρέπει να είναι "straight" ή "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" Το `mode` πρέπει να είναι "free", "keepAngles" ή "symmetric" +@msg `{key}` must be [x, y] Το `{key}` πρέπει να είναι [x, y] diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 0fbc7da18f..1d4c1f10bc 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -5740,3 +5740,25 @@ anchor Points: Puntos: @msg select open paths to close seleccione trazados abiertos que cerrar @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) hay demasiados trazados, o están demasiado enredados, para hallar sus cruces (10000 segmentos como máximo) @msg the paths have too many anchors to edit at once los trazados tienen demasiados puntos de ancla para editarlos a la vez +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Pluma inteligente + Smart Pen Tool Herramienta Pluma inteligente + Smart Pen Panel Panel Pluma inteligente + Next Segment Segmento siguiente + Curved Curvo + Retract Handles Retraer manejadores + Close or Join Cerrar o unir + Open a document to draw with the Smart Pen. Abra un documento para dibujar con la pluma inteligente. + Straight or Curved Segment Segmento recto o curvo +@msg the path is locked or hidden el trazado está bloqueado u oculto +@msg `id` is not a path `id` no es un trazado +@msg the path has no open subpath el trazado no tiene ningún subtrazado abierto +@msg the subpath is closed el subtrazado está cerrado +@msg the subpath is closed or too short to close el subtrazado está cerrado o es demasiado corto para cerrarlo +@msg the path is too short to remove a point from el trazado es demasiado corto para quitarle un punto +@msg the segment can't be bent that far el segmento no se puede curvar tanto +@msg give `{a}` and `{b}` indique `{a}` y `{b}` +@msg `t` must be from 0 to 1 `t` debe estar entre 0 y 1 +@msg `segment` must be "straight" or "curved" `segment` debe ser "straight" o "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` debe ser "free", "keepAngles" o "symmetric" +@msg `{key}` must be [x, y] `{key}` debe ser [x, y] diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 2bd47a6ef3..4bf2f6cea3 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -5828,3 +5828,25 @@ anchor Points: Pisteet: @msg select open paths to close valitse suljettavat avoimet polut @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) liian monta tai liian sotkuista polkua niiden risteyskohtien löytämiseen (enintään 10000 osaa) @msg the paths have too many anchors to edit at once poluissa on liian monta ankkuripistettä muokattavaksi kerralla +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Älykynä + Smart Pen Tool Älykynätyökalu + Smart Pen Panel Älykynäpaneeli + Next Segment Seuraava segmentti + Curved Kaareva + Retract Handles Vedä kahvat sisään + Close or Join Sulje tai liitä + Open a document to draw with the Smart Pen. Avaa asiakirja piirtääksesi älykynällä. + Straight or Curved Segment Suora tai kaareva segmentti +@msg the path is locked or hidden polku on lukittu tai piilotettu +@msg `id` is not a path `id` ei ole polku +@msg the path has no open subpath polulla ei ole avointa alipolkua +@msg the subpath is closed alipolku on suljettu +@msg the subpath is closed or too short to close alipolku on suljettu tai liian lyhyt suljettavaksi +@msg the path is too short to remove a point from polku on liian lyhyt pisteen poistamiseen +@msg the segment can't be bent that far segmenttiä ei voi taivuttaa niin paljon +@msg give `{a}` and `{b}` anna `{a}` ja `{b}` +@msg `t` must be from 0 to 1 `t` on oltava 0–1 +@msg `segment` must be "straight" or "curved" `segment` on oltava "straight" tai "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` on oltava "free", "keepAngles" tai "symmetric" +@msg `{key}` must be [x, y] `{key}` on oltava [x, y] diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index ae3f1b86a2..eb00097f6e 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -5796,3 +5796,25 @@ anchor Points: Points : @msg select open paths to close sélectionnez des tracés ouverts à fermer @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) trop de tracés, ou trop enchevêtrés, pour trouver leurs croisements (10000 segments au plus) @msg the paths have too many anchors to edit at once les tracés ont trop de points d’ancrage pour être modifiés en une fois +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Plume intelligente + Smart Pen Tool Outil Plume intelligente + Smart Pen Panel Panneau Plume intelligente + Next Segment Segment suivant + Curved Courbe + Retract Handles Rétracter les poignées + Close or Join Fermer ou joindre + Open a document to draw with the Smart Pen. Ouvrez un document pour dessiner avec la plume intelligente. + Straight or Curved Segment Segment droit ou courbe +@msg the path is locked or hidden le tracé est verrouillé ou masqué +@msg `id` is not a path `id` n’est pas un tracé +@msg the path has no open subpath le tracé n’a aucun sous-tracé ouvert +@msg the subpath is closed le sous-tracé est fermé +@msg the subpath is closed or too short to close le sous-tracé est fermé ou trop court pour être fermé +@msg the path is too short to remove a point from le tracé est trop court pour en retirer un point +@msg the segment can't be bent that far le segment ne peut pas être courbé à ce point +@msg give `{a}` and `{b}` indiquez `{a}` et `{b}` +@msg `t` must be from 0 to 1 `t` doit être compris entre 0 et 1 +@msg `segment` must be "straight" or "curved" `segment` doit être "straight" ou "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` doit être "free", "keepAngles" ou "symmetric" +@msg `{key}` must be [x, y] `{key}` doit être [x, y] diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 55614e708c..f176caa3d5 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5784,3 +5784,25 @@ anchor Points: Pontok: @msg select open paths to close jelöljön ki lezárandó nyitott útvonalakat @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) túl sok vagy túl összegabalyodott útvonal a kereszteződések megtalálásához (legfeljebb 10000 szakasz) @msg the paths have too many anchors to edit at once az útvonalaknak túl sok horgonypontjuk van az egyszerre szerkesztéshez +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Okostoll + Smart Pen Tool Okostoll eszköz + Smart Pen Panel Okostoll panel + Next Segment Következő szakasz + Curved Ívelt + Retract Handles Fogantyúk behúzása + Close or Join Lezárás vagy összekapcsolás + Open a document to draw with the Smart Pen. Nyisson meg egy dokumentumot az okostollal való rajzoláshoz. + Straight or Curved Segment Egyenes vagy ívelt szakasz +@msg the path is locked or hidden az útvonal zárolt vagy rejtett +@msg `id` is not a path `id`: nem útvonal +@msg the path has no open subpath az útvonalnak nincs nyitott részútvonala +@msg the subpath is closed a részútvonal zárt +@msg the subpath is closed or too short to close a részútvonal zárt vagy túl rövid a lezáráshoz +@msg the path is too short to remove a point from az útvonal túl rövid egy pont eltávolításához +@msg the segment can't be bent that far a szakasz nem hajlítható ennyire +@msg give `{a}` and `{b}` adja meg: `{a}` és `{b}` +@msg `t` must be from 0 to 1 `t`: 0 és 1 között kell +@msg `segment` must be "straight" or "curved" `segment`: "straight" vagy "curved" kell +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode`: "free", "keepAngles" vagy "symmetric" kell +@msg `{key}` must be [x, y] `{key}`: [x, y] kell diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 99db664b51..f44849f6a3 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5702,3 +5702,25 @@ anchor Points: Titik: @msg select open paths to close pilih jalur terbuka untuk ditutup @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) jalur terlalu banyak atau terlalu kusut untuk menemukan persilangannya (paling banyak 10000 segmen) @msg the paths have too many anchors to edit at once jalur memiliki terlalu banyak titik jangkar untuk disunting sekaligus +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Pena pintar + Smart Pen Tool Alat pena pintar + Smart Pen Panel Panel pena pintar + Next Segment Segmen berikutnya + Curved Lengkung + Retract Handles Tarik masuk pegangan + Close or Join Tutup atau sambungkan + Open a document to draw with the Smart Pen. Buka dokumen untuk menggambar dengan pena pintar. + Straight or Curved Segment Segmen lurus atau lengkung +@msg the path is locked or hidden jalur terkunci atau tersembunyi +@msg `id` is not a path `id` bukan jalur +@msg the path has no open subpath jalur tidak punya subjalur terbuka +@msg the subpath is closed subjalur sudah tertutup +@msg the subpath is closed or too short to close subjalur sudah tertutup atau terlalu pendek untuk ditutup +@msg the path is too short to remove a point from jalur terlalu pendek untuk dihapus titiknya +@msg the segment can't be bent that far segmen tidak dapat dibengkokkan sejauh itu +@msg give `{a}` and `{b}` berikan `{a}` dan `{b}` +@msg `t` must be from 0 to 1 `t` harus antara 0 dan 1 +@msg `segment` must be "straight" or "curved" `segment` harus "straight" atau "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` harus "free", "keepAngles" atau "symmetric" +@msg `{key}` must be [x, y] `{key}` harus [x, y] diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index eb91330e10..663b1bdbcb 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -5414,3 +5414,25 @@ anchor Points: Punti: @msg select open paths to close seleziona tracciati aperti da chiudere @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) tracciati troppi o troppo intricati per trovarne gli incroci (al massimo 10000 segmenti) @msg the paths have too many anchors to edit at once i tracciati hanno troppi punti di ancoraggio da modificare in una volta +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Penna intelligente + Smart Pen Tool Strumento Penna intelligente + Smart Pen Panel Pannello Penna intelligente + Next Segment Segmento successivo + Curved Curvo + Retract Handles Ritira maniglie + Close or Join Chiudi o unisci + Open a document to draw with the Smart Pen. Apri un documento per disegnare con la penna intelligente. + Straight or Curved Segment Segmento diritto o curvo +@msg the path is locked or hidden il tracciato è bloccato o nascosto +@msg `id` is not a path `id` non è un tracciato +@msg the path has no open subpath il tracciato non ha sottotracciati aperti +@msg the subpath is closed il sottotracciato è chiuso +@msg the subpath is closed or too short to close il sottotracciato è chiuso o troppo corto per chiuderlo +@msg the path is too short to remove a point from il tracciato è troppo corto per rimuoverne un punto +@msg the segment can't be bent that far il segmento non si può curvare così tanto +@msg give `{a}` and `{b}` indica `{a}` e `{b}` +@msg `t` must be from 0 to 1 `t` deve essere compreso tra 0 e 1 +@msg `segment` must be "straight" or "curved" `segment` deve essere "straight" o "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` deve essere "free", "keepAngles" o "symmetric" +@msg `{key}` must be [x, y] `{key}` deve essere [x, y] diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index b9d63a54ab..0c645b9355 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -5483,3 +5483,25 @@ anchor Points: ポイント: @msg select open paths to close 閉じるオープンパスを選択してください @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) パスが多すぎるか複雑すぎて交差点を見つけられません(最大 10000 セグメント) @msg the paths have too many anchors to edit at once パスのアンカーポイントが多すぎて一度に編集できません +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen スマートペン + Smart Pen Tool スマートペンツール + Smart Pen Panel スマートペンパネル + Next Segment 次のセグメント + Curved 曲線 + Retract Handles ハンドルを収める + Close or Join 閉じるまたは連結 + Open a document to draw with the Smart Pen. スマートペンで描くにはドキュメントを開いてください。 + Straight or Curved Segment 直線または曲線セグメント +@msg the path is locked or hidden パスがロックされているか非表示です +@msg `id` is not a path `id` はパスではありません +@msg the path has no open subpath パスに開いたサブパスがありません +@msg the subpath is closed サブパスは閉じています +@msg the subpath is closed or too short to close サブパスが閉じているか、短すぎて閉じられません +@msg the path is too short to remove a point from パスが短すぎてポイントを削除できません +@msg the segment can't be bent that far セグメントをそこまで曲げることはできません +@msg give `{a}` and `{b}` `{a}` と `{b}` を指定してください +@msg `t` must be from 0 to 1 `t` には 0 から 1 を指定してください +@msg `segment` must be "straight" or "curved" `segment` には "straight" または "curved" を指定してください +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` には "free"、"keepAngles" または "symmetric" を指定してください +@msg `{key}` must be [x, y] `{key}` には [x, y] を指定してください diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index ebddec3e94..4558fd8976 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5787,3 +5787,25 @@ anchor Points: წერტილები: @msg select open paths to close მონიშნეთ შესაკრავი ღია ტრაექტორიები @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) ტრაექტორიები ზედმეტად ბევრი ან ჩახლართულია გადაკვეთების საპოვნელად (მაქსიმუმ 10000 სეგმენტი) @msg the paths have too many anchors to edit at once ტრაექტორიებს ზედმეტად ბევრი საყრდენი წერტილი აქვს ერთბაშად დასარედაქტირებლად +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen ჭკვიანი კალამი + Smart Pen Tool ჭკვიანი კალმის ხელსაწყო + Smart Pen Panel ჭკვიანი კალმის პანელი + Next Segment შემდეგი სეგმენტი + Curved მრუდი + Retract Handles სახელურების შეკეცვა + Close or Join შეკვრა ან შეერთება + Open a document to draw with the Smart Pen. გახსენით დოკუმენტი ჭკვიანი კალმით სახატავად. + Straight or Curved Segment სწორი ან მრუდი სეგმენტი +@msg the path is locked or hidden ტრაექტორია ჩაკეტილი ან დამალულია +@msg `id` is not a path `id` არ არის ტრაექტორია +@msg the path has no open subpath ტრაექტორიას არ აქვს ღია ქვეტრაექტორია +@msg the subpath is closed ქვეტრაექტორია შეკრულია +@msg the subpath is closed or too short to close ქვეტრაექტორია შეკრულია ან შესაკრავად ძალიან მოკლეა +@msg the path is too short to remove a point from ტრაექტორია წერტილის მოსაშორებლად ძალიან მოკლეა +@msg the segment can't be bent that far სეგმენტის ამდენად მოხრა შეუძლებელია +@msg give `{a}` and `{b}` მიუთითეთ `{a}` და `{b}` +@msg `t` must be from 0 to 1 `t` უნდა იყოს 0-დან 1-მდე +@msg `segment` must be "straight" or "curved" `segment` უნდა იყოს "straight" ან "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` უნდა იყოს "free", "keepAngles" ან "symmetric" +@msg `{key}` must be [x, y] `{key}` უნდა იყოს [x, y] diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 348baf15c9..5b40aeddf1 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5377,3 +5377,25 @@ anchor Points: 포인트: @msg select open paths to close 닫을 열린 패스를 선택하세요 @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) 패스가 너무 많거나 너무 얽혀 교차점을 찾을 수 없습니다(최대 10000개 세그먼트) @msg the paths have too many anchors to edit at once 패스의 앵커 포인트가 너무 많아 한 번에 편집할 수 없습니다 +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen 스마트 펜 + Smart Pen Tool 스마트 펜 도구 + Smart Pen Panel 스마트 펜 패널 + Next Segment 다음 세그먼트 + Curved 곡선 + Retract Handles 핸들 접기 + Close or Join 닫기 또는 결합 + Open a document to draw with the Smart Pen. 스마트 펜으로 그리려면 문서를 여세요. + Straight or Curved Segment 직선 또는 곡선 세그먼트 +@msg the path is locked or hidden 패스가 잠겨 있거나 숨겨져 있습니다 +@msg `id` is not a path `id`은(는) 패스가 아닙니다 +@msg the path has no open subpath 패스에 열린 하위 패스가 없습니다 +@msg the subpath is closed 하위 패스가 닫혀 있습니다 +@msg the subpath is closed or too short to close 하위 패스가 닫혀 있거나 너무 짧아 닫을 수 없습니다 +@msg the path is too short to remove a point from 패스가 너무 짧아 포인트를 제거할 수 없습니다 +@msg the segment can't be bent that far 세그먼트를 그만큼 구부릴 수 없습니다 +@msg give `{a}` and `{b}` `{a}`와(과) `{b}`을(를) 지정하세요 +@msg `t` must be from 0 to 1 `t`는 0에서 1 사이여야 합니다 +@msg `segment` must be "straight" or "curved" `segment`는 "straight" 또는 "curved"여야 합니다 +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode`는 "free", "keepAngles" 또는 "symmetric"이어야 합니다 +@msg `{key}` must be [x, y] `{key}`은(는) [x, y]여야 합니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 956e2edd27..b04195e782 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5746,3 +5746,25 @@ anchor Points: Punten: @msg select open paths to close selecteer open paden om te sluiten @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) te veel of te verwarde paden om hun kruisingen te vinden (hoogstens 10000 segmenten) @msg the paths have too many anchors to edit at once de paden hebben te veel ankerpunten om in één keer te bewerken +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Slimme pen + Smart Pen Tool Slimme pen-gereedschap + Smart Pen Panel Slimme pen-paneel + Next Segment Volgend segment + Curved Gebogen + Retract Handles Grepen intrekken + Close or Join Sluiten of verbinden + Open a document to draw with the Smart Pen. Open een document om met de slimme pen te tekenen. + Straight or Curved Segment Recht of gebogen segment +@msg the path is locked or hidden het pad is vergrendeld of verborgen +@msg `id` is not a path `id` is geen pad +@msg the path has no open subpath het pad heeft geen open subpad +@msg the subpath is closed het subpad is gesloten +@msg the subpath is closed or too short to close het subpad is gesloten of te kort om te sluiten +@msg the path is too short to remove a point from het pad is te kort om er een punt uit te verwijderen +@msg the segment can't be bent that far het segment kan niet zo ver worden gebogen +@msg give `{a}` and `{b}` geef `{a}` en `{b}` op +@msg `t` must be from 0 to 1 `t` moet tussen 0 en 1 liggen +@msg `segment` must be "straight" or "curved" `segment` moet "straight" of "curved" zijn +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` moet "free", "keepAngles" of "symmetric" zijn +@msg `{key}` must be [x, y] `{key}` moet [x, y] zijn diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 9292990c49..44eebf2625 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -5652,3 +5652,25 @@ anchor Points: Punkty: @msg select open paths to close zaznacz otwarte ścieżki do zamknięcia @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) za dużo ścieżek lub są zbyt splątane, by znaleźć ich skrzyżowania (najwyżej 10000 segmentów) @msg the paths have too many anchors to edit at once ścieżki mają za dużo punktów kontrolnych, by edytować je naraz +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Inteligentne pióro + Smart Pen Tool Narzędzie Inteligentne pióro + Smart Pen Panel Panel Inteligentne pióro + Next Segment Następny segment + Curved Zakrzywiony + Retract Handles Schowaj uchwyty + Close or Join Zamknij lub połącz + Open a document to draw with the Smart Pen. Otwórz dokument, aby rysować inteligentnym piórem. + Straight or Curved Segment Segment prosty lub zakrzywiony +@msg the path is locked or hidden ścieżka jest zablokowana lub ukryta +@msg `id` is not a path `id` nie jest ścieżką +@msg the path has no open subpath ścieżka nie ma otwartej ścieżki podrzędnej +@msg the subpath is closed ścieżka podrzędna jest zamknięta +@msg the subpath is closed or too short to close ścieżka podrzędna jest zamknięta lub za krótka, by ją zamknąć +@msg the path is too short to remove a point from ścieżka jest za krótka, by usunąć z niej punkt +@msg the segment can't be bent that far segmentu nie da się tak bardzo wygiąć +@msg give `{a}` and `{b}` podaj `{a}` i `{b}` +@msg `t` must be from 0 to 1 `t` musi mieć wartość od 0 do 1 +@msg `segment` must be "straight" or "curved" `segment` musi mieć wartość "straight" lub "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` musi mieć wartość "free", "keepAngles" lub "symmetric" +@msg `{key}` must be [x, y] `{key}` musi mieć postać [x, y] diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index b850a0796d..2e49999cf9 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -5715,3 +5715,25 @@ anchor Points: Pontos: @msg select open paths to close selecione caminhos abertos para fechar @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) caminhos demais, ou emaranhados demais, para encontrar seus cruzamentos (no máximo 10000 segmentos) @msg the paths have too many anchors to edit at once os caminhos têm pontos de ancoragem demais para editar de uma vez +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Caneta Inteligente + Smart Pen Tool Ferramenta Caneta Inteligente + Smart Pen Panel Painel Caneta Inteligente + Next Segment Próximo Segmento + Curved Curvo + Retract Handles Recolher Alças + Close or Join Fechar ou Unir + Open a document to draw with the Smart Pen. Abra um documento para desenhar com a caneta inteligente. + Straight or Curved Segment Segmento Reto ou Curvo +@msg the path is locked or hidden o caminho está bloqueado ou oculto +@msg `id` is not a path `id` não é um caminho +@msg the path has no open subpath o caminho não tem subcaminho aberto +@msg the subpath is closed o subcaminho está fechado +@msg the subpath is closed or too short to close o subcaminho está fechado ou é curto demais para fechar +@msg the path is too short to remove a point from o caminho é curto demais para remover um ponto +@msg the segment can't be bent that far o segmento não pode ser curvado tanto +@msg give `{a}` and `{b}` informe `{a}` e `{b}` +@msg `t` must be from 0 to 1 `t` deve estar entre 0 e 1 +@msg `segment` must be "straight" or "curved" `segment` deve ser "straight" ou "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` deve ser "free", "keepAngles" ou "symmetric" +@msg `{key}` must be [x, y] `{key}` deve ser [x, y] diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index cf222a0af9..63ed5fd139 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -5775,3 +5775,25 @@ anchor Points: Точки: @msg select open paths to close выделите незамкнутые контуры, чтобы замкнуть их @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) контуров слишком много или они слишком запутаны, чтобы найти их пересечения (не более 10000 сегментов) @msg the paths have too many anchors to edit at once у контуров слишком много опорных точек, чтобы править их за раз +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Умное перо + Smart Pen Tool Инструмент «Умное перо» + Smart Pen Panel Панель «Умное перо» + Next Segment Следующий сегмент + Curved Кривой + Retract Handles Убрать маркеры + Close or Join Замкнуть или соединить + Open a document to draw with the Smart Pen. Откройте документ, чтобы рисовать умным пером. + Straight or Curved Segment Прямой или кривой сегмент +@msg the path is locked or hidden контур заблокирован или скрыт +@msg `id` is not a path `id` не является контуром +@msg the path has no open subpath у контура нет незамкнутого вложенного контура +@msg the subpath is closed вложенный контур замкнут +@msg the subpath is closed or too short to close вложенный контур замкнут или слишком короток, чтобы его замкнуть +@msg the path is too short to remove a point from контур слишком короток, чтобы удалить из него точку +@msg the segment can't be bent that far сегмент нельзя изогнуть настолько +@msg give `{a}` and `{b}` укажите `{a}` и `{b}` +@msg `t` must be from 0 to 1 `t` должно быть от 0 до 1 +@msg `segment` must be "straight" or "curved" `segment` должно быть "straight" или "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` должно быть "free", "keepAngles" или "symmetric" +@msg `{key}` must be [x, y] `{key}` должно быть [x, y] diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 965c0f8d6f..7cf4031cc6 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5821,3 +5821,25 @@ anchor Points: Punkter: @msg select open paths to close markera öppna banor att stänga @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) för många eller för trassliga banor för att hitta deras korsningar (högst 10000 segment) @msg the paths have too many anchors to edit at once banorna har för många ankarpunkter för att redigeras på en gång +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Smart penna + Smart Pen Tool Smart penna-verktyget + Smart Pen Panel Smart penna-panelen + Next Segment Nästa segment + Curved Böjd + Retract Handles Dra in handtag + Close or Join Stäng eller foga samman + Open a document to draw with the Smart Pen. Öppna ett dokument för att rita med smart penna. + Straight or Curved Segment Rakt eller böjt segment +@msg the path is locked or hidden banan är låst eller dold +@msg `id` is not a path `id` är inte en bana +@msg the path has no open subpath banan har ingen öppen delbana +@msg the subpath is closed delbanan är stängd +@msg the subpath is closed or too short to close delbanan är stängd eller för kort för att stänga +@msg the path is too short to remove a point from banan är för kort för att ta bort en punkt +@msg the segment can't be bent that far segmentet kan inte böjas så långt +@msg give `{a}` and `{b}` ange `{a}` och `{b}` +@msg `t` must be from 0 to 1 `t` måste vara från 0 till 1 +@msg `segment` must be "straight" or "curved" `segment` måste vara "straight" eller "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` måste vara "free", "keepAngles" eller "symmetric" +@msg `{key}` must be [x, y] `{key}` måste vara [x, y] diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index ee0fcd1404..70c0dc82d0 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5755,3 +5755,25 @@ anchor Points: Noktalar: @msg select open paths to close kapatılacak açık yolları seçin @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) kesişimlerini bulmak için yollar çok fazla veya çok karışık (en fazla 10000 bölüm) @msg the paths have too many anchors to edit at once yolların aynı anda düzenlenemeyecek kadar çok bağlantı noktası var +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Akıllı Kalem + Smart Pen Tool Akıllı Kalem Aracı + Smart Pen Panel Akıllı Kalem Paneli + Next Segment Sonraki Segment + Curved Eğri + Retract Handles Kolları Geri Çek + Close or Join Kapat veya Birleştir + Open a document to draw with the Smart Pen. Akıllı kalemle çizmek için bir belge açın. + Straight or Curved Segment Düz veya Eğri Segment +@msg the path is locked or hidden yol kilitli veya gizli +@msg `id` is not a path `id` bir yol değil +@msg the path has no open subpath yolun açık alt yolu yok +@msg the subpath is closed alt yol kapalı +@msg the subpath is closed or too short to close alt yol kapalı veya kapatmak için çok kısa +@msg the path is too short to remove a point from yol, bir nokta kaldırmak için çok kısa +@msg the segment can't be bent that far segment bu kadar bükülemez +@msg give `{a}` and `{b}` `{a}` ve `{b}` değerlerini verin +@msg `t` must be from 0 to 1 `t` 0 ile 1 arasında olmalıdır +@msg `segment` must be "straight" or "curved" `segment` "straight" veya "curved" olmalıdır +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` "free", "keepAngles" veya "symmetric" olmalıdır +@msg `{key}` must be [x, y] `{key}` [x, y] olmalıdır diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index a9264ddd2e..a84207b276 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -5394,3 +5394,25 @@ anchor Points: Точки: @msg select open paths to close виділіть незамкнені контури, щоб замкнути їх @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) контурів забагато або вони надто заплутані, щоб знайти їхні перетини (не більше 10000 сегментів) @msg the paths have too many anchors to edit at once у контурів забагато опорних точок, щоб редагувати їх за раз +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Розумне перо + Smart Pen Tool Інструмент «Розумне перо» + Smart Pen Panel Панель «Розумне перо» + Next Segment Наступний сегмент + Curved Кривий + Retract Handles Прибрати маркери + Close or Join Замкнути або з’єднати + Open a document to draw with the Smart Pen. Відкрийте документ, щоб малювати розумним пером. + Straight or Curved Segment Прямий або кривий сегмент +@msg the path is locked or hidden контур заблоковано або приховано +@msg `id` is not a path `id` не є контуром +@msg the path has no open subpath контур не має незамкненого вкладеного контуру +@msg the subpath is closed вкладений контур замкнено +@msg the subpath is closed or too short to close вкладений контур замкнено або він закороткий, щоб його замкнути +@msg the path is too short to remove a point from контур закороткий, щоб видалити з нього точку +@msg the segment can't be bent that far сегмент не можна вигнути настільки +@msg give `{a}` and `{b}` укажіть `{a}` і `{b}` +@msg `t` must be from 0 to 1 `t` має бути від 0 до 1 +@msg `segment` must be "straight" or "curved" `segment` має бути "straight" або "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` має бути "free", "keepAngles" або "symmetric" +@msg `{key}` must be [x, y] `{key}` має бути [x, y] diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index d471be738b..6189e8a7aa 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5396,3 +5396,25 @@ anchor Points: Điểm: @msg select open paths to close chọn các đường dẫn mở để đóng @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) quá nhiều đường dẫn hoặc chúng quá rối để tìm chỗ giao nhau (tối đa 10000 đoạn) @msg the paths have too many anchors to edit at once các đường dẫn có quá nhiều điểm neo để sửa cùng lúc +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen Bút thông minh + Smart Pen Tool Công cụ Bút thông minh + Smart Pen Panel Bảng Bút thông minh + Next Segment Đoạn tiếp theo + Curved Cong + Retract Handles Thu tay nắm + Close or Join Đóng hoặc nối + Open a document to draw with the Smart Pen. Mở một tài liệu để vẽ bằng bút thông minh. + Straight or Curved Segment Đoạn thẳng hoặc cong +@msg the path is locked or hidden đường dẫn bị khóa hoặc bị ẩn +@msg `id` is not a path `id` không phải là đường dẫn +@msg the path has no open subpath đường dẫn không có nhánh con mở +@msg the subpath is closed nhánh con đã đóng +@msg the subpath is closed or too short to close nhánh con đã đóng hoặc quá ngắn để đóng +@msg the path is too short to remove a point from đường dẫn quá ngắn để xóa một điểm +@msg the segment can't be bent that far không thể uốn đoạn xa đến vậy +@msg give `{a}` and `{b}` hãy cho `{a}` và `{b}` +@msg `t` must be from 0 to 1 `t` phải từ 0 đến 1 +@msg `segment` must be "straight" or "curved" `segment` phải là "straight" hoặc "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` phải là "free", "keepAngles" hoặc "symmetric" +@msg `{key}` must be [x, y] `{key}` phải là [x, y] diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index dd7d0037a7..048b8bf5ec 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -5637,3 +5637,25 @@ anchor Points: 点: @msg select open paths to close 请选择要闭合的开放路径 @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) 路径太多或太复杂,无法找到交叉处(最多 10000 段) @msg the paths have too many anchors to edit at once 路径的锚点太多,无法一次编辑 +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen 智能钢笔 + Smart Pen Tool 智能钢笔工具 + Smart Pen Panel 智能钢笔面板 + Next Segment 下一线段 + Curved 曲线 + Retract Handles 收回手柄 + Close or Join 闭合或连接 + Open a document to draw with the Smart Pen. 打开文档以使用智能钢笔绘制。 + Straight or Curved Segment 直线或曲线线段 +@msg the path is locked or hidden 路径已锁定或隐藏 +@msg `id` is not a path `id` 不是路径 +@msg the path has no open subpath 路径没有开放的子路径 +@msg the subpath is closed 子路径已闭合 +@msg the subpath is closed or too short to close 子路径已闭合或太短,无法闭合 +@msg the path is too short to remove a point from 路径太短,无法删除锚点 +@msg the segment can't be bent that far 线段无法弯曲到这个程度 +@msg give `{a}` and `{b}` 请提供 `{a}` 和 `{b}` +@msg `t` must be from 0 to 1 `t` 必须在 0 到 1 之间 +@msg `segment` must be "straight" or "curved" `segment` 必须是 "straight" 或 "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` 必须是 "free"、"keepAngles" 或 "symmetric" +@msg `{key}` must be [x, y] `{key}` 必须是 [x, y] diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 0847e3b6c1..f076ef95e1 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -5433,3 +5433,25 @@ anchor Points: 點: @msg select open paths to close 請選取要封閉的開放路徑 @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) 路徑太多或太複雜,無法找到交叉處(最多 10000 段) @msg the paths have too many anchors to edit at once 路徑的錨點太多,無法一次編輯 +# Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. + Smart Pen 智慧筆型 + Smart Pen Tool 智慧筆型工具 + Smart Pen Panel 智慧筆型面板 + Next Segment 下一個線段 + Curved 曲線 + Retract Handles 收回控制把手 + Close or Join 封閉或連接 + Open a document to draw with the Smart Pen. 開啟文件以使用智慧筆型繪製。 + Straight or Curved Segment 直線或曲線線段 +@msg the path is locked or hidden 路徑已鎖定或隱藏 +@msg `id` is not a path `id` 不是路徑 +@msg the path has no open subpath 路徑沒有開放的子路徑 +@msg the subpath is closed 子路徑已封閉 +@msg the subpath is closed or too short to close 子路徑已封閉或太短,無法封閉 +@msg the path is too short to remove a point from 路徑太短,無法移除錨點 +@msg the segment can't be bent that far 線段無法彎曲到這個程度 +@msg give `{a}` and `{b}` 請提供 `{a}` 和 `{b}` +@msg `t` must be from 0 to 1 `t` 必須介於 0 到 1 +@msg `segment` must be "straight" or "curved" `segment` 必須是 "straight" 或 "curved" +@msg `mode` must be "free", "keepAngles" or "symmetric" `mode` 必須是 "free"、"keepAngles" 或 "symmetric" +@msg `{key}` must be [x, y] `{key}` 必須是 [x, y] diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 3760594c8f..513a1bcae1 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -182,6 +182,7 @@ pub fn show_icon_panel(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) { crate::addons::cleanup::ID => crate::addons::cleanup::show(app, ui), crate::addons::color::ID => crate::addons::color::show(app, ui), crate::addons::pathtools::ID => crate::addons::pathtools::show(app, ui), + crate::addons::pen::ID => crate::addons::pen::show(app, ui), id if library_panel::parse(id).is_some() => library_panel::show(app, ui, id), _ => { dim_label(ui, tl!("This panel is on the roadmap (see the parity plan).")); diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 9616f79032..76d6b3967f 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -541,6 +541,10 @@ fn busy_tool_keys(app: &mut VectorcraftApp, ctx: &egui::Context, view: ViewInfo) for d in digits { let _ = app.session.tool_key(ToolKey::Digit(d), Mods::default(), view); } + // Tab, when the tool takes it (the Smart Pen Tool placing an anchor). + if app.session.tool_claims_key(ToolKey::Tab, view) && ctx.input_mut(|i| i.consume_key(Modifiers::NONE, Key::Tab)) { + let _ = app.session.tool_key(ToolKey::Tab, Mods::default(), view); + } // The tool gets each letter it takes (E while dragging a selection marquee) once per press, // without Cmd, Ctrl or Alt. The key is the one egui reports, which on a layout without Latin // letters is the key at that position on a US layout. @@ -592,6 +596,8 @@ fn claimed_tool_keys(app: &mut VectorcraftApp, ctx: &egui::Context, view: ViewIn (Key::ArrowRight, ToolKey::Right), (Key::ArrowUp, ToolKey::Up), (Key::ArrowDown, ToolKey::Down), + // The Smart Pen Tool's Tab while it draws a path (the key otherwise hides the panels). + (Key::Tab, ToolKey::Tab), ] { if ctx.input(|i| i.key_pressed(k)) && app.session.tool_claims_key(tk, view) && ctx.input_mut(|i| i.consume_key(m, k)) { let r = app.session.tool_key(tk, crate::canvas::mods(m, false), view); diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index e41af01cd7..c3e856ba42 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -200,6 +200,7 @@ pub const ICON_PANELS: &[(&str, &str, &str)] = &[ (crate::addons::cleanup::ID, "Artwork Cleanup", "sparkles"), (crate::addons::color::ID, "Color Effects", "sun"), (crate::addons::pathtools::ID, "Anchor Inspector", "dc-anchor-smooth"), + (crate::addons::pen::ID, "Smart Pen", "spline-pointer"), ]; /// Groups of icon panels separated by dividers in the collapsed column. diff --git a/docs/mcp.md b/docs/mcp.md index a04a7abbd4..f603b63175 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5767,6 +5767,66 @@ Commands: {"name":"run_command","arguments":{"command":"addon.pathtools.erase","params":{"points":[[100,40],[100,160]],"diameter":30}}} {"name":"run_command","arguments":{"command":"addon.pathtools.crossings","params":{"cut":true}}} ``` + +## Smart Pen add-on + +Smart Pen is a built-in add-on: one tool that draws paths and edits their points, handles and segments without +switching tools. Its commands are `addon.pen.*`; in the desktop app it lives in Object › Plug-ins › Smart Pen, in its +panel (`window.panel {panel: "smartPen"}`) and in the Smart Pen Tool (`smartPen`), which the toolbars don't show until +it is added from the All Tools drawer (or chosen with `tool.select`); it has no shortcut. Each gesture and each command is +one undo step; an edit that changes nothing makes no step. The standard Pen tool is unchanged. + +The tool (`smartPen`), option `next`: `"straight"` (default) or `"curved"`, the segment a click adds: + +- Drawing: a click adds the next anchor with a straight segment into it (the previous anchor's handle on it retracted) + or a curved one (the previous anchor gets a handle if it has none: in line with its other handle, or, after a straight + segment, along it, so the curve leaves tangent). A drag makes a smooth anchor; Alt breaks the outgoing handle off, + Shift keeps it to 45° steps, Space moves the anchor. Tab switches the segment into the anchor being placed, or the + last segment drawn, between straight and curved. A rubber band shows the next segment. A press on the first anchor + closes the path; on an end of another open path it joins the two (`path.join`); with no path being drawn, a click on + an end of an open path draws on from it. Enter or Esc ends the path. +- Points of the shown (selected) paths: a click selects one (`select.anchors`; Shift adds or removes it), and on an end + of an open path draws on from there; a drag moves it (`path.moveAnchor`, Shift: 45°); Alt-drag pulls out its outgoing + handle (`path.setHandle`); Alt-click removes it keeping the shape and Shift+Alt-click deletes it with the handles + beside it left as they are (`addon.pen.removePoint`); a double-click toggles it between smooth and corner + (`addon.pen.togglePoint`). +- Handles of selected anchors drag (`path.setHandle`; Shift: 45°, Alt: the handle keeps its angle); a double-click on + one toggles its anchor. +- Segments drag to reshape (`addon.pen.reshape`; Shift: `symmetric`, Alt: `keepAngles`); Alt-click adds an anchor + (`path.insertAnchor`); a click on a path that isn't selected selects it. + +Commands: + +- `addon.pen.append {id, subpath?, x, y, in?, out?, segment?}` adds an anchor at the end of an open subpath (by default + the last open one) and selects it. `segment`: `"straight"` (the previous anchor's handle on the new segment and the + new anchor's incoming handle retracted) or `"curved"` (the previous anchor gets a handle on it as a click does); + without it the anchor takes the handles given and the previous anchor stays as it is. +- `addon.pen.close {id, subpath?, segment?}` closes an open subpath of two anchors or more, the closing segment + straight, curved or (without `segment`) with the handles its ends have. +- `addon.pen.segment {id, subpath?, segment, curved}` makes one segment straight or curved → `{changed}`. +- `addon.pen.removePoint {id, subpath?, anchor, plain?}` removes one anchor: the handles beside it are refitted so the + outline keeps its shape (an open end takes its segment with it), or with `plain` left as they are. A subpath keeps two + anchors (three when closed). +- `addon.pen.togglePoint {id, subpath?, anchor, ratio?}`: a smooth anchor becomes a corner with its handles where they + are; any other is made smooth by the auto-smooth rule (`ratio` 0.1 to 0.5, 0.3905) → `{smooth}`. +- `addon.pen.reshape {id, subpath?, segment, t?, dx, dy, mode?}` bends a segment so its point at `t` (0 to 1, held to + 0.05…0.95) moves by `(dx, dy)`: `free` (default; both handles move, the one nearer the grab more), `keepAngles` (each + handle only changes length; a segment whose two directions are parallel bends freely) or `symmetric` (both handles + at right angles to the chord at one length). Missing handles grow out of their anchors; a smooth anchor stays smooth. +- `addon.pen.nextSegment {curved}` sets the tool's `next` option → `{next}`. +- `addon.pen.closeJoin {}`: with exactly two open path ends direct-selected, joins them (as `path.join`); otherwise + closes the selected open paths keeping their ends' handles (as `addon.pathtools.close`). + +The panel sets the next segment and runs Remove Points Keep Shape (`addon.pathtools.removeKeepShape`), Make Smooth +(`addon.pathtools.smooth`), Make Corner (`addon.pathtools.corner {retract: false}`: nothing moves), Retract Handles +(`addon.pathtools.corner {retract: true}`) and Close or Join (`addon.pen.closeJoin`). + +```json +{"name":"run_command","arguments":{"command":"addon.pen.nextSegment","params":{"curved":true}}} +{"name":"run_command","arguments":{"command":"addon.pen.append","params":{"id":12,"x":200,"y":150,"segment":"curved"}}} +{"name":"run_command","arguments":{"command":"addon.pen.reshape","params":{"id":12,"segment":0,"t":0.3,"dx":0,"dy":-25}}} +``` + ## Color Effects add-on Color Effects is a built-in add-on: its effects are colour adjustments in Effect › Color Effects, its command is `addon.color.filter`, and in the desktop app it also lives in Object › Plug-ins › Color Effects and in its panel diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index a42e2b21c5..1f50e3735e 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Path Precision Tools, a built-in add-on beyond Illustrator; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Smart Pen, a built-in add-on beyond Illustrator; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -1229,6 +1229,21 @@ Kernels in `vectorcraft_pathops::addons::pathtools`. Tests: `addons::pathtools` undo step, bad params refused, the brush's stroke one step) and `edit_toolbar::tests::addon_tools_are_in_the_drawer_not_the_toolbars`. Commands: `docs/mcp.md` › Path Precision Tools add-on. +## Smart Pen add-on (2026-10-30) + +A VectorCraft addition, not an Illustrator feature, so no area score moves. Object › Plug-ins › Smart Pen selects the +Smart Pen Tool (kept out of the shipped toolbars, listed in the All Tools drawer, no shortcut) and opens its panel. The +tool draws with a straight or curved next segment (a curve after a straight segment leaves it tangent), smooth drags +with Alt, Shift and Space, Tab to switch a segment, a rubber band, closing, joining and continuing open ends; and edits +without switching tools: point select, move, Alt-click remove keeping shape, Shift+Alt-click plain delete, double-click +smooth/corner, handle drags (Shift 45°, Alt keeps the angle), segment drags (free, keep angles, symmetric) and Alt-click +insert. The panel sets the next segment and runs Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles and +Close or Join. Kernels: `vectorcraft_pathops::addons::pen` and the shared `addons::segment_reshape`. Tests: +`addons::pen` and `addons::segment_reshape` in `vectorcraft-pathops`, `addons::smart_pen` in `vectorcraft-tools`, +`cmd::addons::pen::tests` in `vectorcraft-engine` (each command one undo step, bad params refused, the tool's gestures +through the session) and `addons::pen::tests` in `vectorcraft-ui-egui` (the submenu, the panel). Commands: `docs/mcp.md` +› Smart Pen add-on. + ## Color Effects add-on (2026-10-30) A VectorCraft addition, not an Illustrator feature, so no area score moves. Effect › Color Effects adds live Exposure (stops of linear light, offset and gamma), Desaturate and Invert Colors as colour adjustments evaluated with those of @@ -1242,6 +1257,7 @@ undo step, with any adjustment and its params; bad requests refused) and `addons | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Smart Pen add-on (a VectorCraft addition): evidence added; scores unchanged. | | 2026-10-30 | minor | Path Precision Tools add-on (a VectorCraft addition): evidence added; scores unchanged. | | 2026-10-30 | minor | Color Effects, a built-in add-on beyond Illustrator; scores and estimates unchanged | | 2026-10-30 | minor | Artwork Cleanup add-on (a VectorCraft addition): evidence added; scores unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 103cf2c488..05876d8039 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Path Precision Tools add-on: its tools, Anchor Inspector panel and Object › Plug-ins submenu; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Smart Pen add-on: its tool, panel and Object › Plug-ins submenu; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -321,6 +321,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Preferences › General › Constrain Angle | done | arrow keys and Shift drags along the turned axes; the Rectangle, Rounded Rectangle, Ellipse and grid tools, point and area type and the shape size dialogs draw along them with the bounding box turned; Shift-drawn polygons and stars keep the turned base orientation; the Line Segment tool's Shift steps count from it (#394, ); arcs, spirals, flares and Pen paths are not turned | | Tabs panel: a stop drags from where the press landed, a stop just added included | done | #1458 | | Outline view keeps template layers in Preview, dimmed | done | #1486; a picture placed to be traced stays visible under the outlines | +| Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point) | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not an Illustrator feature, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not an Illustrator feature, so it is not scored | | Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not an Illustrator feature, 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 | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not an Illustrator feature, so it is not scored | @@ -364,6 +365,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Smart Pen add-on (a VectorCraft addition): its tool, panel and Object › Plug-ins › Smart Pen; scores and estimates unchanged | | 2026-10-30 | minor | Path Precision Tools add-on (a VectorCraft addition): its tools, Anchor Inspector panel and Object › Plug-ins › Path Precision Tools; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: its effects, panel and Object › Plug-ins submenu; scores and estimates unchanged | | 2026-10-30 | minor | Artwork Cleanup add-on (a VectorCraft addition): its panel and Object › Plug-ins › Artwork Cleanup; scores and estimates unchanged | From 354b0a48f24fefc5b7f686fbe902f38be5c51589 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 16:01:36 +0700 Subject: [PATCH 002/227] Docs: restore the Color Effects add-on section's spacing and code block --- docs/mcp.md | 8 ++++++++ docs/target-app-parity.md | 1 + 2 files changed, 9 insertions(+) diff --git a/docs/mcp.md b/docs/mcp.md index f603b63175..fec39869a9 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5828,21 +5828,29 @@ The panel sets the next segment and runs Remove Points Keep Shape (`addon.pathto ``` ## Color Effects add-on + Color Effects is a built-in add-on: its effects are colour adjustments in Effect › Color Effects, its command is `addon.color.filter`, and in the desktop app it also lives in Object › Plug-ins › Color Effects and in its panel (`window.panel {panel: "colorEffects"}`). + Its live effects go on through `effect.apply` like any other and recolour what the object paints, in stack order with the other colour adjustments (Effect › Color Adjustments); each colour keeps its colour model: + | Effect | Parameters | Does | |---|---|---| | `addon.color.exposure` (Exposure…) | `exposure` stops −20…20 (0), `offset` −0.5…0.5 (0), `gamma` 0.1…10 (1) | Scales the light in linear light (each stop doubles or halves it, mostly in the highlights), adds the offset (shadows and midtones) and applies the gamma | | `addon.color.desaturate` (Desaturate) | none | Turns every colour to the grey of its lightness | | `addon.color.invert` (Invert Colors) | none | Turns every colour to its RGB inverse | + `addon.color.filter {effect, params?, fill?, stroke?, includeImages?, includePatterns?, ids?}` applies any colour adjustment, the add-on's or one of Effect › Color Adjustments', to the colours themselves instead of as a live effect: fills, strokes, type, gradient meshes, embedded images and pattern tiles, as `edit.colors.invert` reaches them, as one undo step. Missing `params` take the effect's dialog defaults; the objects' own effects stay as they are. + +```json {"name":"run_command","arguments":{"command":"effect.apply","params":{"effect":"addon.color.exposure","params":{"exposure":1.5}}}} {"name":"run_command","arguments":{"command":"addon.color.filter","params":{"effect":"adjust.hueSaturation","params":{"hue":120}}}} +``` + The panel picks an adjustment (Brightness/Contrast, Hue/Saturation, Levels, Temperature/Tint, Exposure, Desaturate or Invert Colors), sets its values, and then Add as Effect (`effect.apply`) or Apply as Filter (`addon.color.filter`). diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 1f50e3735e..2ee6feda96 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1245,6 +1245,7 @@ through the session) and `addons::pen::tests` in `vectorcraft-ui-egui` (the subm › Smart Pen add-on. ## Color Effects add-on (2026-10-30) + A VectorCraft addition, not an Illustrator feature, so no area score moves. Effect › Color Effects adds live Exposure (stops of linear light, offset and gamma), Desaturate and Invert Colors as colour adjustments evaluated with those of Effect › Color Adjustments (`vectorcraft_effects::addons::color`), and `addon.color.filter` applies any colour adjustment From c9504597ea8adbc97b331aec2e1eaffe187b6a5f Mon Sep 17 00:00:00 2001 From: jayzed80 Date: Fri, 30 Oct 2026 02:49:03 +0000 Subject: [PATCH 003/227] pathops: a huge stroke width with round joins no longer panics Outline Stroke normalize_bez ran the sweep without the catch_unwind guard that Sweep::new has, so an outline_stroke width of 1e200 or more with a round join panicked inside linesweeper (Left == Ish). The panic is now a Degenerate error and the art is left unchanged. Adds hostile-number tests for the pathops edit, stroke and offset functions. --- crates/pathops/src/boolean.rs | 6 ++- crates/pathops/tests/it/hostile_params.rs | 49 +++++++++++++++++++++++ crates/pathops/tests/it/main.rs | 1 + 3 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 crates/pathops/tests/it/hostile_params.rs diff --git a/crates/pathops/src/boolean.rs b/crates/pathops/src/boolean.rs index dc3a5cf471..2e7b1b793f 100644 --- a/crates/pathops/src/boolean.rs +++ b/crates/pathops/src/boolean.rs @@ -656,8 +656,10 @@ pub(crate) fn normalize_bez(bp: &BezPath, rule: FillRule) -> Result::from_path(&bp, eps).map_err(|_| PathOpsError::OpenPath)?; - Ok(top.contours(|w| inside(rule, *w))) + // As in `Sweep::new`, a panic in the sweep on near-degenerate input becomes an error. + let swept = + std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| Topology::::from_path(&bp, eps).map(|top| top.contours(|w| inside(rule, *w))))); + swept.map_err(|_| PathOpsError::Degenerate)?.map_err(|_| PathOpsError::OpenPath) } /// Boolean operation between two filled paths. Returns an empty path on invalid (non-finite) input. diff --git a/crates/pathops/tests/it/hostile_params.rs b/crates/pathops/tests/it/hostile_params.rs new file mode 100644 index 0000000000..108fe2b48b --- /dev/null +++ b/crates/pathops/tests/it/hostile_params.rs @@ -0,0 +1,49 @@ +//! Absurd but finite or non-finite numeric parameters: no panic, hang or runaway allocation. + +use vectorcraft_geom::{PathData, Point, SubPath}; +use vectorcraft_pathops::*; + +const HOSTILE: [f64; 9] = [f64::NAN, f64::INFINITY, f64::NEG_INFINITY, 0.0, -0.0, 1e-300, 1e300, -1e300, f64::MAX]; + +fn square() -> PathData { + PathData::single(SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(10.0, 0.0), Point::new(10.0, 10.0), Point::new(0.0, 10.0)], true)) +} + +fn zigzag() -> PathData { + let pts: Vec = (0..40).map(|i| Point::new(i as f64 * 3.0, if i % 2 == 0 { 0.0 } else { 7.0 })).collect(); + PathData::single(SubPath::polyline(&pts, false)) +} + +#[test] +fn edit_functions_survive_hostile_numbers() { + for paths in [square(), zigzag()] { + for &v in &HOSTILE { + let _ = simplify(&paths, v); + let _ = simplify_with(&paths, &SimplifyOptions { tolerance: v, corner_angle_deg: v, straight_lines: false }); + let _ = simplify_with(&paths, &SimplifyOptions { tolerance: 0.5, corner_angle_deg: v, straight_lines: true }); + let _ = smooth(&paths, v); + let _ = smooth_level(&paths, v); + let _ = remove_redundant_points(&paths, v); + let _ = join(&[paths.clone(), zigzag()], v); + let _ = simplify_level_tolerance(v); + let _ = auto_simplify_level(v); + } + } +} + +/// A stroke width of 1e200 or more with round joins used to panic inside the sweep (`Left == Ish`). +#[test] +fn stroke_and_offset_survive_hostile_numbers() { + for paths in [square(), zigzag()] { + for &w in &HOSTILE { + for &m in &[f64::NAN, 0.0, 1.0, 1e300] { + for join in [Join::Miter, Join::Round, Join::Bevel] { + for cap in [Cap::Butt, Cap::Round] { + let _ = outline_stroke(&paths, w, cap, join, m); + } + let _ = offset_path(&paths, w, join, m); + } + } + } + } +} diff --git a/crates/pathops/tests/it/main.rs b/crates/pathops/tests/it/main.rs index 3f565e040d..552620c0c0 100644 --- a/crates/pathops/tests/it/main.rs +++ b/crates/pathops/tests/it/main.rs @@ -5,6 +5,7 @@ #[path = "../common/mod.rs"] mod common; +mod hostile_params; mod ops; mod pathfinder_pinned; mod prop_pathops; From 418f1bffc33a9eb23221bf119c6cadef24059505 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:06:54 +0430 Subject: [PATCH 004/227] Fix #4638: clamp bounded effect length inputs on commit and reject invalid input visibly In effect dialogs (like Color Halftone), length fields with defined bounds (e.g. Max Radius 4..127 pt) were previously checked only after num_field returned, leaving the field's temporary buffer holding the un-clamped string (e.g. '0.5 px'). Subsequently entering invalid text caused the field to fall back to that sub-minimum buffer. - Added num_field_within to pass effect parameter bounds directly to unit_field. - When committed, clamp the parsed value within bounds and update the field buffer to the formatted clamped value so the UI reflects what is applied. - When invalid text is committed, clear the invalid buffer and trigger a one-frame border highlight so invalid input is rejected visibly. --- crates/ui-egui/src/dialogs/form.rs | 4 ++-- crates/ui-egui/src/dialogs/tests.rs | 27 +++++++++++++++++++++++ crates/ui-egui/src/widgets.rs | 8 +++---- crates/ui-egui/src/widgets/numeric.rs | 31 ++++++++++++++++++++++++--- crates/ui-egui/src/widgets/text.rs | 10 ++++++++- docs/effects-parity.md | 3 ++- docs/target-app-parity.md | 3 ++- 7 files changed, 74 insertions(+), 12 deletions(-) diff --git a/crates/ui-egui/src/dialogs/form.rs b/crates/ui-egui/src/dialogs/form.rs index 941687ae48..ce456fb26d 100644 --- a/crates/ui-egui/src/dialogs/form.rs +++ b/crates/ui-egui/src/dialogs/form.rs @@ -58,8 +58,8 @@ pub(super) fn length_within( range: Option>, ) -> bool { let value = d.fields.contains_key(key).then(|| d.f64(key, 0.0)); - let Some(v) = crate::widgets::num_field(ui, ("dlg-len", key), value, unit, width) else { return false }; - let v = range.map_or(v, |r| v.max(*r.start()).min(*r.end())); + let bounds = range.unwrap_or(crate::widgets::ANY); + let Some(v) = crate::widgets::num_field_within(ui, ("dlg-len", key), value, unit, width, bounds) else { return false }; d.fields.insert(key.into(), json!(v)); true } diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index ae9fb664f0..3525d4d9af 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -2513,3 +2513,30 @@ fn an_effect_dialog_keeps_a_typed_distance_within_the_effects_range() { assert_eq!(node.appearance.effects.last().map(|e| e.params["maxRadius"].clone()), Some(json!(applied)), "{typed}"); } } + +/// #4638: typing invalid input in an effect length field does not silently revert to a sub-minimum +/// or out-of-range value; sub-minimum input is clamped immediately and invalid input clears cleanly. +#[test] +fn color_halftone_invalid_input_does_not_revert_to_sub_minimum_value() { + let mut app = app(); + let _id = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); + let ctx = egui::Context::default(); + theme::install_fonts(&ctx); + theme::apply(&ctx, Default::default()); + let frame = |app: &mut VectorcraftApp, events: Vec| { + let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui.ctx())); + out.textures_delta.clear(); + }; + app.run("select.all", json!({})).unwrap(); + app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); + frame(&mut app, vec![]); + // 1. Enter 0.5 px (sub-minimum): clamped immediately to 4 pt + frame(&mut app, vec![egui::Event::Text("0.5 px".into())]); + frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); + // 2. Type invalid input "1jgghgh" + frame(&mut app, vec![egui::Event::Text("1jgghgh".into())]); + frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); + // The value remains the valid clamped minimum 4.0 pt, never 0.5 px + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); +} diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index e4032b53d4..a57f390e48 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -47,14 +47,14 @@ pub use dropdowns::{ }; pub use labels::{dim_label, dim_name, divider, field_label, label_row, link_label, section_header, section_toggle, section_toggle_name, subheader}; pub(crate) use labels::{label_field, take_previous_label}; +pub(crate) use numeric::{ANY, round_to, set_bare_numbers_are_points, typed_unit}; pub use numeric::{ - SpinPick, mixed_field, mixed_field_named, num_field, num_field_named, opt_field, opt_field_named, range_field, range_field_named, - range_field_stepped, size_field, size_field_named, slider, spin_field, spin_field_auto, spin_field_auto_named, spin_field_named, - spin_field_stops_named, spin_plain, spin_plain_named, + SpinPick, mixed_field, mixed_field_named, num_field, num_field_named, num_field_within, opt_field, opt_field_named, range_field, + range_field_named, range_field_stepped, size_field, size_field_named, slider, spin_field, spin_field_auto, spin_field_auto_named, + spin_field_named, spin_field_stops_named, spin_plain, spin_plain_named, }; #[cfg(test)] use numeric::{decimal_point, share_of, spinner_step, step_through, step_to_multiple, within_a_millionth}; -pub(crate) use numeric::{round_to, set_bare_numbers_are_points, typed_unit}; pub use panel_chrome::{bottom_bar, layout_button, list_box, orientation_button, tab_bar}; pub(crate) use text::{ arm_field_focus, dialog_focus_flag, disarm_field_focus, enter_modifiers, focus_field, own_field_shift_enter, set_dialog_open, take_dialog_focus, diff --git a/crates/ui-egui/src/widgets/numeric.rs b/crates/ui-egui/src/widgets/numeric.rs index e815d75fea..1cae6af938 100644 --- a/crates/ui-egui/src/widgets/numeric.rs +++ b/crates/ui-egui/src/widgets/numeric.rs @@ -49,6 +49,19 @@ pub fn num_field(ui: &mut Ui, id: impl std::hash::Hash, value: Option, unit num_field_named(ui, id, None, value, unit, width) } +/// [`num_field`] whose value is clamped to `bounds` (points). +pub fn num_field_within( + ui: &mut Ui, + id: impl std::hash::Hash, + value: Option, + unit: Unit, + width: f32, + bounds: RangeInclusive, +) -> Option { + let label = take_previous_label(ui); + unit_field(ui, id, label, None, value, unit, width, false, bounds, &[]) +} + /// [`num_field`] for a row whose visible label is not an adjacent label widget (a grid cell with /// its label painted separately): screen readers name the field `name` (already translated). pub fn num_field_named(ui: &mut Ui, id: impl std::hash::Hash, name: Option<&str>, value: Option, unit: Unit, width: f32) -> Option { @@ -57,7 +70,7 @@ pub fn num_field_named(ui: &mut Ui, id: impl std::hash::Hash, name: Option<&str> } /// Any number: the bounds of a field that has none. -const ANY: RangeInclusive = f64::NEG_INFINITY..=f64::INFINITY; +pub(crate) const ANY: RangeInclusive = f64::NEG_INFINITY..=f64::INFINITY; /// `v` within `bounds` (bounds the wrong way round or not numbers don't panic, as `f64::clamp` would). fn within(v: f64, bounds: &RangeInclusive) -> f64 { @@ -94,10 +107,22 @@ fn unit_field( let stepped = step_value(ui, &resp, &mut buf, &bounds, (|b: &str| Some(unit.from_pt(read(b)?)), |v| unit.format(unit.to_pt(v))), None, &stops); let scrubbed = scrub::field(ui, id, rect, &buf, value.map(|v| unit.from_pt(v)), STEP_DECIMALS, &bounds); let commit = commit && buf != shown; - ui.data_mut(|d| d.insert_temp(id, buf.clone())); if commit { - read(&buf).or_else(|| if share_of_value { share_of(&decimal_point(&buf), value?) } else { None }) + match read(&buf).or_else(|| if share_of_value { share_of(&decimal_point(&buf), value?) } else { None }) { + Some(v) => { + let clamped = within(v, &bounds); + let formatted = unit.format(clamped); + ui.data_mut(|d| d.insert_temp(id, formatted)); + Some(clamped) + } + None => { + ui.data_mut(|d| d.remove::(id)); + ui.data_mut(|d| d.insert_temp(id.with("invalid-flash"), true)); + None + } + } } else { + ui.data_mut(|d| d.insert_temp(id, buf.clone())); stepped.or(scrubbed).map(|v| unit.to_pt(v)) } } diff --git a/crates/ui-egui/src/widgets/text.rs b/crates/ui-egui/src/widgets/text.rs index ccde3ba382..0517eba55c 100644 --- a/crates/ui-egui/src/widgets/text.rs +++ b/crates/ui-egui/src/widgets/text.rs @@ -237,7 +237,15 @@ pub(super) fn recessed_text( .allocate_ui_with_layout(vec2(width, height), layout, |ui| { ui.set_min_size(vec2(width, height)); let rect = ui.max_rect(); - ui.painter().rect(rect, 5.0, t.input, Stroke::new(1.0, if editing { t.accent } else { t.input_border }), StrokeKind::Inside); + let invalid = ui.data_mut(|d| d.remove_temp::(id.with("invalid-flash"))).unwrap_or(false); + let stroke = if invalid { + Stroke::new(1.5, t.accent_strong) + } else if editing { + Stroke::new(1.0, t.accent) + } else { + Stroke::new(1.0, t.input_border) + }; + ui.painter().rect(rect, 5.0, t.input, stroke, StrokeKind::Inside); let margin = egui::Margin { left: 7, right: 7, top: if rows > 1 { 4 } else { 0 }, bottom: 0 }; let resp = egui::Frame::NONE .inner_margin(margin) diff --git a/docs/effects-parity.md b/docs/effects-parity.md index 3120965872..0c0bc052d2 100644 --- a/docs/effects-parity.md +++ b/docs/effects-parity.md @@ -1,6 +1,6 @@ # Effects parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-28 · **Change:** minor (Drop Shadow Darkness uses fixed RGB subtraction and CMYK black addition; scores unchanged; Pathfinder › Trap: the Pathfinder panel's Trap… and Effect › Pathfinder › Trap… add an overprinting strip of the lighter colour where two solid colours meet; recounted with Hard Mix (#3061) and Soft Mix already in the catalogue: Pathfinder 13/13, Illustrator effects 49/50) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-28 · **Change:** minor (Effect dialogs clamp bounded length inputs immediately on commit and flash rejection on invalid input (#4638); previously: Drop Shadow Darkness uses fixed RGB subtraction and CMYK black addition; scores unchanged; Pathfinder › Trap: the Pathfinder panel's Trap… and Effect › Pathfinder › Trap… add an overprinting strip of the lighter colour where two solid colours meet; recounted with Hard Mix (#3061) and Soft Mix already in the catalogue: Pathfinder 13/13, Illustrator effects 49/50) · **Target:** Adobe Illustrator 2026 (30.x) Every entry of Illustrator's Effect menu, by its public feature name, against VectorCraft's effects catalogue (`effect_catalog()` in `crates/effects/src/lib.rs`) and the Effect menu built from it @@ -193,6 +193,7 @@ angular cut caps, exact visibility, 3D Classic, Turntable, 3D export) is 25–45 | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Effect dialogs: bounded length fields (Color Halftone Max Radius) clamp on commit and visibly reject invalid input (#4638); scores unchanged. | | 2026-10-23 | minor | Pathfinder › Trap ([trapping](https://helpx.adobe.com/illustrator/using/trapping.html)): the Pathfinder panel's Trap… (`object.pathfinder.trap`, one undo step, the traps grouped above the topmost selected object and selected) and Effect › Pathfinder › Trap… (`pathfinder.trap`, live on groups) add an overprinting strip of the lighter colour inside the darker one where two solid colours meet (Reverse Traps: the darker into the lighter, but not a rich black), with Thickness, Height/Width, Tint Reduction and Traps with Process Color; the effect also has Precision and Remove Redundant Points. Recounted: Hard Mix (#3061) and Soft Mix had shipped, so Pathfinder 11/13 → 13/13 and Illustrator effects 46/50 → 49/50 (SVG Filters remains); remaining 6–10 → 4–8 h. Tests: `vectorcraft_pathops` `trap::tests`, `vectorcraft_effects` `trap::tests` and `group::tests::trap_effect_adds_an_overprinting_strip_above_the_members`, `vectorcraft_engine` `tests_trap`, `panels::pathfinder::tests::trap_opens_its_options_and_ok_traps_the_selection`. | | 2026-10-22 | minor | The Transform effect has Transform Objects, Transform Patterns and Scale Strokes & Effects, with visible checkboxes (#885); on a fill's or stroke's own Transform effect the last two are still missing. Counts unchanged. | | 2026-10-22 | minor | G2: the Effect Gallery shipped (#2883): Effect › Effect Gallery… browses the Artistic, Brush Strokes, Distort, Sketch, Stylize and Texture filters, edits each filter's settings, builds an ordered stack (add, reorder, hide, remove) with a live canvas preview, and OK applies it as separate appearance effects in one undo step; remaining: filter thumbnails and a preview area inside the dialog; G2 estimate 4–6 → 1–2 h; Raster effects 82% → 85% (power-user view 49% → 52%), estimated, a modest move because the named missing dialog landed without thumbnails or an in-dialog preview. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 2ee6feda96..3abc4bffc9 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Smart Pen, a built-in add-on beyond Illustrator; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Effects: bounded effect length inputs clamp on commit and reject invalid text visibly (#4638)) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -19,6 +19,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Effects: bounded length inputs clamp on commit and reject invalid text visibly (#4638); scores unchanged. | | 2026-10-29 | minor | File formats: attached Affinity Recolor Adjustment (RcRA) layers import as color overlays (#4420); scores unchanged. | | 2026-10-29 | minor | Type core: copied text runs retain character attributes across document switches and canvas pastes (#4459); scores unchanged. | | 2026-10-29 | minor | Type core: soft return (Shift+Enter forced line break, U+2028) breaks lines without starting new paragraphs (#2754); scores unchanged. | From 5da8c8e495493eaa23d31fcbc91e1bd331d34edd Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:28:16 +0430 Subject: [PATCH 005/227] Numeric: clamp committed values in point units, schedule rejection highlight repaint, and update roadmap/area evidence --- crates/ui-egui/src/dialogs/tests.rs | 29 +++++++++++++++++++++++++-- crates/ui-egui/src/widgets.rs | 2 +- crates/ui-egui/src/widgets/numeric.rs | 10 +++++---- crates/ui-egui/src/widgets/text.rs | 6 +++++- docs/roadmap.md | 1 + docs/target-app-parity.md | 1 + 6 files changed, 41 insertions(+), 8 deletions(-) diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index 3525d4d9af..6add459f47 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -2534,9 +2534,34 @@ fn color_halftone_invalid_input_does_not_revert_to_sub_minimum_value() { frame(&mut app, vec![egui::Event::Text("0.5 px".into())]); frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); - // 2. Type invalid input "1jgghgh" + // 2. Refocus Max Radius before typing invalid text + crate::widgets::arm_field_focus(&ctx, ("dlg-len", "maxRadius")); + frame(&mut app, vec![]); frame(&mut app, vec![egui::Event::Text("1jgghgh".into())]); frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); - // The value remains the valid clamped minimum 4.0 pt, never 0.5 px + // The value remains the valid clamped minimum 4.0 pt, never 0.5 px, and rejection flash is set assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); + assert!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"] == serde_json::json!(4.0)); +} + +#[test] +fn bounded_field_with_inches_does_not_clamp_point_bounds_to_inch_numbers() { + let mut app = app(); + let _id = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); + // Switch document units to Inches + app.run("document.setup", json!({"units": "Inches"})).unwrap(); + let ctx = egui::Context::default(); + theme::install_fonts(&ctx); + theme::apply(&ctx, Default::default()); + let frame = |app: &mut VectorcraftApp, events: Vec| { + let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui.ctx())); + out.textures_delta.clear(); + }; + app.run("select.all", json!({})).unwrap(); + app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); + frame(&mut app, vec![]); + // Type 1 in: 72 pt is within 4..127 pt range and must not clamp to ~1.76 pt + frame(&mut app, vec![egui::Event::Text("1 in".into())]); + frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(72.0)); } diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index a57f390e48..8590a26676 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -87,7 +87,7 @@ impl std::fmt::Debug for HashOnly { } /// `parent.with(salt)` for a salt that needs only `Hash`. -fn id_with(parent: egui::Id, salt: impl std::hash::Hash) -> egui::Id { +pub(crate) fn id_with(parent: egui::Id, salt: impl std::hash::Hash) -> egui::Id { parent.with(HashOnly(salt)) } diff --git a/crates/ui-egui/src/widgets/numeric.rs b/crates/ui-egui/src/widgets/numeric.rs index 1cae6af938..184112790e 100644 --- a/crates/ui-egui/src/widgets/numeric.rs +++ b/crates/ui-egui/src/widgets/numeric.rs @@ -102,10 +102,11 @@ fn unit_field( // ↑/↓ and the wheel step in the field's unit; a drag on its label scrubs it. let typed = typed_unit(ui.ctx(), unit); let read = |b: &str| typed.parse(&decimal_point(b)); - let bounds = unit.from_pt(*bounds.start())..=unit.from_pt(*bounds.end()); + let bounds_unit = unit.from_pt(*bounds.start())..=unit.from_pt(*bounds.end()); let stops: Vec = stops.iter().map(|&s| unit.from_pt(s)).collect(); - let stepped = step_value(ui, &resp, &mut buf, &bounds, (|b: &str| Some(unit.from_pt(read(b)?)), |v| unit.format(unit.to_pt(v))), None, &stops); - let scrubbed = scrub::field(ui, id, rect, &buf, value.map(|v| unit.from_pt(v)), STEP_DECIMALS, &bounds); + let stepped = + step_value(ui, &resp, &mut buf, &bounds_unit, (|b: &str| Some(unit.from_pt(read(b)?)), |v| unit.format(unit.to_pt(v))), None, &stops); + let scrubbed = scrub::field(ui, id, rect, &buf, value.map(|v| unit.from_pt(v)), STEP_DECIMALS, &bounds_unit); let commit = commit && buf != shown; if commit { match read(&buf).or_else(|| if share_of_value { share_of(&decimal_point(&buf), value?) } else { None }) { @@ -117,7 +118,8 @@ fn unit_field( } None => { ui.data_mut(|d| d.remove::(id)); - ui.data_mut(|d| d.insert_temp(id.with("invalid-flash"), true)); + ui.data_mut(|d| d.insert_temp(id.with("invalid-flash"), ui.input(|i| i.time + 0.25))); + ui.ctx().request_repaint(); None } } diff --git a/crates/ui-egui/src/widgets/text.rs b/crates/ui-egui/src/widgets/text.rs index 0517eba55c..e688c0c2e6 100644 --- a/crates/ui-egui/src/widgets/text.rs +++ b/crates/ui-egui/src/widgets/text.rs @@ -237,7 +237,11 @@ pub(super) fn recessed_text( .allocate_ui_with_layout(vec2(width, height), layout, |ui| { ui.set_min_size(vec2(width, height)); let rect = ui.max_rect(); - let invalid = ui.data_mut(|d| d.remove_temp::(id.with("invalid-flash"))).unwrap_or(false); + let now = ui.input(|i| i.time); + let invalid = ui.data(|d| d.get_temp::(id.with("invalid-flash"))).is_some_and(|end| now <= end); + if invalid { + ui.ctx().request_repaint(); + } let stroke = if invalid { Stroke::new(1.5, t.accent_strong) } else if editing { diff --git a/docs/roadmap.md b/docs/roadmap.md index 6bd431b95b..3febbc75cb 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -19,6 +19,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Raster effects: bounded length fields in effect dialogs clamp on commit and reject invalid inputs visibly (#4638); estimates unchanged. | | 2026-10-22 | minor | Reconcile upstream documentation after review F-3; preserve every dated revision and the original scaleArt runtime evidence without repeating completed jobs. | | 2026-10-22 | minor | Reconcile upstream documentation after review F-2; preserve every dated revision and the original scaleArt runtime evidence without repeating completed jobs. | | 2026-10-22 | minor | Reconcile subsequent upstream progress updates without changing the runtime or repeating completed evidence; retain every dated upstream and feature revision. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 3abc4bffc9..43dc705965 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1129,6 +1129,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Glass's Load Texture:** Effect › Distort › Glass… has a Load Texture… button that reads a PNG, JPEG, GIF, WebP, TIFF, BMP, Targa, PSD, PSB or PCX file and adds Loaded Texture to the Texture menu (`textureImage`: `{path}` or `{name?, dataBase64}`, stored in the effect and saved with the document as a grayscale PNG in base64). The texture lies one image pixel per point at Scaling 100%, centered on the object and repeated; each pixel's luma is the surface's height, from 0 for black to 1 pt for white, and a transparent pixel counts as middle gray. Scaling and Invert act on it as on the built-in textures. A Glass saved without `textureImage` draws and saves as before. +- **Bounded effect length inputs (#4638):** Effect dialog fields with defined length ranges (such as Color Halftone Max Radius 4..127 pt) clamp immediately on commit and reject invalid inputs visibly with an accent highlight without reverting to sub-minimum values. - **Raster effects after document and view changes:** a cached drop shadow, outer glow or filtered content is made again when something its content reads from outside the object changes: a pattern's art or tiling, a symbol shown inside another symbol, a brush definition, an image's pixels, the raster resolution (De-Interlace), Page Knockout Group, the substitution highlights (Highlight Substituted Fonts and Highlight Alternate Glyphs in Preferences › Type, Highlight Substituted Glyphs in Document Setup), a layer's Dim Images, the color settings, the fonts, Pixel Preview, Anti-aliased Artwork, Overprint Preview and isolation mode. A thumbnail under Color Halftone or Mezzotint is made again when the document's color mode changes. Raster effects (blur, shadow, glow, grain) drawn after a pattern, radial or freeform gradient fill export at their place and size (#1541, fixes #1536). - **Drop Shadow's Darkness:** Effect › Stylize › Drop Shadow… has Color and Darkness as radio buttons, each with its field, and the Appearance panel's inline editor has the two radio buttons in its Shade row (`shade`: `color` or `darkness`; `darkness`: 0 to 100%, 100 by default). Color is the default, and a shadow saved without these keys draws as before. With Darkness, the stored source-color model determines the adjustment before document/profile conversion and blur: subtract Darkness/100 from each RGB channel, clamped at zero, or add it to CMYK black K and Gray black, clamped at one, preserving CMYK C/M/Y. At the near-100% endpoint the shadow source becomes gray black before conversion. Shadow opacity stays separate. Original gradient stops follow the same application rule before interpolation; exact resource-level gradient parity remains open. Application SVG export keeps a live filter for simple uniform sRGB sources and uses rendered shadow images for other working RGB profiles, source models and gradients. Low-level SVG filter output warns when this preparation is needed; proportional intermediate SVG filters are not misread as additive Darkness. Exact spot/custom-color and composite-source parity remain open, and resulting CMYK ink values follow the application color pipeline. CSS export leaves the shadow out and marks the object unsupported. When a `.ai`, EPS or PDF opens from its editing data, a Drop Shadow with Darkness in an object's art style is read as one with Color is, with the shadow's Darkness percentage (100% when the style gives none). Behavior reference: Illustrator CC Help (2014, [PDF](https://help.adobe.com/archive/en/illustrator/cc/2014/illustrator_reference.pdf)), page 428 (PDF page 434). From e2828bc0649d115f7f10e5bef37073aff764fa3f Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Fri, 30 Oct 2026 12:57:41 +0430 Subject: [PATCH 006/227] Dialogs: keep dialog open on invalid Enter commit and prevent lock nesting in numeric widget --- crates/ui-egui/src/dialogs.rs | 3 ++- crates/ui-egui/src/dialogs/tests.rs | 13 +++++++------ crates/ui-egui/src/widgets.rs | 3 ++- crates/ui-egui/src/widgets/numeric.rs | 8 ++++++-- crates/ui-egui/src/widgets/text.rs | 13 ++++++++++++- docs/roadmap.md | 2 +- 6 files changed, 30 insertions(+), 12 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 6f307d43ab..eb78e43921 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -656,7 +656,8 @@ pub fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { } }); }); - if spec.ok.is_some() && ok_enabled && !after_panel && ctx.input(|i| i.key_pressed(egui::Key::Enter)) { + let rejected = ctx.data_mut(|d| d.remove_temp::(widgets::dialog_reject_commit_flag())).unwrap_or(false); + if spec.ok.is_some() && ok_enabled && !after_panel && !rejected && ctx.input(|i| i.key_pressed(egui::Key::Enter)) { ok = true; } if discard { diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index 6add459f47..ccc7b3dc09 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -2534,14 +2534,15 @@ fn color_halftone_invalid_input_does_not_revert_to_sub_minimum_value() { frame(&mut app, vec![egui::Event::Text("0.5 px".into())]); frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); - // 2. Refocus Max Radius before typing invalid text - crate::widgets::arm_field_focus(&ctx, ("dlg-len", "maxRadius")); + // 2. Typing invalid text on Enter must NOT confirm/close the dialog; the dialog stays open + app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); frame(&mut app, vec![]); frame(&mut app, vec![egui::Event::Text("1jgghgh".into())]); - frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); - // The value remains the valid clamped minimum 4.0 pt, never 0.5 px, and rejection flash is set - assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); - assert!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"] == serde_json::json!(4.0)); + frame( + &mut app, + vec![egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }], + ); + assert!(app.ui.dialog.is_some(), "dialog must remain open on invalid Enter commit"); } #[test] diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 8590a26676..87fa6ac84b 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -57,7 +57,8 @@ pub use numeric::{ use numeric::{decimal_point, share_of, spinner_step, step_through, step_to_multiple, within_a_millionth}; pub use panel_chrome::{bottom_bar, layout_button, list_box, orientation_button, tab_bar}; pub(crate) use text::{ - arm_field_focus, dialog_focus_flag, disarm_field_focus, enter_modifiers, focus_field, own_field_shift_enter, set_dialog_open, take_dialog_focus, + arm_field_focus, dialog_focus_flag, dialog_reject_commit_flag, disarm_field_focus, enter_modifiers, focus_field, own_field_shift_enter, + reject_dialog_commit, set_dialog_open, take_dialog_focus, }; pub use text::{ exact_text_field, exact_text_field_named, plain_field, plain_field_named, search_field, text_field, text_field_named, text_presets, diff --git a/crates/ui-egui/src/widgets/numeric.rs b/crates/ui-egui/src/widgets/numeric.rs index 184112790e..1867eb271b 100644 --- a/crates/ui-egui/src/widgets/numeric.rs +++ b/crates/ui-egui/src/widgets/numeric.rs @@ -117,8 +117,12 @@ fn unit_field( Some(clamped) } None => { - ui.data_mut(|d| d.remove::(id)); - ui.data_mut(|d| d.insert_temp(id.with("invalid-flash"), ui.input(|i| i.time + 0.25))); + let end = ui.input(|i| i.time + 0.25); + ui.data_mut(|d| { + d.remove::(id); + d.insert_temp(id.with("invalid-flash"), end); + }); + crate::widgets::reject_dialog_commit(ui.ctx()); ui.ctx().request_repaint(); None } diff --git a/crates/ui-egui/src/widgets/text.rs b/crates/ui-egui/src/widgets/text.rs index e688c0c2e6..9d848f39f5 100644 --- a/crates/ui-egui/src/widgets/text.rs +++ b/crates/ui-egui/src/widgets/text.rs @@ -87,6 +87,16 @@ fn dialog_open_flag() -> egui::Id { egui::Id::unique("dialog-open") } +/// The flag that tells the dialog runner a field rejected an invalid commit on Enter in this frame. +pub(crate) fn dialog_reject_commit_flag() -> egui::Id { + egui::Id::unique("dialog-reject-commit") +} + +/// Suppress confirming an open dialog on Enter during this frame when an invalid value was committed. +pub(crate) fn reject_dialog_commit(ctx: &egui::Context) { + ctx.data_mut(|d| d.insert_temp(dialog_reject_commit_flag(), true)); +} + /// The app sets this at the start of each frame: while a dialog is open, Shift+Enter in a field /// applies its value and confirms the dialog as Enter does ([`shift_enter_keeps_focus`]). pub(crate) fn set_dialog_open(ctx: &egui::Context, open: bool) { @@ -279,7 +289,8 @@ pub(super) fn recessed_text( d.insert_temp(id, buf.clone()); d.insert_temp(focus_id, focused); }); - let commit = resp.lost_focus() || kept; + let enter_commit = rows == 1 && editing && ui.input(|i| i.key_pressed(egui::Key::Enter)); + let commit = resp.lost_focus() || kept || enter_commit; (buf, commit, resp, rect) } diff --git a/docs/roadmap.md b/docs/roadmap.md index 3febbc75cb..e1f58f3af6 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -4,7 +4,7 @@ ## Feature submission evidence -**Feature evidence last updated:** 2026-10-22. +**Feature evidence last updated:** 2026-10-30. The shared assessment status line and revision history are current upstream; this dated section records the submission's feature evidence and revisions without rescoring upstream or claiming a new combined build or runtime measurement. From 956412e97820f93d68555310a4a39a55b3c6e577 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Fri, 30 Oct 2026 13:31:46 +0430 Subject: [PATCH 007/227] Tests: assert rejection highlight and dialog retention on invalid Enter commit --- crates/ui-egui/src/dialogs/tests.rs | 77 ++++++++++++++++++++--------- crates/ui-egui/src/widgets/text.rs | 7 ++- 2 files changed, 59 insertions(+), 25 deletions(-) diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index ccc7b3dc09..9ee777ccf3 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -2518,39 +2518,65 @@ fn an_effect_dialog_keeps_a_typed_distance_within_the_effects_range() { /// or out-of-range value; sub-minimum input is clamped immediately and invalid input clears cleanly. #[test] fn color_halftone_invalid_input_does_not_revert_to_sub_minimum_value() { - let mut app = app(); - let _id = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); + let mut first_app = app(); + let _id = first_app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); let ctx = egui::Context::default(); theme::install_fonts(&ctx); theme::apply(&ctx, Default::default()); let frame = |app: &mut VectorcraftApp, events: Vec| { let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui.ctx())); out.textures_delta.clear(); + out }; - app.run("select.all", json!({})).unwrap(); - app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); - frame(&mut app, vec![]); - // 1. Enter 0.5 px (sub-minimum): clamped immediately to 4 pt - frame(&mut app, vec![egui::Event::Text("0.5 px".into())]); - frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); - assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); - // 2. Typing invalid text on Enter must NOT confirm/close the dialog; the dialog stays open - app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); - frame(&mut app, vec![]); - frame(&mut app, vec![egui::Event::Text("1jgghgh".into())]); + first_app.run("select.all", json!({})).unwrap(); + first_app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); + frame(&mut first_app, vec![]); + // 1. Enter 0.5 px (sub-minimum): clamped immediately to 4 pt on commit + frame(&mut first_app, vec![egui::Event::Text("0.5 px".into())]); frame( - &mut app, + &mut first_app, + vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }], + ); + assert_eq!(first_app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); + + // 2. Typing invalid text on Enter must NOT confirm/close the dialog and displays rejection highlight + let mut second_app = app(); + let _id2 = second_app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); + let ctx2 = egui::Context::default(); + theme::install_fonts(&ctx2); + theme::apply(&ctx2, Default::default()); + let _t = crate::theme::Tokens::get(&ctx2); + let frame2 = |app: &mut VectorcraftApp, events: Vec| { + let mut out = ctx2.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui.ctx())); + out.textures_delta.clear(); + out + }; + second_app.run("select.all", json!({})).unwrap(); + second_app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); + frame2(&mut second_app, vec![]); + frame2(&mut second_app, vec![egui::Event::Text("1jgghgh".into())]); + let _out = frame2( + &mut second_app, vec![egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }], ); - assert!(app.ui.dialog.is_some(), "dialog must remain open on invalid Enter commit"); + // Dialog remains open + assert!(second_app.ui.dialog.is_some(), "dialog must remain open on invalid Enter commit"); + assert_eq!(second_app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(8.0)); + // The field paints with rejection highlight (width 1.5, accent_strong) + let next_out = frame2(&mut second_app, vec![]); + let has_rejection_highlight = next_out.shapes.iter().any(|s| match &s.shape { + egui::Shape::Rect(r) => (r.stroke.width - 1.5).abs() < 1e-3 && r.stroke.color.a() > 0, + _ => false, + }); + assert!(has_rejection_highlight, "Max Radius must display rejection highlight after invalid input"); } #[test] fn bounded_field_with_inches_does_not_clamp_point_bounds_to_inch_numbers() { - let mut app = app(); - let _id = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); + let mut test_app = app(); + let _id = test_app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); // Switch document units to Inches - app.run("document.setup", json!({"units": "Inches"})).unwrap(); + test_app.run("document.setup", json!({"units": "Inches"})).unwrap(); let ctx = egui::Context::default(); theme::install_fonts(&ctx); theme::apply(&ctx, Default::default()); @@ -2558,11 +2584,14 @@ fn bounded_field_with_inches_does_not_clamp_point_bounds_to_inch_numbers() { let mut out = ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui.ctx())); out.textures_delta.clear(); }; - app.run("select.all", json!({})).unwrap(); - app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); - frame(&mut app, vec![]); + test_app.run("select.all", json!({})).unwrap(); + test_app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); + frame(&mut test_app, vec![]); // Type 1 in: 72 pt is within 4..127 pt range and must not clamp to ~1.76 pt - frame(&mut app, vec![egui::Event::Text("1 in".into())]); - frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); - assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(72.0)); + frame(&mut test_app, vec![egui::Event::Text("1 in".into())]); + frame( + &mut test_app, + vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }], + ); + assert_eq!(test_app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(72.0)); } diff --git a/crates/ui-egui/src/widgets/text.rs b/crates/ui-egui/src/widgets/text.rs index 9d848f39f5..4b3561a89a 100644 --- a/crates/ui-egui/src/widgets/text.rs +++ b/crates/ui-egui/src/widgets/text.rs @@ -248,7 +248,9 @@ pub(super) fn recessed_text( ui.set_min_size(vec2(width, height)); let rect = ui.max_rect(); let now = ui.input(|i| i.time); - let invalid = ui.data(|d| d.get_temp::(id.with("invalid-flash"))).is_some_and(|end| now <= end); + let flash_end = ui.data(|d| d.get_temp::(id.with("invalid-flash"))); + let invalid = flash_end.is_some_and(|end| now <= end); + eprintln!("RECESSED_TEXT_DRAW: now={} flash_end={:?} invalid={}", now, flash_end, invalid); if invalid { ui.ctx().request_repaint(); } @@ -291,6 +293,9 @@ pub(super) fn recessed_text( }); let enter_commit = rows == 1 && editing && ui.input(|i| i.key_pressed(egui::Key::Enter)); let commit = resp.lost_focus() || kept || enter_commit; + if editing || enter_commit || commit { + eprintln!("RECESSED_TEXT: editing={} commit={} enter_commit={} buf={:?}", editing, commit, enter_commit, buf); + } (buf, commit, resp, rect) } From 6ec5178708b99ebce6036d670168aac18b5033b1 Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Fri, 30 Oct 2026 13:54:51 +0430 Subject: [PATCH 008/227] Text: remove debug print in recessed_text and test invalid input in single dialog session --- crates/ui-egui/src/dialogs/tests.rs | 54 +++++++++++------------------ crates/ui-egui/src/widgets/text.rs | 3 -- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index 9ee777ccf3..d316b4ff5b 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -2518,8 +2518,8 @@ fn an_effect_dialog_keeps_a_typed_distance_within_the_effects_range() { /// or out-of-range value; sub-minimum input is clamped immediately and invalid input clears cleanly. #[test] fn color_halftone_invalid_input_does_not_revert_to_sub_minimum_value() { - let mut first_app = app(); - let _id = first_app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); + let mut app = app(); + let _id = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); let ctx = egui::Context::default(); theme::install_fonts(&ctx); theme::apply(&ctx, Default::default()); @@ -2528,42 +2528,30 @@ fn color_halftone_invalid_input_does_not_revert_to_sub_minimum_value() { out.textures_delta.clear(); out }; - first_app.run("select.all", json!({})).unwrap(); - first_app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); - frame(&mut first_app, vec![]); + app.run("select.all", json!({})).unwrap(); + app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); + frame(&mut app, vec![]); // 1. Enter 0.5 px (sub-minimum): clamped immediately to 4 pt on commit - frame(&mut first_app, vec![egui::Event::Text("0.5 px".into())]); - frame( - &mut first_app, - vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }], - ); - assert_eq!(first_app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); + frame(&mut app, vec![egui::Event::Text("0.5 px".into())]); + frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); - // 2. Typing invalid text on Enter must NOT confirm/close the dialog and displays rejection highlight - let mut second_app = app(); - let _id2 = second_app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); - let ctx2 = egui::Context::default(); - theme::install_fonts(&ctx2); - theme::apply(&ctx2, Default::default()); - let _t = crate::theme::Tokens::get(&ctx2); - let frame2 = |app: &mut VectorcraftApp, events: Vec| { - let mut out = ctx2.run_ui(egui::RawInput { events, ..Default::default() }, |ui| show(app, ui.ctx())); - out.textures_delta.clear(); - out - }; - second_app.run("select.all", json!({})).unwrap(); - second_app.run("effect.dialog", json!({"effect": "pixelate.colorHalftone"})).unwrap(); - frame2(&mut second_app, vec![]); - frame2(&mut second_app, vec![egui::Event::Text("1jgghgh".into())]); - let _out = frame2( - &mut second_app, + // 2. Return focus to Max Radius with Shift+Tab, type invalid text, and commit with Enter + frame( + &mut app, + vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::SHIFT }], + ); + frame(&mut app, vec![egui::Event::Text("1jgghgh".into())]); + let _out = frame( + &mut app, vec![egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }], ); - // Dialog remains open - assert!(second_app.ui.dialog.is_some(), "dialog must remain open on invalid Enter commit"); - assert_eq!(second_app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(8.0)); + // Dialog remains open and retains the clamped 4.0 pt rather than reverting to 0.5 px + assert!(app.ui.dialog.is_some(), "dialog must remain open on invalid Enter commit"); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); + // The field paints with rejection highlight (width 1.5, accent_strong) - let next_out = frame2(&mut second_app, vec![]); + let next_out = frame(&mut app, vec![]); let has_rejection_highlight = next_out.shapes.iter().any(|s| match &s.shape { egui::Shape::Rect(r) => (r.stroke.width - 1.5).abs() < 1e-3 && r.stroke.color.a() > 0, _ => false, diff --git a/crates/ui-egui/src/widgets/text.rs b/crates/ui-egui/src/widgets/text.rs index 4b3561a89a..9031c74118 100644 --- a/crates/ui-egui/src/widgets/text.rs +++ b/crates/ui-egui/src/widgets/text.rs @@ -293,9 +293,6 @@ pub(super) fn recessed_text( }); let enter_commit = rows == 1 && editing && ui.input(|i| i.key_pressed(egui::Key::Enter)); let commit = resp.lost_focus() || kept || enter_commit; - if editing || enter_commit || commit { - eprintln!("RECESSED_TEXT: editing={} commit={} enter_commit={} buf={:?}", editing, commit, enter_commit, buf); - } (buf, commit, resp, rect) } From 092cb2ab04de4b2a30f1f691e64393f5087b4b7d Mon Sep 17 00:00:00 2001 From: Taha-Mahmoodi <85902429+Taha-Mahmoodi@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:23:44 +0430 Subject: [PATCH 009/227] Tests: assert rendered field text displays 4 pt after sub-minimum commit and invalid input rejection --- crates/ui-egui/src/dialogs/tests.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/crates/ui-egui/src/dialogs/tests.rs b/crates/ui-egui/src/dialogs/tests.rs index d316b4ff5b..d4b6698a8b 100644 --- a/crates/ui-egui/src/dialogs/tests.rs +++ b/crates/ui-egui/src/dialogs/tests.rs @@ -2535,6 +2535,12 @@ fn color_halftone_invalid_input_does_not_revert_to_sub_minimum_value() { frame(&mut app, vec![egui::Event::Text("0.5 px".into())]); frame(&mut app, vec![egui::Event::Key { key: egui::Key::Tab, physical_key: None, pressed: true, repeat: false, modifiers: Default::default() }]); assert_eq!(app.ui.dialog.as_ref().unwrap().fields["maxRadius"], serde_json::json!(4.0)); + let s1 = frame(&mut app, vec![]); + let shows_clamped_text = s1.shapes.iter().any(|s| match &s.shape { + egui::Shape::Text(t) => t.galley.text().trim() == "4 pt", + _ => false, + }); + assert!(shows_clamped_text, "rendered field must show clamped '4 pt' text after sub-minimum commit"); // 2. Return focus to Max Radius with Shift+Tab, type invalid text, and commit with Enter frame( @@ -2557,6 +2563,11 @@ fn color_halftone_invalid_input_does_not_revert_to_sub_minimum_value() { _ => false, }); assert!(has_rejection_highlight, "Max Radius must display rejection highlight after invalid input"); + let shows_clamped_after_invalid = next_out.shapes.iter().any(|s| match &s.shape { + egui::Shape::Text(t) => t.galley.text().trim() == "4 pt", + _ => false, + }); + assert!(shows_clamped_after_invalid, "rendered field must retain '4 pt' text after invalid input rejection"); } #[test] From a385b5cbf5cc7f139de27e0c90bd2d8ea44ee161 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 16:55:57 +0700 Subject: [PATCH 010/227] Fields: drop a leftover debug print from the invalid-input highlight --- crates/ui-egui/src/widgets/text.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/ui-egui/src/widgets/text.rs b/crates/ui-egui/src/widgets/text.rs index 9031c74118..2c4d25f709 100644 --- a/crates/ui-egui/src/widgets/text.rs +++ b/crates/ui-egui/src/widgets/text.rs @@ -250,7 +250,6 @@ pub(super) fn recessed_text( let now = ui.input(|i| i.time); let flash_end = ui.data(|d| d.get_temp::(id.with("invalid-flash"))); let invalid = flash_end.is_some_and(|end| now <= end); - eprintln!("RECESSED_TEXT_DRAW: now={} flash_end={:?} invalid={}", now, flash_end, invalid); if invalid { ui.ctx().request_repaint(); } From 33d15bec56247697f2b05fc9de2c4dd8d6eb9828 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 17:12:16 +0700 Subject: [PATCH 011/227] Fields: only a plain Enter commits a field early, so Ctrl/Cmd+Enter in X or Y keeps editing --- crates/ui-egui/src/widgets/text.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/widgets/text.rs b/crates/ui-egui/src/widgets/text.rs index 2c4d25f709..a8aa9e8028 100644 --- a/crates/ui-egui/src/widgets/text.rs +++ b/crates/ui-egui/src/widgets/text.rs @@ -290,7 +290,8 @@ pub(super) fn recessed_text( d.insert_temp(id, buf.clone()); d.insert_temp(focus_id, focused); }); - let enter_commit = rows == 1 && editing && ui.input(|i| i.key_pressed(egui::Key::Enter)); + // Plain Enter only: Ctrl/Cmd+Enter keeps editing a field that takes it (X and Y in Transform). + let enter_commit = rows == 1 && editing && ui.input(|i| i.key_pressed(egui::Key::Enter) && i.modifiers.is_none()); let commit = resp.lost_focus() || kept || enter_commit; (buf, commit, resp, rect) } From dd934dfd4e4af6efc34542ce78a79877cee0a5cc Mon Sep 17 00:00:00 2001 From: wjrichards Date: Thu, 29 Oct 2026 14:09:54 -0400 Subject: [PATCH 012/227] Linux clipboard: copy text through the core Wayland protocol Where arboard can't open (GNOME has no data-control protocol, and the Flatpak on a Wayland session has no X11), Copy and Paste use the compositor's core data-device protocol on the window's own connection through smithay-clipboard, already in the build through egui-winit: text only, a copy's text or its SVG markup. A bitmap-only copy reports that this clipboard carries text only and leaves it as it was. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 1 + ROADMAP.md | 2 + apps/vectorcraft/Cargo.toml | 4 + apps/vectorcraft/src/clipboard.rs | 211 +++++++++++++++++++++++--- apps/vectorcraft/src/host_services.rs | 6 +- docs/development.md | 4 +- docs/gaps.md | 5 +- 7 files changed, 206 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f31d49e51..6bf8261a86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6062,6 +6062,7 @@ dependencies = [ "raw-window-handle", "rfd", "serde_json", + "smithay-clipboard", "socket2", "vectorcraft-engine", "vectorcraft-text", diff --git a/ROADMAP.md b/ROADMAP.md index 8a4d00db95..3b52398406 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -144,6 +144,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap | Date | What landed | |---|---| +| 2026-10-29 | Linux: the Flatpak on GNOME copies and pastes text with other apps through the compositor's core Wayland protocol (smithay-clipboard on the window's connection), where arboard has neither data-control nor X11. Scores and estimates unchanged. | | 2026-10-29 | Linux: a clipboard that can't be opened (the Flatpak on GNOME, where arboard has neither data-control nor X11) is retried after 1 s, doubling to a minute, and logged once, where the background Paste check used to reconnect and log a warning every 250 ms (267k warnings in 18 h). Scores and estimates unchanged. | | 2026-10-21 | 3D lighting: four original lighting presets shared by Revolve, Extrude & Bevel, Inflate and Rotate, with command access and manual Custom settings; scores and estimates unchanged. | | 2026-10-21 | Print: the Print dialog's Media list has the Japanese papers — JIS B4 (257 × 364 mm), JIS B5 (182 × 257 mm) and JIS B6 next to the ISO B4/B5 (which keep their ISO 216 dimensions for settings saved before them), はがき 100 × 148 mm, 往復はがき 148 × 200 mm, 封筒 長形3号 120 × 235 mm / 長形4号 90 × 225 mm / 角形2号 240 × 332 mm / 角形3号 216 × 277 mm and 四六判 127 × 188 mm. A paper is named by its JSON id or its dialog label, any case and spacing (`B5 (JIS)` or `b5jis`), and every added size prints as its own PDF page size. Headline numbers unchanged. | @@ -199,6 +200,7 @@ The full pre-standard record of what landed is kept in [docs/roadmap.md](docs/ro | Date | Change | Summary | |---|---|---| +| 2026-10-29 | minor | Progress log row for the Linux Flatpak clipboard's core Wayland protocol text fallback; headline numbers unchanged. | | 2026-10-29 | minor | Progress log row for the Linux clipboard retry backoff; headline numbers unchanged. | | 2026-10-23 | minor | Progress log row for Pathfinder › Trap; Live vector effects hours 6–10 → 4–8; headline numbers unchanged. | | 2026-10-23 | minor | Progress log row for OpenType SVG colour fonts; headline numbers unchanged. | diff --git a/apps/vectorcraft/Cargo.toml b/apps/vectorcraft/Cargo.toml index 3173d3bc97..0657c93c8a 100644 --- a/apps/vectorcraft/Cargo.toml +++ b/apps/vectorcraft/Cargo.toml @@ -92,6 +92,10 @@ x11rb = { version = "0.13", default-features = false, features = ["xinput"] } # Asks the Wayland compositor which GPU it draws with (linux-dmabuf feedback, src/compositor_gpu.rs), # so Automatic draws on that one. Both are already in the build through winit. wayland-client = "0.31" +# Copy and Paste of text through the compositor's core data-device protocol on the window's +# connection (src/clipboard.rs), where arboard has neither data-control (GNOME) nor X11 (a Flatpak +# on a Wayland session). MIT, already in the build through egui-winit. +smithay-clipboard = "0.7" wayland-protocols = { version = "0.32", features = ["client", "unstable"] } # The save dialog's parent window on Wayland (src/portal_save.rs): an xdg-foreign handle (in # wayland-protocols' `unstable` set) made on the window's own connection. MIT, already in the build diff --git a/apps/vectorcraft/src/clipboard.rs b/apps/vectorcraft/src/clipboard.rs index fcaf3857d6..9494749589 100644 --- a/apps/vectorcraft/src/clipboard.rs +++ b/apps/vectorcraft/src/clipboard.rs @@ -9,8 +9,10 @@ //! and EPS as vector art (#1499) and its PNG or TIFF as they are, as screenshots copy them (on //! Linux arboard reads no other formats). On Wayland, arboard's data-control //! backend reads the compositor's clipboard (X11 through XWayland only sees what X11 apps -//! copied), falling back to X11 where the compositor lacks the protocol. A clipboard that can't -//! be opened is tried again after a wait that grows to a minute, not each time Paste asks. +//! copied), falling back to X11 where the compositor lacks the protocol, and where there is no +//! X11 either (a Flatpak on GNOME) to the compositor's core protocol on the window's connection, +//! text only. A clipboard that can't be opened is tried again after a wait that grows to a +//! minute, not each time Paste asks. //! - Everywhere: files copied in a file manager paste as the first one that is art (SVG, PDF, EPS, //! a metafile or a bitmap), before the clipboard's other formats (the files' paths as text). @@ -20,12 +22,16 @@ use std::path::PathBuf; use vectorcraft_engine::cmd::clipboard::{BITMAP, EPS, FILE_HEAD, Flavour, PDF, PNG, SVG, TEXT, file_flavour}; use vectorcraft_ui_egui::SystemClipboard; -/// This platform's system clipboard. -pub fn system_clipboard() -> Box { +/// This platform's system clipboard. On Linux, `window`'s Wayland connection carries text where +/// arboard can't open (GNOME has no data-control protocol, a Flatpak there no X11). +pub fn system_clipboard(window: Option>) -> Box { #[cfg(windows)] - let cb = Box::::default(); + let cb = { + let _ = window; + Box::::default() + }; #[cfg(not(windows))] - let cb = Box::::default(); + let cb = Box::new(portable::Clipboard::new(window)); cb } @@ -307,10 +313,12 @@ mod win { } } -/// arboard: one format at a time. Built everywhere so it is checked everywhere. +/// arboard, or on a Wayland compositor without its data-control protocol the core protocol's text +/// clipboard: one format at a time. Built everywhere so it is checked everywhere. #[cfg_attr(windows, allow(dead_code))] mod portable { use std::borrow::Cow; + use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use std::time::{Duration, Instant}; @@ -322,6 +330,108 @@ mod portable { Image(usize, usize), } + /// An open clipboard connection. + enum Backend { + Arboard(arboard::Clipboard), + /// The compositor's core data-device protocol on the window's connection (text only). + #[cfg(target_os = "linux")] + Wayland(super::wayland::TextClipboard), + } + + /// What a write of a picture says where the clipboard carries text only. + const TEXT_ONLY: &str = "this clipboard carries text only"; + + impl Backend { + /// arboard (Wayland data-control, else X11), else the core protocol on `window`'s + /// Wayland connection. Err: why each failed. + fn open(window: Option<&Arc>) -> Result { + first_open( + || arboard::Clipboard::new().map(Self::Arboard).map_err(|e| e.to_string()), + || { + #[cfg(target_os = "linux")] + return window.and_then(|w| super::wayland::TextClipboard::new(w.clone())).map(Self::Wayland).ok_or("not a Wayland window"); + #[cfg(not(target_os = "linux"))] + { + let _ = window; + Err("not on Linux") + } + }, + ) + } + + fn name(&self) -> &'static str { + match self { + Self::Arboard(_) => "arboard", + #[cfg(target_os = "linux")] + Self::Wayland(_) => "the Wayland core protocol (text only)", + } + } + + fn get_text(&mut self) -> Result { + match self { + Self::Arboard(cb) => cb.get_text().map_err(|e| e.to_string()), + #[cfg(target_os = "linux")] + Self::Wayland(cb) => cb.get_text(), + } + } + + fn set_text(&mut self, text: &str) -> Result<(), String> { + match self { + Self::Arboard(cb) => cb.set_text(text).map_err(|e| e.to_string()), + #[cfg(target_os = "linux")] + Self::Wayland(cb) => { + cb.set_text(text); + Ok(()) + } + } + } + + fn get_image(&mut self) -> Result, String> { + match self { + Self::Arboard(cb) => cb.get_image().map_err(|e| e.to_string()), + #[cfg(target_os = "linux")] + Self::Wayland(_) => Err(TEXT_ONLY.into()), + } + } + + fn set_image(&mut self, img: arboard::ImageData<'_>) -> Result<(), String> { + match self { + Self::Arboard(cb) => cb.set_image(img).map_err(|e| e.to_string()), + #[cfg(target_os = "linux")] + Self::Wayland(_) => Err(TEXT_ONLY.into()), + } + } + + fn clear(&mut self) -> Result<(), String> { + match self { + Self::Arboard(cb) => cb.clear().map_err(|e| e.to_string()), + #[cfg(target_os = "linux")] + Self::Wayland(cb) => { + cb.set_text(""); + Ok(()) + } + } + } + + /// Files copied in a file manager (none where the backend can't read a file list). + fn file_list(&mut self) -> Vec { + match self { + Self::Arboard(cb) => cb.get().file_list().unwrap_or_default(), + #[cfg(target_os = "linux")] + Self::Wayland(_) => vec![], + } + } + } + + /// The first of `arboard` and `wayland` that opens, tried in that order. Err: why each failed. + fn first_open(arboard: impl FnOnce() -> Result, wayland: impl FnOnce() -> Result) -> Result { + let arboard = match arboard() { + Ok(cb) => return Ok(cb), + Err(e) => e, + }; + wayland().map_err(|wayland| format!("arboard: {arboard}; Wayland core protocol: {wayland}")) + } + /// Who asks for the clipboard: the background paste check waits out the whole wait after a /// failure, a Copy or Paste of the user's [`USER_RETRY`] at most. #[derive(Clone, Copy, PartialEq, Eq, Debug)] @@ -348,7 +458,7 @@ mod portable { } /// A handle opened on first use and kept, or after a failure opened again only once its wait is - /// over: where the clipboard can't be opened, asking a few times a second must not reconnect each time. + /// over: where neither backend opens, asking a few times a second must not reconnect each time. pub(super) struct Reopen { handle: Option, failed: Option, @@ -415,20 +525,20 @@ mod portable { pub struct Clipboard { /// Kept open: on Linux the copied data lives as long as the handle does. - cb: Reopen, + cb: Reopen, + /// The app window, for the Wayland core protocol (on its connection). + window: Option>, ours: Option, } - impl Default for Clipboard { - fn default() -> Self { - Self { cb: Reopen::new(&UNAVAILABLE_LOGGED), ours: None } - } - } - impl Clipboard { - fn cb(&mut self, asker: Asker) -> Result<&mut arboard::Clipboard, String> { - let open = || arboard::Clipboard::new().map_err(|e| e.to_string()); - self.cb.get(asker, Instant::now(), open, |_| "arboard").ok_or_else(|| "no system clipboard".to_string()) + pub fn new(window: Option>) -> Self { + Self { cb: Reopen::new(&UNAVAILABLE_LOGGED), window, ours: None } + } + + fn cb(&mut self, asker: Asker) -> Result<&mut Backend, String> { + let window = self.window.as_ref(); + self.cb.get(asker, Instant::now(), || Backend::open(window), Backend::name).ok_or_else(|| "no system clipboard".to_string()) } } @@ -442,16 +552,16 @@ mod portable { let cb = self.cb(Asker::User)?; let ours = match (text, image) { (Some(t), _) => { - cb.set_text(t.as_str()).map_err(|e| e.to_string())?; + cb.set_text(t.as_str())?; Some(Ours::Text(t)) } (None, Some(img)) => { let (width, height) = (img.width() as usize, img.height() as usize); - cb.set_image(arboard::ImageData { width, height, bytes: Cow::Owned(img.into_raw()) }).map_err(|e| e.to_string())?; + cb.set_image(arboard::ImageData { width, height, bytes: Cow::Owned(img.into_raw()) })?; Some(Ours::Image(width, height)) } (None, None) => { - cb.clear().map_err(|e| e.to_string())?; + cb.clear()?; None } }; @@ -470,7 +580,7 @@ mod portable { fn read(&mut self, mimes: &[&'static str]) -> Option { let cb = self.cb(Asker::User).ok()?; - if let Some(f) = cb.get().file_list().ok().and_then(|paths| copied_file(paths, mimes)) { + if let Some(f) = copied_file(cb.file_list(), mimes) { return Some(f); } mimes.iter().find_map(|m| { @@ -608,6 +718,26 @@ mod portable { assert_eq!(cb.opened().copied(), Some(7)); } + #[test] + fn arboard_is_tried_before_the_wayland_core_protocol() { + let wayland_tried = Cell::new(false); + let wayland = |ok| { + wayland_tried.set(true); + if ok { Ok("wayland") } else { Err("not a Wayland window") } + }; + // Where arboard opens (data-control, X11) the core protocol isn't tried. + assert_eq!(first_open(|| Ok("arboard"), || wayland(true)), Ok("arboard")); + assert!(!wayland_tried.get()); + // The Flatpak on GNOME: no data-control, no X11. + assert_eq!(first_open(|| Err("no X11".into()), || wayland(true)), Ok("wayland")); + assert!(wayland_tried.get()); + // Neither: every reason is kept for the log. + assert_eq!( + first_open(|| Err("no X11".into()), || wayland(false)), + Err::<&str, _>("arboard: no X11; Wayland core protocol: not a Wayland window".into()) + ); + } + #[test] fn one_outage_is_logged_once_across_handles() { static LOGGED: AtomicBool = AtomicBool::new(false); @@ -623,6 +753,43 @@ mod portable { } } +/// The compositor's clipboard through the core data-device protocol (`wl_data_device`), on the +/// window's own Wayland connection: what Copy and Paste use where the compositor lacks the +/// data-control protocol arboard needs (GNOME) and there is no X11 to fall back on (the Flatpak on +/// a Wayland session). Text only (smithay-clipboard), and only while the window has focus, as the +/// protocol has it. +#[cfg(target_os = "linux")] +mod wayland { + use std::sync::Arc; + + pub struct TextClipboard { + cb: smithay_clipboard::Clipboard, + /// Held as long as the clipboard: its connection is the window's. + _window: Arc, + } + + impl TextClipboard { + /// None when `window` isn't a Wayland window. + #[allow(unsafe_code)] + pub fn new(window: Arc) -> Option { + use winit::raw_window_handle::{HasDisplayHandle as _, RawDisplayHandle}; + let RawDisplayHandle::Wayland(d) = window.display_handle().ok()?.as_raw() else { return None }; + // SAFETY: the display is winit's open `wl_display`, which outlives `window` (held beside + // the clipboard); smithay-clipboard makes its own event queue on it and doesn't close it. + let cb = unsafe { smithay_clipboard::Clipboard::new(d.display.as_ptr()) }; + Some(Self { cb, _window: window }) + } + + pub fn get_text(&self) -> Result { + self.cb.load().map_err(|e| e.to_string()) + } + + pub fn set_text(&self, text: &str) { + self.cb.store(text); + } + } +} + /// The macOS pasteboard's vector art and bitmaps as they are (arboard reads text, and of the /// pictures TIFF only, decoded). #[cfg(target_os = "macos")] diff --git a/apps/vectorcraft/src/host_services.rs b/apps/vectorcraft/src/host_services.rs index 4254d1591a..e25332b61a 100644 --- a/apps/vectorcraft/src/host_services.rs +++ b/apps/vectorcraft/src/host_services.rs @@ -255,6 +255,7 @@ pub(crate) fn services(parent: Parent, ui: egui::Context) -> Services { .as_ref() .and_then(|w| w.window_handle().ok()) .is_some_and(|h| matches!(h.as_raw(), RawWindowHandle::Xlib(_) | RawWindowHandle::Xcb(_))); + let (clip, clip_probe) = (parent.clone(), parent.clone()); let (p1, p2, p3, p4, p5) = (parent.clone(), parent.clone(), parent.clone(), parent.clone(), parent); #[cfg(target_os = "macos")] let sampled_ui = ui.clone(); @@ -286,11 +287,12 @@ pub(crate) fn services(parent: Parent, ui: egui::Context) -> Services { fileio::write_file_with(p, fill).map_err(|e| e.to_string()) })), // Every format Copy offers and Paste reads (menu-bar Paste never sees egui's Paste event). - system_clipboard: Some(clipboard::system_clipboard()), + system_clipboard: Some(clipboard::system_clipboard(clip)), // Linux checks whether Paste has something to take on a background thread: an X11 clipboard // owner that never answers holds a read for up to 4 s. Windows only asks which formats the // clipboard holds and macOS asks the pasteboard server, so they check in line. - clipboard_probe: cfg!(target_os = "linux").then(|| Box::new(clipboard::system_clipboard) as ClipboardProbeFactory), + // The probe's handle is made on its own thread, from the window (`Send`), not its raw display. + clipboard_probe: cfg!(target_os = "linux").then(|| Box::new(move || clipboard::system_clipboard(clip_probe)) as ClipboardProbeFactory), // Help → Discord / website / GitHub, the Discord button, About and Home links. open_url: Some(Box::new(|url: &str| { let _ = webbrowser::open(url); diff --git a/docs/development.md b/docs/development.md index ca34bf51cb..28ca418319 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,5 +1,6 @@ # Development +> **Last updated:** 2026-10-29 · **Change:** Linux clipboard: the Flatpak on GNOME copies and pastes text through the core Wayland protocol. > **Last updated:** 2026-10-29 · **Change:** Linux clipboard: a clipboard that can't be opened is retried with a growing wait and logged once. > **Last updated:** 2026-10-25 · **Change:** Linux Wayland drag-and-drop note names eframe 0.37 (still on winit 0.30). > **Last updated:** 2026-10-23 · **Change:** Tests: cargo xtask test, one integration-test binary per crate, the dev profile's debug info. @@ -114,7 +115,7 @@ On GNOME/Wayland, enable **Preferences › User Interface › System Title Bar** The window runs natively on Wayland (eframe's `wayland` feature) and on X11. On machines with two GPUs it renders on the one the desktop runs on unless Preferences say otherwise; see [Desktop graphics processor](#desktop-graphics-processor) (#502). The system clipboard (`apps/vectorcraft/src/clipboard.rs`) is arboard with its `wayland-data-control` feature: -- **Clipboard:** under Wayland arboard talks to the compositor through the data-control protocol (wlroots compositors such as Sway and Hyprland, KDE Plasma), so bitmaps (`image/png`), SVG markup and text copied in any app paste (#398). Where the compositor lacks the protocol (GNOME's Mutter, [arboard#223](https://github.com/1Password/arboard/issues/223)), arboard falls back to the X11 clipboard through XWayland, which only holds what X11 apps copied. A clipboard arboard can't open at all (the Flatpak on a Wayland session, where `--socket=fallback-x11` gives it no X11) is tried again after 1 s, doubling to a minute (a Copy or Paste of the user's at most once a second), and logged once when it goes and once when it comes back: before, the background Paste check reconnected and logged a warning every 250 ms. egui's own text paste into fields goes through smithay-clipboard and works either way. +- **Clipboard:** under Wayland arboard talks to the compositor through the data-control protocol (wlroots compositors such as Sway and Hyprland, KDE Plasma), so bitmaps (`image/png`), SVG markup and text copied in any app paste (#398). Where the compositor lacks the protocol (GNOME's Mutter, [arboard#223](https://github.com/1Password/arboard/issues/223)), arboard falls back to the X11 clipboard through XWayland, which only holds what X11 apps copied. Where there is no X11 either (the Flatpak on a Wayland session: `--socket=fallback-x11` gives it none), Copy and Paste use the compositor's core data-device protocol on the window's own connection through smithay-clipboard: text only (a copy's text or its SVG markup), and only while the window has focus. A clipboard neither backend opens is tried again after 1 s, doubling to a minute (a Copy or Paste of the user's at most once a second), and logged once when it goes and once when it comes back: before, the background Paste check reconnected and logged a warning every 250 ms. egui's own text paste into fields goes through smithay-clipboard and works either way. - **Clipboard owners that never answer (#510):** reading the clipboard waits on the app that owns it: arboard gives up on an X11 owner after 4 s, and a Wayland read waits for the owner to send its data. So on Linux the check that enables the Paste menu items runs on a background thread with a second clipboard handle (`crates/ui-egui/src/clipboard_probe.rs`, installed as `Services::clipboard_probe`), only while nothing is copied in the app and a document is open, and the window keeps drawing. A paste itself still reads on the UI thread, so pasting from such an owner waits for it once. Windows and macOS keep the check on the UI thread: Windows only asks which formats the clipboard holds, macOS asks the pasteboard server. - **Copied files:** files copied in a file manager (`text/uri-list`; `CF_HDROP` on Windows, file URLs on macOS) paste as the first one that is art (SVG, PDF, EPS, EMF/WMF or a bitmap; a `.ai` or `.ait` file from the editing data it holds, else as the PDF or PostScript it holds), before the clipboard's other formats (which include the files' paths as text). - **Dropping files on the window does not work under Wayland:** winit 0.30, which eframe 0.37 runs on, has no Wayland drag and drop ([winit#1881](https://github.com/rust-windowing/winit/issues/1881), added in winit 0.31; [egui#1563](https://github.com/emilk/egui/issues/1563)), so no `dropped_files` arrive. Until eframe moves to winit 0.31: copy the files in the file manager and paste them, use File › Place or Open, or open the window through XWayland, where drops work: set **Preferences › Performance › Linux Display Server** to **X11 (XWayland)** and restart (#1151), or start the app with `WAYLAND_DISPLAY= vectorcraft`. The preference (`linuxDisplayServer`, read at startup in `apps/vectorcraft/src/main.rs`, shown on Linux only) has winit open the window on X11 (`EventLoopBuilderExtX11::with_x11`) when the session is Wayland, `DISPLAY` is set and the X11 libraries winit loads are installed (`apps/vectorcraft/src/xwayland.rs` reads `ldconfig -p` and the usual library directories); otherwise the window opens on Wayland and the log says why. Unlike clearing `WAYLAND_DISPLAY`, it leaves the clipboard on the compositor's own. @@ -493,6 +494,7 @@ Scores and hour estimates are unchanged. | Date | Change | Summary | |---|---|---| +| 2026-10-29 | minor | Linux clipboard: core Wayland protocol text fallback where arboard has neither data-control nor X11 (the Flatpak on GNOME). | | 2026-10-29 | minor | Linux clipboard: a clipboard arboard can't open is retried after 1 s doubling to 60 s and logged once, instead of every 250 ms. | | 2026-10-28 | minor | Localisation: Catalan (`ca`) catalog and registry entry (every `ca-*` locale); complete under the catalog tests. | | 2026-10-25 | minor | Linux Wayland drag-and-drop note names eframe 0.37 (still on winit 0.30); behavior unchanged. | diff --git a/docs/gaps.md b/docs/gaps.md index 8816d7209c..2c3df02c12 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -178,8 +178,8 @@ from G14 and the budget run of G15: **~170–270 h** one agent, ~50–80 h wall - **Unconfirmed (2026-10-14):** Tool cursors are painted into the window on Wayland (#1652; not run on Linux, #1645 stays open until confirmed). On Windows the custom title bar's window stays truly borderless, so the pointer lines up with what is drawn on systems where the hidden caption offset it (#1791, #1758; awaiting the reporter's confirmation). - **Done:** RPM required dependencies use 64-bit library capabilities and declare glibc 2.35, libm and libgcc_s (#1275); generated metadata and isolated synthetic-provider checks cover x86_64/aarch64. Real-distribution install/start-up QA is still missing. -- **Done (2026-10-29):** the Linux Flatpak on GNOME no longer reconnects to the compositor and logs a warning every 250 ms when arboard has neither data-control nor X11 (267k warnings in 18 h filled the 16 MB log in 3 h): a clipboard that can't be opened is retried with a wait growing to a minute and logged once. Copy and Paste with other apps still don't work there. -- **Missing:** the app not starting or staying in the background on some Windows 11 machines (#858, #964 fixed +- **Done (2026-10-29):** the Linux Flatpak on GNOME no longer reconnects to the compositor and logs a warning every 250 ms when arboard has neither data-control nor X11 (267k warnings in 18 h filled the 16 MB log in 3 h): a clipboard that can't be opened is retried with a wait growing to a minute and logged once. Copy and Paste of text with other apps work there through the core Wayland protocol. +- **Missing:** pictures (`image/png`) and SVG as `image/svg+xml` on the clipboard of the Flatpak on GNOME, where only text travels (smithay-clipboard 0.7 carries text only); the app not starting or staying in the background on some Windows 11 machines (#858, #964 fixed 2026-10-10, #620, #818), slow pointer on a Linux AppImage (#575), macOS paste from other apps (#954), a web-free crash/hang reporter, a field record. - **Evidence:** open issues; the never-crash lints and `guard` stop panics, not driver, windowing or packaging @@ -655,6 +655,7 @@ trap, and the defaults (0.25 pt, 100%, 40%) are VectorCraft's own, the pages giv |---|---|---| | 2026-10-30 | minor | G1: Object › Path › Average & Join… (`path.averageJoin`, Cmd+Alt+Shift+J) moves two open path ends to their midpoint and joins them there, the joined anchor a corner or a smooth point as its dialog's Points choice asks, in one undo step; the "Average and Join in one step" entry is done. Estimate unchanged | | 2026-10-30 | minor | G12: Preferences audit (#394): 5 options are stored but not acted on (Open Documents As Tabs, Units › East Asian Type, Hyphenation › Default Language, Scratch Disks, Legacy vector clipboard), each waiting on a subsystem; Highlight Alternate Glyphs, Real-time Drawing and the Devices options act. Estimate unchanged. | +| 2026-10-29 | minor | G10: the Linux Flatpak on GNOME copies and pastes text through the core Wayland protocol; pictures and `image/svg+xml` there listed as missing. Estimate unchanged. | | 2026-10-29 | minor | G10: the Linux Flatpak on GNOME stops the clipboard retry storm (retried with a growing wait, logged once). Estimate unchanged. | | 2026-10-29 | minor | G12: Pathfinder: live compound shapes (#4522): the panel menu's Make, Release and Expand Compound Shape, Alt-clicking a Shape Mode, a selected member's Shape Mode and the Expand button act. No entry closed, estimates unchanged. | | 2026-10-29 | minor | G8: a blend makes at most 100,000 steps in all, the steps of blends nested in its keys and steps included; past it each pair of keys keeps the same share of its steps (#3579). No entry closed, estimates unchanged. | From 7a86f942821efd1aaeab35101ccc61187809a707 Mon Sep 17 00:00:00 2001 From: wjrichards Date: Thu, 29 Oct 2026 15:42:33 -0400 Subject: [PATCH 013/227] Linux clipboard: a Wayland core-protocol read waits 2 s at most smithay-clipboard's load() waits for the selection owner's data with no limit, and Paste and the "is the clipboard still ours" check read on the UI thread, so an owner that never sends its data froze the window. Reads now run on a worker thread with a second clipboard on the window's connection and are waited for 2 s at most. While a read that timed out is unanswered, later reads return at once instead of queueing behind it, and its late answer is dropped. Co-Authored-By: Claude Opus 5.5 --- apps/vectorcraft/src/clipboard.rs | 136 ++++++++++++++++++++++++++++-- docs/development.md | 4 +- 2 files changed, 129 insertions(+), 11 deletions(-) diff --git a/apps/vectorcraft/src/clipboard.rs b/apps/vectorcraft/src/clipboard.rs index 9494749589..7a45f42e81 100644 --- a/apps/vectorcraft/src/clipboard.rs +++ b/apps/vectorcraft/src/clipboard.rs @@ -757,37 +757,155 @@ mod portable { /// window's own Wayland connection: what Copy and Paste use where the compositor lacks the /// data-control protocol arboard needs (GNOME) and there is no X11 to fall back on (the Flatpak on /// a Wayland session). Text only (smithay-clipboard), and only while the window has focus, as the -/// protocol has it. +/// protocol has it. A read waits [`LOAD_WAIT`] at most: smithay-clipboard waits for the owner's +/// data with no limit, so reads run on a worker of their own. #[cfg(target_os = "linux")] mod wayland { use std::sync::Arc; + use std::sync::mpsc; + use std::time::Duration; + + /// The longest a read waits for the selection's owner to send its text. + const LOAD_WAIT: Duration = Duration::from_secs(2); + /// What a read says once its worker has stopped. + const GONE: &str = "the clipboard's reader stopped"; pub struct TextClipboard { + /// Writes: a store only hands the text to smithay-clipboard's thread. + cb: smithay_clipboard::Clipboard, + /// Reads, on a worker with a second clipboard on the same connection. + loads: Loads, + /// Held as long as the clipboards: their connection is the window's. + _window: Arc, + } + + /// The read worker's clipboard and the window whose connection it uses, dropped in that order. + struct Loader { cb: smithay_clipboard::Clipboard, - /// Held as long as the clipboard: its connection is the window's. _window: Arc, } impl TextClipboard { - /// None when `window` isn't a Wayland window. + /// None when `window` isn't a Wayland window or the read worker can't start. #[allow(unsafe_code)] pub fn new(window: Arc) -> Option { use winit::raw_window_handle::{HasDisplayHandle as _, RawDisplayHandle}; let RawDisplayHandle::Wayland(d) = window.display_handle().ok()?.as_raw() else { return None }; - // SAFETY: the display is winit's open `wl_display`, which outlives `window` (held beside - // the clipboard); smithay-clipboard makes its own event queue on it and doesn't close it. - let cb = unsafe { smithay_clipboard::Clipboard::new(d.display.as_ptr()) }; - Some(Self { cb, _window: window }) + let display = d.display.as_ptr(); + // SAFETY: the display is winit's open `wl_display`, which outlives `window`; each + // clipboard is held beside a clone of `window` and dropped before it. smithay-clipboard + // makes its own event queue on the display and doesn't close it. + let (cb, reader) = unsafe { (smithay_clipboard::Clipboard::new(display), smithay_clipboard::Clipboard::new(display)) }; + let loader = Loader { cb: reader, _window: window.clone() }; + let loads = Loads::spawn(move || loader.cb.load().map_err(|e| e.to_string()))?; + Some(Self { cb, loads, _window: window }) } - pub fn get_text(&self) -> Result { - self.cb.load().map_err(|e| e.to_string()) + pub fn get_text(&mut self) -> Result { + self.loads.get(LOAD_WAIT) } pub fn set_text(&self, text: &str) { self.cb.store(text); } } + + /// Reads made on a worker thread and waited for a bounded time: a selection owner that never + /// sends its data holds the worker, not the caller. + struct Loads { + requests: mpsc::Sender<()>, + answers: mpsc::Receiver>, + /// A read that timed out and hasn't answered yet: until it does, reads don't queue behind it. + pending: bool, + } + + impl Loads { + fn spawn(mut load: impl FnMut() -> Result + Send + 'static) -> Option { + let (requests, asked) = mpsc::channel::<()>(); + let (answer, answers) = mpsc::channel(); + let work = move || { + while asked.recv().is_ok() { + if answer.send(load()).is_err() { + break; + } + } + }; + std::thread::Builder::new().name("wayland-clipboard-read".into()).spawn(work).ok()?; + Some(Self { requests, answers, pending: false }) + } + + /// The text, or why there is none, after `wait` at most. + fn get(&mut self, wait: Duration) -> Result { + if self.pending { + match self.answers.try_recv() { + // The late answer of the read that timed out: stale by now. + Ok(_) => self.pending = false, + Err(mpsc::TryRecvError::Empty) => return Err("the clipboard's owner hasn't answered an earlier read".into()), + Err(mpsc::TryRecvError::Disconnected) => return Err(GONE.into()), + } + } + self.requests.send(()).map_err(|_| GONE.to_string())?; + match self.answers.recv_timeout(wait) { + Ok(text) => text, + Err(mpsc::RecvTimeoutError::Timeout) => { + self.pending = true; + Err(format!("the clipboard's owner didn't send its text within {wait:?}")) + } + Err(mpsc::RecvTimeoutError::Disconnected) => Err(GONE.into()), + } + } + } + + #[cfg(test)] + mod tests { + use std::time::Instant; + + use super::*; + + #[test] + fn a_read_that_answers_in_time_gives_the_text() { + let mut loads = Loads::spawn(|| Ok("".into())).unwrap(); + assert_eq!(loads.get(Duration::from_secs(5)), Ok("".to_string())); + assert_eq!(loads.get(Duration::from_secs(5)), Ok("".to_string())); + } + + #[test] + fn an_owner_that_never_answers_holds_the_worker_not_the_caller() { + let (release, gate) = mpsc::channel::<()>(); + let mut calls = 0; + let mut loads = Loads::spawn(move || { + calls += 1; + if calls == 1 { + // The first owner sends nothing until released. + let _ = gate.recv(); + return Ok("stale".into()); + } + Ok("fresh".into()) + }) + .unwrap(); + let start = Instant::now(); + assert!(loads.get(Duration::from_millis(50)).is_err(), "the first read times out"); + // While it is unanswered, a read doesn't queue behind it or wait at all. + assert!(loads.get(Duration::from_secs(60)).is_err()); + assert!(start.elapsed() < Duration::from_secs(30), "no read waited past its bound"); + release.send(()).unwrap(); + // Once the late answer is in, it is dropped and a new read is made. + let text = (0..200).find_map(|_| { + std::thread::sleep(Duration::from_millis(10)); + loads.get(Duration::from_secs(5)).ok() + }); + assert_eq!(text.as_deref(), Some("fresh")); + } + + #[test] + fn a_read_after_the_worker_stops_says_so() { + let mut loads = Loads::spawn(|| Ok(String::new())).unwrap(); + // The worker ends when its answers can't be sent: drop them by hand. + let (_, dead) = mpsc::channel(); + drop(std::mem::replace(&mut loads.answers, dead)); + assert_eq!(loads.get(Duration::from_millis(50)), Err(GONE.to_string())); + } + } } /// The macOS pasteboard's vector art and bitmaps as they are (arboard reads text, and of the diff --git a/docs/development.md b/docs/development.md index 28ca418319..261dde457c 100644 --- a/docs/development.md +++ b/docs/development.md @@ -115,7 +115,7 @@ On GNOME/Wayland, enable **Preferences › User Interface › System Title Bar** The window runs natively on Wayland (eframe's `wayland` feature) and on X11. On machines with two GPUs it renders on the one the desktop runs on unless Preferences say otherwise; see [Desktop graphics processor](#desktop-graphics-processor) (#502). The system clipboard (`apps/vectorcraft/src/clipboard.rs`) is arboard with its `wayland-data-control` feature: -- **Clipboard:** under Wayland arboard talks to the compositor through the data-control protocol (wlroots compositors such as Sway and Hyprland, KDE Plasma), so bitmaps (`image/png`), SVG markup and text copied in any app paste (#398). Where the compositor lacks the protocol (GNOME's Mutter, [arboard#223](https://github.com/1Password/arboard/issues/223)), arboard falls back to the X11 clipboard through XWayland, which only holds what X11 apps copied. Where there is no X11 either (the Flatpak on a Wayland session: `--socket=fallback-x11` gives it none), Copy and Paste use the compositor's core data-device protocol on the window's own connection through smithay-clipboard: text only (a copy's text or its SVG markup), and only while the window has focus. A clipboard neither backend opens is tried again after 1 s, doubling to a minute (a Copy or Paste of the user's at most once a second), and logged once when it goes and once when it comes back: before, the background Paste check reconnected and logged a warning every 250 ms. egui's own text paste into fields goes through smithay-clipboard and works either way. +- **Clipboard:** under Wayland arboard talks to the compositor through the data-control protocol (wlroots compositors such as Sway and Hyprland, KDE Plasma), so bitmaps (`image/png`), SVG markup and text copied in any app paste (#398). Where the compositor lacks the protocol (GNOME's Mutter, [arboard#223](https://github.com/1Password/arboard/issues/223)), arboard falls back to the X11 clipboard through XWayland, which only holds what X11 apps copied. Where there is no X11 either (the Flatpak on a Wayland session: `--socket=fallback-x11` gives it none), Copy and Paste use the compositor's core data-device protocol on the window's own connection through smithay-clipboard: text only (a copy's text or its SVG markup), and only while the window has focus. smithay-clipboard waits for the owner's data with no limit, so its reads run on a worker thread and a Paste waits 2 s at most: an owner that never sends its data costs one Paste 2 s, and later reads return at once until it answers. A clipboard neither backend opens is tried again after 1 s, doubling to a minute (a Copy or Paste of the user's at most once a second), and logged once when it goes and once when it comes back: before, the background Paste check reconnected and logged a warning every 250 ms. egui's own text paste into fields goes through smithay-clipboard and works either way. - **Clipboard owners that never answer (#510):** reading the clipboard waits on the app that owns it: arboard gives up on an X11 owner after 4 s, and a Wayland read waits for the owner to send its data. So on Linux the check that enables the Paste menu items runs on a background thread with a second clipboard handle (`crates/ui-egui/src/clipboard_probe.rs`, installed as `Services::clipboard_probe`), only while nothing is copied in the app and a document is open, and the window keeps drawing. A paste itself still reads on the UI thread, so pasting from such an owner waits for it once. Windows and macOS keep the check on the UI thread: Windows only asks which formats the clipboard holds, macOS asks the pasteboard server. - **Copied files:** files copied in a file manager (`text/uri-list`; `CF_HDROP` on Windows, file URLs on macOS) paste as the first one that is art (SVG, PDF, EPS, EMF/WMF or a bitmap; a `.ai` or `.ait` file from the editing data it holds, else as the PDF or PostScript it holds), before the clipboard's other formats (which include the files' paths as text). - **Dropping files on the window does not work under Wayland:** winit 0.30, which eframe 0.37 runs on, has no Wayland drag and drop ([winit#1881](https://github.com/rust-windowing/winit/issues/1881), added in winit 0.31; [egui#1563](https://github.com/emilk/egui/issues/1563)), so no `dropped_files` arrive. Until eframe moves to winit 0.31: copy the files in the file manager and paste them, use File › Place or Open, or open the window through XWayland, where drops work: set **Preferences › Performance › Linux Display Server** to **X11 (XWayland)** and restart (#1151), or start the app with `WAYLAND_DISPLAY= vectorcraft`. The preference (`linuxDisplayServer`, read at startup in `apps/vectorcraft/src/main.rs`, shown on Linux only) has winit open the window on X11 (`EventLoopBuilderExtX11::with_x11`) when the session is Wayland, `DISPLAY` is set and the X11 libraries winit loads are installed (`apps/vectorcraft/src/xwayland.rs` reads `ldconfig -p` and the usual library directories); otherwise the window opens on Wayland and the log says why. Unlike clearing `WAYLAND_DISPLAY`, it leaves the clipboard on the compositor's own. @@ -494,7 +494,7 @@ Scores and hour estimates are unchanged. | Date | Change | Summary | |---|---|---| -| 2026-10-29 | minor | Linux clipboard: core Wayland protocol text fallback where arboard has neither data-control nor X11 (the Flatpak on GNOME). | +| 2026-10-29 | minor | Linux clipboard: core Wayland protocol text fallback where arboard has neither data-control nor X11 (the Flatpak on GNOME).; its reads wait 2 s at most. | | 2026-10-29 | minor | Linux clipboard: a clipboard arboard can't open is retried after 1 s doubling to 60 s and logged once, instead of every 250 ms. | | 2026-10-28 | minor | Localisation: Catalan (`ca`) catalog and registry entry (every `ca-*` locale); complete under the catalog tests. | | 2026-10-25 | minor | Linux Wayland drag-and-drop note names eframe 0.37 (still on winit 0.30); behavior unchanged. | From 9b3b662f5dc2c8bac93dd1429a6d7a166549c3f4 Mon Sep 17 00:00:00 2001 From: wjrichards Date: Thu, 29 Oct 2026 15:54:32 -0400 Subject: [PATCH 014/227] Linux clipboard: the read worker holds the window as long as its clipboard The worker's closure named loader.cb, and a closure moves only the fields it names, so the worker's window clone was dropped when TextClipboard::new returned. A worker held by an owner that never answers could then outlive the window. The closure now calls Loader::load, which moves the whole Loader. Co-Authored-By: Claude Opus 5.5 --- apps/vectorcraft/src/clipboard.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/vectorcraft/src/clipboard.rs b/apps/vectorcraft/src/clipboard.rs index 7a45f42e81..aafb42b9be 100644 --- a/apps/vectorcraft/src/clipboard.rs +++ b/apps/vectorcraft/src/clipboard.rs @@ -785,6 +785,12 @@ mod wayland { _window: Arc, } + impl Loader { + fn load(&self) -> Result { + self.cb.load().map_err(|e| e.to_string()) + } + } + impl TextClipboard { /// None when `window` isn't a Wayland window or the read worker can't start. #[allow(unsafe_code)] @@ -797,7 +803,9 @@ mod wayland { // makes its own event queue on the display and doesn't close it. let (cb, reader) = unsafe { (smithay_clipboard::Clipboard::new(display), smithay_clipboard::Clipboard::new(display)) }; let loader = Loader { cb: reader, _window: window.clone() }; - let loads = Loads::spawn(move || loader.cb.load().map_err(|e| e.to_string()))?; + // `loader.load()`, not `loader.cb.load()`: a closure moves only the fields it names, + // and the worker must hold the window as long as its clipboard. + let loads = Loads::spawn(move || loader.load())?; Some(Self { cb, loads, _window: window }) } From 89b673a8263e938a87d046a622f1585fbd334b06 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 16:42:08 +0700 Subject: [PATCH 015/227] Draw Inside marks the corners of the object it draws into (#4319) --- crates/ui-egui/src/canvas.rs | 3 +- crates/ui-egui/src/canvas/overlays.rs | 21 ++++++++++++++ crates/ui-egui/src/canvas/tests.rs | 42 +++++++++++++++++++++++++++ docs/target-app-parity.md | 5 ++-- docs/ui-parity.md | 4 ++- 5 files changed, 71 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 4482a12838..bb6a3d6d54 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -58,7 +58,7 @@ use outline::KEY_OUTLINE; use outline::{OVERLAY_MAX_ANCHORS, c32, node_outline, walk_drawn}; #[cfg(test)] use overlays::selected_anchor; -use overlays::{HandleLook, draw_overlays, hover_highlight, ime_geometry, selection_overlay}; +use overlays::{HandleLook, draw_inside_overlay, draw_overlays, hover_highlight, ime_geometry, selection_overlay}; pub(crate) use raster::color_image; use raster::{changed_pixels, pixel_region, upload}; use task_bar::task_bar; @@ -792,6 +792,7 @@ fn selection_visuals( hover_highlight(app, painter, xf); } selection_overlay(app, painter, xf, overlays.iter().any(|o| matches!(o, Overlay::CurvePoint { .. }))); + draw_inside_overlay(app, painter, xf); mirror_axis_overlay(app, painter, xf); grid_repeat_overlay(app, painter, xf); if app.ui.view.text_threads { diff --git a/crates/ui-egui/src/canvas/overlays.rs b/crates/ui-egui/src/canvas/overlays.rs index 704745f8aa..4f7e832588 100644 --- a/crates/ui-egui/src/canvas/overlays.rs +++ b/crates/ui-egui/src/canvas/overlays.rs @@ -24,6 +24,27 @@ pub(super) fn hover_highlight(app: &VectorcraftApp, p: &egui::Painter, xf: &Xf) } } +/// Draw Inside (Shift+D): while the mode lasts, a dotted open rectangle round the corners of the +/// object drawn into, selected or not (#4319). +pub(super) fn draw_inside_overlay(app: &VectorcraftApp, p: &egui::Painter, xf: &Xf) { + if app.session.draw_mode != vectorcraft_engine::DrawMode::Inside { + return; + } + let (Some(id), Some(st)) = (app.session.draw_inside, app.session.active()) else { return }; + let Some(bounds) = st.doc.node(id).and_then(|n| n.visual_bounds()) else { return }; + // A few pixels outside the object, clear of its stroke. + let pad = 4.0 / xf.zoom; + let [a, b, c, d] = xf.quad(bounds.inflate(pad, pad))[..] else { return }; + let stroke = Stroke::new(1.0, c32(st.doc.layer_color(id))); + for (corner, sides) in [(a, [b, d]), (b, [c, a]), (c, [d, b]), (d, [a, c])] { + for next in sides { + // Each arm runs a third of its side at most, so the rectangle stays open. + let arm = ((next - corner).length() / 3.0).min(16.0); + p.extend(Shape::dashed_line(&[corner, corner + (next - corner).normalized() * arm], stroke, 3.0, 2.0)); + } + } +} + /// Selected anchors are drawn slightly deeper than the layer colour (#4f80ff → #3d82ff for Layer 1). pub(super) fn selected_anchor(c: Color32) -> Color32 { if c == Color32::from_rgb(0x4f, 0x80, 0xff) { Color32::from_rgb(0x3d, 0x82, 0xff) } else { c } diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index ca95ad72aa..f0c5e6d388 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -7937,3 +7937,45 @@ fn text_threads_skip_the_links_of_a_frame_in_perspective() { // One thread line (c to d) and its two arrows of three strokes each. assert_eq!(o.iter().filter(|x| matches!(x, Overlay::Line { .. })).count(), 7); } + +/// #4319: Draw Inside marks the object it draws into with a dotted open rectangle round its +/// corners while the mode lasts, selected or not, and the marks go with the mode. +#[test] +fn draw_inside_marks_the_corners_of_its_object() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + let id = + vectorcraft_doc::NodeId(app.run("shape.rectangle", json!({"x": 100, "y": 100, "width": 120, "height": 90})).unwrap()["id"].as_u64().unwrap()); + let ctx = egui::Context::default(); + let color = c32(app.session.active().unwrap().doc.layer_color(id)); + // The marks' dashes: one-pixel dashes in the layer colour no longer than a dash. + let dashes = |app: &mut VectorcraftApp| -> Vec<[Pos2; 2]> { + shapes(app, &ctx) + .into_iter() + .filter_map(|s| match s { + Shape::LineSegment { points, stroke } if stroke.color == color && stroke.width == 1.0 && points[0].distance(points[1]) <= 3.01 => { + Some(points) + } + _ => None, + }) + .collect() + }; + let normal = dashes(&mut app).len(); + app.run("view.drawMode", json!({"mode": "inside"})).unwrap(); + let marks = dashes(&mut app); + // Eight arms of 16 px, each four dashes of 3 px with 2 px gaps. + assert_eq!(marks.len() - normal, 32, "{marks:?}"); + let xf = Xf::new(app.canvas_rect.unwrap(), app.view().unwrap()); + let b = app.session.active().unwrap().doc.node(id).unwrap().visual_bounds().unwrap(); + let corner = xf.to_screen(Point::new(b.x0, b.y0)) - vec2(4.0, 4.0); + assert!(marks.iter().any(|m| m[0].distance(corner) < 2.0), "a mark starts at the padded top-left corner"); + // Deselected, the object is still marked. + app.run("select.set", json!({"ids": []})).unwrap(); + assert_eq!(dashes(&mut app).len(), marks.len()); + // Rotated, the arms follow the object's turned sides. + app.view_mut().unwrap().rotation = 30.0; + assert_eq!(dashes(&mut app).len(), marks.len()); + app.view_mut().unwrap().rotation = 0.0; + app.run("view.drawMode", json!({"mode": "normal"})).unwrap(); + assert_eq!(dashes(&mut app).len(), normal); +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 43dc705965..f5a3ea0a4d 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Effects: bounded effect length inputs clamp on commit and reject invalid text visibly (#4638)) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Draw Inside marks the corners of the object it draws into (#4319); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -666,7 +666,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Compound paths:** Make keeps the backmost object's appearance and each contour; selecting a member in Direct Selection reads and changes the compound's fill rule in Attributes. Direction remains a per-member edit. Rendered holes, unchanged contour geometry, no-op history and Undo/Redo are covered by `engine/tests/it/compound_attributes.rs` (#1197). Behaviour reference: [public compound-path documentation](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/create-compound-paths.html). Make Compound Path on a group (such as outlined type) keeps the paint of its backmost path instead of drawing nothing, and compound paths joined into one keep their holes (#1537). - **Saved selections:** Select ▸ Save Selection… asks for a name and keeps the selection in the document (saved with the file, undoable, up to 25); each one is listed at the bottom of the Select menu and a click selects its objects again; Edit Selection… lists them to rename or delete, applied together on OK. A file's saved selections are capped and checked against its objects when it opens. Select ▸ Update Selection replaces the objects of the saved selection last recalled with the selected objects, in one undo step that marks the document changed (`select.update`). After Edit Selection… renames that saved selection, Update Selection replaces it under the new name; after Edit Selection… deletes it, Update Selection is disabled until another saved selection is recalled or the delete is undone. Undo and Redo do not change which saved selection is recalled. - - **Drawing modes:** in Draw Inside, a double-click with a selection tool outside the object being drawn into sets the drawing mode to Draw Normal, as Shift+D does. Pastes follow the drawing mode ([drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html)) (#3705): in Draw Inside, Paste, Paste in Place and Paste on All Artboards put the copies inside the object drawn into, in one undo step, Paste Remembers Layers aside; in Draw Behind, Paste in Place and Paste on All Artboards put them just below the selection; Paste in Front and Paste in Back ignore the mode. Shift+D cycles Draw Normal → Draw Behind → Draw Inside → Draw Normal, skipping Draw Inside unless one path, compound path or type is selected. With the object drawn into isolated (a double-click on it with the Selection tool), art drawn or pasted inside it takes isolation mode into its clip group, so it can be clicked and isn't dimmed, as art added in isolation mode belongs with what is isolated ([isolation mode](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/isolate-objects.html)) (#3705); undo or redo that removes the isolated object ends isolation mode. + - **Drawing modes:** in Draw Inside, a double-click with a selection tool outside the object being drawn into sets the drawing mode to Draw Normal, as Shift+D does. Pastes follow the drawing mode ([drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html)) (#3705): in Draw Inside, Paste, Paste in Place and Paste on All Artboards put the copies inside the object drawn into, in one undo step, Paste Remembers Layers aside; in Draw Behind, Paste in Place and Paste on All Artboards put them just below the selection; Paste in Front and Paste in Back ignore the mode. Shift+D cycles Draw Normal → Draw Behind → Draw Inside → Draw Normal, skipping Draw Inside unless one path, compound path or type is selected. With the object drawn into isolated (a double-click on it with the Selection tool), art drawn or pasted inside it takes isolation mode into its clip group, so it can be clicked and isn't dimmed, as art added in isolation mode belongs with what is isolated ([isolation mode](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/isolate-objects.html)) (#3705); undo or redo that removes the isolated object ends isolation mode. While Draw Inside lasts, a dotted open rectangle marks the corners of the object drawn into (#4319). - **Drawing:** Pen, Curvature, anchor tools, Pencil, Paintbrush, Blob Brush, Smooth, Path Eraser, Join. Direction handles dragged with Direct Selection or the Anchor Point tool snap to smart guides, and Shift keeps them at 45° steps from their anchor. The Pen continues any open path from the end clicked, and while drawing, a click on an end of another open path joins the two into one (#776). The Curvature tool edits any selected path, whatever drew it, keeping its shape except where edited (#798): a click on a point makes it current and a drag moves it, re-curving only its two segments; Alt-click or double-click toggles it smooth or corner and Delete removes it; a click on a segment adds a point without changing the shape; with an end of an open path current, clicks go on from it and its other end closes it (`path.curvatureEdit`). Every point a drawing tool places snaps to Smart Guides through one snapper (#506): the Pen's and Curvature tool's anchors, the Pencil's ends, the shape tools' start and dragged corner or radius (Rectangle, Rounded Rectangle, Ellipse, Polygon, Star, Line Segment, Arc, Spiral, the grids), the Type tool's click and frame, a new artboard's corners. A filled Pencil path keeps a stroke of None (#1804, part of #1679). While a Pencil or Paintbrush stroke is drawn back to within Close Paths When Ends Are Within of its start, the cursor shows the closing ring and a release there closes the path, as [Draw straight lines with the Pencil tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-straight-lines-with-the-pencil-tool.html) describes for the Pencil. The [ and ] keys reach the Blob Brush, the Eraser and the Symbolism tools in the app (#1734, part of #1661). Blob Brush and Eraser Tool Options' Size is Fixed or Pressure with a Variation (#4590, #3961): with Pressure a pen stroke is Size − Variation wide where it presses lightest and Size + Variation where it presses hardest, and a mouse stroke keeps the Size. With the Blob Brush, Shift held during a drag keeps the stroke on the horizontal or vertical line through the press point, whichever is nearer to the pointer (90° steps from the Constrain Angle preference), and the points dragged since Shift went down move to the other line when the pointer crosses to it; the points dragged while Shift is up follow the pointer. @@ -1260,6 +1260,7 @@ undo step, with any adjustment and its params; bad requests refused) and `addons | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Draw Inside marks the corners of the object it draws into (#4319); scores and estimates unchanged | | 2026-10-30 | minor | Smart Pen add-on (a VectorCraft addition): evidence added; scores unchanged. | | 2026-10-30 | minor | Path Precision Tools add-on (a VectorCraft addition): evidence added; scores unchanged. | | 2026-10-30 | minor | Color Effects, a built-in add-on beyond Illustrator; scores and estimates unchanged | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 05876d8039..dfdf3885b0 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Smart Pen add-on: its tool, panel and Object › Plug-ins submenu; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Draw Inside marks the corners of the object it draws into (#4319); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -101,6 +101,7 @@ tools, never checked side by side) isn't captured row by row. | Simplify (slider, auto, corner angle threshold), of a whole path or of the part of it selected with Direct Selection ([manually simplify paths](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/manually-simplify-paths.html)) | done | Tolerance, default-on Preview and original/new point counts (#1272); Corner Point Angle Threshold, Convert to Straight Lines and Show Original Path; the slider under the selection with Auto-Simplify and More Options, opening at the Auto-Simplify level for the selection with that result previewed, and the dialog's option to open it directly with its last settings. With anchors or segments direct-selected, the slider, Auto-Simplify and the dialog refit only each run of selected segments between its end anchors, a closed path's run across its start point included; the rest of the path stays exactly as it was (`tests/simplify_part.rs`, `simplify_slider_and_dialog_simplify_only_the_direct_selected_part_of_a_path`) | | Smooth (Object › Path › Smooth…: slider from minimum to maximum smoothing, Auto-Smooth) ([smooth slider](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/refine-path-segments-with-the-smooth-slider.html)) | done | #4115: the slider under the selection previews `object.path.smooth {level}`, Auto-Smooth picks level 50, Enter or a click outside keeps one undo step and Escape restores; the smoothing rule beyond the two ends is VectorCraft's own (`tests/smooth_path.rs`, `smooth_slider_previews_auto_smooth_and_keeps_the_result`) | | Draw Inside in isolation mode: art drawn or pasted inside the isolated object takes isolation mode into its clip group, clickable and undimmed ([isolation mode](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/isolate-objects.html), [drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html)) | done | #3705; `drawing_inside_an_isolated_object_keeps_the_new_art_in_isolation_mode` | +| Draw Inside marks the object it draws into: a dotted open rectangle round its corners, in its layer's colour, while the mode lasts, selected or not | done | #4319, `canvas::tests::draw_inside_marks_the_corners_of_its_object` ([drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html)) | | Simplify (slider, auto, corner angle threshold) | partial | Tolerance, default-on Preview and original/new point counts (#1272); Corner Point Angle Threshold, Convert to Straight Lines and Show Original Path; the slider under the selection with Auto-Simplify and More Options, and the dialog's option to open it directly with its last settings; the slider opens at 1 pt rather than at the Auto-Simplify level, and simplifying only a Direct Selection part of a path remains missing | | Simplify (slider, auto, corner angle threshold) | partial | Tolerance, default-on Preview and original/new point counts (#1272); Corner Point Angle Threshold, Convert to Straight Lines and Show Original Path; the slider under the selection with Auto-Simplify and More Options, opening at the Auto-Simplify level for the selection with that result previewed, and the dialog's option to open it directly with its last settings; simplifying only a Direct Selection part of a path remains missing | @@ -365,6 +366,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Draw Inside marks the corners of the object it draws into (#4319); scores and estimates unchanged | | 2026-10-30 | minor | Smart Pen add-on (a VectorCraft addition): its tool, panel and Object › Plug-ins › Smart Pen; scores and estimates unchanged | | 2026-10-30 | minor | Path Precision Tools add-on (a VectorCraft addition): its tools, Anchor Inspector panel and Object › Plug-ins › Path Precision Tools; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: its effects, panel and Object › Plug-ins submenu; scores and estimates unchanged | From 9646feb67266e73febe91d6f040f392f17def568 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 16:56:12 +0700 Subject: [PATCH 016/227] Contextual Task Bar: stays up through a click on another object, hides only for a drag (#4681) Squashed from #4692 onto main. --- crates/ui-egui/src/canvas.rs | 5 ++++- crates/ui-egui/src/canvas/tests.rs | 33 ++++++++++++++++++++++++++++++ docs/target-app-parity.md | 4 +++- docs/ui-parity.md | 3 ++- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index bb6a3d6d54..8fafaf86c2 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -329,7 +329,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } // The task bar is not drawn while the Simplify or Smooth slider shows. let strip = crate::dialogs::simplify_slider::showing(app) || crate::dialogs::smooth_slider::showing(app); - if app.ui.task_bar && !revolve_edit && !app.session.tool_busy() && app.ui.screen_mode < 3 && !strip { + // It gives way to a drag, not to a click: hidden for the length of every press, it flashed as + // each click picked another object (#4681). + let dragging = app.session.tool_busy() && ui.input(|i| i.pointer.is_decidedly_dragging()); + if app.ui.task_bar && !revolve_edit && !dragging && app.ui.screen_mode < 3 && !strip { task_bar(app, ui, &xf); } if app.ui.screen_mode < 3 { diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index f0c5e6d388..b5efc127db 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -7979,3 +7979,36 @@ fn draw_inside_marks_the_corners_of_its_object() { app.run("view.drawMode", json!({"mode": "normal"})).unwrap(); assert_eq!(dashes(&mut app).len(), normal); } + +/// #4681: a click on another object moves the Contextual Task Bar to it without hiding it for the +/// press (it flashed); a drag hides it until the drag ends. +#[test] +fn the_task_bar_stays_up_through_a_click_and_gives_way_to_a_drag() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + app.run("shape.rectangle", json!({"x": 40, "y": 60, "width": 60, "height": 60})).unwrap(); + app.run("shape.rectangle", json!({"x": 260, "y": 60, "width": 60, "height": 60})).unwrap(); + app.select_tool("selection"); + let ctx = egui::Context::default(); + for _ in 0..30 { + frame(&mut app, &ctx, vec![]); + } + let first = task_bar_rect(&ctx).expect("the task bar shows under the second rectangle"); + let xf = Xf::new(app.canvas_rect.unwrap(), app.view().unwrap()); + let at = xf.to_screen(Point::new(70.0, 90.0)); + let button = |pos, pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(at), button(at, true)]); + frame(&mut app, &ctx, vec![]); + assert!(app.session.tool_busy(), "the press is under way"); + let pressed = task_bar_rect(&ctx).expect("the task bar stays up through the press"); + assert!(pressed.center().x < first.center().x - 50.0, "it moved under the rectangle pressed: {pressed:?} from {first:?}"); + // Dragged, it gives way until the drag ends. + let to = at + vec2(40.0, 30.0); + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(at + vec2(20.0, 15.0))]); + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(to)]); + frame(&mut app, &ctx, vec![]); + assert!(task_bar_rect(&ctx).is_none(), "hidden while the object is dragged"); + frame(&mut app, &ctx, vec![button(to, false)]); + frame(&mut app, &ctx, vec![]); + assert!(task_bar_rect(&ctx).is_some(), "back once the drag ends"); +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index f5a3ea0a4d..733a8b7cc9 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Draw Inside marks the corners of the object it draws into (#4319); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -562,6 +562,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Numeric fields keep the pointer's pressed character as the text-drag start when movement exceeds the click threshold (#1326, in part); a completed focus click selects the unit too. Pixel/point, plain and optional fields are regression-tested in both directions, before/after focus, with replacement text; keyboard focus, double-click, arrows and wheel keep their prior behavior. Native egui input confirms partial replacement gives 17 px instead of 700 px, one Undo/Redo, window captures and an exact saved-document read in a separate CLI process. Short movements still counted as clicks can select all; that case remains open. - Unit fields and length strings take `%` in arithmetic: `3cm*50%` reads as 1.5 cm, and `50pt+25%` reads as 62.5 pt. - The contextual task bar's handle drags it anywhere on the canvas (kept whole on it as the window resizes); unpinned it keeps that offset as it follows the selection, and its More Options menu hides it, pins its position across selection changes (`window.taskBar.pin`), resets it under the selection (`window.taskBar.reset`) and shows the Properties panel. As in Illustrator the position isn't kept across launches. Not done: the bar's variants for other tools (only the selection tools and the Artboard tool show it). + - A click on another object moves the contextual task bar under it without hiding it for the press; it gives way only to a drag (#4681). - With one image selected, the contextual task bar offers Image Trace, which traces the image at once with the Default preset (the Image Trace panel is left as it was), and Crop Image; with an Image Trace object it offers Expand, which keeps only the traced paths. This follows Illustrator's bar: for a selected image it includes Image Trace, Retype and Crop Image, and traced artwork can be expanded from it ([Contextual Task Bar announcement](https://community.adobe.com/announcements-651/contextual-task-bar-in-illustrator-2025-quick-actions-when-you-need-them-1546580)). Offset Path and Simplify, which don't apply to an image, aren't offered for one. Not done: Retype, which the app doesn't have. - With the Artboard tool, the contextual task bar sits under the selected artboards and offers Resize (Artboard Options for the active artboard), Duplicate (each selected artboard, in one undo step, the copies then selected), Rearrange All (with two or more artboards) and Export (Export for Screens with the selected artboards checked). This follows Illustrator's bar: while the Artboard tool is in use, it has options for resizing, duplicating and exporting artboards (the [Contextual Task Bar announcement](https://community.adobe.com/questions-652/contextual-task-bar-in-illustrator-2025-quick-actions-when-you-need-them-1546580); Rearrange and Export on the bar: [Managing Artboards in Illustrator](https://creativepro.com/managing-artboards-in-illustrator/)). - The contextual task bar offers more next steps by selection (): an open path Join and Edit Path (the Direct Selection tool), a closed path Edit Path, a compound path Edit Path and Release Compound Path, a clipping group Edit Clipping Path and Release Clipping Mask instead of Ungroup and Isolate, an image selected with vector art Make Clipping Mask instead of Unite, and point or area type Convert To Area Type or Convert To Point Type beside Create Outlines. Evidence: `crates/ui-egui/src/tests/taskbar.rs`. @@ -1260,6 +1261,7 @@ undo step, with any adjustment and its params; bad requests refused) and `addons | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores and estimates unchanged | | 2026-10-30 | minor | Draw Inside marks the corners of the object it draws into (#4319); scores and estimates unchanged | | 2026-10-30 | minor | Smart Pen add-on (a VectorCraft addition): evidence added; scores unchanged. | | 2026-10-30 | minor | Path Precision Tools add-on (a VectorCraft addition): evidence added; scores unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index dfdf3885b0..3255659c36 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Draw Inside marks the corners of the object it draws into (#4319); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -366,6 +366,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores and estimates unchanged | | 2026-10-30 | minor | Draw Inside marks the corners of the object it draws into (#4319); scores and estimates unchanged | | 2026-10-30 | minor | Smart Pen add-on (a VectorCraft addition): its tool, panel and Object › Plug-ins › Smart Pen; scores and estimates unchanged | | 2026-10-30 | minor | Path Precision Tools add-on (a VectorCraft addition): its tools, Anchor Inspector panel and Object › Plug-ins › Path Precision Tools; scores and estimates unchanged | From f36dad59b3a0d4dab17352456acb6b714b14f401 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 11:26:22 +0700 Subject: [PATCH 017/227] Place: a photo's EXIF orientation turns it upright (#4284) --- crates/engine/src/cmd/fileio/load.rs | 19 +++++++++++++++-- crates/engine/src/cmd/fileio/tests.rs | 30 +++++++++++++++++++++++++++ crates/engine/src/cmd/links.rs | 6 +++++- 3 files changed, 52 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/cmd/fileio/load.rs b/crates/engine/src/cmd/fileio/load.rs index c1ebdf7233..2c0c7eb733 100644 --- a/crates/engine/src/cmd/fileio/load.rs +++ b/crates/engine/src/cmd/fileio/load.rs @@ -602,7 +602,11 @@ pub fn raster_image(bytes: &[u8]) -> Result { reader.limits(limits); let kind = reader.format().ok_or_else(|| err("not an image VectorCraft reads (see document.formats)"))?; let f = image_format(kind).ok_or_else(|| err(format!("{kind:?} images can't be opened (see document.formats)")))?; + // A photo whose EXIF orientation turns or flips it (a camera held upright) is stored as it is + // seen, so it places the way it was taken (#4284); the others keep their own bytes. + let turned = matches!(f.id, "png" | "jpg" | "gif" | "webp" | "tiff") && exif_orientation(bytes).is_some(); let kept = match f.id { + _ if turned => None, "png" | "jpg" | "gif" | "webp" => Some(bytes.to_vec()), "tiff" => vectorcraft_doc::cmyk::stored_cmyk_tiff(bytes, ppi), _ => None, @@ -621,13 +625,16 @@ pub fn raster_image(bytes: &[u8]) -> Result { Some(read) => read.map_err(err)?, None => { use image::ImageDecoder as _; - let decoder = reader.into_decoder().map_err(err)?; + let mut decoder = reader.into_decoder().map_err(err)?; // The allowance counts the decoded samples and the RGBA pixels they become (#1717). let (w, h) = decoder.dimensions(); if decoder.total_bytes() > MAX_RASTER_ALLOC || u64::from(w) * u64::from(h) * 4 > MAX_RASTER_ALLOC { return Err(err(format!("an image of {w} × {h} pixels is too large to draw"))); } - image::DynamicImage::from_decoder(decoder).map_err(err)?.to_rgba8() + let orientation = decoder.orientation().unwrap_or(image::metadata::Orientation::NoTransforms); + let mut img = image::DynamicImage::from_decoder(decoder).map_err(err)?; + img.apply_orientation(orientation); + img.to_rgba8() } }, }; @@ -637,6 +644,14 @@ pub fn raster_image(bytes: &[u8]) -> Result { as_png(img, ppi) } +/// The EXIF orientation of encoded image `bytes` when it turns or flips the pixels; `None` when +/// it leaves them as stored, or the image has none. +pub(crate) fn exif_orientation(bytes: &[u8]) -> Option { + use image::ImageDecoder as _; + let mut decoder = image::ImageReader::new(Cursor::new(bytes)).with_guessed_format().ok()?.into_decoder().ok()?; + decoder.orientation().ok().filter(|o| *o != image::metadata::Orientation::NoTransforms) +} + /// `img` stored as a PNG that keeps the file's resolution. fn as_png(img: image::RgbaImage, ppi: Option<(f64, f64)>) -> Result { let size = img.dimensions(); diff --git a/crates/engine/src/cmd/fileio/tests.rs b/crates/engine/src/cmd/fileio/tests.rs index f2b770682e..f781a87b5d 100644 --- a/crates/engine/src/cmd/fileio/tests.rs +++ b/crates/engine/src/cmd/fileio/tests.rs @@ -837,3 +837,33 @@ fn a_failed_save_does_not_stamp_the_documents_dates() { s.execute("edit.undo", &json!({})).unwrap(); assert!(!s.doc().unwrap().is_dirty()); } + +/// #4284: a photo whose EXIF orientation says the camera was turned places upright: its pixels +/// turned as the orientation says, its width and height swapped. One without keeps its own bytes. +#[test] +fn a_photo_places_the_way_its_exif_orientation_says() { + // 16 × 8, red on the left half. + let mut rgb = image::RgbImage::from_pixel(16, 8, image::Rgb([255, 255, 255])); + for y in 0..8 { + for x in 0..8 { + rgb.put_pixel(x, y, image::Rgb([220, 0, 0])); + } + } + let mut jpg = Vec::new(); + image::DynamicImage::ImageRgb8(rgb).write_to(&mut Cursor::new(&mut jpg), image::ImageFormat::Jpeg).unwrap(); + // An EXIF segment with Orientation 6: turn a quarter clockwise to show. + let exif: Vec = + [b"Exif\0\0".as_slice(), b"II", &[0x2a, 0, 8, 0, 0, 0], &[1, 0], &[0x12, 0x01, 3, 0, 1, 0, 0, 0, 6, 0, 0, 0], &[0, 0, 0, 0]].concat(); + let mut turned = jpg[..2].to_vec(); + turned.extend([0xff, 0xe1]); + turned.extend(u16::try_from(exif.len() + 2).unwrap().to_be_bytes()); + turned.extend(&exif); + turned.extend(&jpg[2..]); + let plain = raster_image(&jpg).unwrap(); + assert_eq!((plain.width, plain.height, plain.blob.bytes.as_slice()), (16, 8, jpg.as_slice()), "a photo as taken keeps its bytes"); + let img = raster_image(&turned).unwrap(); + assert_eq!((img.width, img.height), (8, 16), "turned a quarter"); + let px = image::load_from_memory(&img.blob.bytes).unwrap().to_rgb8(); + let red = |p: &image::Rgb| p[0] > 150 && p[1] < 80; + assert!(red(px.get_pixel(4, 3)) && !red(px.get_pixel(4, 12)), "the left half is on top"); +} diff --git a/crates/engine/src/cmd/links.rs b/crates/engine/src/cmd/links.rs index 42aafc21d5..c0aacef935 100644 --- a/crates/engine/src/cmd/links.rs +++ b/crates/engine/src/cmd/links.rs @@ -374,7 +374,11 @@ pub(crate) fn full_linked_images<'a>(d: &'a Document, doc_path: Option<&str>) -> continue; }; let preview = d.images.get(&key).map(|b| b.bytes.clone()); - let mime = fileio::format_for_name(g.link.name()).map(|f| f.mime.to_string()).unwrap_or_else(|| img.blob.mime.clone()); + // A file read as it is keeps its own type; one turned upright (EXIF orientation) is the PNG it became. + let mime = match fileio::format_for_name(g.link.name()) { + Some(f) if img.blob.bytes.as_slice() == bytes.as_slice() => f.mime.to_string(), + _ => img.blob.mime.clone(), + }; out.images.insert(key, ImageBlob { mime, bytes: img.blob.bytes, proxy: preview }); } let mut warnings = vec![]; From 0d891b9cb4bc05b5c7c14cd2a0efc02850137650 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 16:59:20 +0700 Subject: [PATCH 018/227] Docs: EXIF orientation on Place (#4284) --- docs/target-app-parity.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 733a8b7cc9..7d72a952c3 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Place: a photo's EXIF orientation turns it upright (#4284); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -1047,6 +1047,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - A Word paragraph justified with a low, medium or high kashida length places justified with Insert Kashidas set to Short, Medium or Long (`file.place`, `crates/engine/src/tests/textimport.rs`). - On the desktop, File › Place reads and decodes files off the UI thread, one at a time, and places each once it is read, with "Placing" in the status bar and the busy spinner until then: the Place dialog's OK, a file dropped on the canvas, a click or drag of the place cursor, and the OK of the PDF, DXF and text import options. The files and thumbnails the place cursor is loaded with are read the same way, and the Place dialog's lines about its files are read on a thread of their own. Files are placed in the order they were started; a file is not placed while a dialog is open or a drag is under way, and a file whose document was closed meanwhile is not placed. `file.place` and `file.place.queue` over MCP and scripts reply as before. - The pixels of a PNG, JPEG, GIF or WebP file that Place decodes to check them are kept in the image store the renderers share, so the canvas's first frame with the placed image draws them without decoding the file again on the UI thread: File › Place, a file dropped on the canvas, a click or drag of the place cursor, `file.place`, and Paste of such an image. A CMYK JPEG is still decoded when it is first drawn (`crates/ui-egui/src/placing.rs`, `crates/render/src/tests.rs`). + - A photo whose EXIF orientation turns or flips it (a camera held upright or upside down) is placed and opened upright, as it was taken; the image is stored as it is seen (#4284). - File › Place and a file dropped on the canvas refuse a PNG, JPEG, GIF or WebP file whose pixels can't be read, such as one cut short by a download or a sync still running, and the status bar shows "Couldn't place : the image's pixels can't be read". Paste and Relink refuse such an image too, and Update Links, or Open when it reads the file again, counts it as missing. A JPEG cut short still places when its pixels can be decoded (`file.place`, `crates/engine/src/tests_place.rs`). - On the desktop, Copy and Cut make the system clipboard's formats (text, SVG, PDF, PNG) from a copy of the clipboard on the thread that writes background saves and exports, and write them when they are ready; while that thread has a save, an export, a print or a recovery copy to finish, they are made and written at once. Until they are written, Paste in VectorCraft takes the internal clipboard, and while a text field or the Type tool has the keyboard the app waits for them. Another Copy or Cut, or a copy of text in VectorCraft, drops them. - On the desktop with Enable Background Export on (Preferences › File Handling), File › Package… collects the linked files and fonts and writes the package from the document as it was at OK on the thread that writes background saves and exports, with "Packaging" in the status bar and the busy spinner until it is written; a save of unsaved changes that Package starts is written first. `file.package` over MCP and scripts replies as before. @@ -1261,6 +1262,7 @@ undo step, with any adjustment and its params; bad requests refused) and `addons | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Place: a photo's EXIF orientation turns it upright (#4284); scores and estimates unchanged | | 2026-10-30 | minor | Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores and estimates unchanged | | 2026-10-30 | minor | Draw Inside marks the corners of the object it draws into (#4319); scores and estimates unchanged | | 2026-10-30 | minor | Smart Pen add-on (a VectorCraft addition): evidence added; scores unchanged. | From ad1bb39d62140521746212028d0b797218f60896 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 17:15:48 +0700 Subject: [PATCH 019/227] =?UTF-8?q?View=20=E2=80=BA=20Hide=20Artboards=20h?= =?UTF-8?q?ides=20their=20edges=20and=20shows=20the=20canvas=20as=20paper?= =?UTF-8?q?=20(#4038)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Squashed from #4694 onto main. --- crates/ui-egui/src/canvas.rs | 15 ++++++++++++++- crates/ui-egui/src/canvas/tests.rs | 26 ++++++++++++++++++++++++++ docs/ui-parity.md | 4 +++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 8fafaf86c2..837d374a25 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -649,7 +649,11 @@ fn paint_paper(app: &VectorcraftApp, ui: &Ui, painter: &egui::Painter, xf: &Xf, // on, the canvas multiplies it with the paper color: each sRGB channel is artboard × paper / 255, // rounded. The transparency grid, while it shows, covers it as it covers the others. painter.rect_filled(rect, 0.0, t.pasteboard); - if app.ui.view.artboards && !app.ui.view.outline { + if !shows_artboards(app) { + // View › Hide Artboards: no edges and no pasteboard, the whole canvas paper (#4038). + let setup = &doc.setup; + painter.rect_filled(rect, 0.0, if setup.simulate_paper { crate::panels::c32(&setup.paper()) } else { Color32::WHITE }); + } else if !app.ui.view.outline { let setup = &doc.setup; let grid = (st.transparency_grid && setup.background == vectorcraft_doc::Background::Transparent).then(|| checker_texture(ui.ctx(), setup)); let paper = if setup.simulate_paper { crate::panels::c32(&setup.paper()) } else { Color32::WHITE }; @@ -712,8 +716,17 @@ fn reproject_frame(app: &VectorcraftApp, painter: &egui::Painter, xf: &Xf, rect: } } +/// Do the artboards show? View › Hide Artboards hides them, except for the Artboard tool, which +/// edits them. +fn shows_artboards(app: &VectorcraftApp) -> bool { + app.ui.view.artboards || app.session.tool_id() == "artboard" +} + /// The artboards' edges, bleeds, marks and names. fn artboard_outlines(app: &VectorcraftApp, ui: &Ui, painter: &egui::Painter, xf: &Xf, t: &Tokens) { + if !shows_artboards(app) { + return; + } let Some(st) = app.session.active() else { return }; let doc = &st.doc; // Artboard edges and names. The Artboard tool labels its selected artboards itself (following diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index b5efc127db..721094bd31 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -8012,3 +8012,29 @@ fn the_task_bar_stays_up_through_a_click_and_gives_way_to_a_drag() { frame(&mut app, &ctx, vec![]); assert!(task_bar_rect(&ctx).is_some(), "back once the drag ends"); } + +/// #4038: View › Hide Artboards leaves no artboard edges and shows the whole canvas as paper; +/// the Artboard tool still shows them. +#[test] +fn hidden_artboards_leave_a_paper_canvas_without_edges() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + let ctx = egui::Context::default(); + let look = |app: &mut VectorcraftApp| { + let shapes = shapes(app, &ctx); + let canvas = app.canvas_rect.unwrap(); + let paper = shapes.iter().any(|s| matches!(s, Shape::Rect(r) if r.fill == Color32::WHITE && r.rect.contains_rect(canvas))); + let edge = + shapes.iter().any(|s| matches!(s, Shape::Path(p) if p.closed && p.stroke.color == egui::epaint::ColorMode::Solid(Color32::from_gray(0)))); + (paper, edge) + }; + assert_eq!(look(&mut app), (false, true), "shown: an edge, the pasteboard round it"); + app.run("view.artboards", json!({})).unwrap(); + assert!(!app.ui.view.artboards); + assert_eq!(look(&mut app), (true, false), "hidden: paper everywhere, no edge"); + app.select_tool("artboard"); + assert!(look(&mut app).1, "the Artboard tool shows them"); + app.select_tool("selection"); + app.run("view.artboards", json!({})).unwrap(); + assert_eq!(look(&mut app), (false, true)); +} diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 3255659c36..866849a534 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (View › Hide Artboards hides their edges and shows the canvas as paper (#4038); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -232,6 +232,7 @@ tools, never checked side by side) isn't captured row by row. | Artboard Options: X and Y beside a reference point locator, counted from the ruler origin; a typed X or Y moves the artboard's reference point there, a new Width or Height keeps it in place | done | #1876; as the Transform panel's and the Control bar's artboard X and Y, with the locator they and Properties share; the shape dialogs' X and Y (the click position) stay hidden. Pointer and key tests in `dialogs/tests.rs` | | Artboard Options shares existing presets/orientation and drafts artwork or selected-art fitting until OK | done | Fit changes only the active artboard and preserves artwork positions; Cancel leaves the document unchanged; newer multi-artboard behavior retained; fitting after draft resizing uses all drawn document artwork and document/revision-scoped bounds; selected art may span boards | | Artboard Options › Display: Show Center Mark and Show Cross Hairs ([public source](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/modify-display-settings-of-artboards.html)) | done | Per-artboard checkboxes (`artboard.setProps`/`artboard.new` `showCenterMark`, `showCrossHairs`, one undo step); the canvas draws a cross 12 points across on screen at the center and lines from the middle of each side through it, 1 point wide on screen at any zoom and turned with the view; exports and print leave them out; tests `an_artboard_shows_its_center_mark_and_cross_hairs`, `artboard_options_show_center_mark_and_cross_hairs` | +| View › Hide Artboards (Ctrl/Cmd+Shift+H) hides the artboards' edges, bleeds, marks and names and shows the whole canvas as paper (white, or Simulate Colored Paper's colour); the Artboard tool still shows them | done | #4038, `canvas::tests::hidden_artboards_leave_a_paper_canvas_without_edges` | | Artboard Options › Display: Show Video Safe Areas and Video Ruler Pixel Aspect Ratio ([public source](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/organize-manage-artboards/set-video-display-options-for-artboards.html)) | done | #2849; per artboard (`artboard.setProps`/`artboard.new` `showVideoSafeAreas`, `videoRulerPixelAspectRatio` 0.1–10, default 1; one undo step; native format). The page gives no safe-area numbers: our choice is [EBU R 95](https://tech.ebu.ch/docs/r/r095.pdf)'s, the action-safe area 3.5% and the title-safe area 5% in from each edge, outlined 1 point wide on the canvas and turned with the view; exports and print leave them out. Tests `an_artboard_shows_its_video_safe_areas`, `artboard_options_show_video_display_options`, `artboard_video_display_options_*` | | Shape tools: Shift constrains, Alt from centre, Space moves while dragging, arrows change sides/points/rows | done | | | Polygon/Star exact-size placement remembers the chosen sides/points for later drags and dialog openings; Cancel preserves the previous count | done | Session tool options; existing dialog-opening gestures retained; regression in `toolbar.rs` | @@ -366,6 +367,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | View › Hide Artboards hides their edges and shows the canvas as paper (#4038); scores and estimates unchanged | | 2026-10-30 | minor | Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores and estimates unchanged | | 2026-10-30 | minor | Draw Inside marks the corners of the object it draws into (#4319); scores and estimates unchanged | | 2026-10-30 | minor | Smart Pen add-on (a VectorCraft addition): its tool, panel and Object › Plug-ins › Smart Pen; scores and estimates unchanged | From 70512352bfee000c6094b3b04753c5bcb1af7c30 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 17:21:01 +0700 Subject: [PATCH 020/227] Full Screen and Presentation Mode fill the screen (#4365) --- crates/ui-egui/src/app.rs | 2 ++ crates/ui-egui/src/chrome.rs | 17 +++++++++++++++++ crates/ui-egui/src/chrome/tests.rs | 30 ++++++++++++++++++++++++++++++ crates/ui-egui/src/lib.rs | 3 +++ docs/target-app-parity.md | 4 +++- 5 files changed, 55 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 6e2527fb68..dcaab8e90e 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -103,6 +103,7 @@ impl VectorcraftApp { hover_doc: None, custom_titlebar: false, last_window_title: String::new(), + fullscreen_for_mode: false, graphics_adapter: None, place: Default::default(), system_paste: false, @@ -337,6 +338,7 @@ impl VectorcraftApp { // The OS title bar (and the taskbar / Alt-Tab entry) follows the active file; with the // system title bar this is where the document name lives, as the in-app mark is hidden. crate::chrome::sync_window_title(self, ctx); + crate::chrome::sync_fullscreen(self, ctx); self.drain_control(ctx); // An egui `PasteImage` with a rich system clipboard: run the paste command now, once. It // goes through `run`, whose `edit.paste` branch calls `adopt_system_clipboard` (which clears diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index b453cc6858..dea0bd3a49 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -160,6 +160,23 @@ pub fn sync_window_title(app: &mut VectorcraftApp, ctx: &egui::Context) { } } +/// Full Screen Mode and Presentation Mode fill the screen (#4365: the taskbar and the window's +/// frame stayed): the window goes full screen when one of them starts, and back when a mode with +/// the menu bar returns. A window that was full screen already stays so. +pub fn sync_fullscreen(app: &mut VectorcraftApp, ctx: &egui::Context) { + let want = app.ui.screen_mode >= 2; + let is = ctx.input(|i| i.viewport().fullscreen.unwrap_or(false)); + if want && !is && !app.fullscreen_for_mode { + ctx.send_viewport_cmd(egui::ViewportCommand::Fullscreen(true)); + app.fullscreen_for_mode = true; + } else if !want && app.fullscreen_for_mode { + if is { + ctx.send_viewport_cmd(egui::ViewportCommand::Fullscreen(false)); + } + app.fullscreen_for_mode = false; + } +} + #[cfg(test)] mod tests; diff --git a/crates/ui-egui/src/chrome/tests.rs b/crates/ui-egui/src/chrome/tests.rs index 929034a72b..929b5a8a8e 100644 --- a/crates/ui-egui/src/chrome/tests.rs +++ b/crates/ui-egui/src/chrome/tests.rs @@ -1603,3 +1603,33 @@ fn artboard_close_active_tab_properties_delete_uses_shown_board() { close_b_tab(&mut app, &ctx, &base); delete_shown_board(&mut app, &ctx, &base); } + +/// #4365: Full Screen and Presentation Mode put the window full screen once, and Normal Screen +/// Mode takes it back out; a window already full screen is left as it is. +#[test] +fn full_screen_modes_fill_the_screen_and_normal_mode_restores_the_window() { + let mut app = title_test_app(true); + let ctx = egui::Context::default(); + let sent = |app: &mut crate::VectorcraftApp, fullscreen: bool| -> Vec { + let mut input = egui::RawInput::default(); + input.viewports.entry(egui::ViewportId::ROOT).or_default().fullscreen = Some(fullscreen); + let mut out = ctx.run_ui(input, |ui| super::sync_fullscreen(app, ui.ctx())); + out.textures_delta.clear(); + let cmds = out.viewport_output.remove(&egui::ViewportId::ROOT).map(|v| v.commands).unwrap_or_default(); + cmds.iter().filter_map(|c| if let egui::ViewportCommand::Fullscreen(f) = c { Some(*f) } else { None }).collect() + }; + assert!(sent(&mut app, false).is_empty(), "Normal Screen Mode"); + app.ui.screen_mode = 3; + assert_eq!(sent(&mut app, false), [true], "Presentation Mode"); + assert!(sent(&mut app, true).is_empty(), "once"); + app.ui.screen_mode = 2; + assert!(sent(&mut app, true).is_empty(), "Full Screen Mode keeps it"); + app.ui.screen_mode = 0; + assert_eq!(sent(&mut app, true), [false], "back to a window"); + assert!(sent(&mut app, false).is_empty()); + // Full screen by the user's own choice: the modes leave it so. + app.ui.screen_mode = 3; + assert!(sent(&mut app, true).is_empty()); + app.ui.screen_mode = 0; + assert!(sent(&mut app, true).is_empty(), "still full screen, as the user had it"); +} diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 27551cae20..cafbbfb6d0 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -185,6 +185,9 @@ pub struct VectorcraftApp { /// Last window title sent to the OS (`ViewportCommand::Title`, see `chrome::sync_window_title`): /// sent again only when it changes, so idle frames don't spam the backend. pub(crate) last_window_title: String, + /// Whether a screen mode put the window full screen (`chrome::sync_fullscreen`), so Normal + /// Screen Mode takes it back out, and leaves a window the user made full screen as it is. + pub(crate) fullscreen_for_mode: bool, /// The graphics adapter the window renders with ("name (backend)"), as the host reports it: /// shown in Help › About and `ui.inspect` for GPU bug reports. `None` when unknown. pub graphics_adapter: Option, diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 7d72a952c3..8eda7169de 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Place: a photo's EXIF orientation turns it upright (#4284); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Full Screen and Presentation Mode fill the screen (#4365); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -763,6 +763,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Rotated views:** with the view rotated, Fit Artboard in Window, Fit All in Window and the status bar's artboard navigator fit the artboard or the art as the view turns it, and a Zoom tool marquee (Animated Zoom or GPU Performance off) zooms to the area dragged across. Ruler guides on no artboard turn with the view. The canvas draws the selection marquee where the tools select, Show Hidden Characters draws the marks of type partly inside the canvas, the Contextual Task Bar stays under the selection, and the Navigator's red box outlines what the window shows. - **Views:** the status bar's artboard navigator (first, previous, next, last; `view.goToArtboard`) goes to an artboard, fits it and synchronizes the Artboard tool selection when that tool is active; ordinary object selection is preserved. Actual Next-button regressions cover keyboard/Properties deletion and Undo in `chrome.rs`. Fit Artboard in Window and Actual Size show the navigator's artboard. The Artboards panel highlights that active artboard: clicking a row makes it active (the Artboard tool's too, while it is chosen) as does clicking an artboard with the Artboard tool, double-clicking its number also fits it in the window and double-clicking its name renames it. Duplicate Artboards, or a row dragged onto New Artboard, copies the artboard with its art (#446). Escape leaves Presentation Mode, `view.screenMode` from it goes back to Normal Screen Mode, and the screen mode isn't saved with the preferences: the app always starts in Normal Screen Mode with its menus and panels (#472). View › Pixel Preview shows the art as the document pixels it rasterizes to, one per point and hard-edged when magnified, turning with a rotated view (it used to draw the smooth vectors, with only the pixel grid over them). In Outline view a template layer keeps drawing in Preview, dimmed, so a picture placed to be traced stays visible under the outlines (#1505, fixes #1486). In Presentation Mode, → and ← go to the next and the previous artboard, and a click anywhere goes to the next one, as the status bar navigator's Next and Previous do (`view.goToArtboard`): on the last artboard → and a click leave the view as it is, and so does ← on the first. The arrow keys do not move the selection there, and the tool does not receive a click, so a click selects and draws nothing (behavior reference: [View artwork](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)). + Full Screen Mode and Presentation Mode put the window full screen, covering the taskbar and the window's frame, and Normal Screen Mode or Full Screen Mode with Menu Bar puts it back (#4365); a window the user made full screen stays so. In Presentation Mode no key press other than ←, → and Escape runs a command or reaches the tool (tool keys, Delete, Enter, Tab, F, Shift+F and every command shortcut, the macOS menu bar's key equivalents included), a right click or a long touch opens no context menu, a tap of two or three fingers undoes or redoes nothing, and the pointer over the canvas is the default one instead of the tool's cursor. Align to Artboard uses the active artboard, the one the Artboards panel highlights (`object.align {artboard}`). A press with a selection tool inside an artboard makes that artboard active; with the Selection tool, a Shift-click on an empty spot inside an artboard makes it active and keeps the selection. One selected object is aligned to the active artboard too, whatever Align To says (a lone object is never the key object). When an action plays, its Align to Artboard, All on Active Artboard, Paste in Place, Paste in Front and Paste in Back steps that name no artboard use the artboard that is active then. With the Artboard tool in use, a Shift-click on a row of the Artboards panel selects the artboards from the last row clicked without Shift to the clicked row, and the clicked row's artboard becomes the active one. When the artboard of the last row clicked without Shift is no longer selected, the range starts from the active artboard, and later Shift-clicks start from there too. A Ctrl/Cmd-click still adds or removes one artboard. A Shift-click used to add or remove one artboard as well. The public [Select artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/select-artboards.html) page lists Shift-click in the Artboards panel for selecting several artboards. @@ -1262,6 +1263,7 @@ undo step, with any adjustment and its params; bad requests refused) and `addons | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Full Screen and Presentation Mode fill the screen (#4365); scores and estimates unchanged | | 2026-10-30 | minor | Place: a photo's EXIF orientation turns it upright (#4284); scores and estimates unchanged | | 2026-10-30 | minor | Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores and estimates unchanged | | 2026-10-30 | minor | Draw Inside marks the corners of the object it draws into (#4319); scores and estimates unchanged | From 9ec7805e544d51a46b762dadae63eab746a15aec Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 17:44:28 +0700 Subject: [PATCH 021/227] Gradient stop popover: an eyedropper samples the stop's colour from the art (#4681) --- crates/ui-egui/src/dialogs/gradient_stop.rs | 12 +++++++ crates/ui-egui/src/panels/gradient.rs | 2 +- crates/ui-egui/src/panels/gradient/tests.rs | 39 +++++++++++++++++++++ docs/target-app-parity.md | 4 ++- 4 files changed, 55 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/dialogs/gradient_stop.rs b/crates/ui-egui/src/dialogs/gradient_stop.rs index b188ad2651..42e66f258b 100644 --- a/crates/ui-egui/src/dialogs/gradient_stop.rs +++ b/crates/ui-egui/src/dialogs/gradient_stop.rs @@ -102,6 +102,7 @@ fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { }); let swatches = d.str("tab") == "swatches"; let mut tab = None; + let mut eyedropper = false; let resp = egui::Area::new(area) .order(egui::Order::Foreground) .fixed_pos(pos) @@ -115,6 +116,12 @@ fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { tab = Some(if icon == "palette" { "color" } else { "swatches" }); } } + // A stop's colour can come from the art, as from the Gradient panel's eyedropper. + if matches!(target, Target::Stop(..)) + && widgets::icon_button(ui, "pipette", tl!("Eyedropper: click the art to sample the stop's colour"), false, 24.0).clicked() + { + eyedropper = true; + } }); ui.add_space(6.0); if swatches { @@ -141,6 +148,11 @@ fn show(app: &mut VectorcraftApp, ctx: &egui::Context) { }); }) .response; + if eyedropper { + app.ui.dialog = None; + crate::panels::gradient::stop_eyedropper(app); + return; + } // The frame it opened in (its first drawn). let frame = ctx.cumulative_frame_nr(); let opened = d.fields.get(OPENED).and_then(Value::as_u64).unwrap_or(frame); diff --git a/crates/ui-egui/src/panels/gradient.rs b/crates/ui-egui/src/panels/gradient.rs index 91c3fa8899..7fa3926b9d 100644 --- a/crates/ui-egui/src/panels/gradient.rs +++ b/crates/ui-egui/src/panels/gradient.rs @@ -572,7 +572,7 @@ fn stop_fields(app: &mut VectorcraftApp, ui: &mut Ui, g: &Gradient, is_grad: boo /// The stop's eyedropper: the Eyedropper tool samples the next colour clicked on the art into the /// selected stop, then hands back to the current tool. -fn stop_eyedropper(app: &mut VectorcraftApp) { +pub(crate) fn stop_eyedropper(app: &mut VectorcraftApp) { let back = app.session.tool_id(); app.select_tool("eyedropper"); app.session.set_tool_option("stop", &json!(back)); diff --git a/crates/ui-egui/src/panels/gradient/tests.rs b/crates/ui-egui/src/panels/gradient/tests.rs index 3f25812130..0a1f601148 100644 --- a/crates/ui-egui/src/panels/gradient/tests.rs +++ b/crates/ui-egui/src/panels/gradient/tests.rs @@ -540,3 +540,42 @@ fn angle_and_aspect_fields_are_named() { let _ = h.get_by_role_and_label(egui::accesskit::Role::TextInput, "Angle"); let _ = h.get_by_role_and_label(egui::accesskit::Role::TextInput, "Aspect Ratio"); } + +/// #4681: the stop popover the annotator opens has the eyedropper too: it closes the popover and +/// arms the Eyedropper for the stop. A freeform gradient's point has none. +#[test] +fn the_stop_popover_has_an_eyedropper_for_a_stop() { + use egui_kittest::kittest::Queryable; + const TIP: &str = "Eyedropper: click the art to sample the stop's colour"; + let harness = |app: VectorcraftApp| { + let mut fonts = false; + egui_kittest::Harness::builder().with_size(egui::vec2(800.0, 700.0)).with_accessibility_check(false).build_ui_state( + move |ui, app: &mut VectorcraftApp| { + if !std::mem::replace(&mut fonts, true) { + crate::theme::install_fonts(ui.ctx()); + return; + } + crate::dialogs::show(app, ui.ctx()); + }, + app, + ) + }; + let mut app = app(json!({"gradient": {}})); + app.select_tool("gradient"); + app.run("gradient.selectStop", json!({"index": 1})).unwrap(); + app.ui.dialog = Some(crate::state::Dialog::new("gradientStop", json!({"index": 1, "screen": [100.0, 100.0], "tab": "color"}))); + let mut h = harness(app); + h.run_steps(3); + h.get_by_label(TIP).click(); + h.run_steps(2); + let app = h.state(); + assert!(app.ui.dialog.is_none(), "the popover closed"); + assert_eq!((app.session.tool_id(), app.session.tool_options()["stop"].clone()), ("eyedropper", json!("gradient"))); + + let mut app = super::tests::app(json!({"gradient": {"kind": "freeform"}})); + app.select_tool("gradient"); + app.ui.dialog = Some(crate::state::Dialog::new("gradientStop", json!({"index": 0, "screen": [100.0, 100.0], "tab": "color"}))); + let mut h = harness(app); + h.run_steps(3); + assert!(h.query_by_label(TIP).is_none(), "no eyedropper for a freeform point"); +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 8eda7169de..3042edc3d6 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Full Screen and Presentation Mode fill the screen (#4365); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Gradient stop popover: an eyedropper samples the stop's colour from the art (#4681); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -922,6 +922,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Sample Color from Screen:** an eyedropper button in the Color Picker and `ui.sampleScreenColor` (which can be given a key in Keyboard Shortcuts) pick a color anywhere on the screen with the system's sampler: `NSColorSampler` on macOS, the EyeDropper API in browsers that have it. The color becomes the fill or the stroke as one undo step, or the Color Picker's color, converted from display sRGB into the working RGB space. Windows, Linux and other browsers have no sampler yet; the button is gray there. - **Stroke visibility (#1253):** adding paint to a previously unpainted zero-width stroke restores the existing 1 pt default (`PaintDefaults::default`, `Appearance::set_stroke`), for the selected appearance item, the new-art defaults and Swap Fill/Stroke. Positive widths are kept; recoloring a painted zero-width stroke keeps its explicit zero. A real Eyedropper-to-new-shape sequence reproduces the zero-width inheritance. Five engine regressions cover creation, defaults, targeted items, preserved widths and one-step Undo/Redo (`crates/engine/tests/it/stroke_visibility.rs`). - **Gradients:** lossless, validated gradient params; gradients follow rotate, reflect, shear, non-uniform scale and distortions; the Gradient tool edits the fill or stroke of the active proxy, type included; an interactive on-canvas annotator (move, length/angle, rotate, add/move/delete/duplicate stops, midpoints, a stop popover, Delete and arrow keys). The Gradient panel has the Fill/Stroke proxy, a gradient-swatch dropdown with Save to Swatches, midpoint locations, Alt-drag to copy or swap stops, swatch drops on the ramp and a stop eyedropper; copied appearances and graphic styles place gradients on each target's own bounds; gradient handles snap and honour Constrain Angle. Gradient stops stay linked to global and spot swatches. Freeform gradients (points and lines) are edited on the canvas; radial gradients have an extent ellipse, an aspect handle and an off-centre focal point (SVG `fx`/`fy`, PDF two-point radials). A stroke's gradient runs within, along or across it. Object ▸ Expand turns gradients into N objects or a gradient mesh. + - The stop popover a double-click on a stop opens (the Gradient tool's annotator or the Gradient panel) has an eyedropper beside its Color and Swatches tabs: it closes the popover and samples the next colour clicked on the art into the stop, as the Gradient panel's eyedropper does (#4681). Cmd/Ctrl-click on the Gradient panel's Gradient Fill box or on the Tools panel's Gradient button resets the gradient of the active Fill or Stroke to the linear White, Black gradient, as one undo step ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)). With a gradient stop or a freeform gradient point selected, Alt-clicking a color swatch in the Swatches panel recolors it instead of the inactive Fill or Stroke. - **Freeform gradient colors in their own model:** Object ▸ Expand and Object ▸ Create Gradient Mesh (`object.mesh.create`) mix a freeform gradient's points in the color model they share: points of C50 M20 Y0 K10 give mesh points of C50 M20 Y0 K10, and RGB points keep their values in a working RGB space other than sRGB. Points in different models mix in display RGB, and a CMYK document stores the result as CMYK through the color settings. Points colored along CMYK stops (`paint.editGradient {stops}`, or a CMYK gradient switched to freeform) are CMYK, and so are a point `paint.freeform.splitLine` adds between CMYK points and a point `paint.freeform.addPoint` adds without `color` to CMYK points. Public reference: [Gradients](https://web.archive.org/web/20250714042311/https://helpx.adobe.com/illustrator/using/gradients.html) and [Meshes](https://web.archive.org/web/20250812201019/https://helpx.adobe.com/illustrator/using/meshes.html), which do not state how colors in different models mix; the rule is VectorCraft's own. @@ -1263,6 +1264,7 @@ undo step, with any adjustment and its params; bad requests refused) and `addons | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Gradient stop popover: an eyedropper samples the stop's colour from the art (#4681); scores and estimates unchanged | | 2026-10-30 | minor | Full Screen and Presentation Mode fill the screen (#4365); scores and estimates unchanged | | 2026-10-30 | minor | Place: a photo's EXIF orientation turns it upright (#4284); scores and estimates unchanged | | 2026-10-30 | minor | Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores and estimates unchanged | From 992055204f223859291bfe518499fab05407d1c6 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 17:56:20 +0700 Subject: [PATCH 022/227] =?UTF-8?q?Add-ons:=20Color=20Effects=20=E2=80=94?= =?UTF-8?q?=20select=20by=20color=20kind=20(spot=20colors,=20color=20effec?= =?UTF-8?q?ts,=20RGB,=20CMYK=20and=20grayscale=20images)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/engine/src/cmd/addons/color.rs | 95 ++++++++++++++++++--- crates/engine/src/cmd/addons/color/tests.rs | 67 +++++++++++++++ crates/ui-egui/src/addons/color.rs | 14 +++ crates/ui-egui/src/i18n/bg.tsv | 9 ++ crates/ui-egui/src/i18n/ca.tsv | 9 ++ crates/ui-egui/src/i18n/cs.tsv | 9 ++ crates/ui-egui/src/i18n/da.tsv | 9 ++ crates/ui-egui/src/i18n/de.tsv | 9 ++ crates/ui-egui/src/i18n/el.tsv | 9 ++ crates/ui-egui/src/i18n/es.tsv | 9 ++ crates/ui-egui/src/i18n/fi.tsv | 9 ++ crates/ui-egui/src/i18n/fr.tsv | 9 ++ crates/ui-egui/src/i18n/hu.tsv | 9 ++ crates/ui-egui/src/i18n/id.tsv | 9 ++ crates/ui-egui/src/i18n/it.tsv | 9 ++ crates/ui-egui/src/i18n/ja.tsv | 9 ++ crates/ui-egui/src/i18n/ka.tsv | 9 ++ crates/ui-egui/src/i18n/ko.tsv | 9 ++ crates/ui-egui/src/i18n/nl.tsv | 9 ++ crates/ui-egui/src/i18n/pl.tsv | 9 ++ crates/ui-egui/src/i18n/pt-br.tsv | 9 ++ crates/ui-egui/src/i18n/ru.tsv | 9 ++ crates/ui-egui/src/i18n/sv.tsv | 9 ++ crates/ui-egui/src/i18n/tr.tsv | 9 ++ crates/ui-egui/src/i18n/uk.tsv | 9 ++ crates/ui-egui/src/i18n/vi.tsv | 9 ++ crates/ui-egui/src/i18n/zh-hans.tsv | 9 ++ crates/ui-egui/src/i18n/zh-hant.tsv | 9 ++ docs/mcp.md | 7 ++ docs/target-app-parity.md | 7 +- docs/ui-parity.md | 5 +- 31 files changed, 404 insertions(+), 16 deletions(-) diff --git a/crates/engine/src/cmd/addons/color.rs b/crates/engine/src/cmd/addons/color.rs index 633760f6e5..3ddbd8c446 100644 --- a/crates/engine/src/cmd/addons/color.rs +++ b/crates/engine/src/cmd/addons/color.rs @@ -1,28 +1,99 @@ //! Color Effects (`addon.color.*`), a built-in add-on: its live effects (Exposure, Desaturate and //! Invert Colors, in Effect › Color Effects) are the effects crate's; here, Apply as Filter writes -//! any colour adjustment into the colours themselves. Its panel and its submenu, Object › Plug-ins › -//! Color Effects, are the UI's. +//! any colour adjustment into the colours themselves, and Select by Color Kind selects the objects +//! that use spot colours, carry a live colour adjustment, or are images of a colour model. Its panel +//! and its submenu, Object › Plug-ins › Color Effects, are the UI's. #[cfg(test)] mod tests; use serde_json::{Value, json}; +use vectorcraft_doc::{Document, Node, NodeId, NodeKind}; use vectorcraft_render::effects; use super::super::colorcmds::recolor; -use super::super::{CommandSpec, bad, checked_ids_or_selection, cmd, has_selection, text_param}; +use super::super::select::walk_selectable; +use super::super::{CommandSpec, bad, checked_ids_or_selection, cmd, has_doc, has_selection, text_param}; use crate::{Result, Session}; +/// The kinds Select by Color Kind selects (`addon.color.select`). +pub const SELECT_KINDS: [&str; 5] = ["spotColors", "colorEffects", "rgbImages", "cmykImages", "grayImages"]; + pub fn specs() -> Vec { - vec![cmd!( - "addon.color.filter", - "Apply as Filter", - ["Object", "Plug-ins", "Color Effects"], - None, - "{effect: a colour adjustment's effect id (adjust.brightnessContrast, adjust.curves, adjust.hueSaturation, adjust.levels, adjust.shiftToColor, adjust.temperatureTint, addon.color.exposure, addon.color.desaturate or addon.color.invert), params?: {…} (as effect.apply; missing keys take the dialog defaults), fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?: [id…] (default: the selection)} recolour the objects and everything inside them as the live effect would draw them, but in their colours, as edit.colors.invert does (fills, strokes, type, gradient meshes, embedded images and pattern tiles), as one undo step; their effects stay → {changed}", - has_selection, - filter - )] + vec![ + cmd!( + "addon.color.select", + "Select by Color Kind", + ["Object", "Plug-ins", "Color Effects"], + None, + "{kind: \"spotColors\" (objects painted with a spot colour swatch, solid or in a gradient's stops) | \"colorEffects\" (objects carrying a visible colour adjustment effect, on themselves or on a fill or stroke) | \"rgbImages\" | \"cmykImages\" | \"grayImages\" (embedded or linked images whose pixels are RGB, CMYK, or grayscale or 1-bit)} select those objects among the ones Select All reaches, inside groups too; locked and hidden ones are left out → {count}", + has_doc, + select + ), + cmd!( + "addon.color.filter", + "Apply as Filter", + ["Object", "Plug-ins", "Color Effects"], + None, + "{effect: a colour adjustment's effect id (adjust.brightnessContrast, adjust.curves, adjust.hueSaturation, adjust.levels, adjust.shiftToColor, adjust.temperatureTint, addon.color.exposure, addon.color.desaturate or addon.color.invert), params?: {…} (as effect.apply; missing keys take the dialog defaults), fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?: [id…] (default: the selection)} recolour the objects and everything inside them as the live effect would draw them, but in their colours, as edit.colors.invert does (fills, strokes, type, gradient meshes, embedded images and pattern tiles), as one undo step; their effects stay → {changed}", + has_selection, + filter + ), + ] +} + +fn select(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.color.select"; + let kind = text_param(p, "kind", C)?.ok_or_else(|| bad(C, "missing `kind`"))?; + if !SELECT_KINDS.contains(&kind) { + return Err(bad(C, "`kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages")); + } + let st = s.doc()?; + let mut ids: Vec = vec![]; + walk_selectable(&st.doc, st.isolation, |n| { + if is_of_kind(&st.doc, n, kind) { + ids.push(n.id); + // An object taken whole: what is inside it isn't taken again. + return false; + } + true + }); + s.select(|_, sel| sel.set(ids))?; + Ok(json!({ "count": s.doc()?.selection.objects.len() })) +} + +/// Is `n` an object of Select by Color Kind's `kind`? Containers count for colour effects only: +/// for the other kinds, the objects inside them are looked at one by one. +fn is_of_kind(d: &Document, n: &Node, kind: &str) -> bool { + match kind { + "colorEffects" => effects::has_adjustment(n), + "spotColors" if !n.is_container() => { + let mut spot = false; + vectorcraft_doc::swatches::node_colors(n, &mut |_, swatch| { + spot |= swatch.is_some_and(|name| d.swatch(name).is_some_and(|w| w.spot)); + }); + spot + } + _ => { + let NodeKind::Image(img) = &n.kind else { return false }; + let Some(blob) = d.images.get(&img.key) else { return false }; + let model = if blob.is_cmyk() { + "cmykImages" + } else if is_gray(&blob.bytes) { + "grayImages" + } else { + "rgbImages" + }; + model == kind + } + } +} + +/// Are the encoded image `bytes` grayscale or 1-bit? Reads only the header. +fn is_gray(bytes: &[u8]) -> bool { + use image::ImageDecoder as _; + let decoder = image::ImageReader::new(std::io::Cursor::new(bytes)).with_guessed_format().ok().and_then(|r| r.into_decoder().ok()); + decoder.is_some_and(|d| matches!(d.color_type(), image::ColorType::L8 | image::ColorType::La8 | image::ColorType::L16 | image::ColorType::La16)) } fn filter(s: &mut Session, p: &Value) -> Result { diff --git a/crates/engine/src/cmd/addons/color/tests.rs b/crates/engine/src/cmd/addons/color/tests.rs index c458fb51bd..29034c51ed 100644 --- a/crates/engine/src/cmd/addons/color/tests.rs +++ b/crates/engine/src/cmd/addons/color/tests.rs @@ -87,3 +87,70 @@ fn bad_requests_are_refused() { s.execute("select.none", &json!({})).unwrap(); assert!(s.execute("addon.color.filter", &json!({"effect": "addon.color.invert"})).is_err(), "nothing selected"); } + +/// An embedded image object of `blob`, selected. +fn image(s: &mut Session, key: &str, blob: vectorcraft_doc::ImageBlob, x: f64) -> NodeId { + s.edit("Place", |d, sel| { + d.images.insert(key.into(), blob); + let id = d.alloc_id(); + let im = vectorcraft_doc::ImageObject { + key: key.into(), + width: 4, + height: 4, + xf: vectorcraft_geom::Affine::translate((x, 0.0)) * vectorcraft_geom::Affine::scale(10.0), + link: None, + placement: Default::default(), + pixels: None, + }; + d.insert(d.default_layer(), 0, vectorcraft_doc::Node::new(id, vectorcraft_doc::NodeKind::Image(Box::new(im))))?; + sel.set([id]); + Ok(id) + }) + .unwrap() +} + +fn png(img: image::DynamicImage) -> vectorcraft_doc::ImageBlob { + let mut bytes = vec![]; + img.write_to(&mut std::io::Cursor::new(&mut bytes), image::ImageFormat::Png).unwrap(); + vectorcraft_doc::ImageBlob::png(bytes) +} + +fn selected(s: &Session) -> Vec { + s.doc().unwrap().selection.objects.clone() +} + +#[test] +fn select_by_color_kind_finds_spot_colours_effects_and_image_models() { + let (mut s, plain) = red_rect(); + // A spot colour, inside a group: the path is taken, not the group. + s.execute("swatch.new", &json!({"name": "Gold", "color": {"model": "cmyk", "c": 0.0, "m": 0.2, "y": 0.8, "k": 0.1}, "spot": true})).unwrap(); + let spot = NodeId(s.execute("shape.rectangle", &json!({"x": 100, "y": 20, "width": 30, "height": 30})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"swatch": "Gold"})).unwrap(); + s.execute("object.group", &json!({})).unwrap(); + // A live colour adjustment. + let adjusted = NodeId(s.execute("shape.rectangle", &json!({"x": 140, "y": 20, "width": 30, "height": 30})).unwrap()["id"].as_u64().unwrap()); + // Its own colour: setting the spot fill made it the default for new art too. + s.execute("paint.setFill", &json!({"color": "#00ff00"})).unwrap(); + s.execute("effect.apply", &json!({"effect": "addon.color.invert"})).unwrap(); + let rgb = image(&mut s, "rgb", png(image::DynamicImage::ImageRgb8(image::RgbImage::new(4, 4))), 0.0); + let gray = image(&mut s, "gray", png(image::DynamicImage::ImageLuma8(image::GrayImage::new(4, 4))), 50.0); + let inks = vectorcraft_doc::cmyk::Inks::new(4, 4, vec![0; 64]).unwrap(); + let cmyk = image(&mut s, "cmyk", vectorcraft_doc::ImageBlob::cmyk_tiff(&inks).unwrap(), 100.0); + for (kind, ids) in [ + ("spotColors", vec![spot]), + ("colorEffects", vec![adjusted]), + ("rgbImages", vec![rgb]), + ("grayImages", vec![gray]), + ("cmykImages", vec![cmyk]), + ] { + let v = s.execute("addon.color.select", &json!({"kind": kind})).unwrap(); + assert_eq!((selected(&s), v["count"].clone()), (ids.clone(), json!(ids.len())), "{kind}"); + } + // Locked objects are left out; none found selects nothing. + s.execute("select.set", &json!({"ids": [spot.0]})).unwrap(); + s.execute("object.lock", &json!({})).unwrap(); + assert_eq!(s.execute("addon.color.select", &json!({"kind": "spotColors"})).unwrap()["count"], 0); + assert!(!selected(&s).contains(&plain)); + assert!(s.execute("addon.color.select", &json!({"kind": "pantone"})).is_err()); + assert!(s.execute("addon.color.select", &json!({})).is_err()); +} diff --git a/crates/ui-egui/src/addons/color.rs b/crates/ui-egui/src/addons/color.rs index c7dae8d491..7c27f5af2b 100644 --- a/crates/ui-egui/src/addons/color.rs +++ b/crates/ui-egui/src/addons/color.rs @@ -75,6 +75,20 @@ pub fn menu() -> Vec { Item::Cmd("Exposure…", "effect.dialog", json!({ "effect": "addon.color.exposure" })), Item::Cmd("Desaturate", "effect.apply", json!({ "effect": "addon.color.desaturate" })), Item::Cmd("Invert Colors", "effect.apply", json!({ "effect": "addon.color.invert" })), + Item::Sep, + Item::Sub( + "Select by Color Kind", + [ + ("Objects with Spot Colors", "spotColors"), + ("Objects with Color Effects", "colorEffects"), + ("RGB Images", "rgbImages"), + ("CMYK Images", "cmykImages"), + ("Grayscale Images", "grayImages"), + ] + .into_iter() + .map(|(label, kind)| Item::Cmd(label, "addon.color.select", json!({ "kind": kind }))) + .collect(), + ), ] } diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 09d7063dc2..ffdeea74d1 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5709,3 +5709,12 @@ anchor Points: Точки: @msg `segment` must be "straight" or "curved" `segment` трябва да е "straight" или "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` трябва да е "free", "keepAngles" или "symmetric" @msg `{key}` must be [x, y] `{key}` трябва да е [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Избиране по вид цвят + Objects with Spot Colors Обекти с плакатни цветове + Objects with Color Effects Обекти с цветови ефекти + RGB Images RGB изображения + CMYK Images CMYK изображения + Grayscale Images Изображения в нюанси на сивото +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` трябва да е spotColors, colorEffects, rgbImages, cmykImages или grayImages diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index c6cfb2d9ff..0cd7e14c36 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5810,3 +5810,12 @@ anchor Points: Punts: @msg `segment` must be "straight" or "curved" `segment` ha de ser "straight" o "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` ha de ser "free", "keepAngles" o "symmetric" @msg `{key}` must be [x, y] `{key}` ha de ser [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Selecciona per tipus de color + Objects with Spot Colors Objectes amb colors directes + Objects with Color Effects Objectes amb efectes de color + RGB Images Imatges RGB + CMYK Images Imatges CMYK + Grayscale Images Imatges en escala de grisos +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` ha de ser spotColors, colorEffects, rgbImages, cmykImages o grayImages diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 6282e305c9..4571be3cf1 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -5819,3 +5819,12 @@ anchor Points: Body: @msg `segment` must be "straight" or "curved" `segment` musí být "straight" nebo "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` musí být "free", "keepAngles" nebo "symmetric" @msg `{key}` must be [x, y] `{key}` musí být [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Vybrat podle druhu barvy + Objects with Spot Colors Objekty s přímými barvami + Objects with Color Effects Objekty s barevnými efekty + RGB Images Obrazy RGB + CMYK Images Obrazy CMYK + Grayscale Images Obrazy ve stupních šedi +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` musí být spotColors, colorEffects, rgbImages, cmykImages nebo grayImages diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index b969e9572b..e598f8e4f0 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5724,3 +5724,12 @@ anchor Points: Punkter: @msg `segment` must be "straight" or "curved" `segment` skal være "straight" eller "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` skal være "free", "keepAngles" eller "symmetric" @msg `{key}` must be [x, y] `{key}` skal være [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Markér efter farvetype + Objects with Spot Colors Objekter med spotfarver + Objects with Color Effects Objekter med farveeffekter + RGB Images RGB-billeder + CMYK Images CMYK-billeder + Grayscale Images Gråtonebilleder +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` skal være spotColors, colorEffects, rgbImages, cmykImages eller grayImages diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index ac48208a1d..e80b94ec2b 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -5402,3 +5402,12 @@ anchor Points: Punkte: @msg `segment` must be "straight" or "curved" `segment` muss "straight" oder "curved" sein @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` muss "free", "keepAngles" oder "symmetric" sein @msg `{key}` must be [x, y] `{key}` muss [x, y] sein + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Nach Farbart auswählen + Objects with Spot Colors Objekte mit Volltonfarben + Objects with Color Effects Objekte mit Farbeffekten + RGB Images RGB-Bilder + CMYK Images CMYK-Bilder + Grayscale Images Graustufenbilder +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` muss spotColors, colorEffects, rgbImages, cmykImages oder grayImages sein diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 0a18dae9dc..6d772aa3f4 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5771,3 +5771,12 @@ anchor Points: Σημεία: @msg `segment` must be "straight" or "curved" Το `segment` πρέπει να είναι "straight" ή "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" Το `mode` πρέπει να είναι "free", "keepAngles" ή "symmetric" @msg `{key}` must be [x, y] Το `{key}` πρέπει να είναι [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Επιλογή κατά είδος χρώματος + Objects with Spot Colors Αντικείμενα με χρώματα spot + Objects with Color Effects Αντικείμενα με εφέ χρώματος + RGB Images Εικόνες RGB + CMYK Images Εικόνες CMYK + Grayscale Images Εικόνες σε κλίμακα του γκρι +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages Το `kind` πρέπει να είναι spotColors, colorEffects, rgbImages, cmykImages ή grayImages diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 1d4c1f10bc..bea2064e10 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -5762,3 +5762,12 @@ anchor Points: Puntos: @msg `segment` must be "straight" or "curved" `segment` debe ser "straight" o "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` debe ser "free", "keepAngles" o "symmetric" @msg `{key}` must be [x, y] `{key}` debe ser [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Seleccionar por tipo de color + Objects with Spot Colors Objetos con tintas planas + Objects with Color Effects Objetos con efectos de color + RGB Images Imágenes RGB + CMYK Images Imágenes CMYK + Grayscale Images Imágenes en escala de grises +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` debe ser spotColors, colorEffects, rgbImages, cmykImages o grayImages diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 4bf2f6cea3..70434ed16a 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -5850,3 +5850,12 @@ anchor Points: Pisteet: @msg `segment` must be "straight" or "curved" `segment` on oltava "straight" tai "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` on oltava "free", "keepAngles" tai "symmetric" @msg `{key}` must be [x, y] `{key}` on oltava [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Valitse värityypin mukaan + Objects with Spot Colors Objektit, joissa on spottivärejä + Objects with Color Effects Objektit, joissa on väritehosteita + RGB Images RGB-kuvat + CMYK Images CMYK-kuvat + Grayscale Images Harmaasävykuvat +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` on oltava spotColors, colorEffects, rgbImages, cmykImages tai grayImages diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index eb00097f6e..e9c4402de8 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -5818,3 +5818,12 @@ anchor Points: Points : @msg `segment` must be "straight" or "curved" `segment` doit être "straight" ou "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` doit être "free", "keepAngles" ou "symmetric" @msg `{key}` must be [x, y] `{key}` doit être [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Sélectionner par type de couleur + Objects with Spot Colors Objets avec tons directs + Objects with Color Effects Objets avec effets de couleur + RGB Images Images RVB + CMYK Images Images CMJN + Grayscale Images Images en niveaux de gris +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` doit être spotColors, colorEffects, rgbImages, cmykImages ou grayImages diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index f176caa3d5..ce60c5f9c4 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5806,3 +5806,12 @@ anchor Points: Pontok: @msg `segment` must be "straight" or "curved" `segment`: "straight" vagy "curved" kell @msg `mode` must be "free", "keepAngles" or "symmetric" `mode`: "free", "keepAngles" vagy "symmetric" kell @msg `{key}` must be [x, y] `{key}`: [x, y] kell + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Kijelölés színtípus szerint + Objects with Spot Colors Direkt színeket használó objektumok + Objects with Color Effects Színeffektusos objektumok + RGB Images RGB-képek + CMYK Images CMYK-képek + Grayscale Images Szürkeárnyalatos képek +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages A `kind` értéke spotColors, colorEffects, rgbImages, cmykImages vagy grayImages lehet diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index f44849f6a3..2906770ee4 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5724,3 +5724,12 @@ anchor Points: Titik: @msg `segment` must be "straight" or "curved" `segment` harus "straight" atau "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` harus "free", "keepAngles" atau "symmetric" @msg `{key}` must be [x, y] `{key}` harus [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Pilih menurut Jenis Warna + Objects with Spot Colors Objek dengan Warna Spot + Objects with Color Effects Objek dengan Efek Warna + RGB Images Gambar RGB + CMYK Images Gambar CMYK + Grayscale Images Gambar Skala Abu-abu +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` harus spotColors, colorEffects, rgbImages, cmykImages, atau grayImages diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 663b1bdbcb..94e8f38d6e 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -5436,3 +5436,12 @@ anchor Points: Punti: @msg `segment` must be "straight" or "curved" `segment` deve essere "straight" o "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` deve essere "free", "keepAngles" o "symmetric" @msg `{key}` must be [x, y] `{key}` deve essere [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Seleziona per tipo di colore + Objects with Spot Colors Oggetti con colori spot + Objects with Color Effects Oggetti con effetti colore + RGB Images Immagini RGB + CMYK Images Immagini CMYK + Grayscale Images Immagini in scala di grigi +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` deve essere spotColors, colorEffects, rgbImages, cmykImages o grayImages diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 0c645b9355..eeb1837c35 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -5505,3 +5505,12 @@ anchor Points: ポイント: @msg `segment` must be "straight" or "curved" `segment` には "straight" または "curved" を指定してください @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` には "free"、"keepAngles" または "symmetric" を指定してください @msg `{key}` must be [x, y] `{key}` には [x, y] を指定してください + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind カラーの種類で選択 + Objects with Spot Colors 特色を使用したオブジェクト + Objects with Color Effects カラー効果のあるオブジェクト + RGB Images RGB 画像 + CMYK Images CMYK 画像 + Grayscale Images グレースケール画像 +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` は spotColors、colorEffects、rgbImages、cmykImages、grayImages のいずれかにしてください diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 4558fd8976..1d4e52cb1e 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5809,3 +5809,12 @@ anchor Points: წერტილები: @msg `segment` must be "straight" or "curved" `segment` უნდა იყოს "straight" ან "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` უნდა იყოს "free", "keepAngles" ან "symmetric" @msg `{key}` must be [x, y] `{key}` უნდა იყოს [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind ფერის სახეობით არჩევა + Objects with Spot Colors ობიექტები სპოტ-ფერებით + Objects with Color Effects ობიექტები ფერის ეფექტებით + RGB Images RGB გამოსახულებები + CMYK Images CMYK გამოსახულებები + Grayscale Images ნაცრისფერის გრადაციის გამოსახულებები +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` უნდა იყოს spotColors, colorEffects, rgbImages, cmykImages ან grayImages diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 5b40aeddf1..56a27979d1 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5399,3 +5399,12 @@ anchor Points: 포인트: @msg `segment` must be "straight" or "curved" `segment`는 "straight" 또는 "curved"여야 합니다 @msg `mode` must be "free", "keepAngles" or "symmetric" `mode`는 "free", "keepAngles" 또는 "symmetric"이어야 합니다 @msg `{key}` must be [x, y] `{key}`은(는) [x, y]여야 합니다 + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind 색상 종류로 선택 + Objects with Spot Colors 별색을 사용한 개체 + Objects with Color Effects 색상 효과가 있는 개체 + RGB Images RGB 이미지 + CMYK Images CMYK 이미지 + Grayscale Images 회색 음영 이미지 +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind`는 spotColors, colorEffects, rgbImages, cmykImages 또는 grayImages여야 합니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index b04195e782..cbe1e0a6f0 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5768,3 +5768,12 @@ anchor Points: Punten: @msg `segment` must be "straight" or "curved" `segment` moet "straight" of "curved" zijn @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` moet "free", "keepAngles" of "symmetric" zijn @msg `{key}` must be [x, y] `{key}` moet [x, y] zijn + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Selecteren op kleursoort + Objects with Spot Colors Objecten met steunkleuren + Objects with Color Effects Objecten met kleureffecten + RGB Images RGB-afbeeldingen + CMYK Images CMYK-afbeeldingen + Grayscale Images Grijswaardenafbeeldingen +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` moet spotColors, colorEffects, rgbImages, cmykImages of grayImages zijn diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 44eebf2625..59cd718f8e 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -5674,3 +5674,12 @@ anchor Points: Punkty: @msg `segment` must be "straight" or "curved" `segment` musi mieć wartość "straight" lub "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` musi mieć wartość "free", "keepAngles" lub "symmetric" @msg `{key}` must be [x, y] `{key}` musi mieć postać [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Zaznacz według rodzaju koloru + Objects with Spot Colors Obiekty z kolorami dodatkowymi + Objects with Color Effects Obiekty z efektami koloru + RGB Images Obrazy RGB + CMYK Images Obrazy CMYK + Grayscale Images Obrazy w skali szarości +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` musi mieć wartość spotColors, colorEffects, rgbImages, cmykImages lub grayImages diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 2e49999cf9..d7f8362faf 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -5737,3 +5737,12 @@ anchor Points: Pontos: @msg `segment` must be "straight" or "curved" `segment` deve ser "straight" ou "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` deve ser "free", "keepAngles" ou "symmetric" @msg `{key}` must be [x, y] `{key}` deve ser [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Selecionar por tipo de cor + Objects with Spot Colors Objetos com cores spot + Objects with Color Effects Objetos com efeitos de cor + RGB Images Imagens RGB + CMYK Images Imagens CMYK + Grayscale Images Imagens em escala de cinza +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` deve ser spotColors, colorEffects, rgbImages, cmykImages ou grayImages diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 63ed5fd139..b467f6d9a4 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -5797,3 +5797,12 @@ anchor Points: Точки: @msg `segment` must be "straight" or "curved" `segment` должно быть "straight" или "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` должно быть "free", "keepAngles" или "symmetric" @msg `{key}` must be [x, y] `{key}` должно быть [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Выделить по типу цвета + Objects with Spot Colors Объекты с плашечными цветами + Objects with Color Effects Объекты с цветовыми эффектами + RGB Images Изображения RGB + CMYK Images Изображения CMYK + Grayscale Images Изображения в оттенках серого +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` должен быть spotColors, colorEffects, rgbImages, cmykImages или grayImages diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 7cf4031cc6..398845645f 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5843,3 +5843,12 @@ anchor Points: Punkter: @msg `segment` must be "straight" or "curved" `segment` måste vara "straight" eller "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` måste vara "free", "keepAngles" eller "symmetric" @msg `{key}` must be [x, y] `{key}` måste vara [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Markera efter färgtyp + Objects with Spot Colors Objekt med dekorfärger + Objects with Color Effects Objekt med färgeffekter + RGB Images RGB-bilder + CMYK Images CMYK-bilder + Grayscale Images Gråskalebilder +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` måste vara spotColors, colorEffects, rgbImages, cmykImages eller grayImages diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 70c0dc82d0..49e85624e9 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5777,3 +5777,12 @@ anchor Points: Noktalar: @msg `segment` must be "straight" or "curved" `segment` "straight" veya "curved" olmalıdır @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` "free", "keepAngles" veya "symmetric" olmalıdır @msg `{key}` must be [x, y] `{key}` [x, y] olmalıdır + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Renk Türüne Göre Seç + Objects with Spot Colors Spot Renkli Nesneler + Objects with Color Effects Renk Efektli Nesneler + RGB Images RGB Görüntüler + CMYK Images CMYK Görüntüler + Grayscale Images Gri Tonlamalı Görüntüler +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` değeri spotColors, colorEffects, rgbImages, cmykImages veya grayImages olmalıdır diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index a84207b276..5f57c26085 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -5416,3 +5416,12 @@ anchor Points: Точки: @msg `segment` must be "straight" or "curved" `segment` має бути "straight" або "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` має бути "free", "keepAngles" або "symmetric" @msg `{key}` must be [x, y] `{key}` має бути [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Виділити за типом кольору + Objects with Spot Colors Об’єкти з плашковими кольорами + Objects with Color Effects Об’єкти з колірними ефектами + RGB Images Зображення RGB + CMYK Images Зображення CMYK + Grayscale Images Зображення у відтінках сірого +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` має бути spotColors, colorEffects, rgbImages, cmykImages або grayImages diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 6189e8a7aa..9beeea182c 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5418,3 +5418,12 @@ anchor Points: Điểm: @msg `segment` must be "straight" or "curved" `segment` phải là "straight" hoặc "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` phải là "free", "keepAngles" hoặc "symmetric" @msg `{key}` must be [x, y] `{key}` phải là [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind Chọn theo loại màu + Objects with Spot Colors Đối tượng có màu pha + Objects with Color Effects Đối tượng có hiệu ứng màu + RGB Images Ảnh RGB + CMYK Images Ảnh CMYK + Grayscale Images Ảnh thang độ xám +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` phải là spotColors, colorEffects, rgbImages, cmykImages hoặc grayImages diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 048b8bf5ec..bbb8cdb647 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -5659,3 +5659,12 @@ anchor Points: 点: @msg `segment` must be "straight" or "curved" `segment` 必须是 "straight" 或 "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` 必须是 "free"、"keepAngles" 或 "symmetric" @msg `{key}` must be [x, y] `{key}` 必须是 [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind 按颜色类型选择 + Objects with Spot Colors 使用专色的对象 + Objects with Color Effects 带颜色效果的对象 + RGB Images RGB 图像 + CMYK Images CMYK 图像 + Grayscale Images 灰度图像 +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` 必须是 spotColors、colorEffects、rgbImages、cmykImages 或 grayImages diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index f076ef95e1..acabf699d0 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -5455,3 +5455,12 @@ anchor Points: 點: @msg `segment` must be "straight" or "curved" `segment` 必須是 "straight" 或 "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` 必須是 "free"、"keepAngles" 或 "symmetric" @msg `{key}` must be [x, y] `{key}` 必須是 [x, y] + +# Color Effects add-on: Select by Color Kind. + Select by Color Kind 依顏色類型選取 + Objects with Spot Colors 使用特別色的物件 + Objects with Color Effects 帶有顏色效果的物件 + RGB Images RGB 影像 + CMYK Images CMYK 影像 + Grayscale Images 灰階影像 +@msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` 必須是 spotColors、colorEffects、rgbImages、cmykImages 或 grayImages diff --git a/docs/mcp.md b/docs/mcp.md index fec39869a9..00c9230a84 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5854,3 +5854,10 @@ undo step. Missing `params` take the effect's dialog defaults; the objects' own The panel picks an adjustment (Brightness/Contrast, Hue/Saturation, Levels, Temperature/Tint, Exposure, Desaturate or Invert Colors), sets its values, and then Add as Effect (`effect.apply`) or Apply as Filter (`addon.color.filter`). + +`addon.color.select {kind}` (Object › Plug-ins › Color Effects › Select by Color Kind) selects, among the objects Select +All reaches and the objects inside groups (locked and hidden ones left out), those of one kind: `spotColors` (painted +with a spot colour swatch, solid or in a gradient's stops), `colorEffects` (carrying a visible colour adjustment effect, +on the object or on one of its fills or strokes; a group carrying one is selected whole), `rgbImages`, `cmykImages` or +`grayImages` (images whose pixels are RGB, CMYK, or grayscale or 1-bit, read from the image's header). It returns the +`count` selected. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 3042edc3d6..9784ca9583 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Gradient stop popover: an eyedropper samples the stop's colour from the art (#4681); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: Select by Color Kind; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -1259,11 +1259,14 @@ to the colours themselves through the Edit Colors pass. Object › Plug-ins › Tests: `addons::color` in `vectorcraft-effects` (exposure in stops, desaturate keeps lightness, invert twice is identity), `cmd::addons::color::tests` in `vectorcraft-engine` (drawn live without changing the colours; a filter as one undo step, with any adjustment and its params; bad requests refused) and `addons::color::tests` in -`vectorcraft-ui-egui` (the menus and the panel). Commands: `docs/mcp.md` › Color Effects add-on. +`vectorcraft-ui-egui` (the menus and the panel). Select by Color Kind (`addon.color.select`) selects the objects that use +spot colours, carry a colour adjustment, or are RGB, CMYK or grayscale images +(`select_by_color_kind_finds_spot_colours_effects_and_image_models`). Commands: `docs/mcp.md` › Color Effects add-on. ## Revision history | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Color Effects add-on: Select by Color Kind; scores and estimates unchanged | | 2026-10-30 | minor | Gradient stop popover: an eyedropper samples the stop's colour from the art (#4681); scores and estimates unchanged | | 2026-10-30 | minor | Full Screen and Presentation Mode fill the screen (#4365); scores and estimates unchanged | | 2026-10-30 | minor | Place: a photo's EXIF orientation turns it upright (#4284); scores and estimates unchanged | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 866849a534..02045c8c87 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (View › Hide Artboards hides their edges and shows the canvas as paper (#4038); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: Select by Color Kind; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -326,7 +326,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point) | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not an Illustrator feature, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not an Illustrator feature, so it is not scored | | Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not an Illustrator feature, 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 | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not an Illustrator feature, 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 | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not an Illustrator feature, so it is not scored | ## Look and feel @@ -367,6 +367,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Color Effects add-on: Select by Color Kind; scores and estimates unchanged | | 2026-10-30 | minor | View › Hide Artboards hides their edges and shows the canvas as paper (#4038); scores and estimates unchanged | | 2026-10-30 | minor | Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores and estimates unchanged | | 2026-10-30 | minor | Draw Inside marks the corners of the object it draws into (#4319); scores and estimates unchanged | From e214b3c9817ae5d033bee573ed184cd025ea515f Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 18:13:02 +0700 Subject: [PATCH 023/227] Presentation Mode fits the active artboard and hides selections, guides, grids and artboard edges --- crates/ui-egui/src/app.rs | 1 + crates/ui-egui/src/caches.rs | 3 ++ crates/ui-egui/src/canvas.rs | 50 ++++++++++++++------------ crates/ui-egui/src/tests/screenmode.rs | 34 ++++++++++++++++++ docs/target-app-parity.md | 4 ++- 5 files changed, 69 insertions(+), 23 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index dcaab8e90e..8e937c45c2 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -73,6 +73,7 @@ impl VectorcraftApp { cursors: Default::default(), view_moved: None, hover_cursor: None, + presented: None, }, perf: Perf::default(), dock_rt: Default::default(), diff --git a/crates/ui-egui/src/caches.rs b/crates/ui-egui/src/caches.rs index 9c9e41e7d8..ce5df47067 100644 --- a/crates/ui-egui/src/caches.rs +++ b/crates/ui-egui/src/caches.rs @@ -55,6 +55,9 @@ pub struct CanvasCache { /// The cursor the active tool last gave over the canvas, with the tool and the modifier keys /// it was for: kept while the view moves. pub hover_cursor: Option<(&'static str, vectorcraft_tools::Mods, vectorcraft_tools::Cursor)>, + /// In Presentation Mode, the canvas rect the active artboard was last fitted to: it is fitted + /// again when the rect changes (the window going full screen). + pub presented: Option, } /// [`CanvasCache::slices`]: the layout of the slices of (document uid, revision). diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 837d374a25..58815f2e7f 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -207,9 +207,13 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let rect = rect.round_to_pixels(ui.ctx().pixels_per_point()); app.canvas_rect = Some(rect); let fitted = app.view().is_some_and(|v| v.fitted); - if !fitted { + // Presentation Mode shows the active artboard on the whole screen and nothing but the art: + // no selection, guides, grids or artboard edges (#4365). + let presenting = app.ui.screen_mode == 3; + if !fitted || (presenting && app.canvas.presented != Some(rect)) { fit(app, "view.fitArtboard"); } + app.canvas.presented = presenting.then_some(rect); // Before the canvas's own interaction, so the view the canvas draws is the one they moved to. if bars { scroll_bars(app, ui, rect, outer, &t); @@ -238,7 +242,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { paint_paper(app, ui, &painter, &xf, rect, &t); // The grid behind the art (Guides & Grid › Grids In Back), else over it below. - let grid_look = app.ui.view.grid.then(|| LineLook::grid(&app.session.prefs)); + let grid_look = (app.ui.view.grid && !presenting).then(|| LineLook::grid(&app.session.prefs)); let grids_in_back = app.session.prefs.grids_in_back; if let Some(look) = grid_look.filter(|_| grids_in_back) { grid(&painter, &xf, doc.grid.spacing, doc.grid.subdivisions, look); @@ -293,28 +297,30 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } // The pixel grid (Guides & Grid › Show Pixel Grid (Above 600% Zoom)): in Pixel Preview from // 600% zoom, a line at every document pixel over the art, so the pixels it rasterizes to show. - if app.ui.view.pixel_preview && v.zoom >= PIXEL_GRID_ZOOM && app.session.prefs.show_pixel_grid { - grid(&painter, &xf, 1.0, 1, LineLook { color: PIXEL_GRID, dots: false }); - } - artboard_outlines(app, ui, &painter, &xf, &t); - if app.ui.view.guides { - guide_lines(app, &painter, &xf, rect, &t); - } - - if !app.session.slices_hidden() { - slice_overlay(app, &painter, &xf); - } - if app.session.active().is_some_and(|d| d.print_tiling) || app.session.tool_id() == "printTiling" { - print_tiling_overlay(app, &painter, &xf); - } - original_path_overlay(app, &painter, &xf); - let revolve_edit = app.ui.dialog.as_ref().is_some_and(crate::dialogs::revolve_gizmo::active); let view_info = app.view_info(); - let overlays = selection_visuals(app, &painter, &xf, (hidden_chars, hover_still), revolve_edit, view_info); - draw_overlays(&painter, &xf, &overlays, &t, HandleLook::of(&app.session.prefs)); - if !revolve_edit { - shaper_widget_overlay(app, &painter, &xf); + if !presenting { + if app.ui.view.pixel_preview && v.zoom >= PIXEL_GRID_ZOOM && app.session.prefs.show_pixel_grid { + grid(&painter, &xf, 1.0, 1, LineLook { color: PIXEL_GRID, dots: false }); + } + artboard_outlines(app, ui, &painter, &xf, &t); + if app.ui.view.guides { + guide_lines(app, &painter, &xf, rect, &t); + } + + if !app.session.slices_hidden() { + slice_overlay(app, &painter, &xf); + } + if app.session.active().is_some_and(|d| d.print_tiling) || app.session.tool_id() == "printTiling" { + print_tiling_overlay(app, &painter, &xf); + } + original_path_overlay(app, &painter, &xf); + + let overlays = selection_visuals(app, &painter, &xf, (hidden_chars, hover_still), revolve_edit, view_info); + draw_overlays(&painter, &xf, &overlays, &t, HandleLook::of(&app.session.prefs)); + if !revolve_edit { + shaper_widget_overlay(app, &painter, &xf); + } } ime_geometry(app, ui.ctx(), &xf); crate::place::paint_drop_highlight(app, ui.ctx(), &painter, rect); diff --git a/crates/ui-egui/src/tests/screenmode.rs b/crates/ui-egui/src/tests/screenmode.rs index a5f5e438b0..0c7f2d2e8e 100644 --- a/crates/ui-egui/src/tests/screenmode.rs +++ b/crates/ui-egui/src/tests/screenmode.rs @@ -273,3 +273,37 @@ fn the_screen_mode_is_not_saved() { let old: crate::state::UiState = serde_json::from_value(json!({ "screen_mode": 3 })).unwrap(); assert_eq!(old.screen_mode, 0); } + +/// Presentation Mode shows the active artboard fitted to the canvas, again when the canvas changes +/// size (the window going full screen), and none of the selection's handles or the artboard edges. +#[test] +fn presentation_mode_fits_the_artboard_and_hides_the_selection() { + let ctx = egui::Context::default(); + let mut app = VectorcraftApp::new(Session::new(), crate::Services::default()); + app.run("file.new", json!({"width": 200, "height": 100})).unwrap(); + app.run("shape.rectangle", json!({"x": 90, "y": 40, "width": 20, "height": 20})).unwrap(); + app.select_tool("selection"); + frame(&mut app, &ctx, vec![]); + app.view_mut().unwrap().zoom = 0.5; + let selection = crate::theme::Tokens::get(&ctx).selection; + let handles = |out: &egui::FullOutput| { + out.shapes.iter().filter(|s| matches!(&s.shape, egui::Shape::Rect(r) if r.stroke.color == selection || r.fill == selection)).count() + }; + let before = frame(&mut app, &ctx, vec![]); + assert!(handles(&before) > 0, "the selection's handles show"); + app.run("view.presentation", json!({})).unwrap(); + let out = frame(&mut app, &ctx, vec![]); + let canvas = app.canvas_rect.unwrap(); + let zoom = app.view().unwrap().zoom; + // 200 × 100 pt fitted to the canvas: one side reaches across most of it. + assert!(200.0 * zoom >= f64::from(canvas.width()) * 0.8 || 100.0 * zoom >= f64::from(canvas.height()) * 0.8, "fitted: {zoom} in {canvas:?}"); + assert_eq!(handles(&out), 0, "no selection shows"); + // A bigger canvas (the window gone full screen) fits it again. + let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1600.0, 1200.0))), ..Default::default() }; + let mut big = ctx.run_ui(raw, |ui| { + app.logic(ui.ctx()); + app.ui(ui); + }); + big.textures_delta.clear(); + assert!(app.view().unwrap().zoom > zoom * 1.5, "fitted again to the larger canvas"); +} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 9784ca9583..31de3148e9 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: Select by Color Kind; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Presentation Mode fits the active artboard and hides selections, guides, grids and artboard edges; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -764,6 +764,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Views:** the status bar's artboard navigator (first, previous, next, last; `view.goToArtboard`) goes to an artboard, fits it and synchronizes the Artboard tool selection when that tool is active; ordinary object selection is preserved. Actual Next-button regressions cover keyboard/Properties deletion and Undo in `chrome.rs`. Fit Artboard in Window and Actual Size show the navigator's artboard. The Artboards panel highlights that active artboard: clicking a row makes it active (the Artboard tool's too, while it is chosen) as does clicking an artboard with the Artboard tool, double-clicking its number also fits it in the window and double-clicking its name renames it. Duplicate Artboards, or a row dragged onto New Artboard, copies the artboard with its art (#446). Escape leaves Presentation Mode, `view.screenMode` from it goes back to Normal Screen Mode, and the screen mode isn't saved with the preferences: the app always starts in Normal Screen Mode with its menus and panels (#472). View › Pixel Preview shows the art as the document pixels it rasterizes to, one per point and hard-edged when magnified, turning with a rotated view (it used to draw the smooth vectors, with only the pixel grid over them). In Outline view a template layer keeps drawing in Preview, dimmed, so a picture placed to be traced stays visible under the outlines (#1505, fixes #1486). In Presentation Mode, → and ← go to the next and the previous artboard, and a click anywhere goes to the next one, as the status bar navigator's Next and Previous do (`view.goToArtboard`): on the last artboard → and a click leave the view as it is, and so does ← on the first. The arrow keys do not move the selection there, and the tool does not receive a click, so a click selects and draws nothing (behavior reference: [View artwork](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)). Full Screen Mode and Presentation Mode put the window full screen, covering the taskbar and the window's frame, and Normal Screen Mode or Full Screen Mode with Menu Bar puts it back (#4365); a window the user made full screen stays so. + Presentation Mode shows the active artboard fitted to the screen (fitted again as the window goes full screen) and hides the selection, guides, grids, slices and the artboards' edges and names, as [presentation mode](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/view-artwork-in-presentation-mode.html) describes. In Presentation Mode no key press other than ←, → and Escape runs a command or reaches the tool (tool keys, Delete, Enter, Tab, F, Shift+F and every command shortcut, the macOS menu bar's key equivalents included), a right click or a long touch opens no context menu, a tap of two or three fingers undoes or redoes nothing, and the pointer over the canvas is the default one instead of the tool's cursor. Align to Artboard uses the active artboard, the one the Artboards panel highlights (`object.align {artboard}`). A press with a selection tool inside an artboard makes that artboard active; with the Selection tool, a Shift-click on an empty spot inside an artboard makes it active and keeps the selection. One selected object is aligned to the active artboard too, whatever Align To says (a lone object is never the key object). When an action plays, its Align to Artboard, All on Active Artboard, Paste in Place, Paste in Front and Paste in Back steps that name no artboard use the artboard that is active then. With the Artboard tool in use, a Shift-click on a row of the Artboards panel selects the artboards from the last row clicked without Shift to the clicked row, and the clicked row's artboard becomes the active one. When the artboard of the last row clicked without Shift is no longer selected, the range starts from the active artboard, and later Shift-clicks start from there too. A Ctrl/Cmd-click still adds or removes one artboard. A Shift-click used to add or remove one artboard as well. The public [Select artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/select-artboards.html) page lists Shift-click in the Artboards panel for selecting several artboards. @@ -1266,6 +1267,7 @@ spot colours, carry a colour adjustment, or are RGB, CMYK or grayscale images | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Presentation Mode fits the active artboard and hides selections, guides, grids and artboard edges; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: Select by Color Kind; scores and estimates unchanged | | 2026-10-30 | minor | Gradient stop popover: an eyedropper samples the stop's colour from the art (#4681); scores and estimates unchanged | | 2026-10-30 | minor | Full Screen and Presentation Mode fill the screen (#4365); scores and estimates unchanged | From 884966c161c2414a65fd2f7cff51d820d5f0d12d Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 19:07:49 +0700 Subject: [PATCH 024/227] Smart Pen: an Alt-drag away from paths selects the points inside a marquee --- crates/tools/src/addons/smart_pen.rs | 59 +++++++++++++++++++++- crates/tools/src/addons/smart_pen/tests.rs | 21 ++++++++ docs/mcp.md | 2 + docs/ui-parity.md | 5 +- 4 files changed, 83 insertions(+), 4 deletions(-) diff --git a/crates/tools/src/addons/smart_pen.rs b/crates/tools/src/addons/smart_pen.rs index b4cc0ea051..f2b52219e6 100644 --- a/crates/tools/src/addons/smart_pen.rs +++ b/crates/tools/src/addons/smart_pen.rs @@ -16,12 +16,14 @@ //! A selected point's handle drags (Shift: 45°, Alt: keeps its angle); a double-click on it toggles //! its point. A segment drags to reshape it (Shift: handles square to its chord, Alt: handles keep //! their angles), Alt-click adds a point on it; a click on a path that isn't selected selects it. +//! With no path being drawn, an Alt-drag away from paths draws a marquee that selects the points +//! inside it (Shift: toggles them). //! //! Each gesture is one undo step (`addon.pen.*`, and `path.*` where the standard command does it). use serde_json::{Value, json}; use vectorcraft_doc::{NodeId, NodeKind}; -use vectorcraft_geom::{Anchor, BezPath, Point, SubPath, Vec2, constrain_angle_from}; +use vectorcraft_geom::{Anchor, BezPath, Point, Rect, SubPath, Vec2, constrain_angle_from}; use vectorcraft_pathops::addons::pathtools::SMOOTH_RATIO; use vectorcraft_pathops::addons::pen::{leave_handle, straighten_segment}; @@ -50,6 +52,8 @@ pub struct SmartPenTool { /// The pointer at the last press or drag (Space moves an anchor being placed by its moves). last: Point, snap: DrawSnap, + /// An Alt-drag's marquee: where it started, where it is, and whether it toggles (Shift). + marquee: Option<(Point, Point, bool)>, } /// A press: where it went down, what it is on and whether it has become a drag (and started its @@ -140,6 +144,50 @@ fn selected_alone(cx: &ToolContext, id: NodeId) -> bool { } impl SmartPenTool { + /// The marquee's part of a pointer event: an Alt-press away from paths, with no path being + /// drawn, starts it; drags move its corner; the release selects the points of the editable + /// paths inside it (`select.anchorsMany`; Shift: toggled). `None`: the event isn't its. + fn marquee_event(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Option> { + match (ev.kind, self.marquee) { + (PointerKind::Down, None) if ev.mods.alt && self.active(cx).is_none() && self.hit(cx, ev.pos) == Hit::Nothing => { + self.marquee = Some((ev.pos, ev.pos, ev.mods.shift)); + Some(vec![]) + } + (PointerKind::Drag | PointerKind::Move, Some((a, _, toggle))) => { + self.marquee = Some((a, ev.pos, toggle)); + Some(vec![]) + } + (PointerKind::Up, Some((a, _, toggle))) => { + self.marquee = None; + let r = Rect::from_points(a, ev.pos); + // A click, not a drag: nothing to select. + if r.width() < cx.tol(DRAG_THRESHOLD) && r.height() < cx.tol(DRAG_THRESHOLD) { + return Some(vec![]); + } + let editable = cx.doc.editable(); + let mut items = vec![]; + crate::draw2::walk_pickable(cx, |n| { + if let NodeKind::Path { path, .. } = &n.kind + && editable(n.id) + { + let inside: Vec = path.anchors().filter(|(_, _, a)| r.contains(a.p)).map(|(s, i, _)| json!([s, i])).collect(); + if !inside.is_empty() { + items.push(json!({"id": n.id.0, "anchors": inside})); + } + } + }); + Some(match (items.is_empty(), toggle) { + (true, true) => vec![], + (true, false) => vec![Action::Exec("select.none".into(), json!({}))], + (false, _) => { + vec![Action::Exec("select.anchorsMany".into(), json!({"items": items, "mode": if toggle { "toggle" } else { "set" }}))] + } + }) + } + _ => None, + } + } + /// The open subpath being drawn: (path, subpath, its data), while it is selected and editable. fn active<'a>(&self, cx: &'a ToolContext) -> Option<(NodeId, usize, &'a SubPath)> { let (id, si) = self.path.filter(|_| self.drawing)?; @@ -438,7 +486,7 @@ impl Tool for SmartPenTool { } fn busy(&self) -> bool { - self.press.is_some() + self.press.is_some() || self.marquee.is_some() } fn pointer(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec { @@ -453,6 +501,9 @@ impl Tool for SmartPenTool { let leave = Leave::segment(cx, a.p, ev.mods.shift); if a.has_out() { leave.without_contact() } else { leave } }); + if let Some(acts) = self.marquee_event(cx, ev) { + return acts; + } match ev.kind { PointerKind::Move => { self.hover = Some(self.snap.hover(cx, ev.pos, drawn.as_slice(), from.as_ref())); @@ -489,6 +540,7 @@ impl Tool for SmartPenTool { fn deactivate(&mut self, _cx: &ToolContext) -> Vec { self.stop(); + self.marquee = None; self.snap.clear(); match self.press.take() { Some(pr) if pr.begun => vec![Action::Commit], @@ -516,6 +568,9 @@ impl Tool for SmartPenTool { } } o.extend_from_slice(self.snap.guides()); + if let Some((a, b, _)) = self.marquee { + o.push(Overlay::Marquee(Rect::from_points(a, b))); + } o } diff --git a/crates/tools/src/addons/smart_pen/tests.rs b/crates/tools/src/addons/smart_pen/tests.rs index df093ac319..0f6bd5c912 100644 --- a/crates/tools/src/addons/smart_pen/tests.rs +++ b/crates/tools/src/addons/smart_pen/tests.rs @@ -308,3 +308,24 @@ fn the_rubber_band_shows_the_next_segment_and_ending_the_path() { assert!(t.active(&cx).is_none()); assert!(t.overlays(&cx).is_empty()); } + +#[test] +fn an_alt_drag_away_from_paths_selects_the_points_inside_a_marquee() { + let (d, id, s) = doc(SubPath::polyline(&[Point::new(100.0, 100.0), Point::new(200.0, 100.0), Point::new(300.0, 100.0)], false)); + let p = paint(); + let cx = plain(&d, &s, &p); + let mut t = SmartPenTool::default(); + assert!(t.pointer(&cx, &ev(PointerKind::Down, 50.0, 50.0, ALT)).is_empty()); + assert!(t.busy()); + t.pointer(&cx, &ev(PointerKind::Drag, 250.0, 150.0, ALT)); + assert_eq!(t.overlays(&cx).last(), Some(&Overlay::Marquee(Rect::from_points(Point::new(50.0, 50.0), Point::new(250.0, 150.0))))); + let acts = t.pointer(&cx, &ev(PointerKind::Up, 250.0, 150.0, ALT)); + assert_eq!(acts, [Action::Exec("select.anchorsMany".into(), json!({"items": [{"id": id.0, "anchors": [[0, 0], [0, 1]]}], "mode": "set"}))]); + assert!(!t.busy(), "the marquee is over"); + // A click is no marquee; Shift toggles the points inside it. + assert!(click(&mut t, &cx, 50.0, 50.0, ALT).is_empty()); + t.pointer(&cx, &ev(PointerKind::Down, 280.0, 50.0, Mods { shift: true, ..ALT })); + t.pointer(&cx, &ev(PointerKind::Drag, 320.0, 150.0, Mods { shift: true, ..ALT })); + let acts = t.pointer(&cx, &ev(PointerKind::Up, 320.0, 150.0, Mods { shift: true, ..ALT })); + assert_eq!(acts, [Action::Exec("select.anchorsMany".into(), json!({"items": [{"id": id.0, "anchors": [[0, 2]]}], "mode": "toggle"}))]); +} diff --git a/docs/mcp.md b/docs/mcp.md index 00c9230a84..7c20fdf54e 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5794,6 +5794,8 @@ The tool (`smartPen`), option `next`: `"straight"` (default) or `"curved"`, the one toggles its anchor. - Segments drag to reshape (`addon.pen.reshape`; Shift: `symmetric`, Alt: `keepAngles`); Alt-click adds an anchor (`path.insertAnchor`); a click on a path that isn't selected selects it. +- With no path being drawn, an Alt-drag away from paths draws a marquee that selects the points of the editable paths + inside it (`select.anchorsMany`; with Shift, toggles them). Commands: diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 02045c8c87..e2c9536ed7 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: Select by Color Kind; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Smart Pen add-on: an Alt-drag away from paths selects points with a marquee; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -323,7 +323,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Preferences › General › Constrain Angle | done | arrow keys and Shift drags along the turned axes; the Rectangle, Rounded Rectangle, Ellipse and grid tools, point and area type and the shape size dialogs draw along them with the bounding box turned; Shift-drawn polygons and stars keep the turned base orientation; the Line Segment tool's Shift steps count from it (#394, ); arcs, spirals, flares and Pen paths are not turned | | Tabs panel: a stop drags from where the press landed, a stop just added included | done | #1458 | | Outline view keeps template layers in Preview, dimmed | done | #1486; a picture placed to be traced stays visible under the outlines | -| Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point) | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not an Illustrator feature, so it is not scored | +| Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point); an Alt-drag away from paths selects the points inside a marquee | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not an Illustrator feature, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not an Illustrator feature, so it is not scored | | Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not an Illustrator feature, 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 | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not an Illustrator feature, so it is not scored | @@ -367,6 +367,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Smart Pen add-on: an Alt-drag away from paths selects points with a marquee; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: Select by Color Kind; scores and estimates unchanged | | 2026-10-30 | minor | View › Hide Artboards hides their edges and shows the canvas as paper (#4038); scores and estimates unchanged | | 2026-10-30 | minor | Contextual task bar: stays up through a click on another object, hides only for a drag (#4681); scores and estimates unchanged | From c0ee9c1986b37f09353e952626a25e31789b57a0 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 13:08:35 +0300 Subject: [PATCH 025/227] .ai/EPS import: read gradient meshes in named colours, mixed colour spaces and large grids A mesh in the editing data that the reader couldn't read made the whole file come in as its page or PDF part, without its layers. Three cases were rejected that files write routinely: - A mesh starts grey, and `/CS` is written only where the colour space changes, before the corner it applies to, even within a patch. Meshes with no `/CS`, or one that changed between corners, were unread. - Named colours (`[c m y k /DeviceCMYK (name) /Process]` or `/Spot`) and `/NChannel` inks: each corner gives the tint, 1 being the full colour. - Grids over 64 patches a side or 4,096 patches (files have 97 x 72). Each corner now takes the colour space last set before it; named colours paint at their tint and inks overprint at theirs; the limits are 128 a side and 16,384 patches. --- crates/eps/src/import/ai/mesh.rs | 253 ++++++++++++++++++++++++++----- docs/file-format-parity.md | 1 + 2 files changed, 219 insertions(+), 35 deletions(-) diff --git a/crates/eps/src/import/ai/mesh.rs b/crates/eps/src/import/ai/mesh.rs index b5a3ee574a..0b2438c7e1 100644 --- a/crates/eps/src/import/ai/mesh.rs +++ b/crates/eps/src/import/ai/mesh.rs @@ -1,5 +1,5 @@ //! Gradient meshes: `/Mesh X!`, then on `%_` lines `value /key X#` entries — the colour space -//! (`/CS`), and per patch its place (`/P [row col]`) and four corners (`/N`, from the corner nearest +//! (`/CS`, see [`Space`]), and per patch its place (`/P [row col]`) and four corners (`/N`, from the corner nearest //! the origin round to the one beside it), ended by `/E` — and `/End X!`. //! //! A corner is `[colour… opacity x y` then the handle towards the next corner, a weight, the handle @@ -18,14 +18,16 @@ use vectorcraft_doc::live::{GradientMesh, H_DOWN, H_LEFT, H_RIGHT, H_UP, MeshPoi use super::obj::V; -/// The most patches read from one mesh. -const MAX_PATCHES: usize = 4096; +/// The most patches read from one mesh (files users sent have up to 97 × 72). +const MAX_PATCHES: usize = 16_384; /// The most points kept from one mesh: a patch with anchors on its edges is cut into cells, up to /// 34 × 34 points, so the patch cap alone doesn't bound them. const MAX_POINTS: usize = MAX_PATCHES * 16; /// The largest grid `/Size` read as one mesh, a side. -const MAX_SIDE: usize = 64; +const MAX_SIDE: usize = 128; +/// The most inks of an `/NChannel` colour space read. +const MAX_INKS: usize = 32; /// The most rows or columns a mesh stitched from its patches may have once the lines through the /// anchors on its patches' edges are added. const MAX_LINES: usize = 256; @@ -49,9 +51,109 @@ pub(super) enum NotOne { Unjoined, } +/// A mesh's colour space (`/CS`). The files write one only where it changes, before the corner +/// it applies to, even within a patch; a mesh starts grey. Besides the device spaces it may be a +/// named colour, `[c m y k /DeviceCMYK (name) /Process]` (or `/Spot`), or several process or spot +/// inks, `[[ink] [ink] … n /NChannel]` (each ink `[c m y k /DeviceCMYK (name) /Separation]`). A +/// corner gives a named colour's tint (1 is the full colour), or each ink's in order. +#[derive(Debug, Clone, Default, PartialEq)] +enum Space { + #[default] + Gray, + Rgb, + Cmyk, + /// The inks' full colours. + Inks(Vec), + /// One this doesn't read: its corners are unread. + Other, +} + +impl Space { + fn read(value: Option<&V>) -> Space { + match value { + Some(v @ (V::Name(_) | V::Str(_))) => match v.text().as_deref() { + Some("DeviceGray") => Space::Gray, + Some("DeviceRGB") => Space::Rgb, + Some("DeviceCMYK") => Space::Cmyk, + _ => Space::Other, + }, + Some(V::Arr(a)) => match a.last().and_then(V::text).as_deref() { + Some("Process" | "Spot") => ink(a).map_or(Space::Other, |c| Space::Inks(vec![c])), + Some("NChannel") => { + let inks: Vec<&Vec> = a.iter().filter_map(|v| if let V::Arr(i) = v { Some(i) } else { None }).collect(); + let count = a.len().checked_sub(2).and_then(|i| a.get(i)).and_then(V::num); + let read: Option> = inks.iter().map(|i| ink(i)).collect(); + match read { + Some(read) if !read.is_empty() && read.len() <= MAX_INKS && count == Some(read.len() as f64) => Space::Inks(read), + _ => Space::Other, + } + } + _ => Space::Other, + }, + _ => Space::Other, + } + } + + /// The colour components a corner gives. + fn components(&self) -> Option { + match self { + Space::Gray => Some(1), + Space::Rgb => Some(3), + Space::Cmyk => Some(4), + Space::Inks(inks) => Some(inks.len()), + Space::Other => None, + } + } + + fn color(&self, c: &[f64]) -> Option { + let u = |i: usize| c.get(i).filter(|v| v.is_finite()).map(|v| v.clamp(0.0, 1.0) as f32); + Some(match self { + Space::Gray => Color::gray(1.0 - u(0)?), + Space::Rgb => Color::rgb(u(0)?, u(1)?, u(2)?), + Space::Cmyk => Color::cmyk(u(0)?, u(1)?, u(2)?, u(3)?), + Space::Inks(inks) => match inks.as_slice() { + [one] => one.tinted(u(0)?), + // Several inks overprint: their CMYK at their tints, added up. + many => { + let mut sum = [0.0f32; 4]; + for (i, ink) in many.iter().enumerate() { + let Color::Cmyk { c, m, y, k } = *ink else { return None }; + let t = u(i)?; + for (s, v) in sum.iter_mut().zip([c, m, y, k]) { + *s += v * t; + } + } + let [c, m, y, k] = sum.map(|v| v.min(1.0)); + Color::cmyk(c, m, y, k) + } + }, + Space::Other => return None, + }) + } +} + +/// A named colour or ink's full colour: `[c m y k /DeviceCMYK (name) /kind]` or `[r g b /DeviceRGB …]`. +fn ink(a: &[V]) -> Option { + let at = a.iter().position(|v| matches!(v, V::Name(_)))?; + let nums: Vec = a.get(..at)?.iter().map(|v| v.num().filter(|v| v.is_finite()).map(|v| v.clamp(0.0, 1.0) as f32)).collect::>()?; + match (a.get(at).and_then(V::text).as_deref(), nums.as_slice()) { + (Some("DeviceCMYK"), &[c, m, y, k]) => Some(Color::cmyk(c, m, y, k)), + (Some("DeviceRGB"), &[r, g, b]) => Some(Color::rgb(r, g, b)), + _ => None, + } +} + +/// A corner as read: its colour in the colour space it was given in, and the numbers after it +/// (opacity, unless the file is older, then the point and its handles). +#[derive(Debug, Clone)] +struct RawCorner { + color: Option, + rest: Vec, +} + #[derive(Debug, Default)] pub(super) struct MeshReader { - space: String, + space: Space, /// `/Type` (`Cartesian` in the files read). kind: Option, /// `/Size [a b]`: the grid's patches along the first and the second index of `/P`. @@ -60,7 +162,7 @@ pub(super) struct MeshReader { at: Option<(i64, i64)>, /// The patches read, in order, for [`Self::one_mesh`]. cells: Vec, - corners: Vec>, + corners: Vec, /// The patch's anchors between its corners (`/A`, `/S`): the edge, and a point and its two handles. anchors: Vec<(usize, [f64; 6])>, pub patches: Vec, @@ -77,14 +179,18 @@ impl MeshReader { let key = vals.get(at).and_then(V::text).unwrap_or_default(); let value = at.checked_sub(1).and_then(|i| vals.get(i)); match key.as_str() { - "CS" => self.space = value.and_then(V::text).unwrap_or_default(), + "CS" => self.space = Space::read(value), "Type" => self.kind = value.and_then(V::text), "Size" => self.size = pair(value), "P" => self.at = pair(value), "N" => { if let Some(V::Arr(a)) = value { if self.corners.len() < 4 { - self.corners.push(a.iter().filter_map(V::num).take(64).collect()); + let n: Vec = a.iter().filter_map(V::num).take(64).collect(); + let comps = self.space.components(); + let color = comps.and_then(|k| self.space.color(n.get(..k)?)); + let rest = comps.and_then(|k| n.get(k..)).map(<[f64]>::to_vec).unwrap_or_default(); + self.corners.push(RawCorner { color, rest }); } else { self.unread = true; } @@ -124,30 +230,14 @@ impl MeshReader { } } - fn color(&self, c: &[f64]) -> Option { - let u = |i: usize| c.get(i).filter(|v| v.is_finite()).map(|v| v.clamp(0.0, 1.0) as f32); - Some(match (self.space.as_str(), c.len()) { - ("DeviceRGB", 3) => Color::rgb(u(0)?, u(1)?, u(2)?), - ("DeviceCMYK", 4) => Color::cmyk(u(0)?, u(1)?, u(2)?, u(3)?), - ("DeviceGray", 1) => Color::gray(1.0 - u(0)?), - _ => return None, - }) - } - /// The four corners of a patch, in the document. - fn read_corners(&self, corners: &[Vec], to_doc: Affine) -> Option<[Corner; 4]> { + fn read_corners(&self, corners: &[RawCorner], to_doc: Affine) -> Option<[Corner; 4]> { let [n0, n1, n2, n3] = corners else { return None }; // (anchor, towards the next corner, towards the previous one, colour, opacity) - let read = |n: &Vec| -> Option<(Point, Vec2, Vec2, Color, f32)> { + let read = |n: &RawCorner| -> Option<(Point, Vec2, Vec2, Color, f32)> { // Older editing streams omit opacity; the colour space determines the number // of colour components, so a coordinate must never be mistaken for opacity. - let comps = match self.space.as_str() { - "DeviceRGB" => 3, - "DeviceCMYK" => 4, - "DeviceGray" => 1, - _ => return None, - }; - let (opacity, geometry) = match n.get(comps..)? { + let (opacity, geometry) = match n.rest.as_slice() { geometry if geometry.len() == 8 => (1.0, geometry), [opacity, geometry @ ..] if geometry.len() == 8 => (*opacity, geometry), _ => return None, @@ -161,13 +251,13 @@ impl MeshReader { return None; } let at = to_doc * Point::new(x, y); - let color = self.color(n.get(..comps)?)?; + let color = n.color?; Some((at, to_doc * Point::new(nx, ny) - at, to_doc * Point::new(px, py) - at, color, opacity.clamp(0.0, 1.0) as f32)) }; Some([read(n0)?, read(n1)?, read(n2)?, read(n3)?]) } - fn patch(&self, corners: &[Vec], anchors: &[(usize, [f64; 6])], to_doc: Affine) -> Option { + fn patch(&self, corners: &[RawCorner], anchors: &[(usize, [f64; 6])], to_doc: Affine) -> Option { let [a, b, c, d] = self.read_corners(corners, to_doc)?; if !anchors.is_empty() { return Some(coons([a, b, c, d], anchors, None)); @@ -490,7 +580,7 @@ mod tests { /// anchor, with the anchor's handles along the edge. #[test] fn an_edge_anchor_cuts_its_patch_there() { - let mut reader = MeshReader { space: "DeviceGray".into(), ..MeshReader::default() }; + let mut reader = MeshReader::default(); let corner = |x: f64, y: f64, next: (f64, f64), prev: (f64, f64)| { vec![V::Arr([0.0, 1.0, x, y, next.0, next.1, 1.0, prev.0, prev.1, 1.0].map(V::Num).to_vec()), V::Name("N".into())] }; @@ -515,7 +605,7 @@ mod tests { /// first corner run along its edge, as the patch above a shared edge lists them. #[test] fn anchors_keyed_s_on_a_first_edge_run_along_it() { - let mut reader = MeshReader { space: "DeviceGray".into(), ..MeshReader::default() }; + let mut reader = MeshReader::default(); let corner = |x: f64, y: f64, next: (f64, f64), prev: (f64, f64)| { vec![V::Arr([0.0, 1.0, x, y, next.0, next.1, 1.0, prev.0, prev.1, 1.0].map(V::Num).to_vec()), V::Name("N".into())] }; @@ -541,23 +631,23 @@ mod tests { #[test] fn hostile_meshes_are_capped_and_checked() { - let mut reader = MeshReader { space: "DeviceGray".into(), ..MeshReader::default() }; + let mut reader = MeshReader::default(); for _ in 0..=MAX_PATCHES { patch(&mut reader, &[0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0]); } assert!(reader.unread && reader.patches.len() == MAX_PATCHES); // Patches cut into cells count by their points. - let mut reader = MeshReader { space: "DeviceGray".into(), points: MAX_POINTS - 3, ..MeshReader::default() }; + let mut reader = MeshReader { points: MAX_POINTS - 3, ..MeshReader::default() }; patch(&mut reader, &[0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0]); assert!(reader.unread && reader.patches.is_empty()); // NaN passes `clamp`: a non-finite opacity or colour leaves the patch unread. for bad in [[0.5, f64::NAN], [f64::INFINITY, 1.0]] { - let mut reader = MeshReader { space: "DeviceGray".into(), ..MeshReader::default() }; + let mut reader = MeshReader::default(); patch(&mut reader, &[bad[0], bad[1], 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0]); assert!(reader.unread && reader.patches.is_empty(), "{bad:?}"); } // More corners than a patch has. - let mut reader = MeshReader { space: "DeviceGray".into(), ..MeshReader::default() }; + let mut reader = MeshReader::default(); for _ in 0..1000 { reader.entry(&corner(&[0.5, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0]), Affine::IDENTITY); } @@ -726,4 +816,97 @@ mod tests { } assert_eq!(r.one_mesh().unwrap_err(), NotOne::Unjoined); } + + fn nums(v: &[f64]) -> V { + V::Arr(v.iter().map(|x| V::Num(*x)).collect()) + } + + /// One unit-square patch: each corner's colour components, then (as version 1 meshes write, + /// without opacity) its point and handles at the point; `before[i]`: entries before corner `i`. + fn square(reader: &mut MeshReader, colors: [&[f64]; 4], before: [Vec<(V, &str)>; 4]) { + let at = [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)]; + for ((color, (x, y)), entries) in colors.into_iter().zip(at).zip(before) { + for (value, key) in entries { + reader.entry(&[value, V::Name(key.into())], Affine::IDENTITY); + } + let corner: Vec = color.iter().copied().chain([x, y, x, y, 1.0, x, y, 1.0]).collect(); + reader.entry(&[nums(&corner), V::Name("N".into())], Affine::IDENTITY); + } + reader.entry(&[V::Num(0.0), V::Name("E".into())], Affine::IDENTITY); + } + + fn assert_color(got: Color, want: Color) { + let (Color::Cmyk { c, m, y, k }, Color::Cmyk { c: c2, m: m2, y: y2, k: k2 }) = (got, want) else { + return assert_eq!(got, want); + }; + assert!([c - c2, m - m2, y - y2, k - k2].iter().all(|d| d.abs() < 1e-6), "{got:?} != {want:?}"); + } + + /// The files write `/CS` only where the colour space changes, before the corner it applies to, + /// even within a patch, and a mesh starts grey: a corner before any `/CS` is one grey + /// component, and one after a `/CS` takes that space. (Patch points: first corner, fourth, + /// second, third.) + #[test] + fn corners_take_the_colour_space_last_set_before_them() { + let cs = |n: &str| vec![(V::Name(n.into()), "CS")]; + let mut reader = MeshReader::default(); + square(&mut reader, [&[0.25], &[1.0, 0.0, 0.0], &[0.75], &[0.0, 0.0, 1.0]], [vec![], cs("DeviceRGB"), cs("DeviceGray"), cs("DeviceRGB")]); + assert!(!reader.unread); + let colors: Vec = reader.patches[0].points.iter().map(|p| p.color).collect(); + assert_eq!(colors, [Color::gray(0.75), Color::rgb(0.0, 0.0, 1.0), Color::rgb(1.0, 0.0, 0.0), Color::gray(0.25)]); + // A mesh with no `/CS` at all is grey. + let mut reader = MeshReader::default(); + square(&mut reader, [&[0.0], &[1.0], &[1.0], &[0.0]], Default::default()); + assert!(!reader.unread && reader.patches[0].points[0].color == Color::gray(1.0)); + } + + /// A named colour (`[c m y k /DeviceCMYK (name) /Process]`) paints at each corner's tint, 1 its + /// full colour; `/NChannel` inks overprint at their tints. Ones that don't add up stay unread. + #[test] + fn named_colours_and_inks_paint_at_their_tints() { + let ink = |c: [f64; 4], name: &str, kind: &str| { + let mut v: Vec = c.iter().map(|x| V::Num(*x)).collect(); + v.extend([V::Name("DeviceCMYK".into()), V::Str(name.as_bytes().to_vec()), V::Name(kind.into())]); + V::Arr(v) + }; + let rose = ink([0.1, 0.6, 0.4, 0.2], "Rose", "Process"); + let mut reader = MeshReader::default(); + // Version 2 corners: tint, then opacity. + square(&mut reader, [&[1.0, 1.0], &[0.5, 1.0], &[1.0, 1.0], &[1.0, 1.0]], [vec![(rose, "CS")], vec![], vec![], vec![]]); + assert!(!reader.unread); + let points = &reader.patches[0].points; + assert_color(points[0].color, Color::cmyk(0.1, 0.6, 0.4, 0.2)); + assert_color(points[2].color, Color::cmyk(0.05, 0.3, 0.2, 0.1)); + + let channels = |n: f64| { + V::Arr(vec![ + ink([0.0, 0.0, 1.0, 0.0], "Yellow", "Separation"), + ink([0.0, 1.0, 0.0, 0.0], "Magenta", "Separation"), + V::Num(n), + V::Name("NChannel".into()), + ]) + }; + let mut reader = MeshReader::default(); + square(&mut reader, [&[0.25, 1.0], &[0.0, 0.0], &[1.0, 1.0], &[0.0, 0.0]], [vec![(channels(2.0), "CS")], vec![], vec![], vec![]]); + assert!(!reader.unread); + assert_color(reader.patches[0].points[0].color, Color::cmyk(0.0, 1.0, 0.25, 0.0)); + assert_color(reader.patches[0].points[3].color, Color::cmyk(0.0, 1.0, 1.0, 0.0)); + + // An ink count that doesn't match its inks, or an ink in a space not read. + let lab = V::Arr(vec![V::Num(50.0), V::Num(0.0), V::Num(0.0), V::Name("Lab".into()), V::Str(b"Grey".to_vec()), V::Name("Spot".into())]); + for space in [channels(3.0), lab] { + let mut reader = MeshReader::default(); + square(&mut reader, [&[1.0, 1.0]; 4], [vec![(space, "CS")], vec![], vec![], vec![]]); + assert!(reader.unread && reader.patches.is_empty()); + } + } + + /// Meshes as large as files users sent (97 × 72 patches) are read, as one mesh. + #[test] + fn a_large_grid_is_read_as_one_mesh() { + let r = Grid::new(97, 72).read([97.0, 72.0]); + assert!(!r.unread); + let mesh = r.one_mesh().unwrap(); + assert_eq!((mesh.rows.min(mesh.cols), mesh.rows.max(mesh.cols)), (72, 97)); + } } diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 20d86dc007..a24b49a79e 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai`/EPS editing data: gradient meshes the reader marked unread, which made the whole file come in as its page or PDF part, are read: a mesh starts grey and its `/CS` is written only where it changes, before the corner it applies to (within a patch too), so each corner takes the space last set before it; named colours (`[c m y k /DeviceCMYK (name) /Process]` or `/Spot`) paint at the corner's tint and `/NChannel` inks overprint at theirs; meshes up to 128 patches a side and 16,384 patches are read (files users sent had up to 97 × 72). Ten of eleven such files from a user's set now open from their layers; meshes with handle weights other than 1 still don't. Own-fixture tests in `import::ai::mesh`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file is put where its matrix takes the canvas point of art space's origin, and, when the layers then don't draw as the page, at the corner of the box it is written with, which many files use; six files of a user's set whose photos landed off their artboards now open from their layers. Own-fixture test in `import::tests_native`; scores unchanged | | 2026-10-30 | minor | SVG export: axis-aligned rectangles are written as ``, circles and ellipses drawn with four standard arcs as ``/``, straight lines as `` and other straight-segment paths as ``/``, at the written precision; a rectangle or ellipse with a dashed stroke, turned ellipses, curves and compound paths stay `` (#4652); scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file written as an object's copy on `%_` lines is read: its `%AI5_BeginPlace` and `%AI5_EndPlace` markers there were dropped, so the `~` that ends it was an unknown operator and the whole file came in as its PDF part; its preview's header, on a `%_` line too, is read. Own-fixture test in `import::ai::tests`; scores unchanged | From 4f5d270ae922a7475f1117099862f762d48de541 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 04:54:31 +0300 Subject: [PATCH 026/227] .ai import: an empty page with skipped content isn't empty; outlines asked for are given Two follow-ups to the empty-page fallback: - A page counts as empty only when nothing on it was skipped: its only notes are the page's own (art off the artboards, art past the page). A page whose only content couldn't be read, such as an image that can't be decoded, keeps its notes and goes through the usual check against the editing data, instead of being replaced by it unchecked. - With textAs: outlines, the document read from the editing data alone has its type outlined. The usual path takes outlines from the page, but an empty page (or a text-only placeholder, #1387) has none to give. --- crates/engine/src/cmd/fileio/load.rs | 36 ++++++++++++- .../engine/src/cmd/fileio/tests_aiimport.rs | 51 +++++++++++++++++++ docs/file-format-parity.md | 1 + 3 files changed, 86 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/fileio/load.rs b/crates/engine/src/cmd/fileio/load.rs index 2c0c7eb733..41503e0620 100644 --- a/crates/engine/src/cmd/fileio/load.rs +++ b/crates/engine/src/cmd/fileio/load.rs @@ -197,6 +197,34 @@ fn from_editing_data_alone(bytes: &[u8], opts: &LoadOptions) -> Option bool { + w == vectorcraft_pdf::OFF_ARTBOARD_NOTE || w == vectorcraft_pdf::PAST_PAGE_NOTE +} + +/// The document read from the editing data alone with its type as outlines when `opts` asks for +/// them (`textAs: outlines`): the page that would have them has none to give. +fn outlined_if_asked(mut doc: Document, warnings: Vec, opts: &LoadOptions) -> (Document, Vec) { + if opts.text_as != vectorcraft_pdf::TextAs::Outlines { + return (doc, warnings); + } + let mut texts = Vec::new(); + doc.walk(|n| { + if matches!(n.kind, vectorcraft_doc::NodeKind::Text(_)) { + texts.push(n.clone()); + } + }); + for t in texts { + let Some(o) = vectorcraft_render::effects::outline_text(&t) else { continue }; + let o = Node { visible: t.visible, locked: t.locked, name: t.name.clone(), ..doc.reid(&o) }; + if let Some(slot) = doc.node_mut(t.id) { + *slot = o; + } + } + (doc, warnings) +} + /// Does `doc` hold no art: only layers, with nothing in them? fn draws_nothing(doc: &Document) -> bool { let mut art = false; @@ -282,10 +310,14 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result // saved without its PDF part (#1387: else the page, which is the art). So too // pages that draw nothing at all: there is no page art to check the layers // against, and the empty page would lose all of it. - let alone = (r.only_text || draws_nothing(&r.document)) + // A page is empty only when nothing on it was skipped (an image that can't be + // decoded draws nothing either): its notes are at most the page's own. + let empty = draws_nothing(&r.document) && r.warnings.iter().all(|w| is_page_note(w)); + let alone = (r.only_text || empty) .then(|| from_editing_data_alone(bytes, opts)) .flatten() - .and_then(|read| read.ok()); + .and_then(|read| read.ok()) + .map(|(doc, warnings)| outlined_if_asked(doc, warnings, opts)); let (doc, warnings, read) = match alone { Some((doc, warnings)) => (doc, warnings, true), None => through_editing_data(bytes, opts, r.document, r.warnings, r.user_unit), diff --git a/crates/engine/src/cmd/fileio/tests_aiimport.rs b/crates/engine/src/cmd/fileio/tests_aiimport.rs index acf7d43b17..ea72dba535 100644 --- a/crates/engine/src/cmd/fileio/tests_aiimport.rs +++ b/crates/engine/src/cmd/fileio/tests_aiimport.rs @@ -576,6 +576,57 @@ fn an_ai_file_whose_pdf_part_draws_nothing_opens_from_its_editing_data() { assert_ne!(names(&s.doc().unwrap().doc.layers), ["Art", "Hidden"]); } +/// A page that draws nothing only because what it holds couldn't be read (an image that can't be +/// decoded) isn't an empty page: its notes stay, and the editing data isn't taken in its place +/// unchecked. +#[test] +fn a_page_whose_content_was_skipped_is_not_taken_for_an_empty_one() { + let broken = "q 100 0 0 50 0 0 cm BI /W 2 /H 2 /CS /RGB /BPC 8 /F /DCT ID notajpeg EI Q"; + let mut s = Session::new(); + let r = open(&mut s, "broken.ai", &ai::ai(&compressed(&ai::sample_data()), broken), json!({})).unwrap(); + let warnings = r["warnings"].to_string(); + assert_ne!(r["warnings"], json!([]), "the skipped image is told: {r}"); + assert!(!warnings.contains("saved without PDF compatibility"), "{r}"); +} + +/// Type asked for as outlines on a page that draws nothing: the editing data's type, outlined (the +/// page has none to give). +#[test] +fn an_empty_page_with_type_as_outlines_outlines_the_editing_datas_type() { + // One left-aligned story, "Hi", 14 pt Helvetica, anchored at the canvas centre (the template + // box's centre), as the editing data's text document gives it. + let story = "<< /0 << /0 (Hi\r) /5 << /0 [ << /0 << /0 << /0 () /5 << /0 0 >> /6 0 >> >> /1 3 >> ] >> \ + /6 << /0 [ << /0 << /0 << /0 () /5 0 /6 << /0 0 /1 14.0 /53 << /99 /CAITextPaint /0 << /0 2 /1 [ 1.0 0.0 1.0 0.0 0.0 ] >> >> >> >> >> /1 3 >> ] >> >> \ + /1 << /0 [ << /0 0 >> ] /2 [ << /99 /PC /6 [ << /99 /F /0 << /0 [ 8191.5 8191.5 ] >> /6 [ << /99 /R /6 [ << /99 /R /6 [ << /99 /L /6 [ \ + << /99 /S /0 << /0 [ 0.0 0.0 ] >> /15 << /0 3 >> >> ] >> ] >> ] >> ] >> ] >> ] >> >>"; + let document = format!( + "/0 << /1 << /0 [ << /0 << /0 << /0 (Helvetica) >> >> >> ] >> /8 << /0 [ << /0 << /0 [ 0 0 ] /2 << /2 [ 1 0 0 1 0 0 ] >> >> >> ] >> >>\n/1 << /1 [ {story} ] /2 << /1 12.0 >> >>\n" + ); + let lines: Vec = ascii85(document.as_bytes()).as_bytes().chunks(60).map(|c| format!("%{}", String::from_utf8_lossy(c))).collect(); + let text = "/AI11Text :\n0 /FreeUndo ,\n0 /FrameIndex ,\n0 /StoryIndex ,\n2 /TextAntialiasing ,\n;\n"; + let data = format!( + "%!PS-Adobe-3.0 \n%%BoundingBox: 0 0 100 100\n%%HiResBoundingBox: 0 0 100 100\n%AI3_Cropmarks: 0 0 100 100\n%AI3_TemplateBox: 50 50 50 50\n\ + %AI5_NumLayers: 1\n{}%AI11_BeginTextDocument\n/AI11TextDocument : /ASCII85Decode ,\n{}\n%AI11_EndTextDocument\n%%Trailer\n", + ai::layer("Art", text), + lines.join("\n") + ); + let file = ai::ai(&compressed(data.as_bytes()), ""); + let texts = |s: &Session| { + let mut n = 0; + s.doc().unwrap().doc.walk(|c| n += usize::from(matches!(c.kind, NodeKind::Text(_)))); + n + }; + let mut s = Session::new(); + let r = open(&mut s, "typed.ai", &file, json!({})).unwrap(); + assert_eq!(texts(&s), 1, "by default the editing data's type is type: {r}"); + let r = open(&mut s, "typed.ai", &file, json!({"textAs": "outlines"})).unwrap(); + assert_eq!(texts(&s), 0, "no type left: {r}"); + let mut paths = 0; + s.doc().unwrap().doc.walk(|c| paths += usize::from(matches!(c.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }))); + assert!(paths > 0, "the outlines are there: {r}"); + assert_eq!(names(&s.doc().unwrap().doc.layers), ["Art"], "the editing data's layers"); +} + #[test] fn editing_data_false_opens_only_what_the_page_prints() { let mut s = Session::new(); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index a24b49a79e..e7f7d8e1aa 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -137,6 +137,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | 2026-10-30 | minor | SVG export: axis-aligned rectangles are written as ``, circles and ellipses drawn with four standard arcs as ``/``, straight lines as `` and other straight-segment paths as ``/``, at the written precision; a rectangle or ellipse with a dashed stroke, turned ellipses, curves and compound paths stay `` (#4652); scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file written as an object's copy on `%_` lines is read: its `%AI5_BeginPlace` and `%AI5_EndPlace` markers there were dropped, so the `~` that ends it was an unknown operator and the whole file came in as its PDF part; its preview's header, on a `%_` line too, is read. Own-fixture test in `import::ai::tests`; scores unchanged | | 2026-10-30 | minor | PDF export: an opaque gradient mesh is written as one PDF Type 6 (Coons patch) shading (ISO 32000-1, 8.7.4.5.7) filling its outline, so viewers blend its colours smoothly instead of showing the bands and seams of the 8 × 8 flat quads a patch it was cut into; a file of 65,558 small meshes exports in 14 s instead of 56 s, at half the size. A mesh with see-through points is still written as quads. Own-fixture tests in `tests::mesh_export`; scores unchanged | +| 2026-10-30 | minor | `.ai` import: a PDF part counts as an empty page only when nothing on it was skipped (an image that can't be decoded draws nothing too), so such a page keeps its notes and is checked against the editing data as before; with `textAs: "outlines"`, a file read from its editing data alone (an empty page, or the text-only placeholder of #1387) has its type outlined. Tests in `tests_aiimport.rs`; scores and hours unchanged | | 2026-10-30 | minor | `.ai` import: a file whose PDF part is an empty page opens from its editing data where that reads, instead of opening blank; scores unchanged | | 2026-10-30 | minor | `.ai` import: a file whose PDF part's pages are cropped to its art rather than its artboards no longer comes in as that PDF part (each page a copy of all the art) but from its layers, with its artboards, where they draw as the page does; own-fixture test in `tests_aiimport`; scores unchanged | | 2026-10-29 | minor | `.ai` and Illustrator EPS import: the editing data is read up to an eighth of installed memory, from 512 MiB to 2 GiB on 64-bit builds (it was 512 MiB on every machine), so a layered file whose embedded rasters unpack past 512 MiB keeps its layers, groups and text on a machine with 8 GiB or more instead of opening as its page or PDF part (#3510, #4628). Measured: 1.1 GB of editing data peaked 1.1 GB above the start; data past the limit is still refused (a 2 MB file unpacking to 2.2 GB stops in under a second). 32-bit and web builds keep 256 MiB. Own-fixture tests `import::ai::tests::editing_data_past_512_mib_is_read_where_memory_allows`, `the_editing_data_limit_follows_installed_memory`; scores and hours unchanged | From 75e8f69734f107a5223872279c631c20ff6b793f Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 14:46:28 +0300 Subject: [PATCH 027/227] PDF import: large mesh shadings and mesh-painted strokes come in as gradient meshes Patch and triangle mesh shadings of more than 4,096 patches, and strokes painted with a mesh shading, came in as a flat grey. Illustrator writes meshes of up to 14,355 patches, and writes a freeform gradient on a stroke as a stroke painted with a type 7 shading. - MAX_PATCHES is 16,384, as in the .ai editing-data reader. - A stroke painted with a mesh shading is the meshes clipped to the area the stroke paints (stroke_outline: width, caps, joins, miter limit and dashes, built in the path's space and then transformed); draw_meshes always clips a stroke's meshes. --- crates/pdf/src/import/builder.rs | 7 +-- crates/pdf/src/import/device.rs | 24 +++++++--- crates/pdf/src/import/state.rs | 21 +++++++++ crates/pdf/src/import_shading.rs | 4 +- crates/pdf/src/tests/import_fidelity.rs | 62 +++++++++++++++++++++---- docs/file-format-parity.md | 1 + 6 files changed, 100 insertions(+), 19 deletions(-) diff --git a/crates/pdf/src/import/builder.rs b/crates/pdf/src/import/builder.rs index 853262bb53..15a05c4729 100644 --- a/crates/pdf/src/import/builder.rs +++ b/crates/pdf/src/import/builder.rs @@ -661,8 +661,9 @@ impl<'p> Builder<'p> { } /// Mesh shadings filling `region` (document space): gradient meshes, clipped to the region - /// when they reach past it. - pub(super) fn draw_meshes(&mut self, meshes: Vec, region: &BezPath, opacity: f32) { + /// when they reach past it, or always (`clip`: a stroke's outline, which a mesh can lie + /// within the box of without filling it). + pub(super) fn draw_meshes(&mut self, meshes: Vec, region: &BezPath, opacity: f32, clip: bool) { let nodes: Vec> = meshes.into_iter().map(|m| Arc::new(Node::new(self.id(), NodeKind::Mesh(m)))).collect(); let Some(art) = bounds(&nodes) else { return }; let mut content = match <[Arc; 1]>::try_from(nodes) { @@ -670,7 +671,7 @@ impl<'p> Builder<'p> { Err(all) => Node::group(self.id(), all), }; content.opacity *= opacity; - if !contains(region.bounding_box().inflate(0.5, 0.5), art) { + if clip || !contains(region.bounding_box().inflate(0.5, 0.5), art) { let clip = self.clip_node(region, FillRule::NonZero); content = clipped(clip, content, self.id()); } diff --git a/crates/pdf/src/import/device.rs b/crates/pdf/src/import/device.rs index 60b00fb2e9..3338124ad6 100644 --- a/crates/pdf/src/import/device.rs +++ b/crates/pdf/src/import/device.rs @@ -1,6 +1,7 @@ use super::entry::{INVISIBLE_TEXT_NOTE, MAX_NESTED, OUTLINED_TEXT_NOTE, UNSORTED, WHITE_KEY}; use super::state::{ Builder, Decoded, Frame, FrameKind, GlyphRun, blend, fill_rule, line_width, mean_scale, resize_alpha, rgba_png, same_outline, stroke_layer, + stroke_outline, }; use super::{ Affine, Appearance, AppearanceItem, Arc, BezPath, BlendMode, ClipPath, Device, FillLayer, FillRule, Glyph, GlyphDrawMode, Image, ImageBlob, @@ -52,12 +53,23 @@ impl<'a> Device<'a> for Builder<'_> { }, craft_pdf::interpret::Paint::Color(_) => None, }; - // Patch and triangle meshes are gradient meshes. - if let (PathDrawMode::Fill(_), Some(sp)) = (draw_mode, shading) - && let Some(meshes) = mesh_shading(sp, &mut self.colors, walked.and_then(|w| self.scan.ink(w, false, true))) - { - self.draw_meshes(meshes, &bp, sp.opacity); - return; + // Patch and triangle meshes are gradient meshes; a stroke's, clipped to the stroke's outline + // (as Illustrator writes a freeform gradient on a stroke). + if let Some(sp) = shading { + let stroke = match draw_mode { + PathDrawMode::Stroke(p) => Some(p), + PathDrawMode::Fill(_) => None, + }; + if let Some(meshes) = mesh_shading(sp, &mut self.colors, walked.and_then(|w| self.scan.ink(w, stroke.is_some(), true))) { + match stroke { + None => return self.draw_meshes(meshes, &bp, sp.opacity, false), + Some(p) => { + if let Some(outline) = stroke_outline(path, transform, p) { + return self.draw_meshes(meshes, &outline, sp.opacity, true); + } + } + } + } } let pd = PathData::from_bezpath(&bp); let stroke = matches!(draw_mode, PathDrawMode::Stroke(_)); diff --git a/crates/pdf/src/import/state.rs b/crates/pdf/src/import/state.rs index ee3d2a5d38..e5011e0ca8 100644 --- a/crates/pdf/src/import/state.rs +++ b/crates/pdf/src/import/state.rs @@ -246,6 +246,27 @@ pub(super) fn stroke_layer(paint: Paint, opacity: f32, p: &StrokeProps, scale: f /// The most entries of a dash array kept (an even count keeps it a pattern of dashes and gaps). const MAX_DASH_ENTRIES: usize = 64; +/// The area stroke `p` paints along `path` (in its own space, before `transform`), in the document: +/// where a shading painting the stroke shows. Width, caps, joins and dashes as [`stroke_layer`] +/// takes them. `None` when it paints nothing. +pub(super) fn stroke_outline(path: &BezPath, transform: Affine, p: &StrokeProps) -> Option { + let scale = mean_scale(transform); + if !(scale.is_finite() && scale > 1e-9) { + return None; + } + let mut style = + kurbo::Stroke::new(line_width(p, scale) / scale).with_join(p.line_join).with_caps(p.line_cap).with_miter_limit(p.miter_limit as f64); + let dashes: Vec = p.dash_array.iter().take(MAX_DASH_ENTRIES).map(|v| *v as f64).collect(); + let dash = Dash { pattern: dashes.clone(), offset: p.dash_offset as f64, align_corners: false }; + if dash.is_dashed() { + style = style.with_dashes(dash.offset, dashes); + } + // To a hundredth of a point in the document. + let mut out = kurbo::stroke(path.iter(), &style, &kurbo::StrokeOpts::default(), 0.01 / scale); + out.apply_affine(transform); + (!out.elements().is_empty()).then_some(out) +} + pub(crate) fn round3(v: f32) -> f32 { (v * 1000.0).round() / 1000.0 } diff --git a/crates/pdf/src/import_shading.rs b/crates/pdf/src/import_shading.rs index 1d2bc9ccae..a8a8b25eaa 100644 --- a/crates/pdf/src/import_shading.rs +++ b/crates/pdf/src/import_shading.rs @@ -21,8 +21,8 @@ use crate::import_color::{Colors, Native}; use crate::import_mask::{contains, is_rectangle, luminance}; /// The most mesh patches (or triangles) imported per shading: past it, the shading is a flat -/// colour. -const MAX_PATCHES: usize = 4096; +/// colour. (Illustrator writes meshes of up to 14,355 in files users sent.) +const MAX_PATCHES: usize = 16_384; /// An axial or radial shading as a gradient paint, with whether it extends past its start and /// its end. `inks`: the colorant names of its space, from the page's walk ([`Colors::solid`]). diff --git a/crates/pdf/src/tests/import_fidelity.rs b/crates/pdf/src/tests/import_fidelity.rs index 9f5b98dfb6..25d84735a6 100644 --- a/crates/pdf/src/tests/import_fidelity.rs +++ b/crates/pdf/src/tests/import_fidelity.rs @@ -395,10 +395,12 @@ fn hex(bytes: &[u8]) -> String { bytes.iter().map(|b| format!("{b:02X}")).collect::>().join("") + ">" } -#[test] -fn a_coons_patch_mesh_becomes_a_gradient_mesh() { - // One patch over (10, 10)–(90, 90): corner colours red (0, 0), green (0, 1), blue (1, 1), - // white (1, 0) in u/v. +/// A Coons patch mesh shading's dictionary for [`coons_patch`] data. +const COONS_MESH: &str = "/ShadingType 6 /ColorSpace /DeviceRGB /BitsPerCoordinate 8 /BitsPerComponent 8 /BitsPerFlag 8 /Decode [0 255 0 255 0 1 0 1 0 1] /Filter /ASCIIHexDecode"; + +/// One patch over (10, 10)–(90, 90): corner colours red (0, 0), green (0, 1), blue (1, 1), white +/// (1, 0) in u/v. +fn coons_patch() -> Vec { let pts: [(u8, u8); 12] = [(10, 10), (10, 37), (10, 63), (10, 90), (37, 90), (63, 90), (90, 90), (90, 63), (90, 37), (90, 10), (63, 10), (37, 10)]; let mut data = vec![0u8]; @@ -406,11 +408,13 @@ fn a_coons_patch_mesh_becomes_a_gradient_mesh() { data.extend([x, y]); } data.extend([255, 0, 0, 0, 255, 0, 0, 0, 255, 255, 255, 255]); + data +} + +#[test] +fn a_coons_patch_mesh_becomes_a_gradient_mesh() { let s = first_extra(1); - let sh = stream( - "/ShadingType 6 /ColorSpace /DeviceRGB /BitsPerCoordinate 8 /BitsPerComponent 8 /BitsPerFlag 8 /Decode [0 255 0 255 0 1 0 1 0 1] /Filter /ASCIIHexDecode", - &hex(&data), - ); + let sh = stream(COONS_MESH, &hex(&coons_patch())); let d = open(&one_page("/Sh0 sh", &format!("/Shading << /Sh0 {s} 0 R >>"), &[&sh])); let meshes: Vec = all(&d).into_iter().filter_map(|n| if let NodeKind::Mesh(m) = n.kind { Some(m) } else { None }).collect(); @@ -427,6 +431,48 @@ fn a_coons_patch_mesh_becomes_a_gradient_mesh() { assert!(!all(&d).iter().any(|n| matches!(n.kind, NodeKind::Group { clip: true, .. })), "the mesh lies inside the page"); } +/// Illustrator writes meshes of many thousands of patches (14,355 in one of a user's files): one +/// of 5,000 comes in as gradient meshes, not a flat grey. +#[test] +fn a_mesh_shading_of_thousands_of_patches_becomes_gradient_meshes() { + let data: Vec = std::iter::repeat_n(coons_patch(), 5000).flatten().collect(); + let s = first_extra(1); + let sh = stream(COONS_MESH, &hex(&data)); + let r = open_with(&one_page("/Sh0 sh", &format!("/Shading << /Sh0 {s} 0 R >>"), &[&sh]), |_| {}); + assert!(!r.warnings.iter().any(|w| w.contains("flat grey")), "{:?}", r.warnings); + assert_eq!(all(&r.document).iter().filter(|n| matches!(n.kind, NodeKind::Mesh(_))).count(), 5000); +} + +/// A stroke painted with a mesh shading (how Illustrator writes a freeform gradient on a stroke) +/// is the mesh clipped to the area the stroke paints, dashes included, not a flat grey. +#[test] +fn a_stroke_painted_with_a_mesh_shading_is_the_mesh_clipped_to_the_stroke() { + let s = first_extra(1); + let sh = stream(COONS_MESH, &hex(&coons_patch())); + let resources = format!("/Pattern << /P0 << /PatternType 2 /Shading {s} 0 R >> >>"); + // A 10 pt line from (20, 50) to (80, 50) with butt caps: page y 45 to 55. Dashed 10 on, 10 + // off: pieces at 20–30, 40–50 and 60–70. + for (dash, pieces, end) in [("[] 0 d", 1, 80.0), ("[10 10] 0 d", 3, 70.0)] { + let content = format!("/Pattern CS /P0 SCN 10 w {dash} 20 50 m 80 50 l S"); + let r = open_with(&one_page(&content, &resources, &[&sh]), |_| {}); + assert!(!r.warnings.iter().any(|w| w.contains("flat grey")), "{:?}", r.warnings); + let nodes = all(&r.document); + assert_eq!(nodes.iter().filter(|n| matches!(n.kind, NodeKind::Mesh(_))).count(), 1, "{dash}"); + let clip = nodes + .iter() + .find_map(|n| match &n.kind { + NodeKind::Group { children, clip: true } => children.first().cloned(), + _ => None, + }) + .expect("a clip group"); + let NodeKind::Path { path, .. } = &clip.kind else { panic!("{:?}", clip.kind) }; + let b = path.bounds().unwrap(); + assert!((b.x0 - 20.0).abs() < 0.01 && (b.x1 - end).abs() < 0.01 && (b.y0 - 45.0).abs() < 0.01 && (b.y1 - 55.0).abs() < 0.01, "{dash}: {b:?}"); + let subpaths = path.to_bezpath().elements().iter().filter(|e| matches!(e, kurbo::PathEl::MoveTo(_))).count(); + assert_eq!(subpaths, pieces, "{dash}"); + } +} + #[test] fn gradient_stop_opacity_round_trips() { let mut d = Document::new(100.0, 100.0); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index e7f7d8e1aa..45eb9f834d 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | PDF import: a patch or triangle mesh shading of up to 16,384 patches comes in as gradient meshes (it was 4,096; Illustrator writes up to 14,355 in files users sent), and a stroke painted with one (how Illustrator writes a freeform gradient on a stroke) is the meshes clipped to the area the stroke paints, with its width, caps, joins and dashes; both came in as a flat grey. In two files of a user's set, the formerly grey area now matches a reference rendering in 99% of its pixels. Own-fixture tests in `tests::import_fidelity`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: gradient meshes the reader marked unread, which made the whole file come in as its page or PDF part, are read: a mesh starts grey and its `/CS` is written only where it changes, before the corner it applies to (within a patch too), so each corner takes the space last set before it; named colours (`[c m y k /DeviceCMYK (name) /Process]` or `/Spot`) paint at the corner's tint and `/NChannel` inks overprint at theirs; meshes up to 128 patches a side and 16,384 patches are read (files users sent had up to 97 × 72). Ten of eleven such files from a user's set now open from their layers; meshes with handle weights other than 1 still don't. Own-fixture tests in `import::ai::mesh`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file is put where its matrix takes the canvas point of art space's origin, and, when the layers then don't draw as the page, at the corner of the box it is written with, which many files use; six files of a user's set whose photos landed off their artboards now open from their layers. Own-fixture test in `import::tests_native`; scores unchanged | | 2026-10-30 | minor | SVG export: axis-aligned rectangles are written as ``, circles and ellipses drawn with four standard arcs as ``/``, straight lines as `` and other straight-segment paths as ``/``, at the written precision; a rectangle or ellipse with a dashed stroke, turned ellipses, curves and compound paths stay `` (#4652); scores unchanged | From b127918be5a1389ebeea613a7865718aede55dba Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 19:45:52 +0700 Subject: [PATCH 028/227] PDF import: a mesh-painted stroke's outline keeps dash and tolerance in reason --- crates/pdf/src/import/state.rs | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/crates/pdf/src/import/state.rs b/crates/pdf/src/import/state.rs index e5011e0ca8..0f02e7a26e 100644 --- a/crates/pdf/src/import/state.rs +++ b/crates/pdf/src/import/state.rs @@ -245,6 +245,8 @@ pub(super) fn stroke_layer(paint: Paint, opacity: f32, p: &StrokeProps, scale: f /// The most entries of a dash array kept (an even count keeps it a pattern of dashes and gaps). const MAX_DASH_ENTRIES: usize = 64; +/// Most dash periods [`stroke_outline`] cuts a stroke into. +const MAX_OUTLINE_DASHES: f64 = 1e5; /// The area stroke `p` paints along `path` (in its own space, before `transform`), in the document: /// where a shading painting the stroke shows. Width, caps, joins and dashes as [`stroke_layer`] @@ -258,11 +260,14 @@ pub(super) fn stroke_outline(path: &BezPath, transform: Affine, p: &StrokeProps) kurbo::Stroke::new(line_width(p, scale) / scale).with_join(p.line_join).with_caps(p.line_cap).with_miter_limit(p.miter_limit as f64); let dashes: Vec = p.dash_array.iter().take(MAX_DASH_ENTRIES).map(|v| *v as f64).collect(); let dash = Dash { pattern: dashes.clone(), offset: p.dash_offset as f64, align_corners: false }; - if dash.is_dashed() { + // A dash pattern far finer than the path would cut it into countless pieces: it strokes solid. + let period: f64 = dashes.iter().sum(); + if dash.is_dashed() && period > 0.0 && kurbo::Shape::perimeter(path, 1e-3) / period < MAX_OUTLINE_DASHES { style = style.with_dashes(dash.offset, dashes); } - // To a hundredth of a point in the document. - let mut out = kurbo::stroke(path.iter(), &style, &kurbo::StrokeOpts::default(), 0.01 / scale); + // To a hundredth of a point in the document, within reason at extreme scales. + let tolerance = (0.01 / scale).clamp(1e-4, 1.0); + let mut out = kurbo::stroke(path.iter(), &style, &kurbo::StrokeOpts::default(), tolerance); out.apply_affine(transform); (!out.elements().is_empty()).then_some(out) } @@ -301,3 +306,22 @@ pub(super) fn resize_alpha(a: &LumaData, w: u32, h: u32) -> Vec { None => vec![255; (w * h) as usize], } } + +#[cfg(test)] +mod stroke_outline_tests { + use super::*; + + /// A dash pattern far finer than the path strokes it solid instead of cutting it into + /// millions of pieces; one in reason dashes it. + #[test] + fn a_dash_far_finer_than_the_path_strokes_solid() { + let mut path = BezPath::new(); + path.move_to((0.0, 0.0)); + path.line_to((1000.0, 0.0)); + let props = |dash: f32| StrokeProps { line_width: 2.0, dash_array: [dash; 4].into(), ..StrokeProps::default() }; + let solid = stroke_outline(&path, Affine::IDENTITY, &props(1e-6)).unwrap(); + assert!(solid.elements().len() < 20, "{} elements", solid.elements().len()); + let dashed = stroke_outline(&path, Affine::IDENTITY, &props(10.0)).unwrap(); + assert!(dashed.elements().len() > 100, "dashed: {} elements", dashed.elements().len()); + } +} From 55bfb7033e12757999d1c44b863873aa5ce86f48 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 30 Oct 2026 19:50:23 +0700 Subject: [PATCH 029/227] feat: show six Distribute Objects buttons in Control bar when 2+ objects selected (Illustrator parity) Squashed from #4561 onto main. --- crates/ui-egui/src/chrome/control_bar.rs | 6 +++ crates/ui-egui/src/chrome/tests.rs | 53 ++++++++++++++++++++++++ crates/ui-egui/src/panels/align.rs | 10 +++++ 3 files changed, 69 insertions(+) diff --git a/crates/ui-egui/src/chrome/control_bar.rs b/crates/ui-egui/src/chrome/control_bar.rs index f2c41b4dfc..c1bdfefa57 100644 --- a/crates/ui-egui/src/chrome/control_bar.rs +++ b/crates/ui-egui/src/chrome/control_bar.rs @@ -244,6 +244,12 @@ pub fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui) { return; } crate::panels::align::align_buttons(app, ui, 24.0); + // Two or more objects get the six Distribute Objects buttons too; a single + // object keeps the bar as it was. + if sel.len() > 1 { + ui.add_space(4.0); + crate::panels::align::distribute_buttons(app, ui, 24.0); + } ui.separator(); // The Transform link opens the whole Transform panel (reference point, rotate, // shear, options) in a popover; X/Y/W/H follow inline while the bar has room. diff --git a/crates/ui-egui/src/chrome/tests.rs b/crates/ui-egui/src/chrome/tests.rs index 929b5a8a8e..91a276e9b0 100644 --- a/crates/ui-egui/src/chrome/tests.rs +++ b/crates/ui-egui/src/chrome/tests.rs @@ -1633,3 +1633,56 @@ fn full_screen_modes_fill_the_screen_and_normal_mode_restores_the_window() { app.ui.screen_mode = 0; assert!(sent(&mut app, true).is_empty(), "still full screen, as the user had it"); } + +/// Two or more selected objects show all six Distribute Objects buttons in the Control bar; +/// a single object keeps the bar as it was. A click distributes as the Align panel's button does. +#[test] +fn the_control_bar_shows_the_distribute_buttons_for_two_or_more_objects() { + crate::i18n::set_current(crate::i18n::Lang::EN); + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 200})).unwrap(); + let rect = |app: &mut crate::VectorcraftApp, x: f64| { + app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 30, "height": 20})).unwrap()["id"].clone() + }; + let (a, b, c) = (rect(&mut app, 10.0), rect(&mut app, 100.0), rect(&mut app, 200.0)); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1600.0, 300.0)); + let frame = |app: &mut crate::VectorcraftApp, events: Vec| { + let mut out = ctx.run_ui(egui::RawInput { events, screen_rect: Some(screen), ..Default::default() }, |ui| super::control_bar(app, ui)); + out.textures_delta.clear(); + out.platform_output.accesskit_update.map(|u| u.nodes).unwrap_or_default() + }; + const DISTRIBUTE: [&str; 6] = [ + "Vertical Distribute Top", + "Vertical Distribute Center", + "Vertical Distribute Bottom", + "Horizontal Distribute Left", + "Horizontal Distribute Center", + "Horizontal Distribute Right", + ]; + let rects = |app: &mut crate::VectorcraftApp| { + frame(app, vec![]); + let nodes = frame(app, vec![]); + DISTRIBUTE.map(|name| { + let n = nodes.iter().find(|(_, n)| n.label() == Some(name)).map(|(_, n)| n)?; + n.bounds().map(|b| egui::Rect::from_min_max(egui::pos2(b.x0 as f32, b.y0 as f32), egui::pos2(b.x1 as f32, b.y1 as f32))) + }) + }; + app.run("select.set", json!({"ids": [a]})).unwrap(); + assert!(rects(&mut app).iter().all(Option::is_none), "one object: no distribute buttons"); + app.run("select.set", json!({"ids": [a, b, c]})).unwrap(); + let rects = rects(&mut app); + assert!(rects.iter().all(Option::is_some), "three objects: {rects:?}"); + let r = rects[3].expect("Horizontal Distribute Left"); + let press = + |pressed| egui::Event::PointerButton { pos: r.center(), button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + for events in [vec![egui::Event::PointerMoved(r.center()), press(true)], vec![press(false)]] { + frame(&mut app, events); + } + let left = |app: &crate::VectorcraftApp, id: &serde_json::Value| { + app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(id.as_u64().unwrap())).unwrap().geometric_bounds().unwrap().x0 + }; + assert_eq!((left(&app, &a), left(&app, &b), left(&app, &c)), (10.0, 105.0, 200.0), "{}", app.ui.status); +} diff --git a/crates/ui-egui/src/panels/align.rs b/crates/ui-egui/src/panels/align.rs index 937a158284..0c322f0a05 100644 --- a/crates/ui-egui/src/panels/align.rs +++ b/crates/ui-egui/src/panels/align.rs @@ -192,6 +192,16 @@ pub fn align_buttons(app: &mut VectorcraftApp, ui: &mut Ui, size: f32) { } } +/// The six Distribute Objects buttons of the Control bar, `size` points square. They distribute +/// what the Align panel's buttons do, to what its Align To says. +pub(crate) fn distribute_buttons(app: &mut VectorcraftApp, ui: &mut Ui, size: f32) { + for (icon, tip, axis, v) in DISTRIBUTE { + if widgets::icon_button(ui, icon, tl!(tip), false, size).clicked() { + run_button(app, Button::Distribute(axis, v)).ok(); + } + } +} + /// Whether the selection has a key object or a key guide. fn has_key(app: &VectorcraftApp) -> bool { app.session.active().is_some_and(|st| st.selection.has_key()) From 7a2fc777f4ab179539c28f88e429c3935ea5da25 Mon Sep 17 00:00:00 2001 From: ashokram-si <347905169+ashokram-si@users.noreply.github.com> Date: Fri, 30 Oct 2026 16:52:51 +0530 Subject: [PATCH 030/227] Gradient panel: presets to apply, save and delete (G13) People reuse the same gradients across documents and rebuilt them by hand. The Gradient panel now has a Presets menu: the presets of the app's built-in gradient libraries, grouped by library (theme), then the saved ones. Choosing one gives the gradient behind the active proxy (or a solid paint) the preset's type, stops, method and dither, keeping its placement, as one undo step, through paint.editGradient. The panel menu saves the current gradient as a preset (named in a dialog) and deletes saved ones; Hide/Show Presets toggles the row. Saved presets are kept with the preferences, next to the other user preset lists (width profiles, flattener, perspective). Stops linked to a document swatch keep their colour, unlinked, since a preset is used in other documents. Built-in presets can't be deleted; names are unique. Commands: gradient.presets.list, .apply, .save and .delete. The menu's rows are drawn only while in view, as its headings are. Tests: engine tests for list, apply (fill and stroke, placement kept, one undo step), save (unique names, unlinked swatch stops) and delete; panel tests for applying from the menu and saving, deleting and hiding presets from the panel menu, including scrolling the menu to the saved presets. Docs: gaps G13, target-app and UI parity, ROADMAP. --- ROADMAP.md | 1 + crates/engine/src/cmd.rs | 5 + crates/engine/src/cmd/gradpresets.rs | 224 ++++++++++++++++++++ crates/engine/src/prefs.rs | 6 + crates/engine/src/tests.rs | 1 + crates/engine/src/tests/gradpresets.rs | 159 ++++++++++++++ crates/ui-egui/src/panels/gradient.rs | 97 +++++++-- crates/ui-egui/src/panels/gradient/tests.rs | 124 ++++++++++- docs/gaps.md | 8 +- docs/target-app-parity.md | 15 +- docs/ui-parity.md | 4 +- 11 files changed, 621 insertions(+), 23 deletions(-) create mode 100644 crates/engine/src/cmd/gradpresets.rs create mode 100644 crates/engine/src/tests/gradpresets.rs diff --git a/ROADMAP.md b/ROADMAP.md index 3b52398406..acd0cf77e0 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -128,6 +128,7 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap ## Progress log +- 2026-10-30: Gradient panel presets: a Presets menu applies one of the built-in gradient libraries' presets (grouped by theme) or a saved one to the gradient behind the active proxy, keeping its placement, as one undo step; the panel menu saves the current gradient as a preset, kept with the preferences, and deletes saved ones (`gradient.presets.list/apply/save/delete`). - 2026-10-23: Pathfinder › Trap: the Pathfinder panel's Trap… and Effect › Pathfinder › Trap… add a thin overprinting strip of the lighter colour inside the darker one where two solid colours meet, so misregistered plates leave no gap ([trapping](https://helpx.adobe.com/illustrator/using/trapping.html)), with Thickness, Height/Width, Tint Reduction, Traps with Process Color and Reverse Traps. Illustrator effects 49/50 (SVG Filters remains); Live vector effects hours 6–10 → 4–8; headline numbers unchanged. - 2026-10-23: OpenType SVG colour fonts draw as vector art: each glyph's SVG document is read by the SVG importer, in the text's colours where it asks for them, and draws, exports and outlines as COLR glyphs do; all colour font formats are now drawn. - 2026-10-23: COLR colour fonts (v0 and v1, as in Noto Color Emoji's vector build, Segoe UI Emoji, Nabla) draw as vector art: their layers' colours, gradients, clips and blend modes on the canvas and in SVG, EPS, legacy `.ai` and PDF, and as editable paths with Create Outlines; glyphs using sweep gradients or compositing modes are drawn as images of the glyph. diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index decb8a668d..dc047d9d65 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -33,6 +33,7 @@ mod fonts; pub(crate) mod freeform; pub mod globaledit; pub(crate) mod gradient; +pub mod gradpresets; pub(crate) mod graph; mod halftone; pub mod help; @@ -244,6 +245,7 @@ pub fn command_specs() -> &'static [CommandSpec] { v.extend(style::specs()); v.extend(swatch::specs()); v.extend(gradient::specs()); + v.extend(gradpresets::specs()); v.extend(opacitymask::specs()); v.extend(layer::specs()); v.extend(layerpanel::specs()); @@ -613,6 +615,9 @@ pub use flatten::FlattenOptions; /// A built-in or saved flattener preset ([`crate::Prefs::flattener_presets`]). pub use flatten::FlattenerPreset; +/// A saved Gradient panel preset ([`crate::Prefs::gradient_presets`]) and a row of the Presets list. +pub use gradpresets::{GradientPreset, GradientPresetEntry}; + /// A saved Image Trace preset ([`crate::Prefs::trace_presets`]), and a change to the saved presets. pub use buildcmds::{TracePreset, TracePresetChange}; diff --git a/crates/engine/src/cmd/gradpresets.rs b/crates/engine/src/cmd/gradpresets.rs new file mode 100644 index 0000000000..2f69a9df39 --- /dev/null +++ b/crates/engine/src/cmd/gradpresets.rs @@ -0,0 +1,224 @@ +//! The Gradient panel's presets: ready-made gradients grouped by theme, applied to the gradient +//! behind the active proxy in one click, and the user's own gradients saved beside them. +//! +//! The built-in presets are the gradient swatches of the built-in swatch libraries +//! ([`vectorcraft_color::libraries`]: the app's own computed palettes), each listed under its +//! library's name. Saved presets are kept with the preferences ([`crate::Prefs::gradient_presets`]), +//! so every document has them. A preset is the colour ramp (type, stops, method, dither), not a +//! placement: applying one edits the gradient in place, as `paint.editGradient` does. + +use serde::{Deserialize, Serialize}; +use serde_json::{Value, json}; +use vectorcraft_color::libraries::{GRADIENT_LIBRARIES, SWATCH_LIBRARIES, builtin_library}; +use vectorcraft_color::{Gradient, GradientPaint, Paint}; +use vectorcraft_tools::params::{gradient_params, stops_json}; + +use super::appearance::{edits_stroke, item_target}; +use super::gradient::active_gradient; +use super::{CommandSpec, Result, Session, always, bad, cmd, has_doc, text_param}; + +pub fn specs() -> Vec { + vec![ + cmd!( + query "gradient.presets.list", + "Gradient Presets", + [], + None, + "{} → {presets: [{name, library: the built-in library (theme) it comes from, null for a saved one, builtIn, gradient: {kind, stops, method?, dither?} (as paint.setFill's `gradient`)}]} the Gradient panel's presets: the built-in ones by library, then the saved ones; names are unique", + always, + list + ), + cmd!( + "gradient.presets.apply", + "Apply Gradient Preset", + [], + None, + "{name: a preset's name (gradient.presets.list), stroke?, item?, ids?|id?, target? (as paint.editGradient)} give the gradient behind the active proxy (or the targeted fill or stroke) the preset's type, stops and method, and a fill its dither, keeping its placement; a solid or no paint becomes the gradient. One undo step, as paint.editGradient → {name, ids: the objects painted (none: only the default changed)}", + has_doc, + apply + ), + cmd!( + query "gradient.presets.save", + "Save Gradient Preset", + [], + None, + "{name?: (default: a new \"Gradient Preset N\"; unique, any case, and not a built-in preset's)} save the gradient behind the active proxy (paint.toggleActive picks Fill or Stroke) as a preset, kept with the preferences: its type, stops, method and dither (stops linked to a swatch keep their colour, unlinked) → {name}", + can_save, + save + ), + cmd!( + query "gradient.presets.delete", + "Delete Gradient Preset", + [], + None, + "{name?: a saved preset (default: the saved preset the active proxy's gradient is)} remove a saved preset; built-in presets can't be deleted, and painted art keeps its gradient → {deleted}", + has_saved_presets, + delete + ), + ] +} + +/// A gradient saved to the Gradient panel's presets ([`crate::Prefs::gradient_presets`]). +#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] +pub struct GradientPreset { + pub name: String, + pub gradient: Gradient, +} + +/// A row of the Presets list: a built-in preset (with its library) or a saved one. +#[derive(Clone, Debug, PartialEq)] +pub struct GradientPresetEntry { + pub name: String, + /// The built-in library (theme) it comes from; `None` for a saved preset. + pub library: Option<&'static str>, + pub gradient: Gradient, +} + +/// The built-in presets: every built-in library's gradient swatches, the gradient libraries first. +fn builtin_presets() -> impl Iterator { + GRADIENT_LIBRARIES.iter().chain(SWATCH_LIBRARIES).flat_map(|b| { + let lib = builtin_library(b.id); + let gradients: Vec = lib + .iter() + .flat_map(|lib| lib.iter()) + .filter_map(|w| match &w.paint { + Paint::Gradient(g) => Some(GradientPresetEntry { name: w.name.clone(), library: Some(b.name), gradient: g.gradient.clone() }), + _ => None, + }) + .collect(); + gradients + }) +} + +/// Do `a` and `b` have the same colour ramp (type, method, dither and stops), swatch links aside? +fn same_ramp(a: &Gradient, b: &Gradient) -> bool { + let stop = |x: &vectorcraft_color::GradientStop, y: &vectorcraft_color::GradientStop| { + (x.offset, x.color, x.opacity, x.midpoint) == (y.offset, y.color, y.opacity, y.midpoint) + }; + (a.kind, a.method, a.dither) == (b.kind, b.method, b.dither) + && a.stops.len() == b.stops.len() + && a.stops.iter().zip(&b.stops).all(|(x, y)| stop(x, y)) +} + +/// `g` without links to document swatches: each linked stop keeps the colour it shows. +fn unlinked(g: &Gradient) -> Gradient { + let mut g = g.clone(); + for s in &mut g.stops { + s.set_color(s.color, None); + } + g +} + +impl Session { + /// The Gradient panel's presets: the built-in ones by library, then the saved ones. + pub fn gradient_presets(&self) -> Vec { + let saved = + self.prefs.gradient_presets.iter().map(|p| GradientPresetEntry { name: p.name.clone(), library: None, gradient: p.gradient.clone() }); + builtin_presets().chain(saved).collect() + } + + /// The preset called `name` (any case). + pub fn gradient_preset(&self, name: &str) -> Option { + let name = name.trim(); + self.gradient_presets().into_iter().find(|e| e.name.eq_ignore_ascii_case(name)) + } + + /// The name Save Gradient Preset suggests: the first free "Gradient Preset N". + pub fn next_gradient_preset_name(&self) -> String { + let presets = self.gradient_presets(); + (1..).map(|n| format!("Gradient Preset {n}")).find(|n| !presets.iter().any(|e| e.name.eq_ignore_ascii_case(n))).unwrap_or_default() + } + + /// The name of the preset `g` is (its colour ramp, swatch links aside): a built-in one first, + /// then a saved one. Cheap enough for every frame: nothing is copied but the name found. + pub fn gradient_preset_name(&self, g: &Gradient) -> Option { + let builtin = GRADIENT_LIBRARIES.iter().chain(SWATCH_LIBRARIES).find_map(|b| { + let lib = builtin_library(b.id)?; + lib.iter().find(|w| matches!(&w.paint, Paint::Gradient(x) if same_ramp(&x.gradient, g))).map(|w| w.name.clone()) + }); + builtin.or_else(|| self.prefs.gradient_presets.iter().find(|p| same_ramp(&p.gradient, g)).map(|p| p.name.clone())) + } + + /// The saved preset the gradient behind the active proxy is (its colour ramp, links aside). + pub fn active_saved_gradient_preset(&self) -> Option<&str> { + let g = active_gradient(self)?; + self.prefs.gradient_presets.iter().find(|p| same_ramp(&p.gradient, &g.gradient)).map(|p| p.name.as_str()) + } +} + +fn can_save(s: &Session) -> std::result::Result<(), String> { + active_gradient(s).map(|_| ()).ok_or_else(|| "the active paint is not a gradient".into()) +} + +fn has_saved_presets(s: &Session) -> std::result::Result<(), String> { + if s.prefs.gradient_presets.is_empty() { Err("no saved gradient presets".into()) } else { Ok(()) } +} + +/// `p`'s `name`: a string, required. +fn name_param<'a>(p: &'a Value, cmd: &str) -> Result<&'a str> { + text_param(p, "name", cmd)?.ok_or_else(|| bad(cmd, "missing `name` (see gradient.presets.list)")) +} + +fn list(s: &mut Session, _: &Value) -> Result { + let rows: Vec = s + .gradient_presets() + .into_iter() + .map(|e| json!({"name": e.name, "library": e.library, "builtIn": e.library.is_some(), "gradient": gradient_params(&GradientPaint::new(e.gradient))})) + .collect(); + Ok(json!({ "presets": rows })) +} + +fn apply(s: &mut Session, p: &Value) -> Result { + const C: &str = "gradient.presets.apply"; + let name = name_param(p, C)?; + let preset = s.gradient_preset(name).ok_or_else(|| bad(C, format!("no gradient preset `{name}` (see gradient.presets.list)")))?; + let stroke = edits_stroke(s, p, item_target(s, p, C)?, !s.fill_active, C)?; + let g = &preset.gradient; + let mut edit = p.clone(); + let Some(o) = edit.as_object_mut() else { return Err(bad(C, "params must be an object")) }; + o.remove("name"); + o.insert("stroke".into(), json!(stroke)); + o.insert("kind".into(), json!(g.kind.label().to_lowercase())); + o.insert("stops".into(), stops_json(&g.stops)); + o.insert("method".into(), json!(g.method.label().to_lowercase())); + // Dither is a fill's (paint.editGradient refuses it on a stroke). + if !stroke { + o.insert("dither".into(), json!(g.dither)); + } + let out = s.execute("paint.editGradient", &edit)?; + Ok(json!({"name": preset.name, "ids": out.get("ids").cloned().unwrap_or_else(|| json!([]))})) +} + +fn save(s: &mut Session, p: &Value) -> Result { + const C: &str = "gradient.presets.save"; + let g = active_gradient(s).ok_or_else(|| bad(C, "the active paint is not a gradient"))?; + let name = match text_param(p, "name", C)?.map(str::trim) { + None => s.next_gradient_preset_name(), + Some("") => return Err(bad(C, "the name is empty")), + Some(n) if s.gradient_preset(n).is_some() => return Err(bad(C, format!("a gradient preset is already called {n}"))), + Some(n) => n.to_string(), + }; + s.prefs.gradient_presets.push(GradientPreset { name: name.clone(), gradient: unlinked(&g.gradient) }); + Ok(json!({ "name": name })) +} + +fn delete(s: &mut Session, p: &Value) -> Result { + const C: &str = "gradient.presets.delete"; + let name = match text_param(p, "name", C)? { + Some(n) => n.trim().to_string(), + None => s + .active_saved_gradient_preset() + .map(str::to_string) + .ok_or_else(|| bad(C, "give a name, or paint the active proxy with a saved preset"))?, + }; + if builtin_presets().any(|e| e.name.eq_ignore_ascii_case(&name)) { + return Err(bad(C, format!("{name} is built in and can't be deleted"))); + } + let i = s + .prefs + .gradient_presets + .iter() + .position(|g| g.name.eq_ignore_ascii_case(&name)) + .ok_or_else(|| bad(C, format!("no saved gradient preset called {name}")))?; + Ok(json!({ "deleted": s.prefs.gradient_presets.remove(i).name })) +} diff --git a/crates/engine/src/prefs.rs b/crates/engine/src/prefs.rs index 4c70712f86..05f7880ba1 100644 --- a/crates/engine/src/prefs.rs +++ b/crates/engine/src/prefs.rs @@ -216,6 +216,11 @@ pub struct Prefs { /// `imageTrace.presets.*` edit it. #[serde(skip_serializing_if = "Vec::is_empty")] pub trace_presets: Vec, + /// Gradient panel › Presets: the user's saved gradients (the built-in presets aren't stored). + /// A local library, not a Preferences dialog field: resetting the preferences keeps it; + /// `gradient.presets.*` edit it. + #[serde(skip_serializing_if = "Vec::is_empty")] + pub gradient_presets: Vec, /// Width profiles saved to the Stroke panel's Profile list (`stroke.widthProfile.*`). Not a /// Preferences dialog field, so it has no [`cmd::prefscmds::PREF_SPECS`] row. #[serde(skip_serializing_if = "Vec::is_empty")] @@ -448,6 +453,7 @@ impl Default for Prefs { glyph_snap: Default::default(), flattener_presets: vec![], trace_presets: vec![], + gradient_presets: vec![], width_profiles: vec![], japanese_crop_marks: false, new_art_basic: true, diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 46d74f362f..c0eb9e253f 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -62,6 +62,7 @@ mod globaledit; mod glyphbounds; mod gradient; mod gradpanel; +mod gradpresets; mod gradspan; mod halftone; mod history_mem; diff --git a/crates/engine/src/tests/gradpresets.rs b/crates/engine/src/tests/gradpresets.rs new file mode 100644 index 0000000000..78be419af5 --- /dev/null +++ b/crates/engine/src/tests/gradpresets.rs @@ -0,0 +1,159 @@ +//! The Gradient panel's presets (`gradient.presets.*`): the built-in gradient libraries by theme, +//! applied in place to the gradient behind a proxy, and gradients saved beside them with the +//! preferences. + +use serde_json::{Value, json}; +use vectorcraft_color::{Color, GradientKind, GradientMethod, Paint}; + +use crate::*; + +/// A document with a selected rectangle filled with `fill` (`paint.setFill` params). +fn session_with(fill: Value) -> (Session, NodeId) { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 300, "height": 300})).unwrap(); + let r = s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 100, "height": 50})).unwrap(); + s.execute("paint.setFill", &fill).unwrap(); + (s, NodeId(r["id"].as_u64().unwrap())) +} + +fn paint(s: &Session, id: NodeId, stroke: bool) -> vectorcraft_color::GradientPaint { + let n = s.doc().unwrap().doc.node(id).unwrap(); + match n.appearance.paint_at(None, !stroke).unwrap().clone() { + Paint::Gradient(g) => *g, + p => panic!("expected a gradient, got {p:?}"), + } +} + +fn names(list: &Value) -> Vec { + list["presets"].as_array().unwrap().iter().map(|p| p["name"].as_str().unwrap().to_string()).collect() +} + +#[test] +fn built_in_presets_are_the_gradient_libraries_by_theme_with_unique_names() { + let mut s = Session::new(); + let list = s.execute("gradient.presets.list", &json!({})).unwrap(); + let rows = list["presets"].as_array().unwrap(); + assert!(rows.len() > 40, "{} presets", rows.len()); + assert!(rows.iter().all(|r| r["builtIn"] == true && r["gradient"]["stops"].as_array().is_some_and(|a| a.len() >= 2))); + // Grouped by library, the gradient libraries first, then the swatch libraries holding gradients. + let mut libraries: Vec<&str> = rows.iter().map(|r| r["library"].as_str().unwrap()).collect(); + libraries.dedup(); + assert_eq!(libraries, ["Spectrum Gradients", "Sky Gradients", "Neutral Gradients", "Duotone Gradients", "Radial Glows", "Metallic Gradients"]); + let mut seen = std::collections::HashSet::new(); + assert!(names(&list).iter().all(|n| seen.insert(n.to_lowercase())), "a name names one preset"); + let vignette = rows.iter().find(|r| r["name"] == "Vignette").unwrap(); + assert_eq!((vignette["library"].as_str(), vignette["gradient"]["kind"].as_str()), (Some("Neutral Gradients"), Some("radial"))); +} + +#[test] +fn applying_a_preset_edits_the_gradient_in_place_as_one_undo_step() { + let (mut s, id) = session_with(json!({"gradient": {"angle": 30}})); + s.execute("paint.editGradient", &json!({"dither": true})).unwrap(); + let before = paint(&s, id, false); + let undo = s.doc().unwrap().history.undo.len(); + let r = s.execute("gradient.presets.apply", &json!({"name": "vignette"})).unwrap(); + assert_eq!((r["name"].as_str(), r["ids"].clone()), (Some("Vignette"), json!([id.0]))); + let g = paint(&s, id, false); + let preset = s.gradient_preset("Vignette").unwrap().gradient; + assert_eq!((g.gradient.kind, &g.gradient.stops), (GradientKind::Radial, &preset.stops)); + assert!(!g.gradient.dither, "the fill takes the preset's dither"); + assert_eq!(g.angle, before.angle, "the placement stays"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1, "one undo step"); + assert_eq!(s.gradient_preset_name(&g.gradient).as_deref(), Some("Vignette"), "the gradient is that preset now"); + assert_eq!(s.gradient_preset_name(&before.gradient), None); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(paint(&s, id, false), before); +} + +#[test] +fn a_preset_applies_to_the_stroke_and_to_a_solid_paint() { + let (mut s, id) = session_with(json!({"color": "#336699"})); + s.execute("paint.setStroke", &json!({"color": "#000000", "focus": false})).unwrap(); + s.execute("gradient.presets.apply", &json!({"name": "Gold"})).unwrap(); + let gold = s.gradient_preset("Gold").unwrap(); + assert_eq!((gold.library, paint(&s, id, false).gradient.stops), (Some("Metallic Gradients"), gold.gradient.stops.clone())); + // With the Stroke proxy in front (or `stroke: true`) the stroke takes it; dither isn't sent. + s.execute("paint.toggleActive", &json!({"fill": false})).unwrap(); + s.execute("gradient.presets.apply", &json!({"name": "Dawn"})).unwrap(); + assert_eq!(paint(&s, id, true).gradient.stops, s.gradient_preset("Dawn").unwrap().gradient.stops); + assert_eq!(paint(&s, id, false).gradient.stops, gold.gradient.stops, "the fill keeps its gradient"); + for bad in [json!({}), json!({"name": 3}), json!({"name": "No Such Preset"})] { + assert!(s.execute("gradient.presets.apply", &bad).is_err(), "{bad}"); + } +} + +#[test] +fn saving_listing_applying_and_deleting_a_preset() { + let stops = json!([{"offset": 0, "color": "#ff0000"}, {"offset": 0.4, "color": "#00ff00", "opacity": 0.5, "midpoint": 0.3}, {"offset": 1, "color": "#0000ff"}]); + let (mut s, id) = session_with(json!({"gradient": {"kind": "radial", "stops": stops, "method": "perceptual"}})); + // A stop linked to a document swatch is saved with its colour, unlinked. + s.execute("swatch.new", &json!({"name": "Brand", "color": "#123456", "global": true})).unwrap(); + s.execute("gradient.selectStop", &json!({"index": 1})).unwrap(); + let mut linked = paint(&s, id, false).gradient.stops.clone(); + linked[1].set_color(Color::rgb8(0x12, 0x34, 0x56), Some(("Brand".into(), 1.0))); + s.execute("paint.editGradient", &json!({"stops": vectorcraft_tools::params::stops_json(&linked)})).unwrap(); + assert_eq!(paint(&s, id, false).gradient.stops[1].swatch.as_deref(), Some("Brand")); + assert_eq!(s.next_gradient_preset_name(), "Gradient Preset 1"); + assert_eq!(s.execute("gradient.presets.save", &json!({})).unwrap()["name"], "Gradient Preset 1"); + let saved = &s.prefs.gradient_presets[0].gradient; + assert_eq!((saved.kind, saved.method, saved.stops.len()), (GradientKind::Radial, GradientMethod::Perceptual, 3)); + assert_eq!((saved.stops[1].swatch.as_ref(), saved.stops[1].color), (None, Color::rgb8(0x12, 0x34, 0x56))); + assert_eq!(s.active_saved_gradient_preset(), Some("Gradient Preset 1"), "the shown gradient is that preset"); + // Listed after the built-in ones, without a library. + let list = s.execute("gradient.presets.list", &json!({})).unwrap(); + let last = list["presets"].as_array().unwrap().last().unwrap().clone(); + assert_eq!((last["name"].as_str(), last["builtIn"].as_bool(), last["library"].clone()), (Some("Gradient Preset 1"), Some(false), Value::Null)); + // Names are unique, any case, and never a built-in preset's. + for (name, why) in [("gradient preset 1", "taken"), ("Sunset", "built in"), (" ", "empty")] { + assert!(s.execute("gradient.presets.save", &json!({"name": name})).is_err(), "{why}"); + } + s.execute("paint.editGradient", &json!({"reverse": true})).unwrap(); + assert_eq!(s.execute("gradient.presets.save", &json!({"name": " Mine "})).unwrap()["name"], "Mine"); + // A saved preset applies to other art like a built-in one. + let r = s.execute("shape.ellipse", &json!({"x": 10, "y": 10, "width": 40, "height": 40})).unwrap(); + let other = NodeId(r["id"].as_u64().unwrap()); + s.execute("gradient.presets.apply", &json!({"name": "Mine"})).unwrap(); + assert_eq!(paint(&s, other, false).gradient, s.prefs.gradient_presets[1].gradient); + // Delete: built-in ones stay; without a name, the saved preset the active proxy shows. + assert!(s.execute("gradient.presets.delete", &json!({"name": "Sunset"})).is_err()); + assert!(s.execute("gradient.presets.delete", &json!({"name": "Nothing"})).is_err()); + assert_eq!(s.execute("gradient.presets.delete", &json!({})).unwrap()["deleted"], "Mine"); + assert!(s.execute("gradient.presets.delete", &json!({})).is_err(), "the ellipse's gradient is no saved preset now"); + assert_eq!(s.execute("gradient.presets.delete", &json!({"name": "GRADIENT PRESET 1"})).unwrap()["deleted"], "Gradient Preset 1"); + assert!((crate::find_command("gradient.presets.delete").unwrap().enabled)(&s).is_err(), "nothing left to delete"); +} + +#[test] +fn saving_needs_a_gradient_behind_the_proxy() { + let (mut s, _) = session_with(json!({"color": "#336699"})); + assert!((crate::find_command("gradient.presets.save").unwrap().enabled)(&s).is_err()); + assert!(s.execute("gradient.presets.save", &json!({})).is_err()); + // A gradient stroke is saved with the Stroke proxy in front. + s.execute("paint.setStroke", &json!({"gradient": {"kind": "radial"}, "focus": false})).unwrap(); + assert!(s.execute("gradient.presets.save", &json!({})).is_err(), "the Fill is in front"); + s.execute("paint.toggleActive", &json!({"fill": false})).unwrap(); + assert_eq!(s.execute("gradient.presets.save", &json!({"name": "Ring"})).unwrap()["name"], "Ring"); + assert_eq!(s.prefs.gradient_presets[0].gradient.kind, GradientKind::Radial); + assert!(s.execute("gradient.presets.save", &json!({"name": 7})).is_err(), "a name is text"); +} + +#[test] +fn saved_presets_round_trip_with_the_preferences() { + let (mut s, _) = session_with(json!({"gradient": {}})); + s.execute("gradient.presets.save", &json!({"name": "Mine"})).unwrap(); + let json = s.prefs.to_json(); + assert_eq!(json["gradientPresets"][0]["name"], "Mine"); + let back: Prefs = serde_json::from_value(json).unwrap(); + assert_eq!(back, s.prefs); + // Without saved presets nothing is written, and older preference files load with none. + assert!(Prefs::default().to_json().get("gradientPresets").is_none()); + let old: Prefs = serde_json::from_value(json!({"keyboardIncrement": 2})).unwrap(); + assert!(old.gradient_presets.is_empty()); + // Resetting the preferences keeps them. + s.execute("prefs.reset", &json!({})).unwrap(); + assert_eq!(s.prefs.gradient_presets.len(), 1); + // A restarted session (preferences applied from the saved file) lists them again. + let mut fresh = Session::new(); + fresh.apply_prefs(back); + assert!(fresh.gradient_preset("mine").is_some_and(|e| e.library.is_none())); +} diff --git a/crates/ui-egui/src/panels/gradient.rs b/crates/ui-egui/src/panels/gradient.rs index 7fa3926b9d..0f6bcf3958 100644 --- a/crates/ui-egui/src/panels/gradient.rs +++ b/crates/ui-egui/src/panels/gradient.rs @@ -19,6 +19,11 @@ //! A freeform gradient shows its section instead of the angle, aspect and slider: the Draw //! toggle (Points or Lines: how the Gradient tool adds points) and the selected point's colour //! (edited in the Color panel), opacity and spread, with Delete Point. +//! +//! The Presets menu lists ready-made gradients by theme (the built-in gradient libraries), then +//! the gradients saved with the panel menu's Save Gradient Preset…; choosing one applies it to the +//! gradient behind the active proxy, keeping its placement (`gradient.presets.*`). Hide Presets in +//! the panel menu leaves the row out. use egui::{Color32, Pos2, Rect, Sense, Stroke, StrokeKind, Ui, pos2, vec2}; use serde_json::{Value, json}; @@ -42,6 +47,8 @@ const ANGLE_PRESETS: [f64; 9] = [-180.0, -135.0, -90.0, -45.0, 0.0, 45.0, 90.0, const ASPECT_PRESETS: [f64; 9] = [10.0, 25.0, 50.0, 75.0, 100.0, 150.0, 200.0, 300.0, 400.0]; /// Panel-state key of Show/Hide Options. const HIDE_OPTIONS: &str = "gradient-hide-options"; +/// Panel-state key of Show/Hide Presets. +const HIDE_PRESETS: &str = "gradient-hide-presets"; /// Panel-state key of the selected midpoint diamond. const MID_SELECTED: &str = "grad-mid"; @@ -277,6 +284,10 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } return; } + if !pstate::(ui.ctx(), HIDE_PRESETS) { + ui.add_space(4.0); + presets_row(app, ui, is_grad.then_some(&g)); + } // How the gradient lies on the stroke behind the Stroke proxy (a linear or radial one). let stroke_mode = (!app.session.fill_active && is_grad && !freeform).then(|| app.session.shown_stroke().map(|st| st.gradient_mode)).flatten(); ui.add_space(4.0); @@ -380,6 +391,64 @@ fn method_row(app: &mut VectorcraftApp, ui: &mut Ui, g: &GradientPaint, is_grad: }); } +/// The Presets row: a menu of the preset gradients by library (theme), then the +/// saved ones; a choice applies to the gradient behind the active proxy, keeping its placement +/// (`gradient.presets.apply`; a solid or no paint becomes the gradient). The menu shows the preset +/// the gradient is, if any. +fn presets_row(app: &mut VectorcraftApp, ui: &mut Ui, g: Option<&GradientPaint>) { + let shown = g.and_then(|g| app.session.gradient_preset_name(&g.gradient)).unwrap_or_default(); + let enabled = crate::menus::enabled(app, "gradient.presets.apply"); + ui.horizontal(|ui| { + widgets::dim_label(ui, tl!("Presets:")); + let chosen = ui.add_enabled_ui(enabled, |ui| widgets::combo(ui, "grad-presets", &shown, 150.0, |ui| preset_list(app, ui, &shown))).inner; + if let Some(name) = chosen { + app.run("gradient.presets.apply", json!({ "name": name })).ok(); + } + }); +} + +/// The Presets menu's rows: each library's name over its presets, then the saved presets. Returns +/// the name of the one clicked. +fn preset_list(app: &VectorcraftApp, ui: &mut Ui, shown: &str) -> Option { + let t = Tokens::get(ui.ctx()); + ui.set_min_width(200.0); + let mut chosen = None; + // The library of the rows drawn last (`Some(None)`: the saved presets). + let mut library: Option> = None; + for e in app.session.gradient_presets() { + if library != Some(e.library) { + if library.is_some() { + ui.add_space(2.0); + } + library = Some(e.library); + widgets::dim_label(ui, e.library.map_or(tl!("Saved"), |l| tl!(l))); + } + if gradient_row(ui, &t, &GradientPaint::new(e.gradient), &e.name, e.name == shown).clicked() { + chosen = Some(e.name); + } + } + chosen +} + +/// A menu row: a chip of `g` and `name` (lit when `marked`). +fn gradient_row(ui: &mut Ui, t: &Tokens, g: &GradientPaint, name: &str, marked: bool) -> egui::Response { + let (row, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 22.0), Sense::click()); + // A long menu scrolls: rows out of view are laid out but not drawn, as labels aren't. + if !ui.is_rect_visible(row) { + return resp; + } + if marked { + ui.painter().rect_filled(row, 0.0, t.row_selected); + } else if resp.hovered() { + ui.painter().rect_filled(row, 0.0, t.hover); + } + let chip = Rect::from_min_size(row.left_center() + vec2(4.0, -8.0), vec2(16.0, 16.0)); + widgets::gradient_chip(ui, chip, g); + ui.painter().rect_stroke(chip, 0.0, Stroke::new(1.0, t.border), StrokeKind::Inside); + ui.painter().text(chip.right_center() + vec2(8.0, 0.0), egui::Align2::LEFT_CENTER, name, egui::FontId::proportional(12.5), t.text); + resp +} + /// The freeform points shown: the gradient's own, else (unplaced) as many as it places, coloured /// along the stops. pub(crate) fn shown_points(g: &GradientPaint) -> std::borrow::Cow<'_, Freeform> { @@ -478,18 +547,8 @@ fn thumbnail(app: &mut VectorcraftApp, ui: &mut Ui, g: &GradientPaint, is_grad: widgets::dim_label(ui, tl!("No gradient swatches")); } for (name, grad) in &swatches { - let (row, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 22.0), Sense::click()); - // The gradient swatch the gradient was applied from. - if g.swatch.as_ref() == Some(name) { - ui.painter().rect_filled(row, 0.0, t.row_selected); - } else if resp.hovered() { - ui.painter().rect_filled(row, 0.0, t.hover); - } - let chip = Rect::from_min_size(row.left_center() + vec2(4.0, -8.0), vec2(16.0, 16.0)); - widgets::gradient_chip(ui, chip, grad); - ui.painter().rect_stroke(chip, 0.0, Stroke::new(1.0, t.border), StrokeKind::Inside); - ui.painter().text(chip.right_center() + vec2(8.0, 0.0), egui::Align2::LEFT_CENTER, name, egui::FontId::proportional(12.5), t.text); - if resp.clicked() { + // The gradient swatch the gradient was applied from is lit. + if gradient_row(ui, &t, grad, name, g.swatch.as_ref() == Some(name)).clicked() { chosen = Some(name.clone()); } } @@ -832,6 +891,20 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { if menu_item(ui, tl!("Reset to White, Black"), true, false) { set_stops(app, &Gradient::default().stops, None, Live::Released); } + ui.separator(); + let presets_hidden: bool = pstate(ui.ctx(), HIDE_PRESETS); + if menu_item(ui, if presets_hidden { tl!("Show Presets") } else { tl!("Hide Presets") }, true, false) { + set_pstate(ui.ctx(), HIDE_PRESETS, !presets_hidden); + } + if menu_item(ui, tl!("Save Gradient Preset…"), crate::menus::enabled(app, "gradient.presets.save"), false) { + let name = app.session.next_gradient_preset_name(); + let p = json!({"command": "gradient.presets.save", "label": "Gradient Preset", "params": {"name": name}}); + app.run("ui.paramDialog", p).ok(); + } + // Deletes the saved preset the gradient behind the active proxy is. + if menu_item(ui, tl!("Delete Gradient Preset"), app.session.active_saved_gradient_preset().is_some(), false) { + app.run("gradient.presets.delete", json!({})).ok(); + } } #[cfg(test)] diff --git a/crates/ui-egui/src/panels/gradient/tests.rs b/crates/ui-egui/src/panels/gradient/tests.rs index 0a1f601148..7d9dcbf9ea 100644 --- a/crates/ui-egui/src/panels/gradient/tests.rs +++ b/crates/ui-egui/src/panels/gradient/tests.rs @@ -98,6 +98,17 @@ impl Panel { /// One frame with `events` (and `modifiers` held); returns the texts drawn and where. fn frame(&mut self, app: &mut VectorcraftApp, events: Vec, modifiers: Modifiers) -> Vec<(String, Pos2)> { + self.frame_of(app, events, modifiers, show) + } + + /// [`Self::frame`] drawing `draw` (the panel, or its menu) instead of the panel. + fn frame_of( + &mut self, + app: &mut VectorcraftApp, + events: Vec, + modifiers: Modifiers, + draw: fn(&mut VectorcraftApp, &mut Ui), + ) -> Vec<(String, Pos2)> { fn texts(s: &egui::Shape, out: &mut Vec<(String, Pos2)>) { match s { egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.pos + t.galley.rect.center().to_vec2())), @@ -114,7 +125,7 @@ impl Panel { screen_rect: Some(Rect::from_min_size(Pos2::ZERO, vec2(260.0, 600.0))), ..Default::default() }; - let mut out = self.ctx.run_ui(input, |ui| show(app, ui)); + let mut out = self.ctx.run_ui(input, |ui| draw(app, ui)); out.textures_delta.clear(); let mut v = vec![]; out.shapes.iter().for_each(|c| texts(&c.shape, &mut v)); @@ -145,6 +156,29 @@ impl Panel { self.frame(app, vec![], Modifiers::NONE) } + /// A click at `at` on the panel menu (drawn alone); returns the menu's texts after it. + fn menu_click(&mut self, app: &mut VectorcraftApp, at: Pos2) -> Vec<(String, Pos2)> { + let b = |pressed| Event::PointerButton { pos: at, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE }; + self.frame_of(app, vec![Event::PointerMoved(at), b(true)], Modifiers::NONE, menu); + self.frame_of(app, vec![b(false)], Modifiers::NONE, menu); + self.frame_of(app, vec![], Modifiers::NONE, menu) + } + + /// The first widget right of `at` on its row (last frame). + fn widget_after(&self, at: Pos2) -> Rect { + let mut v: Vec = self.ctx.viewport(|vp| { + vp.prev_pass + .widgets + .layers() + .flat_map(|(_, w)| w.iter()) + .map(|w| w.rect) + .filter(|r| (r.center().y - at.y).abs() < 8.0 && r.left() > at.x) + .collect() + }); + v.sort_by(|a, b| a.left().total_cmp(&b.left())); + *v.first().expect("a widget right of it") + } + /// The `size`-square widgets right of `at` on its row (last frame), left to right. fn row_after(&self, at: Pos2, size: f32) -> Vec { let mut v: Vec = self.ctx.viewport(|vp| { @@ -579,3 +613,91 @@ fn the_stop_popover_has_an_eyedropper_for_a_stop() { h.run_steps(3); assert!(h.query_by_label(TIP).is_none(), "no eyedropper for a freeform point"); } + +/// Where text `s` was drawn (menu items are drawn indented). +fn text_at(texts: &[(String, Pos2)], s: &str) -> Option { + texts.iter().find(|(t, _)| t.trim_start() == s).map(|(_, at)| *at) +} + +/// The Presets menu lists the presets by library (theme) and applies the one chosen to the +/// gradient behind the active proxy, as one undo step; the menu then shows that preset. +#[test] +fn the_presets_menu_applies_a_preset_and_shows_it() { + let mut app = app(json!({"gradient": {"angle": 30}})); + let mut p = Panel::new(); + let texts = p.frame(&mut app, vec![], Modifiers::NONE); + let label = text_at(&texts, "Presets:").unwrap_or_else(|| panic!("the Presets row: {texts:?}")); + let combo = p.widget_after(label); + let texts = p.click(&mut app, combo.center()); + assert!(text_at(&texts, "Spectrum Gradients").is_some(), "a library's name heads its presets: {texts:?}"); + let soft = text_at(&texts, "Soft Spectrum").expect("the library's presets"); + let undo = app.session.doc().unwrap().history.undo.len(); + p.click(&mut app, soft); + let preset = app.session.gradient_preset("Soft Spectrum").unwrap().gradient; + assert_eq!(fill(&app).gradient.stops, preset.stops); + assert_eq!(fill(&app).angle, 30.0, "the placement stays"); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1, "one undo step"); + let texts = p.frame(&mut app, vec![], Modifiers::NONE); + assert!(text_at(&texts, "Soft Spectrum").is_some(), "the menu shows the preset: {texts:?}"); + // With the Stroke proxy in front a solid stroke takes the preset; the fill keeps its own. + app.run("paint.setStroke", json!({"color": "#00ff00", "focus": false})).unwrap(); + let stroke = p.widget("stroke-proxy"); + p.click(&mut app, stroke.right_bottom() - vec2(2.0, 2.0)); + assert!(!app.session.fill_active); + let texts = p.click(&mut app, combo.center()); + p.click(&mut app, text_at(&texts, "Spectrum").expect("the first preset")); + let Paint::Gradient(st) = app.session.shown_stroke().unwrap().paint.clone() else { panic!("a gradient stroke") }; + assert_eq!(st.gradient.stops, app.session.gradient_preset("Spectrum").unwrap().gradient.stops); + assert_eq!(fill(&app).gradient.stops, preset.stops); +} + +/// The panel menu saves the gradient as a preset (named in a dialog), which the Presets menu then +/// lists under Saved; Delete Gradient Preset removes it, and Hide Presets leaves the row out. +#[test] +fn the_panel_menu_saves_deletes_and_hides_presets() { + let stops = json!([{"offset": 0, "color": "#ff0000"}, {"offset": 1, "color": "#0000ff"}]); + let mut app = app(json!({"gradient": {"stops": stops}})); + let mut p = Panel::new(); + let texts = p.frame_of(&mut app, vec![], Modifiers::NONE, menu); + let save = text_at(&texts, "Save Gradient Preset…").unwrap_or_else(|| panic!("{texts:?}")); + assert!(!app.session.active_saved_gradient_preset().is_some()); + p.menu_click(&mut app, save); + let d = app.ui.dialog.take().expect("the name dialog"); + assert_eq!((d.fields["__command"].as_str(), d.fields["name"].as_str()), (Some("gradient.presets.save"), Some("Gradient Preset 1"))); + // The dialog's OK runs the command with the name typed. + app.run("gradient.presets.save", json!({"name": "Red Blue"})).unwrap(); + assert_eq!(app.session.active_saved_gradient_preset(), Some("Red Blue")); + let texts = p.frame(&mut app, vec![], Modifiers::NONE); + let label = text_at(&texts, "Presets:").unwrap(); + assert!(text_at(&texts, "Red Blue").is_some(), "the menu shows the saved preset the gradient is: {texts:?}"); + let texts = p.click(&mut app, p.widget_after(label).center()); + // The saved presets come after the libraries: scroll the menu to them. + let over = text_at(&texts, "Spectrum").expect("the menu is open"); + let wheel = Event::MouseWheel { + unit: egui::MouseWheelUnit::Point, + delta: vec2(0.0, -5000.0), + phase: egui::TouchPhase::Move, + modifiers: Modifiers::NONE, + source: egui::MouseWheelSource::Unknown, + }; + p.frame(&mut app, vec![Event::PointerMoved(over), wheel], Modifiers::NONE); + let mut texts = vec![]; + for _ in 0..30 { + texts = p.frame(&mut app, vec![], Modifiers::NONE); + } + let saved = text_at(&texts, "Saved").unwrap_or_else(|| panic!("the saved presets have their heading: {texts:?}")); + assert!(texts.iter().any(|(t, at)| t.trim_start() == "Red Blue" && at.y > saved.y), "the saved preset under it: {texts:?}"); + assert!(text_at(&texts, "Spectrum").is_none(), "rows scrolled out of view aren't drawn: {texts:?}"); + // Delete Gradient Preset removes the one the gradient is. + let texts = p.frame_of(&mut app, vec![], Modifiers::NONE, menu); + p.menu_click(&mut app, text_at(&texts, "Delete Gradient Preset").unwrap()); + assert!(app.session.prefs.gradient_presets.is_empty()); + // Hide Presets leaves the row out; Show Presets brings it back. + let texts = p.frame_of(&mut app, vec![], Modifiers::NONE, menu); + let texts = p.menu_click(&mut app, text_at(&texts, "Hide Presets").unwrap()); + assert!(text_at(&texts, "Show Presets").is_some()); + assert!(text_at(&p.frame(&mut app, vec![], Modifiers::NONE), "Presets:").is_none()); + let texts = p.frame_of(&mut app, vec![], Modifiers::NONE, menu); + p.menu_click(&mut app, text_at(&texts, "Show Presets").unwrap()); + assert!(text_at(&p.frame(&mut app, vec![], Modifiers::NONE), "Presets:").is_some()); +} diff --git a/docs/gaps.md b/docs/gaps.md index 2c3df02c12..b7c58f5a72 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (G1: Average & Join with a corner or smooth choice, Cmd+Alt+Shift+J, done; estimate unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (G13: gradient presets done; G1: Average & Join with a corner or smooth choice, Cmd+Alt+Shift+J, done; estimate unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -459,7 +459,11 @@ from G14 and the budget run of G15: **~170–270 h** one agent, ~50–80 h wall segments for drawn lines. Controls are saved under Preferences › Smart Guides › Geometric Guides and available from Control bar › Snapping; both default to on. Existing-line endpoint editing and other tool cases remain unverified. [Public source](https://helpx.adobe.com/illustrator/desktop/measure-and-align/plot-and-measure/snap-to-perpendicular.html). -- **Missing:** gradient presets (30.0); remaining tangent/perpendicular snapping cases and the consolidated +- **Done (2026-10-30):** gradient presets (30.0): the Gradient panel's Presets menu applies one of the + built-in gradient libraries' presets (by theme) or a saved one to the gradient behind the active proxy, keeping + its placement, as one undo step; the panel menu saves the gradient as a preset (kept with the preferences) and + deletes saved ones; `gradient.presets.*` commands. +- **Missing:** remaining tangent/perpendicular snapping cases and the consolidated snapping options (30.0); artboard colors in exports and print, and managing artboards from the canvas other than locking and unlocking them from the Artboard tool's right-click menu (30.0); the Blend panel with ease in/out and separate colour acceleration (30.7); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 31de3148e9..fa92c378dd 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Presentation Mode fits the active artboard and hides selections, guides, grids and artboard edges; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Gradient panel presets done; Gradient stop popover: an eyedropper samples the stop's colour from the art (#4681); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -112,14 +112,14 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); open-path anchor Delete keeps gaps; Select › Start Global Edit finds the paths, compound paths and symbol instances of the selected object's shape (Appearance, Size and artboard options) and gives an edit of one to all of them in proportion, as one undo step (#3521); the Align panel menu's Align to Glyph Bounds › Point Text and Area Text measure type by its glyphs' ink for Align and Distribute (#4231); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups and excluding a match with Shift-click, transform nuances (no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | estimated; Global Edit regression-tested (`crates/engine/src/tests/globaledit.rs`; Quick Action, menu label and Escape in `panels::properties::tests::start_global_edit_quick_action_and_escape`) | | Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself), its gap detection and options; Live Paint Gap Options | 4–8 | estimated (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient dither, perceptual blending and gradient presets; freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251) | +| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient dither and perceptual blending (presets are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251) | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder misses planar regions in real files (#937), its gap detection and options; Live Paint Gap Options | 4–8 | estimated (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient presets (gradient dither and perceptual blending are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's perceptual blending and gradient presets (gradient dither is done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient dither, perceptual blending and gradient presets; freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | +| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient additions are done (dither, perceptual blending, presets); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | +| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's perceptual blending (gradient dither and presets are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | +| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient dither and perceptual blending (presets are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | | Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder misses planar regions in real files (#937); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient presets (gradient dither and perceptual blending are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251) | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's perceptual blending and gradient presets (gradient dither is done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251) | +| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient additions are done (dither, perceptual blending, presets); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251) | +| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's perceptual blending (gradient dither and presets are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251) | | Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (four generated libraries, User Defined, Other Library…, Save Brushes); remaining: Art brush Overlap, Pattern brush auto corners, pen pressure on macOS, tilt/bearing/rotation | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | | Appearance, transparency, graphic styles, masks | 5 | 97% | raster effect reach in preview bounds | 1–2 | estimated | | 3D and Materials (and Turntable) | 4 | ~25% | live Revolve with automatic smooth vector shading and default-on continuous circular caps, Extrude & Bevel (twist, taper, caps, five bevel shapes), Inflate and Rotate with Position presets (colored Inflate uses smooth membrane lighting; white-light Inflate retains its existing shading; Extrude & Bevel and Rotate retain planar shading; one to ten colored lights, shared neutral ambient, painter visibility); materials, light presets, shadows, ray tracing, 3D Classic, Turntable views, 3D export | 30–55 | estimated (Extrude & Bevel, Inflate and Rotate added 2026-10-12) | @@ -1562,6 +1562,7 @@ spot colours, carry a colour adjustment, or are RGB, CMYK or grayscale images | 2026-10-22 | minor | Merge current main and complete the Turkish tab-drag labels and validation messages requested by the maintainer; all 24 catalogs covered; scores and estimates unchanged. | | 2026-10-22 | minor | Tab-drag follow-up: reconcile upstream progress updates and document drag lifecycle, insertion behavior and regression contracts; behavior, scores and estimates unchanged. | | 2026-10-22 | minor | Artwork dragged with Selection switches visible document tabs after a 400 ms hover, then copies editable artwork on canvas release; source and clipboard stay intact; scores and hours unchanged | +| 2026-10-30 | minor | Gradient panel presets (30.0) done: the colour area no longer lists them; scores and estimates unchanged. | 2026-10-28 Flare interaction: the center drag turns only the rays by one degree per document point of increasing pointer y and back at the same rate for decreasing y. This is an application rule independent of event frequency. Shift keeps the current turn; Space during either drag moves the flare without changing its size or turn, including the first drag sample. Releasing a modifier resumes from the current pointer position without catching up skipped rotation. Scores and remaining estimates unchanged. ## EPS Save evidence (2026-10-26) diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e2c9536ed7..e5df92c824 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Smart Pen add-on: an Alt-drag away from paths selects points with a marquee; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Gradient panel presets; View › Hide Artboards hides their edges and shows the canvas as paper (#4038); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -313,6 +313,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Blend panel (30.7) | partial | Window › Blend provides Type (Ease In, Ease Out, Ease In Out, Ease Out In), Ramp 0–100% and independent color Shift, alongside the existing blend controls. Easing is disabled without a spine. Original polynomial distributions approximate the publicly documented behavior; on-canvas easing handles remain missing. [Public source](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blend-panel-overview.html) | | Gradient panel: Dither (30.0) | done | Dither box under the stops (`paint.editGradient` `dither`); dimmed behind the Stroke proxy, fills only; `panels::gradient` test | | Gradient panel: Method, Classic or Perceptual (30.0) | done | Method menu under the Stroke buttons for linear and radial gradients (`paint.editGradient` `method`); [public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/create-and-edit-gradients/control-perceptual-interpolation-in-gradients.html); `panels::gradient` test | +| Gradient panel: Presets (30.0) | done | Presets menu by library (theme) plus Saved: applies a preset to the gradient behind the active proxy, keeping its placement, one undo step; panel menu Save Gradient Preset…, Delete Gradient Preset, Hide/Show Presets (`gradient.presets.*`); `panels::gradient` tests | | SVG Interactivity, Retype, Comments, Version History panels | missing | the last two are cloud features (out of scope) | | Workspaces (save, reset, switch); each remembers the layout changes made in it across switches and restarts until Reset | done | `UiState::workspace_changes` | | Background Export: a progress dialog with the file name, the artboard count and a bar (busy for one artboard and for formats made in one go), Cancel (Esc) and Continue in Background; it opens after 0.4 s and never over another dialog. A cancelled export writes no file | done | #2564; on the shared `vectorcraft_doc::cancel` token (#2546), so a cancelled render keeps no half-drawn pattern tile or effect raster. The bar moves between artboards, not within one. Save As, Export for Screens and Export Selection don't show it yet | @@ -388,6 +389,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | 2026-10-30 | minor | Art moved whole with the Direct Selection or Group Selection tool and dragged off the canvas goes to the panels (Asset Export, Graphic Styles, Swatches, Symbols) as with the Selection tool; anchor points and segments dragged off stay a reshape (#4233). Tests in `crates/ui-egui/src/canvas/tests.rs`; scores and estimates unchanged | | 2026-10-30 | minor | Blob Brush and Eraser Tool Options: Size follows the pen pressure, Fixed or Pressure with a Variation (#4590, #3961); scores and estimates unchanged | | 2026-10-30 | minor | Blob Brush Tool Options: Size follows the pen pressure, Fixed or Pressure with a Variation (#4590); scores and estimates unchanged | +| 2026-10-30 | minor | Gradient panel: Presets menu and Save/Delete Gradient Preset (30.0); scores and estimates unchanged | | 2026-10-29 | minor | Pathfinder: live compound shapes (#4522): the panel menu's Make, Release and Expand Compound Shape, Alt-clicking a Shape Mode, a selected member's Shape Mode and the Expand button act; scores and estimates unchanged | | 2026-10-29 | minor | Object › Path › Smooth… with its slider and Auto-Smooth (#4115); scores and estimates unchanged | | 2026-10-25 | minor | Selection tool: a double-click on a threaded port breaks the thread there (`text.thread.break`); scores and estimates unchanged | From 051b5d8583863318939a5862c60a90992ad7c872 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 19:50:57 +0700 Subject: [PATCH 031/227] Docs: one area-table row each for Path operations and Colour again --- docs/target-app-parity.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index fa92c378dd..98caa6b859 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -111,15 +111,8 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de |---|---:|---:|---|---:|---| | Selection, transform & align tools | 6 | 85% | Direct Selection segment click/Delete corrected (#1278); open-path anchor Delete keeps gaps; Select › Start Global Edit finds the paths, compound paths and symbol instances of the selected object's shape (Appearance, Size and artboard options) and gives an edit of one to all of them in proportion, as one undo step (#3521); the Align panel menu's Align to Glyph Bounds › Point Text and Area Text measure type by its glyphs' ink for Align and Distribute (#4231); remaining: Free Transform/Scale/Reflect along a rotated box, Global Edit of similar groups and excluding a match with Shift-click, transform nuances (no-op anchor Align history regression-tested, #1180 follow-up) | 4–6 | estimated; Global Edit regression-tested (`crates/engine/src/tests/globaledit.rs`; Quick Action, menu label and Escape in `panels::properties::tests::start_global_edit_quick_action_and_escape`) | | Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 85% | Shaper construction widget, Pencil/Pen nuances, Blob Brush options, Touch Type, Dimension tool; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged | -| Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself), its gap detection and options; Live Paint Gap Options | 4–8 | estimated (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient dither and perceptual blending (presets are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251) | -| Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder misses planar regions in real files (#937), its gap detection and options; Live Paint Gap Options | 4–8 | estimated (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | +| Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | | Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient additions are done (dither, perceptual blending, presets); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's perceptual blending (gradient dither and presets are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient dither and perceptual blending (presets are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged | -| Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 80% | Shape Builder misses planar regions in real files (#937); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options; Live Paint Gap Options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog (lowered from 86%: open issues); compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522) | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's gradient additions are done (dither, perceptual blending, presets); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251) | -| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | 30.0's perceptual blending (gradient dither and presets are done); freeform and mixed spot/process gradients in SVG/PDF | 4–7 | estimated; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251) | | Strokes, brushes, width profiles | 5 | 88% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (four generated libraries, User Defined, Other Library…, Save Brushes); remaining: Art brush Overlap, Pattern brush auto corners, pen pressure on macOS, tilt/bearing/rotation | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) | | Appearance, transparency, graphic styles, masks | 5 | 97% | raster effect reach in preview bounds | 1–2 | estimated | | 3D and Materials (and Turntable) | 4 | ~25% | live Revolve with automatic smooth vector shading and default-on continuous circular caps, Extrude & Bevel (twist, taper, caps, five bevel shapes), Inflate and Rotate with Position presets (colored Inflate uses smooth membrane lighting; white-light Inflate retains its existing shading; Extrude & Bevel and Rotate retain planar shading; one to ten colored lights, shared neutral ambient, painter visibility); materials, light presets, shadows, ray tracing, 3D Classic, Turntable views, 3D export | 30–55 | estimated (Extrude & Bevel, Inflate and Rotate added 2026-10-12) | From d38994c77d38096eab5da0817daeb287778bdc42 Mon Sep 17 00:00:00 2001 From: Patrik Lermon Date: Fri, 30 Oct 2026 10:53:39 +0100 Subject: [PATCH 032/227] i18n(sv): translate 32 new strings, use the agreed terms in 11 Brings the Swedish catalog up to date with upstream main (a8ec515e1). Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/i18n/sv.tsv | 54 +++++++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 398845645f..f4284b66e7 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -184,7 +184,7 @@ Anti-aliased Artwork Kantutjämnad grafik Anti-aliasing: Kantutjämning: Any Kind Alla typer - Font Technology Teckensnittsteknik + Font Technology Typsnittsteknik font-technology Variable Variabla Appearance Utseende Appearance Attribute Utseendeattribut @@ -2262,7 +2262,7 @@ font-technology Variable Variabla Percent: Procent: Perceptual Scales Perceptuella skalor Performance Prestanda - Plug-ins & Scratch Disks Insticksprogram & Arbetsdiskar + Plug-ins & Scratch Disks Plugins & arbetsdiskar Permissions Behörigheter Permissions password: Lösenord för behörigheter: Perspective Perspektiv @@ -5504,7 +5504,7 @@ swatch Yellow Green Gulgrön @msg “{name}” is not a file ”{name}” är inte en fil @msg The image is {_1} × {_2} pixels, more than {LARGE_TRACE_SIDE} on a side: it is traced, but more slowly. A lower-fidelity preset or a smaller copy of the image traces faster. Bilden är {_1} × {_2} pixlar, mer än {LARGE_TRACE_SIDE} på en sida: den vektoriseras, men långsammare. En förinställning med lägre återgivning eller en mindre kopia av bilden går snabbare. @msg The image was traced at {_1} × {_2} pixels, scaled down from {_3} × {_4} ({_5} megapixels at most). Bilden vektoriserades vid {_1} × {_2} pixlar, nedskalad från {_3} × {_4} (högst {_5} megapixlar). - Snapping Fästning + Snapping Fäst Snap to Tangent Fäst mot tangent Snap to Perpendicular Fäst mot vinkelrät @msg unknown snap option `{key}` (use {options}) okänt fästalternativ `{key}` (använd {options}) @@ -5601,19 +5601,19 @@ axis Y Axis Y-axel {count} file(s) in {folder}. Show the package folder? {count} fil(er) i {folder}. Visa paketmappen? Clockwise Medurs Dither Dithering - Fine noise hides banding in the gradient fill Fint brus döljer bandningen i övertoningsfyllningen -@msg `dither` applies to gradient fills (stroke: false) `dither` gäller övertoningsfyllningar (stroke: false) -@msg `dither` applies to gradient fills (paint.setFill) `dither` gäller övertoningsfyllningar (paint.setFill) + Fine noise hides banding in the gradient fill Fint brus döljer bandningen i gradientfyllningen +@msg `dither` applies to gradient fills (stroke: false) `dither` gäller gradientfyllningar (stroke: false) +@msg `dither` applies to gradient fills (paint.setFill) `dither` gäller gradientfyllningar (paint.setFill) @msg `dither` must be true or false `dither` måste vara true eller false @msg `method` must be classic or perceptual `method` måste vara classic eller perceptual # Heavy plug-in filters (plugin.inspect, plug-in runs) Install “{name}”, which asks for a heavy budget? Installera ”{name}”, som begär en stor beräkningsbudget? - Each run may take up to {minutes} minutes and do {times} times the work other plug-ins may. It runs in the background, and you can cancel it. Varje körning kan ta upp till {minutes} minuter och göra {times} gånger så mycket arbete som andra insticksprogram får. Den körs i bakgrunden och du kan avbryta den. + Each run may take up to {minutes} minutes and do {times} times the work other plug-ins may. It runs in the background, and you can cancel it. Varje körning kan ta upp till {minutes} minuter och göra {times} gånger så mycket arbete som andra plugins får. Den körs i bakgrunden och du kan avbryta den. It may take minutes, so it runs in the background, where you can cancel it. Det kan ta flera minuter, så det körs i bakgrunden, där du kan avbryta det. - The plug-in is computing… Insticksprogrammet räknar… - Inspect Plug-in Granska insticksprogram - Cancel Plug-in Run Avbryt körning av insticksprogram -@msg {_1} finished, but the document or the plug-in changed meanwhile: run it again {_1} är klar, men dokumentet eller insticksprogrammet ändrades under tiden: kör det igen + The plug-in is computing… Pluginet räknar… + Inspect Plug-in Granska plugin + Cancel Plug-in Run Avbryt körning av plugin +@msg {_1} finished, but the document or the plug-in changed meanwhile: run it again {_1} är klar, men dokumentet eller pluginet ändrades under tiden: kör det igen @msg Running “{name}”… Kör ”{name}”… @msg a live effect runs while the document is drawn, so it can't be `heavy` en live-effekt körs medan dokumentet ritas, så den kan inte vara `heavy` @msg an exporter always gets an export's budget: leave `budget` out ett exportinsticksprogram får alltid en exports budget: utelämna `budget` @@ -5843,6 +5843,38 @@ anchor Points: Punkter: @msg `segment` must be "straight" or "curved" `segment` måste vara "straight" eller "curved" @msg `mode` must be "free", "keepAngles" or "symmetric" `mode` måste vara "free", "keepAngles" eller "symmetric" @msg `{key}` must be [x, y] `{key}` måste vara [x, y] + on the canvas to create one på arbetsytan för att skapa en + Arrow Scale: Pilskala: + Arrow Style: Pilstil: + Check for Updates… Sök efter uppdateringar… + Checking for updates… Söker efter uppdateringar… + Could not check for updates:\n{error} Det gick inte att söka efter uppdateringar:\n{error} + Dimension Lines Måttlinjer + Dimension Text Måttal + Extension Lines Måttgränslinjer + Extension: Förlängning: + Hide Extension Lines Dölj måttgränslinjer + Hide Units Dölj enheter + Invalid panel layout; restored the default dock Ogiltig panellayout; standarddockningen har återställts + Japanese Double Postcard Japanskt dubbelvykort + Japanese Envelope #3 Japanskt kuvert #3 + Japanese Envelope #4 Japanskt kuvert #4 + Japanese Postcard Japanskt vykort + Kaku #2 Kaku #2 + Kaku #3 Kaku #3 + Line Type: Linjetyp: + Line Weight: Linjetjocklek: + Load Variable Library Läs in variabelbibliotek + Preparing the image… Förbereder bilden… + Right-click an item to move it into this group. Högerklicka på ett objekt för att flytta det till den här gruppen. + Tracing the colors… Vektoriserar färgerna… + Units & Scale Enheter & skala + VectorCraft Updates Uppdateringar för VectorCraft + VectorCraft {version} is currently the newest version available. VectorCraft {version} är för närvarande den senaste tillgängliga versionen. + Yonroku-ban Yonroku-ban +@msg image '{key}' has no pixels and was left out bilden '{key}' har inga pixlar och utelämnades +@msg not an RTF file: it doesn't start with {\\rtf inte en RTF-fil: den börjar inte med {\\rtf +shape Open Öppen # Color Effects add-on: Select by Color Kind. Select by Color Kind Markera efter färgtyp From 7688b41a405df92d2047e470c69776baa36f5abc Mon Sep 17 00:00:00 2001 From: Dan Green Date: Tue, 27 Oct 2026 14:56:14 -0700 Subject: [PATCH 033/227] Libraries panel: art and colours dragged in are added where they are dropped Art dragged off the canvas and colours dragged in from elsewhere (swatches, another library's) used to be added at the end of the ungrouped items, wherever they were dropped. They now land as items dragged within the list do: on another item of their kind, just before or after it by the pointer's half and in its group; on a group, into it; away from the items, ungrouped at the end as before. library.add takes group and before/after, placed as library.moveItem places an item (the placement is shared). A library change that fails partway now leaves the library as it was. --- crates/engine/src/cmd/library.rs | 110 +++++++++++++------ crates/engine/src/tests/library.rs | 43 ++++++++ crates/engine/tests/import_fuzz.rs | 10 +- crates/ui-egui/src/panels/libraries.rs | 104 +++++++++++------- crates/ui-egui/src/panels/libraries/tests.rs | 65 +++++++++++ docs/mcp.md | 11 +- docs/target-app-parity.md | 5 +- 7 files changed, 267 insertions(+), 81 deletions(-) diff --git a/crates/engine/src/cmd/library.rs b/crates/engine/src/cmd/library.rs index f0e4307a37..47a5f6e98a 100644 --- a/crates/engine/src/cmd/library.rs +++ b/crates/engine/src/cmd/library.rs @@ -248,22 +248,24 @@ impl Libraries { }) } - /// Change library `id` with `f` and save it; on a failed save the change is undone. + /// Change library `id` with `f` and save it; when `f` fails, or the save does, the change is + /// undone. fn change(&mut self, id: &str, f: impl FnOnce(&mut Library) -> Result) -> Result { let i = self.libs.iter().position(|(i, _)| i == id).ok_or_else(|| EngineError::Other(format!("no library `{id}`")))?; let before = self.libs.get(i).map(|(_, l)| l.clone()).unwrap_or_default(); let r = match self.libs.get_mut(i) { - Some((_, lib)) => f(lib)?, + Some((_, lib)) => f(lib), None => return Err(EngineError::Other(format!("no library `{id}`"))), }; - if let Err(e) = self.save(id) { + let r = r.and_then(|r| self.save(id).map(|()| r)); + if let Err(e) = r { if let Some((_, lib)) = self.libs.get_mut(i) { *lib = before; } return Err(e); } self.sort(); - Ok(r) + r } fn delete(&mut self, id: &str) -> Result<()> { @@ -341,6 +343,23 @@ impl Library { } } + /// Put item `r` in group `at` (an index; None: in none), out of the one it was in, and with + /// `next_to` just before or after that item of its kind in its kind's list: in the group too, + /// next to that item when it is there, else last. → the group's name. + fn put(&mut self, r: ItemRef, at: Option, next_to: Option<&(ItemRef, bool)>) -> Option { + if let Some((other, after)) = next_to + && *other != r + { + self.place_next_to(&r, other, *after); + } + self.ungroup(&r); + at.and_then(|i| self.groups.get_mut(i)).map(|g| { + let near = next_to.and_then(|(other, after)| g.items.iter().position(|x| x == other).map(|j| j + usize::from(*after))); + g.items.insert(near.unwrap_or(g.items.len()).min(g.items.len()), r); + g.name.clone() + }) + } + /// Make a library read from a file (hand-edited, imported) safe and consistent: at most /// [`MAX_ITEMS`] items of each kind and [`MAX_GROUPS`] groups, names clipped to [`MAX_NAME`] /// characters and unique within their kind (a repeated one gets a number), sizes finite, a @@ -617,7 +636,7 @@ pub fn specs() -> Vec { "Add to Library", [], None, - "{library?: id or name (default: the current library, made when there is none), kind: graphic|fillColor|strokeColor|fillGradient|strokeGradient|fillPattern|strokePattern|charStyle|paraStyle, ids?: objects (default: the selection), name?, color?: colour (a colour to add, instead of the selection's), swatch?: a gradient or pattern swatch of the document (fillGradient…strokePattern: added instead of the selection's paint)} add an item from the selection: graphic: a copy of the objects with every resource they use; fillColor/strokeColor: the first selected object's solid fill/stroke colour (else the default fill/stroke); fillGradient/strokeGradient: the first selected object's fill/stroke gradient (else the default's), without its placement or swatch links, named after its swatch, else \"Gradient\"; fillPattern/strokePattern: the first selected object's fill/stroke pattern (else the default's) with the resources its art uses, named after it; charStyle/paraStyle: the selected text's character/paragraph attributes (the Type tool's range, else the first selected text object). An item the library already has (same kind and contents) isn't added again → {library, kind, name, id?: graphic id, existing: bool}", + "{library?: id or name (default: the current library, made when there is none), kind: graphic|fillColor|strokeColor|fillGradient|strokeGradient|fillPattern|strokePattern|charStyle|paraStyle, ids?: objects (default: the selection), name?, color?: colour (a colour to add, instead of the selection's), swatch?: a gradient or pattern swatch of the document (fillGradient…strokePattern: added instead of the selection's paint), group?: name, before?: item | after?: item (an item of the same kind)} add an item from the selection: graphic: a copy of the objects with every resource they use; fillColor/strokeColor: the first selected object's solid fill/stroke colour (else the default fill/stroke); fillGradient/strokeGradient: the first selected object's fill/stroke gradient (else the default's), without its placement or swatch links, named after its swatch, else \"Gradient\"; fillPattern/strokePattern: the first selected object's fill/stroke pattern (else the default's) with the resources its art uses, named after it; charStyle/paraStyle: the selected text's character/paragraph attributes (the Type tool's range, else the first selected text object). A new item goes into `group` (default: none) and, with `before` or `after`, just before or after that item in the order its kind is shown in, as dropping it among the Libraries panel's items does; an item the library already has (same kind and contents) isn't added again, nor moved → {library, kind, name, id?: graphic id, existing: bool, group?: name or null (a new item's)}", has_doc, add ), @@ -818,8 +837,10 @@ fn add(s: &mut Session, p: &Value) -> Result { Item::Style(para, attrs) } }; + let place = Placement::of(p, C)?; let id = target_library(s, p, C)?; let kind_name = str_param(p, "kind").unwrap_or_default().to_string(); + let item_kind = kind.item_kind(); let r = s.libraries.change(&id, |lib| { let full = |n: usize| if n >= MAX_ITEMS { Err(bad(C, format!("the library holds {MAX_ITEMS} items of this kind already"))) } else { Ok(()) }; Ok(match item { @@ -833,8 +854,9 @@ fn add(s: &mut Session, p: &Value) -> Result { // Ids are `graphic`, `graphic-2`…: taken ones are looked for as they are kept. g.id = unique("graphic", |n| lib.graphics.iter().any(|o| o.id == n.replace(' ', "-"))).replace(' ', "-"); let v = json!({ "name": g.name, "id": g.id, "existing": false }); + let key = g.id.clone(); lib.graphics.push(g); - v + placed(lib, &place, ItemRef { kind: item_kind, item: key }, v)? } Item::Color((name, color)) => { full(lib.colors.len())?; @@ -843,7 +865,7 @@ fn add(s: &mut Session, p: &Value) -> Result { } let name = unique(&given.clone().unwrap_or(name), |n| lib.colors.iter().any(|o| o.name == n)); lib.colors.push(LibraryColor { name: name.clone(), color }); - json!({ "name": name, "existing": false }) + placed(lib, &place, ItemRef { kind: item_kind, item: name.clone() }, json!({ "name": name, "existing": false }))? } Item::Gradient(mut g) => { full(lib.gradients.len())?; @@ -852,8 +874,9 @@ fn add(s: &mut Session, p: &Value) -> Result { } g.name = unique(&given.clone().unwrap_or(g.name), |n| lib.gradients.iter().any(|o| o.name == n)); let v = json!({ "name": g.name, "existing": false }); + let key = g.name.clone(); lib.gradients.push(g); - v + placed(lib, &place, ItemRef { kind: item_kind, item: key }, v)? } Item::Pattern(mut pat) => { full(lib.patterns.len())?; @@ -862,8 +885,9 @@ fn add(s: &mut Session, p: &Value) -> Result { } pat.name = unique(&given.clone().unwrap_or(pat.name), |n| lib.patterns.iter().any(|o| o.name == n)); let v = json!({ "name": pat.name, "existing": false }); + let key = pat.name.clone(); lib.patterns.push(pat); - v + placed(lib, &place, ItemRef { kind: item_kind, item: key }, v)? } Item::Style(para, attrs) => { let list = if para { &mut lib.para_styles } else { &mut lib.char_styles }; @@ -874,7 +898,7 @@ fn add(s: &mut Session, p: &Value) -> Result { let base = given.clone().unwrap_or_else(|| style_name(&attrs, para)); let name = unique(&base, |n| list.iter().any(|o| o.name == n)); list.push(TextStyleDef { name: name.clone(), attrs }); - json!({ "name": name, "existing": false }) + placed(lib, &place, ItemRef { kind: item_kind, item: name.clone() }, json!({ "name": name, "existing": false }))? } }) })?; @@ -884,6 +908,13 @@ fn add(s: &mut Session, p: &Value) -> Result { Ok(r) } +/// New item `r` of `lib` put where `place` says, its group added to `v` (what `library.add` +/// reports). +fn placed(lib: &mut Library, place: &Placement, r: ItemRef, mut v: Value) -> Result { + v["group"] = json!(place.apply(lib, r, "library.add")?); + Ok(v) +} + enum Item { Graphic(LibraryGraphic), Color((String, Color)), @@ -1320,38 +1351,47 @@ fn delete_group(s: &mut Session, p: &Value) -> Result { fn move_item(s: &mut Session, p: &Value) -> Result { const C: &str = "library.moveItem"; let (id, kind, item) = item_param(s, p, C)?; - let group = str_param(p, "group"); - let next_to = match (str_param(p, "before"), str_param(p, "after")) { - (Some(_), Some(_)) => return Err(bad(C, "give `before` or `after`, not both")), - (Some(b), None) => Some((b, false)), - (None, Some(a)) => Some((a, true)), - (None, None) => None, - }; + let place = Placement::of(p, C)?; let (key, to) = s.libraries.change(&id, |lib| { - let missing = |item: &str| bad(C, format!("the library has no item `{item}`")); - let r = lib.item_ref(kind.item_kind(), item).ok_or_else(|| missing(item))?; - let at = group.map(|g| group_at(lib, g, C)).transpose()?; - let next_to = next_to - .map(|(other, after)| Ok::<_, EngineError>((lib.item_ref(kind.item_kind(), other).ok_or_else(|| missing(other))?, after))) - .transpose()?; - if let Some((other, after)) = &next_to - && *other != r - { - lib.place_next_to(&r, other, *after); - } - lib.ungroup(&r); + let r = lib.item_ref(kind.item_kind(), item).ok_or_else(|| bad(C, format!("the library has no item `{item}`")))?; let key = r.item.clone(); - let to = at.and_then(|i| lib.groups.get_mut(i)).map(|g| { - // Next to the other item when that is in the group too, else last. - let near = next_to.as_ref().and_then(|(other, after)| g.items.iter().position(|x| x == other).map(|j| j + usize::from(*after))); - g.items.insert(near.unwrap_or(g.items.len()).min(g.items.len()), r); - g.name.clone() - }); + let to = place.apply(lib, r, C)?; Ok((key, to)) })?; Ok(json!({ "library": id, "kind": str_param(p, "kind"), "item": key, "group": to })) } +/// Where `library.add` and `library.moveItem` put an item: its `group` (none: out of any), and +/// the item of its kind it goes `before` or `after`. +struct Placement<'a> { + group: Option<&'a str>, + next_to: Option<(&'a str, bool)>, +} + +impl<'a> Placement<'a> { + fn of(p: &'a Value, cmd: &str) -> Result { + let next_to = match (str_param(p, "before"), str_param(p, "after")) { + (Some(_), Some(_)) => return Err(bad(cmd, "give `before` or `after`, not both")), + (Some(b), None) => Some((b, false)), + (None, Some(a)) => Some((a, true)), + (None, None) => None, + }; + Ok(Self { group: str_param(p, "group"), next_to }) + } + + /// Put item `r` of `lib` where this says ([`Library::put`]) → its group's name. + fn apply(&self, lib: &mut Library, r: ItemRef, cmd: &str) -> Result> { + let at = self.group.map(|g| group_at(lib, g, cmd)).transpose()?; + let next_to = self + .next_to + .map(|(other, after)| { + lib.item_ref(r.kind, other).map(|o| (o, after)).ok_or_else(|| bad(cmd, format!("the library has no item `{other}`"))) + }) + .transpose()?; + Ok(lib.put(r, at, next_to.as_ref())) + } +} + fn move_group(s: &mut Session, p: &Value) -> Result { const C: &str = "library.moveGroup"; let id = library_id(s, p, C)?; diff --git a/crates/engine/src/tests/library.rs b/crates/engine/src/tests/library.rs index ed9d204764..34672008a0 100644 --- a/crates/engine/src/tests/library.rs +++ b/crates/engine/src/tests/library.rs @@ -681,6 +681,49 @@ fn items_and_groups_are_reordered() { assert_eq!(groups(&mut s)[0].1, refs(&[("color", "Green"), ("color", "Gray")]), "a group keeps its items when it moves"); } +/// Dropping art or a colour among the Libraries panel's items: the new item goes just before or +/// after one of its kind and into a group, or into a group alone, and a bad place adds nothing. +#[test] +fn a_new_item_is_added_where_it_is_dropped() { + let mut s = session(); + run(&mut s, "library.create", json!({"name": "Brand"})); + for (name, color) in [("Red", "#ff0000"), ("Green", "#00ff00")] { + run(&mut s, "library.add", json!({"kind": "fillColor", "color": color, "name": name})); + } + run(&mut s, "library.createGroup", json!({"name": "Cool", "items": [{"kind": "fillColor", "item": "Green"}]})); + // Before an ungrouped item: ungrouped too. + let r = run(&mut s, "library.add", json!({"kind": "fillColor", "color": "#ffff00", "name": "Yellow", "before": "Red"})); + assert!(r["group"].is_null()); + assert_eq!(order(&mut s, "colors", "name"), ["Yellow", "Red", "Green"]); + // After an item in a group, into that group next to it. + let r = run(&mut s, "library.add", json!({"kind": "fillColor", "color": "#0000ff", "name": "Blue", "group": "cool", "after": "Green"})); + assert_eq!(r["group"], "Cool"); + assert_eq!(order(&mut s, "colors", "name"), ["Yellow", "Red", "Green", "Blue"]); + assert_eq!(groups(&mut s), [("Cool".into(), refs(&[("color", "Green"), ("color", "Blue")]))]); + // Into a group alone: last in it, and last of its kind. + let shape = run(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 20, "height": 20}))["id"].clone(); + let g = run(&mut s, "library.add", json!({"kind": "graphic", "ids": [shape], "group": "Cool"})); + assert_eq!(g["group"], "Cool"); + let g = g["id"].as_str().unwrap().to_string(); + assert_eq!(groups(&mut s)[0].1, refs(&[("color", "Green"), ("color", "Blue"), ("graphic", &g)])); + // One the library has stays where it is. + let r = run(&mut s, "library.add", json!({"kind": "fillColor", "color": "#ff0000", "before": "Yellow"})); + assert_eq!((r["name"].as_str(), r["existing"].as_bool()), (Some("Red"), Some(true))); + assert_eq!(order(&mut s, "colors", "name"), ["Yellow", "Red", "Green", "Blue"]); + // Bad places add nothing. + let other = run(&mut s, "shape.ellipse", json!({"x": 0, "y": 0, "width": 20, "height": 10}))["id"].clone(); + for bad in [ + json!({"kind": "fillColor", "color": "#808080", "group": "Nope"}), + json!({"kind": "fillColor", "color": "#808080", "before": "Nope"}), + json!({"kind": "fillColor", "color": "#808080", "before": "Red", "after": "Blue"}), + json!({"kind": "graphic", "ids": [other], "before": "Red"}), + ] { + assert!(s.execute("library.add", &bad).is_err(), "{bad}"); + } + assert_eq!(order(&mut s, "colors", "name"), ["Yellow", "Red", "Green", "Blue"]); + assert_eq!(order(&mut s, "graphics", "id"), [g]); +} + /// A library goes out to a file with its art and groups and comes back as a new library, numbered /// when its name is taken; the graphic it brings places in a document (#926). #[test] diff --git a/crates/engine/tests/import_fuzz.rs b/crates/engine/tests/import_fuzz.rs index 81a7289309..0f096b62ad 100644 --- a/crates/engine/tests/import_fuzz.rs +++ b/crates/engine/tests/import_fuzz.rs @@ -1147,8 +1147,9 @@ fn styles(what: &str, data: &str) -> Result<(), TestCaseError> { } /// Libraries panel library file `data` imported, then each kind's first item used on the rich -/// document, moved into its first group and next to its kind's last item, the group moved and -/// deleted and the library exported (#926). +/// document, moved into its first group and next to its kind's last item, a colour and the +/// selection added into that group next to the first ones, the group moved and deleted and the +/// library exported (#926). fn libraries(what: &str, data: &str) -> Result<(), TestCaseError> { survive_library(what, "library.import", data, |s, r| { let lib = r["id"].clone(); @@ -1173,6 +1174,11 @@ fn libraries(what: &str, data: &str) -> Result<(), TestCaseError> { } } } + // Added where the panel drops it: into the first group, next to the first colour and graphic. + let group = &got["groups"][0]["name"]; + let to = json!({"library": lib, "kind": "fillColor", "color": "#123456", "group": group, "after": got["colors"][0]["name"]}); + let _ = no_panic(s.execute("library.add", &to)); + let _ = no_panic(s.execute("library.add", &json!({"library": lib, "kind": "graphic", "group": group, "before": got["graphics"][0]["id"]}))); if let Some(g) = got["groups"].get(0) { for to in [0, 1, 1_000_000] { let _ = no_panic(s.execute("library.moveGroup", &json!({"library": lib, "group": g["name"], "to": to}))); diff --git a/crates/ui-egui/src/panels/libraries.rs b/crates/ui-egui/src/panels/libraries.rs index 8a20be3f6b..2439ba8f27 100644 --- a/crates/ui-egui/src/panels/libraries.rs +++ b/crates/ui-egui/src/panels/libraries.rs @@ -15,7 +15,10 @@ //! bottom edge). An item dragged within it lands before or after another of its kind, in that one's //! group (`library.moveItem` with `before`/`after`), or, dropped elsewhere on a group or on the //! ungrouped items, goes into that group or out of its own; a group dragged by its header goes -//! before or after another group (`library.moveGroup`). +//! before or after another group (`library.moveGroup`). Art from the canvas and swatches from +//! elsewhere are added where they are dropped in the same way (`library.add` with `group` and +//! `before`/`after`): next to an item of their kind and in its group, or into a group; dropped +//! away from the items, ungrouped. //! //! The buttons beside the library picker show the items as icons (colour chips and graphic tiles, //! the default) or in a list, one row each with its name (a colour's hex value too). @@ -99,34 +102,44 @@ enum Act { RenameGroup(String), } -/// What a drag in the panel holds of the library shown: one of its items, or one of its groups -/// (by the group's header). +/// What a drag in the panel holds for the library shown: one of its items, one of its groups (by +/// the group's header), or something to add to it. #[derive(Clone, Debug, PartialEq)] enum Grab { Item(ItemKind, String), Group(String), + /// Art dragged off the canvas, or a swatch from elsewhere (a colour, also from another library, + /// or a gradient or pattern swatch): added where it is dropped, with these `library.add` params. + New(ItemKind, Value), } -/// The item or group of library `library` that `drag` holds, if it holds one. +/// The item or group of library `library` that `drag` holds, or what it would add, if anything. fn grabbed(drag: &PanelDrag, library: &str) -> Option { match drag { PanelDrag::Paint { library: Some((l, item)), .. } if l == library => Some(Grab::Item(ItemKind::Color, item.clone())), PanelDrag::LibraryGraphic { library: l, item } if l == library => Some(Grab::Item(ItemKind::Graphic, item.clone())), PanelDrag::LibraryItem { library: l, kind, item } if l == library => Some(Grab::Item(*kind, item.clone())), PanelDrag::LibraryGroup { library: l, group } if l == library => Some(Grab::Group(group.clone())), + PanelDrag::Art(ids) => { + let ids: Vec = ids.iter().map(|id| id.0).collect(); + Some(Grab::New(ItemKind::Graphic, json!({ "kind": "graphic", "ids": ids }))) + } + PanelDrag::Paint { .. } => swatch_add(drag, library).map(|(kind, add)| Grab::New(kind, add)), _ => None, } } -/// The `library.add` params that add what `drag` holds to library `library`: a color (not one of -/// that library's own), or a gradient or pattern swatch, by its name. -fn swatch_add(drag: &PanelDrag, library: &str) -> Option { +/// The kind and `library.add` params of what `drag` holds, to add to library `library`: a color +/// (not one of that library's own), or a gradient or pattern swatch, by its name. +fn swatch_add(drag: &PanelDrag, library: &str) -> Option<(ItemKind, Value)> { let PanelDrag::Paint { paint, params, library: from, .. } = drag else { return None }; let swatch = || params.get("swatch").and_then(Value::as_str); match paint { - Paint::Solid { color, .. } if from.as_ref().is_none_or(|(l, _)| l != library) => Some(json!({ "kind": "fillColor", "color": color })), - Paint::Gradient(_) => swatch().map(|s| json!({ "kind": "fillGradient", "swatch": s })), - Paint::Pattern { .. } => swatch().map(|s| json!({ "kind": "fillPattern", "swatch": s })), + Paint::Solid { color, .. } if from.as_ref().is_none_or(|(l, _)| l != library) => { + Some((ItemKind::Color, json!({ "kind": "fillColor", "color": color }))) + } + Paint::Gradient(_) => swatch().map(|s| (ItemKind::Gradient, json!({ "kind": "fillGradient", "swatch": s }))), + Paint::Pattern { .. } => swatch().map(|s| (ItemKind::Pattern, json!({ "kind": "fillPattern", "swatch": s }))), _ => None, } } @@ -294,23 +307,18 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { }); out.inner_rect }); - if let Some(grab) = &items.grab - && !over_item - { - section_drop(ui, &items, grab, §ions, list_rect, &mut act); - } - // Art dragged off the canvas, or a swatch (not one of this library's colours), dropped on the - // list is added to the library. + let placed = over_item || items.grab.as_ref().is_some_and(|grab| section_drop(ui, &items, grab, §ions, list_rect, &mut act)); + // Art dragged off the canvas, or a swatch from elsewhere, dropped on the list away from its + // items and sections (an empty library, the space below them) is added to it, ungrouped. The + // zone is there in every frame: egui finds the pointer's widget among the last frame's. let zone = ui.interact(list_rect, ui.scope_id().with("libraries-drop"), Sense::hover()); - if let Some(ids) = widgets::art_drop(ui, &zone) { - act = Some(Act::Run("library.add", json!({ "kind": "graphic", "ids": ids }))); - } - if let Some(drag) = zone.dnd_hover_payload::() - && let Some(add) = swatch_add(&drag, &lib_id) + if !placed + && let Some(Grab::New(_, add)) = &items.grab + && zone.dnd_hover_payload::().is_some() { ui.painter().rect_stroke(zone.rect, 0.0, Stroke::new(1.5, t.accent), StrokeKind::Inside); if zone.dnd_release_payload::().is_some() { - act = Some(Act::Run("library.add", add)); + act = Some(Act::Run("library.add", add.clone())); } } let bar_top = ui.cursor().top(); @@ -534,17 +542,22 @@ impl Items<'_> { resp.context_menu(|ui| self.item_menu(ui, act, kind, name)); } - /// An item of `kind` dragged over item `key`'s cell `resp` lands just before or after it, by - /// the pointer's half (`row`: rows stack downwards; else chips and tiles run across), in its - /// group: an accent line shows where, and `over` is set. Dropped on itself it stays. + /// An item of `kind` dragged over item `key`'s cell `resp`, or a new one of that kind, lands + /// just before or after it, by the pointer's half (`row`: rows stack downwards; else chips and + /// tiles run across), in its group: an accent line shows where, and `over` is set. Dropped on + /// itself an item stays. #[allow(clippy::too_many_arguments)] fn drop_next_to(&self, ui: &Ui, resp: &egui::Response, kind: ItemKind, key: &str, row: bool, act: &mut Option, over: &mut bool) { - let Some(Grab::Item(grabbed_kind, moving)) = &self.grab else { return }; + let (grabbed_kind, moving) = match &self.grab { + Some(Grab::Item(k, item)) => (k, Some(item)), + Some(Grab::New(k, _)) => (k, None), + _ => return, + }; if *grabbed_kind != kind || resp.dnd_hover_payload::().is_none() { return; } *over = true; - if moving == key { + if moving.is_some_and(|m| m == key) { resp.dnd_release_payload::(); return; } @@ -560,12 +573,15 @@ impl Items<'_> { ui.painter().line_segment([egui::pos2(x, r.top()), egui::pos2(x, r.bottom())], accent); } if resp.dnd_release_payload::().is_some() { - let mut p = json!({ "kind": kind_param(kind), "item": moving }); + let (cmd, mut p) = match (&self.grab, moving) { + (Some(Grab::New(_, add)), _) => ("library.add", add.clone()), + (_, item) => ("library.moveItem", json!({ "kind": kind_param(kind), "item": item })), + }; p[if after { "after" } else { "before" }] = json!(key); if let Some(g) = self.group_of(kind, key).and_then(|i| self.lib.groups.get(i)) { p["group"] = json!(g.name); } - *act = Some(Act::Run("library.moveItem", p)); + *act = Some(Act::Run(cmd, p)); } } @@ -649,21 +665,32 @@ fn scroll_at_edges(ui: &mut Ui) { /// The drag in progress held over a section of the list (`sections`, seen through `clip`), away /// from the items that take one: an item goes into that section's group (the ungrouped section: -/// out of its group), the section outlined; a group goes before or after that group, by the -/// pointer's half, an accent line showing where. -fn section_drop(ui: &Ui, items: &Items, grab: &Grab, sections: &[(Option, Rect)], clip: Rect, act: &mut Option) { +/// out of its group), and something new is added there, the section outlined; a group goes +/// before or after that group, by the pointer's half, an accent line showing where. → whether +/// the pointer is over a section. +fn section_drop(ui: &Ui, items: &Items, grab: &Grab, sections: &[(Option, Rect)], clip: Rect, act: &mut Option) -> bool { // By the pointer, not by hover zones: the headers and items over the sections take the hover. - let Some(pos) = ui.ctx().pointer_latest_pos() else { return }; + let Some(pos) = ui.ctx().pointer_latest_pos() else { return false }; let released = ui.input(|i| i.pointer.any_released()); let take = || egui::DragAndDrop::take_payload::(ui.ctx()).is_some(); let t = Tokens::get(ui.ctx()); - let Some((group, rect)) = sections.iter().find(|(_, rect)| rect.intersect(clip).contains(pos)) else { return }; + let Some((group, rect)) = sections.iter().find(|(_, rect)| rect.intersect(clip).contains(pos)) else { return false }; let r = rect.intersect(clip); let name = |i: &usize| items.lib.groups.get(*i).map(|g| g.name.clone()); match grab { + Grab::New(_, add) => { + ui.painter().rect_stroke(r, 3.0, Stroke::new(1.5, t.accent), StrokeKind::Inside); + if released && take() { + let mut p = add.clone(); + if let Some(g) = group.as_ref().and_then(name) { + p["group"] = json!(g); + } + *act = Some(Act::Run("library.add", p)); + } + } Grab::Item(kind, item) => { if items.group_of(*kind, item) == *group { - return; + return true; } ui.painter().rect_stroke(r, 3.0, Stroke::new(1.5, t.accent), StrokeKind::Inside); if released && take() { @@ -676,9 +703,9 @@ fn section_drop(ui: &Ui, items: &Items, grab: &Grab, sections: &[(Option, } Grab::Group(moving) => { // Groups only go among the groups; dropped on itself, one stays. - let (Some(to), Some(from)) = (*group, items.lib.groups.iter().position(|g| g.name == *moving)) else { return }; + let (Some(to), Some(from)) = (*group, items.lib.groups.iter().position(|g| g.name == *moving)) else { return true }; if from == to { - return; + return true; } let after = pos.y > rect.center().y; let y = if after { rect.bottom() } else { rect.top() }; @@ -690,6 +717,7 @@ fn section_drop(ui: &Ui, items: &Items, grab: &Grab, sections: &[(Option, } } } + true } /// An item's row `r` in the list (`resp`: its response): highlighted while hovered, `name` after diff --git a/crates/ui-egui/src/panels/libraries/tests.rs b/crates/ui-egui/src/panels/libraries/tests.rs index 3adc56a5f4..64c3543498 100644 --- a/crates/ui-egui/src/panels/libraries/tests.rs +++ b/crates/ui-egui/src/panels/libraries/tests.rs @@ -235,6 +235,71 @@ fn the_list_view_shows_names_and_takes_drops_by_row() { assert!(!shown(&texts, "Ocean Blue"), "{texts:?}"); } +/// Art dragged off the canvas, and a colour from elsewhere, are added where they are dropped: on +/// another graphic's top or bottom half, just before or after it and in its group; on a group's +/// header, into that group; away from the items, ungrouped at the end, as into an empty library. +#[test] +fn art_and_colours_dropped_from_elsewhere_go_where_they_are_dropped() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + app.run("library.create", json!({"name": "Brand"})).unwrap(); + let art = |app: &mut VectorcraftApp, x: f64, name: Option<&str>| { + let id = app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 10.0 + x, "height": 20})).unwrap()["id"].as_u64().unwrap(); + if let Some(name) = name { + app.run("library.add", json!({"kind": "graphic", "ids": [id], "name": name})).unwrap(); + } + PanelDrag::Art(vec![vectorcraft_doc::NodeId(id)]) + }; + // An empty library takes a drop anywhere on the list. + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + frame_at(&mut app, &ctx, 600.0, vec![]); + let drag = art(&mut app, 0.0, None); + drop_at(&mut app, &ctx, drag, egui::pos2(130.0, 200.0)); + let graphics = |app: &mut VectorcraftApp| { + let got = app.run("library.get", json!({})).unwrap(); + got["graphics"].as_array().unwrap().iter().map(|g| g["name"].as_str().unwrap().to_string()).collect::>() + }; + assert_eq!(graphics(&mut app).len(), 1); + app.run("library.removeItem", json!({"kind": "graphic", "item": "graphic"})).unwrap(); + art(&mut app, 10.0, Some("Badge")); + art(&mut app, 20.0, Some("Seal")); + app.run("library.createGroup", json!({"name": "Logos", "items": [{"kind": "graphic", "item": "Seal"}]})).unwrap(); + crate::panels::set_pstate(&ctx, LIST_VIEW, true); + // Onto Badge's top half: before it, ungrouped. + let (texts, _) = frame_at(&mut app, &ctx, 600.0, vec![]); + let badge = at(&texts, "Badge"); + let drag = art(&mut app, 30.0, None); + drop_at(&mut app, &ctx, drag, egui::pos2(badge.center().x, badge.top() - 2.0)); + let first = graphics(&mut app).first().cloned().unwrap(); + assert_eq!(graphics(&mut app)[1..], ["Badge", "Seal"]); + assert_eq!(group_names(&mut app)[0].1.len(), 1, "only Seal is in Logos"); + // Onto Seal's bottom half: after it, in Logos. + let (texts, _) = frame_at(&mut app, &ctx, 600.0, vec![]); + let seal = at(&texts, "Seal"); + let drag = art(&mut app, 40.0, None); + drop_at(&mut app, &ctx, drag, egui::pos2(seal.center().x, seal.bottom() + 2.0)); + let names = graphics(&mut app); + assert_eq!(names[..3], [first.as_str(), "Badge", "Seal"]); + assert_eq!(group_names(&mut app)[0].1.len(), 2, "the new graphic is in Logos: {:?}", group_names(&mut app)); + // A swatch onto Logos's header: a colour in Logos. + let (texts, _) = frame_at(&mut app, &ctx, 600.0, vec![]); + drop_at(&mut app, &ctx, PanelDrag::paint(Paint::solid(vectorcraft_color::Color::from_hex("#0044aa").unwrap())), at(&texts, "Logos").center()); + let got = app.run("library.get", json!({})).unwrap(); + let color = got["colors"][0]["name"].as_str().unwrap().to_string(); + assert!(group_names(&mut app)[0].1.contains(&color), "{:?}", group_names(&mut app)); + // Below the items: ungrouped, at the end. + let (texts, _) = frame_at(&mut app, &ctx, 600.0, vec![]); + // The last item is the graphic added after Seal, in the list's last section. + let below = at(&texts, "Seal").bottom() + 80.0; + let drag = art(&mut app, 50.0, None); + drop_at(&mut app, &ctx, drag, egui::pos2(130.0, below)); + let got = app.run("library.get", json!({})).unwrap(); + let last = got["graphics"].as_array().unwrap().last().unwrap()["id"].as_str().unwrap().to_string(); + assert_eq!(graphics(&mut app).len(), 5); + assert!(!group_names(&mut app)[0].1.contains(&last), "{:?}", group_names(&mut app)); +} + /// A long list scrolls inside the panel (its bottom bar stays in the window), and a drag held /// near the list's bottom edge scrolls it. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index 7c20fdf54e..e5324f110c 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -2053,10 +2053,13 @@ size and a PNG `thumbnail` in base64; colours with `name`, `hex` and `color`; st `library.setCurrent {library}` manage them; `library` is an id or a name, and without it the current library (the one the panel shows) is meant. -`library.add {library?, kind, ids?, name?, color?, swatch?}` adds from the selection: `graphic` (a copy of the objects with the -images, symbols, patterns, swatches, styles and brushes they use, as Copy takes them), `fillColor` / `strokeColor` (the -first selected object's solid colour, else the default one, or `color`), `charStyle` / `paraStyle` (the selected -text's attributes). An item the library already has is reported as `existing`. `library.use {library?, kind, item, +`library.add {library?, kind, ids?, name?, color?, swatch?, group?, before? | after?}` adds from the selection: +`graphic` (a copy of the objects with the images, symbols, patterns, swatches, styles and brushes they use, as Copy +takes them), `fillColor` / `strokeColor` (the first selected object's solid colour, else the default one, or `color`), +`charStyle` / `paraStyle` (the selected text's attributes). The new item goes into `group` (by default into none) and, +with `before` or `after` (another item of its kind), just before or after that item, as `library.moveItem` places one; +art and swatches dropped among the panel's items are added this way. An item the library already has is reported as +`existing`, and stays where it is. `library.use {library?, kind, item, center?, to?}` uses one: a graphic is placed centred on `center` (pasted with its resources; a swatch name the document gives another colour merges into the document's), a colour paints the selection's fill or stroke, and a style is added to the document under its name without the white space around it (numbered when that name is taken by other diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 98caa6b859..498d16f190 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Gradient panel presets done; Gradient stop popover: an eyedropper samples the stop's colour from the art (#4681); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Libraries panel: art dragged off the canvas and swatches dragged in are added where they are dropped; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -404,7 +404,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale) | Automation | 3 | 65% | scripting surface, batch (MCP drops malformed app replies without replay; Variables: text/visibility variables bound to objects, an object may carry several, dataset rows applied in one undo step, panel and Window › Variables with dialogs; image/graph kinds and dataset import/export open) | 6–10 | | UI chrome (panels, contextual Properties, workspaces, prefs) | 6 | 80% | macOS native menu dismissal fixed (M14.8); Variables, Links, Asset Export, CSS Properties, Attributes, the canvas context menu and docking panels into any dock group by dragging (as tabs, a top/bottom split or icons) are done; remaining: SVG Interactivity, Properties per context, Consolidate All Windows, floating panels outside the app window, context menus beyond the canvas, about 13 Preferences options stored but not yet acted on (#394: Open Documents As Tabs, Real-time Drawing, hyphenation language, devices…) | 13–20 | | UI chrome (panels, contextual Properties, workspaces, prefs) | 6 | 80% | macOS native menu dismissal fixed (M14.8); Variables, Links, Asset Export, CSS Properties, Attributes, the canvas context menu and docking panels into any dock group by dragging (as tabs, a top/bottom split or icons) are done; remaining: SVG Interactivity, Properties per context, Consolidate All Windows, floating panels outside the app window, context menus beyond the canvas, about 14 Preferences options stored but not yet acted on (#394: Highlight Alternate Glyphs, Open Documents As Tabs, Real-time Drawing, hyphenation language, devices…) | 13–20 | -| Libraries, Links, Package | 2 | 82% | the Libraries panel is local only (no cloud by design: libraries are files on this machine) and has no shared libraries, linked graphics or gradients and patterns as items yet; its graphics, colours and text styles (#745), its search, groups and library export/import as `.vclibrary` files (#926), a list that scrolls, with items and groups reordered by dragging and items dragged into and out of groups, and items shown as icons or in a list with their names, are done; Links and Package are done; placed VectorCraft documents are done (linked by default, vectors in every output, previews, Break Link, Expand, Edit Original, refresh on save) | 2–3 | +| Libraries, Links, Package | 2 | 82% | the Libraries panel is local only (no cloud by design: libraries are files on this machine) and has no shared libraries, linked graphics or gradients and patterns as items yet; its graphics, colours and text styles (#745), its search, groups and library export/import as `.vclibrary` files (#926), a list that scrolls, with items and groups reordered by dragging and items dragged into and out of groups, art and swatches dragged in added where they are dropped, and items shown as icons or in a list with their names, are done; Links and Package are done; placed VectorCraft documents are done (linked by default, vectors in every output, previews, Break Link, Expand, Edit Original, refresh on save) | 2–3 | | **Feature parity** | **103** | **~75%** | | **~210–330** | | Interaction-fidelity pass (side by side with Illustrator: every tool modifier, cursor, dialog, Properties context) | | | | 60–90 | | Hardening (big-file corpus, fuzzing, cross-platform and browser QA, accessibility, packaging) | | | Bounded control socket waits (#1726); PngSuite pinned-file integrity and download budgets verified (#1729); RPM runtime capabilities and glibc floor checked (#1275); titled PDF exports ask viewers to display the document title (#3646); real-distro installation/start-up QA pending | 50–80 | @@ -1283,6 +1283,7 @@ spot colours, carry a colour adjustment, or are RGB, CMYK or grayscale images | 2026-10-30 | minor | Selection, transform & align tools: Align panel menu › Align to Glyph Bounds › Point Text and Area Text align and distribute type by the ink of its glyphs (#4231); evidence added; score and hours unchanged (estimated). | | 2026-10-30 | minor | Blob Brush and Eraser Tool Options: Size follows the pen pressure, Fixed or Pressure with a Variation (#4590, #3961); scores and estimates unchanged | | 2026-10-30 | minor | Blob Brush Tool Options: Size follows the pen pressure, Fixed or Pressure with a Variation (#4590); scores and estimates unchanged | +| 2026-10-29 | minor | Libraries panel: art dragged off the canvas and swatches dragged in (colours, also another library's, gradients and patterns) are added where they are dropped, as items dragged within the list move: on another item of their kind, just before or after it by the pointer's half and in its group; on a group, into it; away from the items, ungrouped at the end as before (`library.add` takes `group` and `before`/`after`). Tests: `tests::library::a_new_item_is_added_where_it_is_dropped`, `panels::libraries::tests::art_and_colours_dropped_from_elsewhere_go_where_they_are_dropped`; the library fuzz test adds with them. Scores and hours unchanged. | | 2026-10-29 | minor | Path operations: Pathfinder: live compound shapes (#4522): the panel menu's Make, Release and Expand Compound Shape, Alt-clicking a Shape Mode, a selected member's Shape Mode and the Expand button act; evidence added; score and hours unchanged (estimated). | | 2026-10-29 | minor | Object › Path › Smooth… with its slider and Auto-Smooth (#4115) added to the evidence; score and hours unchanged. | | 2026-10-26 | minor | File formats: EPS Save and Save As: an opened EPS saves back to its own path as EPS, keeping the chosen artboard's page frame and transparent margins and the complete editable VectorCraft document; Save's TIFF preview is capped at 1024 px (Export keeps 2048); partly read, preview-only or damaged-editing-data sources still need confirmation before they are overwritten; evidence added ([file-format-parity.md](file-format-parity.md#eps-save-and-source-protection)); writing Illustrator's editing data (#868) and the `.ai` structure issues stay in the missing items; score and hours unchanged (estimated) | From 10838300f1bcfc69236ebe950542ce6601723baa Mon Sep 17 00:00:00 2001 From: Dan Green Date: Thu, 29 Oct 2026 07:05:25 -0700 Subject: [PATCH 034/227] Libraries: an add that cannot be placed makes no "My Library" With no library yet, library.add made and saved "My Library" before it looked for the group or item to place the new one by, so a bad `group`, `before` or `after` failed but left an empty library behind. The new library is now kept only once the item is in it. --- crates/engine/src/cmd/library.rs | 25 +++++++++++++------------ crates/engine/src/tests/library.rs | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/crates/engine/src/cmd/library.rs b/crates/engine/src/cmd/library.rs index 47a5f6e98a..70aa9561fe 100644 --- a/crates/engine/src/cmd/library.rs +++ b/crates/engine/src/cmd/library.rs @@ -808,14 +808,6 @@ fn delete(s: &mut Session, p: &Value) -> Result { ok() } -/// The library `p` names, else the current one, else a new "My Library". -fn target_library(s: &mut Session, p: &Value, cmd: &str) -> Result { - if p.get("library").is_some_and(|v| !v.is_null()) || s.libraries.current().is_some() { - return library_id(s, p, cmd); - } - s.libraries.create("My Library") -} - /// `base`, or `base 2`, `base 3`… the first that `taken` doesn't hold. fn unique(base: &str, taken: impl Fn(&str) -> bool) -> String { std::iter::once(base.to_string()).chain((2..).map(|n| format!("{base} {n}"))).find(|n| !taken(n)).unwrap_or_else(|| base.to_string()) @@ -838,10 +830,9 @@ fn add(s: &mut Session, p: &Value) -> Result { } }; let place = Placement::of(p, C)?; - let id = target_library(s, p, C)?; let kind_name = str_param(p, "kind").unwrap_or_default().to_string(); let item_kind = kind.item_kind(); - let r = s.libraries.change(&id, |lib| { + let put = |lib: &mut Library| { let full = |n: usize| if n >= MAX_ITEMS { Err(bad(C, format!("the library holds {MAX_ITEMS} items of this kind already"))) } else { Ok(()) }; Ok(match item { Item::Graphic(mut g) => { @@ -901,8 +892,18 @@ fn add(s: &mut Session, p: &Value) -> Result { placed(lib, &place, ItemRef { kind: item_kind, item: name.clone() }, json!({ "name": name, "existing": false }))? } }) - })?; - let mut r = r; + }; + // Into the library `p` names, else the current one, else a new "My Library", which is kept + // only once the item is in it (a `group` or item to place it by that it lacks makes none). + let (id, mut r) = if p.get("library").is_some_and(|v| !v.is_null()) || s.libraries.current().is_some() { + let id = library_id(s, p, C)?; + let r = s.libraries.change(&id, put)?; + (id, r) + } else { + let mut lib = Library { name: "My Library".to_string(), ..Default::default() }; + let r = put(&mut lib)?; + (s.libraries.insert(lib)?, r) + }; r["library"] = json!(id); r["kind"] = json!(kind_name); Ok(r) diff --git a/crates/engine/src/tests/library.rs b/crates/engine/src/tests/library.rs index 34672008a0..92c780e29d 100644 --- a/crates/engine/src/tests/library.rs +++ b/crates/engine/src/tests/library.rs @@ -724,6 +724,30 @@ fn a_new_item_is_added_where_it_is_dropped() { assert_eq!(order(&mut s, "graphics", "id"), [g]); } +/// With no library yet, an add that can't be placed makes no "My Library", in the session or in +/// the library folder; one that can makes it. +#[cfg(not(target_arch = "wasm32"))] +#[test] +fn an_add_that_cannot_be_placed_makes_no_library() { + let folder = vectorcraft_testkit::temp_dir("library-add-unplaced").to_string_lossy().to_string(); + let mut s = session(); + s.libraries.set_dir(Some(folder.clone())); + for bad in [json!({"kind": "fillColor", "color": "#808080", "group": "Nope"}), json!({"kind": "fillColor", "color": "#808080", "after": "Nope"})] + { + assert!(s.execute("library.add", &bad).is_err(), "{bad}"); + assert_eq!(run(&mut s, "library.list", json!({}))["libraries"], json!([]), "{bad}"); + } + let mut t = session(); + t.libraries.set_dir(Some(folder.clone())); + assert_eq!(run(&mut t, "library.list", json!({}))["libraries"], json!([]), "no file was written"); + let r = run(&mut s, "library.add", json!({"kind": "fillColor", "color": "#808080"})); + let list = run(&mut s, "library.list", json!({})); + assert_eq!((list["current"].clone(), list["libraries"][0]["name"].clone()), (r["library"].clone(), json!("My Library"))); + let mut u = session(); + u.libraries.set_dir(Some(folder)); + assert_eq!(run(&mut u, "library.list", json!({}))["libraries"].as_array().map(Vec::len), Some(1)); +} + /// A library goes out to a file with its art and groups and comes back as a new library, numbered /// when its name is taken; the graphic it brings places in a document (#926). #[test] From 27ed249b1ffdbb426f8223d13ec4876a643efca7 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 19:56:42 +0700 Subject: [PATCH 035/227] =?UTF-8?q?Add-ons:=20Parametric=20Shape=20Tool=20?= =?UTF-8?q?=E2=80=94=20re-editable=20stars,=20polygons,=20rings,=20arrows,?= =?UTF-8?q?=20gears=20and=20more?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Path Precision Tools gains the Parametric Shape Tool: ten kinds of shape (rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, speech bubble) that stay editable as numbers. - Geometry in vectorcraft_pathops::addons::pathtools::shapes: each kind's outline, corner rounding limited to the middle of a side, a fingerprint of the outline, recovery of centre, size and rotation after a move, turn or scale, and recognition of plain rectangles, ellipses and regular polygons. - The tool (parametricShape, All Tools drawer and Object › Plug-ins › Path Precision Tools only, no shortcut): drag from the centre (Shift: 45° steps), arrow keys change the count and values while dragging, handles edit a selected shape, double-click places one. - Commands addon.pathtools.shape.create / .set / .convert, one undo step each; params checked (counts 3..1000, sizes up to 16384 pt). - A shape keeps its numbers in one object-data entry (vc-pathtools-shape) that SVG export already leaves out; anchor edits make it a plain path. - Parametric Shape panel, cursor stand-in, catalog rows in all 25 languages, docs and tests. --- crates/engine/src/cmd/addons/pathtools.rs | 12 +- .../engine/src/cmd/addons/pathtools/shape.rs | 137 ++++ .../engine/src/cmd/addons/pathtools/tests.rs | 183 +++++ crates/engine/tests/command_sweep.rs | 14 + crates/pathops/src/addons.rs | 4 +- crates/pathops/src/addons/pathtools.rs | 3 +- crates/pathops/src/addons/pathtools/shapes.rs | 664 ++++++++++++++++++ crates/tools/src/addons.rs | 3 + crates/tools/src/addons/parametric_shape.rs | 620 ++++++++++++++++ crates/tools/src/cursor.rs | 7 +- crates/tools/src/cursors.toml | 6 + crates/tools/src/settings.rs | 2 + crates/ui-egui/src/addons/pathtools.rs | 16 +- crates/ui-egui/src/addons/pathtools/shape.rs | 132 ++++ crates/ui-egui/src/addons/pathtools/tests.rs | 35 +- crates/ui-egui/src/canvas/cursor.rs | 1 + crates/ui-egui/src/cursors.rs | 3 +- crates/ui-egui/src/edit_toolbar/tests.rs | 4 +- crates/ui-egui/src/i18n/bg.tsv | 26 + crates/ui-egui/src/i18n/ca.tsv | 26 + crates/ui-egui/src/i18n/cs.tsv | 26 + crates/ui-egui/src/i18n/da.tsv | 26 + crates/ui-egui/src/i18n/de.tsv | 28 + crates/ui-egui/src/i18n/el.tsv | 26 + crates/ui-egui/src/i18n/es.tsv | 26 + crates/ui-egui/src/i18n/fi.tsv | 26 + crates/ui-egui/src/i18n/fr.tsv | 26 + crates/ui-egui/src/i18n/hu.tsv | 26 + crates/ui-egui/src/i18n/id.tsv | 26 + crates/ui-egui/src/i18n/it.tsv | 28 + crates/ui-egui/src/i18n/ja.tsv | 28 + crates/ui-egui/src/i18n/ka.tsv | 26 + crates/ui-egui/src/i18n/ko.tsv | 28 + crates/ui-egui/src/i18n/nl.tsv | 26 + crates/ui-egui/src/i18n/pl.tsv | 26 + crates/ui-egui/src/i18n/pt-br.tsv | 26 + crates/ui-egui/src/i18n/ru.tsv | 26 + crates/ui-egui/src/i18n/sv.tsv | 26 + crates/ui-egui/src/i18n/tr.tsv | 26 + crates/ui-egui/src/i18n/uk.tsv | 28 + crates/ui-egui/src/i18n/vi.tsv | 28 + crates/ui-egui/src/i18n/zh-hans.tsv | 28 + crates/ui-egui/src/i18n/zh-hant.tsv | 28 + crates/ui-egui/src/panels.rs | 1 + crates/ui-egui/src/state.rs | 1 + docs/mcp.md | 40 +- docs/target-app-parity.md | 16 +- docs/ui-parity.md | 5 +- 48 files changed, 2551 insertions(+), 24 deletions(-) create mode 100644 crates/engine/src/cmd/addons/pathtools/shape.rs create mode 100644 crates/pathops/src/addons/pathtools/shapes.rs create mode 100644 crates/tools/src/addons/parametric_shape.rs create mode 100644 crates/ui-egui/src/addons/pathtools/shape.rs diff --git a/crates/engine/src/cmd/addons/pathtools.rs b/crates/engine/src/cmd/addons/pathtools.rs index 6c5ef24c5c..4e78680ae7 100644 --- a/crates/engine/src/cmd/addons/pathtools.rs +++ b/crates/engine/src/cmd/addons/pathtools.rs @@ -1,8 +1,10 @@ //! Path Precision Tools (`addon.pathtools.*`), a built-in add-on: the Anchor Eraser Brush's stroke, //! the Extend Path tool's extension, the Measure & Inspect tool's readouts, the Anchor Inspector's -//! anchor edits and Split / Add Points at Crossings. Its tools, panel and submenu (Object › -//! Plug-ins › Path Precision Tools) are the tools crate's and the UI's. +//! anchor edits, Split / Add Points at Crossings and the Parametric Shape Tool's shapes ([`shape`]). +//! Its tools, panels and submenu (Object › Plug-ins › Path Precision Tools) are the tools crate's +//! and the UI's. +mod shape; #[cfg(test)] mod tests; @@ -37,7 +39,7 @@ const MAX_EXTEND: f64 = 1e6; const MAX_ADD: u64 = pt::MAX_ADDED_PER_SEGMENT as u64; pub fn specs() -> Vec { - vec![ + let mut v = vec![ cmd!( "addon.pathtools.erase", "Anchor Eraser Brush", @@ -137,7 +139,9 @@ pub fn specs() -> Vec { has_selection, crossings ), - ] + ]; + v.extend(shape::specs()); + v } /// The editable paths (not guides) under `roots`, compound path members included. diff --git a/crates/engine/src/cmd/addons/pathtools/shape.rs b/crates/engine/src/cmd/addons/pathtools/shape.rs new file mode 100644 index 0000000000..4c1ba7e2dd --- /dev/null +++ b/crates/engine/src/cmd/addons/pathtools/shape.rs @@ -0,0 +1,137 @@ +//! The Parametric Shape Tool's commands (`addon.pathtools.shape.*`): draw a parametric shape, change +//! one's numbers, and turn plain rectangles, ellipses and regular polygons into them. A parametric +//! shape is an ordinary path whose numbers sit in one entry of its object data +//! (`vectorcraft_tools::addons::parametric_shape`), which SVG export leaves out. + +use serde_json::{Value, json}; +use vectorcraft_doc::{Node, NodeKind}; +use vectorcraft_geom::{FillRule, PathData, Point}; +use vectorcraft_pathops::addons::pathtools::shapes::{ParametricShape, ShapeKind, recognise}; +use vectorcraft_tools::addons::parametric_shape::{CREATE, EDIT, KEY, apply, read, stored, to_json}; + +use super::super::super::{CommandSpec, bad, checked_id, checked_ids_or_selection, cmd, has_doc, has_selection}; +use crate::{EngineError, Result, Session}; + +/// The undo step's name and the command's label. +const CONVERT: &str = "Convert to Parametric Shape"; + +pub fn specs() -> Vec { + vec![ + cmd!( + "addon.pathtools.shape.create", + "Parametric Shape", + [], + None, + "{center: [x, y], kind?: \"rectangle\"|\"ellipse\"|\"polygon\" (default)|\"star\"|\"ring\"|\"arrow\"|\"cross\"|\"heart\"|\"gear\"|\"bubble\" (a speech bubble), width?, height?: 0.01..16384 pt (100), rotation?: degrees clockwise (0: upright), count?: 3..1000 (a polygon's sides, a star's points, a gear's teeth), a?, b?: the kind's own values (star: inner radius 0.01..1 of the outer, 0.5; ring: hole 0.01..0.99 of the size, 0.5; arrow: head length and shaft width 0.05..0.95, 0.4 and 0.4; cross: bar offset −0.9..0.9 (0, − up) and arm thickness 0.05..0.95 (1/3); heart: notch depth and point roundness 0..1 (0.4 and 0); gear: tooth height 0.01..0.9 (0.2); bubble: tail height 0.05..0.9 (0.25) and tail tip −1..1 across (−0.4)), radius?: corner radius 0..16384 pt (0; no corner rounds past the middle of a side)} draw a parametric shape with the current paint, selected, as one undo step; it stays editable with addon.pathtools.shape.set until its anchors are edited (moving, turning or scaling it keeps it) → {id, shape}", + has_doc, + create + ), + cmd!( + "addon.pathtools.shape.set", + "Edit Parametric Shape", + [], + None, + "{id, kind?, center?, width?, height?, rotation?, count?, a?, b?, radius?} change a parametric shape's numbers (as addon.pathtools.shape.create takes them; a new kind takes its own defaults for the values not given), as one undo step; with none, or the same ones, nothing changes → {id, shape (its numbers now)}", + has_doc, + set + ), + cmd!( + "addon.pathtools.shape.convert", + "Convert to Parametric Shape", + ["Object", "Plug-ins", "Path Precision Tools"], + None, + "{ids?: [id…] (default: the selection)} make each plain closed path that is a rectangle, an ellipse or a polygon with equal sides and corners (stretched along its own axes at most) a parametric shape of the same outline, as one undo step → {ids (converted)}", + has_selection, + convert + ), + ] +} + +/// Give path node `n` the outline `path` of shape `s` and keep its numbers; a live shape goes. +fn shape_node(n: &mut Node, s: &ParametricShape, path: PathData) { + let entry = stored(s, &path); + if let NodeKind::Path { path: p, live, .. } = &mut n.kind { + *p = path; + *live = None; + } + n.edit_attrs(|a| match a.data.iter_mut().find(|(k, _)| k == KEY) { + Some(e) => e.1 = entry, + None => a.data.push((KEY.into(), entry)), + }); +} + +/// The outline of `s`, checked already. +fn outline(s: &ParametricShape, cmd: &str) -> Result { + s.path().ok_or_else(|| bad(cmd, "the shape's numbers are out of range")) +} + +fn create(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pathtools.shape.create"; + if p.get("center").is_none_or(Value::is_null) { + return Err(bad(C, "`center` must be [x, y]")); + } + let shape = apply(ParametricShape::new(ShapeKind::Polygon, Point::ZERO, 100.0, 100.0), p).map_err(|e| bad(C, e))?; + let path = outline(&shape, C)?; + let parent = s.doc()?.target_parent()?; + let look = s.new_art_look(s.paint.fill.clone(), s.paint.stroke.clone(), s.paint.stroke_width); + // shortcut: always on top of the insertion layer, as Draw Normal; honour Draw Behind/Inside if asked. + let id = s.edit(CREATE, |d, sel| { + let id = d.alloc_id(); + let mut n = Node::new(id, NodeKind::Path { path: PathData::default(), rule: FillRule::NonZero, live: None, clipping: false, guide: false }); + shape_node(&mut n, &shape, path); + look.apply(d, &mut n); + d.insert(parent, usize::MAX, n)?; + sel.set([id]); + Ok(id) + })?; + Ok(json!({ "id": id.0, "shape": to_json(&shape) })) +} + +fn set(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pathtools.shape.set"; + let id = checked_id(s, p.get("id").unwrap_or(&Value::Null), C)?; + let d = &s.doc()?.doc; + if !d.is_editable(id) { + return Err(bad(C, "the path is locked or hidden")); + } + let old = d.node(id).and_then(read).ok_or_else(|| bad(C, "the object is not an editable parametric shape"))?; + let shape = apply(old, p).map_err(|e| bad(C, e))?; + if shape != old { + let path = outline(&shape, C)?; + s.edit(EDIT, |d, sel| { + shape_node(d.node_mut(id).ok_or(EngineError::NoNode(id))?, &shape, path); + sel.anchors.remove(&id); + sel.segments.remove(&id); + Ok(()) + })?; + } + Ok(json!({ "id": id.0, "shape": to_json(&shape) })) +} + +fn convert(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.pathtools.shape.convert"; + let roots = checked_ids_or_selection(s, p, C)?; + let d = &s.doc()?.doc; + let mut found = vec![]; + for id in roots { + let Some(n) = d.node(id).filter(|n| d.is_editable(id) && read(n).is_none()) else { continue }; + if let NodeKind::Path { path, guide: false, clipping: false, .. } = &n.kind + && let Some(shape) = recognise(path) + { + found.push((id, shape, outline(&shape, C)?)); + } + } + if found.is_empty() { + return Err(bad(C, "select plain rectangles, ellipses or regular polygons to convert")); + } + let ids: Vec = found.iter().map(|(id, ..)| id.0).collect(); + s.edit(CONVERT, |d, sel| { + for (id, shape, path) in found { + shape_node(d.node_mut(id).ok_or(EngineError::NoNode(id))?, &shape, path); + sel.anchors.remove(&id); + sel.segments.remove(&id); + } + Ok(()) + })?; + Ok(json!({ "ids": ids })) +} diff --git a/crates/engine/src/cmd/addons/pathtools/tests.rs b/crates/engine/src/cmd/addons/pathtools/tests.rs index 90822c7749..e158db5f69 100644 --- a/crates/engine/src/cmd/addons/pathtools/tests.rs +++ b/crates/engine/src/cmd/addons/pathtools/tests.rs @@ -273,3 +273,186 @@ fn crossings_add_anchors_or_cut_in_one_step() { assert_eq!(steps(&s), n + 1); refuses(&mut s, "addon.pathtools.crossings", &[json!({"cut": "yes"}), json!({"ids": [123456]})]); } + +// ---------- Parametric Shape Tool ---------- + +/// The parametric shape object `id` is now, as the tool reads it. +fn shape_of(s: &Session, id: NodeId) -> Option { + vectorcraft_tools::addons::parametric_shape::read(s.doc().unwrap().doc.node(id).unwrap()) +} + +fn star(s: &mut Session) -> NodeId { + let r = s.execute("addon.pathtools.shape.create", &json!({"kind": "star", "center": [200, 150], "width": 100, "height": 100})).unwrap(); + id_of(&r) +} + +#[test] +fn create_draws_a_selected_parametric_shape_in_one_step() { + let mut s = session(); + let n = steps(&s); + let r = s.execute("addon.pathtools.shape.create", &json!({"kind": "gear", "center": [200, 150], "count": 10, "a": 0.3, "radius": 2})).unwrap(); + let id = id_of(&r); + assert_eq!(steps(&s), n + 1, "one undo step"); + assert_eq!((r["shape"]["kind"].clone(), r["shape"]["count"].clone(), r["shape"]["width"].clone()), (json!("gear"), json!(10), json!(100.0))); + assert_eq!(s.doc().unwrap().selection.objects, [id]); + let g = shape_of(&s, id).unwrap(); + assert_eq!((g.count, g.a, g.radius), (10, 0.3, 2.0)); + assert!(path(&s, id).anchor_count() > 40, "40 tooth corners, rounded"); + // Every kind, with its defaults. + for kind in ["rectangle", "ellipse", "polygon", "star", "ring", "arrow", "cross", "heart", "gear", "bubble"] { + let id = id_of(&s.execute("addon.pathtools.shape.create", &json!({"kind": kind, "center": [50, 50]})).unwrap()); + assert_eq!(shape_of(&s, id).map(|s| s.kind.id()), Some(kind)); + } + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(steps(&s), n + 10); +} + +#[test] +fn set_changes_the_numbers_in_one_step_and_nothing_without_a_change() { + let mut s = session(); + let id = star(&mut s); + assert_eq!(path(&s, id).anchor_count(), 10); + let n = steps(&s); + let r = s.execute("addon.pathtools.shape.set", &json!({"id": id.0, "count": 8, "a": 0.3, "rotation": 15})).unwrap(); + assert_eq!((r["shape"]["count"].clone(), r["shape"]["rotation"].clone()), (json!(8), json!(15.0))); + assert_eq!(path(&s, id).anchor_count(), 16); + assert_eq!(steps(&s), n + 1); + // The same numbers again, or none: no step. + s.execute("addon.pathtools.shape.set", &json!({"id": id.0, "count": 8})).unwrap(); + s.execute("addon.pathtools.shape.set", &json!({"id": id.0})).unwrap(); + assert_eq!(steps(&s), n + 1); + // Another kind takes its own defaults. + let r = s.execute("addon.pathtools.shape.set", &json!({"id": id.0, "kind": "arrow"})).unwrap(); + assert_eq!((r["shape"]["a"].clone(), r["shape"]["rotation"].clone()), (json!(0.4), json!(15.0))); + assert_eq!(path(&s, id).anchor_count(), 7); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(path(&s, id).anchor_count(), 16); +} + +#[test] +fn bad_shape_params_are_refused() { + let mut s = session(); + let id = star(&mut s); + let rect = id_of(&s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap()); + let c = json!([10, 10]); + refuses( + &mut s, + "addon.pathtools.shape.create", + &[ + json!({}), + json!({"center": null}), + json!({"center": [1]}), + json!({"center": "here"}), + json!({"center": [1e300, 0]}), + json!({"center": c, "kind": "cloud"}), + json!({"center": c, "kind": 3}), + json!({"center": c, "count": 2}), + json!({"center": c, "count": 1001}), + json!({"center": c, "count": 4.5}), + json!({"center": c, "width": 0}), + json!({"center": c, "height": 16385}), + json!({"center": c, "width": "40"}), + json!({"center": c, "kind": "star", "a": 2}), + json!({"center": c, "kind": "bubble", "b": -1.5}), + json!({"center": c, "radius": -1}), + json!({"center": c, "rotation": "up"}), + ], + ); + refuses( + &mut s, + "addon.pathtools.shape.set", + &[json!({}), json!({"id": rect.0, "count": 6}), json!({"id": 999_999}), json!({"id": id.0, "count": 0}), json!({"id": id.0, "width": -5})], + ); + s.execute("object.setProps", &json!({"ids": [id.0], "locked": true})).unwrap(); + refuses(&mut s, "addon.pathtools.shape.set", &[json!({"id": id.0, "count": 6})]); +} + +#[test] +fn an_anchor_edit_makes_it_a_plain_path_and_transforms_keep_it_editable() { + let mut s = session(); + let id = star(&mut s); + // Moved, turned and scaled with the ordinary commands: still the shape, at its new place. + s.execute("object.move", &json!({"dx": 20, "dy": -10})).unwrap(); + assert!(shape_of(&s, id).is_some_and(|s| s.center.distance(Point::new(220.0, 140.0)) < 1e-6)); + s.execute("object.rotate", &json!({"angle": 30, "origin": [220, 140]})).unwrap(); + let r = shape_of(&s, id).unwrap(); + assert!((r.rotation + 30.0).abs() < 1e-6, "30° counter-clockwise is −30 here: {r:?}"); + s.execute("object.scale", &json!({"sx": 200, "origin": [220, 140]})).unwrap(); + let r = shape_of(&s, id).unwrap(); + assert!((r.width - 200.0).abs() < 1e-6 && r.center.distance(Point::new(220.0, 140.0)) < 1e-6, "{r:?}"); + let n = steps(&s); + s.execute("addon.pathtools.shape.set", &json!({"id": id.0, "count": 6})).unwrap(); + assert_eq!((path(&s, id).anchor_count(), steps(&s)), (12, n + 1)); + assert!((shape_of(&s, id).unwrap().rotation + 30.0).abs() < 1e-6, "the turn stays"); + // Stretched across its own axes (it is turned): skewed, so no longer. + s.execute("object.scale", &json!({"sx": 150, "sy": 100, "origin": [220, 140]})).unwrap(); + assert_eq!(shape_of(&s, id), None); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(shape_of(&s, id).is_some(), "undo brings it back"); + // An anchor moved by hand: a plain path, which `set` refuses. + select_anchors(&mut s, id, &[2]); + s.execute("addon.pathtools.setAnchor", &json!({"x": 0})).unwrap(); + assert_eq!(shape_of(&s, id), None); + refuses(&mut s, "addon.pathtools.shape.set", &[json!({"id": id.0, "count": 7})]); +} + +#[test] +fn convert_makes_plain_shapes_parametric_in_one_step() { + let mut s = session(); + let r = id_of(&s.execute("shape.rectangle", &json!({"x": 10, "y": 20, "width": 100, "height": 50})).unwrap()); + let p = id_of(&s.execute("shape.polygon", &json!({"cx": 200, "cy": 150, "radius": 40, "sides": 7})).unwrap()); + let st = id_of(&s.execute("shape.star", &json!({"cx": 300, "cy": 150, "radius1": 40, "radius2": 15})).unwrap()); + select(&mut s, &[r, p, st]); + let n = steps(&s); + let out = s.execute("addon.pathtools.shape.convert", &json!({})).unwrap(); + assert_eq!(out["ids"], json!([r.0, p.0])); + assert_eq!(steps(&s), n + 1); + assert_eq!(shape_of(&s, r).map(|s| s.kind.id()), Some("rectangle")); + assert_eq!(shape_of(&s, p).map(|s| (s.kind.id(), s.count)), Some(("polygon", 7))); + assert_eq!(shape_of(&s, st), None); + assert_eq!(path(&s, r).bounds().map(|b| b.center()), Some(Point::new(60.0, 45.0))); + // Nothing left to convert. + select(&mut s, &[r, st]); + refuses(&mut s, "addon.pathtools.shape.convert", &[json!({}), json!({"ids": [st.0]}), json!({"ids": [123456]})]); +} + +#[test] +fn the_shape_data_stays_out_of_svg_export() { + let mut s = session(); + let id = star(&mut s); + s.execute("object.setProps", &json!({"ids": [id.0], "data": {"pivot": "1,2"}})).unwrap(); + let key = vectorcraft_tools::addons::parametric_shape::KEY; + let node = s.doc().unwrap().doc.node(id).unwrap().clone(); + assert!(node.extras().attrs.as_deref().is_some_and(|a| a.data.iter().any(|(k, _)| k == key)), "kept with the object"); + assert!(shape_of(&s, id).is_some(), "setting other data keeps it a shape"); + let svg = vectorcraft_svg::export(&s.doc().unwrap().doc, &Default::default()); + assert!(svg.contains("data-pivot=\"1,2\""), "the object's own data still goes out: {svg}"); + assert!(!svg.contains(key) && !svg.contains("fp"") && !svg.contains("\"fp\""), "{svg}"); +} + +#[test] +fn the_tool_draws_one_step_per_drag_and_arrows_change_the_count() { + let mut s = session(); + let view = ViewInfo { smart_guides: false, ..ViewInfo::default() }; + s.select_tool("parametricShape", view).unwrap(); + s.set_tool_option("kind", &json!("star")); + let n = steps(&s); + s.pointer(&PointerEvent::new(PointerKind::Down, 200.0, 150.0), view).unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Drag, 200.0, 100.0), view).unwrap(); + s.tool_key(vectorcraft_tools::ToolKey::Up, vectorcraft_tools::Mods::default(), view).unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Drag, 200.0, 90.0), view).unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Up, 200.0, 90.0), view).unwrap(); + assert_eq!(steps(&s), n + 1); + let id = *s.doc().unwrap().selection.objects.first().unwrap(); + let shape = shape_of(&s, id).unwrap(); + assert_eq!((shape.kind.id(), shape.count, shape.height, shape.rotation), ("star", 6, 120.0, 0.0)); + // Its size handle (lower right of its box) drags into one more step. + let corner = shape.frame() * Point::new(shape.width / 2.0, shape.height / 2.0); + for (k, x) in [(PointerKind::Down, corner.x), (PointerKind::Drag, corner.x + 30.0), (PointerKind::Up, corner.x + 30.0)] { + s.pointer(&PointerEvent::new(k, x, corner.y), view).unwrap(); + } + assert_eq!(steps(&s), n + 2); + assert!((shape_of(&s, id).unwrap().width - 180.0).abs() < 1e-9); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(shape_of(&s, id).map(|s| s.width), Some(120.0)); +} diff --git a/crates/engine/tests/command_sweep.rs b/crates/engine/tests/command_sweep.rs index 4bc82c4397..2e6d9a678b 100644 --- a/crates/engine/tests/command_sweep.rs +++ b/crates/engine/tests/command_sweep.rs @@ -510,6 +510,20 @@ fn structured_junk() { ("shapeBuilder.regions", json!({"ids": [2, 3], "gap": "x"})), ("shapeBuilder.regions", json!({"gap": true})), ("shapeBuilder.regions", json!({"gap": 12, "ids": [u64::MAX]})), + // Path Precision Tools: the Parametric Shape Tool. + ("addon.pathtools.shape.create", json!({"center": [1e308, -1e308], "width": 1e308, "count": 1e308})), + ( + "addon.pathtools.shape.create", + json!({"center": [0, 0], "kind": "gear", "count": 1000, "a": 0.9, "radius": 16384, "width": 16384, "height": 0.01}), + ), + ("addon.pathtools.shape.create", json!({"center": [0, 0], "kind": "star", "count": 1000, "a": 0.01, "radius": 1e-300})), + ("addon.pathtools.shape.create", json!({"center": ["x", null], "kind": ["star"], "rotation": f64::NAN})), + ("addon.pathtools.shape.create", json!({"center": [5, 5], "kind": "bubble", "a": -1e308, "b": 1e308, "rotation": 1e308})), + ("addon.pathtools.shape.set", json!({"id": 2, "count": 1000, "kind": "gear"})), + ("addon.pathtools.shape.set", json!({"id": u64::MAX, "width": -1})), + ("addon.pathtools.shape.set", json!({"id": 2, "center": [1, 2, 3], "radius": "big"})), + ("addon.pathtools.shape.convert", json!({"ids": [0, 1, 2, 3, u64::MAX]})), + ("addon.pathtools.shape.convert", json!({"ids": "all"})), // Smart Pen add-on. ("addon.pen.append", json!({"id": 2, "x": 1e308, "y": 0, "in": [1e308, -1e308]})), ("addon.pen.append", json!({"id": 2, "subpath": u64::MAX, "x": 0, "y": 0, "segment": "curved"})), diff --git a/crates/pathops/src/addons.rs b/crates/pathops/src/addons.rs index bb821df062..f85ebae672 100644 --- a/crates/pathops/src/addons.rs +++ b/crates/pathops/src/addons.rs @@ -4,8 +4,8 @@ //! its shape within a tolerance (shared by every add-on that takes anchors away). //! - [`cleanup`]: Artwork Cleanup's path repairs (collinear, duplicate and near anchors, tiny //! handles, nearly closed paths) and Rejoin Path Pieces. -//! - [`pathtools`]: Path Precision Tools' anchor edits, path readouts, extending open paths and -//! finding where paths cross. +//! - [`pathtools`]: Path Precision Tools' anchor edits, path readouts, extending open paths, +//! finding where paths cross and the Parametric Shape Tool's re-editable shapes. //! - [`segment_reshape`]: bending a segment by dragging a point on it (shared by the tools that //! reshape segments directly). //! - [`pen`]: the Smart Pen's straight and curved segments and its point edits. diff --git a/crates/pathops/src/addons/pathtools.rs b/crates/pathops/src/addons/pathtools.rs index 7ab2809469..e836664138 100644 --- a/crates/pathops/src/addons/pathtools.rs +++ b/crates/pathops/src/addons/pathtools.rs @@ -1,10 +1,11 @@ //! Path Precision Tools' geometry: anchor edits for the Anchor Inspector (smooth by the auto-smooth //! rule, equalise handles, add evenly spaced anchors, close), the readouts the Measure & Inspect //! tool shows over a path, open paths lengthened or shortened at an end ([`extend`]) and the places -//! where paths cross ([`crossings`]). +//! where paths cross ([`crossings`]), and the Parametric Shape Tool's shapes ([`shapes`]). mod crossings; mod extend; +pub mod shapes; #[cfg(test)] mod tests; diff --git a/crates/pathops/src/addons/pathtools/shapes.rs b/crates/pathops/src/addons/pathtools/shapes.rs new file mode 100644 index 0000000000..08416f34a0 --- /dev/null +++ b/crates/pathops/src/addons/pathtools/shapes.rs @@ -0,0 +1,664 @@ +//! The Parametric Shape Tool's geometry (Path Precision Tools): shapes described by a few numbers +//! (kind, centre, size, rotation, a count and up to two values of the kind's own, corner radius) +//! that stay editable as those numbers. [`ParametricShape::path`] draws one; [`fingerprint`] and +//! [`ParametricShape::recover`] tell whether a path is still the shape it was drawn as, moved, +//! turned or scaled since, or was edited into something else; [`recognise`] finds the shape a +//! plain rectangle, ellipse or regular polygon is. + +use std::f64::consts::{PI, TAU}; + +use kurbo::{Affine, Point, Vec2}; +use vectorcraft_geom::corners::cut_corners; +use vectorcraft_geom::shapes::KAPPA; +use vectorcraft_geom::{Anchor, AnchorKind, PathData, SubPath}; + +/// The fewest sides, points or teeth. +pub const MIN_COUNT: u32 = 3; +/// The most sides, points or teeth. +pub const MAX_COUNT: u32 = 1000; +/// The smallest width or height (pt). +pub const MIN_SIZE: f64 = 0.01; +/// The largest width, height or corner radius (pt). +pub const MAX_SIZE: f64 = 16384.0; +/// The farthest from the origin a centre may be (pt). +pub const MAX_CENTER: f64 = 1e7; + +/// The kinds of parametric shape. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum ShapeKind { + Rectangle, + Ellipse, + Polygon, + Star, + Ring, + Arrow, + Cross, + Heart, + Gear, + Bubble, +} + +/// One of a kind's own values: its range and default. +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct ValueRange { + pub min: f64, + pub max: f64, + pub default: f64, +} + +const fn range(min: f64, max: f64, default: f64) -> Option { + Some(ValueRange { min, max, default }) +} + +impl ShapeKind { + pub const ALL: [ShapeKind; 10] = [ + ShapeKind::Rectangle, + ShapeKind::Ellipse, + ShapeKind::Polygon, + ShapeKind::Star, + ShapeKind::Ring, + ShapeKind::Arrow, + ShapeKind::Cross, + ShapeKind::Heart, + ShapeKind::Gear, + ShapeKind::Bubble, + ]; + + /// The kind's name in commands and files. + pub fn id(self) -> &'static str { + match self { + ShapeKind::Rectangle => "rectangle", + ShapeKind::Ellipse => "ellipse", + ShapeKind::Polygon => "polygon", + ShapeKind::Star => "star", + ShapeKind::Ring => "ring", + ShapeKind::Arrow => "arrow", + ShapeKind::Cross => "cross", + ShapeKind::Heart => "heart", + ShapeKind::Gear => "gear", + ShapeKind::Bubble => "bubble", + } + } + + pub fn parse(s: &str) -> Option { + Self::ALL.into_iter().find(|k| k.id() == s) + } + + /// Does `count` set how many sides, points or teeth the kind has? + pub fn counted(self) -> bool { + matches!(self, ShapeKind::Polygon | ShapeKind::Star | ShapeKind::Gear) + } + + /// The count a shape of this kind starts with. + pub fn default_count(self) -> u32 { + match self { + ShapeKind::Star => 5, + ShapeKind::Gear => 12, + _ => 6, + } + } + + /// Can its corners be rounded (`radius`)? Not a shape without corners. + pub fn rounds(self) -> bool { + !matches!(self, ShapeKind::Ellipse | ShapeKind::Ring) + } + + /// The kind's own values `a` and `b` (as fractions of its size), where it has them: a star's + /// and a ring's inner radius; an arrow's head length and shaft width; a cross's bar offset + /// (−: up) and arm thickness; a heart's notch depth and the roundness of its point; a gear's + /// tooth height; a speech bubble's tail height and where its tip is across (−1 left, 1 right). + pub fn values(self) -> [Option; 2] { + match self { + ShapeKind::Star => [range(0.01, 1.0, 0.5), None], + ShapeKind::Ring => [range(0.01, 0.99, 0.5), None], + ShapeKind::Arrow => [range(0.05, 0.95, 0.4), range(0.05, 0.95, 0.4)], + ShapeKind::Cross => [range(-0.9, 0.9, 0.0), range(0.05, 0.95, 1.0 / 3.0)], + ShapeKind::Heart => [range(0.0, 1.0, 0.4), range(0.0, 1.0, 0.0)], + ShapeKind::Gear => [range(0.01, 0.9, 0.2), None], + ShapeKind::Bubble => [range(0.05, 0.9, 0.25), range(-1.0, 1.0, -0.4)], + ShapeKind::Rectangle | ShapeKind::Ellipse | ShapeKind::Polygon => [None, None], + } + } +} + +/// A parametric shape: what it is and where; its outline is [`ParametricShape::path`]. +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct ParametricShape { + pub kind: ShapeKind, + pub center: Point, + pub width: f64, + pub height: f64, + /// Degrees clockwise on the page; 0 stands the shape upright (a polygon's first corner up). + pub rotation: f64, + /// Sides, points or teeth ([`ShapeKind::counted`]). + pub count: u32, + /// The kind's own values ([`ShapeKind::values`]); a kind without one ignores it. + pub a: f64, + pub b: f64, + /// The corners' radius (pt), each no larger than fits ([`ShapeKind::rounds`]). + pub radius: f64, +} + +/// Where a shape is wrong, as `(param, min, max)`: `param` must be from `min` to `max`. +pub type OutOfRange = (&'static str, f64, f64); + +impl ParametricShape { + /// A `kind` of shape about `center`, `width` × `height`, with the kind's defaults. + pub fn new(kind: ShapeKind, center: Point, width: f64, height: f64) -> Self { + let [a, b] = kind.values().map(|v| v.map_or(0.0, |v| v.default)); + Self { kind, center, width, height, rotation: 0.0, count: kind.default_count(), a, b, radius: 0.0 } + } + + /// The shape as another kind, keeping its place, size, rotation and corner radius; its count + /// and values are the new kind's defaults. + pub fn with_kind(self, kind: ShapeKind) -> Self { + if kind == self.kind { + return self; + } + Self { radius: self.radius, rotation: self.rotation, ..Self::new(kind, self.center, self.width, self.height) } + } + + /// The first number out of its range, if any (every number must also be finite). + pub fn check(&self) -> Result<(), OutOfRange> { + let within = |v: f64, lo: f64, hi: f64| v.is_finite() && (lo..=hi).contains(&v); + let size = [("width", self.width), ("height", self.height)]; + if let Some((key, _)) = size.into_iter().find(|(_, v)| !within(*v, MIN_SIZE, MAX_SIZE)) { + return Err((key, MIN_SIZE, MAX_SIZE)); + } + if !within(self.radius, 0.0, MAX_SIZE) { + return Err(("radius", 0.0, MAX_SIZE)); + } + if !(within(self.center.x, -MAX_CENTER, MAX_CENTER) && within(self.center.y, -MAX_CENTER, MAX_CENTER)) { + return Err(("center", -MAX_CENTER, MAX_CENTER)); + } + if !self.rotation.is_finite() { + return Err(("rotation", -360.0, 360.0)); + } + if !(MIN_COUNT..=MAX_COUNT).contains(&self.count) { + return Err(("count", f64::from(MIN_COUNT), f64::from(MAX_COUNT))); + } + // A value the kind doesn't have is left alone. + for (key, v, spec) in [("a", self.a, self.kind.values()[0]), ("b", self.b, self.kind.values()[1])] { + if let Some(r) = spec.filter(|r| !within(v, r.min, r.max)) { + return Err((key, r.min, r.max)); + } + } + Ok(()) + } + + /// From the shape's own frame (its centre at the origin, upright) to the page. + pub fn frame(&self) -> Affine { + Affine::translate(self.center.to_vec2()) * Affine::rotate(self.rotation.to_radians()) + } + + /// The shape's outline on the page: closed subpaths, starting at the top (a rectangle's and a + /// speech bubble's at the top left corner) and running clockwise; a ring's hole runs the + /// other way. `None` when a number is out of range ([`Self::check`]). + pub fn path(&self) -> Option { + self.check().ok()?; + let (rx, ry) = (self.width / 2.0, self.height / 2.0); + let at = |x: f64, y: f64| Point::new(x * rx, y * ry); + let polygon = |pts: Vec| vec![SubPath::polyline(&pts, true)]; + let (a, b) = (self.a, self.b); + let around = |n: usize, turn: f64, radius_at: &dyn Fn(usize) -> f64| -> Vec { + (0..n) + .map(|i| { + let (s, c) = (i as f64 * turn).sin_cos(); + let r = radius_at(i); + at(r * s, -r * c) + }) + .collect() + }; + let n = self.count as usize; + let subpaths = match self.kind { + ShapeKind::Rectangle => polygon(vec![at(-1.0, -1.0), at(1.0, -1.0), at(1.0, 1.0), at(-1.0, 1.0)]), + ShapeKind::Ellipse => vec![ellipse(rx, ry)], + ShapeKind::Polygon => polygon(around(n, TAU / n as f64, &|_| 1.0)), + ShapeKind::Star => polygon(around(2 * n, PI / n as f64, &|i| if i % 2 == 0 { 1.0 } else { a })), + ShapeKind::Ring => { + let mut hole = ellipse(rx * a, ry * a); + hole.reverse(); + vec![ellipse(rx, ry), hole] + } + ShapeKind::Arrow => { + // The head from the top down to `yb`, the shaft below it. + let (yb, sw) = (-1.0 + 2.0 * a, b); + polygon(vec![at(0.0, -1.0), at(1.0, yb), at(sw, yb), at(sw, 1.0), at(-sw, 1.0), at(-sw, yb), at(-1.0, yb)]) + } + ShapeKind::Cross => { + // The bar across, `a` of the way from the middle to an end of the upright. + let (t, y0) = (b, a * (1.0 - b)); + let (top, bottom) = (y0 - t, y0 + t); + polygon(vec![ + at(-t, -1.0), + at(t, -1.0), + at(t, top), + at(1.0, top), + at(1.0, bottom), + at(t, bottom), + at(t, 1.0), + at(-t, 1.0), + at(-t, bottom), + at(-1.0, bottom), + at(-1.0, top), + at(-t, top), + ]) + } + ShapeKind::Heart => vec![heart(a, b, &at)], + ShapeKind::Gear => { + // Each tooth's flanks and tip, centred on its angle; straight roots between them. + let step = TAU / n as f64; + let root = 1.0 - a; + let mut pts = Vec::with_capacity(4 * n); + for i in 0..n { + for (f, r) in [(-0.3, root), (-0.15, 1.0), (0.15, 1.0), (0.3, root)] { + let (s, c) = ((i as f64 + f) * step).sin_cos(); + pts.push(at(r * s, -r * c)); + } + } + polygon(pts) + } + ShapeKind::Bubble => { + // The body above `by`, the tail's base on its bottom edge, its tip on the bottom. + let by = 1.0 - 2.0 * a; + let (mid, half) = (b * 0.5, 0.3); + polygon(vec![at(-1.0, -1.0), at(1.0, -1.0), at(1.0, by), at(mid + half, by), at(b, 1.0), at(mid - half, by), at(-1.0, by)]) + } + }; + let mut path = PathData::new(subpaths); + if self.radius > 0.0 && self.kind.rounds() { + path = cut_corners(&path, &vec![self.radius; path.anchor_count()], &[]).0; + } + path.transform(self.frame()); + Some(path) + } + + /// The shape `path` is when it is this shape's outline moved, turned or scaled (along the + /// shape's own axes; uniformly when its corners are rounded), not mirrored or skewed, and + /// otherwise unedited: the new centre, size, rotation and corner radius. `None` when its + /// anchors were edited, or it was skewed or mirrored. + pub fn recover(&self, path: &PathData) -> Option { + let drawn = self.path()?; + let pts = |p: &PathData| p.anchors().map(|(_, _, a)| a.p).collect::>(); + let (from, to) = (pts(&drawn), pts(path)); + if from.len() != to.len() || drawn.subpaths.len() != path.subpaths.len() { + return None; + } + let m = fit_affine(&from, &to)? * self.frame(); + let [m0, m1, m2, m3, ..] = m.as_coeffs(); + let (x, y) = (Vec2::new(m0, m1), Vec2::new(m2, m3)); + let (sx, sy) = (x.hypot(), y.hypot()); + // Square and not mirrored: the shape's axes stay at right angles, turned the same way. + if !(sx > 1e-12 && sy > 1e-12) || x.dot(y).abs() > 1e-6 * sx * sy || x.cross(y) <= 0.0 { + return None; + } + let out = Self { + center: m * Point::ZERO, + width: self.width * sx, + height: self.height * sy, + rotation: vectorcraft_geom::normalize_deg(x.y.atan2(x.x).to_degrees()), + radius: self.radius * (sx * sy).sqrt(), + ..*self + }; + out.check().ok()?; + same(&out.path()?, path).then_some(out) + } +} + +/// An ellipse of radii `rx`, `ry` about the origin: four smooth anchors from the top, clockwise. +fn ellipse(rx: f64, ry: f64) -> SubPath { + let (kx, ky) = (rx * KAPPA, ry * KAPPA); + let s = |p: Point, out: Vec2| Anchor { p, h_in: p - out, h_out: p + out, kind: AnchorKind::Smooth }; + SubPath::new( + vec![ + s(Point::new(0.0, -ry), Vec2::new(kx, 0.0)), + s(Point::new(rx, 0.0), Vec2::new(0.0, ky)), + s(Point::new(0.0, ry), Vec2::new(-kx, 0.0)), + s(Point::new(-rx, 0.0), Vec2::new(0.0, -ky)), + ], + true, + ) +} + +/// A heart in the unit box (`at` scales it): two lobes over a point at the bottom, the notch +/// between the lobes `depth` of the way down to the middle, the point rounder with `round`. +fn heart(depth: f64, round: f64, at: &dyn Fn(f64, f64) -> Point) -> SubPath { + let ny = -1.0 + depth; + let notch = at(0.0, ny); + let mirror = |x: f64, y: f64| [at(x, y), at(-x, y)]; + let [notch_out, notch_in] = mirror(0.1, ny - 0.3 * (1.0 + ny)); + let [tip_in, tip_out] = mirror(0.2 + 0.4 * round, 0.7 + 0.3 * round); + let a = |p, h_in, h_out, kind| Anchor { p, h_in, h_out, kind }; + let smooth = AnchorKind::Smooth; + SubPath::new( + vec![ + a(notch, notch_in, notch_out, AnchorKind::Corner), + a(at(0.5, -1.0), at(0.2, -1.0), at(0.8, -1.0), smooth), + a(at(1.0, -0.35), at(1.0, -0.75), at(1.0, 0.1), smooth), + a(at(0.0, 1.0), tip_in, tip_out, AnchorKind::Corner), + a(at(-1.0, -0.35), at(-1.0, 0.1), at(-1.0, -0.75), smooth), + a(at(-0.5, -1.0), at(-0.8, -1.0), at(-0.2, -1.0), smooth), + ], + true, + ) +} + +/// The affine map taking each of `from` to the point of `to` at its index, worked out from +/// three of them far apart; `None` when they all lie on a line. +fn fit_affine(from: &[Point], to: &[Point]) -> Option { + let (&p0, &q0) = (from.first()?, to.first()?); + let far = (0..from.len()).max_by(|&i, &j| dist(from, i, p0).total_cmp(&dist(from, j, p0)))?; + let p1 = *from.get(far)?; + let wide = |i: usize| from.get(i).map_or(0.0, |p| (p1 - p0).cross(*p - p0).abs()); + let third = (0..from.len()).max_by(|&i, &j| wide(i).total_cmp(&wide(j)))?; + let (p2, q1, q2) = (*from.get(third)?, *to.get(far)?, *to.get(third)?); + let basis = |o: Point, u: Vec2, v: Vec2| Affine::new([u.x, u.y, v.x, v.y, o.x, o.y]); + let g = basis(p0, p1 - p0, p2 - p0); + let det = g.determinant(); + // Too thin a triangle to tell a turn from a skew. + if det.is_nan() || det.abs() <= 1e-9 * (p1 - p0).hypot2().max(1e-12) { + return None; + } + Some(basis(q0, q1 - q0, q2 - q0) * g.inverse()) +} + +fn dist(pts: &[Point], i: usize, from: Point) -> f64 { + pts.get(i).map_or(0.0, |p| p.distance(from)) +} + +/// Are `a` and `b` the same outline, anchor for anchor and handle for handle (to well under a +/// thousandth of a point at the size of the art)? +fn same(a: &PathData, b: &PathData) -> bool { + let scale = a.anchors().map(|(_, _, x)| x.p.x.abs().max(x.p.y.abs())).fold(1.0, f64::max); + let tol = 1e-3_f64.max(scale * 1e-9); + a.subpaths.len() == b.subpaths.len() + && a.subpaths.iter().zip(&b.subpaths).all(|(s, t)| { + s.closed == t.closed + && s.anchors.len() == t.anchors.len() + && s.anchors + .iter() + .zip(&t.anchors) + .all(|(x, y)| x.p.distance(y.p) <= tol && x.h_in.distance(y.h_in) <= tol && x.h_out.distance(y.h_out) <= tol) + }) +} + +/// A fingerprint of `path`'s geometry: its subpaths and every anchor and handle to a thousandth of +/// a point. Kept with a shape, it shows whether the path is still the one drawn. +pub fn fingerprint(path: &PathData) -> u64 { + // FNV-1a: the same in every build, as a fingerprint saved in a file must be. + let mut h: u64 = 0xcbf2_9ce4_8422_2325; + let mut eat = |v: i64| { + for byte in v.to_le_bytes() { + h = (h ^ u64::from(byte)).wrapping_mul(0x0100_0000_01b3); + } + }; + for sp in &path.subpaths { + eat(sp.anchors.len() as i64); + eat(i64::from(sp.closed)); + for a in &sp.anchors { + for p in [a.p, a.h_in, a.h_out] { + // Saturating casts: a huge or non-finite coordinate still hashes. + eat((p.x * 1000.0).round() as i64); + eat((p.y * 1000.0).round() as i64); + } + } + } + h +} + +/// The parametric shape a plain closed path is, if it is one: a rectangle (four corners, no +/// handles), an ellipse (four smooth anchors) or a polygon whose sides and corners are all equal, +/// stretched along its own axes at most. The shape's outline starts at its own first anchor, so +/// the path's anchors may come in a different order. +pub fn recognise(path: &PathData) -> Option { + let [sp] = path.subpaths.as_slice() else { return None }; + let n = sp.anchors.len(); + if !sp.closed || !(3..=MAX_COUNT as usize).contains(&n) { + return None; + } + let corners = sp.anchors.iter().all(|a| !a.has_in() && !a.has_out()); + let kinds: &[ShapeKind] = match (n, corners) { + (4, true) => &[ShapeKind::Rectangle, ShapeKind::Polygon], + (4, false) => &[ShapeKind::Ellipse], + (_, true) => &[ShapeKind::Polygon], + _ => return None, + }; + let unit = |kind| ParametricShape { count: n as u32, ..ParametricShape::new(kind, Point::ZERO, 2.0, 2.0) }; + // The path read from each anchor in turn, either way round. + for reversed in [false, true] { + let mut sp = sp.clone(); + if reversed { + sp.reverse(); + } + for _ in 0..n { + let candidate = PathData::single(sp.clone()); + if let Some(s) = kinds.iter().find_map(|k| unit(*k).recover(&candidate)) { + return Some(s); + } + sp.anchors.rotate_left(1); + } + } + None +} + +#[cfg(test)] +mod tests { + use super::*; + + fn shape(kind: ShapeKind) -> ParametricShape { + ParametricShape::new(kind, Point::new(100.0, 50.0), 80.0, 60.0) + } + + fn closed(p: &PathData) -> bool { + p.subpaths.iter().all(|s| s.closed) + } + + /// Every point of `p` lies in the shape's box (a little slack for curves). + fn within_box(p: &PathData, s: &ParametricShape) -> bool { + let b = p.bounds().unwrap(); + let (hw, hh) = (s.width / 2.0 + 1e-6, s.height / 2.0 + 1e-6); + b.x0 >= s.center.x - hw && b.x1 <= s.center.x + hw && b.y0 >= s.center.y - hh && b.y1 <= s.center.y + hh + } + + #[test] + fn each_kind_draws_a_closed_outline_in_its_box() { + for kind in ShapeKind::ALL { + let s = shape(kind); + assert_eq!(ShapeKind::parse(kind.id()), Some(kind)); + assert_eq!(s.check(), Ok(()), "{kind:?}"); + let p = s.path().unwrap(); + assert!(closed(&p) && within_box(&p, &s), "{kind:?}: {:?}", p.bounds()); + assert!(p.anchors().all(|(_, _, a)| a.p.x.is_finite() && a.p.y.is_finite())); + } + assert_eq!(ShapeKind::parse("cloud"), None); + } + + #[test] + fn anchor_counts_and_corners_per_kind() { + let count = |kind, n: u32| ParametricShape { count: n, ..shape(kind) }.path().unwrap().anchor_count(); + assert_eq!(count(ShapeKind::Rectangle, 3), 4); + assert_eq!(count(ShapeKind::Ellipse, 3), 4); + assert_eq!(count(ShapeKind::Polygon, 7), 7); + assert_eq!(count(ShapeKind::Polygon, 1000), 1000); + assert_eq!(count(ShapeKind::Star, 5), 10); + assert_eq!(count(ShapeKind::Gear, 12), 48); + assert_eq!(count(ShapeKind::Arrow, 3), 7); + assert_eq!(count(ShapeKind::Cross, 3), 12); + assert_eq!(count(ShapeKind::Heart, 3), 6); + assert_eq!(count(ShapeKind::Bubble, 3), 7); + let ring = shape(ShapeKind::Ring).path().unwrap(); + assert_eq!(ring.subpaths.len(), 2); + // The hole runs the other way, so it stays a hole under the non-zero rule. + assert!(ring.subpaths[0].signed_area() * ring.subpaths[1].signed_area() < 0.0); + let (outer, inner) = (ring.subpaths[0].area().abs(), ring.subpaths[1].area().abs()); + assert!((inner / outer - 0.25).abs() < 1e-3, "inner ratio 0.5 → a quarter of the area: {}", inner / outer); + } + + #[test] + fn polygons_and_stars_stand_upright_and_turn_clockwise() { + let p = shape(ShapeKind::Polygon).path().unwrap(); + let top = p.subpaths[0].anchors[0].p; + assert!(top.distance(Point::new(100.0, 20.0)) < 1e-9, "first corner straight up: {top:?}"); + let turned = ParametricShape { rotation: 90.0, ..shape(ShapeKind::Polygon) }.path().unwrap(); + let right = turned.subpaths[0].anchors[0].p; + assert!(right.distance(Point::new(130.0, 50.0)) < 1e-9, "a quarter turn clockwise puts it on the right: {right:?}"); + let star = shape(ShapeKind::Star).path().unwrap(); + let inner = star.subpaths[0].anchors[1].p.distance(Point::new(100.0, 50.0)); + let outer = star.subpaths[0].anchors[0].p.distance(Point::new(100.0, 50.0)); + assert!((outer - 30.0).abs() < 1e-9 && inner < outer * 0.6, "{outer} {inner}"); + } + + #[test] + fn values_change_each_kind() { + let differ = |kind: ShapeKind, a: f64, b: f64| { + let s = shape(kind); + let t = ParametricShape { a, b, ..s }; + assert_eq!(t.check(), Ok(()), "{kind:?}"); + assert_ne!(s.path(), t.path(), "{kind:?} a {a} b {b}"); + }; + differ(ShapeKind::Star, 0.2, 0.0); + differ(ShapeKind::Ring, 0.8, 0.0); + differ(ShapeKind::Arrow, 0.6, 0.4); + differ(ShapeKind::Arrow, 0.4, 0.2); + differ(ShapeKind::Cross, 0.5, 1.0 / 3.0); + differ(ShapeKind::Cross, 0.0, 0.6); + differ(ShapeKind::Heart, 0.8, 0.0); + differ(ShapeKind::Heart, 0.4, 1.0); + differ(ShapeKind::Gear, 0.5, 0.0); + differ(ShapeKind::Bubble, 0.5, -0.4); + differ(ShapeKind::Bubble, 0.25, 0.8); + // An arrow's head reaches down `a` of the height. + let arrow = ParametricShape { a: 0.5, ..shape(ShapeKind::Arrow) }.path().unwrap(); + assert!((arrow.subpaths[0].anchors[1].p.y - 50.0).abs() < 1e-9); + // A gear's roots sit `a` of the radius in. + let gear = shape(ShapeKind::Gear).path().unwrap(); + let root = gear.subpaths[0].anchors[0].p - Point::new(100.0, 50.0); + assert!((root.x / 40.0).hypot(root.y / 30.0) - 0.8 < 1e-9); + } + + #[test] + fn corners_round_but_never_past_the_middle_of_a_side() { + let sharp = shape(ShapeKind::Rectangle); + let round = ParametricShape { radius: 10.0, ..sharp }; + let p = round.path().unwrap(); + assert_eq!(p.anchor_count(), 8); + assert_eq!(p.bounds(), sharp.path().unwrap().bounds()); + // Far too big a radius: the corners meet in the middle of the short sides. + let huge = ParametricShape { radius: 1000.0, ..sharp }.path().unwrap(); + let b = huge.bounds().unwrap(); + assert!((b.width() - 80.0).abs() < 1e-6 && (b.height() - 60.0).abs() < 1e-6); + // Kinds without corners ignore it. + let e = ParametricShape { radius: 10.0, ..shape(ShapeKind::Ellipse) }; + assert_eq!(e.path(), shape(ShapeKind::Ellipse).path()); + for kind in ShapeKind::ALL.into_iter().filter(|k| k.rounds()) { + let p = ParametricShape { radius: 3.0, ..shape(kind) }.path().unwrap(); + assert!(p.anchor_count() > shape(kind).path().unwrap().anchor_count(), "{kind:?}"); + } + } + + #[test] + fn numbers_out_of_range_are_refused() { + let s = shape(ShapeKind::Star); + let bad = [ + (ParametricShape { width: 0.0, ..s }, "width"), + (ParametricShape { height: MAX_SIZE * 2.0, ..s }, "height"), + (ParametricShape { width: f64::NAN, ..s }, "width"), + (ParametricShape { count: 2, ..s }, "count"), + (ParametricShape { count: MAX_COUNT + 1, ..s }, "count"), + (ParametricShape { a: 1.5, ..s }, "a"), + (ParametricShape { a: f64::NAN, ..s }, "a"), + (ParametricShape { radius: -1.0, ..s }, "radius"), + (ParametricShape { rotation: f64::INFINITY, ..s }, "rotation"), + (ParametricShape { center: Point::new(1e300, 0.0), ..s }, "center"), + ]; + for (shape, key) in bad { + assert_eq!(shape.check().map_err(|e| e.0), Err(key)); + assert_eq!(shape.path(), None); + } + } + + #[test] + fn with_kind_keeps_the_place_and_takes_the_new_kinds_defaults() { + let s = ParametricShape { rotation: 30.0, radius: 4.0, count: 9, ..shape(ShapeKind::Polygon) }; + let star = s.with_kind(ShapeKind::Star); + assert_eq!((star.center, star.width, star.rotation, star.radius, star.count, star.a), (s.center, 80.0, 30.0, 4.0, 5, 0.5)); + let arrow = star.with_kind(ShapeKind::Arrow); + assert_eq!((arrow.count, arrow.a, arrow.b), (6, 0.4, 0.4)); + assert_eq!(arrow.check(), Ok(())); + } + + #[test] + fn a_moved_turned_or_scaled_shape_is_recovered() { + for kind in ShapeKind::ALL { + let s = ParametricShape { rotation: 20.0, ..shape(kind) }; + let p = s.path().unwrap(); + assert_eq!(s.recover(&p).map(|r| r.kind), Some(kind), "unchanged {kind:?}"); + let xf = Affine::translate((40.0, -15.0)) * Affine::rotate_about(0.5, s.center); + let r = s.recover(&p.transformed(xf)).unwrap_or_else(|| panic!("{kind:?} moved and turned")); + assert!((r.rotation - (20.0 + 0.5f64.to_degrees())).abs() < 1e-6 && (r.width - 80.0).abs() < 1e-6, "{r:?}"); + assert!(r.center.distance(Point::new(140.0, 35.0)) < 1e-6); + // Scaled along its own axes. + let along = s.frame() * Affine::scale_non_uniform(1.5, 0.5) * s.frame().inverse(); + let r = s.recover(&p.transformed(along)).unwrap_or_else(|| panic!("{kind:?} scaled")); + assert!((r.width - 120.0).abs() < 1e-6 && (r.height - 30.0).abs() < 1e-6, "{kind:?} {r:?}"); + } + // Rounded corners scale uniformly only. + let s = ParametricShape { radius: 5.0, ..shape(ShapeKind::Star) }; + let p = s.path().unwrap(); + let r = s.recover(&p.transformed(Affine::scale_about(2.0, s.center))).unwrap(); + assert!((r.radius - 10.0).abs() < 1e-9 && (r.width - 160.0).abs() < 1e-9); + assert_eq!(s.recover(&p.transformed(Affine::scale_non_uniform(2.0, 1.0))), None); + } + + #[test] + fn edited_skewed_or_mirrored_shapes_are_not() { + let s = shape(ShapeKind::Star); + let p = s.path().unwrap(); + let mut edited = p.clone(); + edited.anchor_mut(0, 3).unwrap().translate(Vec2::new(5.0, 0.0)); + assert_eq!(s.recover(&edited), None); + assert_eq!(s.recover(&p.transformed(Affine::skew(0.3, 0.0))), None); + assert_eq!(s.recover(&p.transformed(Affine::FLIP_X)), None); + let mut more = p.clone(); + more.subpaths[0].insert_anchor(0, 0.5); + assert_eq!(s.recover(&more), None); + assert_eq!(s.recover(&PathData::default()), None); + } + + #[test] + fn the_fingerprint_follows_the_geometry() { + let p = shape(ShapeKind::Gear).path().unwrap(); + assert_eq!(fingerprint(&p), fingerprint(&p.clone())); + assert_eq!(fingerprint(&p), fingerprint(&p.transformed(Affine::translate((1e-5, 0.0)))), "below a thousandth of a point"); + assert_ne!(fingerprint(&p), fingerprint(&p.transformed(Affine::translate((0.01, 0.0))))); + let mut edited = p.clone(); + edited.anchor_mut(0, 5).unwrap().h_out.x += 1.0; + assert_ne!(fingerprint(&p), fingerprint(&edited)); + let mut weird = p.clone(); + weird.anchor_mut(0, 0).unwrap().p.x = f64::NAN; + let _ = fingerprint(&weird); + } + + #[test] + fn plain_rectangles_ellipses_and_regular_polygons_are_recognised() { + use vectorcraft_geom::shapes; + let r = recognise(&shapes::rectangle(kurbo::Rect::new(10.0, 20.0, 110.0, 70.0))).unwrap(); + assert_eq!(r.kind, ShapeKind::Rectangle); + assert!(r.center.distance(Point::new(60.0, 45.0)) < 1e-9); + let (w, h) = if r.rotation.abs() < 1e-6 || (r.rotation.abs() - 180.0).abs() < 1e-6 { (r.width, r.height) } else { (r.height, r.width) }; + assert!((w - 100.0).abs() < 1e-9 && (h - 50.0).abs() < 1e-9, "{r:?}"); + let e = recognise(&shapes::ellipse(kurbo::Rect::new(0.0, 0.0, 40.0, 20.0))).unwrap(); + assert_eq!(e.kind, ShapeKind::Ellipse); + assert!(e.center.distance(Point::new(20.0, 10.0)) < 1e-9); + let poly = recognise(&shapes::polygon(Point::new(50.0, 50.0), 30.0, 7, 10.0)).unwrap(); + assert_eq!((poly.kind, poly.count), (ShapeKind::Polygon, 7)); + assert!((poly.width - 60.0).abs() < 1e-6); + // Its outline is the polygon's, if from another first anchor. + let (a, b) = (poly.path().unwrap().bounds().unwrap(), shapes::polygon(Point::new(50.0, 50.0), 30.0, 7, 10.0).bounds().unwrap()); + assert!(a.center().distance(b.center()) < 1e-9 && (a.area() - b.area()).abs() < 1e-6, "{a:?} {b:?}"); + // Not regular, open, or a star: no. + assert_eq!(recognise(&PathData::single(SubPath::polyline(&[Point::ZERO, Point::new(10.0, 0.0), Point::new(3.0, 8.0)], true))), None); + assert_eq!(recognise(&PathData::single(SubPath::polyline(&[Point::ZERO, Point::new(10.0, 0.0), Point::new(10.0, 10.0)], false))), None); + assert_eq!(recognise(&shapes::star(Point::ZERO, 10.0, 4.0, 5, 0.0)), None); + } +} diff --git a/crates/tools/src/addons.rs b/crates/tools/src/addons.rs index 8c5c9909ba..d10e38a3b5 100644 --- a/crates/tools/src/addons.rs +++ b/crates/tools/src/addons.rs @@ -5,6 +5,7 @@ pub mod anchor_eraser; pub mod extend_path; pub mod measure_inspect; +pub mod parametric_shape; pub mod smart_pen; use crate::{Tool, ToolInfo}; @@ -14,6 +15,7 @@ pub const PATH_TOOLS: &[ToolInfo] = &[ ToolInfo { id: anchor_eraser::ID, label: "Anchor Eraser Brush", shortcut: None, icon: "dc-remove-brush" }, ToolInfo { id: extend_path::ID, label: "Extend Path Tool", shortcut: None, icon: "dc-arrow-extend" }, ToolInfo { id: measure_inspect::ID, label: "Measure & Inspect Tool", shortcut: None, icon: "ruler" }, + ToolInfo { id: parametric_shape::ID, label: "Parametric Shape Tool", shortcut: None, icon: "hexagon" }, ]; /// Smart Pen's tool, a flyout group of its own. @@ -37,6 +39,7 @@ pub fn create(id: &str) -> Option> { anchor_eraser::ID => Box::new(anchor_eraser::AnchorEraserTool::default()), extend_path::ID => Box::new(extend_path::ExtendPathTool::default()), measure_inspect::ID => Box::new(measure_inspect::MeasureInspectTool::default()), + parametric_shape::ID => Box::new(parametric_shape::ParametricShapeTool::default()), smart_pen::ID => Box::new(smart_pen::SmartPenTool::default()), _ => return None, }) diff --git a/crates/tools/src/addons/parametric_shape.rs b/crates/tools/src/addons/parametric_shape.rs new file mode 100644 index 0000000000..d16cb63935 --- /dev/null +++ b/crates/tools/src/addons/parametric_shape.rs @@ -0,0 +1,620 @@ +//! Parametric Shape Tool (Path Precision Tools): shapes that stay editable as numbers. A drag from +//! the centre draws one (`addon.pathtools.shape.create`): the drag's length is its size and its +//! direction its rotation (Shift: 45° steps); ↑/↓ change the kind's count or first value while +//! dragging, ←/→ its second value or corner radius. A click selects a parametric shape and shows +//! its handles (centre, size, rotation, corner radius and one of the kind's own), whose drags run +//! `addon.pathtools.shape.set`; a double-click on the canvas places one with the last settings. +//! Each gesture is one undo step. +//! +//! A parametric shape is an ordinary path that keeps its numbers in one entry of its object data +//! ([`KEY`]) with a fingerprint of the outline they drew. Moved, turned or scaled by any tool it +//! stays editable ([`ParametricShape::recover`]); once its anchors are edited it is a plain path. + +use serde_json::{Value, json}; +use vectorcraft_doc::hit::hit_test; +use vectorcraft_doc::{Node, NodeId, NodeKind}; +use vectorcraft_geom::{Affine, BezPath, PathData, Point, Vec2}; +use vectorcraft_pathops::addons::pathtools::shapes::fingerprint; +pub use vectorcraft_pathops::addons::pathtools::shapes::{MAX_COUNT, MAX_SIZE, MIN_COUNT, MIN_SIZE, ParametricShape, ShapeKind}; + +use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey}; + +/// The tool's id. +pub const ID: &str = "parametricShape"; +/// The object data entry that holds a parametric shape's numbers (JSON). The `vc-` prefix marks it +/// as VectorCraft's own, which SVG export leaves out of the `data-*` attributes it writes. +pub const KEY: &str = "vc-pathtools-shape"; +/// The longest entry read back (a damaged file's longer one is no shape). +const MAX_STORED: usize = 4096; +/// The undo steps' names. +pub const CREATE: &str = "Parametric Shape"; +pub const EDIT: &str = "Edit Parametric Shape"; +const BLUE: [u8; 3] = [0x4f, 0x9d, 0xff]; +/// How far (px) the rotation handle stands above the shape. +const STEM_PX: f64 = 24.0; + +/// `s` as commands take it and files keep it. +pub fn to_json(s: &ParametricShape) -> Value { + json!({ + "kind": s.kind.id(), "center": [s.center.x, s.center.y], "width": s.width, "height": s.height, + "rotation": s.rotation, "count": s.count, "a": s.a, "b": s.b, "radius": s.radius, + }) +} + +/// `s` with the numbers `p` gives (as [`to_json`] writes them; any left out stay as they are). A +/// new `kind` comes first, with its own defaults for what `p` leaves out. Every number is checked: +/// the error says which is wrong. +pub fn apply(mut s: ParametricShape, p: &Value) -> Result { + let given = |key: &str| p.get(key).filter(|v| !v.is_null()); + let num = |key: &str| -> Result, String> { + given(key).map(|v| v.as_f64().filter(|x| x.is_finite()).ok_or_else(|| format!("`{key}` must be a number"))).transpose() + }; + if let Some(k) = given("kind") { + let kind = k.as_str().and_then(ShapeKind::parse); + s = s.with_kind(kind.ok_or("`kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble")?); + } + if let Some(c) = given("center") { + let xy = c.as_array().filter(|a| a.len() == 2).and_then(|a| Some((a.first()?.as_f64()?, a.get(1)?.as_f64()?))); + let (x, y) = xy.ok_or("`center` must be [x, y]")?; + s.center = Point::new(x, y); + } + for (key, slot) in [("width", &mut s.width), ("height", &mut s.height), ("a", &mut s.a), ("b", &mut s.b), ("radius", &mut s.radius)] { + if let Some(v) = num(key)? { + *slot = v; + } + } + if let Some(r) = num("rotation")? { + s.rotation = vectorcraft_geom::normalize_deg(r); + } + if let Some(n) = num("count")? { + if n.fract() != 0.0 || !(f64::from(MIN_COUNT)..=f64::from(MAX_COUNT)).contains(&n) { + return Err("`count` must be a whole number from 3 to 1000".into()); + } + s.count = n as u32; + } + s.check().map_err(|(key, lo, hi)| format!("`{key}` must be from {lo} to {hi}"))?; + Ok(s) +} + +/// What a parametric shape keeps in its object data ([`KEY`]): its numbers and the fingerprint of +/// `path`, the outline they drew. +pub fn stored(s: &ParametricShape, path: &PathData) -> String { + let mut v = to_json(s); + v["fp"] = json!(format!("{:016x}", fingerprint(path))); + v.to_string() +} + +/// The parametric shape object `n` is, if it is one: a path (not a guide) with a [`KEY`] entry +/// whose fingerprint is its outline's, or which it is moved, turned or scaled. `None` for any +/// other object, a damaged entry, or a path whose anchors were edited since. +pub fn read(n: &Node) -> Option { + let NodeKind::Path { path, guide: false, .. } = &n.kind else { return None }; + let (_, text) = n.extras().attrs.as_deref()?.data.iter().find(|(k, _)| k == KEY)?; + if text.len() > MAX_STORED { + return None; + } + let v: Value = serde_json::from_str(text).ok()?; + let s = apply(ParametricShape::new(ShapeKind::Polygon, Point::ZERO, 100.0, 100.0), &v).ok()?; + let fp = v.get("fp").and_then(Value::as_str).and_then(|f| u64::from_str_radix(f, 16).ok())?; + if fp == fingerprint(path) { Some(s) } else { s.recover(path) } +} + +/// The values the arrow keys change while drawing: ↑/↓ the first, ←/→ the second. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum Field { + Count, + A, + B, + Radius, +} + +/// The kind's (↑/↓, ←/→) values. +fn arrow_fields(kind: ShapeKind) -> (Option, Option) { + match kind { + ShapeKind::Rectangle => (None, Some(Field::Radius)), + ShapeKind::Ellipse => (None, None), + ShapeKind::Polygon => (Some(Field::Count), Some(Field::Radius)), + ShapeKind::Star | ShapeKind::Gear => (Some(Field::Count), Some(Field::A)), + ShapeKind::Ring => (Some(Field::A), None), + ShapeKind::Arrow | ShapeKind::Cross | ShapeKind::Heart | ShapeKind::Bubble => (Some(Field::A), Some(Field::B)), + } +} + +/// `s` with `field` one step up (`up`) or down: a count by one, a value by 5 % of its range, the +/// corner radius by `step` pt; each kept within its range. +fn stepped(mut s: ParametricShape, field: Field, up: bool, step: f64) -> ParametricShape { + let sign = if up { 1.0 } else { -1.0 }; + let value = |v: f64, slot: usize| match s.kind.values().get(slot).copied().flatten() { + Some(r) => (v + sign * 0.05 * (r.max - r.min)).clamp(r.min, r.max), + None => v, + }; + match field { + Field::Count => s.count = if up { (s.count + 1).min(MAX_COUNT) } else { s.count.saturating_sub(1).max(MIN_COUNT) }, + Field::A => s.a = value(s.a, 0), + Field::B => s.b = value(s.b, 1), + Field::Radius => s.radius = (s.radius + sign * step).clamp(0.0, MAX_SIZE), + } + s +} + +/// The handles of a selected shape. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum Grip { + /// The centre: moves the shape. + Move, + /// The box's lower right corner: sizes it about its centre (Shift keeps its proportions). + Size, + /// Above the top: turns it (Shift: 45° steps). + Rotate, + /// On the box's top edge, the radius in from its left end: the corner radius. + Corner, + /// One of the kind's own values, where it shows. + Value, +} + +/// Where the kind's own value handle is, in the shape's unit box (−1..1 each way, y down). +fn value_spot(s: &ParametricShape) -> Option { + let n = f64::from(s.count.max(1)); + Some(match s.kind { + ShapeKind::Star => { + let (sn, cs) = (std::f64::consts::PI / n).sin_cos(); + Point::new(s.a * sn, -s.a * cs) + } + ShapeKind::Ring => Point::new(0.0, -s.a), + ShapeKind::Gear => Point::new(0.0, -(1.0 - s.a)), + ShapeKind::Arrow => Point::new(1.0, -1.0 + 2.0 * s.a), + ShapeKind::Cross => Point::new(-1.0, s.a * (1.0 - s.b)), + ShapeKind::Heart => Point::new(0.0, -1.0 + s.a), + ShapeKind::Bubble => Point::new(s.b, 1.0), + ShapeKind::Rectangle | ShapeKind::Ellipse | ShapeKind::Polygon => return None, + }) +} + +/// `s` with its own value set from the handle dragged to `u` (unit box), within its range. +fn value_from(mut s: ParametricShape, u: Point) -> ParametricShape { + let clamp = |v: f64, slot: usize| s.kind.values().get(slot).copied().flatten().map_or(v, |r| v.clamp(r.min, r.max)); + match s.kind { + ShapeKind::Star | ShapeKind::Ring => s.a = clamp(u.to_vec2().hypot(), 0), + ShapeKind::Gear => s.a = clamp(1.0 - u.to_vec2().hypot(), 0), + ShapeKind::Arrow => s.a = clamp((u.y + 1.0) / 2.0, 0), + ShapeKind::Cross => s.a = clamp(u.y / (1.0 - s.b).max(1e-9), 0), + ShapeKind::Heart => s.a = clamp(u.y + 1.0, 0), + ShapeKind::Bubble => s.b = clamp(u.x, 1), + ShapeKind::Rectangle | ShapeKind::Ellipse | ShapeKind::Polygon => {} + } + s +} + +/// The handles of `s` and where they are on the page. +fn grips(cx: &ToolContext, s: &ParametricShape) -> Vec<(Grip, Point)> { + let (f, rx, ry) = (s.frame(), s.width / 2.0, s.height / 2.0); + let mut out = vec![(Grip::Move, s.center), (Grip::Size, f * Point::new(rx, ry)), (Grip::Rotate, f * Point::new(0.0, -ry - cx.tol(STEM_PX)))]; + if s.kind.rounds() { + out.push((Grip::Corner, f * Point::new(-rx + s.radius.min(rx), -ry))); + } + if let Some(u) = value_spot(s) { + out.push((Grip::Value, f * Point::new(u.x * rx, u.y * ry))); + } + out +} + +/// The angle (degrees clockwise from straight up) of `p` seen from `c`; with Shift in 45° steps. +fn angle(c: Point, p: Point, shift: bool) -> f64 { + let d = p - c; + let deg = d.x.atan2(-d.y).to_degrees(); + vectorcraft_geom::normalize_deg(if shift { (deg / 45.0).round() * 45.0 } else { deg }) +} + +/// A drag under way. +#[derive(Clone, Debug, PartialEq)] +enum Drag { + /// Drawing a shape out from its centre. + Create { center: Point }, + /// Dragging a handle of shape `id`, which was `shape` when the drag began at `from`. + Edit { id: NodeId, shape: ParametricShape, grip: Grip, from: Point }, +} + +pub struct ParametricShapeTool { + /// What the next shape is (its kind and numbers, and the size and rotation a double-click + /// gives it: the last drawn one's). + next: ParametricShape, + drag: Option, + /// Where the pointer last was during the drag, and the keys held. + last: (Point, Mods), +} + +impl Default for ParametricShapeTool { + fn default() -> Self { + Self { next: ParametricShape::new(ShapeKind::Polygon, Point::ZERO, 100.0, 100.0), drag: None, last: (Point::ZERO, Mods::default()) } + } +} + +/// The one selected object when it is an editable parametric shape. +fn selected(cx: &ToolContext) -> Option<(NodeId, ParametricShape)> { + let [id] = cx.selection.objects.as_slice() else { return None }; + let s = read(cx.doc.node(*id)?)?; + cx.doc.is_editable(*id).then_some((*id, s)) +} + +/// The editable parametric shape under `p`. +fn shape_at(cx: &ToolContext, p: Point) -> Option { + let id = hit_test(cx.doc, p, cx.hit_options())?.leaf; + (cx.doc.is_editable(id) && read(cx.doc.node(id)?).is_some()).then_some(id) +} + +impl ParametricShapeTool { + /// The shape a drag to `p` with `mods` makes, and the command that makes it. + fn shaped(&self, drag: &Drag, p: Point, mods: Mods) -> (&'static str, ParametricShape, Option) { + let fit = |v: f64| v.clamp(MIN_SIZE, MAX_SIZE); + match *drag { + Drag::Create { center } => { + let r = center.distance(p); + let aspect = self.next.width / self.next.height; + let s = ParametricShape { + center, + width: fit(2.0 * r * aspect), + height: fit(2.0 * r), + rotation: angle(center, p, mods.shift), + ..self.next + }; + ("addon.pathtools.shape.create", s, None) + } + Drag::Edit { id, shape: s, grip, from } => { + let local = s.frame().inverse() * p; + let (rx, ry) = (s.width / 2.0, s.height / 2.0); + let out = match grip { + Grip::Move => ParametricShape { center: s.center + (p - from), ..s }, + Grip::Size if mods.shift => { + let k = (local.x.abs() / rx).max(local.y.abs() / ry); + ParametricShape { width: fit(s.width * k), height: fit(s.height * k), ..s } + } + Grip::Size => ParametricShape { width: fit(2.0 * local.x.abs()), height: fit(2.0 * local.y.abs()), ..s }, + Grip::Rotate => ParametricShape { rotation: angle(s.center, p, mods.shift), ..s }, + Grip::Corner => ParametricShape { radius: (local.x + rx).clamp(0.0, rx.min(MAX_SIZE)), ..s }, + Grip::Value => value_from(s, Point::new(local.x / rx, local.y / ry)), + }; + ("addon.pathtools.shape.set", out, Some(id)) + } + } + } + + /// The preview of the drag under way at the pointer's last place. + fn preview(&self) -> Option { + let drag = self.drag.as_ref()?; + let (cmd, s, id) = self.shaped(drag, self.last.0, self.last.1); + let mut p = to_json(&s); + if let Some(id) = id { + p["id"] = json!(id.0); + } + Some(Action::Preview(cmd.into(), p)) + } +} + +impl Tool for ParametricShapeTool { + fn id(&self) -> &'static str { + ID + } + + fn busy(&self) -> bool { + self.drag.is_some() + } + + fn pointer(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec { + match ev.kind { + PointerKind::Move => vec![], + PointerKind::Down => { + let tol = cx.point_tol(); + let grip = selected(cx).and_then(|(id, s)| { + let near = grips(cx, &s).into_iter().filter(|(_, at)| at.distance(ev.pos) <= tol); + near.min_by(|a, b| a.1.distance(ev.pos).total_cmp(&b.1.distance(ev.pos))).map(|(g, _)| (id, s, g)) + }); + if let Some((id, shape, grip)) = grip { + self.drag = Some(Drag::Edit { id, shape, grip, from: ev.pos }); + self.last = (ev.pos, ev.mods); + return vec![Action::Begin(EDIT.into())]; + } + if let Some(id) = shape_at(cx, ev.pos) { + return if cx.selection.objects == [id] { vec![] } else { vec![Action::Exec("select.set".into(), json!({ "ids": [id.0] }))] }; + } + let (center, _) = crate::guides::snap_draw(cx, ev.pos, &[]); + self.drag = Some(Drag::Create { center }); + self.last = (center, ev.mods); + vec![Action::Begin(CREATE.into())] + } + PointerKind::Drag | PointerKind::Up => { + if self.drag.is_none() { + return vec![]; + } + self.last = (ev.pos, ev.mods); + let Some(preview) = self.preview() else { return vec![] }; + if ev.kind == PointerKind::Drag { + return vec![preview]; + } + let Some(drag) = self.drag.take() else { return vec![] }; + match drag { + // A click draws nothing (a double-click places a shape). + Drag::Create { center } if center.distance(ev.pos) <= cx.tol(2.0) => vec![Action::Cancel], + Drag::Create { .. } => { + if let Action::Preview(_, p) = &preview + && let Ok(s) = apply(self.next, p) + { + self.next = ParametricShape { center: Point::ZERO, ..s }; + } + vec![preview, Action::Commit] + } + Drag::Edit { from, .. } if from == ev.pos => vec![Action::Cancel], + Drag::Edit { .. } => vec![preview, Action::Commit], + } + } + PointerKind::DoubleClick => { + if self.drag.is_some() || shape_at(cx, ev.pos).is_some() { + return vec![]; + } + let s = ParametricShape { center: ev.pos, ..self.next }; + vec![Action::Exec("addon.pathtools.shape.create".into(), to_json(&s))] + } + } + } + + fn key(&mut self, cx: &ToolContext, key: ToolKey, _mods: Mods) -> Vec { + if key == ToolKey::Escape && self.drag.take().is_some() { + return vec![Action::Cancel]; + } + if !matches!(self.drag, Some(Drag::Create { .. })) { + return vec![]; + } + let (primary, secondary) = arrow_fields(self.next.kind); + let (field, up) = match key { + ToolKey::Up => (primary, true), + ToolKey::Down => (primary, false), + ToolKey::Right => (secondary, true), + ToolKey::Left => (secondary, false), + _ => return vec![], + }; + let Some(field) = field else { return vec![] }; + self.next = stepped(self.next, field, up, cx.keyboard_increment.max(0.01)); + self.preview().into_iter().collect() + } + + fn claims_key(&self, _cx: &ToolContext, key: ToolKey) -> bool { + match self.drag { + Some(Drag::Create { .. }) => matches!(key, ToolKey::Up | ToolKey::Down | ToolKey::Left | ToolKey::Right | ToolKey::Escape), + Some(Drag::Edit { .. }) => key == ToolKey::Escape, + None => false, + } + } + + fn overlays(&self, cx: &ToolContext) -> Vec { + if let Some(Drag::Create { center }) = &self.drag { + let (_, s, _) = self.shaped(&Drag::Create { center: *center }, self.last.0, self.last.1); + let text = format!("{}\nAngle: {:.1}°", cx.size_label(s.width, s.height), s.rotation); + return vec![Overlay::Measure { p: self.last.0 + Vec2::new(cx.tol(12.0), cx.tol(12.0)), text }]; + } + let Some((_, s)) = selected(cx) else { return vec![] }; + // The shape's box, then its handles. + let (rx, ry) = (s.width / 2.0, s.height / 2.0); + let mut bp = BezPath::new(); + let f: Affine = s.frame(); + let corners = [(-rx, -ry), (rx, -ry), (rx, ry), (-rx, ry)].map(|(x, y)| f * Point::new(x, y)); + for (i, p) in corners.iter().enumerate() { + if i == 0 { bp.move_to(*p) } else { bp.line_to(*p) } + } + bp.close_path(); + let mut out = vec![Overlay::Path { path: bp, color: BLUE, width: 1.0, dashed: true }]; + for (grip, p) in grips(cx, &s) { + if grip == Grip::Rotate { + out.push(Overlay::Line { a: f * Point::new(0.0, -ry), b: p, color: BLUE, dashed: false }); + } + out.push(match grip { + Grip::Move | Grip::Size => Overlay::Anchor { p, color: BLUE, filled: grip == Grip::Move, size: 7.0 }, + Grip::Rotate => Overlay::Handle { p, color: BLUE }, + Grip::Corner | Grip::Value => Overlay::CurvePoint { p, color: BLUE, filled: grip == Grip::Value, size: 7.0 }, + }); + } + out + } + + fn cursor(&self, _cx: &ToolContext, _p: Point, _mods: Mods) -> Cursor { + Cursor::ParametricShape + } + + /// The next shape's numbers (its size and rotation are a double-click's). + fn options(&self) -> Value { + let mut v = to_json(&self.next); + if let Some(o) = v.as_object_mut() { + o.remove("center"); + } + v + } + + fn set_option(&mut self, key: &str, v: &Value) { + if key != "center" + && let Ok(s) = apply(self.next, &json!({ key: v })) + { + self.next = s; + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + use crate::testutil::*; + use vectorcraft_doc::{Appearance, Document, Selection}; + + fn ev(kind: PointerKind, x: f64, y: f64) -> PointerEvent { + PointerEvent::new(kind, x, y) + } + + /// A document with a parametric star about (250, 250), 100 × 100: the document and its id. + fn doc_with_star() -> (Document, NodeId) { + let mut d = Document::new(500.0, 500.0); + let l = d.layers[0].id; + let id = d.alloc_id(); + let s = ParametricShape::new(ShapeKind::Star, Point::new(250.0, 250.0), 100.0, 100.0); + let path = s.path().unwrap(); + let mut n = Node::path(id, path.clone(), Appearance::default_art()); + n.edit_attrs(|a| a.data.push((KEY.into(), stored(&s, &path)))); + d.insert(Some(l), 0, n).unwrap(); + (d, id) + } + + fn preview_of(acts: &[Action]) -> (String, Value) { + match acts.first() { + Some(Action::Preview(c, p)) => (c.clone(), p.clone()), + other => panic!("{other:?}"), + } + } + + #[test] + fn a_drag_from_the_centre_draws_sized_and_turned_and_arrows_change_its_numbers() { + let (d, _) = doc_with_rect(); + let (sel, p) = (Selection::default(), paint()); + let cx = cx(&d, &sel, &p); + let mut t = ParametricShapeTool::default(); + assert_eq!(t.pointer(&cx, &ev(PointerKind::Down, 300.0, 300.0)), vec![Action::Begin(CREATE.into())]); + // 40 pt to the right: 80 across, turned a quarter clockwise. + let acts = t.pointer(&cx, &ev(PointerKind::Drag, 340.0, 300.0)); + let (cmd, p) = preview_of(&acts); + assert_eq!(cmd, "addon.pathtools.shape.create"); + assert_eq!( + (p["kind"].clone(), p["center"].clone(), p["width"].clone(), p["rotation"].clone()), + (json!("polygon"), json!([300.0, 300.0]), json!(80.0), json!(90.0)) + ); + assert!(t.claims_key(&cx, ToolKey::Up) && t.busy()); + // ↑ adds a side, ← takes a point off the corner radius (none left: stays 0), → adds one. + let (_, p) = preview_of(&t.key(&cx, ToolKey::Up, Mods::default())); + assert_eq!(p["count"], json!(7)); + let (_, p) = preview_of(&t.key(&cx, ToolKey::Right, Mods::default())); + assert_eq!(p["radius"], json!(1.0)); + // Shift turns in 45° steps. + let shifted = ev(PointerKind::Drag, 340.0, 290.0).with_mods(Mods { shift: true, ..Mods::default() }); + let (_, p) = preview_of(&t.pointer(&cx, &shifted)); + assert_eq!(p["rotation"], json!(90.0)); + let up = t.pointer(&cx, &ev(PointerKind::Up, 300.0, 250.0)); + assert!( + matches!(up.as_slice(), [Action::Preview(_, p), Action::Commit] if p["rotation"] == json!(0.0) && p["height"] == json!(100.0)), + "{up:?}" + ); + assert!(!t.busy() && !t.claims_key(&cx, ToolKey::Up), "arrows nudge again"); + // The next shape remembers the numbers; a double-click places it. + assert_eq!((t.options()["count"].clone(), t.options()["radius"].clone()), (json!(7), json!(1.0))); + let acts = t.pointer(&cx, &ev(PointerKind::DoubleClick, 50.0, 400.0)); + let [Action::Exec(cmd, p)] = acts.as_slice() else { panic!("{acts:?}") }; + assert_eq!( + (cmd.as_str(), p["center"].clone(), p["count"].clone(), p["height"].clone()), + ("addon.pathtools.shape.create", json!([50.0, 400.0]), json!(7), json!(100.0)) + ); + // A click without a drag draws nothing; Escape drops a drag. + t.pointer(&cx, &ev(PointerKind::Down, 50.0, 50.0)); + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 50.0, 50.0)), vec![Action::Cancel]); + t.pointer(&cx, &ev(PointerKind::Down, 50.0, 50.0)); + assert_eq!(t.key(&cx, ToolKey::Escape, Mods::default()), vec![Action::Cancel]); + assert_eq!(t.cursor(&cx, Point::ZERO, Mods::default()), Cursor::ParametricShape); + } + + #[test] + fn each_kinds_arrow_keys_step_within_range() { + let s = ParametricShape::new(ShapeKind::Star, Point::ZERO, 10.0, 10.0); + assert_eq!(stepped(s, Field::Count, false, 1.0).count, 4); + assert_eq!(stepped(ParametricShape { count: 3, ..s }, Field::Count, false, 1.0).count, 3); + assert_eq!(stepped(ParametricShape { count: MAX_COUNT, ..s }, Field::Count, true, 1.0).count, MAX_COUNT); + assert!((stepped(s, Field::A, true, 1.0).a - 0.5495).abs() < 1e-9); + assert_eq!(stepped(ParametricShape { a: 1.0, ..s }, Field::A, true, 1.0).a, 1.0); + for kind in ShapeKind::ALL { + let (up, side) = arrow_fields(kind); + let s = ParametricShape::new(kind, Point::ZERO, 10.0, 10.0); + for f in [up, side].into_iter().flatten() { + assert_eq!(stepped(s, f, true, 1.0).check(), Ok(()), "{kind:?} {f:?}"); + assert_eq!(stepped(s, f, false, 1.0).check(), Ok(()), "{kind:?} {f:?}"); + } + } + } + + #[test] + fn a_click_selects_a_shape_and_its_handles_drag_into_set() { + let (d, id) = doc_with_star(); + let p = paint(); + let none = Selection::default(); + let mut t = ParametricShapeTool::default(); + let acts = t.pointer(&cx(&d, &none, &p), &ev(PointerKind::Down, 250.0, 250.0)); + assert_eq!(acts, vec![Action::Exec("select.set".into(), json!({ "ids": [id.0] }))]); + assert!(t.overlays(&cx(&d, &none, &p)).is_empty()); + let mut sel = Selection::default(); + sel.set([id]); + let cx = cx(&d, &sel, &p); + let ov = t.overlays(&cx); + assert!(matches!(ov.first(), Some(Overlay::Path { dashed: true, .. })) && ov.len() >= 6, "{ov:?}"); + // The size handle, at the box's lower right corner: 150 × 120 now. + assert_eq!(t.pointer(&cx, &ev(PointerKind::Down, 300.0, 300.0)), vec![Action::Begin(EDIT.into())]); + let (cmd, p) = preview_of(&t.pointer(&cx, &ev(PointerKind::Drag, 325.0, 310.0))); + assert_eq!( + (cmd.as_str(), p["id"].clone(), p["width"].clone(), p["height"].clone()), + ("addon.pathtools.shape.set", json!(id.0), json!(150.0), json!(120.0)) + ); + assert!(matches!(t.pointer(&cx, &ev(PointerKind::Up, 325.0, 310.0)).as_slice(), [Action::Preview(..), Action::Commit])); + // The centre moves it. + t.pointer(&cx, &ev(PointerKind::Down, 251.0, 249.0)); + let (_, p) = preview_of(&t.pointer(&cx, &ev(PointerKind::Drag, 261.0, 229.0))); + assert_eq!(p["center"], json!([260.0, 230.0])); + t.key(&cx, ToolKey::Escape, Mods::default()); + // The rotation handle above the top. + t.pointer(&cx, &ev(PointerKind::Down, 250.0, 200.0 - STEM_PX)); + let (_, p) = preview_of(&t.pointer(&cx, &ev(PointerKind::Drag, 350.0, 250.0))); + assert_eq!(p["rotation"], json!(90.0)); + t.key(&cx, ToolKey::Escape, Mods::default()); + // The star's inner radius, on its first inner corner. + let inner = Point::new(250.0, 250.0) + Vec2::new((36f64).to_radians().sin(), -(36f64).to_radians().cos()) * 25.0; + t.pointer(&cx, &ev(PointerKind::Down, inner.x, inner.y)); + let (_, p) = preview_of(&t.pointer(&cx, &ev(PointerKind::Drag, 250.0, 210.0))); + assert!((p["a"].as_f64().unwrap() - 0.8).abs() < 1e-9, "{p}"); + t.key(&cx, ToolKey::Escape, Mods::default()); + // The corner radius on the top edge. + t.pointer(&cx, &ev(PointerKind::Down, 200.0, 200.0)); + let (_, p) = preview_of(&t.pointer(&cx, &ev(PointerKind::Drag, 212.0, 200.0))); + assert_eq!(p["radius"], json!(12.0)); + // Pressing and letting go of a handle without moving changes nothing. + t.key(&cx, ToolKey::Escape, Mods::default()); + t.pointer(&cx, &ev(PointerKind::Down, 300.0, 300.0)); + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 300.0, 300.0)), vec![Action::Cancel]); + // A double-click on a shape places none. + assert!(t.pointer(&cx, &ev(PointerKind::DoubleClick, 250.0, 250.0)).is_empty()); + } + + #[test] + fn stored_numbers_are_read_back_only_while_the_path_is_the_shape() { + let (mut d, id) = doc_with_star(); + let s = read(d.node(id).unwrap()).unwrap(); + assert_eq!((s.kind, s.center, s.count), (ShapeKind::Star, Point::new(250.0, 250.0), 5)); + // Moved: still the shape, about its new centre. + d.node_mut(id).unwrap().path_data_mut().unwrap().transform(Affine::translate((10.0, 0.0))); + assert_eq!(read(d.node(id).unwrap()).map(|s| s.center), Some(Point::new(260.0, 250.0))); + // An anchor moved: a plain path. + d.node_mut(id).unwrap().path_data_mut().unwrap().anchor_mut(0, 2).unwrap().p.x += 3.0; + assert_eq!(read(d.node(id).unwrap()), None); + // Damaged entries are no shape. + for bad in ["", "{", "[]", r#"{"kind":"blob"}"#, r#"{"kind":"star","count":5000,"fp":"0"}"#, r#"{"kind":"star"}"#] { + let mut n = d.node(id).unwrap().clone(); + n.edit_attrs(|a| a.data = vec![(KEY.into(), bad.into())]); + assert_eq!(read(&n), None, "{bad}"); + } + let plain = Node::path(NodeId(99), PathData::default(), Appearance::default_art()); + assert_eq!(read(&plain), None); + } + + #[test] + fn options_set_the_next_shape_and_refuse_bad_values() { + let mut t = ParametricShapeTool::default(); + t.set_option("kind", &json!("gear")); + t.set_option("count", &json!(20)); + t.set_option("count", &json!(5000)); + t.set_option("a", &json!(0.3)); + t.set_option("width", &json!(-4)); + t.set_option("kind", &json!("cloud")); + let o = t.options(); + assert_eq!((o["kind"].clone(), o["count"].clone(), o["a"].clone(), o["width"].clone()), (json!("gear"), json!(20), json!(0.3), json!(100.0))); + assert!(o.get("center").is_none()); + assert!(apply(t.next, &json!({"center": [1, "x"]})).is_err()); + assert_eq!(apply(t.next, &json!({"rotation": 450})).map(|s| s.rotation), Ok(90.0)); + } +} diff --git a/crates/tools/src/cursor.rs b/crates/tools/src/cursor.rs index f7974e82dc..cba597e95d 100644 --- a/crates/tools/src/cursor.rs +++ b/crates/tools/src/cursor.rs @@ -177,6 +177,9 @@ pub enum Cursor { ExtendPath, /// The Measure & Inspect tool (Path Precision Tools add-on). MeasureInspect, + /// The Parametric Shape Tool (Path Precision Tools add-on): a drag draws a shape out from its + /// centre; a selected shape's handles edit it. + ParametricShape, /// The Smart Pen Tool (Smart Pen add-on) away from paths, where a click starts a new path (over /// a path or while drawing it shows the Pen's and Direct Selection's cursors). SmartPen, @@ -274,6 +277,7 @@ impl Cursor { | Cursor::AnchorEraser | Cursor::ExtendPath | Cursor::MeasureInspect + | Cursor::ParametricShape | Cursor::SmartPen => Cursor::Crosshair, c => c, } @@ -311,7 +315,8 @@ impl Cursor { | Cursor::Scissors | Cursor::AnchorEraser | Cursor::ExtendPath - | Cursor::MeasureInspect => Some(Cursor::Crosshair), + | Cursor::MeasureInspect + | Cursor::ParametricShape => Some(Cursor::Crosshair), Cursor::TypeVertical => Some(Cursor::Text), Cursor::MeshAdd | Cursor::PuppetPin => Some(Cursor::PenAdd), Cursor::SmartPen => Some(Cursor::Pen), diff --git a/crates/tools/src/cursors.toml b/crates/tools/src/cursors.toml index 5304377b31..2dd2a014c4 100644 --- a/crates/tools/src/cursors.toml +++ b/crates/tools/src/cursors.toml @@ -696,6 +696,12 @@ group = "Drawing and editing tools" shown_when = ["The Measure & Inspect tool (Path Precision Tools add-on): drag to measure distance and angle; hover a path to read its lengths, area, curvature and angles."] hotspot = "Exact, because precision matters here (an open centre suits it)." +[[cursor]] +id = "ParametricShape" +group = "Drawing and editing tools" +shown_when = ["The Parametric Shape Tool (Path Precision Tools add-on): a drag draws a re-editable shape out from its centre; a click selects one and shows its handles."] +hotspot = "Exact: the centre of the shape being drawn." + # ── Symbolism tools ─────────────────────────────────────────────────────────────────────────────── # The brush size is drawn by the app as a circle around the cursor. diff --git a/crates/tools/src/settings.rs b/crates/tools/src/settings.rs index 2d13db548a..1c9d13a948 100644 --- a/crates/tools/src/settings.rs +++ b/crates/tools/src/settings.rs @@ -70,6 +70,8 @@ const ROWS: &[Row] = &[ (&[crate::addons::anchor_eraser::ID], None, &["size", "tolerance", "pressure"]), (&[crate::addons::extend_path::ID], None, &["mode"]), (&[crate::addons::smart_pen::ID], None, &["next"]), + // The kind first: a new kind resets the values after it. + (&[crate::addons::parametric_shape::ID], None, &["kind", "count", "a", "b", "radius", "width", "height", "rotation"]), // Flare Tool Options (`extra::FLARE_OPTIONS` and the Rays and Rings checkboxes). ( &["flare"], diff --git a/crates/ui-egui/src/addons/pathtools.rs b/crates/ui-egui/src/addons/pathtools.rs index 0ae31640a6..54df402ede 100644 --- a/crates/ui-egui/src/addons/pathtools.rs +++ b/crates/ui-egui/src/addons/pathtools.rs @@ -1,13 +1,16 @@ //! Path Precision Tools in the interface: its submenu (Object › Plug-ins › Path Precision Tools), -//! which selects its tools, opens the Anchor Inspector and runs Split / Add Points at Crossings; -//! the Anchor Inspector panel (the selected anchor's position and handles as numbers, and the -//! add-on's anchor edits); and its tools' options dialog (a double-click on the tool). Everything -//! acts through `addon.pathtools.*` and `tool.setOption`. +//! which selects its tools, opens its panels and runs Split / Add Points at Crossings and Convert +//! to Parametric Shape; the Anchor Inspector panel (the selected anchor's position and handles as +//! numbers, and the add-on's anchor edits); the Parametric Shape panel ([`shape`]); and its tools' +//! options dialog (a double-click on the tool). Everything acts through `addon.pathtools.*` and +//! `tool.setOption`. + +pub mod shape; use egui::Ui; use serde_json::{Map, Value, json}; use vectorcraft_geom::Point; -use vectorcraft_tools::addons::{anchor_eraser, extend_path, measure_inspect}; +use vectorcraft_tools::addons::{anchor_eraser, extend_path, measure_inspect, parametric_shape}; use crate::VectorcraftApp; use crate::dialogs::DialogSpec; @@ -33,11 +36,14 @@ pub fn menu() -> Vec { tool("Anchor Eraser Brush", anchor_eraser::ID), tool("Extend Path Tool", extend_path::ID), tool("Measure & Inspect Tool", measure_inspect::ID), + tool("Parametric Shape Tool", parametric_shape::ID), Item::Sep, Item::Cmd("Anchor Inspector", "window.panel", json!({ "panel": ID })), + Item::Cmd("Parametric Shape", "window.panel", json!({ "panel": shape::ID })), Item::Sep, Item::Cmd("Add Points at Crossings", "addon.pathtools.crossings", json!({})), Item::Cmd("Split at Crossings", "addon.pathtools.crossings", json!({ "cut": true })), + Item::Cmd("Convert to Parametric Shape", "addon.pathtools.shape.convert", json!({})), ] } diff --git a/crates/ui-egui/src/addons/pathtools/shape.rs b/crates/ui-egui/src/addons/pathtools/shape.rs new file mode 100644 index 0000000000..f29a372934 --- /dev/null +++ b/crates/ui-egui/src/addons/pathtools/shape.rs @@ -0,0 +1,132 @@ +//! The Parametric Shape panel (Path Precision Tools): the selected parametric shape's numbers as +//! fields (kind, count, size, rotation, the kind's own values, corner radius), edited with +//! `addon.pathtools.shape.set`; with no shape selected, the same fields set the Parametric Shape +//! Tool's next shape (`tool.setOption`). Convert turns selected plain shapes into parametric ones. + +use egui::Ui; +use serde_json::{Value, json}; +use vectorcraft_geom::Point; +use vectorcraft_tools::addons::parametric_shape::{self as tool, MAX_COUNT, MAX_SIZE, MIN_COUNT, ParametricShape, ShapeKind, apply, read}; + +use crate::VectorcraftApp; +use crate::panels::empty_state; +use crate::widgets::{self, dim_label}; + +/// The panel's id (`window.panel {panel: "parametricShape"}`). +pub const ID: &str = "parametricShape"; +const LABEL_W: f32 = 96.0; +const FIELD_W: f32 = 72.0; + +/// The kind's name in the interface. +fn kind_label(kind: ShapeKind) -> &'static str { + match kind { + ShapeKind::Rectangle => "Rectangle", + ShapeKind::Ellipse => "Ellipse", + ShapeKind::Polygon => "Polygon", + ShapeKind::Star => "Star", + ShapeKind::Ring => "Ring", + ShapeKind::Arrow => "Arrow", + ShapeKind::Cross => "Cross", + ShapeKind::Heart => "Heart", + ShapeKind::Gear => "Gear", + ShapeKind::Bubble => "Speech Bubble", + } +} + +/// The labels of the kind's own values `a` and `b`. +fn value_labels(kind: ShapeKind) -> [&'static str; 2] { + match kind { + ShapeKind::Star | ShapeKind::Ring => ["Inner Radius:", ""], + ShapeKind::Arrow => ["Head:", "Shaft:"], + ShapeKind::Cross => ["Offset:", "Thickness:"], + ShapeKind::Heart => ["Depth:", "Point:"], + ShapeKind::Gear => ["Tooth Height:", ""], + ShapeKind::Bubble => ["Tail:", "Tip:"], + ShapeKind::Rectangle | ShapeKind::Ellipse | ShapeKind::Polygon => ["", ""], + } +} + +fn run(app: &mut VectorcraftApp, id: &str, p: Value) { + if let Err(e) = app.run(id, p) { + app.status(e); + } +} + +pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { + let Some(st) = app.session.active() else { + empty_state(ui, "hexagon", tl!("No document"), tl!("Open a document to draw parametric shapes.")); + return; + }; + // The selected shape, else the tool's next one. + let selected = match st.selection.objects.as_slice() { + [id] => st.doc.node(*id).and_then(read).map(|s| (*id, s)), + _ => None, + }; + let plain_selected = !st.selection.is_empty() && selected.is_none(); + let fallback = ParametricShape::new(ShapeKind::Polygon, Point::ZERO, 100.0, 100.0); + let s = selected.map(|(_, s)| s).unwrap_or_else(|| apply(fallback, &app.session.tool_options_of(tool::ID)).unwrap_or(fallback)); + let unit = app.session.general_unit(); + if selected.is_none() { + dim_label(ui, tl!("Select a parametric shape to edit it. With none selected, these set the next shape.")); + } + let mut change: Option = None; + let labels = ShapeKind::ALL.map(kind_label); + widgets::label_row(ui, "Shape:", LABEL_W, |ui| { + if let Some(k) = widgets::dropdown(ui, "parametric-shape-kind", kind_label(s.kind), &labels, 150.0).and_then(|i| ShapeKind::ALL.get(i)) { + change = Some(json!({ "kind": k.id() })); + } + }); + if s.kind.counted() { + widgets::label_row(ui, "Count:", LABEL_W, |ui| { + let range = f64::from(MIN_COUNT)..=f64::from(MAX_COUNT); + if let Some(v) = widgets::range_field(ui, "parametric-shape-count", f64::from(s.count), range, "", 0, FIELD_W) { + change = Some(json!({ "count": v })); + } + }); + } + // Width and height side by side, as the Transform panel has them. + egui::Grid::new("parametric-shape-size").num_columns(4).spacing([4.0, 6.0]).min_col_width(0.0).show(ui, |ui| { + for (label, key, v) in [("W:", "width", s.width), ("H:", "height", s.height)] { + dim_label(ui, label); + if let Some(v) = widgets::size_field_named(ui, ("parametric-shape", key), Some(tl!(label)), Some(v), unit, FIELD_W) { + change = Some(json!({ key: v })); + } + } + ui.end_row(); + }); + widgets::label_row(ui, "Rotation:", LABEL_W, |ui| { + if let Some(v) = widgets::mixed_field(ui, "parametric-shape-rotation", Some(s.rotation), "°", 1, FIELD_W) { + change = Some(json!({ "rotation": v })); + } + }); + // The kind's own values, as percentages of their fraction. + for ((key, v), (range, label)) in [("a", s.a), ("b", s.b)].into_iter().zip(s.kind.values().into_iter().zip(value_labels(s.kind))) { + let Some(r) = range else { continue }; + widgets::label_row(ui, label, LABEL_W, |ui| { + if let Some(x) = widgets::range_field(ui, ("parametric-shape", key), v * 100.0, r.min * 100.0..=r.max * 100.0, "%", 0, FIELD_W) { + change = Some(json!({ key: x / 100.0 })); + } + }); + } + if s.kind.rounds() { + widgets::label_row(ui, "Corner Radius:", LABEL_W, |ui| { + if let Some(v) = widgets::size_field(ui, "parametric-shape-radius", Some(s.radius), unit, FIELD_W) { + change = Some(json!({ "radius": v.clamp(0.0, MAX_SIZE) })); + } + }); + } + widgets::divider(ui); + let width = ui.available_width(); + let convert = ui.add_enabled_ui(plain_selected, |ui| widgets::flat_button(ui, tl!("Convert to Parametric Shape"), width).clicked()).inner; + match (change, selected) { + (Some(mut p), Some((id, _))) => { + p["id"] = json!(id.0); + run(app, "addon.pathtools.shape.set", p); + } + (Some(values), None) => run(app, "tool.setOption", json!({ "tool": tool::ID, "values": values })), + (None, _) => {} + } + if convert { + run(app, "addon.pathtools.shape.convert", json!({})); + } +} diff --git a/crates/ui-egui/src/addons/pathtools/tests.rs b/crates/ui-egui/src/addons/pathtools/tests.rs index 4e639d3292..9965773b98 100644 --- a/crates/ui-egui/src/addons/pathtools/tests.rs +++ b/crates/ui-egui/src/addons/pathtools/tests.rs @@ -16,9 +16,12 @@ fn the_plugins_submenu_selects_the_tools_and_opens_the_anchor_inspector() { let mut app = app(); let entries = menus::menu_entries(&app); let under = |label: &str| entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Path Precision Tools"] && e.label == label); - for (label, tool) in - [("Anchor Eraser Brush", "anchorEraserBrush"), ("Extend Path Tool", "extendPath"), ("Measure & Inspect Tool", "measureInspect")] - { + for (label, tool) in [ + ("Anchor Eraser Brush", "anchorEraserBrush"), + ("Extend Path Tool", "extendPath"), + ("Measure & Inspect Tool", "measureInspect"), + ("Parametric Shape Tool", "parametricShape"), + ] { let e = under(label).expect(label); assert_eq!((e.command.as_deref(), &e.params), (Some("tool.select"), &json!({ "tool": tool }))); menus::invoke(&mut app, "tool.select", e.params.clone()); @@ -84,3 +87,29 @@ fn double_clicking_the_brush_opens_its_options_and_ok_sets_them() { assert_eq!(app.session.tool_options_of("extendPath")["mode"], json!("arc")); assert!(app.run("tool.options", json!({"tool": "measureInspect"})).is_err()); } + +#[test] +fn the_parametric_shape_panel_opens_from_the_submenu_and_shows_the_shape() { + let mut app = app(); + let entries = menus::menu_entries(&app); + let under = |label: &str| { + let e = entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Path Precision Tools"] && e.label == label).expect(label); + (e.command.clone(), e.params.clone()) + }; + assert_eq!(under("Convert to Parametric Shape").0.as_deref(), Some("addon.pathtools.shape.convert")); + let (command, params) = under("Parametric Shape"); + assert_eq!(command.as_deref(), Some("window.panel")); + menus::invoke(&mut app, "window.panel", params); + assert!(crate::panel_docking::showing(&app.ui, super::shape::ID), "the panel opens"); + // Nothing selected: the fields set the tool's next shape. + let text = painted_text(&mut app, super::shape::show); + assert!(text.contains("With none selected") && text.contains("Polygon") && text.contains("Count:") && text.contains("Corner Radius:"), "{text}"); + app.run("tool.setOption", json!({"tool": "parametricShape", "values": {"kind": "gear"}})).unwrap(); + let text = painted_text(&mut app, super::shape::show); + assert!(text.contains("Gear") && text.contains("Tooth Height:"), "{text}"); + // A shape selected: its own numbers. + app.run("addon.pathtools.shape.create", json!({"kind": "bubble", "center": [150, 150]})).unwrap(); + let text = painted_text(&mut app, super::shape::show); + assert!(text.contains("Speech Bubble") && text.contains("Tail:") && text.contains("Tip:") && !text.contains("With none selected"), "{text}"); + assert!(!text.contains("Count:"), "a speech bubble has no count: {text}"); +} diff --git a/crates/ui-egui/src/canvas/cursor.rs b/crates/ui-egui/src/canvas/cursor.rs index 84c7bea8f8..535b77fdcb 100644 --- a/crates/ui-egui/src/canvas/cursor.rs +++ b/crates/ui-egui/src/canvas/cursor.rs @@ -151,6 +151,7 @@ pub(super) fn cursor_icon(c: Cursor) -> egui::CursorIcon { | Cursor::AnchorEraser | Cursor::ExtendPath | Cursor::MeasureInspect + | Cursor::ParametricShape | Cursor::SmartPen => cursor_icon(c.stand_in().unwrap_or(Cursor::Crosshair)), } } diff --git a/crates/ui-egui/src/cursors.rs b/crates/ui-egui/src/cursors.rs index df9008210f..530ac8c95c 100644 --- a/crates/ui-egui/src/cursors.rs +++ b/crates/ui-egui/src/cursors.rs @@ -440,7 +440,7 @@ fn magnifier(p: &mut Ink, o: Pos2, out: bool) { /// Every cursor with a glyph: its own, drawn here, or the one it borrows. #[cfg(test)] -const GLYPHS: [Cursor; 85] = [ +const GLYPHS: [Cursor; 86] = [ Cursor::Hand, Cursor::HandGrab, Cursor::ZoomIn, @@ -525,6 +525,7 @@ const GLYPHS: [Cursor; 85] = [ Cursor::AnchorEraser, Cursor::ExtendPath, Cursor::MeasureInspect, + Cursor::ParametricShape, Cursor::SmartPen, ]; diff --git a/crates/ui-egui/src/edit_toolbar/tests.rs b/crates/ui-egui/src/edit_toolbar/tests.rs index d4bc5e25ac..7d547f2407 100644 --- a/crates/ui-egui/src/edit_toolbar/tests.rs +++ b/crates/ui-egui/src/edit_toolbar/tests.rs @@ -379,7 +379,7 @@ fn drop_targets_follow_the_buttons_edges() { fn addon_tools_are_in_the_drawer_not_the_toolbars() { let mut app = app(); let addon: Vec<&str> = vectorcraft_tools::addons::GROUPS.iter().flat_map(|g| g.iter().map(|t| t.id)).collect(); - assert_eq!(addon, ["anchorEraserBrush", "extendPath", "measureInspect", "smartPen"]); + assert_eq!(addon, ["anchorEraserBrush", "extendPath", "measureInspect", "parametricShape", "smartPen"]); for advanced in [false, true] { if advanced { app.run("window.toolbarAdvanced", json!({})).unwrap(); @@ -389,7 +389,7 @@ fn addon_tools_are_in_the_drawer_not_the_toolbars() { let listed = |id: &str| { sections().iter().find(|(_, tools)| tools.iter().any(|t| t.id == id)).map(|(h, tools)| (*h, tools.iter().map(|t| t.id).collect::>())) }; - assert_eq!(listed("extendPath"), Some(("Path Precision Tools", addon[..3].to_vec()))); + assert_eq!(listed("extendPath"), Some(("Path Precision Tools", addon[..4].to_vec()))); assert_eq!(listed("smartPen"), Some(("Smart Pen", vec!["smartPen"]))); for tool in ["extendPath", "smartPen"] { app.run("toolbar.addTool", json!({"tool": tool})).unwrap(); diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index ffdeea74d1..a75e6068a1 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5687,6 +5687,32 @@ anchor Points: Точки: @msg select open paths to close изберете отворени пътища за затваряне @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) пътищата са твърде много или твърде заплетени, за да се намерят пресичанията им (най-много 10000 сегмента) @msg the paths have too many anchors to edit at once пътищата имат твърде много опорни точки, за да се редактират наведнъж +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Инструмент „Параметрична форма“ + Parametric Shape Параметрична форма + Edit Parametric Shape Редактиране на параметрична форма + Convert to Parametric Shape Преобразуване в параметрична форма + Ring Пръстен + Heart Сърце + Gear Зъбно колело + Speech Bubble Балонче за реч + Count: Брой: + Thickness: Дебелина: + Inner Radius: Вътрешен радиус: + Head: Глава: + Shaft: Стъбло: + Point: Връх: + Tooth Height: Височина на зъба: + Tail: Опашка: + Tip: Връх: + Open a document to draw parametric shapes. Отворете документ, за да рисувате параметрични форми. + Select a parametric shape to edit it. With none selected, these set the next shape. Изберете параметрична форма, за да я редактирате. Без избрана форма тези стойности важат за следващата. +@msg the object is not an editable parametric shape обектът не е редактируема параметрична форма +@msg select plain rectangles, ellipses or regular polygons to convert изберете обикновени правоъгълници, елипси или правилни многоъгълници за преобразуване +@msg the shape's numbers are out of range стойностите на формата са извън допустимия обхват +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` трябва да е едно от: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` трябва да е цяло число от 3 до 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` трябва да е от {lo} до {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Интелигентно перо Smart Pen Tool Инструмент „Интелигентно перо“ diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 0cd7e14c36..dfd5d5a2ae 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5788,6 +5788,32 @@ anchor Points: Punts: @msg select open paths to close seleccioneu traçats oberts per tancar-los @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) massa traçats, o massa enredats, per trobar-ne els encreuaments (10000 segments com a màxim) @msg the paths have too many anchors to edit at once els traçats tenen massa punts d’ancoratge per editar-los alhora +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Eina de forma paramètrica + Parametric Shape Forma paramètrica + Edit Parametric Shape Edita la forma paramètrica + Convert to Parametric Shape Converteix en forma paramètrica + Ring Anell + Heart Cor + Gear Engranatge + Speech Bubble Bafarada + Count: Nombre: + Thickness: Gruix: + Inner Radius: Radi interior: + Head: Cap: + Shaft: Tija: + Point: Punta: + Tooth Height: Alçada de la dent: + Tail: Cua: + Tip: Punta: + Open a document to draw parametric shapes. Obriu un document per dibuixar formes paramètriques. + Select a parametric shape to edit it. With none selected, these set the next shape. Seleccioneu una forma paramètrica per editar-la. Sense cap selecció, aquests valors s’apliquen a la forma següent. +@msg the object is not an editable parametric shape l’objecte no és una forma paramètrica editable +@msg select plain rectangles, ellipses or regular polygons to convert seleccioneu rectangles, el·lipses o polígons regulars simples per convertir-los +@msg the shape's numbers are out of range els valors de la forma són fora de l’interval +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` ha de ser un de: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` ha de ser un nombre enter de 3 a 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` ha de ser de {lo} a {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Ploma intel·ligent Smart Pen Tool Eina de ploma intel·ligent diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 4571be3cf1..f4262a357c 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -5797,6 +5797,32 @@ anchor Points: Body: @msg select open paths to close vyberte otevřené cesty k uzavření @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) příliš mnoho nebo příliš spletených cest pro nalezení jejich křížení (nejvýše 10000 segmentů) @msg the paths have too many anchors to edit at once cesty mají příliš mnoho kotevních bodů na úpravu najednou +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Nástroj Parametrický tvar + Parametric Shape Parametrický tvar + Edit Parametric Shape Upravit parametrický tvar + Convert to Parametric Shape Převést na parametrický tvar + Ring Prstenec + Heart Srdce + Gear Ozubené kolo + Speech Bubble Bublina + Count: Počet: + Thickness: Tloušťka: + Inner Radius: Vnitřní poloměr: + Head: Hrot: + Shaft: Dřík: + Point: Špička: + Tooth Height: Výška zubu: + Tail: Ocásek: + Tip: Špička: + Open a document to draw parametric shapes. Otevřete dokument a kreslete parametrické tvary. + Select a parametric shape to edit it. With none selected, these set the next shape. Vyberte parametrický tvar a upravte ho. Bez výběru tyto hodnoty platí pro další tvar. +@msg the object is not an editable parametric shape objekt není upravitelný parametrický tvar +@msg select plain rectangles, ellipses or regular polygons to convert vyberte k převodu obyčejné obdélníky, elipsy nebo pravidelné mnohoúhelníky +@msg the shape's numbers are out of range hodnoty tvaru jsou mimo rozsah +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` musí být jedno z: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` musí být celé číslo od 3 do 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` musí být od {lo} do {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Chytré pero Smart Pen Tool Nástroj Chytré pero diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index e598f8e4f0..381031efa9 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5702,6 +5702,32 @@ anchor Points: Punkter: @msg select open paths to close vælg åbne stier at lukke @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) for mange eller for sammenfiltrede stier til at finde deres krydsninger (højst 10000 segmenter) @msg the paths have too many anchors to edit at once stierne har for mange ankerpunkter til at blive redigeret på én gang +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Parametrisk form-værktøj + Parametric Shape Parametrisk form + Edit Parametric Shape Rediger parametrisk form + Convert to Parametric Shape Konverter til parametrisk form + Ring Ring + Heart Hjerte + Gear Tandhjul + Speech Bubble Taleboble + Count: Antal: + Thickness: Tykkelse: + Inner Radius: Indre radius: + Head: Hoved: + Shaft: Skaft: + Point: Spids: + Tooth Height: Tandhøjde: + Tail: Hale: + Tip: Spids: + Open a document to draw parametric shapes. Åbn et dokument for at tegne parametriske former. + Select a parametric shape to edit it. With none selected, these set the next shape. Vælg en parametrisk form for at redigere den. Uden valg gælder disse værdier for den næste form. +@msg the object is not an editable parametric shape objektet er ikke en redigerbar parametrisk form +@msg select plain rectangles, ellipses or regular polygons to convert vælg almindelige rektangler, ellipser eller regulære polygoner at konvertere +@msg the shape's numbers are out of range formens værdier er uden for området +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` skal være en af: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` skal være et heltal fra 3 til 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` skal være fra {lo} til {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Smart pen Smart Pen Tool Smart pen-værktøj diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index e80b94ec2b..3c24d28251 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -5380,6 +5380,34 @@ anchor Points: Punkte: @msg select open paths to close offene Pfade zum Schließen auswählen @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) zu viele oder zu verschlungene Pfade, um ihre Kreuzungen zu finden (höchstens 10000 Segmente) @msg the paths have too many anchors to edit at once die Pfade haben zu viele Ankerpunkte, um sie auf einmal zu bearbeiten +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Parametrische-Form-Werkzeug + Parametric Shape Parametrische Form + Edit Parametric Shape Parametrische Form bearbeiten + Convert to Parametric Shape In parametrische Form umwandeln + Ring Ring + Arrow Pfeil + Cross Kreuz + Heart Herz + Gear Zahnrad + Speech Bubble Sprechblase + Count: Anzahl: + Thickness: Stärke: + Inner Radius: Innenradius: + Head: Kopf: + Shaft: Schaft: + Point: Spitze: + Tooth Height: Zahnhöhe: + Tail: Zipfel: + Tip: Spitze: + Open a document to draw parametric shapes. Öffnen Sie ein Dokument, um parametrische Formen zu zeichnen. + Select a parametric shape to edit it. With none selected, these set the next shape. Wählen Sie eine parametrische Form aus, um sie zu bearbeiten. Ohne Auswahl gelten diese Werte für die nächste Form. +@msg the object is not an editable parametric shape das Objekt ist keine bearbeitbare parametrische Form +@msg select plain rectangles, ellipses or regular polygons to convert einfache Rechtecke, Ellipsen oder regelmäßige Polygone zum Umwandeln auswählen +@msg the shape's numbers are out of range die Werte der Form liegen außerhalb des zulässigen Bereichs +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` muss eines der folgenden sein: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` muss eine ganze Zahl von 3 bis 1000 sein +@msg `{key}` must be from {lo} to {hi} `{key}` muss zwischen {lo} und {hi} liegen # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Intelligenter Zeichenstift Smart Pen Tool Intelligenter-Zeichenstift-Werkzeug diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 6d772aa3f4..1bd9af4865 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5749,6 +5749,32 @@ anchor Points: Σημεία: @msg select open paths to close επιλέξτε ανοιχτές διαδρομές για κλείσιμο @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) οι διαδρομές είναι πάρα πολλές ή πολύ μπλεγμένες για να βρεθούν οι διασταυρώσεις τους (έως 10000 τμήματα) @msg the paths have too many anchors to edit at once οι διαδρομές έχουν πάρα πολλά σημεία αγκύρωσης για επεξεργασία με μία φορά +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Εργαλείο παραμετρικού σχήματος + Parametric Shape Παραμετρικό σχήμα + Edit Parametric Shape Επεξεργασία παραμετρικού σχήματος + Convert to Parametric Shape Μετατροπή σε παραμετρικό σχήμα + Ring Δακτύλιος + Heart Καρδιά + Gear Γρανάζι + Speech Bubble Συννεφάκι ομιλίας + Count: Πλήθος: + Thickness: Πάχος: + Inner Radius: Εσωτερική ακτίνα: + Head: Κεφαλή: + Shaft: Στέλεχος: + Point: Μύτη: + Tooth Height: Ύψος δοντιού: + Tail: Ουρά: + Tip: Άκρη: + Open a document to draw parametric shapes. Ανοίξτε ένα έγγραφο για να σχεδιάσετε παραμετρικά σχήματα. + Select a parametric shape to edit it. With none selected, these set the next shape. Επιλέξτε ένα παραμετρικό σχήμα για να το επεξεργαστείτε. Χωρίς επιλογή, αυτές οι τιμές ισχύουν για το επόμενο σχήμα. +@msg the object is not an editable parametric shape το αντικείμενο δεν είναι επεξεργάσιμο παραμετρικό σχήμα +@msg select plain rectangles, ellipses or regular polygons to convert επιλέξτε απλά ορθογώνια, ελλείψεις ή κανονικά πολύγωνα για μετατροπή +@msg the shape's numbers are out of range οι τιμές του σχήματος είναι εκτός εύρους +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble Το `kind` πρέπει να είναι ένα από: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 Το `count` πρέπει να είναι ακέραιος από 3 έως 1000 +@msg `{key}` must be from {lo} to {hi} Το `{key}` πρέπει να είναι από {lo} έως {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Έξυπνη πένα Smart Pen Tool Έξυπνη πένα (Smart Pen Tool) diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index bea2064e10..314a86f6ae 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -5740,6 +5740,32 @@ anchor Points: Puntos: @msg select open paths to close seleccione trazados abiertos que cerrar @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) hay demasiados trazados, o están demasiado enredados, para hallar sus cruces (10000 segmentos como máximo) @msg the paths have too many anchors to edit at once los trazados tienen demasiados puntos de ancla para editarlos a la vez +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Herramienta Forma paramétrica + Parametric Shape Forma paramétrica + Edit Parametric Shape Editar forma paramétrica + Convert to Parametric Shape Convertir en forma paramétrica + Ring Anillo + Heart Corazón + Gear Engranaje + Speech Bubble Bocadillo + Count: Cantidad: + Thickness: Grosor: + Inner Radius: Radio interior: + Head: Cabeza: + Shaft: Cuerpo: + Point: Punta: + Tooth Height: Altura del diente: + Tail: Cola: + Tip: Punta: + Open a document to draw parametric shapes. Abra un documento para dibujar formas paramétricas. + Select a parametric shape to edit it. With none selected, these set the next shape. Seleccione una forma paramétrica para editarla. Sin selección, estos valores se aplican a la siguiente forma. +@msg the object is not an editable parametric shape el objeto no es una forma paramétrica editable +@msg select plain rectangles, ellipses or regular polygons to convert seleccione rectángulos, elipses o polígonos regulares simples que convertir +@msg the shape's numbers are out of range los valores de la forma están fuera de rango +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` debe ser uno de: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` debe ser un número entero entre 3 y 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` debe estar entre {lo} y {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Pluma inteligente Smart Pen Tool Herramienta Pluma inteligente diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 70434ed16a..52e389442e 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -5828,6 +5828,32 @@ anchor Points: Pisteet: @msg select open paths to close valitse suljettavat avoimet polut @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) liian monta tai liian sotkuista polkua niiden risteyskohtien löytämiseen (enintään 10000 osaa) @msg the paths have too many anchors to edit at once poluissa on liian monta ankkuripistettä muokattavaksi kerralla +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Parametrinen muoto -työkalu + Parametric Shape Parametrinen muoto + Edit Parametric Shape Muokkaa parametrista muotoa + Convert to Parametric Shape Muunna parametriseksi muodoksi + Ring Rengas + Heart Sydän + Gear Hammaspyörä + Speech Bubble Puhekupla + Count: Määrä: + Thickness: Paksuus: + Inner Radius: Sisäsäde: + Head: Kärki: + Shaft: Varsi: + Point: Kärki: + Tooth Height: Hampaan korkeus: + Tail: Häntä: + Tip: Kärki: + Open a document to draw parametric shapes. Avaa asiakirja piirtääksesi parametrisia muotoja. + Select a parametric shape to edit it. With none selected, these set the next shape. Valitse parametrinen muoto muokataksesi sitä. Ilman valintaa nämä arvot koskevat seuraavaa muotoa. +@msg the object is not an editable parametric shape objekti ei ole muokattava parametrinen muoto +@msg select plain rectangles, ellipses or regular polygons to convert valitse muunnettavat tavalliset suorakulmiot, ellipsit tai säännölliset monikulmiot +@msg the shape's numbers are out of range muodon arvot ovat sallitun alueen ulkopuolella +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` on oltava jokin seuraavista: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` on oltava kokonaisluku 3–1000 +@msg `{key}` must be from {lo} to {hi} `{key}` on oltava {lo}–{hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Älykynä Smart Pen Tool Älykynätyökalu diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index e9c4402de8..90c1fc733b 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -5796,6 +5796,32 @@ anchor Points: Points : @msg select open paths to close sélectionnez des tracés ouverts à fermer @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) trop de tracés, ou trop enchevêtrés, pour trouver leurs croisements (10000 segments au plus) @msg the paths have too many anchors to edit at once les tracés ont trop de points d’ancrage pour être modifiés en une fois +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Outil Forme paramétrique + Parametric Shape Forme paramétrique + Edit Parametric Shape Modifier la forme paramétrique + Convert to Parametric Shape Convertir en forme paramétrique + Ring Anneau + Heart Cœur + Gear Engrenage + Speech Bubble Bulle de dialogue + Count: Nombre : + Thickness: Épaisseur : + Inner Radius: Rayon intérieur : + Head: Tête : + Shaft: Corps : + Point: Pointe : + Tooth Height: Hauteur des dents : + Tail: Queue : + Tip: Pointe : + Open a document to draw parametric shapes. Ouvrez un document pour dessiner des formes paramétriques. + Select a parametric shape to edit it. With none selected, these set the next shape. Sélectionnez une forme paramétrique pour la modifier. Sans sélection, ces valeurs s’appliquent à la forme suivante. +@msg the object is not an editable parametric shape l’objet n’est pas une forme paramétrique modifiable +@msg select plain rectangles, ellipses or regular polygons to convert sélectionnez des rectangles, ellipses ou polygones réguliers simples à convertir +@msg the shape's numbers are out of range les valeurs de la forme sont hors limites +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` doit être l’un de : rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` doit être un nombre entier compris entre 3 et 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` doit être compris entre {lo} et {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Plume intelligente Smart Pen Tool Outil Plume intelligente diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index ce60c5f9c4..a9fce7ddbd 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5784,6 +5784,32 @@ anchor Points: Pontok: @msg select open paths to close jelöljön ki lezárandó nyitott útvonalakat @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) túl sok vagy túl összegabalyodott útvonal a kereszteződések megtalálásához (legfeljebb 10000 szakasz) @msg the paths have too many anchors to edit at once az útvonalaknak túl sok horgonypontjuk van az egyszerre szerkesztéshez +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Paraméteres alakzat eszköz + Parametric Shape Paraméteres alakzat + Edit Parametric Shape Paraméteres alakzat szerkesztése + Convert to Parametric Shape Átalakítás paraméteres alakzattá + Ring Gyűrű + Heart Szív + Gear Fogaskerék + Speech Bubble Szövegbuborék + Count: Darabszám: + Thickness: Vastagság: + Inner Radius: Belső sugár: + Head: Fej: + Shaft: Szár: + Point: Csúcs: + Tooth Height: Fogmagasság: + Tail: Csóva: + Tip: Csúcs: + Open a document to draw parametric shapes. Nyisson meg egy dokumentumot paraméteres alakzatok rajzolásához. + Select a parametric shape to edit it. With none selected, these set the next shape. A szerkesztéshez jelöljön ki egy paraméteres alakzatot. Kijelölés nélkül ezek az értékek a következő alakzatra vonatkoznak. +@msg the object is not an editable parametric shape az objektum nem szerkeszthető paraméteres alakzat +@msg select plain rectangles, ellipses or regular polygons to convert jelöljön ki átalakítandó egyszerű téglalapokat, ellipsziseket vagy szabályos sokszögeket +@msg the shape's numbers are out of range az alakzat értékei a megengedett tartományon kívül esnek +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind`: ezek egyike kell: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count`: 3 és 1000 közötti egész szám kell +@msg `{key}` must be from {lo} to {hi} `{key}`: {lo} és {hi} között kell # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Okostoll Smart Pen Tool Okostoll eszköz diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 2906770ee4..fc6f7bef60 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5702,6 +5702,32 @@ anchor Points: Titik: @msg select open paths to close pilih jalur terbuka untuk ditutup @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) jalur terlalu banyak atau terlalu kusut untuk menemukan persilangannya (paling banyak 10000 segmen) @msg the paths have too many anchors to edit at once jalur memiliki terlalu banyak titik jangkar untuk disunting sekaligus +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Alat bentuk parametrik + Parametric Shape Bentuk parametrik + Edit Parametric Shape Sunting bentuk parametrik + Convert to Parametric Shape Ubah menjadi bentuk parametrik + Ring Cincin + Heart Hati + Gear Roda gigi + Speech Bubble Balon ucapan + Count: Jumlah: + Thickness: Ketebalan: + Inner Radius: Jari-jari dalam: + Head: Kepala: + Shaft: Batang: + Point: Ujung: + Tooth Height: Tinggi gigi: + Tail: Ekor: + Tip: Ujung: + Open a document to draw parametric shapes. Buka dokumen untuk menggambar bentuk parametrik. + Select a parametric shape to edit it. With none selected, these set the next shape. Pilih bentuk parametrik untuk menyuntingnya. Tanpa pilihan, nilai ini berlaku untuk bentuk berikutnya. +@msg the object is not an editable parametric shape objek bukan bentuk parametrik yang dapat disunting +@msg select plain rectangles, ellipses or regular polygons to convert pilih persegi panjang, elips, atau poligon beraturan biasa untuk diubah +@msg the shape's numbers are out of range nilai bentuk berada di luar rentang +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` harus salah satu dari: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` harus bilangan bulat dari 3 sampai 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` harus antara {lo} dan {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Pena pintar Smart Pen Tool Alat pena pintar diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 94e8f38d6e..d13f802951 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -5414,6 +5414,34 @@ anchor Points: Punti: @msg select open paths to close seleziona tracciati aperti da chiudere @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) tracciati troppi o troppo intricati per trovarne gli incroci (al massimo 10000 segmenti) @msg the paths have too many anchors to edit at once i tracciati hanno troppi punti di ancoraggio da modificare in una volta +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Strumento Forma parametrica + Parametric Shape Forma parametrica + Edit Parametric Shape Modifica forma parametrica + Convert to Parametric Shape Converti in forma parametrica + Ring Anello + Arrow Freccia + Cross Croce + Heart Cuore + Gear Ingranaggio + Speech Bubble Fumetto + Count: Numero: + Thickness: Spessore: + Inner Radius: Raggio interno: + Head: Testa: + Shaft: Asta: + Point: Punta: + Tooth Height: Altezza denti: + Tail: Coda: + Tip: Punta: + Open a document to draw parametric shapes. Apri un documento per disegnare forme parametriche. + Select a parametric shape to edit it. With none selected, these set the next shape. Seleziona una forma parametrica per modificarla. Senza selezione, questi valori valgono per la forma successiva. +@msg the object is not an editable parametric shape l’oggetto non è una forma parametrica modificabile +@msg select plain rectangles, ellipses or regular polygons to convert seleziona rettangoli, ellissi o poligoni regolari semplici da convertire +@msg the shape's numbers are out of range i valori della forma sono fuori intervallo +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` deve essere uno tra: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` deve essere un numero intero compreso tra 3 e 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` deve essere compreso tra {lo} e {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Penna intelligente Smart Pen Tool Strumento Penna intelligente diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index eeb1837c35..831a6ab674 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -5483,6 +5483,34 @@ anchor Points: ポイント: @msg select open paths to close 閉じるオープンパスを選択してください @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) パスが多すぎるか複雑すぎて交差点を見つけられません(最大 10000 セグメント) @msg the paths have too many anchors to edit at once パスのアンカーポイントが多すぎて一度に編集できません +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool パラメトリックシェイプツール + Parametric Shape パラメトリックシェイプ + Edit Parametric Shape パラメトリックシェイプを編集 + Convert to Parametric Shape パラメトリックシェイプに変換 + Ring リング + Arrow 矢印 + Cross 十字 + Heart ハート + Gear 歯車 + Speech Bubble 吹き出し + Count: 数: + Thickness: 太さ: + Inner Radius: 内側の半径: + Head: 矢じり: + Shaft: 軸: + Point: 先端: + Tooth Height: 歯の高さ: + Tail: しっぽ: + Tip: 先端: + Open a document to draw parametric shapes. パラメトリックシェイプを描くにはドキュメントを開いてください。 + Select a parametric shape to edit it. With none selected, these set the next shape. 編集するパラメトリックシェイプを選択してください。選択がないときは、次に描くシェイプの値になります。 +@msg the object is not an editable parametric shape オブジェクトは編集可能なパラメトリックシェイプではありません +@msg select plain rectangles, ellipses or regular polygons to convert 変換する通常の長方形、楕円または正多角形を選択してください +@msg the shape's numbers are out of range シェイプの値が範囲外です +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` には次のいずれかを指定してください:rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` には 3 から 1000 の整数を指定してください +@msg `{key}` must be from {lo} to {hi} `{key}` には {lo} から {hi} を指定してください # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen スマートペン Smart Pen Tool スマートペンツール diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 1d4e52cb1e..29a0bd9749 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5787,6 +5787,32 @@ anchor Points: წერტილები: @msg select open paths to close მონიშნეთ შესაკრავი ღია ტრაექტორიები @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) ტრაექტორიები ზედმეტად ბევრი ან ჩახლართულია გადაკვეთების საპოვნელად (მაქსიმუმ 10000 სეგმენტი) @msg the paths have too many anchors to edit at once ტრაექტორიებს ზედმეტად ბევრი საყრდენი წერტილი აქვს ერთბაშად დასარედაქტირებლად +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool პარამეტრული ფიგურის ხელსაწყო + Parametric Shape პარამეტრული ფიგურა + Edit Parametric Shape პარამეტრული ფიგურის რედაქტირება + Convert to Parametric Shape პარამეტრულ ფიგურად გარდაქმნა + Ring რგოლი + Heart გული + Gear კბილანა + Speech Bubble ტექსტის ბუშტი + Count: რაოდენობა: + Thickness: სისქე: + Inner Radius: შიდა რადიუსი: + Head: თავი: + Shaft: ღერო: + Point: წვერი: + Tooth Height: კბილის სიმაღლე: + Tail: კუდი: + Tip: წვერი: + Open a document to draw parametric shapes. გახსენით დოკუმენტი პარამეტრული ფიგურების დასახატად. + Select a parametric shape to edit it. With none selected, these set the next shape. მონიშნეთ პარამეტრული ფიგურა მის დასარედაქტირებლად. მონიშვნის გარეშე ეს მნიშვნელობები შემდეგ ფიგურას ეხება. +@msg the object is not an editable parametric shape ობიექტი არ არის რედაქტირებადი პარამეტრული ფიგურა +@msg select plain rectangles, ellipses or regular polygons to convert მონიშნეთ გარდასაქმნელი ჩვეულებრივი მართკუთხედები, ელიფსები ან წესიერი მრავალკუთხედები +@msg the shape's numbers are out of range ფიგურის მნიშვნელობები დასაშვებ დიაპაზონს სცდება +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` უნდა იყოს ერთ-ერთი: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` უნდა იყოს მთელი რიცხვი 3-დან 1000-მდე +@msg `{key}` must be from {lo} to {hi} `{key}` უნდა იყოს {lo}-დან {hi}-მდე # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen ჭკვიანი კალამი Smart Pen Tool ჭკვიანი კალმის ხელსაწყო diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 56a27979d1..b5a1958faf 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5377,6 +5377,34 @@ anchor Points: 포인트: @msg select open paths to close 닫을 열린 패스를 선택하세요 @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) 패스가 너무 많거나 너무 얽혀 교차점을 찾을 수 없습니다(최대 10000개 세그먼트) @msg the paths have too many anchors to edit at once 패스의 앵커 포인트가 너무 많아 한 번에 편집할 수 없습니다 +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool 파라메트릭 모양 도구 + Parametric Shape 파라메트릭 모양 + Edit Parametric Shape 파라메트릭 모양 편집 + Convert to Parametric Shape 파라메트릭 모양으로 변환 + Ring 고리 + Arrow 화살표 + Cross 십자 + Heart 하트 + Gear 톱니바퀴 + Speech Bubble 말풍선 + Count: 개수: + Thickness: 두께: + Inner Radius: 안쪽 반지름: + Head: 머리: + Shaft: 몸통: + Point: 끝: + Tooth Height: 톱니 높이: + Tail: 꼬리: + Tip: 끝: + Open a document to draw parametric shapes. 파라메트릭 모양을 그리려면 문서를 여세요. + Select a parametric shape to edit it. With none selected, these set the next shape. 편집할 파라메트릭 모양을 선택하세요. 선택하지 않으면 이 값은 다음 모양에 적용됩니다. +@msg the object is not an editable parametric shape 개체가 편집 가능한 파라메트릭 모양이 아닙니다 +@msg select plain rectangles, ellipses or regular polygons to convert 변환할 일반 사각형, 타원 또는 정다각형을 선택하세요 +@msg the shape's numbers are out of range 모양의 값이 범위를 벗어났습니다 +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind`은(는) 다음 중 하나여야 합니다: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count`는 3에서 1000 사이의 정수여야 합니다 +@msg `{key}` must be from {lo} to {hi} `{key}`은(는) {lo}에서 {hi} 사이여야 합니다 # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen 스마트 펜 Smart Pen Tool 스마트 펜 도구 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index cbe1e0a6f0..de6dcd584b 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5746,6 +5746,32 @@ anchor Points: Punten: @msg select open paths to close selecteer open paden om te sluiten @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) te veel of te verwarde paden om hun kruisingen te vinden (hoogstens 10000 segmenten) @msg the paths have too many anchors to edit at once de paden hebben te veel ankerpunten om in één keer te bewerken +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Parametrische vorm-gereedschap + Parametric Shape Parametrische vorm + Edit Parametric Shape Parametrische vorm bewerken + Convert to Parametric Shape Omzetten in parametrische vorm + Ring Ring + Heart Hart + Gear Tandwiel + Speech Bubble Tekstballon + Count: Aantal: + Thickness: Dikte: + Inner Radius: Binnenstraal: + Head: Kop: + Shaft: Schacht: + Point: Punt: + Tooth Height: Tandhoogte: + Tail: Staart: + Tip: Punt: + Open a document to draw parametric shapes. Open een document om parametrische vormen te tekenen. + Select a parametric shape to edit it. With none selected, these set the next shape. Selecteer een parametrische vorm om die te bewerken. Zonder selectie gelden deze waarden voor de volgende vorm. +@msg the object is not an editable parametric shape het object is geen bewerkbare parametrische vorm +@msg select plain rectangles, ellipses or regular polygons to convert selecteer gewone rechthoeken, ellipsen of regelmatige polygonen om om te zetten +@msg the shape's numbers are out of range de waarden van de vorm liggen buiten het bereik +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` moet een van deze zijn: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` moet een geheel getal van 3 tot 1000 zijn +@msg `{key}` must be from {lo} to {hi} `{key}` moet tussen {lo} en {hi} liggen # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Slimme pen Smart Pen Tool Slimme pen-gereedschap diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 59cd718f8e..2bd746e1d2 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -5652,6 +5652,32 @@ anchor Points: Punkty: @msg select open paths to close zaznacz otwarte ścieżki do zamknięcia @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) za dużo ścieżek lub są zbyt splątane, by znaleźć ich skrzyżowania (najwyżej 10000 segmentów) @msg the paths have too many anchors to edit at once ścieżki mają za dużo punktów kontrolnych, by edytować je naraz +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Narzędzie Kształt parametryczny + Parametric Shape Kształt parametryczny + Edit Parametric Shape Edytuj kształt parametryczny + Convert to Parametric Shape Konwertuj na kształt parametryczny + Ring Pierścień + Heart Serce + Gear Koło zębate + Speech Bubble Dymek + Count: Liczba: + Thickness: Grubość: + Inner Radius: Promień wewnętrzny: + Head: Grot: + Shaft: Trzon: + Point: Czubek: + Tooth Height: Wysokość zęba: + Tail: Ogonek: + Tip: Czubek: + Open a document to draw parametric shapes. Otwórz dokument, aby rysować kształty parametryczne. + Select a parametric shape to edit it. With none selected, these set the next shape. Zaznacz kształt parametryczny, aby go edytować. Bez zaznaczenia te wartości dotyczą następnego kształtu. +@msg the object is not an editable parametric shape obiekt nie jest edytowalnym kształtem parametrycznym +@msg select plain rectangles, ellipses or regular polygons to convert zaznacz zwykłe prostokąty, elipsy lub wielokąty foremne do konwersji +@msg the shape's numbers are out of range wartości kształtu są poza zakresem +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` musi mieć jedną z wartości: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` musi być liczbą całkowitą od 3 do 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` musi mieć wartość od {lo} do {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Inteligentne pióro Smart Pen Tool Narzędzie Inteligentne pióro diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index d7f8362faf..2e4aed474b 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -5715,6 +5715,32 @@ anchor Points: Pontos: @msg select open paths to close selecione caminhos abertos para fechar @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) caminhos demais, ou emaranhados demais, para encontrar seus cruzamentos (no máximo 10000 segmentos) @msg the paths have too many anchors to edit at once os caminhos têm pontos de ancoragem demais para editar de uma vez +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Ferramenta Forma Paramétrica + Parametric Shape Forma Paramétrica + Edit Parametric Shape Editar Forma Paramétrica + Convert to Parametric Shape Converter em Forma Paramétrica + Ring Anel + Heart Coração + Gear Engrenagem + Speech Bubble Balão de Fala + Count: Quantidade: + Thickness: Espessura: + Inner Radius: Raio Interno: + Head: Ponta: + Shaft: Haste: + Point: Bico: + Tooth Height: Altura do Dente: + Tail: Rabicho: + Tip: Ponta: + Open a document to draw parametric shapes. Abra um documento para desenhar formas paramétricas. + Select a parametric shape to edit it. With none selected, these set the next shape. Selecione uma forma paramétrica para editá-la. Sem seleção, estes valores valem para a próxima forma. +@msg the object is not an editable parametric shape o objeto não é uma forma paramétrica editável +@msg select plain rectangles, ellipses or regular polygons to convert selecione retângulos, elipses ou polígonos regulares simples para converter +@msg the shape's numbers are out of range os valores da forma estão fora do intervalo +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` deve ser um destes: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` deve ser um número inteiro de 3 a 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` deve estar entre {lo} e {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Caneta Inteligente Smart Pen Tool Ferramenta Caneta Inteligente diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index b467f6d9a4..2583931c4e 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -5775,6 +5775,32 @@ anchor Points: Точки: @msg select open paths to close выделите незамкнутые контуры, чтобы замкнуть их @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) контуров слишком много или они слишком запутаны, чтобы найти их пересечения (не более 10000 сегментов) @msg the paths have too many anchors to edit at once у контуров слишком много опорных точек, чтобы править их за раз +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Инструмент «Параметрическая фигура» + Parametric Shape Параметрическая фигура + Edit Parametric Shape Изменить параметрическую фигуру + Convert to Parametric Shape Преобразовать в параметрическую фигуру + Ring Кольцо + Heart Сердце + Gear Шестерёнка + Speech Bubble Речевой пузырь + Count: Количество: + Thickness: Толщина: + Inner Radius: Внутренний радиус: + Head: Наконечник: + Shaft: Древко: + Point: Острие: + Tooth Height: Высота зуба: + Tail: Хвостик: + Tip: Кончик: + Open a document to draw parametric shapes. Откройте документ, чтобы рисовать параметрические фигуры. + Select a parametric shape to edit it. With none selected, these set the next shape. Выделите параметрическую фигуру, чтобы править её. Без выделения эти значения применяются к следующей фигуре. +@msg the object is not an editable parametric shape объект не является редактируемой параметрической фигурой +@msg select plain rectangles, ellipses or regular polygons to convert выделите обычные прямоугольники, эллипсы или правильные многоугольники для преобразования +@msg the shape's numbers are out of range значения фигуры вне допустимого диапазона +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` должно быть одним из: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` должно быть целым числом от 3 до 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` должно быть от {lo} до {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Умное перо Smart Pen Tool Инструмент «Умное перо» diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index f4284b66e7..2c33ce33fd 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5821,6 +5821,32 @@ anchor Points: Punkter: @msg select open paths to close markera öppna banor att stänga @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) för många eller för trassliga banor för att hitta deras korsningar (högst 10000 segment) @msg the paths have too many anchors to edit at once banorna har för många ankarpunkter för att redigeras på en gång +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Parametrisk form-verktyget + Parametric Shape Parametrisk form + Edit Parametric Shape Redigera parametrisk form + Convert to Parametric Shape Konvertera till parametrisk form + Ring Ring + Heart Hjärta + Gear Kugghjul + Speech Bubble Pratbubbla + Count: Antal: + Thickness: Tjocklek: + Inner Radius: Inre radie: + Head: Huvud: + Shaft: Skaft: + Point: Spets: + Tooth Height: Tandhöjd: + Tail: Svans: + Tip: Spets: + Open a document to draw parametric shapes. Öppna ett dokument för att rita parametriska former. + Select a parametric shape to edit it. With none selected, these set the next shape. Markera en parametrisk form för att redigera den. Utan markering gäller värdena nästa form. +@msg the object is not an editable parametric shape objektet är inte en redigerbar parametrisk form +@msg select plain rectangles, ellipses or regular polygons to convert markera vanliga rektanglar, ellipser eller regelbundna polygoner att konvertera +@msg the shape's numbers are out of range formens värden ligger utanför intervallet +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` måste vara något av: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` måste vara ett heltal från 3 till 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` måste vara från {lo} till {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Smart penna Smart Pen Tool Smart penna-verktyget diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 49e85624e9..82c531a051 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5755,6 +5755,32 @@ anchor Points: Noktalar: @msg select open paths to close kapatılacak açık yolları seçin @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) kesişimlerini bulmak için yollar çok fazla veya çok karışık (en fazla 10000 bölüm) @msg the paths have too many anchors to edit at once yolların aynı anda düzenlenemeyecek kadar çok bağlantı noktası var +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Parametrik Şekil Aracı + Parametric Shape Parametrik Şekil + Edit Parametric Shape Parametrik Şekli Düzenle + Convert to Parametric Shape Parametrik Şekle Dönüştür + Ring Halka + Heart Kalp + Gear Dişli + Speech Bubble Konuşma Balonu + Count: Sayı: + Thickness: Kalınlık: + Inner Radius: İç Yarıçap: + Head: Uç: + Shaft: Gövde: + Point: Sivri Uç: + Tooth Height: Diş Yüksekliği: + Tail: Kuyruk: + Tip: Uç: + Open a document to draw parametric shapes. Parametrik şekiller çizmek için bir belge açın. + Select a parametric shape to edit it. With none selected, these set the next shape. Düzenlemek için bir parametrik şekil seçin. Seçim yokken bu değerler bir sonraki şekle uygulanır. +@msg the object is not an editable parametric shape nesne düzenlenebilir bir parametrik şekil değil +@msg select plain rectangles, ellipses or regular polygons to convert dönüştürülecek düz dikdörtgenleri, elipsleri veya düzgün çokgenleri seçin +@msg the shape's numbers are out of range şeklin değerleri aralığın dışında +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` şunlardan biri olmalıdır: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` 3 ile 1000 arasında bir tam sayı olmalıdır +@msg `{key}` must be from {lo} to {hi} `{key}` {lo} ile {hi} arasında olmalıdır # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Akıllı Kalem Smart Pen Tool Akıllı Kalem Aracı diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 5f57c26085..b83c2bc944 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -5394,6 +5394,34 @@ anchor Points: Точки: @msg select open paths to close виділіть незамкнені контури, щоб замкнути їх @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) контурів забагато або вони надто заплутані, щоб знайти їхні перетини (не більше 10000 сегментів) @msg the paths have too many anchors to edit at once у контурів забагато опорних точок, щоб редагувати їх за раз +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Інструмент «Параметрична фігура» + Parametric Shape Параметрична фігура + Edit Parametric Shape Редагувати параметричну фігуру + Convert to Parametric Shape Перетворити на параметричну фігуру + Ring Кільце + Arrow Стрілка + Cross Хрест + Heart Серце + Gear Зубчасте колесо + Speech Bubble Мовна бульбашка + Count: Кількість: + Thickness: Товщина: + Inner Radius: Внутрішній радіус: + Head: Наконечник: + Shaft: Держак: + Point: Вістря: + Tooth Height: Висота зуба: + Tail: Хвостик: + Tip: Кінчик: + Open a document to draw parametric shapes. Відкрийте документ, щоб малювати параметричні фігури. + Select a parametric shape to edit it. With none selected, these set the next shape. Виділіть параметричну фігуру, щоб редагувати її. Без виділення ці значення стосуються наступної фігури. +@msg the object is not an editable parametric shape об’єкт не є редагованою параметричною фігурою +@msg select plain rectangles, ellipses or regular polygons to convert виділіть звичайні прямокутники, еліпси або правильні багатокутники для перетворення +@msg the shape's numbers are out of range значення фігури поза допустимим діапазоном +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` має бути одним із: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` має бути цілим числом від 3 до 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` має бути від {lo} до {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Розумне перо Smart Pen Tool Інструмент «Розумне перо» diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 9beeea182c..533d6996d8 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5396,6 +5396,34 @@ anchor Points: Điểm: @msg select open paths to close chọn các đường dẫn mở để đóng @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) quá nhiều đường dẫn hoặc chúng quá rối để tìm chỗ giao nhau (tối đa 10000 đoạn) @msg the paths have too many anchors to edit at once các đường dẫn có quá nhiều điểm neo để sửa cùng lúc +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool Công cụ Hình tham số + Parametric Shape Hình tham số + Edit Parametric Shape Sửa hình tham số + Convert to Parametric Shape Chuyển thành hình tham số + Ring Vành khuyên + Arrow Mũi tên + Cross Chữ thập + Heart Trái tim + Gear Bánh răng + Speech Bubble Bong bóng thoại + Count: Số lượng: + Thickness: Độ dày: + Inner Radius: Bán kính trong: + Head: Đầu: + Shaft: Thân: + Point: Mũi: + Tooth Height: Chiều cao răng: + Tail: Đuôi: + Tip: Chóp: + Open a document to draw parametric shapes. Mở một tài liệu để vẽ hình tham số. + Select a parametric shape to edit it. With none selected, these set the next shape. Chọn một hình tham số để sửa nó. Khi không chọn gì, các giá trị này dùng cho hình tiếp theo. +@msg the object is not an editable parametric shape đối tượng không phải hình tham số có thể sửa +@msg select plain rectangles, ellipses or regular polygons to convert chọn các hình chữ nhật, hình elip hoặc đa giác đều thông thường để chuyển đổi +@msg the shape's numbers are out of range các giá trị của hình nằm ngoài phạm vi +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` phải là một trong: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` phải là số nguyên từ 3 đến 1000 +@msg `{key}` must be from {lo} to {hi} `{key}` phải từ {lo} đến {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen Bút thông minh Smart Pen Tool Công cụ Bút thông minh diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index bbb8cdb647..88e4d4c998 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -5637,6 +5637,34 @@ anchor Points: 点: @msg select open paths to close 请选择要闭合的开放路径 @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) 路径太多或太复杂,无法找到交叉处(最多 10000 段) @msg the paths have too many anchors to edit at once 路径的锚点太多,无法一次编辑 +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool 参数化形状工具 + Parametric Shape 参数化形状 + Edit Parametric Shape 编辑参数化形状 + Convert to Parametric Shape 转换为参数化形状 + Ring 圆环 + Arrow 箭头 + Cross 十字 + Heart 心形 + Gear 齿轮 + Speech Bubble 对话气泡 + Count: 数量: + Thickness: 粗细: + Inner Radius: 内半径: + Head: 箭头头部: + Shaft: 箭杆: + Point: 尖端: + Tooth Height: 齿高: + Tail: 尾巴: + Tip: 尖端: + Open a document to draw parametric shapes. 打开文档以绘制参数化形状。 + Select a parametric shape to edit it. With none selected, these set the next shape. 选择一个参数化形状以编辑它。未选择时,这些值用于下一个形状。 +@msg the object is not an editable parametric shape 该对象不是可编辑的参数化形状 +@msg select plain rectangles, ellipses or regular polygons to convert 请选择要转换的普通矩形、椭圆或正多边形 +@msg the shape's numbers are out of range 形状的数值超出范围 +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` 必须是以下之一:rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` 必须是 3 到 1000 之间的整数 +@msg `{key}` must be from {lo} to {hi} `{key}` 必须在 {lo} 到 {hi} 之间 # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen 智能钢笔 Smart Pen Tool 智能钢笔工具 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index acabf699d0..2c42fbd63c 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -5433,6 +5433,34 @@ anchor Points: 點: @msg select open paths to close 請選取要封閉的開放路徑 @msg the paths are too many or too tangled to find where they cross (at most 10000 segments) 路徑太多或太複雜,無法找到交叉處(最多 10000 段) @msg the paths have too many anchors to edit at once 路徑的錨點太多,無法一次編輯 +# Path Precision Tools add-on: the Parametric Shape Tool, its panel, commands and messages. + Parametric Shape Tool 參數化形狀工具 + Parametric Shape 參數化形狀 + Edit Parametric Shape 編輯參數化形狀 + Convert to Parametric Shape 轉換為參數化形狀 + Ring 圓環 + Arrow 箭頭 + Cross 十字 + Heart 心形 + Gear 齒輪 + Speech Bubble 對話氣泡 + Count: 數量: + Thickness: 粗細: + Inner Radius: 內半徑: + Head: 箭頭頭部: + Shaft: 箭桿: + Point: 尖端: + Tooth Height: 齒高: + Tail: 尾巴: + Tip: 尖端: + Open a document to draw parametric shapes. 開啟文件以繪製參數化形狀。 + Select a parametric shape to edit it. With none selected, these set the next shape. 選取一個參數化形狀以編輯它。未選取時,這些值用於下一個形狀。 +@msg the object is not an editable parametric shape 該物件不是可編輯的參數化形狀 +@msg select plain rectangles, ellipses or regular polygons to convert 請選取要轉換的一般矩形、橢圓或正多邊形 +@msg the shape's numbers are out of range 形狀的數值超出範圍 +@msg `kind` must be one of: rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble `kind` 必須是下列其中之一:rectangle, ellipse, polygon, star, ring, arrow, cross, heart, gear, bubble +@msg `count` must be a whole number from 3 to 1000 `count` 必須是介於 3 到 1000 的整數 +@msg `{key}` must be from {lo} to {hi} `{key}` 必須介於 {lo} 到 {hi} # Smart Pen add-on (Object › Plug-ins › Smart Pen): its tool, panel, commands and messages. Smart Pen 智慧筆型 Smart Pen Tool 智慧筆型工具 diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 513a1bcae1..494360e74b 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -182,6 +182,7 @@ pub fn show_icon_panel(app: &mut VectorcraftApp, ui: &mut Ui, id: &str) { crate::addons::cleanup::ID => crate::addons::cleanup::show(app, ui), crate::addons::color::ID => crate::addons::color::show(app, ui), crate::addons::pathtools::ID => crate::addons::pathtools::show(app, ui), + crate::addons::pathtools::shape::ID => crate::addons::pathtools::shape::show(app, ui), crate::addons::pen::ID => crate::addons::pen::show(app, ui), id if library_panel::parse(id).is_some() => library_panel::show(app, ui, id), _ => { diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index c3e856ba42..0409a78c76 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -200,6 +200,7 @@ pub const ICON_PANELS: &[(&str, &str, &str)] = &[ (crate::addons::cleanup::ID, "Artwork Cleanup", "sparkles"), (crate::addons::color::ID, "Color Effects", "sun"), (crate::addons::pathtools::ID, "Anchor Inspector", "dc-anchor-smooth"), + (crate::addons::pathtools::shape::ID, "Parametric Shape", "hexagon"), (crate::addons::pen::ID, "Smart Pen", "spline-pointer"), ]; diff --git a/docs/mcp.md b/docs/mcp.md index e5324f110c..e3e7f8b1a2 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5716,9 +5716,10 @@ topmost piece. Path Precision Tools is a built-in add-on for exact anchor and path work: its commands are `addon.pathtools.*`, and in the desktop app it lives in Object › Plug-ins › Path Precision Tools, in its Anchor Inspector panel -(`window.panel {panel: "anchorInspector"}`) and in three tools that the toolbars don't show until they are added from the -All Tools drawer (or chosen with `tool.select`): `anchorEraserBrush`, `extendPath` and `measureInspect`. Each edit is one -undo step, and an edit that changes nothing makes no step. +(`window.panel {panel: "anchorInspector"}`), in its Parametric Shape panel (`window.panel {panel: "parametricShape"}`) +and in four tools that the toolbars don't show until they are added from the All Tools drawer (or chosen with +`tool.select`): `anchorEraserBrush`, `extendPath`, `measureInspect` and `parametricShape`. None has a shortcut. Each edit +is one undo step, and an edit that changes nothing makes no step. Tools: @@ -5732,6 +5733,15 @@ Tools: - **Measure & Inspect tool** (`measureInspect`): a drag measures distance, angle and offsets, as the Measure tool does (`tool.options` reports the last one); hovering a path reads it, as `addon.pathtools.inspect` does. Nothing goes into the document. +- **Parametric Shape Tool** (`parametricShape`): draws shapes that stay editable as numbers. A drag from the centre runs + `addon.pathtools.shape.create`: the drag's length is the shape's size (height 2 × the distance, width in the last + shape's proportions), its direction the rotation (Shift: 45° steps). While dragging, ↑/↓ change the kind's count or + first value and ←/→ its second value or corner radius. A click selects a parametric shape and shows its handles: + centre (move), the box's lower right corner (size; Shift keeps the proportions), a handle above the top (rotation; + Shift: 45° steps), a dot on the top edge (corner radius) and one of the kind's own (a star's or ring's inner radius, a + gear's tooth height, an arrow's head, a cross's bar, a heart's notch, a bubble's tail tip); each drag runs + `addon.pathtools.shape.set`. A double-click on the canvas places a shape with the last settings. Options + (`tool.setOption`, or the panel with no shape selected) are the next shape's numbers, as the commands take them. Commands: @@ -5764,11 +5774,35 @@ Commands: - `addon.pathtools.crossings {cut?, selfCrossings?, ids?}` adds anchors where the selected paths cross one another (and where each crosses itself, with `selfCrossings`), or with `cut` also cuts them there: a path of one subpath becomes a path per piece. Paths that meet at a shared anchor don't cross there; at most 10,000 segments at once. +- `addon.pathtools.shape.create {center, kind?, width?, height?, rotation?, count?, a?, b?, radius?}` draws a parametric + shape with the current paint, selected. `kind`: `rectangle`, `ellipse`, `polygon` (default), `star`, `ring`, `arrow`, + `cross`, `heart`, `gear` or `bubble` (a speech bubble). `width` and `height` are 0.01 to 16,384 pt (100); + `rotation` is in degrees clockwise (0: upright, a polygon's first corner up); `count` is a polygon's sides, a star's + points or a gear's teeth (3 to 1,000); `radius` rounds the corners (0 to 16,384 pt; no corner passes the middle of a + side). `a` and `b` are the kind's own values, fractions of its size: star, inner radius (0.01 to 1, 0.5); ring, the + hole (0.01 to 0.99, 0.5); arrow, head length and shaft width (0.05 to 0.95, 0.4 each); cross, the bar's offset (−0.9 + to 0.9, 0; negative is up) and the arms' thickness (0.05 to 0.95, 1/3); heart, the notch's depth and the point's + roundness (0 to 1; 0.4 and 0); gear, tooth height (0.01 to 0.9, 0.2); bubble, the tail's height (0.05 to 0.9, 0.25) + and where its tip is across (−1 to 1, −0.4). → `{id, shape}`. +- `addon.pathtools.shape.set {id, …}` changes a parametric shape's numbers (the same keys; a new `kind` takes its own + defaults for the values not given) and redraws it in place. With no change it makes no step. → `{id, shape}` (its + numbers now, so `{id}` alone reads them). +- `addon.pathtools.shape.convert {ids?}` makes the selected plain closed paths that are rectangles, ellipses or + polygons with equal sides and corners (stretched along their own axes at most) parametric shapes with the same + outline. → `{ids}` (those converted). + +A parametric shape is an ordinary path. It keeps its numbers, with a fingerprint of the outline they drew, in one +entry of its object data (`vc-pathtools-shape`, as `document.node` lists `attrs.data`), which SVG export leaves out; +copies and duplicates keep it. Moved, rotated or scaled with any tool it stays editable: its centre, size and rotation +follow (a shape with rounded corners only when scaled evenly). Skewed, mirrored, or with its anchors edited, it is a +plain path from then on. ```json {"name":"run_command","arguments":{"command":"addon.pathtools.extend","params":{"id":12,"end":"end","length":40,"mode":"arc"}}} {"name":"run_command","arguments":{"command":"addon.pathtools.erase","params":{"points":[[100,40],[100,160]],"diameter":30}}} {"name":"run_command","arguments":{"command":"addon.pathtools.crossings","params":{"cut":true}}} +{"name":"run_command","arguments":{"command":"addon.pathtools.shape.create","params":{"kind":"star","center":[200,150],"width":120,"height":120,"count":7,"a":0.4}}} +{"name":"run_command","arguments":{"command":"addon.pathtools.shape.set","params":{"id":14,"kind":"gear","count":16,"radius":2}}} ``` ## Smart Pen add-on diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 498d16f190..d50a7a2de4 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Libraries panel: art dragged off the canvas and swatches dragged in are added where they are dropped; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Path Precision Tools add-on: the Parametric Shape Tool; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -1229,6 +1229,19 @@ Kernels in `vectorcraft_pathops::addons::pathtools`. Tests: `addons::pathtools` undo step, bad params refused, the brush's stroke one step) and `edit_toolbar::tests::addon_tools_are_in_the_drawer_not_the_toolbars`. Commands: `docs/mcp.md` › Path Precision Tools add-on. +The add-on's Parametric Shape Tool (2026-10-30) draws ten kinds of shape that stay editable as numbers (rectangle, +ellipse, polygon and star with 3 to 1,000 sides or points, ring, arrow, cross, heart, gear, speech bubble; corner radius +limited to the middle of a side): a drag from the centre sizes and turns one, the arrow keys change its count and values +while dragging, handles edit a selected one, a double-click places one with the last settings, and its panel edits the +numbers. A shape is a plain path whose numbers and outline fingerprint sit in one object-data entry that SVG export +leaves out; moving, rotating or scaling it keeps it editable, editing its anchors makes it a plain path. Convert to +Parametric Shape recognises plain rectangles, ellipses and regular polygons. Geometry in +`vectorcraft_pathops::addons::pathtools::shapes`. Tests: `shapes` in `vectorcraft-pathops` (each kind, ranges, +recovery after transforms, recognition), `addons::parametric_shape` in `vectorcraft-tools` (drag, keys, handles, +stored data), `cmd::addons::pathtools::tests` in `vectorcraft-engine` (each command one undo step, bad params refused, +anchor edits and transforms, the SVG export filter, the tool's gestures), `addons::pathtools::tests` in +`vectorcraft-ui-egui` (submenu and panel) and `command_sweep`. + ## Smart Pen add-on (2026-10-30) A VectorCraft addition, not an Illustrator feature, so no area score moves. Object › Plug-ins › Smart Pen selects the @@ -1260,6 +1273,7 @@ spot colours, carry a colour adjustment, or are RGB, CMYK or grayscale images | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Path Precision Tools add-on: the Parametric Shape Tool; evidence added; scores unchanged. | | 2026-10-30 | minor | Presentation Mode fits the active artboard and hides selections, guides, grids and artboard edges; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: Select by Color Kind; scores and estimates unchanged | | 2026-10-30 | minor | Gradient stop popover: an eyedropper samples the stop's colour from the art (#4681); scores and estimates unchanged | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e5df92c824..612c955c11 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Gradient panel presets; View › Hide Artboards hides their edges and shows the canvas as paper (#4038); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Path Precision Tools add-on: the Parametric Shape Tool and its panel; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -324,6 +324,8 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Preferences › General › Constrain Angle | done | arrow keys and Shift drags along the turned axes; the Rectangle, Rounded Rectangle, Ellipse and grid tools, point and area type and the shape size dialogs draw along them with the bounding box turned; Shift-drawn polygons and stars keep the turned base orientation; the Line Segment tool's Shift steps count from it (#394, ); arcs, spirals, flares and Pen paths are not turned | | Tabs panel: a stop drags from where the press landed, a stop just added included | done | #1458 | | Outline view keeps template layers in Preview, dimmed | done | #1486; a picture placed to be traced stays visible under the outlines | +| Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point) | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not an Illustrator feature, so it is not scored | +| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its four tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/shape.rs` and their tests; not an Illustrator feature, so it is not scored | | Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point); an Alt-drag away from paths selects the points inside a marquee | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not an Illustrator feature, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not an Illustrator feature, so it is not scored | | Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not an Illustrator feature, so it is not scored | @@ -368,6 +370,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Path Precision Tools add-on: the Parametric Shape Tool (ten re-editable shape kinds), its panel and Convert to Parametric Shape; scores and estimates unchanged | | 2026-10-30 | minor | Smart Pen add-on: an Alt-drag away from paths selects points with a marquee; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: Select by Color Kind; scores and estimates unchanged | | 2026-10-30 | minor | View › Hide Artboards hides their edges and shows the canvas as paper (#4038); scores and estimates unchanged | From 3b724a0a7955964c21ae18d14b51d899f7b009f3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 21:16:33 +0700 Subject: [PATCH 036/227] Text styles: Select All Unused highlights the unused styles, and Delete deletes them all Squashed from #4486 onto main. --- crates/engine/src/cmd/textstyles.rs | 78 ++++-- crates/engine/src/cmd/textstyles/tests.rs | 94 +++++++ crates/ui-egui/src/i18n/bg.tsv | 1 + crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + crates/ui-egui/src/panels/text_styles.rs | 208 +++++++++++---- .../ui-egui/src/panels/text_styles/tests.rs | 249 +++++++++++++++++- docs/mcp.md | 6 +- docs/target-app-parity.md | 1 + 31 files changed, 591 insertions(+), 70 deletions(-) diff --git a/crates/engine/src/cmd/textstyles.rs b/crates/engine/src/cmd/textstyles.rs index 9b3b14456e..2a8d48fab5 100644 --- a/crates/engine/src/cmd/textstyles.rs +++ b/crates/engine/src/cmd/textstyles.rs @@ -99,10 +99,18 @@ macro_rules! style_cmds { concat!($p, ".delete"), concat!("Delete ", $what, " Style"), &["Window", "Type", $menu], - "{name} (text keeps its look)", + "{name} | {names: [name…]} delete styles in one undo step (text keeps its look; never the Normal style)", |s, p| delete(s, p, $kind), true, ), + spec( + concat!($p, ".unused"), + "Select All Unused", + &["Window", "Type", $menu], + "{} → {names: [the styles no text uses, in panel order; never the Normal style]} (the panel highlights them)", + |s, _| unused(s, $kind), + false, + ), ] }; } @@ -291,21 +299,33 @@ fn text_mut(d: &mut Document, id: NodeId) -> Option<&mut vectorcraft_doc::TextOb } } -/// How many runs (char) or paragraphs (para) use `name`. -fn uses(d: &Document, kind: Kind, name: &str) -> usize { - let target = (name != kind.normal()).then_some(name); - let mut n = 0; - d.walk(|node| { - if let NodeKind::Text(t) = &node.kind { - n += match kind { - Kind::Char => t.runs.iter().filter(|r| r.style.style_name.as_deref() == target).count(), - Kind::Para => (0..t.paragraph_count()).filter(|&i| t.para_at(i).style_name.as_deref() == target).count(), - }; - } - }); +/// How many runs (char) or paragraphs (para) use each style, by style name (`None`: the Normal +/// style). Type in the art (opacity masks included), symbols, graph designs, pattern tiles and the +/// art of brushes counts. +fn uses(d: &Document, kind: Kind) -> std::collections::HashMap, usize> { + let mut n = std::collections::HashMap::new(); + let mut count = |name: &Option| *n.entry(name.clone()).or_insert(0) += 1; + let brushes = vectorcraft_brush::library(d); + let trees = d.layers.iter().map(|l| &**l).chain(d.symbols.iter().map(|s| &*s.art)).chain(d.graph_designs.iter().map(|g| &*g.art)); + let trees = trees.chain(d.patterns.iter().flat_map(|p| p.art.iter().map(|a| &**a))).chain(brushes.iter().flat_map(|b| b.art())); + for tree in trees { + vectorcraft_doc::swatches::walk_with_masks(tree, &mut |node| { + if let NodeKind::Text(t) = &node.kind { + match kind { + Kind::Char => t.runs.iter().for_each(|r| count(&r.style.style_name)), + Kind::Para => (0..t.paragraph_count()).for_each(|i| count(&t.para_at(i).style_name)), + } + } + }); + } n } +/// How many runs (char) or paragraphs (para) use `name` (see [`uses`]). +fn uses_of(uses: &std::collections::HashMap, usize>, kind: Kind, name: &str) -> usize { + uses.get(&(name != kind.normal()).then(|| name.to_string())).copied().unwrap_or(0) +} + /// Update every user of `name` from `old` to `new` attributes (overrides kept). fn update_users(d: &mut Document, kind: Kind, name: &str, old: &Map, new: &Map) { let target = (name != kind.normal()).then_some(name.to_string()); @@ -434,7 +454,8 @@ fn list(s: &mut Session, kind: Kind) -> Result { let d = &s.doc()?.doc; let mut names = vec![kind.normal().to_string()]; names.extend(kind.defs(d).iter().map(|s| s.name.clone()).filter(|n| n != kind.normal())); - let styles: Vec = names.iter().map(|n| json!({ "name": n, "attrs": kind.attrs(d, n), "uses": uses(d, kind, n) })).collect(); + let uses = uses(d, kind); + let styles: Vec = names.iter().map(|n| json!({ "name": n, "attrs": kind.attrs(d, n), "uses": uses_of(&uses, kind, n) })).collect(); Ok(json!({ "styles": styles })) } @@ -616,16 +637,26 @@ fn rename(s: &mut Session, p: &Value, kind: Kind) -> Result { fn delete(s: &mut Session, p: &Value, kind: Kind) -> Result { let c = kind.cmd("delete"); - let name = name_param(p, kind, "delete")?.to_string(); - if name == kind.normal() || !kind.defs(&s.doc()?.doc).iter().any(|s| s.name == name) { + let names: Vec = match p.get("names") { + Some(v) => v + .as_array() + .and_then(|a| a.iter().map(|n| n.as_str().map(str::to_string)).collect::>>()) + .ok_or_else(|| bad(&c, "`names` must be an array of style names"))?, + None => vec![name_param(p, kind, "delete")?.to_string()], + }; + if names.is_empty() { + return Err(bad(&c, "missing `name`")); + } + let defs = kind.defs(&s.doc()?.doc); + if let Some(name) = names.iter().find(|n| *n == kind.normal() || !defs.iter().any(|s| s.name == **n)) { return Err(bad(&c, format!("`{name}` can't be deleted"))); } - s.edit("Delete Style", |d, _| { - kind.defs_mut(d).retain(|s| s.name != name); + s.edit(if names.len() > 1 { "Delete Styles" } else { "Delete Style" }, |d, _| { + kind.defs_mut(d).retain(|s| !names.contains(&s.name)); for id in all_text(d) { let Some(t) = text_mut(d, id) else { continue }; let fix = |n: &mut Option| { - if n.as_deref() == Some(name.as_str()) { + if n.as_ref().is_some_and(|n| names.contains(n)) { *n = None; } }; @@ -639,5 +670,14 @@ fn delete(s: &mut Session, p: &Value, kind: Kind) -> Result { ok() } +/// The styles no text uses (see [`uses`]), in the order the panel lists them, without the Normal +/// style. +fn unused(s: &mut Session, kind: Kind) -> Result { + let d = &s.doc()?.doc; + let uses = uses(d, kind); + let names: Vec<&str> = kind.defs(d).iter().map(|s| s.name.as_str()).filter(|n| *n != kind.normal() && uses_of(&uses, kind, n) == 0).collect(); + Ok(json!({ "names": names })) +} + #[cfg(test)] mod tests; diff --git a/crates/engine/src/cmd/textstyles/tests.rs b/crates/engine/src/cmd/textstyles/tests.rs index e322e814a2..2cdcaf77af 100644 --- a/crates/engine/src/cmd/textstyles/tests.rs +++ b/crates/engine/src/cmd/textstyles/tests.rs @@ -122,6 +122,100 @@ fn new_styles_trim_their_names_as_a_rename_does() { assert_eq!(s.execute("charStyle.duplicate", &json!({"name": " Old "})).unwrap()["name"], "Old copy 2"); } +fn unused(s: &mut Session, p: &str) -> Vec { + serde_json::from_value(s.execute(&format!("{p}.unused"), &json!({})).unwrap()["names"].clone()).unwrap() +} + +fn listed(s: &mut Session, p: &str) -> Vec { + let list = s.execute(&format!("{p}.list"), &json!({})).unwrap(); + list["styles"].as_array().unwrap().iter().filter_map(|x| x["name"].as_str()).map(str::to_string).collect() +} + +/// Select All Unused: `charStyle.unused` and `paraStyle.unused` list, in panel order and without an +/// undo step, the styles no text uses, never the Normal style. Type in a symbol, an opacity mask, a +/// graph design, a pattern tile or a brush's art counts, as type in the layers does. +#[test] +fn unused_styles_are_those_no_text_uses_wherever_the_text_is() { + let (mut s, id) = session_with_text("Used"); + let names = ["Spare", "Used", "Symbol", "Mask", "Design", "Pattern", "Brush", "Also spare"]; + for p in ["charStyle", "paraStyle"] { + for n in names { + s.execute(&format!("{p}.new"), &json!({"name": n, "attrs": {}})).unwrap(); + } + s.execute(&format!("{p}.apply"), &json!({"name": "Used", "id": id})).unwrap(); + } + // Type in style `name`, selected. + let styled = |s: &mut Session, name: &str| { + let t = s.execute("text.create", &json!({"x": 10, "y": 150, "text": name})).unwrap()["id"].as_u64().unwrap(); + for p in ["charStyle", "paraStyle"] { + s.execute(&format!("{p}.apply"), &json!({"name": name, "id": t})).unwrap(); + } + s.execute("select.set", &json!({"ids": [t]})).unwrap(); + NodeId(t) + }; + let clear = |s: &mut Session, id: NodeId| { + s.execute("edit.clear", &json!({"ids": [id.0]})).unwrap(); + }; + styled(&mut s, "Symbol"); + let sym = s.execute("symbol.new", &json!({"name": "Mark"})).unwrap(); + clear(&mut s, NodeId(sym["id"].as_u64().unwrap())); + let masked = s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 60, "height": 60})).unwrap()["id"].as_u64().unwrap(); + let mask = styled(&mut s, "Mask"); + s.execute("select.set", &json!({"ids": [masked, mask.0]})).unwrap(); + s.execute("transparency.makeOpacityMask", &json!({})).unwrap(); + let design = styled(&mut s, "Design"); + s.execute("graph.design", &json!({"new": "Bar"})).unwrap(); + clear(&mut s, design); + let tile = styled(&mut s, "Pattern"); + s.execute("object.pattern.make", &json!({"edit": false})).unwrap(); + if s.doc().unwrap().doc.node(tile).is_some() { + clear(&mut s, tile); + } + let art = styled(&mut s, "Brush"); + s.execute("brush.new", &json!({"type": "art", "name": "Lettering"})).unwrap(); + clear(&mut s, art); + let undo = s.doc().unwrap().history.undo.len(); + for p in ["charStyle", "paraStyle"] { + assert_eq!(unused(&mut s, p), ["Spare", "Also spare"], "{p}"); + } + assert_eq!(s.doc().unwrap().history.undo.len(), undo); + let list = s.execute("charStyle.list", &json!({})).unwrap(); + let uses = |name: &str| list["styles"].as_array().unwrap().iter().find(|x| x["name"] == name).unwrap()["uses"].as_u64(); + for name in ["Symbol", "Mask", "Design", "Pattern", "Brush"] { + assert_eq!(uses(name), Some(1), "{name}"); + } +} + +/// `charStyle.delete` and `paraStyle.delete` take `names` and delete them in one undo step; text +/// that used them keeps its look. A name that is not a style, the Normal style, or `names` that is +/// not an array of strings deletes none. +#[test] +fn several_styles_are_deleted_in_one_step() { + let (mut s, id) = session_with_text("Title"); + s.execute("text.setStyle", &json!({"size": 40})).unwrap(); + for p in ["charStyle", "paraStyle"] { + for n in ["A", "B", "C"] { + s.execute(&format!("{p}.new"), &json!({"name": n})).unwrap(); + } + s.execute(&format!("{p}.apply"), &json!({"name": "B", "id": id})).unwrap(); + let before = listed(&mut s, p); + let undo = s.doc().unwrap().history.undo.len(); + let normal = before[0].clone(); + for bad in [json!(["A", "Nope"]), json!(["A", normal]), json!([]), json!(["A", 7]), json!("A")] { + assert!(s.execute(&format!("{p}.delete"), &json!({"names": bad})).is_err(), "{p} {bad}"); + } + assert_eq!((listed(&mut s, p), s.doc().unwrap().history.undo.len()), (before.clone(), undo), "{p}"); + s.execute(&format!("{p}.delete"), &json!({"names": ["A", "B"]})).unwrap(); + assert_eq!(listed(&mut s, p), [normal.as_str(), "C"], "{p}"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1, "{p}"); + assert_eq!(s.execute("edit.undo", &json!({})).unwrap()["undone"], "Delete Styles", "{p}"); + assert_eq!(listed(&mut s, p), before, "{p}"); + } + s.execute("charStyle.delete", &json!({"names": ["B"]})).unwrap(); + assert_eq!((runs(&s, id)[0].style.style_name.as_deref(), runs(&s, id)[0].style.size), (None, 40.0)); + assert_eq!(s.execute("edit.undo", &json!({})).unwrap()["undone"], "Delete Style"); +} + /// #1001: attributes their JSON leaves out at the defaults (Auto leading and kerning, no /// mojikumi) are still attributes a style can set, and a style captured with one applies to /// text at the default, is duplicated and comes back out of a library. diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index a75e6068a1..3a715a29d8 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -1380,6 +1380,7 @@ font-technology Variable Променливи Delete Guides Изтриване на водачи Delete Slice Изтриване на отрязък Delete Style Изтриване на стил + Delete Styles Изтриване на стилове Delete Variables Изтриване на променливи Delete View Изтриване на изглед Done Editing Pattern Край на редактирането на мостра diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index dfd5d5a2ae..9ecbd9ec53 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -1042,6 +1042,7 @@ Delete Spine Point Suprimeix el punt de l’espina Delete Stop Suprimeix la parada Delete Style Suprimeix l’estil + Delete Styles Suprimeix els estils Delete Swatch Suprimeix la mostra Delete Symbol Suprimeix el símbol Delete Tab Suprimeix la tabulació diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index f4262a357c..5e5e459ea1 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -1593,6 +1593,7 @@ lighting Light Světlo Delete Guides Odstranit vodítka Delete Slice Odstranit řez Delete Style Odstranit styl + Delete Styles Odstranit styly Delete Variables Odstranit proměnné Delete View Odstranit zobrazení Done Editing Pattern Dokončit úpravy vzorku diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 381031efa9..52eac9d03a 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5330,6 +5330,7 @@ swatch Bright Violet Kraftig violet Delete Guides Slet hjælpelinjer Delete Slice Slet udsnit Delete Style Slet typografi + Delete Styles Slet typografier Delete Variables Slet variabler Delete View Slet visning Done Editing Pattern Redigering af mønster udført diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 3c24d28251..74bfb8ad19 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -1406,6 +1406,7 @@ file-filter Templates Vorlagen Delete Guides Hilfslinien löschen Delete Slice Slice löschen Delete Style Format löschen + Delete Styles Formate löschen Delete Variables Variablen löschen Delete View Ansicht löschen Done Editing Pattern Musterbearbeitung beenden diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 1bd9af4865..fc31f0850f 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -1344,6 +1344,7 @@ font-technology Variable Μεταβλητές Delete Guides Διαγραφή οδηγών Delete Slice Διαγραφή τομής Delete Style Διαγραφή στυλ + Delete Styles Διαγραφή στυλ Delete Variables Διαγραφή μεταβλητών Delete View Διαγραφή προβολής Done Editing Pattern Ολοκλήρωση επεξεργασίας μοτίβου diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 314a86f6ae..0214dd9c6d 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -1418,6 +1418,7 @@ font-technology Variable Variables Delete Guides Eliminar guías Delete Slice Eliminar sector Delete Style Eliminar estilo + Delete Styles Eliminar estilos Delete Variables Eliminar variables Delete View Eliminar vista Done Editing Pattern Terminar edición de motivo diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 52e389442e..b9be325c65 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -1567,6 +1567,7 @@ lighting Light Valo Delete Guides Poista apuviivat Delete Slice Poista siivu Delete Style Poista tyyli + Delete Styles Poista tyylit Delete Variables Poista muuttujat Delete View Poista näkymä Done Editing Pattern Lopeta kuvion muokkaus diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 90c1fc733b..ad57031ed3 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -1417,6 +1417,7 @@ font-technology Variable Variables Delete Guides Supprimer les repères Delete Slice Supprimer la tranche Delete Style Supprimer le style + Delete Styles Supprimer les styles Delete Variables Supprimer les variables Delete View Supprimer la vue Done Editing Pattern Terminer la modification du motif diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index a9fce7ddbd..38e97c940f 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -1806,6 +1806,7 @@ file-filter Templates Sablonok Delete Guides Segédvonalak törlése Delete Slice Szelet törlése Delete Style Stílus törlése + Delete Styles Stílusok törlése Delete Variables Változók törlése Delete View Nézet törlése Done Editing Pattern Mintázatszerkesztés befejezése diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index fc6f7bef60..8d9fb5cfb0 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5330,6 +5330,7 @@ swatch Bright Violet Violet cerah Delete Guides Hapus semua panduan Delete Slice Hapus slice Delete Style Hapus gaya + Delete Styles Hapus gaya Delete Variables Hapus variabel Delete View Hapus tampilan Done Editing Pattern Selesai mengedit pola diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index d13f802951..0baee70c0e 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -1430,6 +1430,7 @@ file-filter Templates Modelli Delete Guides Elimina guide Delete Slice Elimina sezione Delete Style Elimina stile + Delete Styles Elimina stili Delete Variables Elimina variabili Delete View Elimina vista Done Editing Pattern Termina modifica motivo diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 831a6ab674..583b7ae427 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -1713,6 +1713,7 @@ font-technology Variable バリアブル Delete Guides ガイドを削除 Delete Slice スライスを削除 Delete Style スタイルを削除 + Delete Styles スタイルを削除 Delete Variables 変数を削除 Delete View 表示を削除 Done Editing Pattern パターン編集を完了 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 29a0bd9749..5cd927a0f6 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5185,6 +5185,7 @@ imageTrace Outline კონტური Delete Light სინათლის წაშლა Delete Slice ნაჭრის წაშლა Delete Style სტილის წაშლა + Delete Styles სტილების წაშლა Delete Variables ცვლადების წაშლა Delete View ხედის წაშლა Done Editing Pattern პატერნის რედაქტირების დასრულება diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index b5a1958faf..53bc38d4ad 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -1701,6 +1701,7 @@ font-technology Variable 가변 Delete Guides 안내선 삭제 Delete Slice 분할 삭제 Delete Style 스타일 삭제 + Delete Styles 스타일 삭제 Delete Variables 변수 삭제 Delete View 보기 삭제 Done Editing Pattern 패턴 편집 완료 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index de6dcd584b..535a5d6bed 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5341,6 +5341,7 @@ swatch Bright Violet Felviolet Delete Guides Hulplijnen verwijderen Delete Slice Slice verwijderen Delete Style Stijl verwijderen + Delete Styles Stijlen verwijderen Delete Variables Variabelen verwijderen Delete View Weergave verwijderen Done Editing Pattern Patroon bewerken voltooid diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 2bd746e1d2..99f3621519 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -1508,6 +1508,7 @@ lighting Light Światło Delete Guides Usuń linie pomocnicze Delete Slice Usuń plasterek Delete Style Usuń styl + Delete Styles Usuń style Delete Variables Usuń zmienne Delete View Usuń widok Done Editing Pattern Zakończ edycję wzorka diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 2e4aed474b..dc816dd384 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -1224,6 +1224,7 @@ Delete Guides Excluir Guias Delete Slice Excluir Fatia Delete Style Excluir Estilo + Delete Styles Excluir Estilos Delete Variables Excluir Variáveis Delete View Excluir Exibição Done Editing Pattern Concluir Edição de Padrão diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 2583931c4e..79d270ba7a 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -1428,6 +1428,7 @@ file-filter Templates Шаблоны Delete Guides Удалить направляющие Delete Slice Удалить фрагмент Delete Style Удалить стиль + Delete Styles Удалить стили Delete Variables Удалить переменные Delete View Удалить вид Done Editing Pattern Завершить редактирование узора diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 2c33ce33fd..24bded7f48 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -1382,6 +1382,7 @@ font-technology Variable Variabla Delete Guides Radera stödlinjer Delete Slice Radera skiva Delete Style Radera stil + Delete Styles Radera stilar Delete Variables Radera variabler Delete View Radera vy Done Editing Pattern Avsluta mönsterredigering diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 82c531a051..b94cb137e4 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5147,6 +5147,7 @@ theme Appearance Görünüm Delete Guides Kılavuzları Sil Delete Slice Dilimi Sil Delete Style Stili Sil + Delete Styles Stilleri Sil Delete Variables Değişkenleri Sil Delete View Görünümü Sil Done Editing Pattern Desen Düzenlemeyi Bitir diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index b83c2bc944..4882ba94c5 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -1424,6 +1424,7 @@ file-filter Templates Шаблони Delete Guides Видалити напрямні Delete Slice Видалити фрагмент Delete Style Видалити стиль + Delete Styles Видалити стилі Delete Variables Видалити змінні Delete View Видалити вигляд Done Editing Pattern Завершити редагування візерунка diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 533d6996d8..311008cab2 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -1637,6 +1637,7 @@ file-filter Templates Mẫu Delete Guides Xóa các đường căn Delete Slice Xóa lát cắt Delete Style Xóa kiểu + Delete Styles Xóa kiểu Delete Variables Xóa biến số Delete View Xóa chế độ xem Done Editing Pattern Hoàn tất chỉnh sửa họa tiết diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 88e4d4c998..a8eb60373f 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -1362,6 +1362,7 @@ file-filter Templates 模板 Delete Guides 删除参考线 Delete Slice 删除切片 Delete Style 删除样式 + Delete Styles 删除样式 Delete Variables 删除变量 Delete View 删除视图 Done Editing Pattern 完成图案编辑 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 2c42fbd63c..3c19fbd98b 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -1395,6 +1395,7 @@ file-filter Templates 範本 Delete Guides 刪除參考線 Delete Slice 刪除切片 Delete Style 刪除樣式 + Delete Styles 刪除樣式 Delete Variables 刪除變數 Delete View 刪除檢視 Done Editing Pattern 完成圖樣編輯 diff --git a/crates/ui-egui/src/panels/text_styles.rs b/crates/ui-egui/src/panels/text_styles.rs index 049ebac48f..7c65cf93df 100644 --- a/crates/ui-egui/src/panels/text_styles.rs +++ b/crates/ui-egui/src/panels/text_styles.rs @@ -5,11 +5,15 @@ //! "+" when the text overrides some of its attributes. New makes a style from the selected text; //! Alt-click on New first asks for its name (`ui.newCharStyle`, `ui.newParaStyle`). -use egui::{Sense, Ui, vec2}; +use std::cell::RefCell; + +use egui::{Color32, Sense, Ui, vec2}; use serde_json::{Map, Value, json}; +use vectorcraft_doc::Document; use vectorcraft_engine::cmd::textstyles; use super::character::{end_typing, text_editing, text_style}; +use super::memo::Memo; use super::{alt_held, pstate, selection_len, set_pstate}; use crate::VectorcraftApp; use crate::theme::Tokens; @@ -35,28 +39,93 @@ impl Kind { fn key(self) -> &'static str { if self == Kind::Char { "char-style-sel" } else { "para-style-sel" } } + /// Panel state holding the styles highlighted together, with the style [`Kind::key`] held + /// when they were highlighted. + fn many_key(self) -> &'static str { + if self == Kind::Char { "char-style-many" } else { "para-style-many" } + } + /// Panel state holding the style a Shift-click extends the highlight from. + fn anchor_key(self) -> &'static str { + if self == Kind::Char { "char-style-anchor" } else { "para-style-anchor" } + } /// The style row the panel scrolls into view the next time it draws. fn scroll_key(self) -> &'static str { if self == Kind::Char { "char-style-scroll" } else { "para-style-scroll" } } + /// Panel state holding the `uid` of the document the highlight was made in. + fn document_key(self) -> &'static str { + if self == Kind::Char { "char-style-document" } else { "para-style-document" } + } } -/// Highlights a style the panel just made and scrolls its row into view the next time it draws. -fn highlight_made(ctx: &egui::Context, kind: Kind, name: Option) { - set_pstate(ctx, kind.scroll_key(), name.clone()); - set_pstate(ctx, kind.key(), name); +/// The styles highlighted in the panel, in the order they were picked, among the styles `listed`: +/// the styles a Shift-click, a Cmd/Ctrl-click or Select All Unused highlighted together while +/// [`Kind::key`] still holds the style it held then, else the one style in [`Kind::key`]. +fn highlighted(app: &VectorcraftApp, ctx: &egui::Context, kind: Kind, listed: &[&str]) -> Vec { + let document = app.session.active().map(|st| st.uid); + if pstate::>(ctx, kind.document_key()) != document { + set_pstate(ctx, kind.document_key(), document); + set_highlighted(ctx, kind, vec![]); + set_pstate(ctx, kind.anchor_key(), String::new()); + set_pstate::>(ctx, kind.scroll_key(), None); + } + let one: Option = pstate(ctx, kind.key()); + let (with, many): (Option, Vec) = pstate(ctx, kind.many_key()); + let mut names = if with == one && !many.is_empty() { many } else { one.into_iter().collect() }; + names.retain(|n| listed.contains(&n.as_str())); + names +} + +/// Highlights `names` in the panel: [`Kind::key`] holds the first of them. +fn set_highlighted(ctx: &egui::Context, kind: Kind, names: Vec) { + let one = names.first().cloned(); + set_pstate(ctx, kind.key(), one.clone()); + set_pstate(ctx, kind.many_key(), (one, names)); +} + +/// Highlights the styles the panel just made and scrolls the first one's row into view the next +/// time it draws. +fn highlight_made(ctx: &egui::Context, kind: Kind, names: Vec) { + set_pstate(ctx, kind.scroll_key(), names.first().cloned()); + set_highlighted(ctx, kind, names); +} + +/// Duplicates the styles `names` (`charStyle.duplicate`, `paraStyle.duplicate`) in one undo step +/// and highlights the copies. +fn duplicate(app: &mut VectorcraftApp, ctx: &egui::Context, kind: Kind, names: &[String]) { + let p = kind.prefix(); + let made = if let [name] = names { + app.run(&format!("{p}.duplicate"), json!({ "name": name })).map(|r| vec![r]) + } else { + let commands: Vec = names.iter().map(|n| json!({ "command": format!("{p}.duplicate"), "params": { "name": n } })).collect(); + let label = if kind == Kind::Char { "New Character Style" } else { "New Paragraph Style" }; + app.run("command.batch", json!({ "label": label, "commands": commands })).map(|r| r["results"].as_array().cloned().unwrap_or_default()) + }; + if let Ok(made) = made { + highlight_made(ctx, kind, made.iter().filter_map(|r| r["name"].as_str().map(str::to_string)).collect()); + } } /// A row dragged in the list: the style's kind and name. Dropped on Create New Style it is /// duplicated (`charStyle.duplicate`, `paraStyle.duplicate`); dropped on Delete it is deleted -/// (`charStyle.delete`, `paraStyle.delete`) unless it is Normal. Each panel's buttons accept only rows of -/// their own kind. +/// (`charStyle.delete`, `paraStyle.delete`) unless it is Normal. A highlighted row carries every +/// highlighted style with it. Each panel's buttons accept only rows of their own kind. #[derive(Clone)] struct RowDrag { kind: Kind, name: String, } +/// The styles a row dragged from the list carries: every highlighted style (`sel`) in the order +/// the panel lists them when the row is one of them, else the row's style alone. +fn dragged(sel: &[String], listed: &[&str], name: &str) -> Vec { + if sel.iter().any(|s| s == name) { + listed.iter().filter(|n| sel.iter().any(|s| s == *n)).map(|n| n.to_string()).collect() + } else { + vec![name.to_string()] + } +} + /// The style row of `kind` released on `button` this frame, if any; `button` is outlined while one /// is held over it. `take`: whether a row with that name may be dropped there. fn row_dropped(ui: &Ui, button: &egui::Response, kind: Kind, take: impl Fn(&str) -> bool) -> Option { @@ -65,9 +134,18 @@ fn row_dropped(ui: &Ui, button: &egui::Response, kind: Kind, take: impl Fn(&str) button.dnd_release_payload::().map(|_| held.name.clone()) } -/// (name, attrs, uses) for every style, Normal first. +/// (name, attrs, uses) for every style, Normal first, listed once per document version. fn styles(app: &mut VectorcraftApp, kind: Kind) -> Vec<(String, Map, u64)> { - let v = app.session.execute(&format!("{}.list", kind.prefix()), &json!({})).unwrap_or_default(); + thread_local! { + static MEMO: RefCell<[Memo; 2]> = RefCell::new([Memo::default(), Memo::default()]); + } + let Some((doc, revision)) = app.session.active().map(|st| (st.doc.clone(), st.revision)) else { return vec![] }; + let list = || { + #[cfg(test)] + LISTED.with(|n| n.set(n.get() + 1)); + app.session.execute(&format!("{}.list", kind.prefix()), &json!({})).unwrap_or_default() + }; + let v = MEMO.with(|m| m.borrow_mut()[kind as usize].get(&doc, revision, list)); v["styles"] .as_array() .map(|a| { @@ -84,6 +162,12 @@ fn styles(app: &mut VectorcraftApp, kind: Kind) -> Vec<(String, Map = const { std::cell::Cell::new(0) }; +} + /// The selection's style name (Normal when none) and every one of its attributes, written as a /// style holds them, if text is selected. fn current(app: &VectorcraftApp, kind: Kind) -> Option<(Option, Map)> { @@ -116,14 +200,33 @@ pub(crate) fn open_new(app: &mut VectorcraftApp, kind: Kind) -> Result (Option, bool) { + let fill = if is_cur { + Some(t.row_selected) + } else if in_highlight || hovered { + Some(t.hover) + } else { + None + }; + (fill, is_cur && in_highlight) +} + +/// The style list and its New and Delete buttons. Shift-click highlights every style from the +/// last one clicked without Shift through this one, and Cmd/Ctrl-click adds or removes one; both +/// leave the text as it is. Delete deletes every highlighted style but the Normal style. pub fn show(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { let t = Tokens::get(ui.ctx()); let all = styles(app, kind); let cur = current(app, kind); let normal = all.first().map(|s| s.0.clone()).unwrap_or_default(); let cur_name = cur.as_ref().map(|(n, _)| n.clone().unwrap_or_else(|| normal.clone())); - let mut clicked: Option<(String, bool)> = None; - let mut sel: Option = pstate(ui.ctx(), kind.key()); + let mut clicked: Option<(String, egui::Modifiers)> = None; + let listed: Vec<&str> = all.iter().map(|s| s.0.as_str()).collect(); + // A highlighted style that is no longer listed (renamed in Style Options, deleted by a command + // or undone) is no longer highlighted. + let mut sel = highlighted(app, ui.ctx(), kind, &listed); let scroll_to: Option = pstate(ui.ctx(), kind.scroll_key()); widgets::list_box(ui, |ui| { for (name, attrs, _) in &all { @@ -137,10 +240,12 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { if scroll_to.as_deref() == Some(name.as_str()) { ui.scroll_to_rect(r, None); } - if is_cur || sel.as_deref() == Some(name.as_str()) { - ui.painter().rect_filled(r, 0.0, if is_cur { t.row_selected } else { t.hover }); - } else if resp.hovered() { - ui.painter().rect_filled(r, 0.0, t.hover); + let (fill, outline) = row_look(is_cur, sel.contains(name), resp.hovered(), &t); + if let Some(fill) = fill { + ui.painter().rect_filled(r, 0.0, fill); + } + if outline { + ui.painter().rect_stroke(r, 0.0, egui::Stroke::new(2.0, t.accent), egui::StrokeKind::Inside); } // The built-in "[Normal … Style]" (listed first) is translated where painted; other names // are user data, brackets or not. @@ -148,7 +253,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { let label = if overridden { format!("{shown}+") } else { shown.to_string() }; ui.painter().text(r.left_center() + vec2(8.0, 0.0), egui::Align2::LEFT_CENTER, label, egui::FontId::proportional(12.5), t.text); if resp.clicked() { - clicked = Some((name.clone(), ui.input(|i| i.modifiers.alt))); + clicked = Some((name.clone(), ui.input(|i| i.modifiers))); } } }); @@ -156,20 +261,17 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { set_pstate::>(ui.ctx(), kind.scroll_key(), None); } let has_text = cur.is_some(); - if let Some((name, clear)) = clicked { - sel = Some(name.clone()); - if has_text { - let p = target(app, kind, json!({ "name": name, "clearOverrides": clear })); + if let Some((name, m)) = clicked { + sel = super::swatches::click_selection(ui, kind.anchor_key(), sel, &listed, &name, m); + // Shift and Cmd/Ctrl clicks only highlight, as in the Graphic Styles panel. + if has_text && !(m.shift || m.command) { + let p = target(app, kind, json!({ "name": name, "clearOverrides": m.alt })); app.run(&format!("{}.apply", kind.prefix()), p).ok(); } } - // A highlighted style that is no longer listed (renamed in Style Options, deleted by a command - // or undone) is no longer highlighted. - if sel.as_ref().is_some_and(|s| !all.iter().any(|(n, ..)| n == s)) { - sel = None; - } - set_pstate(ui.ctx(), kind.key(), sel.clone()); - let deletable = sel.as_ref().is_some_and(|s| *s != normal); + set_highlighted(ui.ctx(), kind, sel.clone()); + let doomed: Vec<&String> = sel.iter().filter(|s| **s != normal).collect(); + let deletable = !doomed.is_empty(); widgets::bottom_bar(ui, |ui| { ui.add_space((ui.available_width() - 2.0 * 28.0).max(0.0)); let new = widgets::icon_button_enabled( @@ -181,15 +283,13 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { 24.0, ); if let Some(name) = row_dropped(ui, &new, kind, |_| true) { - if let Ok(r) = app.run(&format!("{}.duplicate", kind.prefix()), json!({ "name": name })) { - highlight_made(ui.ctx(), kind, r["name"].as_str().map(str::to_string)); - } + duplicate(app, ui.ctx(), kind, &dragged(&sel, &listed, &name)); } else if new.clicked() { end_typing(app); if alt_held(ui) { app.run(if kind == Kind::Char { "ui.newCharStyle" } else { "ui.newParaStyle" }, json!({})).ok(); } else if let Ok(r) = app.run(&format!("{}.new", kind.prefix()), target(app, kind, json!({}))) { - highlight_made(ui.ctx(), kind, r["name"].as_str().map(str::to_string)); + highlight_made(ui.ctx(), kind, r["name"].as_str().map(str::to_string).into_iter().collect()); } } let delete = widgets::icon_button_enabled( @@ -200,23 +300,31 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { deletable, 24.0, ); - if let Some(name) = row_dropped(ui, &delete, kind, |n| n != normal) { - if app.run(&format!("{}.delete", kind.prefix()), json!({ "name": name })).is_ok() && sel.as_ref() == Some(&name) { - set_pstate::>(ui.ctx(), kind.key(), None); + let drop_names = |n: &str| dragged(&sel, &listed, n).into_iter().filter(|s| *s != normal).collect::>(); + if let Some(name) = row_dropped(ui, &delete, kind, |n| !drop_names(n).is_empty()) { + // Deleting the highlighted styles clears the highlight; a row dropped from outside it + // leaves it as it is. + if app.run(&format!("{}.delete", kind.prefix()), json!({ "names": drop_names(&name) })).is_ok() && sel.contains(&name) { + set_highlighted(ui.ctx(), kind, vec![]); } - } else if delete.clicked() - && let Some(n) = &sel - && app.run(&format!("{}.delete", kind.prefix()), json!({ "name": n })).is_ok() - { - set_pstate::>(ui.ctx(), kind.key(), None); + } else if delete.clicked() && app.run(&format!("{}.delete", kind.prefix()), json!({ "names": doomed })).is_ok() { + set_highlighted(ui.ctx(), kind, vec![]); } }); } +/// The panel menu. Select All Unused highlights the styles no text uses (`charStyle.unused`, +/// `paraStyle.unused`), Duplicate copies every highlighted style and highlights the copies, and +/// Delete deletes every highlighted style but the Normal style. pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { - let sel: Option = pstate(ui.ctx(), kind.key()); + let all = styles(app, kind); + let listed: Vec<&str> = all.iter().map(|s| s.0.as_str()).collect(); + let many = highlighted(app, ui.ctx(), kind, &listed); + // The items for one style act on the highlighted style while it is the only one. + let sel: Option = if many.len() == 1 { many.first().cloned() } else { None }; let normal = if kind == Kind::Char { "[Normal Character Style]" } else { "[Normal Paragraph Style]" }; let user = sel.as_ref().is_some_and(|s| s != normal); + let doomed: Vec<&String> = many.iter().filter(|s| *s != normal).collect(); let has_text = current(app, kind).is_some() || selection_len(app) > 0; let p = kind.prefix(); if menu_item(ui, &crate::i18n::fmt(tl!("New {kind} Style…"), &[("kind", kind.what_label())]), true, false) { @@ -224,17 +332,19 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { end_typing(app); app.run(&format!("{p}.new"), target(app, kind, json!({}))).ok(); } - if menu_item(ui, &crate::i18n::fmt(tl!("Duplicate {kind} Style"), &[("kind", kind.what_label())]), sel.is_some(), false) - && let Some(n) = &sel - && let Ok(r) = app.run(&format!("{p}.duplicate"), json!({ "name": n })) - { - highlight_made(ui.ctx(), kind, r["name"].as_str().map(str::to_string)); + if menu_item(ui, &crate::i18n::fmt(tl!("Duplicate {kind} Style"), &[("kind", kind.what_label())]), !many.is_empty(), false) { + let names: Vec = listed.iter().filter(|n| many.iter().any(|s| s == *n)).map(|n| n.to_string()).collect(); + duplicate(app, ui.ctx(), kind, &names); } - if menu_item(ui, &crate::i18n::fmt(tl!("Delete {kind} Style"), &[("kind", kind.what_label())]), user, false) - && let Some(n) = &sel - && app.run(&format!("{p}.delete"), json!({ "name": n })).is_ok() + if menu_item(ui, &crate::i18n::fmt(tl!("Delete {kind} Style"), &[("kind", kind.what_label())]), !doomed.is_empty(), false) + && app.run(&format!("{p}.delete"), json!({ "names": doomed })).is_ok() { - set_pstate::>(ui.ctx(), kind.key(), None); + set_highlighted(ui.ctx(), kind, vec![]); + } + if menu_item(ui, tl!("Select All Unused"), app.session.active().is_some(), false) + && let Ok(r) = app.run(&format!("{p}.unused"), json!({})) + { + set_highlighted(ui.ctx(), kind, serde_json::from_value(r["names"].clone()).unwrap_or_default()); } ui.separator(); if menu_item(ui, tl!("Clear Overrides"), sel.is_some() && has_text, false) diff --git a/crates/ui-egui/src/panels/text_styles/tests.rs b/crates/ui-egui/src/panels/text_styles/tests.rs index a5e9c31a6a..465baeac29 100644 --- a/crates/ui-egui/src/panels/text_styles/tests.rs +++ b/crates/ui-egui/src/panels/text_styles/tests.rs @@ -3,6 +3,16 @@ use vectorcraft_doc::{NodeId, NodeKind}; use super::super::tests_appearance::{click, frame_events, frame_raw, text_rect}; +#[test] +fn current_style_highlight_has_a_separate_indicator() { + let ctx = egui::Context::default(); + let t = Tokens::get(&ctx); + assert_eq!(row_look(true, false, false, &t), (Some(t.row_selected), false)); + assert_eq!(row_look(true, true, false, &t), (Some(t.row_selected), true)); + assert_eq!(row_look(false, true, false, &t), (Some(t.hover), false)); + assert_eq!(row_look(false, false, false, &t), (None, false)); +} + #[test] fn panels_draw_and_apply_headless() { let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); @@ -309,7 +319,7 @@ fn a_style_made_from_the_panel_is_scrolled_into_view() { } else { // The New button's path: the style it made, highlighted with `highlight_made`. let name = app.run(&format!("{}.new", kind.prefix()), json!({})).unwrap()["name"].as_str().unwrap_or_default().to_string(); - highlight_made(&ctx, kind, Some(name.clone())); + highlight_made(&ctx, kind, vec![name.clone()]); name }; assert_eq!(pstate::>(&ctx, kind.key()).as_deref(), Some(made.as_str()), "{what}: the new style is highlighted"); @@ -493,6 +503,243 @@ fn character_style_range_apply_from_panel_control() { assert_eq!(app.session.doc().unwrap().doc, after); } +/// A document with selected type and both kinds' styles A, B, C and D, the type using B. +fn several_app() -> (VectorcraftApp, NodeId) { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + let id = NodeId(app.run("text.create", json!({"x": 20, "y": 50, "text": "Hi", "size": 18})).unwrap()["id"].as_u64().unwrap()); + app.run("select.set", json!({"ids": [id.0]})).unwrap(); + for kind in [Kind::Char, Kind::Para] { + for n in ["A", "B", "C", "D"] { + app.run(&format!("{}.new", kind.prefix()), json!({"name": n, "attrs": {}})).unwrap(); + } + app.run(&format!("{}.apply", kind.prefix()), json!({"name": "B"})).unwrap(); + } + (app, id) +} + +/// Click the text `label` that `draw` paints, with `modifiers` held. +fn click_text_held( + ctx: &egui::Context, + app: &mut VectorcraftApp, + label: &str, + modifiers: egui::Modifiers, + draw: impl FnMut(&mut VectorcraftApp, &mut egui::Ui), +) { + click_where(ctx, app, |texts| text_rect(texts, label).center(), modifiers, draw); +} + +/// Click where `at` finds in the texts `draw` paints, with `modifiers` held, over three frames +/// (hover, press, release) after two frames that lay them out. +fn click_where( + ctx: &egui::Context, + app: &mut VectorcraftApp, + at: impl FnOnce(&[(String, egui::Rect)]) -> egui::Pos2, + modifiers: egui::Modifiers, + mut draw: impl FnMut(&mut VectorcraftApp, &mut egui::Ui), +) { + let held = egui::Event::ModifiersChanged(modifiers); + frame_events(ctx, app, vec![held.clone()], &mut draw); + let pos = at(&frame_events(ctx, app, vec![held.clone()], &mut draw)); + let button = |pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers }; + for e in [egui::Event::PointerMoved(pos), button(true), button(false)] { + frame_events(ctx, app, vec![held.clone(), e], &mut draw); + } + frame_events(ctx, app, vec![egui::Event::ModifiersChanged(egui::Modifiers::NONE)], &mut draw); +} + +/// The styles `kind`'s panel highlights. +fn highlighted_now(app: &mut VectorcraftApp, ctx: &egui::Context, kind: Kind) -> Vec { + let all = styles(app, kind); + highlighted(app, ctx, kind, &all.iter().map(|s| s.0.as_str()).collect::>()) +} + +#[test] +fn switching_documents_clears_highlighted_styles_with_matching_names() { + for kind in [Kind::Char, Kind::Para] { + let (mut app, _) = several_app(); + let ctx = egui::Context::default(); + let rows = |app: &mut VectorcraftApp, ui: &mut egui::Ui| { + ui.set_width(280.0); + show(app, ui, kind); + }; + click_text_held(&ctx, &mut app, "A", egui::Modifiers::NONE, rows); + click_text_held(&ctx, &mut app, "B", egui::Modifiers::COMMAND, rows); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["A", "B"]); + + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + for name in ["A", "B"] { + app.run(&format!("{}.new", kind.prefix()), json!({"name": name, "attrs": {}})).unwrap(); + } + assert!(highlighted_now(&mut app, &ctx, kind).is_empty(), "{} Styles: the new document has no highlighted styles", kind.what()); + assert_eq!(pstate::(&ctx, kind.anchor_key()), ""); + assert_eq!(pstate::>(&ctx, kind.key()), None); + assert_eq!(pstate::<(Option, Vec)>(&ctx, kind.many_key()).1, Vec::::new()); + } +} + +/// In both panels Shift-click highlights every style from the last one clicked without Shift +/// through the one clicked, and Cmd/Ctrl-click adds or removes one; neither applies a style to the +/// selected type. +/// Delete then deletes every highlighted style in one undo step, and the type keeps its look. +#[test] +fn shift_and_cmd_clicks_highlight_several_styles_that_delete_deletes_at_once() { + use egui::Modifiers; + for kind in [Kind::Char, Kind::Para] { + let (mut app, id) = several_app(); + let ctx = egui::Context::default(); + let rows = |app: &mut VectorcraftApp, ui: &mut egui::Ui| { + ui.set_width(280.0); + show(app, ui, kind); + }; + click_text_held(&ctx, &mut app, "A", Modifiers::NONE, rows); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["A"]); + let doc = app.session.doc().unwrap().doc.clone(); + click_text_held(&ctx, &mut app, "C", Modifiers::SHIFT, rows); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["A", "B", "C"], "{} Styles: Shift-click", kind.what()); + click_text_held(&ctx, &mut app, "B", Modifiers::COMMAND, rows); + click_text_held(&ctx, &mut app, "D", Modifiers::COMMAND, rows); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["A", "C", "D"], "{} Styles: Cmd/Ctrl-click", kind.what()); + assert_eq!(app.session.doc().unwrap().doc, doc, "Shift and Cmd/Ctrl clicks apply nothing"); + let undo = app.session.doc().unwrap().history.undo.len(); + // The footer's Delete button is centered 12 points left of the panel's right edge. + let button = std::cell::Cell::new(egui::Pos2::ZERO); + let footer = |app: &mut VectorcraftApp, ui: &mut egui::Ui| { + ui.set_width(280.0); + let right = ui.max_rect().right(); + show(app, ui, kind); + button.set(egui::pos2(right - 12.0, ui.min_rect().bottom() - 12.0)); + }; + click_where(&ctx, &mut app, |_| button.get(), Modifiers::NONE, footer); + let left: Vec = styles(&mut app, kind).into_iter().skip(1).map(|s| s.0).collect(); + assert_eq!(left, ["B"], "{} Styles: Delete deletes A, C and D", kind.what()); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1, "one undo step"); + assert_eq!(highlighted_now(&mut app, &ctx, kind), Vec::::new()); + assert_eq!(text_runs(&app, id)[0].1, 18.0, "the type keeps its look"); + app.run("edit.undo", json!({})).unwrap(); + assert_eq!(app.session.doc().unwrap().doc, doc); + } +} + +/// The panel menu's Select All Unused highlights, in both panels, the styles no text uses, never +/// the Normal style; the menu's Delete then deletes them in one undo step. +#[test] +fn select_all_unused_highlights_the_unused_styles_for_delete() { + for kind in [Kind::Char, Kind::Para] { + let (mut app, _) = several_app(); + let ctx = egui::Context::default(); + let items = |app: &mut VectorcraftApp, ui: &mut egui::Ui| menu(app, ui, kind); + click_text_held(&ctx, &mut app, " Select All Unused", egui::Modifiers::NONE, items); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["A", "C", "D"], "{} Styles", kind.what()); + let undo = app.session.doc().unwrap().history.undo.len(); + let label = format!(" Delete {} Style", kind.what()); + click_text_held(&ctx, &mut app, &label, egui::Modifiers::NONE, items); + let left: Vec = styles(&mut app, kind).into_iter().map(|s| s.0).collect(); + assert_eq!(left[1..], ["B"], "{} Styles: the unused styles are deleted", kind.what()); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1, "one undo step"); + assert_eq!(highlighted_now(&mut app, &ctx, kind), Vec::::new()); + // With every style used, nothing is highlighted. + click_text_held(&ctx, &mut app, " Select All Unused", egui::Modifiers::NONE, items); + assert_eq!(highlighted_now(&mut app, &ctx, kind), Vec::::new()); + } +} + +/// With several styles highlighted, the panel menu's Duplicate copies each of them in one undo +/// step, highlights the copies and scrolls the first copy's row into view. +#[test] +fn panel_menu_duplicate_copies_every_highlighted_style() { + for kind in [Kind::Char, Kind::Para] { + let what = kind.what(); + let (mut app, _) = several_app(); + let ctx = egui::Context::default(); + let items = |app: &mut VectorcraftApp, ui: &mut egui::Ui| menu(app, ui, kind); + click_text_held(&ctx, &mut app, " Select All Unused", egui::Modifiers::NONE, items); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["A", "C", "D"], "{what} Styles"); + let before = styles(&mut app, kind); + let undo = app.session.doc().unwrap().history.undo.len(); + click_text_held(&ctx, &mut app, &format!(" Duplicate {what} Style"), egui::Modifiers::NONE, items); + let names: Vec = styles(&mut app, kind).into_iter().skip(1).map(|s| s.0).collect(); + assert_eq!(names, ["A", "B", "C", "D", "A copy", "C copy", "D copy"], "{what} Styles: A, C and D are duplicated"); + assert_eq!(app.session.doc().unwrap().history.undo.len(), undo + 1, "{what} Styles: one undo step"); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["A copy", "C copy", "D copy"], "{what} Styles: the copies are highlighted"); + assert_eq!(pstate::>(&ctx, kind.scroll_key()).as_deref(), Some("A copy"), "{what} Styles: the first copy scrolls into view"); + app.run("edit.undo", json!({})).unwrap(); + assert_eq!(styles(&mut app, kind), before); + } +} + +/// The panel and its menu list the styles, and count their uses, once per document version: more +/// frames of an unchanged document list nothing again, and an edit lists them again. +#[test] +fn the_styles_are_listed_once_per_document_version() { + for kind in [Kind::Char, Kind::Para] { + let what = kind.what(); + let (mut app, _) = several_app(); + let ctx = egui::Context::default(); + let draw = |app: &mut VectorcraftApp, ui: &mut egui::Ui| { + show(app, ui, kind); + menu(app, ui, kind); + }; + let listed = || LISTED.with(|n| n.get()); + frame_events(&ctx, &mut app, vec![], draw); + let first = listed(); + for _ in 0..4 { + frame_events(&ctx, &mut app, vec![], draw); + } + assert_eq!(listed(), first, "{what} Styles: unchanged frames list nothing again"); + app.run(&format!("{}.new", kind.prefix()), json!({"name": "E", "attrs": {}})).unwrap(); + frame_events(&ctx, &mut app, vec![], draw); + assert_eq!(listed(), first + 1, "{what} Styles: an edit lists the styles again"); + assert_eq!(styles(&mut app, kind).last().map(|s| s.0.as_str()), Some("E"), "{what} Styles: the new style is listed"); + } +} + +/// A row dragged from the highlighted styles carries all of them: dropped on Create New Style it +/// duplicates each in one undo step and highlights the copies, and dropped on Delete it deletes each +/// but the Normal style in one undo step and clears the highlight. A row from outside the highlight +/// carries only its own style; dropped on Delete it leaves the highlight as it is. +#[test] +fn dragging_a_highlighted_style_carries_every_highlighted_style() { + use egui::Modifiers; + for kind in [Kind::Char, Kind::Para] { + let what = kind.what(); + let (mut app, _) = several_app(); + let ctx = egui::Context::default(); + let rows = |app: &mut VectorcraftApp, ui: &mut egui::Ui| { + ui.set_width(280.0); + show(app, ui, kind); + }; + let names = |app: &mut VectorcraftApp| styles(app, kind).into_iter().skip(1).map(|s| s.0).collect::>(); + let undo_len = |app: &VectorcraftApp| app.session.doc().unwrap().history.undo.len(); + click_text_held(&ctx, &mut app, "A", Modifiers::NONE, rows); + click_text_held(&ctx, &mut app, "C", Modifiers::COMMAND, rows); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["A", "C"], "{what} Styles"); + + let undo = undo_len(&app); + assert!(drag_row_onto_footer(&ctx, &mut app, kind, "C", 40.0, false), "{what} Styles: New is outlined"); + assert_eq!(names(&mut app), ["A", "B", "C", "D", "A copy", "C copy"], "{what} Styles: A and C are duplicated"); + assert_eq!(undo_len(&app), undo + 1, "{what} Styles: one undo step for the copies"); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["A copy", "C copy"], "{what} Styles: the copies are highlighted"); + assert!(drag_row_onto_footer(&ctx, &mut app, kind, "B", 40.0, false), "{what} Styles: New is outlined"); + assert_eq!(names(&mut app), ["A", "B", "C", "D", "A copy", "C copy", "B copy"], "{what} Styles: only B is duplicated"); + assert_eq!(highlighted_now(&mut app, &ctx, kind), ["B copy"], "{what} Styles: the copy of B is highlighted"); + + let normal = super::super::label_or_name(&styles(&mut app, kind)[0].0, true).to_string(); + click_text_held(&ctx, &mut app, "A copy", Modifiers::NONE, rows); + click_text_held(&ctx, &mut app, "C copy", Modifiers::COMMAND, rows); + click_text_held(&ctx, &mut app, &normal, Modifiers::COMMAND, rows); + assert_eq!(highlighted_now(&mut app, &ctx, kind).len(), 3, "{what} Styles: A copy, C copy and Normal are highlighted"); + assert!(drag_row_onto_footer(&ctx, &mut app, kind, "D", 12.0, false), "{what} Styles: Delete is outlined"); + assert_eq!(names(&mut app), ["A", "B", "C", "A copy", "C copy", "B copy"], "{what} Styles: only D is deleted"); + assert_eq!(highlighted_now(&mut app, &ctx, kind).len(), 3, "{what} Styles: the highlight stays"); + let undo = undo_len(&app); + assert!(drag_row_onto_footer(&ctx, &mut app, kind, &normal, 12.0, false), "{what} Styles: Delete is outlined for the highlight"); + assert_eq!(names(&mut app), ["A", "B", "C", "B copy"], "{what} Styles: A copy and C copy are deleted, Normal stays"); + assert_eq!(undo_len(&app), undo + 1, "{what} Styles: one undo step for the deletes"); + assert_eq!(highlighted_now(&mut app, &ctx, kind), Vec::::new(), "{what} Styles: the highlight is cleared"); + } +} + /// Feed real text/shortcut events through the canvas Type routing. No focus reset or typing /// settlement here: the capture dispatch itself must close the live typing interaction. fn capture_input(ctx: &egui::Context, app: &mut VectorcraftApp, events: Vec) { diff --git a/docs/mcp.md b/docs/mcp.md index e3e7f8b1a2..e92143b410 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5020,7 +5020,11 @@ spaceBefore, spaceAfter, hyphenate, mojikumi, burasagari, direction, leadingMode touches (a caret, `start == end`, touches its paragraph). Without a range they change every paragraph of the targeted objects, as before. With a range, the character attributes of `text.setStyle` and `text.setFormat` style that range of characters. `text.tabs.get {start?}` and `paraStyle.new` / `paraStyle.redefine {id, start?}` read the -paragraph at `start`; `paraStyle.list` counts paragraphs as uses. A Return the Type tool types (or `text.editRange` +paragraph at `start`; `paraStyle.list` counts paragraphs as uses, and `charStyle.list` counts runs; both count the type in +the layers, opacity masks, symbols, graph designs, pattern tiles and the art of brushes. `charStyle.unused` and +`paraStyle.unused` (Select All Unused in the Character Styles and Paragraph Styles panel menus) list the styles with no +uses, in panel order and never the Normal style, and the panel highlights them; `charStyle.delete` and +`paraStyle.delete` take `{names}` to delete several styles in one undo step. A Return the Type tool types (or `text.editRange` inserting `\n`) continues the style of the paragraph it splits; deleting a break keeps the first paragraph's style; `text.setText` gives every paragraph the first one's attributes. Threaded text keeps each paragraph's attributes as the story re-flows (a paragraph split between frames has them in both). diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index d50a7a2de4..e6e5bd60da 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -948,6 +948,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur Type inside a group, layer, symbol instance, blend or repeat keeps its opacity, blend mode, opacity mask, Opacity & Mask Define Knockout Shape, own effects, perspective and visibility when the effects on the container outline it. Hidden type with a geometry effect of its own is left out of exports. - **Graphic styles:** styles keep opacity and blend mode, capture groups and type, apply on top with Alt, and link to the objects using them; Redefine, Break Link, Graphic Style Options, Select All Unused, Sort by Name, and Select > Same Graphic Style / Appearance Attribute. The panel has list and thumbnail views with rendered previews, merge, reorder and drag and drop, plus a Control bar Style picker; six generated style libraries save and load as `.vcstyles`. In the Graphic Styles panel, Shift-click selects a range of styles and Ctrl/Cmd-click adds or removes one. + - **Several text styles at once:** in the Character Styles and Paragraph Styles panels, Shift-click highlights a range of styles and Ctrl/Cmd-click adds or removes one, without applying them; the panel menu's Select All Unused (`charStyle.unused`, `paraStyle.unused`) highlights the styles no type uses (in the layers, opacity masks, symbols, graph designs, pattern tiles and the art of brushes), never the Normal style; Delete, the button or the menu item, deletes every highlighted style but Normal in one undo step (`charStyle.delete {names}`, `paraStyle.delete {names}`). The menu's Duplicate copies every highlighted style in one undo step and highlights the copies. A highlighted row dragged onto Create New Style or Delete carries every highlighted style: dropped on Create New Style it copies them all and highlights the copies, and dropped on Delete it deletes them all but Normal and clears the highlight; a row from outside the highlight carries only its own style. Public reference: [Character and paragraph styles](https://web.archive.org/web/20261015081534/https://helpx.adobe.com/illustrator/using/character-paragraph-styles.html). - **Neutral wording:** labels, MCP tool text, docs and packaging use neutral names, and `cargo xtask brands` (part of `cargo xtask ci`) fails on vendor names. - **Colour, type and file workflows:** Recolor Artwork (dialog with harmonies), Edit Colors, Find & Replace, Change Case, Smart Punctuation, Guides, Lock/Hide Above, Transform Each, Rasterize. The Libraries panel holds gradients and patterns: its + button adds the selection's fill or stroke gradient or pattern, a gradient or pattern swatch dragged from the Swatches panel is added, and a click paints the selection through the active Fill/Stroke proxy, a pattern bringing its definition and swatch into the document. From f4c245286ef13091704b042a06f71bab8bdc5fe4 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 21:46:56 +0700 Subject: [PATCH 037/227] =?UTF-8?q?Add-ons:=20Color=20Effects=20=E2=80=94?= =?UTF-8?q?=20live=20Vector=20Halftone=20effect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Effect › Color Effects › Vector Halftone… (addon.color.halftone, also in Object › Plug-ins › Color Effects) draws its object as the halftone dots Object › Vector Halftone makes, live: mono (one dot colour, or each dot in the art's colour under it) or CMYK screens, the five dot shapes, frequency, angle, invert and clip to the art's outline. - The screens, dots and caps move to vectorcraft_effects::addons::halftone, shared by the command (its behaviour and tests unchanged) and the effect. - The renderer samples the art (vectorcraft_render::addons::halftone) and keeps the dots by the object's content and what it reads from the document, so unchanged art isn't sampled again; past 100000 cells per screen the object draws as it is. - Expand Appearance turns the object into its dots, and the SVG, PDF, EPS and AI exporters write them as paths. - Its dialog reuses the command's fields, without Keep Original. Deferred: stochastic and radial patterns, a dot-gain curve, per-screen separation settings, type or symbols as dots. --- crates/effects/src/addons.rs | 3 + crates/effects/src/addons/halftone.rs | 489 ++++++++++++++++++++ crates/effects/src/bake.rs | 5 + crates/effects/src/catalog.rs | 1 + crates/effects/src/params.rs | 6 +- crates/engine/src/cmd/addons/color/tests.rs | 84 ++++ crates/engine/src/cmd/effectcmd.rs | 13 +- crates/engine/src/cmd/halftone.rs | 233 +--------- crates/engine/src/session/documents.rs | 7 +- crates/engine/tests/command_sweep.rs | 3 + crates/render/src/addons.rs | 5 + crates/render/src/addons/halftone.rs | 94 ++++ crates/render/src/addons/halftone/tests.rs | 111 +++++ crates/render/src/fx/bounds.rs | 5 + crates/render/src/fx/predicates.rs | 7 +- crates/render/src/fx/renderer.rs | 14 +- crates/render/src/lib.rs | 1 + crates/ui-egui/src/addons/color.rs | 4 +- crates/ui-egui/src/addons/color/tests.rs | 25 +- crates/ui-egui/src/dialogs/effect.rs | 4 + crates/ui-egui/src/dialogs/halftone.rs | 30 +- crates/ui-egui/src/i18n/bg.tsv | 3 + crates/ui-egui/src/i18n/ca.tsv | 3 + crates/ui-egui/src/i18n/cs.tsv | 3 + crates/ui-egui/src/i18n/da.tsv | 3 + crates/ui-egui/src/i18n/de.tsv | 3 + crates/ui-egui/src/i18n/el.tsv | 3 + crates/ui-egui/src/i18n/es.tsv | 3 + crates/ui-egui/src/i18n/fi.tsv | 3 + crates/ui-egui/src/i18n/fr.tsv | 3 + crates/ui-egui/src/i18n/hu.tsv | 3 + crates/ui-egui/src/i18n/id.tsv | 3 + crates/ui-egui/src/i18n/it.tsv | 3 + crates/ui-egui/src/i18n/ja.tsv | 3 + crates/ui-egui/src/i18n/ka.tsv | 3 + crates/ui-egui/src/i18n/ko.tsv | 3 + crates/ui-egui/src/i18n/nl.tsv | 3 + crates/ui-egui/src/i18n/pl.tsv | 3 + crates/ui-egui/src/i18n/pt-br.tsv | 3 + crates/ui-egui/src/i18n/ru.tsv | 3 + crates/ui-egui/src/i18n/sv.tsv | 3 + crates/ui-egui/src/i18n/tr.tsv | 3 + crates/ui-egui/src/i18n/uk.tsv | 3 + crates/ui-egui/src/i18n/vi.tsv | 3 + crates/ui-egui/src/i18n/zh-hans.tsv | 3 + crates/ui-egui/src/i18n/zh-hant.tsv | 3 + docs/mcp.md | 32 ++ docs/target-app-parity.md | 14 +- docs/ui-parity.md | 5 +- 49 files changed, 1027 insertions(+), 243 deletions(-) create mode 100644 crates/effects/src/addons/halftone.rs create mode 100644 crates/render/src/addons.rs create mode 100644 crates/render/src/addons/halftone.rs create mode 100644 crates/render/src/addons/halftone/tests.rs diff --git a/crates/effects/src/addons.rs b/crates/effects/src/addons.rs index 39e5bab973..d1ba0783d6 100644 --- a/crates/effects/src/addons.rs +++ b/crates/effects/src/addons.rs @@ -2,5 +2,8 @@ //! //! - [`color`]: Color Effects' live Exposure, Desaturate and Invert Colors, colour adjustments //! evaluated with the others ([`crate::adjust`]). +//! - [`halftone`]: Color Effects' live Vector Halftone, and the screens Object › Vector Halftone +//! builds its dots with. pub mod color; +pub mod halftone; diff --git a/crates/effects/src/addons/halftone.rs b/crates/effects/src/addons/halftone.rs new file mode 100644 index 0000000000..9b5771e7bd --- /dev/null +++ b/crates/effects/src/addons/halftone.rs @@ -0,0 +1,489 @@ +//! Vector Halftone (Color Effects): the art as vector dots, lines or shapes sized by its tone, as a +//! live effect (Effect › Color Effects › Vector Halftone…, [`HALFTONE`]) and for Object › Vector +//! Halftone, which builds its paths with the same screens ([`Halftone::layers`]). +//! +//! The art is sampled from pixels ([`Samples`], drawn by the renderer) once per halftone cell on a +//! grid turned by the screen angle; each cell gets a shape whose area follows the tone there. Mono +//! screens follow lightness in one colour (or, with `fromArt`, each dot takes the art's colour under +//! it); CMYK screens follow the art's ink amounts (as CMYK output separates it), one screen per ink at +//! the classic angles, multiplied over each other. The dots can be clipped to the art's outline as +//! real geometry. +//! +//! The renderer, the exporters ([`crate::bake_document`]) and Expand Appearance draw an object with +//! the effect as [`halftone_art`]: the renderer samples the art, so it registers how ([`set_art`]). + +use std::collections::BTreeMap; +use std::sync::{Arc, OnceLock}; + +use serde_json::{Value, json}; +use vectorcraft_doc::color::{BlendMode, Color, Paint}; +use vectorcraft_doc::{Appearance, Document, Node, NodeId}; +use vectorcraft_geom::hit::fill_contains; +use vectorcraft_geom::{Affine, BezPath, FillRule, PathData, Point, Rect, shapes}; +use vectorcraft_pathops::{self as po, BoolOp}; + +use crate::catalog::{EffectInfo, Lengths}; +use crate::util::{flag, num, text}; + +/// Vector Halftone, the live effect. +pub const HALFTONE: &str = "addon.color.halftone"; + +/// Most halftone cells per screen. +pub const MAX_CELLS: f64 = 100_000.0; +/// Most pixels the tone is sampled from. +pub const MAX_SAMPLE_PIXELS: f64 = 16.0e6; +/// Cells lighter than this get no dot. +const MIN_TONE: f64 = 0.01; +/// Levels per channel the art's colours are rounded to with `fromArt` (one path per colour). +const COLOR_LEVELS: f64 = 15.0; + +/// The effect's catalogue entry. +pub(crate) fn catalog() -> Vec { + vec![EffectInfo { + id: HALFTONE, + label: "Vector Halftone…", + menu: &["Effect", "Color Effects"], + params: "{shape: \"circle\"|\"ellipse\"|\"square\"|\"diamond\"|\"line\" (circle), frequency: lines per inch 1..300 (20), angle: deg (45; CMYK: the black screen's, cyan −30°, magenta +30°, yellow −45° from it), mode: \"mono\"|\"cmyk\" (mono), color: mono dot colour (\"#000000\"), fromArt: bool (false; mono: each dot takes the art's colour under it), invert: bool (false; dots for light tones), clip: bool (true; the dots clipped to the art's outline)} draws the object as vector halftone dots sized by its tone, as object.vectorHalftone makes them (CMYK screens multiply); the object is sampled as drawn with its other effects; at most 100000 cells per screen, past that the object draws as it is", + defaults: json!({"shape": "circle", "frequency": 20.0, "angle": 45.0, "mode": "mono", "color": "#000000", "fromArt": false, "invert": false, "clip": true}), + raster: false, + lengths: Lengths::default(), + }] +} + +/// Does `n` carry a visible Vector Halftone effect? +pub fn has_halftone(n: &Node) -> bool { + n.appearance.effects.iter().any(|e| e.visible && e.id == HALFTONE) +} + +/// The shape of a halftone dot. +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum DotShape { + Circle, + Ellipse, + Square, + Diamond, + Line, +} + +impl DotShape { + pub fn parse(s: &str) -> Option { + Some(match s.to_ascii_lowercase().as_str() { + "circle" | "round" | "dot" => DotShape::Circle, + "ellipse" => DotShape::Ellipse, + "square" => DotShape::Square, + "diamond" => DotShape::Diamond, + "line" | "lines" => DotShape::Line, + _ => return None, + }) + } + + /// The shape for tone `t` (0..1) in a cell of side `s` centred on the origin, the screen + /// running along x. + fn path(self, t: f64, s: f64) -> PathData { + let square = |side: f64| shapes::rectangle(Rect::from_center_size(Point::ZERO, (side, side))); + match self { + DotShape::Circle => { + let r = s * (t / std::f64::consts::PI).sqrt(); + shapes::ellipse(Rect::from_center_size(Point::ZERO, (2.0 * r, 2.0 * r))) + } + DotShape::Ellipse => { + let r = s * (t / std::f64::consts::PI).sqrt(); + shapes::ellipse(Rect::from_center_size(Point::ZERO, (2.6 * r, 2.0 * r / 1.3))) + } + DotShape::Square => square(s * t.sqrt()), + DotShape::Diamond => square(s * t.sqrt()).transformed(Affine::rotate(std::f64::consts::FRAC_PI_4)), + // Cells along a row join into a line as thick as the tone. + DotShape::Line => shapes::rectangle(Rect::from_center_size(Point::ZERO, (s * 1.001, s * t))), + } + } +} + +/// One screen: its ink and angle, and how to read its tone from a sampled pixel. +struct Screen { + paint: Color, + angle: f64, + /// Index into the sampled pixel (unused for mono, CMYK inks for cmyk). + channel: usize, +} + +/// The sampled art: `w`×`h` pixels of 4 bytes over `region` at `scale` px/pt. +pub struct Samples { + px: Vec, + w: usize, + h: usize, + region: Rect, + scale: f64, + /// Mono: tones are 1 − lightness of RGBA pixels drawn on white; CMYK: ink amounts. + mono: bool, + invert: bool, +} + +impl Samples { + /// Pixels `px` (`w`×`h`, 4 bytes each) over `region` at `scale` px/pt; `None` when there are + /// fewer bytes than that. + pub fn new(px: Vec, (w, h): (usize, usize), region: Rect, scale: f64, mono: bool, invert: bool) -> Option { + (px.len() >= w.checked_mul(h)?.checked_mul(4)?).then_some(Self { px, w, h, region, scale, mono, invert }) + } + + /// The index of the pixel at document point `p`, `None` outside the samples. + fn index(&self, p: Point) -> Option { + let x = ((p.x - self.region.x0) * self.scale).floor(); + let y = ((p.y - self.region.y0) * self.scale).floor(); + (x >= 0.0 && y >= 0.0 && (x as usize) < self.w && (y as usize) < self.h).then(|| (y as usize * self.w + x as usize) * 4) + } + + fn byte(&self, i: usize, k: usize) -> f64 { + self.px.get(i + k).copied().unwrap_or(0) as f64 / 255.0 + } + + /// The tone (0..1) of `channel` at document point `p`. + fn tone(&self, p: Point, channel: usize) -> f64 { + let Some(i) = self.index(p) else { return if self.invert { 1.0 } else { 0.0 } }; + let t = + if self.mono { 1.0 - (0.2126 * self.byte(i, 0) + 0.7152 * self.byte(i, 1) + 0.0722 * self.byte(i, 2)) } else { self.byte(i, channel) }; + if self.invert { 1.0 - t } else { t } + } + + /// The 3 × 3 sample points of a cell of side `s` at `c` turned by `rot`. + fn cell_points(c: Point, s: f64, rot: Affine) -> impl Iterator { + (0..9).map(move |k| c + (rot * Point::new((f64::from(k / 3) - 1.0) * s / 3.0, (f64::from(k % 3) - 1.0) * s / 3.0)).to_vec2()) + } + + /// The mean tone over a cell of side `s` at `c` turned by `rot` (3 × 3 samples). + fn cell_tone(&self, c: Point, s: f64, rot: Affine, channel: usize) -> f64 { + Self::cell_points(c, s, rot).map(|p| self.tone(p, channel)).sum::() / 9.0 + } + + /// The mean colour over a cell (as [`Self::cell_tone`]; white outside the samples), each channel + /// rounded to [`COLOR_LEVELS`] steps. + fn cell_color(&self, c: Point, s: f64, rot: Affine) -> [u8; 3] { + let mut sum = [0.0; 3]; + for p in Self::cell_points(c, s, rot) { + for (k, v) in sum.iter_mut().enumerate() { + *v += self.index(p).map_or(1.0, |i| self.byte(i, k)); + } + } + sum.map(|v| (v / 9.0 * COLOR_LEVELS).round().clamp(0.0, COLOR_LEVELS) as u8) + } +} + +/// A halftone's settings. +#[derive(Clone, Debug, PartialEq)] +pub struct Halftone { + pub shape: DotShape, + /// Lines per inch. + pub frequency: f64, + /// Degrees. + pub angle: f64, + /// One screen in `color` (else four CMYK screens). + pub mono: bool, + pub color: Color, + /// Mono: each dot in the art's colour under it instead of `color`. + pub from_art: bool, + /// Dots for light tones. + pub invert: bool, + /// The dots clipped to the art's outline. + pub clip: bool, +} + +impl Halftone { + /// The settings of `n`'s last visible Vector Halftone effect, its values brought into range. + pub fn of(n: &Node) -> Option { + let e = n.appearance.effects.iter().rev().find(|e| e.visible && e.id == HALFTONE)?; + Some(Self::from_params(&e.params)) + } + + fn from_params(p: &Value) -> Self { + Self { + shape: DotShape::parse(text(p, "shape", "circle")).unwrap_or(DotShape::Circle), + frequency: num(p, "frequency", 20.0).clamp(1.0, 300.0), + angle: num(p, "angle", 45.0), + mono: !text(p, "mode", "mono").eq_ignore_ascii_case("cmyk"), + color: crate::raster::color_param(p, Color::BLACK), + from_art: flag(p, "fromArt", false), + invert: flag(p, "invert", false), + clip: flag(p, "clip", true), + } + } + + /// The side of a cell in points. + pub fn cell(&self) -> f64 { + 72.0 / self.frequency + } + + /// Where the art over `bounds` is sampled and at how many pixels per point: about four pixels per + /// cell, at most [`MAX_SAMPLE_PIXELS`]. `None` when `bounds` have no area or the grid turned by + /// the screen angle would have more than [`MAX_CELLS`] cells. + pub fn plan(&self, bounds: Rect) -> Option<(Rect, f64)> { + let cell = self.cell(); + if !(bounds.width() > 0.0 && bounds.height() > 0.0 && bounds.area().is_finite()) { + return None; + } + // The grid turned by the screen angle covers at most (w + h)² / 2. + if (bounds.width() + bounds.height()).powi(2) / 2.0 / (cell * cell) > MAX_CELLS { + return None; + } + let scale = (4.0 / cell).min((MAX_SAMPLE_PIXELS / bounds.area()).sqrt()).clamp(0.01, 16.0); + Some((bounds.inflate(cell, cell), scale)) + } + + /// The screens, bottom to top. + fn screens(&self) -> Vec { + let angle = self.angle; + if self.mono { + return vec![Screen { paint: self.color, angle, channel: 0 }]; + } + // Bottom to top: yellow, magenta, cyan, black. + vec![ + Screen { paint: Color::cmyk(0.0, 0.0, 1.0, 0.0), angle: angle - 45.0, channel: 2 }, + Screen { paint: Color::cmyk(0.0, 1.0, 0.0, 0.0), angle: angle + 30.0, channel: 1 }, + Screen { paint: Color::cmyk(1.0, 0.0, 0.0, 0.0), angle: angle - 30.0, channel: 0 }, + Screen { paint: Color::cmyk(0.0, 0.0, 0.0, 1.0), angle, channel: 3 }, + ] + } + + /// The dots of the art `samples` show over `bounds`, one path per ink (per colour with + /// `fromArt`) in paint order, each clipped to `outline` when given, and how many dots there are. + pub fn layers(&self, samples: &Samples, bounds: Rect, outline: Option<&(BezPath, FillRule)>) -> (Vec<(PathData, Color)>, usize) { + let cell = self.cell(); + let mut layers = vec![]; + let mut count = 0; + for sc in self.screens() { + let dots = screen_dots(samples, bounds, cell, &sc, self.shape); + count += dots.len(); + if self.mono && self.from_art { + let rot = Affine::rotate(sc.angle.to_radians()); + let mut by_color: BTreeMap<[u8; 3], Vec> = BTreeMap::new(); + for (dot, c) in dots { + by_color.entry(samples.cell_color(c, cell, rot)).or_default().push(dot); + } + for (rgb, dots) in by_color { + let [r, g, b] = rgb.map(|v| (f64::from(v) / COLOR_LEVELS) as f32); + layers.push((merged(dots, outline), Color::rgb(r, g, b))); + } + } else { + layers.push((merged(dots.into_iter().map(|d| d.0).collect(), outline), sc.paint)); + } + } + layers.retain(|(path, _)| !path.is_empty()); + (layers, count) + } +} + +/// The dots of one screen over `bounds`, each with its cell's centre. +fn screen_dots(samples: &Samples, bounds: Rect, cell: f64, sc: &Screen, shape: DotShape) -> Vec<(PathData, Point)> { + let rot = Affine::rotate(sc.angle.to_radians()); + let inv = rot.inverse(); + // The grid covers the bounds in screen space. + let corners = + [bounds.origin(), Point::new(bounds.x1, bounds.y0), Point::new(bounds.x1, bounds.y1), Point::new(bounds.x0, bounds.y1)].map(|q| inv * q); + let (mut lo, mut hi) = (corners[0], corners[0]); + for q in &corners[1..] { + lo = Point::new(lo.x.min(q.x), lo.y.min(q.y)); + hi = Point::new(hi.x.max(q.x), hi.y.max(q.y)); + } + let (i0, i1) = ((lo.x / cell).floor() as i64 - 1, (hi.x / cell).ceil() as i64 + 1); + let (j0, j1) = ((lo.y / cell).floor() as i64 - 1, (hi.y / cell).ceil() as i64 + 1); + let near = bounds.inflate(cell, cell); + let mut dots = vec![]; + for j in j0..=j1 { + for i in i0..=i1 { + let c = rot * Point::new((i as f64 + 0.5) * cell, (j as f64 + 0.5) * cell); + if !near.contains(c) { + continue; + } + let t = samples.cell_tone(c, cell, rot, sc.channel).clamp(0.0, 1.0); + if t < MIN_TONE { + continue; + } + let place = Affine::translate(c.to_vec2()) * rot; + dots.push((shape.path(t, cell).transformed(place), c)); + } + } + dots +} + +/// The outline Clip to Art clips the dots of `nodes` to: their clip outline taken together. +pub fn art_outline(nodes: &[Node]) -> Option<(BezPath, FillRule)> { + crate::clip_outline(&Node::group(NodeId(u64::MAX), nodes.iter().cloned().map(Arc::new).collect())) +} + +/// `dots` as one path, clipped to `outline` when given (dots wholly inside it need no clipping). +fn merged(dots: Vec, outline: Option<&(BezPath, FillRule)>) -> PathData { + let (mut inside, mut edge) = (vec![], vec![]); + for dot in dots { + let whole = match (outline, dot.control_bounds()) { + (Some((bp, rule)), Some(db)) => [db.origin(), Point::new(db.x1, db.y0), Point::new(db.x1, db.y1), Point::new(db.x0, db.y1)] + .iter() + .all(|q| fill_contains(bp, *rule, *q)), + _ => true, + }; + if whole { inside.push(dot) } else { edge.push(dot) } + } + let mut subs: Vec<_> = inside.into_iter().flat_map(|p| p.subpaths).collect(); + if let Some((bp, rule)) = outline + && !edge.is_empty() + { + let edge = PathData::new(edge.into_iter().flat_map(|p| p.subpaths).collect()); + let clipped = po::boolean(&edge, FillRule::NonZero, &PathData::from_bezpath(bp), *rule, BoolOp::Intersect); + subs.extend(clipped.subpaths); + } else { + subs.extend(edge.into_iter().flat_map(|p| p.subpaths)); + } + PathData::new(subs) +} + +/// The paths of `layers` ([`Halftone::layers`]), each filled with its ink and ids from `id`; CMYK +/// screens (`mono` false) multiply over each other. +pub fn dot_nodes(layers: Vec<(PathData, Color)>, mono: bool, id: &mut dyn FnMut() -> NodeId) -> Vec> { + layers + .into_iter() + .map(|(path, ink)| { + let mut n = Node::path(id(), path, Appearance::basic(Paint::solid(ink), Paint::None, 0.0)); + if !mono { + n.blend = BlendMode::Multiply; + } + Arc::new(n) + }) + .collect() +} + +/// `n` split for its halftone: the object the effect samples (`n` visible, without its Vector +/// Halftone effects, transparency, mask and link) and an empty group that takes over its identity, +/// transparency, mask and link, for the dots. +pub fn split(n: &Node) -> (Node, Node) { + let mut object = n.clone(); + object.appearance.effects.retain(|e| e.id != HALFTONE); + object.visible = true; + let mut g = Node::group(n.id, vec![]); + (g.visible, g.locked) = (n.visible, n.locked); + g.name = object.name.take(); + g.opacity = std::mem::replace(&mut object.opacity, 1.0); + g.blend = std::mem::take(&mut object.blend); + g.isolate = std::mem::take(&mut object.isolate); + g.extras_mut().mask = object.extras_mut().mask.take(); + g.extras_mut().attrs = object.extras_mut().attrs.take(); + (object, g) +} + +/// How far the dots of `n`'s halftone reach past the bounds of the object it samples: nothing when +/// they are clipped to its outline, else up to two cells (a dot's centre lies within a cell of the +/// bounds, and the dot within another). +pub fn reach(n: &Node) -> f64 { + Halftone::of(n).filter(|h| !h.clip).map_or(0.0, |h| 2.0 * h.cell()) +} + +/// Makes the art of an object with a visible Vector Halftone effect ([`halftone_art`]). +pub type ArtHook = fn(&Document, &Node) -> Option; + +static ART: OnceLock = OnceLock::new(); + +/// Register how the art of an object with Vector Halftone is made (the renderer samples it, above +/// this crate; the first registration stays). +pub fn set_art(f: ArtHook) { + // Already set: the same renderer, registered by another session. + let _ = ART.set(f); +} + +/// The art of `n` with a visible Vector Halftone effect in `d`: the group [`split`] makes, holding +/// the dot paths ([`dot_nodes`], ids `n`'s). `None` without the effect, while nothing is registered +/// ([`set_art`]), and when the art has no area or would take too many cells ([`Halftone::plan`]). +pub fn halftone_art(d: &Document, n: &Node) -> Option { + if !has_halftone(n) { + return None; + } + ART.get()?(d, n) +} + +#[cfg(test)] +mod tests { + use super::*; + use vectorcraft_doc::Effect; + + /// A black square's samples: `side` points of black from (10, 10), white around it. + fn black_square(side: f64, h: &Halftone) -> (Samples, Rect) { + let b = Rect::new(10.0, 10.0, 10.0 + side, 10.0 + side); + let (region, scale) = h.plan(b).unwrap(); + let (w, hh) = ((region.width() * scale).round() as usize, (region.height() * scale).round() as usize); + let mut px = vec![255u8; w * hh * 4]; + for y in 0..hh { + for x in 0..w { + let p = Point::new(region.x0 + (x as f64 + 0.5) / scale, region.y0 + (y as f64 + 0.5) / scale); + if b.contains(p) { + px[(y * w + x) * 4..][..3].copy_from_slice(&[200, 0, 0]); + } + } + } + (Samples::new(px, (w, hh), region, scale, true, h.invert).unwrap(), b) + } + + fn effect(params: Value) -> Node { + let mut n = Node::path(NodeId(7), shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 10.0)), Appearance::default()); + n.appearance.effects.push(Effect { id: HALFTONE.into(), params, visible: true }); + n + } + + #[test] + fn the_effect_is_in_color_effects_with_its_defaults() { + let info = crate::effect_info(HALFTONE).unwrap(); + assert_eq!(info.menu, ["Effect", "Color Effects"]); + assert!(!crate::is_geometry(HALFTONE) && !crate::is_raster(HALFTONE) && !crate::is_adjustment(HALFTONE)); + let h = Halftone::of(&effect(info.defaults)).unwrap(); + assert_eq!((h.shape, h.frequency, h.angle, h.mono, h.from_art, h.invert, h.clip), (DotShape::Circle, 20.0, 45.0, true, false, false, true)); + assert_eq!(h.color, Color::BLACK); + } + + #[test] + fn values_out_of_range_are_brought_in() { + let h = Halftone::of(&effect(json!({"frequency": 1e308, "angle": "NaN", "shape": 7, "mode": "CMYK", "color": "nope"}))).unwrap(); + assert_eq!((h.frequency, h.angle, h.shape, h.mono, h.color), (300.0, 45.0, DotShape::Circle, false, Color::BLACK)); + assert_eq!(Halftone::of(&effect(json!({"frequency": -5}))).unwrap().frequency, 1.0); + let mut hidden = effect(json!({})); + hidden.appearance.effects[0].visible = false; + assert!(Halftone::of(&hidden).is_none() && !has_halftone(&hidden)); + } + + #[test] + fn dots_follow_the_tone_and_the_settings() { + let h = Halftone::of(&effect(json!({"frequency": 18}))).unwrap(); + let (s, b) = black_square(60.0, &h); + let (layers, dots) = h.layers(&s, b, None); + assert_eq!(layers.len(), 1); + assert!((150..=320).contains(&dots), "{dots}"); + // Inverted, the dark square gets small dots and the white around it full ones. + let inv = Halftone { invert: true, ..h.clone() }; + let (s2, _) = black_square(60.0, &inv); + assert!(inv.layers(&s2, b, None).1 > dots); + // The colour of the art under each dot. + let art = Halftone { from_art: true, ..h.clone() }; + let (layers, _) = art.layers(&s, b, None); + assert!(layers.iter().any(|(_, c)| c.to_hex() == "#cc0000"), "{:?}", layers.iter().map(|l| l.1.to_hex()).collect::>()); + // CMYK screens: one layer per ink with dots (red: magenta and yellow). + let cmyk = Halftone { mono: false, ..h }; + let one = Samples::new([0u8, 255, 255, 0].repeat(400), (20, 20), Rect::new(0.0, 0.0, 20.0, 20.0), 1.0, false, false).unwrap(); + assert_eq!(cmyk.layers(&one, Rect::new(2.0, 2.0, 18.0, 18.0), None).0.len(), 2); + } + + #[test] + fn the_caps_refuse_too_many_cells() { + let h = Halftone::of(&effect(json!({"frequency": 300}))).unwrap(); + assert!(h.plan(Rect::new(0.0, 0.0, 10_000.0, 10_000.0)).is_none()); + assert!(h.plan(Rect::new(0.0, 0.0, f64::INFINITY, 10.0)).is_none()); + assert!(h.plan(Rect::new(0.0, 0.0, 0.0, 10.0)).is_none()); + assert!(h.plan(Rect::new(0.0, 0.0, 40.0, 40.0)).is_some()); + assert!(Samples::new(vec![0; 3], (1, 1), Rect::new(0.0, 0.0, 1.0, 1.0), 1.0, true, false).is_none()); + assert!(Samples::new(vec![], (usize::MAX, 2), Rect::new(0.0, 0.0, 1.0, 1.0), 1.0, true, false).is_none()); + } + + #[test] + fn the_group_takes_the_objects_identity() { + let mut n = effect(json!({"clip": false, "frequency": 36})); + n.opacity = 0.5; + n.name = Some("art".into()); + let (object, g) = split(&n); + assert!(!has_halftone(&object)); + assert_eq!((object.opacity, g.opacity, g.id, g.name.as_deref()), (1.0, 0.5, n.id, Some("art"))); + assert_eq!(reach(&n), 4.0); + assert_eq!(reach(&effect(json!({}))), 0.0); + } +} diff --git a/crates/effects/src/bake.rs b/crates/effects/src/bake.rs index c92947ac3c..e713e0ffa3 100644 --- a/crates/effects/src/bake.rs +++ b/crates/effects/src/bake.rs @@ -52,6 +52,7 @@ pub fn needs_bake(n: &Node) -> bool { || crate::has_solid(n) || has_adjustment(n) || has_crop_marks(n) + || crate::addons::halftone::has_halftone(n) || has_pathfinder(n) || has_own_paint(n) || has_geometry(&n.appearance.effects) @@ -104,6 +105,10 @@ fn bake_node(d: &mut Document, n: &Node) -> Option { if let Some(m) = crop_marks_art(n) { return Some(bake_pieces(d, m)); } + // Vector Halftone: the object as its dots. + if let Some(m) = crate::addons::halftone::halftone_art(d, n) { + return Some(bake_pieces(d, m)); + } if let Some(m) = crate::revolve_art(n).or_else(|| crate::solid_art(n)) { let m = evaluate_container(Some(d), &m).unwrap_or(m); return Some(bake_pieces(d, m)); diff --git a/crates/effects/src/catalog.rs b/crates/effects/src/catalog.rs index 32e611c62a..5fdef797c7 100644 --- a/crates/effects/src/catalog.rs +++ b/crates/effects/src/catalog.rs @@ -792,6 +792,7 @@ pub fn effect_catalog() -> Vec { } } v.extend(crate::addons::color::catalog()); + v.extend(crate::addons::halftone::catalog()); v.push(g(TRAP, "Trap…", PATHFINDER, trap::EFFECT_PARAMS_DOC, trap::effect_defaults())); v.push(g( CROP_MARKS, diff --git a/crates/effects/src/params.rs b/crates/effects/src/params.rs index d64ac7b780..c8cea82590 100644 --- a/crates/effects/src/params.rs +++ b/crates/effects/src/params.rs @@ -118,14 +118,16 @@ pub fn is_raster(id: &str) -> bool { || PIXEL_EFFECTS.contains(&id) } -/// Does `id` change geometry? (Crop Marks adds art of its own instead, [`crop_marks_art`]; colour -/// adjustments recolour, [`adjust`].) Plug-in effects do, installed or not (a missing plug-in +/// Does `id` change geometry? (Crop Marks and Vector Halftone add art of their own instead, +/// [`crop_marks_art`] and [`crate::addons::halftone::halftone_art`]; colour adjustments recolour, +/// [`adjust`].) Plug-in effects do, installed or not (a missing plug-in /// leaves the geometry as it is). pub fn is_geometry(id: &str) -> bool { !is_raster(id) && !is_pathfinder(id) && !is_adjustment(id) && id != CROP_MARKS + && id != crate::addons::halftone::HALFTONE && !is_three_d(id) && (catalog_index().contains_key(id) || vectorcraft_plugins::effect::plugin_id(id).is_some()) } diff --git a/crates/engine/src/cmd/addons/color/tests.rs b/crates/engine/src/cmd/addons/color/tests.rs index 29034c51ed..5094c2019f 100644 --- a/crates/engine/src/cmd/addons/color/tests.rs +++ b/crates/engine/src/cmd/addons/color/tests.rs @@ -154,3 +154,87 @@ fn select_by_color_kind_finds_spot_colours_effects_and_image_models() { assert!(s.execute("addon.color.select", &json!({"kind": "pantone"})).is_err()); assert!(s.execute("addon.color.select", &json!({})).is_err()); } + +/// Vector Halftone, the live effect. +const HALFTONE: &str = "addon.color.halftone"; + +/// The dots in group `g`: each path's geometry, ink and blend mode. +fn dots(g: &vectorcraft_doc::Node) -> Vec<(vectorcraft_geom::PathData, String, vectorcraft_color::BlendMode)> { + let ink = |c: &vectorcraft_doc::Node| c.appearance.fill_paint().color().unwrap().to_hex(); + g.children().unwrap().iter().map(|c| (c.path_data().unwrap().clone(), ink(c), c.blend)).collect() +} + +/// `format` as `document.export` writes the active document. +fn exported(s: &mut Session, format: &str) -> Vec { + let v = s.execute("document.export", &json!({"format": format})).unwrap(); + vectorcraft_format::base64_decode(v["dataBase64"].as_str().unwrap()).unwrap() +} + +/// How many subpaths the path data of `svg` starts. +fn svg_moves(svg: &[u8]) -> usize { + let svg = String::from_utf8_lossy(svg); + svg.split(" d=\"").skip(1).map(|d| d.split('"').next().unwrap_or("").matches(['M', 'm']).count()).sum() +} + +#[test] +fn expand_appearance_gives_the_dots_object_vector_halftone_makes() { + for params in [ + json!({"frequency": 18}), + json!({"frequency": 12, "mode": "cmyk", "shape": "square", "angle": 15}), + json!({"shape": "line", "invert": true, "clip": false}), + json!({"shape": "ellipse", "color": "#336699", "angle": -30}), + ] { + let (mut live, id) = red_rect(); + live.execute("effect.apply", &json!({"effect": HALFTONE, "params": params})).unwrap(); + assert_eq!(fill_hex(&live, id), "#ff0000", "the effect leaves the object as it is"); + live.execute("effect.expandAppearance", &json!({})).unwrap(); + let expanded = live.doc().unwrap().doc.node(id).cloned().unwrap(); + assert!(expanded.appearance.effects.is_empty()); + let (mut made, _) = red_rect(); + let r = made.execute("object.vectorHalftone", ¶ms).unwrap(); + let g = made.doc().unwrap().doc.node(NodeId(r["id"].as_u64().unwrap())).cloned().unwrap(); + assert!(!dots(&g).is_empty(), "{params}"); + assert_eq!(dots(&expanded), dots(&g), "{params}"); + // Ids of their own. + let ids: std::collections::HashSet<_> = expanded.children().unwrap().iter().map(|c| c.id).chain([id]).collect(); + assert_eq!(ids.len(), expanded.children().unwrap().len() + 1); + } +} + +#[test] +fn exports_write_the_dots_as_paths() { + let (mut s, _) = red_rect(); + let plain: Vec = ["pdf", "eps", "ai"].map(|f| exported(&mut s, f).len()).to_vec(); + s.execute("effect.apply", &json!({"effect": HALFTONE, "params": {"frequency": 18}})).unwrap(); + // The exporters' copy of the document has the dots in the object's place. + let baked = vectorcraft_render::effects::bake_document(&s.doc().unwrap().doc).unwrap(); + let mut paths = 0; + baked.walk(|n| { + assert!(n.appearance.effects.iter().all(|e| e.id != HALFTONE)); + paths += n.path_data().map_or(0, |p| p.subpaths.len()); + }); + assert!(paths > 100, "{paths} subpaths"); + // SVG: path data of a subpath per dot. + let moves = svg_moves(&exported(&mut s, "svg")); + assert!(moves > 100, "{moves} subpaths"); + // PDF, EPS and AI: the dots' paths make each file larger. + for (f, plain) in ["pdf", "eps", "ai"].into_iter().zip(plain) { + let with = exported(&mut s, f).len(); + assert!(with > plain + 1000, "{f}: {with} bytes, {plain} without the effect"); + } +} + +#[test] +fn a_halftone_past_the_caps_leaves_the_object_as_it_is() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let id = NodeId(s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 9000, "height": 9000})).unwrap()["id"].as_u64().unwrap()); + s.execute("effect.apply", &json!({"effect": HALFTONE, "params": {"frequency": 300}})).unwrap(); + // Drawn as it is, exported and expanded without dots and without a panic. + pixel(&s); + assert!(svg_moves(&exported(&mut s, "svg")) < 5); + let r = s.execute("effect.expandAppearance", &json!({})); + assert!(!matches!(r, Err(crate::EngineError::Internal { .. })), "{r:?}"); + let n = s.doc().unwrap().doc.node(id).cloned().unwrap(); + assert!(n.children().is_none_or(|c| c.len() < 5), "no dots"); +} diff --git a/crates/engine/src/cmd/effectcmd.rs b/crates/engine/src/cmd/effectcmd.rs index d7c584d9dd..bdd252da4f 100644 --- a/crates/engine/src/cmd/effectcmd.rs +++ b/crates/engine/src/cmd/effectcmd.rs @@ -69,7 +69,7 @@ pub fn specs() -> Vec { "Expand Appearance", ["Object"], None, - "{ids?|id?: [..], target?} turn each object's appearance into objects: every fill and stroke becomes an object of its own (a stroke stays a stroke, with its weight, dashes, arrowheads and width profile, on its own copy of the path, which object.expand or object.path.outlineStroke outline; brushed strokes become their brush art) grouped in paint order under the object's id and transparency, geometry effects are baked, raster effects become an embedded image (shadows and outer glows below the art; blur, feather and inner glow replace it; an object whose only raster effect is its own Rasterize becomes the image object.rasterize makes with the effect's options), type with effects or fills of its own is outlined; Crop Marks become a group of the object and its marks; a group's or layer's own fills and strokes become objects among its members, which are expanded too. An outlined frame of threaded text leaves its thread with the text it shows, and a frame kept as type in a group stays in its thread. Hidden fills, strokes and effects are dropped. Enabled when a selected or targeted object's appearance isn't basic (`ids` then pick which objects) → {ids, warning? (an image in the art couldn't be decoded, as object.rasterize says)}", + "{ids?|id?: [..], target?} turn each object's appearance into objects: every fill and stroke becomes an object of its own (a stroke stays a stroke, with its weight, dashes, arrowheads and width profile, on its own copy of the path, which object.expand or object.path.outlineStroke outline; brushed strokes become their brush art) grouped in paint order under the object's id and transparency, geometry effects are baked, raster effects become an embedded image (shadows and outer glows below the art; blur, feather and inner glow replace it; an object whose only raster effect is its own Rasterize becomes the image object.rasterize makes with the effect's options), type with effects or fills of its own is outlined; Crop Marks become a group of the object and its marks; Vector Halftone (addon.color.halftone) becomes a group of its dot paths, one per ink; a group's or layer's own fills and strokes become objects among its members, which are expanded too. An outlined frame of threaded text leaves its thread with the text it shows, and a frame kept as type in a group stays in its thread. Hidden fills, strokes and effects are dropped. Enabled when a selected or targeted object's appearance isn't basic (`ids` then pick which objects) → {ids, warning? (an image in the art couldn't be decoded, as object.rasterize says)}", can_expand, expand_appearance ), @@ -646,6 +646,17 @@ fn expanded_node(d: &mut Document, mut n: Node, brushes: &[vectorcraft_brush::Br out.extend(expanded.into_iter().map(|(id, at)| (id, at + 1))); return Some(m); } + // Vector Halftone: the object becomes its dots, a group (with `id`) of paths with ids of their own. + if let Some(mut m) = vectorcraft_render::addons::halftone::art(d, &n) { + let mut seen = std::collections::HashSet::from([id]); + for c in m.children_mut().into_iter().flatten() { + effects::fresh_ids(d, Arc::make_mut(c), &mut seen); + } + if !listed_n { + out.push((id, 0)); + } + return Some(m); + } let image = raster_image(d, &n); let mut v = n.clone(); rasterfx::strip_raster(&mut v, false); diff --git a/crates/engine/src/cmd/halftone.rs b/crates/engine/src/cmd/halftone.rs index b97d92ee44..a205adc46c 100644 --- a/crates/engine/src/cmd/halftone.rs +++ b/crates/engine/src/cmd/halftone.rs @@ -1,24 +1,16 @@ //! Object → Vector Halftone: the selected art (vectors, type, images) as vector dots, lines or -//! shapes sized by its tone. +//! shapes sized by its tone, as one undo step. //! -//! The art is rendered offscreen and sampled once per halftone cell on a grid turned by the screen -//! angle; each cell gets a shape whose area follows the tone there. Mono screens follow lightness -//! in one colour; CMYK screens follow the art's ink amounts (as CMYK output separates it), one -//! screen per ink at the classic angles, multiplied over each other. The dots can be clipped to the -//! art's outline as real geometry. - -use std::sync::Arc; +//! The screens, dots and caps are Color Effects' Vector Halftone's +//! ([`vectorcraft_render::effects::addons::halftone`]), which draws the same dots live; the art is +//! sampled as [`vectorcraft_render::addons::halftone::sample`] draws it. use serde_json::{Value, json}; -use vectorcraft_color::{BlendMode, Color, Paint}; -use vectorcraft_doc::{Appearance, Node, NodeId}; -use vectorcraft_geom::hit::fill_contains; -use vectorcraft_geom::{Affine, BezPath, FillRule, PathData, Point, Rect, shapes}; -use vectorcraft_pathops as po; -use vectorcraft_pathops::BoolOp; +use vectorcraft_color::Color; +use vectorcraft_doc::Node; +use vectorcraft_render::effects::addons::halftone::{DotShape, Halftone, art_outline, dot_nodes}; use super::edit::selected_roots; -use super::menucmds::isolated_doc; use super::{CommandSpec, EngineError, Result, Session, bad, bool_or, cmd, color_value, f64_or, has_selection, str_param}; pub fn specs() -> Vec { @@ -33,102 +25,6 @@ pub fn specs() -> Vec { )] } -/// Most halftone cells per screen. -const MAX_CELLS: f64 = 100_000.0; -/// Most pixels the tone is sampled from. -const MAX_SAMPLE_PIXELS: f64 = 16.0e6; -/// Cells lighter than this get no dot. -const MIN_TONE: f64 = 0.01; - -#[derive(Clone, Copy, Debug, PartialEq)] -enum DotShape { - Circle, - Ellipse, - Square, - Diamond, - Line, -} - -impl DotShape { - fn parse(s: &str) -> Option { - Some(match s.to_ascii_lowercase().as_str() { - "circle" | "round" | "dot" => DotShape::Circle, - "ellipse" => DotShape::Ellipse, - "square" => DotShape::Square, - "diamond" => DotShape::Diamond, - "line" | "lines" => DotShape::Line, - _ => return None, - }) - } - - /// The shape for tone `t` (0..1) in a cell of side `s` centred on the origin, the screen - /// running along x. - fn path(self, t: f64, s: f64) -> PathData { - let square = |side: f64| shapes::rectangle(Rect::from_center_size(Point::ZERO, (side, side))); - match self { - DotShape::Circle => { - let r = s * (t / std::f64::consts::PI).sqrt(); - shapes::ellipse(Rect::from_center_size(Point::ZERO, (2.0 * r, 2.0 * r))) - } - DotShape::Ellipse => { - let r = s * (t / std::f64::consts::PI).sqrt(); - shapes::ellipse(Rect::from_center_size(Point::ZERO, (2.6 * r, 2.0 * r / 1.3))) - } - DotShape::Square => square(s * t.sqrt()), - DotShape::Diamond => square(s * t.sqrt()).transformed(Affine::rotate(std::f64::consts::FRAC_PI_4)), - // Cells along a row join into a line as thick as the tone. - DotShape::Line => shapes::rectangle(Rect::from_center_size(Point::ZERO, (s * 1.001, s * t))), - } - } -} - -/// One screen: its ink and angle, and how to read its tone from a sampled pixel. -struct Screen { - paint: Color, - angle: f64, - /// Index into the sampled pixel (RGBA lightness for mono, CMYK inks for cmyk). - channel: usize, -} - -/// The sampled art: `w`×`h` pixels of 4 bytes over `region` at `scale` px/pt. -struct Samples { - px: Vec, - w: usize, - h: usize, - region: Rect, - scale: f64, - /// Mono: tones are 1 − lightness of RGBA pixels; CMYK: ink amounts. - mono: bool, - invert: bool, -} - -impl Samples { - /// The tone (0..1) of `channel` at document point `p`. - fn tone(&self, p: Point, channel: usize) -> f64 { - let x = ((p.x - self.region.x0) * self.scale).floor(); - let y = ((p.y - self.region.y0) * self.scale).floor(); - if !(x >= 0.0 && y >= 0.0 && (x as usize) < self.w && (y as usize) < self.h) { - return if self.invert { 1.0 } else { 0.0 }; - } - let i = (y as usize * self.w + x as usize) * 4; - let byte = |k: usize| self.px.get(i + k).copied().unwrap_or(0) as f64 / 255.0; - let t = if self.mono { 1.0 - (0.2126 * byte(0) + 0.7152 * byte(1) + 0.0722 * byte(2)) } else { byte(channel) }; - if self.invert { 1.0 - t } else { t } - } - - /// The mean tone over a cell of side `s` at `c` turned by `rot` (3 × 3 samples). - fn cell_tone(&self, c: Point, s: f64, rot: Affine, channel: usize) -> f64 { - let mut sum = 0.0; - for i in 0..3 { - for j in 0..3 { - let off = Point::new((i as f64 - 1.0) * s / 3.0, (j as f64 - 1.0) * s / 3.0); - sum += self.tone(c + (rot * off).to_vec2(), channel); - } - } - sum / 9.0 - } -} - fn halftone(s: &mut Session, p: &Value) -> Result { const C: &str = "object.vectorHalftone"; let shape = match str_param(p, "shape") { @@ -153,7 +49,7 @@ fn halftone(s: &mut Session, p: &Value) -> Result { None => Color::BLACK, }; let (invert, clip, keep) = (bool_or(p, "invert", false), bool_or(p, "clip", true), bool_or(p, "keepOriginal", false)); - let cell = 72.0 / frequency; + let ht = Halftone { shape, frequency, angle, mono, color, from_art: false, invert, clip }; let roots = selected_roots(s)?; let st = s.doc()?; @@ -161,10 +57,7 @@ fn halftone(s: &mut Session, p: &Value) -> Result { if b.width() <= 0.0 || b.height() <= 0.0 || !b.area().is_finite() { return Err(bad(C, "the selection has no area")); } - // The grid turned by the screen angle covers at most (w + h)² / 2. - if (b.width() + b.height()).powi(2) / 2.0 / (cell * cell) > MAX_CELLS { - return Err(bad(C, "too many dots for this size: lower the frequency")); - } + let (region, scale) = ht.plan(b).ok_or_else(|| bad(C, "too many dots for this size: lower the frequency"))?; let nodes: Vec = roots .iter() .filter_map(|id| st.doc.node(*id).cloned()) @@ -173,64 +66,18 @@ fn halftone(s: &mut Session, p: &Value) -> Result { n }) .collect(); - let outline = if clip { - vectorcraft_render::effects::clip_outline(&Node::group(NodeId(u64::MAX), nodes.iter().cloned().map(Arc::new).collect())) - } else { - None - }; - // Sample the art at about four pixels per cell. - let scale = (4.0 / cell).min((MAX_SAMPLE_PIXELS / b.area()).sqrt()).clamp(0.01, 16.0); - let region = b.inflate(cell, cell); - let tmp = isolated_doc(&st.doc, nodes); - let mut r = vectorcraft_render::Renderer::new(); - let (w, h) = vectorcraft_render::region_pixels(region, scale); - let (w, h) = (w as usize, h as usize); + let outline = if clip { art_outline(&nodes) } else { None }; let failed = vectorcraft_render::decode_failures(); - let px = if mono { - r.render_region(&tmp, region, scale, true).pixels - } else { - r.render_region_inks(&tmp, region, scale, &vectorcraft_render::RenderOptions { skip_templates: true, ..Default::default() }) - }; + let samples = vectorcraft_render::addons::halftone::sample(&st.doc, nodes, region, scale, mono, invert); let warning = super::rasterfx::undecoded_warning(failed); - if px.len() < w * h * 4 { - return Err(EngineError::Other("the art could not be sampled".into())); - } - let samples = Samples { px, w, h, region, scale, mono, invert }; - let screens: Vec = if mono { - vec![Screen { paint: color, angle, channel: 0 }] - } else { - // Bottom to top: yellow, magenta, cyan, black. - vec![ - Screen { paint: Color::cmyk(0.0, 0.0, 1.0, 0.0), angle: angle - 45.0, channel: 2 }, - Screen { paint: Color::cmyk(0.0, 1.0, 0.0, 0.0), angle: angle + 30.0, channel: 1 }, - Screen { paint: Color::cmyk(1.0, 0.0, 0.0, 0.0), angle: angle - 30.0, channel: 0 }, - Screen { paint: Color::cmyk(0.0, 0.0, 0.0, 1.0), angle, channel: 3 }, - ] - }; - let mut layers = vec![]; - let mut dots = 0; - for sc in &screens { - let (path, n) = screen_dots(&samples, b, cell, sc, shape, outline.as_ref()); - dots += n; - if !path.is_empty() { - layers.push((path, sc.paint)); - } - } + let samples = samples.ok_or_else(|| EngineError::Other("the art could not be sampled".into()))?; + let (layers, dots) = ht.layers(&samples, b, outline.as_ref()); if layers.is_empty() { return Err(EngineError::Other("the art is too light for any dots".into())); } let top = *roots.last().ok_or_else(|| bad(C, "nothing selected"))?; let id = s.edit("Vector Halftone", |d, sel| { - let children = layers - .into_iter() - .map(|(path, ink)| { - let mut n = Node::path(d.alloc_id(), path, Appearance::basic(Paint::solid(ink), Paint::None, 0.0)); - if !mono { - n.blend = BlendMode::Multiply; - } - Arc::new(n) - }) - .collect(); + let children = dot_nodes(layers, mono, &mut || d.alloc_id()); let gid = d.alloc_id(); let mut g = Node::group(gid, children); g.name = Some("Vector Halftone".into()); @@ -249,55 +96,3 @@ fn halftone(s: &mut Session, p: &Value) -> Result { } Ok(out) } - -/// The dots of one screen over `bounds` as one path, with their count. -fn screen_dots(samples: &Samples, bounds: Rect, cell: f64, sc: &Screen, shape: DotShape, outline: Option<&(BezPath, FillRule)>) -> (PathData, usize) { - let rot = Affine::rotate(sc.angle.to_radians()); - let inv = rot.inverse(); - // The grid covers the bounds in screen space. - let corners = - [bounds.origin(), Point::new(bounds.x1, bounds.y0), Point::new(bounds.x1, bounds.y1), Point::new(bounds.x0, bounds.y1)].map(|q| inv * q); - let (mut lo, mut hi) = (corners[0], corners[0]); - for q in &corners[1..] { - lo = Point::new(lo.x.min(q.x), lo.y.min(q.y)); - hi = Point::new(hi.x.max(q.x), hi.y.max(q.y)); - } - let (i0, i1) = ((lo.x / cell).floor() as i64 - 1, (hi.x / cell).ceil() as i64 + 1); - let (j0, j1) = ((lo.y / cell).floor() as i64 - 1, (hi.y / cell).ceil() as i64 + 1); - let near = bounds.inflate(cell, cell); - let (mut inside, mut edge) = (vec![], vec![]); - for j in j0..=j1 { - for i in i0..=i1 { - let c = rot * Point::new((i as f64 + 0.5) * cell, (j as f64 + 0.5) * cell); - if !near.contains(c) { - continue; - } - let t = samples.cell_tone(c, cell, rot, sc.channel).clamp(0.0, 1.0); - if t < MIN_TONE { - continue; - } - let place = Affine::translate(c.to_vec2()) * rot; - let dot = shape.path(t, cell).transformed(place); - // Dots wholly inside the outline need no clipping. - let whole = match (outline, dot.control_bounds()) { - (Some((bp, rule)), Some(db)) => [db.origin(), Point::new(db.x1, db.y0), Point::new(db.x1, db.y1), Point::new(db.x0, db.y1)] - .iter() - .all(|q| fill_contains(bp, *rule, *q)), - _ => true, - }; - if whole { inside.push(dot) } else { edge.push(dot) } - } - } - let count = inside.len() + edge.len(); - let mut subs: Vec<_> = inside.into_iter().flat_map(|p| p.subpaths).collect(); - if let Some((bp, rule)) = outline - && !edge.is_empty() - { - let edge = PathData::new(edge.into_iter().flat_map(|p| p.subpaths).collect()); - let clipped = po::boolean(&edge, FillRule::NonZero, &PathData::from_bezpath(bp), *rule, BoolOp::Intersect); - subs.extend(clipped.subpaths); - } else { - subs.extend(edge.into_iter().flat_map(|p| p.subpaths)); - } - (PathData::new(subs), count) -} diff --git a/crates/engine/src/session/documents.rs b/crates/engine/src/session/documents.rs index 472ce8ab2f..a331144d5b 100644 --- a/crates/engine/src/session/documents.rs +++ b/crates/engine/src/session/documents.rs @@ -5,8 +5,9 @@ use super::{ impl Session { /// A session with no document open, the default preferences and the Selection tool. It also - /// installs the hooks the document crate calls back into: the loader and file reader of placed - /// documents, and where an image's effects draw its fills and strokes, for clicks. + /// installs the hooks the document and effects crates call back into: the loader and file reader + /// of placed documents, where an image's effects draw its fills and strokes, for clicks, and how + /// Vector Halftone's dots are sampled, for exports. pub fn new() -> Self { // Placed documents are read by the native format's loader. vectorcraft_doc::placed_document::set_loader(cmd::place::document::read_document); @@ -19,6 +20,8 @@ impl Session { }); // Clicks find an image's own fills and strokes where their effects draw them. vectorcraft_doc::hit::set_image_paint(vectorcraft_render::effects::image_paint); + // Exports bake Vector Halftone into the dots the renderer samples. + vectorcraft_render::effects::addons::halftone::set_art(vectorcraft_render::addons::halftone::art); // OpenType SVG glyphs are drawn as the SVG importer reads their documents. vectorcraft_text::set_svg_glyph_reader(vectorcraft_svg::glyph_art); Self { diff --git a/crates/engine/tests/command_sweep.rs b/crates/engine/tests/command_sweep.rs index 2e6d9a678b..bf28fa057c 100644 --- a/crates/engine/tests/command_sweep.rs +++ b/crates/engine/tests/command_sweep.rs @@ -403,6 +403,9 @@ fn structured_junk() { ("effect.apply", json!({"effect": "distort.diffuseGlow", "params": {"graininess": "x", "glowAmount": 1e308, "clearAmount": -1e308}})), ("effect.apply", json!({"effect": "distort.glass", "params": {"distortion": 1e308, "smoothness": "NaN", "texture": 3, "scaling": -1}})), ("effect.apply", json!({"effect": "distort.oceanRipple", "params": {"rippleSize": [1], "rippleMagnitude": 1e308}})), + ("effect.apply", json!({"effect": "addon.color.halftone", "params": {"frequency": 1e308, "angle": -1e308, "shape": "star", "mode": "rgb"}})), + ("effect.apply", json!({"effect": "addon.color.halftone", "params": {"frequency": 300, "invert": true, "clip": false, "fromArt": true}})), + ("effect.apply", json!({"effect": "addon.color.halftone", "params": {"frequency": -1e308, "mode": "cmyk", "color": "#123456", "target": 3}})), ("effect.apply", json!({"effect": "no.such.effect"})), ("effect.remove", json!({"index": 99})), ("effect.setParams", json!({"index": 0, "params": null})), diff --git a/crates/render/src/addons.rs b/crates/render/src/addons.rs new file mode 100644 index 0000000000..8ab1d2b822 --- /dev/null +++ b/crates/render/src/addons.rs @@ -0,0 +1,5 @@ +//! The renderer's part of VectorCraft's built-in add-ons, one module per add-on. +//! +//! - [`halftone`]: Color Effects' Vector Halftone, which samples the art it turns into dots. + +pub mod halftone; diff --git a/crates/render/src/addons/halftone.rs b/crates/render/src/addons/halftone.rs new file mode 100644 index 0000000000..9b1cfe7091 --- /dev/null +++ b/crates/render/src/addons/halftone.rs @@ -0,0 +1,94 @@ +//! Color Effects' Vector Halftone: the art sampled as the dots read it ([`sample`], which Object › +//! Vector Halftone uses too), and the art of an object with the live effect ([`art`]), which the +//! renderer draws, and the exporters and Expand Appearance write, in its place. +//! +//! The art is kept by the object's content and what it reads from the document (its symbols, +//! patterns, fonts and colour settings, as the live cache finds them): drawing, measuring or +//! exporting an object that hasn't changed takes the dots made before instead of sampling it again. + +use std::sync::{Arc, Mutex, PoisonError}; + +use vectorcraft_doc::{Document, LayerColor, Node, NodeId}; +use vectorcraft_effects::addons::halftone::{Halftone, Samples, art_outline, dot_nodes, split}; +use vectorcraft_geom::Rect; + +use crate::live::Found; +use crate::{RenderOptions, Renderer, region_pixels}; + +/// How many halftone arts are kept, the most recently used first. +const KEPT: usize = 8; + +/// A halftone art kept: the object it was made for, what that read from the document, and the art +/// (`None`: the object draws as it is). +type Kept = (Node, Found, Option); + +static CACHE: Mutex> = Mutex::new(Vec::new()); + +#[cfg(test)] +thread_local! { + /// How many times this thread sampled art for the live effect. + pub(crate) static SAMPLED: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// `nodes` from `doc` drawn over `region` at `scale` pixels per point, as the dots read them: on +/// white as RGBA for a mono screen, as CMYK ink amounts for CMYK screens (`mono` false). `None` +/// when the pixels couldn't be made. +pub fn sample(doc: &Document, nodes: Vec, region: Rect, scale: f64, mono: bool, invert: bool) -> Option { + let mut tmp = doc.clone(); + let mut layer = Node::layer(NodeId(u64::MAX), "halftone", LayerColor::Preset(0)); + if let Some(ch) = layer.children_mut() { + *ch = nodes.into_iter().map(Arc::new).collect(); + } + tmp.layers = vec![Arc::new(layer)]; + let mut r = Renderer::new(); + let (w, h) = region_pixels(region, scale); + let px = if mono { + r.render_region(&tmp, region, scale, true).pixels + } else { + r.render_region_inks(&tmp, region, scale, &RenderOptions { skip_templates: true, ..Default::default() }) + }; + Samples::new(px, (w as usize, h as usize), region, scale, mono, invert) +} + +/// The art of `n`, an object with a visible Vector Halftone effect, in `doc` +/// ([`vectorcraft_effects::addons::halftone::halftone_art`]): `n`'s dots as the effect's last +/// visible settings make them from `n` drawn without the effect, over its painted bounds, in a +/// group that takes `n`'s place. `None` without the effect, or when the art has no area or would +/// take too many cells: `n` then draws as it is. +pub fn art(doc: &Document, n: &Node) -> Option { + let ht = Halftone::of(n)?; + let found = Renderer::new().live_found(doc, &Arc::new(n.clone())); + let mut cache = CACHE.lock().unwrap_or_else(PoisonError::into_inner); + if let Some(at) = cache.iter().position(|(node, was, _)| was.0 == found.0 && node == n) { + let kept = cache.remove(at); + let art = kept.2.clone(); + cache.insert(0, kept); + return art; + } + // Sampling draws other objects that may have the effect: not under the lock. + drop(cache); + let art = make(doc, n, &ht); + let mut cache = CACHE.lock().unwrap_or_else(PoisonError::into_inner); + cache.insert(0, (n.clone(), found, art.clone())); + cache.truncate(KEPT); + art +} + +/// [`art`] made: `n` sampled and its dots built. +fn make(doc: &Document, n: &Node, ht: &Halftone) -> Option { + #[cfg(test)] + SAMPLED.with(|c| c.set(c.get() + 1)); + let (object, mut group) = split(n); + let bounds = crate::drawn_bounds(doc, &object)?; + let (region, scale) = ht.plan(bounds)?; + let outline = if ht.clip { art_outline(std::slice::from_ref(&object)) } else { None }; + let samples = sample(doc, vec![object], region, scale, ht.mono, ht.invert)?; + let (layers, _) = ht.layers(&samples, bounds, outline.as_ref()); + if let Some(ch) = group.children_mut() { + *ch = dot_nodes(layers, ht.mono, &mut || n.id); + } + Some(group) +} + +#[cfg(test)] +mod tests; diff --git a/crates/render/src/addons/halftone/tests.rs b/crates/render/src/addons/halftone/tests.rs new file mode 100644 index 0000000000..0a6f4309ba --- /dev/null +++ b/crates/render/src/addons/halftone/tests.rs @@ -0,0 +1,111 @@ +//! Vector Halftone's live art: drawn as dots, following its settings, kept while the art doesn't +//! change, and refused past the caps. + +use serde_json::{Value, json}; +use vectorcraft_color::{Color, Paint}; +use vectorcraft_doc::{Appearance, Document, Effect, Node}; +use vectorcraft_effects::addons::halftone::HALFTONE; +use vectorcraft_geom::{Affine, Rect, shapes}; + +use super::{SAMPLED, art}; +use crate::{RenderOptions, Renderer}; + +/// A document with a mid-grey square of side `side` at (`x`, 10) carrying Vector Halftone with +/// `params`, and the square. +fn doc(x: f64, side: f64, params: Value) -> (Document, Node) { + let mut d = Document::new(200.0, 200.0); + let grey = Paint::solid(Color::rgb(0.5, 0.5, 0.5)); + let mut n = Node::path(d.alloc_id(), shapes::rectangle(Rect::new(x, 10.0, x + side, 10.0 + side)), Appearance::basic(grey, Paint::None, 0.0)); + n.appearance.effects.push(Effect { id: HALFTONE.into(), params, visible: true }); + let layer = d.layers[0].id; + d.insert(Some(layer), 0, n).unwrap(); + let n = (*d.layers[0].children().unwrap()[0]).clone(); + (d, n) +} + +fn sampled() -> usize { + SAMPLED.with(std::cell::Cell::get) +} + +/// The square's pixels (from (x, 10), `side` wide), drawn on white. +fn square_pixels(d: &Document, x: f64, side: f64) -> Vec<[u8; 4]> { + let r = Renderer::new().render(d, 200, 200, Affine::IDENTITY, &RenderOptions { background: Some([255; 4]), ..Default::default() }); + let (x0, y0, s) = (x as u32, 10, side as u32); + (y0..y0 + s).flat_map(|y| (x0..x0 + s).map(move |x| (x, y))).map(|(x, y)| r.pixel(x, y)).collect() +} + +#[test] +fn the_effect_draws_the_grey_as_black_dots_on_white() { + // 6 lpi: 12 pt cells, each half black for the mid-grey. + let (d, _) = doc(10.0, 60.0, json!({"frequency": 6})); + let px = square_pixels(&d, 10.0, 60.0); + let share = |f: &dyn Fn(&[u8; 4]) -> bool| px.iter().filter(|p| f(p)).count() as f64 / px.len() as f64; + let (black, white) = (share(&|p| p[0] < 40), share(&|p| p[0] > 215)); + assert!(black > 0.25 && white > 0.25, "black {black}, white {white}"); + // Without the effect, the square is grey all over. + let mut plain = d.clone(); + let id = d.layers[0].children().unwrap()[0].id; + plain.node_mut(id).unwrap().appearance.effects.clear(); + assert!(square_pixels(&plain, 10.0, 60.0).iter().all(|p| (100..=160).contains(&p[0]))); +} + +#[test] +fn the_settings_change_the_dots() { + let look = |params: Value| square_pixels(&doc(20.0, 60.0, params).0, 20.0, 60.0); + let base = look(json!({"frequency": 18})); + for other in [ + json!({"frequency": 9}), + json!({"frequency": 18, "angle": 0}), + json!({"frequency": 18, "shape": "square"}), + json!({"frequency": 18, "invert": true}), + json!({"frequency": 18, "mode": "cmyk"}), + ] { + assert_ne!(look(other.clone()), base, "{other}"); + } + // A red dot colour paints red dots. + let red = look(json!({"frequency": 18, "color": "#ff0000"})); + assert!(red.iter().any(|p| p[0] > 215 && p[1] < 40 && p[2] < 40)); + // The art's own colour under each dot. + let (d, _) = doc(20.0, 60.0, json!({"frequency": 18, "fromArt": true})); + assert!(square_pixels(&d, 20.0, 60.0).iter().any(|p| (100..=160).contains(&p[0]) && p[0] == p[1])); +} + +#[test] +fn unchanged_art_is_not_sampled_again() { + let (d, n) = doc(30.0, 50.0, json!({"frequency": 12})); + let before = sampled(); + let first = art(&d, &n).unwrap(); + assert_eq!(sampled(), before + 1); + // Drawn again, in a copy of the object or of the document, by another renderer: the same dots. + assert_eq!(art(&d.clone(), &n.clone()), Some(first.clone())); + square_pixels(&d, 30.0, 50.0); + square_pixels(&d, 30.0, 50.0); + assert_eq!(sampled(), before + 1); + // Changed settings, or a moved object, are sampled again. + let mut changed = n.clone(); + changed.appearance.effects[0].params = json!({"frequency": 13}); + assert_ne!(art(&d, &changed), Some(first)); + assert_eq!(sampled(), before + 2); + let (moved, m) = doc(31.0, 50.0, json!({"frequency": 12})); + art(&moved, &m).unwrap(); + assert_eq!(sampled(), before + 3); +} + +#[test] +fn too_many_cells_draw_the_object_as_it_is() { + let (d, n) = doc(40.0, 10_000.0, json!({"frequency": 300})); + assert!(art(&d, &n).is_none()); + // Drawn without dots, and without a panic. + assert!(square_pixels(&d, 40.0, 100.0).iter().all(|p| (100..=160).contains(&p[0]))); + let (d, n) = doc(40.0, 0.0, json!({})); + assert!(art(&d, &n).is_none(), "no area"); +} + +#[test] +fn unclipped_dots_reach_past_the_object() { + let (d, n) = doc(50.0, 40.0, json!({"frequency": 9, "invert": true, "clip": false})); + let b = crate::effect_bounds(&d.symbol_boxes(), &n).unwrap(); + let dots = art(&d, &n).unwrap().visual_bounds().unwrap(); + assert!(b.x0 <= dots.x0 && b.y0 <= dots.y0 && b.x1 >= dots.x1 && b.y1 >= dots.y1, "{b:?} holds {dots:?}"); + assert!(dots.x0 < 50.0, "the inverted white around the object gets dots: {dots:?}"); +} diff --git a/crates/render/src/fx/bounds.rs b/crates/render/src/fx/bounds.rs index 41c9eca2b3..725a62f92b 100644 --- a/crates/render/src/fx/bounds.rs +++ b/crates/render/src/fx/bounds.rs @@ -249,6 +249,11 @@ fn cull_bounds_in(symbols: &SymbolBoxes, n: &Node, after_reshape: bool) -> Optio match &n.kind { // The object and its crop marks. _ if effects::has_crop_marks(n) => effects::crop_marks_art(n).and_then(|art| inner(&art)), + // The object Vector Halftone samples, and as far as its dots reach past it. + _ if effects::addons::halftone::has_halftone(n) => { + let reach = effects::addons::halftone::reach(n); + inner(&effects::addons::halftone::split(n).0).map(|b| b.inflate(reach, reach)) + } // The evaluated art (its fills, strokes and geometry effects) and the raster effects' reach. _ if effects::has_container_appearance(n) => { let art = effects::evaluate_container(Some(symbols.document()), n); diff --git a/crates/render/src/fx/predicates.rs b/crates/render/src/fx/predicates.rs index f54d996a9f..7fc85b71a2 100644 --- a/crates/render/src/fx/predicates.rs +++ b/crates/render/src/fx/predicates.rs @@ -29,6 +29,7 @@ pub(crate) fn has_object_fx(n: &Node) -> bool { || effects::has_transform_art(n) || effects::has_container_appearance(n) || effects::has_crop_marks(n) + || effects::addons::halftone::has_halftone(n) || effects::has_adjustment(n) || effects::has_revolve(n) || effects::has_solid(n) @@ -51,8 +52,9 @@ pub(super) fn evaluates_live(n: &Node) -> bool { /// Can the art [`Renderer::fx_art`] makes for `n` change while `n` stays the same, other than /// through live objects it evaluates? It can when `n` holds type (laid out in the fonts installed), -/// a symbol instance (made from its symbol's art), or an object with a 3D effect or a color -/// adjustment (shaded or recolored through the color settings), in it or in the opacity masks of +/// a symbol instance (made from its symbol's art), an object with a 3D effect or a color +/// adjustment (shaded or recolored through the color settings), or one with Vector Halftone (its +/// dots sampled from everything it draws), in it or in the opacity masks of /// the objects in it. pub(super) fn reads_outside(n: &Node) -> bool { let mut reads = false; @@ -61,6 +63,7 @@ pub(super) fn reads_outside(n: &Node) -> bool { || effects::has_revolve(c) || effects::has_solid(c) || effects::has_adjustment(c) + || effects::addons::halftone::has_halftone(c) || c.extras().mask.as_ref().is_some_and(|m| reads_outside(&m.art)) }); reads diff --git a/crates/render/src/fx/renderer.rs b/crates/render/src/fx/renderer.rs index 53a17b25db..b053f3120c 100644 --- a/crates/render/src/fx/renderer.rs +++ b/crates/render/src/fx/renderer.rs @@ -370,8 +370,13 @@ impl Renderer { let kept = cache && self.fx_arts.get(&(Arc::as_ptr(a) as usize), self.stamp).is_some_and(|e| Arc::ptr_eq(&e.1, &art)); let outer = self.made_again; self.made_again = outer || !kept; - // With Crop Marks, the object inside the art paints its own raster effects. - let rfx = if effects::has_crop_marks(a) { vec![] } else { effects::raster_effects(&a.appearance.effects) }; + // With Crop Marks, the object inside the art paints its own raster effects; Vector + // Halftone samples them with the object. + let rfx = if effects::has_crop_marks(a) || effects::addons::halftone::has_halftone(a) { + vec![] + } else { + effects::raster_effects(&a.appearance.effects) + }; match cull_bounds(f.symbols, &art) { Some(reach) if !f.opts.outline && !rfx.is_empty() => { // Feather, Inner Glow and Rasterize with Create Clipping Mask clip to the art's outline. @@ -426,6 +431,7 @@ impl Renderer { }; let container = is_container(a); let art = match effects::crop_marks_art(a) + .or_else(|| crate::addons::halftone::art(doc, a)) .or_else(|| effects::revolve_art(a)) .or_else(|| effects::solid_art(a)) .or_else(|| effects::reshape(Some(doc), a, symbol.as_ref())) @@ -436,7 +442,9 @@ impl Renderer { None => effects::outline_art(Some(doc), a, symbol.as_ref()).unwrap_or_else(|| Node::group(a.id, vec![])), }; let art = if effects::has_revolve(a) || effects::has_solid(a) { effects::evaluate_container(Some(doc), &art).unwrap_or(art) } else { art }; - let mut art = self.adjusted_art(art, effects::color_map(&a.appearance.effects).as_ref()); + // Vector Halftone samples the object with its colour adjustments: its dots keep their inks. + let outer = if effects::addons::halftone::has_halftone(a) { None } else { effects::color_map(&a.appearance.effects) }; + let mut art = self.adjusted_art(art, outer.as_ref()); // A path's geometry effects still apply when it is drawn. let path = matches!(art.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }); art.appearance.effects.retain(|e| path && effects::is_geometry(&e.id)); diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index 7de2aa0ab2..9343d1c2f9 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -6,6 +6,7 @@ //! gradients, images and text (via `vectorcraft-text` glyph outlines). #![forbid(unsafe_code)] +pub mod addons; mod brush_fx; mod changed; mod dither; diff --git a/crates/ui-egui/src/addons/color.rs b/crates/ui-egui/src/addons/color.rs index 7c27f5af2b..e338137ce1 100644 --- a/crates/ui-egui/src/addons/color.rs +++ b/crates/ui-egui/src/addons/color.rs @@ -1,7 +1,8 @@ //! Color Effects' panel and submenu (Object › Plug-ins › Color Effects). The panel picks a colour //! adjustment and its values, then adds it to the selection as a live effect or applies it as a //! filter, into the colours themselves (`addon.color.filter`). The submenu applies the add-on's -//! live effects (Effect › Color Effects has them too) and opens the panel. +//! live effects, Vector Halftone among them (Effect › Color Effects has them too), and opens the +//! panel. use egui::Ui; use serde_json::{Map, Value, json}; @@ -75,6 +76,7 @@ pub fn menu() -> Vec { Item::Cmd("Exposure…", "effect.dialog", json!({ "effect": "addon.color.exposure" })), Item::Cmd("Desaturate", "effect.apply", json!({ "effect": "addon.color.desaturate" })), Item::Cmd("Invert Colors", "effect.apply", json!({ "effect": "addon.color.invert" })), + Item::Cmd("Vector Halftone…", "effect.dialog", json!({ "effect": "addon.color.halftone" })), Item::Sep, Item::Sub( "Select by Color Kind", diff --git a/crates/ui-egui/src/addons/color/tests.rs b/crates/ui-egui/src/addons/color/tests.rs index e05cacbfbd..a44f1d9857 100644 --- a/crates/ui-egui/src/addons/color/tests.rs +++ b/crates/ui-egui/src/addons/color/tests.rs @@ -22,7 +22,7 @@ fn the_menus_list_the_effects_and_open_the_panel() { let at = |path: &[&str], label: &str| entries.iter().find(|e| e.path == path && e.label == label); let plugins = ["Object", "Plug-ins", "Color Effects"]; let item = at(&plugins, "Color Effects Panel").expect("listed"); - for label in ["Exposure…", "Desaturate", "Invert Colors"] { + for label in ["Exposure…", "Desaturate", "Invert Colors", "Vector Halftone…"] { assert!(at(&plugins, label).is_some(), "Object › Plug-ins › Color Effects › {label}"); assert!(at(&["Effect", "Color Effects"], label).is_some(), "Effect › Color Effects › {label}"); } @@ -59,3 +59,26 @@ fn the_panel_shows_the_values_and_its_buttons() { app.run("select.none", json!({})).unwrap(); assert!(painted_text(&mut app, show).contains("No selection")); } + +#[test] +fn the_halftone_effect_dialog_has_the_command_fields_and_edits_the_effect() { + let mut app = app(); + let text = |app: &mut VectorcraftApp| painted_text(app, |app, ui| crate::dialogs::show(app, ui.ctx())); + app.run("effect.dialog", json!({"effect": "addon.color.halftone"})).unwrap(); + let shown = text(&mut app); + for s in ["Vector Halftone", "Shape", "Frequency", "Angle", "Screens", "Dot Color from Art", "Color", "Invert", "Clip to Art", "Preview"] { + assert!(shown.lines().any(|l| l == s), "{s} in {shown}"); + } + assert!(!shown.lines().any(|l| l == "Keep Original"), "the effect keeps its object"); + assert!(app.session.in_interaction(), "the preview runs"); + // The art's colours instead of one: no colour field. + app.ui.dialog.as_mut().unwrap().fields.insert("fromArt".into(), json!(true)); + assert!(!text(&mut app).lines().any(|l| l == "Color")); + crate::dialogs::confirm(&mut app).unwrap(); + let st = app.session.active().unwrap(); + let fx = st.doc.node(st.selection.objects[0]).unwrap().appearance.effects.clone(); + assert_eq!((fx.len(), fx[0].id.as_str(), &fx[0].params["fromArt"]), (1, "addon.color.halftone", &json!(true))); + // The Appearance panel reopens it with its values. + app.run("effect.dialog", json!({"effect": "addon.color.halftone", "index": 0})).unwrap(); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["fromArt"], json!(true)); +} diff --git a/crates/ui-egui/src/dialogs/effect.rs b/crates/ui-egui/src/dialogs/effect.rs index 9e00f0927b..d54fe82962 100644 --- a/crates/ui-egui/src/dialogs/effect.rs +++ b/crates/ui-egui/src/dialogs/effect.rs @@ -163,6 +163,10 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { Some(plugin) => form::schema_fields(app, ui, d, plugin.manifest()), // The Color Effects add-on's take the plain form of their parameters. None if vectorcraft_effects::is_adjustment(&id) && !vectorcraft_effects::addons::color::is_color_effect(&id) => adjust_fields(ui, d), + None if id == vectorcraft_effects::addons::halftone::HALFTONE => { + super::halftone::screen_fields(ui, d); + values_changed(d) + } None if id == GLASS => glass_fields(app, ui, d, GLASS), None if id == TEXTURIZER => glass_fields(app, ui, d, TEXTURIZER), None if id == TRANSFORM => transform_fields(ui, d, app.session.general_unit()), diff --git a/crates/ui-egui/src/dialogs/halftone.rs b/crates/ui-egui/src/dialogs/halftone.rs index 02a1364bfe..653b16fc9e 100644 --- a/crates/ui-egui/src/dialogs/halftone.rs +++ b/crates/ui-egui/src/dialogs/halftone.rs @@ -3,7 +3,8 @@ //! the preview as one undo step (`object.vectorHalftone`). //! //! Fields: `shape`, `frequency`, `angle`, `mode`, `color`, `invert`, `clip`, `keepOriginal` (the -//! command's parameters) and `preview`. +//! command's parameters) and `preview`. The live effect's dialog shows the same fields but Keep +//! Original ([`screen_fields`]). use serde_json::{Value, json}; use vectorcraft_color::Color; @@ -29,6 +30,17 @@ pub fn fields() -> Value { } fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { + screen_fields(ui, d); + form::check(ui, d, "keepOriginal", tl!("Keep Original")); + let p = form::params(d); + form::preview(app, ui, d, "Vector Halftone", CMD, p); + false +} + +/// The fields Object › Vector Halftone and the live effect (Effect › Color Effects › Vector +/// Halftone…) share: the dot shape, the screen frequency and angle, mono or CMYK screens, the dot +/// colour (or, with the effect's `fromArt`, the art's), Invert and Clip to Art. +pub(super) fn screen_fields(ui: &mut egui::Ui, d: &mut Dialog) { let shapes = [("circle", tl!("Circle")), ("ellipse", tl!("Ellipse")), ("square", tl!("Square")), ("diamond", tl!("Diamond")), ("line", tl!("Line"))]; form::choice(ui, d, "shape", tl!("Shape"), (LABEL_W, 140.0), &shapes); @@ -36,17 +48,19 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { form::slider_w(ui, d, ("angle", tl!("Angle"), LABEL_W), -90.0..=90.0, "°", &|x| c32(&Color::gray(0.2 + 0.6 * x))); form::choice(ui, d, "mode", tl!("Screens"), (LABEL_W, 140.0), &[("mono", tl!("Mono")), ("cmyk", tl!("CMYK"))]); if d.str("mode") != "cmyk" { - widgets::label_row(ui, tl!("Color"), LABEL_W, |ui| { - form::text(ui, d, "color", 120.0); - }); + if d.fields.contains_key("fromArt") { + form::check(ui, d, "fromArt", tl!("Dot Color from Art")); + } + if !d.bool("fromArt") { + widgets::label_row(ui, tl!("Color"), LABEL_W, |ui| { + form::text(ui, d, "color", 120.0); + }); + } } ui.add_space(4.0); - for (key, label) in [("invert", tl!("Invert")), ("clip", tl!("Clip to Art")), ("keepOriginal", tl!("Keep Original"))] { + for (key, label) in [("invert", tl!("Invert")), ("clip", tl!("Clip to Art"))] { form::check(ui, d, key, label); } - let p = form::params(d); - form::preview(app, ui, d, "Vector Halftone", CMD, p); - false } fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 3a715a29d8..bb71167209 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5745,3 +5745,6 @@ anchor Points: Точки: CMYK Images CMYK изображения Grayscale Images Изображения в нюанси на сивото @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` трябва да е spotColors, colorEffects, rgbImages, cmykImages или grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Цвят на точките от илюстрацията diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 9ecbd9ec53..1a1ce4c037 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5846,3 +5846,6 @@ anchor Points: Punts: CMYK Images Imatges CMYK Grayscale Images Imatges en escala de grisos @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` ha de ser spotColors, colorEffects, rgbImages, cmykImages o grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Color dels punts de la il·lustració diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 5e5e459ea1..f92459d608 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -5855,3 +5855,6 @@ anchor Points: Body: CMYK Images Obrazy CMYK Grayscale Images Obrazy ve stupních šedi @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` musí být spotColors, colorEffects, rgbImages, cmykImages nebo grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Barva bodů podle kresby diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 52eac9d03a..e735ddd999 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5760,3 +5760,6 @@ anchor Points: Punkter: CMYK Images CMYK-billeder Grayscale Images Gråtonebilleder @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` skal være spotColors, colorEffects, rgbImages, cmykImages eller grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Prikfarve fra grafik diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 74bfb8ad19..9a41a838c9 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -5440,3 +5440,6 @@ anchor Points: Punkte: CMYK Images CMYK-Bilder Grayscale Images Graustufenbilder @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` muss spotColors, colorEffects, rgbImages, cmykImages oder grayImages sein + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Punktfarbe aus Grafik diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index fc31f0850f..fed8acea23 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5807,3 +5807,6 @@ anchor Points: Σημεία: CMYK Images Εικόνες CMYK Grayscale Images Εικόνες σε κλίμακα του γκρι @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages Το `kind` πρέπει να είναι spotColors, colorEffects, rgbImages, cmykImages ή grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Χρώμα κουκκίδων από το γραφικό diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 0214dd9c6d..2956f03abd 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -5798,3 +5798,6 @@ anchor Points: Puntos: CMYK Images Imágenes CMYK Grayscale Images Imágenes en escala de grises @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` debe ser spotColors, colorEffects, rgbImages, cmykImages o grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Color de puntos de la ilustración diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index b9be325c65..5942d952e6 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -5886,3 +5886,6 @@ anchor Points: Pisteet: CMYK Images CMYK-kuvat Grayscale Images Harmaasävykuvat @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` on oltava spotColors, colorEffects, rgbImages, cmykImages tai grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Pisteiden väri kuvituksesta diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index ad57031ed3..9d12a94226 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -5854,3 +5854,6 @@ anchor Points: Points : CMYK Images Images CMJN Grayscale Images Images en niveaux de gris @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` doit être spotColors, colorEffects, rgbImages, cmykImages ou grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Couleur des points d’après l’illustration diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 38e97c940f..dbb6993cef 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5842,3 +5842,6 @@ anchor Points: Pontok: CMYK Images CMYK-képek Grayscale Images Szürkeárnyalatos képek @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages A `kind` értéke spotColors, colorEffects, rgbImages, cmykImages vagy grayImages lehet + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Pontszín a grafikából diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 8d9fb5cfb0..084f32a747 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5760,3 +5760,6 @@ anchor Points: Titik: CMYK Images Gambar CMYK Grayscale Images Gambar Skala Abu-abu @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` harus spotColors, colorEffects, rgbImages, cmykImages, atau grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Warna titik dari karya seni diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 0baee70c0e..ec98d42ba3 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -5474,3 +5474,6 @@ anchor Points: Punti: CMYK Images Immagini CMYK Grayscale Images Immagini in scala di grigi @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` deve essere spotColors, colorEffects, rgbImages, cmykImages o grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Colore punti dalla grafica diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 583b7ae427..41e730518d 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -5543,3 +5543,6 @@ anchor Points: ポイント: CMYK Images CMYK 画像 Grayscale Images グレースケール画像 @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` は spotColors、colorEffects、rgbImages、cmykImages、grayImages のいずれかにしてください + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art ドットの色をアートから取得 diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 5cd927a0f6..545958500c 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5845,3 +5845,6 @@ anchor Points: წერტილები: CMYK Images CMYK გამოსახულებები Grayscale Images ნაცრისფერის გრადაციის გამოსახულებები @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` უნდა იყოს spotColors, colorEffects, rgbImages, cmykImages ან grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art წერტილების ფერი ნახატიდან diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 53bc38d4ad..6ba3b91b2a 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5437,3 +5437,6 @@ anchor Points: 포인트: CMYK Images CMYK 이미지 Grayscale Images 회색 음영 이미지 @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind`는 spotColors, colorEffects, rgbImages, cmykImages 또는 grayImages여야 합니다 + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art 아트워크에서 점 색상 가져오기 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 535a5d6bed..6b78604c66 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5804,3 +5804,6 @@ anchor Points: Punten: CMYK Images CMYK-afbeeldingen Grayscale Images Grijswaardenafbeeldingen @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` moet spotColors, colorEffects, rgbImages, cmykImages of grayImages zijn + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Puntkleur uit artwork diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 99f3621519..cacdfbe826 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -5710,3 +5710,6 @@ anchor Points: Punkty: CMYK Images Obrazy CMYK Grayscale Images Obrazy w skali szarości @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` musi mieć wartość spotColors, colorEffects, rgbImages, cmykImages lub grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Kolor kropek z kompozycji diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index dc816dd384..1418bc61b3 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -5773,3 +5773,6 @@ anchor Points: Pontos: CMYK Images Imagens CMYK Grayscale Images Imagens em escala de cinza @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` deve ser spotColors, colorEffects, rgbImages, cmykImages ou grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Cor dos Pontos da Arte diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 79d270ba7a..ee4bb67aa6 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -5833,3 +5833,6 @@ anchor Points: Точки: CMYK Images Изображения CMYK Grayscale Images Изображения в оттенках серого @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` должен быть spotColors, colorEffects, rgbImages, cmykImages или grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Цвет точек из рисунка diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 24bded7f48..3864fa5e2e 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5911,3 +5911,6 @@ shape Open Öppen CMYK Images CMYK-bilder Grayscale Images Gråskalebilder @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` måste vara spotColors, colorEffects, rgbImages, cmykImages eller grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Punktfärg från objekt diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index b94cb137e4..051726501e 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5813,3 +5813,6 @@ anchor Points: Noktalar: CMYK Images CMYK Görüntüler Grayscale Images Gri Tonlamalı Görüntüler @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` değeri spotColors, colorEffects, rgbImages, cmykImages veya grayImages olmalıdır + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Nokta Rengini Sanattan Al diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 4882ba94c5..3d87bbb521 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -5454,3 +5454,6 @@ anchor Points: Точки: CMYK Images Зображення CMYK Grayscale Images Зображення у відтінках сірого @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` має бути spotColors, colorEffects, rgbImages, cmykImages або grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Колір точок із малюнка diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 311008cab2..51092dc6a7 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5456,3 +5456,6 @@ anchor Points: Điểm: CMYK Images Ảnh CMYK Grayscale Images Ảnh thang độ xám @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` phải là spotColors, colorEffects, rgbImages, cmykImages hoặc grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art Màu chấm theo tác phẩm diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index a8eb60373f..5085e1a313 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -5697,3 +5697,6 @@ anchor Points: 点: CMYK Images CMYK 图像 Grayscale Images 灰度图像 @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` 必须是 spotColors、colorEffects、rgbImages、cmykImages 或 grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art 网点颜色取自图稿 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 3c19fbd98b..6e0c66dd6e 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -5493,3 +5493,6 @@ anchor Points: 點: CMYK Images CMYK 影像 Grayscale Images 灰階影像 @msg `kind` must be spotColors, colorEffects, rgbImages, cmykImages or grayImages `kind` 必須是 spotColors、colorEffects、rgbImages、cmykImages 或 grayImages + +# Color Effects add-on: Vector Halftone (Effect › Color Effects). + Dot Color from Art 網點顏色取自圖稿 diff --git a/docs/mcp.md b/docs/mcp.md index e92143b410..8f6c84a949 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5904,3 +5904,35 @@ with a spot colour swatch, solid or in a gradient's stops), `colorEffects` (carr on the object or on one of its fills or strokes; a group carrying one is selected whole), `rgbImages`, `cmykImages` or `grayImages` (images whose pixels are RGB, CMYK, or grayscale or 1-bit, read from the image's header). It returns the `count` selected. + +### Vector Halftone (live) + +`addon.color.halftone` (Effect › Color Effects › Vector Halftone…, also in Object › Plug-ins › Color Effects) draws its +object as vector halftone dots sized by the object's tone, the dots `object.vectorHalftone` makes, and keeps them in step +as the art or the settings change. It goes on through `effect.apply` like any other effect; its dialog has the fields of +Object › Vector Halftone without Keep Original, and the Appearance panel reopens it. + +| Parameter | Values (default) | Does | +|---|---|---| +| `shape` | `circle`, `ellipse`, `square`, `diamond`, `line` (`circle`) | The dot shape; lines join along a row | +| `frequency` | lines per inch 1…300 (20) | Cells per inch of the screen | +| `angle` | degrees (45) | The screen angle; CMYK: the black screen's, cyan −30°, magenta +30°, yellow −45° from it | +| `mode` | `mono`, `cmyk` (`mono`) | One screen following lightness, or four ink screens following the art's ink amounts, multiplied over each other | +| `color` | `#rrggbb` (`#000000`) | The mono dot colour | +| `fromArt` | bool (false) | Mono: each dot takes the art's colour under it (one path per colour) | +| `invert` | bool (false) | Dots for light tones | +| `clip` | bool (true) | The dots clipped to the art's outline | + +The object is sampled as it draws with its other effects (its own transparency and opacity mask apply to the dots). +Each screen takes at most 100000 cells: past that, or for art without area, the object draws as it is. The dots are kept +while the object and what it reads from the document (symbols, patterns, fonts, colour settings) stay the same, so +redrawing, measuring or exporting unchanged art doesn't sample it again. Effect › Expand Appearance turns the object +into the dots, a group of one path per ink (per colour with `fromArt`), and the SVG, PDF, EPS and AI exporters write +those paths. + +```json +{"name":"run_command","arguments":{"command":"effect.apply","params":{"effect":"addon.color.halftone","params":{"frequency":24,"shape":"diamond","angle":30}}}} +``` + +Not yet: stochastic (FM) and radial patterns, a dot-gain curve, per-screen separation settings, and type or symbols as +dots. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e6e5bd60da..b31bd92e01 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Path Precision Tools add-on: the Parametric Shape Tool; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: live Vector Halftone; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -1269,11 +1269,21 @@ identity), `cmd::addons::color::tests` in `vectorcraft-engine` (drawn live witho undo step, with any adjustment and its params; bad requests refused) and `addons::color::tests` in `vectorcraft-ui-egui` (the menus and the panel). Select by Color Kind (`addon.color.select`) selects the objects that use spot colours, carry a colour adjustment, or are RGB, CMYK or grayscale images -(`select_by_color_kind_finds_spot_colours_effects_and_image_models`). Commands: `docs/mcp.md` › Color Effects add-on. +(`select_by_color_kind_finds_spot_colours_effects_and_image_models`). Vector Halftone (`addon.color.halftone`) draws the +object as the dots Object › Vector Halftone makes, live: the screens and dots are shared +(`vectorcraft_effects::addons::halftone`), the renderer samples the art and keeps the dots while it doesn't change +(`vectorcraft_render::addons::halftone`), and Expand Appearance and the SVG, PDF, EPS and AI exporters write the paths. +Tests: `addons::halftone` in `vectorcraft-effects` (settings, tone, caps), `addons::halftone::tests` in +`vectorcraft-render` (drawn as dots, settings change them, unchanged art not sampled again, too many cells draw the +object as it is), `expand_appearance_gives_the_dots_object_vector_halftone_makes`, +`exports_write_the_dots_as_paths` and `a_halftone_past_the_caps_leaves_the_object_as_it_is` in `vectorcraft-engine`, +and `the_halftone_effect_dialog_has_the_command_fields_and_edits_the_effect` in `vectorcraft-ui-egui`. Commands: +`docs/mcp.md` › Color Effects add-on. ## Revision history | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Color Effects add-on: live Vector Halftone; scores and estimates unchanged | | 2026-10-30 | minor | Path Precision Tools add-on: the Parametric Shape Tool; evidence added; scores unchanged. | | 2026-10-30 | minor | Presentation Mode fits the active artboard and hides selections, guides, grids and artboard edges; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: Select by Color Kind; scores and estimates unchanged | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 612c955c11..ffd993efbd 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Path Precision Tools add-on: the Parametric Shape Tool and its panel; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: live Vector Halftone; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -329,7 +329,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point); an Alt-drag away from paths selects the points inside a marquee | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not an Illustrator feature, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not an Illustrator feature, so it is not scored | | Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not an Illustrator feature, 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 | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not an Illustrator feature, 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 | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not an Illustrator feature, so it is not scored | ## Look and feel @@ -370,6 +370,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Color Effects add-on: live Vector Halftone; scores and estimates unchanged | | 2026-10-30 | minor | Path Precision Tools add-on: the Parametric Shape Tool (ten re-editable shape kinds), its panel and Convert to Parametric Shape; scores and estimates unchanged | | 2026-10-30 | minor | Smart Pen add-on: an Alt-drag away from paths selects points with a marquee; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: Select by Color Kind; scores and estimates unchanged | From f4be2b900626756463c17246430b7a2822cbb513 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 22:18:04 +0700 Subject: [PATCH 038/227] 3D Extrude & Bevel, Inflate and Rotate apply to type, which stays editable (#4715) --- crates/effects/src/solids.rs | 27 ++++++++++++++++++++- crates/engine/src/cmd/effectcmd/tests.rs | 31 +++++++++++++++++++++--- docs/target-app-parity.md | 4 ++- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/crates/effects/src/solids.rs b/crates/effects/src/solids.rs index a68b7f579d..1165340bc2 100644 --- a/crates/effects/src/solids.rs +++ b/crates/effects/src/solids.rs @@ -114,10 +114,34 @@ fn profile(n: &Node) -> Option<(PathData, FillRule)> { NodeKind::Compound { children, rule } => { Some((PathData::new(children.iter().filter_map(|c| c.path_data()).flat_map(|p| p.subpaths.iter().cloned()).collect()), *rule)) } + // Type extrudes as its glyph outlines and stays type: editing it reshapes the solid (#4715). + NodeKind::Text(_) => { + let mut subpaths = vec![]; + crate::outline_text(n)?.walk(&mut |c| subpaths.extend(c.path_data().into_iter().flat_map(|p| p.subpaths.iter().cloned()))); + (!subpaths.is_empty()).then(|| (PathData::new(subpaths), FillRule::NonZero)) + } _ => None, } } +/// What a 3D effect paints `n` with: its own fills and strokes, else, for type that has none, the +/// fill and stroke of its first painted run (its characters' colours). +fn solid_paints(n: &Node) -> Vec { + let own: Vec = n.appearance.items.iter().filter(|i| crate::paints(i)).cloned().collect(); + if !own.is_empty() || !matches!(n.kind, NodeKind::Text(_)) { + return own; + } + let mut runs = vec![]; + if let Some(outlined) = crate::outline_text(n) { + outlined.walk(&mut |c| { + if runs.is_empty() && c.path_data().is_some() { + runs = c.appearance.items.iter().filter(|i| crate::paints(i)).cloned().collect(); + } + }); + } + runs +} + fn facets(id: &str, path: &PathData, rule: FillRule, bounds: Rect, p: &Value) -> Result, String> { let view = view_options(p); match id { @@ -320,7 +344,8 @@ pub fn solid_art(n: &Node) -> Option { } let (path, rule) = profile(n)?; let ctx = GeomContext::of(n); - let painted: Vec<&AppearanceItem> = n.appearance.items.iter().filter(|i| crate::paints(i)).collect(); + let paints = solid_paints(n); + let painted: Vec<&AppearanceItem> = paints.iter().collect(); let mut children = vec![]; let remaining: Vec; if let Some((index, fx)) = solid(&n.appearance.effects) { diff --git a/crates/engine/src/cmd/effectcmd/tests.rs b/crates/engine/src/cmd/effectcmd/tests.rs index e5279391ac..d85b3358c7 100644 --- a/crates/engine/src/cmd/effectcmd/tests.rs +++ b/crates/engine/src/cmd/effectcmd/tests.rs @@ -77,12 +77,35 @@ fn solid_effects_apply_save_edit_export_expand_and_undo() { s.execute("edit.undo", &json!({})).unwrap(); assert_eq!(node(&s, id).appearance.effects.len(), 0, "{effect}: back to the plain rectangle"); } - // Type has no outline to extrude. +} + +/// #4715: type extrudes as its glyph outlines, painted with its characters' colour, and stays +/// type: editing its text reshapes the solid. +#[test] +fn type_extrudes_as_its_glyphs_and_stays_editable() { let mut s = Session::new(); s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap(); - let t = s.execute("text.create", &json!({"x": 50, "y": 50, "text": "3D"})).unwrap(); - let err = s.execute("effect.apply", &json!({"effect": "threeD.extrude", "ids": [t["id"]], "item": null})).unwrap_err(); - assert!(err.to_string().contains("requires a path"), "{err}"); + let t = s.execute("text.create", &json!({"x": 50, "y": 100, "text": "3D", "size": 72})).unwrap(); + let id = NodeId(t["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"ids": [id.0], "color": "#cc2200"})).unwrap(); + s.execute("effect.apply", &json!({"effect": "threeD.extrude", "ids": [id.0], "item": null})).unwrap(); + let n = node(&s, id); + assert!(matches!(n.kind, NodeKind::Text(_)), "still type"); + let art = effects::solid_art(&n).expect("a solid of the glyphs"); + let mut faces = 0; + let mut tinted = false; + art.walk(&mut |c| { + if c.path_data().is_some() { + faces += 1; + // Shaded from the characters' red: red stays the strongest channel. + if let Some([r, g, b, _]) = c.appearance.fill_paint().color().map(|c| c.to_rgba8(1.0)) { + tinted |= r > g && r > b; + } + } + }); + assert!(faces > 2 && tinted, "{faces} faces, tinted {tinted}"); + s.execute("text.setText", &json!({"ids": [id.0], "text": "3DD"})).unwrap(); + assert_ne!(effects::solid_art(&node(&s, id)).unwrap(), art, "the solid follows the edited text"); } /// Scripts from before the Perspective angle give `perspective` as a 0–100 % strength: it is diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b31bd92e01..a819544008 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: live Vector Halftone; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (3D Extrude & Bevel, Inflate and Rotate apply to type, which stays editable (#4715); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -788,6 +788,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Divide uses open lines, bent paths and curves as cutting edges (#1307), preserving the frontmost filled face's appearance and holes. Engine tests cover implicit closure of filled open contours and unrelated objects; native automation confirms independent piece movement, one Undo/Redo, canvas/window captures and an exact saved-document read by a separate CLI process. The shared planar map keeps a segment cap (65,536 since #937, was 4,096) and its filled-area fallback; other Pathfinder operations are unchanged. - Type that Transform effects only move and copy (no scale, rotation, reflection or Random) exports as type in each place, and PDF export writes every copy as selectable, searchable text, when its characters are in solid colors without underline or strikethrough, the type object has no fills or strokes of its own, no inline graphics and no perspective, its transform does not scale or shear stroked characters, and the copies do not overlap. When the effect is on the type itself, the type can also have transparency, an opacity mask and raster effects. When the effect is on the group or layer holding the type, the type has no transparency or effects of its own and is not in a clipping path, the group or layer has no fill, stroke or Pathfinder effect of its own, and no group between them has a fill, stroke, Pathfinder or geometry effect. Type still exports as outlines when the effect stops its copies early, or when the copies would number more than 10,000 or take more than 20,000,000 bytes of document data, and so does other type under a geometry effect. - Extrude & Bevel and Inflate treat strokes as outlined: each visible stroke builds a solid from its outline in its own paint beside the top fill's ([three-d.md](three-d.md#fills-and-strokes)). + - Extrude & Bevel, Inflate and Rotate apply to type: it makes a solid of its glyph outlines, painted with its own fills and strokes or, when it has none, its characters' colour (the first run's), and stays type, so editing the text reshapes the solid (#4715). - Extrude & Bevel, Inflate and Rotate (Effect › 3D and Materials): live effects in the `three-d` crate with depth, twist, taper, solid or hollow caps, five original bevel shapes (width, height, repeat, spacing, inside, both sides), Inflate's volume, both sides, twist, taper and cap, Rotate's turned fills and strokes, Position presets, the rotation and light gizmos, SVG/PDF vector output and Expand Appearance; one 3D effect per object; covered by geometry, effect, canvas-versus-export, command and dialog tests ([three-d.md](three-d.md)). - Initial live Revolve (#605, #846): a portable geometry and shading crate (`three-d`), editable path and compound profiles, compact options with artboard rotation and light gizmos, SVG/PDF vector output and Expand Appearance that can trim covered faces. Open ends have continuous caps by default, shading is smooth with one to ten colored lights, and intersecting surfaces' visibility is approximate ([revolve.md](revolve.md)). - Live effects with previewing dialogs: Distort & Transform, Path, Convert to Shape, 15 Warp styles, Round Corners, Scribble, Effect → Pathfinder (all 10 operations, live on groups; several loose objects are grouped first, in one undo step), Color Adjustments (Brightness/Contrast, Curves, Levels, Hue/Saturation, Shift to Color, Temperature/Tint, on vectors, live type and embedded images), and raster drop shadow, glows and feather. SVG and PDF export keep live effects (geometry baked; SVG raster effects as filters). Zig Zag spaces its ridges evenly along each segment, so lines and curves get a regular wave in Corner and Smooth (#1558). Warp › Arc (the effect and Envelope › Make with Warp) bends in the object's real proportions: a circular arc with concentric edges and no fold-over at 100%, so Arc on art that isn't square draws differently from before (#1581, fixes #1578). `effect.apply` and `effect.setParams` give an error for a misspelt or wrongly typed effect parameter instead of running the effect with its default (#1623, #1592). Roughen with Smooth keeps turn-backs smooth instead of making cusps that draw as spikes (#1646, #1643). Scribble draws one zig-zag per region, with no lines across holes and notches; convex shapes are unchanged (#1651, #1648). On the canvas, in Expand Appearance and in exports, Effect → Pathfinder uses the glyph outlines of type in the group, and results painted like the type keep its opacity and blend mode. @@ -1283,6 +1284,7 @@ and `the_halftone_effect_dialog_has_the_command_fields_and_edits_the_effect` in | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | 3D Extrude & Bevel, Inflate and Rotate apply to type, which stays editable (#4715); scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: live Vector Halftone; scores and estimates unchanged | | 2026-10-30 | minor | Path Precision Tools add-on: the Parametric Shape Tool; evidence added; scores unchanged. | | 2026-10-30 | minor | Presentation Mode fits the active artboard and hides selections, guides, grids and artboard edges; scores and estimates unchanged | From 856c6023103848c48cbe5a22d74c088eecdead4d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 28 Oct 2026 06:59:22 -0700 Subject: [PATCH 039/227] Spiral tool: Alt-drag adds or removes segments, and Ctrl/Cmd-drag changes the decay The reference app adds or subtracts winds from a spiral with Alt-drag and changes its decay rate with Ctrl/Cmd-drag. VectorCraft's Spiral tool did nothing with either key during a drag. While a spiral is dragged out, Alt or Ctrl/Cmd keeps the spiral's inner end at the distance from the center it had when the key went down, and the outer end follows the pointer. With Alt the number of segments changes to the nearest whole number that fits, within 2 to 1000, so dragging outward adds segments and dragging inward removes them. With Ctrl/Cmd the decay changes to fit, within 5 to 99.99 percent, the decays a spiral is drawn with. When both keys are held, Ctrl/Cmd changes the decay. Up/Down with a key still held move the held radius to the new segment count. The new values stay when the key is let go, and as the Spiral tool's segments and decay options for the next spiral. Both keys also work with a 5 percent decay and hundreds of segments. Docs: docs/mcp.md, docs/target-app-parity.md. --- crates/engine/src/tests/draw2.rs | 32 +++++++++ crates/tools/src/draw2/family.rs | 114 ++++++++++++++++++++++++++++++- docs/mcp.md | 11 +++ docs/target-app-parity.md | 1 + 4 files changed, 157 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index 15d1b27f9a..b4b2418404 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -1275,6 +1275,38 @@ fn shape_arc_closed_along_y_closes_through_the_top_left_corner() { assert!((area - std::f64::consts::FRAC_PI_4).abs() < 0.01, "{area}"); } +/// A spiral dragged out with Alt pressed part way gets more segments as its outer end moves out, +/// and one dragged with Ctrl/Cmd pressed part way gets the decay that keeps its inner end's +/// distance from the center; the Spiral tool keeps both for the next spiral. +#[test] +fn spiral_drags_with_alt_and_ctrl_change_its_segments_and_decay() { + let mut s = session(); + let v = view(); + let spiral = |s: &mut Session, m: Mods, to: (f64, f64)| { + s.pointer(&PointerEvent::new(PointerKind::Down, 100.0, 100.0), v).unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Drag, 200.0, 100.0), v).unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(m), v).unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Drag, to.0, to.1).with_mods(m), v).unwrap(); + s.pointer(&PointerEvent::new(PointerKind::Up, to.0, to.1).with_mods(m), v).unwrap(); + let sp = paths(s).last().unwrap().1.subpaths[0].clone(); + (sp.anchors.len(), sp.anchors.last().unwrap().p) + }; + s.select_tool("spiral", v).unwrap(); + let undo = undo_steps(&s); + // Alt from a radius of 100 to 200: 10 segments become 13, the outer end at the pointer. + let (anchors, outer) = spiral(&mut s, Mods { alt: true, ..Mods::default() }, (300.0, 100.0)); + assert_eq!(anchors, 14); + assert!(near(outer, Point::new(300.0, 100.0)), "{outer:?}"); + assert_eq!(s.tool_options()["segments"], json!(13)); + // Ctrl/Cmd from 100 to 50: the decay rises from 80 % to 80 × 2^(1/13) %. + let (anchors, outer) = spiral(&mut s, Mods { cmd: true, ..Mods::default() }, (150.0, 100.0)); + assert_eq!(anchors, 14); + assert!(near(outer, Point::new(150.0, 100.0)), "{outer:?}"); + let decay = s.tool_options()["decay"].as_f64().unwrap(); + assert!((decay - 80.0 * 2f64.powf(1.0 / 13.0)).abs() < 1e-9, "{decay}"); + assert_eq!(undo_steps(&s) - undo, 2, "one undo step a spiral"); +} + /// The children of the grid a `shape.rectangularGrid` / `shape.polarGrid` call made, bottom first. fn grid(s: &mut Session, cmd: &str, p: serde_json::Value) -> Vec> { let id = NodeId(s.execute(cmd, &p).unwrap()["id"].as_u64().unwrap()); diff --git a/crates/tools/src/draw2/family.rs b/crates/tools/src/draw2/family.rs index 9f8c08a59d..b068e87727 100644 --- a/crates/tools/src/draw2/family.rs +++ b/crates/tools/src/draw2/family.rs @@ -5,7 +5,9 @@ //! start point and the dragged corner snap to Smart Guides ([`DrawSnap`]), hovering too. //! While dragging, ↑/↓ change the arc's slope, the spiral's segments, the grid rows or the //! concentric dividers; ←/→ change grid columns / radial dividers. C switches the arc between open -//! and closed, and F switches its base between the X and Y axes. +//! and closed, and F switches its base between the X and Y axes. While a spiral is dragged out, Alt +//! and Ctrl/Cmd keep its inner end at the distance from the center it had when the key went down as +//! the outer end follows the pointer: Alt adds or removes segments, and Ctrl/Cmd changes the decay. use serde_json::{Value, json}; use vectorcraft_geom::Point; @@ -33,6 +35,9 @@ pub struct FamilyTool { pub decay: f64, pub segments: u32, pub clockwise: bool, + /// The natural logarithm of the radius of the spiral's inner end, held while Alt or Ctrl/Cmd + /// is down in a drag. + spiral_end: Option, /// Rows / concentric dividers. pub rows: u32, /// Columns / radial dividers. @@ -75,6 +80,7 @@ impl FamilyTool { decay: 80.0, segments: 10, clockwise: true, + spiral_end: None, rows: 5, columns: 5, skew: [0.0; 2], @@ -107,6 +113,39 @@ impl FamilyTool { matches!(self.id, "rectangularGrid" | "polarGrid") } + /// The natural logarithm of the radius of the inner end of a spiral of outer radius `r` drawn + /// with the tool's decay and segments (a logarithm, so that a low decay with many segments does + /// not round to 0). The decay ratio is clamped to 0.05…0.9999 as `shapes::spiral` clamps it. + fn spiral_inner_end_ln(&self, r: f64) -> f64 { + r.ln() + f64::from(self.segments) * (self.decay / 100.0).clamp(0.05, 0.9999).ln() + } + + /// Alt or Ctrl/Cmd in a spiral drag from `start` to `p`: the inner end keeps the distance from + /// the center it had when the key went down while the outer end follows the pointer. With + /// Ctrl/Cmd the decay changes to fit (within 5…99.99 %, the decays `shapes::spiral` draws); + /// with Alt alone the segments change to the nearest whole number that fits (within 2…1000). + /// The new values stay once the key is let go. + fn hold_spiral_end(&mut self, start: Point, p: Point, m: Mods) { + let r = p.distance(start).max(0.01); + match (m.cmd || m.alt, self.spiral_end) { + (true, None) => self.spiral_end = Some(self.spiral_inner_end_ln(r)), + (false, Some(_)) => self.spiral_end = None, + _ => {} + } + let Some(end) = self.spiral_end.filter(|e| e.is_finite()) else { return }; + if m.cmd { + let ratio = ((end - r.ln()) / f64::from(self.segments)).exp(); + if ratio.is_finite() { + self.decay = (ratio * 100.0).clamp(5.0, 99.99); + } + } else { + let winds = (r.ln() - end) / -(self.decay / 100.0).clamp(0.05, 0.9999).ln(); + if winds.is_finite() { + self.segments = winds.round().clamp(2.0, 1000.0) as u32; + } + } + } + /// A grid's options a drag draws with: its dividers, skews and switches (the Default Size and /// Reference Point are for a click's dialog). fn grid_options(&self) -> Value { @@ -187,6 +226,7 @@ impl Tool for FamilyTool { self.start = Some(p); self.last = p; self.began = false; + self.spiral_end = None; vec![] } PointerKind::Drag => { @@ -204,6 +244,9 @@ impl Tool for FamilyTool { self.began = true; out.push(Action::Begin(self.label().into())); } + if self.id == "spiral" { + self.hold_spiral_end(s, ev.pos, ev.mods); + } let (c, v) = self.command_at(s, ev.pos, ev.mods, cx.constrain_angle); out.push(Action::Preview(c, v)); out @@ -211,6 +254,7 @@ impl Tool for FamilyTool { PointerKind::Up => { let Some(s) = self.start.take() else { return vec![] }; self.snap.clear(); + self.spiral_end = None; if std::mem::take(&mut self.began) { vec![Action::Commit] } else { vec![Action::Dialog(self.id.into(), json!({"x": s.x, "y": s.y}))] } } _ => vec![], @@ -262,11 +306,16 @@ impl Tool for FamilyTool { _ => false, }; if changed { + // An arrow with Alt or Ctrl/Cmd still held: the held inner end moves with the new segment count. + if self.spiral_end.is_some() { + self.spiral_end = Some(self.spiral_inner_end_ln(self.last.distance(s).max(0.01))); + } let (c, v) = self.command_at(s, self.last, self.mods, cx.constrain_angle); vec![Action::Preview(c, v)] } else if key == ToolKey::Escape { self.start = None; self.began = false; + self.spiral_end = None; self.snap.clear(); vec![Action::Cancel] } else { @@ -461,6 +510,69 @@ mod tests { ); } + /// While a spiral is dragged out, Alt and Ctrl/Cmd keep its inner end at the distance from the + /// center it had when the key went down as the outer end follows the pointer: Alt adds or + /// removes segments and Ctrl/Cmd changes the decay. The new values stay once the key is let go, + /// and for the next spiral. Both keys work with the lowest decay and many segments. + #[test] + fn spiral_drag_alt_changes_its_segments_and_ctrl_its_decay() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let mut cx = cx(&d, &s, &p); + cx.smart_guides = false; + let alt = Mods { alt: true, ..Mods::default() }; + let ctrl = Mods { cmd: true, ..Mods::default() }; + let spiral = |a: Vec| match a.last() { + Some(Action::Preview(c, v)) if c == "shape.spiral" => { + (v["radius"].as_f64().unwrap(), v["decay"].as_f64().unwrap(), v["segments"].as_u64().unwrap()) + } + _ => panic!("{a:?}"), + }; + let mut t = FamilyTool::new("spiral"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0))), (100.0, 80.0, 10)); + // Alt: twice the radius adds ln 2 / ln 1.25 ≈ 3.1 segments, half of it takes them away. + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(alt))), (100.0, 80.0, 10)); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(alt))), (200.0, 80.0, 13)); + // ↑ with Alt held adds one, and the held inner end moves with it. + assert_eq!(spiral(t.key(&cx, ToolKey::Up, alt)).2, 14); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(alt))).2, 14); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(alt))), (50.0, 80.0, 8)); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 101.0, 100.0).with_mods(alt))).2, 2, "at least two"); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(alt))).2, 8); + // Let go: the eight segments stay as the radius follows the pointer again. + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0))), (100.0, 80.0, 8)); + // Ctrl/Cmd: the decay fits the held inner end, 80 % × (100 / r)^(1/8). + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(ctrl)); + let (r, decay, n) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(ctrl))); + assert!((r, n) == (50.0, 8) && (decay - 80.0 * 2f64.powf(1.0 / 8.0)).abs() < 1e-9, "{r} {decay} {n}"); + let (_, decay, _) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 400.0, 100.0).with_mods(ctrl))); + assert!((decay - 80.0 * (1.0f64 / 3.0).powf(1.0 / 8.0)).abs() < 1e-9, "{decay}"); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 100.5, 100.0).with_mods(ctrl))).1, 99.99, "at most 99.99 %"); + let (_, decay, _) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(ctrl))); + assert!((decay - 80.0 * 0.5f64.powf(1.0 / 8.0)).abs() < 1e-9, "{decay}"); + // Let go: the decay stays, and the spiral drawn next keeps both. + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 250.0, 100.0))), (150.0, decay, 8)); + assert_eq!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 250.0, 100.0)), vec![Action::Commit]); + assert_eq!((t.options()["decay"].as_f64(), t.options()["segments"].clone()), (Some(decay), json!(8))); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); + let (_, d2, n2) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 100.0, 140.0).with_mods(alt))); + assert_eq!((d2, n2), (decay, 8), "a new drag holds the end anew"); + // 5 % and 300 segments: an inner radius of 100 × 0.05^300 is below the smallest f64. + let mut t = FamilyTool::new("spiral"); + t.set_option("decay", &json!(5.0)); + t.set_option("segments", &json!(300)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(ctrl)); + let (_, decay, _) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(ctrl))); + assert!((decay - 5.0 * 2f64.powf(1.0 / 300.0)).abs() < 1e-9, "{decay}"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0)); + // Alt: 200 times the radius adds ln 200 / ln (100 / decay) ≈ 1.8 segments. + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 120.0, 100.0).with_mods(alt)); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 4100.0, 100.0).with_mods(alt))).2, 302); + } + #[test] fn arc_drag_uses_stored_segment_options() { let mut t = FamilyTool::new("arc"); diff --git a/docs/mcp.md b/docs/mcp.md index 8f6c84a949..b907decc29 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -486,6 +486,17 @@ values, and they stay as the Arc tool's `closed`, `baseAlong` and `slope` option dragged, `c` chooses the tool bound to C, and `f` runs the shortcut bound to F in remote mode (headless has no binding for it). +While a spiral is being dragged out with the Spiral tool, a `drag` event with `mods.alt` or `mods.cmd` keeps the +spiral's inner end at the distance from the center it had at the first such event, and the outer end follows the +pointer. With `mods.alt` the number of segments changes to the nearest whole number of segments that fits (within +2…1000), so dragging outward adds segments and dragging inward removes them; with `mods.cmd` the decay changes to fit +(within 5…99.99 %). The spiral drawn on release uses the new values, and they stay as the Spiral tool's `segments` and +`decay` options for the next spiral: + +```json +{"name":"pointer_gesture","arguments":{"tool":"spiral","events":[{"kind":"down","x":100,"y":100},{"kind":"drag","x":200,"y":100,"mods":{"alt":true}},{"kind":"drag","x":300,"y":100,"mods":{"alt":true}},{"kind":"up","x":300,"y":100}]}} +``` + Appearance stacks: an object can carry several fills and strokes (`appearance.addFill`, `appearance.addStroke`), indexed in paint order (0 is painted first, the bottom row of the Appearance panel). Cmd+/ runs `appearance.addFill` and Cmd+Alt+/ runs `appearance.addStroke` (`press_key {key: "/", mods: {cmd: true, alt: true}}`). `paint.setFill`, `paint.setStroke`, diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index a819544008..6387f91d35 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -673,6 +673,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Shapes:** all shape tools (including Flare) and the line, arc, spiral and grid tools. Space held while dragging out a shape, line, arc, spiral or grid moves it at its current size. The Flare tool's center drag turns the rays with the pointer, Shift keeps them in their original orientation (unturned, or turned by a nonzero General › Constrain Angle), and Space held during either of its drags moves the flare. While a grid is dragged out, Up/Down change its rows (concentric dividers) and Left/Right its columns (radial dividers). A click with a grid tool asks for the size, the divider counts and the grid options (#1377, in part): a skew for each set of dividers, Use Outside Rectangle As Frame or Create Compound Path From Ellipses, and Fill Grid; they are parameters of `shape.rectangularGrid` and `shape.polarGrid`, stay as the tool's options and apply to drags too. The curve a skew percentage follows and the direction of the radial skew are our own (the public documentation gives neither), and the dialogs have no reference point locator. An ellipse's Pie Start and End Angle and Invert Pie (Transform and Properties panels' Ellipse Properties, `object.setLiveShape {pieStart, pieEnd, invertPie}`) cut it as a pie (#812). With the bounding box showing, the Selection tool shows a selected ellipse's two pie widgets just outside it; dragging one sets its angle in one undo step and double-clicking one makes the ellipse whole again. A live polygon's Polygon Properties there: side count, angle, corner type and radius, radius, side length and Make Sides Equal once an uneven scale has made its sides differ (`object.setLiveShape {sides, polygonAngle, polygonRadius, sideLength, makeSidesEqual}`, part of #812); a star is a plain path, as in Illustrator. The Flare Tool Options last as the tool's options: the next flare dragged out uses them, a click's dialog shows them and double-clicking the tool opens them (part of #812). - **Shapes:** all shape tools (including Flare) and the line, arc, spiral and grid tools. Space held while dragging out a shape, line, arc, spiral or grid moves it at its current size. The Flare tool's center drag turns the rays with the pointer, Shift keeps them in their original orientation, and Space held during either of its drags moves the flare. While a grid is dragged out, Up/Down change its rows (concentric dividers) and Left/Right its columns (radial dividers). A click with a grid tool asks for the size, the divider counts and the grid options (#1377, in part): a skew for each set of dividers, Use Outside Rectangle As Frame or Create Compound Path From Ellipses, and Fill Grid; they are parameters of `shape.rectangularGrid` and `shape.polarGrid`, stay as the tool's options and apply to drags too. The curve a skew percentage follows and the direction of the radial skew are our own (the public documentation gives neither), and the dialogs have no reference point locator. An ellipse's Pie Start and End Angle and Invert Pie (Transform and Properties panels' Ellipse Properties, `object.setLiveShape {pieStart, pieEnd, invertPie}`) cut it as a pie (#812). With the bounding box showing, the Selection tool shows a selected ellipse's two pie widgets just outside it; dragging one sets its angle in one undo step and double-clicking one makes the ellipse whole again. A live polygon's Polygon Properties there: side count, angle, corner type and radius, radius, side length and Make Sides Equal once an uneven scale has made its sides differ (`object.setLiveShape {sides, polygonAngle, polygonRadius, sideLength, makeSidesEqual}`, part of #812); a star is a plain path, as in Illustrator. The Flare Tool Options last as the tool's options: the next flare dragged out uses them, a click's dialog shows them and double-clicking the tool opens them (part of #812). While an arc is dragged out, C switches it between open and closed, F switches its base between the X and Y axes in the same box, and Up/Down raise and lower its slope by 10 within −100…100; each press switches once, and the values stay as the Arc tool's options. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list C, F and Up/Down for an arc being dragged out. F as the base switch, the arrows changing the slope, the step of 10 and one switch per press are our own rules. + While a spiral is dragged out, Alt adds or removes segments and Ctrl/Cmd changes the decay; both keep the spiral's inner end at the distance from the center it had when the key went down while the outer end follows the pointer, and the values stay as the Spiral tool's options. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list Alt-drag to add or subtract winds and Ctrl-drag to change the decay rate. The held inner radius, rounding to whole segments, the ranges (2…1000 segments, 5…99.99 % decay) and the new values staying are our own rules. - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. Eraser Tool Options has Angle and Roundness besides Size, as [Erase paths using the Eraser tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/erase-paths-using-eraser-tool.html) describes: the Eraser's tip is an ellipse Size across, its long axis at Angle and its short axis Roundness percent of the long one, and a drag with a tip that is not round shows the outline of the area it erases (`path.eraseRegion` `angle` and `roundness`). From 88e2177fecfc9b932dd91ebc17bbd844498d4099 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 08:24:11 -0700 Subject: [PATCH 040/227] Spiral tool: Alt-drag adds or removes whole winds of four segments Alt in a spiral drag now rounds the fitted segment count to whole winds of four segments, counted from the segment count when Alt went down. Ctrl/Cmd takes precedence when both keys are held, and switching back to Alt starts from the current count with the held inner end kept. Arrow keys, Escape, release and a new drag clear the held Alt count. Tests cover both keys together, a switch mid-drag, Escape, the 2 to 1000 bounds and the committed path's anchor count. docs/mcp.md and docs/target-app-parity.md describe the rule. --- crates/engine/src/tests/draw2.rs | 18 ++-- crates/tools/src/draw2/family.rs | 146 +++++++++++++++++++++++++------ docs/mcp.md | 11 +-- docs/target-app-parity.md | 2 +- 4 files changed, 136 insertions(+), 41 deletions(-) diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index b4b2418404..1471c1b1af 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -1275,9 +1275,9 @@ fn shape_arc_closed_along_y_closes_through_the_top_left_corner() { assert!((area - std::f64::consts::FRAC_PI_4).abs() < 0.01, "{area}"); } -/// A spiral dragged out with Alt pressed part way gets more segments as its outer end moves out, -/// and one dragged with Ctrl/Cmd pressed part way gets the decay that keeps its inner end's -/// distance from the center; the Spiral tool keeps both for the next spiral. +/// A spiral dragged out with Alt pressed part way gets four more segments per wind as its outer end +/// moves out. Ctrl/Cmd pressed part way fits the decay so the inner end keeps its distance from the +/// center. The Spiral tool keeps both values for the next spiral. #[test] fn spiral_drags_with_alt_and_ctrl_change_its_segments_and_decay() { let mut s = session(); @@ -1293,17 +1293,17 @@ fn spiral_drags_with_alt_and_ctrl_change_its_segments_and_decay() { }; s.select_tool("spiral", v).unwrap(); let undo = undo_steps(&s); - // Alt from a radius of 100 to 200: 10 segments become 13, the outer end at the pointer. + // Alt from a radius of 100 to 200: 10 segments become 14, one full wind of four quarter turns. let (anchors, outer) = spiral(&mut s, Mods { alt: true, ..Mods::default() }, (300.0, 100.0)); - assert_eq!(anchors, 14); + assert_eq!(anchors, 15); assert!(near(outer, Point::new(300.0, 100.0)), "{outer:?}"); - assert_eq!(s.tool_options()["segments"], json!(13)); - // Ctrl/Cmd from 100 to 50: the decay rises from 80 % to 80 × 2^(1/13) %. + assert_eq!(s.tool_options()["segments"], json!(14)); + // Ctrl/Cmd from 100 to 50: the decay rises from 80 % to 80 × 2^(1/14) %. let (anchors, outer) = spiral(&mut s, Mods { cmd: true, ..Mods::default() }, (150.0, 100.0)); - assert_eq!(anchors, 14); + assert_eq!(anchors, 15); assert!(near(outer, Point::new(150.0, 100.0)), "{outer:?}"); let decay = s.tool_options()["decay"].as_f64().unwrap(); - assert!((decay - 80.0 * 2f64.powf(1.0 / 13.0)).abs() < 1e-9, "{decay}"); + assert!((decay - 80.0 * 2f64.powf(1.0 / 14.0)).abs() < 1e-9, "{decay}"); assert_eq!(undo_steps(&s) - undo, 2, "one undo step a spiral"); } diff --git a/crates/tools/src/draw2/family.rs b/crates/tools/src/draw2/family.rs index b068e87727..aad4ff38fe 100644 --- a/crates/tools/src/draw2/family.rs +++ b/crates/tools/src/draw2/family.rs @@ -6,8 +6,9 @@ //! While dragging, ↑/↓ change the arc's slope, the spiral's segments, the grid rows or the //! concentric dividers; ←/→ change grid columns / radial dividers. C switches the arc between open //! and closed, and F switches its base between the X and Y axes. While a spiral is dragged out, Alt -//! and Ctrl/Cmd keep its inner end at the distance from the center it had when the key went down as -//! the outer end follows the pointer: Alt adds or removes segments, and Ctrl/Cmd changes the decay. +//! and Ctrl/Cmd keep its inner end at the distance from the center on the first modified drag as +//! the outer end follows the pointer: Alt adds or removes whole winds of four segments, and +//! Ctrl/Cmd changes the decay. use serde_json::{Value, json}; use vectorcraft_geom::Point; @@ -38,6 +39,8 @@ pub struct FamilyTool { /// The natural logarithm of the radius of the spiral's inner end, held while Alt or Ctrl/Cmd /// is down in a drag. spiral_end: Option, + /// The segment count when Alt alone starts adjusting winds. + spiral_alt_base: Option, /// Rows / concentric dividers. pub rows: u32, /// Columns / radial dividers. @@ -81,6 +84,7 @@ impl FamilyTool { segments: 10, clockwise: true, spiral_end: None, + spiral_alt_base: None, rows: 5, columns: 5, skew: [0.0; 2], @@ -121,9 +125,10 @@ impl FamilyTool { } /// Alt or Ctrl/Cmd in a spiral drag from `start` to `p`: the inner end keeps the distance from - /// the center it had when the key went down while the outer end follows the pointer. With + /// the center it had on the first modified drag while the outer end follows the pointer. With /// Ctrl/Cmd the decay changes to fit (within 5…99.99 %, the decays `shapes::spiral` draws); - /// with Alt alone the segments change to the nearest whole number that fits (within 2…1000). + /// with Alt alone the count changes in whole winds of four segments from its Alt entry count + /// (within 2…1000). Ctrl/Cmd takes precedence when both modifiers are held. /// The new values stay once the key is let go. fn hold_spiral_end(&mut self, start: Point, p: Point, m: Mods) { let r = p.distance(start).max(0.01); @@ -132,6 +137,11 @@ impl FamilyTool { (false, Some(_)) => self.spiral_end = None, _ => {} } + if m.alt && !m.cmd { + self.spiral_alt_base.get_or_insert(self.segments); + } else { + self.spiral_alt_base = None; + } let Some(end) = self.spiral_end.filter(|e| e.is_finite()) else { return }; if m.cmd { let ratio = ((end - r.ln()) / f64::from(self.segments)).exp(); @@ -139,9 +149,10 @@ impl FamilyTool { self.decay = (ratio * 100.0).clamp(5.0, 99.99); } } else { - let winds = (r.ln() - end) / -(self.decay / 100.0).clamp(0.05, 0.9999).ln(); - if winds.is_finite() { - self.segments = winds.round().clamp(2.0, 1000.0) as u32; + let fitted = (r.ln() - end) / -(self.decay / 100.0).clamp(0.05, 0.9999).ln(); + if fitted.is_finite() { + let base = f64::from(self.spiral_alt_base.unwrap_or(self.segments)); + self.segments = (base + 4.0 * ((fitted - base) / 4.0).round()).clamp(2.0, 1000.0) as u32; } } } @@ -227,6 +238,7 @@ impl Tool for FamilyTool { self.last = p; self.began = false; self.spiral_end = None; + self.spiral_alt_base = None; vec![] } PointerKind::Drag => { @@ -255,6 +267,7 @@ impl Tool for FamilyTool { let Some(s) = self.start.take() else { return vec![] }; self.snap.clear(); self.spiral_end = None; + self.spiral_alt_base = None; if std::mem::take(&mut self.began) { vec![Action::Commit] } else { vec![Action::Dialog(self.id.into(), json!({"x": s.x, "y": s.y}))] } } _ => vec![], @@ -309,6 +322,7 @@ impl Tool for FamilyTool { // An arrow with Alt or Ctrl/Cmd still held: the held inner end moves with the new segment count. if self.spiral_end.is_some() { self.spiral_end = Some(self.spiral_inner_end_ln(self.last.distance(s).max(0.01))); + self.spiral_alt_base = (self.mods.alt && !self.mods.cmd).then_some(self.segments); } let (c, v) = self.command_at(s, self.last, self.mods, cx.constrain_angle); vec![Action::Preview(c, v)] @@ -316,6 +330,7 @@ impl Tool for FamilyTool { self.start = None; self.began = false; self.spiral_end = None; + self.spiral_alt_base = None; self.snap.clear(); vec![Action::Cancel] } else { @@ -512,8 +527,9 @@ mod tests { /// While a spiral is dragged out, Alt and Ctrl/Cmd keep its inner end at the distance from the /// center it had when the key went down as the outer end follows the pointer: Alt adds or - /// removes segments and Ctrl/Cmd changes the decay. The new values stay once the key is let go, - /// and for the next spiral. Both keys work with the lowest decay and many segments. + /// removes whole winds of four segments and Ctrl/Cmd changes the decay. The new values stay + /// once the key is let go, and for the next spiral. Both keys work with the lowest decay and + /// many segments. #[test] fn spiral_drag_alt_changes_its_segments_and_ctrl_its_decay() { let (d, _) = doc_with_rect(); @@ -532,33 +548,34 @@ mod tests { let mut t = FamilyTool::new("spiral"); t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0))), (100.0, 80.0, 10)); - // Alt: twice the radius adds ln 2 / ln 1.25 ≈ 3.1 segments, half of it takes them away. + // Alt rounds the fitted count to whole winds from the count when Alt goes down. assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(alt))), (100.0, 80.0, 10)); - assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(alt))), (200.0, 80.0, 13)); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(alt))), (200.0, 80.0, 14)); // ↑ with Alt held adds one, and the held inner end moves with it. - assert_eq!(spiral(t.key(&cx, ToolKey::Up, alt)).2, 14); - assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(alt))).2, 14); - assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(alt))), (50.0, 80.0, 8)); + assert_eq!(spiral(t.key(&cx, ToolKey::Up, alt)).2, 15); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(alt))).2, 15); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(alt))), (50.0, 80.0, 7)); assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 101.0, 100.0).with_mods(alt))).2, 2, "at least two"); - assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(alt))).2, 8); - // Let go: the eight segments stay as the radius follows the pointer again. - assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0))), (100.0, 80.0, 8)); - // Ctrl/Cmd: the decay fits the held inner end, 80 % × (100 / r)^(1/8). + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(alt))).2, 7); + // The count stays as the radius follows the pointer again. + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0))), (100.0, 80.0, 7)); + // Ctrl/Cmd fits the decay to the held inner end. t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(ctrl)); let (r, decay, n) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(ctrl))); - assert!((r, n) == (50.0, 8) && (decay - 80.0 * 2f64.powf(1.0 / 8.0)).abs() < 1e-9, "{r} {decay} {n}"); + assert!((r, n) == (50.0, 7) && (decay - 80.0 * 2f64.powf(1.0 / 7.0)).abs() < 1e-9, "{r} {decay} {n}"); let (_, decay, _) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 400.0, 100.0).with_mods(ctrl))); - assert!((decay - 80.0 * (1.0f64 / 3.0).powf(1.0 / 8.0)).abs() < 1e-9, "{decay}"); + assert!((decay - 80.0 * (1.0f64 / 3.0).powf(1.0 / 7.0)).abs() < 1e-9, "{decay}"); assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 100.5, 100.0).with_mods(ctrl))).1, 99.99, "at most 99.99 %"); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 1e20, 100.0).with_mods(ctrl))).1, 5.0, "at least 5 %"); let (_, decay, _) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(ctrl))); - assert!((decay - 80.0 * 0.5f64.powf(1.0 / 8.0)).abs() < 1e-9, "{decay}"); + assert!((decay - 80.0 * 0.5f64.powf(1.0 / 7.0)).abs() < 1e-9, "{decay}"); // Let go: the decay stays, and the spiral drawn next keeps both. - assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 250.0, 100.0))), (150.0, decay, 8)); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 250.0, 100.0))), (150.0, decay, 7)); assert_eq!(t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 250.0, 100.0)), vec![Action::Commit]); - assert_eq!((t.options()["decay"].as_f64(), t.options()["segments"].clone()), (Some(decay), json!(8))); + assert_eq!((t.options()["decay"].as_f64(), t.options()["segments"].clone()), (Some(decay), json!(7))); t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); let (_, d2, n2) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 100.0, 140.0).with_mods(alt))); - assert_eq!((d2, n2), (decay, 8), "a new drag holds the end anew"); + assert_eq!((d2, n2), (decay, 7), "a new drag holds the end anew"); // 5 % and 300 segments: an inner radius of 100 × 0.05^300 is below the smallest f64. let mut t = FamilyTool::new("spiral"); t.set_option("decay", &json!(5.0)); @@ -568,9 +585,86 @@ mod tests { let (_, decay, _) = spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0).with_mods(ctrl))); assert!((decay - 5.0 * 2f64.powf(1.0 / 300.0)).abs() < 1e-9, "{decay}"); t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 100.0)); - // Alt: 200 times the radius adds ln 200 / ln (100 / decay) ≈ 1.8 segments. + // Alt: a large radius increase adds a whole wind. t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 120.0, 100.0).with_mods(alt)); - assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 4100.0, 100.0).with_mods(alt))).2, 302); + assert_eq!(spiral(t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200100.0, 100.0).with_mods(alt))).2, 304); + } + + /// Switching between Alt and Ctrl/Cmd keeps the held inner end and uses the current segment + /// count when Alt resumes. Escape clears the held end before the next drag. + #[test] + fn spiral_drag_switches_between_alt_and_ctrl_and_escape_lets_go_of_the_inner_end() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let mut cx = cx(&d, &s, &p); + cx.smart_guides = false; + let alt = Mods { alt: true, ..Mods::default() }; + let ctrl = Mods { cmd: true, ..Mods::default() }; + let both = Mods { alt: true, cmd: true, ..Mods::default() }; + let mut t = FamilyTool::new("spiral"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(alt)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(alt)); + assert_eq!(t.segments, 14); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(both)); + assert_eq!(t.segments, 14, "Ctrl/Cmd takes precedence"); + let decay = t.decay; + assert!(decay > 80.0); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(ctrl)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 300.0, 100.0).with_mods(alt)); + assert_eq!(t.segments, 18, "Alt resumes from the current count with the held end"); + assert_eq!(t.decay, decay); + t.key(&cx, ToolKey::Escape, alt); + assert_eq!(t.spiral_end, None); + assert_eq!(t.spiral_alt_base, None); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(alt)); + assert_eq!(t.segments, 18, "a new drag holds a new inner end"); + } + + /// Alt adjusts the segment count in whole winds while keeping it within 2 to 1000. + #[test] + fn spiral_drag_alt_keeps_the_segments_within_2_to_1000() { + let mut t = FamilyTool::new("spiral"); + let alt = Mods { alt: true, ..Mods::default() }; + let start = Point::new(0.0, 0.0); + t.hold_spiral_end(start, Point::new(100.0, 0.0), alt); + t.hold_spiral_end(start, Point::new(200.0, 0.0), alt); + assert_eq!(t.segments, 14); + t.hold_spiral_end(start, Point::new(0.01, 0.0), alt); + assert_eq!(t.segments, 2); + t.hold_spiral_end(start, Point::new(1e150, 0.0), alt); + assert_eq!(t.segments, 1000); + } + + #[test] + fn spiral_drag_arrows_and_release_clear_the_right_held_state() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let mut cx = cx(&d, &s, &p); + cx.smart_guides = false; + let alt = Mods { alt: true, ..Mods::default() }; + let both = Mods { alt: true, cmd: true, ..Mods::default() }; + let mut t = FamilyTool::new("spiral"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(both)); + t.key(&cx, ToolKey::Up, both); + assert_eq!(t.segments, 11); + assert_eq!(t.spiral_alt_base, None, "Ctrl/Cmd still takes precedence after Up"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 200.0, 100.0).with_mods(alt)); + assert_eq!(t.spiral_alt_base, Some(11), "Alt starts from the current count"); + t.key(&cx, ToolKey::Down, alt); + assert_eq!(t.segments, 10); + assert_eq!(t.spiral_alt_base, Some(10)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 200.0, 100.0).with_mods(alt)); + assert_eq!(t.spiral_end, None); + assert_eq!(t.spiral_alt_base, None); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 100.0, 100.0)); + assert_eq!(t.spiral_end, None, "Up after Down clears the held end"); + assert_eq!(t.spiral_alt_base, None, "Up after Down clears the Alt base"); } #[test] diff --git a/docs/mcp.md b/docs/mcp.md index b907decc29..1f5bd6571b 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -487,11 +487,12 @@ dragged, `c` chooses the tool bound to C, and `f` runs the shortcut bound to F i binding for it). While a spiral is being dragged out with the Spiral tool, a `drag` event with `mods.alt` or `mods.cmd` keeps the -spiral's inner end at the distance from the center it had at the first such event, and the outer end follows the -pointer. With `mods.alt` the number of segments changes to the nearest whole number of segments that fits (within -2…1000), so dragging outward adds segments and dragging inward removes them; with `mods.cmd` the decay changes to fit -(within 5…99.99 %). The spiral drawn on release uses the new values, and they stay as the Spiral tool's `segments` and -`decay` options for the next spiral: +spiral's inner end at the distance from the center it had on the first modified `drag` event, and the outer end follows +the pointer. With `mods.alt` alone, dragging outward adds whole winds of four segments and dragging inward removes +them. The fitted segment count rounds to the nearest whole wind from the count on the first Alt-only `drag`, within 2…1000. +With `mods.cmd`, decay changes to fit within 5…99.99 %; it takes precedence when both modifiers are held. Switching +back to Alt uses the current count as its new base while keeping the held inner end. The spiral drawn on release uses +the new values, and they stay as the Spiral tool's `segments` and `decay` options for the next spiral: ```json {"name":"pointer_gesture","arguments":{"tool":"spiral","events":[{"kind":"down","x":100,"y":100},{"kind":"drag","x":200,"y":100,"mods":{"alt":true}},{"kind":"drag","x":300,"y":100,"mods":{"alt":true}},{"kind":"up","x":300,"y":100}]}} diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 6387f91d35..0dd0423855 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -673,7 +673,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Shapes:** all shape tools (including Flare) and the line, arc, spiral and grid tools. Space held while dragging out a shape, line, arc, spiral or grid moves it at its current size. The Flare tool's center drag turns the rays with the pointer, Shift keeps them in their original orientation (unturned, or turned by a nonzero General › Constrain Angle), and Space held during either of its drags moves the flare. While a grid is dragged out, Up/Down change its rows (concentric dividers) and Left/Right its columns (radial dividers). A click with a grid tool asks for the size, the divider counts and the grid options (#1377, in part): a skew for each set of dividers, Use Outside Rectangle As Frame or Create Compound Path From Ellipses, and Fill Grid; they are parameters of `shape.rectangularGrid` and `shape.polarGrid`, stay as the tool's options and apply to drags too. The curve a skew percentage follows and the direction of the radial skew are our own (the public documentation gives neither), and the dialogs have no reference point locator. An ellipse's Pie Start and End Angle and Invert Pie (Transform and Properties panels' Ellipse Properties, `object.setLiveShape {pieStart, pieEnd, invertPie}`) cut it as a pie (#812). With the bounding box showing, the Selection tool shows a selected ellipse's two pie widgets just outside it; dragging one sets its angle in one undo step and double-clicking one makes the ellipse whole again. A live polygon's Polygon Properties there: side count, angle, corner type and radius, radius, side length and Make Sides Equal once an uneven scale has made its sides differ (`object.setLiveShape {sides, polygonAngle, polygonRadius, sideLength, makeSidesEqual}`, part of #812); a star is a plain path, as in Illustrator. The Flare Tool Options last as the tool's options: the next flare dragged out uses them, a click's dialog shows them and double-clicking the tool opens them (part of #812). - **Shapes:** all shape tools (including Flare) and the line, arc, spiral and grid tools. Space held while dragging out a shape, line, arc, spiral or grid moves it at its current size. The Flare tool's center drag turns the rays with the pointer, Shift keeps them in their original orientation, and Space held during either of its drags moves the flare. While a grid is dragged out, Up/Down change its rows (concentric dividers) and Left/Right its columns (radial dividers). A click with a grid tool asks for the size, the divider counts and the grid options (#1377, in part): a skew for each set of dividers, Use Outside Rectangle As Frame or Create Compound Path From Ellipses, and Fill Grid; they are parameters of `shape.rectangularGrid` and `shape.polarGrid`, stay as the tool's options and apply to drags too. The curve a skew percentage follows and the direction of the radial skew are our own (the public documentation gives neither), and the dialogs have no reference point locator. An ellipse's Pie Start and End Angle and Invert Pie (Transform and Properties panels' Ellipse Properties, `object.setLiveShape {pieStart, pieEnd, invertPie}`) cut it as a pie (#812). With the bounding box showing, the Selection tool shows a selected ellipse's two pie widgets just outside it; dragging one sets its angle in one undo step and double-clicking one makes the ellipse whole again. A live polygon's Polygon Properties there: side count, angle, corner type and radius, radius, side length and Make Sides Equal once an uneven scale has made its sides differ (`object.setLiveShape {sides, polygonAngle, polygonRadius, sideLength, makeSidesEqual}`, part of #812); a star is a plain path, as in Illustrator. The Flare Tool Options last as the tool's options: the next flare dragged out uses them, a click's dialog shows them and double-clicking the tool opens them (part of #812). While an arc is dragged out, C switches it between open and closed, F switches its base between the X and Y axes in the same box, and Up/Down raise and lower its slope by 10 within −100…100; each press switches once, and the values stay as the Arc tool's options. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list C, F and Up/Down for an arc being dragged out. F as the base switch, the arrows changing the slope, the step of 10 and one switch per press are our own rules. - While a spiral is dragged out, Alt adds or removes segments and Ctrl/Cmd changes the decay; both keep the spiral's inner end at the distance from the center it had when the key went down while the outer end follows the pointer, and the values stay as the Spiral tool's options. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list Alt-drag to add or subtract winds and Ctrl-drag to change the decay rate. The held inner radius, rounding to whole segments, the ranges (2…1000 segments, 5…99.99 % decay) and the new values staying are our own rules. + While a spiral is dragged out, Alt adds or removes whole winds of four segments and Ctrl/Cmd changes the decay. The spiral's inner end keeps the distance from the center it had on the first modified drag event, while the outer end follows the pointer. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list Alt-drag to add or subtract winds and Ctrl-drag to change the decay rate; [Draw spirals](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-spirals.html) defines four segments per full wind. Rounding the fitted count to whole winds from the count on the first Alt-only drag event, the held inner radius, the ranges (2…1000 segments, 5…99.99 % decay), Ctrl/Cmd taking precedence when both are held, and the new values staying as Spiral tool options are our own rules. Switching back to Alt uses the current count as its new base while keeping the held inner end. - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. Eraser Tool Options has Angle and Roundness besides Size, as [Erase paths using the Eraser tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/erase-paths-using-eraser-tool.html) describes: the Eraser's tip is an ellipse Size across, its long axis at Angle and its short axis Roundness percent of the long one, and a drag with a tip that is not round shows the outline of the area it erases (`path.eraseRegion` `angle` and `roundness`). From 16db8b6a1a2952ab854043d135a192a1a154b67c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 07:41:26 -0700 Subject: [PATCH 041/227] PDF export: bound a colorized image's color channel A colorized image's color channel is the paint's samples repeated once a pixel, and nothing bounded its size: an image colorized in Registration in a document with many spot swatches could allocate without limit, and an overflowing length panicked inside repeat. The length is now computed with checked arithmetic and refused above MAX_RASTER_ALLOC, the image's own decode budget, and the export leaves such an image out with the existing "an image couldn't be decoded" warning instead of drawing it uncolored. --- crates/pdf/src/export/images.rs | 25 +++++++++++++++++++++++-- crates/pdf/src/export/nodes.rs | 18 +++++++++++++----- 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/crates/pdf/src/export/images.rs b/crates/pdf/src/export/images.rs index 63bf1e7d5e..74fa5ba465 100644 --- a/crates/pdf/src/export/images.rs +++ b/crates/pdf/src/export/images.rs @@ -3,6 +3,12 @@ use super::{Arc, BlendMode, Color, Exporter, Image, NodeKind, Paint, Rect, Size, use krilla::color::device_n::{Colorant, DeviceNSpace, Process}; use krilla::image::{BitsPerComponent, CustomImage, ImageColorspace}; +/// The byte count of a repeated color channel, within [`vectorcraft_doc::MAX_RASTER_ALLOC`]. +fn tinted_color_len(samples: usize, pixels: usize) -> Option { + let bytes = samples.checked_mul(pixels)?; + (u64::try_from(bytes).ok()? <= vectorcraft_doc::MAX_RASTER_ALLOC).then_some(bytes) +} + /// A colorized image's pixels: one color in every pixel, shown as much as its soft mask says. #[derive(Clone, Hash)] struct Tinted { @@ -52,8 +58,9 @@ impl Exporter<'_> { /// every process ink and every spot ink of the document, other colors in gray, RGB or CMYK as /// the Output settings write them. The coverage is resampled as the Compression settings ask /// ([`crate::images::coverage_sized`]). `None` when the paint isn't a solid color or the pixels - /// can't be decoded; cached like [`Self::load_image`]. With `interpolate` (and the export's own - /// setting), viewers may smooth it. + /// can't be decoded or its color channel exceeds [`vectorcraft_doc::MAX_RASTER_ALLOC`]; cached + /// like [`Self::load_image`]. With `interpolate` (and the export's own setting), viewers may + /// smooth it. pub(super) fn colorized_image(&mut self, im: &vectorcraft_doc::ImageObject, paint: &Paint, interpolate: bool) -> Option { let Paint::Solid { color, swatch, tint } = paint else { return None }; let size = placed_size(im); @@ -96,6 +103,7 @@ impl Exporter<'_> { other => (other.to_rgb().map(q).to_vec(), ImageColorspace::Rgb), }, }; + tinted_color_len(samples.len(), n)?; let color = Arc::new(samples.repeat(n)); let img = Image::from_custom(Tinted { color, alpha: Arc::new(alpha), width, height, space, device_n }, interpolate).ok(); self.images.insert(cache, img.clone()); @@ -245,3 +253,16 @@ pub(super) fn embed(blob: &vectorcraft_doc::ImageBlob, interpolate: bool, sixtee Some(Image::from_rgba8(rgba.into_raw(), w, h)) }) } + +#[cfg(test)] +mod tests { + use super::tinted_color_len; + + #[test] + fn tinted_color_rejects_oversized_and_overflowing_buffers() { + let max = usize::try_from(vectorcraft_doc::MAX_RASTER_ALLOC).unwrap_or(usize::MAX); + assert_eq!(tinted_color_len(4, max / 4), Some(max)); + assert_eq!(tinted_color_len(4, max / 4 + 1), None); + assert_eq!(tinted_color_len(4, usize::MAX), None); + } +} diff --git a/crates/pdf/src/export/nodes.rs b/crates/pdf/src/export/nodes.rs index 3302766df6..f2edf94687 100644 --- a/crates/pdf/src/export/nodes.rs +++ b/crates/pdf/src/export/nodes.rs @@ -1,4 +1,4 @@ -use super::exporter::{address, blend, color, constant_mask, cover, in_range, norm, rects_overlap, rule, to_path, writable, xf}; +use super::exporter::{UNDECODED, address, blend, color, constant_mask, cover, in_range, norm, rects_overlap, rule, to_path, writable, xf}; use super::{ Affine, AppearanceItem, BezPath, BlendMode, Exporter, Fill, FillRule, LineCap, LineJoin, Mark, Node, NodeKind, NormalizedF32, Paint, Path, Rect, Shape, Stroke, StrokeAlign, StrokeDash, StrokeLayer, Surface, WrittenShape, krilla, stroke, @@ -182,10 +182,18 @@ impl Exporter<'_> { self.shape(s, n, &bp, *rule, page); } NodeKind::Text(t) => self.text(s, n, t, page), - NodeKind::Image(im) => { - let colorized = n.extras().colorize.as_deref().and_then(|p| self.colorized_image(im, p, !n.extras().pixelated)); - self.image(s, im, colorized.or(alpha), n.extras().pixelated) - } + NodeKind::Image(im) => match n.extras().colorize.as_deref() { + Some(p @ Paint::Solid { .. }) => { + if writable(s, im.xf, Rect::new(0.0, 0.0, im.width.max(1).into(), im.height.max(1).into())) { + if let Some(colorized) = self.colorized_image(im, p, !n.extras().pixelated) { + self.image(s, im, Some(colorized), n.extras().pixelated); + } else { + self.warn(UNDECODED); + } + } + } + _ => self.image(s, im, alpha, n.extras().pixelated), + }, NodeKind::SymbolInstance { symbol, xf } => { // Within the objects a frame may draw of symbol instances, as on screen: nested // instances multiply. From ae0ce1888d0608fe726da48822fc080ba7483326 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 07:51:50 -0700 Subject: [PATCH 042/227] Libraries: library loads check name before reading the file swatch.library.load, graphicStyle.loadLibrary, symbol.loadLibrary and brush.loadLibrary read the whole file or decoded data before checking `name`, so a call with a `name` that is not a string read the file first, and with a missing file reported the file error instead of the parameter error. The shared loader now checks every parameter before it reads anything. --- crates/engine/src/cmd/swatchlib.rs | 7 +++++-- crates/engine/src/tests/swatchlib.rs | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/swatchlib.rs b/crates/engine/src/cmd/swatchlib.rs index f88130763c..b7a0e2f299 100644 --- a/crates/engine/src/cmd/swatchlib.rs +++ b/crates/engine/src/cmd/swatchlib.rs @@ -232,13 +232,16 @@ impl Libraries { /// others are listed as loaded until the app quits. pub(crate) fn load(&mut self, p: &Value, cmd: &str, parse: impl FnOnce(&[u8], &str) -> Result) -> Result<(LibraryInfo, Arc)> { let path = text_param(p, "path", cmd)?; - let bytes = match (path, text_param(p, "data", cmd)?, text_param(p, "dataBase64", cmd)?) { + let data = text_param(p, "data", cmd)?; + let data_base64 = text_param(p, "dataBase64", cmd)?; + let name = text_param(p, "name", cmd)?; + let bytes = match (path, data, data_base64) { (Some(path), ..) => read_file(path)?, (None, Some(text), _) => text.as_bytes().to_vec(), (None, None, Some(b64)) => vectorcraft_format::base64_decode(b64).ok_or_else(|| bad(cmd, "bad dataBase64"))?, _ => return Err(bad(cmd, "give `path`, `data` or `dataBase64`")), }; - let file = text_param(p, "name", cmd)?.map(str::to_string).or_else(|| path.map(file_name)).unwrap_or_else(|| "Library".into()); + let file = name.map(str::to_string).or_else(|| path.map(file_name)).unwrap_or_else(|| "Library".into()); let lib = parse(&bytes, &file)?; self.rescan(); let user = diff --git a/crates/engine/src/tests/swatchlib.rs b/crates/engine/src/tests/swatchlib.rs index 7e3e8d616c..c20968db54 100644 --- a/crates/engine/src/tests/swatchlib.rs +++ b/crates/engine/src/tests/swatchlib.rs @@ -215,6 +215,22 @@ fn library_commands_refuse_params_of_the_wrong_form() { assert!(r["added"].as_array().is_some_and(|a| !a.is_empty()), "{r}"); } +#[test] +fn library_loads_validate_name_before_reading_a_file_or_decoding_data() { + let mut s = session(); + let missing = temp_dir("invalid-load-name").join("missing.vcswatches").to_string_lossy().to_string(); + for cmd in ["swatch.library.load", "graphicStyle.loadLibrary", "symbol.loadLibrary", "brush.loadLibrary"] { + for name in [json!(5), json!([])] { + let p = json!({"path": missing, "name": name}); + let e = s.execute(cmd, &p).unwrap_err().to_string(); + assert!(e.contains("`name` must be a string"), "{cmd} {p}: {e}"); + } + let p = json!({"dataBase64": "not base64!", "name": 5}); + let e = s.execute(cmd, &p).unwrap_err().to_string(); + assert!(e.contains("`name` must be a string"), "{cmd} {p}: {e}"); + } +} + #[test] fn libraries_saved_in_the_user_folder_are_user_defined() { let dir = temp_dir("user"); From b3f1d57ecf93c3680a5bd4bec7afecb0aed2cb46 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 07:51:50 -0700 Subject: [PATCH 043/227] Graphic Styles: addFromLibrary treats ids: null as left out graphicStyle.addFromLibrary with apply: true and ids: null tried to apply the style to no objects and failed with "no such objects" when nothing was selected. A null `ids` now behaves as leaving `ids` out: the style is applied to the selection when there is one, and only added otherwise. --- crates/engine/src/cmd/stylelib.rs | 5 +++-- crates/engine/src/tests/stylelib.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/cmd/stylelib.rs b/crates/engine/src/cmd/stylelib.rs index 1f4792c084..2864f574b0 100644 --- a/crates/engine/src/cmd/stylelib.rs +++ b/crates/engine/src/cmd/stylelib.rs @@ -194,10 +194,11 @@ fn add(s: &mut Session, p: &Value) -> Result { "existing": existing.iter().map(|g| &g.name).collect::>(), }); let first = picked.first().map(|g| doc_name(&g.name)); - let targets = p.get("ids").is_some() || !super::appearance::appearance_targets(s, &json!({}))?.is_empty(); + let ids = p.get("ids").filter(|v| !v.is_null()); + let targets = ids.is_some() || !super::appearance::appearance_targets(s, &json!({}))?.is_empty(); if let Some(name) = first.filter(|_| apply && targets) { let mut params = json!({"name": name, "add": add}); - if let Some(ids) = p.get("ids") { + if let Some(ids) = ids { params["ids"] = ids.clone(); } s.execute("graphicStyle.apply", ¶ms)?; diff --git a/crates/engine/src/tests/stylelib.rs b/crates/engine/src/tests/stylelib.rs index 2c3a4c6fbf..6a93b80a3d 100644 --- a/crates/engine/src/tests/stylelib.rs +++ b/crates/engine/src/tests/stylelib.rs @@ -117,6 +117,35 @@ fn add_with_apply_styles_the_selection_in_the_same_undo_step() { assert_eq!(doc(&s).node(id).unwrap().opacity, 0.4); } +#[test] +fn add_with_null_ids_and_no_selection_only_adds_style() { + let mut omitted = session(); + let mut null_ids = session(); + let params = json!({"library": "shadows-glows", "name": "Halo", "apply": true}); + let expected = run(&mut omitted, "graphicStyle.addFromLibrary", params.clone()); + let mut with_null = params; + with_null["ids"] = Value::Null; + let actual = run(&mut null_ids, "graphicStyle.addFromLibrary", with_null); + assert_eq!(actual, expected); + assert_eq!(names(&actual["added"]), ["Halo"]); + assert!(actual.get("applied").is_none()); + assert!(doc(&null_ids).graphic_style("Halo").is_some()); + assert_eq!(undo_len(&null_ids), undo_len(&omitted)); +} + +#[test] +fn add_with_null_ids_applies_to_selection() { + let mut s = session(); + let id = rect(&mut s, 10.0, 20.0, 100.0, 50.0); + let before = undo_len(&s); + let result = run(&mut s, "graphicStyle.addFromLibrary", json!({"library": "shadows-glows", "name": "Halo", "apply": true, "ids": null})); + assert_eq!(result["applied"], "Halo"); + assert_eq!(undo_len(&s), before + 1); + let (style, linked) = s.selection_graphic_style().unwrap(); + assert_eq!((style.name.as_str(), linked), ("Halo", true)); + assert_eq!(doc(&s).node(id).unwrap().extras().graphic_style, Some(style.id)); +} + /// A document with pattern `name` (a dot) and its swatch. fn add_pattern(s: &mut Session, name: &str, radius: f64) { s.edit("Pattern", |d, _| { From 6c9933666bbb8c1625c2698c926f7f483bf05939 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 08:06:53 -0700 Subject: [PATCH 044/227] PDF: colorized images count as transparency for PDF 1.3 and PDF/X A colorized grayscale or 1-bit image draws its white pixels transparent and is written to PDF with the image as a soft mask. Node::shows_transparency did not count it, so a PDF 1.3, PDF/X-1a or PDF/X-3 export whose only transparency was a colorized image was not flattened and kept the soft mask. A legacy .ai save also wrote such an image as opaque. - shows_transparency counts a visible image with a colorize paint. - The legacy .ai writer flattens or leaves out colorized images like other see-through images. --- crates/doc/src/node/ops.rs | 5 +- crates/engine/src/cmd/fileio/legacy_ai.rs | 10 ++- crates/engine/src/cmd/fileio/pdf.rs | 6 +- crates/engine/src/tests/colorize.rs | 78 +++++++++++++++++++++++ 4 files changed, 91 insertions(+), 8 deletions(-) diff --git a/crates/doc/src/node/ops.rs b/crates/doc/src/node/ops.rs index cdbdeec27a..fcf2c9429d 100644 --- a/crates/doc/src/node/ops.rs +++ b/crates/doc/src/node/ops.rs @@ -683,8 +683,8 @@ impl Node { impl Node { /// Whether this object shows any transparency, itself or anything inside it: object, fill or - /// stroke opacity below 100%, a blend mode, an opacity mask, effects or transparent gradient - /// stops. Hidden objects show none. + /// stroke opacity below 100%, a blend mode, an opacity mask, effects, transparent gradient + /// stops or a colorized image. Hidden objects show none. pub fn shows_transparency(&self) -> bool { use vectorcraft_color::Paint; let see_through = |p: &Paint| matches!(p, Paint::Gradient(g) if g.gradient.stops.iter().any(|s| s.opacity < 1.0)); @@ -693,6 +693,7 @@ impl Node { && (self.opacity < 1.0 || self.blend != BlendMode::Normal || self.extras().mask.as_ref().is_some_and(|m| !m.disabled) + || (matches!(self.kind, NodeKind::Image(_)) && self.extras().colorize.is_some()) || effects(&self.appearance.effects) || self .appearance diff --git a/crates/engine/src/cmd/fileio/legacy_ai.rs b/crates/engine/src/cmd/fileio/legacy_ai.rs index c7c467dc8c..6a87b1e9e7 100644 --- a/crates/engine/src/cmd/fileio/legacy_ai.rs +++ b/crates/engine/src/cmd/fileio/legacy_ai.rs @@ -174,8 +174,8 @@ fn expand_image_patterns(d: &mut Document) -> Result<()> { } /// The images of `d` a legacy `.ai` can't hold, in paint order with their places in it (as -/// [`Document::walk`] counts). These are the images with see-through pixels, and the images -/// that have opacity or a blending mode of their own or, with `flatten`, of a group they are in. +/// [`Document::walk`] counts). These have see-through pixels or a colorize paint, or have opacity +/// or a blending mode of their own or, with `flatten`, of a group they are in. /// With `flatten` only visible images are returned, because a hidden one (which the hidden objects /// option may write) is written over white. With `omit` all of them are returned. fn see_through_images(d: &Document, mode: SeeThrough) -> Vec<(usize, NodeId)> { @@ -184,7 +184,11 @@ fn see_through_images(d: &Document, mode: SeeThrough) -> Vec<(usize, NodeId)> { let mut at = 0; d.walk(|n| { if let NodeKind::Image(im) = &n.kind - && (keys.contains(&im.key) || n.opacity < 1.0 || n.blend != BlendMode::Normal || (mode == SeeThrough::Flatten && transparent(d, n.id))) + && (keys.contains(&im.key) + || n.extras().colorize.is_some() + || n.opacity < 1.0 + || n.blend != BlendMode::Normal + || (mode == SeeThrough::Flatten && transparent(d, n.id))) { out.push((at, n.id)); } diff --git a/crates/engine/src/cmd/fileio/pdf.rs b/crates/engine/src/cmd/fileio/pdf.rs index 7902a0fed1..dfa7d1cfa7 100644 --- a/crates/engine/src/cmd/fileio/pdf.rs +++ b/crates/engine/src/cmd/fileio/pdf.rs @@ -317,9 +317,9 @@ pub const DEFAULT_FLATTENER: &str = "High Resolution"; /// `doc` with its transparency flattened for a PDF 1.3 file (asked for, or PDF/X-1a and PDF/X-3, /// whose files have none), with `flattenerPreset` (default High Resolution) and `p`'s `flattener` -/// options over it; images with see-through pixels count as transparency, rasterized areas are -/// clipped to their regions, and discarded overprints are dropped. `None` when nothing changes (or -/// the file keeps transparency). +/// options over it; images with see-through pixels and colorized images count as transparency, +/// rasterized areas are clipped to their regions, and discarded overprints are dropped. `None` +/// when nothing changes (or the file keeps transparency). fn flatten_for(cmd: &str, doc: &Document, set: &PdfSettings, p: &Value) -> Result> { if !set.pdf13() { return Ok(None); diff --git a/crates/engine/src/tests/colorize.rs b/crates/engine/src/tests/colorize.rs index 8ae5dd0f9f..444d365fd1 100644 --- a/crates/engine/src/tests/colorize.rs +++ b/crates/engine/src/tests/colorize.rs @@ -54,6 +54,84 @@ fn colorize(s: &Session, id: NodeId) -> Option { s.doc().unwrap().doc.node(id).unwrap().extras().colorize.as_deref().cloned() } +#[test] +fn colorized_gray_image_is_flattened_for_pdf_13() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + assert!(!s.doc().unwrap().doc.layers[0].shows_transparency()); + let plain = s.execute("document.exportPdf", &json!({"compatibility": "1.3"})).unwrap(); + assert!( + plain["warnings"].as_array().unwrap().iter().all(|w| !w.as_str().unwrap().contains("transparency is flattened")), + "{}", + plain["warnings"] + ); + + s.execute("paint.setFill", &json!({"color": "#ff0000", "ids": [id.0]})).unwrap(); + assert!(s.doc().unwrap().doc.layers[0].shows_transparency()); + let tinted = s.execute("document.exportPdf", &json!({"compatibility": "1.3"})).unwrap(); + assert!( + tinted["warnings"].as_array().unwrap().iter().any(|w| w.as_str().unwrap().contains("transparency is flattened")), + "{}", + tinted["warnings"] + ); + let bytes = vectorcraft_format::base64_decode(tinted["dataBase64"].as_str().unwrap()).unwrap(); + assert!(!String::from_utf8_lossy(&bytes).contains("/SMask"), "PDF 1.3 has no soft mask"); +} + +#[test] +fn colorized_gray_image_is_flattened_for_pdf_x_1a() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#ff0000", "ids": [id.0]})).unwrap(); + let out = s.execute("document.exportPdf", &json!({"standard": "pdfX1a"})).unwrap(); + assert!(out["warnings"].as_array().unwrap().iter().any(|w| w.as_str().unwrap().contains("transparency is flattened")), "{}", out["warnings"]); + let bytes = vectorcraft_format::base64_decode(out["dataBase64"].as_str().unwrap()).unwrap(); + assert!(!String::from_utf8_lossy(&bytes).contains("/SMask"), "PDF/X-1a has no soft mask"); +} + +#[test] +fn colorized_gray_image_is_omitted_from_legacy_ai_when_requested() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#ff0000", "ids": [id.0]})).unwrap(); + let out = s.execute("file.saveCopy", &json!({"format": "ai", "aiVersion": "7", "transparentImages": "omit"})).unwrap(); + assert!(out["warnings"].as_array().unwrap().iter().any(|w| w.as_str().unwrap().contains("are left out")), "{}", out["warnings"]); +} + +#[test] +fn flattened_colorized_image_shows_the_art_under_white_pixels() { + let mut s = session(); + let background = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 40, "height": 20})).unwrap()["id"].as_u64().unwrap(); + s.execute("paint.setFill", &json!({"color": "#0000ff", "ids": [background]})).unwrap(); + s.execute("paint.setStroke", &json!({"none": true, "ids": [background]})).unwrap(); + let id = image(&mut s, "gray", gray(false)); + s.edit("Scale image", |d, _| { + if let NodeKind::Image(im) = &mut d.node_mut(id).unwrap().kind { + im.xf = vectorcraft_geom::Affine::scale(20.0); + } + Ok(()) + }) + .unwrap(); + s.execute("paint.setFill", &json!({"color": "#ff0000", "ids": [id.0]})).unwrap(); + s.execute("object.arrange.bringToFront", &json!({"ids": [id.0]})).unwrap(); + let doc = &s.doc().unwrap().doc; + let mut options = crate::cmd::flatten::FlattenOptions::preset("low").unwrap(); + options.no_transparency = Some(Default::default()); + options.clip_complex_regions = true; + let flat = crate::cmd::flatten::flatten_document(doc, &options).unwrap().unwrap(); + let region = vectorcraft_geom::Rect::new(0.0, 0.0, 40.0, 20.0); + let before = vectorcraft_render::Renderer::new().render_region(doc, region, 1.0, true); + let after = vectorcraft_render::Renderer::new().render_region(&flat, region, 1.0, true); + for (x, expected) in [(10, [255, 0, 0]), (30, [0, 0, 255])] { + let a = before.pixel(x, 10); + let b = after.pixel(x, 10); + for channel in 0..3 { + assert!((i16::from(a[channel]) - i16::from(b[channel])).abs() <= 10, "x={x}: {a:?} became {b:?}"); + assert!((i16::from(b[channel]) - expected[channel]).abs() <= 10, "x={x}: {b:?}"); + } + } +} + #[test] fn a_fill_color_colorizes_a_gray_image_and_none_takes_it_off() { let mut s = session(); From 29fb6bcd896674f38b398d515371f9ccf870d345 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 08:35:34 -0700 Subject: [PATCH 045/227] Images: color edits recolor a colorized image's fill paint.invert and paint.complement on the Fill proxy, the Edit Colors commands, the Blend commands and recolor.apply now recolor the color that colorizes a grayscale or 1-bit image, as one undo step with the other targets. Before, they left it unchanged. Expand Appearance and Object > Expand bake color adjustment effects into that color too. - A colorized image's pixels are not recolored; they stay the gray coverage of its color. A stroke-only pass reaches the image's stroke items and leaves its colorize color unchanged. - A command that would leave a process color on a grayscale image with an alpha channel fails with the existing message and changes nothing. Object > Expand undoes its earlier steps when that happens. - A colorized image counts as a filled object in a blend. --- crates/doc/src/recolor.rs | 19 +- crates/engine/src/cmd/colorcmds.rs | 20 +- crates/engine/src/cmd/effectcmd.rs | 2 + crates/engine/src/cmd/expand.rs | 17 +- crates/engine/src/cmd/paint.rs | 7 +- crates/engine/src/cmd/recolor.rs | 2 + crates/engine/src/tests/colorize.rs | 306 +++++++++++++++++++++++++++- docs/mcp.md | 23 ++- 8 files changed, 370 insertions(+), 26 deletions(-) diff --git a/crates/doc/src/recolor.rs b/crates/doc/src/recolor.rs index a5a8787104..0efa82296a 100644 --- a/crates/doc/src/recolor.rs +++ b/crates/doc/src/recolor.rs @@ -18,8 +18,8 @@ pub trait ColorVisitor { fn image(&mut self, key: &str) -> Option; } -/// What a recolouring pass reaches: fills (with gradient-mesh points), strokes and the pixels of -/// embedded images. +/// What a recolouring pass reaches: fills (including colorized image fills and gradient-mesh +/// points), strokes and the pixels of embedded images without a colorize paint. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct Reach { pub fill: bool, @@ -33,11 +33,18 @@ impl Reach { } /// Recolour `n` and everything inside it through `v`: the paints of its fills and strokes and of -/// its text runs, its gradient-mesh points and an embedded image's pixels (linked images stay -/// as they are). Members that change are replaced by copies; the others stay shared. Returns the -/// number of paints, meshes and images that changed. +/// its text runs, its gradient-mesh points and an embedded image's pixels (linked and colorized +/// images keep their pixels). Members that change are replaced by copies; the others stay shared. +/// Returns the number of paints, meshes and images that changed. pub fn recolor_node(n: &mut Node, reach: Reach, v: &mut dyn ColorVisitor) -> usize { let mut changed = 0; + let colorized = matches!(&n.kind, NodeKind::Image(_)) && n.extras().colorize.is_some(); + if colorized + && reach.fill + && let Some(paint) = n.extras_mut().colorize.as_deref_mut() + { + changed += v.paint(paint) as usize; + } for it in &mut n.appearance.items { match it { AppearanceItem::Fill(l) if reach.fill => changed += v.paint(&mut l.paint) as usize, @@ -67,7 +74,7 @@ pub fn recolor_node(n: &mut Node, reach: Reach, v: &mut dyn ColorVisitor) -> usi } // An image holding its own pixels is a glyph's (emoji in outlined type): it keeps its // colours, as the glyph does in type. - NodeKind::Image(im) if reach.images && im.link.is_none() && im.pixels.is_none() => { + NodeKind::Image(im) if reach.images && !colorized && im.link.is_none() && im.pixels.is_none() => { if let Some(k) = v.image(&im.key) { im.key = k; changed += 1; diff --git a/crates/engine/src/cmd/colorcmds.rs b/crates/engine/src/cmd/colorcmds.rs index 49b729c8ad..2fadc11fde 100644 --- a/crates/engine/src/cmd/colorcmds.rs +++ b/crates/engine/src/cmd/colorcmds.rs @@ -30,7 +30,7 @@ pub fn specs() -> Vec { "Invert Colors", ["Edit", "Edit Colors"], None, - "{fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?} replace each colour by its RGB inverse (keeps the colour model) in fills, strokes, text, gradient meshes (with fills), embedded images (a recoloured copy) and pattern tiles (a new pattern swatch; the original stays), as one undo step → {changed}", + "{fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?} replace each colour by its RGB inverse (keeps the colour model) in fills, strokes, text, gradient meshes (with fills), colorized image fills (their pixels stay unchanged), other embedded images (a recoloured copy) and pattern tiles (a new pattern swatch; the original stays), as one undo step → {changed}", has_selection, |s, p| recolor(s, p, "Invert Colors", &invert) ), @@ -178,10 +178,10 @@ impl Scope { /// One recolouring pass, the colour visitor Edit Colors and Recolor Artwork share: `f` maps the /// solid colours and gradient stops of fills, strokes and text runs, gradient-mesh points, the -/// pixels of embedded images and the art of patterns used as fills or strokes. A recoloured image -/// becomes a new image and a recoloured pattern a new pattern swatch ("Dots 2"); the originals stay -/// as they are for other objects. Colours that change lose their swatch link. Only nodes that -/// change are kept as copies. +/// pixels of embedded images without a colorize paint and the art of patterns used as fills or +/// strokes. A recoloured image becomes a new image and a recoloured pattern a new pattern swatch +/// ("Dots 2"); the originals stay as they are for other objects. Colours that change lose their +/// swatch link. Only nodes that change are kept as copies. pub(crate) struct Recolor<'a> { f: &'a dyn Fn(Color) -> Color, /// Maps solid colours and gradient stops with their link and tint in place of `f`. @@ -341,7 +341,12 @@ fn run_pass(s: &mut Session, p: &Value, label: &str, pass: Recolor) -> Result v, None => selected_roots(s)?, }; - let n = s.edit(label, |d, _| Ok(pass.run(d, &ids)))?; + let colorized_ok = super::paint::check_colorized(&s.doc()?.doc).is_ok(); + let n = s.edit(label, |d, _| { + let n = pass.run(d, &ids); + super::paint::check_colorized_kept(colorized_ok, d).map_err(|e| bad(label, e))?; + Ok(n) + })?; Ok(json!({ "changed": n })) } @@ -451,6 +456,7 @@ fn filled_leaves(d: &Document, roots: &[NodeId]) -> Vec { fn fill_color(n: &Node) -> Option { match &n.kind { NodeKind::Text(t) => t.first_style().fill.color(), + NodeKind::Image(_) => n.extras().colorize.as_deref().and_then(Paint::color).or_else(|| n.appearance.fill_paint().color()), NodeKind::Mesh(m) => { let k = m.points.len() as f32; let sum = m.points.iter().map(|p| p.color.to_rgb()).reduce(|a, c| [a[0] + c[0], a[1] + c[1], a[2] + c[2]])?; @@ -487,6 +493,7 @@ fn blend(s: &mut Session, order: BlendOrder) -> Result { BlendOrder::Vertical => "Blend Vertically", }; let fills = Scope { fill: true, stroke: false, images: false, patterns: false }; + let colorized_ok = super::paint::check_colorized(&s.doc()?.doc).is_ok(); let changed = s.edit(label, |d, _| { let mut changed = 0; for (i, id) in ids.iter().enumerate().take(n - 1).skip(1) { @@ -504,6 +511,7 @@ fn blend(s: &mut Session, order: BlendOrder) -> Result { }; changed += Recolor::new(fills, &*f).run(d, &[*id]); } + super::paint::check_colorized_kept(colorized_ok, d).map_err(|e| bad(label, e))?; Ok(changed) })?; Ok(json!({ "changed": changed })) diff --git a/crates/engine/src/cmd/effectcmd.rs b/crates/engine/src/cmd/effectcmd.rs index bdd252da4f..ec659abe8b 100644 --- a/crates/engine/src/cmd/effectcmd.rs +++ b/crates/engine/src/cmd/effectcmd.rs @@ -732,6 +732,7 @@ fn expanded_node(d: &mut Document, mut n: Node, brushes: &[vectorcraft_brush::Br fn expand_appearance(s: &mut Session, p: &Value) -> Result { let roots = appearance_targets(s, p)?; let failed = vectorcraft_render::decode_failures(); + let colorized_ok = super::paint::check_colorized(&s.doc()?.doc).is_ok(); let ids = s.edit("Expand Appearance", |d, _| { let brushes = vectorcraft_brush::library(d); let mut out = vec![]; @@ -745,6 +746,7 @@ fn expand_appearance(s: &mut Session, p: &Value) -> Result { if out.is_empty() { return Err(EngineError::Other("Expand Appearance: the selection has a basic appearance".into())); } + super::paint::check_colorized_kept(colorized_ok, d).map_err(|e| bad("Expand Appearance", e))?; Ok(out) })?; let mut out = json!({ "ids": ids_json(&ids) }); diff --git a/crates/engine/src/cmd/expand.rs b/crates/engine/src/cmd/expand.rs index 8dc49b0890..b117b77a95 100644 --- a/crates/engine/src/cmd/expand.rs +++ b/crates/engine/src/cmd/expand.rs @@ -189,6 +189,15 @@ fn pattern_fill<'a, 'd>(d: &'d Document, i: &'a AppearanceItem) -> Option<(&'a F } fn expand(s: &mut Session, p: &Value) -> Result { + let scope = s.begin_undo_scope(); + let result = expand_steps(s, p); + if let Some(scope) = scope { + s.end_undo_scope(scope, result.is_err()); + } + result +} + +fn expand_steps(s: &mut Session, p: &Value) -> Result { let object = bool_or(p, "object", true); let fill = bool_or(p, "fill", true); let stroke = bool_or(p, "stroke", true); @@ -218,7 +227,13 @@ fn expand(s: &mut Session, p: &Value) -> Result { s.edit("Expand", |d, _| super::patterncmds::expand_repeats(d, &roots).map(|_| ()))?; } if object && e.effects { - let _ = run_raw(s, "effect.expandAppearance", &json!({})); + // Effects that Expand Appearance can't expand are left as they are. When it refuses to + // leave a process color on a grayscale image with transparency, Expand fails as a whole. + if let Err(e) = run_raw(s, "effect.expandAppearance", &json!({})) + && super::paint::is_colorize_refusal(&e) + { + return Err(e); + } // What is left to expand is in the baked art: Expand Appearance leaves strokes strokes // (#3089), a group's own as stroked paths among its members, which Stroke outlines below. e = Expandable::of(&s.doc()?.doc, &selected_roots(s)?); diff --git a/crates/engine/src/cmd/paint.rs b/crates/engine/src/cmd/paint.rs index c0ca01b673..33c69589b7 100644 --- a/crates/engine/src/cmd/paint.rs +++ b/crates/engine/src/cmd/paint.rs @@ -681,6 +681,11 @@ pub(super) fn check_colorized_kept(was_ok: bool, d: &Document) -> std::result::R if was_ok { check_colorized(d) } else { Ok(()) } } +/// Is `e` the refusal of [`check_colorized`]? +pub(super) fn is_colorize_refusal(e: &EngineError) -> bool { + e.to_string().contains(PROCESS_ON_TRANSPARENCY) +} + /// Is `c` black or white (white, or black alone at 100%)? fn black_or_white(c: &Color) -> bool { let (none, full) = (|v: f32| v <= 0.0, |v: f32| v >= 1.0); @@ -835,7 +840,7 @@ fn proxy_recolor(s: &mut Session, p: &Value, cmd: &str, label: &str, f: &dyn Fn( })?; (json!({ "changed": changed }), Some(index)) } - // The proxy's colours only: images and pattern tiles stay as they are. + // The proxy recolors its paints, including a colorized image's fill, without changing image pixels or pattern tiles. ItemTarget::Top => { let q = json!({"fill": !stroke, "stroke": stroke, "includeImages": false, "includePatterns": false, "ids": ids.iter().map(|i| i.0).collect::>()}); (super::colorcmds::recolor(s, &q, label, f)?, None) diff --git a/crates/engine/src/cmd/recolor.rs b/crates/engine/src/cmd/recolor.rs index d65ecfbd9b..82d1f1cfd5 100644 --- a/crates/engine/src/cmd/recolor.rs +++ b/crates/engine/src/cmd/recolor.rs @@ -480,6 +480,7 @@ fn apply(s: &mut Session, p: &Value) -> Result { None => rows.iter().filter_map(Row::new_color).collect(), }; let rename = text_param(p, "rename", C)?; + let colorized_ok = super::paint::check_colorized(&s.doc()?.doc).is_ok(); let (changed, edit, added, converted) = s.edit(label, |d, _| { // The rows' library swatches join the document (one it has with that name and colour is // used as it is). @@ -519,6 +520,7 @@ fn apply(s: &mut Session, p: &Value) -> Result { let lf = |c: &mut Color, link: &mut Option, tint: &mut f32| map.map_link(c, link, tint); let changed = Recolor::with_links(scope, &f, &lf).run(d, &ids); let edit = group.map(|g| super::swatch::rewrite_group(d, g, &new, rename, C)).transpose()?; + super::paint::check_colorized_kept(colorized_ok, d).map_err(|e| bad(C, e))?; Ok((changed, edit, added, map.converted.get())) })?; let mut out = json!({ "changed": changed, "swatches": added }); diff --git a/crates/engine/src/tests/colorize.rs b/crates/engine/src/tests/colorize.rs index 444d365fd1..bb9a9ac0f9 100644 --- a/crates/engine/src/tests/colorize.rs +++ b/crates/engine/src/tests/colorize.rs @@ -1,7 +1,7 @@ //! A fill color colorizes grayscale and 1-bit images (`paint.setFill` on the image). use serde_json::json; -use vectorcraft_color::Paint; +use vectorcraft_color::{Color, Paint}; use vectorcraft_doc::{ImageBlob, Node, NodeKind}; use crate::*; @@ -54,6 +54,287 @@ fn colorize(s: &Session, id: NodeId) -> Option { s.doc().unwrap().doc.node(id).unwrap().extras().colorize.as_deref().cloned() } +fn image_key(s: &Session, id: NodeId) -> String { + let d = &s.doc().unwrap().doc; + let NodeKind::Image(im) = &d.node(id).unwrap().kind else { panic!("not an image") }; + im.key.clone() +} + +fn colorized_image_with_adjustment(alpha: bool) -> (Session, NodeId, Paint) { + let mut s = session(); + let id = image(&mut s, "gray", gray(alpha)); + s.execute("paint.setFill", &json!({"swatch": "Ink"})).unwrap(); + let before = colorize(&s, id).unwrap(); + s.execute("effect.apply", &json!({"effect": "adjust.hueSaturation", "params": {"hue": 120}})).unwrap(); + (s, id, before) +} + +fn assert_adjustment_expand_rejected(command: &str) { + let (mut s, id, before) = colorized_image_with_adjustment(true); + let doc_before = s.doc().unwrap().doc.clone(); + let undo_before = s.doc().unwrap().history.undo.len(); + let e = s.execute(command, &json!({})).unwrap_err().to_string(); + assert!(e.contains("a process color can't colorize a grayscale image with transparency"), "{command}: {e}"); + assert_eq!(colorize(&s, id), Some(before)); + assert_eq!(s.doc().unwrap().doc, doc_before); + assert_eq!(s.doc().unwrap().history.undo.len(), undo_before); +} + +fn assert_adjustment_expand_succeeds(command: &str) { + let (mut s, id, before) = colorized_image_with_adjustment(false); + s.execute(command, &json!({})).unwrap(); + assert_ne!(colorize(&s, id), Some(before)); + assert!(s.doc().unwrap().doc.node(id).unwrap().appearance.effects.is_empty()); +} + +#[test] +fn expand_appearance_rejects_adjusted_colorized_gray_image_with_alpha() { + assert_adjustment_expand_rejected("effect.expandAppearance"); +} + +#[test] +fn expand_appearance_adjusts_colorized_gray_image_without_alpha() { + assert_adjustment_expand_succeeds("effect.expandAppearance"); +} + +#[test] +fn object_expand_rejects_adjusted_colorized_gray_image_with_alpha() { + assert_adjustment_expand_rejected("object.expand"); +} + +#[test] +fn object_expand_adjusts_colorized_gray_image_without_alpha() { + assert_adjustment_expand_succeeds("object.expand"); +} + +#[test] +fn object_expand_still_expands_a_gradient_beside_an_effect_that_cannot_expand() { + let mut s = session(); + let guide = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap(); + s.execute("effect.apply", &json!({"effect": "adjust.hueSaturation", "params": {"hue": 120}})).unwrap(); + s.execute("view.guides.make", &json!({})).unwrap(); + let rect = s.execute("shape.rectangle", &json!({"x": 50, "y": 50, "width": 40, "height": 40})).unwrap()["id"].as_u64().unwrap(); + s.execute("paint.setFill", &json!({"gradient": {"kind": "linear"}})).unwrap(); + s.execute("select.set", &json!({"ids": [guide, rect]})).unwrap(); + s.execute("object.expand", &json!({})).unwrap(); + let doc = &s.doc().unwrap().doc; + assert!(doc.node(NodeId(rect)).is_none_or(|n| !matches!(n.appearance.fill_paint(), Paint::Gradient(_))), "the gradient expanded"); + assert_eq!(doc.node(NodeId(guide)).unwrap().appearance.effects.len(), 1, "the guide keeps its effect"); +} + +#[test] +fn object_expand_restores_earlier_expansions_when_adjusted_colorize_is_rejected() { + let (mut s, id, before) = colorized_image_with_adjustment(true); + let a = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap(); + let b = s.execute("shape.rectangle", &json!({"x": 50, "y": 10, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap(); + let blend = s.execute("object.blend.make", &json!({"ids": [a, b], "steps": 1})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [id.0, blend]})).unwrap(); + let doc_before = s.doc().unwrap().doc.clone(); + let undo_before = s.doc().unwrap().history.undo.len(); + let e = s.execute("object.expand", &json!({})).unwrap_err().to_string(); + assert!(e.contains("a process color can't colorize a grayscale image with transparency"), "{e}"); + assert_eq!(colorize(&s, id), Some(before)); + assert_eq!(s.doc().unwrap().doc, doc_before); + assert_eq!(s.doc().unwrap().history.undo.len(), undo_before); +} + +fn blend_with_colorized_middle(alpha: bool) -> (Session, NodeId, Paint) { + let mut s = session(); + let back = s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 20, "height": 20})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#000000"})).unwrap(); + let back = NodeId(back["id"].as_u64().unwrap()); + let middle = image(&mut s, "gray", gray(alpha)); + s.execute("paint.setFill", &json!({"swatch": "Ink"})).unwrap(); + s.execute("object.transform", &json!({"ids": [middle.0], "matrix": [1, 0, 0, 1, 30, 0]})).unwrap(); + let before = colorize(&s, middle).unwrap(); + let front = s.execute("shape.rectangle", &json!({"x": 40, "y": 0, "width": 20, "height": 20})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#ffffff"})).unwrap(); + let front = NodeId(front["id"].as_u64().unwrap()); + s.execute("select.set", &json!({"ids": [back.0, middle.0, front.0]})).unwrap(); + (s, middle, before) +} + +#[test] +fn blend_rejects_a_process_color_on_a_colorized_gray_image_with_alpha() { + let (mut s, middle, before) = blend_with_colorized_middle(true); + let doc_before = s.doc().unwrap().doc.clone(); + let undo_before = s.doc().unwrap().history.undo.len(); + let e = s.execute("edit.colors.blendHorizontally", &json!({})).unwrap_err().to_string(); + assert!(e.contains("a process color can't colorize a grayscale image with transparency"), "{e}"); + assert_eq!(colorize(&s, middle), Some(before)); + assert_eq!(s.doc().unwrap().doc, doc_before); + assert_eq!(s.doc().unwrap().history.undo.len(), undo_before); +} + +#[test] +fn blend_recolors_a_colorized_gray_image_without_alpha() { + let (mut s, middle, _) = blend_with_colorized_middle(false); + assert_eq!(s.execute("edit.colors.blendHorizontally", &json!({})).unwrap(), json!({"changed": 1})); + assert_eq!(colorize(&s, middle), Some(Paint::solid(Color::rgb(0.5, 0.5, 0.5)))); +} + +#[test] +fn fill_proxy_invert_recolors_a_colorized_gray_image_and_undo_restores_it() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#336699"})).unwrap(); + let before = colorize(&s, id).unwrap(); + assert_eq!(s.execute("paint.invert", &json!({})).unwrap(), json!({"changed": 1})); + assert_eq!(colorize(&s, id).and_then(|p| p.color()).map(|c| c.to_hex()), Some("#cc9966".into())); + assert_eq!(s.proxy_paints().0.color().map(|c| c.to_hex()), Some("#cc9966".into())); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(colorize(&s, id), Some(before)); +} + +#[test] +fn fill_proxy_complement_recolors_a_colorized_gray_image_and_undo_restores_it() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#ff0000"})).unwrap(); + let before = colorize(&s, id).unwrap(); + let expected = Paint::solid(Color::rgb8(0, 255, 255)); + assert_eq!(s.execute("paint.complement", &json!({})).unwrap(), json!({"changed": 1})); + assert_eq!(colorize(&s, id), Some(expected.clone())); + assert_eq!(s.proxy_paints().0, expected); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(colorize(&s, id), Some(before)); +} + +#[test] +fn stroke_proxy_invert_leaves_a_colorized_image_fill_unchanged() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#336699"})).unwrap(); + let before = colorize(&s, id); + let key = image_key(&s, id); + s.execute("paint.setStroke", &json!({"color": "#ff0000"})).unwrap(); + assert_eq!(s.doc().unwrap().doc.node(id).unwrap().appearance.stroke().unwrap().paint.color(), Some(Color::rgb8(255, 0, 0))); + assert_eq!(s.execute("paint.invert", &json!({"stroke": true})).unwrap(), json!({"changed": 1})); + assert_eq!(s.doc().unwrap().doc.node(id).unwrap().appearance.stroke().unwrap().paint.color(), Some(Color::rgb8(0, 255, 255))); + assert_eq!(colorize(&s, id), before); + assert_eq!(image_key(&s, id), key); +} + +#[test] +fn edit_colors_invert_without_fill_recolors_a_colorized_images_stroke() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#336699"})).unwrap(); + s.execute("paint.setStroke", &json!({"color": "#ff0000"})).unwrap(); + let before = colorize(&s, id); + let key = image_key(&s, id); + assert_eq!(s.execute("edit.colors.invert", &json!({"fill": false, "stroke": true})).unwrap(), json!({"changed": 1})); + assert_eq!(s.doc().unwrap().doc.node(id).unwrap().appearance.stroke().unwrap().paint.color(), Some(Color::rgb8(0, 255, 255))); + assert_eq!(colorize(&s, id), before); + assert_eq!(image_key(&s, id), key); +} + +#[test] +fn colorized_alpha_image_rejects_a_recolored_spot_but_accepts_inverted_black() { + let mut s = session(); + let id = image(&mut s, "alpha", gray(true)); + s.execute("paint.setFill", &json!({"swatch": "Ink"})).unwrap(); + let before = colorize(&s, id); + for cmd in ["paint.invert", "paint.complement", "edit.colors.invert"] { + let e = s.execute(cmd, &json!({"includeImages": false})).unwrap_err().to_string(); + assert!(e.contains("a process color can't colorize a grayscale image with transparency"), "{cmd}: {e}"); + assert_eq!(colorize(&s, id), before, "{cmd}"); + } + s.execute("paint.setFill", &json!({"color": "#000000"})).unwrap(); + s.execute("paint.invert", &json!({})).unwrap(); + assert_eq!(colorize(&s, id), Some(Paint::solid(Color::rgb8(255, 255, 255)))); +} + +#[test] +fn edit_colors_recolors_an_image_colorize_with_pixels_excluded() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#ff0000"})).unwrap(); + let before = colorize(&s, id); + assert_eq!(s.execute("edit.colors.invert", &json!({"includeImages": false})).unwrap(), json!({"changed": 1})); + assert_eq!(colorize(&s, id), Some(Paint::solid(Color::rgb8(0, 255, 255)))); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(colorize(&s, id), before); +} + +#[test] +fn edit_colors_invert_recolors_colorize_without_changing_pixels_and_undo_restores() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#336699"})).unwrap(); + let before = colorize(&s, id); + let key = image_key(&s, id); + assert_eq!(s.execute("edit.colors.invert", &json!({})).unwrap(), json!({"changed": 1})); + assert_eq!(colorize(&s, id).and_then(|p| p.color()).map(|c| c.to_hex()), Some("#cc9966".into())); + assert_eq!(image_key(&s, id), key); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(colorize(&s, id), before); + assert_eq!(image_key(&s, id), key); +} + +#[test] +fn edit_colors_invert_recolors_colorized_image_inside_group() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#336699"})).unwrap(); + let shape = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap(); + let shape = NodeId(shape["id"].as_u64().unwrap()); + s.execute("select.set", &json!({"ids": [id.0, shape.0]})).unwrap(); + let group = s.execute("object.group", &json!({})).unwrap(); + assert!(s.execute("edit.colors.invert", &json!({"ids": [group["id"]]})).unwrap()["changed"].as_u64().unwrap() >= 1); + assert_eq!(colorize(&s, id).and_then(|p| p.color()).map(|c| c.to_hex()), Some("#cc9966".into())); +} + +#[test] +fn edit_colors_invert_without_fill_leaves_colorized_image_unchanged() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#336699"})).unwrap(); + let before = colorize(&s, id); + let key = image_key(&s, id); + assert_eq!(s.execute("edit.colors.invert", &json!({"fill": false})).unwrap(), json!({"changed": 0})); + assert_eq!(colorize(&s, id), before); + assert_eq!(image_key(&s, id), key); +} + +#[test] +fn recolor_apply_recolors_a_colorized_image_and_checks_alpha() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#ff0000"})).unwrap(); + assert_eq!(s.execute("recolor.apply", &json!({"map": {"#ff0000": "#00ff00"}, "includeImages": false})).unwrap()["changed"], 1); + assert_eq!(colorize(&s, id), Some(Paint::solid(Color::rgb8(0, 255, 0)))); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(colorize(&s, id), Some(Paint::solid(Color::rgb8(255, 0, 0)))); + + let mut s = session(); + let id = image(&mut s, "alpha", gray(true)); + s.execute("paint.setFill", &json!({"swatch": "Ink"})).unwrap(); + let before = colorize(&s, id); + let e = s.execute("recolor.apply", &json!({"map": {"cmyk 0 100 100 0": "#00ff00"}, "includeImages": false})).unwrap_err().to_string(); + assert!(e.contains("a process color can't colorize a grayscale image with transparency"), "{e}"); + assert_eq!(colorize(&s, id), before); +} + +#[test] +fn proxy_invert_recolors_a_colorized_image_and_another_fill_in_one_undo_step() { + let mut s = session(); + let id = image(&mut s, "gray", gray(false)); + s.execute("paint.setFill", &json!({"color": "#ff0000"})).unwrap(); + let shape = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap(); + let shape = NodeId(shape["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"color": "#0000ff"})).unwrap(); + s.execute("select.set", &json!({"ids": [id.0, shape.0]})).unwrap(); + let undo = s.doc().unwrap().history.undo.len(); + assert_eq!(s.execute("paint.invert", &json!({})).unwrap(), json!({"changed": 2})); + assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1); + assert_eq!(colorize(&s, id), Some(Paint::solid(Color::rgb8(0, 255, 255)))); + assert_eq!(s.doc().unwrap().doc.node(shape).unwrap().appearance.fill().unwrap().paint.color(), Some(Color::rgb8(255, 255, 0))); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(colorize(&s, id), Some(Paint::solid(Color::rgb8(255, 0, 0)))); + assert_eq!(s.doc().unwrap().doc.node(shape).unwrap().appearance.fill().unwrap().paint.color(), Some(Color::rgb8(0, 0, 255))); +} + #[test] fn colorized_gray_image_is_flattened_for_pdf_13() { let mut s = session(); @@ -149,12 +430,33 @@ fn a_fill_color_colorizes_a_gray_image_and_none_takes_it_off() { assert!(matches!(colorize(&s, id), Some(Paint::Solid { swatch: Some(_), .. })), "undo restores the spot color"); s.execute("paint.setFill", &json!({"none": true})).unwrap(); assert_eq!(colorize(&s, id), None); - // `none` takes the color off after an edit of the pixels leaves the image in color. + // `none` takes the color off after an edit that leaves the image pixels gray. s.execute("paint.setFill", &json!({"swatch": "Ink"})).unwrap(); + let key = image_key(&s, id); s.execute("edit.colors.invert", &json!({"includeImages": true})).unwrap(); let d = &s.doc().unwrap().doc; let NodeKind::Image(im) = &d.node(id).unwrap().kind else { panic!() }; + assert_eq!(im.key, key); + assert!(d.image_blob(im).and_then(|b| b.gray_source()).is_some(), "the pixels remain gray"); + s.execute("paint.setFill", &json!({"none": true})).unwrap(); + assert_eq!(colorize(&s, id), None); + + // `none` also takes the color off when a colorized image has color pixels. + s.execute("paint.setFill", &json!({"swatch": "Ink"})).unwrap(); + s.edit("Replace Image", |d, _| { + d.images.insert("rgb".into(), png(image::DynamicImage::ImageRgb8(image::RgbImage::from_raw(2, 1, vec![255, 0, 0, 0, 0, 255]).unwrap()))); + if let Some(node) = d.node_mut(id) + && let NodeKind::Image(im) = &mut node.kind + { + im.key = "rgb".into(); + } + Ok(()) + }) + .unwrap(); + let d = &s.doc().unwrap().doc; + let NodeKind::Image(im) = &d.node(id).unwrap().kind else { panic!() }; assert_eq!(d.image_blob(im).and_then(|b| b.gray_source()), None, "the pixels are no longer gray"); + assert!(colorize(&s, id).is_some()); s.execute("paint.setFill", &json!({"none": true})).unwrap(); assert_eq!(colorize(&s, id), None); } diff --git a/docs/mcp.md b/docs/mcp.md index 1f5bd6571b..2050794414 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -402,9 +402,10 @@ alpha channel takes only a spot color, black or white; a process color is refuse For `draw_shape` and `draw_path`, omitted paint fields inherit the current [new-art appearance](#new-art). For a filled shape or path without an outline, pass an explicit `fill` and `stroke: "none"`. Lines start with no fill and a visible stroke. -The Fill/Stroke proxy commands run through `run_command`: `paint.invert` and `paint.complement` recolour the active -proxy keeping each colour's model, `paint.lastColor` / `paint.lastGradient` re-apply the last solid colour or gradient, -and `paint.recent` returns the recent colours that every paint command (and the eyedropper) feeds. +The Fill/Stroke proxy commands run through `run_command`: `paint.invert` and `paint.complement` recolor the active +proxy, including a grayscale image's colorized fill, while keeping each color's model. `paint.lastColor` / +`paint.lastGradient` re-apply the last solid color or gradient, and `paint.recent` returns the recent colors that every +paint command (and the eyedropper) feeds. `paint.proxies` returns what the proxies show: the fill and stroke, which one is active, and whether the selected objects' fills or strokes differ (`fillMixed` / `strokeMixed`, drawn as a "?" proxy). @@ -1809,13 +1810,15 @@ the scope and what differs from the public documentation. ## Edit Colors and Recolor Artwork `edit.colors.invert`, `edit.colors.toCMYK`, `edit.colors.toGrayscale`, `edit.colors.toRGB`, `edit.colors.saturate`, -`edit.colors.adjustBalance` and `recolor.apply` recolour everything inside the selection (or `ids`) in one undo step: -fills, strokes, text, gradient stops, gradient-mesh points, embedded images (a recoloured copy of the image; linked -images are left alone) and the tiles of pattern fills and strokes (a recoloured copy saved as a new pattern swatch, -e.g. "Dots 2"; the original pattern is untouched). `includeImages: false` / `includePatterns: false` leave images or -patterns out. The Blend commands also grade gradient meshes, which keep their shading. `edit.colors.saturate` needs -`intensity`, a number from -100 to 100 (a number outside the range counts as its nearest end). Without one, or with a -value that is not a number, it answers `` missing number `intensity` `` and changes nothing. +`edit.colors.adjustBalance` and `recolor.apply` recolor everything inside the selection (or `ids`) in one undo step: +fills, strokes, text, gradient stops, gradient-mesh points, colorized image fills, embedded images (a recolored copy of +the image; linked images are left alone) and the tiles of pattern fills and strokes (a recolored copy saved as a new +pattern swatch, e.g. "Dots 2"; the original pattern is untouched). Colorized image fills are recolored when fills are in +scope, but their pixels are never recolored. `includeImages: false` leaves other images' pixels unchanged. +For `edit.colors.*`, `fill: false` leaves colorized image fills unchanged. `recolor.apply` always includes fills. +`includePatterns: false` leaves patterns out. The Blend commands also grade gradient meshes, which keep their shading. +`edit.colors.saturate` needs `intensity`, a number from -100 to 100 (a number outside the range counts as its nearest +end). Without one, or with a value that is not a number, it answers `` missing number `intensity` `` and changes nothing. ```json {"name":"run_command","arguments":{"command":"recolor.colors","params":{}}} From aea9296fa2207519eefce117316c2baf44ec7708 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 23:45:42 +0700 Subject: [PATCH 046/227] Character and Paragraph Styles: a style made by the New style dialog or the panel menu is highlighted Squashed from #4713 onto main. --- crates/ui-egui/src/dialogs/new_text_style.rs | 9 +- crates/ui-egui/src/panels/text_styles.rs | 16 ++- .../ui-egui/src/panels/text_styles/tests.rs | 115 ++++++++++++++++++ crates/ui-egui/src/state.rs | 5 + 4 files changed, 142 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/dialogs/new_text_style.rs b/crates/ui-egui/src/dialogs/new_text_style.rs index 1949f00545..f945332e64 100644 --- a/crates/ui-egui/src/dialogs/new_text_style.rs +++ b/crates/ui-egui/src/dialogs/new_text_style.rs @@ -48,13 +48,18 @@ fn body(_: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { } /// OK: make the style with the name. A name another style has, or an empty one, keeps the dialog -/// open. +/// open. The panel highlights the new style and scrolls it into view when it next draws. fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { let mut params = d.fields.get("__target").filter(|t| t.is_object()).cloned().unwrap_or_else(|| json!({})); params["name"] = json!(d.str("name")); let r = app.run(if para(d) { "paraStyle.new" } else { "charStyle.new" }, params); - if r.is_ok() { + if let Ok(v) = &r { app.ui.dialog = None; + if let Some((uid, name)) = app.session.active().and_then(|doc| v["name"].as_str().map(|name| (doc.uid, name))) { + let para = para(d); + app.ui.made_text_style.retain(|(pending_uid, pending_para, _)| *pending_uid != uid || *pending_para != para); + app.ui.made_text_style.push((uid, para, name.to_string())); + } } r } diff --git a/crates/ui-egui/src/panels/text_styles.rs b/crates/ui-egui/src/panels/text_styles.rs index 7c65cf93df..8eebeae19f 100644 --- a/crates/ui-egui/src/panels/text_styles.rs +++ b/crates/ui-egui/src/panels/text_styles.rs @@ -227,6 +227,18 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { // A highlighted style that is no longer listed (renamed in Style Options, deleted by a command // or undone) is no longer highlighted. let mut sel = highlighted(app, ui.ctx(), kind, &listed); + // A style made by the New style dialog waits for this kind's panel on its own document. + app.ui.made_text_style.retain(|(uid, _, _)| app.session.documents().iter().any(|doc| doc.uid == *uid)); + if let Some(index) = app + .ui + .made_text_style + .iter() + .position(|(uid, para, _)| *para == (kind == Kind::Para) && app.session.active().is_some_and(|doc| doc.uid == *uid)) + { + let (_, _, name) = app.ui.made_text_style.remove(index); + highlight_made(ui.ctx(), kind, vec![name]); + sel = highlighted(app, ui.ctx(), kind, &listed); + } let scroll_to: Option = pstate(ui.ctx(), kind.scroll_key()); widgets::list_box(ui, |ui| { for (name, attrs, _) in &all { @@ -330,7 +342,9 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui, kind: Kind) { if menu_item(ui, &crate::i18n::fmt(tl!("New {kind} Style…"), &[("kind", kind.what_label())]), true, false) { // A later typing preview must not restore the document from before this capture. end_typing(app); - app.run(&format!("{p}.new"), target(app, kind, json!({}))).ok(); + if let Ok(r) = app.run(&format!("{p}.new"), target(app, kind, json!({}))) { + highlight_made(ui.ctx(), kind, r["name"].as_str().map(str::to_string).into_iter().collect()); + } } if menu_item(ui, &crate::i18n::fmt(tl!("Duplicate {kind} Style"), &[("kind", kind.what_label())]), !many.is_empty(), false) { let names: Vec = listed.iter().filter(|n| many.iter().any(|s| s == *n)).map(|n| n.to_string()).collect(); diff --git a/crates/ui-egui/src/panels/text_styles/tests.rs b/crates/ui-egui/src/panels/text_styles/tests.rs index 465baeac29..d20962461a 100644 --- a/crates/ui-egui/src/panels/text_styles/tests.rs +++ b/crates/ui-egui/src/panels/text_styles/tests.rs @@ -368,6 +368,15 @@ fn capture_from_menu(range: Option<(usize, usize)>, redefine: bool) { capture_from_ui(range, redefine, false, false); } +fn assert_new_style_highlight(ctx: &egui::Context, redefine: bool, name: &str) { + if !redefine { + let selected: Option = pstate(ctx, Kind::Char.key()); + assert_eq!(selected.as_deref(), Some(name), "New highlights the style it made"); + let scroll_to: Option = pstate(ctx, Kind::Char.scroll_key()); + assert_eq!(scroll_to.as_deref(), Some(name), "New requests a scroll to the new style"); + } +} + fn capture_from_ui(range: Option<(usize, usize)>, redefine: bool, footer: bool, unicode: bool) { let (mut app, id, ctx) = capture_app(); let (first, tail) = if unicode { ("é", "漢字") } else { ("AB", "cdef") }; @@ -413,6 +422,7 @@ fn capture_from_ui(range: Option<(usize, usize)>, redefine: bool, footer: bool, } let after = app.session.doc().unwrap().doc.clone(); let name = if redefine { "Body" } else { "Character Style 1" }; + assert_new_style_highlight(&ctx, redefine, name); let definition = after.char_styles.iter().find(|s| s.name == name); let size = definition.and_then(|s| s.attrs.get("size")).and_then(Value::as_f64); let expected_size = if range.is_some_and(|(a, b)| b > a && a >= first.len()) { 34.0 } else { 18.0 }; @@ -840,6 +850,10 @@ fn alt_clicking_new_character_style_asks_for_its_name() { set_name(&mut app, "Untouched"); assert!(crate::dialogs::confirm(&mut app).is_err(), "names are unique"); assert!(app.ui.dialog.is_some(), "a taken name keeps the dialog open"); + assert!(app.ui.made_text_style.is_empty(), "a taken name does not request a highlight"); + set_name(&mut app, ""); + assert!(crate::dialogs::confirm(&mut app).is_err(), "a name is required"); + assert!(app.ui.made_text_style.is_empty(), "an empty name does not request a highlight"); set_name(&mut app, "Heading"); let undo = app.session.doc().unwrap().history.undo.len(); crate::dialogs::confirm(&mut app).unwrap(); @@ -852,6 +866,107 @@ fn alt_clicking_new_character_style_asks_for_its_name() { assert_eq!(text_editing(&app), Some((id, 3, 5)), "the Type selection stays"); } +/// The dialog highlights its new style and scrolls the matching panel to its row. +#[test] +fn a_style_made_in_the_new_style_dialog_is_highlighted() { + for kind in [Kind::Char, Kind::Para] { + let (mut app, id, ctx) = capture_app(); + if kind == Kind::Para { + app.run("paraStyle.new", json!({"name": "Untouched"})).unwrap(); + } + for i in 1..=12 { + app.run(&format!("{}.new", kind.prefix()), json!({"name": format!("Item {i:02}")})).unwrap(); + } + select_type_range(&mut app, id, 3, 5); + let panel = |app: &mut VectorcraftApp, ui: &mut egui::Ui| { + egui::ScrollArea::vertical().id_salt("styles").max_height(80.0).show(ui, |ui| show(app, ui, kind)); + }; + let before = frame_events(&ctx, &mut app, vec![], panel); + let top = text_rect(&before, "Untouched").top() - 30.0; + set_pstate(&ctx, kind.key(), Some("Untouched".to_string())); + alt_click_new(&ctx, &mut app, kind); + set_name(&mut app, "Heading"); + crate::dialogs::confirm(&mut app).unwrap(); + let other = if kind == Kind::Char { Kind::Para } else { Kind::Char }; + frame_events(&ctx, &mut app, vec![], |app, ui| show(app, ui, other)); + assert_eq!(pstate::>(&ctx, other.key()), None, "{}: the other panel highlights nothing", kind.what()); + assert_eq!( + app.ui.made_text_style.first().map(|(_, _, name)| name.as_str()), + Some("Heading"), + "{}: the other panel leaves the new style pending", + kind.what() + ); + let mut after = vec![]; + for _ in 0..3 { + let time = ctx.input(|i| i.time) + 1.0; + after = frame_raw(&ctx, &mut app, egui::RawInput { time: Some(time), ..Default::default() }, panel); + } + let highlighted: Option = pstate(&ctx, kind.key()); + assert_eq!(highlighted.as_deref(), Some("Heading"), "{}: the new style replaces the old highlight", kind.what()); + assert!(app.ui.made_text_style.is_empty(), "{}: the panel consumes its pending highlight", kind.what()); + let row = text_rect(&after, "Heading"); + assert!(row.top() >= top && row.bottom() <= top + 80.0 + 30.0, "{}: Heading at {row:?}, panel from {top}", kind.what()); + } +} + +#[test] +fn new_character_and_paragraph_style_highlights_wait_for_their_panels() { + let (mut app, id, ctx) = capture_app(); + select_type_range(&mut app, id, 3, 5); + for (kind, name) in [(Kind::Char, "Heading Char"), (Kind::Para, "Heading Para")] { + open_new(&mut app, kind).unwrap(); + set_name(&mut app, name); + crate::dialogs::confirm(&mut app).unwrap(); + } + frame_events(&ctx, &mut app, vec![], |app, ui| show(app, ui, Kind::Char)); + assert_eq!(pstate::>(&ctx, Kind::Char.key()).as_deref(), Some("Heading Char")); + assert_eq!(app.ui.made_text_style.len(), 1); + frame_events(&ctx, &mut app, vec![], |app, ui| show(app, ui, Kind::Para)); + assert_eq!(pstate::>(&ctx, Kind::Para.key()).as_deref(), Some("Heading Para")); + assert!(app.ui.made_text_style.is_empty()); +} + +/// A style made in one document is highlighted only when that document's panel draws. +#[test] +fn a_new_style_dialog_highlight_waits_for_its_document() { + for kind in [Kind::Char, Kind::Para] { + let (mut app, id, ctx) = capture_app(); + let first_uid = app.session.active().unwrap().uid; + select_type_range(&mut app, id, 3, 5); + alt_click_new(&ctx, &mut app, kind); + set_name(&mut app, "Heading"); + crate::dialogs::confirm(&mut app).unwrap(); + assert_eq!(app.ui.made_text_style.first().map(|(uid, _, _)| *uid), Some(first_uid)); + + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + app.run(&format!("{}.new", kind.prefix()), json!({"name": "Heading"})).unwrap(); + frame_events(&ctx, &mut app, vec![], |app, ui| show(app, ui, kind)); + assert_eq!(pstate::>(&ctx, kind.key()), None, "{}: the second document highlights nothing", kind.what()); + assert!(!app.ui.made_text_style.is_empty(), "{}: the first document's highlight stays pending", kind.what()); + + assert!(app.session.set_active(0)); + frame_events(&ctx, &mut app, vec![], |app, ui| show(app, ui, kind)); + assert_eq!(pstate::>(&ctx, kind.key()).as_deref(), Some("Heading"), "{}: the first document is highlighted", kind.what()); + assert!(app.ui.made_text_style.is_empty()); + } +} + +#[test] +fn a_closed_document_drops_its_pending_style_highlight() { + let (mut app, id, ctx) = capture_app(); + select_type_range(&mut app, id, 3, 5); + alt_click_new(&ctx, &mut app, Kind::Char); + set_name(&mut app, "Heading"); + crate::dialogs::confirm(&mut app).unwrap(); + + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + app.run("charStyle.new", json!({"name": "Heading"})).unwrap(); + app.session.execute("file.close", &json!({"index": 0})).unwrap(); + frame_events(&ctx, &mut app, vec![], |app, ui| show(app, ui, Kind::Char)); + assert_eq!(pstate::>(&ctx, Kind::Char.key()), None); + assert!(app.ui.made_text_style.is_empty(), "the closed document's highlight is discarded"); +} + /// OK makes the style from the text's attributes as they were when the dialog opened: a later /// format change of the Type selection, or a change of the selected objects, does not reach it. #[test] diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index 0409a78c76..72a8be32fc 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -520,6 +520,10 @@ pub struct UiState { /// dialog is open. #[serde(skip)] pub dialog_file: Option>, + /// Pending new style highlights: document uid, paragraph-style flag, and name. Each document + /// and style kind has at most one pending highlight. + #[serde(skip)] + pub made_text_style: Vec<(u64, bool, String)>, /// The documents (uids) whose Missing Fonts dialog waits until no dialog is open, the next one to /// show first ([`crate::dialogs::settle`]). #[serde(skip)] @@ -879,6 +883,7 @@ impl Default for UiState { svg_options: Value::Null, place_link: true, dialog_file: None, + made_text_style: vec![], pending_fonts: vec![], fonts_dialog: None, dialog_search: None, From cd9eb0acd5fcc047b3f6133ca95c7f9d6279cb2f Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 28 Oct 2026 07:24:47 -0700 Subject: [PATCH 047/227] =?UTF-8?q?Knife:=20Alt=20cuts=20in=20a=20straight?= =?UTF-8?q?=20line=20and=20Shift+Alt=20cuts=20at=2045=C2=B0=20steps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Knife cut along the freehand drag whatever keys were held. The reference app cuts in a straight line with Alt-drag, and it cuts at 45 or 90 degrees with Shift+Alt-drag. With Alt held at the press, or pressed before the drag has moved, the Knife's stroke is the press point and the pointer: the dashed line shows it while dragging, and the release sends path.knife with those two points. With Shift held too, the line keeps to 45° steps from the Constrain Angle, as the Pencil's Shift line does. Shift is read on each drag event and at the release. The cut stays straight when Alt is let go, a line taken back to its press point sends no command, and Shift alone leaves the cut freehand. Docs: docs/target-app-parity.md. --- crates/engine/src/tests/draw2.rs | 21 ++++++ crates/tools/src/draw2/gesture.rs | 35 ++++++++-- crates/tools/src/draw2/gesture/tests.rs | 93 +++++++++++++++++++++++++ docs/target-app-parity.md | 1 + 4 files changed, 144 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index 1471c1b1af..ad6293c0e8 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -1011,6 +1011,27 @@ fn knife_cuts_rect_into_two_pieces() { assert_eq!(paths(&s).len(), 1); } +/// An Alt-drag with the Knife cuts along the straight line from the press point to the release, +/// wherever the drag went between, and Shift+Alt along the nearest 45° step, in one undo step. +#[test] +fn knife_alt_drag_cuts_along_a_straight_line() { + let alt = Mods { alt: true, ..Default::default() }; + let shift_alt = Mods { shift: true, alt: true, ..Default::default() }; + // From (150, 50) to (250, 250) the line crosses the rectangle's top at x 175 and its bottom at + // x 225, so the left piece holds 10000 pt²; a vertical cut at x 150 leaves 5000 pt². + for (m, to, left) in [(alt, (250.0, 250.0), 10000.0), (shift_alt, (160.0, 240.0), 5000.0)] { + let mut s = session(); + rect(&mut s, 100.0, 100.0, 200.0, 100.0); + s.execute("select.none", &json!({})).unwrap(); + s.select_tool("knife", view()).unwrap(); + assert_eq!(gesture(&mut s, &[(150.0, 50.0), (290.0, 150.0), to], m), 1, "{m:?}: one undo step"); + let ps = paths(&s); + assert_eq!(ps.len(), 2, "{m:?}"); + let small = ps.iter().map(|(_, p)| area(p)).fold(f64::INFINITY, f64::min); + assert!((small - left).abs() < 30.0, "{m:?}: {small}"); + } +} + #[test] fn knife_partial_cut_does_nothing() { let mut s = session(); diff --git a/crates/tools/src/draw2/gesture.rs b/crates/tools/src/draw2/gesture.rs index 2a6380aa94..fab93aecdb 100644 --- a/crates/tools/src/draw2/gesture.rs +++ b/crates/tools/src/draw2/gesture.rs @@ -14,6 +14,9 @@ //! collect the drag polyline (shown as an overlay) and run one command on release. With Shift held, the Blob Brush's points stay on the horizontal or //! vertical line through the press point. Alt held at the press, or before the Blob Brush's drag //! has moved, switches the Blob Brush to the Smooth tool: the drag smooths the selected paths. +//! Alt held at the press, or pressed before the Knife's drag has moved, makes the Knife cut along +//! the straight line from the press point to the pointer, at 45° steps from the Constrain Angle +//! while Shift is held. use serde_json::{Value, json}; use vectorcraft_doc::{NodeId, NodeKind}; @@ -89,11 +92,12 @@ pub struct GestureTool { /// The pointer has moved from the press point, by any distance (a move too short to add a /// point counts). moved: bool, - /// Active Pencil drag draws a straight line (Shift or Alt held at the press): the stroke is - /// the press point and the pointer. + /// Active Pencil drag draws a straight line (Shift or Alt held at the press), or active Knife + /// drag cuts along one (Alt held at the press or before the drag moved): the stroke is the + /// press point and the pointer. straight: bool, - /// The straight line is Alt's: the pointer is not constrained to 45° steps, and the line's end - /// snaps to Smart Guides as a stroke's end does. + /// The straight line is not constrained to 45° steps: the Pencil's Alt line, whose end snaps to + /// Smart Guides as a stroke's end does, or the Knife's line while Shift is up. unconstrained: bool, /// Axis selected during the current uninterrupted Shift interval, in degrees. shift_line: Option, @@ -201,6 +205,23 @@ impl GestureTool { self.id == "blobBrush" && m.alt && !self.moved } + /// Would Alt held now make the Knife cut along a straight line? It does at the press, and + /// during a drag that has not moved from the press point yet. + fn knife_alt_straight(&self, m: Mods) -> bool { + self.id == "knife" && m.alt && !self.moved + } + + /// Alt starts a straight Knife cut before the drag moves. While it cuts along a straight line, + /// Shift keeps the line to 45° steps; without Shift, the line follows the pointer. + fn knife_shift(&mut self, m: Mods) { + if self.knife_alt_straight(m) { + self.straight = true; + } + if self.id == "knife" && self.straight { + self.unconstrained = !m.shift; + } + } + /// Constrain the Pencil line or the current Blob Brush sample. Blob Brush chooses an /// axis once per uninterrupted Shift interval; samples already drawn never move. /// A smoothing drag follows the pointer without a Shift constraint. @@ -449,8 +470,8 @@ impl Tool for GestureTool { // switches the Blob Brush. self.smoothing = ev.mods.alt && (self.id == "blobBrush" || (self.id == "pencil" && self.alt_smooth)); // Alt draws a straight line only while it doesn't lend the Smooth tool; with Shift - // too, the line keeps Shift's 45° steps. - self.straight = self.id == "pencil" && !self.smoothing && (ev.mods.shift || ev.mods.alt); + // too, the line keeps Shift's 45° steps. Alt makes the Knife cut along a straight line. + self.straight = (self.id == "pencil" && !self.smoothing && (ev.mods.shift || ev.mods.alt)) || (self.id == "knife" && ev.mods.alt); self.unconstrained = self.straight && !ev.mods.shift; let extend = if self.draws_path() && !self.smoothing { self.find_extend(cx, p) } else { None }; self.extend = extend.map(|(id, at_start, _)| (id, at_start)); @@ -480,6 +501,7 @@ impl Tool for GestureTool { if (!self.began && !self.straight && self.id == "pencil" && self.alt_smooth && ev.mods.alt) || self.blob_alt_smooths(ev.mods) { self.smoothing = true; } + self.knife_shift(ev.mods); self.moved |= self.points.first().is_some_and(|start| p.distance(*start) > vectorcraft_geom::EPS); let p = self.constrained(cx, p, ev.mods); let mut end = p; @@ -548,6 +570,7 @@ impl Tool for GestureTool { if self.blob_alt_smooths(ev.mods) { self.smoothing = true; } + self.knife_shift(ev.mods); let p = self.constrained(cx, p, ev.mods); let end = if self.snaps() && !self.smoothing && (!self.straight || self.unconstrained) { self.snap.drag(cx, p, None) } else { p }; self.snap.clear(); diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index c3335d1cf4..eefca081e6 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -1106,6 +1106,99 @@ fn eraser_and_knife_exec_on_release() { assert!(matches!(&a[0], Action::Exec(c, v) if c == "path.knife" && v["points"].as_array().unwrap().len() == 3)); } +/// The points of the Knife's release command, or of its drag overlay. +fn knife_points(acts: &[Action]) -> Vec<(f64, f64)> { + let Some(Action::Exec(c, v)) = acts.first() else { panic!("{acts:?}") }; + assert_eq!(c, "path.knife"); + v["points"].as_array().unwrap().iter().map(|q| (q[0].as_f64().unwrap(), q[1].as_f64().unwrap())).collect() +} + +fn overlay_points(t: &GestureTool, cx: &ToolContext) -> Vec<(f64, f64)> { + let o = t.overlays(cx); + let Some(Overlay::Path { path, dashed: true, .. }) = o.last() else { panic!("{o:?}") }; + path.elements().iter().filter_map(|e| e.end_point()).map(|q| (q.x, q.y)).collect() +} + +/// With Alt held at the press, or pressed before the drag has moved, a wavy Knife drag shows and +/// cuts along the straight line from the press point to the pointer, whatever Alt does after. +/// Alt pressed once the drag has moved leaves the cut freehand, and a straight cut taken back to +/// the press point sends no command. +#[test] +fn knife_alt_cuts_along_a_straight_line() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let cx = cx(&d, &s, &p); + let alt = Mods { alt: true, ..Default::default() }; + let none = Mods::default(); + let ev = |k, x, y, m| PointerEvent::new(k, x, y).with_mods(m); + let mut t = GestureTool::new("knife"); + t.pointer(&cx, &ev(PointerKind::Down, 50.0, 150.0, alt)); + t.pointer(&cx, &ev(PointerKind::Drag, 100.0, 120.0, alt)); + t.pointer(&cx, &ev(PointerKind::Drag, 150.0, 190.0, alt)); + assert_eq!(overlay_points(&t, &cx), vec![(50.0, 150.0), (150.0, 190.0)]); + // Alt let go: the cut stays straight. + let a = t.pointer(&cx, &ev(PointerKind::Up, 250.0, 160.0, none)); + assert_eq!(knife_points(&a), vec![(50.0, 150.0), (250.0, 160.0)]); + // Alt pressed while the pointer stands still at the press point. + t.pointer(&cx, &ev(PointerKind::Down, 50.0, 150.0, none)); + t.pointer(&cx, &ev(PointerKind::Drag, 50.0, 150.0, alt)); + t.pointer(&cx, &ev(PointerKind::Drag, 100.0, 120.0, alt)); + let a = t.pointer(&cx, &ev(PointerKind::Up, 250.0, 160.0, alt)); + assert_eq!(knife_points(&a), vec![(50.0, 150.0), (250.0, 160.0)]); + // Alt pressed after the drag moved: the cut follows the drag. + t.pointer(&cx, &ev(PointerKind::Down, 50.0, 150.0, none)); + t.pointer(&cx, &ev(PointerKind::Drag, 100.0, 120.0, none)); + t.pointer(&cx, &ev(PointerKind::Drag, 150.0, 190.0, alt)); + let a = t.pointer(&cx, &ev(PointerKind::Up, 250.0, 160.0, alt)); + assert_eq!(knife_points(&a), vec![(50.0, 150.0), (100.0, 120.0), (150.0, 190.0), (250.0, 160.0)]); + // Back at the press point the line goes, and the release cuts nothing. + t.pointer(&cx, &ev(PointerKind::Down, 50.0, 150.0, alt)); + t.pointer(&cx, &ev(PointerKind::Drag, 150.0, 190.0, alt)); + t.pointer(&cx, &ev(PointerKind::Drag, 50.2, 150.0, alt)); + assert!(t.overlays(&cx).is_empty()); + assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 50.2, 150.0, alt)), vec![]); +} + +/// With Shift and Alt held, the Knife's straight cut keeps to 45° steps from the Constrain Angle +/// and is as long as the line to the pointer. Shift is read on each drag event: when Shift is let +/// go, the line follows the pointer again. With Shift alone, the cut follows the drag. +#[test] +fn knife_shift_alt_cuts_at_45_degree_steps() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let mut cx = cx(&d, &s, &p); + let shift_alt = Mods { shift: true, alt: true, ..Default::default() }; + let alt = Mods { alt: true, ..Default::default() }; + let angle = |q: (f64, f64), from: (f64, f64)| (-(q.1 - from.1)).atan2(q.0 - from.0).to_degrees(); + let mut t = GestureTool::new("knife"); + // A wavy drag heading up and right at about 40°: a cut at 45°, as long as the drag. + let acts = drag_held(&mut t, &cx, &[(0.0, 0.0), (30.0, -10.0), (50.0, -60.0), (100.0, -84.0)], shift_alt); + let cut = knife_points(acts.last().unwrap()); + assert_eq!(cut.len(), 2, "{cut:?}"); + assert_eq!(cut[0], (0.0, 0.0)); + assert!((angle(cut[1], (0.0, 0.0)) - 45.0).abs() < 1e-9, "{cut:?}"); + assert!((cut[1].0.hypot(cut[1].1) - 100f64.hypot(84.0)).abs() < 1e-9, "{cut:?}"); + // Shift goes down mid-drag and up again: the overlay steps, then follows the pointer. + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 0.0, 0.0).with_mods(alt)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 100.0, -84.0).with_mods(shift_alt)); + let shown = overlay_points(&t, &cx); + assert!((angle(shown[1], (0.0, 0.0)) - 45.0).abs() < 1e-9, "{shown:?}"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 100.0, -80.0).with_mods(alt)); + assert_eq!(overlay_points(&t, &cx), vec![(0.0, 0.0), (100.0, -80.0)]); + let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 100.0, -84.0).with_mods(shift_alt)); + assert!((angle(knife_points(&a)[1], (0.0, 0.0)) - 45.0).abs() < 1e-9, "{a:?}"); + // The steps turn with the Constrain Angle: at 30°, a drag at 40° gives 30°. + cx.constrain_angle = 30.0; + let acts = drag_held(&mut t, &cx, &[(10.0, 10.0), (110.0, -74.0)], shift_alt); + let cut = knife_points(acts.last().unwrap()); + assert!((angle(cut[1], (10.0, 10.0)) - 30.0).abs() < 1e-9, "{cut:?}"); + // Shift alone: the cut follows the drag. + let acts = drag_held(&mut t, &cx, &[(0.0, 0.0), (30.0, -10.0), (50.0, -60.0)], Mods { shift: true, ..Default::default() }); + assert_eq!(knife_points(acts.last().unwrap()).len(), 3); +} + /// The Eraser's Angle and Roundness (Eraser Tool Options) go with its stroke, kept within /// −180–180° and 1–100%; while it drags, a tip that is not round shows the outline of the area /// it covers, and a round one the drag as wide as the tip. diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 0dd0423855..8c44cbc207 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -676,6 +676,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur While a spiral is dragged out, Alt adds or removes whole winds of four segments and Ctrl/Cmd changes the decay. The spiral's inner end keeps the distance from the center it had on the first modified drag event, while the outer end follows the pointer. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list Alt-drag to add or subtract winds and Ctrl-drag to change the decay rate; [Draw spirals](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-spirals.html) defines four segments per full wind. Rounding the fitted count to whole winds from the count on the first Alt-only drag event, the held inner radius, the ranges (2…1000 segments, 5…99.99 % decay), Ctrl/Cmd taking precedence when both are held, and the new values staying as Spiral tool options are our own rules. Switching back to Alt uses the current count as its new base while keeping the held inner end. - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. + Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. With Alt held at the press, or pressed before the drag has moved, the dashed line runs from the press point to the pointer and the release sends `path.knife` with those two points. With Shift held too, the line keeps to 45° steps from the Constrain Angle. The cut stays straight when Alt is let go, and a line taken back to its press point sends no command. Eraser Tool Options has Angle and Roundness besides Size, as [Erase paths using the Eraser tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/erase-paths-using-eraser-tool.html) describes: the Eraser's tip is an ellipse Size across, its long axis at Angle and its short axis Roundness percent of the long one, and a drag with a tip that is not round shows the outline of the area it erases (`path.eraseRegion` `angle` and `roundness`). - **Transform:** Rotate, Reflect, Scale, Shear (click or Alt-click snaps the reference point to anchors and centres; Alt-click opens the tool's dialog, and a drag with Alt down at the release, from the press or pressed mid-drag, transforms a copy), Reshape, Free Transform (free and perspective distort and shear, switched by the keys held during a handle drag). Align, Distribute, Distribute Spacing, Reflect and Shear return an error for any `horizontal`, `vertical`, `to`, `axis`, `bounds` or `spacing` value they don't take, listing the choices, and Align returns one when a call gives neither `horizontal` nor `vertical`; nothing moves and no undo step is recorded. Align and Distribute act on the anchor points selected with Direct Selection: the points of one path align to each other, not to the artboard, and Distribute spaces them (#1641, fixes #1636; aligning to a key anchor is still missing). From 28936f617411e591498468ee59793e322851e1d8 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 08:29:37 -0700 Subject: [PATCH 048/227] Knife: Alt counts only at the press and Shift+Alt steps from the canvas axes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A straight Knife cut now starts only when Alt is held at the press. Alt pressed later in the drag, even before the pointer moves, leaves the cut freehand. Releasing Alt during a straight cut keeps it straight. With Shift+Alt, the cut keeps to 45° steps from the horizontal and vertical whatever the Constrain Angle. The Pencil's straight line still steps from the Constrain Angle. Tests cover Alt after the press, Alt only at the release, a 90° cut, a 30° Constrain Angle, and the cut boundaries in the engine. Docs: docs/target-app-parity.md. --- crates/engine/src/tests/draw2.rs | 11 +++- crates/tools/src/draw2/gesture.rs | 29 ++++----- crates/tools/src/draw2/gesture/tests.rs | 78 ++++++++++++++++++++----- docs/target-app-parity.md | 2 +- 4 files changed, 85 insertions(+), 35 deletions(-) diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index ad6293c0e8..935ae78a91 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -1019,7 +1019,10 @@ fn knife_alt_drag_cuts_along_a_straight_line() { let shift_alt = Mods { shift: true, alt: true, ..Default::default() }; // From (150, 50) to (250, 250) the line crosses the rectangle's top at x 175 and its bottom at // x 225, so the left piece holds 10000 pt²; a vertical cut at x 150 leaves 5000 pt². - for (m, to, left) in [(alt, (250.0, 250.0), 10000.0), (shift_alt, (160.0, 240.0), 5000.0)] { + for (m, to, left, top, bottom) in [ + (alt, (250.0, 250.0), 10000.0, Point::new(175.0, 100.0), Point::new(225.0, 200.0)), + (shift_alt, (160.0, 240.0), 5000.0, Point::new(150.0, 100.0), Point::new(150.0, 200.0)), + ] { let mut s = session(); rect(&mut s, 100.0, 100.0, 200.0, 100.0); s.execute("select.none", &json!({})).unwrap(); @@ -1029,6 +1032,12 @@ fn knife_alt_drag_cuts_along_a_straight_line() { assert_eq!(ps.len(), 2, "{m:?}"); let small = ps.iter().map(|(_, p)| area(p)).fold(f64::INFINITY, f64::min); assert!((small - left).abs() < 30.0, "{m:?}: {small}"); + // The Knife leaves a narrow slit, so each piece's boundary lies just beside the center line. + for (_, piece) in &ps { + let anchors = &piece.subpaths[0].anchors; + assert!(anchors.iter().any(|a| a.p.distance(top) < 0.1), "{m:?}: missing top cut boundary near {top:?}: {anchors:?}"); + assert!(anchors.iter().any(|a| a.p.distance(bottom) < 0.1), "{m:?}: missing bottom cut boundary near {bottom:?}: {anchors:?}"); + } } } diff --git a/crates/tools/src/draw2/gesture.rs b/crates/tools/src/draw2/gesture.rs index fab93aecdb..eade2a524b 100644 --- a/crates/tools/src/draw2/gesture.rs +++ b/crates/tools/src/draw2/gesture.rs @@ -14,9 +14,9 @@ //! collect the drag polyline (shown as an overlay) and run one command on release. With Shift held, the Blob Brush's points stay on the horizontal or //! vertical line through the press point. Alt held at the press, or before the Blob Brush's drag //! has moved, switches the Blob Brush to the Smooth tool: the drag smooths the selected paths. -//! Alt held at the press, or pressed before the Knife's drag has moved, makes the Knife cut along -//! the straight line from the press point to the pointer, at 45° steps from the Constrain Angle -//! while Shift is held. +//! Alt held at the Knife's press makes it cut along the straight line from the press point to the +//! pointer, even if Alt is released during the drag. Shift on each drag or release constrains that +//! line to 45° steps from the canvas axes. use serde_json::{Value, json}; use vectorcraft_doc::{NodeId, NodeKind}; @@ -93,8 +93,7 @@ pub struct GestureTool { /// point counts). moved: bool, /// Active Pencil drag draws a straight line (Shift or Alt held at the press), or active Knife - /// drag cuts along one (Alt held at the press or before the drag moved): the stroke is the - /// press point and the pointer. + /// drag cuts along one (Alt held at the press): the stroke is the press point and the pointer. straight: bool, /// The straight line is not constrained to 45° steps: the Pencil's Alt line, whose end snaps to /// Smart Guides as a stroke's end does, or the Knife's line while Shift is up. @@ -205,24 +204,16 @@ impl GestureTool { self.id == "blobBrush" && m.alt && !self.moved } - /// Would Alt held now make the Knife cut along a straight line? It does at the press, and - /// during a drag that has not moved from the press point yet. - fn knife_alt_straight(&self, m: Mods) -> bool { - self.id == "knife" && m.alt && !self.moved - } - - /// Alt starts a straight Knife cut before the drag moves. While it cuts along a straight line, - /// Shift keeps the line to 45° steps; without Shift, the line follows the pointer. + /// Shift keeps an active straight Knife cut at 45° steps; without Shift it follows the pointer. + /// Releasing Alt does not end a straight cut. fn knife_shift(&mut self, m: Mods) { - if self.knife_alt_straight(m) { - self.straight = true; - } if self.id == "knife" && self.straight { self.unconstrained = !m.shift; } } - /// Constrain the Pencil line or the current Blob Brush sample. Blob Brush chooses an + /// Constrain a straight Pencil line from the Constrain Angle, a straight Knife cut from the + /// canvas axes, or the current Blob Brush sample. Blob Brush chooses an /// axis once per uninterrupted Shift interval; samples already drawn never move. /// A smoothing drag follows the pointer without a Shift constraint. fn constrained(&mut self, cx: &ToolContext, p: Point, m: Mods) -> Point { @@ -232,7 +223,8 @@ impl GestureTool { if self.straight && let Some(&start) = self.points.first() { - return start + vectorcraft_geom::constrain_angle_from(p - start, 45.0, cx.constrain_angle); + let origin = if self.id == "knife" { 0.0 } else { cx.constrain_angle }; + return start + vectorcraft_geom::constrain_angle_from(p - start, 45.0, origin); } let Some(&start) = self.points.first().filter(|_| self.id == "blobBrush" && m.shift && !self.smoothing) else { self.shift_line = None; @@ -570,6 +562,7 @@ impl Tool for GestureTool { if self.blob_alt_smooths(ev.mods) { self.smoothing = true; } + // Alt only on release cannot turn a freehand Knife drag into a straight cut. self.knife_shift(ev.mods); let p = self.constrained(cx, p, ev.mods); let end = if self.snaps() && !self.smoothing && (!self.straight || self.unconstrained) { self.snap.drag(cx, p, None) } else { p }; diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index eefca081e6..0b6da81f59 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -1106,7 +1106,7 @@ fn eraser_and_knife_exec_on_release() { assert!(matches!(&a[0], Action::Exec(c, v) if c == "path.knife" && v["points"].as_array().unwrap().len() == 3)); } -/// The points of the Knife's release command, or of its drag overlay. +/// The points of the Knife's release command. fn knife_points(acts: &[Action]) -> Vec<(f64, f64)> { let Some(Action::Exec(c, v)) = acts.first() else { panic!("{acts:?}") }; assert_eq!(c, "path.knife"); @@ -1119,10 +1119,9 @@ fn overlay_points(t: &GestureTool, cx: &ToolContext) -> Vec<(f64, f64)> { path.elements().iter().filter_map(|e| e.end_point()).map(|q| (q.x, q.y)).collect() } -/// With Alt held at the press, or pressed before the drag has moved, a wavy Knife drag shows and -/// cuts along the straight line from the press point to the pointer, whatever Alt does after. -/// Alt pressed once the drag has moved leaves the cut freehand, and a straight cut taken back to -/// the press point sends no command. +/// With Alt held at the press, a wavy Knife drag shows and cuts along the straight line from the +/// press point to the pointer, even after Alt is released. Alt first pressed after the press +/// leaves the cut freehand, and a straight cut taken back to the press point sends no command. #[test] fn knife_alt_cuts_along_a_straight_line() { let (d, _) = doc_with_rect(); @@ -1135,17 +1134,16 @@ fn knife_alt_cuts_along_a_straight_line() { let mut t = GestureTool::new("knife"); t.pointer(&cx, &ev(PointerKind::Down, 50.0, 150.0, alt)); t.pointer(&cx, &ev(PointerKind::Drag, 100.0, 120.0, alt)); - t.pointer(&cx, &ev(PointerKind::Drag, 150.0, 190.0, alt)); + t.pointer(&cx, &ev(PointerKind::Drag, 150.0, 190.0, none)); assert_eq!(overlay_points(&t, &cx), vec![(50.0, 150.0), (150.0, 190.0)]); // Alt let go: the cut stays straight. let a = t.pointer(&cx, &ev(PointerKind::Up, 250.0, 160.0, none)); assert_eq!(knife_points(&a), vec![(50.0, 150.0), (250.0, 160.0)]); - // Alt pressed while the pointer stands still at the press point. + // Alt pressed on the first Drag event leaves the cut freehand. t.pointer(&cx, &ev(PointerKind::Down, 50.0, 150.0, none)); - t.pointer(&cx, &ev(PointerKind::Drag, 50.0, 150.0, alt)); t.pointer(&cx, &ev(PointerKind::Drag, 100.0, 120.0, alt)); let a = t.pointer(&cx, &ev(PointerKind::Up, 250.0, 160.0, alt)); - assert_eq!(knife_points(&a), vec![(50.0, 150.0), (250.0, 160.0)]); + assert_eq!(knife_points(&a), vec![(50.0, 150.0), (100.0, 120.0), (250.0, 160.0)]); // Alt pressed after the drag moved: the cut follows the drag. t.pointer(&cx, &ev(PointerKind::Down, 50.0, 150.0, none)); t.pointer(&cx, &ev(PointerKind::Drag, 100.0, 120.0, none)); @@ -1160,9 +1158,48 @@ fn knife_alt_cuts_along_a_straight_line() { assert_eq!(t.pointer(&cx, &ev(PointerKind::Up, 50.2, 150.0, alt)), vec![]); } -/// With Shift and Alt held, the Knife's straight cut keeps to 45° steps from the Constrain Angle -/// and is as long as the line to the pointer. Shift is read on each drag event: when Shift is let -/// go, the line follows the pointer again. With Shift alone, the cut follows the drag. +/// Alt first held after the Knife press leaves the cut freehand, including when the pointer has +/// not moved before Alt is pressed. The release command contains every collected point. +#[test] +fn knife_alt_after_press_keeps_freehand_cut() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let cx = cx(&d, &s, &p); + let alt = Mods { alt: true, ..Default::default() }; + let mut t = GestureTool::new("knife"); + for stationary_first in [false, true] { + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 50.0, 150.0)); + if stationary_first { + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 50.0, 150.0).with_mods(alt)); + } + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 100.0, 120.0).with_mods(alt)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 190.0)); + assert_eq!(overlay_points(&t, &cx), vec![(50.0, 150.0), (100.0, 120.0), (150.0, 190.0)]); + let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 250.0, 160.0)); + assert_eq!(knife_points(&a), vec![(50.0, 150.0), (100.0, 120.0), (150.0, 190.0), (250.0, 160.0)]); + } +} + +/// Alt first held at release leaves a freehand Knife cut on its collected drag points. +#[test] +fn knife_alt_only_at_release_keeps_freehand_cut() { + let (d, _) = doc_with_rect(); + let s = Selection::default(); + let p = paint(); + let cx = cx(&d, &s, &p); + let alt = Mods { alt: true, ..Default::default() }; + let mut t = GestureTool::new("knife"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 50.0, 150.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 100.0, 120.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 150.0, 190.0)); + let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 250.0, 160.0).with_mods(alt)); + assert_eq!(knife_points(&a), vec![(50.0, 150.0), (100.0, 120.0), (150.0, 190.0), (250.0, 160.0)]); +} + +/// With Shift and Alt held, the Knife's straight cut keeps to 45° steps from the canvas axes +/// and is as long as the line to the pointer. Shift is read on each Drag and Up event: when Shift +/// is let go, the line follows the pointer again. With Shift alone, the cut follows the drag. #[test] fn knife_shift_alt_cuts_at_45_degree_steps() { let (d, _) = doc_with_rect(); @@ -1180,6 +1217,15 @@ fn knife_shift_alt_cuts_at_45_degree_steps() { assert_eq!(cut[0], (0.0, 0.0)); assert!((angle(cut[1], (0.0, 0.0)) - 45.0).abs() < 1e-9, "{cut:?}"); assert!((cut[1].0.hypot(cut[1].1) - 100f64.hypot(84.0)).abs() < 1e-9, "{cut:?}"); + // A nearly vertical drag takes the nearest 90° step, with the same overlay and command endpoints. + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 10.0, 10.0).with_mods(shift_alt)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 15.0, -90.0).with_mods(shift_alt)); + let shown = overlay_points(&t, &cx); + let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 15.0, -90.0).with_mods(shift_alt)); + let cut = knife_points(&a); + assert_eq!(shown, cut); + assert!((cut[1].0 - 10.0).abs() < 1e-9, "{cut:?}"); + assert!((cut[1].1 - (10.0 - 5f64.hypot(100.0))).abs() < 1e-9, "{cut:?}"); // Shift goes down mid-drag and up again: the overlay steps, then follows the pointer. t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 0.0, 0.0).with_mods(alt)); t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 100.0, -84.0).with_mods(shift_alt)); @@ -1189,14 +1235,16 @@ fn knife_shift_alt_cuts_at_45_degree_steps() { assert_eq!(overlay_points(&t, &cx), vec![(0.0, 0.0), (100.0, -80.0)]); let a = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 100.0, -84.0).with_mods(shift_alt)); assert!((angle(knife_points(&a)[1], (0.0, 0.0)) - 45.0).abs() < 1e-9, "{a:?}"); - // The steps turn with the Constrain Angle: at 30°, a drag at 40° gives 30°. + // A 30° Constrain Angle does not turn the Knife's horizontal or 45° cuts. cx.constrain_angle = 30.0; + let acts = drag_held(&mut t, &cx, &[(10.0, 10.0), (110.0, 3.0)], shift_alt); + assert_eq!(knife_points(acts.last().unwrap()), vec![(10.0, 10.0), (10.0 + 100f64.hypot(7.0), 10.0)]); let acts = drag_held(&mut t, &cx, &[(10.0, 10.0), (110.0, -74.0)], shift_alt); let cut = knife_points(acts.last().unwrap()); - assert!((angle(cut[1], (10.0, 10.0)) - 30.0).abs() < 1e-9, "{cut:?}"); + assert!((angle(cut[1], (10.0, 10.0)) - 45.0).abs() < 1e-9, "{cut:?}"); // Shift alone: the cut follows the drag. let acts = drag_held(&mut t, &cx, &[(0.0, 0.0), (30.0, -10.0), (50.0, -60.0)], Mods { shift: true, ..Default::default() }); - assert_eq!(knife_points(acts.last().unwrap()).len(), 3); + assert_eq!(knife_points(acts.last().unwrap()), vec![(0.0, 0.0), (30.0, -10.0), (50.0, -60.0)]); } /// The Eraser's Angle and Roundness (Eraser Tool Options) go with its stroke, kept within diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 8c44cbc207..5b73ff4ea2 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -676,7 +676,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur While a spiral is dragged out, Alt adds or removes whole winds of four segments and Ctrl/Cmd changes the decay. The spiral's inner end keeps the distance from the center it had on the first modified drag event, while the outer end follows the pointer. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list Alt-drag to add or subtract winds and Ctrl-drag to change the decay rate; [Draw spirals](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-spirals.html) defines four segments per full wind. Rounding the fitted count to whole winds from the count on the first Alt-only drag event, the held inner radius, the ranges (2…1000 segments, 5…99.99 % decay), Ctrl/Cmd taking precedence when both are held, and the new values staying as Spiral tool options are our own rules. Switching back to Alt uses the current count as its new base while keeping the held inner end. - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. - Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. With Alt held at the press, or pressed before the drag has moved, the dashed line runs from the press point to the pointer and the release sends `path.knife` with those two points. With Shift held too, the line keeps to 45° steps from the Constrain Angle. The cut stays straight when Alt is let go, and a line taken back to its press point sends no command. + Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. The press-only timing, the straight cut after Alt is let go and the steps from the horizontal and vertical were observed in the reference app; sending no command for a line taken back to its press point and reading Shift on each move are our own rules. Eraser Tool Options has Angle and Roundness besides Size, as [Erase paths using the Eraser tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/erase-paths-using-eraser-tool.html) describes: the Eraser's tip is an ellipse Size across, its long axis at Angle and its short axis Roundness percent of the long one, and a drag with a tip that is not round shows the outline of the area it erases (`path.eraseRegion` `angle` and `roundness`). - **Transform:** Rotate, Reflect, Scale, Shear (click or Alt-click snaps the reference point to anchors and centres; Alt-click opens the tool's dialog, and a drag with Alt down at the release, from the press or pressed mid-drag, transforms a copy), Reshape, Free Transform (free and perspective distort and shear, switched by the keys held during a handle drag). Align, Distribute, Distribute Spacing, Reflect and Shear return an error for any `horizontal`, `vertical`, `to`, `axis`, `bounds` or `spacing` value they don't take, listing the choices, and Align returns one when a call gives neither `horizontal` nor `vertical`; nothing moves and no undo step is recorded. Align and Distribute act on the anchor points selected with Direct Selection: the points of one path align to each other, not to the artboard, and Distribute spaces them (#1641, fixes #1636; aligning to a key anchor is still missing). From 9b3e2d873b8adabd7861c47fe5d653d9ba95c707 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 05:35:02 -0700 Subject: [PATCH 049/227] Pathfinder: Cmd+4 repeats the last Pathfinder operation --- crates/ui-egui/src/app.rs | 1 + crates/ui-egui/src/i18n/bg.tsv | 1 + crates/ui-egui/src/i18n/cs.tsv | 1 + crates/ui-egui/src/i18n/da.tsv | 1 + crates/ui-egui/src/i18n/de.tsv | 1 + crates/ui-egui/src/i18n/el.tsv | 1 + crates/ui-egui/src/i18n/es.tsv | 1 + crates/ui-egui/src/i18n/fi.tsv | 1 + crates/ui-egui/src/i18n/fr.tsv | 1 + crates/ui-egui/src/i18n/hu.tsv | 1 + crates/ui-egui/src/i18n/id.tsv | 1 + crates/ui-egui/src/i18n/it.tsv | 1 + crates/ui-egui/src/i18n/ja.tsv | 1 + crates/ui-egui/src/i18n/ka.tsv | 1 + crates/ui-egui/src/i18n/ko.tsv | 1 + crates/ui-egui/src/i18n/nl.tsv | 1 + crates/ui-egui/src/i18n/pl.tsv | 1 + crates/ui-egui/src/i18n/pt-br.tsv | 1 + crates/ui-egui/src/i18n/ru.tsv | 1 + crates/ui-egui/src/i18n/sv.tsv | 1 + crates/ui-egui/src/i18n/uk.tsv | 1 + crates/ui-egui/src/i18n/vi.tsv | 1 + crates/ui-egui/src/i18n/zh-hans.tsv | 1 + crates/ui-egui/src/i18n/zh-hant.tsv | 1 + crates/ui-egui/src/lib.rs | 3 + crates/ui-egui/src/menus/run.rs | 1 + crates/ui-egui/src/menus/state.rs | 1 + crates/ui-egui/src/menus/ui_commands.rs | 6 + crates/ui-egui/src/panels/pathfinder.rs | 161 ++++++++++++++++++++++-- docs/mcp.md | 2 +- docs/target-app-parity.md | 1 + docs/ui-parity.md | 4 +- 32 files changed, 190 insertions(+), 13 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 8e937c45c2..0e5475b669 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -79,6 +79,7 @@ impl VectorcraftApp { dock_rt: Default::default(), titlebar_inset: 0.0, last_effect: None, + last_pathfinder: None, last_warp: None, character_focus: None, run_count: 0, diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index bb71167209..530dc7b5d7 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -4041,6 +4041,7 @@ axis Both И двете @msg no document няма документ @msg no document open няма отворен документ @msg no effect applied yet все още няма приложен ефект +@msg no Pathfinder operation applied yet все още няма приложена операция на Pathfinder @msg no effect at index {k} няма ефект на индекс {k} @msg no end record няма краен запис @msg no file manager here няма файлов мениджър тук diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index f92459d608..30ebe1e7f0 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4464,6 +4464,7 @@ imageTrace Outline Obrys @msg no document žádný dokument @msg no document open není otevřen žádný dokument @msg no effect applied yet zatím nebyl použit žádný efekt +@msg no Pathfinder operation applied yet zatím nebyla použita žádná operace s cestami @msg no effect at index {k} na indexu {k} není žádný efekt @msg no end record chybí koncový záznam @msg no file manager here zde není správce souborů diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index e735ddd999..1c67176a24 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -4151,6 +4151,7 @@ imageTrace Outline Kontur @msg no document intet dokument @msg no document open intet åbent dokument @msg no effect applied yet ingen effekt er anvendt endnu +@msg no Pathfinder operation applied yet ingen Pathfinder-handling er anvendt endnu @msg no effect at index {k} ingen effekt ved indeks {k} @msg no end record ingen slutpost @msg no file manager here ingen filhåndtering her diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 9a41a838c9..cf6c8aec57 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -4078,6 +4078,7 @@ theme Appearance Erscheinungsbild @msg no document kein Dokument @msg no document open kein Dokument geöffnet @msg no effect applied yet noch kein Effekt angewendet +@msg no Pathfinder operation applied yet noch keine Pathfinder-Operation angewendet @msg no effect at index {k} kein Effekt bei Index {k} @msg no end record kein Endeintrag @msg no file manager here hier gibt es keinen Dateimanager diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index fed8acea23..91c001e7a0 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -4117,6 +4117,7 @@ theme Appearance Εμφάνιση @msg no document δεν υπάρχει έγγραφο @msg no document open δεν υπάρχει ανοιχτό έγγραφο @msg no effect applied yet δεν έχει εφαρμοστεί ακόμη εφέ +@msg no Pathfinder operation applied yet δεν έχει εφαρμοστεί ακόμη λειτουργία Pathfinder @msg no effect at index {k} δεν υπάρχει εφέ στον δείκτη {k} @msg no end record λείπει η εγγραφή τέλους @msg no file manager here δεν υπάρχει διαχειριστής αρχείων εδώ diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 2956f03abd..8eaac3bb77 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4157,6 +4157,7 @@ axis Both Ambos @msg no document no hay documento @msg no document open no hay ningún documento abierto @msg no effect applied yet todavía no se aplicó ningún efecto +@msg no Pathfinder operation applied yet todavía no se aplicó ninguna operación de Buscatrazos @msg no effect at index {k} no hay ningún efecto en el índice {k} @msg no end record no hay registro final @msg no file manager here aquí no hay administrador de archivos diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 5942d952e6..3b0bb739e4 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4373,6 +4373,7 @@ imageTrace Outline Ääriviiva @msg no document ei asiakirjaa @msg no document open asiakirjaa ei ole auki @msg no effect applied yet tehostetta ei ole vielä käytetty +@msg no Pathfinder operation applied yet polunetsimen toimintoa ei ole vielä käytetty @msg no effect at index {k} ei tehostetta indeksissä {k} @msg no end record ei loppumerkintää @msg no file manager here täällä ei ole tiedostonhallintaa diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 9d12a94226..f90d02f879 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -4154,6 +4154,7 @@ axis Both Les deux @msg no document aucun document @msg no document open aucun document ouvert @msg no effect applied yet aucun effet appliqué pour l’instant +@msg no Pathfinder operation applied yet aucune opération Pathfinder appliquée pour l’instant @msg no effect at index {k} aucun effet à l’indice {k} @msg no end record aucun enregistrement de fin @msg no file manager here aucun gestionnaire de fichiers ici diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index dbb6993cef..b8035f4c2e 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -4814,6 +4814,7 @@ imageTrace Outline Körvonal @msg no document nincs dokumentum @msg no document open nincs megnyitott dokumentum @msg no effect applied yet még nincs alkalmazott effektus +@msg no Pathfinder operation applied yet még nincs alkalmazott útvonalkezelő-művelet @msg no effect at index {k} ezen az indexen nincs effektus: {k} @msg no end record nincs záró rekord @msg no file manager here itt nincs fájlkezelő diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 084f32a747..995e574582 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -4151,6 +4151,7 @@ imageTrace Outline Kontur @msg no document tidak ada dokumen @msg no document open tidak ada dokumen yang terbuka @msg no effect applied yet belum ada efek yang diterapkan +@msg no Pathfinder operation applied yet belum ada operasi Pathfinder yang diterapkan @msg no effect at index {k} tidak ada efek pada indeks {k} @msg no end record tidak ada rekaman akhir @msg no file manager here tidak ada pengelola file di sini diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index ec98d42ba3..ffcb2a32a9 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4197,6 +4197,7 @@ axis Both Entrambi @msg no document nessun documento @msg no document open nessun documento aperto @msg no effect applied yet nessun effetto ancora applicato +@msg no Pathfinder operation applied yet nessuna operazione di elaborazione tracciati ancora applicata @msg no effect at index {k} nessun effetto all'indice {k} @msg no end record nessun record finale @msg no file manager here nessun gestore file disponibile qui diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 41e730518d..5a8d912427 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -4543,6 +4543,7 @@ swatch Bright Violet ビビッドバイオレット @msg no PNG encoder PNG エンコーダーがありません @msg no document open ドキュメントが開かれていません @msg no effect applied yet まだ効果を適用していません +@msg no Pathfinder operation applied yet まだパスファインダーの操作を適用していません @msg no such perspective grid preset 指定された遠近グリッドプリセットが見つかりません @msg no such recent file 指定された最近使ったファイルが見つかりません @msg no such recent font 指定された最近使ったフォントが見つかりません diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 545958500c..d150719a28 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -3934,6 +3934,7 @@ font-technology Variable ცვლადი @msg no document დოკუმენტი არ არის @msg no document open გახსნილი დოკუმენტი არ არის @msg no effect applied yet ეფექტი ჯერ არ გამოყენებულა +@msg no Pathfinder operation applied yet ტრაექტორიების ოპერაცია ჯერ არ გამოყენებულა @msg no effect at index {k} ინდექსზე {k} ეფექტი არ არის @msg no end record დასასრულის ჩანაწერი არ არის @msg no file manager here აქ ფაილების მენეჯერი არ არის diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 6ba3b91b2a..e956dc4a30 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -4468,6 +4468,7 @@ theme Appearance 외관 @msg no PNG encoder PNG 인코더가 없습니다 @msg no document open 열린 문서가 없습니다 @msg no effect applied yet 아직 적용된 효과가 없습니다 +@msg no Pathfinder operation applied yet 아직 적용된 패스파인더 작업이 없습니다 @msg no such perspective grid preset 해당 원근 격자 프리셋이 없습니다 @msg no such recent file 해당 최근 파일이 없습니다 @msg no such recent font 해당 최근 글꼴이 없습니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 6b78604c66..fbe5d843c6 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4163,6 +4163,7 @@ imageTrace Outline Contour @msg no document geen document @msg no document open geen document geopend @msg no effect applied yet nog geen effect toegepast +@msg no Pathfinder operation applied yet nog geen Pathfinder-bewerking toegepast @msg no effect at index {k} geen effect op index {k} @msg no end record geen eindrecord @msg no file manager here hier is geen bestandsbeheerder diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index cacdfbe826..618cf8553c 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4288,6 +4288,7 @@ imageTrace Outline Kontur @msg no document brak dokumentu @msg no document open brak otwartego dokumentu @msg no effect applied yet nie zastosowano jeszcze żadnego efektu +@msg no Pathfinder operation applied yet nie zastosowano jeszcze żadnej operacji odnajdywania ścieżek @msg no effect at index {k} brak efektu o indeksie {k} @msg no end record brak rekordu końcowego @msg no file manager here brak menedżera plików diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 1418bc61b3..a381352984 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -3734,6 +3734,7 @@ axis Both Ambos @msg no document nenhum documento @msg no document open nenhum documento aberto @msg no effect applied yet nenhum efeito aplicado ainda +@msg no Pathfinder operation applied yet nenhuma operação do Localizador de Caminhos aplicada ainda @msg no effect at index {k} nenhum efeito no índice {k} @msg no end record sem registro final @msg no file manager here nenhum gerenciador de arquivos aqui diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index ee4bb67aa6..b1c4c01be7 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -4193,6 +4193,7 @@ axis Both Оба @msg no document нет документа @msg no document open нет открытого документа @msg no effect applied yet эффект ещё не применён +@msg no Pathfinder operation applied yet операция обработки контуров ещё не применена @msg no effect at index {k} нет эффекта с индексом {k} @msg no end record нет конечной записи @msg no file manager here здесь нет файлового менеджера diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 3864fa5e2e..3593d08d94 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -4068,6 +4068,7 @@ axis Both Båda @msg no document inget dokument @msg no document open inget dokument är öppet @msg no effect applied yet ingen effekt har använts än +@msg no Pathfinder operation applied yet ingen banfinnaråtgärd har använts än @msg no effect at index {k} ingen effekt vid index {k} @msg no end record ingen slutpost @msg no file manager here ingen filhanterare här diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 3d87bbb521..535cbeacca 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -4181,6 +4181,7 @@ axis Both Обидві @msg no document немає документа @msg no document open немає відкритого документа @msg no effect applied yet ефект ще не застосований +@msg no Pathfinder operation applied yet операцію обробки контурів ще не застосовано @msg no effect at index {k} немає ефекту з індексом {k} @msg no end record немає кінцевого запису @msg no file manager here тут немає файлового менеджера diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 51092dc6a7..baf4a60d9b 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -4462,6 +4462,7 @@ theme Appearance Giao diện @msg no document không có tài liệu @msg no document open không có tài liệu nào đang mở @msg no effect applied yet chưa áp dụng hiệu ứng +@msg no Pathfinder operation applied yet chưa áp dụng thao tác Pathfinder @msg no effect at index {k} không có hiệu ứng tại chỉ mục {k} @msg no end record không có bản ghi kết thúc @msg no file manager here không có trình quản lý tệp ở đây diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 5085e1a313..d49842dbcf 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -4257,6 +4257,7 @@ imageTrace Outline 轮廓 @msg no PNG encoder 没有 PNG 编码器 @msg no document open 没有打开的文档 @msg no effect applied yet 尚未应用任何效果 +@msg no Pathfinder operation applied yet 尚未应用任何路径查找器操作 @msg no such perspective grid preset 没有此透视网格预设 @msg no such recent file 没有此最近使用的文件 @msg no such recent font 没有此最近使用的字体 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 6e0c66dd6e..e305bc4457 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2198,6 +2198,7 @@ file-filter Templates 範本 @msg no PNG encoder 沒有 PNG 編碼器 @msg no document open 沒有開啟的文件 @msg no effect applied yet 尚未套用任何效果 +@msg no Pathfinder operation applied yet 尚未套用任何路徑管理員操作 @msg no such perspective grid preset 沒有這個透視格點預設集 @msg no such recent file 沒有這個最近使用的檔案 @msg no such recent font 沒有這個最近使用的字體 diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index cafbbfb6d0..a888114dd9 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -134,6 +134,9 @@ pub struct VectorcraftApp { pub titlebar_inset: f32, /// Last applied effect (Effect → Apply Last Effect). pub last_effect: Option<(String, serde_json::Value)>, + /// The operation a Pathfinder panel button ran last (`unite`, `divide`, …) and the button's + /// label, which Repeat Pathfinder runs again ([`panels::pathfinder::repeat`]). + pub last_pathfinder: Option<(String, String)>, /// Last confirmed Warp Options (bend, distortion, orientation) for the next new warp dialog. pub last_warp: Option, /// The Character panel field that takes the keyboard focus when the panel next draws it diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 22ddb543d3..339682c94a 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -544,6 +544,7 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option app.run("effect.apply", json!({"effect": e, "params": params})), None => Err("no effect applied yet".into()), }, + "pathfinder.repeat" => crate::panels::pathfinder::repeat(app), "file.export.pdf" if p.as_object().is_none_or(|o| o.is_empty()) => crate::dialogs::open_save_pdf(app, &json!({})), "file.export.pdf" => io::export_pdf(app, p.clone()), _ => return None, diff --git a/crates/ui-egui/src/menus/state.rs b/crates/ui-egui/src/menus/state.rs index 4b009fbf4d..d66e3e76cd 100644 --- a/crates/ui-egui/src/menus/state.rs +++ b/crates/ui-egui/src/menus/state.rs @@ -217,6 +217,7 @@ pub fn enabled(app: &VectorcraftApp, id: &str) -> bool { "effect.dialog" | "ui.recolorDialog" | "ui.effectGalleryDialog" => app.session.active().is_some_and(|d| !d.selection.is_empty()), "ui.cropImage" => selected_image(app, |_| true), "effect.applyLast" | "effect.last" => app.last_effect.is_some() && app.session.active().is_some_and(|d| !d.selection.is_empty()), + "pathfinder.repeat" => app.last_pathfinder.as_ref().is_some_and(|(op, _)| enabled(app, &format!("object.pathfinder.{op}"))), "file.export.pdf" | "ui.savePdfDialog" | "ui.fileInfoDialog" | "ui.rasterEffectsSettingsDialog" => app.session.active().is_some(), "ui.missingFontsDialog" => !cfg!(target_arch = "wasm32") && app.session.active().is_some(), "ui.findFontsInFolder" => crate::picks::can(app, &crate::picks::PickRequest::Folder) && app.session.active().is_some(), diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 51ba642c1e..6eca8e9df0 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -575,6 +575,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "{} show a crop box on the selected image (tool `cropImage`): it starts on the part over the image's artboard; drag its handles or inside it, then Enter or the Control bar's Apply crops the image to it (object.cropImage {rect}), Escape or Cancel leaves it as it is, both back to the Selection tool. tool.setOption {key: \"rect\", value: [x, y, width, height]} sets the box", ), ("effect.applyLast", "Apply Last Effect", "Cmd+Shift+E", "{}"), + ( + "pathfinder.repeat", + "Repeat Pathfinder", + "Cmd+4", + "{} repeat the last Pathfinder operation run from the Pathfinder panel on the selection; an error until a button has run", + ), ( "file.export.pdf", "Save as PDF…", diff --git a/crates/ui-egui/src/panels/pathfinder.rs b/crates/ui-egui/src/panels/pathfinder.rs index 13008e064a..a888ebbba0 100644 --- a/crates/ui-egui/src/panels/pathfinder.rs +++ b/crates/ui-egui/src/panels/pathfinder.rs @@ -3,10 +3,10 @@ //! sets theirs. use egui::Ui; -use serde_json::json; +use serde_json::{Value, json}; use vectorcraft_engine::doc::ShapeMode; -use super::{pstate, selection_len, set_pstate}; +use super::selection_len; use crate::VectorcraftApp; use crate::widgets::{self, menu_item}; @@ -26,9 +26,18 @@ pub const PATHFINDERS: [(&str, &str, &str); 6] = [ ("dc-pf-minus-back", "Minus Back", "minusBack"), ]; -fn run(app: &mut VectorcraftApp, ui: &Ui, op: &str, label: &str) { +fn run(app: &mut VectorcraftApp, _ui: &Ui, op: &str, label: &str) { if app.run(&format!("object.pathfinder.{op}"), json!({})).is_ok() { - set_pstate(ui.ctx(), "pf-last", Some((op.to_string(), label.to_string()))); + app.last_pathfinder = Some((op.to_string(), label.to_string())); + } +} + +/// Repeat Pathfinder (`pathfinder.repeat`, Cmd/Ctrl+4, the panel menu's Repeat item): the +/// operation a button of the panel ran last, on the selection. +pub fn repeat(app: &mut VectorcraftApp) -> Result { + match app.last_pathfinder.clone() { + Some((op, _)) => app.run(&format!("object.pathfinder.{op}"), json!({})), + None => Err("no Pathfinder operation applied yet".into()), } } @@ -110,13 +119,13 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { if menu_item(ui, tl!("Trap…"), operands(app) >= 2, false) { open_trap(app); } - let last: Option<(String, String)> = pstate(ui.ctx(), "pf-last"); - let label = - last.as_ref().map(|(_, l)| crate::i18n::fmt(tl!("Repeat {name}"), &[("name", tl!(l))])).unwrap_or_else(|| tl!("Repeat Pathfinder").into()); - if menu_item(ui, &label, last.is_some() && selection_len(app) >= 1, false) - && let Some((op, l)) = last - { - run(app, ui, &op, &l); + let label = app + .last_pathfinder + .as_ref() + .map(|(_, l)| crate::i18n::fmt(tl!("Repeat {name}"), &[("name", tl!(l))])) + .unwrap_or_else(|| tl!("Repeat Pathfinder").into()); + if menu_item(ui, &label, crate::menus::enabled(app, "pathfinder.repeat"), false) { + crate::menus::invoke(app, "pathfinder.repeat", json!({})); } if menu_item(ui, tl!("Pathfinder Options…"), true, false) { crate::menus::invoke(app, "object.pathfinder.options", json!({})); @@ -281,4 +290,134 @@ mod tests { assert_eq!(pieces.len(), 1, "only the square's piece outside the unfilled rectangle"); assert!(pieces.iter().all(|p| !p.appearance.fill_paint().is_none())); } + + /// A document with two overlapping 50 pt squares, both selected. + fn two_squares() -> VectorcraftApp { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + select_two_squares(&mut app, 10.0); + app + } + + /// Draw two overlapping 50 pt squares, the first at (`x`, 10), and select only them. + fn select_two_squares(app: &mut VectorcraftApp, x: f64) { + let a = app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 50, "height": 50})).unwrap()["id"].clone(); + let b = app.run("shape.rectangle", json!({"x": x + 30.0, "y": 40, "width": 50, "height": 50})).unwrap()["id"].clone(); + app.run("select.set", json!({"ids": [a, b]})).unwrap(); + } + + /// The kind and geometric bounds of each object on the first layer. + fn objects(app: &VectorcraftApp) -> Vec<(&'static str, [f64; 4])> { + let doc = &app.session.active().unwrap().doc; + let kind = |n: &vectorcraft_engine::doc::Node| if matches!(n.kind, NodeKind::Path { .. }) { "path" } else { "other" }; + let bounds = |n: &vectorcraft_engine::doc::Node| n.geometric_bounds().map_or([0.0; 4], |b| [b.x0, b.y0, b.x1, b.y1]); + doc.layers[0].children().unwrap().iter().map(|n| (kind(n), bounds(n))).collect() + } + + /// Cmd/Ctrl+4 pressed through the shortcut handler. + fn press_cmd_4(app: &mut VectorcraftApp) { + let ctx = egui::Context::default(); + let ev = egui::Event::Key { key: egui::Key::Num4, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::COMMAND }; + let mut out = ctx.run_ui(egui::RawInput { events: vec![ev], ..Default::default() }, |ui| crate::shortcuts::handle(app, ui.ctx())); + out.textures_delta.clear(); + } + + /// A click on the panel button that screen readers name `label`. egui finds what the pointer + /// is over from the frame before, so the move gets a frame of its own. + fn click_button(app: &mut VectorcraftApp, label: &str) { + crate::i18n::set_current(crate::i18n::Lang::EN); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + let mut time = 0.0; + let mut frame = |app: &mut VectorcraftApp, events: Vec| { + time += 0.1; + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(300.0, 200.0)); + let input = egui::RawInput { events, time: Some(time), screen_rect: Some(screen), ..Default::default() }; + let mut out = ctx.run_ui(input, |ui| show(app, ui)); + out.textures_delta.clear(); + out + }; + frame(app, vec![]); + let out = frame(app, vec![]); + let nodes = &out.platform_output.accesskit_update.as_ref().expect("an accessibility tree").nodes; + let node = nodes.iter().find(|(_, n)| n.label() == Some(label) && n.role() == egui::accesskit::Role::Button); + let b = node.unwrap_or_else(|| panic!("no button named {label:?}")).1.bounds().expect("bounds"); + let at = egui::pos2((b.x0 + b.x1) as f32 * 0.5, (b.y0 + b.y1) as f32 * 0.5); + let button = + |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + frame(app, vec![egui::Event::PointerMoved(at)]); + frame(app, vec![button(true)]); + frame(app, vec![button(false)]); + } + + /// A click on the panel menu item labeled `label`. + fn click_menu_item(app: &mut VectorcraftApp, label: &str) { + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let frame = |app: &mut VectorcraftApp, events: Vec| { + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(236.0, 400.0)); + let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), events, ..Default::default() }, |ui| menu(app, ui)); + out.textures_delta.clear(); + crate::tests_removeanchors::shapes_text(&out.shapes.iter().map(|c| c.shape.clone()).collect::>()) + }; + let labels = frame(app, vec![]); + let at = labels.iter().find(|(t, _)| t.trim() == label).map(|(_, r)| r.center()).unwrap_or_else(|| panic!("no {label:?} in {labels:?}")); + let button = + |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + frame(app, vec![egui::Event::PointerMoved(at), button(true)]); + frame(app, vec![button(false)]); + } + + /// Cmd/Ctrl+4 is Repeat Pathfinder's default key. Keyboard Shortcuts lists the command with + /// it, and no other default has the key. + #[test] + fn cmd_4_is_repeat_pathfinder() { + use crate::shortcut_editor::{command_for_key, default_command_shortcut}; + assert_eq!(default_command_shortcut("pathfinder.repeat"), Some("Cmd+4")); + assert_eq!(command_for_key("Cmd+4"), Some("pathfinder.repeat")); + let chord = crate::shortcuts::parse("Cmd+4").expect("parses"); + assert_eq!((chord.modifiers, chord.logical_key), (egui::Modifiers::COMMAND, egui::Key::Num4)); + assert_eq!(crate::menus::pretty_shortcut("Cmd+4"), if cfg!(target_os = "macos") { "⌘4" } else { "Ctrl+4" }); + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + let listed = app.run("shortcuts.list", json!({"query": "pathfinder.repeat"})).unwrap(); + let rows: Vec<_> = listed.as_array().expect("rows").iter().map(|r| (r["label"].clone(), r["default"].clone())).collect(); + assert_eq!(rows, [(json!("Repeat Pathfinder"), json!("Cmd+4"))], "Keyboard Shortcuts lists it"); + assert_eq!(app.run("shortcuts.conflicts", json!({})).unwrap(), json!([]), "no other default has the key"); + } + + /// After Unite from the panel, Cmd/Ctrl+4 unites the two squares selected next, and the panel + /// menu's Repeat Unite item, which runs the same command, unites a third pair. + #[test] + fn cmd_4_repeats_the_operation_a_panel_button_ran_last() { + let mut app = two_squares(); + click_button(&mut app, "Unite"); + let first = ("path", [10.0, 10.0, 90.0, 90.0]); + assert_eq!(objects(&app), [first], "the panel's Unite merged the first pair"); + select_two_squares(&mut app, 110.0); + assert!(crate::menus::enabled(&app, "pathfinder.repeat")); + press_cmd_4(&mut app); + let second = ("path", [110.0, 10.0, 190.0, 90.0]); + assert_eq!(objects(&app), [first, second], "Cmd+4 merged the second pair"); + select_two_squares(&mut app, 210.0); + click_menu_item(&mut app, "Repeat Unite"); + assert_eq!(objects(&app), [first, second, ("path", [210.0, 10.0, 290.0, 90.0])], "the menu item merged the third pair"); + } + + /// Before a button of the panel has run, Repeat Pathfinder is disabled and Cmd/Ctrl+4 leaves + /// the selected squares as they are, with a message in the status bar. After a button has + /// run, the command is disabled again while nothing is selected. + #[test] + fn cmd_4_does_nothing_before_a_panel_button_has_run() { + let mut app = two_squares(); + let before = objects(&app); + assert_eq!(before.len(), 2); + assert!(!crate::menus::enabled(&app, "pathfinder.repeat")); + press_cmd_4(&mut app); + assert_eq!(objects(&app), before, "Cmd+4 changed nothing"); + assert_eq!(app.ui.status, "no Pathfinder operation applied yet"); + click_button(&mut app, "Unite"); + app.run("select.none", json!({})).unwrap(); + assert!(!crate::menus::enabled(&app, "pathfinder.repeat"), "nothing selected"); + } } diff --git a/docs/mcp.md b/docs/mcp.md index 2050794414..f124123223 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -431,7 +431,7 @@ objects' fills or strokes differ (`fillMixed` / `strokeMixed`, drawn as a "?" pr | `export` | `{path?, format?, scale?, artboard?, range?, selection?, outlineText?, options?}` | `svg`, `svgz`, `pdf`, `ai` (the PDF-compatible `.ai` that Save writes, which carries the document when every artboard is written in order), `eps`, `dxf`, `emf`, `wmf`, `png`, `jpg`, `webp`, `gif`, `png8` (an indexed `.png`), `tiff`, `bmp`, `tga`, `psd` (layered), `txt` (the document's text), `vectorcraft` or `template` (a native template). The tool's `format` enum and `document.formats` list them, generated from the engine's format table. When `format` is omitted, it comes from the path's extension. PDF and `.ai` write one page per artboard: all of them, or `artboard` (0-based) / `range` (`"1-3, 5"`, 1-based). SVG and SVGZ write one file per chosen artboard. EPS writes one file of the visible art; with `artboard`, `range`, `options.artboards` or `options: {"useArtboards": true}` it writes one file per chosen artboard, after a central file of the visible art when there are two or more, and `useArtboards: false` keeps the one file. Rasters, DXF, EMF and WMF write one artboard, or one file per chosen artboard with `options: {"useArtboards": true}`. Rasters also take `options: {"rect": [x, y, width, height]}` (page points, y down): that area of the page at the given `ppi`/`scale`, without an artboard and without changing the document; it is refused with `artboard`, `artboards`, `range` or `useArtboards`, with a non-positive or non-finite size, and for non-raster formats. `options` carries more format options (e.g. `{"quality": 80}` for JPEG). `selection: true` exports the selected objects cropped to their bounds (the reply adds their `bounds`, and reports `format` and the encoder's `warnings` as a whole-document export does); `outlineText: true` writes SVG text as paths. Template layers are left out, live effects are kept, and exporting `vectorcraft` never changes the document's path. Without `path` the bytes come back as `dataBase64`. Both backends run the same `document.export` call. | | `add_text` | `{text, x?, y?, width?, height?, fit?, fitMinPercent?, path?, mode?, pathEffect?, size?, font?, color?, justify?, vertical?}` | Point type at (x, y) (`justify`: `left`, `center` or `right` starts, centres or ends each line on x); area type with `width`/`height` (`fit`: `none`, `autoHeight`, `shrinkText`, as `text.areaOptions`); or `path` + `mode` (`area`/`onPath`) to flow text in or along a path, with `pathEffect` (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`); `justify` (also `auto`, `justifyAll`) aligns the paragraphs of every kind, as `text.setStyle` does later. `vertical: true` uses the existing vertical writing mode for every kind (default `false`, horizontal). Returns `{id}`, with `overflow: true` when the text doesn't fit its frame or path. | | `apply_effect` | `{effect?, params?, ids?}` | Appends a live effect. Without `effect`, returns the effect catalogue with parameters and defaults. | -| `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). | +| `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). In the desktop app, the UI command `pathfinder.repeat` (Repeat Pathfinder, Cmd/Ctrl+4) takes no params and runs the operation a Pathfinder panel button ran last on the selection; before a button has run it returns the error "no Pathfinder operation applied yet". | | `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. With `copy`, the first step duplicates. | | `create_graph` | `{type?, x, y, width, height, csv? \| series?, categories?, rows?}` | The nine Illustrator graph types: column, stacked column, bar, stacked bar, line, area, scatter, pie and radar. An empty CSV cell or a `null` in `rows` is a blank value; a number in straight quotes is a label. Edit later with `graph.setData` / `graph.setType` via `run_command`. `graph.column {design, columnType: vertical\|uniform\|repeating\|sliding, each, fractions: chop\|scale}` draws the columns or bars of the series picked with Group Selection (or `seriesIndexes`, or all of them) with a graph design saved by `graph.design`; with no `design` it returns the series' current design and options. Type in the design that holds a `%` followed by two digits shows each column's value, with at least the first digit's places before the decimal point and the second digit's places after it. | | `text_wrap` | `{ids?, offset?, invert?, release?}` | Area type below the objects (same layer) flows around them. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index c34242da1d..a5c1c349ca 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -615,6 +615,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - While the Type tool edits text, a character typed with AltGr is typed and runs no command. Firefox on Windows reports AltGr as Ctrl and Alt held, so in the web build AltGr+L (ł on a Polish layout) does not also open Layer Options for a new layer, and AltGr+Q (@ on a German layout) does not also run Reset Tracking and Kerning. A Ctrl+Alt chord that types no character runs its command. - With the Artboard tool, Cmd/Ctrl+A after a click on a row of the Artboards panel selects every artboard, as the macOS menu bar's Select All does then; the active artboard stays active, and the art's selection does not change. After a press outside the panel's list, Cmd/Ctrl+A selects every object again. It used to select every object after a click in the panel too. Public reference: [Select artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/select-artboards.html). - Cmd/Ctrl+/ (`appearance.addFill`) and Cmd/Ctrl+Alt+/ (`appearance.addStroke`) add a new fill and a new stroke to the selected objects, as the Appearance panel's Add New Fill and Add New Stroke buttons do, on the keys the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for adding a new fill and a new stroke. Keyboard Shortcuts lists both under Window › Appearance. + - Cmd/Ctrl+4 (`pathfinder.repeat`, Repeat Pathfinder) runs the operation a Pathfinder panel button ran last on the selected objects, as the panel menu's Repeat item does. Until a button has run, the command is disabled and the key leaves the art as it is, with "no Pathfinder operation applied yet" in the status bar. - Cmd/Ctrl+Alt+Shift+. and , (`type.size.increaseByFive`, `type.size.decreaseByFive`) step the font size of the selected type, or of the text the Type tool has selected, by five times the Size/Leading increment (Preferences › Type); Cmd/Ctrl+Shift+. and , still step it by one increment. - Cmd/Ctrl+Alt+Q (`type.resetTracking`) sets the tracking of the selected type, or of the text the Type tool has selected, to 0 and its kerning to Auto (0 in the Character panel), in one undo step; at a caret it resets the kerning of the character before it. - Cmd/Ctrl+Alt+K (`type.highlightKerning`) and Cmd/Ctrl+Alt+Shift+F (`type.highlightFontName`) show the Character panel and give its Kerning field the keyboard focus with the value selected, or open its font family menu with the search field focused, on the keys the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for highlighting kerning and the font name field. The page lists the same key for selecting the tracking value; `type.highlightTracking` focuses the Tracking field the same way and has no default key in Keyboard Shortcuts. diff --git a/docs/ui-parity.md b/docs/ui-parity.md index ffd993efbd..6b8c0b1c33 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -244,7 +244,9 @@ tools, never checked side by side) isn't captured row by row. ## Keyboard shortcuts Cmd/Ctrl+/ (`appearance.addFill`) and Cmd/Ctrl+Alt+/ (`appearance.addStroke`) add a new fill and a new stroke to the -selected objects, as the Appearance panel's Add New Fill and Add New Stroke buttons do. +selected objects, as the Appearance panel's Add New Fill and Add New Stroke buttons do. Cmd/Ctrl+4 +(`pathfinder.repeat`, Repeat Pathfinder) runs the operation a Pathfinder panel button ran last on the selected +objects, as the panel menu's Repeat item does. ~110 distinct modified shortcuts on menu commands plus single-key tool shortcuts for the default toolbar (`crates/tools/src/catalog.rs`), a shortcut editor with chords, and saved sets. Cmd/Ctrl+Alt+L (`ui.newLayer`) opens Layer Options for a new layer, as an Alt-click on the Layers panel's New Layer button does, and Cmd/Ctrl+L still adds a layer without the dialog. F8 (`ui.symbolOptions`) opens Symbol Options for a new symbol made from the selection, as the Symbols panel's New Symbol button does. Not yet diffed item by item From bad34b711580ca544e0e0c5a5bf29ec53add6575 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 08:46:17 -0700 Subject: [PATCH 050/227] Pathfinder: direct commands set the operation Cmd+4 repeats Every successful Shape Mode or Pathfinder operation now sets the operation that Repeat Pathfinder runs, including direct object.pathfinder.* commands, not only the panel's buttons. Trap, compound-shape edits and live effects leave it unchanged, and a failed operation keeps the earlier one. The panel menu names the remembered operation, and Repeat runs it on the current selection with the current Pathfinder Options. With too few objects selected, Cmd/Ctrl+4 leaves the art as it is and shows the panel's selection message in the status bar. Adds the "no Pathfinder operation applied yet" rows to the Catalan and Turkish catalogs, and tests for direct and failed operations, Trap, compound shapes, current options, a one-path selection and the default keys. --- crates/ui-egui/src/app/commands.rs | 6 + crates/ui-egui/src/i18n/ca.tsv | 1 + crates/ui-egui/src/i18n/tr.tsv | 1 + crates/ui-egui/src/lib.rs | 5 +- crates/ui-egui/src/menus/state.rs | 5 +- crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/panels/pathfinder.rs | 148 +++++++++++++++++++++--- docs/mcp.md | 2 +- docs/target-app-parity.md | 2 +- docs/ui-parity.md | 5 +- 10 files changed, 148 insertions(+), 29 deletions(-) diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index 0f136e65e5..9273f9683d 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -88,6 +88,12 @@ impl VectorcraftApp { { crate::ime::note_application_edit(self, &ctx, ime_view, ime_target, ime_before); } + if r.is_ok() + && let Some(op) = id.strip_prefix("object.pathfinder.") + && panels::pathfinder::operation_label(op).is_some() + { + self.last_pathfinder = Some(op.to_string()); + } if r.is_ok() && matches!(id, "edit.copy" | "edit.cut") { self.publish_clipboard(); } diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 1a1ce4c037..08e8c524d1 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5105,6 +5105,7 @@ @msg no document no hi ha document @msg no document open no hi ha cap document obert @msg no effect applied yet encara no s’ha aplicat cap efecte +@msg no Pathfinder operation applied yet encara no s’ha aplicat cap operació del Cercador de traçats @msg no effect at index {k} no hi ha cap efecte a l’índex {k} @msg no empty artboards to delete no hi ha taulers buits per suprimir @msg no end record no hi ha registre final diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 051726501e..eb2a277f00 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -3931,6 +3931,7 @@ axis Both Her İkisi @msg no document belge yok @msg no document open hiçbir belge açık değil @msg no effect applied yet henüz hiçbir efekt uygulanmadı +@msg no Pathfinder operation applied yet henüz hiçbir Yol Bulucu işlemi uygulanmadı @msg no effect at index {k} {k} endeksinde etkisi yok @msg no end record son kayıt yok @msg no file manager here burada dosya yöneticisi yok diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index a888114dd9..a15351576a 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -134,9 +134,8 @@ pub struct VectorcraftApp { pub titlebar_inset: f32, /// Last applied effect (Effect → Apply Last Effect). pub last_effect: Option<(String, serde_json::Value)>, - /// The operation a Pathfinder panel button ran last (`unite`, `divide`, …) and the button's - /// label, which Repeat Pathfinder runs again ([`panels::pathfinder::repeat`]). - pub last_pathfinder: Option<(String, String)>, + /// Last successful destructive Pathfinder operation, repeated on the current selection. + pub last_pathfinder: Option, /// Last confirmed Warp Options (bend, distortion, orientation) for the next new warp dialog. pub last_warp: Option, /// The Character panel field that takes the keyboard focus when the panel next draws it diff --git a/crates/ui-egui/src/menus/state.rs b/crates/ui-egui/src/menus/state.rs index d66e3e76cd..55ee84b800 100644 --- a/crates/ui-egui/src/menus/state.rs +++ b/crates/ui-egui/src/menus/state.rs @@ -217,7 +217,10 @@ pub fn enabled(app: &VectorcraftApp, id: &str) -> bool { "effect.dialog" | "ui.recolorDialog" | "ui.effectGalleryDialog" => app.session.active().is_some_and(|d| !d.selection.is_empty()), "ui.cropImage" => selected_image(app, |_| true), "effect.applyLast" | "effect.last" => app.last_effect.is_some() && app.session.active().is_some_and(|d| !d.selection.is_empty()), - "pathfinder.repeat" => app.last_pathfinder.as_ref().is_some_and(|(op, _)| enabled(app, &format!("object.pathfinder.{op}"))), + "pathfinder.repeat" => app.last_pathfinder.as_ref().is_some_and(|op| { + let min = crate::panels::pathfinder::minimum_operands(op); + crate::panels::pathfinder::operands(app) >= min + }), "file.export.pdf" | "ui.savePdfDialog" | "ui.fileInfoDialog" | "ui.rasterEffectsSettingsDialog" => app.session.active().is_some(), "ui.missingFontsDialog" => !cfg!(target_arch = "wasm32") && app.session.active().is_some(), "ui.findFontsInFolder" => crate::picks::can(app, &crate::picks::PickRequest::Folder) && app.session.active().is_some(), diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 6eca8e9df0..8c62a3f110 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -579,7 +579,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "pathfinder.repeat", "Repeat Pathfinder", "Cmd+4", - "{} repeat the last Pathfinder operation run from the Pathfinder panel on the selection; an error until a button has run", + "{} repeat the last successful Shape Mode or Pathfinder operation on the selection with the current Pathfinder Options; an error until one has run", ), ( "file.export.pdf", diff --git a/crates/ui-egui/src/panels/pathfinder.rs b/crates/ui-egui/src/panels/pathfinder.rs index a888ebbba0..9533938472 100644 --- a/crates/ui-egui/src/panels/pathfinder.rs +++ b/crates/ui-egui/src/panels/pathfinder.rs @@ -26,24 +26,38 @@ pub const PATHFINDERS: [(&str, &str, &str); 6] = [ ("dc-pf-minus-back", "Minus Back", "minusBack"), ]; -fn run(app: &mut VectorcraftApp, _ui: &Ui, op: &str, label: &str) { - if app.run(&format!("object.pathfinder.{op}"), json!({})).is_ok() { - app.last_pathfinder = Some((op.to_string(), label.to_string())); - } +/// Returns the minimum number of operands required by a Pathfinder operation. +pub(crate) fn minimum_operands(op: &str) -> usize { + if matches!(op, "outline" | "divide") { 1 } else { 2 } } -/// Repeat Pathfinder (`pathfinder.repeat`, Cmd/Ctrl+4, the panel menu's Repeat item): the -/// operation a button of the panel ran last, on the selection. +/// The panel name for one of the ten repeatable Shape Mode or Pathfinder operations. +pub fn operation_label(op: &str) -> Option<&'static str> { + SHAPE_MODES.into_iter().chain(PATHFINDERS).find(|(_, _, id)| *id == op).map(|(_, label, _)| label) +} + +fn run(app: &mut VectorcraftApp, op: &str) { + // The command path reports a failed operation in the status bar. + let _ = app.run(&format!("object.pathfinder.{op}"), json!({})); +} + +/// Repeat the last successful Shape Mode or Pathfinder operation on the current selection. pub fn repeat(app: &mut VectorcraftApp) -> Result { match app.last_pathfinder.clone() { - Some((op, _)) => app.run(&format!("object.pathfinder.{op}"), json!({})), + Some(op) => { + let min = minimum_operands(&op); + if operands(app) < min { + return Err("Select two or more objects, or a group".into()); + } + app.run(&format!("object.pathfinder.{op}"), json!({})) + } None => Err("no Pathfinder operation applied yet".into()), } } /// How many objects the selection gives an operation: a group selected alone counts as the shapes /// the operation takes from it, nested groups included (#1450, #1635). -fn operands(app: &VectorcraftApp) -> usize { +pub(crate) fn operands(app: &VectorcraftApp) -> usize { let alone = app.session.active().filter(|d| d.selection.len() == 1).and_then(|d| d.doc.node(*d.selection.objects.first()?)); match alone.filter(|n| matches!(n.kind, vectorcraft_doc::NodeKind::Group { .. })) { Some(group) => vectorcraft_engine::cmd::shape_count(group), @@ -64,13 +78,13 @@ fn button(ui: &mut Ui, icon: &str, tip: &str, selected: bool, n: usize, min: usi /// A Shape Mode button clicked: Alt makes a compound shape of the selection in `mode`; with /// members of compound shapes selected they take `mode`; otherwise operation `op` runs. -fn shape_mode(app: &mut VectorcraftApp, ui: &Ui, op: &str, label: &str, mode: ShapeMode, members: bool) { +fn shape_mode(app: &mut VectorcraftApp, ui: &Ui, op: &str, mode: ShapeMode, members: bool) { if ui.input(|i| i.modifiers.alt) { crate::menus::invoke(app, "object.compoundShape.make", json!({"mode": mode.name()})); } else if members { crate::menus::invoke(app, "object.compoundShape.setMode", json!({"mode": mode.name()})); } else { - run(app, ui, op, label); + run(app, op); } } @@ -88,7 +102,7 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let count = if modes.is_empty() { n } else { n.max(2) }; for ((icon, tip, op), mode) in SHAPE_MODES.into_iter().zip(ShapeMode::ALL) { if button(ui, icon, tip, shared == Some(mode), count, 2) { - shape_mode(app, ui, op, tip, mode, !modes.is_empty()); + shape_mode(app, ui, op, mode, !modes.is_empty()); } } let resp = ui.add_enabled_ui(expand, |ui| widgets::flat_button_fit(ui, "Expand", 90.0)).inner; @@ -100,9 +114,9 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { ui.horizontal(|ui| { ui.spacing_mut().item_spacing.x = 5.0; for (icon, tip, op) in PATHFINDERS { - let min = if op == "outline" || op == "divide" { 1 } else { 2 }; + let min = minimum_operands(op); if button(ui, icon, tip, false, n, min) { - run(app, ui, op, tip); + run(app, op); } } }); @@ -122,7 +136,8 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { let label = app .last_pathfinder .as_ref() - .map(|(_, l)| crate::i18n::fmt(tl!("Repeat {name}"), &[("name", tl!(l))])) + .and_then(|op| operation_label(op)) + .map(|label| crate::i18n::fmt(tl!("Repeat {name}"), &[("name", tl!(label))])) .unwrap_or_else(|| tl!("Repeat Pathfinder").into()); if menu_item(ui, &label, crate::menus::enabled(app, "pathfinder.repeat"), false) { crate::menus::invoke(app, "pathfinder.repeat", json!({})); @@ -325,6 +340,11 @@ mod tests { /// A click on the panel button that screen readers name `label`. egui finds what the pointer /// is over from the frame before, so the move gets a frame of its own. fn click_button(app: &mut VectorcraftApp, label: &str) { + click_button_with_modifiers(app, label, egui::Modifiers::NONE); + } + + /// Click a panel button with a modifier held across the input frames. + fn click_button_with_modifiers(app: &mut VectorcraftApp, label: &str, modifiers: egui::Modifiers) { crate::i18n::set_current(crate::i18n::Lang::EN); let ctx = egui::Context::default(); ctx.enable_accesskit(); @@ -333,6 +353,8 @@ mod tests { let mut frame = |app: &mut VectorcraftApp, events: Vec| { time += 0.1; let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(300.0, 200.0)); + let mut events = events; + events.insert(0, egui::Event::ModifiersChanged(modifiers)); let input = egui::RawInput { events, time: Some(time), screen_rect: Some(screen), ..Default::default() }; let mut out = ctx.run_ui(input, |ui| show(app, ui)); out.textures_delta.clear(); @@ -344,8 +366,7 @@ mod tests { let node = nodes.iter().find(|(_, n)| n.label() == Some(label) && n.role() == egui::accesskit::Role::Button); let b = node.unwrap_or_else(|| panic!("no button named {label:?}")).1.bounds().expect("bounds"); let at = egui::pos2((b.x0 + b.x1) as f32 * 0.5, (b.y0 + b.y1) as f32 * 0.5); - let button = - |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE }; + let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers }; frame(app, vec![egui::Event::PointerMoved(at)]); frame(app, vec![button(true)]); frame(app, vec![button(false)]); @@ -375,6 +396,7 @@ mod tests { fn cmd_4_is_repeat_pathfinder() { use crate::shortcut_editor::{command_for_key, default_command_shortcut}; assert_eq!(default_command_shortcut("pathfinder.repeat"), Some("Cmd+4")); + assert_eq!(default_command_shortcut("effect.applyLast"), Some("Cmd+Shift+E")); assert_eq!(command_for_key("Cmd+4"), Some("pathfinder.repeat")); let chord = crate::shortcuts::parse("Cmd+4").expect("parses"); assert_eq!((chord.modifiers, chord.logical_key), (egui::Modifiers::COMMAND, egui::Key::Num4)); @@ -384,6 +406,8 @@ mod tests { let rows: Vec<_> = listed.as_array().expect("rows").iter().map(|r| (r["label"].clone(), r["default"].clone())).collect(); assert_eq!(rows, [(json!("Repeat Pathfinder"), json!("Cmd+4"))], "Keyboard Shortcuts lists it"); assert_eq!(app.run("shortcuts.conflicts", json!({})).unwrap(), json!([]), "no other default has the key"); + assert_eq!(vectorcraft_engine::command_specs().iter().filter(|c| c.shortcut == Some("Cmd+4")).count(), 0); + assert_eq!(crate::menus::UI_COMMANDS.iter().filter(|c| c.2 == "Cmd+4").map(|c| c.0).collect::>(), ["pathfinder.repeat"]); } /// After Unite from the panel, Cmd/Ctrl+4 unites the two squares selected next, and the panel @@ -404,11 +428,11 @@ mod tests { assert_eq!(objects(&app), [first, second, ("path", [210.0, 10.0, 290.0, 90.0])], "the menu item merged the third pair"); } - /// Before a button of the panel has run, Repeat Pathfinder is disabled and Cmd/Ctrl+4 leaves - /// the selected squares as they are, with a message in the status bar. After a button has + /// Before a repeatable operation has run, Repeat Pathfinder is disabled and Cmd/Ctrl+4 leaves + /// the selected squares as they are, with a message in the status bar. After an operation has /// run, the command is disabled again while nothing is selected. #[test] - fn cmd_4_does_nothing_before_a_panel_button_has_run() { + fn cmd_4_does_nothing_before_an_operation_has_run() { let mut app = two_squares(); let before = objects(&app); assert_eq!(before.len(), 2); @@ -419,5 +443,91 @@ mod tests { click_button(&mut app, "Unite"); app.run("select.none", json!({})).unwrap(); assert!(!crate::menus::enabled(&app, "pathfinder.repeat"), "nothing selected"); + assert!(app.run("pathfinder.repeat", json!({})).is_err()); + } + + /// One selected path cannot supply the operands for Unite; the shortcut reports the failure. + #[test] + fn repeat_with_one_path_keeps_art_and_history() { + let mut app = two_squares(); + click_button(&mut app, "Unite"); + let before = objects(&app); + assert_eq!(before.len(), 1); + assert!(!crate::menus::enabled(&app, "pathfinder.repeat")); + press_cmd_4(&mut app); + assert_eq!(objects(&app), before); + assert_eq!(app.ui.status, "Select two or more objects, or a group"); + assert_eq!(app.last_pathfinder.as_deref(), Some("unite")); + } + + /// A direct command replaces the panel's previous operation and supplies the menu name. + #[test] + fn direct_operation_becomes_the_one_repeated() { + let mut app = two_squares(); + click_button(&mut app, "Unite"); + select_two_squares(&mut app, 110.0); + app.run("object.pathfinder.intersect", json!({})).unwrap(); + assert_eq!(app.last_pathfinder.as_deref(), Some("intersect")); + select_two_squares(&mut app, 210.0); + click_menu_item(&mut app, "Repeat Intersect"); + assert_eq!(objects(&app).last(), Some(&("path", [240.0, 40.0, 260.0, 60.0]))); + assert_eq!(app.last_pathfinder.as_deref(), Some("intersect")); + } + + /// A rejected operation leaves the prior successful operation available to repeat. + #[test] + fn failed_operation_keeps_history() { + let mut app = two_squares(); + click_button(&mut app, "Unite"); + assert!(app.run("object.pathfinder.intersect", json!({"precision": -1.0})).is_err()); + assert_eq!(app.last_pathfinder.as_deref(), Some("unite")); + select_two_squares(&mut app, 110.0); + click_menu_item(&mut app, "Repeat Unite"); + assert_eq!(objects(&app).last(), Some(&("path", [110.0, 10.0, 190.0, 90.0]))); + } + + /// A successful Trap keeps the last repeatable operation in history. + #[test] + fn successful_trap_keeps_history() { + let mut app = two_squares(); + click_button(&mut app, "Unite"); + let mut rect = |x: f64, color: &str| { + let id = app.run("shape.rectangle", json!({"x": x, "y": 10, "width": 50, "height": 50})).unwrap()["id"].clone(); + app.run("paint.setFill", json!({"color": color})).unwrap(); + id + }; + let (a, b) = (rect(110.0, "#ffff00"), rect(160.0, "#0000ff")); + app.run("select.set", json!({"ids": [a, b]})).unwrap(); + app.run("object.pathfinder.trap", json!({"thickness": 2, "tintReduction": 30})).unwrap(); + assert_eq!(app.last_pathfinder.as_deref(), Some("unite")); + } + + /// Repeat reads the current options instead of replaying the earlier command's settings. + #[test] + fn repeat_uses_current_pathfinder_options() { + let mut app = two_squares(); + app.run("object.pathfinder.divide", json!({})).unwrap(); + assert_eq!(app.last_pathfinder.as_deref(), Some("divide")); + app.run("object.pathfinder.options", json!({"precision": 1.0})).unwrap(); + let a = app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 100, "height": 100})).unwrap()["id"].clone(); + let b = app.run("shape.rectangle", json!({"x": 0, "y": 99.5, "width": 100, "height": 100})).unwrap()["id"].clone(); + app.run("select.set", json!({"ids": [a, b]})).unwrap(); + let id = app.run("pathfinder.repeat", json!({})).unwrap()["ids"][0].as_u64().unwrap(); + let group = app.session.active().unwrap().doc.node(NodeId(id)).unwrap(); + assert_eq!(group.children().unwrap().len(), 2); + assert_eq!(app.last_pathfinder.as_deref(), Some("divide")); + } + + /// Compound-shape creation and member edits leave destructive Pathfinder history alone. + #[test] + fn compound_shape_commands_do_not_set_history() { + let mut app = two_squares(); + let a = app.session.active().unwrap().selection.objects[0]; + click_button_with_modifiers(&mut app, "Minus Front", egui::Modifiers::ALT); + assert_eq!(app.last_pathfinder, None); + app.run("select.set", json!({"ids": [a.0]})).unwrap(); + click_button(&mut app, "Unite"); + assert_eq!(app.last_pathfinder, None); + assert!(!crate::menus::enabled(&app, "pathfinder.repeat")); } } diff --git a/docs/mcp.md b/docs/mcp.md index f124123223..558154f70a 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -431,7 +431,7 @@ objects' fills or strokes differ (`fillMixed` / `strokeMixed`, drawn as a "?" pr | `export` | `{path?, format?, scale?, artboard?, range?, selection?, outlineText?, options?}` | `svg`, `svgz`, `pdf`, `ai` (the PDF-compatible `.ai` that Save writes, which carries the document when every artboard is written in order), `eps`, `dxf`, `emf`, `wmf`, `png`, `jpg`, `webp`, `gif`, `png8` (an indexed `.png`), `tiff`, `bmp`, `tga`, `psd` (layered), `txt` (the document's text), `vectorcraft` or `template` (a native template). The tool's `format` enum and `document.formats` list them, generated from the engine's format table. When `format` is omitted, it comes from the path's extension. PDF and `.ai` write one page per artboard: all of them, or `artboard` (0-based) / `range` (`"1-3, 5"`, 1-based). SVG and SVGZ write one file per chosen artboard. EPS writes one file of the visible art; with `artboard`, `range`, `options.artboards` or `options: {"useArtboards": true}` it writes one file per chosen artboard, after a central file of the visible art when there are two or more, and `useArtboards: false` keeps the one file. Rasters, DXF, EMF and WMF write one artboard, or one file per chosen artboard with `options: {"useArtboards": true}`. Rasters also take `options: {"rect": [x, y, width, height]}` (page points, y down): that area of the page at the given `ppi`/`scale`, without an artboard and without changing the document; it is refused with `artboard`, `artboards`, `range` or `useArtboards`, with a non-positive or non-finite size, and for non-raster formats. `options` carries more format options (e.g. `{"quality": 80}` for JPEG). `selection: true` exports the selected objects cropped to their bounds (the reply adds their `bounds`, and reports `format` and the encoder's `warnings` as a whole-document export does); `outlineText: true` writes SVG text as paths. Template layers are left out, live effects are kept, and exporting `vectorcraft` never changes the document's path. Without `path` the bytes come back as `dataBase64`. Both backends run the same `document.export` call. | | `add_text` | `{text, x?, y?, width?, height?, fit?, fitMinPercent?, path?, mode?, pathEffect?, size?, font?, color?, justify?, vertical?}` | Point type at (x, y) (`justify`: `left`, `center` or `right` starts, centres or ends each line on x); area type with `width`/`height` (`fit`: `none`, `autoHeight`, `shrinkText`, as `text.areaOptions`); or `path` + `mode` (`area`/`onPath`) to flow text in or along a path, with `pathEffect` (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`); `justify` (also `auto`, `justifyAll`) aligns the paragraphs of every kind, as `text.setStyle` does later. `vertical: true` uses the existing vertical writing mode for every kind (default `false`, horizontal). Returns `{id}`, with `overflow: true` when the text doesn't fit its frame or path. | | `apply_effect` | `{effect?, params?, ids?}` | Appends a live effect. Without `effect`, returns the effect catalogue with parameters and defaults. | -| `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). In the desktop app, the UI command `pathfinder.repeat` (Repeat Pathfinder, Cmd/Ctrl+4) takes no params and runs the operation a Pathfinder panel button ran last on the selection; before a button has run it returns the error "no Pathfinder operation applied yet". | +| `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). In remote desktop mode, `run_command` and `invoke_menu` can both call `pathfinder.repeat` with `{}`. Every successful Shape Mode or Pathfinder operation, including direct `object.pathfinder.*` commands, sets its history. Repeat applies it to the current selection using current Pathfinder Options. Trap, compound-shape edits and live effects do not set history. With no history it returns "no Pathfinder operation applied yet". | | `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. With `copy`, the first step duplicates. | | `create_graph` | `{type?, x, y, width, height, csv? \| series?, categories?, rows?}` | The nine Illustrator graph types: column, stacked column, bar, stacked bar, line, area, scatter, pie and radar. An empty CSV cell or a `null` in `rows` is a blank value; a number in straight quotes is a label. Edit later with `graph.setData` / `graph.setType` via `run_command`. `graph.column {design, columnType: vertical\|uniform\|repeating\|sliding, each, fractions: chop\|scale}` draws the columns or bars of the series picked with Group Selection (or `seriesIndexes`, or all of them) with a graph design saved by `graph.design`; with no `design` it returns the series' current design and options. Type in the design that holds a `%` followed by two digits shows each column's value, with at least the first digit's places before the decimal point and the second digit's places after it. | | `text_wrap` | `{ids?, offset?, invert?, release?}` | Area type below the objects (same layer) flows around them. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index a5c1c349ca..c4653b53d0 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -615,7 +615,6 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - While the Type tool edits text, a character typed with AltGr is typed and runs no command. Firefox on Windows reports AltGr as Ctrl and Alt held, so in the web build AltGr+L (ł on a Polish layout) does not also open Layer Options for a new layer, and AltGr+Q (@ on a German layout) does not also run Reset Tracking and Kerning. A Ctrl+Alt chord that types no character runs its command. - With the Artboard tool, Cmd/Ctrl+A after a click on a row of the Artboards panel selects every artboard, as the macOS menu bar's Select All does then; the active artboard stays active, and the art's selection does not change. After a press outside the panel's list, Cmd/Ctrl+A selects every object again. It used to select every object after a click in the panel too. Public reference: [Select artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/select-artboards.html). - Cmd/Ctrl+/ (`appearance.addFill`) and Cmd/Ctrl+Alt+/ (`appearance.addStroke`) add a new fill and a new stroke to the selected objects, as the Appearance panel's Add New Fill and Add New Stroke buttons do, on the keys the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for adding a new fill and a new stroke. Keyboard Shortcuts lists both under Window › Appearance. - - Cmd/Ctrl+4 (`pathfinder.repeat`, Repeat Pathfinder) runs the operation a Pathfinder panel button ran last on the selected objects, as the panel menu's Repeat item does. Until a button has run, the command is disabled and the key leaves the art as it is, with "no Pathfinder operation applied yet" in the status bar. - Cmd/Ctrl+Alt+Shift+. and , (`type.size.increaseByFive`, `type.size.decreaseByFive`) step the font size of the selected type, or of the text the Type tool has selected, by five times the Size/Leading increment (Preferences › Type); Cmd/Ctrl+Shift+. and , still step it by one increment. - Cmd/Ctrl+Alt+Q (`type.resetTracking`) sets the tracking of the selected type, or of the text the Type tool has selected, to 0 and its kerning to Auto (0 in the Character panel), in one undo step; at a caret it resets the kerning of the character before it. - Cmd/Ctrl+Alt+K (`type.highlightKerning`) and Cmd/Ctrl+Alt+Shift+F (`type.highlightFontName`) show the Character panel and give its Kerning field the keyboard focus with the value selected, or open its font family menu with the search field focused, on the keys the reference app's [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page lists for highlighting kerning and the font name field. The page lists the same key for selecting the tracking value; `type.highlightTracking` focuses the Tracking field the same way and has no default key in Keyboard Shortcuts. @@ -795,6 +794,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Extrude & Bevel, Inflate and Rotate (Effect › 3D and Materials): live effects in the `three-d` crate with depth, twist, taper, solid or hollow caps, five original bevel shapes (width, height, repeat, spacing, inside, both sides), Inflate's volume, both sides, twist, taper and cap, Rotate's turned fills and strokes, Position presets, the rotation and light gizmos, SVG/PDF vector output and Expand Appearance; one 3D effect per object; covered by geometry, effect, canvas-versus-export, command and dialog tests ([three-d.md](three-d.md)). - Initial live Revolve (#605, #846): a portable geometry and shading crate (`three-d`), editable path and compound profiles, compact options with artboard rotation and light gizmos, SVG/PDF vector output and Expand Appearance that can trim covered faces. Open ends have continuous caps by default, shading is smooth with one to ten colored lights, and intersecting surfaces' visibility is approximate ([revolve.md](revolve.md)). - Live effects with previewing dialogs: Distort & Transform, Path, Convert to Shape, 15 Warp styles, Round Corners, Scribble, Effect → Pathfinder (all 10 operations, live on groups; several loose objects are grouped first, in one undo step), Color Adjustments (Brightness/Contrast, Curves, Levels, Hue/Saturation, Shift to Color, Temperature/Tint, on vectors, live type and embedded images), and raster drop shadow, glows and feather. SVG and PDF export keep live effects (geometry baked; SVG raster effects as filters). Zig Zag spaces its ridges evenly along each segment, so lines and curves get a regular wave in Corner and Smooth (#1558). Warp › Arc (the effect and Envelope › Make with Warp) bends in the object's real proportions: a circular arc with concentric edges and no fold-over at 100%, so Arc on art that isn't square draws differently from before (#1581, fixes #1578). `effect.apply` and `effect.setParams` give an error for a misspelt or wrongly typed effect parameter instead of running the effect with its default (#1623, #1592). Roughen with Smooth keeps turn-backs smooth instead of making cusps that draw as spikes (#1646, #1643). Scribble draws one zig-zag per region, with no lines across holes and notches; convex shapes are unchanged (#1651, #1648). On the canvas, in Expand Appearance and in exports, Effect → Pathfinder uses the glyph outlines of type in the group, and results painted like the type keep its opacity and blend mode. + - Cmd/Ctrl+4 (`pathfinder.repeat`) repeats the last successful Shape Mode or Pathfinder operation, including direct `object.pathfinder.*` commands, on the current selection; the panel menu names it. Trap, compound-shape edits and live effects do not set history. Public references: [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), [Pathfinder panel overview](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html). - Pathfinder Options ([Pathfinder panel overview](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html)): the panel menu's Pathfinder Options… sets Precision (0.001–10 pt: results refit to within it, thinner pieces dropped), Remove Redundant Points and Divide and Outline Will Remove Unpainted Artwork (`object.pathfinder.options`, kept in the preferences) for every Shape Mode and Pathfinder operation; the defaults keep the earlier output (`pathops` `precision_drops_pieces_thinner_than_it`, engine `tests_pathops` Pathfinder Options tests, `panels::pathfinder` dialog test). - Pathfinder › Trap ([trapping](https://helpx.adobe.com/illustrator/using/trapping.html), [Pathfinder panel](https://helpx.adobe.com/illustrator/using/pathfinder-panel-overview.html)): the Pathfinder panel menu's Trap… (`object.pathfinder.trap`) and Effect › Pathfinder › Trap… (`pathfinder.trap`, live on groups) add, where two objects' visible areas of different solid colours meet, a strip of the darker one's area along the edge, filled with the lighter colour at the Tint Reduction percentage and set to overprint (Reverse Traps: the darker colour spreads instead, but not a rich black); Thickness 0.01–5000 pt across vertical edges, Height/Width scales it across horizontal ones, Traps with Process Color paints a swatch colour's trap with its CMYK equivalent; the effect also has Precision and Remove Redundant Points. The panel's Trap is one undo step and groups the traps above the topmost selected object, selected; with no adjoining edges of different colours it says so and changes nothing. Tests: `crates/pathops/src/trap.rs`, `crates/effects/src/trap.rs`, `group::tests::trap_effect_adds_an_overprinting_strip_above_the_members`, `crates/engine/src/tests/trap.rs`, `panels::pathfinder::tests::trap_opens_its_options_and_ok_traps_the_selection`. - Compound shapes ([Create compound shapes with Pathfinder](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/create-compound-shapes-with-pathfinder.html), [Pathfinder panel overview](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html)): the Pathfinder panel menu's Make Compound Shape (every member in Add) and Alt-clicking a Shape Mode (every member in that mode) make the two or more selected paths, compound paths, groups, compound shapes or type a live compound shape (`object.compoundShape.make`): a group whose members each keep a shape mode and stay editable, drawn, printed and exported (SVG, PDF and the rest through the baked document) as the area the modes make from the backmost member up, open paths closed, painted with its own appearance, taken from the topmost member not subtracting. With members selected (Direct Selection, Layers panel, isolation mode) a Shape Mode button sets theirs (`object.compoundShape.setMode`) and is lit for the mode they share; paint given to a member goes to the compound shape. Release Compound Shape gives the members back as they were (`object.compoundShape.release`); Expand Compound Shape and the panel's Expand button turn it into the path or compound path of its area (`object.compoundShape.expand`). Shape Modes and Pathfinders take a compound shape as its area. Saved files keep it (`compound_shape`, `shape_mode`; an unknown mode reads as Add). Tests: `crates/engine/src/tests/compound_shape.rs`, `group::tests::compound_shapes_draw_the_area_their_shape_modes_make`, `group::tests::nested_compound_shapes_take_part_as_their_area`, `panels::pathfinder::tests::compound_shape_items_follow_the_selection`, the `CompoundShape` op of the property-test strategies. Not yet: blends, envelopes and warps as members, the question marks on mixed member modes, hit-testing by the area (a click hits the members). diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 6b8c0b1c33..8b79849c1e 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -244,9 +244,7 @@ tools, never checked side by side) isn't captured row by row. ## Keyboard shortcuts Cmd/Ctrl+/ (`appearance.addFill`) and Cmd/Ctrl+Alt+/ (`appearance.addStroke`) add a new fill and a new stroke to the -selected objects, as the Appearance panel's Add New Fill and Add New Stroke buttons do. Cmd/Ctrl+4 -(`pathfinder.repeat`, Repeat Pathfinder) runs the operation a Pathfinder panel button ran last on the selected -objects, as the panel menu's Repeat item does. +selected objects, as the Appearance panel's Add New Fill and Add New Stroke buttons do. ~110 distinct modified shortcuts on menu commands plus single-key tool shortcuts for the default toolbar (`crates/tools/src/catalog.rs`), a shortcut editor with chords, and saved sets. Cmd/Ctrl+Alt+L (`ui.newLayer`) opens Layer Options for a new layer, as an Alt-click on the Layers panel's New Layer button does, and Cmd/Ctrl+L still adds a layer without the dialog. F8 (`ui.symbolOptions`) opens Symbol Options for a new symbol made from the selection, as the Symbols panel's New Symbol button does. Not yet diffed item by item @@ -308,6 +306,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Pathfinder panel on one group selected alone; a greyed-out button says what it needs | partial | #1450; the group's members are combined; one plain path selected alone stays disabled (the public documentation doesn't say what the operations do to a single path) | | Pathfinder Divide: an open cutting line splits a filled path | done | #1307; straight, crossed, bent and curved cutters, holes and frontmost appearance regression-tested; native automation: independent piece movement, one Undo/Redo, saved-document round trip and window capture; existing bounded-map fallback remains | | Pathfinder panel › Pathfinder Options…: Precision, Remove Redundant Points, Divide and Outline Will Remove Unpainted Artwork | done | #3426; `object.pathfinder.options`, kept in the preferences; defaults (0.01 pt, both off) keep the earlier results; [spec](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html) | +| Cmd/Ctrl+4 repeats the last successful Shape Mode or Pathfinder operation on the selection | done | Direct `object.pathfinder.*` commands set history too; Trap, compound-shape edits and live effects do not. Repeat uses current Pathfinder Options; [key spec](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), [menu spec](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html) | | Pathfinder panel: compound shapes (Make, Release and Expand Compound Shape in the panel menu, Alt-click a Shape Mode, a Shape Mode for selected members, the Expand button) | partial | #4522; `object.compoundShape.make`/`setMode`/`release`/`expand`; members stay editable, the area draws, exports and saves; the button of the members' shared mode is lit; [spec](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/create-compound-shapes-with-pathfinder.html); missing: blends, envelopes and warps as members, question marks for mixed modes, hit-testing by the area | | Canvas context menu | done | Layers rows, panels and type have none (gap) | | SVG Interactivity panel: JavaScript for each object's events and the document's linked JavaScript files, written to SVG and read back as text | done | `svgInteractivity.*`, `ui.javascriptFilesDialog` | From 71f566c6aa9a0872c22d8622eb981d0251fe0d9e Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 23:52:26 +0700 Subject: [PATCH 051/227] Docs: keep the Knife entry to the documented behaviour --- docs/target-app-parity.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 5b73ff4ea2..c34242da1d 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -676,7 +676,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur While a spiral is dragged out, Alt adds or removes whole winds of four segments and Ctrl/Cmd changes the decay. The spiral's inner end keeps the distance from the center it had on the first modified drag event, while the outer end follows the pointer. The [default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) (archived copy) list Alt-drag to add or subtract winds and Ctrl-drag to change the decay rate; [Draw spirals](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-spirals.html) defines four segments per full wind. Rounding the fitted count to whole winds from the count on the first Alt-only drag event, the held inner radius, the ranges (2…1000 segments, 5…99.99 % decay), Ctrl/Cmd taking precedence when both are held, and the new values staying as Spiral tool options are our own rules. Switching back to Alt uses the current count as its new base while keeping the held inner end. - **Cutting:** Eraser, Scissors, Knife, Mirror & Cut, Line Cut and Rectangle Cut (real geometry, compound paths keep their holes). While Alt is held, the Scissors tool works as the Add Anchor Point tool ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): a click on a segment adds an anchor point without cutting (`path.insertAnchor`), and the pointer shows the Add Anchor Point cursor. When Alt is let go, a click cuts again. - Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. The press-only timing, the straight cut after Alt is let go and the steps from the horizontal and vertical were observed in the reference app; sending no command for a line taken back to its press point and reading Shift on each move are our own rules. + Alt-drag with the Knife cuts in a straight line, and Shift+Alt-drag cuts at 45° or 90°, as [Cut objects using the Knife and Scissors tools](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/cut-objects.html) and [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) describe. Alt counts only when held at the press; the dashed line runs from the press point to the pointer, stays straight after Alt is let go, and release sends `path.knife` with those two points. Alt pressed after the press leaves the cut freehand. Shift+Alt keeps the endpoint at 45° steps from the horizontal and vertical, whatever the Constrain Angle. Eraser Tool Options has Angle and Roundness besides Size, as [Erase paths using the Eraser tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/erase-paths-using-eraser-tool.html) describes: the Eraser's tip is an ellipse Size across, its long axis at Angle and its short axis Roundness percent of the long one, and a drag with a tip that is not round shows the outline of the area it erases (`path.eraseRegion` `angle` and `roundness`). - **Transform:** Rotate, Reflect, Scale, Shear (click or Alt-click snaps the reference point to anchors and centres; Alt-click opens the tool's dialog, and a drag with Alt down at the release, from the press or pressed mid-drag, transforms a copy), Reshape, Free Transform (free and perspective distort and shear, switched by the keys held during a handle drag). Align, Distribute, Distribute Spacing, Reflect and Shear return an error for any `horizontal`, `vertical`, `to`, `axis`, `bounds` or `spacing` value they don't take, listing the choices, and Align returns one when a call gives neither `horizontal` nor `vertical`; nothing moves and no undo step is recorded. Align and Distribute act on the anchor points selected with Direct Selection: the points of one path align to each other, not to the artboard, and Distribute spaces them (#1641, fixes #1636; aligning to a key anchor is still missing). From 7d97c633b7ea123a0771880ced4ff65e3a610a0b Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 27 Oct 2026 17:46:04 -0700 Subject: [PATCH 052/227] Pencil and Blob Brush: Alt smooths with the Smooth tool's Fidelity When Alt switches the Pencil (with Alt key toggles to Smooth Tool on) or the Blob Brush to the Smooth tool, the drag sent the drawing tool's own Fidelity (1.5 by default) to path.smoothRegion. The Smooth tool sends its own Fidelity (2.5 by default, set in Smooth Tool Options). Both tools now smooth with the Smooth tool's Fidelity. The engine gives them the stored Smooth Fidelity when it makes the tool, and again when Smooth Tool Options changes while one of them is active. Each tool's own Fidelity still sets how its strokes are fitted. --- crates/engine/src/tests/toolsettings.rs | 35 +++++++++++++++++++++++++ crates/engine/src/tooling.rs | 9 ++++++- crates/tools/src/draw2/gesture.rs | 13 +++++++-- crates/tools/src/draw2/gesture/tests.rs | 33 ++++++++++++++++++++++- 4 files changed, 86 insertions(+), 4 deletions(-) diff --git a/crates/engine/src/tests/toolsettings.rs b/crates/engine/src/tests/toolsettings.rs index 7584aa9cbd..3f7d1513bf 100644 --- a/crates/engine/src/tests/toolsettings.rs +++ b/crates/engine/src/tests/toolsettings.rs @@ -96,3 +96,38 @@ fn options_are_saved_with_the_preferences() { t.execute("prefs.reset", &json!({})).unwrap(); assert_eq!(t.prefs.tool_settings["polygon"]["sides"], json!(9)); } + +/// The Fidelity an Alt smoothing drag uses on a selected path. +fn alt_smooth_fidelity(s: &mut Session) -> Option { + use vectorcraft_tools::{Action, Mods, PointerEvent, PointerKind}; + let mods = Mods { alt: true, ..Default::default() }; + let mut last = vec![]; + for (kind, x, y) in [(PointerKind::Down, 50.0, 150.0), (PointerKind::Drag, 150.0, 150.0), (PointerKind::Up, 250.0, 160.0)] { + let ev = PointerEvent { mods, ..PointerEvent::new(kind, x, y) }; + last = s.with_tool_cx(ViewInfo::default(), |t, cx| t.pointer(cx, &ev)); + } + last.iter().find_map(|a| match a { + Action::Exec(c, v) if c == "path.smoothRegion" => v["fidelity"].as_f64(), + _ => None, + }) +} + +/// Alt switches Pencil and Blob Brush to Smooth, using Smooth Tool Options' stored Fidelity. +#[test] +fn alt_smoothing_takes_the_smooth_tools_fidelity() { + for id in ["pencil", "blobBrush"] { + let mut s = session(); + s.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 100, "height": 100})).unwrap(); + select(&mut s, "smooth"); + s.set_tool_option("fidelity", &json!(6)); + select(&mut s, id); + if id == "pencil" { + s.set_tool_option("altSmooth", &json!(true)); + } + s.set_tool_option("fidelity", &json!(3)); + assert_eq!(alt_smooth_fidelity(&mut s), Some(6.0), "{id}"); + s.set_tool_option_cmd(&json!({"tool": "smooth", "key": "fidelity", "value": 9})).unwrap(); + assert_eq!(alt_smooth_fidelity(&mut s), Some(9.0), "{id}"); + assert_eq!(s.tool_options()["fidelity"], json!(3.0), "{id}"); + } +} diff --git a/crates/engine/src/tooling.rs b/crates/engine/src/tooling.rs index 13a7c28623..6dbfb133d7 100644 --- a/crates/engine/src/tooling.rs +++ b/crates/engine/src/tooling.rs @@ -216,6 +216,12 @@ impl Session { } } } + // Alt switches the Pencil or Blob Brush to Smooth, using Smooth Tool Options' Fidelity. + if matches!(t.id(), "pencil" | "blobBrush") + && let Some(v) = prefs.tool_settings.get("smooth").and_then(|s| s.get("fidelity")) + { + t.set_option("smoothFidelity", v); + } } /// Store the persistent options of `t` in `prefs` (so they are saved with them too). @@ -623,7 +629,8 @@ impl Session { /// Set options of tool `id` (default: the active tool). Another tool's persistent options are /// stored for when it is chosen, and the active tool takes those it shares with it (the - /// Liquify tools' Global Brush Dimensions). Returns the tool's options. + /// Liquify tools' Global Brush Dimensions, the Smooth tool's Fidelity for the Pencil's and + /// Blob Brush's Alt smoothing). Returns the tool's options. pub fn set_tool_options(&mut self, id: Option<&str>, values: &Map) -> Value { let active = id.is_none_or(|id| id == self.tool.id()); self.tool_set_since_reset |= active; diff --git a/crates/tools/src/draw2/gesture.rs b/crates/tools/src/draw2/gesture.rs index eade2a524b..3082641370 100644 --- a/crates/tools/src/draw2/gesture.rs +++ b/crates/tools/src/draw2/gesture.rs @@ -34,6 +34,8 @@ const SMOOTH_RADIUS: f64 = 12.0; /// a fit's cost grows as its Fidelity shrinks (at 0.01 pt a long pen stroke lagged, #4565), and /// a preview within half a pixel of the stroke looks the same. The release fits it at its Fidelity. const PREVIEW_FIDELITY_PX: f64 = 0.5; +/// The Smooth tool's Fidelity until Smooth Tool Options sets another. +const SMOOTH_FIDELITY: f64 = 2.5; pub struct GestureTool { /// How many points the last preview of the stroke had ([`crate::previews_at`]); 0 when it was @@ -87,6 +89,9 @@ pub struct GestureTool { /// preview shows the points joined by straight segments and the release fits them (Pencil /// only, on by default). pub live_fit: bool, + /// The Smooth tool's Fidelity, used when Alt switches the Pencil or Blob Brush to Smooth. + /// The engine sets it from Smooth Tool Options (`smoothFidelity`). + smooth_fidelity: f64, /// Active drag is smoothing with the Pencil or the Blob Brush (Alt held). smoothing: bool, /// The pointer has moved from the press point, by any distance (a move too short to add a @@ -133,7 +138,7 @@ impl GestureTool { "join" => "join", _ => "pencil", }; - let fidelity = if id == "smooth" { 2.5 } else { 1.5 }; + let fidelity = if id == "smooth" { SMOOTH_FIDELITY } else { 1.5 }; Self { id, previewed: 0, @@ -157,6 +162,7 @@ impl GestureTool { alt_smooth: false, live_preview: true, live_fit: true, + smooth_fidelity: SMOOTH_FIDELITY, smoothing: false, moved: false, straight: false, @@ -383,7 +389,7 @@ impl GestureTool { if has_sel && pts.len() >= 2 { return vec![Action::Exec( "path.smoothRegion".into(), - json!({"points": points_json(pts), "radius": radius, "fidelity": self.fidelity}), + json!({"points": points_json(pts), "radius": radius, "fidelity": self.smooth_fidelity}), )]; } return vec![]; @@ -783,6 +789,9 @@ impl Tool for GestureTool { "altSmooth" => self.alt_smooth = v.as_bool().unwrap_or(self.alt_smooth), "livePreview" if self.id == "pencil" => self.live_preview = v.as_bool().unwrap_or(self.live_preview), "liveFit" if self.id == "pencil" => self.live_fit = v.as_bool().unwrap_or(self.live_fit), + "smoothFidelity" if matches!(self.id, "pencil" | "blobBrush") => { + self.smooth_fidelity = v.as_f64().unwrap_or(self.smooth_fidelity).clamp(super::min_fidelity("smooth"), 100.0) + } "keepSelected" => self.keep_selected = v.as_bool().unwrap_or(self.keep_selected), "mergeOnlySelection" => self.merge_only_selection = v.as_bool().unwrap_or(self.merge_only_selection), "editWithin" => self.edit_within = v.as_f64().unwrap_or(self.edit_within).clamp(0.0, 100.0), diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index 0b6da81f59..c511091b5a 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -420,7 +420,7 @@ fn blob_brush_alt_switches_to_the_smooth_tool() { let acts = drag_held(&mut t, &cx, &stroke, alt); assert!(acts[..acts.len() - 1].iter().all(|a| a.is_empty()), "{acts:?}"); let v = smoothed(&acts).unwrap_or_else(|| panic!("{acts:?}")); - assert_eq!(v, json!({"points": [[50.0, 150.0], [150.0, 150.0], [250.0, 160.0]], "radius": cx.tol(12.0), "fidelity": 1.5})); + assert_eq!(v, json!({"points": [[50.0, 150.0], [150.0, 150.0], [250.0, 160.0]], "radius": cx.tol(12.0), "fidelity": SMOOTH_FIDELITY})); // Mid-drag the cursor stays the Smooth tool's when Alt is let go, and the line is thin with // no length label. t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 50.0, 150.0).with_mods(alt)); @@ -872,6 +872,37 @@ fn pencil_alt_smooths_within_the_smooth_tools_radius() { } } +/// An Alt smoothing drag uses the Smooth tool's Fidelity for both Pencil and Blob Brush. +#[test] +fn alt_smoothing_uses_the_smooth_tools_fidelity() { + let (d, id) = doc_with_rect(); + let mut s = Selection::default(); + s.set([id]); + let p = paint(); + let mut cx = cx(&d, &s, &p); + cx.smart_guides = false; + let pts = [(50.0, 150.0), (150.0, 150.0), (250.0, 160.0)]; + let fidelity = |acts: &[Vec]| match acts.last().and_then(|a| a.first()) { + Some(Action::Exec(c, v)) if c == "path.smoothRegion" => v["fidelity"].as_f64().unwrap(), + a => panic!("expected path.smoothRegion, got: {a:?}"), + }; + let alt = Mods { alt: true, ..Default::default() }; + let want = fidelity(&drag(&mut GestureTool::new("smooth"), &cx, &pts, Mods::default())); + for id in ["pencil", "blobBrush"] { + let mut t = GestureTool::new(id); + if id == "pencil" { + t.set_option("altSmooth", &json!(true)); + } + t.set_option("fidelity", &json!(10.0)); + assert_eq!(fidelity(&drag_held(&mut t, &cx, &pts, alt)), want, "{id}"); + t.set_option("smoothFidelity", &json!(7.5)); + assert_eq!(fidelity(&drag_held(&mut t, &cx, &pts, alt)), 7.5, "{id}"); + // Drawing keeps the tool's own Fidelity; Smooth's setting stays out of its options. + assert_eq!(t.options()["fidelity"], json!(10.0), "{id}"); + assert!(t.options().get("smoothFidelity").is_none(), "{id}"); + } +} + /// #3799: Alt's line starts and ends on Smart Guides as a stroke does, and pressed on an end of /// a selected open path it continues the path from that end to the pointer. #[test] From b4899e665d1e1450e3cd3a1be4506b3e0ef5fcb2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 09:06:33 -0700 Subject: [PATCH 053/227] Pathfinder: batch steps set the operation Cmd+4 repeats A successful command.batch now records its last Unite, Intersect or other Pathfinder step as the operation Repeat Pathfinder runs, so playing an action from the Actions panel updates it. A batch that fails and rolls back leaves the previous operation in place. action.batch, which runs an action over other files or data sets, does not set it. --- crates/ui-egui/src/app/commands.rs | 13 +++++- crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/panels/pathfinder.rs | 60 +++++++++++++++++++++++++ docs/mcp.md | 2 +- docs/target-app-parity.md | 2 +- docs/ui-parity.md | 2 +- 6 files changed, 75 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index 9273f9683d..2cbbf3eb13 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -1,6 +1,16 @@ use super::fonts::MAX_RECENT_FONTS; use super::{Value, VectorcraftApp, dialogs, fileio, io, menus, panels, picks, toolbar}; +/// The last repeatable Pathfinder operation completed by a command or atomic batch. +fn completed_pathfinder_operation<'a>(id: &'a str, params: &'a Value) -> Option<&'a str> { + let tracked = |id: &'a str| id.strip_prefix("object.pathfinder.").filter(|op| panels::pathfinder::operation_label(op).is_some()); + if id == "command.batch" { + params.get("commands")?.as_array()?.iter().rev().find_map(|step| step.get("command").and_then(Value::as_str).and_then(tracked)) + } else { + tracked(id) + } +} + impl VectorcraftApp { /// Run a UI or engine command by id. The single entry point for every frontend path. pub fn run(&mut self, id: &str, params: Value) -> Result { @@ -89,8 +99,7 @@ impl VectorcraftApp { crate::ime::note_application_edit(self, &ctx, ime_view, ime_target, ime_before); } if r.is_ok() - && let Some(op) = id.strip_prefix("object.pathfinder.") - && panels::pathfinder::operation_label(op).is_some() + && let Some(op) = completed_pathfinder_operation(id, ¶ms) { self.last_pathfinder = Some(op.to_string()); } diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 8c62a3f110..5a99c4ca6b 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -579,7 +579,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "pathfinder.repeat", "Repeat Pathfinder", "Cmd+4", - "{} repeat the last successful Shape Mode or Pathfinder operation on the selection with the current Pathfinder Options; an error until one has run", + "{} repeat the last successful Pathfinder panel operation, direct object.pathfinder.* command or command.batch step on the selection with current Pathfinder Options; an error until one has run", ), ( "file.export.pdf", diff --git a/crates/ui-egui/src/panels/pathfinder.rs b/crates/ui-egui/src/panels/pathfinder.rs index 9533938472..34f2b58f3a 100644 --- a/crates/ui-egui/src/panels/pathfinder.rs +++ b/crates/ui-egui/src/panels/pathfinder.rs @@ -474,6 +474,66 @@ mod tests { assert_eq!(app.last_pathfinder.as_deref(), Some("intersect")); } + /// A successful batch records its last repeatable Pathfinder step. + #[test] + fn batch_pathfinder_step_becomes_the_one_repeated() { + let mut app = two_squares(); + click_button(&mut app, "Intersect"); + select_two_squares(&mut app, 110.0); + app.run( + "command.batch", + json!({"commands": [ + {"command": "object.pathfinder.unite", "params": {}}, + {"command": "select.none", "params": {}} + ]}), + ) + .unwrap(); + assert_eq!(app.last_pathfinder.as_deref(), Some("unite")); + select_two_squares(&mut app, 210.0); + press_cmd_4(&mut app); + assert_eq!(objects(&app).last(), Some(&("path", [210.0, 10.0, 290.0, 90.0]))); + } + + /// A batch rollback leaves the previous Pathfinder operation available. + #[test] + fn failed_batch_pathfinder_step_keeps_history() { + let mut app = two_squares(); + click_button(&mut app, "Unite"); + select_two_squares(&mut app, 110.0); + let before = objects(&app); + assert!( + app.run( + "command.batch", + json!({"commands": [ + {"command": "object.pathfinder.intersect", "params": {}}, + {"command": "unknown.command", "params": {}} + ]}) + ) + .is_err() + ); + assert_eq!(app.last_pathfinder.as_deref(), Some("unite")); + assert_eq!(objects(&app), before); + press_cmd_4(&mut app); + assert_eq!(objects(&app).last(), Some(&("path", [110.0, 10.0, 190.0, 90.0]))); + } + + /// Playing an action records its Pathfinder step for the repeat shortcut. + #[test] + fn actions_panel_play_records_pathfinder_step() { + let mut app = two_squares(); + click_button(&mut app, "Intersect"); + app.ui.action_sets[0] + .actions + .push(crate::panels::actions::Action { name: "Unite".into(), steps: vec![("object.pathfinder.unite".into(), json!({}))] }); + let idx = app.ui.action_sets[0].actions.len() - 1; + select_two_squares(&mut app, 110.0); + crate::panels::actions::play(&mut app, 0, idx).unwrap(); + assert_eq!(app.last_pathfinder.as_deref(), Some("unite")); + select_two_squares(&mut app, 210.0); + press_cmd_4(&mut app); + assert_eq!(objects(&app).last(), Some(&("path", [210.0, 10.0, 290.0, 90.0]))); + } + /// A rejected operation leaves the prior successful operation available to repeat. #[test] fn failed_operation_keeps_history() { diff --git a/docs/mcp.md b/docs/mcp.md index 558154f70a..17627ddead 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -431,7 +431,7 @@ objects' fills or strokes differ (`fillMixed` / `strokeMixed`, drawn as a "?" pr | `export` | `{path?, format?, scale?, artboard?, range?, selection?, outlineText?, options?}` | `svg`, `svgz`, `pdf`, `ai` (the PDF-compatible `.ai` that Save writes, which carries the document when every artboard is written in order), `eps`, `dxf`, `emf`, `wmf`, `png`, `jpg`, `webp`, `gif`, `png8` (an indexed `.png`), `tiff`, `bmp`, `tga`, `psd` (layered), `txt` (the document's text), `vectorcraft` or `template` (a native template). The tool's `format` enum and `document.formats` list them, generated from the engine's format table. When `format` is omitted, it comes from the path's extension. PDF and `.ai` write one page per artboard: all of them, or `artboard` (0-based) / `range` (`"1-3, 5"`, 1-based). SVG and SVGZ write one file per chosen artboard. EPS writes one file of the visible art; with `artboard`, `range`, `options.artboards` or `options: {"useArtboards": true}` it writes one file per chosen artboard, after a central file of the visible art when there are two or more, and `useArtboards: false` keeps the one file. Rasters, DXF, EMF and WMF write one artboard, or one file per chosen artboard with `options: {"useArtboards": true}`. Rasters also take `options: {"rect": [x, y, width, height]}` (page points, y down): that area of the page at the given `ppi`/`scale`, without an artboard and without changing the document; it is refused with `artboard`, `artboards`, `range` or `useArtboards`, with a non-positive or non-finite size, and for non-raster formats. `options` carries more format options (e.g. `{"quality": 80}` for JPEG). `selection: true` exports the selected objects cropped to their bounds (the reply adds their `bounds`, and reports `format` and the encoder's `warnings` as a whole-document export does); `outlineText: true` writes SVG text as paths. Template layers are left out, live effects are kept, and exporting `vectorcraft` never changes the document's path. Without `path` the bytes come back as `dataBase64`. Both backends run the same `document.export` call. | | `add_text` | `{text, x?, y?, width?, height?, fit?, fitMinPercent?, path?, mode?, pathEffect?, size?, font?, color?, justify?, vertical?}` | Point type at (x, y) (`justify`: `left`, `center` or `right` starts, centres or ends each line on x); area type with `width`/`height` (`fit`: `none`, `autoHeight`, `shrinkText`, as `text.areaOptions`); or `path` + `mode` (`area`/`onPath`) to flow text in or along a path, with `pathEffect` (`rainbow`, `skew`, `3dRibbon`, `stairStep`, `gravity`); `justify` (also `auto`, `justifyAll`) aligns the paragraphs of every kind, as `text.setStyle` does later. `vertical: true` uses the existing vertical writing mode for every kind (default `false`, horizontal). Returns `{id}`, with `overflow: true` when the text doesn't fit its frame or path. | | `apply_effect` | `{effect?, params?, ids?}` | Appends a live effect. Without `effect`, returns the effect catalogue with parameters and defaults. | -| `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). In remote desktop mode, `run_command` and `invoke_menu` can both call `pathfinder.repeat` with `{}`. Every successful Shape Mode or Pathfinder operation, including direct `object.pathfinder.*` commands, sets its history. Repeat applies it to the current selection using current Pathfinder Options. Trap, compound-shape edits and live effects do not set history. With no history it returns "no Pathfinder operation applied yet". | +| `pathfinder` | `{operation, ids?}` | `unite`, `minusFront`, `intersect`, `exclude`, `divide`, `trim`, `merge`, `crop`, `outline`, `minusBack`. For a live version, apply the `pathfinder.*` effect to a group (`effect.apply` groups several loose selected objects first). In remote desktop mode, `run_command` and `invoke_menu` can both call `pathfinder.repeat` with `{}`. Successful panel operations, direct `object.pathfinder.*` commands, and `command.batch` steps (including Actions panel playback) set its history. Repeat applies it to the current selection using current Pathfinder Options. Trap, compound-shape edits, live effects and `action.batch` do not set history. With no history it returns "no Pathfinder operation applied yet". | | `transform` | `{ids?, dx?, dy?, rotate?, scale?, scaleX?, scaleY?, reflect?, shear?, origin?, copy?}` | Runs move, rotate, scale, reflect, shear in that order. With `copy`, the first step duplicates. | | `create_graph` | `{type?, x, y, width, height, csv? \| series?, categories?, rows?}` | The nine Illustrator graph types: column, stacked column, bar, stacked bar, line, area, scatter, pie and radar. An empty CSV cell or a `null` in `rows` is a blank value; a number in straight quotes is a label. Edit later with `graph.setData` / `graph.setType` via `run_command`. `graph.column {design, columnType: vertical\|uniform\|repeating\|sliding, each, fractions: chop\|scale}` draws the columns or bars of the series picked with Group Selection (or `seriesIndexes`, or all of them) with a graph design saved by `graph.design`; with no `design` it returns the series' current design and options. Type in the design that holds a `%` followed by two digits shows each column's value, with at least the first digit's places before the decimal point and the second digit's places after it. | | `text_wrap` | `{ids?, offset?, invert?, release?}` | Area type below the objects (same layer) flows around them. | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index c4653b53d0..ca235f91a3 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -794,7 +794,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Extrude & Bevel, Inflate and Rotate (Effect › 3D and Materials): live effects in the `three-d` crate with depth, twist, taper, solid or hollow caps, five original bevel shapes (width, height, repeat, spacing, inside, both sides), Inflate's volume, both sides, twist, taper and cap, Rotate's turned fills and strokes, Position presets, the rotation and light gizmos, SVG/PDF vector output and Expand Appearance; one 3D effect per object; covered by geometry, effect, canvas-versus-export, command and dialog tests ([three-d.md](three-d.md)). - Initial live Revolve (#605, #846): a portable geometry and shading crate (`three-d`), editable path and compound profiles, compact options with artboard rotation and light gizmos, SVG/PDF vector output and Expand Appearance that can trim covered faces. Open ends have continuous caps by default, shading is smooth with one to ten colored lights, and intersecting surfaces' visibility is approximate ([revolve.md](revolve.md)). - Live effects with previewing dialogs: Distort & Transform, Path, Convert to Shape, 15 Warp styles, Round Corners, Scribble, Effect → Pathfinder (all 10 operations, live on groups; several loose objects are grouped first, in one undo step), Color Adjustments (Brightness/Contrast, Curves, Levels, Hue/Saturation, Shift to Color, Temperature/Tint, on vectors, live type and embedded images), and raster drop shadow, glows and feather. SVG and PDF export keep live effects (geometry baked; SVG raster effects as filters). Zig Zag spaces its ridges evenly along each segment, so lines and curves get a regular wave in Corner and Smooth (#1558). Warp › Arc (the effect and Envelope › Make with Warp) bends in the object's real proportions: a circular arc with concentric edges and no fold-over at 100%, so Arc on art that isn't square draws differently from before (#1581, fixes #1578). `effect.apply` and `effect.setParams` give an error for a misspelt or wrongly typed effect parameter instead of running the effect with its default (#1623, #1592). Roughen with Smooth keeps turn-backs smooth instead of making cusps that draw as spikes (#1646, #1643). Scribble draws one zig-zag per region, with no lines across holes and notches; convex shapes are unchanged (#1651, #1648). On the canvas, in Expand Appearance and in exports, Effect → Pathfinder uses the glyph outlines of type in the group, and results painted like the type keep its opacity and blend mode. - - Cmd/Ctrl+4 (`pathfinder.repeat`) repeats the last successful Shape Mode or Pathfinder operation, including direct `object.pathfinder.*` commands, on the current selection; the panel menu names it. Trap, compound-shape edits and live effects do not set history. Public references: [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), [Pathfinder panel overview](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html). + - Cmd/Ctrl+4 (`pathfinder.repeat`) repeats the last successful Pathfinder panel operation, direct `object.pathfinder.*` command or `command.batch` step (including Actions playback) on the current selection; the panel menu names it. `action.batch`, Trap, compound-shape edits and live effects do not set history. Public references: [Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), [Pathfinder panel overview](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html). - Pathfinder Options ([Pathfinder panel overview](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html)): the panel menu's Pathfinder Options… sets Precision (0.001–10 pt: results refit to within it, thinner pieces dropped), Remove Redundant Points and Divide and Outline Will Remove Unpainted Artwork (`object.pathfinder.options`, kept in the preferences) for every Shape Mode and Pathfinder operation; the defaults keep the earlier output (`pathops` `precision_drops_pieces_thinner_than_it`, engine `tests_pathops` Pathfinder Options tests, `panels::pathfinder` dialog test). - Pathfinder › Trap ([trapping](https://helpx.adobe.com/illustrator/using/trapping.html), [Pathfinder panel](https://helpx.adobe.com/illustrator/using/pathfinder-panel-overview.html)): the Pathfinder panel menu's Trap… (`object.pathfinder.trap`) and Effect › Pathfinder › Trap… (`pathfinder.trap`, live on groups) add, where two objects' visible areas of different solid colours meet, a strip of the darker one's area along the edge, filled with the lighter colour at the Tint Reduction percentage and set to overprint (Reverse Traps: the darker colour spreads instead, but not a rich black); Thickness 0.01–5000 pt across vertical edges, Height/Width scales it across horizontal ones, Traps with Process Color paints a swatch colour's trap with its CMYK equivalent; the effect also has Precision and Remove Redundant Points. The panel's Trap is one undo step and groups the traps above the topmost selected object, selected; with no adjoining edges of different colours it says so and changes nothing. Tests: `crates/pathops/src/trap.rs`, `crates/effects/src/trap.rs`, `group::tests::trap_effect_adds_an_overprinting_strip_above_the_members`, `crates/engine/src/tests/trap.rs`, `panels::pathfinder::tests::trap_opens_its_options_and_ok_traps_the_selection`. - Compound shapes ([Create compound shapes with Pathfinder](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/create-compound-shapes-with-pathfinder.html), [Pathfinder panel overview](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html)): the Pathfinder panel menu's Make Compound Shape (every member in Add) and Alt-clicking a Shape Mode (every member in that mode) make the two or more selected paths, compound paths, groups, compound shapes or type a live compound shape (`object.compoundShape.make`): a group whose members each keep a shape mode and stay editable, drawn, printed and exported (SVG, PDF and the rest through the baked document) as the area the modes make from the backmost member up, open paths closed, painted with its own appearance, taken from the topmost member not subtracting. With members selected (Direct Selection, Layers panel, isolation mode) a Shape Mode button sets theirs (`object.compoundShape.setMode`) and is lit for the mode they share; paint given to a member goes to the compound shape. Release Compound Shape gives the members back as they were (`object.compoundShape.release`); Expand Compound Shape and the panel's Expand button turn it into the path or compound path of its area (`object.compoundShape.expand`). Shape Modes and Pathfinders take a compound shape as its area. Saved files keep it (`compound_shape`, `shape_mode`; an unknown mode reads as Add). Tests: `crates/engine/src/tests/compound_shape.rs`, `group::tests::compound_shapes_draw_the_area_their_shape_modes_make`, `group::tests::nested_compound_shapes_take_part_as_their_area`, `panels::pathfinder::tests::compound_shape_items_follow_the_selection`, the `CompoundShape` op of the property-test strategies. Not yet: blends, envelopes and warps as members, the question marks on mixed member modes, hit-testing by the area (a click hits the members). diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 8b79849c1e..4f3ac445e0 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -306,7 +306,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Pathfinder panel on one group selected alone; a greyed-out button says what it needs | partial | #1450; the group's members are combined; one plain path selected alone stays disabled (the public documentation doesn't say what the operations do to a single path) | | Pathfinder Divide: an open cutting line splits a filled path | done | #1307; straight, crossed, bent and curved cutters, holes and frontmost appearance regression-tested; native automation: independent piece movement, one Undo/Redo, saved-document round trip and window capture; existing bounded-map fallback remains | | Pathfinder panel › Pathfinder Options…: Precision, Remove Redundant Points, Divide and Outline Will Remove Unpainted Artwork | done | #3426; `object.pathfinder.options`, kept in the preferences; defaults (0.01 pt, both off) keep the earlier results; [spec](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html) | -| Cmd/Ctrl+4 repeats the last successful Shape Mode or Pathfinder operation on the selection | done | Direct `object.pathfinder.*` commands set history too; Trap, compound-shape edits and live effects do not. Repeat uses current Pathfinder Options; [key spec](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), [menu spec](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html) | +| Cmd/Ctrl+4 repeats the last successful Shape Mode or Pathfinder operation on the selection | done | Panel operations, direct `object.pathfinder.*` commands and `command.batch` steps (Actions playback) set history; `action.batch`, Trap, compound-shape edits and live effects do not. Repeat uses current Pathfinder Options; [key spec](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), [menu spec](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/pathfinder-panel-overview.html) | | Pathfinder panel: compound shapes (Make, Release and Expand Compound Shape in the panel menu, Alt-click a Shape Mode, a Shape Mode for selected members, the Expand button) | partial | #4522; `object.compoundShape.make`/`setMode`/`release`/`expand`; members stay editable, the area draws, exports and saves; the button of the members' shared mode is lit; [spec](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/create-compound-shapes-with-pathfinder.html); missing: blends, envelopes and warps as members, question marks for mixed modes, hit-testing by the area | | Canvas context menu | done | Layers rows, panels and type have none (gap) | | SVG Interactivity panel: JavaScript for each object's events and the document's linked JavaScript files, written to SVG and read back as text | done | `svgInteractivity.*`, `ui.javascriptFilesDialog` | From 530605d4fc86c9cbb9faaf56c68e23b0fc24e58c Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 16:23:22 +0300 Subject: [PATCH 054/227] fix(ai-import): keep All Caps and Small Caps on type from the text document Character attribute 12 of the editing data's text document is the case (1 Small Caps, 2 All Caps). The reader skipped it, so type set in All Caps came in as typed, in lower or mixed case where the page draws capitals. Map it onto CharStyle::all_caps and CharStyle::small_caps. --- crates/eps/src/import/ate.rs | 7 +++++++ crates/eps/src/import/tests_native.rs | 24 ++++++++++++++++++++++++ docs/file-format-parity.md | 3 ++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/crates/eps/src/import/ate.rs b/crates/eps/src/import/ate.rs index 7c90b15aa2..21198305dd 100644 --- a/crates/eps/src/import/ate.rs +++ b/crates/eps/src/import/ate.rs @@ -296,6 +296,8 @@ struct Style { fill: Option, stroke: Option, stroke_width: f64, + /// Key 12, the case: 1 Small Caps, 2 All Caps. + caps: u8, } /// The text document of an editing copy. @@ -476,6 +478,7 @@ impl Texts { fill: if on("56") { Some(pick("53").and_then(paint).unwrap_or(Color::BLACK)) } else { None }, stroke: if matches!(pick("57"), Some(Val::Bool(true))) { pick("54").and_then(paint) } else { None }, stroke_width: num("63").filter(|v| *v >= 0.0 && *v < 1e4).unwrap_or(1.0), + caps: num("12").filter(|v| *v == 1.0 || *v == 2.0).map_or(0, |v| v as u8), } } } @@ -824,6 +827,9 @@ fn char_style(s: &Style, scale: f64, leading: Option) -> CharStyle { fill: s.fill.map_or(Paint::None, Paint::solid), stroke: s.stroke.map_or(Paint::None, Paint::solid), stroke_width: if s.stroke.is_some() { s.stroke_width * scale } else { 0.0 }, + all_caps: s.caps == 2, + // At the default Small Caps size of Document Setup: the file's own isn't read. + small_caps: (s.caps == 1).then(|| vectorcraft_doc::DocSetup::default().small_caps_size), ..CharStyle::default() } } @@ -1006,6 +1012,7 @@ mod tests { fill: Some(Color::BLACK), stroke: None, stroke_width: 1.0, + caps: 0, }, )], } diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index 200bf04049..db7960c9f0 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -685,6 +685,30 @@ fn type_on_a_hidden_layer_comes_from_the_text_document() { assert!(!r.warnings.iter().any(|w| w.contains("couldn't be read")), "{:?}", r.warnings); } +#[test] +fn type_from_the_text_document_keeps_its_case_setting() { + // Key 12 of a character style is its case: 1 Small Caps, 2 All Caps. The characters stay as + // typed; the setting shows them as capitals. + let doc = text_document(&[ + ("hon. guest\r", 0, (8200.0, 8180.0), (0.0, 0.0), 0.0), + ("Book Now\r", 0, (8200.0, 8170.0), (0.0, 0.0), 0.0), + ("plain\r", 0, (8200.0, 8160.0), (0.0, 0.0), 0.0), + ]) + .replacen("/1 14.0 /53", "/1 14.0 /12 2 /53", 1) + .replacen("/1 14.0 /53", "/1 14.0 /12 1 /53", 1); + let spare = text_object(0) + &text_object(1) + &text_object(2); + let art = native_with_text(&(layer("Back", true, &square(10, 10)) + &layer("Spare", false, &spare)), &doc); + let r = import(&eps(&page_square(10, 10), &art)).unwrap(); + let texts = text_of(&r.document.layers[1]); + assert_eq!(texts.len(), 3, "{:?}", r.warnings); + let case = |i: usize| texts[i].runs.iter().map(|r| (r.style.all_caps, r.style.small_caps)).collect::>(); + assert_eq!(texts[0].plain_text(), "hon. guest"); + assert_eq!(case(0), [(true, None)]); + assert_eq!(texts[1].plain_text(), "Book Now"); + assert_eq!(case(1), [(false, Some(r.document.setup.small_caps_size))]); + assert_eq!(case(2), [(false, None)]); +} + #[test] fn type_with_a_frame_it_cant_read_is_left_out_with_a_note() { // A story whose frame is of a kind this doesn't know isn't guessed at. diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 45eb9f834d..6961c1983c 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: placed files at their box's corner where that draws as the page) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: All Caps and Small Caps type from the editing data keeps its case setting) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai` import: type read from the editing data's text document keeps its case setting (character attribute 12: 1 Small Caps, at Document Setup's default size, 2 All Caps); it came in as typed, so a heading set in All Caps showed in lower or mixed case where the page draws capitals. Test `import::tests_native::type_from_the_text_document_keeps_its_case_setting`; checked locally against a user's files; scores unchanged | | 2026-10-30 | minor | PDF import: a patch or triangle mesh shading of up to 16,384 patches comes in as gradient meshes (it was 4,096; Illustrator writes up to 14,355 in files users sent), and a stroke painted with one (how Illustrator writes a freeform gradient on a stroke) is the meshes clipped to the area the stroke paints, with its width, caps, joins and dashes; both came in as a flat grey. In two files of a user's set, the formerly grey area now matches a reference rendering in 99% of its pixels. Own-fixture tests in `tests::import_fidelity`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: gradient meshes the reader marked unread, which made the whole file come in as its page or PDF part, are read: a mesh starts grey and its `/CS` is written only where it changes, before the corner it applies to (within a patch too), so each corner takes the space last set before it; named colours (`[c m y k /DeviceCMYK (name) /Process]` or `/Spot`) paint at the corner's tint and `/NChannel` inks overprint at theirs; meshes up to 128 patches a side and 16,384 patches are read (files users sent had up to 97 × 72). Ten of eleven such files from a user's set now open from their layers; meshes with handle weights other than 1 still don't. Own-fixture tests in `import::ai::mesh`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file is put where its matrix takes the canvas point of art space's origin, and, when the layers then don't draw as the page, at the corner of the box it is written with, which many files use; six files of a user's set whose photos landed off their artboards now open from their layers. Own-fixture test in `import::tests_native`; scores unchanged | From 75958ce7dafd3888ac4edd9d77c7bdbb95e48f68 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 18:17:52 +0300 Subject: [PATCH 055/227] fix(ai-import): weigh unseen text again at the placed files' other placement prune_unseen ran before the retry that moves placed files to their box's corner, and that retry cloned the pruned layers: text an image covered only at its first placement was already gone, so the file came in without it or as its PDF part. Clone the layers before pruning and prune each placement on its own. --- crates/eps/src/import/native/build.rs | 23 +++++++----- crates/eps/src/import/tests_native.rs | 51 +++++++++++++++++++++++++++ docs/file-format-parity.md | 3 +- 3 files changed, 68 insertions(+), 9 deletions(-) diff --git a/crates/eps/src/import/native/build.rs b/crates/eps/src/import/native/build.rs index 7064ea133e..687ea4a9d1 100644 --- a/crates/eps/src/import/native/build.rs +++ b/crates/eps/src/import/native/build.rs @@ -219,19 +219,26 @@ pub(super) fn build_from( Some(frame) => { let mut view = PageView::new(&frame); view.restyled(&restyled, frame.rect); + // The placed files' other placement starts from the layers as read: which text the page + // doesn't draw is weighed again with the images there, since an image that covered a + // text object at the first placement may not cover it at the other. + let other = elsewhere(&doc, &placed_elsewhere); let unseen = prune_unseen(&frame, &mut view, &mut doc); - if unseen > 0 { - notes.push(format!("{unseen} {UNSEEN_TEXT}")); - } + let unseen_note = |n: usize| (n > 0).then(|| format!("{n} {UNSEEN_TEXT}")); match compare(&frame, &mut view, &doc) { - Ok(note) => notes.extend(note), + Ok(note) => notes.extend(unseen_note(unseen).into_iter().chain(note)), // Placed files at the other point their data gives, where that draws as the page. - Err(why) => match elsewhere(&doc, &placed_elsewhere).map(|other| (compare(&frame, &mut view, &other), other)) { - Some((Ok(note), other)) => { + Err(why) => match other.map(|mut other| { + let unseen = prune_unseen(&frame, &mut view, &mut other); + (compare(&frame, &mut view, &other), other, unseen) + }) { + Some((Ok(note), other, unseen)) => { doc = other; - notes.extend(note); + notes.extend(unseen_note(unseen).into_iter().chain(note)); + } + _ if trust => { + notes.extend(unseen_note(unseen).into_iter().chain([format!("{why}: they come from its editing data all the same")])) } - _ if trust => notes.push(format!("{why}: they come from its editing data all the same")), _ => return Err(why), }, } diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index db7960c9f0..bb1b867ca2 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -1628,3 +1628,54 @@ fn a_placed_file_at_its_boxs_corner_matches_the_page() { let b = image.geometric_bounds().unwrap(); assert!([b.x0 - 30.0, b.y0 - 30.0, b.x1 - 70.0, b.y1 - 70.0].iter().all(|v| v.abs() < 0.01), "on the page's square: {b:?}"); } + +#[test] +fn text_a_placed_file_covers_only_at_its_first_placement_is_kept() { + const OPAQUE: &str = ""; + // An opaque black 2 × 2 preview of a file whose box corner the matrix takes to (30, 30)–(70, + // 70), as the page draws it. The template box's canvas point puts it 10 to the left instead, + // over the 8 pt text object "Hi" at (21, 48): there the text can't be seen, and the page has + // no type for it (it draws it as outlines), so the text looks like type the app doesn't draw. + // The layers then differ from the page by little more than `compare` allows, so that is + // weighed. With the file at its box's corner the text shows, as the page has it. + let place = format!( + "%AI5_BeginPlace\n%%FileType: 1\n[1 0 0 -1 -7970 8070] 8000 8000 8040 8040 4 4 0\n(photo.png)`\n\ + %AI26_BeginPlacedObjectPreview\n2 2 8 32 17 {}\n%AI26_EndPlacedObjectPreview\n~\n%AI5_EndPlace\n", + OPAQUE.repeat(4) + ); + // Canvas centre 8191.5 is the template box's centre (201.5, -191.5): the anchor (8011, 7952) is + // (21, 48) in art space. + let document = text_document(&[("Hi\r", 0, (8011.0, 7952.0), (0.0, 0.0), 0.0)]).replace("/1 14.0", "/1 8.0"); + let data = native_with_text(&layer("Art", true, &(text_object(0) + &place)), &document) + .replace("%AI3_TemplateBox: 50 50 50 50", "%AI3_TemplateBox: 201.5 -191.5 201.5 -191.5"); + // The page (y down): the image's black square, and the type's outlines, a magenta box where + // its glyphs are. + let mut page = Document::new(100.0, 100.0); + let l = page.layers[0].id; + for (rect, color) in [ + (vectorcraft_geom::Rect::new(30.0, 30.0, 70.0, 70.0), vectorcraft_color::Color::BLACK), + (vectorcraft_geom::Rect::new(21.5, 46.5, 28.0, 52.0), vectorcraft_color::Color::Cmyk { c: 0.0, m: 1.0, y: 0.0, k: 0.0 }), + ] { + let id = page.alloc_id(); + let fill = vectorcraft_doc::FillLayer::new(vectorcraft_color::Paint::solid(color)); + let n = Node::path( + id, + vectorcraft_geom::shapes::rectangle(rect), + vectorcraft_doc::Appearance { items: vec![vectorcraft_doc::AppearanceItem::Fill(fill)], ..Default::default() }, + ); + page.insert(Some(l), 0, n).unwrap(); + } + // The preview's pixels are opaque black (ARGB `ff 00 00 00`), bytes a `str` can't hold. + let bytes = + data.replace(OPAQUE, "\u{1}").into_bytes().into_iter().flat_map(|b| if b == 1 { vec![0xff, 0, 0, 0] } else { vec![b] }).collect::>(); + let private = + [b"%AI24_ZStandard_Data".as_slice(), &ruzstd::encoding::compress_to_vec(&bytes[..], ruzstd::encoding::CompressionLevel::Fastest)].concat(); + let (d, w, read) = crate::layered_ai(&private, page, vec![], false, false, 1.0); + assert!(read, "{w:?}"); + let art = d.layers[0].children().unwrap(); + let image = art.iter().find(|n| matches!(n.kind, NodeKind::Image(_))).expect("the image"); + let b = image.geometric_bounds().unwrap(); + assert!([b.x0 - 30.0, b.y0 - 30.0, b.x1 - 70.0, b.y1 - 70.0].iter().all(|v| v.abs() < 0.01), "on the page's square: {b:?}"); + assert_eq!(text_of(&d.layers[0]).iter().map(|t| t.plain_text()).collect::>(), ["Hi"], "{w:?}"); + assert!(!w.iter().any(|w| w.contains("doesn't draw")), "{w:?}"); +} diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 6961c1983c..9385ff252f 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: All Caps and Small Caps type from the editing data keeps its case setting) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: the placed files' other placement weighs the page's unseen text again) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai` import: when the layers are compared with the page again with placed files at the corner of their box, the text objects the page doesn't draw are weighed with the images there, from the layers as read: before, the text an image covered at its first placement had already been left out, so a file whose image covered type only there came in without that type or as its PDF part. Test `import::tests_native::text_a_placed_file_covers_only_at_its_first_placement_is_kept`; scores unchanged | | 2026-10-30 | minor | `.ai` import: type read from the editing data's text document keeps its case setting (character attribute 12: 1 Small Caps, at Document Setup's default size, 2 All Caps); it came in as typed, so a heading set in All Caps showed in lower or mixed case where the page draws capitals. Test `import::tests_native::type_from_the_text_document_keeps_its_case_setting`; checked locally against a user's files; scores unchanged | | 2026-10-30 | minor | PDF import: a patch or triangle mesh shading of up to 16,384 patches comes in as gradient meshes (it was 4,096; Illustrator writes up to 14,355 in files users sent), and a stroke painted with one (how Illustrator writes a freeform gradient on a stroke) is the meshes clipped to the area the stroke paints, with its width, caps, joins and dashes; both came in as a flat grey. In two files of a user's set, the formerly grey area now matches a reference rendering in 99% of its pixels. Own-fixture tests in `tests::import_fidelity`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: gradient meshes the reader marked unread, which made the whole file come in as its page or PDF part, are read: a mesh starts grey and its `/CS` is written only where it changes, before the corner it applies to (within a patch too), so each corner takes the space last set before it; named colours (`[c m y k /DeviceCMYK (name) /Process]` or `/Spot`) paint at the corner's tint and `/NChannel` inks overprint at theirs; meshes up to 128 patches a side and 16,384 patches are read (files users sent had up to 97 × 72). Ten of eleven such files from a user's set now open from their layers; meshes with handle weights other than 1 still don't. Own-fixture tests in `import::ai::mesh`; scores unchanged | From 1d58ea947d9d170444cfe164a08f2b46f9844e88 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 18:53:08 +0300 Subject: [PATCH 056/227] fix(ai-import): pages cropped to the art in UserUnit units, and their copies' type A page cropped to the art is recognised in a UserUnit page's units too, when the art's box is the page in those units and the artboard isn't the page in points. Such pages are taken only when every page is the art's box, and only the first page's type is read: the later pages are copies whose type was moved by the first page's offset and could fill the layers' text objects twice. --- crates/eps/src/import/native/build.rs | 38 ++++++++++++++++----- crates/eps/src/import/tests_native.rs | 48 +++++++++++++++++++++++++++ docs/file-format-parity.md | 3 +- 3 files changed, 80 insertions(+), 9 deletions(-) diff --git a/crates/eps/src/import/native/build.rs b/crates/eps/src/import/native/build.rs index 687ea4a9d1..c36013cb8c 100644 --- a/crates/eps/src/import/native/build.rs +++ b/crates/eps/src/import/native/build.rs @@ -61,7 +61,11 @@ pub(super) fn build_from( // Editing data in the units of the page's user space ([`in_units`]) is compared with the page // scaled down to those units, and the document read from it is scaled up by `unit`. let board = artboard.map(|a| to_doc.transform_rect_bbox(a)); - let small = visible.filter(|v| matches!(page, Page::Artboard) && in_units(board, v, unit)).map(|v| { + // A page cropped to the art (see below) is in those units as well, when the art's box is and + // the artboard isn't the page in points. + let art = bbox.map(|[a, b, c, d]| to_doc.transform_rect_bbox(Rect::new(a, b, c, d))); + let units = |v: &Document| in_units(board, v, unit) || (!same_size(board, v) && in_units(art, v, unit)); + let small = visible.filter(|v| matches!(page, Page::Artboard) && units(v)).map(|v| { let mut v = v.clone(); scale_document(&mut v, 1.0 / unit); v @@ -83,12 +87,15 @@ pub(super) fn build_from( let mut rect = to_doc.transform_rect_bbox(art_box); // A `.ai` whose PDF part's pages are cropped to its art (each page the box of all of it, // the editing data's bounding box) rather than to its artboards: the layers are compared - // with the page on that box, and keep their artboards. + // with the page on that box, and keep their artboards. Each page then holds all the art + // again, so every page must be that box. + let mut cropped = false; if matches!(page, Page::Artboard) && !fits(&rect) - && let Some(art) = bbox.map(|[a, b, c, d]| to_doc.transform_rect_bbox(Rect::new(a, b, c, d))).filter(fits) + && visible.artboards.iter().all(|a| fits(&a.rect)) + && let Some(art) = art.filter(fits) { - rect = art; + (rect, cropped) = (art, true); } if !fits(&rect) { // Both sizes in points as the fields show them, and the editing data's page to the @@ -123,12 +130,21 @@ pub(super) fn build_from( let same = |(a, p): (&vectorcraft_doc::Artboard, &Rect)| (a.rect.width() - p.width()).abs() <= 0.5 && (a.rect.height() - p.height()).abs() <= 0.5; let boards = (pages.len() == doc.artboards.len() && doc.artboards.iter().zip(&pages).all(same)).then_some(&doc.artboards); - for object in shown.iter_mut().chain(hidden.iter_mut()).chain(lone.iter_mut()) { - // The page with most of it, the first for what is on none. - let on = extent(object).and_then(|r| { + // The page with most of an object, the first for what is on none. + let page_of = |object: &[Arc]| { + extent(object).and_then(|r| { let inside = |p: &Rect| p.intersect(r).area().max(0.0); pages.iter().enumerate().skip(1).filter(|(_, p)| inside(p) > inside(&page_rect)).max_by(|a, b| inside(a.1).total_cmp(&inside(b.1))) - }); + }) + }; + // Pages cropped to the art are copies of one another: the type is the first page's. + if cropped { + for objects in [&mut shown, &mut hidden, &mut lone] { + objects.retain(|o| page_of(o).is_none()); + } + } + for object in shown.iter_mut().chain(hidden.iter_mut()).chain(lone.iter_mut()) { + let on = page_of(object); let shift = match on.and_then(|(i, page)| Some((boards?.get(i)?, page))) { Some((board, page)) => Affine::translate(board.rect.origin() - page.origin()), None => shift, @@ -268,6 +284,12 @@ fn elsewhere(doc: &Document, placed: &[(NodeId, Affine)]) -> Option { Some(doc) } +/// Has `r` the size of `page`'s first artboard (in points)? +fn same_size(r: Option, page: &Document) -> bool { + let (Some(r), Some(p)) = (r, page.artboards.first().map(|a| a.rect)) else { return false }; + (r.width() - p.width()).abs() <= 0.5 && (r.height() - p.height()).abs() <= 0.5 +} + /// Does the editing data's first artboard `board` (in the document read from it: art space through /// `to_doc`) have the size of `page`'s first artboard in units of `unit` points, `unit` being above /// 1, and not its size in points? `page` is a PDF part read in points from pages of `unit` points a diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index bb1b867ca2..d4699b06d8 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -374,6 +374,54 @@ fn editing_data_in_the_units_of_a_user_unit_page_comes_in_at_the_pages_size() { assert!(near(first(&d, 0), [100.0, 860.0, 140.0, 900.0]), "{:?}", first(&d, 0)); } +/// A PDF part read from a `UserUnit` page cropped to the art: the art's box, not the artboard, is +/// the page in the editing data's units, so the layers are read at the page's size, with their +/// artboard. +#[test] +fn a_user_unit_page_cropped_to_the_art_is_read_in_its_units() { + // A 50 × 50 artboard, art over 100 × 100 (its bounding box), and a page of that box at 10 pt a + // unit: 1000 × 1000 pt. + let art = native(&layer("Jig", true, &square(10, 10))).replace("%AI3_Cropmarks: 0 0 100 100", "%AI3_Cropmarks: 0 0 50 50"); + let page = in_points(pdf_part(10.0, 86.0), 10.0); + let (d, w, read) = crate::layered_ai(&private(&art), page, vec![], false, false, 10.0); + assert!(read, "{w:?}"); + assert_eq!(d.artboards[0].rect.size(), vectorcraft_geom::Size::new(500.0, 500.0)); + // The square, 36 down the artboard, ten times as large and as far. + let b = d.layers[0].children().unwrap()[0].visual_bounds().unwrap(); + assert!([b.x0 - 100.0, b.y0 - 360.0, b.x1 - 140.0, b.y1 - 400.0].iter().all(|v| v.abs() < 1e-6), "{b:?}"); +} + +/// A PDF part whose pages are each cropped to all of the art holds the art once a page: the type +/// of the pages after the first is that type again, and only the first page's goes into the +/// layers. +#[test] +fn type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once() { + // A 50 × 50 artboard, art over 100 × 100, a text object with no story in the file, and two + // pages of the art's box in a row, 20 apart, each with the square and the type. + let art = native(&layer("Art", true, &(square(10, 10) + &text_object(0)))).replace("%AI3_Cropmarks: 0 0 100 100", "%AI3_Cropmarks: 0 0 50 50"); + let mut pdf = pdf_part(10.0, 86.0); + let mut second = pdf.artboards[0].clone(); + (second.id, second.rect) = (2, vectorcraft_geom::Rect::new(120.0, 0.0, 220.0, 100.0)); + pdf.artboards.push(second); + let copy = pdf_part(130.0, 86.0).layers[0].children().unwrap()[0].as_ref().clone(); + let layer_id = pdf.layers[0].id; + let id = pdf.alloc_id(); + pdf.insert(Some(layer_id), 1, Node { id, ..copy }).unwrap(); + for x in [30.0, 150.0] { + let style = vectorcraft_doc::CharStyle { size: 14.0, ..Default::default() }; + let text = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::new(x, 40.0), "Hi", style); + let id = pdf.alloc_id(); + pdf.insert(Some(layer_id), 2, Node::new(id, NodeKind::Text(Box::new(text)))).unwrap(); + } + let (d, w, read) = crate::layered_ai(&private(&art), pdf, vec![], false, false, 1.0); + assert!(read, "{w:?}"); + let texts = text_of(&d.layers[0]); + // The first page's type, where the art has it: 50 above the artboard's top. + assert_eq!(texts.iter().map(|t| t.plain_text()).collect::>(), ["Hi"], "{w:?}"); + let [.., e, f] = texts[0].xf.as_coeffs(); + assert!((e - 30.0).abs() < 1e-6 && (f + 10.0).abs() < 1e-6, "{:?}", texts[0].xf); +} + #[test] fn an_ai_file_that_cant_be_read_through_its_editing_data_keeps_its_pdf_part() { let pdf = pdf_part(10.0, 86.0); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 9385ff252f..48cd9701f8 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: the placed files' other placement weighs the page's unseen text again) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: pages cropped to the art in `UserUnit` units, and their copies' type) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai` import: a PDF part whose pages are cropped to the art is recognised in a `UserUnit` page's units too (the art's box in those units, the artboard not the page in points), and its type is read from the first page only, since every such page holds all the art again: the copies on later pages were moved as the first page's and could be put into the layers' text objects. A page cropped to the art is taken only when every page is that box. Tests `import::tests_native::a_user_unit_page_cropped_to_the_art_is_read_in_its_units`, `type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`; scores unchanged | | 2026-10-30 | minor | `.ai` import: when the layers are compared with the page again with placed files at the corner of their box, the text objects the page doesn't draw are weighed with the images there, from the layers as read: before, the text an image covered at its first placement had already been left out, so a file whose image covered type only there came in without that type or as its PDF part. Test `import::tests_native::text_a_placed_file_covers_only_at_its_first_placement_is_kept`; scores unchanged | | 2026-10-30 | minor | `.ai` import: type read from the editing data's text document keeps its case setting (character attribute 12: 1 Small Caps, at Document Setup's default size, 2 All Caps); it came in as typed, so a heading set in All Caps showed in lower or mixed case where the page draws capitals. Test `import::tests_native::type_from_the_text_document_keeps_its_case_setting`; checked locally against a user's files; scores unchanged | | 2026-10-30 | minor | PDF import: a patch or triangle mesh shading of up to 16,384 patches comes in as gradient meshes (it was 4,096; Illustrator writes up to 14,355 in files users sent), and a stroke painted with one (how Illustrator writes a freeform gradient on a stroke) is the meshes clipped to the area the stroke paints, with its width, caps, joins and dashes; both came in as a flat grey. In two files of a user's set, the formerly grey area now matches a reference rendering in 99% of its pixels. Own-fixture tests in `tests::import_fidelity`; scores unchanged | From 66c797a59b11057151c8f707dfb98e609f68951f Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 18:53:03 +0300 Subject: [PATCH 057/227] .ai import: outlines from the editing data keep their look and threads; mesh corners with non-numbers are unread Follow-ups to the review of #4697 and #4698: - With textAs: outlines, a .ai saved without PDF compatibility, read from its editing data alone, has its type outlined too, as an empty page or a text-only placeholder already did. - Threaded type read from the editing data holds its story in its first frame: it now flows through its frames before it is outlined, so each frame's outlines show the text it holds, and the outlined frames leave their threads. - Each outline group keeps its type's opacity, blend mode, isolation, opacity mask and effects (the same carry-over the flattener uses). - A gradient-mesh corner (/N) holding anything but numbers is unread, instead of being read with the numbers after it shifted into its colour and opacity. --- crates/engine/src/cmd/fileio/load.rs | 17 ++- .../engine/src/cmd/fileio/tests_aiimport.rs | 130 +++++++++++++++--- crates/engine/src/cmd/flatten.rs | 2 +- crates/engine/src/cmd/flatten/analysis.rs | 2 +- crates/eps/src/import/ai/mesh.rs | 27 +++- docs/file-format-parity.md | 1 + 6 files changed, 155 insertions(+), 24 deletions(-) diff --git a/crates/engine/src/cmd/fileio/load.rs b/crates/engine/src/cmd/fileio/load.rs index 41503e0620..c2e58e39e7 100644 --- a/crates/engine/src/cmd/fileio/load.rs +++ b/crates/engine/src/cmd/fileio/load.rs @@ -204,11 +204,18 @@ fn is_page_note(w: &str) -> bool { } /// The document read from the editing data alone with its type as outlines when `opts` asks for -/// them (`textAs: outlines`): the page that would have them has none to give. -fn outlined_if_asked(mut doc: Document, warnings: Vec, opts: &LoadOptions) -> (Document, Vec) { +/// them (`textAs: outlines`): the page that would have them has none to give. Threaded type first +/// flows through its frames (the editing data gives a story in its first frame), and the outlined +/// frames leave their threads. Each outline group keeps its type's transparency, opacity mask and +/// effects. +pub(super) fn outlined_if_asked(mut doc: Document, warnings: Vec, opts: &LoadOptions) -> (Document, Vec) { if opts.text_as != vectorcraft_pdf::TextAs::Outlines { return (doc, warnings); } + if !doc.text_threads.is_empty() { + crate::cmd::threads::reflow(&Document::new(1.0, 1.0), &mut doc); + } + let threaded = crate::cmd::threads::frames(&doc); let mut texts = Vec::new(); doc.walk(|n| { if matches!(n.kind, vectorcraft_doc::NodeKind::Text(_)) { @@ -216,12 +223,13 @@ fn outlined_if_asked(mut doc: Document, warnings: Vec, opts: &LoadOption } }); for t in texts { - let Some(o) = vectorcraft_render::effects::outline_text(&t) else { continue }; - let o = Node { visible: t.visible, locked: t.locked, name: t.name.clone(), ..doc.reid(&o) }; + let Some(o) = crate::cmd::flatten::outlined_text(&t) else { continue }; + let o = Node { visible: t.visible, locked: t.locked, ..doc.reid(&o) }; if let Some(slot) = doc.node_mut(t.id) { *slot = o; } } + crate::cmd::threads::leave_threads(&mut doc, &threaded); (doc, warnings) } @@ -331,6 +339,7 @@ pub fn load_with(name: &str, bytes: &[u8], opts: &LoadOptions) -> Result let whole = LoadOptions { pages: None, ..opts.clone() }; from_editing_data_alone(bytes, if every_page(bytes, opts) { &whole } else { opts }) .unwrap_or(Err(e)) + .map(|(doc, warnings)| outlined_if_asked(doc, warnings, opts)) .inspect(|_| editing_data = true) } Err(e) => Err(e), diff --git a/crates/engine/src/cmd/fileio/tests_aiimport.rs b/crates/engine/src/cmd/fileio/tests_aiimport.rs index ea72dba535..edccacd50a 100644 --- a/crates/engine/src/cmd/fileio/tests_aiimport.rs +++ b/crates/engine/src/cmd/fileio/tests_aiimport.rs @@ -6,7 +6,7 @@ use std::io::Write as _; use std::sync::Arc; use serde_json::{Value, json}; -use vectorcraft_doc::{Node, NodeKind}; +use vectorcraft_doc::{Node, NodeId, NodeKind}; use vectorcraft_testkit::ai; use vectorcraft_testkit::pdf::{PdfPage, first_extra, pdf_with}; @@ -589,12 +589,10 @@ fn a_page_whose_content_was_skipped_is_not_taken_for_an_empty_one() { assert!(!warnings.contains("saved without PDF compatibility"), "{r}"); } -/// Type asked for as outlines on a page that draws nothing: the editing data's type, outlined (the -/// page has none to give). -#[test] -fn an_empty_page_with_type_as_outlines_outlines_the_editing_datas_type() { - // One left-aligned story, "Hi", 14 pt Helvetica, anchored at the canvas centre (the template - // box's centre), as the editing data's text document gives it. +/// Editing data with one layer, "Art", holding one left-aligned story, "Hi", 14 pt Helvetica, +/// anchored at the canvas centre (the template box's centre), as the editing data's text document +/// gives it; compressed. +fn typed_data() -> Vec { let story = "<< /0 << /0 (Hi\r) /5 << /0 [ << /0 << /0 << /0 () /5 << /0 0 >> /6 0 >> >> /1 3 >> ] >> \ /6 << /0 [ << /0 << /0 << /0 () /5 0 /6 << /0 0 /1 14.0 /53 << /99 /CAITextPaint /0 << /0 2 /1 [ 1.0 0.0 1.0 0.0 0.0 ] >> >> >> >> >> /1 3 >> ] >> >> \ /1 << /0 [ << /0 0 >> ] /2 [ << /99 /PC /6 [ << /99 /F /0 << /0 [ 8191.5 8191.5 ] >> /6 [ << /99 /R /6 [ << /99 /R /6 [ << /99 /L /6 [ \ @@ -610,23 +608,121 @@ fn an_empty_page_with_type_as_outlines_outlines_the_editing_datas_type() { ai::layer("Art", text), lines.join("\n") ); - let file = ai::ai(&compressed(data.as_bytes()), ""); - let texts = |s: &Session| { - let mut n = 0; - s.doc().unwrap().doc.walk(|c| n += usize::from(matches!(c.kind, NodeKind::Text(_)))); - n - }; + compressed(data.as_bytes()) +} + +/// How many text objects and how many paths the open document holds. +fn texts_and_paths(s: &Session) -> (usize, usize) { + let (mut texts, mut paths) = (0, 0); + s.doc().unwrap().doc.walk(|c| { + texts += usize::from(matches!(c.kind, NodeKind::Text(_))); + paths += usize::from(matches!(c.kind, NodeKind::Path { .. } | NodeKind::Compound { .. })); + }); + (texts, paths) +} + +/// Type asked for as outlines on a page that draws nothing: the editing data's type, outlined (the +/// page has none to give). +#[test] +fn an_empty_page_with_type_as_outlines_outlines_the_editing_datas_type() { + let file = ai::ai(&typed_data(), ""); let mut s = Session::new(); let r = open(&mut s, "typed.ai", &file, json!({})).unwrap(); - assert_eq!(texts(&s), 1, "by default the editing data's type is type: {r}"); + assert_eq!(texts_and_paths(&s).0, 1, "by default the editing data's type is type: {r}"); let r = open(&mut s, "typed.ai", &file, json!({"textAs": "outlines"})).unwrap(); - assert_eq!(texts(&s), 0, "no type left: {r}"); - let mut paths = 0; - s.doc().unwrap().doc.walk(|c| paths += usize::from(matches!(c.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }))); + let (texts, paths) = texts_and_paths(&s); + assert_eq!(texts, 0, "no type left: {r}"); assert!(paths > 0, "the outlines are there: {r}"); assert_eq!(names(&s.doc().unwrap().doc.layers), ["Art"], "the editing data's layers"); } +/// Type asked for as outlines in a `.ai` saved without PDF compatibility (its page only a +/// placeholder): the editing data's type, outlined, as for an empty page. +#[test] +fn a_file_saved_without_its_pdf_part_with_type_as_outlines_outlines_its_type() { + let file = ai::ai(&typed_data(), PLACEHOLDER); + let mut s = Session::new(); + let r = open(&mut s, "typed.ai", &file, json!({})).unwrap(); + assert_eq!(texts_and_paths(&s).0, 1, "by default the editing data's type is type: {r}"); + let r = open(&mut s, "typed.ai", &file, json!({"textAs": "outlines"})).unwrap(); + let (texts, paths) = texts_and_paths(&s); + assert_eq!(texts, 0, "no type left: {r}"); + assert!(paths > 0, "the outlines are there: {r}"); + assert_eq!(names(&s.doc().unwrap().doc.layers), ["Art"], "the editing data's layers"); +} + +/// Type of the editing data outlined keeps its transparency, opacity mask and effects, and is +/// shown and locked as the type was. +#[test] +fn outlined_type_of_the_editing_data_keeps_its_transparency_and_effects() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 200, "height": 100})).unwrap(); + let id = NodeId(s.execute("text.create", &json!({"x": 10, "y": 50, "text": "Hi"})).unwrap()["id"].as_u64().unwrap()); + let mut doc = s.doc().unwrap().doc.as_ref().clone(); + let shadow = vectorcraft_doc::Effect { id: "stylize.dropShadow".into(), params: json!({}), visible: true }; + { + let t = doc.node_mut(id).unwrap(); + t.opacity = 0.5; + t.blend = vectorcraft_color::BlendMode::Multiply; + t.isolate = true; + t.locked = true; + t.name = Some("Title".into()); + t.appearance.effects = vec![shadow.clone()]; + } + let opts = LoadOptions { text_as: vectorcraft_pdf::TextAs::Outlines, ..Default::default() }; + let (doc, _) = load::outlined_if_asked(doc, vec![], &opts); + let mut outlines = vec![]; + doc.walk(|n| { + if n.extras().type_outlines { + outlines.push(n.clone()); + } + }); + let [o] = &outlines[..] else { panic!("one group of outlines: {outlines:?}") }; + assert_eq!((o.opacity, o.blend, o.isolate), (0.5, vectorcraft_color::BlendMode::Multiply, true)); + assert_eq!(o.appearance.effects, [shadow]); + assert!(o.locked && o.visible); + assert_eq!(o.name.as_deref(), Some("Title")); +} + +/// Threaded type of the editing data, its story all in its first frame as the editing data gives +/// it, outlined: each frame's outlines show the text that flows into it. +#[test] +fn outlined_threaded_type_of_the_editing_data_shows_the_text_of_every_frame() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 600, "height": 300})).unwrap(); + let story = "The quick brown fox jumps over the lazy dog and keeps running far beyond the first frame. ".repeat(4); + let a = + s.execute("text.create", &json!({"x": 10, "y": 10, "text": story, "area": {"width": 150, "height": 60}})).unwrap()["id"].as_u64().unwrap(); + let b = s.execute("shape.rectangle", &json!({"x": 200, "y": 10, "width": 150, "height": 200})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [a, b]})).unwrap(); + s.execute("text.thread.create", &json!({})).unwrap(); + // As the editing data gives it: the first frame holds the story, the second nothing yet. + let mut doc = s.doc().unwrap().doc.as_ref().clone(); + let runs = |id: u64| match &doc.node(NodeId(id)).unwrap().kind { + NodeKind::Text(t) => t.runs.clone(), + _ => panic!("area type"), + }; + let (shown, flowed) = (runs(a), runs(b)); + let empty: Vec<_> = flowed.iter().take(1).map(|r| vectorcraft_doc::TextRun { text: String::new(), ..r.clone() }).collect(); + for (id, put) in [(a, [shown, flowed].concat()), (b, empty)] { + if let NodeKind::Text(t) = &mut doc.node_mut(NodeId(id)).unwrap().kind { + t.runs = put; + t.cached_bounds = None; + t.cached_baselines.clear(); + } + } + let opts = LoadOptions { text_as: vectorcraft_pdf::TextAs::Outlines, ..Default::default() }; + let (doc, _) = load::outlined_if_asked(doc, vec![], &opts); + let mut right = 0; + doc.walk(|n| { + if matches!(n.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }) && n.geometric_bounds().is_some_and(|r| r.x0 >= 190.0) { + right += 1; + } + }); + assert!(right > 0, "the second frame's text is outlined where it flows"); + assert!(doc.text_threads.is_empty(), "outlined frames are in no thread: {:?}", doc.text_threads); +} + #[test] fn editing_data_false_opens_only_what_the_page_prints() { let mut s = Session::new(); diff --git a/crates/engine/src/cmd/flatten.rs b/crates/engine/src/cmd/flatten.rs index c7ddd8bc57..47a190a430 100644 --- a/crates/engine/src/cmd/flatten.rs +++ b/crates/engine/src/cmd/flatten.rs @@ -48,7 +48,7 @@ mod options; mod presets; mod report; -pub(crate) use analysis::see_through_images; +pub(crate) use analysis::{outlined_text, see_through_images}; pub(crate) use apply::flatten_document; pub use commands::specs; pub use options::FlattenOptions; diff --git a/crates/engine/src/cmd/flatten/analysis.rs b/crates/engine/src/cmd/flatten/analysis.rs index cad3b9384e..4bdbb8b723 100644 --- a/crates/engine/src/cmd/flatten/analysis.rs +++ b/crates/engine/src/cmd/flatten/analysis.rs @@ -51,7 +51,7 @@ impl Scratch { } /// Type as outlines painted like it ([`effects::outline_text`]), keeping its transparency. -pub(super) fn outlined_text(n: &Node) -> Option { +pub(crate) fn outlined_text(n: &Node) -> Option { effects::outline_text(n).map(|g| Node { knockout: Knockout::Off, ..carry(n, g) }) } diff --git a/crates/eps/src/import/ai/mesh.rs b/crates/eps/src/import/ai/mesh.rs index 0b2438c7e1..b33869a953 100644 --- a/crates/eps/src/import/ai/mesh.rs +++ b/crates/eps/src/import/ai/mesh.rs @@ -186,7 +186,9 @@ impl MeshReader { "N" => { if let Some(V::Arr(a)) = value { if self.corners.len() < 4 { - let n: Vec = a.iter().filter_map(V::num).take(64).collect(); + // A corner holding anything but numbers is unread: skipping it would shift + // the numbers after it into the colour or the opacity. + let n: Vec = a.iter().take(64).map(V::num).collect::>().unwrap_or_default(); let comps = self.space.components(); let color = comps.and_then(|k| self.space.color(n.get(..k)?)); let rest = comps.and_then(|k| n.get(k..)).map(<[f64]>::to_vec).unwrap_or_default(); @@ -901,6 +903,29 @@ mod tests { } } + /// A corner holding anything but numbers is unread: skipping it would shift the numbers after + /// it into its colour and opacity (two inks' tints `0.25 /bad 0.5`, read as `0.25 0.5` and no + /// opacity). + #[test] + fn a_corner_with_something_other_than_numbers_is_unread() { + let ink = |c: [f64; 4], name: &str| { + let mut v: Vec = c.iter().map(|x| V::Num(*x)).collect(); + v.extend([V::Name("DeviceCMYK".into()), V::Str(name.as_bytes().to_vec()), V::Name("Separation".into())]); + V::Arr(v) + }; + let channels = + V::Arr(vec![ink([0.0, 0.0, 1.0, 0.0], "Yellow"), ink([0.0, 1.0, 0.0, 0.0], "Magenta"), V::Num(2.0), V::Name("NChannel".into())]); + let mut reader = MeshReader::default(); + reader.entry(&[channels, V::Name("CS".into())], Affine::IDENTITY); + for (x, y) in [(0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0)] { + let mut corner = vec![V::Num(0.25), V::Name("bad".into()), V::Num(0.5)]; + corner.extend([x, y, x, y, 1.0, x, y, 1.0].map(V::Num)); + reader.entry(&[V::Arr(corner), V::Name("N".into())], Affine::IDENTITY); + } + reader.entry(&[V::Num(0.0), V::Name("E".into())], Affine::IDENTITY); + assert!(reader.unread && reader.patches.is_empty(), "{:?}", reader.patches); + } + /// Meshes as large as files users sent (97 × 72 patches) are read, as one mesh. #[test] fn a_large_grid_is_read_as_one_mesh() { diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 48cd9701f8..af662106c7 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -141,6 +141,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | 2026-10-30 | minor | SVG export: axis-aligned rectangles are written as ``, circles and ellipses drawn with four standard arcs as ``/``, straight lines as `` and other straight-segment paths as ``/``, at the written precision; a rectangle or ellipse with a dashed stroke, turned ellipses, curves and compound paths stay `` (#4652); scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file written as an object's copy on `%_` lines is read: its `%AI5_BeginPlace` and `%AI5_EndPlace` markers there were dropped, so the `~` that ends it was an unknown operator and the whole file came in as its PDF part; its preview's header, on a `%_` line too, is read. Own-fixture test in `import::ai::tests`; scores unchanged | | 2026-10-30 | minor | PDF export: an opaque gradient mesh is written as one PDF Type 6 (Coons patch) shading (ISO 32000-1, 8.7.4.5.7) filling its outline, so viewers blend its colours smoothly instead of showing the bands and seams of the 8 × 8 flat quads a patch it was cut into; a file of 65,558 small meshes exports in 14 s instead of 56 s, at half the size. A mesh with see-through points is still written as quads. Own-fixture tests in `tests::mesh_export`; scores unchanged | +| 2026-10-30 | minor | `.ai` import with `textAs: "outlines"`, read from the editing data alone: a file saved without PDF compatibility has its type outlined too; threaded type flows through its frames before it is outlined, so each frame's outlines show the text it holds; and each outline group keeps its type's opacity, blending, opacity mask and effects. `.ai`/EPS import: a gradient-mesh corner holding anything but numbers is unread instead of read with the numbers after it shifted into its colour and opacity. Tests in `tests_aiimport.rs` and `import::ai::mesh::tests`; scores and hours unchanged | | 2026-10-30 | minor | `.ai` import: a PDF part counts as an empty page only when nothing on it was skipped (an image that can't be decoded draws nothing too), so such a page keeps its notes and is checked against the editing data as before; with `textAs: "outlines"`, a file read from its editing data alone (an empty page, or the text-only placeholder of #1387) has its type outlined. Tests in `tests_aiimport.rs`; scores and hours unchanged | | 2026-10-30 | minor | `.ai` import: a file whose PDF part is an empty page opens from its editing data where that reads, instead of opening blank; scores unchanged | | 2026-10-30 | minor | `.ai` import: a file whose PDF part's pages are cropped to its art rather than its artboards no longer comes in as that PDF part (each page a copy of all the art) but from its layers, with its artboards, where they draw as the page does; own-fixture test in `tests_aiimport`; scores unchanged | From 8f56899df911585c2278a6edcaeba2df542e3381 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 06:51:06 -0700 Subject: [PATCH 058/227] Perspective Selection: Cmd/Ctrl+Alt-drag copies objects in perspective With the Perspective Selection tool, Ctrl+Alt-drag (Command+Option-drag on macOS) now copies objects on their perspective plane, as Alt/Option-drag does. Before, Cmd/Ctrl lent the last selection tool even with Alt held, so the drag made a flat copy. Cmd/Ctrl alone still lends the last selection tool, and the cursor follows the same rule. --- crates/engine/src/tests/persp_select.rs | 61 ++++++++++++++++++++++++- crates/engine/src/tooling.rs | 4 ++ docs/target-app-parity.md | 1 + 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/tests/persp_select.rs b/crates/engine/src/tests/persp_select.rs index b769647912..3b848d927d 100644 --- a/crates/engine/src/tests/persp_select.rs +++ b/crates/engine/src/tests/persp_select.rs @@ -4,7 +4,7 @@ use serde_json::json; use vectorcraft_geom::{Point, Rect, Vec2}; use vectorcraft_tools::distort::perspective::{self as persp, PerspectiveGrid, Plane}; -use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey}; +use vectorcraft_tools::{Cursor, Mods, PointerEvent, PointerKind, ToolKey}; use crate::*; @@ -111,6 +111,65 @@ fn alt_drag_copies_and_the_copy_stays_attached() { assert!(s.doc().unwrap().doc.node(copy).is_none()); } +#[test] +fn cmd_alt_drag_copies_on_the_perspective_plane() { + let (mut s, id) = persp_session(); + let v = ViewInfo::default(); + s.select_tool("directSelection", v).unwrap(); + s.select_tool("perspectiveSelection", v).unwrap(); + let before = plane_pts(&s, id, Plane::Right, 0.0); + let count = s.doc().unwrap().doc.node_count(); + let c = bounds_of(&before).center(); + let h = grid(&s).homography(Plane::Right).unwrap(); + let (from, to) = (h.apply(c).unwrap(), h.apply(c + Vec2::new(80.0, 0.0)).unwrap()); + let n = undo_len(&s); + drag(&mut s, &[from, to, to], Mods { cmd: true, alt: true, ..Default::default() }); + assert_eq!(undo_len(&s), n + 1, "one undo step"); + assert_eq!(s.doc().unwrap().doc.node_count(), count + 1, "one copy"); + assert_eq!(s.doc().unwrap().selection.objects.len(), 1); + let copy = s.doc().unwrap().selection.objects[0]; + assert_ne!(copy, id, "the copy is selected"); + assert_eq!(plane_pts(&s, id, Plane::Right, 0.0), before, "the original stays"); + assert_eq!(attached(&s, copy), Some((Plane::Right, 0.0)), "the copy is attached"); + for (a, b) in before.iter().zip(plane_pts(&s, copy, Plane::Right, 0.0)) { + assert!((b - *a - Vec2::new(80.0, 0.0)).hypot() < 1e-6); + } + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc.node_count(), count); + assert_eq!(plane_pts(&s, id, Plane::Right, 0.0), before); + assert_eq!(s.doc().unwrap().selection.objects, vec![id]); +} + +#[test] +fn cmd_drag_still_lends_selection_from_perspective_selection() { + let (mut s, id) = persp_session(); + let v = ViewInfo::default(); + s.select_tool("directSelection", v).unwrap(); + s.select_tool("perspectiveSelection", v).unwrap(); + let p = s.doc().unwrap().doc.node(id).unwrap().geometric_bounds().unwrap().center(); + let cmd = Mods { cmd: true, ..Default::default() }; + s.pointer(&PointerEvent::new(PointerKind::Down, p.x, p.y).with_mods(cmd), v).unwrap(); + assert_eq!(s.tool_id(), "directSelection"); + s.pointer(&PointerEvent::new(PointerKind::Up, p.x, p.y).with_mods(cmd), v).unwrap(); + assert_eq!(s.tool_id(), "perspectiveSelection"); + let cmd_alt = Mods { cmd: true, alt: true, ..Default::default() }; + s.pointer(&PointerEvent::new(PointerKind::Down, p.x, p.y).with_mods(cmd_alt), v).unwrap(); + assert_eq!(s.tool_id(), "perspectiveSelection"); + s.pointer(&PointerEvent::new(PointerKind::Up, p.x, p.y).with_mods(cmd_alt), v).unwrap(); +} + +#[test] +fn cmd_alt_cursor_stays_with_perspective_selection() { + let (mut s, id) = persp_session(); + let v = ViewInfo::default(); + s.select_tool("directSelection", v).unwrap(); + s.select_tool("perspectiveSelection", v).unwrap(); + let p = s.doc().unwrap().doc.node(id).unwrap().geometric_bounds().unwrap().center(); + let cmd_alt = Mods { cmd: true, alt: true, ..Default::default() }; + assert_eq!(s.cursor(p, cmd_alt, v), Cursor::Arrow); + assert_eq!(s.tool_id(), "perspectiveSelection"); +} + #[test] fn pressing_5_while_dragging_moves_perpendicular_to_the_plane() { let (mut s, id) = persp_session(); diff --git a/crates/engine/src/tooling.rs b/crates/engine/src/tooling.rs index 6dbfb133d7..997606253d 100644 --- a/crates/engine/src/tooling.rs +++ b/crates/engine/src/tooling.rs @@ -147,6 +147,7 @@ impl Session { /// Direct Selection to the tools that edit anchors (the Pen) and Selection to the others. /// Cmd+Alt lends Group Selection while Direct Selection is active. Cmd still lends the last /// selection tool from other tools (Alt on the lent Direct Selection gesture stays copy/subtract). + /// Perspective Selection keeps Cmd+Alt drags to copy objects on their perspective plane. /// None for the other selection tools and the view tools. fn lent_tool(&self, id: &str, mods: &Mods) -> Option<&'static str> { use vectorcraft_tools::catalog::{edits_anchors, is_selection_tool}; @@ -156,6 +157,9 @@ impl Session { if id == "directSelection" && mods.cmd && mods.alt { return Some("groupSelection"); } + if id == "perspectiveSelection" && mods.cmd && mods.alt { + return None; + } if is_selection_tool(id) { return None; } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index ca235f91a3..428b38c75a 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1089,6 +1089,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur In the web build, while a pan, zoom or rotation changes the view of a document whose last canvas render took more than 8 ms, the canvas draws the last frame moved with the view, and it renders the art again once the view has been still for 0.2 s. An Alt-drag with the Selection, Direct Selection, Group Selection, Rotate, Scale, Reflect or Shear tool copies the selection on its first move, and the moves after it transform those copies; the previews of the Move, Rotate, Scale, Reflect and Shear dialogs with Copy and Preview on copy the selection once in the same way (#1429). An Alt-drag of objects in perspective with the Perspective Selection tool, and an Alt-drag of a plane widget with that tool or the Perspective Grid tool, copy the objects on the first move, and the moves after it move those copies (#1429). + With the Perspective Selection tool, Ctrl+Alt-drag (Command+Option-drag on macOS) also copies objects on their perspective plane; Alt/Option-drag continues to do so. When the desktop app opens a document on a thread of its own (#1245), that thread also reads the document's linked files and lays out its type, and the UI thread only adds the finished document: in release builds, the step left on the UI thread takes 0.02 ms instead of 1.04 s for a document with 12 linked 3000 × 2000 TIFFs, and it takes 0.1 ms instead of 0.85 s for one with 300 Auto Size area type objects, every second one in three columns. The Layers panel's Delete Selection, Duplicate Selection, Collect in New Layer, Merge Selected, Flatten Artwork, Release to Layers (Sequence) and row drags also take time in proportion to the size of the document, and so do Cut Artboard and Duplicate Artboard with their art and each move of an Alt-drag of one artboard with the Artboard tool while Move/Copy Artwork with Artboard is on (#1429). In Outline view the renderer draws paths and compound paths from the geometry it keeps for them between frames, and it culls the members of clip groups by the bounds it keeps for them. Layers with Preview off and the outlines of Image Trace objects are drawn the same way. From 65f7d3a6996350edca87646d1d6c1cc241f10cb7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 29 Oct 2026 02:02:15 -0700 Subject: [PATCH 059/227] Image Trace: Document Library links to a global swatch that shares a process swatch's color When a process swatch listed before a global or spot swatch showed the same color, a traced fill of that color took the process swatch and stayed unlinked. Of the swatches that trace as one color, the first linked one now gives the fill, and the first one otherwise. --- crates/engine/src/cmd/buildcmds/trace.rs | 10 ++++--- crates/engine/src/tests/build.rs | 37 ++++++++++++++++++++++++ docs/image-trace-adjustments.md | 4 ++- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/crates/engine/src/cmd/buildcmds/trace.rs b/crates/engine/src/cmd/buildcmds/trace.rs index 308e300ec7..a44b4bbcad 100644 --- a/crates/engine/src/cmd/buildcmds/trace.rs +++ b/crates/engine/src/cmd/buildcmds/trace.rs @@ -585,10 +585,12 @@ pub(super) fn trace_make(s: &mut Session, p: &Value, expand: bool) -> Result [200, 40, 40, 255], + 20..40 => [40, 160, 60, 255], + _ => [tr, tg, tb, 255], + }); + add_image(&mut s, &r, Affine::IDENTITY); + let params = json!({"mode": "color", "palette": "documentLibrary", "library": "document", "colors": 8}); + let res = s.execute("imageTrace.makeAndExpand", &json!({"params": params})).unwrap(); + let g = node(&s, NodeId(res["id"].as_u64().unwrap())); + let got: Vec = g.children().unwrap().iter().map(|n| n.appearance.fill_paint()).collect(); + let red = Color::rgb8(200, 40, 40); + let reds: Vec<&Paint> = got.iter().filter(|p| p.color().map(|c| c.to_rgba8(1.0)) == Some(red.to_rgba8(1.0))).collect(); + assert!(!reds.is_empty(), "{got:?}"); + assert!(reds.iter().all(|p| matches!(p, Paint::Solid { swatch: Some(w), .. } if w == "Ink")), "{got:?}"); + let tints: Vec<&Paint> = got.iter().filter(|p| p.color().map(|c| c.to_rgba8(1.0)) == Some([tr, tg, tb, 255])).collect(); + assert!(!tints.is_empty(), "{got:?}"); + assert!(tints.iter().all(|p| matches!(p, Paint::Solid { swatch: Some(w), tint, .. } if w == "Sky" && *tint == 0.5)), "{got:?}"); + // Editing the global swatch recolors the trace. + s.execute("swatch.edit", &json!({"name": "Ink", "color": "#ff8800"})).unwrap(); + let g = node(&s, NodeId(res["id"].as_u64().unwrap())); + let orange = Color::rgb8(255, 136, 0).to_rgba8(1.0); + assert!(g.children().unwrap().iter().any(|n| n.appearance.fill_paint().color().map(|c| c.to_rgba8(1.0)) == Some(orange))); +} + #[test] fn image_trace_document_library_matches_a_lab_spot_by_its_cmyk_equivalent() { let _g = crate::tests_colormgmt::GLOBAL.lock().unwrap_or_else(|e| e.into_inner()); diff --git a/docs/image-trace-adjustments.md b/docs/image-trace-adjustments.md index b124de96a4..0de13b953c 100644 --- a/docs/image-trace-adjustments.md +++ b/docs/image-trace-adjustments.md @@ -49,7 +49,9 @@ and traces as All. **Document Library linked colors.** With Library › Document Swatches, with or without a color group, a traced fill or stroke whose color comes from a global or spot swatch is linked to that swatch, and one whose color comes from a tint swatch is linked to its base at the tint. Editing the swatch -recolors the trace. Colors from process swatches and from swatch libraries are not linked. +recolors the trace. Colors from process swatches and from swatch libraries are not linked. When +several swatches show the same color, the first of them in the list that is a global, spot or tint +swatch gives the link. **Document Library** traces with the library's colors as they are. Each pixel takes the library color nearest to it in lightness and hue, with a difference in hue or chroma counted three times From a2d38415793e22b3b9259ceab15e5c1f2a319ce2 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 06:44:47 -0700 Subject: [PATCH 060/227] Image Trace: look up library swatches once per trace Each traced path filtered the whole library for its color, twice when no swatch of that color was linked. The color-to-paint lookup is now built once before the paths are filled. The first linked swatch of a color still gives the fill, and the first swatch of that color otherwise. --- crates/engine/src/cmd/buildcmds/trace.rs | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/cmd/buildcmds/trace.rs b/crates/engine/src/cmd/buildcmds/trace.rs index a44b4bbcad..832219d5fd 100644 --- a/crates/engine/src/cmd/buildcmds/trace.rs +++ b/crates/engine/src/cmd/buildcmds/trace.rs @@ -1,3 +1,5 @@ +use std::collections::HashMap; + use vectorcraft_color::Swatch; use vectorcraft_doc::ImageObject; @@ -557,6 +559,16 @@ pub(super) fn trace_make(s: &mut Session, p: &Value, expand: bool) -> Result = HashMap::new(); + for (rgb, paint) in &library { + let chosen = by_color.entry(*rgb).or_insert(paint); + if !matches!(**chosen, Paint::Solid { swatch: Some(_), .. }) && matches!(paint, Paint::Solid { swatch: Some(_), .. }) { + *chosen = paint; + } + } let id = s.edit(label, |d, sel| { let src = d.node(target).cloned().ok_or(EngineError::NoNode(target))?; let mut image = if is_trace_group(&src) { @@ -584,14 +596,8 @@ pub(super) fn trace_make(s: &mut Session, p: &Value, expand: bool) -> Result Date: Sat, 31 Oct 2026 00:02:59 +0700 Subject: [PATCH 061/227] Canvas: Shift, Alt and Cmd/Ctrl pressed or released mid-drag apply with the pointer held still (#4711) --- crates/ui-egui/src/canvas/drag.rs | 10 ++++++++ crates/ui-egui/src/canvas/input.rs | 5 ++-- crates/ui-egui/src/canvas/tests.rs | 37 ++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/canvas/drag.rs b/crates/ui-egui/src/canvas/drag.rs index c35effb6fd..75b155c516 100644 --- a/crates/ui-egui/src/canvas/drag.rs +++ b/crates/ui-egui/src/canvas/drag.rs @@ -78,6 +78,16 @@ pub(super) fn tool_drag_moved(ui: &Ui, xf: &Xf, p: Pos2, pointer: &egui::Pointer true } +/// Whether the tool should get another drag event at a pointer held still because Shift, Alt, +/// Cmd/Ctrl or Space went down or up (#4711): a scale switches to proportional or from the centre +/// at once. Records `m` as the modifiers last seen; only once the press has dragged. +pub(super) fn tool_drag_mods_changed(ui: &Ui, m: Mods) -> bool { + let id = egui::Id::unique("canvas-tool-drag-mods"); + let (dragged, last) = ui.data(|d| (d.get_temp::(tool_drag_doc_id()).is_some(), d.get_temp::(id))); + ui.data_mut(|d| d.insert_temp(id, m)); + dragged && last.is_some_and(|l| l != m) +} + /// The pen pressure (0..1) of the press in progress: the force of this frame's pen or touch /// input, else the pressure in the host's feed while a pen is the pointer that moved last /// ([`crate::Services::stylus`]: [`StylusFeed::press`] for a new press, [`StylusFeed::held`] diff --git a/crates/ui-egui/src/canvas/input.rs b/crates/ui-egui/src/canvas/input.rs index e254e83134..223c24d1fa 100644 --- a/crates/ui-egui/src/canvas/input.rs +++ b/crates/ui-egui/src/canvas/input.rs @@ -1,7 +1,7 @@ use super::artboards::{artboard_name_at, begin_artboard_name_edit, name_press_id, select_named_artboard}; use super::drag::{ HoverContext, apply_requests, dispatch, drag_art_out, drag_id, drag_layer_id, drag_pos_id, drop_press, mods, on_canvas, pen_pressure, - tool_drag_doc_id, tool_drag_moved, tool_frame_moves, tool_holds, tool_press_doc_id, + tool_drag_doc_id, tool_drag_mods_changed, tool_drag_moved, tool_frame_moves, tool_holds, tool_press_doc_id, }; use super::view::{ HOLD_DELAY, HOLD_ZOOM, SCRUB_SLOP, SCRUB_ZOOM, WheelTurn, animated_zoom, pan_pixels, rotate_about, scroll_view, touch_gestures, trackpad_turn, @@ -361,7 +361,8 @@ fn drag_held(app: &mut VectorcraftApp, ui: &Ui, f: &Pointing, d: Drag, p: Pos2) // the last position only, so a costly drag preview runs once a frame. let moves = tool_frame_moves(ui, app); // A frame whose pointer ends where the last one did still moved in between. - if tool_drag_moved(ui, &xf, p, pointer) || !moves.is_empty() { + let mods_changed = tool_drag_mods_changed(ui, mods(m, space)); + if tool_drag_moved(ui, &xf, p, pointer) || mods_changed || !moves.is_empty() { for (at, force) in moves { let pressure = force.unwrap_or_else(|| pen_pressure(ui, app, false)); dispatch(app, &PointerEvent { kind: PointerKind::Drag, pos: xf.to_doc(at), mods: mods(m, space), pressure }, view); diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 721094bd31..0c238693b4 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -6054,6 +6054,43 @@ fn tool_drag_moved_without_pointer_delta() { assert!(moved, "a new document position runs even when egui reports no delta"); } +/// #4711: Shift pressed and released while a corner handle is held still scales proportionally and +/// then freely again at once, without waiting for the pointer to move. +#[test] +fn a_modifier_changed_mid_scale_applies_with_the_pointer_held_still() { + use egui::{Event, Modifiers}; + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); + app.ui.view.smart_guides = false; + app.ui.view.snap_to_point = false; + let id = app.session.execute("shape.rectangle", &json!({"x": 100, "y": 100, "width": 100, "height": 50})).unwrap()["id"].as_u64().unwrap(); + app.select_tool("selection"); + let ctx = egui::Context::default(); + frame(&mut app, &ctx, vec![]); + let xf = Xf::new(app.canvas_rect.unwrap(), app.view().unwrap()); + let with = |app: &mut VectorcraftApp, mut events: Vec, modifiers: Modifiers| { + events.insert(0, Event::ModifiersChanged(modifiers)); + let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0))), events, ..Default::default() }; + let mut out = ctx.run_ui(raw, |ui| show(app, ui)); + out.textures_delta.clear(); + }; + let button = |pos, pressed| Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Modifiers::NONE }; + let height = + |app: &VectorcraftApp| app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(id)).unwrap().geometric_bounds().unwrap().height(); + let corner = xf.to_screen(Point::new(200.0, 150.0)); + let to = xf.to_screen(Point::new(300.0, 150.0)); + with(&mut app, vec![Event::PointerMoved(corner)], Modifiers::NONE); + with(&mut app, vec![button(corner, true)], Modifiers::NONE); + with(&mut app, vec![Event::PointerMoved(to)], Modifiers::NONE); + assert!((height(&app) - 50.0).abs() < 1e-6, "a free scale keeps the height: {}", height(&app)); + with(&mut app, vec![], Modifiers::SHIFT); + assert!((height(&app) - 100.0).abs() < 1e-6, "Shift scales proportionally at once: {}", height(&app)); + with(&mut app, vec![], Modifiers::NONE); + assert!((height(&app) - 50.0).abs() < 1e-6, "releasing Shift frees it at once: {}", height(&app)); + with(&mut app, vec![button(to, false)], Modifiers::NONE); + assert!(app.session.active().unwrap().interaction.is_none(), "committed"); +} + /// #834 review: a press held still is not a drag. Before the press has dragged, the first held /// frame without a delta at the press's own position sends nothing, so a click stays a click; /// the first move after it does. From ebc5b7038c58c7579da4326bcab2b4b2bd76c567 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 30 Oct 2026 23:51:56 +0700 Subject: [PATCH 062/227] =?UTF-8?q?Add-ons:=20Color=20Effects=20=E2=80=94?= =?UTF-8?q?=20Duotone=20effect=20and=20Print=20Ink=20Fixes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Effect › Color Effects › Duotone… (addon.color.duotone, also in Object › Plug-ins › Color Effects) prints the grey-equivalent tone of each colour with one to four inks, each with its own tone curve. It is a colour adjustment like the add-on's others, so it stacks with them and works as a filter through addon.color.filter. - One tone of a swatch the document has gives a tint of that swatch, linked, so a spot tone separates onto its plate; several tones give the CMYK mix of their tints (the inks overprint, so they multiply). - Colour adjustments now map paints with their swatch links (ColorMap::apply_link); the existing adjustments behave as before. - Skip Objects with Spot Colors leaves spot-linked colours as they are. - The dialog has a row per tone and the picked tone's curve (the Curves graph, reused), its points and Reset to Linear / Inverse. Print Ink Fixes (addon.color.printFixes, Object › Plug-ins › Color Effects › Print Ink Fixes…) scales CMYK colours over a total ink limit down to it, removes white overprint and sets black overprint (Overprint Black's logic) in a CMYK document, as one undo step, and reports what changed. RGB documents are refused. The panel opens both under Inks. Deferred: an opaque undercoat, tones for type only, extra gradient stops for smoother tints, curve flip and all-100 % buttons. --- crates/effects/src/addons.rs | 3 + crates/effects/src/addons/color.rs | 14 +- crates/effects/src/addons/duotone.rs | 178 ++++++++++++++++++ crates/effects/src/addons/duotone/tests.rs | 128 +++++++++++++ crates/effects/src/adjust.rs | 109 ++++++++--- crates/engine/src/cmd/addons/color.rs | 29 ++- .../src/cmd/addons/color/print_fixes.rs | 170 +++++++++++++++++ .../src/cmd/addons/color/print_fixes/tests.rs | 129 +++++++++++++ crates/engine/src/cmd/addons/color/tests.rs | 76 ++++++++ crates/engine/src/cmd/colorcmds.rs | 6 + crates/engine/tests/command_sweep.rs | 16 ++ crates/render/src/fx/renderer.rs | 13 +- crates/ui-egui/src/addons/color.rs | 36 +++- crates/ui-egui/src/addons/color/tests.rs | 57 +++++- crates/ui-egui/src/dialogs.rs | 1 + crates/ui-egui/src/dialogs/command.rs | 1 + crates/ui-egui/src/dialogs/duotone.rs | 123 ++++++++++++ crates/ui-egui/src/dialogs/effect.rs | 33 ++-- crates/ui-egui/src/i18n/bg.tsv | 23 +++ crates/ui-egui/src/i18n/ca.tsv | 23 +++ crates/ui-egui/src/i18n/cs.tsv | 23 +++ crates/ui-egui/src/i18n/da.tsv | 23 +++ crates/ui-egui/src/i18n/de.tsv | 23 +++ crates/ui-egui/src/i18n/el.tsv | 23 +++ crates/ui-egui/src/i18n/es.tsv | 23 +++ crates/ui-egui/src/i18n/fi.tsv | 23 +++ crates/ui-egui/src/i18n/fr.tsv | 23 +++ crates/ui-egui/src/i18n/hu.tsv | 23 +++ crates/ui-egui/src/i18n/id.tsv | 23 +++ crates/ui-egui/src/i18n/it.tsv | 23 +++ crates/ui-egui/src/i18n/ja.tsv | 23 +++ crates/ui-egui/src/i18n/ka.tsv | 23 +++ crates/ui-egui/src/i18n/ko.tsv | 23 +++ crates/ui-egui/src/i18n/nl.tsv | 23 +++ crates/ui-egui/src/i18n/pl.tsv | 23 +++ crates/ui-egui/src/i18n/pt-br.tsv | 23 +++ crates/ui-egui/src/i18n/ru.tsv | 23 +++ crates/ui-egui/src/i18n/sv.tsv | 23 +++ crates/ui-egui/src/i18n/tr.tsv | 23 +++ crates/ui-egui/src/i18n/uk.tsv | 23 +++ crates/ui-egui/src/i18n/vi.tsv | 23 +++ crates/ui-egui/src/i18n/zh-hans.tsv | 23 +++ crates/ui-egui/src/i18n/zh-hant.tsv | 23 +++ docs/mcp.md | 57 ++++++ docs/target-app-parity.md | 15 +- docs/ui-parity.md | 5 +- 46 files changed, 1709 insertions(+), 65 deletions(-) create mode 100644 crates/effects/src/addons/duotone.rs create mode 100644 crates/effects/src/addons/duotone/tests.rs create mode 100644 crates/engine/src/cmd/addons/color/print_fixes.rs create mode 100644 crates/engine/src/cmd/addons/color/print_fixes/tests.rs create mode 100644 crates/ui-egui/src/dialogs/duotone.rs diff --git a/crates/effects/src/addons.rs b/crates/effects/src/addons.rs index d1ba0783d6..e02c4b22c3 100644 --- a/crates/effects/src/addons.rs +++ b/crates/effects/src/addons.rs @@ -2,8 +2,11 @@ //! //! - [`color`]: Color Effects' live Exposure, Desaturate and Invert Colors, colour adjustments //! evaluated with the others ([`crate::adjust`]). +//! - [`duotone`]: Color Effects' live Duotone, a colour adjustment that prints each colour's tone +//! with one to four inks. //! - [`halftone`]: Color Effects' live Vector Halftone, and the screens Object › Vector Halftone //! builds its dots with. pub mod color; +pub mod duotone; pub mod halftone; diff --git a/crates/effects/src/addons/color.rs b/crates/effects/src/addons/color.rs index 2d5ebea919..07627dd8d7 100644 --- a/crates/effects/src/addons/color.rs +++ b/crates/effects/src/addons/color.rs @@ -1,6 +1,6 @@ -//! Color Effects (a built-in add-on): live Exposure, Desaturate and Invert Colors, in Effect › Color -//! Effects. They are colour adjustments ([`crate::is_adjustment`]): they recolour what an object -//! paints as the others do, in stack order with them. +//! Color Effects (a built-in add-on): live Exposure, Desaturate, Duotone and Invert Colors, in +//! Effect › Color Effects. They are colour adjustments ([`crate::is_adjustment`]): they recolour what +//! an object paints as the others do, in stack order with them. use serde_json::{Value, json}; @@ -13,9 +13,10 @@ pub const EXPOSURE: &str = "addon.color.exposure"; pub const DESATURATE: &str = "addon.color.desaturate"; /// Invert Colors: every colour to its RGB inverse. pub const INVERT: &str = "addon.color.invert"; +pub use super::duotone::DUOTONE; /// The add-on's effects, in menu order. -pub const EFFECTS: [&str; 3] = [DESATURATE, EXPOSURE, INVERT]; +pub const EFFECTS: [&str; 4] = [DESATURATE, DUOTONE, EXPOSURE, INVERT]; /// Is `id` one of the add-on's effects? pub fn is_color_effect(id: &str) -> bool { @@ -28,6 +29,7 @@ pub(crate) fn catalog() -> Vec { let e = |id, label, params, defaults| EffectInfo { id, label, menu: MENU, params, defaults, raster: false, lengths: Lengths::default() }; vec![ e(DESATURATE, "Desaturate", "{} turns every colour the object paints to the grey of its lightness (each colour keeps its model)", json!({})), + e(DUOTONE, "Duotone…", super::duotone::PARAMS, super::duotone::defaults()), e( EXPOSURE, "Exposure…", @@ -49,6 +51,8 @@ pub(crate) enum Adjust { }, Desaturate, Invert, + /// Duotone ([`super::duotone`]). + Duotone(super::duotone::Duotone), } impl Adjust { @@ -61,6 +65,7 @@ impl Adjust { }, DESATURATE => Adjust::Desaturate, INVERT => Adjust::Invert, + DUOTONE => Adjust::Duotone(super::duotone::Duotone::parse(p)?), _ => return None, }) } @@ -73,6 +78,7 @@ impl Adjust { [(r.max(g).max(b) + r.min(g).min(b)) / 2.0; 3] } Adjust::Invert => rgb.map(|v| 1.0 - v), + Adjust::Duotone(d) => d.apply_rgb(rgb), } } } diff --git a/crates/effects/src/addons/duotone.rs b/crates/effects/src/addons/duotone.rs new file mode 100644 index 0000000000..c4febd8658 --- /dev/null +++ b/crates/effects/src/addons/duotone.rs @@ -0,0 +1,178 @@ +//! Color Effects' Duotone (Effect › Color Effects › Duotone…), a colour adjustment: the +//! grey-equivalent tone of each colour an object paints is printed with one to four inks (a +//! monotone, duotone, tritone or quadtone). Each ink, a tone, is a colour, typically a spot swatch, +//! with its own curve from the tone's tint to the ink's. The inks overprint, so their tints +//! multiply. +//! +//! With one tone of a swatch, a colour becomes a tint of that swatch, linked to it, so a spot tone +//! separates onto its plate. With several tones it becomes the CMYK mix of their tints: a colour +//! links to one swatch at one tint, and a mix of several spot inks has no swatch to link to. + +use std::collections::HashMap; +use std::sync::Arc; + +use serde_json::{Value, json}; +use vectorcraft_doc::Document; +use vectorcraft_doc::color::{Color, cms::Model}; + +use crate::adjust::{LUT, curve_at, curve_points_on, lookup, sample}; +use crate::raster::color_param; +use crate::util::flag; + +/// Duotone (Effect › Color Effects › Duotone…). +pub const DUOTONE: &str = "addon.color.duotone"; + +/// Most tones Duotone reads (a quadtone): any past them are left out. +pub const MAX_TONES: usize = 4; + +/// Most points a tone's curve reads: any past them are left out. +pub const MAX_CURVE_POINTS: usize = 64; + +/// The parameters' description (`effect.apply`). +pub(crate) const PARAMS: &str = "{tones: [{color: \"#rrggbb\" or a colour object, swatch?: a global or spot swatch's name (with the swatch's colour as `color`), curve?: \"tint,ink tint,ink …\" or [[tint, ink], …] (0..100, at most 64 points; \"0,0 100,100\"), active?: true}] (up to four inks, overprinting; any past four are left out), skipSpot?: false (colours linked to a spot swatch keep their colour)} prints the grey-equivalent tone of each colour the object paints with the inks, each at the tint its curve gives for the tone's: with one tone of a swatch, as a tint of that swatch (a spot tone prints on its own plate); with several, as the CMYK mix of their tints"; + +/// The dialog's defaults: one black tone, its curve linear. +pub(crate) fn defaults() -> Value { + json!({"tones": [{"color": "#000000", "curve": "0,0 100,100", "active": true}], "skipSpot": false}) +} + +/// Whether swatch `name` of the document is a spot colour: `Some(false)` for a global process +/// swatch, `None` when the document has no global swatch of that name. +pub type SwatchKinds<'a> = dyn Fn(&str) -> Option + 'a; + +/// [`SwatchKinds`] of `d`'s swatch `name`. +pub fn swatch_kind(d: &Document, name: &str) -> Option { + d.swatches_iter().find(|w| w.global && w.name == name).map(|w| w.spot) +} + +/// [`swatch_kind`] of each of `d`'s global swatches. +pub fn swatch_kinds(d: &Document) -> HashMap { + d.swatches_iter().filter(|w| w.global).map(|w| (w.name.clone(), w.spot)).collect() +} + +/// A tone's curve points (0..1 each) from its `curve` (0..100). +pub fn tone_curve_points(v: Option<&Value>) -> Vec<(f32, f32)> { + curve_points_on(v, 100.0, MAX_CURVE_POINTS) +} + +/// One ink. +#[derive(Clone, Debug, PartialEq)] +struct Tone { + color: Color, + /// `color` as CMYK inks, which several tones mix in. + cmyk: [f32; 4], + /// The swatch the colour is of, if any. + swatch: Option, + /// Its curve, sampled: the tone's tint → the ink's. + curve: Arc<[f32]>, +} + +/// Duotone's tones and options, its parameters read. +#[derive(Clone, Debug, PartialEq)] +pub struct Duotone { + tones: Vec, + skip_spot: bool, + /// The display colour at each sampled tint, for pixels. + rgb: Arc<[[f32; 3]]>, +} + +impl Duotone { + /// `None` without an active tone (the effect then leaves the colours as they are). + pub(crate) fn parse(p: &Value) -> Option { + let tones: Vec = p + .get("tones") + .and_then(Value::as_array) + .into_iter() + .flatten() + .take(MAX_TONES) + .filter(|t| t.is_object() && flag(t, "active", true)) + .map(|t| { + let color = finite(color_param(t, Color::BLACK)); + let cmyk = match color.in_model(Model::Cmyk) { + Color::Cmyk { c, m, y, k } => [c, m, y, k].map(|v| if v.is_finite() { v.clamp(0.0, 1.0) } else { 0.0 }), + _ => [0.0, 0.0, 0.0, 1.0], + }; + let pts = tone_curve_points(t.get("curve")); + let swatch = t.get("swatch").and_then(Value::as_str).filter(|s| !s.is_empty()).map(str::to_string); + Tone { color, cmyk, swatch, curve: sample(|x| curve_at(&pts, x)) } + }) + .collect(); + if tones.is_empty() { + return None; + } + let mut d = Duotone { tones, skip_spot: flag(p, "skipSpot", false), rgb: Arc::new([]) }; + d.rgb = (0..LUT).map(|i| d.mix(i as f32 / (LUT - 1) as f32).to_rgb()).collect(); + Some(d) + } + + /// The inks' colour for tone `t` (0 = white, 1 = black): one tone's colour at its tint, or + /// several tones' CMYK tints overprinted (each ink lets through what the others leave). + fn mix(&self, t: f32) -> Color { + if let [one] = self.tones.as_slice() { + return one.color.tinted(lookup(&one.curve, t)); + } + let mut paper = [1.0f32; 4]; + for tone in &self.tones { + let k = lookup(&tone.curve, t); + for (p, ink) in paper.iter_mut().zip(tone.cmyk) { + *p *= 1.0 - ink * k; + } + } + let [c, m, y, k] = paper.map(|p| 1.0 - p); + Color::cmyk(c, m, y, k) + } + + /// Display components 0..1 through the effect. + pub(crate) fn apply_rgb(&self, rgb: [f32; 3]) -> [f32; 3] { + let x = tone(rgb) * (LUT - 1) as f32; + let i = (x.floor() as usize).min(LUT - 2); + let f = x - i as f32; + match (self.rgb.get(i), self.rgb.get(i + 1)) { + (Some(a), Some(b)) => std::array::from_fn(|k| a[k] + (b[k] - a[k]) * f), + _ => rgb, + } + } + + /// A colour with its swatch link and tint through the effect ([`crate::ColorMap::apply_link`]): + /// true when it changed. With `skipSpot`, a colour linked to a spot swatch stays. + pub(crate) fn map_link(&self, c: &mut Color, link: &mut Option, tint: &mut f32, swatches: &SwatchKinds) -> bool { + if self.skip_spot && link.as_deref().and_then(swatches) == Some(true) { + return false; + } + let t = tone(c.to_rgb()); + let new = self.mix(t); + let (new_link, new_tint) = match self.tones.as_slice() { + [one] => match one.swatch.as_ref().filter(|n| swatches(n).is_some()) { + Some(name) => (Some(name.clone()), lookup(&one.curve, t)), + None => (None, 1.0), + }, + _ => (None, 1.0), + }; + if new == *c && new_link == *link && new_tint == *tint { + return false; + } + (*c, *link, *tint) = (new, new_link, new_tint); + true + } +} + +/// The grey-equivalent tone of display colour `rgb`: 0 for white, 1 for black (its luma, as +/// Convert to Grayscale reads it, so a grey's tone is its ink). +fn tone([r, g, b]: [f32; 3]) -> f32 { + let t = 1.0 - (0.299 * r + 0.587 * g + 0.114 * b); + if t.is_finite() { t.clamp(0.0, 1.0) } else { 0.0 } +} + +/// `c` with its components finite and in range. +fn finite(c: Color) -> Color { + let v = |x: f32, lo: f32, hi: f32| if x.is_finite() { x.clamp(lo, hi) } else { lo }; + match c { + Color::Rgb { r, g, b } => Color::rgb(v(r, 0.0, 1.0), v(g, 0.0, 1.0), v(b, 0.0, 1.0)), + Color::Cmyk { c, m, y, k } => Color::cmyk(v(c, 0.0, 1.0), v(m, 0.0, 1.0), v(y, 0.0, 1.0), v(k, 0.0, 1.0)), + Color::Gray { k } => Color::gray(v(k, 0.0, 1.0)), + Color::Lab { l, a, b } => Color::lab(v(l, 0.0, 100.0), v(a, -128.0, 127.0), v(b, -128.0, 127.0)), + } +} + +#[cfg(test)] +mod tests; diff --git a/crates/effects/src/addons/duotone/tests.rs b/crates/effects/src/addons/duotone/tests.rs new file mode 100644 index 0000000000..8a3255b054 --- /dev/null +++ b/crates/effects/src/addons/duotone/tests.rs @@ -0,0 +1,128 @@ +use serde_json::{Value, json}; +use vectorcraft_doc::Effect; +use vectorcraft_doc::color::Color; + +use super::*; +use crate::{ColorMap, color_map}; + +fn map(params: Value) -> ColorMap { + color_map(&[Effect { id: DUOTONE.into(), params, visible: true }]).unwrap() +} + +/// `c` with link `link` through `m`, the document having spot swatch "Ink" and process swatch +/// "Blue": (colour, link, tint, changed). +fn linked(m: &ColorMap, c: Color, link: Option<&str>) -> (Color, Option, f32, bool) { + let (mut c, mut link, mut tint) = (c, link.map(str::to_string), 1.0); + let kinds = |n: &str| match n { + "Ink" => Some(true), + "Blue" => Some(false), + _ => None, + }; + let changed = m.apply_link(&mut c, &mut link, &mut tint, &kinds); + (c, link, tint, changed) +} + +fn close(a: f32, b: f32) -> bool { + (a - b).abs() < 0.01 +} + +fn looks(c: Color, rgb: [f32; 3]) -> bool { + c.to_rgb().iter().zip(rgb).all(|(a, b)| close(*a, b)) +} + +const INK: Color = Color::Cmyk { c: 0.0, m: 0.5, y: 1.0, k: 0.0 }; + +fn ink_tone(curve: &str) -> Value { + json!({"tones": [{"color": INK, "swatch": "Ink", "curve": curve}]}) +} + +#[test] +fn a_spot_tone_turns_greys_into_tints_of_its_swatch() { + let m = map(ink_tone("0,0 100,100")); + for k in [0.0, 0.25, 0.6, 1.0] { + let (c, link, tint, _) = linked(&m, Color::gray(k), None); + assert_eq!(link.as_deref(), Some("Ink"), "linked at {k}"); + assert!(close(tint, k), "the tint is the grey's ink: {k} → {tint}"); + assert_eq!(c, INK.tinted(tint), "its colour is the swatch's at that tint"); + } + // A colour reads as its grey equivalent: white is no ink. + let (_, _, tint, _) = linked(&m, Color::rgb(1.0, 1.0, 1.0), None); + assert!(close(tint, 0.0)); + // A swatch the document hasn't: an unlinked tint of the tone's colour. + let (c, link, ..) = linked(&map(json!({"tones": [{"color": INK, "swatch": "Gone"}]})), Color::gray(0.5), None); + assert!(link.is_none() && looks(c, INK.tinted(0.5).to_rgb())); + // Without the links, colours (mesh points) take the tone's colour too. + assert!(looks(m.apply(Color::gray(0.5)), INK.tinted(0.5).to_rgb())); +} + +#[test] +fn the_curve_changes_the_mapping() { + // Inverse: dark greys get little ink. + let (_, _, tint, _) = linked(&map(ink_tone("0,100 100,0")), Color::gray(0.8), None); + assert!(close(tint, 0.2), "{tint}"); + // Through its points exactly, flat past its ends. + let lifted = map(ink_tone("0,0 50,80 100,100")); + assert!(close(linked(&lifted, Color::gray(0.5), None).2, 0.8)); + assert!(close(linked(&map(ink_tone("20,0 80,100")), Color::gray(0.1), None).2, 0.0)); + // Unreadable or missing curves are linear; points past the cap are left out. + for curve in [json!("junk"), json!(null), json!([[0, 0]])] { + let p = json!({"tones": [{"color": INK, "swatch": "Ink", "curve": curve}]}); + assert!(close(linked(&map(p), Color::gray(0.3), None).2, 0.3), "{curve}"); + } + let many: Vec<[f64; 2]> = (0..200).map(|i| [f64::from(i) / 2.0, 100.0 - f64::from(i) / 2.0]).collect(); + assert_eq!(tone_curve_points(Some(&json!(many))).len(), MAX_CURVE_POINTS); +} + +#[test] +fn several_tones_multiply_as_cmyk_inks() { + let cyan = json!({"color": {"model": "cmyk", "c": 1.0, "m": 0.0, "y": 0.0, "k": 0.0}, "swatch": "Ink"}); + let half_black = json!({"color": {"model": "cmyk", "c": 0.6, "m": 0.0, "y": 0.0, "k": 1.0}, "curve": "0,0 100,50"}); + let m = map(json!({"tones": [cyan, half_black]})); + let (c, link, tint, changed) = linked(&m, Color::gray(1.0), Some("Ink")); + assert!(changed && link.is_none() && tint == 1.0, "a process mix, unlinked"); + // Cyan 100% over the second ink at 50% (60% cyan, 100% black at half): cyan 1-(1-1)(1-0.3). + let Color::Cmyk { c, m: mg, y, k } = c else { panic!("CMYK: {c:?}") }; + assert!(close(c, 1.0) && close(mg, 0.0) && close(y, 0.0) && close(k, 0.5), "{c} {mg} {y} {k}"); + let (mid, ..) = linked(&m, Color::gray(0.5), None); + let Color::Cmyk { c, k, .. } = mid else { panic!("CMYK") }; + // Cyan 50% over the second ink at 25% (15% cyan, 25% black): 1 - 0.5 * 0.85 = 0.575. + assert!(close(c, 0.575) && close(k, 0.25), "{c} {k}"); + // Inactive tones and tones past the fourth don't count; none active leaves the colours. + let one = json!({"color": "#000000"}); + let off = json!({"color": "#ff0000", "active": false}); + let only_black = map(json!({"tones": [one, off, off, off, {"color": "#ff0000"}]})); + assert!(looks(only_black.apply(Color::gray(0.4)), [0.6; 3])); + assert!(color_map(&[Effect { id: DUOTONE.into(), params: json!({"tones": [off]}), visible: true }]).is_none()); + assert!(color_map(&[Effect { id: DUOTONE.into(), params: json!({"tones": "x"}), visible: true }]).is_none()); +} + +#[test] +fn skip_spot_keeps_spot_colours() { + let mut p = json!({"tones": [{"color": "#000000"}], "skipSpot": true}); + let m = map(p.clone()); + let spot = Color::cmyk(0.0, 1.0, 0.0, 0.0); + assert_eq!(linked(&m, spot, Some("Ink")), (spot, Some("Ink".to_string()), 1.0, false)); + // A process swatch's colour, and an unlinked one, still change. + assert!(linked(&m, spot, Some("Blue")).3); + assert!(linked(&m, spot, None).3); + p["skipSpot"] = json!(false); + assert!(linked(&map(p), spot, Some("Ink")).3); +} + +#[test] +fn pixels_and_other_adjustments_compose() { + let m = map(json!({"tones": [{"color": "#ff0000"}]})); + // A grey pixel half way: half way to red from white. + let px = m.apply_rgb([0.5, 0.5, 0.5]); + assert!(close(px[0], 1.0) && close(px[1], 0.5) && close(px[2], 0.5), "{px:?}"); + // Invert, then Duotone: white becomes full red. + let both = color_map(&[ + Effect { id: crate::addons::color::INVERT.into(), params: json!({}), visible: true }, + Effect { id: DUOTONE.into(), params: json!({"tones": [{"color": "#ff0000"}]}), visible: true }, + ]) + .unwrap(); + assert!(looks(both.apply(Color::WHITE), [1.0, 0.0, 0.0])); + // Out of range colours are brought into range. + let wild = map(json!({"tones": [{"color": [1e30, -5, 0.5]}]})); + assert!(looks(wild.apply(Color::gray(1.0)), [1.0, 0.0, 0.5])); +} diff --git a/crates/effects/src/adjust.rs b/crates/effects/src/adjust.rs index 7350958cc3..93601680f0 100644 --- a/crates/effects/src/adjust.rs +++ b/crates/effects/src/adjust.rs @@ -14,9 +14,10 @@ use std::sync::Arc; use serde_json::Value; use vectorcraft_doc::color::{Color, Paint, keep_model}; -use vectorcraft_doc::recolor::{ColorVisitor, Reach, map_paint, recolor_node}; +use vectorcraft_doc::recolor::{ColorVisitor, Reach, map_links, recolor_node}; use vectorcraft_doc::{Document, Effect, Node, NodeKind}; +use crate::addons::duotone::{Duotone, SwatchKinds}; use crate::merged_params; use crate::raster::color_param; use crate::util::{flag, num, text}; @@ -72,7 +73,7 @@ pub fn is_channel(s: &str) -> bool { } /// Entries of a sampled tone curve. -const LUT: usize = 256; +pub(crate) const LUT: usize = 256; /// One adjustment, its parameters normalised. #[derive(Clone, Debug, PartialEq)] @@ -92,6 +93,16 @@ enum Adjust { Addon(crate::addons::color::Adjust), } +impl Adjust { + /// Duotone, which maps a colour with its swatch link ([`ColorMap::apply_link`]). + fn duotone(&self) -> Option<&Duotone> { + match self { + Adjust::Addon(crate::addons::color::Adjust::Duotone(d)) => Some(d), + _ => None, + } + } +} + /// The colour adjustments of an effect list, composed in order. #[derive(Clone, Debug, PartialEq)] pub struct ColorMap(Vec); @@ -104,17 +115,44 @@ impl ColorMap { /// Adjust display (sRGB) components 0..1. pub fn apply_rgb(&self, rgb: [f32; 3]) -> [f32; 3] { - self.0.iter().fold(rgb, |c, a| a.apply(c).map(|v| if v.is_finite() { v.clamp(0.0, 1.0) } else { 0.0 })) + apply_rgb(&self.0, rgb) } /// Adjust a colour, keeping its colour model (unchanged when the adjustments leave it as is). + /// Duotone gives its inks' colour instead ([`Duotone`]). pub fn apply(&self, c: Color) -> Color { - let rgb = c.to_rgb(); - let out = self.apply_rgb(rgb); - if out.iter().zip(rgb).all(|(a, b)| (a - b).abs() < 1e-6) { - return c; + let (mut c, mut link, mut tint) = (c, None, 1.0); + self.apply_link(&mut c, &mut link, &mut tint, &|_| None); + c + } + + /// Adjust a colour with its swatch link and tint (`link`, `tint`), as a paint holds them; + /// true when it changed. A colour that changes loses its link, except that Duotone with one + /// tone of a swatch the document has (`swatches`, [`SwatchKinds`]) links it to that swatch at + /// the tone's tint. The adjustments between Duotones work in display RGB, each run keeping + /// the colour's model. + pub fn apply_link(&self, c: &mut Color, link: &mut Option, tint: &mut f32, swatches: &SwatchKinds) -> bool { + let mut changed = false; + let mut rest: &[Adjust] = &self.0; + while !rest.is_empty() { + let (run, after) = rest.split_at(rest.iter().position(|a| a.duotone().is_some()).unwrap_or(rest.len())); + if !run.is_empty() { + let rgb = c.to_rgb(); + let out = apply_rgb(run, rgb); + if !out.iter().zip(rgb).all(|(a, b)| (a - b).abs() < 1e-6) { + *c = keep_model(*c, Color::rgb(out[0], out[1], out[2])); + *link = None; + *tint = 1.0; + changed = true; + } + } + let Some((duotone, tail)) = after.split_first() else { break }; + if let Some(d) = duotone.duotone() { + changed |= d.map_link(c, link, tint, swatches); + } + rest = tail; } - keep_model(c, Color::rgb(out[0], out[1], out[2])) + changed } /// Adjust an 8-bit sRGB pixel. @@ -124,6 +162,11 @@ impl ColorMap { } } +/// Display (sRGB) components 0..1 through `adjustments`, in order. +fn apply_rgb(adjustments: &[Adjust], rgb: [f32; 3]) -> [f32; 3] { + adjustments.iter().fold(rgb, |c, a| a.apply(c).map(|v| if v.is_finite() { v.clamp(0.0, 1.0) } else { 0.0 })) +} + /// The visible colour adjustments of `effects` as one map, `None` when there are none. pub fn color_map(effects: &[Effect]) -> Option { let v: Vec = @@ -233,12 +276,12 @@ impl Adjust { } /// `f` sampled at [`LUT`] inputs 0..1. -fn sample(f: impl Fn(f32) -> f32) -> Arc<[f32]> { +pub(crate) fn sample(f: impl Fn(f32) -> f32) -> Arc<[f32]> { (0..LUT).map(|i| f(i as f32 / (LUT - 1) as f32).clamp(0.0, 1.0)).collect() } /// The tone curve `lut` at `v` (linear between samples). -fn lookup(lut: &[f32], v: f32) -> f32 { +pub(crate) fn lookup(lut: &[f32], v: f32) -> f32 { let x = v.clamp(0.0, 1.0) * (LUT - 1) as f32; let i = (x.floor() as usize).min(LUT - 2); let (a, b) = (lut.get(i).copied().unwrap_or(v), lut.get(i + 1).copied().unwrap_or(v)); @@ -248,6 +291,12 @@ fn lookup(lut: &[f32], v: f32) -> f32 { /// Curves' points (0..1 each, sorted by input, one per input) from its `points` parameter: /// `"x,y x,y …"` or `[[x, y], …]` in 0..255. Missing or unreadable points give the identity line. pub fn curve_points(v: Option<&Value>) -> Vec<(f32, f32)> { + // At most a point per level is meaningful. + curve_points_on(v, 255.0, 256) +} + +/// [`curve_points`] on a scale of 0..`max`, reading at most `cap` points. +pub fn curve_points_on(v: Option<&Value>, max: f64, cap: usize) -> Vec<(f32, f32)> { let mut pts: Vec<(f64, f64)> = match v { Some(Value::String(s)) => s .split(|c: char| c.is_whitespace() || c == ';') @@ -260,10 +309,9 @@ pub fn curve_points(v: Option<&Value>) -> Vec<(f32, f32)> { _ => vec![], }; pts.retain(|(x, y)| x.is_finite() && y.is_finite()); - // At most a point per level is meaningful. - pts.truncate(256); - let mut pts: Vec<(f32, f32)> = - pts.into_iter().map(|(x, y)| ((x.clamp(0.0, 255.0) / 255.0) as f32, (y.clamp(0.0, 255.0) / 255.0) as f32)).collect(); + pts.truncate(cap); + let unit = |v: f64| (v.clamp(0.0, max) / max) as f32; + let mut pts: Vec<(f32, f32)> = pts.into_iter().map(|(x, y)| (unit(x), unit(y))).collect(); pts.sort_by(|a, b| a.0.total_cmp(&b.0)); pts.dedup_by(|a, b| (a.0 - b.0).abs() < 1e-6); if pts.len() < 2 { @@ -357,15 +405,22 @@ fn from_hsl([h, s, l]: [f32; 3]) -> [f32; 3] { /// Gives the key of an embedded image recoloured by a map (`None`: leave it as it is). pub type ImageHook<'a> = dyn FnMut(&str, &ColorMap) -> Option + 'a; -/// The live visitor: every colour through `map`, embedded images through the hook. +/// The live visitor: every colour through `map` (paints with their swatch links, the document's +/// swatches being `swatches`), embedded images through the hook. struct Live<'a, 'b> { map: &'a ColorMap, + swatches: &'a SwatchKinds<'b>, images: &'a mut ImageHook<'b>, } +/// `p`'s colours through `map` with their swatch links ([`ColorMap::apply_link`]). +fn map_paint(p: &mut Paint, map: &ColorMap, swatches: &SwatchKinds) -> bool { + map_links(p, &|c, link, tint| map.apply_link(c, link, tint, swatches)) +} + impl ColorVisitor for Live<'_, '_> { fn paint(&mut self, p: &mut Paint) -> bool { - map_paint(p, &|c| self.map.apply(c)) + map_paint(p, self.map, self.swatches) } fn color(&mut self, c: Color) -> Color { self.map.apply(c) @@ -378,12 +433,13 @@ impl ColorVisitor for Live<'_, '_> { /// `n` with the colour adjustments in it applied, `None` when it has none: its members' first, /// then those of its fills and strokes on their paints, then its own followed by `outer` (the /// adjustments of an object `n` is the art of) on everything it paints. The adjustment effects -/// are gone from the result; embedded images take the keys `images` gives. -pub fn adjust(n: &Node, outer: Option<&ColorMap>, images: &mut ImageHook<'_>) -> Option { +/// are gone from the result; embedded images take the keys `images` gives. `swatches` tells the +/// document's global and spot swatches apart ([`crate::addons::duotone::swatch_kind`]). +pub fn adjust(n: &Node, outer: Option<&ColorMap>, swatches: &SwatchKinds, images: &mut ImageHook<'_>) -> Option { let mut m: Option = None; if let Some(ch) = n.children() { for (i, c) in ch.iter().enumerate() { - if let Some(new) = adjust(c, None, images) + if let Some(new) = adjust(c, None, swatches, images) && let Some(slot) = m.get_or_insert_with(|| n.clone()).children_mut().and_then(|ch| ch.get_mut(i)) { *slot = Arc::new(new); @@ -394,7 +450,7 @@ pub fn adjust(n: &Node, outer: Option<&ColorMap>, images: &mut ImageHook<'_>) -> if let Some(map) = color_map(item.effects()) && let Some(it) = m.get_or_insert_with(|| n.clone()).appearance.items.get_mut(i) { - map_paint(it.paint_mut(), &|c| map.apply(c)); + map_paint(it.paint_mut(), &map, swatches); it.effects_mut().retain(|e| !is_adjustment(&e.id)); } } @@ -406,7 +462,7 @@ pub fn adjust(n: &Node, outer: Option<&ColorMap>, images: &mut ImageHook<'_>) -> if let Some(map) = map { let mm = m.get_or_insert_with(|| n.clone()); mm.appearance.effects.retain(|e| !is_adjustment(&e.id)); - recolor_node(mm, Reach::ALL, &mut Live { map: &map, images }); + recolor_node(mm, Reach::ALL, &mut Live { map: &map, swatches, images }); } m } @@ -423,13 +479,14 @@ pub fn adjust_in_document(d: &mut Document, n: &Node) -> Option { } _ => n, }; + let kinds = crate::addons::duotone::swatch_kinds(d); let mut hook = |key: &str, map: &ColorMap| -> Option { let blob = d.images.get(key)?.map_rgb(|rgb| map.apply_rgb8(rgb))?; let k = blob.content_key(); d.images.entry(k.clone()).or_insert(blob); Some(k) }; - adjust(src, None, &mut hook) + adjust(src, None, &|name| kinds.get(name).copied(), &mut hook) } #[cfg(test)] @@ -492,17 +549,17 @@ mod tests { let mut g = Node::group(NodeId(1), vec![leaf(2), leaf(3)]); g.appearance.effects.push(Effect { id: "adjust.hueSaturation".into(), params: json!({"hue": 120}), visible: true }); assert!(has_adjustment(&g)); - let out = adjust(&g, None, &mut |_, _| None).unwrap(); + let out = adjust(&g, None, &|_| None, &mut |_, _| None).unwrap(); assert!(out.appearance.effects.is_empty()); for c in out.children().unwrap() { assert_eq!(c.appearance.fill_paint().color().unwrap().to_hex(), "#00ff00"); } // A hidden effect does nothing; a stroke's own effect recolours just that stroke. g.appearance.effects[0].visible = false; - assert!(!has_adjustment(&g) && adjust(&g, None, &mut |_, _| None).is_none()); + assert!(!has_adjustment(&g) && adjust(&g, None, &|_| None, &mut |_, _| None).is_none()); let mut p = Node::path(NodeId(5), shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 10.0)), Appearance::default_art()); p.appearance.items[1].effects_mut().push(Effect { id: "adjust.levels".into(), params: json!({"outputBlack": 255}), visible: true }); - let out = adjust(&p, None, &mut |_, _| None).unwrap(); + let out = adjust(&p, None, &|_| None, &mut |_, _| None).unwrap(); assert_eq!(out.appearance.items[1].paint().color().unwrap().to_hex(), "#ffffff"); assert_eq!(out.appearance.items[0].paint(), p.appearance.items[0].paint()); assert!(out.appearance.items[1].effects().is_empty()); @@ -517,7 +574,7 @@ mod tests { let fill = Appearance::basic(Paint::Gradient(Box::new(gp)), Paint::None, 0.0); let mut p = Node::path(NodeId(1), shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 10.0)), fill); p.appearance.effects.push(Effect { id: "adjust.hueSaturation".into(), params: json!({"hue": 120}), visible: true }); - let out = adjust(&p, None, &mut |_, _| None).unwrap(); + let out = adjust(&p, None, &|_| None, &mut |_, _| None).unwrap(); let Paint::Gradient(g) = out.appearance.fill_paint() else { panic!("a gradient fill") }; // The points are what a freeform gradient draws from, not its stops. let hexes: Vec = g.freeform.as_ref().unwrap().points.iter().map(|p| p.color.to_hex()).collect(); diff --git a/crates/engine/src/cmd/addons/color.rs b/crates/engine/src/cmd/addons/color.rs index 3ddbd8c446..4426624ccf 100644 --- a/crates/engine/src/cmd/addons/color.rs +++ b/crates/engine/src/cmd/addons/color.rs @@ -1,9 +1,11 @@ -//! Color Effects (`addon.color.*`), a built-in add-on: its live effects (Exposure, Desaturate and -//! Invert Colors, in Effect › Color Effects) are the effects crate's; here, Apply as Filter writes -//! any colour adjustment into the colours themselves, and Select by Color Kind selects the objects -//! that use spot colours, carry a live colour adjustment, or are images of a colour model. Its panel -//! and its submenu, Object › Plug-ins › Color Effects, are the UI's. +//! Color Effects (`addon.color.*`), a built-in add-on: its live effects (Exposure, Desaturate, +//! Duotone and Invert Colors, in Effect › Color Effects) are the effects crate's; here, Apply as +//! Filter writes any colour adjustment into the colours themselves, Select by Color Kind selects the +//! objects that use spot colours, carry a live colour adjustment, or are images of a colour model, +//! and Print Ink Fixes ([`print_fixes`]) prepares a CMYK document's inks for print. Its panel and +//! its submenu, Object › Plug-ins › Color Effects, are the UI's. +mod print_fixes; #[cfg(test)] mod tests; @@ -11,7 +13,7 @@ use serde_json::{Value, json}; use vectorcraft_doc::{Document, Node, NodeId, NodeKind}; use vectorcraft_render::effects; -use super::super::colorcmds::recolor; +use super::super::colorcmds::recolor_links; use super::super::select::walk_selectable; use super::super::{CommandSpec, bad, checked_ids_or_selection, cmd, has_doc, has_selection, text_param}; use crate::{Result, Session}; @@ -35,10 +37,19 @@ pub fn specs() -> Vec { "Apply as Filter", ["Object", "Plug-ins", "Color Effects"], None, - "{effect: a colour adjustment's effect id (adjust.brightnessContrast, adjust.curves, adjust.hueSaturation, adjust.levels, adjust.shiftToColor, adjust.temperatureTint, addon.color.exposure, addon.color.desaturate or addon.color.invert), params?: {…} (as effect.apply; missing keys take the dialog defaults), fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?: [id…] (default: the selection)} recolour the objects and everything inside them as the live effect would draw them, but in their colours, as edit.colors.invert does (fills, strokes, type, gradient meshes, embedded images and pattern tiles), as one undo step; their effects stay → {changed}", + "{effect: a colour adjustment's effect id (adjust.brightnessContrast, adjust.curves, adjust.hueSaturation, adjust.levels, adjust.shiftToColor, adjust.temperatureTint, addon.color.exposure, addon.color.desaturate, addon.color.duotone or addon.color.invert), params?: {…} (as effect.apply; missing keys take the dialog defaults), fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?: [id…] (default: the selection)} recolour the objects and everything inside them as the live effect would draw them, but in their colours, as edit.colors.invert does (fills, strokes, type, gradient meshes, embedded images and pattern tiles), as one undo step; their effects stay. Duotone links a colour to its one tone's swatch as the live effect does → {changed}", has_selection, filter ), + cmd!( + "addon.color.printFixes", + "Print Ink Fixes", + ["Object", "Plug-ins", "Color Effects"], + None, + "{scope?: \"selection\" (the selection, or `ids`; by default, the document while nothing is selected) | \"document\" (every layer), inkLimit?: total ink % 1..400 (0 or left out: off), excludePureBlack?: true (black-only and grey colours keep their ink), removeWhiteOverprint?: false (white fills and strokes stop overprinting), overprintBlack?: black % 1..100 (black-only and grey fills and strokes this dark or darker overprint, as edit.colors.overprintBlack; 0 or left out: off), textOnly?: false (Overprint Black on type only), fill?: true, stroke?: true, ids?: [id…]} prepare a CMYK document's inks for print as one undo step: CMYK colours (solid, gradient stops, gradient meshes) with more total ink than inkLimit are scaled down to it (colours of spot swatches and Registration stay), white overprint is removed and black overprint set. Refused in RGB documents (File › Document Color Mode › CMYK Color first) → {changed, inkLimited: paints and meshes scaled, whiteOverprintRemoved: objects, blackOverprinted: objects}", + has_doc, + print_fixes::run + ), ] } @@ -116,5 +127,7 @@ fn filter(s: &mut Session, p: &Value) -> Result { o.insert("ids".into(), json!(ids.iter().map(|i| i.0).collect::>())); } let label = effects::effect_info(id).map_or("Apply as Filter", |e| e.label.trim_end_matches('…')); - recolor(s, &given, label, &|c| map.apply(c)) + let kinds = effects::addons::duotone::swatch_kinds(&s.doc()?.doc); + let swatches = |name: &str| kinds.get(name).copied(); + recolor_links(s, &given, label, &|c| map.apply(c), &|c, link, tint| map.apply_link(c, link, tint, &swatches)) } diff --git a/crates/engine/src/cmd/addons/color/print_fixes.rs b/crates/engine/src/cmd/addons/color/print_fixes.rs new file mode 100644 index 0000000000..7a4cfee9c4 --- /dev/null +++ b/crates/engine/src/cmd/addons/color/print_fixes.rs @@ -0,0 +1,170 @@ +//! Print Ink Fixes (`addon.color.printFixes`, Object › Plug-ins › Color Effects › Print Ink +//! Fixes…): a CMYK document's inks made ready for print in one undo step. Colours with more total +//! ink than the limit are scaled down to it, white fills and strokes stop overprinting, and black +//! ones start to, as Edit › Edit Colors › Overprint Black sets it. + +use std::sync::Arc; + +use serde_json::{Value, json}; +use vectorcraft_color::Color; +use vectorcraft_color::swatch::REGISTRATION; +use vectorcraft_doc::overprint::{OverprintBlack, is_white}; +use vectorcraft_doc::{ColorMode, Node, NodeKind}; + +use super::super::super::colorcmds::{Recolor, Scope}; +use super::super::super::overprint::edit_counted; +use super::super::super::{bad, checked_ids_or_selection, number_or, switch_or, text_param}; +use crate::{Result, Session}; + +const C: &str = "addon.color.printFixes"; + +/// What `p` asks for. +struct Fixes { + /// Most total ink, 0..4 (0: off). + ink_limit: f32, + exclude_pure_black: bool, + remove_white_overprint: bool, + /// Overprint Black's least black, 0..1 (0: off). + overprint_black: f32, + text_only: bool, + fill: bool, + stroke: bool, +} + +/// The percentage `p` gives for `key` in 0..=`max`, as a fraction (0 when left out). +fn percent(p: &Value, key: &str, max: f64) -> Result { + let v = number_or(p, key, 0.0, C)?; + if !(0.0..=max).contains(&v) { + return Err(bad(C, format!("`{key}` must be 0..{max}"))); + } + Ok((v / 100.0) as f32) +} + +impl Fixes { + fn of(p: &Value) -> Result { + let f = Fixes { + ink_limit: percent(p, "inkLimit", 400.0)?, + exclude_pure_black: switch_or(p, "excludePureBlack", true, C)?, + remove_white_overprint: switch_or(p, "removeWhiteOverprint", false, C)?, + overprint_black: percent(p, "overprintBlack", 100.0)?, + text_only: switch_or(p, "textOnly", false, C)?, + fill: switch_or(p, "fill", true, C)?, + stroke: switch_or(p, "stroke", true, C)?, + }; + if f.ink_limit <= 0.0 && f.overprint_black <= 0.0 && !f.remove_white_overprint { + return Err(bad(C, "give `inkLimit`, `removeWhiteOverprint` or `overprintBlack`")); + } + Ok(f) + } + + /// `c` with its total ink scaled down to the limit: CMYK, and grey (black ink) unless + /// pure blacks are excluded, which CMYK with black ink only is too. + fn limit(&self, c: Color) -> Color { + const E: f32 = 0.005; + let max = self.ink_limit; + match c { + Color::Cmyk { c: cy, m, y, k } => { + let total = cy + m + y + k; + let pure_black = cy <= E && m <= E && y <= E; + if total <= max || (self.exclude_pure_black && pure_black) || !total.is_finite() { + return c; + } + let s = max / total; + Color::cmyk(cy * s, m * s, y * s, k * s) + } + Color::Gray { k } if k > max && !self.exclude_pure_black => Color::gray(max), + _ => c, + } + } + + /// Remove white overprint from `n`'s own fills and strokes and its characters': true when + /// that changed anything. + fn unset_white(&self, n: &mut Node) -> bool { + let mut changed = false; + let mut off = |aimed: bool, white: bool, flag: &mut bool| { + if aimed && white && *flag { + *flag = false; + changed = true; + } + }; + for it in &mut n.appearance.items { + let aimed = if it.is_fill() { self.fill } else { self.stroke }; + let white = is_white(it.paint()); + off(aimed, white, it.overprint_mut()); + } + if let NodeKind::Text(t) = &mut n.kind { + for r in &mut t.runs { + off(self.fill, is_white(&r.style.fill), &mut r.style.overprint_fill); + off(self.stroke, is_white(&r.style.stroke), &mut r.style.overprint_stroke); + } + } + changed + } + + /// The overprint fixes on `n` and everything inside it: (objects whose white overprint was + /// removed, objects set to overprint black). + fn overprint(&self, n: &mut Node, black: &OverprintBlack, spots: &[String]) -> (usize, usize) { + let white = usize::from(self.remove_white_overprint && self.unset_white(n)); + let blacks = self.overprint_black > 0.0 && (!self.text_only || matches!(n.kind, NodeKind::Text(_))); + let mut counts = (white, usize::from(blacks && black.apply(n, spots))); + for c in n.children_mut().into_iter().flatten() { + let (w, b) = self.overprint(Arc::make_mut(c), black, spots); + counts = (counts.0 + w, counts.1 + b); + } + counts + } +} + +pub(super) fn run(s: &mut Session, p: &Value) -> Result { + let fixes = Fixes::of(p)?; + let st = s.doc()?; + if st.doc.color_mode != ColorMode::Cmyk { + return Err(bad(C, "Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first")); + } + let layers = st.doc.layers.iter().map(|l| l.id).collect(); + let roots = checked_ids_or_selection(s, p, C)?; + // As Artwork Cleanup's: the selection, or the document while nothing is selected. + let ids = match text_param(p, "scope", C)? { + Some("document") => layers, + None if roots.is_empty() => layers, + Some("selection") if roots.is_empty() => return Err(bad(C, "nothing selected")), + Some("selection") | None => roots, + Some(other) => return Err(bad(C, format!("`scope` must be \"selection\" or \"document\", not {other:?}"))), + }; + let black = OverprintBlack { min_k: fixes.overprint_black, fill: fixes.fill, stroke: fixes.stroke, ..OverprintBlack::default() }; + let (mut ink, mut white, mut blacks) = (0, 0, 0); + let changed = edit_counted(s, "Print Ink Fixes", |d| { + if fixes.ink_limit > 0.0 { + let spots = d.spot_names(); + // Spot inks and Registration aren't process ink: they keep their colour and link. + let links = |c: &mut Color, link: &mut Option, _: &mut f32| { + if link.as_ref().is_some_and(|n| n == REGISTRATION || spots.contains(n)) { + return false; + } + let new = fixes.limit(*c); + if new == *c { + return false; + } + (*c, *link) = (new, None); + true + }; + let scope = Scope { fill: fixes.fill, stroke: fixes.stroke, images: false, patterns: false }; + ink = Recolor::with_links(scope, &|c| fixes.limit(c), &links).run(d, &ids); + } + if !fixes.remove_white_overprint && fixes.overprint_black <= 0.0 { + return Ok(ink); + } + let spots = d.spot_names(); + for id in &ids { + if let Some(n) = d.node_mut(*id) { + let (w, b) = fixes.overprint(n, &black, &spots); + (white, blacks) = (white + w, blacks + b); + } + } + Ok(ink + white + blacks) + })?; + Ok(json!({ "changed": changed, "inkLimited": ink, "whiteOverprintRemoved": white, "blackOverprinted": blacks })) +} + +#[cfg(test)] +mod tests; diff --git a/crates/engine/src/cmd/addons/color/print_fixes/tests.rs b/crates/engine/src/cmd/addons/color/print_fixes/tests.rs new file mode 100644 index 0000000000..e4c1915879 --- /dev/null +++ b/crates/engine/src/cmd/addons/color/print_fixes/tests.rs @@ -0,0 +1,129 @@ +//! Print Ink Fixes. + +use serde_json::{Value, json}; +use vectorcraft_color::Color; +use vectorcraft_doc::NodeId; + +use crate::Session; + +const C: &str = "addon.color.printFixes"; + +/// A CMYK document with a rectangle per fill, each with overprint as given; nothing selected. +fn doc(fills: &[(Value, bool)]) -> (Session, Vec) { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 200, "colorMode": "cmyk"})).unwrap(); + let ids = fills + .iter() + .enumerate() + .map(|(i, (fill, overprint))| { + let id = s.execute("shape.rectangle", &json!({"x": 10 + 30 * i, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap(); + s.execute("paint.setFill", &json!({ "color": fill })).unwrap(); + s.execute("paint.setStroke", &json!({"none": true})).unwrap(); + s.execute("object.setOverprint", &json!({ "fill": overprint })).unwrap(); + NodeId(id) + }) + .collect(); + s.execute("select.none", &json!({})).unwrap(); + (s, ids) +} + +fn fill(s: &Session, id: NodeId) -> (Color, bool) { + let n = s.doc().unwrap().doc.node(id).unwrap().clone(); + let item = n.appearance.items.iter().find(|i| i.is_fill()).unwrap().clone(); + (item.paint().color().unwrap(), item.overprint()) +} + +fn cmyk(c: f64, m: f64, y: f64, k: f64) -> Value { + json!({"c": c, "m": m, "y": y, "k": k}) +} + +fn close(a: Color, b: [f32; 4]) -> bool { + let Color::Cmyk { c, m, y, k } = a else { return false }; + [c, m, y, k].iter().zip(b).all(|(x, y)| (x - y).abs() < 0.001) +} + +#[test] +fn the_ink_limit_scales_heavy_colours_down_to_it() { + let (mut s, ids) = doc(&[(cmyk(100.0, 100.0, 100.0, 100.0), false), (cmyk(40.0, 30.0, 20.0, 10.0), false), (cmyk(0.0, 0.0, 0.0, 80.0), false)]); + let undo = s.doc().unwrap().history.undo.len(); + // Nothing selected: the whole document. + let v = s.execute(C, &json!({"inkLimit": 300})).unwrap(); + assert_eq!((v["inkLimited"].clone(), v["changed"].clone()), (json!(1), json!(1))); + assert!(close(fill(&s, ids[0]).0, [0.75; 4]), "{:?}", fill(&s, ids[0])); + assert!(close(fill(&s, ids[1]).0, [0.4, 0.3, 0.2, 0.1]), "under the limit: as it was"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1, "one undo step"); + // The selection only. + s.execute("select.set", &json!({"ids": [ids[1].0]})).unwrap(); + s.execute(C, &json!({"inkLimit": 50})).unwrap(); + assert!(close(fill(&s, ids[1]).0, [0.2, 0.15, 0.1, 0.05])); + assert!(close(fill(&s, ids[0]).0, [0.75; 4]), "left out"); + // Pure black keeps its ink unless it is included. + s.execute(C, &json!({"inkLimit": 50, "scope": "document"})).unwrap(); + assert!(close(fill(&s, ids[0]).0, [0.125; 4])); + assert!(close(fill(&s, ids[2]).0, [0.0, 0.0, 0.0, 0.8])); + s.execute(C, &json!({"inkLimit": 50, "scope": "document", "excludePureBlack": false})).unwrap(); + assert!(close(fill(&s, ids[2]).0, [0.0, 0.0, 0.0, 0.5])); +} + +#[test] +fn spot_and_registration_colours_keep_their_ink() { + let (mut s, ids) = doc(&[(cmyk(0.0, 0.0, 0.0, 0.0), false), (cmyk(0.0, 0.0, 0.0, 0.0), false)]); + s.execute("swatch.new", &json!({"name": "Heavy", "color": cmyk(100.0, 100.0, 100.0, 50.0), "spot": true})).unwrap(); + s.execute("select.set", &json!({"ids": [ids[0].0]})).unwrap(); + s.execute("paint.setFill", &json!({"swatch": "Heavy"})).unwrap(); + s.execute("select.set", &json!({"ids": [ids[1].0]})).unwrap(); + s.execute("paint.setFill", &json!({"swatch": "[Registration]"})).unwrap(); + s.execute("select.none", &json!({})).unwrap(); + let before = [fill(&s, ids[0]), fill(&s, ids[1])]; + assert_eq!(s.execute(C, &json!({"inkLimit": 200})).unwrap()["changed"], 0); + assert_eq!([fill(&s, ids[0]), fill(&s, ids[1])], before); +} + +#[test] +fn white_overprint_goes_and_black_overprint_comes_at_the_threshold() { + let white = cmyk(0.0, 0.0, 0.0, 0.0); + let (mut s, ids) = + doc(&[(white.clone(), true), (cmyk(0.0, 0.0, 0.0, 95.0), false), (cmyk(0.0, 0.0, 0.0, 80.0), false), (cmyk(30.0, 0.0, 0.0, 100.0), false)]); + let undo = s.doc().unwrap().history.undo.len(); + let v = s.execute(C, &json!({"removeWhiteOverprint": true, "overprintBlack": 90})).unwrap(); + assert_eq!((v["whiteOverprintRemoved"].clone(), v["blackOverprinted"].clone()), (json!(1), json!(1)), "{v}"); + let overprints: Vec = ids.iter().map(|id| fill(&s, *id).1).collect(); + // White stops; 95 % black starts; 80 % is under the threshold; a rich black isn't pure black. + assert_eq!(overprints, [false, true, false, false]); + assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1, "one undo step"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(ids.iter().map(|id| fill(&s, *id).1).collect::>(), [true, false, false, false]); + // On type only: the rectangles stay. + let v = s.execute(C, &json!({"overprintBlack": 90, "textOnly": true})).unwrap(); + assert_eq!(v["changed"], 0); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "nothing changed, no undo step"); + // Strokes only: the fills stay. + assert_eq!(s.execute(C, &json!({"overprintBlack": 90, "fill": false})).unwrap()["changed"], 0); +} + +#[test] +fn bad_requests_and_rgb_documents_are_refused() { + let (mut s, ids) = doc(&[(cmyk(100.0, 100.0, 100.0, 100.0), true)]); + for p in [ + json!({}), + json!({"inkLimit": 0}), + json!({"inkLimit": "300"}), + json!({"inkLimit": 401}), + json!({"inkLimit": -1}), + json!({"overprintBlack": 101}), + json!({"overprintBlack": true}), + json!({"removeWhiteOverprint": "yes"}), + json!({"inkLimit": 300, "fill": 1}), + json!({"inkLimit": 300, "scope": "page"}), + json!({"inkLimit": 300, "scope": "selection"}), + json!({"inkLimit": 300, "ids": [999_999]}), + ] { + assert!(s.execute(C, &p).is_err(), "{p}"); + } + assert!(close(fill(&s, ids[0]).0, [1.0; 4])); + let mut rgb = Session::new(); + rgb.execute("file.new", &json!({})).unwrap(); + rgb.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap(); + let e = rgb.execute(C, &json!({"inkLimit": 300})).unwrap_err().to_string(); + assert!(e.contains("CMYK"), "{e}"); +} diff --git a/crates/engine/src/cmd/addons/color/tests.rs b/crates/engine/src/cmd/addons/color/tests.rs index 5094c2019f..ed8137d6a9 100644 --- a/crates/engine/src/cmd/addons/color/tests.rs +++ b/crates/engine/src/cmd/addons/color/tests.rs @@ -238,3 +238,79 @@ fn a_halftone_past_the_caps_leaves_the_object_as_it_is() { let n = s.doc().unwrap().doc.node(id).cloned().unwrap(); assert!(n.children().is_none_or(|c| c.len() < 5), "no dots"); } + +/// Duotone, the live effect. +const DUOTONE: &str = "addon.color.duotone"; + +/// A document with spot swatch "Ink" and a selected grey (50 %) rectangle, unstroked. +fn grey_rect() -> (Session, NodeId) { + let (mut s, id) = red_rect(); + s.execute("swatch.new", &json!({"name": "Ink", "color": {"model": "cmyk", "c": 0.0, "m": 0.6, "y": 1.0, "k": 0.0}, "spot": true})).unwrap(); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + s.execute("paint.setFill", &json!({"color": {"gray": 0.5}})).unwrap(); + (s, id) +} + +fn ink_tone(curve: &str) -> serde_json::Value { + json!({"tones": [{"color": {"model": "cmyk", "c": 0.0, "m": 0.6, "y": 1.0, "k": 0.0}, "swatch": "Ink", "curve": curve}]}) +} + +fn fill_paint(s: &Session, id: NodeId) -> vectorcraft_color::Paint { + s.doc().unwrap().doc.node(id).unwrap().appearance.fill_paint().clone() +} + +#[test] +fn duotone_draws_a_tint_of_its_spot_tone_and_expands_to_it() { + let (mut s, id) = grey_rect(); + let grey = pixel(&s); + s.execute("effect.apply", &json!({"effect": DUOTONE, "params": ink_tone("0,0 100,100")})).unwrap(); + assert_eq!(fill_paint(&s, id).color().unwrap(), vectorcraft_color::Color::gray(0.5), "the colours stay"); + let drawn = pixel(&s); + assert!(drawn != grey && drawn[0] > drawn[2], "drawn in the ink: {drawn:?}"); + s.execute("effect.expandAppearance", &json!({})).unwrap(); + let vectorcraft_color::Paint::Solid { swatch, tint, .. } = fill_paint(&s, id) else { panic!("a solid fill") }; + assert_eq!(swatch.as_deref(), Some("Ink"), "linked to the spot swatch, so it separates on its plate"); + assert!((tint - 0.5).abs() < 0.01, "{tint}"); +} + +#[test] +fn duotone_as_a_filter_equals_the_live_effect_expanded() { + for params in [ + ink_tone("0,0 100,100"), + ink_tone("0,0 40,70 100,100"), + json!({"tones": [{"color": "#00ffff", "swatch": "Ink"}, {"color": {"model": "cmyk", "c": 0.0, "m": 0.0, "y": 0.0, "k": 1.0}, "curve": "0,0 100,40"}]}), + json!({"tones": [{"color": "#000000"}], "skipSpot": true}), + ] { + let (mut live, id) = grey_rect(); + live.execute("effect.apply", &json!({"effect": DUOTONE, "params": params})).unwrap(); + live.execute("effect.expandAppearance", &json!({})).unwrap(); + let (mut filtered, _) = grey_rect(); + let undo = filtered.doc().unwrap().history.undo.len(); + assert_eq!(filtered.execute("addon.color.filter", &json!({"effect": DUOTONE, "params": params})).unwrap()["changed"], 1); + assert_eq!(filtered.doc().unwrap().history.undo.len(), undo + 1, "one undo step"); + assert_eq!(fill_paint(&filtered, id), fill_paint(&live, id), "{params}"); + } + // The params round-trip: the effect keeps what it was given, and the filter reads the same. + let (mut s, id) = grey_rect(); + let params = ink_tone("0,0 40,70 100,100"); + s.execute("effect.apply", &json!({"effect": DUOTONE, "params": params})).unwrap(); + let kept = s.doc().unwrap().doc.node(id).unwrap().appearance.effects[0].params.clone(); + assert_eq!(kept["tones"], params["tones"]); + s.execute("addon.color.filter", &json!({"effect": DUOTONE, "params": kept})).unwrap(); + let vectorcraft_color::Paint::Solid { swatch, tint, .. } = fill_paint(&s, id) else { panic!("a solid fill") }; + assert_eq!(swatch.as_deref(), Some("Ink")); + let fx = vectorcraft_render::effects::addons::duotone::tone_curve_points(Some(&json!("0,0 40,70 100,100"))); + let want = vectorcraft_render::effects::curve_at(&fx, 0.5); + assert!(want > 0.7 && (tint - want).abs() < 0.01, "the curve lifts the mid tone: {tint}, {want}"); +} + +#[test] +fn duotone_skips_spot_colours_when_asked() { + let (mut s, id) = grey_rect(); + s.execute("paint.setFill", &json!({"swatch": "Ink"})).unwrap(); + let spot = fill_paint(&s, id); + s.execute("addon.color.filter", &json!({"effect": DUOTONE, "params": {"tones": [{"color": "#000000"}], "skipSpot": true}})).unwrap(); + assert_eq!(fill_paint(&s, id), spot); + s.execute("addon.color.filter", &json!({"effect": DUOTONE, "params": {"tones": [{"color": "#000000"}]}})).unwrap(); + assert_ne!(fill_paint(&s, id), spot); +} diff --git a/crates/engine/src/cmd/colorcmds.rs b/crates/engine/src/cmd/colorcmds.rs index 2fadc11fde..4ab859740b 100644 --- a/crates/engine/src/cmd/colorcmds.rs +++ b/crates/engine/src/cmd/colorcmds.rs @@ -335,6 +335,12 @@ pub(crate) fn recolor(s: &mut Session, p: &Value, label: &str, f: &dyn Fn(Color) run_pass(s, p, label, Recolor::new(Scope::of(p), f)) } +/// [`recolor`] with solid colours and gradient stops mapped through `links`, with their swatch +/// link and tint. +pub(crate) fn recolor_links(s: &mut Session, p: &Value, label: &str, f: &dyn Fn(Color) -> Color, links: &LinkMap) -> Result { + run_pass(s, p, label, Recolor::with_links(Scope::of(p), f, links)) +} + /// Run `pass` on the `ids` param's objects (default: the selection) as one undo step. fn run_pass(s: &mut Session, p: &Value, label: &str, pass: Recolor) -> Result { let ids = match ids_param(p, "ids") { diff --git a/crates/engine/tests/command_sweep.rs b/crates/engine/tests/command_sweep.rs index bf28fa057c..c5f9fc9de4 100644 --- a/crates/engine/tests/command_sweep.rs +++ b/crates/engine/tests/command_sweep.rs @@ -406,6 +406,22 @@ fn structured_junk() { ("effect.apply", json!({"effect": "addon.color.halftone", "params": {"frequency": 1e308, "angle": -1e308, "shape": "star", "mode": "rgb"}})), ("effect.apply", json!({"effect": "addon.color.halftone", "params": {"frequency": 300, "invert": true, "clip": false, "fromArt": true}})), ("effect.apply", json!({"effect": "addon.color.halftone", "params": {"frequency": -1e308, "mode": "cmyk", "color": "#123456", "target": 3}})), + ("effect.apply", json!({"effect": "addon.color.duotone", "params": {"tones": "x", "skipSpot": "yes"}})), + ( + "effect.apply", + json!({"effect": "addon.color.duotone", "params": {"tones": [1, null, {"color": [1e308, -1e308, "x"], "curve": [[1e308, -1e308], ["a"]]}]}}), + ), + ( + "effect.apply", + json!({"effect": "addon.color.duotone", "params": {"tones": [{"swatch": 3, "curve": "1e999,5 x,y", "active": "no"}, {"color": {"model": "lab", "l": 1e30, "a": -1e30, "b": 0}}, {}, {}, {}, {}]}}), + ), + ( + "addon.color.filter", + json!({"effect": "addon.color.duotone", "params": {"tones": [{"color": "#ff0000", "swatch": "[Registration]"}], "skipSpot": true}}), + ), + ("addon.color.printFixes", json!({"inkLimit": 1e308, "overprintBlack": -1e308})), + ("addon.color.printFixes", json!({"inkLimit": 1, "overprintBlack": 1, "removeWhiteOverprint": true, "scope": "document", "textOnly": true})), + ("addon.color.printFixes", json!({"inkLimit": [300], "scope": 3, "ids": "x"})), ("effect.apply", json!({"effect": "no.such.effect"})), ("effect.remove", json!({"index": 99})), ("effect.setParams", json!({"index": 0, "params": null})), diff --git a/crates/render/src/fx/renderer.rs b/crates/render/src/fx/renderer.rs index b053f3120c..949732c528 100644 --- a/crates/render/src/fx/renderer.rs +++ b/crates/render/src/fx/renderer.rs @@ -444,7 +444,7 @@ impl Renderer { let art = if effects::has_revolve(a) || effects::has_solid(a) { effects::evaluate_container(Some(doc), &art).unwrap_or(art) } else { art }; // Vector Halftone samples the object with its colour adjustments: its dots keep their inks. let outer = if effects::addons::halftone::has_halftone(a) { None } else { effects::color_map(&a.appearance.effects) }; - let mut art = self.adjusted_art(art, outer.as_ref()); + let mut art = self.adjusted_art(doc, art, outer.as_ref()); // A path's geometry effects still apply when it is drawn. let path = matches!(art.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }); art.appearance.effects.retain(|e| path && effects::is_geometry(&e.id)); @@ -477,12 +477,15 @@ impl Renderer { } /// `art` with the colour adjustments inside it applied, then `outer` (its object's own) on - /// everything ([`effects::adjust`]). Embedded images become recoloured copies, cached with the - /// decoded images under a key naming the adjustment. - fn adjusted_art(&mut self, mut art: Node, outer: Option<&effects::ColorMap>) -> Node { + /// everything ([`effects::adjust`]), with `doc`'s swatches. Embedded images become recoloured + /// copies, cached with the decoded images under a key naming the adjustment. + fn adjusted_art(&mut self, doc: &vectorcraft_doc::Document, mut art: Node, outer: Option<&effects::ColorMap>) -> Node { art.appearance.effects.retain(|e| !effects::is_adjustment(&e.id)); let mut wanted: Vec<(String, String, u64, effects::ColorMap)> = vec![]; - let adjusted = effects::adjust(&art, outer, &mut |key, map| { + // shortcut: art kept by `fx_arts` isn't made again when only a swatch's kind (spot or + // process) changes, which Duotone reads; editing the object makes it again. + let swatches = |name: &str| effects::addons::duotone::swatch_kind(doc, name); + let adjusted = effects::adjust(&art, outer, &swatches, &mut |key, map| { let mut h = std::hash::DefaultHasher::new(); std::hash::Hash::hash(&format!("{map:?}"), &mut h); let hash = std::hash::Hasher::finish(&h); diff --git a/crates/ui-egui/src/addons/color.rs b/crates/ui-egui/src/addons/color.rs index e338137ce1..c3944cbb83 100644 --- a/crates/ui-egui/src/addons/color.rs +++ b/crates/ui-egui/src/addons/color.rs @@ -1,8 +1,9 @@ //! Color Effects' panel and submenu (Object › Plug-ins › Color Effects). The panel picks a colour //! adjustment and its values, then adds it to the selection as a live effect or applies it as a -//! filter, into the colours themselves (`addon.color.filter`). The submenu applies the add-on's -//! live effects, Vector Halftone among them (Effect › Color Effects has them too), and opens the -//! panel. +//! filter, into the colours themselves (`addon.color.filter`); below, under Inks, it opens Duotone's +//! dialog and Print Ink Fixes' (`addon.color.printFixes`). The submenu applies the add-on's live +//! effects, Duotone and Vector Halftone among them (Effect › Color Effects has them too), opens +//! Print Ink Fixes and opens the panel. use egui::Ui; use serde_json::{Map, Value, json}; @@ -63,6 +64,21 @@ const ADJUSTMENTS: [(&str, &str, &[Field]); 7] = [ ("addon.color.invert", "Invert Colors", &[]), ]; +/// Print Ink Fixes' menu item: its label, command and the options its dialog opens with (the +/// selection, or the document while nothing is selected). +fn print_fixes() -> (&'static str, &'static str, Value) { + let options = json!({ + "inkLimit": 300, "excludePureBlack": true, "removeWhiteOverprint": true, "overprintBlack": 100, + "textOnly": false, "fill": true, "stroke": true, + }); + ("Print Ink Fixes…", "addon.color.printFixes", options) +} + +/// Duotone's menu item: its label, and its effect's dialog. +fn duotone() -> (&'static str, &'static str, Value) { + ("Duotone…", "effect.dialog", json!({ "effect": vectorcraft_effects::addons::duotone::DUOTONE })) +} + /// Adjustment `i` of [`ADJUSTMENTS`] (the first past the end). fn adjustment(i: usize) -> (&'static str, &'static str, &'static [Field]) { ADJUSTMENTS.get(i).copied().unwrap_or(ADJUSTMENTS[0]) @@ -70,14 +86,18 @@ fn adjustment(i: usize) -> (&'static str, &'static str, &'static [Field]) { /// Object › Plug-ins › Color Effects. pub fn menu() -> Vec { + let cmd = |(label, id, p): (&'static str, &'static str, Value)| Item::Cmd(label, id, p); vec![ Item::Cmd("Color Effects Panel", "window.panel", json!({ "panel": ID })), Item::Sep, Item::Cmd("Exposure…", "effect.dialog", json!({ "effect": "addon.color.exposure" })), Item::Cmd("Desaturate", "effect.apply", json!({ "effect": "addon.color.desaturate" })), + cmd(duotone()), Item::Cmd("Invert Colors", "effect.apply", json!({ "effect": "addon.color.invert" })), Item::Cmd("Vector Halftone…", "effect.dialog", json!({ "effect": "addon.color.halftone" })), Item::Sep, + cmd(print_fixes()), + Item::Sep, Item::Sub( "Select by Color Kind", [ @@ -159,6 +179,16 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } }); set_pstate(ui.ctx(), STATE, st); + // Inks: Duotone's and Print Ink Fixes' dialogs, as their menu items open them. + ui.add_space(8.0); + widgets::subheader(ui, tl!("Inks")); + let width = ui.available_width(); + for (label, id, p) in [duotone(), print_fixes()] { + if widgets::flat_button(ui, tl!(label), width).clicked() { + let (id, p) = crate::menus::click_target(label, id, &p); + crate::menus::invoke(app, &id, p); + } + } } #[cfg(test)] diff --git a/crates/ui-egui/src/addons/color/tests.rs b/crates/ui-egui/src/addons/color/tests.rs index a44f1d9857..7ba046c72e 100644 --- a/crates/ui-egui/src/addons/color/tests.rs +++ b/crates/ui-egui/src/addons/color/tests.rs @@ -22,10 +22,11 @@ fn the_menus_list_the_effects_and_open_the_panel() { let at = |path: &[&str], label: &str| entries.iter().find(|e| e.path == path && e.label == label); let plugins = ["Object", "Plug-ins", "Color Effects"]; let item = at(&plugins, "Color Effects Panel").expect("listed"); - for label in ["Exposure…", "Desaturate", "Invert Colors", "Vector Halftone…"] { + for label in ["Exposure…", "Desaturate", "Duotone…", "Invert Colors", "Vector Halftone…"] { assert!(at(&plugins, label).is_some(), "Object › Plug-ins › Color Effects › {label}"); assert!(at(&["Effect", "Color Effects"], label).is_some(), "Effect › Color Effects › {label}"); } + assert!(at(&plugins, "Print Ink Fixes…").is_some(), "Object › Plug-ins › Color Effects › Print Ink Fixes…"); // The existing submenus are as they were. assert!(at(&["Effect", "Color Adjustments"], "Exposure…").is_none()); menus::invoke(&mut app, "window.panel", item.params.clone()); @@ -53,7 +54,7 @@ fn the_panel_shows_the_values_and_its_buttons() { set_pstate(ui.ctx(), STATE, Picked { index: exposure, ..Picked::default() }); show(app, ui); }); - for s in ["Exposure", "Offset", "Gamma", "Add as Effect", "Apply as Filter"] { + for s in ["Exposure", "Offset", "Gamma", "Add as Effect", "Apply as Filter", "Inks", "Duotone…", "Print Ink Fixes…"] { assert!(text.contains(s), "{s} in {text}"); } app.run("select.none", json!({})).unwrap(); @@ -82,3 +83,55 @@ fn the_halftone_effect_dialog_has_the_command_fields_and_edits_the_effect() { app.run("effect.dialog", json!({"effect": "addon.color.halftone", "index": 0})).unwrap(); assert_eq!(app.ui.dialog.as_ref().unwrap().fields["fromArt"], json!(true)); } + +#[test] +fn the_duotone_dialog_has_a_row_per_tone_and_the_curve_of_one() { + let mut app = app(); + let text = |app: &mut VectorcraftApp| painted_text(app, |app, ui| crate::dialogs::show(app, ui.ctx())); + app.run("swatch.new", json!({"name": "Ink", "color": "#e07020", "spot": true})).unwrap(); + app.run("effect.dialog", json!({"effect": "addon.color.duotone"})).unwrap(); + let shown = text(&mut app); + for s in ["Duotone", "Tone 1", "Tone 2", "Tone 3", "Tone 4", "Process Color", "Curve", "Points", "Reset to Linear", "Reset to Inverse"] { + assert!(shown.contains(s), "{s} in {shown}"); + } + assert!(shown.contains("Skip Objects with Spot Colors") && shown.contains("Preview"), "{shown}"); + assert!(app.session.in_interaction(), "the preview runs"); + // Four tones while the dialog is open, the ones after the first off. + let tones = app.ui.dialog.as_ref().unwrap().fields["tones"].as_array().unwrap().clone(); + assert_eq!(tones.iter().map(|t| t["active"].as_bool().unwrap_or(true)).collect::>(), [true, false, false, false]); + // A spot tone with an inverse curve; the second tone's curve shows when picked. + { + let d = app.ui.dialog.as_mut().unwrap(); + d.fields["tones"][0] = json!({"color": "#e07020", "swatch": "Ink", "curve": "0,100 100,0", "active": true}); + d.fields.insert("__tone".into(), json!(1)); + } + assert!(text(&mut app).contains("Ink"), "the swatch is named"); + crate::dialogs::confirm(&mut app).unwrap(); + let st = app.session.active().unwrap(); + let fx = st.doc.node(st.selection.objects[0]).unwrap().appearance.effects.clone(); + assert_eq!((fx.len(), fx[0].id.as_str()), (1, "addon.color.duotone")); + assert_eq!((fx[0].params["tones"][0]["swatch"].clone(), fx[0].params["tones"].as_array().unwrap().len()), (json!("Ink"), 4)); + assert!(!fx[0].params.as_object().unwrap().contains_key("__tone"), "dialog-only"); + // The Appearance panel reopens it with its values. + app.run("effect.dialog", json!({"effect": "addon.color.duotone", "index": 0})).unwrap(); + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["tones"][0]["curve"], json!("0,100 100,0")); +} + +#[test] +fn print_ink_fixes_opens_its_options_and_runs_on_ok() { + let mut app = app(); + app.run("file.documentColorMode", json!({"mode": "cmyk"})).unwrap(); + app.run("paint.setFill", json!({"color": {"c": 100, "m": 100, "y": 100, "k": 100}})).unwrap(); + let entries = menus::menu_entries(&app); + let item = entries.iter().find(|e| e.path == ["Object", "Plug-ins", "Color Effects"] && e.label == "Print Ink Fixes…").unwrap(); + let (id, p) = menus::click_target(&item.label, item.command.as_deref().unwrap(), &item.params); + menus::invoke(&mut app, &id, p); + let shown = painted_text(&mut app, |app, ui| crate::dialogs::show(app, ui.ctx())); + for s in ["Print Ink Fixes", "Ink Limit", "Exclude Pure Black", "Remove White Overprint", "Overprint Black", "Text Only"] { + assert!(shown.contains(s), "{s} in {shown}"); + } + crate::dialogs::confirm(&mut app).unwrap(); + let st = app.session.active().unwrap(); + let fill = st.doc.node(st.selection.objects[0]).unwrap().appearance.fill_paint().color().unwrap(); + assert_eq!(fill, vectorcraft_color::Color::cmyk(0.75, 0.75, 0.75, 0.75), "scaled to 300 %"); +} diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index eb78e43921..ba85dc4a25 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -21,6 +21,7 @@ pub mod confirm; pub mod corners; pub mod dimension; mod document_setup; +mod duotone; pub mod dxf_import; pub mod dxf_options; pub mod edit_selection; diff --git a/crates/ui-egui/src/dialogs/command.rs b/crates/ui-egui/src/dialogs/command.rs index 8e8196ade3..3ebefdc211 100644 --- a/crates/ui-egui/src/dialogs/command.rs +++ b/crates/ui-egui/src/dialogs/command.rs @@ -49,6 +49,7 @@ fn order(command: &str) -> &'static [&'static str] { match command { // The public Trap options' order. "object.pathfinder.trap" => &["thickness", "heightWidth", "tintReduction", "trapsWithProcessColor", "reverseTraps"], + "addon.color.printFixes" => &["inkLimit", "excludePureBlack", "removeWhiteOverprint", "overprintBlack", "textOnly", "fill", "stroke"], _ => &[], } } diff --git a/crates/ui-egui/src/dialogs/duotone.rs b/crates/ui-egui/src/dialogs/duotone.rs new file mode 100644 index 0000000000..69ce931a82 --- /dev/null +++ b/crates/ui-egui/src/dialogs/duotone.rs @@ -0,0 +1,123 @@ +//! Duotone's dialog (Effect › Color Effects › Duotone…): a row per tone (on or off, its swatch or +//! process colour), the curve of the tone picked under Curve (the graph, its points as text and +//! the Reset buttons) and Skip Objects with Spot Colors. +//! +//! Fields: `tones` (the effect's, always [`MAX_TONES`] while the dialog is open, the ones after +//! the first off), `skipSpot`, and `__tone`, the tone whose curve shows. + +use serde_json::{Map, Value, json}; +use vectorcraft_color::{Color, Paint}; +use vectorcraft_effects::addons::duotone::{MAX_TONES, tone_curve_points}; + +use super::effect::{curve_graph, points_text}; +use super::form; +use crate::state::Dialog; +use crate::{VectorcraftApp, widgets}; + +/// A curve's text: linear, inverse. +const LINEAR: &str = "0,0 100,100"; +const INVERSE: &str = "0,100 100,0"; + +/// Width of the label column. +const LABEL_W: f32 = 84.0; + +/// A tone's colour (black when it has none that reads). +fn tone_color(tone: &Value) -> Color { + match tone.get("color") { + Some(Value::String(s)) => Color::from_hex(s), + Some(v @ Value::Object(_)) => serde_json::from_value(v.clone()).ok(), + _ => None, + } + .unwrap_or(Color::BLACK) +} + +/// The dialog's fields; returns nothing, the caller compares the values with those previewed. +pub(super) fn fields(app: &VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) { + let mut tones: Vec = d.fields.get("tones").and_then(Value::as_array).cloned().unwrap_or_default(); + tones.truncate(MAX_TONES); + while tones.len() < MAX_TONES { + tones.push(json!({"color": "#000000", "curve": LINEAR, "active": false})); + } + // The global and spot swatches a tone can be: (name, colour). + let swatches: Vec<(String, Color)> = app + .session + .active() + .map(|st| st.doc.swatches_iter().filter_map(|w| Some((w.name.clone(), st.doc.global_color(&w.name)?))).collect()) + .unwrap_or_default(); + let labels = [tl!("Tone 1"), tl!("Tone 2"), tl!("Tone 3"), tl!("Tone 4")]; + let process = tl!("Process Color"); + let names: Vec<&str> = std::iter::once(process).chain(swatches.iter().map(|(n, _)| n.as_str())).collect(); + for (i, tone) in tones.iter_mut().enumerate() { + let Some(t) = tone.as_object_mut() else { continue }; + ui.horizontal(|ui| { + let on = t.get("active").and_then(Value::as_bool).unwrap_or(true); + if widgets::check(ui, labels.get(i).copied().unwrap_or_default(), on, true) { + t.insert("active".into(), json!(!on)); + } + tone_row(ui, (i, labels.get(i).copied().unwrap_or_default()), t, &swatches, &names); + }); + } + ui.add_space(6.0); + widgets::subheader(ui, tl!("Curve")); + let picked = (d.f64("__tone", 0.0).max(0.0) as usize).min(MAX_TONES - 1); + ui.horizontal(|ui| { + let current = labels.get(picked).copied().unwrap_or_default(); + if let Some(i) = widgets::dropdown_named(ui, "duotone-curve-tone", Some(tl!("Curve")), current, &labels, 120.0) { + d.fields.insert("__tone".into(), json!(i)); + } + }); + if let Some(t) = tones.get_mut(picked).and_then(Value::as_object_mut) { + curve_fields(ui, t); + } + d.fields.insert("tones".into(), Value::Array(tones)); + ui.add_space(4.0); + form::check(ui, d, "skipSpot", tl!("Skip Objects with Spot Colors")); +} + +/// Tone `i`'s (named `name`) colour chip, its swatch (or Process Color) and, as a process colour, +/// its hex value. +fn tone_row(ui: &mut egui::Ui, (i, name): (usize, &str), t: &mut Map, swatches: &[(String, Color)], names: &[&str]) { + let color = tone_color(&Value::Object(t.clone())); + let (chip, _) = ui.allocate_exact_size(egui::vec2(16.0, 16.0), egui::Sense::hover()); + widgets::paint_chip(ui, chip, &Paint::solid(color)); + let swatch = t.get("swatch").and_then(Value::as_str).filter(|s| !s.is_empty()).map(str::to_string); + let current = swatch.as_deref().unwrap_or(names.first().copied().unwrap_or_default()); + if let Some(k) = widgets::dropdown_names_named(ui, ("duotone-swatch", i), Some(name), current, names, 130.0) { + match k.checked_sub(1).and_then(|k| swatches.get(k)) { + Some((name, c)) => { + t.insert("swatch".into(), json!(name)); + t.insert("color".into(), serde_json::to_value(c).unwrap_or(Value::Null)); + } + None => { + t.remove("swatch"); + } + } + } + if swatch.is_none() + && let Some(hex) = widgets::hex_field_named(ui, ("duotone-hex", i), Some(name), color.to_hex().trim_start_matches('#')) + && let Some(c) = Color::from_hex(&format!("#{hex}")) + { + t.insert("color".into(), json!(c.to_hex())); + } +} + +/// The picked tone's curve: the graph, its points as text, and Reset to Linear or to Inverse. +fn curve_fields(ui: &mut egui::Ui, t: &mut Map) { + let mut pts = tone_curve_points(t.get("curve")); + if curve_graph(ui, &mut pts, 100.0) { + t.insert("curve".into(), json!(points_text(&pts, 100.0))); + } + widgets::label_row(ui, tl!("Points"), LABEL_W, |ui| { + let mut text = t.get("curve").and_then(Value::as_str).unwrap_or(LINEAR).to_string(); + if ui.add(egui::TextEdit::singleline(&mut text).desired_width(200.0)).changed() { + t.insert("curve".into(), json!(text)); + } + }); + ui.horizontal(|ui| { + for (label, curve) in [(tl!("Reset to Linear"), LINEAR), (tl!("Reset to Inverse"), INVERSE)] { + if widgets::flat_button(ui, label, 120.0).clicked() { + t.insert("curve".into(), json!(curve)); + } + } + }); +} diff --git a/crates/ui-egui/src/dialogs/effect.rs b/crates/ui-egui/src/dialogs/effect.rs index d54fe82962..6fc6203de6 100644 --- a/crates/ui-egui/src/dialogs/effect.rs +++ b/crates/ui-egui/src/dialogs/effect.rs @@ -167,6 +167,10 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { super::halftone::screen_fields(ui, d); values_changed(d) } + None if id == vectorcraft_effects::addons::duotone::DUOTONE => { + super::duotone::fields(app, ui, d); + values_changed(d) + } None if id == GLASS => glass_fields(app, ui, d, GLASS), None if id == TEXTURIZER => glass_fields(app, ui, d, TEXTURIZER), None if id == TRANSFORM => transform_fields(ui, d, app.session.general_unit()), @@ -454,7 +458,10 @@ fn adjust_fields(ui: &mut egui::Ui, d: &mut Dialog) -> bool { if d.fields.contains_key("points") { ui.horizontal(|ui| { ui.add_space(LABEL_W + ui.spacing().item_spacing.x); - curve_graph(ui, d); + let mut pts = vectorcraft_effects::curve_points(d.fields.get("points")); + if curve_graph(ui, &mut pts, 255.0) { + d.fields.insert("points".into(), json!(points_text(&pts, 255.0))); + } }); } for (key, label, width) in [("points", tl!("Points"), 220.0), ("color", tl!("Color"), 120.0)] { @@ -714,15 +721,15 @@ fn drop_shadow_fields(ui: &mut egui::Ui, d: &mut Dialog, unit: vectorcraft_doc:: values_changed(d) } -/// Curves' graph of its `points` (input across, output up, 0..255): drag a point to move it -/// between its neighbours, press on the graph away from the points to add one there, drag one -/// off the graph to remove it (two always stay). -fn curve_graph(ui: &mut egui::Ui, d: &mut Dialog) { +/// A curve's graph of its points `pts` (0..1 each; input across, output up), as Curves and +/// Duotone's tones edit them on a scale of 0..`max`: drag a point to move it between its +/// neighbours, press on the graph away from the points to add one there, drag one off the graph +/// to remove it (two always stay). Returns whether the points changed. +pub(super) fn curve_graph(ui: &mut egui::Ui, pts: &mut Vec<(f32, f32)>, max: f32) -> bool { const SIZE: f32 = 200.0; /// How near (screen points) a press must be to take a point. const GRAB: f32 = 8.0; let t = Tokens::get(ui.ctx()); - let mut pts = vectorcraft_effects::curve_points(d.fields.get("points")); let (rect, resp) = ui.allocate_exact_size(egui::vec2(SIZE, SIZE), egui::Sense::click_and_drag()); let screen = |(x, y): (f32, f32)| egui::pos2(rect.left() + x * SIZE, rect.bottom() - y * SIZE); let unit = |p: egui::Pos2| (((p.x - rect.left()) / SIZE).clamp(0.0, 1.0), ((rect.bottom() - p.y) / SIZE).clamp(0.0, 1.0)); @@ -752,7 +759,7 @@ fn curve_graph(ui: &mut egui::Ui, d: &mut Dialog) { pts.remove(i.min(pts.len() - 1)); grabbed = None; } else { - let step = 1.0 / 255.0; + let step = 1.0 / max; let lo = if i == 0 { 0.0 } else { pts.get(i - 1).map_or(0.0, |a| a.0 + step) }; let hi = pts.get(i + 1).map_or(1.0, |a| a.0 - step); let (x, y) = unit(p); @@ -776,17 +783,19 @@ fn curve_graph(ui: &mut egui::Ui, d: &mut Dialog) { painter.line_segment([screen((0.0, f)), screen((1.0, f))], faint); } painter.line_segment([screen((0.0, 0.0)), screen((1.0, 1.0))], faint); - let curve: Vec = (0..=64).map(|k| k as f32 / 64.0).map(|x| screen((x, vectorcraft_effects::curve_at(&pts, x)))).collect(); + let curve: Vec = (0..=64).map(|k| k as f32 / 64.0).map(|x| screen((x, vectorcraft_effects::curve_at(pts.as_slice(), x)))).collect(); painter.add(egui::Shape::line(curve, egui::Stroke::new(1.5, t.text))); for (i, q) in pts.iter().enumerate() { let fill = if Some(i) == grabbed { t.accent } else { t.panel }; painter.circle(screen(*q), 4.0, fill, egui::Stroke::new(1.5, t.text)); } painter.rect_stroke(rect, 2.0, egui::Stroke::new(1.0, t.input_border), egui::StrokeKind::Inside); - if changed { - let text: Vec = pts.iter().map(|(x, y)| format!("{},{}", (x * 255.0).round(), (y * 255.0).round())).collect(); - d.fields.insert("points".into(), json!(text.join(" "))); - } + changed +} + +/// Curve points `pts` (0..1) as the `"x,y x,y …"` text of a curve on a scale of 0..`max`. +pub(super) fn points_text(pts: &[(f32, f32)], max: f32) -> String { + pts.iter().map(|(x, y)| format!("{},{}", (x * max).round(), (y * max).round())).collect::>().join(" ") } /// What OK runs: `effect.setParams` on the edited effect (`__index`), else `effect.apply` of the diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 530dc7b5d7..2a64dfdb74 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5749,3 +5749,26 @@ anchor Points: Точки: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Цвят на точките от илюстрацията + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Двутон… + Duotone Двутон + Print Ink Fixes… Корекции на мастилата за печат… + Print Ink Fixes Корекции на мастилата за печат + Inks Мастила + Tone 1 Тон 1 + Tone 2 Тон 2 + Tone 3 Тон 3 + Tone 4 Тон 4 + Curve Крива + Reset to Linear Връщане към линейна + Reset to Inverse Връщане към обърната + Skip Objects with Spot Colors Пропускане на обекти с плакатни цветове + Ink Limit Лимит на мастилото + Exclude Pure Black Без чисто черно + Remove White Overprint Премахване на напечатването на бялото + Overprint Black Напечатване на черното + Text Only Само текст +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` задайте `inkLimit`, `removeWhiteOverprint` или `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Корекциите на мастилата за печат работят върху CMYK документи: първо изберете Файл › Цветен режим на документа › CMYK цвят +@msg `{key}` must be 0..{max} `{key}` трябва да е 0..{max} diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 08e8c524d1..473c7b8bf9 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5850,3 +5850,26 @@ anchor Points: Punts: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Color dels punts de la il·lustració + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Bitò… + Duotone Bitò + Print Ink Fixes… Correccions de tinta per a impressió… + Print Ink Fixes Correccions de tinta per a impressió + Inks Tintes + Tone 1 To 1 + Tone 2 To 2 + Tone 3 To 3 + Tone 4 To 4 + Curve Corba + Reset to Linear Restableix a lineal + Reset to Inverse Restableix a invertida + Skip Objects with Spot Colors Omet els objectes amb colors directes + Ink Limit Límit de tinta + Exclude Pure Black Exclou el negre pur + Remove White Overprint Elimina la sobreimpressió del blanc + Overprint Black Sobreimpressió del negre + Text Only Només text +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` indiqueu `inkLimit`, `removeWhiteOverprint` o `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Les correccions de tinta per a impressió funcionen en documents CMYK: trieu primer Fitxer › Mode de color del document › Color CMYK +@msg `{key}` must be 0..{max} `{key}` ha de ser 0..{max} diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 30ebe1e7f0..91be88b94f 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -5859,3 +5859,26 @@ anchor Points: Body: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Barva bodů podle kresby + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Dvoutón… + Duotone Dvoutón + Print Ink Fixes… Opravy tiskových barev… + Print Ink Fixes Opravy tiskových barev + Inks Barvy + Tone 1 Tón 1 + Tone 2 Tón 2 + Tone 3 Tón 3 + Tone 4 Tón 4 + Curve Křivka + Reset to Linear Obnovit lineární + Reset to Inverse Obnovit obrácenou + Skip Objects with Spot Colors Vynechat objekty s přímými barvami + Ink Limit Limit barvy + Exclude Pure Black Vyloučit čistou černou + Remove White Overprint Odebrat přetisk bílé + Overprint Black Přetisk černé + Text Only Pouze text +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` zadejte `inkLimit`, `removeWhiteOverprint` nebo `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Opravy tiskových barev fungují v dokumentech CMYK: nejprve zvolte Soubor › Barevný režim dokumentu › Barvy CMYK +@msg `{key}` must be 0..{max} `{key}` musí být 0..{max} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 1c67176a24..bc671274c4 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5764,3 +5764,26 @@ anchor Points: Punkter: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Prikfarve fra grafik + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Duotone… + Duotone Duotone + Print Ink Fixes… Trykfarverettelser… + Print Ink Fixes Trykfarverettelser + Inks Trykfarver + Tone 1 Tone 1 + Tone 2 Tone 2 + Tone 3 Tone 3 + Tone 4 Tone 4 + Curve Kurve + Reset to Linear Nulstil til lineær + Reset to Inverse Nulstil til omvendt + Skip Objects with Spot Colors Spring objekter med spotfarver over + Ink Limit Farvegrænse + Exclude Pure Black Udelad ren sort + Remove White Overprint Fjern overprint af hvid + Overprint Black Overprint sort + Text Only Kun tekst +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` angiv `inkLimit`, `removeWhiteOverprint` eller `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Trykfarverettelser virker på CMYK-dokumenter: vælg først Filer › Dokumentets farvetilstand › CMYK-farve +@msg `{key}` must be 0..{max} `{key}` skal være 0..{max} diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index cf6c8aec57..a87dcbc6a9 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -5444,3 +5444,26 @@ anchor Points: Punkte: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Punktfarbe aus Grafik + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Duplex… + Duotone Duplex + Print Ink Fixes… Druckfarbkorrekturen… + Print Ink Fixes Druckfarbkorrekturen + Inks Druckfarben + Tone 1 Druckfarbe 1 + Tone 2 Druckfarbe 2 + Tone 3 Druckfarbe 3 + Tone 4 Druckfarbe 4 + Curve Kurve + Reset to Linear Auf linear zurücksetzen + Reset to Inverse Auf umgekehrt zurücksetzen + Skip Objects with Spot Colors Objekte mit Volltonfarben auslassen + Ink Limit Farbauftragsgrenze + Exclude Pure Black Reines Schwarz ausnehmen + Remove White Overprint Überdrucken von Weiß entfernen + Overprint Black Schwarz überdrucken + Text Only Nur Text +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` geben Sie `inkLimit`, `removeWhiteOverprint` oder `overprintBlack` an +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Druckfarbkorrekturen wirken in CMYK-Dokumenten: Wählen Sie zuerst Datei › Dokumentfarbmodus › CMYK-Farbe +@msg `{key}` must be 0..{max} `{key}` muss 0..{max} sein diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 91c001e7a0..8b571c11f6 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5811,3 +5811,26 @@ anchor Points: Σημεία: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Χρώμα κουκκίδων από το γραφικό + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Δίτονο… + Duotone Δίτονο + Print Ink Fixes… Διορθώσεις μελανιών εκτύπωσης… + Print Ink Fixes Διορθώσεις μελανιών εκτύπωσης + Inks Μελάνια + Tone 1 Τόνος 1 + Tone 2 Τόνος 2 + Tone 3 Τόνος 3 + Tone 4 Τόνος 4 + Curve Καμπύλη + Reset to Linear Επαναφορά σε γραμμική + Reset to Inverse Επαναφορά σε αντεστραμμένη + Skip Objects with Spot Colors Παράλειψη αντικειμένων με χρώματα spot + Ink Limit Όριο μελανιού + Exclude Pure Black Εξαίρεση καθαρού μαύρου + Remove White Overprint Αφαίρεση υπερεκτύπωσης λευκού + Overprint Black Υπερεκτύπωση μαύρου + Text Only Μόνο κείμενο +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` δώστε `inkLimit`, `removeWhiteOverprint` ή `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Οι διορθώσεις μελανιών εκτύπωσης ισχύουν σε έγγραφα CMYK: επιλέξτε πρώτα Αρχείο › Λειτουργία χρώματος εγγράφου › Χρώμα CMYK +@msg `{key}` must be 0..{max} το `{key}` πρέπει να είναι 0..{max} diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 8eaac3bb77..b84ce995a8 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -5802,3 +5802,26 @@ anchor Points: Puntos: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Color de puntos de la ilustración + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Duotono… + Duotone Duotono + Print Ink Fixes… Correcciones de tinta para impresión… + Print Ink Fixes Correcciones de tinta para impresión + Inks Tintas + Tone 1 Tono 1 + Tone 2 Tono 2 + Tone 3 Tono 3 + Tone 4 Tono 4 + Curve Curva + Reset to Linear Restablecer a lineal + Reset to Inverse Restablecer a invertida + Skip Objects with Spot Colors Omitir objetos con tintas planas + Ink Limit Límite de tinta + Exclude Pure Black Excluir negro puro + Remove White Overprint Quitar sobreimpresión del blanco + Overprint Black Sobreimprimir negro + Text Only Solo texto +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` indique `inkLimit`, `removeWhiteOverprint` u `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Las correcciones de tinta para impresión funcionan en documentos CMYK: elija primero Archivo › Modo de color del documento › Color CMYK +@msg `{key}` must be 0..{max} `{key}` debe ser 0..{max} diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 3b0bb739e4..47aab93774 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -5890,3 +5890,26 @@ anchor Points: Pisteet: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Pisteiden väri kuvituksesta + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Duotone… + Duotone Duotone + Print Ink Fixes… Painovärien korjaukset… + Print Ink Fixes Painovärien korjaukset + Inks Painovärit + Tone 1 Sävy 1 + Tone 2 Sävy 2 + Tone 3 Sävy 3 + Tone 4 Sävy 4 + Curve Käyrä + Reset to Linear Palauta lineaariseksi + Reset to Inverse Palauta käänteiseksi + Skip Objects with Spot Colors Ohita objektit, joissa on spottivärejä + Ink Limit Värirajoitus + Exclude Pure Black Jätä puhdas musta pois + Remove White Overprint Poista valkoisen päällepainatus + Overprint Black Päällepainata musta + Text Only Vain teksti +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` anna `inkLimit`, `removeWhiteOverprint` tai `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Painovärien korjaukset toimivat CMYK-asiakirjoissa: valitse ensin Tiedosto › Asiakirjan väritila › CMYK-väri +@msg `{key}` must be 0..{max} `{key}` on oltava 0..{max} diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index f90d02f879..8e1fb1a783 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -5858,3 +5858,26 @@ anchor Points: Points : # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Couleur des points d’après l’illustration + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Bichromie… + Duotone Bichromie + Print Ink Fixes… Corrections d’encres pour l’impression… + Print Ink Fixes Corrections d’encres pour l’impression + Inks Encres + Tone 1 Ton 1 + Tone 2 Ton 2 + Tone 3 Ton 3 + Tone 4 Ton 4 + Curve Courbe + Reset to Linear Réinitialiser en linéaire + Reset to Inverse Réinitialiser en inversée + Skip Objects with Spot Colors Ignorer les objets avec tons directs + Ink Limit Limite d’encrage + Exclude Pure Black Exclure le noir pur + Remove White Overprint Supprimer la surimpression du blanc + Overprint Black Surimpression du noir + Text Only Texte uniquement +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` indiquez `inkLimit`, `removeWhiteOverprint` ou `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Les corrections d’encres pour l’impression s’appliquent aux documents CMJN : choisissez d’abord Fichier › Mode colorimétrique du document › Couleur CMJN +@msg `{key}` must be 0..{max} `{key}` doit être compris entre 0 et {max} diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index b8035f4c2e..fa4728ec47 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5846,3 +5846,26 @@ anchor Points: Pontok: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Pontszín a grafikából + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Duplex… + Duotone Duplex + Print Ink Fixes… Nyomdai festékjavítások… + Print Ink Fixes Nyomdai festékjavítások + Inks Festékek + Tone 1 1. tónus + Tone 2 2. tónus + Tone 3 3. tónus + Tone 4 4. tónus + Curve Görbe + Reset to Linear Visszaállítás lineárisra + Reset to Inverse Visszaállítás fordítottra + Skip Objects with Spot Colors Direkt színeket használó objektumok kihagyása + Ink Limit Festékkorlát + Exclude Pure Black Tiszta fekete kizárása + Remove White Overprint Fehér felülnyomásának eltávolítása + Overprint Black Fekete felülnyomása + Text Only Csak szöveg +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` adja meg: `inkLimit`, `removeWhiteOverprint` vagy `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first A nyomdai festékjavítások CMYK-dokumentumokon működnek: előbb válassza a Fájl › Dokumentum színmódja › CMYK-szín parancsot +@msg `{key}` must be 0..{max} `{key}` értéke 0..{max} lehet diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 995e574582..0907afd036 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5764,3 +5764,26 @@ anchor Points: Titik: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Warna titik dari karya seni + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Duotone… + Duotone Duotone + Print Ink Fixes… Perbaikan Tinta Cetak… + Print Ink Fixes Perbaikan Tinta Cetak + Inks Tinta + Tone 1 Nada 1 + Tone 2 Nada 2 + Tone 3 Nada 3 + Tone 4 Nada 4 + Curve Kurva + Reset to Linear Atur ulang ke linear + Reset to Inverse Atur ulang ke terbalik + Skip Objects with Spot Colors Lewati objek dengan warna spot + Ink Limit Batas tinta + Exclude Pure Black Kecualikan hitam murni + Remove White Overprint Hapus overprint putih + Overprint Black Overprint hitam + Text Only Hanya teks +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` berikan `inkLimit`, `removeWhiteOverprint`, atau `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Perbaikan Tinta Cetak bekerja pada dokumen CMYK: pilih dulu Berkas › Mode warna dokumen › Warna CMYK +@msg `{key}` must be 0..{max} `{key}` harus 0..{max} diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index ffcb2a32a9..13b70da3c7 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -5478,3 +5478,26 @@ anchor Points: Punti: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Colore punti dalla grafica + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Bicromia… + Duotone Bicromia + Print Ink Fixes… Correzioni inchiostri di stampa… + Print Ink Fixes Correzioni inchiostri di stampa + Inks Inchiostri + Tone 1 Tono 1 + Tone 2 Tono 2 + Tone 3 Tono 3 + Tone 4 Tono 4 + Curve Curva + Reset to Linear Ripristina lineare + Reset to Inverse Ripristina invertita + Skip Objects with Spot Colors Salta oggetti con colori spot + Ink Limit Limite inchiostro + Exclude Pure Black Escludi nero puro + Remove White Overprint Rimuovi sovrastampa del bianco + Overprint Black Sovrastampa nero + Text Only Solo testo +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` indica `inkLimit`, `removeWhiteOverprint` o `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Le correzioni inchiostri di stampa funzionano nei documenti CMYK: scegli prima File › Metodo colore documento › Colore CMYK +@msg `{key}` must be 0..{max} `{key}` deve essere 0..{max} diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 5a8d912427..274d1eff83 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -5547,3 +5547,26 @@ anchor Points: ポイント: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art ドットの色をアートから取得 + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… ダブルトーン… + Duotone ダブルトーン + Print Ink Fixes… 印刷インキの修正… + Print Ink Fixes 印刷インキの修正 + Inks インキ + Tone 1 トーン 1 + Tone 2 トーン 2 + Tone 3 トーン 3 + Tone 4 トーン 4 + Curve カーブ + Reset to Linear 直線にリセット + Reset to Inverse 反転にリセット + Skip Objects with Spot Colors 特色を使用したオブジェクトをスキップ + Ink Limit インキ総量の上限 + Exclude Pure Black 純粋なブラックを除外 + Remove White Overprint 白のオーバープリントを削除 + Overprint Black ブラックをオーバープリント + Text Only テキストのみ +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` `inkLimit`、`removeWhiteOverprint` または `overprintBlack` を指定してください +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first 印刷インキの修正は CMYK ドキュメントで使用できます。先にファイル › ドキュメントのカラーモード › CMYK カラーを選択してください +@msg `{key}` must be 0..{max} `{key}` は 0..{max} にしてください diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index d150719a28..236a14befb 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5849,3 +5849,26 @@ anchor Points: წერტილები: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art წერტილების ფერი ნახატიდან + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… დუოტონი… + Duotone დუოტონი + Print Ink Fixes… საბეჭდი მელნის შესწორებები… + Print Ink Fixes საბეჭდი მელნის შესწორებები + Inks მელნები + Tone 1 ტონი 1 + Tone 2 ტონი 2 + Tone 3 ტონი 3 + Tone 4 ტონი 4 + Curve მრუდი + Reset to Linear წრფივზე დაბრუნება + Reset to Inverse შებრუნებულზე დაბრუნება + Skip Objects with Spot Colors სპოტ-ფერების მქონე ობიექტების გამოტოვება + Ink Limit მელნის ზღვარი + Exclude Pure Black სუფთა შავის გამორიცხვა + Remove White Overprint თეთრის ზედდაბეჭდვის მოხსნა + Overprint Black შავის ზედდაბეჭდვა + Text Only მხოლოდ ტექსტი +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` მიუთითეთ `inkLimit`, `removeWhiteOverprint` ან `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first საბეჭდი მელნის შესწორებები მუშაობს CMYK დოკუმენტებზე: ჯერ აირჩიეთ ფაილი › დოკუმენტის ფერის რეჟიმი › CMYK ფერი +@msg `{key}` must be 0..{max} `{key}` უნდა იყოს 0..{max} diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index e956dc4a30..2bc410a421 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5441,3 +5441,26 @@ anchor Points: 포인트: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art 아트워크에서 점 색상 가져오기 + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… 이중톤… + Duotone 이중톤 + Print Ink Fixes… 인쇄 잉크 수정… + Print Ink Fixes 인쇄 잉크 수정 + Inks 잉크 + Tone 1 톤 1 + Tone 2 톤 2 + Tone 3 톤 3 + Tone 4 톤 4 + Curve 곡선 + Reset to Linear 선형으로 재설정 + Reset to Inverse 반전으로 재설정 + Skip Objects with Spot Colors 별색을 사용한 개체 건너뛰기 + Ink Limit 잉크 한계 + Exclude Pure Black 순수 검정 제외 + Remove White Overprint 흰색 겹쳐찍기 제거 + Overprint Black 검정 겹쳐찍기 + Text Only 문자만 +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` `inkLimit`, `removeWhiteOverprint` 또는 `overprintBlack`을 지정하십시오 +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first 인쇄 잉크 수정은 CMYK 문서에서 작동합니다. 먼저 파일 › 문서 색상 모드 › CMYK 색상을 선택하십시오 +@msg `{key}` must be 0..{max} `{key}`은(는) 0..{max}이어야 합니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index fbe5d843c6..d5c08f815a 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5808,3 +5808,26 @@ anchor Points: Punten: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Puntkleur uit artwork + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Duotoon… + Duotone Duotoon + Print Ink Fixes… Drukinktcorrecties… + Print Ink Fixes Drukinktcorrecties + Inks Inkten + Tone 1 Toon 1 + Tone 2 Toon 2 + Tone 3 Toon 3 + Tone 4 Toon 4 + Curve Curve + Reset to Linear Herstellen naar lineair + Reset to Inverse Herstellen naar omgekeerd + Skip Objects with Spot Colors Objecten met steunkleuren overslaan + Ink Limit Inktlimiet + Exclude Pure Black Puur zwart uitsluiten + Remove White Overprint Overprint van wit verwijderen + Overprint Black Zwart overprinten + Text Only Alleen tekst +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` geef `inkLimit`, `removeWhiteOverprint` of `overprintBlack` op +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Drukinktcorrecties werken in CMYK-documenten: kies eerst Bestand › Documentkleurmodus › CMYK-kleur +@msg `{key}` must be 0..{max} `{key}` moet 0..{max} zijn diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 618cf8553c..c456c6df8f 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -5714,3 +5714,26 @@ anchor Points: Punkty: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Kolor kropek z kompozycji + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Dwutonowy… + Duotone Dwutonowy + Print Ink Fixes… Poprawki farb drukarskich… + Print Ink Fixes Poprawki farb drukarskich + Inks Farby + Tone 1 Ton 1 + Tone 2 Ton 2 + Tone 3 Ton 3 + Tone 4 Ton 4 + Curve Krzywa + Reset to Linear Resetuj do liniowej + Reset to Inverse Resetuj do odwróconej + Skip Objects with Spot Colors Pomiń obiekty z kolorami dodatkowymi + Ink Limit Limit farby + Exclude Pure Black Wyklucz czystą czerń + Remove White Overprint Usuń nadruk bieli + Overprint Black Nadruk czerni + Text Only Tylko tekst +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` podaj `inkLimit`, `removeWhiteOverprint` lub `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Poprawki farb drukarskich działają w dokumentach CMYK: najpierw wybierz Plik › Tryb koloru dokumentu › Kolor CMYK +@msg `{key}` must be 0..{max} `{key}` musi wynosić 0..{max} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index a381352984..b95ea47bda 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -5777,3 +5777,26 @@ anchor Points: Pontos: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Cor dos Pontos da Arte + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Duotom… + Duotone Duotom + Print Ink Fixes… Correções de Tinta para Impressão… + Print Ink Fixes Correções de Tinta para Impressão + Inks Tintas + Tone 1 Tom 1 + Tone 2 Tom 2 + Tone 3 Tom 3 + Tone 4 Tom 4 + Curve Curva + Reset to Linear Redefinir para linear + Reset to Inverse Redefinir para invertida + Skip Objects with Spot Colors Ignorar objetos com cores spot + Ink Limit Limite de tinta + Exclude Pure Black Excluir preto puro + Remove White Overprint Remover sobreimpressão do branco + Overprint Black Sobreimpressão de Preto + Text Only Somente texto +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` informe `inkLimit`, `removeWhiteOverprint` ou `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first As Correções de Tinta para Impressão funcionam em documentos CMYK: escolha antes Arquivo › Modo de Cor do Documento › Cor CMYK +@msg `{key}` must be 0..{max} `{key}` deve ser 0..{max} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index b1c4c01be7..bbeca6300c 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -5837,3 +5837,26 @@ anchor Points: Точки: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Цвет точек из рисунка + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Дуплекс… + Duotone Дуплекс + Print Ink Fixes… Исправления печатных красок… + Print Ink Fixes Исправления печатных красок + Inks Краски + Tone 1 Тон 1 + Tone 2 Тон 2 + Tone 3 Тон 3 + Tone 4 Тон 4 + Curve Кривая + Reset to Linear Сбросить на линейную + Reset to Inverse Сбросить на обратную + Skip Objects with Spot Colors Пропускать объекты с плашечными цветами + Ink Limit Предел краски + Exclude Pure Black Исключить чистый чёрный + Remove White Overprint Убрать наложение белого + Overprint Black Наложение чёрного + Text Only Только текст +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` задайте `inkLimit`, `removeWhiteOverprint` или `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Исправления печатных красок работают в документах CMYK: сначала выберите Файл › Цветовой режим документа › Цвет CMYK +@msg `{key}` must be 0..{max} `{key}` должен быть 0..{max} diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 3593d08d94..7ba6023b4c 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5915,3 +5915,26 @@ shape Open Öppen # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Punktfärg från objekt + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Duoton… + Duotone Duoton + Print Ink Fixes… Tryckfärgskorrigeringar… + Print Ink Fixes Tryckfärgskorrigeringar + Inks Tryckfärger + Tone 1 Ton 1 + Tone 2 Ton 2 + Tone 3 Ton 3 + Tone 4 Ton 4 + Curve Kurva + Reset to Linear Återställ till linjär + Reset to Inverse Återställ till omvänd + Skip Objects with Spot Colors Hoppa över objekt med dekorfärger + Ink Limit Färggräns + Exclude Pure Black Uteslut ren svart + Remove White Overprint Ta bort övertryck av vitt + Overprint Black Övertryck svart + Text Only Endast text +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` ange `inkLimit`, `removeWhiteOverprint` eller `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Tryckfärgskorrigeringar fungerar i CMYK-dokument: välj först Fil › Dokumentets färgläge › CMYK-färg +@msg `{key}` must be 0..{max} `{key}` måste vara 0..{max} diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index eb2a277f00..f445da8adb 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5817,3 +5817,26 @@ anchor Points: Noktalar: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Nokta Rengini Sanattan Al + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Çift Ton… + Duotone Çift Ton + Print Ink Fixes… Baskı Mürekkebi Düzeltmeleri… + Print Ink Fixes Baskı Mürekkebi Düzeltmeleri + Inks Mürekkepler + Tone 1 Ton 1 + Tone 2 Ton 2 + Tone 3 Ton 3 + Tone 4 Ton 4 + Curve Eğri + Reset to Linear Doğrusala sıfırla + Reset to Inverse Terse sıfırla + Skip Objects with Spot Colors Spot renkli nesneleri atla + Ink Limit Mürekkep sınırı + Exclude Pure Black Saf siyahı hariç tut + Remove White Overprint Beyazın üst baskısını kaldır + Overprint Black Üst Baskı Siyah + Text Only Yalnızca metin +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` `inkLimit`, `removeWhiteOverprint` veya `overprintBlack` verin +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Baskı Mürekkebi Düzeltmeleri CMYK belgelerinde çalışır: önce Dosya › Belge Renk Modu › CMYK Rengi'ni seçin +@msg `{key}` must be 0..{max} `{key}` 0..{max} olmalıdır diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 535cbeacca..26da71aac1 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -5458,3 +5458,26 @@ anchor Points: Точки: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Колір точок із малюнка + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Дуплекс… + Duotone Дуплекс + Print Ink Fixes… Виправлення друкарських фарб… + Print Ink Fixes Виправлення друкарських фарб + Inks Фарби + Tone 1 Тон 1 + Tone 2 Тон 2 + Tone 3 Тон 3 + Tone 4 Тон 4 + Curve Крива + Reset to Linear Скинути до лінійної + Reset to Inverse Скинути до оберненої + Skip Objects with Spot Colors Пропускати об’єкти з плашковими кольорами + Ink Limit Межа фарби + Exclude Pure Black Виключити чистий чорний + Remove White Overprint Прибрати накладення білого + Overprint Black Накладення чорного + Text Only Лише текст +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` задайте `inkLimit`, `removeWhiteOverprint` або `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Виправлення друкарських фарб працюють у документах CMYK: спершу виберіть Файл › Колірний режим документа › Колір CMYK +@msg `{key}` must be 0..{max} `{key}` має бути 0..{max} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index baf4a60d9b..f26f07db70 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5460,3 +5460,26 @@ anchor Points: Điểm: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art Màu chấm theo tác phẩm + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… Hai tông… + Duotone Hai tông + Print Ink Fixes… Sửa mực in… + Print Ink Fixes Sửa mực in + Inks Mực + Tone 1 Tông 1 + Tone 2 Tông 2 + Tone 3 Tông 3 + Tone 4 Tông 4 + Curve Đường cong + Reset to Linear Đặt lại thành tuyến tính + Reset to Inverse Đặt lại thành đảo ngược + Skip Objects with Spot Colors Bỏ qua đối tượng có màu pha + Ink Limit Giới hạn mực + Exclude Pure Black Loại trừ đen thuần + Remove White Overprint Bỏ in chồng màu trắng + Overprint Black In chồng đen + Text Only Chỉ văn bản +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` hãy cho `inkLimit`, `removeWhiteOverprint` hoặc `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Sửa mực in hoạt động trên tài liệu CMYK: trước hết chọn Tệp › Chế độ màu tài liệu › Màu CMYK +@msg `{key}` must be 0..{max} `{key}` phải là 0..{max} diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index d49842dbcf..76378e4e88 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -5701,3 +5701,26 @@ anchor Points: 点: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art 网点颜色取自图稿 + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… 双色调… + Duotone 双色调 + Print Ink Fixes… 印刷油墨修正… + Print Ink Fixes 印刷油墨修正 + Inks 油墨 + Tone 1 色调 1 + Tone 2 色调 2 + Tone 3 色调 3 + Tone 4 色调 4 + Curve 曲线 + Reset to Linear 重置为线性 + Reset to Inverse 重置为反相 + Skip Objects with Spot Colors 跳过使用专色的对象 + Ink Limit 油墨限制 + Exclude Pure Black 排除纯黑 + Remove White Overprint 移除白色叠印 + Overprint Black 黑色叠印 + Text Only 仅文字 +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` 请指定 `inkLimit`、`removeWhiteOverprint` 或 `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first 印刷油墨修正适用于 CMYK 文档:请先选择 文件 › 文档颜色模式 › CMYK 颜色 +@msg `{key}` must be 0..{max} `{key}` 必须为 0..{max} diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index e305bc4457..34597f4aa7 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -5497,3 +5497,26 @@ anchor Points: 點: # Color Effects add-on: Vector Halftone (Effect › Color Effects). Dot Color from Art 網點顏色取自圖稿 + +# Color Effects add-on: Duotone (Effect › Color Effects) and Print Ink Fixes (Object › Plug-ins › Color Effects). + Duotone… 雙色調… + Duotone 雙色調 + Print Ink Fixes… 印刷油墨修正… + Print Ink Fixes 印刷油墨修正 + Inks 油墨 + Tone 1 色調 1 + Tone 2 色調 2 + Tone 3 色調 3 + Tone 4 色調 4 + Curve 曲線 + Reset to Linear 重設為線性 + Reset to Inverse 重設為反轉 + Skip Objects with Spot Colors 略過使用特別色的物件 + Ink Limit 油墨限制 + Exclude Pure Black 排除純黑 + Remove White Overprint 移除白色疊印 + Overprint Black 疊印黑色 + Text Only 僅文字 +@msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` 請指定 `inkLimit`、`removeWhiteOverprint` 或 `overprintBlack` +@msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first 印刷油墨修正適用於 CMYK 文件:請先選擇 檔案 › 文件色彩模式 › CMYK 色彩 +@msg `{key}` must be 0..{max} `{key}` 必須為 0..{max} diff --git a/docs/mcp.md b/docs/mcp.md index 17627ddead..d0568d5cdb 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5898,6 +5898,7 @@ the other colour adjustments (Effect › Color Adjustments); each colour keeps i |---|---|---| | `addon.color.exposure` (Exposure…) | `exposure` stops −20…20 (0), `offset` −0.5…0.5 (0), `gamma` 0.1…10 (1) | Scales the light in linear light (each stop doubles or halves it, mostly in the highlights), adds the offset (shadows and midtones) and applies the gamma | | `addon.color.desaturate` (Desaturate) | none | Turns every colour to the grey of its lightness | +| `addon.color.duotone` (Duotone…) | `tones`, `skipSpot` (below) | Prints each colour's tone with one to four inks | | `addon.color.invert` (Invert Colors) | none | Turns every colour to its RGB inverse | `addon.color.filter {effect, params?, fill?, stroke?, includeImages?, includePatterns?, ids?}` applies any colour @@ -5951,3 +5952,59 @@ those paths. Not yet: stochastic (FM) and radial patterns, a dot-gain curve, per-screen separation settings, and type or symbols as dots. + +### Duotone (live) + +`addon.color.duotone` (Effect › Color Effects › Duotone…, also in Object › Plug-ins › Color Effects and the panel's Inks) +prints the grey-equivalent tone of each colour the object paints with one to four inks: a monotone, duotone, tritone or +quadtone. It is a colour adjustment like the add-on's others, so it goes on through `effect.apply`, stacks with the +other adjustments and works as a filter through `addon.color.filter {effect: "addon.color.duotone", params}`; Expand +Appearance gives the same colours as the filter. + +| Parameter | Values (default) | Does | +|---|---|---| +| `tones` | up to four `{color, swatch?, curve?, active?}` (one black tone) | The inks; tones past the fourth are left out, and one not `active` (true) is skipped | +| `tones[].color` | `#rrggbb`, `[r, g, b]` or a colour object (`#000000`) | The ink's colour; with a `swatch`, that swatch's colour (the dialog fills it in) | +| `tones[].swatch` | a global or spot swatch's name (none) | The swatch the ink is | +| `tones[].curve` | `"tint,ink tint,ink …"` or `[[tint, ink], …]`, 0…100, at most 64 points (`"0,0 100,100"`) | The tone's tint to the ink's tint, a smooth curve through the points, flat past its ends | +| `skipSpot` | bool (false) | Colours linked to a spot swatch keep their colour | + +The tone of a colour is its grey equivalent (a grey's ink; for other colours one minus their luma). With one tone of a +swatch the document has, the result is a tint of that swatch, linked to it, so a spot tone separates onto its own plate. +With several tones the inks overprint: the result is the CMYK mix of their tints, each ink multiplying what the others +leave of the paper. A colour links to one swatch at one tint, so a mix of several spot inks becomes process colour. +Gradient stops, type, gradient meshes and embedded images are recoloured as by the other adjustments. + +```json +{"name":"run_command","arguments":{"command":"effect.apply","params":{"effect":"addon.color.duotone","params":{"tones":[{"color":"#000000"},{"color":{"model":"cmyk","c":0,"m":0.5,"y":1,"k":0},"swatch":"Orange","curve":"0,0 50,70 100,100"}]}}}} +``` + +The dialog has a row per tone (on or off, a colour chip, the swatch or Process Color with its hex value), the curve of the +tone picked under Curve (the graph, its points and Reset to Linear or Reset to Inverse) and Skip Objects with Spot Colors. + +Not yet: an opaque undercoat, tones for type only, extra gradient stops for smoother tints, and buttons that flip a +curve or set it to 100 %. + +### Print Ink Fixes + +`addon.color.printFixes {scope?, inkLimit?, excludePureBlack?, removeWhiteOverprint?, overprintBlack?, textOnly?, fill?, +stroke?, ids?}` (Object › Plug-ins › Color Effects › Print Ink Fixes…, also under the panel's Inks) prepares a CMYK +document's inks for print, as one undo step: + +| Parameter | Values (default) | Does | +|---|---|---| +| `scope` | `selection`, `document` (the selection, or the document while nothing is selected) | What it fixes; `ids` stand for the selection | +| `inkLimit` | total ink % 1…400, 0 off (off) | CMYK colours (solid, gradient stops, gradient meshes) with more ink than this are scaled down to it; colours of spot swatches and Registration stay | +| `excludePureBlack` | bool (true) | Black-only CMYK and grey colours keep their ink | +| `removeWhiteOverprint` | bool (false) | White fills and strokes, and characters', stop overprinting | +| `overprintBlack` | black % 1…100, 0 off (off) | Black-only and grey fills and strokes this dark or darker overprint, as `edit.colors.overprintBlack` sets it (not spot-linked or rich blacks) | +| `textOnly` | bool (false) | Overprint Black on type only | +| `fill`, `stroke` | bool (true) | Which paints the fixes reach | + +It returns `changed`, `inkLimited` (paints and meshes scaled), `whiteOverprintRemoved` and `blackOverprinted` (objects); +nothing changed is no undo step. It needs a CMYK document (File › Document Color Mode › CMYK Color) and refuses an RGB +one, out of range values and a request with no fix on. + +```json +{"name":"run_command","arguments":{"command":"addon.color.printFixes","params":{"scope":"document","inkLimit":300,"removeWhiteOverprint":true,"overprintBlack":100}}} +``` diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 428b38c75a..e480a75256 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (3D Extrude & Bevel, Inflate and Rotate apply to type, which stays editable (#4715); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: Duotone and Print Ink Fixes; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -1282,12 +1282,21 @@ Tests: `addons::halftone` in `vectorcraft-effects` (settings, tone, caps), `addo `vectorcraft-render` (drawn as dots, settings change them, unchanged art not sampled again, too many cells draw the object as it is), `expand_appearance_gives_the_dots_object_vector_halftone_makes`, `exports_write_the_dots_as_paths` and `a_halftone_past_the_caps_leaves_the_object_as_it_is` in `vectorcraft-engine`, -and `the_halftone_effect_dialog_has_the_command_fields_and_edits_the_effect` in `vectorcraft-ui-egui`. Commands: -`docs/mcp.md` › Color Effects add-on. +and `the_halftone_effect_dialog_has_the_command_fields_and_edits_the_effect` in `vectorcraft-ui-egui`. Duotone +(`addon.color.duotone`) maps each colour's tone through one to four inks with their curves, a tint of a lone tone's +swatch (linked, so a spot tone separates on its plate) or the multiplied CMYK of several, live and through +`addon.color.filter`; Print Ink Fixes (`addon.color.printFixes`) limits total ink, removes white overprint and sets +black overprint in a CMYK document as one undo step. Tests: `addons::duotone::tests` in `vectorcraft-effects` (spot +tints, curves, multiplied inks, skip spot), `duotone_*` and `cmd::addons::color::print_fixes::tests` in +`vectorcraft-engine` (drawn and expanded, filter equals live then expand, ink limit, overprint, one undo step, bad +params and RGB documents refused), and `the_duotone_dialog_has_a_row_per_tone_and_the_curve_of_one` and +`print_ink_fixes_opens_its_options_and_runs_on_ok` in `vectorcraft-ui-egui`. Commands: `docs/mcp.md` › Color Effects +add-on. ## Revision history | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Color Effects add-on: live Duotone (one to four inks, spot tones kept) and Print Ink Fixes; scores and estimates unchanged | | 2026-10-30 | minor | 3D Extrude & Bevel, Inflate and Rotate apply to type, which stays editable (#4715); scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: live Vector Halftone; scores and estimates unchanged | | 2026-10-30 | minor | Path Precision Tools add-on: the Parametric Shape Tool; evidence added; scores unchanged. | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index 4f3ac445e0..e8de7ef081 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: live Vector Halftone; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: Duotone and Print Ink Fixes; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -330,7 +330,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point); an Alt-drag away from paths selects the points inside a marquee | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not an Illustrator feature, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not an Illustrator feature, so it is not scored | | Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not an Illustrator feature, 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 | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not an Illustrator feature, 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 an Illustrator feature, so it is not scored | ## Look and feel @@ -371,6 +371,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Color Effects add-on: live Duotone (one to four inks, spot tones kept) and Print Ink Fixes; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: live Vector Halftone; scores and estimates unchanged | | 2026-10-30 | minor | Path Precision Tools add-on: the Parametric Shape Tool (ten re-editable shape kinds), its panel and Convert to Parametric Shape; scores and estimates unchanged | | 2026-10-30 | minor | Smart Pen add-on: an Alt-drag away from paths selects points with a marquee; scores and estimates unchanged | From f38cdaeaa77d6225deb1ecfd840cae31197c393a Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sat, 31 Oct 2026 01:16:26 +0700 Subject: [PATCH 063/227] Testkit: temp_dir starts empty in each process, so a reused process id can't fail a test --- crates/testkit/src/lib.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/crates/testkit/src/lib.rs b/crates/testkit/src/lib.rs index c9f8cb7686..b76159c2c8 100644 --- a/crates/testkit/src/lib.rs +++ b/crates/testkit/src/lib.rs @@ -42,7 +42,13 @@ pub use {vectorcraft_doc as doc, vectorcraft_format as format, vectorcraft_rende /// A per-process temporary directory for test output (created on first use). It is made with /// `create_dir` (owner-only on Unix), and a directory that already exists is reused only when it is a /// real directory, not a link, with no access for others and writable by this user: one pre-made in a shared temp folder is refused. +/// The first call for a `tag` in a process empties a directory left by an earlier process of the +/// same id (Windows reuses ids soon); later calls share it. pub fn temp_dir(tag: &str) -> std::path::PathBuf { + static SEEN: std::sync::Mutex> = std::sync::Mutex::new(std::collections::BTreeSet::new()); + // Held to the end: another thread's first files must not land before the emptying. + let mut seen = SEEN.lock().unwrap_or_else(std::sync::PoisonError::into_inner); + let first = seen.insert(tag.to_string()); let dir = std::env::temp_dir().join(format!("vectorcraft-testkit-{tag}-{}", std::process::id())); // Unix sets the mode on it; elsewhere it stays as made. #[cfg_attr(not(unix), allow(unused_mut))] @@ -60,6 +66,13 @@ pub fn temp_dir(tag: &str) -> std::path::PathBuf { static PROBES: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0); let probe = dir.join(format!(".probe-{}", PROBES.fetch_add(1, std::sync::atomic::Ordering::Relaxed))); assert!(std::fs::write(&probe, b"").and_then(|()| std::fs::remove_file(&probe)).is_ok(), "{}: not owned by this user", dir.display()); + if first { + for entry in std::fs::read_dir(&dir).expect("temp dir").flatten() { + let path = entry.path(); + let gone = if path.is_dir() { std::fs::remove_dir_all(&path) } else { std::fs::remove_file(&path) }; + assert!(gone.is_ok(), "{}: left by an earlier run", path.display()); + } + } } dir } @@ -91,3 +104,20 @@ pub fn catch_quiet(f: impl FnOnce() -> T) -> Result { QUIET.with(|q| q.set(false)); r.map_err(|p| p.downcast_ref::().cloned().or_else(|| p.downcast_ref::<&str>().map(|s| s.to_string())).unwrap_or_else(|| "panic".into())) } + +#[cfg(test)] +mod tests { + #[test] + fn a_temp_dir_starts_empty_in_a_process_and_stays_for_later_calls() { + let tag = "fresh-temp-dir"; + let left = std::env::temp_dir().join(format!("vectorcraft-testkit-{tag}-{}", std::process::id())); + std::fs::create_dir_all(left.join("nested")).unwrap(); + std::fs::write(left.join("left.txt"), b"an earlier process").unwrap(); + let dir = super::temp_dir(tag); + assert_eq!(dir, left); + assert_eq!(std::fs::read_dir(&dir).unwrap().count(), 0, "what an earlier process of this id left is gone"); + std::fs::write(dir.join("mine.txt"), b"this process").unwrap(); + assert!(super::temp_dir(tag).join("mine.txt").is_file(), "a later call keeps this process's files"); + std::fs::remove_dir_all(&dir).unwrap(); + } +} From 64b92627c2333c077ec085e23c06c9a55e121b84 Mon Sep 17 00:00:00 2001 From: nine-codes <136345161+nine-codes@users.noreply.github.com> Date: Fri, 30 Oct 2026 09:05:20 +0000 Subject: [PATCH 064/227] Add Bosnian (bs) to the interface languages bs.tsv: Bosnian (Latin script, Ijekavian) catalog covering every key of VectorCraft's other catalogs, its wording shared with storytold/craft-i18n locales/bs/ and the strings craft-i18n lacks translated new. Every bs-* locale selects it; counts use one/few/other. Locale and plural tests, localization docs and an attribution entry (AI-assisted, not yet reviewed by a native speaker). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_013Tayw8nmxoLLmKv13jK93z --- ROADMAP.md | 1 + crates/ui-egui/src/i18n.rs | 16 +- crates/ui-egui/src/i18n/bs.tsv | 5854 ++++++++++++++++++++++++++++++ crates/ui-egui/src/i18n/tests.rs | 8 +- docs/localization-parity.md | 4 +- 5 files changed, 5877 insertions(+), 6 deletions(-) create mode 100644 crates/ui-egui/src/i18n/bs.tsv diff --git a/ROADMAP.md b/ROADMAP.md index acd0cf77e0..c8fa604074 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -110,6 +110,7 @@ Weights, evidence and the missing items per area: [target-app-parity.md](docs/ta | Japanese | `ja` | full | 100% | | German | `de` | full | 98% | | Korean | `ko` | full | 100% | +| Bosnian | `bs` | full (AI-assisted, native review pending) | 100% | | Vietnamese | `vi` | full | 100% | Also shipped: Traditional Chinese (partial, 80%), Bulgarian, Finnish, Greek, Hungarian, Italian, Polish, Russian, Swedish, Ukrainian and Georgian (full), Catalan (full; AI-drafted, native review welcome), Czech (catalog complete; render-site gaps reduced; native review pending). diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 4c2a01b9fa..af85867d85 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -68,8 +68,8 @@ fn plural_french(n: u64) -> usize { usize::from(n > 1) } -/// Russian and Ukrainian integer counts: 1 (but not 11) is `one`, 2–4 (but not 12–14) -/// `few`, everything else `many`. +/// Russian, Ukrainian and Bosnian integer counts: 1 (but not 11) is `one`, 2–4 (but not 12–14) +/// `few`, everything else `many` (Bosnian `other`). fn plural_east_slavic(n: u64) -> usize { match n % 100 { 11..=14 => 2, @@ -94,7 +94,7 @@ fn plural_polish(n: u64) -> usize { } /// The registry. English first: it is the fallback and the source language. -pub static LANGUAGES: [LangInfo; 26] = [ +pub static LANGUAGES: [LangInfo; 27] = [ LangInfo { code: "en", name: "English", source: "", plural: plural_one_other, complete_menus: false, catalog: OnceLock::new() }, // Greek: the whole interface and the status and error messages, keeping the same names in // English as Spanish; every `el-*` locale (including `el-GR` and `el-CY`) resolves here. @@ -137,6 +137,16 @@ pub static LANGUAGES: [LangInfo; 26] = [ complete_menus: true, catalog: OnceLock::new(), }, + // Bosnian (Latin script, Ijekavian): the whole interface and the status and error messages, with + // one/few/other plurals (the Russian rule for whole counts); every `bs-*` locale resolves here. + LangInfo { + code: "bs", + name: "Bosanski", + source: include_str!("i18n/bs.tsv"), + plural: plural_east_slavic, + complete_menus: true, + catalog: OnceLock::new(), + }, // German: the whole interface and the status and error messages, keeping the same names in // English as Spanish; every `de-*` locale (`de-DE`, `de-AT`, `de-CH`, `de-LU` …) resolves here. LangInfo { diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv new file mode 100644 index 0000000000..e26a6f5294 --- /dev/null +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -0,0 +1,5854 @@ +# Bosnian (bs) catalog, Latin script, Ijekavian. Same format as zh-hant.tsv: context source translation +# (empty context = a plain UI string; `@id` = a command id; `@plural` = "one|few|other" forms). +# +# Clean-room: every entry is written from the meaning of VectorCraft's English label, in standard +# Bosnian (historija, sačuvaj, tačka, datoteka, postavke); no other application's localisation was +# consulted or copied. Drafted with AI assistance (Claude Code) from the English meaning; not yet +# reviewed by a native speaker. The wording is shared with storytold/craft-i18n +# (locales/bs/vectorcraft.tsv and common.tsv). Vocabulary: radna ploča (artboard), putanja (path), +# sidrena tačka (anchor point), potez (stroke), ispuna (fill), gradijent, uzorci boja (Swatches), +# uzorak (pattern), neprozirnost (opacity), četkica (brush), praćenje slike (Image Trace). +# Product and format names (VectorCraft, OpenType, PDF ...) stay as they are; `{placeholders}`, +# `code` in backticks and a trailing "…" are kept. + + New Design Novi dizajn + Delete Design Izbriši dizajn + Paste Design Zalijepi dizajn + Select Unused Odaberi nekorišteno + Glowing Edges… Užarene ivice… + About VectorCraft O VectorCraftu + Align to Path Poravnaj s putanjom + Cut Path at Selected Anchor Points Presijeci putanju na odabranim sidrenim tačkama + Join Our Discord Pridružite se našem Discordu + Language Jezik + UI Brightness Svjetlina interfejsa + Dark Tamno + Medium Dark Srednje tamno + Medium Light Srednje svijetlo + Light Svijetlo + Quit VectorCraft Zatvori VectorCraft + Drop Artwork Ispusti crtež +@msg {key} must be [x, y] with finite coordinates {key} mora biti [x, y] s konačnim koordinatama +@msg ids must contain 1–10000 object ids ids mora sadržavati 1–10000 ID-ova objekata + File Datoteka + New… Novo… + New Without Dialog Novo bez dijaloga + New from Template… Novo iz predloška… + Open… Otvori… + Open Recent Files Otvori nedavne datoteke + Clear Recent Files Očisti nedavne datoteke + Show in Folder Prikaži u folderu + Close Zatvori +@id file.close Zatvori + Close All Zatvori sve + Save Sačuvaj + Save As… Sačuvaj kao… + Save a Copy… Sačuvaj kopiju… + Save as Template… Sačuvaj kao predložak… + Save as PDF… Sačuvaj kao PDF… + Save for Office Documents… Sačuvaj za Office dokumente… + Revert Vrati na sačuvano + Place… Postavi… + Export Izvezi + Export for Screens… Izvoz za ekrane… + Export As… Izvezi kao… + Export As SVG… Izvezi kao SVG… + Export As PNG… Izvezi kao PNG… + Save for Web (Legacy)… Sačuvaj za web (naslijeđeno)… + Export Selection… Izvezi odabir… + Package… Paket… + Scripts Skripte + Check Script… Provjeri skriptu… + Check Script Provjeri skriptu + Other Script… Druga skripta… + Document Setup… Postavke dokumenta… + Switch Units Promijeni jedinice + Document Color Mode Način boja dokumenta + CMYK Color CMYK boja + RGB Color RGB boja + File Info… Informacije o datoteci… + Print… Štampaj… + Edit Uredi + Undo Poništi + Redo Ponovi + Cut Izreži + Copy Kopiraj + Paste Zalijepi + Paste in Front Zalijepi ispred + Paste in Back Zalijepi pozadi + Paste in Place Zalijepi na mjesto + Paste on All Artboards Zalijepi na sve radne ploče + Paste without Formatting Zalijepi bez oblikovanja + Clear Očisti + Find and Replace… Pronađi i zamijeni… + Find Next Pronađi sljedeće + Spelling Pravopis + Auto Spell Check Automatska provjera pravopisa + Check Spelling… Provjeri pravopis… + Edit Custom Dictionary… Uredi prilagođeni rječnik… + Edit Colors Uredi boje + Recolor Artwork… Ponovo oboji crtež… + Recolor with Preset Ponovo oboji predloškom + 1 Color Job… Posao s 1 bojom… + 2 Color Job… Posao s 2 boje… + 3 Color Job… Posao s 3 boje… + Color Library… Biblioteka boja… + Adjust Color Balance… Podesi balans boja… + Blend Front to Back Stopi od naprijed prema nazad + Blend Horizontally Stopi vodoravno + Blend Vertically Stopi okomito + Convert to CMYK Pretvori u CMYK + Convert to Grayscale Pretvori u nijanse sive + Convert to RGB Pretvori u RGB + Invert Colors Obrni boje + Overprint Black… Pretisak crne… + Saturate… Zasiti… + Edit Original Uredi original + Transparency Flattener Presets… Predlošci spljoštavanja prozirnosti… + Print Presets… Predlošci štampanja… + PDF Presets… PDF predlošci… + Perspective Grid Presets… Predlošci mreže perspektive… + Color Settings… Postavke boja… + Assign Profile… Dodijeli profil… + Keyboard Shortcuts… Prečice na tastaturi… + Import Shortcut Set Uvezi skup prečica + Import Shortcut Set… Uvezi skup prečica… + Each entry of the file is matched to a VectorCraft tool, command or panel. Check the matches and answer what is left. Svaki unos datoteke uparuje se s alatom, naredbom ili panelom VectorCrafta. Provjerite uparivanja i odgovorite na ostatak. + Keys Tipke + The file writes keys and modifiers as codes. Check the proposed meanings and answer the codes that are not known yet. Datoteka zapisuje tipke i modifikatore kao kodove. Provjerite predložena značenja i odgovorite na kodove koji još nisu poznati. + Click, then press the key this code stands for (Esc cancels) Kliknite, zatim pritisnite tipku koju ovaj kod predstavlja (Esc otkazuje) + Press a key… Pritisnite tipku… + from your earlier imports iz vaših ranijih uvoza + from the format's public description iz javnog opisa formata + not known yet još nije poznato + Shortcuts Prečice + In the File U datoteci + In VectorCraft U VectorCraftu + Needs Attention Only Samo oni koji zahtijevaju pažnju + Ready Spremno + Needs a choice Treba izbor + Needs a key Treba tipku + No equivalent Nema ekvivalenta + Tools take a single key (optionally with Shift) Alati primaju jednu tipku (po želji sa Shiftom) + A later row takes this shortcut Kasniji red preuzima ovu prečicu + Same item as a later row Ista stavka kao kasniji red + Start from VectorCraft Defaults Počni od zadanih postavki VectorCrafta + Add to the Current Shortcuts Dodaj u trenutne prečice + Remember My Choices Zapamti moje izbore + {ready} of {total} ready Spremno {ready} od {total} + The file is too large to read in full, so only its first part is listed. Datoteka je prevelika za potpuno čitanje, pa je naveden samo njen prvi dio. + Report copied Izvještaj kopiran + Line {line} Red {line} + Line {line}: {name}: {status} Red {line}: {name}: {status} + Read Shortcut Set File Pročitaj datoteku skupa prečica + Import Matches Uparivanja uvoza + Remember Import Matches Zapamti uparivanja uvoza + Forget Import Matches Zaboravi uparivanja uvoza +@plural agrees with {n} default shortcut|agrees with {n} default shortcuts slaže se s {n} zadanom prečicom|slaže se s {n} zadane prečice|slaže se s {n} zadanih prečica +@plural {n} part of the file wasn't read|{n} parts of the file weren't read {n} dio datoteke nije pročitan|{n} dijela datoteke nisu pročitana|{n} dijelova datoteke nije pročitano +@msg This shortcut file is in a form VectorCraft can't read. Ova datoteka prečica je u obliku koji VectorCraft ne može pročitati. +@msg not a shortcut set: the text doesn't start with a slash name and an opening brace nije skup prečica: tekst ne počinje nazivom s kosom crtom i otvarajućom vitičastom zagradom + Preferences… Postavke… + Object Objekat + Transform Transformiši + Transform Again Ponovo transformiši + Move… Pomjeri… + Rotate… Rotiraj… + Reflect… Odrazi… + Scale… Skaliraj… + Shear… Smicanje… + Transform Each… Transformiši svaki… + Reset Bounding Box Vrati granični okvir na početno + Arrange Rasporedi + Bring to Front Postavi na vrh + Bring Forward Pomakni naprijed + Send Backward Pomakni nazad + Send to Back Postavi na dno + Send to Current Layer Pošalji u trenutni sloj + Align Poravnaj + Horizontal Align Left Vodoravno poravnanje lijevo + Horizontal Align Center Vodoravno poravnanje po sredini + Horizontal Align Right Vodoravno poravnanje desno + Vertical Align Top Okomito poravnanje gore + Vertical Align Center Okomito poravnanje po sredini + Horizontal & Vertical Align Center Vodoravno i okomito poravnanje po sredini + Vertical Align Bottom Okomito poravnanje dolje + Group Grupiši + Ungroup Razgrupiši + Lock Zaključaj + Selection Odabir + All Artwork Above Sav crtež iznad + Other Layers Ostali slojevi + Unlock All Otključaj sve + Hide Sakrij + Unselected Artwork Neodabrana grafika + Show All Prikaži sve + Expand… Proširi… + Expand Appearance Proširi izgled + Crop Image Izreži sliku + Edit Path Uredi putanju + Mask Maska + Rasterize… Rasteriziraj… + Create Gradient Mesh… Kreiraj gradijentnu mrežu… + Create Object Mosaic… Kreiraj mozaik objekata… + Vector Halftone… Vektorski polutonovi… + Create Trim Marks Kreiraj oznake za obrezivanje + Flatten Transparency… Spljošti prozirnost… + Make Pixel Perfect Učini savršenim po pikselima + Slice Isječak + Make Napravi + Make and Expand Napravi i proširi + Release Oslobodi + Create from Guides Kreiraj iz vodilica + Create from Selection Kreiraj iz odabira + Duplicate Slice Dupliciraj isječak + Combine Slices Kombinuj isječke + Divide Slices… Podijeli isječke… + Delete All Izbriši sve + Slice Options… Opcije isječka… + Clip to Artboard Isijeci prema radnoj ploči + Path Putanja + Join Spoji + Average… Prosjek… + Outline Stroke Obris poteza + Outline Object Objekat u obrisu + Offset Path… Odmak putanje… + Reverse Path Direction Obrni smjer putanje + Simplify… Pojednostavi… + Smooth… Izgladi… + Add Anchor Points Dodaj sidrene tačke + Remove Anchor Points Ukloni sidrene tačke + Divide Objects Below Podijeli objekte ispod + Split Into Grid… Podijeli u mrežu… + Clean Up… Očisti… + Shape Oblik + Convert to Shape Pretvori u oblik + Expand Shape Proširi oblik + Pattern Uzorak + Edit Pattern Uredi uzorak + Tile Edge Color… Boja ivice pločice… + Repeat Ponavljaj + Radial Radijalno + Grid Mreža + Mirror Zrcali + Options… Opcije… + Blend Stapanje + Blend Options… Opcije stapanja… + Expand Proširi + Replace Spine Zamijeni kičmu + Reverse Spine Obrni kičmu + Reverse Front to Back Obrni od naprijed prema nazad + Envelope Distort Izobličenje omotnicom + Make with Warp… Napravi iskrivljenjem… + Reset with Warp… Vrati iskrivljenjem… + Make with Mesh… Napravi mrežom… + Reset with Mesh… Vrati mrežom… + Make with Top Object Napravi gornjim objektom + Envelope Options… Opcije omotnice… + Edit Contents Uredi sadržaj + Edit Envelope Uredi omotnicu + Perspective Perspektiva + Attach to Active Plane Priloži aktivnoj ravni + Release with Perspective Oslobodi s perspektivom + Move Plane to Match Object Pomjeri ravan da odgovara objektu + Edit Text Uredi tekst + Live Paint Živo bojenje + Merge Spoji + Gap Options… Opcije praznina… + Gap Options Opcije praznina + Gap Detection Otkrivanje praznina + Paint Stops At: Bojenje se zaustavlja na: + Small Gaps Male praznine + Medium Gaps Srednje praznine + Large Gaps Velike praznine + Gap Preview Color: Boja pregleda praznina: + Close Gaps With Paths Zatvori praznine putanjama + Show Live Paint Gaps Prikaži praznine živog bojenja + Hide Live Paint Gaps Sakrij praznine živog bojenja + Select Fills Odaberi ispune + Select Strokes Odaberi poteze + Image Trace Praćenje slike + Image Trace (Make and Expand) Praćenje slike (napravi i proširi) + Release Image Trace Oslobodi praćenje slike + Text Wrap Omotavanje teksta + Make Text Wrap Napravi omotavanje teksta + Release Text Wrap Oslobodi omotavanje teksta + Text Wrap Options… Opcije omotavanja teksta… + Clipping Mask Maska isijecanja + Edit Clipping Path Uredi putanju isijecanja + Compound Path Složena putanja + Compound Shape Složeni oblik + Artboards Radne ploče + Convert to Artboards Pretvori u radne ploče + Rearrange All Artboards… Preuredi sve radne ploče… + Fit to Artwork Bounds Uklopi u granice crteža + Fit to Selected Art Uklopi u odabrani crtež + Graph Grafikon + Type… Vrsta… + Data… Podaci… + Design… Dizajn… + Graph Design Dizajn grafikona + Graph Marker Marker grafikona + Graph Column Kolona grafikona + Column Type: Vrsta kolone: + Vertically Scaled Okomito skalirano + Uniformly Scaled Ujednačeno skalirano + Repeating Ponavljanje + Sliding Klizno + Each Design Represents: Svaki dizajn predstavlja: + For Fractions: Za razlomke: + Chop Design Isjeckaj dizajn + Scale Design Skaliraj dizajn + Column… Kolona… + Marker… Marker… + Collect for Export Prikupi za izvoz + As Single Asset Kao jedan resurs + As Multiple Assets Kao više resursa + Plug-ins Dodaci + No filter plug-ins installed Nisu instalirani dodaci filtera + Install Plug-in… Instaliraj dodatak… + Open this setting's help page Otvori stranicu pomoći za ovu postavku + Reload Plug-ins Ponovo učitaj dodatke + Type Vrsta + Font Font + Recent Fonts Nedavni fontovi + Size Veličina + Glyphs Glifovi + Insert Special Character Umetni posebni znak + Bullet Oznaka nabrajanja + Bullets Oznake + Bullets and Numbering Oznake i numerisanje + Apply Bullets Primijeni oznake + Numbered List Numerisana lista + Apply Numbers Primijeni brojeve + Convert to Text Pretvori u tekst + Filled Dot Ispunjena tačka + Dash Crtica + Hollow Circle Prazan krug + Filled Square Ispunjen kvadrat + Copyright Symbol Simbol autorskih prava + Ellipsis Tri tačke + Paragraph Symbol Simbol pasusa + Registered Trademark Symbol Simbol registrovane marke + Section Symbol Simbol odjeljka + Trademark Symbol Simbol zaštitnog znaka + Em Dash Duga crtica + En Dash Srednja crtica + Discretionary Hyphen Neobavezna crtica + Nonbreaking Hyphen Neprelomiva crtica + Double Left Quotation Marks Dvostruki lijevi navodnici + Double Right Quotation Marks Dvostruki desni navodnici + Single Left Quotation Mark Jednostruki lijevi navodnik + Single Right Quotation Mark Jednostruki desni navodnik + Insert Whitespace Character Umetni znak razmaka + Em Space Široki razmak (em) + En Space Polu-široki razmak (en) + Hair Space Tanki razmak + Sixth Space Šestina razmaka + Thin Space Tanki razmak + Nonbreaking Space Neprelomivi razmak + Figure Space Razmak širine cifre + Punctuation Space Razmak interpunkcije + Third Space Trećina razmaka + Quarter Space Četvrtina razmaka + Insert Break Character Umetni znak preloma + Forced Line Break Prisilni prelom reda + Tab Tab + Convert To Area Type Pretvori u tekst u području + Convert To Point Type Pretvori u tačkasti tekst + Area Type Options… Opcije teksta u području… + Type on a Path Tekst na putanji + Area Type Tekst u području + Rainbow Duga + Skew Iskosi + 3D Ribbon 3D traka + Stair Step Stepenice + Gravity Gravitacija + Type on a Path Options… Opcije teksta na putanji… + Threaded Text Povezani tekst + Create Kreiraj + Release Selection Oslobodi odabir + Remove Threading Ukloni povezivanje teksta + Break Thread Prekini nit + Fit Headline Uklopi naslov + Find Font… Pronađi font… + Change Case Promijeni veličinu slova + UPPERCASE VELIKA SLOVA + lowercase mala slova + Title Case Svaka Riječ Velikim Slovom + Sentence case Veliko početno slovo rečenice + Smart Punctuation… Pametna interpunkcija… + Create Outlines Kreiraj obrise + Optical Margin Alignment Optičko poravnanje margina + Fill with Placeholder Text Ispuni tekstom čuvara mjesta + Insert Inline Symbol Umetni simbol u redu + Show Hidden Characters Prikaži skrivene znakove + Bold Podebljano + Italic Kurziv + Hide Hidden Characters Sakrij skrivene znakove + Type Orientation Orijentacija teksta + Horizontal Vodoravno + Vertical Okomito + Select Odaberi + All Sve + All on Active Artboard Sve na aktivnoj radnoj ploči + Deselect Poništi odabir + Reselect Ponovo odaberi + Inverse Obrnuto + Next Object Above Sljedeći objekat iznad + Next Object Below Sljedeći objekat ispod + Same Isto + Appearance Izgled + Appearance Attribute Atribut izgleda + Blending Mode Način stapanja + Fill & Stroke Ispuna i potez + Fill Color Boja ispune + Opacity Neprozirnost + Stroke Color Boja poteza + Fill Gradient Gradijent ispune + Stroke Gradient Gradijent poteza + Fill Pattern Uzorak ispune + Stroke Pattern Uzorak poteza + Patterns Uzorci + Stroke Weight Debljina poteza + Graphic Style Grafički stil + Symbol Instance Instanca simbola + Font Family Porodica fonta + Font Family & Style Porodica i stil fonta + Font Family, Style & Size Porodica, stil i veličina fonta + Font Size Veličina fonta + Variable Font Varijabilni font + Text Fill Color Boja ispune teksta + Text Stroke Color Boja poteza teksta + All on Same Layers Sve na istim slojevima + Direction Handles Ručke smjera + Brush Strokes Potezi četkicom + Bristle Brush Strokes Potezi četkicom s čekinjama + Clipping Masks Maske isijecanja + Slices Isječci + Stray Points Zalutale tačke + Open Paths Otvorene putanje + All Text Objects Svi tekstualni objekti + Point Text Objects Objekti tačkastog teksta + Area Text Objects Objekti teksta u području + Start Global Edit Započni globalno uređivanje + Save Selection… Sačuvaj odabir… + Update Selection Ažuriraj odabir + Edit Selection… Uredi odabir… + Effect Efekat + Apply Last Effect Primijeni posljednji efekat + Last Effect… Posljednji efekat… + Document Raster Effects Settings… Postavke rasterskih efekata dokumenta… + Vector Effects Vektorski efekti + 3D and Materials 3D i materijali + Extrude & Bevel… Istiskivanje i zakošenje… + Revolve… Rotaciono tijelo… + Inflate… Napuhni… + Materials… Materijali… + Color Adjustments Podešavanja boja + Brightness/Contrast… Svjetlina/kontrast… + Curves… Krive… + Hue/Saturation… Nijansa/zasićenje… + Levels… Nivoi… + Shift to Color… Pomakni prema boji… + Temperature/Tint… Temperatura/preliv… + Rectangle… Pravougaonik… + Rounded Rectangle… Zaobljeni pravougaonik… + Ellipse… Elipsa… + Crop Marks Oznake za izrezivanje + Distort & Transform Izobliči i transformiši + Free Distort… Slobodno izobličenje… + Pucker & Bloat… Nabiranje i napuhavanje… + Roughen… Ohrapavi… + Transform… Transformiši… + Tweak… Podesi… + Twist… Uvrtanje… + Zig Zag… Cik-cak… + Pathfinder Pathfinder + Add Dodaj +@id pathfinder.add Ujedini + Intersect Presijeci + Intertwine Intertwine + Arrange Intertwine Area Rasporedi područje Intertwine + Exclude Isključi + Subtract Oduzmi + Minus Back Minus pozadi + Divide Podijeli + Trim Obreži + Crop Izreži okvir + Outline Obris + Stylize Stilizuj + Round Corners… Zaobljeni uglovi… + Scribble… Škrabanje… + Drop Shadow… Sjena… + Darkness Tama + Inner Glow… Unutrašnji sjaj… + Outer Glow… Vanjski sjaj… + Feather… Omekšaj ivice… + SVG Filters SVG filteri + Apply SVG Filter… Primijeni SVG filter… + Warp Iskrivi + Arc… Luk… + Arc Lower… Donji luk… + Arc Upper… Gornji luk… + Arch… Svod… + Bulge… Ispupčenje… + Shell Lower… Donja školjka… + Shell Upper… Gornja školjka… + Flag… Zastava… + Wave… Talas… + Fish… Riba… + Rise… Uspon… + Fisheye… Riblje oko… + Squeeze… Stisni… + Raster Effects Rasterski efekti + Blur Zamućenje + Gaussian Blur… Gaussovo zamućenje… + View Prikaz + Preview Pregled + Overprint Preview Pregled pretiska + Pixel Preview Pregled piksela + Trim View Prikaz obrezivanja + Presentation Mode Način prezentacije + Screen Mode Način prikaza ekrana + Normal Screen Mode Normalni način prikaza ekrana + Full Screen Mode with Menu Bar Način rada preko cijelog ekrana s trakom menija + Full Screen Mode Način rada preko cijelog ekrana + Proof Setup Postavke probnog prikaza + Working CMYK Radni CMYK + RGB RGB + sRGB IEC61966-2.1 sRGB IEC61966-2.1 + VectorCraft Generic CMYK (SWOP-like) VectorCraft generički CMYK (sličan SWOP-u) + Legacy Macintosh RGB (Gamma 1.8) Naslijeđeni Macintosh RGB (gama 1.8) + Internet Standard RGB (sRGB) Internet standardni RGB (sRGB) + Monitor RGB RGB monitora + Color blindness – Protanopia-type Daltonizam – tip protanopije + Color blindness – Deuteranopia-type Daltonizam – tip deuteranopije + Color blindness – Tritanopia-type Daltonizam – tip tritanopije + Customize… Prilagodi… + Proof Colors Probne boje + Zoom In Uvećaj + Zoom Out Umanji + Fit Artboard in Window Uklopi radnu ploču u prozor + Fit All in Window Uklopi sve u prozor + Actual Size Stvarna veličina + Reset Rotate View Vrati rotaciju prikaza na početno + Rotate View to Selection Rotiraj prikaz prema odabiru + Hide Edges Sakrij ivice + Show Edges Prikaži ivice + Hide Artboards Sakrij radne ploče + Show Artboards Prikaži radne ploče + Show Print Tiling Prikaži popločavanje štampe + Hide Print Tiling Sakrij popločavanje štampe + Hide Slices Sakrij isječke + Show Slices Prikaži isječke + Lock Slices Zaključaj isječke + Rulers Ravnala + Show Rulers Prikaži ravnala + Hide Rulers Sakrij ravnala + Change to Global Rulers Prebaci na globalna ravnala + Change to Artboard Rulers Prebaci na ravnala radne ploče + Show Video Rulers Prikaži video ravnala + Hide Bounding Box Sakrij granični okvir + Show Bounding Box Prikaži granični okvir + Hide Template Sakrij predložak + Show Template Prikaži predložak + Show Transparency Grid Prikaži mrežu prozirnosti + Hide Transparency Grid Sakrij mrežu prozirnosti + Hide Text Threads Sakrij niti teksta + Show Text Threads Prikaži niti teksta + Hide Gradient Annotator Sakrij anotator gradijenta + Show Gradient Annotator Prikaži anotator gradijenta + Hide Corner Widget Sakrij widget ugla + Show Corner Widget Prikaži widget ugla + Guides Vodilice + Hide Guides Sakrij vodilice + Show Guides Prikaži vodilice + Lock Guides Zaključaj vodilice + Unlock Guides Otključaj vodilice + Make Guides Napravi vodilice + Release Guides Oslobodi vodilice + Clear Guides Očisti vodilice + Smart Guides Pametne vodilice + Perspective Grid Mreža perspektive + Show Grid Prikaži mrežu + Hide Grid Sakrij mrežu + Snap to Grid Priljepi uz mrežu + Lock Grid Zaključaj mrežu + Unlock Grid Otključaj mrežu + Lock Station Point Zaključaj tačku stajališta + Define Grid… Definiši mrežu… + One Point Perspective Perspektiva s jednom tačkom + Two Point Perspective Perspektiva s dvije tačke + Three Point Perspective Perspektiva s tri tačke + Save Grid as Preset… Sačuvaj mrežu kao predložak… + Snap to Pixel Prilijepi uz piksel + Precise Cursors Precizni kursori + Image Trace Preview Pregled praćenja slike + Snap to Point Prilijepi uz tačku + Snap to Glyph Prilijepi uz glif + New View… Novi pogled… + Edit Views… Uredi poglede… + Saved View 1 Sačuvani pogled 1 + Saved View 2 Sačuvani pogled 2 + Saved View 3 Sačuvani pogled 3 + Saved View 4 Sačuvani pogled 4 + Saved View 5 Sačuvani pogled 5 + Saved View 6 Sačuvani pogled 6 + Saved View 7 Sačuvani pogled 7 + Saved View 8 Sačuvani pogled 8 + Saved View 9 Sačuvani pogled 9 + Saved View 10 Sačuvani pogled 10 + Saved View 11 Sačuvani pogled 11 + Saved View 12 Sačuvani pogled 12 + Saved View 13 Sačuvani pogled 13 + Saved View 14 Sačuvani pogled 14 + Saved View 15 Sačuvani pogled 15 + Saved View 16 Sačuvani pogled 16 + Saved View 17 Sačuvani pogled 17 + Saved View 18 Sačuvani pogled 18 + Saved View 19 Sačuvani pogled 19 + Saved View 20 Sačuvani pogled 20 + Saved View 21 Sačuvani pogled 21 + Saved View 22 Sačuvani pogled 22 + Saved View 23 Sačuvani pogled 23 + Saved View 24 Sačuvani pogled 24 + Saved View 25 Sačuvani pogled 25 + Window Prozor + New Window Novi prozor + Next Document Sljedeći dokument + Previous Document Prethodni dokument + Cascade Kaskadno + Tile Popločaj + Float in Window Odvoji u prozor + Consolidate All Windows Objedini sve prozore + Workspace Radni prostor + Reset Essentials Vrati Osnove na početno + Reset Automation Vrati automatizaciju na početno + Reset Essentials Classic Vrati Osnove klasično na početno + Reset Layout Vrati raspored na početno + Reset Painting Vrati Slikanje na početno + Reset Printing and Proofing Vrati Štampanje i probni ispis na početno + Reset Tracing Vrati praćenje na početno + Reset Typography Vrati Tipografiju na početno + Reset Web Vrati Web na početno + New Workspace… Novi radni prostor… + Manage Workspaces… Upravljaj radnim prostorima… + Control Kontrola + Contextual Task Bar Kontekstna traka zadataka + Pin Bar Position Položaj prikvačene trake + Reset Bar Position Vrati položaj trake na početno + Resize Promijeni veličinu + Tools Alati + Toolbars Trake s alatima + Advanced Napredno + Double Column Dvostruka kolona + Actions Akcije + Asset Export Izvoz resursa + Attributes Atributi + Brushes Četkice + Color Boja + Color Guide Vodič za boje + Color Themes Teme boja + CSS Properties CSS svojstva + Document Info Informacije o dokumentu + Flattener Preview Pregled spljoštavanja + Gradient Gradijent + Graphic Styles Grafički stilovi + Graphic Styles (4) Grafički stilovi (4) + History Historija + Info Informacije + Layers Slojevi + 1 Layer 1 sloj + Libraries Biblioteke + Links Veze + {count} linked image(s) changed on disk. Show the new versions? Povezanih slika promijenjenih na disku: {count}. Prikazati nove verzije? + Update Changed Links Ažuriraj promijenjene veze +@msg Updated {_1} linked file(s) changed on disk Ažurirano povezanih datoteka promijenjenih na disku: {_1} + Magic Wand Čarobni štapić + Navigator Navigator + Pattern Options Opcije uzorka + Properties Svojstva + Separations Preview Pregled separacija + Stroke Potez + SVG Interactivity SVG interaktivnost + Event: Događaj: + JavaScript: JavaScript: + Add Event Dodaj događaj + Remove Selected Entry Ukloni odabrani unos + Clear Events Očisti događaje + Link JavaScript Files… Poveži JavaScript datoteke… + JavaScript Files JavaScript datoteke + File or URL: Datoteka ili URL: + Add JavaScript File Dodaj JavaScript datoteku + Remove JavaScript File Ukloni JavaScript datoteku + Swatches Uzorci boja + Symbols Simboli + Transparency Prozirnost + Character Znak + Character Styles Stilovi znakova + Paragraph Pasus + Paragraph Styles Stilovi pasusa + Tabs Tabulatori + Variables Varijable + New Variable… Nova varijabla… + Unbind Variable Odveži varijablu + Delete Variable Izbriši varijablu + Lock Variables Zaključaj varijable + Unlock Variables Otključaj varijable + New Data Set… Novi skup podataka… + Edit Data Set… Uredi skup podataka… + Delete Data Set Izbriši skup podataka + Next Data Set Sljedeći skup podataka + Previous Data Set Prethodni skup podataka + Make Text Dynamic Učini tekst dinamičkim + Make Visibility Dynamic Učini vidljivost dinamičkom + Capture Data Set Zabilježi skup podataka + Update Data Set Ažuriraj skup podataka + Rename Data Set… Preimenuj skup podataka… + Variable Options… Opcije varijable… + Brush Libraries Biblioteke četkica + Built-in Libraries Ugrađene biblioteke + User Defined Korisnički definisano + Other Library… Druga biblioteka… + Graphic Style Libraries Biblioteke grafičkih stilova + Shadows and Glows Sjene i sjajevi + Outlines and Rules Obrisi i linije + Hand-Drawn Ručno crtano + Gradient Finishes Gradijentne završnice + Shape Effects Efekti oblika + Blends and Transparency Stapanja i prozirnost + Save Graphic Style Library… Sačuvaj biblioteku grafičkih stilova… + Swatch Libraries Biblioteke uzoraka boja + Default Swatches Zadani uzorci boja + Web Safe 216 Sigurne web boje 216 + Grays and Neutrals Sive i neutralne + Earth Tones Zemljani tonovi + Skin Tone Ramps Rampe tonova kože + Pastels Pasteli + Brights Jarke + Metallic Gradients Metalni gradijenti + Perceptual Scales Perceptivne skale + Harmony Sets Skupovi harmonije + Gradients Gradijenti + Spectrum Gradients Gradijenti spektra + Sky Gradients Gradijenti neba + Neutral Gradients Neutralni gradijenti + Duotone Gradients Duoton gradijenti + Radial Glows Radijalni sjajevi + Save Swatch Library… Sačuvaj biblioteku uzoraka boja… + Symbol Libraries Biblioteke simbola + Help Pomoć + ArtCraft Website Web stranica ArtCrafta + VectorCraft on getartcraft.com VectorCraft na getartcraft.com + VectorCraft on GitHub VectorCraft na GitHubu + Search Commands… Pretraži naredbe… + VectorCraft Help… Pomoć za VectorCraft… + Auto Color Automatska boja + Automatic Automatski + Isolate Selected Group Izoliraj odabranu grupu + Isolate Selected Object Izoliraj odabrani objekat + Exit Isolation Mode Izađi iz načina izolacije + Make Clipping Mask Napravi masku isijecanja + Release Clipping Mask Oslobodi masku isijecanja + Make Compound Path Napravi složenu putanju + Release Compound Path Oslobodi složenu putanju + Select All Odaberi sve + Collapse Panels to Icons Skupi panele u ikone + Collapse to Icons Skupi u ikone + Expand Panels Proširi panele + About O programu + Contributors Saradnici + Models Modeli + Username Korisničko ime + Display name Ime za prikaz + Real name Pravo ime + Sort Sortiraj + Reverse the order Obrni redoslijed + Grab bag Svaštara + Table Tabela + Name (A–Z) Naziv (A–Z) + Merged PRs Spojeni PR-ovi + Commits Commitovi + Lines added Dodane linije + Lines deleted Izbrisane linije + Line delta Razlika u linijama + Binary assets added Dodani binarni resursi + Binary assets removed Uklonjeni binarni resursi + First commit Prvi commit + Last commit Posljednji commit + First Prvo + Last Posljednje + {people} contributors · {commits} commits Saradnika: {people} · commitova: {commits} + No contributor data was built into this copy. U ovu kopiju nisu ugrađeni podaci o saradnicima. + No model credits were built into this copy. U ovu kopiju nisu ugrađene zasluge za modele. + Company Firma + Version Verzija + % of all commits % svih commitova + Lines +/− Linije +/− + Drag to move Prevucite za pomjeranje + Drag to float as a toolbar Prevucite da odvojite kao traku s alatima + Put back in the toolbar Vrati u traku s alatima + Float Panel Odvoji panel + Dock Panel Usidri panel + Float Tool Group Odvoji grupu alata + Services Usluge + Hide VectorCraft Sakrij VectorCraft + Hide Others Sakrij ostale + Minimize Minimiziraj + Zoom Zumiranje + Bring All to Front Postavi sve na vrh + Settings Postavke + General Općenito + Selection & Anchor Display Prikaz odabira i sidara + Units Jedinice + Guides & Grid Vodilice i mreža + Hyphenation Rastavljanje riječi + Plug-ins & Scratch Disks Dodaci i radni diskovi + User Interface Korisnički interfejs + Performance Performanse + File Handling Rukovanje datotekama + Clipboard Handling Rukovanje međuspremnikom + Appearance of Black Izgled crne + Devices Uređaji + A file dialog is open: choose there first Dijalog za datoteke je otvoren: prvo odaberite tamo + The document was closed while its file dialog was open Dokument je zatvoren dok je njegov dijalog za datoteke bio otvoren + The dialog was closed before its file dialog answered Dijalog je zatvoren prije nego što je njegov dijalog za datoteke odgovorio + Shaper Oblikovač + Expand Shaper Group Proširi grupu oblikovača + Release Shaper Group Oslobodi grupu oblikovača + Remove from Shaper Group Ukloni iz grupe oblikovača +@msg source must be the id of a Shaper Group's original shape source mora biti id izvornog oblika grupe oblikovača +@msg group must be the id of a Shaper Group group mora biti id grupe oblikovača +@msg the shape is not an editable original shape of that Shaper Group oblik nije izvorni oblik te grupe oblikovača koji se može uređivati + Select Shaper Face Odaberi lice oblikovača + Constrain Ograniči + Free Transform Slobodna transformacija + Perspective Distort Izobličenje perspektive + Radial Blur… Radijalno zamućenje… + Smart Blur… Pametno zamućenje… + Sharpen Izoštri + Unsharp Mask… Maska izoštravanja… + Pixelate Pikseliziraj + Color Halftone… Polutonovi u boji… + Crystallize… Kristalizuj… + Mezzotint… Mecotinta… + Pointillize… Tačkasto slikanje… + Video Video + De-Interlace… Ukloni preplitanje… + NTSC Colors NTSC boje + RGB: RGB: + CMYK: CMYK: + CMYK CMYK + Texture Tekstura + Craquelure… Krakelura… + Grain… Zrno… + Mosaic Tiles… Mozaik pločice… + Patchwork… Krpice… + Stained Glass… Vitraž… + Texturizer… Teksturizator… + System Title Bar Sistemska naslovna traka + Exit Izlaz + Distort Izobliči + Diffuse Glow… Difuzni sjaj… + Glass… Staklo… + Ocean Ripple… Talasanje okeana… + Rename Data Set Preimenuj skup podataka + Rename Variable Preimenuj varijablu + Activate Panel Aktiviraj panel + Change Panel Layout Promijeni raspored panela + Close Panel Zatvori panel + Collapse Panel Group Skupi grupu panela + Move Panel Pomakni panel + Group with Grupiši sa + Resize panels Promijeni veličinu panela + Resize panel window Promijeni veličinu prozora panela + Lighting Osvjetljenje + Revolve angle Ugao rotacije + Axis side Strana ose + Rotation X Rotacija X + Rotation Y Rotacija Y + Rotation Z Rotacija Z + Shading Sjenčenje + Intensity Intenzitet + Segments Segmenti + Show axis Prikaži osu + Reset all Vrati sve na početno + Reset to default Vrati na zadano + Reset all Revolve settings to their defaults. Vrati sve postavke rotacionog tijela na zadane vrijednosti. + Step up or down Korak gore ili dolje + Drag values or labels. Double-click a value to type. Prevucite vrijednosti ili oznake. Dvostruki klik na vrijednost za upis. + Drag rings to rotate. Shift snaps to 15°. Prevucite prstenove za rotaciju. Shift hvata na 15°. + Drag the light, or its rings. Shift snaps to 15°. Prevucite svjetlo ili njegove prstenove. Shift hvata na 15°. +lighting Light Svjetlo + Keep visible surfaces only when expanding Pri proširivanju zadrži samo vidljive površine + Trim covered geometry on Expand Appearance. Live preview keeps the full surface. Transparent paints and surfaces exceeding visibility limits retain all faces. Obreži prekrivenu geometriju pri Proširi izgled. Pregled uživo zadržava cijelu površinu. Prozirne boje i površine koje premašuju ograničenja vidljivosti zadržavaju sva lica. + Left Lijevo + Right Desno + Offset Pomak + Rotation Rotacija + Cancel Otkaži + Accented Edges… Naglašene ivice… + Angled Strokes… Ukošeni potezi… + Crosshatch… Unakrsno šrafiranje… + Dark Strokes… Tamni potezi… + Ink Outlines… Obrisi tintom… + Spatter… Prskanje… + Sprayed Strokes… Raspršeni potezi… + Sumi-e… Sumi-e… + Vertical Guide Okomita vodilica + Horizontal Guide Vodoravna vodilica + Align center Poravnaj po sredini + Align left Poravnaj lijevo + Align right Poravnaj desno + Browser Preglednik + Color Guide Options… Opcije vodiča za boje… + Color Picker… Birač boja… + Coming soon — tracked in the parity plan Uskoro — prati se u planu usklađenosti + Command Dialog Dijalog naredbe + Copy Selected Style Kopiraj odabrani stil + Corners… Uglovi… + Define Perspective Grid… Definiši mrežu perspektive… + Delete Workspace Izbriši radni prostor + Document Raster Effects Settings Dialog Dijalog postavki rasterskih efekata dokumenta + Drop Shadow Sjena + DXF Options Dialog Dijalog DXF opcija + Edit Toolbar Uredi traku s alatima + Edit Views Uredi poglede + Effect… Efekat… + EPS Options Dialog Dijalog EPS opcija + Expand Layers Panel Rows Proširi redove panela slojeva + Export CSS… Izvezi CSS… + Export Keyboard Shortcuts… Izvezi prečice na tastaturi… + File Info Dialog Dijalog informacija o datoteci + Go to Artboard Idi na radnu ploču + First Artboard Prva radna ploča + Previous Artboard Prethodna radna ploča + Next Artboard Sljedeća radna ploča + Last Artboard Posljednja radna ploča + Graphic Style Options… Opcije grafičkog stila… + Symbol Options Opcije simbola + Symbol Options… Opcije simbola… + Home Početna + Import Keyboard Shortcuts… Uvezi prečice na tastaturi… + Justify all lines Obostrano poravnaj sve redove + Justify with last line aligned left Obostrano s posljednjim redom lijevo + Keyboard Shortcut Conflicts Konflikti prečica na tastaturi + Keyboard Shortcut Set Skup prečica na tastaturi + Interface Language Jezik interfejsa + Last Effect: {name} Posljednji efekat: {name} + Last Effect: {} Posljednji efekat: {} + Limit Color Guide to Library Ograniči vodič za boje na biblioteku + List Keyboard Shortcuts Izlistaj prečice na tastaturi + List Workspaces Izlistaj radne prostore + Menu Dialog Dijalog menija + Merge Graphic Styles… Spoji grafičke stilove… + New Color Group… Nova grupa boja… + New Artboard Options… Opcije nove radne ploče… + New Layer Options… Opcije novog sloja… + New Swatch… Novi uzorak boje… + No saved views (View → New View…) Nema sačuvanih pogleda (Prikaz → Novi pogled…) + One Point Perspective Preset 1 Predložak perspektive s jednom tačkom 1 + One Point Perspective Preset 2 Predložak perspektive s jednom tačkom 2 + One Point Perspective Preset 3 Predložak perspektive s jednom tačkom 3 + One Point Perspective Preset 4 Predložak perspektive s jednom tačkom 4 + One Point Perspective Preset 5 Predložak perspektive s jednom tačkom 5 + Open Recent File 1 Otvori nedavnu datoteku 1 + Open Recent File 10 Otvori nedavnu datoteku 10 + Open Recent File 11 Otvori nedavnu datoteku 11 + Open Recent File 12 Otvori nedavnu datoteku 12 + Open Recent File 13 Otvori nedavnu datoteku 13 + Open Recent File 14 Otvori nedavnu datoteku 14 + Open Recent File 15 Otvori nedavnu datoteku 15 + Open Recent File 16 Otvori nedavnu datoteku 16 + Open Recent File 17 Otvori nedavnu datoteku 17 + Open Recent File 18 Otvori nedavnu datoteku 18 + Open Recent File 19 Otvori nedavnu datoteku 19 + Open Recent File 2 Otvori nedavnu datoteku 2 + Open Recent File 20 Otvori nedavnu datoteku 20 + Open Recent File 21 Otvori nedavnu datoteku 21 + Open Recent File 22 Otvori nedavnu datoteku 22 + Open Recent File 23 Otvori nedavnu datoteku 23 + Open Recent File 24 Otvori nedavnu datoteku 24 + Open Recent File 25 Otvori nedavnu datoteku 25 + Open Recent File 26 Otvori nedavnu datoteku 26 + Open Recent File 27 Otvori nedavnu datoteku 27 + Open Recent File 28 Otvori nedavnu datoteku 28 + Open Recent File 29 Otvori nedavnu datoteku 29 + Open Recent File 3 Otvori nedavnu datoteku 3 + Open Recent File 30 Otvori nedavnu datoteku 30 + Open Recent File 4 Otvori nedavnu datoteku 4 + Open Recent File 5 Otvori nedavnu datoteku 5 + Open Recent File 6 Otvori nedavnu datoteku 6 + Open Recent File 7 Otvori nedavnu datoteku 7 + Open Recent File 8 Otvori nedavnu datoteku 8 + Open Recent File 9 Otvori nedavnu datoteku 9 + Options for Selection… Opcije za odabir… + Panel Options… Opcije panela… + Panels Paneli + Panels Except Tools and Control Paneli osim alata i kontrole + Perspective Plane Options… Opcije ravni perspektive… + Placement Options… Opcije postavljanja… + Plug-in… Dodatak… + Preview in Browser Pregledaj u pregledniku + Printer Setup… Podešavanje štampača… + Printers Štampači + Recent File Nedavna datoteka + Recent Font Nedavni font + Recent Font 1 Nedavni font 1 + Recent Font 10 Nedavni font 10 + Recent Font 11 Nedavni font 11 + Recent Font 12 Nedavni font 12 + Recent Font 13 Nedavni font 13 + Recent Font 14 Nedavni font 14 + Recent Font 15 Nedavni font 15 + Recent Font 2 Nedavni font 2 + Recent Font 3 Nedavni font 3 + Recent Font 4 Nedavni font 4 + Recent Font 5 Nedavni font 5 + Recent Font 6 Nedavni font 6 + Recent Font 7 Nedavni font 7 + Recent Font 8 Nedavni font 8 + Recent Font 9 Nedavni font 9 + Redo {name} Ponovi {name} + Redo {} Ponovi {} + Missing Fonts Dialog Dijalog nedostajućih fontova + Find Fonts in Folder… Pronađi fontove u folderu… + Rename Workspace Preimenuj radni prostor + Reset Keyboard Shortcuts Vrati prečice na tastaturi na početno + Reset {name} Vrati na početno: {name} + Reset {} Vrati na početno: {} + Save Document Info… Sačuvaj informacije o dokumentu… + Save PDF Dialog Dijalog Sačuvaj PDF + Saved Selection 1 Sačuvani odabir 1 + Saved Selection 10 Sačuvani odabir 10 + Saved Selection 11 Sačuvani odabir 11 + Saved Selection 12 Sačuvani odabir 12 + Saved Selection 13 Sačuvani odabir 13 + Saved Selection 14 Sačuvani odabir 14 + Saved Selection 15 Sačuvani odabir 15 + Saved Selection 16 Sačuvani odabir 16 + Saved Selection 17 Sačuvani odabir 17 + Saved Selection 18 Sačuvani odabir 18 + Saved Selection 19 Sačuvani odabir 19 + Saved Selection 2 Sačuvani odabir 2 + Saved Selection 20 Sačuvani odabir 20 + Saved Selection 21 Sačuvani odabir 21 + Saved Selection 22 Sačuvani odabir 22 + Saved Selection 23 Sačuvani odabir 23 + Saved Selection 24 Sačuvani odabir 24 + Saved Selection 25 Sačuvani odabir 25 + Saved Selection 3 Sačuvani odabir 3 + Saved Selection 4 Sačuvani odabir 4 + Saved Selection 5 Sačuvani odabir 5 + Saved Selection 6 Sačuvani odabir 6 + Saved Selection 7 Sačuvani odabir 7 + Saved Selection 8 Sačuvani odabir 8 + Saved Selection 9 Sačuvani odabir 9 + Select Tool Alat za odabir + Set Keyboard Shortcut Postavi prečicu na tastaturi + Set Zoom Postavi zumiranje + Show Package Prikaži paket + Show Panel Prikaži panel + Spot Colors… Spot boje… + Swatch Options… Opcije uzorka boje… + Three Point Perspective Preset 1 Predložak perspektive s tri tačke 1 + Three Point Perspective Preset 2 Predložak perspektive s tri tačke 2 + Three Point Perspective Preset 3 Predložak perspektive s tri tačke 3 + Three Point Perspective Preset 4 Predložak perspektive s tri tačke 4 + Three Point Perspective Preset 5 Predložak perspektive s tri tačke 5 + Tool Option Opcija alata + Tool Options… Opcije alata… + Toolbar: Advanced / Basic Traka s alatima: napredno / osnovno + Basic Osnovno + Toolbar: Single/Double Column Traka s alatima: jedna/dvije kolone + Toolbar: Add Tool Traka s alatima: dodaj alat + Toolbar: Remove Tool Traka s alatima: ukloni alat + Toolbar: Reset Traka s alatima: vrati na početno + Two Point Perspective Preset 1 Predložak perspektive s dvije tačke 1 + Two Point Perspective Preset 2 Predložak perspektive s dvije tačke 2 + Two Point Perspective Preset 3 Predložak perspektive s dvije tačke 3 + Two Point Perspective Preset 4 Predložak perspektive s dvije tačke 4 + Two Point Perspective Preset 5 Predložak perspektive s dvije tačke 5 + Undo {name} Poništi {name} + Undo {} Poništi {} + User Graphic Style Library 1 Korisnička biblioteka grafičkih stilova 1 + User Graphic Style Library 10 Korisnička biblioteka grafičkih stilova 10 + User Graphic Style Library 2 Korisnička biblioteka grafičkih stilova 2 + User Graphic Style Library 3 Korisnička biblioteka grafičkih stilova 3 + User Graphic Style Library 4 Korisnička biblioteka grafičkih stilova 4 + User Graphic Style Library 5 Korisnička biblioteka grafičkih stilova 5 + User Graphic Style Library 6 Korisnička biblioteka grafičkih stilova 6 + User Graphic Style Library 7 Korisnička biblioteka grafičkih stilova 7 + User Graphic Style Library 8 Korisnička biblioteka grafičkih stilova 8 + User Graphic Style Library 9 Korisnička biblioteka grafičkih stilova 9 + User Swatch Library 1 Korisnička biblioteka uzoraka boja 1 + User Swatch Library 10 Korisnička biblioteka uzoraka boja 10 + User Swatch Library 2 Korisnička biblioteka uzoraka boja 2 + User Swatch Library 3 Korisnička biblioteka uzoraka boja 3 + User Swatch Library 4 Korisnička biblioteka uzoraka boja 4 + User Swatch Library 5 Korisnička biblioteka uzoraka boja 5 + User Swatch Library 6 Korisnička biblioteka uzoraka boja 6 + User Swatch Library 7 Korisnička biblioteka uzoraka boja 7 + User Swatch Library 8 Korisnička biblioteka uzoraka boja 8 + User Swatch Library 9 Korisnička biblioteka uzoraka boja 9 + View {n} Pogled {n} + Width Point Edit… Uređivanje tačke širine… + to search every command za pretragu svih naredbi + Anchor Point Sidrena tačka + Anchors: Sidra: + Anchors Sidra + Click Kliknite + Alt+Click Alt+klik + Shift+Click Shift+klik + Click an anchor point Kliknite sidrenu tačku + Click or drag Kliknite ili prevucite + Click the first point Kliknite prvu tačku + Connect Selected End Points Poveži odabrane krajnje tačke + Connect Poveži + Convert Selected Anchor Points to Corner Pretvori odabrane sidrene tačke u ugaone + Convert Selected Anchor Points to Smooth Pretvori odabrane sidrene tačke u glatke + Convert: Pretvori: + Double-click Dvostruki klik + Drag Prevucite + Alt+Drag Alt+prevlačenje + Shift+Drag Shift+prevlačenje + Drag a handle Prevucite ručku + Enter Enter + Esc Esc + Fit All Uklopi sve + Fit on Screen Uklopi na ekran + Help › Search Commands… Pomoć › Pretraži naredbe… + Name* @ 66.67 % (RGB/Preview) Naziv* @ 66,67 % (RGB/pregled) + Name* @ 66.67% (RGB/Preview) Naziv* @ 66,67% (RGB/pregled) + No Document Nema dokumenta + Press Pritisnite + Search commands and tools Pretraži naredbe i alate + Style: Stil: + Switch workspace Promijeni radni prostor + Show all open documents Prikaži sve otvorene dokumente + Use Koristite + the object to select | objekat za odabir | + to select multiple objects | za odabir više objekata | + the object to duplicate objekat za dupliciranje + an anchor or path segment to select it | sidro ili segment putanje da ga odaberete | + to move | za pomjeranje | + to add za dodavanje + to add a corner point | za dodavanje ugaone tačke | + to add a smooth point | za dodavanje glatke tačke | + to close | za zatvaranje | + to finish za završetak + to add smooth points | za dodavanje glatkih tačaka | + to toggle corner | za prebacivanje ugla | + to create point type | za kreiranje tačkastog teksta | + to create area type | za kreiranje teksta u području | + to exit editing za izlazak iz uređivanja + to draw | za crtanje | + to constrain proportions | za zadržavanje proporcija | + from center | iz središta | + for exact size za tačnu veličinu + to set the reference point | za postavljanje referentne tačke | + to transform | za transformisanje | + for exact values za tačne vrijednosti + to pan the view za pomicanje prikaza + to zoom in | za uvećanje | + to zoom out | za umanjenje | + to zoom into an area za zumiranje područja + Hold Zadrži + right or left to zoom in or out | desno ili lijevo za uvećanje ili umanjenje | + to keep zooming za nastavak zumiranja + an object to copy its attributes | objekat da kopirate njegove atribute | + to apply the selection's to it | da primijenite onaj iz odabira | + to sample a color za uzimanje uzorka boje + across a selected object to set the gradient direction preko odabranog objekta da postavite smjer gradijenta + to select an artboard | za odabir radne ploče | + on the canvas to create one ( na platno da kreirate jedan ( + selects several, or draws one inside an artboard) odabire više ili crta jedan unutar radne ploče) + a stroke to add a width point | potez da dodate tačku širine | + to change one side | za promjenu jedne strane | + to select more points | za odabir više tačaka | + a point to edit it | tačku da je uredite | + to remove points za uklanjanje tačaka + the art to add a pin | po crtežu da dodate pribadaču | + to select more pins | za odabir više pribadača | + a pin to warp | pribadaču za iskrivljenje | + near a selected pin to rotate | blizu odabrane pribadače za rotaciju | + to remove pins za uklanjanje pribadača + across paths to push them along | preko putanja da ih gurate | + to size the brush ( za veličinu četkice ( + keeps its proportions) zadržava proporcije) + over paths, and hold still to keep going | preko putanja i mirujte da nastavite | + over paths to roughen their outlines | preko putanja da ohrapavite njihove obrise | + to move in perspective | za pomjeranje u perspektivi | + to copy | za kopiranje | + while dragging to move perpendicular to the plane | tokom prevlačenja za pomjeranje okomito na ravan | + to scale in perspective za skaliranje u perspektivi + an object, then another to blend them | objekat, zatim drugi da ih stopite | + to blend from it | da stapate od njega | + to set spacing and orientation za postavljanje razmaka i orijentacije + Apply Primijeni + Change Screen Mode (F) Promijeni način prikaza ekrana (F) + Color (,) Boja (,) + Draw Behind Crtaj iza + Draw Inside Crtaj unutra + Draw Normal Crtaj normalno + Expand: Proširi: + Gradient (.) Gradijent (.) + H: V: + Modify Izmijeni + Navigate Navigacija + None (/) Ništa (/) + Select All Pins Odaberi sve pribadače + Show Mesh Prikaži mrežu poligona + Toggle single/double column Prebaci jednu/dvije kolone + W: Š: + X: X: + Y: Y: + Drag to float the toolbar Prevucite da odvojite traku s alatima + Drag to the window's left edge to dock Prevucite do lijeve ivice prozora za sidrenje + Crystallize Kristalizuj + Add Anchor Point Tool Alat za dodavanje sidrene tačke + Anchor Point Tool Alat sidrena tačka + Arc Tool Alat luk + Area Graph Tool Alat za površinski grafikon + Area Type Tool Alat za tekst u području + Artboard Tool Alat radna ploča + Bar Graph Tool Alat za trakasti grafikon + Blend Tool Alat za stapanje + Bloat Tool Alat za napuhavanje + Blob Brush Tool Alat četkica mrlja + Column Graph Tool Alat za stupčasti grafikon + Crystallize Tool Alat za kristalizaciju + Delete Anchor Point Tool Alat za brisanje sidrene tačke + Direct Selection Tool Alat za direktni odabir + Direct Selection Direktni odabir + Ellipse Tool Alat za elipsu + Eraser Tool Alat gumica + Eyedropper Tool Alat kapaljka + Flare Tool Alat za odsjaj + Free Transform Tool Alat za slobodnu transformaciju + Gradient Tool Alat za gradijent + Group Selection Tool Alat za odabir grupe + Group Selection Odabir grupe + Hand Tool Alat ruka + Hand Ruka + Join Tool Alat za spajanje + Lasso Tool Alat laso + Lasso Laso + Line Cut Tool Alat za rez linijom + Line Graph Tool Alat za linijski grafikon + Line Segment Tool Alat segment linije + Live Paint Selection Tool Alat za odabir živog bojenja + Magic Wand Tool Alat čarobni štapić + Measure Tool Alat za mjerenje + Measure Mjeri + Mesh Tool Alat mreža + Mirror & Cut Tool Alat zrcali i reži + Paintbrush Tool Alat kist + Path Eraser Tool Alat gumica za putanje + Pencil Tool Alat olovka + Perspective Grid Tool Alat mreža perspektive + Perspective Selection Tool Alat za odabir u perspektivi + Pie Graph Tool Alat za tortni grafikon + Polar Grid Tool Alat polarna mreža + Polygon Tool Alat mnogougao + Print Tiling Tool Alat za popločavanje štampe + Pucker Tool Alat za nabiranje + Puppet Warp Tool Alat za iskrivljenje lutkom + Radar Graph Tool Alat za radarski grafikon + Rectangle Cut Tool Alat za rez pravougaonikom + Rectangle Tool Alat pravougaonik + Rectangular Grid Tool Alat pravougaona mreža + Reflect Tool Alat za odraz + Reshape Tool Alat za preoblikovanje + Rotate Tool Alat za rotaciju + Rotate View Tool Alat za rotaciju prikaza + Trackpad Gesture to Rotate View Pokret dodirne ploče za rotaciju prikaza + Rotate View Rotiraj prikaz + Rounded Rectangle Tool Alat zaobljeni pravougaonik + Scale Tool Alat za skaliranje + Scallop Tool Alat školjka + Scatter Graph Tool Alat za raspršeni grafikon + Scissors Tool Alat makaze + Scissors Makaze + Selection Tool Alat za odabir + Shape Builder Tool Alat graditelj oblika + Shaper Tool Alat oblikovač + Shear Tool Alat za smicanje + Slice Selection Tool Alat za odabir isječka + Slice Tool Alat za isječke + Smooth Tool Alat za zaglađivanje + Spiral Tool Alat spirala + Stacked Bar Graph Tool Alat za naslagani trakasti grafikon + Stacked Column Graph Tool Alat za naslagani stupčasti grafikon + Star Tool Alat zvijezda + Symbol Screener Tool Alat prozirivač simbola + Symbol Scruncher Tool Alat sabijač simbola + Symbol Shifter Tool Alat pomjerač simbola + Symbol Sizer Tool Alat mijenjač veličine simbola + Symbol Spinner Tool Alat okretač simbola + Symbol Sprayer Tool Alat raspršivač simbola + Symbol Stainer Tool Alat bojač simbola + Symbol Styler Tool Alat stilizator simbola + Touch Type Tool Alat dodirni tekst + Touch Type Dodirni tekst + Twirl Tool Alat kovitlac + Type on a Path Tool Alat tekst na putanji + Type Tool Alat za tekst + Vertical Area Type Tool Alat okomiti tekst u području + Vertical Area Type Okomiti tekst u području + Vertical Type on a Path Tool Alat okomiti tekst na putanji + Vertical Type on a Path Okomiti tekst na putanji + Vertical Type Tool Alat za okomiti tekst + Vertical Type Okomiti tekst + Warp Tool Alat za iskrivljenje + Width Tool Alat širina + Wrinkle Tool Alat za nabiranje + Zoom Tool Alat za zumiranje + Action {n} Akcija {n} + Begin Recording Započni snimanje + Center on Artboard Centriraj na radnoj ploči + Default Actions Zadane akcije + ▾ Default Actions ▾ Zadane akcije + Duplicate and Offset 10 pt Dupliciraj i pomakni za 10 pt + No actions. Press ● to record. Nema akcija. Pritisnite ● za snimanje. + Outline Text Tekst u obrise + Play Current Selection Reprodukuj trenutni odabir + Reflect Horizontal Odrazi vodoravno + Rotate 90° CW Rotiraj za 90° u smjeru kazaljke + Set 1 Skup 1 + Stop Playing/Recording Zaustavi reprodukciju/snimanje + Unite and Simplify Ujedini i pojednostavi + ● Recording ● Snimanje + Align to Artboard Poravnaj s radnom pločom + Align to Glyph Bounds Poravnaj s granicama glifa + Align to Key Object Poravnaj s ključnim objektom + Align to Selection Poravnaj prema odabiru + Align To: Poravnaj s: + Cancel Key Object Otkaži ključni objekat + Distribute Objects: Rasporedi objekte: + Distribute Spacing: Rasporedi razmak: + Horizontal Distribute Center Vodoravna raspodjela po sredini + Horizontal Distribute Left Vodoravna raspodjela lijevo + Horizontal Distribute Right Vodoravna raspodjela desno + Horizontal Distribute Space Vodoravna raspodjela razmaka + Vertical Distribute Bottom Okomita raspodjela dolje + Vertical Distribute Center Okomita raspodjela po sredini + Vertical Distribute Space Okomita raspodjela razmaka + Vertical Distribute Top Okomita raspodjela gore + Add New Effect Dodaj novi efekat + Click to choose a swatch, Shift-click to mix a colour Kliknite da odaberete uzorak boje, Shift-klik da miješate boju + Click to toggle visibility Kliknite za promjenu vidljivosti + Dashed Isprekidano + Delete Selected Item Izbriši odabranu stavku + Double-click to edit the characters' paint Dvostruki klik za uređivanje boje znakova + Double-click to target the contents Dvostruki klik za ciljanje sadržaja + Drag onto art to apply this appearance Prevucite na crtež da primijenite ovaj izgled + Duplicate Selected Item Dupliciraj odabranu stavku + Fill: Ispuna: + Hide Thumbnail Sakrij sličicu + Mixed Appearances Mješoviti izgledi + Mixed Objects Mješoviti objekti + Mixed Miješano + No options Nema opcija + No Selection Nema odabira + Offset X Pomak X + Opacity: 50% Multiply Neprozirnost: 50% množenje + Opacity: Default Neprozirnost: zadano + Opacity: {value} Neprozirnost: {value} + Rectangle: Sunshine Pravougaonik: sunce + Redefine Graphic Style “{name}” Ponovo definiši grafički stil „{name}” + Apply {name} Primijeni {name} + Redefine {name} Ponovo definiši {name} + Show Thumbnail Prikaži sličicu + Delete Artboards Izbriši radne ploče + Delete Empty Artboards Izbriši prazne radne ploče + Duplicate Artboards Dupliciraj radne ploče + Move Down Pomakni dolje + Move Up Pomakni gore + Open a document to see its artboards. Otvorite dokument da vidite njegove radne ploče. + Rearrange All Artboards Preuredi sve radne ploče + Move Artwork with Artboard Pomjeraj crtež s radnom pločom + Scale Artwork with Artboard Skaliraj crtež s radnom pločom + Add Selected Artwork (Alt: as one asset) Dodaj odabrani crtež (Alt: kao jedan resurs) + Add Selected Artwork as Multiple Assets Dodaj odabrani crtež kao više resursa + Double-click to rename Dvostruki klik za preimenovanje + Drag art here, or select it and click +. Hold Alt for one asset of several objects. Prevucite crtež ovdje ili ga odaberite i kliknite +. Držite Alt za jedan resurs od više objekata. + Export the selected assets (else all of them) Izvezi odabrane resurse (inače sve) + Export {count} Selected Izvezi odabrano ({count}) + Select All Assets Odaberi sve resurse + Don't Show Center Ne prikazuj središte + Hide Note Sakrij bilješku + Image Map: Mapa slike: + Note: Napomena: + Open the URL in the web browser Otvori URL u web pregledniku + Overprint Fill Pretisak ispune + Overprint Stroke Pretisak poteza + Recent URLs Nedavni URL-ovi + Reverse Path Direction Off Obrni smjer putanje isključeno + Reverse Path Direction On Obrni smjer putanje uključeno + Show Center Prikaži središte + Show Note Prikaži bilješku + URL: URL: + Use Even-Odd Fill Rule Koristi pravilo ispune parno-neparno + Use Non-Zero Winding Fill Rule Koristi pravilo ispune nenultog namotaja + List View Prikaz liste + New Art Brush from Selection Nova umjetnička četkica iz odabira + New Bristle Brush Nova četkica s čekinjama + New Calligraphic Brush Nova kaligrafska četkica + New Pattern Brush from Selection Nova četkica uzorka iz odabira + New Scatter Brush from Selection Nova raspršena četkica iz odabira + No brushes Nema četkica + Select art and use New Brush to make one. Odaberite crtež i koristite Nova četkica da je napravite. + Show {kind} Brushes Prikaži {kind} četkice + Thumbnail View Prikaz sličica + All Caps Sva velika slova + Character Alignment Poravnanje znakova + Character Rotation Rotacija znakova + Em Box Bottom/Left Dno/lijevo em okvira + Em Box Center Središte em okvira + Em Box Top/Right Vrh/desno em okvira + Fractional Widths Djelimične širine + Hide Options Sakrij opcije + Horizontal Scale % Vodoravna skala % + Kerning (0 = Auto) Podrezivanje (0 = automatski) + Leading Prored + No Break Bez preloma + Proportional Metrics Proporcionalna metrika + Character Direction Smjer znakova + Digits Cifre + Arabic Arapski + Hindi Hindi + Farsi Farsi + Reset Panel Vrati panel na početno + Roman Baseline Latinična osnovna linija + Select a text object to edit its character attributes. Odaberite tekstualni objekat da uredite njegove atribute znakova. + Show Options Prikaži opcije + Color Panel Options Opcije panela boja + Small Caps Mala velika slova + Small Caps (on the roadmap) Mala velika slova (u planu) + Standard Vertical Roman Alignment Standardno okomito latinično poravnanje + Strikethrough Precrtano + Character: Znak: + Character options Opcije znakova + Subscript Indeks + Subscript (on the roadmap) Indeks (u planu) + Superscript Eksponent + Superscript (on the roadmap) Eksponent (u planu) + System Layout Sistemski raspored + Tate-chu-yoko Tate-chu-yoko + Underline Podvučeno + Vertical Scale % Okomita skala % + Axis Osa + ICF Top/Right ICF vrh/desno + ICF Bottom/Left ICF dno/lijevo + Copy Color Value (Hex) Kopiraj vrijednost boje (hex) + Create New Swatch… Kreiraj novi uzorak boje… + Name 40% Naziv 40% + Out of Gamut Warning Upozorenje o izlasku iz gamuta + Out of Web Color Warning Upozorenje o boji izvan weba + Web Safe RGB Sigurni web RGB + {warning}: click to correct to the closest color ({hex}) {warning}: kliknite za ispravku na najbližu boju ({hex}) + Edit or Apply Colors Uredi ili primijeni boje + Limit colors to swatch library Ograniči boje na biblioteku uzoraka boja + Limit colors to swatch library: {name} Ograniči boje na biblioteku uzoraka boja: {name} + Save color group to Swatch panel Sačuvaj grupu boja u panel Uzorci boja + Save Colors as Swatches Sačuvaj boje kao uzorke boja + Save selected colors as swatches Sačuvaj odabrane boje kao uzorke boja + Set base color Postavi osnovnu boju + Set base color to the current color Postavi osnovnu boju na trenutnu boju + Show Tints/Shades Prikaži nijanse/sjene + Show Vivid/Muted Prikaži živo/prigušeno + Show Warm/Cool Prikaži toplo/hladno + Click to select, double-click to edit Kliknite za odabir, dvostruki klik za uređivanje + Color Theme Tema boja + Delete theme Izbriši temu + Edit Theme Uredi temu + Edit theme Uredi temu + Make a theme on Create and save it. Napravite temu na Kreiraj i sačuvajte je. + My Themes Moje teme + New theme from the current color Nova tema iz trenutne boje + No saved themes Nema sačuvanih tema + Rule: Pravilo: + Save changes to {name} Sačuvaj promjene u {name} + Save theme to My Themes Sačuvaj temu u Moje teme + Set the selected color to the current color Postavi odabranu boju na trenutnu boju + Copied the CSS of {rules} object(s) Kopiran CSS objekata: {rules} + Copy All Styles Kopiraj sve stilove + Exported {path} Izvezeno: {path} + Generate CSS: the whole document's CSS while nothing is selected Generiši CSS: CSS cijelog dokumenta kad ništa nije odabrano + No CSS Nema CSS-a + Select objects to see their CSS, or Generate CSS for the whole document. Odaberite objekte da vidite njihov CSS ili Generiši CSS za cijeli dokument. + The selected objects have no CSS of their own (see below). Odabrani objekti nemaju vlastiti CSS (vidi ispod). + Units: {units} Jedinice: {units} + {count} more rules: Export writes every one. Još pravila: {count}; izvoz zapisuje svako. + {count} unnamed objects left out: name them, or turn on Unnamed Objects in the panel menu. Izostavljeno neimenovanih objekata: {count}; imenujte ih ili uključite Neimenovani objekti u meniju panela. + All Categories Sve kategorije + Repeat Objects Ponovi objekte + Save… Sačuvaj… + Selection Only Samo odabir + {title} (selection) {title} (odabir) + Changed since the last Refresh. Promijenjeno od posljednjeg osvježavanja. + Click to zoom in, Alt-click to zoom out, drag to pan, double-click to fit Kliknite za uvećanje, Alt-klik za umanjenje, prevucite za pomicanje, dvostruki klik za uklapanje + Fit in Window Uklopi u prozor + Open a document to preview its flattening. Otvorite dokument da pregledate njegovo spljoštavanje. + Overprints: Pretisci: + Preview the document as it is now Pregledaj dokument kakav je sada + Raster/Vector Balance: Balans rastera i vektora: + Refresh Osvježi + Save Transparency Flattener Preset… Sačuvaj predložak spljoštavanja prozirnosti… + Basic Latin Osnovna latinica + Currency & Symbols Valuta i simboli + Double-click to insert Dvostruki klik za umetanje + Entire Font Cijeli font + glyph {id} glif {id} + Greek & Cyrillic Grčko i ćirilica + Latin Extended Proširena latinica + Latin-1 Supplement Latin-1 dodatak + No fonts are available. Nema dostupnih fontova. + Select text or click into text with the Type tool to insert glyphs Odaberite tekst ili kliknite u tekst alatom za tekst da umetnete glifove + Show: Prikaži: + Use the Selected Text's Font Koristi font odabranog teksta + Aspect Ratio Omjer stranica + Click the art with the Gradient tool to add or select points. Kliknite crtež alatom za gradijent da dodate ili odaberete tačke. + Click the ramp or a type button to apply a gradient. Kliknite rampu ili dugme vrste da primijenite gradijent. + Color: Boja: + Delete Stop Izbriši tačku + Edit Gradient Uredi gradijent + Edit the selected point's colour in the Color panel Uredite boju odabrane tačke u panelu Boja + Edit the stop Uredi tačku + Eyedropper: click the art to sample the stop's colour Kapaljka: kliknite crtež da uzmete uzorak boje tačke + Eyedropper: click the art to sample the key color Kapaljka: kliknite crtež da uzmete uzorak ključne boje + Gradient across stroke Gradijent preko poteza + Gradient along stroke Gradijent duž poteza + Gradient Fill: click to apply, drag onto art Gradijentna ispuna: kliknite za primjenu, prevucite na crtež + Gradient swatches Gradijentni uzorci boja + Gradient within stroke Gradijent unutar poteza + Linear Gradient Linearni gradijent + Lines: clicks add points joined by a line Linije: klikovi dodaju tačke spojene linijom + No gradient swatches Nema gradijentnih uzoraka boja + Points: clicks add free points Tačke: klikovi dodaju slobodne tačke + Radial Gradient Radijalni gradijent + Reset to White, Black Vrati na bijelu, crnu + Reverse Gradient Obrni gradijent + Save to Swatches Sačuvaj u uzorke boja + Delete Graphic Style (Alt-click: without asking) Izbriši grafički stil (Alt-klik: bez pitanja) + Delete the graphic style “{name}”? Izbrisati grafički stil „{name}”? + Delete these {n} graphic styles? Izbrisati ove grafičke stilove ({n})? + Delete this {n} graphic style? Izbrisati ovaj grafički stil ({n})? + Graphic Style Libraries Menu Meni biblioteka grafičkih stilova + New Graphic Style (Alt-click to name it) Novi grafički stil (Alt-klik da ga imenujete) + New Graphic Style… Novi grafički stil… + No graphic styles Nema grafičkih stilova + Objects using them keep their look but are no longer linked. Objekti koji ih koriste zadržavaju izgled, ali više nisu povezani. + Open a document to see its graphic styles. Otvorite dokument da vidite njegove grafičke stilove. + Open Graphic Style Library Otvori biblioteku grafičkih stilova + Select styled art and click New Graphic Style. Odaberite stilizovani crtež i kliknite Novi grafički stil. + Use Square for Previews Koristi kvadrat za preglede + Use Text for Previews Koristi tekst za preglede + {percent}% opacity {percent}% neprozirnosti + History Options… Opcije historije… + Step Backward Korak unazad + Step Forward Korak naprijed + Clear History Očisti historiju + Set History Limit… Postavi ograničenje historije… + Open a document to see its history. Otvorite dokument da vidite njegovu historiju. + Apply Data Set Primijeni skup podataka + Cancel Pattern Editing Otkaži uređivanje uzorka + Copy Appearance Kopiraj izgled + Copy Guide Kopiraj vodilicu + Copy in Perspective Kopiraj u perspektivi + Create Slice from Selection Kreiraj isječak iz odabira + Create Slices from Guides Kreiraj isječke iz vodilica + Delete All Slices Izbriši sve isječke + Delete Data Sets Izbriši skupove podataka + Delete Graphic Styles Izbriši grafičke stilove + Delete Guide Izbriši vodilicu + Delete Guides Izbriši vodilice + Delete Slice Izbriši isječak + Delete Style Izbriši stil + Delete Variables Izbriši varijable + Delete View Izbriši pogled + Done Editing Pattern Završi uređivanje uzorka + Duplicate Rows Dupliciraj redove + Edit Perspective Grid Uredi mrežu perspektive + Expand Blend Proširi stapanje + Expand Envelope Proširi omotnicu + Expand Image Trace Proširi praćenje slike + Expand Live Paint Proširi živo bojenje + Live Shape Živi oblik + Make Blend Napravi stapanje + Make Dynamic Učini dinamičkim + Make Intertwine Napravi Intertwine + Make Live Paint Napravi živo bojenje + Make Pattern Napravi uzorak + Make Slice Napravi isječak + Merge Live Paint Spoji živo bojenje + Mesh Point Color Boja tačke mreže + Move Envelope Point Pomjeri tačku omotnice + Move Plane and Copy Objects Pomjeri ravan i kopiraj objekte + Move Plane and Objects Pomjeri ravan i objekte + Move Slice Pomjeri isječak + Move Type on a Path Pomjeri tekst na putanji + New Guide Nova vodilica + Place from Library Postavi iz biblioteke + Rearrange Artboards Preuredi radne ploče + Release Blend Oslobodi stapanje + Release Envelope Oslobodi omotnicu + Release Intertwine Oslobodi Intertwine + Objects on Path Objekti na putanji + Attach Priloži + Objects on Path Options Opcije objekata na putanji + Objects on Path Tool Alat objekti na putanji + Attach Objects on Path Priloži objekte na putanju + Expand Objects on Path Proširi objekte na putanji + Release Live Paint Oslobodi živo bojenje + Release Repeat Oslobodi ponavljanje + Release Slice Oslobodi isječak + Release Threaded Text Oslobodi povezani tekst + Rename Design Preimenuj dizajn + Rename Style Preimenuj stil + Rename View Preimenuj pogled + Reorder Appearance Promijeni redoslijed izgleda + Reorder Artboards Promijeni redoslijed radnih ploča + Reshape Spine Preoblikuj kičmu + Resize Artboard Promijeni veličinu radne ploče + Resize Slice Promijeni veličinu isječka + Resize Type Area Promijeni veličinu područja teksta + Scale in Perspective Skaliraj u perspektivi + Shape Builder Delete Brisanje graditeljem oblika + Sort Swatches Sortiraj uzorke boja + Symbol Screener Prozirivač simbola + Symbol Scruncher Sabijač simbola + Symbol Shifter Pomjerač simbola + Symbol Sizer Mijenjač veličine simbola + Symbol Spinner Okretač simbola + Symbol Stainer Bojač simbola + Symbol Styler Stilizator simbola + Text Orientation Orijentacija teksta + Thread Text Poveži tekst + Typing Kucanje + Abutting Spojeno + Black and White Crno i bijelo + Corners Uglovi + Auto Grouping Automatsko grupisanje + Enhanced Poboljšano + Ignore Color Zanemari boju + Ignore White Zanemari bijelu + Palette: Paleta: + Limited Ograničeno + Full Tone Puni ton + Document Library Biblioteka dokumenta + Library: Biblioteka: + Tracing Presets Predlošci praćenja + Manage Presets Upravljaj unaprijed postavljenim + Save as New Preset… Sačuvaj kao novo unaprijed postavljeno… + Rename… Preimenuj… + Rename Preset Preimenuj unaprijed postavljeno + Save Image Trace Preset Sačuvaj unaprijed postavljeno praćenje slike + Delete Image Trace Preset Izbriši unaprijed postavljeno praćenje slike + Method: Metoda: + Mode: Način: + Noise Šum + Create: Kreiraj: + Fills Ispune + Strokes Potezi + Overlapping Preklapajuće + Paths: {paths} Anchors: {anchors} Colors: {colors} Putanje: {paths} Sidra: {anchors} Boje: {colors} + Reset to Default Vrati na zadano + Select an image to trace Odaberite sliku za praćenje + Snap Curves To Lines Hvataj krive na linije + Tracing Result with Outlines Rezultat praćenja s obrisima + Source Image Izvorna slika + Threshold Prag + Trace Prati + Trace the image with the Default preset Prati sliku zadanim predloškom + Size: {size} Tracking: {tracking} Veličina: {size} Razmak slova: {tracking} + + Create New Layer Kreiraj novi sloj + Create New Sublayer Kreiraj novi podsloj + Search All Pretraži sve + Filter Filter + Clear All Očisti sve + By Object Po objektu + By Layer Po sloju + Images Slike + Groups Grupe + Linked Files Povezane datoteke + Locked Zaključano + Hidden Skriveno + Filter Layers Panel Rows Filtriraj redove panela slojeva +@msg `Custom` stands for changed settings: save the preset under another name `Custom` označava promijenjene postavke: sačuvajte unaprijed postavljeno pod drugim nazivom +@msg `{key}` must be an array of these names: {_1} `{key}` mora biti niz ovih naziva: {_1} + Graphics Grafika + Local Libraries Lokalne biblioteke + Add Content Dodaj sadržaj + Click to apply to the selected type Kliknite da primijenite na odabrani tekst + Create New Library… Kreiraj novu biblioteku… + Rename Library… Preimenuj biblioteku… + Delete the library “{name}”? Izbrisati biblioteku „{name}”? + Drag art or swatches here, or use + to add the selection's colors and text styles. Prevucite crtež ili uzorke boja ovdje ili koristite + da dodate boje i stilove teksta iz odabira. + Its graphics, colors and text styles are deleted from this machine. Njene grafike, boje i stilovi teksta brišu se s ovog računara. + Keep graphics, colors and text styles here to use them in any document. Libraries are stored on this machine — no account required. Čuvajte grafike, boje i stilove teksta ovdje da ih koristite u bilo kojem dokumentu. Biblioteke se čuvaju na ovom računaru — račun nije potreban. + This library is empty Ova biblioteka je prazna + No results Nema rezultata + No items in this library match “{query}”. Nijedna stavka u ovoj biblioteci ne odgovara „{query}”. + Drag an item here, or right-click one, to put it in this group. Prevucite stavku ovdje ili desno kliknite na nju da je stavite u ovu grupu. + New Group Nova grupa + New Group… Nova grupa… + Move to Group Premjesti u grupu + No Group Bez grupe + Rename Group… Preimenuj grupu… + Delete Group Izbriši grupu + Import Library… Uvezi biblioteku… + Export Library… Izvezi biblioteku… + Close Library Zatvori biblioteku + Next Library Sljedeća biblioteka + No matches. Nema podudaranja. + Other Libraries Ostale biblioteke + Previous Library Prethodna biblioteka + Swatch exchange files keep solid colors only. Datoteke za razmjenu uzoraka boja zadržavaju samo pune boje. + This library is empty. Ova biblioteka je prazna. + Color Space Prostor boja + Created Kreirano + Dimensions Dimenzije + Embedded {n} image(s) Ugrađeno slika: {n} + Embedded {n} image(s); {missing} missing: relink them first Ugrađeno slika: {n}; nedostaje {missing}: prvo ih ponovo povežite + File › Place… brings in an image, linked or embedded. Datoteka › Postavi… unosi sliku, povezanu ili ugrađenu. + Format Format + Medium Thumbnails Srednje sličice + Missing: {path} Nedostaje: {path} + Modified Izmijenjeno + Modified since it was read: {path} Izmijenjeno nakon čitanja: {path} + No Thumbnails Bez sličica + Nothing matches the Show filter. Ništa ne odgovara filteru Prikaži. + PPI PPI + Relinked {n} image(s) Ponovo povezano slika: {n} + Relinked {n} image(s); not in that folder: {} Ponovo povezano slika: {n}; nisu u tom folderu: {} + Relinked {} image(s) Ponovo povezano slika: {} + Relink… Ponovo poveži… + Find Linked Files Pronađi povezane datoteke + Find Linked Files in Folder… Pronađi povezane datoteke u folderu… + Choose the file to relink each linked file to. Files with the size and contents saved with the link come first. Odaberite datoteku s kojom ponovo povezati svaku povezanu datoteku. Datoteke s veličinom i sadržajem sačuvanim uz vezu dolaze prve. + Same file Ista datoteka + Same size Ista veličina + Don't Relink Nemoj ponovo povezati + Copy into the document's folder Kopiraj u folder dokumenta + Select an image to see its Link Info. Odaberite sliku da vidite informacije o njenoj vezi. + Show Embedded Prikaži ugrađeno + Show Link Info Prikaži informacije o vezi + Show Modified Prikaži izmijenjene + Small Thumbnails Male sličice + Status Status + Unembedded to {} Ugrađivanje poništeno u {} + Update Link Ažuriraj vezu + Updated {} image(s) Ažurirano slika: {} + Break Link Prekini vezu + Tolerance: Tolerancija: + Corner Point Angle Threshold: Prag ugla ugaone tačke: + Convert to Straight Lines Pretvori u ravne linije + Show Original Path Prikaži originalnu putanju + Open this dialog with these settings next time Sljedeći put otvori ovaj dijalog s ovim postavkama + Auto-Simplify Automatsko pojednostavljenje + Auto-Smooth Automatsko izglađivanje + Transparency Options Opcije prozirnosti + Color Mixer (Shift-click the chip) Mikser boja (Shift-klik na kvadratić) + Fill: click for swatches, Shift-click for the color mixer Ispuna: kliknite za uzorke boja, Shift-klik za mikser boja + Stroke: click for swatches, Shift-click for the color mixer Potez: kliknite za uzorke boja, Shift-klik za mikser boja + This panel is on the roadmap (see the parity plan). Ovaj panel je u planu (vidi plan usklađenosti). + Open a document to navigate it. Otvorite dokument da se krećete kroz njega. + View Artboard Only Prikaži samo radnu ploču + Contextual Alternates Kontekstualne alternative + Default Figure Zadane brojke + Discretionary Ligatures Diskrecione ligature + Figure: Brojke: + Fractions Razlomci + Ligatures are off while the text is tracked. Ligature su isključene dok tekst ima razmak slova. + Ordinals Redni brojevi + Proportional Oldstyle Proporcionalne stare brojke + Reset OpenType Features Vrati OpenType mogućnosti na početno + Select text to set its OpenType features. Odaberite tekst da postavite njegove OpenType mogućnosti. + Standard Ligatures Standardne ligature + Swash Ukrasni potez + Tabular Lining Tabelarne brojke + Tabular Oldstyle Tabelarne stare brojke + Every-line Composer Slagač svih redova + First-line Left Indent Lijeva uvlaka prvog reda + Hyphenation… Rastavljanje riječi… + Words Longer Than: Riječi duže od: + After First: Nakon prvog: + Before Last: Prije posljednjeg: + Hyphen Limit: Ograničenje crtica: + Hyphenation Zone: Zona rastavljanja: + letters slova + hyphens crtice + Hyphenate Capitalized Words Rastavljaj riječi s velikim početnim slovom + Justification… Poravnanje… + Justify with last line aligned center Obostrano s posljednjim redom po sredini + Justify with last line aligned right Obostrano s posljednjim redom desno + Left Indent Lijeva uvlaka + Left-to-Right Paragraph Direction Smjer pasusa s lijeva nadesno + Line-end Punctuation Half Width Interpunkcija na kraju reda u pola širine + Insert Kashidas Umetni kašide + Long Dugo + Stylistic Stilsko + Mojikumi Set Mojikumi skup + Kinsoku Set Kinsoku skup + Hard Tvrdo + Right Indent Desna uvlaka + Right-to-Left Paragraph Direction Smjer pasusa s desna nalijevo + Roman Hanging Punctuation Latinična viseća interpunkcija + Select a text object to edit its paragraph attributes. Odaberite tekstualni objekat da uredite njegove atribute pasusa. + Single-line Composer Slagač jednog reda + Toggle Line Composer Uključi/isključi Line Composer + Space After Paragraph Razmak nakon pasusa + Space Before Paragraph Razmak prije pasusa + Top-to-Top Leading Prored od vrha do vrha + Bottom-to-Bottom Leading Prored od dna do dna + Burasagari Burasagari + Force Prisili + Expand Compound Shape Proširi složeni oblik + Make Compound Shape Napravi složeni oblik + Pathfinder Options… Opcije Pathfindera… + Pathfinders: Pathfinderi: + Release Compound Shape Oslobodi složeni oblik + Repeat Pathfinder Ponovi Pathfinder + Repeat {name} Ponovi {name} + Trap… Preklapanje boja… + Trap Zamka + Height/Width Visina/širina + Tint Reduction Smanjenje nijanse + Traps with Process Color Zamke procesnom bojom + Reverse Traps Obrni zamke + Precision Preciznost + Remove Redundant Points Ukloni suvišne tačke + Bottom in Front Dno naprijed + Brick by Column Cigla po koloni + Brick by Row Cigla po redu + Brick Offset: Pomak cigle: + Copies: Kopije: + Dim Copies to: Zatamni kopije na: + H Spacing: Vodoravni razmak: + Height: Visina: + Hex by Column Heksagonalno po koloni + Hex by Row Heksagonalno po redu + Left in Front Lijevo naprijed + No document Nema dokumenta + Open a document to edit its patterns. Otvorite dokument da uredite njegove uzorke. + Overlap Preklapanje + Overlap: Preklapanje: + Pattern options are available in pattern editing mode. Opcije uzorka su dostupne u načinu uređivanja uzorka. + Right in Front Desno naprijed + Select art and choose Object › Pattern › Make. Odaberite crtež i izaberite Objekat › Uzorak › Napravi. + Show Swatch Bounds Prikaži granice uzorka boje + Show Tile Edge Prikaži ivicu pločice + Size Tile to Art Prilagodi pločicu crtežu + Tile Type: Vrsta pločice: + Top in Front Vrh naprijed + V Spacing: Okomiti razmak: + Width: Širina: + Appearance panel Panel izgleda + Arrange: Bring to Front Rasporedi: postavi na vrh + Draw: Crtaj: + Edit Artboards Uredi radne ploče + Flip Along Horizontal Axis Preokreni duž vodoravne ose + Flip Along Vertical Axis Preokreni duž okomite ose + Hyphenate Rastavljaj riječi + Isolate Group Izoliraj grupu + Landscape Položeno + More Pathfinder options Više opcija Pathfindera + More Align options Više opcija poravnanja + More Paragraph options Više opcija pasusa + No document open Nijedan dokument nije otvoren + Quick Actions Brze akcije + Rearrange All Preuredi sve + Rulers & Grids Ravnala i mreže + Select a text object Odaberite tekstualni objekat + Show Grid (⌘') Prikaži mrežu (⌘') + Show Rulers (⌘R) Prikaži ravnala (⌘R) + Smart Guides (⌘U) Pametne vodilice (⌘U) + Snap Options Opcije hvatanja + Type: Vrsta: + All colours are within the CMYK gamut Sve boje su unutar CMYK gamuta + Assign: Dodijeli: + Color Settings Postavke boja + Gamut Check Provjera gamuta + Intent: Namjera: + No document open. Nijedan dokument nije otvoren. + Overprint Preview (separations) Pregled pretiska (separacije) + Show All Plates Prikaži sve ploče + Show all plates Prikaži sve ploče + Show/hide plate (Alt-click: only this plate) Prikaži/sakrij ploču (Alt-klik: samo ova ploča) + Simulate Paper Simuliraj papir + Use Black Point Compensation Koristi kompenzaciju crne tačke + Working CMYK (don't tag) Radni CMYK (bez oznake) + {name} (spot) {name} (spot) + Add to Profiles… Dodaj u profile… + Align Stroke to Center Poravnaj potez po sredini + Align Stroke to Inside Poravnaj potez unutra + Align Stroke to Outside Poravnaj potez vani + Align Stroke: Poravnaj potez: + Align: Poravnaj: + Arrowheads: Vrhovi strelica: + Bevel Join Zakošeni spoj + Butt Cap Ravni završetak + Cap: Završetak: + Corner: Ugao: + End arrowhead Krajnji vrh strelice + Exact dash lengths Tačne dužine crtica + Fit dashes to corners and ends Prilagodi crtice uglovima i krajevima + Flip Across Preokreni preko + Flip Along Preokreni duž + gap razmak + Limit: Ograničenje: + Link start and end arrowhead scales Poveži skale početnog i krajnjeg vrha strelice + Miter Join Šiljasti spoj + Profile: Profil: + Projecting Cap Isturen završetak + Round Cap Okrugli završetak + Round Join Okrugli spoj + Scale: Skala: + Start arrowhead Početni vrh strelice + Stroke options Opcije poteza + Swap start and end arrowheads Zamijeni početni i krajnji vrh strelice + Tip extends past the end point Vrh prelazi preko krajnje tačke + Tip on the end point Vrh na krajnjoj tački + Variable Width Profile Profil promjenjive širine + Weight: Debljina: + Art using a deleted global swatch keeps its colour. Crtež koji koristi izbrisani globalni uzorak boje zadržava svoju boju. + Color Group: {name} Grupa boja: {name} + Delete these {count} swatches and groups? Izbrisati ove uzorke boja i grupe ({count})? + Delete “{name}”? Izbrisati „{name}”? + Document Swatches Uzorci boja dokumenta + Edit or Apply Color Group Uredi ili primijeni grupu boja + Edit or Apply Color Group… Uredi ili primijeni grupu boja… + Global Process Color Globalna procesna boja + Global Process Color, CMYK Globalna procesna boja, CMYK + Large List View Prikaz velike liste + Large Thumbnail View Prikaz velikih sličica + Medium Thumbnail View Prikaz srednjih sličica + Open a document to see its swatches. Otvorite dokument da vidite njegove uzorke boja. + Open Swatch Library Otvori biblioteku uzoraka boja + Process Color Procesna boja + Show All Swatches Prikaži sve uzorke boja + Show Color Groups Prikaži grupe boja + Show Color Swatches Prikaži uzorke boja + Show Find Field Prikaži polje za pretragu + Show Gradient Swatches Prikaži gradijentne uzorke boja + Show List View Prikaži prikaz liste + Show Pattern Swatches Prikaži uzorke boja s uzorkom + Pattern Swatches Uzorci boja s uzorkom + Show Swatch Kinds Prikaži vrste uzoraka boja + Show Thumbnail View Prikaži prikaz sličica + Small List View Prikaz male liste + Small Thumbnail View Prikaz malih sličica + Swatch Libraries Menu Meni biblioteka uzoraka boja + User Library Korisnička biblioteka + {kind} Gradient {kind} gradijent + {kind}, {model} {kind}, {model} + No symbols in this document U ovom dokumentu nema simbola + Select art and click New Symbol to make one. Odaberite crtež i kliknite Novi simbol da ga napravite. + Align On: Poravnaj na: + Bottom-Justified Tab Tabulator poravnat na dno + Center-Justified Tab Tabulator poravnat po sredini + Above Text Iznad teksta + Position Panel Above Text Postavi panel iznad teksta + Click to add a tab stop, drag to move it, drag it off the ruler to delete it Kliknite da dodate tabulator, prevucite da ga pomjerite, prevucite ga s ravnala da ga izbrišete + Decimal-Justified Tab Tabulator poravnat po decimalnom znaku + Delete Tab Izbriši tabulator + Leader: Vodeći znak: + Left-Justified Tab Tabulator poravnat lijevo + No text selected Nije odabran tekst + Repeat Tab Ponavljajući tabulator + Right-Justified Tab Tabulator poravnat desno + Top-Justified Tab Tabulator poravnat na vrh + Select a text object to set its tab stops. Odaberite tekstualni objekat da postavite njegove tabulatore. + Select text Odaberi tekst + Snap to Unit Prilijepi uz jedinicu + + Add Scale + Dodaj skalu + Add Selected Artwork as One Asset Dodaj odabrani crtež kao jedan resurs + Export Settings Postavke izvoza + No assets Nema resursa + Remove Selected Assets Ukloni odabrane resurse + Suffix Sufiks + Absolute Position Apsolutni položaj + Export All… Izvezi sve… + Export Selected CSS… Izvezi odabrani CSS… + No selection Nema odabira + Rasterize Unsupported Art Rasteriziraj nepodržani crtež + Unnamed Objects Neimenovani objekti + Width and Height Širina i visina + Add New Dodaj novo + Delete Point Izbriši tačku + Location: Lokacija: + Spread: Širenje: + Clip to Bounding Box Isijeci prema graničnom okviru + Effective PPI Efektivni PPI + Embed Image(s) Ugradi slike + Embedded Image Ugrađena slika + Large Thumbnails Velike sličice + Linked Povezano + Location Lokacija + No images Nema slika + Relink to Folder… Ponovo poveži s folderom… + Show Missing Prikaži nedostajuće + Sort by Status Sortiraj po statusu + Clear Overrides Očisti zamjene + Create New {kind} Style Kreiraj novi {kind} stil + Delete {kind} Style Izbriši {kind} stil + Duplicate {kind} Style Dupliciraj {kind} stil + New {kind} Style… Novi {kind} stil… + Redefine {kind} Style Ponovo definiši {kind} stil + {kind} Style Options… Opcije {kind} stila… + Angle: Ugao: + Ellipse Properties: Svojstva elipse: + Invert Pie Obrnuta pita + Side Length: Dužina stranice: + Make Sides Equal Izjednači stranice + Pie End Angle: Krajnji ugao pite: + Pie Start Angle: Početni ugao pite: + Corner Radius: Poluprečnik ugla: + Radius: Poluprečnik: + Round Okruglo + Flip Horizontal Preokreni vodoravno + Flip Vertical Preokreni okomito + Polygon Properties: Svojstva mnogougla: + Rectangle Properties: Svojstva pravougaonika: + Shape Properties: Svojstva oblika: + Sides: Stranice: + Transform options Opcije transformacije + Transform Both Transformiši oboje + Transform Object Only Transformiši samo objekat + Transform Pattern Only Transformiši samo uzorak + Use Registration Point for Symbol Koristi tačku registracije za simbol + Click to edit the mask; Alt-click to view only the mask; Shift-click to disable or enable it Kliknite da uredite masku; Alt-klik da vidite samo masku; Shift-klik da je onemogućite ili omogućite + Hide Thumbnails Sakrij sličice + Invert Mask Obrni masku + Isolate Blending Izoliraj stapanje + Knockout Group Grupa izbijanja + Link the mask Poveži masku + Make Mask Napravi masku + Opacity & Mask Define Knockout Shape Neprozirnost i maska određuju oblik izbijanja + Select the art (and, on top of it, the mask object) Odaberite crtež (i, iznad njega, objekat maske) + Show Thumbnails Prikaži sličice + Stop editing the opacity mask Zaustavi uređivanje maske neprozirnosti + Unlink the mask Prekini vezu maske + Data Sets Skupovi podataka + Data Set Skup podataka + Select Bound Object Odaberi vezani objekat + Select All Bound Objects Odaberi sve vezane objekte + Multiple objects Više objekata + Graphics: {adapter} Grafika: {adapter} + Part of ArtCraft. MIT OR Apache-2.0. Fonts: Source Sans 3, Inter, JetBrains Mono (OFL). Icons: Lucide (ISC) + VectorCraft. Dio ArtCrafta. MIT OR Apache-2.0. Fontovi: Source Sans 3, Inter, JetBrains Mono (OFL). Ikone: Lucide (ISC) + VectorCraft. + Part of ArtCraft. MIT OR Apache-2.0. Fonts: Source Sans 3, Inter, JetBrains Mono, Noto Sans SC (OFL). Icons: Lucide (ISC) + VectorCraft. Dio ArtCrafta. MIT OR Apache-2.0. Fontovi: Source Sans 3, Inter, JetBrains Mono, Noto Sans SC (OFL). Ikone: Lucide (ISC) + VectorCraft. + Version {version} — open-source vector illustration in pure Rust. Verzija {version} — vektorska ilustracija otvorenog koda u čistom Rustu. + Align to Page Poravnaj sa stranicom + Smooth Color Glatka boja + Specified Distance Navedena udaljenost + Specified Steps Navedeni koraci + Direction: Smjer: + Scatter Brush Options Opcije raspršene četkice + Art Brush Options Opcije umjetničke četkice + Pattern Brush Options Opcije četkice uzorka + Scatter: Raspršenost: + Rotation: Rotacija: + Rotation relative to: Rotacija u odnosu na: + Brush Scale Options Opcije skale četkice + Scale Proportionately Skaliraj proporcionalno + Stretch to Fit Stroke Length Razvuci da stane u dužinu poteza + Stretch Between Guides Razvuci između vodilica + Start: Početak: + End: Kraj: + Left to Right S lijeva nadesno + Right to Left S desna nalijevo + Top to Bottom Odozgo prema dolje + Bottom to Top Odozdo prema gore + Outer Corner Tile Pločica vanjskog ugla + Side Tile Bočna pločica + Inner Corner Tile Pločica unutrašnjeg ugla + Auto-Centered Automatski centrirano + Auto-Between Automatski između + Auto-Sliced Automatski isječeno + Auto-Overlap Automatsko preklapanje + Start Tile Početna pločica + End Tile Krajnja pločica + Fit Uklopi + Stretch to fit Razvuci da stane + Add space to fit Dodaj razmak da stane + Approximate path Približna putanja + Colorization Bojenje + Tints Nijanse + Tints and Shades Nijanse i sjene + Hue Shift Pomak nijanse + Key Color: Ključna boja: + Tips Savjeti + Colorization Tips Savjeti za bojenje + The samples show this brush on a blue stroke. Uzorci prikazuju ovu četkicu na plavom potezu. + The art keeps its own colors. Crtež zadržava svoje boje. + Black becomes the stroke color and white stays white. Other colors become tints of the stroke color by their lightness. Crna postaje boja poteza, a bijela ostaje bijela. Ostale boje postaju nijanse boje poteza prema svjetlini. + Black and white stay as they are. Dark colors become shades of the stroke color and light colors become tints of it. Crna i bijela ostaju kakve jesu. Tamne boje postaju sjene boje poteza, a svijetle boje njene nijanse. + The key color becomes the stroke color. The other colors shift their hue by the same amount and keep their saturation and brightness. Ključna boja postaje boja poteza. Ostale boje pomjeraju nijansu za isti iznos i zadržavaju zasićenje i svjetlinu. + Size: Veličina: + Calligraphic Brush Options Opcije kaligrafske četkice + Bristle Brush Options Opcije četkice s čekinjama + Roundness: Zaobljenost: + Shape: Oblik: + Bristle Length: Dužina čekinja: + Bristle Density: Gustoća čekinja: + Bristle Thickness: Debljina čekinja: + Paint Opacity: Neprozirnost boje: + Stiffness: Krutost: + Round Point Okrugli šiljasti + Flat Point Ravni šiljasti + Round Blunt Okrugli tupi + Flat Blunt Ravni tupi + Round Curve Okrugli zakrivljeni + Flat Curve Ravni zakrivljeni + Round Angle Okrugli ukošeni + Flat Angle Ravni ukošeni + Round Fan Okrugla lepeza + Flat Fan Ravna lepeza + Adjust Options: Opcije podešavanja: + Color Mode: Način boja: + Convert Pretvori + Global Globalno + Green Zelena + Shifts the tints of global and spot colors; other colors stay. Pomjera nijanse globalnih i spot boja; ostale boje ostaju. + Tint Preliv + Color Guide Options Opcije vodiča za boje + Less Manje + Steps: Koraci: + Variation: Varijacija: + Variation Varijacija + Color Models Modeli boja + Color Picker Birač boja + Color wheel Kotač boja + Color Swatches Uzorci boja + Only Web Colors Samo web boje + Original: click to restore Original: kliknite za vraćanje + Ascender Gornji produžetak + Descender Donji produžetak + On Left Side S lijeve strane + On Right Side S desne strane + On Both Sides S obje strane + Short Kratko + Full Width Puna širina + Chamfer Zakošenje + Inverted Round Obrnuto okruglo + Bleed: Napust: + Discard White Overprint in Output Odbaci bijeli pretisak u izlazu + Double Quotes: Dvostruki navodnici: + Export and Clipboard Transparency Flattener Settings Postavke spljoštavanja prozirnosti za izvoz i međuspremnik + Export: Izvoz: + Grid Colors: Boje mreže: + Grid Size: Veličina mreže: + Highlight Substituted Fonts Istakni zamijenjene fontove + Highlight Substituted Glyphs Istakni zamijenjene glifove + Language: Jezik: + Position Položaj + Preserve Text Appearance Očuvaj izgled teksta + Preserve Text Editability Očuvaj mogućnost uređivanja teksta + Show Images in Outline Mode Prikaži slike u načinu obrisa + Simulate Colored Paper Simuliraj obojeni papir + Single Quotes: Jednostruki navodnici: + Small Caps: Mala velika slova: + Subscript: Indeks: + Superscript: Eksponent: + Transparency Grid Mreža prozirnosti + Units: Jedinice: + Use Typographer's Quotes Koristi tipografske navodnike + Center Artwork Centriraj crtež + DXF Import Options Opcije uvoza DXF + Layout: Raspored: + Merge Layers Spoji slojeve + Place DXF Postavi DXF + Scale Lineweights Skaliraj debljine linija + Scale to Fit Artboard Skaliraj da stane u radnu ploču + Scaling Skaliranje + Alter Paths for Appearance Izmijeni putanje za izgled + DXF Options DXF opcije + Export Option Opcija izvoza + Export Selected Art Only Izvezi samo odabrani crtež + Number of Colors: Broj boja: + Raster File Format: Format rasterske datoteke: + True colour needs version 2004 or later: the nearest of 256 colours is written. Prava boja zahtijeva verziju 2004 ili noviju: zapisuje se najbliža od 256 boja. + Type becomes outlines, and strokes a CAD line can't draw become filled shapes. Tekst postaje obrisi, a potezi koje CAD linija ne može nacrtati postaju ispunjeni oblici. + Type stays text, and every stroke is a line with its lineweight and dashes. Tekst ostaje tekst, a svaki potez je linija sa svojom debljinom i crticama. + Version: Verzija: + Spin Okretanje + Good Dobro + Best Najbolje + Mode Način + Blur Mode Način zamućenja + Edge Only Samo ivica + Overlay Edge Ivica preklopa + Amount Količina + Contrast Kontrast + Edit the applied effect, or add another one? Urediti primijenjeni efekat ili dodati još jedan? + Input White Ulazna bijela + Output Black Izlazna crna + Preserve Lightness Očuvaj svjetloću + Ridges per segment: Grebena po segmentu: + Temperature Temperatura + {effect} is already applied {effect} je već primijenjen + Odd Fields Neparna polja + Even Fields Parna polja + Duplication Dupliciranje + Interpolation Interpolacija + Anti-Alias Zaglađivanje ivica + Bend: Savijanje: + Distort Appearance Izobliči izgled + Distort Linear Gradients Izobliči linearne gradijente + Distort Pattern Fills Izobliči ispune uzorkom + Distortion Izobličenje + Envelope Mesh Mreža omotnice + Maintain Envelope Shape Zadrži oblik omotnice + Preserve Shape Using: Očuvaj oblik pomoću: + Reset Envelope Mesh Vrati mrežu omotnice na početno + Reset Envelope Shape Vrati oblik omotnice na početno + V: O: + Warp Options Opcije iskrivljenja + Compatible Gradient and Gradient Mesh Printing Kompatibilno štampanje gradijenata i gradijentnih mreža + Embed Fonts (for other applications) Ugradi fontove (za druge aplikacije) + EPS Options EPS opcije + Include CMYK PostScript in RGB Files Uključi CMYK PostScript u RGB datoteke + Include Document Thumbnails Uključi sličice dokumenta + Include Linked Files Uključi povezane datoteke + Opaque Neprozirno + PostScript: PostScript: + Transparency is flattened with the preset. Type is written as outlines; gradients as bands of colour. Prozirnost se spljoštava predloškom. Tekst se zapisuje kao obrisi; gradijenti kao trake boja. + Transparency is flattened with the preset. Type is written as outlines; gradients stay smooth. Prozirnost se spljoštava predloškom. Tekst se zapisuje kao obrisi; gradijenti ostaju glatki. + Expand Gradient To Proširi gradijent u + Gradient Mesh Gradijentna mreža + Specify: Navedi: + Export As Izvezi kao + One file per artboard: -.{ext} Jedna datoteka po radnoj ploči: -.{ext} + One page per artboard. Jedna stranica po radnoj ploči. + The bounds of the visible art. Granice vidljivog crteža. + The plug-in writes the whole document. Dodatak zapisuje cijeli dokument. + Use Artboards Koristi radne ploče + Choose a folder Odaberite folder + Create Sub-folders Kreiraj podfoldere + Export Asset Izvezi resurs + Export to: Izvezi u: + Format Settings Postavke formata + Formats: Formati: + Full Document Cijeli dokument + Include Bleed Uključi napust + No assets yet. Collect art with Object › Collect for Export, or drag it into the Asset Export panel. Još nema resursa. Prikupite crtež pomoću Objekat › Prikupi za izvoz ili ga prevucite u panel Izvoz resursa. + Open Location after Export Otvori lokaciju nakon izvoza + PDF Preset: PDF predložak: + Prefix: Prefiks: + Remove Ukloni + Select: Odaberi: + Your browser downloads the files (several as one .zip). Vaš preglednik preuzima datoteke (više njih kao jedan .zip). + Cap Završetak + Dash Pattern Uzorak crtica + Eyedropper Applies: Kapaljka primjenjuje: + Eyedropper Picks Up: Kapaljka uzima: + Focal Fill Fokalna ispuna + Focal Stroke Fokalni potez + Miter Limit Ograničenje šiljastog spoja + Point Sample Uzorak tačke + Raster Sample Size: Veličina rasterskog uzorka: + Weight Debljina + 3 x 3 Average Prosjek 3 x 3 + 5 x 5 Average Prosjek 5 x 5 + Author Title: Titula autora: + Author: Autor: + Copyright Info URL: URL informacija o autorskim pravima: + Copyright Notice: Obavještenje o autorskim pravima: + Copyright Status: Status autorskih prava: + Created: Kreirano: + Dates Datumi + Description: Opis: + Document Title: Naslov dokumenta: + Keywords: Ključne riječi: + Modified: Izmijenjeno: + Rating: Ocjena: + Remove “{keyword}” Ukloni „{keyword}” + Separate several keywords with commas. Odvojite više ključnih riječi zarezima. + Flare Tool Options Opcije alata za odsjaj + Rings Prstenovi + Brightness: Svjetlina: + Growth: Rast: + Fuzziness: Nejasnoća: + Number: Broj: + Longest: Najduže: + Path: Putanja: + Largest: Najveće: + Anti-alias Rasters Zaglađivanje ivica rastera + Clip Complex Regions Isijeci složena područja + Convert All Strokes to Outlines Pretvori sve poteze u obrise + Convert All Text to Outlines Pretvori sav tekst u obrise + Gradient and Mesh Resolution: Rezolucija gradijenata i mreža: + Line Art and Text Resolution: Rezolucija linijske grafike i teksta: + Preserve Alpha Transparency Očuvaj alfa prozirnost + Preserve Overprints and Spot Colors Očuvaj pretiske i spot boje + Rasters Rasteri + Replaces the saved preset of that name. Zamjenjuje sačuvani predložak tog naziva. + Save Preset… Sačuvaj postavku… + Vectors Vektori + A saved copy of the selected preset Sačuvana kopija odabranog predloška + Built-in presets don't change: New makes a copy you can edit. Ugrađeni predlošci se ne mijenjaju: Novo pravi kopiju koju možete uređivati. + Horizontal % Vodoravno % + Include Cmy Blacks Uključi CMY crne + Make all bleed settings the same Izjednači sve postavke napusta + Make the bleed values differ Neka vrijednosti napusta budu različite + Miter Limit: Ograničenje šiljastog spoja: + Radius 1 Poluprečnik 1 + Radius 2 Poluprečnik 2 + Radius1 Poluprečnik1 + Radius2 Poluprečnik2 + Relative Relativno + Absolute Apsolutno + Vertical % Okomito % + Miter Šiljasti spoj + Bevel Zakošenje + A lower value follows the stroke closely; a higher one gives fewer points and smoother curves. Niža vrijednost blisko prati potez; viša daje manje tačaka i glađe krive. + Accurate Precizno + Close paths when ends are within: Zatvori putanje kad su krajevi unutar: + Edit selected paths within: Uređuj odabrane putanje unutar: + Fidelity: Vjernost: + Fill new strokes Ispunjavaj nove poteze + Alt key toggles to Smooth Tool Tipka Alt prebacuje na alat za zaglađivanje + Live curve fitting Uklapanje krivulje uživo + Keep selected Zadrži odabrano + Merge only with selection Spajaj samo s odabirom + Consider Open Filled Paths as Closed Smatraj otvorene ispunjene putanje zatvorenim + In Merge Mode, Clicking Stroke Splits the Path U načinu spajanja, klik na potez razdvaja putanju + Pick Color From: Uzmi boju iz: + Artwork Crtež + Cursor Swatch Preview Pregled uzorka boje na kursoru + Selection: Odabir: + Straight Line Ravna linija + Highlight: Isticanje: + Stroke When Editable Potez kad se može uređivati + The document has no colour swatches. Dokument nema uzoraka boja. + Style Name: Naziv stila: + Crop To Izreži na + e.g. 1-3, 5 npr. 1-3, 5 + First Page Prva stranica + Import PDF Uvezi PDF + Last Page Posljednja stranica + Next Page Sljedeća stranica + of {count} od {count} + of od + Previous Page Prethodna stranica + “{file}” is protected by a password. „{file}” je zaštićen lozinkom. + Dim Images to: Zatamni slike na: + Light Blue Svijetloplava + Layers Panel Options Opcije panela slojeva + Row Size: Veličina reda: + Show Layers Only Prikaži samo slojeve + Locate Selected Objects Pronađi odabrane objekte + Thumbnails: Sličice: + Anchor Points Sidrene tačke + "In" Control Points Kontrolne tačke „ulaz” + "Out" Control Points Kontrolne tačke „izlaz” + Brush Affects: Četkica utiče na: + Complexity: Složenost: + Detail: Detalji: + Global Brush Dimensions Globalne dimenzije četkice + Horizontal: Vodoravno: + In Tangent Handles Ulazne tangentne ručke + Out Tangent Handles Izlazne tangentne ručke + Show Brush Size Prikaži veličinu četkice + Simplify: Pojednostavi: + Twirl Rate: Brzina kovitlaca: + Use Pressure Pen Koristi olovku na pritisak + Vertical: Okomito: + {shortcut} with the tool sizes the brush {shortcut} s alatom određuje veličinu četkice + {tool} Options Opcije za {tool} + {tool} Tool Options Opcije alata {tool} + These fonts aren't available. Their text shows in another font. Ovi fontovi nisu dostupni. Njihov tekst se prikazuje drugim fontom. + Search Fonts Folder Pretraži folder fontova + Add Fonts Dodaj fontove + Find Fonts Pronađi fontove + Stop Zaustavi + Searching… Pretraga… + Not found Nije pronađeno + {folders} folder(s) and {files} file(s) searched Pretraženo foldera: {folders}, datoteka: {files} + {count} folder(s) skipped, such as other apps' and the system's folders and hidden ones Preskočeno foldera: {count}, npr. foldera drugih aplikacija, sistemskih i skrivenih + {count} folder(s) or file(s) couldn't be read Foldera ili datoteka koje nije moguće pročitati: {count} + The search stopped at its limit: search a smaller folder. Pretraga se zaustavila na svom ograničenju: pretražite manji folder. + Copy only fonts you own or are licensed to install. Kopirajte samo fontove koje posjedujete ili imate licencu za instaliranje. + VectorCraft copies the fonts to {folder}. VectorCraft kopira fontove u {folder}. + Apply to All ({count} more missing) Primijeni na sve (još {count} nedostaje) + Ignore Zanemari + Linked File Not Found Povezana datoteka nije pronađena + Replace it with another file, or ignore it: its images keep showing the preview saved with the document. Zamijenite je drugom datotekom ili je zanemarite: njene slike i dalje prikazuju pregled sačuvan s dokumentom. + Replace… Zamijeni… + Update Modified Links Ažuriraj izmijenjene veze + {count} linked image(s) changed since this document was saved. Show the new versions? Povezanih slika promijenjenih otkako je dokument sačuvan: {count}. Prikazati nove verzije? + Dialog Dijalog + Convert Process to Global Pretvori procesne u globalne + Create From: Kreiraj iz: + Include Swatches for Tints Uključi uzorke boja za nijanse + Selected Artwork Odabrani crtež + Selected Swatches Odabrani uzorci boja + Advanced Options Napredne opcije + Background Contents Sadržaj pozadine + Background Contents: Sadržaj pozadine: + BLANK DOCUMENT PRESETS PREDLOŠCI PRAZNIH DOKUMENATA + Bleed Napust + Change to Right-to-Left Layout Prebaci na raspored s desna nalijevo + Columns: Kolone: + Create Document Kreiraj dokument + Documents you create appear here. Dokumenti koje kreirate pojavljuju se ovdje. + More Settings Više postavki + New from Template Novo iz predloška + Number of Artboards: Broj radnih ploča: + Orientation: Orijentacija: + PRESET DETAILS DETALJI PREDLOŠKA + Preset Name Naziv predloška + Preset {} Predložak {} + Presets you save with the Save Preset button appear here. Predlošci koje sačuvate dugmetom Sačuvaj predložak pojavljuju se ovdje. + Preview Mode Način pregleda + RECENT NEDAVNO + RECENT (1) NEDAVNO (1) + SAVED SAČUVANO + Templates… Predlošci… + Transparent (Default) Prozirno (zadano) + Save for Office Documents Sačuvaj za Office dokumente + Transparent Background Prozirna pozadina + Choose… Odaberi… + Copy Fonts Used in the Document Kopiraj fontove korištene u dokumentu + Copy Links Kopiraj veze + Create Report Kreiraj izvještaj + Fonts whose licence doesn't allow embedding are not copied. Fontovi čija licenca ne dozvoljava ugrađivanje ne kopiraju se. + Package collects a saved document with its linked files and fonts. Paket prikuplja sačuvani dokument s njegovim povezanim datotekama i fontovima. + Package created Paket je kreiran + Packaged {n} file(s) in {folder} {note} Upakovano datoteka u {folder}: {n} {note} + Packaged {n} file(s){note} Upakovano datoteka: {n}{note} + Relink Linked Files to the Document Ponovo poveži povezane datoteke s dokumentom + Save the document first? Prvo sačuvati dokument? + {count} file(s) in {folder} {note}. Show the package folder? Datoteka u {folder}: {count} {note}. Prikazati folder paketa? + {count} linked file(s) not found Povezanih datoteka nije pronađeno: {count} + fonts not copied: {fonts} fontovi nisu kopirani: {fonts} + Built-in presets are read-only: New… starts an editable copy. Ugrađeni predlošci su samo za čitanje: Novo… započinje kopiju koja se može uređivati. + 1 {unit} on the artboard stands for {real} {unit} in the scene. 1 {unit} na radnoj ploči predstavlja {real} {unit} u sceni. + Grid Color & Opacity Boja i neprozirnost mreže + Gridline every: Linija mreže svakih: + Horizon Height: Visina horizonta: + Horizontal Grid: Vodoravna mreža: + Left Grid: Lijeva mreža: + Perspective Grid Settings Postavke mreže perspektive + Real World: Stvarni svijet: + Right Grid: Desna mreža: + Save Grid as Preset Sačuvaj mrežu kao predložak + Save these settings as a preset Sačuvaj ove postavke kao predložak + Third Vanishing Point: Treća tačka nestajanja: + Viewing Angle: Ugao gledanja: + Viewing Distance: Udaljenost gledanja: + Show Active Plane Widget Prikaži widget aktivne ravni + Widget Position: Položaj widgeta: + Copy All Objects Kopiraj sve objekte + Do Not Move Ne pomjeraj + Horizontal Plane Vodoravna ravan + Left Plane Lijeva ravan + Move All Objects Pomjeri sve objekte + Right Plane Desna ravan + Built-in presets don't change: New… starts an editable copy. Ugrađeni predlošci se ne mijenjaju: Novo… započinje kopiju koja se može uređivati. + One Point Jedna tačka + Perspective grid presets Predlošci mreže perspektive + Three Point Tri tačke + Two Point Dvije tačke + User Preset Korisnički predložak + Click to place each file at 100%, or drag to size it; arrow keys switch files, Esc skips one. Kliknite da postavite svaku datoteku na 100% ili prevucite da odredite veličinu; tipke sa strelicama mijenjaju datoteke, Esc preskače jednu. + Keep a link to an image file instead of only embedding it Zadrži vezu na slikovnu datoteku umjesto samo ugrađivanja + Place onto a new locked, dimmed template layer below the current layer Postavi na novi zaključani, zatamnjeni sloj predloška ispod trenutnog sloja + Swap the selected object for the file, keeping its place and transform Zamijeni odabrani objekat datotekom, zadržavajući njegovo mjesto i transformaciju + On: one locked object showing the document, updated when it changes. Uključeno: jedan zaključani objekat koji prikazuje dokument, ažuriran kad se on promijeni. + Off: an editable copy of its art, embedded in this document. Isključeno: kopija njegovog crteža koja se može uređivati, ugrađena u ovaj dokument. + Images: link to the file instead of only embedding it. Slike: poveži s datotekom umjesto samo ugrađivanja. + VectorCraft documents: one locked object, updated when the file changes. VectorCraft dokumenti: jedan zaključani objekat, ažuriran kad se datoteka promijeni. + Alignment: Poravnanje: + Applies when the linked file is relinked or updated. Primjenjuje se kad se povezana datoteka ponovo poveže ili ažurira. + Bounds (Fill Proportionally) Granice (proporcionalna ispuna) + Bounds (Fit Proportionally) Granice (proporcionalno uklapanje) + File Dimensions Dimenzije datoteke + Transforms Transformacije + Background Color: Boja pozadine: + Show Center Mark Prikaži oznaku centra + Show Cross Hairs Prikaži končanicu + Show Video Safe Areas Prikaži sigurne oblasti za video + Video Ruler Pixel Aspect Ratio: Omjer stranica piksela video ravnala: + Hide Video Rulers Sakrij video ravnala + Client-side (.html) Na strani klijenta (.html) + Color Reduction: Smanjenje boja: + Lossless (lossy WebP isn't available yet) Bez gubitaka (WebP s gubicima još nije dostupan) + Scans: Skenovi: + Server-side (.map) Na strani servera (.map) + {format} Options Opcije za {format} + 0.2 (quality) to 100 (speed) 0,2 (kvalitet) do 100 (brzina) + All the art Sav crtež + Artboard {number} Radna ploča {number} + Auto-Rotate (turn the paper to each artboard) Automatska rotacija (okreni papir prema svakoj radnoj ploči) + Automatic flatness Automatska ravnost + Can't print these settings: see the Summary Nije moguće štampati s ovim postavkama: pogledajte Sažetak + CMYK colours print with their own values; off, they go through the colour settings too. CMYK boje se štampaju vlastitim vrijednostima; kad je isključeno, prolaze i kroz postavke boja. + Collate Složi po kopijama + Composite colours are converted to it; separations separate with it when it is a CMYK profile. Kompozitne boje se pretvaraju u njega; separacije se razdvajaju njime kad je CMYK profil. + Convert All Spot Colors to Process Pretvori sve spot boje u procesne + Default Printer Zadani štampač + Document Ink Options Opcije tinti dokumenta + Download: Preuzimanje: + Drag the art to move it on the paper Prevucite crtež da ga pomjerite na papiru + Each page prints as one image, at the document's raster effects resolution. Svaka stranica se štampa kao jedna slika, u rezoluciji rasterskih efekata dokumenta. + Edit Print Preset Uredi predložak štampanja + Emulsion: Emulzija: + Every option is at its default. Sve opcije su na zadanim vrijednostima. + Flatness: Ravnost: + Frequencies and angles are the output device's to apply. Frekvencije i uglove primjenjuje izlazni uređaj. + General › Placement › X Općenito › Postavljanje › X + How colours outside the press's gamut are separated. Kako se razdvajaju boje izvan gamuta štamparije. + Ignore Artboards (all the art as one page) Zanemari radne ploče (sav crtež kao jedna stranica) + Image: Slika: + Marks and Bleed Oznake i napust + Media Medij + New Print Preset Novi predložak štampanja + Next page Sljedeća stranica + No printer settings to open here Ovdje nema postavki štampača za otvaranje + None (keep transparency) Ništa (zadrži prozirnost) + Nothing to print Nema ničeg za štampanje + Open a document to preview its pages Otvorite dokument da pregledate njegove stranice + Output › Mode Izlaz › Način + Overprint and Transparency Flattener Options Opcije pretiska i spljoštavanja prozirnosti + Place the pages with the placement again Ponovo postavi stranice s postavljanjem + Placement: Postavljanje: + Preserve CMYK Numbers Očuvaj CMYK brojeve + Previous page Prethodna stranica + Print Layers: Štampaj slojeve: + Print Preset: Predložak štampanja: + Printer Štampač + Printer profile: Profil štampača: + Printer: Štampač: + Rendering intent: Namjera iscrtavanja: + Same As Source Isto kao izvor + Save these settings as a print preset Sačuvaj ove postavke kao predložak štampanja + Scaling: Skaliranje: + Separations list the document's inks here: one page per ink that prints. Separacije ovdje navode tinte dokumenta: jedna stranica po tinti koja se štampa. + Setup… Podešavanje… + Skip Blank Artboards Preskoči prazne radne ploče + The edge of the paper the printer can't reach: the art goes inside it, and the preview shows it dashed. Ivica papira koju štampač ne može dosegnuti: crtež ide unutar nje, a pregled je prikazuje isprekidano. + The page as it prints Stranica kako se štampa + The Print Tiling tool placed the pages. Alat za popločavanje štampe postavio je stranice. + The system's settings of this printer Sistemske postavke ovog štampača + Tile Full Pages Popločaj pune stranice + Tile Range: Raspon pločica: + tile {number} pločica {number} + Tiles are numbered across, then down; leave the range empty for every tile. Pločice se numerišu poprijeko, zatim nadolje; ostavite raspon prazan za sve pločice. + Transverse (the page a quarter turn on the paper) Poprečno (stranica okrenuta za četvrtinu na papiru) + Unprintable margin: Margina koja se ne štampa: + {pages} in all, {count} per copy Ukupno {pages}, {count} po kopiji + {page} of {count} {page} od {count} + PDF File PDF datoteka + [Default] is protected: New… starts an editable copy. [Zadano] je zaštićeno: Novo… započinje kopiju koja se može uređivati. + A new preset starting from the selected one Novi predložak koji počinje od odabranog + Differences from {preset}: Razlike od {preset}: + Differences from [Default]: Razlike od [Zadano]: + Differences from VectorCraft Default: Razlike od VectorCraft zadano: + Edit… Uredi… + None. Ništa. + Presets: Unaprijed postavljene vrijednosti: + Save the selected preset to a file Sačuvaj odabrani predložak u datoteku + Embed ICC Profile Ugradi ICC profil + Flat Image Ravna slika + Include Hidden Layers Uključi skrivene slojeve + Maximum Editability Maksimalna mogućnost uređivanja + Options: Opcije: + Write Layers Zapiši slojeve + Anti-alias Zaglađivanje ivica + Around Object Oko objekta + Background: Pozadina: + Changing these settings changes how raster effects look when exported, flattened or expanded. Promjena ovih postavki mijenja izgled rasterskih efekata pri izvozu, spljoštavanju ili proširivanju. + Color Model: Model boja: + Create Clipping Mask Kreiraj masku isijecanja + Preserve Spot Colors Očuvaj spot boje + Resolution: Rezolucija: + Transparent Prozirno + Layout Order: Redoslijed rasporeda: + Change to Left-to-Right Layout Prebaci na raspored s lijeva nadesno + Artboards: {n} Radne ploče: {n} + Rows: Redovi: + Assign Dodijeli + Color Group: Grupa boja: + Color Library Biblioteka boja + Colors: Boje: + Current Colors ({total}) Trenutne boje ({total}) + Current Colors Trenutne boje + Current Colors (0) Trenutne boje (0) + Harmony Rules: Pravila harmonije: + Harmony Rules Pravila harmonije + Keep this row's colors (exclude) Zadrži boje ovog reda (isključi) + Limit to Library: Ograniči na biblioteku: + Link harmony colors Poveži boje harmonije + Merge colors into one row Spoji boje u jedan red + No colors to recolor (preserved colors are left out). Nema boja za ponovno bojenje (sačuvane boje su izostavljene). + Preserve: Očuvaj: + Randomly change color order Nasumično promijeni redoslijed boja + Randomly change saturation and brightness Nasumično promijeni zasićenje i svjetlinu + Recolor this row Ponovo oboji ovaj red + Reset the rows to the artwork's colors Vrati redove na boje crteža + Separate colors into rows Razdvoji boje u redove + Unlink harmony colors Prekini vezu boja harmonije + 1 Color Job Posao s 1 bojom + 2 Color Job Posao s 2 boje + 3 Color Job Posao s 3 boje + Recover Documents Oporavi dokumente + Restored documents open unsaved: save them to keep them. Vraćeni dokumenti otvaraju se nesačuvani: sačuvajte ih da ih zadržite. + VectorCraft didn't quit normally last time. These documents had unsaved changes: VectorCraft se prošli put nije normalno zatvorio. Ovi dokumenti su imali nesačuvane promjene: + Do you want to save the changes you made to “{name}”? Želite li sačuvati promjene koje ste napravili u „{name}”? + Don't Save Nemoj sačuvati + Your changes will be lost if you don't save them. Vaše promjene će biti izgubljene ako ih ne sačuvate. + < 1 sec < 1 sek. + [Unnamed] [Bez naziva] + Amount: Količina: + Anti-aliasing: Zaglađivanje ivica: + Artboard: Radna ploča: + Color Table Tabela boja + Color Table (4 colors) Tabela boja (4 boje) + Color Table ({n} color) Tabela boja ({n} boja) + Color Table ({n} colors) Tabela boja ({n} boja) + Convert to sRGB Pretvori u sRGB + Delete this saved preset Izbriši ovaj sačuvani predložak + Dither: Dithering: + Downloaded {} file(s) Preuzeto datoteka: {} + Fit in View Uklopi u prikaz + Format: Format: + WebP WebP + High Visoko + ICC Profile ICC profil + Image Size Veličina slike + Interlaced Isprepleteno + Lossy: S gubicima: + Low Nisko + Matte: Podloga: + Maximum Maksimum + Metadata: Metapodaci: + Needs the desktop app Treba desktop aplikaciju + Optimized Optimizirano + Order: Redoslijed: + Original Original + 2-Up 2 odjednom + 4-Up 4 odjednom + Output: Izlaz: + Percent: Postotak: + Preview in Browser needs the desktop app (the web downloads files instead) Pregledaj u pregledniku zahtijeva desktop aplikaciju (web umjesto toga preuzima datoteke) + Progressive Progresivno + Quality {quality} Kvalitet {quality} + Quality: Kvalitet: + Reduction: Smanjenje: + Save the settings as a preset Sačuvaj postavke kao predložak + Saved {n} files beside {path} Sačuvano datoteka pored {path}: {n} + Shown with the optimised preview. Prikazano s optimiziranim pregledom. + Slices: Isječci: + Unlock Otključaj + Unshift Poništi pomak + Very High Vrlo visoko + Web Shift Web pomak + Web Snap: Hvatanje web boja: + {secs} sec {secs} sek. + Create PDF-Compatible File Kreiraj datoteku kompatibilnu s PDF-om + Embed ICC Profiles Ugradi ICC profile + File Name: Naziv datoteke: + Save As Sačuvaj kao + Save as Template Sačuvaj kao predložak + Save each artboard to a separate file Sačuvaj svaku radnu ploču u zasebnu datoteku + All printer's marks Sve štamparske oznake + Bleeds Napusti + Bottom: Dno: + Changes allowed: Dozvoljene promjene: + Color bars Trake boja + Color conversion: Pretvaranje boja: + Color images Slike u boji + Compatibility: Kompatibilnost: + PDF 1.7 PDF 1.7 + VectorCraft Default VectorCraft zadano + High Quality Print Štampa visokog kvaliteta + [High Quality Print] [Štampa visokog kvaliteta] + Press Quality Štamparski kvalitet + [Press Quality] [Štamparski kvalitet] + Smallest File Size Najmanja veličina datoteke + [Smallest File Size] [Najmanja veličina datoteke] + PDF/X-1a:2001 PDF/X-1a:2001 + [PDF/X-1a:2001] [PDF/X-1a:2001] + PDF/X-3:2002 PDF/X-3:2002 + [PDF/X-3:2002] [PDF/X-3:2002] + PDF/X-4:2010 PDF/X-4:2010 + [PDF/X-4:2010] [PDF/X-4:2010] + Keeps the document editable: VectorCraft reopens the PDF with nothing lost. For files you'll edit again. Dokument ostaje uređiv: VectorCraft ponovo otvara PDF bez gubitaka. Za datoteke koje ćete ponovo uređivati. + Compress text and line art Komprimiraj tekst i linijsku grafiku + Compression Kompresija + Compression › Color › Above Ppi Kompresija › Boja › Iznad ppi + Compression: Kompresija: + Condition identifier: Identifikator uslova: + Convert text to outlines Pretvori tekst u obrise + Create PDF layers from layers and sublayers Kreiraj PDF slojeve iz slojeva i podslojeva + Description Opis + Destination: Odredište: + Document open password Lozinka za otvaranje dokumenta + Document profile Profil dokumenta + Edit PDF Preset Uredi PDF predložak + Embed page thumbnails Ugradi sličice stranica + Enable copying of text, images and other content Omogući kopiranje teksta, slika i ostalog sadržaja + Enable plaintext metadata Omogući metapodatke u običnom tekstu + Enable text access for screen readers Omogući pristup tekstu čitačima ekrana + Encryption: {name} (set by Compatibility) Šifrovanje: {name} (postavlja Kompatibilnost) + Error Greška + Every option matches {base}. Sve opcije odgovaraju {base}. + Files of a PDF standard can't be password-protected. Datoteke PDF standarda ne mogu se zaštititi lozinkom. + Files of this standard tag their colours with ICC profiles. Datoteke ovog standarda označavaju svoje boje ICC profilima. + Flattener preset: Predložak spljoštavanja: + General › Thumbnails Općenito › Sličice + Grayscale images Slike u nijansama sive + Include non-printing layers Uključi slojeve koji se ne štampaju + Left: Lijevo: + Mark as trapped Označi kao zarobljeno + Marks and Bleeds Oznake i napusti + Monochrome images Jednobojne slike + Monochrome Jednobojno + New PDF Preset Novi PDF predložak + of characters used od korištenih znakova + Offset: Pomak: + On Uključeno + Open password: Lozinka za otvaranje: + Optimize for fast web view Optimiziraj za brzi web prikaz + Output condition: Izlazni uslov: + Output Intent Izlazna namjena + Output intent profile: Profil izlazne namjene: + Overprint and Transparency Flattener Pretisak i spljoštavanje prozirnosti + Overprint: Pretisak: + Page information Informacije o stranici + PDF 1.3 files have no transparency: the preset flattens it. PDF 1.3 datoteke nemaju prozirnost: predložak je spljoštava. + PDF/A files carry their own output intent. PDF/A datoteke nose vlastitu izlaznu namjenu. + PDF/X-1a files are CMYK: every colour is converted to the destination (blank: the output intent's CMYK profile), untagged. PDF/X-1a datoteke su CMYK: svaka boja se pretvara u odredište (prazno: CMYK profil izlazne namjene), bez oznake. + Permissions Dozvole + Permissions password: Lozinka za dozvole: + Preserve editing capabilities Očuvaj mogućnosti uređivanja + Preset name: Naziv predloška: + Printer mark type: Vrsta štamparske oznake: + Printing allowed: Dozvoljeno štampanje: + Profile inclusion: Uključivanje profila: + Range: Raspon: + Registration marks Registracijske oznake + Registry name: Naziv registra: + Require a password to open the document Zahtijevaj lozinku za otvaranje dokumenta + Restrict printing, editing and other tasks Ograniči štampanje, uređivanje i druge zadatke + Right: Desno: + Save as preset: Sačuvaj kao predložak: + Save PDF Sačuvaj PDF + Security Sigurnost + Standard: Standardno: + Subset fonts below: Podskup fontova ispod: + the preset predložak + Top: Vrh: + Trim mark weight: Debljina oznaka za obrezivanje: + Trim marks Oznake za obrezivanje + Use document bleed settings Koristi postavke napusta dokumenta + View PDF after saving Prikaži PDF nakon čuvanja + Warnings Upozorenja + CMYK profile in effect Važeći CMYK profil + Save Graphic Style Library Sačuvaj biblioteku grafičkih stilova + Selected Styles Only Samo odabrani stilovi + Selected Styles Only (0) Samo odabrani stilovi (0) + A File… Datoteka… + GPL palettes keep solid colours only, as RGB. GPL palete zadržavaju samo pune boje, kao RGB. + Save Swatch Library Sačuvaj biblioteku uzoraka boja + VectorCraft Swatches (.vcswatches) VectorCraft uzorci boja (.vcswatches) + Save To: Sačuvaj u: + Saved to User Defined: {} Sačuvano u korisnički definisano: {} + Selected Swatches Only Samo odabrani uzorci boja + Selected Swatches Only (0) Samo odabrani uzorci boja (0) + User Defined Libraries Korisnički definisane biblioteke + Copy Report Kopiraj izvještaj + VectorCraft read this script without running it. VectorCraft je pročitao ovu skriptu bez izvršavanja. + Needs nothing beyond plain JavaScript Ne treba ništa osim običnog JavaScripta + Needs the script language's own objects or directives Treba vlastite objekte ili direktive jezika skripte + Needs the document model Treba model dokumenta + Needs files Treba datoteke + Needs menu commands Treba naredbe menija + Needs dialogs Treba dijaloge + Needs features only the reference app has Treba mogućnosti koje ima samo referentna aplikacija + Outside the document Izvan dokumenta + Writes, moves or deletes files Zapisuje, premješta ili briše datoteke + Opens files in other apps Otvara datoteke u drugim aplikacijama + Opens network connections Otvara mrežne veze + Loads native code Učitava izvorni kod + Sends messages to other apps Šalje poruke drugim aplikacijama + Reads or sets environment variables Čita ili postavlja varijable okruženja + Runs code the checker can't read Izvršava kod koji provjera ne može pročitati + Changes the reference app's preferences Mijenja postavke referentne aplikacije + Menu commands Naredbe menija + Names the script builds as it runs: {count} Nazivi koje skripta gradi tokom izvršavanja: {count} + Document model Model dokumenta + Object types: {names} Vrste objekata: {names} + Directives Direktive + Includes Uključuje + Checked Označeno + Not followed: outside the script's folder Nije praćeno: izvan foldera skripte + Includes itself Uključuje sam sebe + Not read Nije pročitano + Not read: a limit was reached Nije pročitano: dostignuto je ograničenje + Compiled or not text Kompajliran ili nije tekst + Problems Problemi + String not closed Niz znakova nije zatvoren + Comment not closed Komentar nije zatvoren + Regular expression not closed Regularni izraz nije zatvoren + Template literal not closed Šablonski literal nije zatvoren + XML literal not closed XML literal nije zatvoren + Bracket never closed Zagrada nikad nije zatvorena + Closing bracket with no opening one Zatvarajuća zagrada bez otvarajuće + Syntax newer than ES3 Sintaksa novija od ES3 + Unknown directive Nepoznata direktiva + Not valid UTF-8: unreadable bytes were replaced Nije važeći UTF-8: nečitljivi bajtovi su zamijenjeni + Mixed line endings Mješoviti završeci redova + Nesting too deep to follow Ugnježđivanje je previše duboko za praćenje + line {line} red {line} + lines {lines} redovi {lines} + {file}, line {line} {file}, red {line} + Compiled script: ask its author for the .jsx file Kompajlirana skripta: zatražite .jsx datoteku od njenog autora + Too large to check Preveliko za provjeru + Not a script for the reference app Nije skripta za referentnu aplikaciju + Some lists were cut short at their limit. Neke liste su skraćene na svom ograničenju. + Line Segment Tool Options Opcije alata segment linije + Alt: Alt: + Divide Horizontally Into Podijeli vodoravno na + Divide Vertically Into Podijeli okomito na + Matte Mat + Message: Poruka: + N slices …, evenly spaced N isječaka …, ravnomjerno raspoređenih + per slice po isječku + Slice Type: Vrsta isječka: + slices across, evenly spaced isječaka poprijeko, ravnomjerno raspoređenih + slices down, evenly spaced isječaka nadolje, ravnomjerno raspoređenih + Target: Cilj: + Text Displayed in Cell: Tekst prikazan u ćeliji: + The cell shows the type object's text as HTML. Ćelija prikazuje tekst tekstualnog objekta kao HTML. + Lab Spot Colors: Lab spot boje: + Lab Spot Colors Lab spot boje + Lab Values Lab vrijednosti + Show and print from the Lab definition; PDF files carry it as the ink's alternate color. Prikaži i štampaj iz Lab definicije; PDF datoteke je nose kao alternativnu boju tinte. + Show and separate through the working CMYK space, as in older documents. Prikaži i razdvajaj kroz radni CMYK prostor, kao u starijim dokumentima. + CMYK Equivalents CMYK ekvivalenti + Convert To Outlines Pretvori u obrise + Decimal: Decimalni znak: + Embed Fonts (Glyphs Used) Ugradi fontove (korišteni glifovi) + Fewer Elements Manje elemenata + Font: Font: + Hide Code Sakrij kod + Images: Slike: + Include Metadata Uključi metapodatke + Internal CSS Interni CSS + Layer Names Nazivi slojeva + Minify Minificiraj + Minimal Minimalno + Object IDs: ID-ovi objekata: + Presentation Attributes Atributi prezentacije + Preserve Editing Capabilities Očuvaj mogućnosti uređivanja + Responsive Responzivno + Show Code Prikaži kod + Style Attributes Atributi stila + Style Attributes (Entity References) Atributi stila (reference entiteta) + Styling: Stilizovanje: + SVG Profile: SVG profil: + SVG 1.1 SVG 1.1 + Unicode (UTF-16) Unicode (UTF-16) + Unicode (UTF-8) Unicode (UTF-8) + Unique Jedinstveno + Conflict {n} of {count} Konflikt {n} od {count} + Keep the pasted color as a new swatch with a numbered name. Zadrži zalijepljenu boju kao novi uzorak boje s numerisanim nazivom. + Pasted Zalijepljeno + This document already has a swatch named “{name}” with another color. Ovaj dokument već ima uzorak boje „{name}” s drugom bojom. + Use the document's swatch: pasted colors take its color. Koristi uzorak boje dokumenta: zalijepljene boje preuzimaju njegovu boju. + Color Type: Vrsta boje: + Swatch Name: Naziv uzorka boje: + Diameter: Prečnik: + Symbolism Tools Options Opcije alata simbolizam + Symbol Set Density: Gustoća skupa simbola: + Intensity: Intenzitet: + Place PDF Postavi PDF + Collect Links in a Separate Folder Prikupi veze u zaseban folder + Folder Name: Naziv foldera: + Color Management Upravljanje bojama + Summary Sažetak + Download Preuzmi + Export Artboard Izvezi radnu ploču + A File per Object Datoteka po objektu + Example: {name} Primjer: {name} + Export Preset: Predložak izvoza: + Folders: Folderi: + Insert Umetni + Nothing is selected. Select the art to export, then open this tab again. Ništa nije odabrano. Odaberite crtež za izvoz, zatim ponovo otvorite ovu karticu. + One File of the Selection Jedna datoteka odabira + Start at: Počni od: + {n} objects selected Odabrano objekata: {n} + Delete Export Preset Izbriši predložak izvoza + Export Presets Izvezi predloške + Save Export Preset Sačuvaj predložak izvoza + Export Layer Izvezi sloj + Export Selection Izvezi odabir + All in One Folder Sve u jednom folderu + By Size or Row Po veličini ili redu + By Format Po formatu + By Artboard or Item Po radnoj ploči ili stavci + By Item, Then Format Po stavci, zatim formatu + Document Name Naziv dokumenta + Artboard or Item Name Naziv radne ploče ili stavke + Number (####) Broj (####) + Date (YYYYMMDD) Datum (GGGGMMDD) + Date (YYYY-MM-DD) Datum (GGGG-MM-DD) + Time (hhmmss) Vrijeme (hhmmss) + PDF Print PDF štampa + Encoding: Kodiranje: + UTF-16 (Unicode) UTF-16 (Unicode) + Line Endings: Završeci redova: + LF (macOS, Linux) LF (macOS, Linux) + CRLF (Windows) CRLF (Windows) + Text Export Options Opcije izvoza teksta + Character Set: Skup znakova: + Join the lines of each paragraph Spoji redove svakog pasusa + Line Breaks Prelomi reda + Mac Mac + or more spaces with a tab ili više razmaka tabulatorom + Platform: Platforma: + Remove blank lines between paragraphs Ukloni prazne redove između pasusa + Spaces Razmaci + Text Import Options Opcije uvoza teksta + Unicode Unicode + Byte Order: Redoslijed bajtova: + Compress (RLE) Komprimiraj (RLE) + Depth: Dubina: + File Format: Format datoteke: + Flip Row Order Obrni redoslijed redova + LZW Compression LZW kompresija + Copy (make a transformed copy) Kopija (napravi transformisanu kopiju) + Reference Point Referentna tačka + Reflect X Odrazi X + Reflect Y Odrazi Y + Kind Vrsta + Variable Varijabla + no data set to edit nema skupa podataka za uređivanje + New Name Novi naziv + no variable to rename nema varijable za preimenovanje + no data set to rename nema skupa podataka za preimenovanje + Variable Options Opcije varijable + Define a variable first Prvo definišite varijablu + Adjust Adjoining Width Points Podesi susjedne tačke širine + Keep both sides the same width Zadrži obje strane iste širine + Side 1: Strana 1: + Side 2: Strana 2: + Total Width: Ukupna širina: + Width Point Edit Uređivanje tačke širine + Art Crtež + Bristle Čekinje + Calligraphic Kaligrafsko + Dots Tačke + Fixed Fiksno + Pressure Pritisak + Random Nasumično + Scatter Raspršeno + Color Burn Tamnjenje boje + Color Dodge Posvjetljivanje boje + Darken Potamni + Exclusion Isključivanje + Hard Light Jako svjetlo + Hard Mix Tvrdo miješanje + Lighten Posvijetli + Luminosity Osvijetljenost + Overlay Prekrivanje + Soft Light Meko svjetlo + Soft Mix Meko miješanje + Crosshatch Unakrsno šrafiranje + Fine Dots Sitne tačke + Simple Jednostavno + Light Rough Svijetlo grubo + Dark Rough Tamno grubo + Wide Sharp Široko oštro + Wide Blurry Široko mutno + Sparkle Iskrenje + Medium Dots Srednje tačke + Grainy Dots Zrnate tačke + Coarse Dots Krupne tačke + Short Lines Kratke linije + Medium Lines Srednje linije + Long Lines Duge linije + Short Strokes Kratki potezi + Medium Strokes Srednji potezi + Long Strokes Dugi potezi + Soft Meko + Screen Ekran +axis Horizontal Vodoravno +axis Vertical Okomito + Sprinkles Mrvice + Clumped Nakupljeno + Contrasty Kontrastno + Enlarged Uvećano + Stippled Tačkasto sjenčenje + Speckle Pjegavost + Brick Cigla + Burlap Juta + Canvas Platno + Sandstone Pješčar + Bottom Left Dolje lijevo + Top Left Gore lijevo + Top Right Gore desno + Bottom Right Dolje desno +effect Soft Meko + Blocks Blokovi + Frosted Mat staklo + Tiny Lens Sićušni objektiv + Loaded Texture Učitana tekstura + Load Texture… Učitaj teksturu… + Texture Image Slika teksture + Right Diagonal Desna dijagonala + Left Diagonal Lijeva dijagonala +effect Horizontal Vodoravno +effect Vertical Okomito + Diamond Romb + Ellipse Elipsa + Add Effect Dodaj efekat + Add New Fill Dodaj novu ispunu + Add New Stroke Dodaj novi potez + Appearance Item Stavka izgleda + Clear Appearance Očisti izgled + Duplicate Item Dupliciraj stavku + Eyedropper Kapaljka + Sample Color from Screen Uzmi uzorak boje s ekrana + This system has no screen color sampler Ovaj sistem nema uzorkivač boja s ekrana + The active document changed while the screen color sampler was open Aktivni dokument se promijenio dok je bio otvoren uzorkivač boja s ekrana + Move Appearance Premjesti izgled + Reduce to Basic Appearance Svedi na osnovni izgled + Remove Item Ukloni stavku + Reorder Appearance Item Promijeni redoslijed stavke izgleda + Select Appearance Item Odaberi stavku izgleda + Show All Hidden Attributes Prikaži sve skrivene atribute + Target Contents Ciljaj sadržaj +theme Appearance Izgled + Asset Export Settings Postavke izvoza resursa + Assets Resursi + Export Assets Izvezi resurse + Remove Asset Ukloni resurs + Rename Asset Preimenuj resurs + Fill Rule Pravilo ispune + Apply Brush Primijeni četkicu + Break Link to Symbol Prekini vezu sa simbolom + Brush Definition Definicija četkice + Brush Options… Opcije četkice… + Current Brush Trenutna četkica + Current Symbol Trenutni simbol + Delete Brush Izbriši četkicu + Delete Symbol Izbriši simbol + Duplicate Brush Dupliciraj četkicu + Duplicate Symbol Dupliciraj simbol + Edit Symbol Uredi simbol + Expand Brush Strokes Proširi poteze četkicom + New Brush… Nova četkica… + New Brush Nova četkica + Calligraphic Brush Kaligrafska četkica + Scatter Brush Raspršena četkica + Art Brush Umjetnička četkica + Bristle Brush Četkica s čekinjama + Pattern Brush Četkica uzorka + Select art to make a scatter, art or pattern brush. Odaberite crtež da napravite raspršenu, umjetničku četkicu ili četkicu uzorka. + Brush Art Crtež četkice + New Symbol Novi simbol + New Symbol… Novi simbol… + Place Symbol Instance Postavi instancu simbola + Redefine Symbol Ponovo definiši simbol + Remove Brush Stroke Ukloni potez četkicom + Replace Symbol Zamijeni simbol + Select All Instances Odaberi sve instance + Symbol Sprayer Raspršivač simbola + Symbolism Tool Alat simbolizam + Image Trace Presets Predlošci praćenja slike + Live Paint Bucket Kanta za živo bojenje + Live Paint Bucket (Stroke) Kanta za živo bojenje (potez) + Live Paint Info Informacije o živom bojenju + Shape Builder Graditelj oblika + Shape Builder Regions Regije graditelja oblika + Image Trace View Prikaz praćenja slike + Edge Ivica + Clipboard as PDF Međuspremnik kao PDF + Clipboard as PNG Međuspremnik kao PNG + Clipboard as Text Međuspremnik kao tekst + Clipboard Formats Formati međuspremnika + Load Image into Clipboard Učitaj sliku u međuspremnik + Load Metafile into Clipboard Učitaj metafile u međuspremnik + Load PDF into Clipboard Učitaj PDF u međuspremnik + Load Text into Clipboard Učitaj tekst u međuspremnik + Clipboard as SVG Međuspremnik kao SVG + Load SVG into Clipboard Učitaj SVG u međuspremnik + Swatch Conflicts Konflikti uzoraka boja + Saturate Zasiti + Convert Color Pretvori boju + Convert Document Color Mode Pretvori način boja dokumenta + Gamut Warning Upozorenje o gamutu + Load Color Profile… Učitaj profil boja… + Remove Color Profile… Ukloni profil boja… + Plates Ploče + Spot Color Spot boja + Add to Swatches Dodaj u uzorke boja + Delete Theme Izbriši temu + Save Theme Sačuvaj temu + dash crtica + Missing Nedostaje + [Normal Paragraph Style] [Normalni stil pasusa] + Arc Luk + Auto Size New Area Type Automatska veličina novog teksta u području + Create Path Kreiraj putanju + Create Text Kreiraj tekst + Drawing Mode Način crtanja + Line Linija + Line Segment Segment linije + Polar Grid Polarna mreža + Polygon Mnogougao + Rectangular Grid Pravougaona mreža + Horizontal Dividers: Vodoravni razdjelnici: + Vertical Dividers: Okomiti razdjelnici: + Rounded Rectangle Zaobljeni pravougaonik + Spiral Spirala + Export CSS Izvezi CSS + Generate CSS Generiši CSS + Line Cut Rez linijom + Mirror & Cut Zrcali i reži + Rectangle Cut Rez pravougaonikom + Active Perspective Plane Aktivna ravan perspektive + Delete Width Point Izbriši tačku širine + Draw in Perspective Crtaj u perspektivi + Move in Perspective Pomjeri u perspektivi + Move Plane Pomjeri ravan + Nudge in Perspective Pomak u perspektivi + Puppet Warp Iskrivljenje lutkom + Puppet Warp Pins Pribadače iskrivljenja lutkom + Show Perspective Grid Prikaži mrežu perspektive + Width Point Tačka širine + Width Profile Profil širine + Objects Objekti + Paths Putanje + Path Length Dužina putanje + Add Guide Dodaj vodilicu + Edit Selection Uredi odabir + Recall Selection Vrati odabir + Remove Guide Ukloni vodilicu + Saved Selections Sačuvani odabiri + Select Guides Odaberi vodilice + Move Guide to Layer Premjesti vodilicu u sloj + Blob Brush Četkica mrlja + Convert Anchor Point Pretvori sidrenu tačku + Curvature Zakrivljenost + Delete Anchor Point Izbriši sidrenu tačku + Eraser Gumica + Knife Nož + Path Eraser Gumica za putanje + Pencil Olovka + Reshape Segment Preoblikuj segment + Split Path Razdvoji putanju + Activate Document Aktiviraj dokument + Delete Izbriši + Document JSON JSON dokumenta + Duplicate Dupliciraj + Find Objects Pronađi objekte + Inspect Document Pregledaj dokument + Inspect Object Pregledaj objekat + Begin Undo Group Započni grupu poništavanja + End Undo Group Završi grupu poništavanja + Apply Effect Primijeni efekat + Duplicate Effect Dupliciraj efekat + Effect Options Opcije efekta + Effects Efekti + Move Effect Premjesti efekat + Remove Effect Ukloni efekat + Expand Options Opcije proširivanja + File Info Informacije o datoteci + Batch Paketna obrada + DXF Info Informacije o DXF-u + Export Document Izvezi dokument + Export DXF Izvezi DXF + Export EPS Izvezi EPS + Export for Screens Izvoz za ekrane + Export for Screens Settings Postavke izvoza za ekrane + Export PDF Izvezi PDF + File Formats Formati datoteka + Flattener presets Predlošci spljoštavanja + Format Options Opcije formata + Layer Sloj + Link Veza + Model Model + Open Document Otvori dokument + Password Lozinka + PDF Info Informacije o PDF-u + PDF Settings PDF postavke + Print presets Predlošci štampanja + Save Document Sačuvaj dokument + Serialize Document Serijaliziraj dokument + Shapes Oblici + Outlines Obrisi + Artboard Radna ploča + Windows Prozori + Delete Transparency Flattener Preset Izbriši predložak spljoštavanja prozirnosti + Export Transparency Flattener Presets Izvezi predloške spljoštavanja prozirnosti + Import Transparency Flattener Presets Uvezi predloške spljoštavanja prozirnosti + Save Transparency Flattener Preset Sačuvaj predložak spljoštavanja prozirnosti + Transparency Flattener Presets Predlošci spljoštavanja prozirnosti + to do + Missing Fonts Nedostajući fontovi + Find Font Files Pronađi datoteke fontova + Add Font Files Dodaj datoteke fontova + Font List Lista fontova + Fonts in Document Fontovi u dokumentu + Refresh Font List Osvježi listu fontova + Replace Font Zamijeni font + Select Text by Font Odaberi tekst po fontu + Add Freeform Line Dodaj liniju slobodnog oblika + Add Freeform Point Dodaj tačku slobodnog oblika + Delete Freeform Point Izbriši tačku slobodnog oblika + Edit Freeform Point Uredi tačku slobodnog oblika + Freeform Gradient Gradijent slobodnog oblika + Select Freeform Point Odaberi tačku slobodnog oblika + Split Freeform Line Razdvoji liniju slobodnog oblika + Gradient Vector Vektor gradijenta + Select Gradient Stop Odaberi tačku gradijenta + Create Graph Kreiraj grafikon + Graph Data Podaci grafikona + Graph Type Vrsta grafikona + Vector Halftone Vektorski polutonovi + spot spot + Text Tekst + Artboard Options Opcije radne ploče + Artboard Options… Opcije radne ploče… + Collect in New Layer Prikupi u novi sloj + Delete Artboard Izbriši radnu ploču + Delete Selection Izbriši odabir + Duplicate Selection Dupliciraj odabir + Highlight Rows Istakni redove + Layer Options Opcije sloja + Layer Options… Opcije sloja… + Make/Release Clipping Mask Napravi/oslobodi masku isijecanja + Move Rows Premjesti redove + New Artboard Nova radna ploča + New Layer… Novi sloj… + New Sublayer… Novi podsloj… + Paste Remembers Layers Lijepljenje pamti slojeve + Reorder Promijeni redoslijed + Select Art Odaberi crtež + Set Current Layer Postavi trenutni sloj + Flatten Artwork Spljošti crtež + Locate Object Pronađi objekat + Lock Others Zaključaj ostale + Merge Selected Spoji odabrano + Outline Others Ostali u obrisu + Preview All Layers Pregledaj sve slojeve + Release to Layers (Build) Oslobodi u slojeve (gradnja) + Release to Layers (Sequence) Oslobodi u slojeve (niz) + Reverse Order Obrni redoslijed + Show All Layers Prikaži sve slojeve + Unlock All Layers Otključaj sve slojeve + English: USA Engleski: SAD + Move Pomakni + Character Style Stil znakova + Paragraph Style Stil pasusa + Style Stil + Create New Library Kreiraj novu biblioteku + Add to Library Dodaj u biblioteku + Delete Library Izbriši biblioteku + Delete Library Item Izbriši stavku biblioteke + Import Library Uvezi biblioteku + Export Library Izvezi biblioteku + New Library Group Nova grupa biblioteke + Rename Library Group Preimenuj grupu biblioteke + Delete Library Group Izbriši grupu biblioteke + Move Library Item to Group Premjesti stavku biblioteke u grupu + Rename Library Preimenuj biblioteku + Show Library Prikaži biblioteku + Use Library Item Koristi stavku biblioteke + Graphic Grafika + Check Links Provjeri veze + Embed Image Ugradi sliku + Go To Link Idi na vezu + Link Info Informacije o vezi + Placement Options Opcije postavljanja + Relink Ponovo poveži + Unembed Poništi ugrađivanje + Add Mesh Line Dodaj liniju mreže + Add Spine Point Dodaj tačku kičme + Blend Info Informacije o stapanju + Blend Options Opcije stapanja + Delete Mesh Point Izbriši tačku mreže + Delete Spine Point Izbriši tačku kičme + Envelope Info Informacije o omotnici + Envelope Options Opcije omotnice + Expand Gradient Mesh Proširi gradijentnu mrežu + Make Envelope Napravi omotnicu + Move Envelope Mesh Point Pomjeri tačku mreže omotnice + Move Mesh Point Pomjeri tačku mreže + Move Mesh Points Pomjeri tačke mreže + Move Spine Point Pomjeri tačku kičme + Reshape Spine Segment Preoblikuj segment kičme + Reset with Mesh Vrati mrežom + Reset with Warp Vrati iskrivljenjem + Set Mesh Point Color Postavi boju tačke mreže + Edit Opacity Mask Uredi masku neprozirnosti + Opacity Mask Maska neprozirnosti + Stop Editing Opacity Mask Zaustavi uređivanje maske neprozirnosti + View Opacity Mask Prikaži masku neprozirnosti + New Opacity Masks Are Clipping Nove maske neprozirnosti isijecaju + New Opacity Masks Are Inverted Nove maske neprozirnosti su obrnute + Rasterize Rasteriziraj + Transform Each Transformiši svaki + New Art Appearance Izgled novog crteža + New Art Has Basic Appearance Novi crtež ima osnovni izgled + Delete Preset Izbriši predložak + High (300 ppi) Visoko (300 ppi) + Medium (150 ppi) Srednje (150 ppi) + New Document Presets Predlošci novih dokumenata + Phone 390×844 Telefon 390×844 + Postcard Razglednica + Grid by Row Mreža po redu + Grid by Column Mreža po koloni + Arrange by Row Rasporedi po redu + Arrange by Column Rasporedi po koloni + Save Preset Sačuvaj predložak + Screen (72 ppi) Ekran (72 ppi) + Social Square Post 1080×1080 Kvadratna objava za društvene mreže 1080×1080 + Distribute Rasporedi ravnomjerno + Distribute Spacing Rasporedi razmak + Enter Isolation Mode Uđi u način izolacije + Live Shape Properties Svojstva živog oblika + Nudge Pomak + Object Properties Svojstva objekta + Reflect Odrazi + Rotate Rotiraj + Set Bounds Postavi granice + Shear Smicanje + Disable Opacity Mask Onemogući masku neprozirnosti + Enable Opacity Mask Omogući masku neprozirnosti + Link Opacity Mask Poveži masku neprozirnosti + Make Opacity Mask Napravi masku neprozirnosti + Opacity Mask Info Informacije o maski neprozirnosti + Opacity Mask Options Opcije maske neprozirnosti + Page Isolated Blending Izolirano stapanje stranice + Page Knockout Group Grupa izbijanja stranice + Release Opacity Mask Oslobodi masku neprozirnosti + Transparency Info Informacije o prozirnosti + Unlink Opacity Mask Prekini vezu maske neprozirnosti + Overprint Pretisak + Package Paket + Apply Last Color Primijeni posljednju boju + Apply Last Gradient Primijeni posljednji gradijent + Complement Komplement + Default Fill and Stroke Zadana ispuna i potez + Fill Ispuna + Fill and Stroke Ispuna i potez + Invert Obrni + Recent Colors Nedavne boje + Swap Fill and Stroke Zamijeni ispunu i potez + Toggle Fill/Stroke Focus Prebaci fokus ispune/poteza + Character / Paragraph Znak / pasus + Copy Artboard Kopiraj radnu ploču + Cut Artboard Izreži radnu ploču + Move Artboard Up/Down Pomakni radnu ploču gore/dolje + Add Anchor (Pen) Dodaj sidro (pero) + Add Anchor Point Dodaj sidrenu tačku + Average Prosjek + Close Path Zatvori putanju + Convert Anchor Points Pretvori sidrene tačke + Cut Path Presijeci putanju + Delete Anchor Points Izbriši sidrene tačke + Move Anchors Pomjeri sidra + Move Direction Handle Pomjeri ručku smjera + Reshape Preoblikuj + Set Anchors Postavi sidra + Minus Front Minus naprijed + Offset Path Odmak putanje + Simplify Pojednostavi + Split Into Grid Podijeli u mrežu + Total: Ukupno: + Add Guides Dodaj vodilice + Unite Ujedini + Delete Pattern Izbriši uzorak + Done Gotovo + Expand Repeat Proširi ponavljanje + List Patterns Izlistaj uzorke + Repeat Options Opcije ponavljanja + Save a Copy Sačuvaj kopiju + Transform Patterns Transformiši uzorke + Delete PDF Preset Izbriši PDF predložak + Export PDF Presets Izvezi PDF predloške + Import PDF Presets Uvezi PDF predloške + PDF Preset PDF predložak + PDF Presets PDF predlošci + Save PDF Preset Sačuvaj PDF predložak + Define Perspective Grid Definiši mrežu perspektive + Delete Perspective Grid Preset Izbriši predložak mreže perspektive + Export Perspective Grid Presets Izvezi predloške mreže perspektive + Import Perspective Grid Presets Uvezi predloške mreže perspektive + Perspective Grid Options Opcije mreže perspektive + Perspective Grid Preset Predložak mreže perspektive + Perspective Grid Presets Predlošci mreže perspektive + Save Perspective Grid Preset Sačuvaj predložak mreže perspektive + Image Info Informacije o slici + Load Place Cursor Učitaj kursor za postavljanje + Placed File Info Informacije o postavljenoj datoteci + Install Plug-in Instaliraj dodatak + List Plug-ins Izlistaj dodatke + Plug-in Info Informacije o dodatku + Remove Plug-in Ukloni dodatak + Run Plug-in Pokreni dodatak + Smooth Glatko + Corner Ugao + White Bijela + 30° Angles Uglovi od 30° + 45° Angles Uglovi od 45° + 60° Angles Uglovi od 60° + 90° & 45° & 30° Angles Uglovi od 90°, 45° i 30° + 90° & 45° Angles Uglovi od 90° i 45° + 90° Angles Uglovi od 90° + Additional Plug-ins Folder Dodatni folder dodataka + Additional Fonts Folder Dodatni folder fontova + Alignment Guides Vodilice za poravnanje + Anchor Points, Handle, and Bounding Box Display Prikaz sidrenih tačaka, ručki i graničnog okvira + Anchor/Path Labels Oznake sidara/putanja + Angles Uglovi + Animated Zoom Animirano zumiranje + Anti-aliased Artwork Crtež sa zaglađenim ivicama + Appearance Panel Panel izgleda + Ask When Modified Pitaj kad je izmijenjeno + Auto-Collapse Iconic Panels Automatski skupi panele ikona + Show Tool Group Labels Prikaži oznake grupa alata + Automatically Automatski + Automatically Save Recovery Data Automatski čuvaj podatke za oporavak + Baseline Shift Pomak osnovne linije + Brightness Svjetlina + Canvas Color Boja platna + Centimeters Centimetri + Command Click to Select Objects Behind Command-klik za odabir objekata iza + Constrain Angle Ograniči ugao + Constrain Width and Height Proportions Zadrži proporcije širine i visine + Construction Guides Konstrukcijske vodilice + Curvature Tool Alat zakrivljenost + Data Recovery Oporavak podataka + Default Language Zadani jezik + Disable Auto Add/Delete Onemogući automatsko dodavanje/brisanje + Display All Blacks Accurately Prikaži sve crne tačno + Display All Blacks as Rich Black Prikaži sve crne kao bogatu crnu + Display Bitmaps as Anti-aliased Images in Pixel Preview Prikaži bitmape kao slike sa zaglađenim ivicama u pregledu piksela + Display Options Opcije prikaza + Display Print Size at 100% Zoom Prikaži veličinu štampe pri zumiranju 100% + Double Click To Isolate Dvostruki klik za izolaciju + Dutch Holandski + East Asian Type Istočnoazijski tekst + Enable Background Export Omogući izvoz u pozadini + Enable Background Save Omogući čuvanje u pozadini + Enable in-menu font previews Omogući preglede fontova u meniju + Enable Missing Glyph Protection Omogući zaštitu od nedostajućih glifova + Enable Rubber Band for Omogući gumenu traku za + Enable Touch Gestures Omogući pokrete dodirom + Enable Touch Workspace Omogući radni prostor za dodir + English: UK Engleski: UK + Every (minutes) Svakih (minuta) + Exceptions (comma separated) Izuzeci (odvojeni zarezom) + Feet Stope + Files Datoteke + Fill New Type Objects With Placeholder Text Ispuni nove tekstualne objekte tekstom čuvara mjesta + Folder Folder + Font Preview Size Veličina pregleda fonta + Get Preferences Preuzmi postavke + GPU Performance GPU performanse + Graphics Processor Grafički procesor + Gridline every Linija mreže svakih + Grids In Back Mreže pozadi + Handles Ručke + Hide Corner Widget for angles greater than Sakrij widget ugla za uglove veće od + High Performance (discrete) Visoke performanse (diskretna) + Highlight Alternate Glyphs Istakni alternativne glifove + Highlight anchors on mouse over Istakni sidra pri prelasku mišem + History States Stanja historije + Hollow Šuplje + Identify Objects By Identifikuj objekte po + Include SVG Code Uključi SVG kod + Italian Italijanski + Keyboard Increment Korak tastature + Language Options Jezičke opcije + Large Veliko + Large Tabs Velike kartice + Legacy vector clipboard Naslijeđeni vektorski međuspremnik + Legacy (version 7) Naslijeđeno (verzija 7) + Transparent Images: Prozirne slike: + Flatten Spljošti + Omit Izostavi + Legacy .ai Options Opcije naslijeđenog .ai + A legacy .ai file holds one artboard: each artboard you check is saved as a separate file. Naslijeđena .ai datoteka sadrži jednu radnu ploču: svaka radna ploča koju označite čuva se kao zasebna datoteka. + {count} of {total} artboards {count} od {total} radnih ploča + Check an artboard to save. Označite radnu ploču za čuvanje. + Hidden Objects: Skriveni objekti: + Hidden Layer Skriveni sloj + Make Visible Učini vidljivim + Text: Tekst: + Editable Može se uređivati + PDF-compatible Kompatibilno s PDF-om + Legacy vector clipboard (no transparency) Naslijeđeni vektorski međuspremnik (bez prozirnosti) + Line Color Boja linije + Lines Linije + List Preferences Izlistaj postavke + Manually Ručno + Mark Older Files as [Converted] When Opened Označi starije datoteke kao [Pretvoreno] pri otvaranju + Match User Interface Brightness Uskladi sa svjetlinom korisničkog interfejsa + Light Gray Svijetlosiva + Medium Gray Srednje siva + Dark Gray Tamnosiva + Measurement Labels Oznake mjerenja + Meters Metri + Move Locked and Hidden Artwork with Artboard Pomjeraj zaključani i skriveni crtež s radnom pločom + Number of Recent Files to Display Broj nedavnih datoteka za prikaz + Number of Recent Fonts Broj nedavnih fontova + Numbers Without Units Are Points Brojevi bez jedinica su tačke + Object Highlighting Isticanje objekata + Object Name Naziv objekta + Object Selection by Path Only Odabir objekata samo putanjom + On Copy Pri kopiranju + On Paste Pri lijepljenju + On Screen Na ekranu + Open Documents As Tabs Otvaraj dokumente kao kartice + Options Opcije + Output All Blacks Accurately Izlaz svih crnih tačno + Output All Blacks as Rich Black Izlaz svih crnih kao bogata crna + Override Character Color Zamijeni boju znakova + Paste Offset Pomak lijepljenja + Pattern Editing Uređivanje uzorka + Pen Tool Alat pero + Picas Pice + Portuguese Portugalski + Preserve Appearance and Overprints Očuvaj izgled i pretiske + Preserve Paths Očuvaj putanje + Primary Primarno + Printing / Exporting Štampanje / izvoz + Real-time Drawing and Editing Crtanje i uređivanje u stvarnom vremenu + Render Threads (-1 = Automatic) Niti iscrtavanja (-1 = automatski) + Reset Preferences Vrati postavke na početne + Scale Corners Skaliraj uglove + Scale Cursor Proportional to UI Skaliraj kursor proporcionalno interfejsu + Scale Strokes & Effects Skaliraj poteze i efekte + Scale Text Attributes Skaliraj atribute teksta + Scratch Disks Radni diskovi + Secondary Sekundarno + Select Same Tint % Odaberi isti % nijanse + Set Preference Postavi postavku + Show East Asian Options Prikaži istočnoazijske opcije + Show Font Names in English Prikaži nazive fontova na engleskom + Show handles when multiple anchors are selected Prikaži ručke kad je odabrano više sidara + Show Indic Options Prikaži indijske opcije + Show Pixel Grid (Above 600% Zoom) Prikaži mrežu piksela (iznad 600% zumiranja) + Show Slice Numbers Prikaži brojeve isječaka + Show The Home Screen When No Documents Are Open Prikaži početni ekran kad nijedan dokument nije otvoren + Show Tool Tips Prikaži opise alata + Size/Leading Veličina/prored + Snapping Tolerance Tolerancija hvatanja + Spacing Guides Vodilice razmaka + Invoke Distance Guides Pozovi vodiče udaljenosti + Spanish Španski + Subdivisions Podjele + Templates Folder Folder predložaka + Tile Edge Color Boja ivice pločice + Tolerance Tolerancija + Tracking Razmak slova + Transform Panel Panel transformacije + Transform Pattern Tiles Transformiši pločice uzorka + Transform Tools Alati za transformaciju + Turn off Data Recovery for complex documents Isključi oporavak podataka za složene dokumente + Type Object Selection by Path Only Odabir tekstualnog objekta samo putanjom + UI Scaling Skaliranje interfejsa + Use Compression Koristi kompresiju + Use Japanese Crop Marks Koristi japanske oznake za izrezivanje + Use Low Resolution Proxy for Linked EPS Koristi proksi niske rezolucije za povezani EPS + Use Precise Cursors Koristi precizne kursore + Use Preview Bounds Koristi granice pregleda + When pasting text Pri lijepljenju teksta + XML ID XML ID + Yards Jardi + Zoom to Selection Zumiraj na odabir + Zoom with Mouse Wheel Zumiraj točkićem miša + Scrub Numeric Fields by Dragging Mijenjaj numerička polja prevlačenjem + Linux Display Server Linux server prikaza + Print Preview Pregled štampanja + Print Setup Podešavanje štampe + Bitmap Bitmapa + Delete Print Preset Izbriši predložak štampanja + Export Print Presets Izvezi predloške štampanja + Import Print Presets Uvezi predloške štampanja + Print Preset Predložak štampanja + Print Presets Predlošci štampanja + Save Print Preset Sačuvaj predložak štampanja + Print Tiling Pages Stranice popločavanja štampe + Document Raster Effects Settings Postavke rasterskih efekata dokumenta + Use Document Raster Effects Resolution Koristi rezoluciju rasterskih efekata dokumenta + Artwork Colors Boje crteža + Randomize Colors Nasumične boje + Recolor Artwork Ponovo oboji crtež + Reduce Colors Smanji boje + Discard Recovered Documents Odbaci oporavljene dokumente + Recovery Data Podaci za oporavak + Restore Recovered Documents Vrati oporavljene dokumente + Save Recovery Data Sačuvaj podatke za oporavak + Untitled Bez naslova + Add to Selection Dodaj u odabir + Select Anchors Odaberi sidra + Select Segments Odaberi segmente + Select Objects Odaberi objekte + Toggle Selection Uključi/isključi odabir + Create Slice Kreiraj isječak + Delete Slices Izbriši isječke + Divide Slices Podijeli isječke + List Slices Izlistaj isječke + Move Slices Pomjeri isječke + Select Slices Odaberi isječke + Set Slice Rectangle Postavi pravougaonik isječka + Slice Options Opcije isječka + Add to Profiles Dodaj u profile + Delete Profile Izbriši profil + Reset Profiles Vrati profile na početno + Stroke Options Opcije poteza + Width Profiles Profili širine + Apply Graphic Style Primijeni grafički stil + Break Link to Graphic Style Prekini vezu s grafičkim stilom + Delete Graphic Style Izbriši grafički stil + Duplicate Graphic Style Dupliciraj grafički stil + Graphic Style Options Opcije grafičkog stila + Graphic Styles Options Opcije grafičkih stilova + Default Graphic Style Zadani grafički stil + Black Outline Crni obris + Heavy Ink Teška tinta + Sunshine Sunce + List Graphic Styles Izlistaj grafičke stilove + Merge Graphic Styles Spoji grafičke stilove + Move Graphic Style Premjesti grafički stil + New Graphic Style Novi grafički stil + Redefine Graphic Style Ponovo definiši grafički stil + Rename Graphic Style Preimenuj grafički stil + Add to Graphic Styles Dodaj u grafičke stilove + Graphic Style Library Biblioteka grafičkih stilova + Add Used Colors Dodaj korištene boje + Delete Swatch Izbriši uzorak boje + Duplicate Swatch Dupliciraj uzorak boje + Merge Swatches Spoji uzorke boja + Move Brush Premjesti četkicu + Move Swatch Premjesti uzorak boje + New Color Group Nova grupa boja + New Swatch Novi uzorak boje + Select All Unused Odaberi sve nekorišteno + Sort by Kind Sortiraj po vrsti + Sort by Name Sortiraj po nazivu + Spot Colors Spot boje + Spot Colors (0) Spot boje (0) + Swatch Options Opcije uzorka boje + Ungroup Color Group Razgrupiši grupu boja + Copy to User Defined Kopiraj u korisnički definisano + Swatch Library Biblioteka uzoraka boja + Clear All Tabs Očisti sve tabulatore + Set Tab Stops Postavi tabulatore + Tab Stops Tabulatori + Flare Odsjaj + Rays Zrake + Rectangle Pravougaonik + Paintbrush Kist + Pen Pero + Small Malo + Black and White Logo Crno-bijeli logotip + High Fidelity Photo Fotografija visoke vjernosti + Low Fidelity Photo Fotografija niske vjernosti + 3 Colors 3 boje + 6 Colors 6 boja + Shades of Gray Nijanse sive + Sketched Art Skicirani crtež + Silhouettes Siluete + Line Art Linijska grafika + Technical Drawing Tehnički crtež + Flat Logo Ravni logotip + Keep Formatting Zadrži oblikovanje + Keep Plain Text Zadrži običan tekst + Clip Isijeci + PDF PDF + no document nema dokumenta + Blue Plava + Brown Smeđa + Gray Siva + Orange Narandžasta + Pink Ružičasta + Purple Ljubičasta + Custom Prilagođeno + Document Setup Postavke dokumenta + French Francuski + German Njemački + Inches Inči + Japanese Japanski + Millimeters Milimetri + Points Tačke +effect Points Tačke + Adjust Colors Podesi boje + Place Postavi + Discard Empty Type Odbaci prazan tekst + Copyright Autorska prava + Other Ostalo + Print Štampaj + Solid Puno + Difference Razlika + Flatten Transparency Spljošti prozirnost + Fonts Fontovi + Off Isključeno + above iznad + Square Kvadrat + Update Links Ažuriraj veze + Liquify Ukapljivanje + Corner Radius Poluprečnik ugla + Move Guide Pomjeri vodilicu +axis Both Obje + Letter Letter + Portrait Uspravno + Recent Nedavno + Saved Sačuvano + Web 1920×1080 Web 1920×1080 + Yellow Žuta + Auto Automatski + Center Sredina + Transform in Perspective Transformiši u perspektivi + Grayscale Nijanse sive + Embed Ugradi + Star Zvijezda + Power Saving (integrated) Ušteda energije (integrisana) + Target Cilj + X11 (XWayland) When a Pen Is Attached X11 (XWayland) kad je priključena olovka + If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. Ako olovka grafičkog tableta ne crta, odaberite X11 (XWayland) opciju. + X11 (XWayland) X11 (XWayland) + Print as Bitmap Štampaj kao bitmapu + Draft Nacrt + Default Zadano + [VectorCraft Default] [VectorCraft zadano] + Magenta Magenta + Page Stranica + Print Tiling Popločavanje štampe + Edit Color Group Uredi grupu boja + Marks Oznake + Color Mode Način boja + Templates Predlošci + Halo Oreol + Multiply Množenje + Red Crvena + Grays Sive + Color Group Grupa boja + Library Biblioteka + English Engleski + List Folder Izlistaj folder + Area Type Options Opcije teksta u području + Reshape Type Area Preoblikuj područje teksta + Scale Skaliraj + Feet & Inches Stope i inči + Pixels Pikseli + Pixel Piksel + More Više + Show Prikaži + Copy Width Point Kopiraj tačku širine + Duplicate Artboard Dupliciraj radnu ploču + Area / Path Type Tekst u području / na putanji + Decrease Font Size Smanji veličinu fonta + Decrease Font Size by Five Steps Smanji veličinu fonta za pet koraka + Increase Font Size Povećaj veličinu fonta + Increase Font Size by Five Steps Povećaj veličinu fonta za pet koraka + Reset Tracking and Kerning Vrati razmak slova i podrezivanje na početno + Reset Horizontal Scale Vrati vodoravnu skalu na početno + Highlight Font Name Istakni naziv fonta + Highlight Kerning Istakni podrezivanje + Highlight Tracking Istakni razmak slova + Step Type Vrsta koraka + Get Text Range Preuzmi raspon teksta + Punctuation Interpunkcija + [Normal Character Style] [Normalni stil znakova] + Text Wrap Options Opcije omotavanja teksta + Threads Niti + Orientation Orijentacija + Set Text Postavi tekst + Insert Character Umetni znak + Replace Zamijeni + Replace: Zamijeni: + Type on a Path Options Opcije teksta na putanji + Highlight Variable Istakni varijablu + New Variable Nova varijabla + List Variables Izlistaj varijable + Bind Variable Veži varijablu + New Data Set Novi skup podataka + List Data Sets Izlistaj skupove podataka + Select Data Set Odaberi skup podataka + Edit Data Set Uredi skup podataka + Visibility Vidljivost + New View Novi pogled + Saved Views Sačuvani pogledi + Magic Wand Options Opcije čarobnog štapića + Magic Wand Settings Postavke čarobnog štapića + Delete Save for Web Preset Izbriši predložak Sačuvaj za web + Save for Web Sačuvaj za web + Save for Web Presets Predlošci Sačuvaj za web + GIF, 128 colours GIF, 128 boja + Save for Web Preview Pregled Sačuvaj za web + Save for Web Settings Postavke Sačuvaj za web + Save Save for Web Preset Sačuvaj predložak Sačuvaj za web + Eyedropper Options Opcije kapaljke + Free Distort Slobodno izobličenje + Move Artboard Pomjeri radnu ploču + Sample Color Uzmi uzorak boje + Angle Ugao + Black Crna + Bottom Dno + Bounds Granice + Colors Boje + Cyan Cijan + Discard Odbaci + Document Dokument + Encoding Kodiranje + Frequency Frekvencija + Height Visina + Image Slika + Ink Tinta + Lab Lab + Medium Srednje + Name Naziv + None Ništa + Normal Normalno + Pages Stranice + Regular Obično + Source Sans 3 Source Sans 3 + Template Predložak + Top Vrh + Width Širina + : : +effect Regular Obično + Saving Poster.vectorcraft Čuvanje Poster.vectorcraft + Community Zajednica + Hide Bar Sakrij traku + More Options Više opcija + Show Properties Panel Prikaži panel svojstava + Isolate Izoliraj + Lock (⌘2) Zaključaj (⌘2) + New file Nova datoteka + Open Otvori + Quickly start a new file Brzo započnite novu datoteku + Recent Files Nedavne datoteke + Vector illustration — fast, open, scriptable. Vektorska ilustracija — brza, otvorena, skriptabilna. + Welcome to VectorCraft Dobro došli u VectorCraft + ArtCraft website Web stranica ArtCrafta + Discord Discord + Join our Discord Pridružite nam se na Discordu + Join the ArtCraft community on Discord (discord.gg/artcraft) Pridružite se ArtCraft zajednici na Discordu (discord.gg/artcraft) + Source code on GitHub Izvorni kod na GitHubu + All Tools Svi alati + Draw Crtaj + Reset Vrati na početno + — missing — nedostaje + (closest) (najbliže) + Change Promijeni + Change All Promijeni sve + Find Pronađi + Find Font Pronađi font + Fonts in Document: {count} Fontovi u dokumentu: {count} + In the selected objects U odabranim objektima + Find in Folder… Pronađi u folderu… + Replace With Font Zamijeni fontom + — substituted by {style} — zamijenjeno stilom {style} + — {n} characters from another font — {n} znakova iz drugog fonta + All Scripts Sve skripte + Any Kind Bilo koja vrsta + Font Technology Tehnologija fonta +font-technology Variable Varijabilni + Decorative Ukrasno + Favorites Omiljeno + Latin Latinica + Thai Tajlandski + Monospaced Neproporcionalni + No matching fonts Nema odgovarajućih fontova + Rounded Zaobljeno + Sans Serif / Gothic Bez serifa / gotika + Script / Brush Rukopisno / četkica + Serif / Mincho Serif / Mincho + Changes made since it was last saved will be lost. Promjene napravljene od posljednjeg čuvanja bit će izgubljene. + Can't open “{name}”. Nije moguće otvoriti „{name}”. + Can't save “{name}”. Nije moguće sačuvati „{name}”. + Can't export “{name}”. Nije moguće izvesti „{name}”. + Downloaded {what} Preuzeto: {what} + Exported {count} file(s) to {folder} Izvezeno datoteka u {folder}: {count} + Exported {what} Izvezeno: {what} + Exported {what} with {} note(s): {first} Izvezeno {what} s bilješkama ({}): {first} + Exporting {} Izvoz {} + Imported {what}: {} Uvezeno {what}: {} + Installed plug-in {} Instaliran dodatak {} + Opened with {} note(s): {} Otvoreno s bilješkama ({}): {} + Revert to the saved version of “{name}”? Vratiti na sačuvanu verziju dokumenta „{name}”? + Replace “{name}”, the file this document was opened from? Zamijeniti „{name}”, datoteku iz koje je ovaj dokument otvoren? + Opening it left out what VectorCraft can't read yet ({what}), so replacing it loses that for good. Save under another name to keep it. Pri otvaranju izostavljeno je ono što VectorCraft još ne može pročitati ({what}), pa se zamjenom to trajno gubi. Sačuvajte pod drugim nazivom da to zadržite. + “{name}” already exists. Replace it? „{name}” već postoji. Zamijeniti? + The name in the save panel was “{typed}”; VectorCraft added the file type's extension. Replacing the file overwrites its contents. Naziv u panelu za čuvanje bio je „{typed}”; VectorCraft je dodao ekstenziju vrste datoteke. Zamjena datoteke prepisuje njen sadržaj. + Saved {path} Sačuvano: {path} + Saved {path} with {} note(s): {first} Sačuvano {path} s bilješkama ({}): {first} + Saving Čuvanje + Saving {} Čuvanje {} + Search commands and tools… Pretraži naredbe i alate… + Dashed Line Isprekidana linija + Panel menu Meni panela + Unembed… Poništi ugrađivanje… + Applies the next time VectorCraft starts. Primjenjuje se pri sljedećem pokretanju VectorCrafta. + Enable Contextual Task Bar Omogući kontekstnu traku zadataka + Next Sljedeće + OK U redu + Preferences Postavke + Previous Prethodno + Restore every preference to its default (applied on OK) Vrati svaku postavku na zadanu vrijednost (primjenjuje se na U redu) + Smaller ↔ Larger Manje ↔ veće + Smart Guides (View → Smart Guides) Pametne vodilice (Prikaz → Pametne vodilice) + Couldn't save recovery data: {e} Nije moguće sačuvati podatke za oporavak: {e} + Discarded {} recovered document(s) Odbačeno oporavljenih dokumenata: {} + Restored {} recovered document(s): save them to keep them Vraćeno oporavljenih dokumenata: {}; sačuvajte ih da ih zadržite + Saved recovery data for {title} Sačuvani podaci za oporavak za {title} + Saving recovery data for {} Čuvanje podataka za oporavak za {} + Alt Alt + Backspace Backspace + Cmd Cmd + Ctrl Ctrl + Shift Shift + Couldn't copy to the system clipboard: {e} Nije moguće kopirati u sistemski međuspremnik: {e} + Couldn't paste from the clipboard: {e} Nije moguće zalijepiti iz međuspremnika: {e} + Channel Kanal + Circle Krug + Clip to Art Isijeci prema crtežu + Colorize Oboji + Gamma Gama + Hue Nijansa + Input Black Ulazna crna + Keep Original Zadrži original + Lightness Svjetloća + Mono Mono + Output White Izlazna bijela + Saturation Zasićenje + Screens Ekrani + Add Swatches Dodaj uzorke boja + Apply to All Primijeni na sve + Swatch Conflict Konflikt uzoraka boja + Axis: Osa: + Free Slobodno + Keep: Zadrži: + Search Pretraga + Classic Defaults Klasične zadane postavke + Uniform Ujednačeno + Include Blacks with CMY: Uključi crne s CMY: + Recolor Ponovo oboji + Swatch Tiles Pločice uzoraka boja + Baseline Osnovna linija + Flip: Preokreni: + Spacing: Razmak: + Output Izlaz + Export… Izvezi… + Import… Uvezi… + Load Profile… Učitaj profil… + Embedded Ugrađeno + Image Tracing Praćenje slika + Linked File Povezana datoteka + Preset: Unaprijed postavljeno: + View: Prikaz: + Tracing Result Rezultat praćenja + Outlines with Source Image Obrisi s izvornom slikom + Press and hold to view the source image Pritisnite i držite da vidite izvornu sliku + SVG Options SVG opcije + Maximize Maksimiziraj + Restore Vrati + Align Objects: Poravnaj objekte: + Default Fill and Stroke (D) Zadana ispuna i potez (D) + Fill (X), double-click for the Color Picker Ispuna (X), dvostruki klik za birač boja + Opacity: Neprozirnost: + Shape Mode Način oblika + Shape Modes: Načini oblika: + Stroke (X), double-click for the Color Picker Potez (X), dvostruki klik za birač boja + Stroke: Potez: + Swap Fill and Stroke (Shift+X) Zamijeni ispunu i potez (Shift+X) + Manage Workspaces Upravljaj radnim prostorima + Name: Naziv: + New Novo + New Workspace Novi radni prostor + Rename Preimenuj + Save the current layout under this name Sačuvaj trenutni raspored pod ovim nazivom + Saves the current bars, toolbar and panel layout. Čuva trenutne trake, traku s alatima i raspored panela. + Workspace {i} Radni prostor {i} + Glowing Edges Užarene ivice + Edge Width Širina ivica + Edge Brightness Svjetlina ivica + Smoothness Glatkoća + Color Halftone Polutonovi u boji + Mezzotint Mecotinta + Pointillize Tačkasto slikanje + Max. Radius Maks. poluprečnik + Channel 1 Kanal 1 + Channel 2 Kanal 2 + Channel 3 Kanal 3 + Channel 4 Kanal 4 + Cell Size Veličina ćelije + Radial Blur Radijalno zamućenje + Smart Blur Pametno zamućenje + Unsharp Mask Maska izoštravanja + Gaussian Blur Gaussovo zamućenje + Method Metoda + Quality Kvalitet + Radius Poluprečnik + Apply Character Style Primijeni stil znakova + Apply Paragraph Style Primijeni stil pasusa + Character Style Options Opcije stila znakova + Flip Preokreni + Couldn't {} {name}: {e} Nije moguće {} {name}: {e} + Create PDF layers from top-level layers Kreiraj PDF slojeve iz slojeva najvišeg nivoa + Delete Character Style Izbriši stil znakova + Delete Layer Izbriši sloj + Delete Paragraph Style Izbriši stil pasusa + Duplicate Character Style Dupliciraj stil znakova + Duplicate Layer Dupliciraj sloj + Duplicate Paragraph Style Dupliciraj stil pasusa + Spacing Razmak + Mojikumi Mojikumi + N pt per N pt po + New Character Style Novi stil znakova + New Character Style… Novi stil znakova… + New Paragraph Style Novi stil pasusa + New Paragraph Style… Novi stil pasusa… + Paragraph Style Options Opcije stila pasusa + Redefine Character Style Ponovo definiši stil znakova + Redefine Paragraph Style Ponovo definiši stil pasusa + Rename Character Style Preimenuj stil znakova + Rename Paragraph Style Preimenuj stil pasusa + Select All Art on Layer Odaberi sav crtež na sloju + Settings… Postavke… + Joins Spojevi + Joins: Spojevi: + Distance Udaljenost + Distance: Udaljenost: + Gutter Međuprostor + Gutter: Međuprostor: + Length Dužina + Length: Dužina: + Points: Tačke: + Scale X Skala X + Scale X: Skala X: + Scale Y Skala Y + Scale Y: Skala Y: + Shear: Smicanje: + Drag art, colors and text styles here to reuse them across documents. Libraries are stored on this machine — no account required. Prevucite crtež, boje i stilove teksta ovdje da ih ponovo koristite u drugim dokumentima. Biblioteke se čuvaju na ovom računaru — račun nije potreban. + De-Interlace Ukloni preplitanje + Eliminate Eliminiši + Create New Fields by Kreiraj nova polja po + Craquelure Krakelura + Grain Zrno + Mosaic Tiles Mozaik pločice + Patchwork Krpice + Stained Glass Vitraž + Texturizer Teksturizator + Crack Spacing Razmak pukotina + Crack Depth Dubina pukotina + Crack Brightness Svjetlina pukotina + Grain Type Vrsta zrna + Tile Size Veličina pločice + Grout Width Širina fuga + Lighten Grout Posvijetli fuge + Square Size Veličina kvadrata + Relief Reljef + Border Thickness Debljina okvira + Light Intensity Intenzitet svjetla + Light Direction Smjer svjetla + Value Axis Osa vrijednosti + Diffuse Glow Difuzni sjaj + Glass Staklo + Ocean Ripple Talasanje okeana + Graininess Zrnatost + Glow Amount Količina sjaja + Clear Amount Očisti količinu + Ripple Size Veličina talasanja + Ripple Magnitude Jačina talasanja + Accented Edges Naglašene ivice + Angled Strokes Ukošeni potezi + Dark Strokes Tamni potezi + Ink Outlines Obrisi tintom + Spatter Prskanje + Sprayed Strokes Raspršeni potezi + Sumi-e Sumi-e + Direction Balance Balans smjera + Stroke Length Dužina poteza + Sharpness Oštrina + Strength Jačina + Balance Balans + Black Intensity Intenzitet crne + White Intensity Intenzitet bijele + Dark Intensity Intenzitet tame + Spray Radius Poluprečnik prskanja + Stroke Direction Smjer poteza + Stroke Width Širina poteza + Stroke Pressure Pritisak poteza +imageTrace Outline Obris +@plural {n} item|{n} items {n} stavka|{n} stavke|{n} stavki +@plural Color Table ({n} color)|Color Table ({n} colors) Tabela boja ({n} boja)|Tabela boja ({n} boje)|Tabela boja ({n} boja) +@plural Delete this {n} graphic style?|Delete these {n} graphic styles? Izbrisati ovaj {n} grafički stil?|Izbrisati ova {n} grafička stila?|Izbrisati ovih {n} grafičkih stilova? +@plural {n} Layer|{n} Layers {n} sloj|{n} sloja|{n} slojeva +@plural {n} Object|{n} Objects {n} objekat|{n} objekta|{n} objekata +@plural {n} area highlighted|{n} areas highlighted Istaknuto {n} područje|Istaknuta {n} područja|Istaknuto {n} područja +@plural {n} color|{n} colors {n} boja|{n} boje|{n} boja +@plural {n} fill|{n} fills {n} ispuna|{n} ispune|{n} ispuna +@plural {n} glyph|{n} glyphs {n} glif|{n} glifa|{n} glifova +@plural {n} object highlighted|{n} objects highlighted Istaknut {n} objekat|Istaknuta {n} objekta|Istaknuto {n} objekata +@plural {n} star|{n} stars {n} zvjezdica|{n} zvjezdice|{n} zvjezdica +@plural {n} step|{n} steps {n} korak|{n} koraka|{n} koraka +@plural {n} stroke|{n} strokes {n} potez|{n} poteza|{n} poteza +@msg no library `{id}` nema biblioteke `{id}` +@msg select some type first prvo odaberite tekst +@msg the selection has no gradient fill odabir nema ispunu gradijentom +@msg the selection has no gradient stroke odabir nema potez gradijentom +@msg the selection has no pattern fill odabir nema ispunu uzorkom +@msg the selection has no pattern stroke odabir nema potez uzorkom +@msg no gradient swatch `{name}` nema uzorka gradijenta `{name}` +@msg no pattern swatch `{name}` nema uzorka šare `{name}` +@msg the library item is damaged stavka biblioteke je oštećena +@msg {_1} has no {_2} style {_1} nema stil {_2} +@msg a layer couldn't be read sloj nije moguće pročitati +@msg it has more than one artboard ima više od jedne radne ploče +@msg it has no page nema stranicu +@msg it has too many text objects ima previše tekstualnih objekata +@msg it has too much text ima previše teksta +@msg its editing data doesn't say where its artboard is njeni podaci za uređivanje ne govore gdje joj je radna ploča +@msg its editing data has no layers njeni podaci za uređivanje nemaju slojeve +@msg its editing data is damaged njeni podaci za uređivanje su oštećeni +@msg its editing data is for a {w} × {h} pt page, not the file's {pw} × {ph} pt page njeni podaci za uređivanje su za stranicu od {w} × {h} pt, a ne za stranicu datoteke od {pw} × {ph} pt +@msg its editing data is for a {w} × {h} pt page, the file's {pw} × {ph} pt page at {scale} njeni podaci za uređivanje su za stranicu od {w} × {h} pt, stranica datoteke od {pw} × {ph} pt pri {scale} +@msg its zlib compression is damaged njena zlib kompresija je oštećena +@msg its Zstandard compression is damaged njena Zstandard kompresija je oštećena +@msg it decompresses to more than {_1} MB dekompresuje se na više od {_1} MB +@msg its editing data is for a different page njeni podaci za uređivanje su za drugu stranicu +@msg its layers use {_1}, which aren't read yet njeni slojevi koriste {_1}, koji se još ne čitaju +@msg its page has text, and its layers have no text objects to put it in njena stranica ima tekst, a njeni slojevi nemaju tekstualne objekte u koje bi ga stavili +@msg its type is to come in as outlines, which only its page has njen tekst treba stići kao obrisi, koje ima samo njena stranica +@msg the art on them differs from the page's in {_1}% of it crtež na njima razlikuje se od crteža stranice u {_1}% +@msg the art on them differs from the page's in {_1}% of it: they come from its editing data all the same crtež na njima razlikuje se od crteža stranice u {_1}%: ipak dolaze iz njenih podataka za uređivanje +@msg the file's layers weren't read ({_1}): it comes in as its page, in one layer slojevi datoteke nisu pročitani ({_1}): stiže kao svoja stranica, u jednom sloju +@msg the file's layers weren't read from its editing data ({_1}): they come from its PDF part slojevi datoteke nisu pročitani iz njenih podataka za uređivanje ({_1}): dolaze iz njenog PDF dijela +@msg `to` must be "corner" or "smooth" `to` mora biti "corner" ili "smooth" +@msg BMP files are RGB or grayscale: colorModel rgb or gray BMP datoteke su RGB ili nijanse sive: colorModel rgb ili gray +@msg Blend colors: select at least three objects with filled colours Stopi boje: odaberite barem tri objekta s ispunjenim bojama +@msg Combine Slices: the slices have no bounds Kombinuj isječke: isječci nemaju granice +@msg Convert to Artboards: selection has no area Pretvori u radne ploče: odabir nema površinu +@msg Convert to Shape: no rectangles or ellipses selected Pretvori u oblik: nisu odabrani pravougaonici ni elipse +@msg Copied the CSS of {rules} object(s) Kopiran CSS objekata: {rules} +@msg Copied the script report Izvještaj skripte kopiran +@msg Corners edits the corners of a path Uglovi uređuje uglove putanje +@msg Couldn't copy to the system clipboard: {e} Nije moguće kopirati u sistemski međuspremnik: {e} +@msg Couldn't open {name}: {e} Nije moguće otvoriti {name}: {e} +@msg Couldn't place {name}: the document it was dropped on was closed Nije moguće postaviti {name}: dokument na koji je ispušten je zatvoren +@msg Couldn't place {name}: the document it was placed in was closed Nije moguće postaviti {name}: dokument u koji je postavljen je zatvoren +@msg Couldn't read {name}: {e} Nije moguće pročitati {name}: {e} +@msg Couldn't save recovery data: {e} Nije moguće sačuvati podatke za oporavak: {e} +@msg Create Outlines: select text objects Kreiraj obrise: odaberite tekstualne objekte +@msg Create from Guides: the document has no artboard Kreiraj iz vodilica: dokument nema radnu ploču +@msg Create from Guides: the guides make more than {MAX_PIECES} slices Kreiraj iz vodilica: vodilice prave više od {MAX_PIECES} isječaka +@msg Create from Selection: the selection has no area Kreiraj iz odabira: odabir nema površinu +@msg Data Recovery has nowhere to keep copies: set Preferences → File Handling → Data Recovery → Folder (recoveryFolder) Oporavak podataka nema gdje čuvati kopije: postavite Postavke → Rukovanje datotekama → Oporavak podataka → Folder (recoveryFolder) +@msg direct-select anchor points to cut at (not the end points of open paths) direktno odaberite sidrene tačke za presijecanje (ne krajnje tačke otvorenih putanja) +@msg Divide Objects Below: select a path Podijeli objekte ispod: odaberite putanju +@msg Divide Objects Below: select exactly one path Podijeli objekte ispod: odaberite tačno jednu putanju +@msg Downloaded {_1} file(s) Preuzeto datoteka: {_1} +@msg Downloaded {what} Preuzeto: {what} +@msg Expand Appearance: the selection has a basic appearance Proširi izgled: odabir ima osnovni izgled +@msg Expand: no brush strokes selected Proširi: nisu odabrani potezi četkicom +@msg Expand: no gradient fills Proširi: nema gradijentnih ispuna +@msg Expand: nothing to expand Proširi: nema ničeg za proširivanje +@msg Exported {count} file(s) to {folder} Izvezeno datoteka u {folder}: {count} +@msg Exported {path} Izvezeno: {path} +@msg Flatten Transparency: select objects to flatten Spljošti prozirnost: odaberite objekte za spljoštavanje +@msg Flatten Transparency: {e} Spljošti prozirnost: {e} +@msg Image Trace: the traced image is missing Praćenje slike: praćena slika nedostaje +@msg Imported {what}: {_1} Uvezeno {what}: {_1} +@msg Installed plug-in {_1} Instaliran dodatak {_1} +@msg Internal error: {msg} (please report this bug) Interna greška: {msg} (molimo prijavite ovu grešku) +@msg Live Paint Merge: select a Live Paint group and the paths to add Spajanje živog bojenja: odaberite grupu živog bojenja i putanje za dodavanje +@msg Live Paint takes paths and compound paths: convert type, images and other objects to paths first Živo bojenje prihvata putanje i složene putanje: prvo pretvorite tekst, slike i druge objekte u putanje +@msg Live Paint: select paths or compound paths Živo bojenje: odaberite putanje ili složene putanje +@msg Live Paint: these paths are too degenerate to paint Živo bojenje: ove putanje su previše degenerisane za bojenje +@msg Make Guides: select paths Napravi vodilice: odaberite putanje +@msg No saved selections (Select → Save Selection…) Nema sačuvanih odabira (Odaberi → Sačuvaj odabir…) +@msg No saved views (View → New View…) Nema sačuvanih pogleda (Prikaz → Novi pogled…) +@msg Offset Path: select paths Odmak putanje: odaberite putanje +@msg Offset Path: the offset leaves nothing of the selected paths (an inset larger than the shapes) Odmak putanje: odmak ne ostavlja ništa od odabranih putanja (umetak veći od oblika) +@msg Opened with {_1} note(s): {_2} Otvoreno s bilješkama ({_1}): {_2} +@msg Opened {url} Otvoreno: {url} +@msg Outline Stroke: no stroked paths selected Obris poteza: nisu odabrane putanje s potezom +@msg PDF settings are not an object PDF postavke nisu objekat +@msg PDF security settings are not an object PDF sigurnosne postavke nisu objekat +@msg PDF writer error: {0} greška PDF zapisivača: {0} +@msg Packaged {n} file(s) in {folder} {note} Upakovano datoteka u {folder}: {n} {note} +@msg Packaged {n} file(s){note} Upakovano datoteka: {n}{note} +@msg Preview in Browser needs the desktop app (the web downloads files instead) Pregledaj u pregledniku zahtijeva desktop aplikaciju (web umjesto toga preuzima datoteke) +@msg Release Guides: no guides Oslobodi vodilice: nema vodilica +@msg Release: no layer to put the rectangle in Oslobodi: nema sloja u koji bi se stavio pravougaonik +@msg Replace Spine: select a blend and a path Zamijeni kičmu: odaberite stapanje i putanju +@msg select two or more objects to distribute odaberite dva ili više objekata za raspoređivanje +@msg select paths or anchor points odaberite putanje ili sidrene tačke +@msg SVG parse error: {0} greška raščlanjivanja SVG-a: {0} +@msg Save for Web: the image is empty Sačuvaj za web: slika je prazna +@msg Save writes {_1}, not {_2}: use document.export for other formats Sačuvaj zapisuje {_1}, a ne {_2}: za druge formate koristite document.export +@msg Save writes {_1}, not {_2}: use file.saveAsTemplate to write it Sačuvaj zapisuje {_1}, a ne {_2}: za zapisivanje koristite file.saveAsTemplate +@msg aiVersion 7 writes legacy .ai files; a .ait template is always PDF-compatible aiVersion 7 zapisuje naslijeđene .ai datoteke; .ait predložak je uvijek kompatibilan s PDF-om +@msg Saved recovery data for {title} Sačuvani podaci za oporavak za {title} +@msg Saved to User Defined: {_1} Sačuvano u korisnički definisano: {_1} +@msg Saved {path} Sačuvano: {path} +@msg Select text or click into text with the Type tool to insert glyphs Odaberite tekst ili kliknite u tekst alatom za tekst da umetnete glifove +@msg Shape Builder: no region under the pointer Graditelj oblika: nema regije ispod pokazivača +@msg Shape Builder: select paths or compound paths Graditelj oblika: odaberite putanje ili složene putanje +@msg Show All Hidden Attributes: nothing is hidden Prikaži sve skrivene atribute: ništa nije skriveno +@msg Split Into Grid: select paths large enough for the grid Podijeli u mrežu: odaberite putanje dovoljno velike za mrežu +@msg Targa files are RGB: colorModel rgb Targa datoteke su RGB: colorModel rgb +@msg Text Wrap: select a wrap object Omotavanje teksta: odaberite objekat omotavanja +@msg `aspect` must be a number (%) `aspect` mora biti broj (%) +@msg `at` must be [x, y] `at` mora biti [x, y] +@msg `color` must be a colour `color` mora biti boja +@msg `command` must be a command whose menu item opens a dialog (see ui.menuDialog) `command` mora biti naredba čija stavka menija otvara dijalog (vidi ui.menuDialog) +@msg `freeform.points` must be an array `freeform.points` mora biti niz +@msg `freeform.lines` must be an array `freeform.lines` mora biti niz +@msg `gradient` must be an object `gradient` mora biti objekat +@msg `groupColors` must be an array `groupColors` mora biti niz +@msg `library` is a library id or name (see {list}) `library` je ID ili naziv biblioteke (vidi {list}) +@msg `mode` applies to freeform gradients `mode` se primjenjuje na gradijente slobodnog oblika +@msg `preserve` must be an object `preserve` mora biti objekat +@msg `sampleSize` must be 1, 3 or 5 `sampleSize` mora biti 1, 3 ili 5 +@msg `stops` must be an array `stops` mora biti niz +@msg `svg` must be an object of SVG options (see document.formats) `svg` mora biti objekat SVG opcija (vidi document.formats) +@msg `{_1}` is no save command `{_1}` nije naredba čuvanja +@msg `{area}` is no recovery area name `{area}` nije naziv područja za oporavak +@msg `{color}` is not a colour (#rrggbb or a preset name) `{color}` nije boja (#rrggbb ili naziv predloška) +@msg `{id}` has no envelope dialog `{id}` nema dijalog omotnice +@msg `{keep}` is not a side of this axis `{keep}` nije strana ove ose +@msg `{key}` must be `auto` or a language code such as `en` or `zh-hant` `{key}` mora biti `auto` ili kod jezika poput `en` ili `zh-hant` +@msg `{key}` must be a #rrggbb color `{key}` mora biti boja #rrggbb +@msg `{key}` must be a #rrggbb colour `{key}` mora biti boja #rrggbb +@msg `{key}` must be a number `{key}` mora biti broj +@msg `{key}` must be a number, not {v} `{key}` mora biti broj, a ne {v} +@msg {key} must be Unix seconds (an integer) or null {key} mora biti Unix sekunde (cijeli broj) ili null +@msg `{key}` must be a string `{key}` mora biti niz znakova +@msg `{key}` must be a whole number `{key}` mora biti cijeli broj +@msg `{key}` must be a whole number between {min} and {max} (got {x}) `{key}` mora biti cijeli broj između {min} i {max} (dobiveno {x}) +@msg `{key}` must be between {min} and {max} (got {x}) `{key}` mora biti između {min} i {max} (dobiveno {x}) +@msg `{key}` must be one of {_1} `{key}` mora biti jedno od {_1} +@msg `{key}` must be true or false `{key}` mora biti true ili false +@msg `top` and `below` can't both be true `top` i `below` ne mogu oba biti true +@msg `select` must be true or false `select` mora biti true ili false +@msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` i `maxAnchors` moraju biti cijeli brojevi +@msg `{key}` must be a number not below 0 `{key}` mora biti broj ne manji od 0 +@msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` mora biti [x, y, width, height]: četiri konačna broja, širina i visina nisu negativne +@msg `{min_key}` is greater than `{max_key}` `{min_key}` je veće od `{max_key}` +@msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` navedite barem jedno od `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` +@msg `mode` must be grayscale, rgb, hsb, cmyk or websafe `mode` mora biti grayscale, rgb, hsb, cmyk ili websafe +@msg `{k}` must be [x, y] `{k}` mora biti [x, y] +@msg `{name}` has no options `{name}` nema opcija +@msg `{name}` is a built-in workspace; choose another name `{name}` je ugrađeni radni prostor; odaberite drugi naziv +@msg `{name}` is a process colour: tints apply to global and spot colours `{name}` je procesna boja: nijanse se primjenjuju na globalne i spot boje +@msg `{name}` is no recovery entry name `{name}` nije naziv unosa za oporavak +@msg `{name}` isn't a colour swatch `{name}` nije uzorak boje +@msg a process color can't colorize a grayscale image with transparency: use a spot color, black or white procesna boja ne može obojiti sliku u sivim tonovima s prozirnošću: koristite spot boju, crnu ili bijelu +@msg `{path}` must be a bool or an object of bools `{path}` mora biti bool ili objekat boolova +@msg `{s}` is not a colour (#rrggbb or a preset name) `{s}` nije boja (#rrggbb ili naziv predloška) +@msg `{tool}` isn't a Liquify tool `{tool}` nije alat za ukapljivanje +@msg `{tool}` isn't a freehand tool `{tool}` nije alat za slobodno crtanje +@msg `{to}` is not an available name `{to}` nije dostupan naziv +@msg a PostScript error ({name} in `{op}`) PostScript greška ({name} u `{op}`) +@msg a PostScript error ({name} in `{op}`), in {procs} PostScript greška ({name} u `{op}`), u {procs} +@msg a PostScript error ({name} in `{op}`: {at}) PostScript greška ({name} u `{op}`: {at}) +@msg a PostScript error ({name} in `{op}`: {at}), in {procs} PostScript greška ({name} u `{op}`: {at}), u {procs} +@msg a PostScript error ({name}) PostScript greška ({name}) +@msg a PostScript error ({name} in `{op}`; {meaning}) PostScript greška ({name} u `{op}`; {meaning}) +@msg a PostScript error ({name} in `{op}`; {meaning}), in {procs} PostScript greška ({name} u `{op}`; {meaning}), u {procs} +@msg a PostScript error ({name} in `{op}`: {at}; {meaning}) PostScript greška ({name} u `{op}`: {at}; {meaning}) +@msg a PostScript error ({name} in `{op}`: {at}; {meaning}), in {procs} PostScript greška ({name} u `{op}`: {at}; {meaning}), u {procs} +@msg a PostScript error ({name}; {meaning}) PostScript greška ({name}; {meaning}) +@msg the program ends a dictionary it didn't begin program završava rječnik koji nije započeo +@msg the program opens a file, which the reader can't do program otvara datoteku, što čitač ne može +@msg the program restores a saved state that was already restored program vraća sačuvano stanje koje je već vraćeno +@msg data the program reads is damaged or cut short, or the program asks for a position in a file that has none podaci koje program čita su oštećeni ili skraćeni, ili program traži poziciju u datoteci koja je nema +@msg the program goes past one of the reader's limits program prelazi jedno od ograničenja čitača +@msg the path has no point to continue from putanja nema tačku od koje bi se nastavilo +@msg a value is outside the range the operator takes vrijednost je izvan raspona koji operator prima +@msg the operator needs more values than the stack holds operator treba više vrijednosti nego što stog sadrži +@msg part of the program isn't valid PostScript text dio programa nije važeći PostScript tekst +@msg a value has the wrong type for the operator vrijednost ima pogrešnu vrstu za operator +@msg the program runs, deletes or renames a file, which the reader can't do program pokreće, briše ili preimenuje datoteku, što čitač ne može +@msg the program asks for a resource that isn't defined program traži resurs koji nije definisan +@msg a calculation has no result, as in a division by zero izračun nema rezultat, kao kod dijeljenja nulom +@msg the operator looks for a mark on the stack and finds none operator traži oznaku na stogu i ne nalazi je +@msg a bitmap is empty bitmapa je prazna +@msg a bitmap is too large to read bitmapa je prevelika za čitanje +@msg a colour index is 0 to {_1}, not {n} indeks boje je od 0 do {_1}, a ne {n} +@msg a colour is an index, #rrggbb or a preset name, not {v} boja je indeks, #rrggbb ili naziv predloška, a ne {v} +@msg a document needs at least one artboard dokument treba barem jednu radnu ploču +@msg a document needs at least one layer dokument treba barem jedan sloj +@msg a freeform gradient keeps at least one point gradijent slobodnog oblika zadržava barem jednu tačku +@msg a gradient needs at least two stops gradijent treba barem dvije tačke +@msg a graphic style named `{to}` already exists grafički stil s nazivom `{to}` već postoji +@msg a key object sits on that point na toj tački nalazi se ključni objekat +@msg a page is missing nedostaje stranica +@msg a page out of range stranica izvan raspona +@msg a page tree kid isn't a reference dijete stabla stranica nije referenca +@msg a page tree node has no kids čvor stabla stranica nema djece +@msg a page's placement is not finite položaj stranice nije konačan +@msg a preset named `{_1}` exists predložak s nazivom `{_1}` postoji +@msg `name` is empty `name` je prazno +@msg `newName` is empty `newName` je prazno +@msg `{name}` is a built-in preset and can't change: save it under another name `{name}` je ugrađena unaprijed postavljena vrijednost i ne može se mijenjati: sačuvajte je pod drugim nazivom +@msg `{name}` is a built-in preset and stays `{name}` je ugrađena unaprijed postavljena vrijednost i ostaje +@msg a swatch or color group named `{n}` exists uzorak boje ili grupa boja s nazivom `{n}` postoji +@msg a slice size must be a positive number of points veličina isječka mora biti pozitivan broj tačaka +@msg a spine keeps at least two points kičma zadržava barem dvije tačke +@msg a stream runs past the end tok ide preko kraja +@msg a stream's length is wrong dužina toka je pogrešna +@msg a stream's length isn't a number dužina toka nije broj +@msg add a format to export dodajte format za izvoz +@msg already editing a pattern već se uređuje uzorak +@msg an object can't be read objekat se ne može pročitati +@msg an object in perspective would leave the edited grid objekat u perspektivi napustio bi uređenu mrežu +@msg antiAlias `{id}`: none, art or type antiAlias `{id}`: none, art ili type +@msg artboard {0} does not exist radna ploča {0} ne postoji +@msg at this scale the drawing is {w} × {h} pt, more than the canvas holds: choose a smaller scale or fit it to the artboard u ovoj skali crtež je {w} × {h} pt, više nego što platno može primiti: odaberite manju skalu ili ga uklopite u radnu ploču +@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{v}` osa mora biti "vertical", "horizontal" ili ugao u stepenima, a ne `{v}` +@msg background {other}: transparent, white, black or a colour such as "#ff8800" pozadina {other}: transparent, white, black ili boja poput "#ff8800" +@msg bad color {v} loša boja {v} +@msg videoRulerPixelAspectRatio must be a number from 0.1 to 10 videoRulerPixelAspectRatio mora biti broj od 0,1 do 10 +@msg the Color Picker is not open birač boja nije otvoren +@msg the Simplify slider is not open klizač Pojednostavi nije otvoren +@msg the Smooth slider is not open klizač Izgladi nije otvoren +@msg the screen color sampler is already open uzorkivač boja s ekrana je već otvoren +@msg this system has no screen color sampler ovaj sistem nema uzorkivač boja s ekrana +@msg bad colour `{hex}` (#rrggbb) loša boja `{hex}` (#rrggbb) +@msg bad page tree loše stablo stranica +@msg bad shortcut loša prečica +@msg bad stream length loša dužina toka +@msg bad trailer loš trailer +@msg balance must be between 0 and 100 balans mora biti između 0 i 100 +@msg batch step {_1} (`{id}`) failed: {e} korak paketa {_1} (`{id}`) nije uspio: {e} +@msg brightness must be dark|mediumDark|mediumLight|light brightness mora biti dark|mediumDark|mediumLight|light +@msg can't encode the document: {0} nije moguće kodirati dokument: {0} +@msg can't parse shortcut `{c}` nije moguće raščlaniti prečicu `{c}` +@msg can't parse shortcut `{s}` for `{k}` nije moguće raščlaniti prečicu `{s}` za `{k}` +@msg can't save version {0}: VectorCraft writes versions {MIN_VERSION} to {VERSION} nije moguće sačuvati verziju {0}: VectorCraft zapisuje verzije od {MIN_VERSION} do {VERSION} +@msg can't write .{ext} images nije moguće zapisati .{ext} slike +@msg cannot distort a zero-size bounding box nije moguće izobličiti granični okvir nulte veličine +@msg cannot read PDF: {0} nije moguće pročitati PDF: {0} +@msg cannot split an open path at its end point nije moguće razdvojiti otvorenu putanju na njenoj krajnjoj tački +@msg closing needs three anchors zatvaranje zahtijeva tri sidra +@msg check an asset to export označite resurs za izvoz +@msg check a layer to export označite sloj za izvoz +@msg select the art to export first prvo odaberite crtež za izvoz +@msg choice must be "merge" or "add", not `{choice}` choice mora biti "merge" ili "add", a ne `{choice}` +@msg choose a direction to divide in odaberite smjer dijeljenja +@msg choose a folder to export to odaberite folder za izvoz +@msg choose a location for the package odaberite lokaciju za paket +@msg clipboard is empty međuspremnik je prazan +@msg colorTable.{what}: `{h}` is not a colour such as "#ff8800" colorTable.{what}: `{h}` nije boja poput "#ff8800" +@msg colorTable.{what}: at most {MAX_TABLE} colours colorTable.{what}: najviše {MAX_TABLE} boja +@msg command `{0}` is not available right now: {1} naredba `{0}` trenutno nije dostupna: {1} +@msg compound paths can only contain paths složene putanje mogu sadržavati samo putanje +@msg compressed (RLE) bitmaps can't be read yet komprimirane (RLE) bitmape se još ne mogu čitati +@msg damaged oštećeno +@msg decimals must be {_1}–{_2} (got {_3}) decimals mora biti {_1}–{_2} (dobiveno {_3}) +@msg divide into 1 to {MAX_PIECES} slices podijelite na 1 do {MAX_PIECES} isječaka +@msg effect {k} is `{_1}`, not `{id}` efekat {k} je `{_1}`, a ne `{id}` +@msg empty brush stroke prazan potez četkicom +@msg empty cutter prazan rezač +@msg empty path prazna putanja +@msg file version {0} is newer than this VectorCraft supports ({VERSION}) verzija datoteke {0} novija je od one koju ovaj VectorCraft podržava ({VERSION}) +@msg freeform point {i} needs `at` [x, y] and a valid `color` tačka slobodnog oblika {i} treba `at` [x, y] i važeću `color` +@msg freeform line {i} must be an array of point indices linija slobodnog oblika {i} mora biti niz indeksa tačaka +@msg give both `start` and `end` [x, y] (or neither) navedite i `start` i `end` [x, y] (ili nijedno) +@msg give corners of the path: anchors where its sides meet at an angle navedite uglove putanje: sidra gdje se njene strane sastaju pod uglom +@msg give horizontal or vertical navedite horizontal ili vertical +@msg give the path `id` and the width point `index` navedite `id` putanje i `index` tačke širine +@msg guides are locked vodilice su zaključane +@msg handle must be in or out handle mora biti in ili out +@msg an image has no pixels and was left out slika nema piksela i izostavljena je +@msg image data `{_1}` is missing nedostaju podaci slike `{_1}` +@msg image would be too large; lower the resolution slika bi bila prevelika; smanjite rezoluciju +@msg index must be a number or first, previous, next or last index mora biti broj ili first, previous, next ili last +@msg index must be a number or first, previous, next or last, not `{other}` index mora biti broj ili first, previous, next ili last, a ne `{other}` +@msg index must be ≥ 0 index mora biti ≥ 0 +@msg installing from a path is not available on the web; pass the module as `dataBase64` instaliranje s putanje nije dostupno na webu; proslijedite modul kao `dataBase64` +@msg internal error in `{cmd}`: {msg} (the document was left as it was before; please report this bug) interna greška u `{cmd}`: {msg} (dokument je ostao kakav je bio; molimo prijavite ovu grešku) +@msg internal error: {msg} (please report this bug) interna greška: {msg} (molimo prijavite ovu grešku) +@msg invalid PDF setting: {0} nevažeća PDF postavka: {0} +@msg invalid image data for `{0}` nevažeći podaci slike za `{0}` +@msg invalid parameters for `{cmd}`: {msg} nevažeći parametri za `{cmd}`: {msg} +@msg is not an image VectorCraft reads nije slika koju VectorCraft čita +@msg it uses `{at}`, which VectorCraft's PostScript reader doesn't know koristi `{at}`, što PostScript čitač VectorCrafta ne poznaje +@msg it uses `{at}`, which VectorCraft's PostScript reader doesn't know, in {procs} koristi `{at}`, što PostScript čitač VectorCrafta ne poznaje, u {procs} +@msg its Windows metafile preview was opened instead, which may simplify the art umjesto nje otvoren je njen Windows metafile pregled, što može pojednostaviti crtež +@msg its preview was placed instead, at screen resolution umjesto nje postavljen je njen pregled, u rezoluciji ekrana +@msg join needs open paths spajanje zahtijeva otvorene putanje +@msg lang must be one of {_1} lang mora biti jedno od {_1} +@msg layers can't be wrap objects slojevi ne mogu biti objekti omotavanja +@msg missing `folder` nedostaje `folder` +@msg missing `id` (see plugin.list) nedostaje `id` (vidi plugin.list) +@msg missing `name` nedostaje `name` +@msg missing `tool` nedostaje `tool` +@msg missing id nedostaje id +@msg missing index nedostaje indeks +@msg missing number `{key}` nedostaje broj `{key}` +@msg missing integer `{key}` nedostaje cijeli broj `{key}` +@msg New Window isn't available yet: a document opens in one window Novi prozor još nije dostupan: dokument se otvara u jednom prozoru +@msg name the file imenujte datoteku +@msg no CSS to copy: select objects with CSS of their own nema CSS-a za kopiranje: odaberite objekte s vlastitim CSS-om +@msg no Live Paint edge near that point nema ivice živog bojenja blizu te tačke +@msg no Live Paint face at that point nema lica živog bojenja na toj tački +@msg no PNG encoder nema PNG kodera +@msg no active document nema aktivnog dokumenta +@msg no active perspective plane nema aktivne ravni perspektive +@msg no anchor points selected nisu odabrane sidrene tačke +@msg no app to open files here ovdje nema aplikacije za otvaranje datoteka +@msg no artboard nema radne ploče +@msg no artboard {i} (0-based; the document has {_1}) nema radne ploče {i} (od 0; dokument ima {_1}) +@msg no artboard {i} (0-based; the document has {count}) nema radne ploče {i} (od 0; dokument ima {count}) +@msg no artboards named nisu navedene radne ploče +@msg no artwork nema crteža +@msg no blend options nema opcija stapanja +@msg no bounds nema granica +@msg no brush named `{name}` nema četkice pod nazivom `{name}` +@msg a bristle brush name can have at most {max} characters: `{name}` has {count} naziv četkice s čekinjama može imati najviše {max} znakova: `{name}` ima {count} +@msg no brush selected nije odabrana četkica +@msg brushes move only within their type četkice se pomjeraju samo unutar svoje vrste +@msg no catalog nema kataloga +@msg no changes since the last save nema promjena od posljednjeg čuvanja +@msg no clock to keep a heartbeat by nema sata za otkucaje +@msg no colour group `{g}` nema grupe boja `{g}` +@msg no cross-reference table nema tabele unakrsnih referenci +@msg no current layer nema trenutnog sloja +@msg no data nema podataka +@msg no dialog open nijedan dijalog nije otvoren +@msg the open dialog has no Reset otvoreni dijalog nema Vrati +@msg no document nema dokumenta +@msg no document open nijedan dokument nije otvoren +@msg no effect applied yet još nije primijenjen nijedan efekat +@msg no effect at index {k} nema efekta na indeksu {k} +@msg no end record nema završnog zapisa +@msg no file manager here ovdje nema upravitelja datoteka +@msg no file reader nema čitača datoteka +@msg no file system here ovdje nema datotečnog sistema +@msg no file writer nema zapisivača datoteka +@msg no files to place nema datoteka za postavljanje +@msg `{file}` isn't a VectorCraft document, a PDF or a PDF-compatible .ai file `{file}` nije VectorCraft dokument, PDF niti .ai datoteka kompatibilna s PDF-om +@msg no format to export to nema formata za izvoz +@msg no free recovery area nema slobodnog područja za oporavak +@msg no gradient stop or freeform point is selected nije odabrana tačka gradijenta ni tačka slobodnog oblika +@msg no graphic style `{name}` nema grafičkog stila `{name}` +@msg no graphic style `{n}` nema grafičkog stila `{n}` +@msg no interaction in progress nema interakcije u toku +@msg no key object nema ključnog objekta +@msg no library `{key}` (see {list}) nema biblioteke `{key}` (vidi {list}) +@msg no native format nema izvornog formata +@msg no pages nema stranica +@msg no pattern `{name}` nema uzorka `{name}` +@msg no perspective grid preset named `{name}` nema predloška mreže perspektive pod nazivom `{name}` +@msg no plug-in {0} is installed nije instaliran dodatak {0} +@msg no plug-in {id} is installed nije instaliran dodatak {id} +@msg no point {i} (the gradient has {_1}) nema tačke {i} (gradijent ima {_1}) +@msg no preset editor nema uređivača predložaka +@msg no previous transform nema prethodne transformacije +@msg no print preset named `{base}` nema predloška štampanja pod nazivom `{base}` +@msg no print preset named `{name}` nema predloška štampanja pod nazivom `{name}` +@msg no print service nema usluge štampanja +@msg no revert command nema naredbe za vraćanje +@msg no saved PDF preset named `{name}` (built-in presets are read-only: start a new one from them) nema sačuvanog PDF predloška pod nazivom `{name}` (ugrađeni predlošci su samo za čitanje: započnite novi od njih) +@msg no saved preset named `{name}` nema sačuvane unaprijed postavljene vrijednosti `{name}` +@msg no saved preset named `{name}` to rename nema sačuvane unaprijed postavljene vrijednosti `{name}` za preimenovanje +@msg no saved presets nema sačuvanih predložaka +@msg no saved print preset named `{name}` ({DEFAULT_PRESET} is protected: start a new one from it) nema sačuvanog predloška štampanja pod nazivom `{name}` ({DEFAULT_PRESET} je zaštićen: započnite novi od njega) +@msg no saved profiles nema sačuvanih profila +@msg no saved selection recalled nije vraćen sačuvani odabir +@msg no saved selections nema sačuvanih odabira +@msg no saved themes nema sačuvanih tema +@msg no segment {segment} on line {line} nema segmenta {segment} na redu {line} +@msg no selected slice in the image: select slices, or save all of them nema odabranog isječka na slici: odaberite isječke ili sačuvajte sve +@msg no selection bounds nema granica odabira +@msg no slice selected nije odabran isječak +@msg no such action nema takve akcije +@msg no such anchor nema takvog sidra +@msg no such artboard nema takve radne ploče +@msg the artboard is locked radna ploča je zaključana +@msg no such document nema takvog dokumenta +@msg no such layer or object nema takvog sloja ili objekta +@msg no such object {0} nema objekta {0} +@msg no such perspective grid preset nema takvog predloška mreže perspektive +@msg no such recent file nema takve nedavne datoteke +@msg no such recent font nema takvog nedavnog fonta +@msg no such saved selection nema takvog sačuvanog odabira +@msg no such segment nema takvog segmenta +@msg no such spine point nema takve tačke kičme +@msg no such spine segment nema takvog segmenta kičme +@msg no such subpath nema takve podputanje +@msg no such user library nema takve korisničke biblioteke +@msg no such view nema takvog pogleda +@msg no such width point nema takve tačke širine +@msg no swatch `{name}` nema uzorka boje `{name}` +@msg no swatch library `{l}` (see swatch.library.list) nema biblioteke uzoraka boja `{l}` (vidi swatch.library.list) +@msg no symbol instances selected nisu odabrane instance simbola +@msg no target object has an opacity mask: select one or give `id` nijedan ciljni objekat nema masku neprozirnosti: odaberite jedan ili navedite `id` +@msg no threaded text selected nije odabran povezani tekst +@msg no user library folder here ovdje nema foldera korisničke biblioteke +@msg no user workspace `{from}` nema korisničkog radnog prostora `{from}` +@msg node {_1} is not text čvor {_1} nije tekst +@msg not a DXF drawing nije DXF crtež +@msg not a VectorCraft file: {0} nije VectorCraft datoteka: {0} +@msg not a VectorCraft shortcut set (missing `overrides`) nije VectorCraft skup prečica (nedostaje `overrides`) +@msg not a blend nije stapanje +@msg not a graphic style library (format `{_1}`) nije biblioteka grafičkih stilova (format `{_1}`) +@msg not a stored central record nije sačuvani centralni zapis +@msg not a valid plug-in module: {0} nije važeći modul dodatka: {0} +@msg not an EMF or WMF file nije EMF ni WMF datoteka +@msg not found nije pronađeno +@msg not in pattern editing mode nije u načinu uređivanja uzorka +@msg finish editing the pattern first prvo završite uređivanje uzorka +@msg nothing encoded ništa nije kodirano +@msg nothing selected ništa nije odabrano +@msg nothing selected is in a group ništa odabrano nije u grupi +@msg nothing to align nema ničeg za poravnanje +@msg nothing to distort nema ničeg za izobličenje +@msg nothing to export: the document has no visible art (or turn on Use Artboards) nema ničeg za izvoz: dokument nema vidljiv crtež (ili uključite Koristi radne ploče) +@msg nothing to preview nema ničeg za pregled +@msg nothing to print nema ničeg za štampanje +@msg nothing to redo nema ničeg za ponavljanje +@msg nothing to save: the document has no visible art nema ničeg za čuvanje: dokument nema vidljiv crtež +@msg nothing to undo nema ničeg za poništavanje +@msg no history to clear nema historije za brisanje +@msg nothing to warp nema ničeg za iskrivljenje +@msg nothing to wrap nema ničeg za omotavanje +@msg object {0} cannot have children objekat {0} ne može imati djecu +@msg object {id} is not a path objekat {id} nije putanja +@msg object {id} is not a selected top-level object objekat {id} nije odabrani objekat najvišeg nivoa +@msg page size {w} × {h} veličina stranice {w} × {h} +@msg page {0} does not exist (the PDF has {1}) stranica {0} ne postoji (PDF ima {1}) +@msg thumbnail: no page {n} (the file has 1) sličica: nema stranice {n} (datoteka ima 1) +@msg paste unavailable lijepljenje nije dostupno +@msg path is already closed putanja je već zatvorena +@msg paths contain invalid coordinates putanje sadrže nevažeće koordinate +@msg paths: give at least one file paths: navedite barem jednu datoteku +@msg replace: the object to replace was changed or deleted replace: objekat za zamjenu je promijenjen ili izbrisan +@msg pattern missing uzorak nedostaje +@msg patterns nested too deeply are filled with mid-grey previše duboko ugniježđeni uzorci ispunjavaju se srednje sivom +@msg percent must be above 0 and at most 6400, not {p} postotak mora biti iznad 0 i najviše 6400, a ne {p} +@msg pick a colour, gradient or pattern to save as a swatch odaberite boju, gradijent ili uzorak za čuvanje kao uzorak boje +@msg plane must be left, right or ground plane mora biti left, right ili ground +@msg plug-in ABI: {0} ABI dodatka: {0} +@msg plug-in exceeded its {0} dodatak je premašio svoje {0} +@msg plug-in failed: {0} dodatak nije uspio: {0} +@msg plug-in manifest: {0} manifest dodatka: {0} +@msg plug-in output: {0} izlaz dodatka: {0} +@msg plug-in parameters: {0} parametri dodatka: {0} +@msg plug-in trapped: {0} dodatak je zaustavljen: {0} +@msg print settings are not an object postavke štampanja nisu objekat +@msg printing isn't available here štampanje ovdje nije dostupno +@msg range `{s}` is empty raspon `{s}` je prazan +@msg range `{s}`: `{part}` names no number raspon `{s}`: `{part}` ne navodi broj +@msg range `{s}`: `{part}` runs backwards raspon `{s}`: `{part}` ide unazad +@msg range `{s}`: `{t}` is not a number from 1 to {count} raspon `{s}`: `{t}` nije broj od 1 do {count} +@msg recovery copy `{file}`: {e} kopija za oporavak `{file}`: {e} +@msg resolutions must be between 1 and 2400 ppi rezolucije moraju biti između 1 i 2400 ppi +@msg result would exceed the canvas (coordinates out of range) rezultat bi premašio platno (koordinate izvan raspona) +@msg objects can't be nested more than 32 deep objekti ne mogu biti ugniježđeni dublje od 32 nivoa +@msg the SVG's elements are nested more than {0} deep elementi SVG-a ugniježđeni su dublje od {0} nivoa +@msg scale must be a number from {_1} to {_2}, not {_3} skala mora biti broj od {_1} do {_2}, a ne {_3} +@msg scale must be a number from {_1} to {_2}, not {s} skala mora biti broj od {_1} do {_2}, a ne {s} +@msg select (or target) objects whose appearance isn't basic odaberite (ili ciljajte) objekte čiji izgled nije osnovni +@msg select a Live Paint group odaberite grupu živog bojenja +@msg select a blend odaberite stapanje +@msg select a blend or give `id` odaberite stapanje ili navedite `id` +@msg select a clip group odaberite grupu isijecanja +@msg select a gradient mesh odaberite gradijentnu mrežu +@msg select a linked image: an embedded one has no file odaberite povezanu sliku: ugrađena nema datoteku +@msg select a repeat odaberite ponavljanje +@msg select an Intertwine group odaberite Intertwine grupu +@msg select an Objects on Path group odaberite grupu objekata na putanji +@msg a path inside a compound path, blend, envelope, repeat or Intertwine group can't take objects putanja unutar složene putanje, stapanja, omotnice, ponavljanja ili Intertwine grupe ne može primiti objekte +@msg a clipping path can't take objects putanja isijecanja ne može primiti objekte +@msg objects inside a blend, envelope, repeat or Intertwine group can't be attached to a path objekti unutar stapanja, omotnice, ponavljanja ili Intertwine grupe ne mogu se priložiti putanji +@msg a clipping path can't be attached to a path putanja isijecanja ne može se priložiti putanji +@msg select a stroke with a variable width odaberite potez s promjenjivom širinom +@msg select a symbol instance odaberite instancu simbola +@msg select an Image Trace object odaberite objekat praćenja slike +@msg could not decode image: {0} nije moguće dekodirati sliku: {0} +@msg image is empty slika je prazna +@msg the image is {width} × {height} pixels, more than Image Trace takes ({max} megapixels) slika ima {width} × {height} piksela, više nego što praćenje slike prima ({max} megapiksela) +@msg this trace would make more than {max} anchor points, more than the document can show smoothly: raise Noise, lower Paths or Colors, or pick a lower-fidelity preset ovo praćenje bi napravilo više od {max} sidrenih tačaka, više nego što dokument može glatko prikazati: povećajte Šum, smanjite Putanje ili Boje ili odaberite predložak niže vjernosti +@msg select an envelope odaberite omotnicu +@msg select an image odaberite sliku +@msg select an object in perspective odaberite objekat u perspektivi +@msg select artwork (or a colour group) to recolor odaberite crtež (ili grupu boja) za ponovno bojenje +@msg select at least two objects odaberite barem dva objekta +@msg exit isolation mode first prvo izađite iz načina izolacije +@msg select objects, not layers odaberite objekte, a ne slojeve +@msg select one path, or give its `id` odaberite jednu putanju ili navedite njen `id` +@msg select paths to join odaberite putanje za spajanje +@msg select the art to repeat odaberite crtež za ponavljanje +@msg select the artwork to warp odaberite crtež za iskrivljenje +@msg select the objects to transform in perspective odaberite objekte za transformisanje u perspektivi +@msg select two or more graphic styles to merge odaberite dva ili više grafičkih stilova za spajanje +@msg select type in perspective odaberite tekst u perspektivi +@msg selection has no bounds odabir nema granice +@msg shadings of an unknown type were left out izostavljena su sjenčenja nepoznate vrste +@msg shadings of more than 4096 patches or triangles were left out izostavljena su sjenčenja s više od 4096 zakrpa ili trouglova +@msg shadings whose functions are of an unknown type are filled with their middle colour sjenčenja čije su funkcije nepoznate vrste ispunjavaju se njihovom srednjom bojom +@msg shortcut for `{k}` must be a string prečica za `{k}` mora biti niz znakova +@msg stop {i} needs `offset` tačka {i} treba `offset` +@msg stop {i} needs a valid `color` tačka {i} treba važeću `color` +@msg stop {i}: `{k}` must be a number tačka {i}: `{k}` mora biti broj +@msg t, dx and dy must be finite t, dx i dy moraju biti konačni +@msg the EMF header is damaged EMF zaglavlje je oštećeno +@msg the PDF has no pages PDF nema stranica +@msg the PDF is no longer loaded PDF više nije učitan +@msg the PDF is password-protected: give its password PDF je zaštićen lozinkom: navedite njegovu lozinku +@msg the PDF password is wrong PDF lozinka je pogrešna +@msg the Save PDF dialog didn't open dijalog Sačuvaj PDF se nije otvorio +@msg the WMF header is damaged WMF zaglavlje je oštećeno +@msg the art could not be sampled crtež nije moguće uzorkovati +@msg the art has no bounds crtež nema granice +@msg the art is too light for any dots crtež je previše svijetao za bilo kakve tačke +@msg the artboard to fit must be a positive size up to {_1} pt radna ploča za uklapanje mora imati pozitivnu veličinu do {_1} pt +@msg the background worker stopped pozadinski proces se zaustavio +@msg the blend has no spine stapanje nema kičmu +@msg the compressed file unpacks to more than {_1} MB komprimirana datoteka se raspakuje na više od {_1} MB +@msg the document has never been saved dokument nikad nije sačuvan +@msg the document has no artboard dokument nema radnu ploču +@msg the document has no artboards dokument nema radne ploče +@msg the document has no patterns dokument nema uzoraka +@msg the document has no slices dokument nema isječaka +@msg the document has no symbols dokument nema simbola +@msg the drawing has no layout `{_1}` (it has {_2}) crtež nema raspored `{_1}` (ima {_2}) +@msg the drawing is no longer loaded crtež više nije učitan +@msg the drawing is too large to open crtež je prevelik za otvaranje +@msg the export region is empty područje izvoza je prazno +@msg the export region is not finite područje izvoza nije konačno +@msg the export returned unreadable data izvoz je vratio nečitljive podatke +@msg the export wrote no file izvoz nije zapisao datoteku +@msg the file holds only a placeholder page, not its art (it was saved without PDF compatibility): save it again with PDF compatibility on, or as PDF or SVG datoteka sadrži samo zamjensku stranicu, a ne svoj crtež (sačuvana je bez PDF kompatibilnosti): ponovo je sačuvajte s uključenom PDF kompatibilnošću ili kao PDF ili SVG +@msg the file was read up to an error ({why}): what follows it was left out datoteka je pročitana do greške ({why}): ono što slijedi je izostavljeno +@msg the file's preview header points outside the file zaglavlje pregleda datoteke pokazuje izvan datoteke +@msg the image's pixels don't match its size pikseli slike ne odgovaraju njenoj veličini +@msg the layer has no objects to clip by sloj nema objekata za isijecanje +@msg the layer or group is locked sloj ili grupa je zaključan +@msg the guide is on a hidden or locked layer vodilica je na skrivenom ili zaključanom sloju +@msg the target layer is locked or hidden ciljni sloj je zaključan ili skriven +@msg the object is hidden or locked objekat je skriven ili zaključan +@msg the object is outside the isolated group objekat je izvan izolovane grupe +@msg type objects can't be isolated tekstualni objekti se ne mogu izolovati +@msg the layer to flatten into is hidden sloj u koji se spljoštava je skriven +@msg the object already has an opacity mask objekat već ima masku neprozirnosti +@msg the object has no geometry objekat nema geometriju +@msg the object has no opacity mask objekat nema masku neprozirnosti +@msg stop editing the opacity mask first prvo prestanite uređivati masku neprozirnosti +@msg the object has no stroke objekat nema potez +@msg the object is beyond the plane's horizon objekat je iza horizonta ravni +@msg the object isn't in perspective objekat nije u perspektivi +@msg the object isn't on a perspective plane objekat nije na ravni perspektive +@msg the object would cross the horizon of the perspective plane objekat bi prešao horizont ravni perspektive +@msg the objects would leave the grid objekti bi napustili mrežu +@msg the package came back damaged paket se vratio oštećen +@msg the pointer is beyond the plane's horizon pokazivač je iza horizonta ravni +@msg the preview image is empty slika pregleda je prazna +@msg the print job has no data zadatak štampanja nema podataka +@msg the scale is not a usable number skala nije upotrebljiv broj +@msg the selected stroke's profile is already listed as {_1} profil odabranog poteza već je naveden kao {_1} +@msg the selection has no URL (or they differ) odabir nema URL (ili se razlikuju) +@msg the selection isn't in perspective odabir nije u perspektivi +@msg the spine has no segments kičma nema segmenata +@msg the stroke has no weight potez nema debljinu +@msg the thumbnail image is malformed slika sličice je neispravna +@msg the top object must be a path, compound path or text object to use as a clipping mask gornji objekat mora biti putanja, složena putanja ili tekstualni objekat da bi se koristio kao maska isijecanja +@msg the {tool} tool has no options alat {tool} nema opcija +@msg there are no objects to release nema objekata za oslobađanje +@msg there are no printer settings to open here ovdje nema postavki štampača za otvaranje +@msg this PostScript file can't be read ({why}): save it as PDF or SVG in the app that made it ova PostScript datoteka se ne može pročitati ({why}): sačuvajte je kao PDF ili SVG u aplikaciji koja ju je napravila +@msg this file's PostScript couldn't be read ({why}): {what} PostScript ove datoteke nije moguće pročitati ({why}): {what} +@msg this format holds one artboard: export several as PDF or with document.exportForScreens ovaj format sadrži jednu radnu ploču: izvezite više njih kao PDF ili pomoću document.exportForScreens +@msg this is a DWG drawing, which can't be read: save it from the CAD app as an ASCII DXF and open that ovo je DWG crtež, koji se ne može čitati: sačuvajte ga iz CAD aplikacije kao ASCII DXF i otvorite taj +@msg this is a PostScript file (an .ai saved in an older format or without PDF compatibility, or an EPS file), not a PDF: File › Open and File › Place read it as EPS ovo je PostScript datoteka (.ai sačuvan u starijem formatu ili bez PDF kompatibilnosti, ili EPS datoteka), a ne PDF: Datoteka › Otvori i Datoteka › Postavi čitaju je kao EPS +@msg this is not a PostScript file ovo nije PostScript datoteka +@msg tool shortcuts must be a single key (optionally with Shift) prečice alata moraju biti jedna tipka (po želji sa Shiftom) +@msg truncated skraćeno +@msg unknown command `{0}` nepoznata naredba `{0}` +@msg unknown command `{0}`; did you mean `{1}`? nepoznata naredba `{0}`; da li ste mislili `{1}`? +@msg unknown effect `{id}` nepoznat efekat `{id}` +@msg unknown format nepoznat format +@msg unknown format `{f}` (Save writes {_1}) nepoznat format `{f}` (Sačuvaj zapisuje {_1}) +@msg unknown freeform mode `{m}` (points, lines) nepoznat način slobodnog oblika `{m}` (points, lines) +@msg unknown gradient kind `{k}` (linear, radial, freeform) nepoznata vrsta gradijenta `{k}` (linear, radial, freeform) +@msg unknown highlight `{h}` nepoznato isticanje `{h}` +@msg unknown option `{path}.{k}` nepoznata opcija `{path}.{k}` +@msg unknown overprints `{o}` (preserve, simulate or discard) nepoznati pretisci `{o}` (preserve, simulate ili discard) +@msg unknown panel `{raw}` nepoznat panel `{raw}` +@msg unknown preference `{key}` nepoznata postavka `{key}` +@msg unknown preset (one of {_1}) nepoznat predložak (jedan od {_1}) +@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) nepoznat predložak `{name}` (high, medium, low ili sačuvani: vidi flattener.presets.list) +@msg unknown preset `{name}` (see flattener.presets.list) nepoznat predložak `{name}` (vidi flattener.presets.list) +@msg unknown preset `{name}` (see webExport.presets.list) nepoznat predložak `{name}` (vidi webExport.presets.list) +@msg unknown preset `{name}`: not a built-in or saved preset (see imageTrace.presets) nepoznata unaprijed postavljena vrijednost `{name}`: nije ugrađena niti sačuvana (pogledajte imageTrace.presets) +@msg unknown side `{other}` (left|right|top|bottom) nepoznata strana `{other}` (left|right|top|bottom) +@msg unknown tool `{tool}` nepoznat alat `{tool}` +@msg unknown tool `{t}` nepoznat alat `{t}` +@msg unknown tool or command `{key}` nepoznat alat ili naredba `{key}` +@msg unknown workspace (one of {_1}) nepoznat radni prostor (jedan od {_1}) +@msg unsupported: {0} nepodržano: {0} +@msg variables are locked varijable su zaključane +@msg variables that aren't text were left out: {kinds} izostavljene su varijable koje nisu tekst: {kinds} +@msg `{key}: {top}` and `options.{key}: {inner}` disagree: give the option once `{key}: {top}` i `options.{key}: {inner}` se ne slažu: navedite opciju jednom +@msg version {0} files can't be compressed: only version {COMPRESSED_SINCE} and later open compressed files datoteke verzije {0} ne mogu se komprimirati: komprimirane datoteke otvaraju samo verzija {COMPRESSED_SINCE} i novije +@msg width and height are at least 1 pixel širina i visina su najmanje 1 piksel +@msg workspace name can't be empty naziv radnog prostora ne može biti prazan +@msg x and y must be finite x i y moraju biti konačni +@msg {C}: no effect at index {from} {C}: nema efekta na indeksu {from} +@msg {_1} failed: {e} {_1} nije uspjelo: {e} +@msg {_1} files can be opened but not written (see document.formats) {_1} datoteke mogu se otvoriti, ali ne i zapisati (vidi document.formats) +@msg {_1} files are written by file.saveAsTemplate {_1} datoteke zapisuje file.saveAsTemplate +@msg {_1} font families available Dostupno porodica fontova: {_1} +@msg {_1} is a live effect (Effect › Plug-ins) {_1} je živi efekat (Efekat › Dodaci) +@msg {_1} is an exporter (File › Export › Export As…) {_1} je izvoznik (Datoteka › Izvezi › Izvezi kao…) +@msg `documentData` is {size} bytes (limit {MAX_DOCUMENT_DATA}) `documentData` ima {size} bajtova (ograničenje {MAX_DOCUMENT_DATA}) +@msg {_1} is already used by {_2} {_1} već koristi {_2} +@msg {_1} is reserved by the system {_1} je rezervisano od strane sistema +@msg {_1} linked file(s) can't be read here: their previews show Povezane datoteke koje se ovdje ne mogu pročitati: {_1}; prikazuju se njihovi pregledi +@msg {undecoded} image(s) couldn't be decoded and show as crossed boxes Slike koje nije moguće dekodirati prikazuju se kao prekriženi okviri ({undecoded}) +@msg {_1} linked image(s) changed on disk: Update Links shows the new versions Povezane slike promijenjene na disku: {_1}; Ažuriraj veze prikazuje nove verzije +@msg {_1}: not saved, so not closed {_1}: nije sačuvano, pa nije zatvoreno +@msg {bpp}-bit bitmaps can't be read {bpp}-bitne bitmape ne mogu se pročitati +@msg {command} didn't create an object {command} nije kreirala objekat +@msg {label} produced an empty result {label} je dao prazan rezultat +@msg {label}: lost track of a shape's style {label}: izgubljen je trag stila oblika +@msg {label}: select paths {label}: odaberite putanje +@msg {label}: select paths, compound paths, groups or text {label}: odaberite putanje, složene putanje, grupe ili tekst +@msg {label}… {label}… +@msg {name}: CRC mismatch {name}: CRC se ne podudara +@msg {name}: no local header {name}: nema lokalnog zaglavlja +@msg {name}: no such recovery entry {name}: nema takvog unosa za oporavak +@msg {path} can't be found: relink it first {path} nije moguće pronaći: prvo ga ponovo povežite +@msg {path}: no file system here (pass dataBase64 to open; omit the path to get dataBase64) {path}: ovdje nema datotečnog sistema (proslijedite dataBase64 za otvaranje; izostavite putanju da dobijete dataBase64) +@msg {path}: not a file {path}: nije datoteka +@msg {path}: {e} {path}: {e} +@msg {status} ({e}) {status} ({e}) +@msg Couldn't place {name}: {e} Nije moguće postaviti {name}: {e} +@msg Couldn't paste from the clipboard: {e} Nije moguće zalijepiti iz međuspremnika: {e} +@msg Saved {path} with {_1} note(s): {first} Sačuvano {path} s bilješkama ({_1}): {first} +@msg Exported {what} with {_1} note(s): {first} Izvezeno {what} s bilješkama ({_1}): {first} +@msg Exported {what} Izvezeno: {what} +@msg Saved {n} files beside {path} Sačuvano datoteka pored {path}: {n} +@msg Saving Čuvanje +@msg Saving {_1} Čuvanje {_1} +@msg Exporting {_1} Izvoz {_1} +@msg Packaging {_1} Pakovanje {_1} +@msg Placing {_1} Postavljanje {_1} +@msg Saving recovery data for {_1} Čuvanje podataka za oporavak za {_1} +@msg Discarded {_1} recovered document(s) Odbačeno oporavljenih dokumenata: {_1} +@msg Restored {_1} recovered document(s): save them to keep them Vraćeno oporavljenih dokumenata: {_1}; sačuvajte ih da ih zadržite +@msg Embedded {n} image(s); {missing} missing: relink them first Ugrađeno slika: {n}; nedostaje {missing}: prvo ih ponovo povežite +@msg Embedded {n} image(s) Ugrađeno slika: {n} +@msg Relinked {_1} image(s) Ponovo povezano slika: {_1} +@msg Relinked {n} image(s) Ponovo povezano slika: {n} +@msg Relinked {n} image(s); not in that folder: {_1} Ponovo povezano slika: {n}; nisu u tom folderu: {_1} +@msg Updated {_1} image(s) Ažurirano slika: {_1} +@msg Unembedded to {_1} Ugrađivanje poništeno u {_1} +@msg Reset {_1} Vrati na početno: {_1} +@msg Sent to {_1} Poslano na {_1} +@msg {_1} files {_1} datoteke +@msg The graphics were lost and have been restarted Grafika je izgubljena i ponovo je pokrenuta +@msg The graphics processor tried first couldn't show the window, so VectorCraft started again on {summary} Grafički procesor koji je prvi pokušan nije mogao prikazati prozor, pa se VectorCraft ponovo pokrenuo na {summary} +@msg The last start of VectorCraft ended on {name} before its window appeared, so it started on {summary}. To try that graphics processor again, change Preferences › Performance › Graphics Processor or start with WGPU_BACKEND set Posljednje pokretanje VectorCrafta završilo je na {name} prije nego što se pojavio prozor, pa je pokrenut na {summary}. Da ponovo pokušate taj grafički procesor, promijenite Postavke › Performanse › Grafički procesor ili pokrenite s postavljenim WGPU_BACKEND +@msg The last start of VectorCraft ended while it listed the graphics processors, so it started on {summary} with OpenGL alone. To try the other graphics backends again, change Preferences › Performance › Graphics Processor or start with WGPU_BACKEND set Posljednje pokretanje VectorCrafta završilo je dok je izlistavao grafičke procesore, pa je pokrenut na {summary} samo s OpenGL-om. Da ponovo pokušate druge grafičke pozadinske sisteme, promijenite Postavke › Performanse › Grafički procesor ili pokrenite s postavljenim WGPU_BACKEND +@msg Loading VectorCraft… Učitavanje VectorCrafta… +@msg VectorCraft failed to start: {e} VectorCraft se nije uspio pokrenuti: {e} +@msg A browser with WebGPU or WebGL2 is required. Potreban je preglednik s WebGPU ili WebGL2. +@msg The graphics were lost and couldn't be restarted. Grafika je izgubljena i nije je moguće ponovo pokrenuti. +@msg Your unsaved changes are kept in this browser: reload the page to get them back. Vaše nesačuvane promjene čuvaju se u ovom pregledniku: ponovo učitajte stranicu da ih vratite. +@msg Reload the page to go on (changes not saved yet may be lost). Ponovo učitajte stranicu da nastavite (još nesačuvane promjene mogu biti izgubljene). +@msg tool (a tool id) is required tool (ID alata) je obavezan +@msg {tool} isn't in a toolbar group of several tools {tool} nije u grupi trake s alatima s više alata +@msg onto must name a panel floating in another group onto mora navesti panel koji pluta u drugoj grupi +@msg below and above must name a panel floating in another group below i above moraju navesti panel koji pluta u drugoj grupi +@msg give only one of onto, below and above navedite samo jedno od onto, below i above +@msg column must be true or a number from 1 column mora biti true ili broj od 1 +@msg x and y must both be numbers x i y moraju oba biti brojevi +@msg "{0}" is not a colour: write it as #rrggbb "{0}" nije boja: napišite je kao #rrggbb +@msg this isn't a flat-colour logo ({_1}% of its solid areas match a few flat colours), so Flat Logo mode would turn its gradients into patches: use Color mode instead ovo nije logotip s ravnim bojama ({_1}% njegovih punih područja odgovara nekolicini ravnih boja), pa bi način Ravni logotip pretvorio njegove gradijente u zakrpe: umjesto toga koristite način Boja +@msg `{what}` closes nothing `{what}` ne zatvara ništa +@msg `{what}` closes something it didn't open `{what}` zatvara nešto što nije otvorio +@msg a path has too many points putanja ima previše tačaka +@msg it ends inside a layer završava unutar sloja +@msg it has art outside its layers ima crtež izvan svojih slojeva +@msg it has more than {MAX_NODES} objects ima više od {MAX_NODES} objekata +@msg it has no layers nema slojeva +@msg it has too many values in a row ima previše vrijednosti u redu +@msg it has {_1}, which VectorCraft doesn't read from it yet sadrži {_1}, što VectorCraft još ne čita iz nje +@msg its objects are nested too deeply njeni objekti su previše duboko ugniježđeni +@msg its section ending with `%{end}` doesn't end njen odjeljak koji završava s `%{end}` ne završava +@msg objects with several fills or strokes, effects or brushes came in as their drawn look ({_1}): their appearance isn't editable yet objekti s više ispuna ili poteza, efekata ili četkica stigli su kao njihov iscrtani izgled ({_1}): njihov izgled se još ne može uređivati +@msg gradient “{name}” isn't defined in the file: a plain colour stands in for it gradijent „{name}” nije definisan u datoteci: umjesto njega koristi se obična boja +@msg an image VectorCraft can't read was left out izostavljena je slika koju VectorCraft ne može pročitati +@msg an image whose data is cut short was left out izostavljena je slika čiji su podaci skraćeni +@msg linked pictures show the low-resolution preview saved in the file until their files are found: relink them in the Links panel povezane slike prikazuju pregled niske rezolucije sačuvan u datoteci dok se njihove datoteke ne pronađu: ponovo ih povežite u panelu Veze +@msg area type in frames too short for a line of the font it shows in got taller frames ({_1}): their type wouldn't show otherwise tekst u području u okvirima prekratkim za red fonta u kojem se prikazuje dobio je više okvire ({_1}): inače se tekst ne bi prikazao +@msg its editing data doesn't say where its art is njeni podaci za uređivanje ne govore gdje joj je crtež +@msg this file was saved without PDF compatibility, and its editing data can't be read ({why}) ova datoteka je sačuvana bez PDF kompatibilnosti, a njeni podaci za uređivanje se ne mogu pročitati ({why}) +@msg No fonts are missing in this document U ovom dokumentu ne nedostaje nijedan font +@msg VectorCraft doesn't search other apps' or the system's folders: {path} VectorCraft ne pretražuje foldere drugih aplikacija ni sistemske foldere: {path} +@msg VectorCraft doesn't search the Shared or Public folder in Users: {path} VectorCraft ne pretražuje folder Shared ili Public u Users: {path} +@msg {path} is not a folder {path} nije folder +@msg the search couldn't start: try again in a moment pretraga nije mogla početi: pokušajte ponovo za trenutak +@msg searching a folder isn't available on the web pretraživanje foldera nije dostupno na webu +@msg every search thread stopped on an internal error (please report this bug) sve niti pretrage su se zaustavile zbog interne greške (molimo prijavite ovu grešku) +@msg VectorCraft's Fonts folder isn't set here: the desktop app and vectorcraft-cli set it Folder Fontovi VectorCrafta ovdje nije postavljen: postavljaju ga desktop aplikacija i vectorcraft-cli +@msg choose the font files to add odaberite datoteke fontova za dodavanje +@msg {n} font file(s) are now in {folder} Datoteke fontova ({n}) sada su u {folder} +@msg {n} font file(s) are now in {folder}; {failed} couldn't be added: {reason} Datoteke fontova ({n}) sada su u {folder}; {failed} nije moguće dodati: {reason} +@msg {n} font(s) aren't available here: their text shows in another font Fontovi koji ovdje nisu dostupni: {n}; njihov tekst se prikazuje drugim fontom +@msg not a file nije datoteka +@msg not a font file nije datoteka fonta +@msg that document is no longer open taj dokument više nije otvoren +@msg larger than 256 MB veće od 256 MB +@msg the files come to more than 1 GB: add fewer at a time datoteke zajedno prelaze 1 GB: dodajte ih manje odjednom +@msg every numbered name for it is taken in the Fonts folder svi numerisani nazivi za njega su zauzeti u folderu Fontovi +@msg every numbered name for {name} is taken in the document's folder svi numerisani nazivi za {name} su zauzeti u folderu dokumenta +@msg No linked files to look for Nema povezanih datoteka za traženje +@msg Relinked {n} image(s); {name} couldn't be relinked: {reason} Ponovo povezano slika: {n}; {name} nije moguće ponovo povezati: {reason} +@msg `id` is the step reference {r}, which only `run` and `command_batch` resolve `id` je referenca na korak {r}, koju razrješavaju samo `run` i `command_batch` +@msg `ids` must be an array of object ids, not {v} `ids` mora biti niz ID-ova objekata, a ne {v} +@msg `corners` must be an array of anchor indices, not {v} `corners` mora biti niz indeksa sidara, a ne {v} +@msg `{text}`: step {i}'s result has no such value (write $$ for a literal $) `{text}`: rezultat koraka {i} nema takvu vrijednost (napišite $$ za doslovni $) +@msg `{text}`: there is no step {i} before this one (steps count from 0; write $$ for a literal $) `{text}`: prije ovog nema koraka {i} (koraci se broje od 0; napišite $$ za doslovni $) +@msg object ids are non-negative integers, not {v} ID-ovi objekata su nenegativni cijeli brojevi, a ne {v} +@msg {key} must be an array of non-negative integer object ids {key} mora biti niz nenegativnih cjelobrojnih ID-ova objekata +@msg invalid object id {value}: expected a non-negative integer nevažeći ID objekta {value}: očekuje se nenegativan cijeli broj +@msg no such object id {value} nema objekta s ID-om {value} +@msg id {value} is a layer, not an object id {value} je sloj, a ne objekat +@msg id {value} is a layer, not an object; move layers with layer.move id {value} je sloj, a ne objekat; slojeve pomjerajte s layer.move +@msg automation filesystem access is not granted: read authority is absent: {path} pristup datotečnom sistemu za automatizaciju nije odobren: nema ovlaštenja za čitanje: {path} +@msg automation filesystem access is not granted: write authority is absent: {path} pristup datotečnom sistemu za automatizaciju nije odobren: nema ovlaštenja za pisanje: {path} +@msg automation path rejected: outside the read root {root}: {path} putanja automatizacije odbijena: izvan korijena za čitanje {root}: {path} +@msg automation path rejected: outside the read roots {roots}: {path} putanja automatizacije odbijena: izvan korijena za čitanje {roots}: {path} +@msg automation path rejected: outside the write root {root}: {path} putanja automatizacije odbijena: izvan korijena za pisanje {root}: {path} +@msg automation path rejected: outside the write roots {roots}: {path} putanja automatizacije odbijena: izvan korijena za pisanje {roots}: {path} +@msg automation path rejected: path is empty putanja automatizacije odbijena: putanja je prazna +@msg automation path rejected: a link that leads nowhere: {path} putanja automatizacije odbijena: veza koja ne vodi nikuda: {path} +@msg automation path rejected: cannot resolve {path}: {e} putanja automatizacije odbijena: nije moguće razriješiti {path}: {e} +@msg automation path rejected: parent traversal below a folder that doesn't exist: {path} putanja automatizacije odbijena: prelazak na nadređeni ispod foldera koji ne postoji: {path} +@msg automation path rejected: reserved device names are not allowed: {path} putanja automatizacije odbijena: rezervisani nazivi uređaja nisu dozvoljeni: {path} +@msg Multichannel PSD files can't be read: save it in RGB, CMYK or Grayscale mode Višekanalne PSD datoteke se ne mogu čitati: sačuvajte je u RGB, CMYK ili načinu nijansi sive +@msg not a PSD file nije PSD datoteka +@msg the PSD file has an unknown colour mode ({m}) PSD datoteka ima nepoznat način boja ({m}) +@msg the PSD file's image data uses an unknown compression ({m}) podaci slike PSD datoteke koriste nepoznatu kompresiju ({m}) +@msg the PCX file is cut short PCX datoteka je skraćena +@msg the PCX file's header is damaged zaglavlje PCX datoteke je oštećeno +@msg PCX files with {bits}-bit pixels in {planes} planes can't be read PCX datoteke s {bits}-bitnim pikselima u {planes} ravni nije moguće pročitati +@msg the PSD image is too large to read ({_1} × {_2} pixels) PSD slika je prevelika za čitanje ({_1} × {_2} piksela) +@msg zipped 32-bit PSD image data with prediction can't be read zipovani 32-bitni PSD podaci slike s predviđanjem ne mogu se pročitati +@msg {depth}-bit PSD files in this colour mode can't be read {depth}-bitne PSD datoteke u ovom načinu boja ne mogu se pročitati +@msg the PSD file is cut short PSD datoteka je skraćena +@msg the PSD file's header is damaged zaglavlje PSD datoteke je oštećeno +@msg the PSD file's image data can't be read: {e} podaci slike PSD datoteke se ne mogu pročitati: {e} +@msg Imported library {name} Uvezena biblioteka {name} +@msg Invalid panel layout; restored the default dock Nevažeći raspored panela; vraćeno je zadano sidrište +@msg action is required akcija je obavezna +@msg anchor must name a registered panel anchor mora navesti registrovani panel +@msg before must name a panel before mora navesti panel +@msg docking action contains an unknown panel or an excessive split path akcija sidrenja sadrži nepoznat panel ili prekomjernu putanju podjele +@msg group must be true or false group mora biti true ili false +@msg panel is not in a dock group panel nije u grupi sidrišta +@msg only a dock group above or below others collapses, not one beside another skuplja se samo grupa sidrišta iznad ili ispod drugih, a ne ona pored druge +@msg icon must be true or false icon mora biti true ili false +@msg icon only docks a panel in the icon column, with no anchor icon samo usidrava panel u kolonu ikona, bez sidra +@msg column docks a set as a dock column, with no anchor or icon column usidrava skup kao kolonu sidrišta, bez sidra ili ikone +@msg move requires a destination panel move zahtijeva odredišni panel +@msg move requires an existing destination panel move zahtijeva postojeći odredišni panel +@msg onto must name a floating panel onto mora navesti plutajući panel +@msg panel group is empty grupa panela je prazna +@msg panel must name a registered panel panel mora navesti registrovani panel +@msg saved panel layout is invalid; reset the workspace first sačuvani raspored panela je nevažeći; prvo vratite radni prostor na početno +@msg zone must be a string zone mora biti niz znakova +@msg zone must be tab, center, left, right, top or bottom zone mora biti tab, center, left, right, top ili bottom +@msg {key} must be a finite coordinate {key} mora biti konačna koordinata +@msg x and y must be provided together x i y moraju se navesti zajedno +@msg invalid restored panel group nevažeća vraćena grupa panela +@msg invalid native panel set nevažeći izvorni skup panela +@msg missing panel layout nedostaje raspored panela +@msg unsupported native docking operation nepodržana izvorna operacija sidrenja +@msg this kind of brush has no options dialog yet ova vrsta četkice još nema dijalog opcija + Ruler Origin Ishodište ravnala + Reset Ruler Origin Vrati ishodište ravnala na početno + Column Width: Širina kolone: + Import Data… Uvezi podatke… + Number of Decimals: Broj decimala: + Switch x/y Zamijeni x/y + Transpose Transponuj + Phone 393×852 Telefon 393×852 + Phone 430×932 Telefon 430×932 + Phone 360×800 Telefon 360×800 + Phone 412×915 Telefon 412×915 + Phone 375×667 Telefon 375×667 + Tablet 768×1024 Tablet 768×1024 + Tablet 820×1180 Tablet 820×1180 + Tablet 834×1194 Tablet 834×1194 + Tablet 1024×1366 Tablet 1024×1366 + Tablet 800×1280 Tablet 800×1280 + Watch 184×224 Sat 184×224 + Watch 198×242 Sat 198×242 + Web 1600×900 Web 1600×900 + Web 1440×900 Web 1440×900 + Web 1366×768 Web 1366×768 + Web 1280×800 Web 1280×800 + Web 1024×768 Web 1024×768 + Legal Legal + Tabloid Tabloid + A3 A3 + A4 A4 + A5 A5 + B4 B4 + B5 B5 + HDTV 1080p HDTV 1080p + HDTV 720p HDTV 720p + 4K UHD 4K UHD + 8K UHD 8K UHD + 2K Cinema 2K kino + 4K Cinema 4K kino + Greeting Card Čestitka + Square 8 × 8 in Kvadrat 8 × 8 in + Poster 18 × 24 in Poster 18 × 24 in + Poster 24 × 36 in Poster 24 × 36 in + Logo 1000×1000 Logotip 1000×1000 + Business Card 3.5 × 2 in Vizitkarta 3,5 × 2 in + Business Card 85 × 55 mm Vizitkarta 85 × 55 mm + Business Card 91 × 55 mm Vizitkarta 91 × 55 mm + Letterhead Letter Memorandum Letter + Letterhead A4 Memorandum A4 + Envelope DL Koverta DL + Envelope #10 Koverta #10 + Social Portrait Post 1080×1350 Uspravna objava za društvene mreže 1080×1350 + Social Landscape Post 1200×630 Položena objava za društvene mreže 1200×630 + Social Story 1080×1920 Priča za društvene mreže 1080×1920 + Social Tall Post 1000×1500 Visoka objava za društvene mreže 1000×1500 + Profile Cover 1500×500 Naslovnica profila 1500×500 + Page Cover 1640×624 Naslovnica stranice 1640×624 + Video Banner 2560×1440 Video baner 2560×1440 + Video Thumbnail 1280×720 Sličica videa 1280×720 + Keyboard Shortcuts Prečice na tastaturi + Set: Skup: + Reset to Defaults Vrati na zadane vrijednosti + Tool Alat + Command Naredba + Shortcut Prečica + Menu Commands Naredbe menija + Press keys… Pritisnite tipke… + Use Default Koristi zadano + Go to Conflict Idi na konflikt + Remove the shortcut Ukloni prečicu + Click, then press the new shortcut (Esc cancels) Kliknite, zatim pritisnite novu prečicu (Esc otkazuje) + All shortcuts reset to defaults. Sve prečice su vraćene na zadane. + Imported. Press OK to keep the imported set. Uvezeno. Pritisnite U redu da zadržite uvezeni skup. + ⚠ {chord} was already used by {names} — it has been removed there. ⚠ {chord} je već koristio {names} — tamo je uklonjena. + VectorCraft Defaults Zadane postavke VectorCrafta +@plural {n} shortcut is assigned more than once|{n} shortcuts are assigned more than once {n} prečica je dodijeljena više puta|{n} prečice su dodijeljene više puta|{n} prečica je dodijeljeno više puta + Simulate prints overprints as Overprint Preview shows them; separations always keep them. A preset flattens transparency before printing (PostScript files always flatten it). Simuliraj štampa pretiske onako kako ih prikazuje Pregled pretiska; separacije ih uvijek zadržavaju. Predložak spljoštava prozirnost prije štampanja (PostScript datoteke je uvijek spljoštavaju). + Preserve Očuvaj + Simulate Simuliraj + Portrait (flipped) Uspravno (preokrenuto) + Landscape (flipped) Položeno (preokrenuto) + Visible & Printable Layers Vidljivi slojevi i slojevi za štampu + Visible Layers Vidljivi slojevi + All Layers Svi slojevi + Do Not Scale Ne skaliraj + Fit to Page Uklopi u stranicu + Custom Scale Prilagođena skala + Tile Imageable Areas Popločaj područja za ispis + Composite Kompozit + Separations Separacije + Up (right reading) Gore (čitljivo zdesna) + Down (right reading) Dolje (čitljivo zdesna) + Positive Pozitiv + Negative Negativ + Subset Podskup + Complete Dovršeno + [Custom] [Prilagođeno] + [Default] [Zadano] + No downsampling Bez smanjivanja uzorkovanja + Subsample Poduzorkovanje + Bicubic Bikubično + Minimum Minimum + Run Length Dužina niza + Roman Latinično + No conversion Bez pretvaranja + Convert to destination Pretvori u odredište + Convert to destination (preserve numbers) Pretvori u odredište (očuvaj brojeve) + Don't include profiles Ne uključuj profile + Include all profiles Uključi sve profile + Include destination profile Uključi odredišni profil + Include tagged source profiles Uključi označene izvorne profile + Low resolution (150 ppi) Niska rezolucija (150 ppi) + High resolution Visoka rezolucija + Inserting, deleting and rotating pages Umetanje, brisanje i rotiranje stranica + Filling in form fields and signing Popunjavanje polja obrasca i potpisivanje + Commenting, filling in form fields and signing Komentarisanje, popunjavanje polja obrasca i potpisivanje + Any except extracting pages Sve osim izdvajanja stranica + Bounding Box Granični okvir + Mobile Mobilno + Film & Video Film i video + Art & Illustration Umjetnost i ilustracija + Branding Brendiranje + Social Društvene mreže + Triangle Trougao + Triangle (open) Trougao (otvoreni) + Circle (open) Krug (otvoreni) + Square (open) Kvadrat (otvoreni) + Bar Traka + Arrow Strelica + Arrow (open) Strelica (otvorena) + Barbed Bodljikavo + Half Arrow (left) Polustrelica (lijevo) + Half Arrow (right) Polustrelica (desno) + Concave Konkavno + Double Bar Dvostruka traka + Feather Omekšaj ivice + Dot on Bar Tačka na traci + Chevron Ševron + Double Arrow Dvostruka strelica + Cross Križ + Plus Plus + Hexagon Šesterougao + Hexagon (open) Šesterougao (otvoreni) + Tag Oznaka + Tag (open) Oznaka (otvorena) + Half Circle Polukrug + Drop Kap + Slash Kosa crta + Double Slash Dvostruka kosa crta + Diamond (open) Romb (otvoreni) + Reverse Triangle Obrnuti trougao + Swallowtail Lastin rep + Bracket Zagrada + Fork Račvanje + Leaf List + Kite Zmaj + Triangle to Bar Trougao u traku + Oval Oval + Complementary Komplementarne + Complementary 2 Komplementarne 2 + Split Complementary Podijeljene komplementarne + Left Complement Lijevi komplement + Right Complement Desni komplement + Analogous Analogne + Analogous 2 Analogne 2 + Monochromatic Monohromatske + Shades Sjene + Triad Trijada + Triad 2 Trijada 2 + Triad 3 Trijada 3 + Tetrad Tetrada + Tetrad 2 Tetrada 2 + Tetrad 3 Tetrada 3 + Compound Složeno + Compound 2 Složeno 2 + High Contrast Visoki kontrast + High Contrast 2 Visoki kontrast 2 + High Contrast 3 Visoki kontrast 3 + Pentagram Pentagram + Cool Hladno + Warm Toplo + Muted Prigušeno + Vivid Živo + Spectrum Spektar + Perceptual Perceptivno + Relative Colorimetric Relativna kolorimetrija + Absolute Colorimetric Apsolutna kolorimetrija + Exact Tačno + Preserve Tints Očuvaj nijanse + Scale Tints Skaliraj nijanse + Linear Linearno + Freeform Slobodni oblik + 8 Colors 8 boja + 16 Colors 16 boja + 256 Colors 256 boja + True Colors Prave boje + Preserve Appearance Očuvaj izgled + Maximize Editability Maksimiziraj mogućnost uređivanja + Clip Group Grupa isijecanja + Guide Vodilica + Symbol Simbol + Envelope Omotnica + Mesh Mreža + Placed Document Postavljeni dokument + Radial Repeat Radijalno ponavljanje + Grid Repeat Ponavljanje u mreži + Mirror Repeat Zrcalno ponavljanje + Auto Size Automatska veličina + Shrink Text to Fit Smanji tekst da stane + Ascent Uspon + Cap Height Visina velikih slova + x Height Visina malog slova x + Justify Poravnaj obostrano + First Baseline Prva osnovna linija + Vertical Align Okomito poravnanje + Save Selection Sačuvaj odabir + No Legend Bez legende + Standard Legend Standardna legenda + Legends in Wedges Legende u isječcima + Ratio Omjer + Even Ravnomjerno + Stacked Naslagano + Twirl Kovitlac + Pucker Nabiranje + Bloat Napuhni + Scallop Školjka + Wrinkle Nabor + Unknown Nepoznato + Copyrighted Zaštićeno autorskim pravima + Public Domain Javno vlasništvo + None (Color Preview) Ništa (pregled boja) + Rasterized Complex Regions Rasterizirana složena područja + Transparent Objects Prozirni objekti + All Affected Objects Svi zahvaćeni objekti + Expanded Patterns Prošireni uzorci + Outlined Strokes Potezi u obrisima + Outlined Text Tekst u obrisima + All Rasterized Regions Sva rasterizirana područja + High Resolution Visoka rezolucija + [High Resolution] [Visoka rezolucija] + Medium Resolution Srednja rezolucija + [Medium Resolution] [Srednja rezolucija] + Low Resolution Niska rezolucija + [Low Resolution] [Niska rezolucija] + Copyright and Contact Info Autorska prava i kontakt informacije + All Slices Svi isječci + Selected Slices Odabrani isječci + No Slices Bez isječaka + Images Only Samo slike + HTML and Images HTML i slike + Selective Selektivno + Adaptive Prilagodljivo + Black & White Crno-bijelo + No Dither Bez ditheringa + Diffusion Difuzija + Unsorted Nesortirano + Sort by Hue Sortiraj po nijansi + Sort by Luminance Sortiraj po luminansi + Sort by Popularity Sortiraj po popularnosti + Baseline (Standard) Osnovno (standardno) + Baseline Optimized Osnovno optimizirano + Art Optimized Optimizirano za crtež + Type Optimized Optimizirano za tekst + Language Level 2 Jezički nivo 2 + Language Level 3 Jezički nivo 3 + TIFF (Black & White) TIFF (crno-bijelo) + TIFF (8-bit Color) TIFF (8-bitna boja) + 1 bit 1 bit + 4 bit 4 bita + 8 bit 8-bitno + 16 bit 16-bitno + 24 bit 24-bitno + 32 bit 32-bitno + 16 bits/pixel 16 bita/piksel + 24 bits/pixel 24 bita/piksel + 32 bits/pixel 32 bita/piksel + DWG (use DXF) DWG (koristite DXF) + Artistic Umjetnički + Film Grain… Filmsko zrno… + Colored Pencil… Drvene bojice… + Colored Pencil Drvene bojice + Cutout… Izrezak… + Cutout Izrezak + Dry Brush… Suhi kist… + Dry Brush Suhi kist + Neon Glow… Neonski sjaj… + Palette Knife… Špahtla… + Neon Glow Neonski sjaj + Paint Daubs… Mrlje boje… + Paint Daubs Mrlje boje + Palette Knife Špahtla + Poster Edges… Posterske ivice… + Rough Pastels… Grubi pasteli… + Poster Edges Posterske ivice + Rough Pastels Grubi pasteli + Underpainting… Podslikavanje… + Underpainting Podslikavanje + Levels Nivoi + Edge Simplicity Jednostavnost ivica + Edge Fidelity Vjernost ivica + Glow Size Veličina sjaja + Glow Brightness Svjetlina sjaja + Edge Thickness Debljina ivica + Edge Intensity Intenzitet ivica + Posterization Posterizacija + Highlight Area Područje isticanja +file-filter All readable files Sve datoteke koje se mogu pročitati +file-filter All placeable files Sve datoteke koje se mogu postaviti +file-filter Swatch libraries Biblioteke uzoraka boja +file-filter Flattener presets Predlošci spljoštavanja +file-filter PDF presets PDF predlošci +file-filter Print presets Predlošci štampanja +file-filter SVG Compressed Komprimirani SVG +file-filter PDF-compatible .ai .ai kompatibilan s PDF-om +file-filter VectorCraft Template VectorCraft predložak +file-filter Templates Predlošci +diagnostics render iscrtavanje +diagnostics ui interfejs + Preset {number} Predložak {number} + PRs PR-ovi + @{login}: {prs}, {commits}, +{added} / −{deleted} lines (Δ {delta}), +{binary_added} / −{binary_deleted} binary assets, {first} – {last} @{login}: {prs}, {commits}, +{added} / −{deleted} linija (Δ {delta}), +{binary_added} / −{binary_deleted} binarnih resursa, {first} – {last} +@plural {n} PR|{n} PRs {n} PR|{n} PR-a|{n} PR-ova +@plural {n} commit|{n} commits {n} commit|{n} commita|{n} commitova +gradient-kind Radial Radijalno +mark-style Japanese Japanski +@msg the compressed file unpacks to more than VectorCraft reads ({_1} MB of document, {_2} MB per image) komprimirana datoteka se raspakuje na više nego što VectorCraft čita ({_1} MB dokumenta, {_2} MB po slici) +@msg the document is too large to save compressed ({0}): save it with Use Compression off dokument je prevelik za komprimirano čuvanje ({0}): sačuvajte ga s isključenim Koristi kompresiju +@msg the file stopped being read (please report this bug) čitanje datoteke je prestalo (molimo prijavite ovu grešku) + Concentric Dividers: Koncentrični razdjelnici: + Radial Dividers: Radijalni razdjelnici: + Skew: Iskošenje: + Inside Unutra + Outside Vani + Use Outside Rectangle As Frame Koristi vanjski pravougaonik kao okvir + Create Compound Path From Ellipses Kreiraj složenu putanju od elipsi + Fill Grid Ispuni mrežu + Select two or more objects, or a group Odaberite dva ili više objekata ili grupu + Back Nazad + Both sides Obje strane + Classic Klasično + Cove Udubina + Depth Dubina + Front Prednja strana + Isometric Bottom Izometrijsko dno + Isometric Left Izometrijski lijevo + Isometric Right Izometrijski desno + Isometric Top Izometrijski vrh + Off-Axis Back Van ose pozadi + Off-Axis Bottom Van ose dno + Off-Axis Front Van ose naprijed + Off-Axis Left Van ose lijevo + Off-Axis Right Van ose desno + Off-Axis Top Van ose vrh + Ogee Ogee + Reset all 3D settings to their defaults. Vrati sve 3D postavke na zadane vrijednosti. + Step Korak + Taper Suženje + Twist Uvrtanje + Volume Zapremina +3d Cap Završetak +3d Solid Puno +3d Hollow Šuplje +3d Bevel Zakošenje +3d Rounded Zaobljeno +3d Space Prostor + Bevel Shape Oblik zakošenja + Bevel Inside Zakošenje unutra + Bevel both sides Zakošenje s obje strane + Presets Unaprijed postavljene vrijednosti +@msg An object takes one 3D effect. Edit the existing effect's options, or remove it first. Objekat prima jedan 3D efekat. Uredite opcije postojećeg efekta ili ga prvo uklonite. +@msg {label} currently requires a path or compound path. Convert type, images and groups to paths first. {label} trenutno zahtijeva putanju ili složenu putanju. Prvo pretvorite tekst, slike i grupe u putanje. +@msg {label} requires a shape with at least two anchors {label} zahtijeva oblik s najmanje dva sidra +@msg The shape is too complex for a 3D effect Oblik je previše složen za 3D efekat +@msg The 3D surface is too complex; simplify the shape 3D površina je previše složena; pojednostavite oblik + Transform Objects Transformiši objekte +@msg unknown parameter `{key}`; did you mean `{near}`? nepoznat parametar `{key}`; da li ste mislili `{near}`? +@msg unknown parameter `{key}`; the command takes no parameters nepoznat parametar `{key}`; naredba ne prima parametre +@msg unknown parameter `{key}`; the command takes: {keys} nepoznat parametar `{key}`; naredba prima: {keys} + Load EPS into Clipboard Učitaj EPS u međuspremnik +@msg an image of {w} × {h} pixels is too large to draw slika od {w} × {h} piksela prevelika je za crtanje +@msg an image of {w} × {h} pixels is shown at reduced size slika od {w} × {h} piksela prikazana je u smanjenoj veličini +@msg the image can't be read as a texture slika se ne može čitati kao tekstura + Fill and Stroke Controls Kontrole ispune i poteza + Coloring Controls Kontrole bojenja + Draw Mode Controls Kontrole načina crtanja + Screen Mode Controls Kontrole načina prikaza ekrana + Drawer menu Meni ladice + Toolbar: Show Controls Traka s alatima: prikaži kontrole +@msg control must be fillStroke, coloring, drawMode or screenMode control mora biti fillStroke, coloring, drawMode ili screenMode +@msg unknown control `{name}`: fillStroke, coloring, drawMode or screenMode nepoznata kontrola `{name}`: fillStroke, coloring, drawMode ili screenMode +@msg give a fraction `t` from 0 to 1 navedite razlomak `t` od 0 do 1 +@msg give the path `id` navedite `id` putanje +@msg invalid stroke widths nevažeće širine poteza +@msg object has no weighted stroke objekat nema potez s težinom + Single Corner Radius Jedinstveni poluprečnik ugla + Top Left: Gore lijevo: + Top Right: Gore desno: + Bottom Left: Dolje lijevo: + Bottom Right: Dolje desno: + Softness Mekoća + Ambient Light Ambijentalno svjetlo + Light behind the object Svjetlo iza objekta + 3D Lighting Preset Predložak 3D osvjetljenja + Standard Standardno + Diffuse Difuzno + Lights Svjetla + Add Light Dodaj svjetlo + Delete Light Izbriši svjetlo +3d Light Svjetlo + Registration: Registracija: + Display Prikaz + Dimension Kota + Drawing : real size — 1:10 labels 1 unit on the page as 10. Crtež : stvarna veličina — 1:10 označava 1 jedinicu na stranici kao 10. + Preview (1 inch on the page) Pregled (1 inč na stranici) + Set as Default Postavi kao zadano + out from a highlighted edge to place its dimension | od istaknute ivice da postavite njenu kotu | + cancels | Double-click the tool for options otkazuje | Dvostruki klik na alat za opcije + Angular Ugaono + Away from the Line Dalje od linije + Between Line and Object Između linije i objekta + Drag out from a segment, or click two points, then click to place. Prevucite od segmenta ili kliknite dvije tačke, zatim kliknite za postavljanje. + Drag out from a corner, or click two straight lines, then click to place. Prevucite od ugla ili kliknite dvije ravne linije, zatim kliknite za postavljanje. + Drag out from a circle or arc for its radius, inwards for its diameter. Prevucite od kruga ili luka prema van za poluprečnik, prema unutra za prečnik. +@msg Choose a circle or a perfect arc Odaberite krug ili savršen luk +@msg Choose a precision from 0 to 6 Odaberite preciznost od 0 do 6 + Create Dimension Kreiraj kotu + Dimension Tool Alat za kotiranje + Dimension Tool Options Opcije alata za kotiranje + Font Family: Porodica fonta: + Font Style: Stil fonta: + Precision: Preciznost: + Update Dimensions Ažuriraj kote +@msg Angles require two straight segments Uglovi zahtijevaju dva ravna segmenta +@msg Choose two different points Odaberite dvije različite tačke +@msg Choose two non-parallel straight segments Odaberite dva neparalelna ravna segmenta +@msg Choose two nonzero angle arms Odaberite dva kraka ugla različita od nule +@msg Dimension point is outside the canvas Tačka kote je izvan platna +@msg Dimension size is outside its supported range Veličina kote je izvan podržanog raspona +@msg First measured segment no longer exists Prvi izmjereni segment više ne postoji +@msg Invalid dimension distance Nevažeća udaljenost kote +@msg Invalid dimension font name Nevažeći naziv fonta kote +@msg Invalid drawing scale Nevažeća skala crteža +@msg Invalid real scale Nevažeća stvarna skala +@msg Measured anchor no longer exists Izmjereno sidro više ne postoji +@msg Measured segment no longer exists Izmjereni segment više ne postoji +@msg Non-finite dimension Nekonačna kota +@msg Scale Text Attributes: selected type has no scale to bake Skaliraj atribute teksta: odabrani tekst nema skalu za primjenu +@msg Scale must be drawing:real, for example 1:10 Skala mora biti crtež:stvarno, npr. 1:10 +@msg Scale ratio must be between 1:1000000 and 1000000:1 Omjer skale mora biti između 1:1000000 i 1000000:1 +@msg Second measured segment no longer exists Drugi izmjereni segment više ne postoji +@msg Unknown dimension mode Nepoznat način kote +@msg Unknown dimension option {k} Nepoznata opcija kote {k} +@msg Unknown dimension style Nepoznat stil kote +@msg Unknown unit Nepoznata jedinica + Close the circular ends of open profiles. Partial sweeps keep their cut sides open. Zatvori kružne krajeve otvorenih profila. Djelimična izvlačenja zadržavaju otvorene rezane strane. +@msg span must be "object" or "selection", got {v} span mora biti "object" ili "selection", dobiveno {v} +@msg span: "selection" places a `gradient`, not a swatch span: "selection" postavlja `gradient`, a ne uzorak boje +@msg span: "selection" places a gradient: give `gradient` span: "selection" postavlja gradijent: navedite `gradient` +@msg span: "selection" places a linear or radial gradient, not a freeform one span: "selection" postavlja linearni ili radijalni gradijent, a ne gradijent slobodnog oblika +@msg span: "selection" places the gradient itself: leave out `start` and `end` (they already place it in document coordinates) span: "selection" postavlja sam gradijent: izostavite `start` i `end` (oni ga već postavljaju u koordinatama dokumenta) + Make Image Dynamic Učini sliku dinamičkom + Import Data Sets… Uvezi skupove podataka… + Export Data Sets… Izvezi skupove podataka… + Load Variable Library… Učitaj biblioteku varijabli… + Make Graph Dynamic Učini grafikon dinamičkim + Batch… Paketna obrada… + Source Folder: Izvorni folder: + Destination Folder: Odredišni folder: + Overrides Zamjene + Uses every data set of the open document. Koristi svaki skup podataka otvorenog dokumenta. +@msg Batch: {count} processed Paket: obrađeno {count} +@msg Batch: {count} processed, {failed} failed Paket: obrađeno {count}, neuspjelo {failed} +@msg choose a destination folder odaberite odredišni folder +@msg choose a source folder odaberite izvorni folder +@msg open a document with data sets otvorite dokument sa skupovima podataka +@msg nothing in data set {name} was applied: no object is bound to a variable it has a value for ništa iz skupa podataka {name} nije primijenjeno: nijedan objekat nije vezan za varijablu za koju ima vrijednost +@msg the action has no steps akcija nema koraka + Accent Color Boja naglaska + Amber Jantar + Coral Koralna + Violet Ljubičasta + Sketch Skica + Halftone Pattern… Uzorak polutonova… + Halftone Pattern Uzorak polutonova + Torn Edges… Pocijepane ivice… + Torn Edges Pocijepane ivice + Conté Crayon… Konte krejon… + Conté Crayon Konte krejon + Foreground Level Nivo prednjeg plana + Background Level Nivo pozadine + Pattern Type Vrsta uzorka + Dot Tačka + Color Scheme Shema boja + Modern Moderno + Export Type: Vrsta izvoza: + Movie Clip Filmski klip +@msg name is empty naziv je prazan +@msg no symbol named `{n}` nema simbola pod nazivom `{n}` + Smudge Stick… Štapić za razmazivanje… + Smudge Stick Štapić za razmazivanje + Sponge… Spužva… + Sponge Spužva + Watercolor… Akvarel… + Watercolor Akvarel + Brush Size Veličina četkice + Texture Coverage Pokrivenost teksturom + Definition Definicija + Brush Detail Detalji četkice + Shadow Intensity Intenzitet sjene + Bas Relief… Bareljef… + Bas Relief Bareljef + Charcoal… Ugljen… + Charcoal Ugljen + Photocopy… Fotokopija… + Photocopy Fotokopija + Stamp… Pečat… + Stamp Pečat + Thickness Debljina + Detail Detalji + Light/Dark Balance Balans svijetlog/tamnog +@msg Edit Original opens image and document files only; “{name}” is not one Uredi original otvara samo slike i dokumente; „{name}” nije ni jedno ni drugo +@msg only http, https and mailto URLs open in the browser, not “{url}” u pregledniku se otvaraju samo http, https i mailto URL-ovi, a ne „{url}” +@msg {id} opens another app: only the person at the keyboard can run it {id} otvara drugu aplikaciju: može je pokrenuti samo osoba za tastaturom +@msg “{name}” is not a file „{name}” nije datoteka + Enable Guides for 9-Slice Scaling Omogući vodilice za skaliranje u 9 dijelova +@msg a mask has more than one art block maska ima više od jednog bloka crteža +@msg mask art ends outside a mask dictionary crtež maske završava izvan rječnika maske +@msg cancelled; nothing was changed otkazano; ništa nije promijenjeno +@msg a linked image can't become a gradient mesh: embed it first povezana slika ne može postati gradijentna mreža: prvo je ugradite +@msg the image has no usable size or position slika nema upotrebljivu veličinu ili položaj +@msg the image's pixels can't be read pikseli slike se ne mogu pročitati + Persistent Trajno + Library Panel Options Opcije panela biblioteke + Locate Library… Pronađi biblioteku… +@msg Persistent libraries not found: {files} Trajne biblioteke nisu pronađene: {files} +@msg `{given}` isn't a library panel (see window.swatchLibrary) `{given}` nije panel biblioteke (vidi window.swatchLibrary) +@msg library panel `{given}` isn't open panel biblioteke `{given}` nije otvoren +@msg too many changed shortcuts previše promijenjenih prečica +@msg library panel `{given}` isn't missing its library panelu biblioteke `{given}` ne nedostaje biblioteka +@msg too many library panels were opened in this session u ovoj sesiji otvoreno je previše panela biblioteka +@msg The image is {_1} × {_2} pixels, more than {LARGE_TRACE_SIDE} on a side: it is traced, but more slowly. A lower-fidelity preset or a smaller copy of the image traces faster. Slika ima {_1} × {_2} piksela, više od {LARGE_TRACE_SIDE} po strani: prati se, ali sporije. Predložak niže vjernosti ili manja kopija slike prate se brže. +@msg The image was traced at {_1} × {_2} pixels, scaled down from {_3} × {_4} ({_5} megapixels at most). Slika je praćena pri {_1} × {_2} piksela, smanjena s {_3} × {_4} (najviše {_5} megapiksela). + Snapping Hvatanje + Snap to Tangent Prilijepi uz tangentu + Snap to Perpendicular Prilijepi okomito +@msg unknown snap option `{key}` (use {options}) nepoznata opcija hvatanja `{key}` (koristite {options}) + Gap Length: Dužina razmaka: +@msg `colorGroup` needs `library: "document"` `colorGroup` zahtijeva `library: "document"` +@msg `colorGroup` needs `palette: "documentLibrary"` `colorGroup` zahtijeva `palette: "documentLibrary"` +@msg `colorGroup` needs `mode: "color"` `colorGroup` zahtijeva `mode: "color"` +@msg no color group `{name}` in the document (see swatch.list) nema grupe boja `{name}` u dokumentu (pogledajte swatch.list) +@msg Flat Logo traced the image at {_1} × {_2} pixels, averaged down from {_3} × {_4}. Ravni logo je pratio sliku u {_1} × {_2} piksela, usrednjeno sa {_3} × {_4}. + Artboard {n} of {total} Radna ploča {n} od {total} + File {n} of {total} Datoteka {n} od {total} + Encoding and writing the file… Kodiranje i zapisivanje datoteke… +@plural {n} more export waiting|{n} more exports waiting Čeka još {n} izvoz|Čekaju još {n} izvoza|Čeka još {n} izvoza + Continue in Background Nastavi u pozadini + Cancel Export Otkaži izvoz +@msg Export cancelled Izvoz otkazan + Desired Željeno + Word Spacing: Razmak riječi: + Letter Spacing: Razmak slova: + Glyph Scaling: Skaliranje glifova: + Auto Leading: Automatski prored: + Single Word Justification: Obostrano poravnanje jedne riječi: + Full Justify Potpuno obostrano poravnanje + Minimum must not exceed Desired, nor Desired Maximum. Minimum ne smije premašiti Željeno, niti Željeno maksimum. + Justification Obostrano poravnanje + Add filters from the list above Dodajte filtere s liste iznad + Add to Stack Dodaj u stog + Applied Filters Primijenjeni filteri + Categories Kategorije + Choose a filter Odaberite filter + Effect Gallery Galerija efekata + Filters Filteri + Select artwork to apply effects Odaberite crtež za primjenu efekata +@msg the file's variables and data sets weren't read (variables: {variables}, data sets: {data_sets}): the Variables panel doesn't list them varijable i skupovi podataka datoteke nisu pročitani (varijable: {variables}, skupovi podataka: {data_sets}): panel Varijable ih ne navodi + Select by Color Odaberi po boji + Move Anchor Point Pomjeri sidrenu tačku +@msg {label} keeps 1 of the document's {n} artboards: the file reopens with one. Turn on Preserve Editing Capabilities to keep them all. {label} zadržava 1 od {n} radnih ploča dokumenta: datoteka se ponovo otvara s jednom. Uključite Očuvaj mogućnosti uređivanja da ih zadržite sve. + Chalk & Charcoal… Kreda i ugljen… + Chalk & Charcoal Kreda i ugljen + Graphic Pen… Grafičko pero… + Graphic Pen Grafičko pero + Reticulation… Retikulacija… + Reticulation Retikulacija + Plastic Wrap… Plastična folija… + Plastic Wrap Plastična folija + Chrome… Hrom… + Chrome Hrom + Drop here to take it out of its group Ispustite ovdje da ga izvadite iz grupe + Move Library Group Premjesti grupu biblioteke + Plaster… Gips… + Plaster Gips + Note Paper… Papir za bilješke… + Note Paper Papir za bilješke + Water Paper… Vodeni papir… + Water Paper Vodeni papir + Ruby… Ruby… + Ruby Ruby + Geometric Guides Geometrijske vodilice + Ease In Ublaži ulaz + Ease Out Ublaži izlaz + Ease In Out Ublaži ulaz i izlaz + Ease Out In Ublaži izlaz i ulaz + Ramp: Rampa: + Shift: Shift: + Fresco… Freska… + Fresco Freska + Lock Artboards Zaključaj radne ploče + Unlock Artboards Otključaj radne ploče + Lock Selected Zaključaj odabrano + Lock All Except Selected Zaključaj sve osim odabranog + Lock All Zaključaj sve + Unlock Selected Otključaj odabrano + Effect Gallery… Galerija efekata… + Effect Gallery Dialog Dijalog galerije efekata + Arc Segment Tool Options Opcije alata za lučni segment + Base Along: Osnova duž: + Closed Zatvoreno + Convex Konveksno + Fill Arc Ispuni luk + Length X-Axis: Dužina X-ose: + Length Y-Axis: Dužina Y-ose: + Slope: Nagib: +axis X Axis X osa +axis Y Axis Y osa +@msg Packaged {n} file(s) in {folder} Upakovano datoteka u {folder}: {n} +@msg Packaged {n} file(s) {note} Upakovano datoteka: {n} {note} +@msg Packaged {n} file(s) Upakovano datoteka: {n} + Packaged {n} file(s) Upakovano datoteka: {n} + Packaged {n} file(s) in {folder} Upakovano datoteka u {folder}: {n} + Packaged {n} file(s) {note} Upakovano datoteka: {n} {note} + {count} file(s) in {folder}. Show the package folder? Datoteka u {folder}: {count}. Prikazati folder paketa? + Clockwise U smjeru kazaljke na satu + Dither Dithering + Fine noise hides banding in the gradient fill Fini šum skriva trake u gradijentnoj ispuni +@msg `dither` applies to gradient fills (stroke: false) `dither` se primjenjuje na gradijentne ispune (stroke: false) +@msg `dither` applies to gradient fills (paint.setFill) `dither` se primjenjuje na gradijentne ispune (paint.setFill) +@msg `dither` must be true or false `dither` mora biti true ili false +@msg `method` must be classic or perceptual `method` mora biti classic ili perceptual + Install “{name}”, which asks for a heavy budget? Instalirati „{name}”, koji traži veliki budžet? + Each run may take up to {minutes} minutes and do {times} times the work other plug-ins may. It runs in the background, and you can cancel it. Svako pokretanje može trajati do {minutes} minuta i obaviti {times} puta više posla nego drugi dodaci. Radi u pozadini i možete ga otkazati. + It may take minutes, so it runs in the background, where you can cancel it. Može trajati minutama, pa radi u pozadini, gdje ga možete otkazati. + The plug-in is computing… Dodatak računa… + Inspect Plug-in Pregledaj dodatak + Cancel Plug-in Run Otkaži pokretanje dodatka +@msg {_1} finished, but the document or the plug-in changed meanwhile: run it again {_1} je završen, ali su se dokument ili dodatak u međuvremenu promijenili: pokrenite ga ponovo +@msg Running “{name}”… Pokretanje „{name}”… +@msg a live effect runs while the document is drawn, so it can't be `heavy` živi efekat radi dok se dokument iscrtava, pa ne može biti `heavy` +@msg an exporter always gets an export's budget: leave `budget` out izvoznik uvijek dobija budžet izvoza: izostavite `budget` +@msg “{_1}” asks for a heavy budget (each run up to {minutes} minutes and {times} times the usual instructions): install it with `allowHeavy: true` once the user agrees „{_1}” traži veliki budžet (svako pokretanje do {minutes} minuta i {times} puta više uobičajenih instrukcija): instalirajte ga s `allowHeavy: true` kada korisnik pristane + New Set… Novi skup… + New Set Novi skup + Set Options… Opcije skupa… + Set Options Opcije skupa + Create New Set Napravi novi skup + Stop Global Edit Zaustavi globalno uređivanje + Global Edit Options Opcije globalnog uređivanja + Match Podudaranje + On Artboards Na radnim pločama + All Artboards Sve radne ploče + Include Objects On Canvas Uključi objekte na platnu + Result(s): {count} Rezultati: {count} +@msg select one object odaberite jedan objekat +@msg Global Edit works on paths, compound paths and symbol instances Globalno uređivanje radi na putanjama, složenim putanjama i instancama simbola +@msg no similar objects found (rotated or reflected copies are not matched); change the Global Edit Options and try again nisu pronađeni slični objekti (rotirane ili zrcaljene kopije se ne podudaraju); promijenite opcije globalnog uređivanja i pokušajte ponovo +@msg `artboards`: all or a range such as 1, 3-5, not {v} `artboards`: all ili raspon poput 1, 3-5, a ne {v} + Add to Symbols Dodaj u simbole + Basic Shapes Osnovni oblici + Open Symbol Library Otvori biblioteku simbola + Save Symbol Library Sačuvaj biblioteku simbola + Save Symbol Library… Sačuvaj biblioteku simbola… + Save Symbols… Sačuvaj simbole… + Selected Symbols Only Samo odabrani simboli + Symbol Libraries Menu Meni biblioteka simbola + Symbol Library Biblioteka simbola + User Symbol Library 1 Korisnička biblioteka simbola 1 + User Symbol Library 2 Korisnička biblioteka simbola 2 + User Symbol Library 3 Korisnička biblioteka simbola 3 + User Symbol Library 4 Korisnička biblioteka simbola 4 + User Symbol Library 5 Korisnička biblioteka simbola 5 + User Symbol Library 6 Korisnička biblioteka simbola 6 + User Symbol Library 7 Korisnička biblioteka simbola 7 + User Symbol Library 8 Korisnička biblioteka simbola 8 + User Symbol Library 9 Korisnička biblioteka simbola 9 + User Symbol Library 10 Korisnička biblioteka simbola 10 + {w} × {h} pt {w} × {h} pt +@msg `{_1}` has no symbols to place `{_1}` nema simbola za postavljanje +@msg missing `library` (see symbol.libraries) nedostaje `library` (pogledajte symbol.libraries) +@msg no symbol `{n}` nema simbola `{n}` +@msg no symbol `{n}` in `{_1}` nema simbola `{n}` u `{_1}` +@msg no symbol library `{key}` (see symbol.libraries) nema biblioteke simbola `{key}` (pogledajte symbol.libraries) +@msg the document has no symbols to save dokument nema simbola za čuvanje +@msg Trap: select two or more objects filled with solid colours Zamka: odaberite dva ili više objekata ispunjenih punim bojama +@msg Trap: no edges of different colours meet among the selected objects Zamka: među odabranim objektima ne susreću se ivice različitih boja +@msg thickness must be from 0.01 to 5000 pt debljina mora biti od 0,01 do 5000 pt +@msg heightWidth must be from 1 to 1000 % heightWidth mora biti od 1 do 1000 % +@msg tintReduction must be from 0 to 100 % tintReduction mora biti od 0 do 100 % + Rectangular Grid Tool Options Opcije alata pravougaona mreža + Polar Grid Tool Options Opcije alata polarna mreža + Fill Line Ispuni liniju + Pathfinder Options Opcije Pathfindera + Divide and Outline Will Remove Unpainted Artwork Podijeli i Obris uklanjaju neobojenu grafiku +@msg precision must be from 0.001 to 10 pt preciznost mora biti od 0,001 do 10 pt +@msg `pathfinder` must be an object `pathfinder` mora biti objekat + Add to Brushes Dodaj u četkice + Brush Library Biblioteka četkica + Save Brush Library Sačuvaj biblioteku četkica + Save Brushes… Sačuvaj četkice… + Open Brush Library Otvori biblioteku četkica + Selected Brushes Only Samo odabrane četkice + Brush Libraries Menu Meni biblioteka četkica + User Brush Library 1 Korisnička biblioteka četkica 1 + User Brush Library 2 Korisnička biblioteka četkica 2 + User Brush Library 3 Korisnička biblioteka četkica 3 + User Brush Library 4 Korisnička biblioteka četkica 4 + User Brush Library 5 Korisnička biblioteka četkica 5 + User Brush Library 6 Korisnička biblioteka četkica 6 + User Brush Library 7 Korisnička biblioteka četkica 7 + User Brush Library 8 Korisnička biblioteka četkica 8 + User Brush Library 9 Korisnička biblioteka četkica 9 + User Brush Library 10 Korisnička biblioteka četkica 10 + Art Ribbons Umjetničke trake + Calligraphic Nibs Kaligrafski vrhovi + Pattern Borders Ivice od uzoraka + Scatter Shapes Raspršeni oblici + Save Brush Library… Sačuvaj biblioteku četkica… +@msg `{_1}` has no brushes to apply `{_1}` nema četkica za primjenu +@msg missing `library` (see brush.libraries) nedostaje `library` (pogledajte brush.libraries) +@msg no brush `{n}` nema četkice `{n}` +@msg no brush `{n}` in `{_1}` nema četkice `{n}` u `{_1}` +@msg no brush library `{key}` (see brush.libraries) nema biblioteke četkica `{key}` (pogledajte brush.libraries) +@msg the document has no brushes to save dokument nema četkica za čuvanje +@msg no empty artboards to delete nema praznih radnih ploča za brisanje + Scale Presets Unaprijed postavljene skale +@msg a {width}×{height} screenshot's byte count overflows broj bajtova snimka ekrana {width}×{height} prekoračuje opseg +@msg the window's {what} ({points} points × {scale} DPI) cannot size a screenshot {what} prozora ({points} tačaka × {scale} DPI) ne može odrediti veličinu snimka ekrana + Expand Appearance first (Object › Expand Appearance) Prvo proširite izgled (Objekat › Proširi izgled) + Live preview Pregled uživo + Point Text Tačkasti tekst + Area Text Tekst u oblasti + Show Snap to Glyph Options Prikaži opcije prianjanja uz glif + Hide Snap to Glyph Options Sakrij opcije prianjanja uz glif + Snap to Glyph Options Opcije prianjanja uz glif + x-height x-visina + Glyph Bounds Granice glifa + Proximity Guides Vodiči blizine + Angular Guides Ugaoni vodiči + Average & Join… Prosjek i spajanje… + Average & Join Prosjek i spajanje +anchor Points: Tačke: +@msg select two open path ends, or two open paths, to average and join odaberite dva otvorena kraja putanje ili dvije otvorene putanje za prosjek i spajanje + Artwork Cleanup Čišćenje grafike + Simplify Anchors (Keep Shape)… Pojednostavi sidra (zadrži oblik)… + Health Check Provjera ispravnosti + Show Issue Prikaži problem + Fix All Issues Popravi sve probleme + Fix Issues Popravi probleme + Deep Ungroup… Duboko razgrupisanje… + Rejoin Path Pieces… Ponovo spoji dijelove putanje… + Document Health Check Provjera ispravnosti dokumenta + Check Selection Provjeri odabir + Check Document Provjeri dokument + No issues found. Nisu pronađeni problemi. + Changed since the last check. Promijenjeno od posljednje provjere. + Fix Selected Popravi odabrano + Fix All Popravi sve + Issues fixed: {count} Popravljeni problemi: {count} + Open a document to check it for issues. Otvorite dokument da ga provjerite na probleme. + Empty Text Prazan tekst + Unpainted Objects Neobojeni objekti + Zero-Opacity Objects Objekti s nultom neprozirnošću + Duplicate Objects Duplirani objekti + Off-Artboard Art Grafika izvan radne ploče + Duplicate Anchors Duplirana sidra + Tiny Handles Sićušne ručke + Collinear Anchors Kolinearna sidra + Nearly Coincident Anchors Gotovo podudarna sidra + Nearly Closed Paths Gotovo zatvorene putanje + Filled Open Paths Ispunjene otvorene putanje + Needless Clipping Groups Nepotrebne grupe isijecanja + Needless Compound Paths Nepotrebne složene putanje + Needless Groups Nepotrebne grupe + Empty Artboards Prazne radne ploče + Protect Corners Zaštiti uglove + Gap Razmak + Include Clip Groups Uključi grupe isijecanja +@msg `tolerance` must be from 1 to 100 `tolerance` mora biti od 1 do 100 +@msg `gap` must be from 0 to 6 pt `gap` mora biti od 0 do 6 pt +@msg Simplify Anchors: the paths have too many anchors to simplify at once Pojednostavi sidra: putanje imaju previše sidara da bi se pojednostavile odjednom +@msg Rejoin Path Pieces: too many paths to rejoin at once Ponovo spoji dijelove putanje: previše putanja za spajanje odjednom +@msg None of these issues are left: check again Nijedan od ovih problema više ne postoji: provjerite ponovo +@msg `kinds` must be a list of issue kinds `kinds` mora biti lista vrsta problema +@msg missing `kind` nedostaje `kind` + Simplify Anchors (Keep Shape) Pojednostavi sidra (zadrži oblik) + Deep Ungroup Duboko razgrupisanje + Rejoin Path Pieces Ponovo spoji dijelove putanje + Color Effects Efekti boja + Color Effects Panel Panel Efekti boja + Exposure Ekspozicija + Exposure… Ekspozicija… + Desaturate Ukloni zasićenje + Adjustment Podešavanje + Add as Effect Dodaj kao efekat + Apply as Filter Primijeni kao filter + Select objects to adjust their colors. Odaberite objekte da podesite njihove boje. + Brightness/Contrast Svjetlina/kontrast + Hue/Saturation Nijansa/zasićenost + Temperature/Tint Temperatura/nijansa +@msg `{id}` is not a colour adjustment `{id}` nije podešavanje boje +@msg missing `effect` nedostaje `effect` +@msg `params` must be an object `params` mora biti objekat + Path Precision Tools Alati za preciznost putanja + Anchor Eraser Brush Četkica za brisanje sidara + Extend Path Tool Alat produži putanju + Measure & Inspect Tool Alat mjeri i pregledaj + Anchor Inspector Pregled sidara + Add Points at Crossings Dodaj tačke na presjecima + Split at Crossings Razdvoji na presjecima + Extend Path Produži putanju + Measure & Inspect Mjeri i pregledaj + Set Anchor Postavi sidro + Make Smooth Napravi glatko + Make Corner Napravi ugao + Equalize Handles Izjednači ručke + Remove Points, Keep Shape Ukloni tačke, zadrži oblik + Add Points to Segments… Dodaj tačke segmentima… + Add Points to Segments Dodaj tačke segmentima + Open a document to edit its anchor points. Otvorite dokument da uredite njegove sidrene tačke. + Anchors selected: {count} Odabrana sidra: {count} + Direct-select anchor points to edit them. Direktno odaberite sidrene tačke da ih uredite. + In: Ulaz: + Out: Izlaz: + Add Points Dodaj tačke + Points per segment Tačaka po segmentu + Close Path: Zatvori putanju: + Keep Handles Zadrži ručke + Straight Ravno + Stretch Curve Rastegni krivulju +@msg direct-select the anchor points to remove direktno odaberite sidrene tačke za uklanjanje +@msg select segments, or paths, to add points to odaberite segmente ili putanje kojima ćete dodati tačke +@msg select open paths to close odaberite otvorene putanje za zatvaranje +@msg the paths are too many or too tangled to find where they cross (at most 10000 segments) putanja je previše ili su previše isprepletene da bi se našlo gdje se sijeku (najviše 10000 segmenata) +@msg the paths have too many anchors to edit at once putanje imaju previše sidara da bi se uredile odjednom + Artboard Options: edit with the Artboard tool Opcije radne ploče: uredite alatom radna ploča + 2up 2 odjednom + 4up 4 odjednom + A6 A6 + Art and Bright Colors Crtež i jarke boje + Convert to Global Pretvori u globalne + Dot Gain 15% Prirast tačke 15% + Expand 1 Selected Proširi 1 odabrano + Expand Object Proširi objekat + Gray Gamma 2.2 Siva gama 2.2 + Grey Siva + Phone 375×812 Telefon 375×812 + Photo Low Fidelity Fotografija niske vjernosti + Print & Proof Štampanje i probni ispis + Printing & Proofing Štampanje i probni ispis + Restricted Colors Ograničene boje + Simplified Chinese Pojednostavljeni kineski + Tablet 1024×768 Tablet 1024×768 + Text Displayed in Cell Tekst prikazan u ćeliji + Video 1920×1080 Video 1920×1080 + Video 3840×2160 Video 3840×2160 + Web 1280×720 Web 1280×720 + Working RGB Radni RGB +@msg give corners of the path: anchors between two straight sides navedite uglove putanje: sidra između dvije ravne strane + Automation Automatizacija + Essentials Osnove + Essentials Classic Osnove klasično + Layout Raspored + OpenType OpenType + Painting Slikanje + Printing and Proofing Štampanje i probni ispis + Tracing Praćenje + Touch Dodir + Typography Tipografija + VectorCraft VectorCraft + Web Web + [1P-High View] [Pogled 1T - visoki] + [1P-Low View] [Pogled 1T - niski] + [1P-Normal View] [Pogled 1T - normalni] + [2P-High View] [Pogled 2T - visoki] + [2P-Low View] [Pogled 2T - niski] + [2P-Normal View] [Pogled 2T - normalni] + [3P-Low View] [Pogled 3T - niski] + [3P-Normal View] [Pogled 3T - normalni] + on the canvas to create one na platno da kreirate jedan + Automate Automatizacija + Include All Subdirectories Uključi sve poddirektorije + Japanese Double Postcard Japanska dvostruka razglednica + Japanese Envelope #3 Japanska koverta br. 3 + Japanese Envelope #4 Japanska koverta br. 4 + Japanese Postcard Japanska razglednica + Kaku #2 Kaku br. 2 + Kaku #3 Kaku br. 3 + Load Variable Library Učitaj biblioteku varijabli + Override Action "Export" Commands Zamijeni naredbe "Izvezi" u akcijama + Override Action "Open" Commands Zamijeni naredbe "Otvori" u akcijama + Override Action "Save" Commands Zamijeni naredbe "Sačuvaj" u akcijama + Play: Reprodukuj: + Right-click an item to move it into this group. Desno kliknite stavku da je premjestite u ovu grupu. + Save and Close Sačuvaj i zatvori + Stop on Errors Zaustavi pri greškama + Yonroku-ban Yonroku-ban +@msg image '{key}' has no pixels and was left out slika '{key}' nema piksela i izostavljena je +@msg not an RTF file: it doesn't start with {\\rtf nije RTF datoteka: ne počinje s {\\rtf +@msg this is a PostScript file (an .ai saved in an older format or without PDF compatibility, or an EPS file), which can't be opened yet: save it as PDF, PDF-compatible .ai or SVG ovo je PostScript datoteka (.ai sačuvan u starijem formatu ili bez PDF kompatibilnosti, ili EPS datoteka), koja se još ne može otvoriti: sačuvajte je kao PDF, .ai kompatibilan s PDF-om ili SVG +font-script Japanese Japansko +swatch [None] [Nijedna] +swatch [Registration] [Registracija] +swatch Amber Jantar +swatch Aqua Akva +swatch Azure Azurna +swatch Black Crna +swatch Blue Plava +swatch Bright Blue Jarko plava +swatch Bright Green Jarko zelena +swatch Bright Red Jarko crvena +swatch Bright Violet Jarko ljubičasta +swatch Bright Yellow Jarko žuta +swatch Brights Jarke +swatch Brown Smeđa +swatch Chocolate Čokoladna +swatch Coffee Kafa +swatch Copper Bakarna +swatch Cyan Cijan +swatch Cyan Green Cijan-zelena +swatch Emerald Smaragdna +swatch Espresso Espresso +swatch Grays Sive +swatch Green Zelena +swatch Indigo Indigo +swatch Lime Limeta +swatch Magenta Magenta +swatch Ocean Okean +swatch Orange Narandžasta +swatch Orange Red Narandžasto-crvena +swatch Pink Ružičasta +swatch Purple Ljubičasta +swatch Radial White, Black Radijalno bijela, crna +swatch Red Crvena +swatch Rose Ružičastocrvena +swatch Rust Hrđa +swatch Sand Pijesak +swatch Sunset Zalazak sunca +swatch Tan Žutosmeđa +swatch Teal Tirkizna +swatch Violet Ljubičasta +swatch Walnut Orah +swatch White Bijela +swatch White, Black Bijela, crna +swatch Yellow Žuta +swatch Yellow Green Žuto-zelena + Check for Updates… Provjeri ažuriranja… + Checking for updates… Provjera ažuriranja… + Could not check for updates:\n{error} Nije moguće provjeriti ažuriranja:\n{error} + VectorCraft Updates VectorCraft ažuriranja + VectorCraft {version} is currently the newest version available. VectorCraft {version} je trenutno najnovija dostupna verzija. + Preparing the image… Priprema slike… + Tracing the colors… Praćenje boja… + Units & Scale Jedinice i skala + Dimension Lines Kotne linije + Extension Lines Pomoćne linije + Dimension Text Tekst kote + Arrow Scale: Skala strelice: + Arrow Style: Stil strelice: + Extension: Produžetak: + Hide Extension Lines Sakrij pomoćne linije + Hide Units Sakrij jedinice + Line Type: Vrsta linije: + Line Weight: Debljina linije: + Position: Položaj: + Font Size: Veličina fonta: +shape Open Otvoren diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 4b6da23561..5e53f4fefe 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -44,9 +44,13 @@ fn tags_map_to_languages() { assert_eq!(lang_from_tag("_"), None); } -/// The Georgian, Ukrainian, Hungarian, Korean, Vietnamese, Swedish and Catalan tags of +/// The Bosnian, Georgian, Ukrainian, Hungarian, Korean, Vietnamese, Swedish and Catalan tags of /// [`tags_map_to_languages`]. fn other_tags_map_to_languages() { + let bs = Lang::from_code("bs").expect("bs registered"); + for tag in ["bs", "bs-BA", "bs_BA.UTF-8", "BS-ba", "bs-Latn-BA"] { + assert_eq!(lang_from_tag(tag), Some(bs), "{tag}"); + } for tag in ["ka", "ka-GE", "ka_GE.UTF-8", "KA-ge"] { assert_eq!(lang_from_tag(tag), Some(ka()), "{tag}"); } @@ -149,7 +153,7 @@ fn each_language_counts_with_its_plural_rule() { (&["de", "es", "it", "pt-br", "fi", "ca"][..], [1, 0, 1, 1, 1, 1, 1, 1]), (&["fr"], [0, 0, 1, 1, 1, 1, 1, 1]), (&["ja", "ka", "hu", "ko", "vi", "tr"], [0; 8]), - (&["ru", "uk"], [2, 0, 1, 1, 2, 2, 0, 1]), + (&["ru", "uk", "bs"], [2, 0, 1, 1, 2, 2, 0, 1]), (&["cs"], [2, 0, 1, 1, 2, 2, 2, 2]), (&["pl"], [2, 0, 1, 1, 2, 2, 2, 1]), ] { diff --git a/docs/localization-parity.md b/docs/localization-parity.md index 9417f88935..d7ab314f5d 100644 --- a/docs/localization-parity.md +++ b/docs/localization-parity.md @@ -1,6 +1,6 @@ # Localization parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-29 · **Change:** minor (Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests) Per-language status of VectorCraft's interface. How the catalogs work and how to add a language: [`development.md` › Localisation](development.md#localisation). Part of @@ -58,6 +58,7 @@ plus review. Native-speaker review is human work and isn't in the hours. | Polish | `pl` | 5,130 rows (counted 2026-10-21): menus, `tl!` literals and messages complete when counted; one/few/many plurals | full; native review pending | | Finnish | `fi` | 5,318 rows (counted 2026-10-21): menus, `tl!` literals and messages complete when counted; one/other plurals, 797 `@msg` rows | full; AI-assisted, native proofreading pending | | Czech | `cs` | 5,240 catalog entries, including 795 `@msg` rows (counted 2026-10-21); menus, literals and messages complete when counted | catalog complete; render-site gaps reduced; native review pending | +| Bosnian | `bs` | 5,841 rows (counted 2026-10-30): menus, `tl!` literals and messages complete when counted; one/few/other plurals | full; AI-assisted, native review pending | | Swedish | `sv` | 5,251 rows, 795 of them `@msg` (counted 2026-10-21): menus, `tl!` literals and messages complete when counted; one/other plurals | full; native review welcome | | Bulgarian | `bg` | 5,245 rows, 763 of them `@msg` (counted 2026-10-21): menus and `tl!` literals complete when counted; its messages are partial | full; AI-drafted, native review pending | | Greek | `el` | 5,251 rows, 795 of them `@msg` (counted 2026-10-21): menus, `tl!` literals and messages complete when counted | full; native review welcome | @@ -95,6 +96,7 @@ font for the web build. | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Bosnian (`bs`, Latin, Ijekavian): complete catalog of 5,841 rows, every `bs-*` locale, one/few/other plurals; AI-assisted, not yet native-reviewed | | 2026-10-29 | minor | Vietnamese text: letters with two marks (Ể, Ứ, Ự) attach in precomposed, decomposed and keyboard forms, and a font lacking the marks falls back for the whole letter (#4491); scores unchanged | | 2026-10-28 | minor | Catalan (`ca`): complete catalog under the tests (menus, literals, messages; one/other plurals); every `ca-*` locale resolves here; AI-drafted, native review welcome. Added the Turkish and Indonesian rows the table was missing. Scores and estimates unchanged | | 2026-10-23 | patch | A missing translation never fails a test or a build; one untranslated report, printed by `cargo xtask ci` and `cargo xtask i18n-report`, lists the missing strings per language; scores unchanged | From 63a5889895dae40cd5e3a40e329a90acdb097f7f Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sat, 31 Oct 2026 01:31:09 +0700 Subject: [PATCH 065/227] bs: language names keep their own name in the picker --- crates/ui-egui/src/i18n/bs.tsv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index e26a6f5294..b20bb4f29b 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -3737,7 +3737,7 @@ axis Both Obje Grays Sive Color Group Grupa boja Library Biblioteka - English Engleski + English English List Folder Izlistaj folder Area Type Options Opcije teksta u području Reshape Type Area Preoblikuj područje teksta From dc6af04dcce97266072fcf97eda734b2a4296152 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:23:03 +0300 Subject: [PATCH 066/227] fix(ai-import): read mesh corners whose handle weights are 0 Some files write a handle weight of 0 on some gradient mesh corners. The reader took only weights of 1, so the mesh and the whole file's layers were unread. A weight of 0 draws as the same cubic edge against the files' pages; other weights still leave the mesh unread. --- crates/eps/src/import/ai/mesh.rs | 24 ++++++++++++++++++++++-- docs/file-format-parity.md | 3 ++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/crates/eps/src/import/ai/mesh.rs b/crates/eps/src/import/ai/mesh.rs index b33869a953..3937045dbe 100644 --- a/crates/eps/src/import/ai/mesh.rs +++ b/crates/eps/src/import/ai/mesh.rs @@ -245,8 +245,9 @@ impl MeshReader { _ => return None, }; let &[x, y, nx, ny, nw, px, py, pw] = geometry else { return None }; - // Non-unit rational weights need a different surface representation. - if nw != 1.0 || pw != 1.0 { + // Weights are 1, or 0 on some corners, which draw as the same cubic edges (checked + // against the files' pages). Others would need a rational surface. + if ![nw, pw].iter().all(|w| *w == 1.0 || *w == 0.0) { return None; } if ![opacity, x, y, nx, ny, px, py].iter().all(|v| v.is_finite()) { @@ -631,6 +632,25 @@ mod tests { assert!((first.handles[H_DOWN] - Vec2::new(0.0, 1.0)).hypot() < 1e-9, "{:?}", first.handles); } + /// A corner's handle weights are 1, or 0 on some corners, which draw as the same patch; any + /// other weight leaves the patch unread. + #[test] + fn corners_with_handle_weights_of_zero_are_read() { + let read = |nw: f64, pw: f64| { + let mut reader = MeshReader::default(); + patch(&mut reader, &[0.5, 1.0, 0.0, 0.0, 0.0, 0.3, nw, 0.3, 0.0, pw]); + reader + }; + for (nw, pw) in [(0.0, 0.0), (0.0, 1.0), (1.0, 0.0)] { + let reader = read(nw, pw); + assert!(!reader.unread, "{nw} {pw}"); + let p = &reader.patches[0].points[0]; + assert_eq!((p.handles[H_DOWN], p.handles[H_RIGHT]), (Vec2::new(0.0, 0.3), Vec2::new(0.3, 0.0))); + } + let reader = read(0.5, 1.0); + assert!(reader.unread && reader.patches.is_empty()); + } + #[test] fn hostile_meshes_are_capped_and_checked() { let mut reader = MeshReader::default(); diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index af662106c7..4f383bd3dc 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: pages cropped to the art in `UserUnit` units, and their copies' type) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai`/EPS editing data: mesh corners with handle weights of 0 are read) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai`/EPS editing data: a gradient mesh corner whose handle weights are 0 (one or both; the others are 1) is read like one whose weights are 1, so a mesh with such corners no longer leaves the whole file coming in as its page or PDF part; other weights still leave the mesh unread. Checked against the pages of two users' files: one opens from its layers 0.6% from its page, the other with 728 live meshes instead of its PDF part's 65,558 patches. Test `import::ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a PDF part whose pages are cropped to the art is recognised in a `UserUnit` page's units too (the art's box in those units, the artboard not the page in points), and its type is read from the first page only, since every such page holds all the art again: the copies on later pages were moved as the first page's and could be put into the layers' text objects. A page cropped to the art is taken only when every page is that box. Tests `import::tests_native::a_user_unit_page_cropped_to_the_art_is_read_in_its_units`, `type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`; scores unchanged | | 2026-10-30 | minor | `.ai` import: when the layers are compared with the page again with placed files at the corner of their box, the text objects the page doesn't draw are weighed with the images there, from the layers as read: before, the text an image covered at its first placement had already been left out, so a file whose image covered type only there came in without that type or as its PDF part. Test `import::tests_native::text_a_placed_file_covers_only_at_its_first_placement_is_kept`; scores unchanged | | 2026-10-30 | minor | `.ai` import: type read from the editing data's text document keeps its case setting (character attribute 12: 1 Small Caps, at Document Setup's default size, 2 All Caps); it came in as typed, so a heading set in All Caps showed in lower or mixed case where the page draws capitals. Test `import::tests_native::type_from_the_text_document_keeps_its_case_setting`; checked locally against a user's files; scores unchanged | From e5481bda9866eceec244ae013a1758054dc19937 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:42:49 +0300 Subject: [PATCH 067/227] fix(eps): a gradient mesh takes the transparency written after it In the editing data of a .ai or EPS file, a gradient mesh's own state (`Xy`) comes right after its `/End X!`, before its `Xd` and `XW`, as a group's comes after its `U`. The reader took it as the next object's, so a Multiply shadow mesh came in as Normal and painted opaque white over the art under it, while the file's page shows the shadow. An `Xy` read straight after a mesh ends now also applies to that mesh. An `Xy` after the mesh's `Xd` and `XW` stays the next object's. --- crates/eps/src/import/ai/read.rs | 3 +++ crates/eps/src/import/ai/read/art.rs | 8 ++++++-- crates/eps/src/import/ai/read/ops.rs | 12 ++++++++---- crates/eps/src/import/ai/tests.rs | 29 ++++++++++++++++++++++++++++ docs/file-format-parity.md | 3 ++- 5 files changed, 48 insertions(+), 7 deletions(-) diff --git a/crates/eps/src/import/ai/read.rs b/crates/eps/src/import/ai/read.rs index cc060f3f1c..abcbf02190 100644 --- a/crates/eps/src/import/ai/read.rs +++ b/crates/eps/src/import/ai/read.rs @@ -183,6 +183,8 @@ struct Reader<'a> { blend_budget: usize, /// A group just ended, its state (`Xy`, `Xd`, `XW`) not yet read. group_ended: bool, + /// A gradient mesh just ended (`/End X!`), its own state (`Xy`) not yet read. + mesh_ended: bool, /// A layer's own state (`Xy` after its art, before `LB`), until something says the art moves on. layer_state: Option<(f32, BlendMode, bool, Knockout)>, /// Painted copies of clipping paths that have a fill (drawn under what they clip). @@ -288,6 +290,7 @@ impl<'a> Reader<'a> { compound_groups: HashSet::new(), text_looks: HashSet::new(), group_ended: false, + mesh_ended: false, layer_state: None, styles: HashMap::new(), palette: super::palette::Palette::default(), diff --git a/crates/eps/src/import/ai/read/art.rs b/crates/eps/src/import/ai/read/art.rs index 6bf699ce9f..89df83cd41 100644 --- a/crates/eps/src/import/ai/read/art.rs +++ b/crates/eps/src/import/ai/read/art.rs @@ -235,7 +235,9 @@ impl<'a> Reader<'a> { let mut node = self.new_node(NodeKind::Mesh(one), &gs); node.opacity = gs.opacity; node.blend = gs.blend; - return self.add(node, hidden); + self.add(node, hidden)?; + self.mesh_ended = true; + return Ok(()); } Err(crate::import::ai::mesh::NotOne::Unjoined) => { self.warn("a gradient mesh whose patches don't join up comes in as a group of its patches") @@ -249,7 +251,9 @@ impl<'a> Reader<'a> { }; node.opacity = gs.opacity; node.blend = gs.blend; - self.add(node, hidden) + self.add(node, hidden)?; + self.mesh_ended = true; + Ok(()) } /// Stroke the path just painted (a gradient-filled one, `1 BB` or `2 BB`) with the stroke's state. diff --git a/crates/eps/src/import/ai/read/ops.rs b/crates/eps/src/import/ai/read/ops.rs index 9431061fe9..d9dbab22a2 100644 --- a/crates/eps/src/import/ai/read/ops.rs +++ b/crates/eps/src/import/ai/read/ops.rs @@ -79,6 +79,7 @@ impl<'a> Reader<'a> { self.layer_state = None; } let group_ended = std::mem::take(&mut self.group_ended); + let mesh_ended = std::mem::take(&mut self.mesh_ended); let vals = self.operands(); let vals = self.take_head(vals); // Only `Bh` reads an undefined number. Anywhere else it would reach a point or a size, so @@ -201,7 +202,7 @@ impl<'a> Reader<'a> { } } // Transparency and state. - "Xy" => self.transparency(&vals), + "Xy" => self.transparency(&vals, mesh_ended), // A group's own state (`Xd`, `6 () XW`) without an `Xy` keeps the current transparency, as // the file's PDF part draws it. A look's group (`9 () XW`) has no state of its own. "Xd" if group_ended => { @@ -388,8 +389,9 @@ impl<'a> Reader<'a> { }); } - /// `mode opacity isolate knockout shape Xy`; after a group's end, the group's too. - fn transparency(&mut self, vals: &[V]) { + /// `mode opacity isolate knockout shape Xy`; after a group's end, the group's too, and right + /// after a gradient mesh's `/End X!` (before its `Xd` and `XW`), the mesh's. + fn transparency(&mut self, vals: &[V], mesh_ended: bool) { let n = Self::nums(vals); let [mode, opacity, rest @ ..] = n.as_slice() else { return }; let gs = &mut self.gs; @@ -403,7 +405,9 @@ impl<'a> Reader<'a> { }; gs.knockout_shape = rest.get(2).is_some_and(|v| *v != 0.0); let gs = self.gs.clone(); - if self.last_object().is_some_and(|n| matches!(n.kind, NodeKind::Group { .. } | NodeKind::Compound { .. })) { + if self.last_object().is_some_and(|n| { + matches!(n.kind, NodeKind::Group { .. } | NodeKind::Compound { .. }) || (mesh_ended && matches!(n.kind, NodeKind::Mesh(_))) + }) { if let Some(n) = self.last_object() { n.opacity = gs.opacity; n.blend = gs.blend; diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index 9b453de24c..1c3ff8acc7 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -410,6 +410,35 @@ fn transparency_of_objects_and_groups() { assert_eq!((a[2].opacity, a[2].blend), (1.0, BlendMode::Normal), "the next object's state isn't the group's"); } +#[test] +fn a_gradient_mesh_takes_the_transparency_written_after_it() { + // GUARDS: a mesh's own state (`Xy`) comes right after its `/End X!`, before `Xd` and `XW`, as a + // group's does after `U`; read as the next object's, a Multiply shadow mesh painted opaque. + let corner = + |x: i32, y: i32, next: (i32, i32), prev: (i32, i32)| format!("%_[1 1 1 1 {x} {y} {} {} 1 {} {} 1] /N X#\n", next.0, next.1, prev.0, prev.1); + let mesh = |x: i32| { + format!( + "/Mesh X!\n%_(DeviceRGB) /CS X#\n%_[0 0] /P X#\n{}{}{}{}%_0 /E X#\n/End X!\n", + corner(x, 0, (x, 10), (x + 10, 0)), + corner(x, 40, (x + 10, 40), (x, 30)), + corner(x + 40, 40, (x + 40, 30), (x + 30, 40)), + corner(x + 40, 0, (x + 30, 0), (x + 40, 10)), + ) + }; + let art_ = format!( + "0 1 0 0 0 Xy\n{}1 0.8 0 0 0 Xy\n0 0 Xd\n6 () XW\n{}0 0 Xd\n6 () XW\n2 0.7 0 0 0 Xy\n{RED}{}f\n", + mesh(0), + mesh(50), + rect_path(100.0, 0.0, 110.0, 10.0) + ); + let doc = read_ok(&layer(&art_)).doc; + let a = art(&doc); + assert!(matches!(a[0].kind, NodeKind::Mesh(_)) && matches!(a[1].kind, NodeKind::Mesh(_)), "{a:#?}"); + assert_eq!((a[0].opacity, a[0].blend), (0.8, BlendMode::Multiply), "the state after the mesh is its own"); + assert_eq!((a[1].opacity, a[1].blend), (0.8, BlendMode::Multiply), "the next mesh keeps the current state"); + assert_eq!((a[2].opacity, a[2].blend), (0.7, BlendMode::Screen), "a state after the mesh's `Xd` and `XW` is the next object's"); +} + #[test] fn gradients() { let defs = "%AI5_BeginGradient: (G)\n(G) 1 2 Bd\n[\n<00FF>\n0\n0 0 0 0 1 0 0 2 1 6 %_BS\n\ diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 4f383bd3dc..b85ff6dbbb 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai`/EPS editing data: mesh corners with handle weights of 0 are read) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai`/EPS editing data: a gradient mesh takes the transparency written after it) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai`/EPS editing data: a gradient mesh takes the transparency (`Xy`) written right after its `/End X!`, before its `Xd` and `XW`, as a group takes the one after its `U`; it was read as the next object's, so a Multiply shadow mesh painted opaque white over the art under it, where the file's page shows the shadow. A user's file now draws such a mesh as its page does. Own-fixture test in `import::ai::tests`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: a gradient mesh corner whose handle weights are 0 (one or both; the others are 1) is read like one whose weights are 1, so a mesh with such corners no longer leaves the whole file coming in as its page or PDF part; other weights still leave the mesh unread. Checked against the pages of two users' files: one opens from its layers 0.6% from its page, the other with 728 live meshes instead of its PDF part's 65,558 patches. Test `import::ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a PDF part whose pages are cropped to the art is recognised in a `UserUnit` page's units too (the art's box in those units, the artboard not the page in points), and its type is read from the first page only, since every such page holds all the art again: the copies on later pages were moved as the first page's and could be put into the layers' text objects. A page cropped to the art is taken only when every page is that box. Tests `import::tests_native::a_user_unit_page_cropped_to_the_art_is_read_in_its_units`, `type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`; scores unchanged | | 2026-10-30 | minor | `.ai` import: when the layers are compared with the page again with placed files at the corner of their box, the text objects the page doesn't draw are weighed with the images there, from the layers as read: before, the text an image covered at its first placement had already been left out, so a file whose image covered type only there came in without that type or as its PDF part. Test `import::tests_native::text_a_placed_file_covers_only_at_its_first_placement_is_kept`; scores unchanged | From 2d4e9dc9c952d96998394746c1be16f0eb915886 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 15:05:16 +0300 Subject: [PATCH 068/227] EPS import: the printer's crop marks after the layers aren't art outside them An Illustrator EPS draws its crop marks after the last layer, between %AI3_BeginCrops and %AI3_EndCrops (inside userdict /AI3_noCropMarks known not { ... } if). The reader took them for art outside the layers, and the whole file came in as its page in one layer. The section is now skipped, as other non-art sections are; the crop area is %AI3_Cropmarks. --- crates/eps/src/import/ai/read/types.rs | 3 +++ crates/eps/src/import/ai/tests.rs | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/crates/eps/src/import/ai/read/types.rs b/crates/eps/src/import/ai/read/types.rs index 95423c94ee..fccbc6c486 100644 --- a/crates/eps/src/import/ai/read/types.rs +++ b/crates/eps/src/import/ai/read/types.rs @@ -246,6 +246,9 @@ pub(super) const SKIPPED: &[(&str, &str)] = &[ ("BeginSymbolList", "EndSymbolList"), ("BeginTextDocument", "EndTextDocument"), ("BeginEncoding", "EndEncoding"), + // The printer's crop marks, drawn after the layers (`userdict /AI3_noCropMarks known not { + // … } if`); the crop area they mark is `%AI3_Cropmarks`. + ("BeginCrops", "EndCrops"), ]; /// The note for versioned content whose `%AI17_End_Versioned_Content` is missing: every diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index 1c3ff8acc7..813113d5b1 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -1929,3 +1929,15 @@ fn a_blend_record_is_read_to_its_length() { let (blend, warnings) = read_blend(&blend_file("%_10 50 m\n%_110 50 L\n", [Some("A"), Some("B")], &longer)); assert!(matches!(blend.kind, NodeKind::Blend { .. }), "{warnings:?}"); } + +/// The printer's crop marks Illustrator draws after the last layer (`%AI3_BeginCrops`, inside +/// `userdict /AI3_noCropMarks known not { … } if`) aren't art outside the layers: the file reads +/// from its layers, without them (the crop area is `%AI3_Cropmarks`). +#[test] +fn crop_marks_after_the_layers_are_not_art() { + let crops = "%AI3_BeginCrops\nuserdict /AI3_noCropMarks known not {\n0 A\nu\n0 R\n1 1 1 1 ([Registration]) 0 XS\n\ + 0 J 0 j 0.5 w 4 M []0 d\n0 XR\n-9 -400 m\n-36 -400 L\nS\nU\n} if\n%AI3_EndCrops\n"; + let r = read_ok(&format!("{}{crops}", layer(&(rect_path(0.0, 0.0, 1.0, 1.0) + "f\n")))); + assert_eq!(art(&r.doc).len(), 1); + assert_eq!(r.doc.layers.len(), 1); +} From 67c8d86c6ff636653638f7ac3b6b34c0592d2886 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 20:54:02 +0300 Subject: [PATCH 069/227] .ai import: a page's type inside placed files needs no text object A .ai whose layers hold placed (linked) PDFs and no text object came in as its PDF part, saying its layers had no text objects for its page's text. The PDF part draws each placed file, type and all, where the layers show its preview, so type that lies inside the placed files (at either of their placements) is theirs and needs no text object. Type outside them still does. --- crates/eps/src/import/native/build.rs | 38 +++++++++++++++++++- crates/eps/src/import/tests_native.rs | 51 +++++++++++++++++++++++++++ docs/file-format-parity.md | 3 +- 3 files changed, 90 insertions(+), 2 deletions(-) diff --git a/crates/eps/src/import/native/build.rs b/crates/eps/src/import/native/build.rs index c36013cb8c..92d80c2cdf 100644 --- a/crates/eps/src/import/native/build.rs +++ b/crates/eps/src/import/native/build.rs @@ -179,7 +179,12 @@ pub(super) fn build_from( return Err("its type is to come in as outlines, which only its page has".into()); } if infos.iter().all(|i| !i.shown) && !shown.is_empty() { - return Err("its page has text, and its layers have no text objects to put it in".into()); + if !in_placed_files(&shown, &doc, &placed_elsewhere) { + return Err("its page has text, and its layers have no text objects to put it in".into()); + } + // The page's type is all inside placed files: it is theirs, which their previews show, and + // needs no text object. + shown.clear(); } // The page's type is compared with every text object of the layers: that has its limits. if infos.len() > MAX_SLOTS || infos.len().saturating_mul(shown.len()) > MAX_PAIRS { @@ -290,6 +295,37 @@ fn same_size(r: Option, page: &Document) -> bool { (r.width() - p.width()).abs() <= 0.5 && (r.height() - p.height()).abs() <= 0.5 } +/// Does all of `objects` (the page's text objects) lie inside placed files that show in `doc`? The +/// page draws a placed file, type and all, where the layers show its preview (a linked image, see +/// `ai::Reader::end_place`), at its first placement or at the other one that `placed` lists (see +/// [`elsewhere`]). +fn in_placed_files(objects: &[Vec>], doc: &Document, placed: &[(NodeId, Affine)]) -> bool { + let inside = |d: &Document| { + let mut files = vec![]; + placed_files(&d.layers, &mut files); + !files.is_empty() + && objects + .iter() + .all(|o| extent(o).is_some_and(|r| files.iter().any(|f: &Rect| f.inflate(OUTLINE_REACH, OUTLINE_REACH).contains_rect(r)))) + }; + inside(doc) || elsewhere(doc, placed).is_some_and(|other| inside(&other)) +} + +/// Where the placed files that show in `nodes` are: the linked images the editing data's reader +/// makes of them. +fn placed_files(nodes: &[Arc], out: &mut Vec) { + for n in nodes.iter().filter(|n| n.visible) { + match &n.kind { + NodeKind::Image(im) if im.link.is_some() => out.extend(n.visual_bounds()), + _ => { + if let Some(c) = n.children() { + placed_files(c, out); + } + } + } + } +} + /// Does the editing data's first artboard `board` (in the document read from it: art space through /// `to_doc`) have the size of `page`'s first artboard in units of `unit` points, `unit` being above /// 1, and not its size in points? `page` is a PDF part read in points from pages of `unit` points a diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index d4699b06d8..d49b89540d 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -266,6 +266,57 @@ fn an_ai_file_with_an_image_too_large_for_its_editing_data_comes_in_as_its_pdf_p assert!(read, "{warnings:?}"); } +/// A `.ai` whose layers hold a placed PDF and no text object: its PDF part draws the placed file, +/// type and all, where the layers show the file's preview. That type is the placed file's and needs +/// no text object, so the file comes in from its layers, the placed file where its matrix takes the +/// canvas point of art space's origin or at the corner of its box (see +/// `a_placed_file_at_its_boxs_corner_matches_the_page`). Type outside the placed file still needs +/// one, and without it the file comes in as its PDF part. +#[test] +fn type_of_the_page_inside_a_placed_file_needs_no_text_object() { + // A file placed on (30, 30)–(70, 70) whose preview is 2 × 2 pixels of half-transparent black, + // as in `a_placed_file_at_its_boxs_corner_matches_the_page`; with the template box, the canvas + // point of art space's origin puts it off the page, and the box's corner on it. + let place = format!( + "%AI5_BeginPlace\n%%FileType: 1\n[1 0 0 -1 -7970 8070] 8000 8000 8040 8040 4 4 0\n(/files/pages.pdf)`\n\ + %AI26_BeginPlacedObjectPreview\n2 2 8 32 17 {}\n%AI26_EndPlacedObjectPreview\n~\n%AI5_EndPlace\n", + "\x7f\0\0\0".repeat(4) + ); + let at_origin = native(&layer("Pages", true, &place)); + let at_corner = at_origin.replace("%AI5_NumLayers", "%AI3_TemplateBox: 100 50 100 50\n%AI5_NumLayers"); + // The PDF part: the placed file's page in 50% grey, and type at (`x`, 55). + let pdf = |x: f64| { + let mut d = Document::new(100.0, 100.0); + let grey = vectorcraft_doc::FillLayer::new(vectorcraft_color::Paint::solid(vectorcraft_color::Color::gray(0.5))); + let rect = vectorcraft_geom::shapes::rectangle(vectorcraft_geom::Rect::new(30.0, 30.0, 70.0, 70.0)); + let page = Node::path( + d.alloc_id(), + rect, + vectorcraft_doc::Appearance { items: vec![vectorcraft_doc::AppearanceItem::Fill(grey)], ..Default::default() }, + ); + let style = vectorcraft_doc::CharStyle { size: 14.0, ..Default::default() }; + let text = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::new(x, 55.0), "Hi", style); + let text = Node::new(d.alloc_id(), NodeKind::Text(Box::new(text))); + let layer = d.layers[0].id; + d.insert(Some(layer), 0, page).unwrap(); + d.insert(Some(layer), 1, text).unwrap(); + d + }; + for data in [&at_origin, &at_corner] { + let (d, warnings, read) = crate::layered_ai(&private(data), pdf(38.0), vec![], false, false, 1.0); + assert!(read, "{warnings:?}"); + assert_eq!(names(&d), ["Pages"]); + let mut links = vec![]; + d.visit_images(|_, im| links.extend(im.link.as_ref().map(|l| l.path.clone()))); + assert_eq!(links, ["/files/pages.pdf"], "{warnings:?}"); + assert!(warnings.iter().all(|w| !w.contains("no text object")), "the type is the placed file's, not left out: {warnings:?}"); + // Type beside the placed file is a text object's, which the layers don't have. + let (_, warnings, read) = crate::layered_ai(&private(data), pdf(5.0), vec![], false, false, 1.0); + assert!(!read, "{warnings:?}"); + assert!(warnings.iter().any(|w| w.contains("its layers have no text objects")), "{warnings:?}"); + } +} + /// A palette of `[None]` and White, and a color group `Inks` holding a spot color, Red ink. const PALETTE: &str = "%AI5_BeginPalette\n0 0 Pb\n0 0 0 0 1 1 1 Xa\n(White)\nPc\n1 (Inks) 1 Pg\n0.06 0.98 1 0 (Red ink) 0 x\n(Red ink)\nPc\nPB\n%AI5_EndPalette\n"; diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index b85ff6dbbb..b24f517429 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai`/EPS editing data: a gradient mesh takes the transparency written after it) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: a page's type inside placed files needs no text object) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai` import: a file whose layers hold placed (linked) PDFs and no text object comes in from its layers when all of its page's type lies inside the placed files (at either of their placements): the PDF part draws each placed file, type and all, where the layers show its preview, so that type needs no text object. Such a file came in as its PDF part, saying its layers had no text objects for its page's text; type outside the placed files still needs one. Own-fixture test in `import::tests_native`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: a gradient mesh takes the transparency (`Xy`) written right after its `/End X!`, before its `Xd` and `XW`, as a group takes the one after its `U`; it was read as the next object's, so a Multiply shadow mesh painted opaque white over the art under it, where the file's page shows the shadow. A user's file now draws such a mesh as its page does. Own-fixture test in `import::ai::tests`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: a gradient mesh corner whose handle weights are 0 (one or both; the others are 1) is read like one whose weights are 1, so a mesh with such corners no longer leaves the whole file coming in as its page or PDF part; other weights still leave the mesh unread. Checked against the pages of two users' files: one opens from its layers 0.6% from its page, the other with 728 live meshes instead of its PDF part's 65,558 patches. Test `import::ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a PDF part whose pages are cropped to the art is recognised in a `UserUnit` page's units too (the art's box in those units, the artboard not the page in points), and its type is read from the first page only, since every such page holds all the art again: the copies on later pages were moved as the first page's and could be put into the layers' text objects. A page cropped to the art is taken only when every page is that box. Tests `import::tests_native::a_user_unit_page_cropped_to_the_art_is_read_in_its_units`, `type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`; scores unchanged | From 7b4a65e23100c0571291ff2366ce7278c279bceb Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:55:25 +0300 Subject: [PATCH 070/227] fix(ai-import): put placed files where they draw closer to the page The corner placement of placed files was tried only when the first placement failed the comparison with the page. A small logo in the wrong place differs too little to fail, so it stayed there. When the corner placement draws closer to the page and still matches it, use it. --- crates/eps/src/import/native/build.rs | 17 ++++++++++++++++- crates/eps/src/import/tests_native.rs | 25 +++++++++++++++++++++++++ docs/file-format-parity.md | 3 ++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/crates/eps/src/import/native/build.rs b/crates/eps/src/import/native/build.rs index 92d80c2cdf..bf1611fc70 100644 --- a/crates/eps/src/import/native/build.rs +++ b/crates/eps/src/import/native/build.rs @@ -247,7 +247,22 @@ pub(super) fn build_from( let unseen = prune_unseen(&frame, &mut view, &mut doc); let unseen_note = |n: usize| (n > 0).then(|| format!("{n} {UNSEEN_TEXT}")); match compare(&frame, &mut view, &doc) { - Ok(note) => notes.extend(unseen_note(unseen).into_iter().chain(note)), + // Placed files at the other point their data gives, where that draws closer to the + // page: a small image in the wrong place differs too little to fail. + Ok(note) => { + let closer = other.and_then(|mut other| { + let unseen = prune_unseen(&frame, &mut view, &mut other); + let closer = view.difference(&other, frame.rect).any < view.difference(&doc, frame.rect).any; + closer.then(|| compare(&frame, &mut view, &other).ok()).flatten().map(|note| (other, unseen, note)) + }); + match closer { + Some((other, unseen, note)) => { + doc = other; + notes.extend(unseen_note(unseen).into_iter().chain(note)); + } + None => notes.extend(unseen_note(unseen).into_iter().chain(note)), + } + } // Placed files at the other point their data gives, where that draws as the page. Err(why) => match other.map(|mut other| { let unseen = prune_unseen(&frame, &mut view, &mut other); diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index d49b89540d..5183a46a8c 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -1728,6 +1728,31 @@ fn a_placed_file_at_its_boxs_corner_matches_the_page() { assert!([b.x0 - 30.0, b.y0 - 30.0, b.x1 - 70.0, b.y1 - 70.0].iter().all(|v| v.abs() < 0.01), "on the page's square: {b:?}"); } +#[test] +fn a_small_placed_file_goes_where_it_draws_closer_to_the_page() { + // A 2 × 2 placed file (a small logo on a large page) whose box corner the matrix takes to + // (30, 30)–(32, 32), as the page draws it. The template box's canvas point puts it at + // (10, 10)–(12, 12): on the page too, and small enough that the layers pass the comparison + // there all the same. + let place = format!( + "%AI5_BeginPlace\n%%FileType: 1\n[1 0 0 -1 -7970 8070] 8000 8000 8002 8002 4 4 0\n(logo.png)`\n\ + %AI26_BeginPlacedObjectPreview\n2 2 8 32 17 {}\n%AI26_EndPlacedObjectPreview\n~\n%AI5_EndPlace\n", + "\x7f\0\0\0".repeat(4) + ); + let data = native(&layer("Jig", true, &place)).replace("%AI5_NumLayers", "%AI3_TemplateBox: 211.5 -211.5 211.5 -211.5\n%AI5_NumLayers"); + let mut page = Document::new(100.0, 100.0); + let id = page.alloc_id(); + let path = vectorcraft_geom::shapes::rectangle(vectorcraft_geom::Rect::new(30.0, 30.0, 32.0, 32.0)); + let grey = vectorcraft_doc::FillLayer::new(vectorcraft_color::Paint::solid(vectorcraft_color::Color::gray(0.5))); + let n = Node::path(id, path, vectorcraft_doc::Appearance { items: vec![vectorcraft_doc::AppearanceItem::Fill(grey)], ..Default::default() }); + let l = page.layers[0].id; + page.insert(Some(l), 0, n).unwrap(); + let (d, w, read) = crate::layered_ai(&private(&data), page, vec![], false, false, 1.0); + assert!(read, "{w:?}"); + let b = d.layers[0].children().unwrap()[0].geometric_bounds().unwrap(); + assert!([b.x0 - 30.0, b.y0 - 30.0, b.x1 - 32.0, b.y1 - 32.0].iter().all(|v| v.abs() < 0.01), "on the page's square: {b:?}"); +} + #[test] fn text_a_placed_file_covers_only_at_its_first_placement_is_kept() { const OPAQUE: &str = ""; diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index b24f517429..971aa3984b 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: a page's type inside placed files needs no text object) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: placed files go where they draw closer to the page) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai` import: a placed (linked) file whose data gives two placements is put at the corner of its box when that draws closer to the page and the layers still match it, not only when the first placement fails the comparison: a small logo in the wrong place differed too little to fail, and stayed there. Test `import::tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a file whose layers hold placed (linked) PDFs and no text object comes in from its layers when all of its page's type lies inside the placed files (at either of their placements): the PDF part draws each placed file, type and all, where the layers show its preview, so that type needs no text object. Such a file came in as its PDF part, saying its layers had no text objects for its page's text; type outside the placed files still needs one. Own-fixture test in `import::tests_native`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: a gradient mesh takes the transparency (`Xy`) written right after its `/End X!`, before its `Xd` and `XW`, as a group takes the one after its `U`; it was read as the next object's, so a Multiply shadow mesh painted opaque white over the art under it, where the file's page shows the shadow. A user's file now draws such a mesh as its page does. Own-fixture test in `import::ai::tests`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: a gradient mesh corner whose handle weights are 0 (one or both; the others are 1) is read like one whose weights are 1, so a mesh with such corners no longer leaves the whole file coming in as its page or PDF part; other weights still leave the mesh unread. Checked against the pages of two users' files: one opens from its layers 0.6% from its page, the other with 728 live meshes instead of its PDF part's 65,558 patches. Test `import::ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`; scores unchanged | From 1a5f0fb099a1ae1b8524a0854af6dc59af1ba5e9 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 21:47:34 +0300 Subject: [PATCH 071/227] fix(ai-import): space type on a path round curves as the file lays it out Type on a path from the editing data's text document came in at the font's advances, while the file's own layout (and its page) closes the glyphs up round the outside of a curve and opens them up round the inside, even where the frame keeps no spacing. Round a circle the type ran on past where the page ends it. The spacing (Type on a Path Options > Spacing) that reproduces the layout is now fitted from the layout's glyph positions, advances and turns, using the text engine's own model, and set on the imported text object. Corners and straight runs are left out of the fit. --- crates/eps/src/import/ate.rs | 108 +++++++++++++++++++++++++- crates/eps/src/import/tests_native.rs | 78 +++++++++++++++++++ docs/file-format-parity.md | 3 +- 3 files changed, 186 insertions(+), 3 deletions(-) diff --git a/crates/eps/src/import/ate.rs b/crates/eps/src/import/ate.rs index 21198305dd..875a046fc0 100644 --- a/crates/eps/src/import/ate.rs +++ b/crates/eps/src/import/ate.rs @@ -281,6 +281,8 @@ pub(super) struct Story { paras: Vec<(usize, Para)>, /// `(characters, style)` in order. runs: Vec<(usize, Style)>, + /// Type on a path: the spacing its first frame's layout implies ([`path_spacing`]). + path_spacing: f64, } #[derive(Clone, Debug)] @@ -408,8 +410,11 @@ impl Texts { return None; } // The first frame's layout, when the file keeps one: where its lines start. - let (mut anchor, mut lines) = ((0.0, 0.0), vec![]); + let (mut anchor, mut lines, mut path_spacing) = ((0.0, 0.0), vec![], 0.0); if let Some(f) = view.get("2").and_then(|l| find_node(l, "F")) { + if matches!(frames.first(), Some(FrameKind::OnPath { .. })) { + path_spacing = self::path_spacing(f); + } if let Some(a) = f.get("0").and_then(|a| a.get("0")).and_then(Val::nums) && let [x, y, ..] = a.as_slice() { @@ -441,7 +446,7 @@ impl Texts { if runs.is_empty() { runs.push((text.chars().count(), self.style(None))); } - Some(Story { text, anchor, lines, frames, paras, runs }) + Some(Story { text, anchor, lines, frames, paras, runs, path_spacing }) } /// A paragraph's attributes: its own keys, else the document's. @@ -572,6 +577,50 @@ fn length_fraction(segments: &[[f64; 8]], t: f64) -> f64 { ((before + within) / total).clamp(0.0, 1.0) } +/// The spacing (Type on a Path Options › Spacing) that the layout `f` of type on a path implies. +/// The file closes its glyphs up round the outside of a curve and opens them up round the inside, +/// even where its frame keeps no spacing; the text engine spaces glyphs that way by the spacing +/// (`vectorcraft_text`'s `path_steps`): between two glyphs' centres, the path's length `s`, their +/// advances' mean `a` and how far it turns `t` (away from their tops) make `s + t × spacing = a`. +/// Fitted over every pair of the layout's glyphs; none where the path doesn't turn under them. +fn path_spacing(f: &Val) -> f64 { + let mut found = vec![]; + find_nodes(f, "G", &mut found); + let (mut sum, mut turns) = (0.0, 0.0); + for g in found { + // Each glyph's origin, its matrix (along its baseline, then towards its foot) and where it + // ends along the line; the lists end with where the line ends. + let Some(at) = g.get("21") else { continue }; + let list = |k: &str| at.get(k).and_then(Val::nums).unwrap_or_default(); + let (xs, ys, matrices, ends) = (list("1"), list("2"), list("3"), list("4")); + let glyphs: Vec<(Point, f64, kurbo::Vec2, kurbo::Vec2)> = xs + .iter() + .zip(&ys) + .zip(matrices.as_chunks::<6>().0) + .zip(ends.windows(2)) + .map(|(((x, y), [a, b, c, d, ..]), e)| { + let advance = e.get(1).zip(e.first()).map_or(0.0, |(e1, e0)| e1 - e0); + let along = kurbo::Vec2::new(*a, *b); + (Point::new(*x, *y) + along * (advance * 0.5), advance, along, kurbo::Vec2::new(*c, *d)) + }) + .collect(); + for w in glyphs.windows(2) { + let [(p, a0, along, foot), (q, a1, next, _)] = w else { continue }; + let turn = next.dot(*foot).atan2(next.dot(*along)); + // The length of the arc between the centres (the path is taken to be round there). A + // corner (a turn of more than a radian between two glyphs) isn't round: left out. + let half = turn.abs() * 0.5; + let length = if half > 1e-9 { (*q - *p).hypot() * half / half.sin() } else { (*q - *p).hypot() }; + if turn.abs() <= 1.0 && length.is_finite() && a0.is_finite() && a1.is_finite() { + sum += ((a0 + a1) * 0.5 - length) * turn; + turns += turn * turn; + } + } + } + let spacing = sum / turns; + if turns > 1e-6 && spacing.is_finite() { spacing.clamp(-1000.0, 1000.0) } else { 0.0 } +} + impl Story { /// How many bytes of text the story has. pub(super) fn len(&self) -> usize { @@ -711,6 +760,9 @@ impl Story { if paras.len() > 1 && paras.iter().any(|p| *p != t.para) { t.paras = paras; } + if matches!(kind, TextKind::OnPath { .. }) && !threaded { + t.path_spacing = self.path_spacing * scale; + } t.kind = kind; t.xf = xf; Some(Node::new(id, NodeKind::Text(Box::new(t)))) @@ -1015,9 +1067,61 @@ mod tests { caps: 0, }, )], + path_spacing: 0.0, } } + /// A layout of glyphs `advances` wide round a circle of radius `radius` (y down), from its left, + /// outside it (their feet towards its centre) or inside it, the length of the circle between + /// their centres `fraction` of their advances' mean. + fn round_layout(advances: &[f64], radius: f64, outside: bool, fraction: f64) -> Val { + let sign = if outside { 1.0 } else { -1.0 }; + let (mut xs, mut ys, mut matrices, mut ends) = (vec![], vec![], vec![], vec![0.0]); + let mut angle = std::f64::consts::PI; + for (i, a) in advances.iter().enumerate() { + if i > 0 { + angle += sign * (advances[i - 1] + a) * 0.5 * fraction / radius; + } + // Outside, clockwise on the page (y down); inside, the other way round. + let along = (-angle.sin() * sign, angle.cos() * sign); + let centre = (radius * angle.cos(), radius * angle.sin()); + xs.push(centre.0 - along.0 * a * 0.5); + ys.push(centre.1 - along.1 * a * 0.5); + matrices.extend([along.0, along.1, -along.1, along.0, 0.0, 0.0]); + ends.push(ends[i] + a); + } + let nums = |v: &[f64]| v.iter().map(|n| format!("{n}")).collect::>().join(" "); + let doc = format!( + "/0 << /99 /F /6 [ << /99 /L /6 [ << /99 /S /6 [ << /99 /G /21 << /1 [ {} ] /2 [ {} ] /3 [ {} ] /4 [ {} ] >> >> ] >> ] >> ] >>", + nums(&xs), + nums(&ys), + nums(&matrices), + nums(&ends) + ); + read(doc.as_bytes()).unwrap().get("0").unwrap().clone() + } + + /// The file lays type on a path out closer round the outside of a curve and further apart round + /// the inside: the spacing that does that is read from its layout, as the text engine's model + /// has it (length + turn × spacing = advance). + #[test] + fn the_layout_of_type_on_a_path_gives_its_spacing() { + let advances = [20.0, 30.0, 10.0, 25.0, 20.0]; + // Outside a circle of radius 100, 10 above the path: the centres are 100/110 of the advances apart. + let spacing = path_spacing(&round_layout(&advances, 100.0, true, 100.0 / 110.0)); + assert!((spacing - 10.0).abs() < 1e-6, "{spacing}"); + // Inside it, 20 above the path: 100/80 of them. + let spacing = path_spacing(&round_layout(&advances, 100.0, false, 100.0 / 80.0)); + assert!((spacing - 20.0).abs() < 1e-6, "{spacing}"); + // At their advances: none. + assert!(path_spacing(&round_layout(&advances, 100.0, true, 1.0)).abs() < 1e-6); + // Corners (here a turn of about four radians from glyph to glyph) aren't taken for a curve. + assert_eq!(path_spacing(&round_layout(&advances, 5.0, true, 1.0)), 0.0); + // A straight line turns nowhere, and a layout without glyphs says nothing. + assert_eq!(path_spacing(&round_layout(&advances, 1e12, true, 0.9)), 0.0); + assert_eq!(path_spacing(&read(b"/99 /F").unwrap()), 0.0); + } + /// The leading of the text object a story comes in as. fn leading_of(story: &Story) -> Option { let node = story.node(NodeId(1), 0, (0.0, 0.0), Affine::IDENTITY)?; diff --git a/crates/eps/src/import/tests_native.rs b/crates/eps/src/import/tests_native.rs index 5183a46a8c..fb1c65c914 100644 --- a/crates/eps/src/import/tests_native.rs +++ b/crates/eps/src/import/tests_native.rs @@ -1490,6 +1490,84 @@ fn area_type_and_type_on_a_path_come_from_the_text_document() { assert!(!r.warnings.iter().any(|w| w.contains("couldn't be read")), "{:?}", r.warnings); } +/// A story of `text` on frame 0 whose layout sets glyphs `advance` wide round the outside of a +/// circle of radius `radius`, the circle's length between their centres `fraction` of an advance. +fn round_story(text: &str, advance: f64, radius: f64, fraction: f64) -> String { + let n = text.chars().count(); + let (mut xs, mut ys, mut matrices, mut ends) = (vec![], vec![], vec![], vec![]); + for i in 0..=n { + // From the circle's left, clockwise on the canvas (y down), feet towards its centre. + let angle = std::f64::consts::PI + i as f64 * advance * fraction / radius; + let along = (-angle.sin(), angle.cos()); + xs.push(radius * angle.cos() - along.0 * advance * 0.5); + ys.push(radius * angle.sin() - along.1 * advance * 0.5); + matrices.push(format!("{} {} {} {} 0 0", along.0, along.1, -along.1, along.0)); + ends.push(i as f64 * advance); + } + let nums = |v: &[f64]| v.iter().map(|x| format!("{x}")).collect::>().join(" "); + format!( + "<< /0 << /0 ({text}) /5 << /0 [ << /0 << /0 << /0 () /5 << /0 0 >> /6 0 >> >> /1 {n} >> ] >> \ + /6 << /0 [ << /0 << /0 << /0 () /5 0 /6 << /1 12.0 >> >> >> /1 {n} >> ] >> >> /1 << /0 [ << /0 0 >> ] \ + /2 [ << /99 /PC /6 [ << /99 /F /6 [ << /99 /L /6 [ << /99 /S /6 [ << /99 /G /21 << /1 [ {} ] /2 [ {} ] /3 [ {} ] /4 [ {} ] >> >> ] >> ] >> ] >> ] >> ] >> >>", + nums(&xs), + nums(&ys), + matrices.join(" "), + nums(&ends) + ) +} + +/// The file closes type up round the outside of a curve (its layout puts the glyphs' centres +/// closer than their advances), though the frame has no spacing of its own: the type comes in +/// spaced as the layout is, not at its advances, so it doesn't run on past where the page ends it. +#[test] +fn type_round_a_circle_is_spaced_as_the_file_lays_it_out() { + // A circle of radius 40 round the middle of the page, in four cubics from its right, clockwise + // on the page; the type from its left, over the top, round almost all of it. + let k = 40.0 * 0.552_284_75; + let points = [ + (90.0, 50.0), + (90.0, 50.0 - k), + (50.0 + k, 10.0), + (50.0, 10.0), + (50.0 - k, 10.0), + (10.0, 50.0 - k), + (10.0, 50.0), + (10.0, 50.0 + k), + (50.0 - k, 90.0), + (50.0, 90.0), + (50.0 + k, 90.0), + (90.0, 50.0 + k), + (90.0, 50.0), + ]; + let all: Vec<(f64, f64)> = points.iter().map(|(x, y)| canvas(*x, *y)).collect(); + let segment = |i: usize| (0..4).map(|j| format!("{} {}", all[i * 3 + j].0, all[i * 3 + j].1)).collect::>().join(" "); + let frame = + format!("<< /0 << /0 [ 0 0 ] /1 << /0 [ {} ] >> /2 << /0 2 /6 [ 2.0 5.99 ] >> >> >>", (0..4).map(segment).collect::>().join(" ")); + // Glyphs 5 apart, their centres 5 × 40/48 apart round the circle: spaced 8 above the path. + let doc = document_of(&[frame], &[round_story("abcdefgh", 5.0, 40.0, 40.0 / 48.0)]); + let art = native_with_text(&(layer("Back", true, &square(10, 10)) + &layer("Spare", false, &text_object(0))), &doc); + let r = import(&eps(&page_square(10, 10), &art)).unwrap(); + let texts = text_of(&r.document.layers[1]); + assert_eq!(texts.len(), 1, "{:?}", r.warnings); + let t = texts[0]; + assert!(matches!(t.kind, vectorcraft_doc::TextKind::OnPath { .. }), "{:?}", t.kind); + assert!((t.path_spacing - 8.0).abs() < 0.05, "{}", t.path_spacing); + // Laid out, the glyphs' centres are 40/48 of their advances apart round the circle. + let layout = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), t); + let centres: Vec<(f64, f64)> = layout + .glyphs + .iter() + .map(|g| (g.origin.x + g.angle.cos() * g.advance * 0.5 - 50.0, g.origin.y + g.angle.sin() * g.advance * 0.5 - 50.0, g.advance)) + .map(|(x, y, a)| (y.atan2(x), a)) + .collect(); + assert_eq!(centres.len(), 8); + for w in centres.windows(2) { + let turn = (w[1].0 - w[0].0 + std::f64::consts::PI).rem_euclid(std::f64::consts::TAU) - std::f64::consts::PI; + let ratio = turn.abs() * 40.0 / ((w[0].1 + w[1].1) * 0.5); + assert!((ratio - 40.0 / 48.0).abs() < 0.01, "{ratio}"); + } +} + #[test] fn threaded_area_type_flows_through_its_frames() { let frames = [ diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 971aa3984b..4b487b5a40 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: placed files go where they draw closer to the page) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: type on a path spaced round curves as the file lays it out) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai`/EPS editing data: type on a path is spaced round curves as the file's own layout spaces it, closer round the outside and further apart round the inside, though its frame keeps no spacing: the Type on a Path Options › Spacing that does that is fitted from the layout's glyph positions, where it came in at the font's advances and ran on past where the page ends it. In 8 files of a user's set with type round curves (19 stories), the fitted spacing is a fifth of the line's ascent outside a curve (17 stories) and half of it inside (2), and the 4 files whose pages were measured space their glyphs as their layouts do. Own-fixture tests in `import::tests_native` and `import::ate`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file whose data gives two placements is put at the corner of its box when that draws closer to the page and the layers still match it, not only when the first placement fails the comparison: a small logo in the wrong place differed too little to fail, and stayed there. Test `import::tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a file whose layers hold placed (linked) PDFs and no text object comes in from its layers when all of its page's type lies inside the placed files (at either of their placements): the PDF part draws each placed file, type and all, where the layers show its preview, so that type needs no text object. Such a file came in as its PDF part, saying its layers had no text objects for its page's text; type outside the placed files still needs one. Own-fixture test in `import::tests_native`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: a gradient mesh takes the transparency (`Xy`) written right after its `/End X!`, before its `Xd` and `XW`, as a group takes the one after its `U`; it was read as the next object's, so a Multiply shadow mesh painted opaque white over the art under it, where the file's page shows the shadow. A user's file now draws such a mesh as its page does. Own-fixture test in `import::ai::tests`; scores unchanged | From a0da3faffebafc0772b5a1902d66fd55b60501e6 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 10:10:21 -0700 Subject: [PATCH 072/227] Swatches: a Shift-click after switching documents starts a new range The panel cleared its swatch selection when the active document or the selected art changed, but kept the Shift-click range anchor. A Shift-click in the other document then selected every swatch from a name clicked in the first document (for example White) to the clicked one. The anchor is now cleared with the selection, so the Shift-click selects only the clicked swatch. --- crates/ui-egui/src/panels/swatches/body.rs | 1 + crates/ui-egui/src/panels/swatches/tests.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/crates/ui-egui/src/panels/swatches/body.rs b/crates/ui-egui/src/panels/swatches/body.rs index 9147960baa..611b12d6d3 100644 --- a/crates/ui-egui/src/panels/swatches/body.rs +++ b/crates/ui-egui/src/panels/swatches/body.rs @@ -159,6 +159,7 @@ pub(super) fn focus_swatch(app: &VectorcraftApp, ui: &Ui, active: Option<&str>) let reselected = last_art.as_ref().is_some_and(|l| *l != art); if reselected { set_pstate(ui.ctx(), "swatch-selected", Vec::::new()); + set_pstate(ui.ctx(), "swatch-anchor", String::new()); } let changed = reselected || last_art.is_none() || last_swatch.as_deref() != active; set_pstate(ui.ctx(), "swatch-focus", (Some(art), active.map(str::to_string))); diff --git a/crates/ui-egui/src/panels/swatches/tests.rs b/crates/ui-egui/src/panels/swatches/tests.rs index 7d751fe9d5..c659413703 100644 --- a/crates/ui-egui/src/panels/swatches/tests.rs +++ b/crates/ui-egui/src/panels/swatches/tests.rs @@ -133,6 +133,21 @@ fn modifier_clicks_select_several_swatches_and_groups() { assert_eq!(selected(&ctx), ["Grays"], "a plain click on a group selects it alone"); } +#[test] +fn switching_documents_clears_the_swatch_range_anchor() { + let mut app = app(); + let ctx = context(); + click_tile(&mut app, &ctx, "White", Modifiers::NONE, 0.0); + assert_eq!(selected(&ctx), ["White"]); + + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + frame(&mut app, &ctx, vec![], 1.0, show); + assert!(selected(&ctx).is_empty()); + + click_tile(&mut app, &ctx, "Black", Modifiers::SHIFT, 2.0); + assert_eq!(selected(&ctx), ["Black"]); +} + /// A color swatch or a recent color clicked in the panel becomes the Color Guide's base color /// (#3137); a modifier click only selects. #[test] From e556dacbb61f796c32219d42cfb43ca8b84ae03d Mon Sep 17 00:00:00 2001 From: bflatastic Date: Sat, 31 Oct 2026 01:11:25 +0700 Subject: [PATCH 073/227] =?UTF-8?q?Add-ons:=20Artwork=20Cleanup=20?= =?UTF-8?q?=E2=80=94=20text=20tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Object › Plug-ins › Artwork Cleanup and a hideable Text row in its panel gain text tools, each one undo step: - Break Text into Lines / Paragraphs / Words / Glyphs: point type pieces placed by the glyph of their first character, keeping their styles. - Combine Point Text: one-line point type merged into as few objects as it can, every glyph staying where it was (tracking and spaces, checked against the layout). - Split Text at Cursor, Remove Line Breaks, Remove Paragraph Breaks, Set Alignment, Keep Position, Reset Text Transform and Replace Missing Fonts. --- crates/engine/src/cmd/addons/cleanup.rs | 10 +- crates/engine/src/cmd/addons/cleanup/text.rs | 865 ++++++++++++++++++ .../src/cmd/addons/cleanup/text/tests.rs | 307 +++++++ crates/engine/tests/command_sweep.rs | 54 ++ crates/ui-egui/src/addons/cleanup.rs | 150 ++- crates/ui-egui/src/addons/cleanup/tests.rs | 108 +++ crates/ui-egui/src/i18n/bg.tsv | 44 + crates/ui-egui/src/i18n/ca.tsv | 44 + crates/ui-egui/src/i18n/cs.tsv | 44 + crates/ui-egui/src/i18n/da.tsv | 44 + crates/ui-egui/src/i18n/de.tsv | 44 + crates/ui-egui/src/i18n/el.tsv | 44 + crates/ui-egui/src/i18n/es.tsv | 44 + crates/ui-egui/src/i18n/fi.tsv | 44 + crates/ui-egui/src/i18n/fr.tsv | 44 + crates/ui-egui/src/i18n/hu.tsv | 44 + crates/ui-egui/src/i18n/id.tsv | 44 + crates/ui-egui/src/i18n/it.tsv | 44 + crates/ui-egui/src/i18n/ja.tsv | 44 + crates/ui-egui/src/i18n/ka.tsv | 44 + crates/ui-egui/src/i18n/ko.tsv | 44 + crates/ui-egui/src/i18n/nl.tsv | 44 + crates/ui-egui/src/i18n/pl.tsv | 44 + crates/ui-egui/src/i18n/pt-br.tsv | 44 + crates/ui-egui/src/i18n/ru.tsv | 44 + crates/ui-egui/src/i18n/sv.tsv | 44 + crates/ui-egui/src/i18n/tr.tsv | 44 + crates/ui-egui/src/i18n/uk.tsv | 44 + crates/ui-egui/src/i18n/vi.tsv | 44 + crates/ui-egui/src/i18n/zh-hans.tsv | 44 + crates/ui-egui/src/i18n/zh-hant.tsv | 44 + docs/mcp.md | 43 + docs/target-app-parity.md | 11 +- docs/ui-parity.md | 4 +- 34 files changed, 2637 insertions(+), 15 deletions(-) create mode 100644 crates/engine/src/cmd/addons/cleanup/text.rs create mode 100644 crates/engine/src/cmd/addons/cleanup/text/tests.rs diff --git a/crates/engine/src/cmd/addons/cleanup.rs b/crates/engine/src/cmd/addons/cleanup.rs index 0b29b07e26..972fb79041 100644 --- a/crates/engine/src/cmd/addons/cleanup.rs +++ b/crates/engine/src/cmd/addons/cleanup.rs @@ -1,10 +1,12 @@ //! Artwork Cleanup (`addon.cleanup.*`), a built-in add-on: Simplify Anchors (Keep Shape), the //! Document Health Check (check, show and fix the issues it finds), Deep Ungroup and Rejoin Path -//! Pieces. Its panel and its submenu, Object › Plug-ins › Artwork Cleanup, are the UI's. +//! Pieces, and its text tools ([`text`]). Its panel and its submenu, Object › Plug-ins › Artwork +//! Cleanup, are the UI's. mod checks; #[cfg(test)] mod tests; +mod text; use serde_json::{Map, Value, json}; use vectorcraft_doc::{Document, Node, NodeId, NodeKind}; @@ -30,7 +32,7 @@ const FIX_ROUNDS: usize = 3; const MAX_LISTED: usize = 1000; pub fn specs() -> Vec { - vec![ + let mut v = vec![ cmd!( "addon.cleanup.simplify", "Simplify Anchors (Keep Shape)…", @@ -85,7 +87,9 @@ pub fn specs() -> Vec { has_selection, rejoin ), - ] + ]; + v.extend(text::specs()); + v } /// The paths (not guides) under `roots`, compound path members included. diff --git a/crates/engine/src/cmd/addons/cleanup/text.rs b/crates/engine/src/cmd/addons/cleanup/text.rs new file mode 100644 index 0000000000..26a37efbf1 --- /dev/null +++ b/crates/engine/src/cmd/addons/cleanup/text.rs @@ -0,0 +1,865 @@ +//! Artwork Cleanup's text tools: Break Text into Lines / Paragraphs / Words / Glyphs, Combine Point +//! Text, Split Text at Cursor, Remove Line / Paragraph Breaks, Set Alignment, Keep Position, Reset +//! Text Transform and Replace Missing Fonts. Each is one undo step. Pieces keep their characters' +//! styles and stay where the layout drew them: each is moved so the glyph of its first character +//! lands where it was. + +#[cfg(test)] +mod tests; + +use serde_json::{Value, json}; +use vectorcraft_doc::{CharStyle, Document, Justify, Node, NodeId, NodeKind, ParaStyle, RubySpan, TextKind, TextObject}; +use vectorcraft_geom::{Affine, Point, Vec2}; +use vectorcraft_text::{FontDb, FontMatch, TextLayout, edit}; + +use crate::cmd::textedit::editing_range; +use crate::cmd::typecmd::refresh_bounds; +use crate::cmd::{CommandSpec, bad, checked_ids_or_selection, cmd, has_doc, has_selection, switch_or, text_param}; +use crate::{EngineError, Result, Session}; + +/// Most text objects one command takes. +const MAX_TEXTS: usize = 10_000; +/// Most pieces Break Text and Split Text at Cursor make at once. +const MAX_PIECES: usize = 20_000; +/// Most breaks Remove Line / Paragraph Breaks removes at once. +const MAX_BREAKS: usize = 200_000; +/// Most pieces Combine Point Text tries to join, counted over every try: past it, what it joined +/// so far is the result. +const MAX_JOIN_TRIES: usize = 200_000; +/// How far (pt) a glyph Combine Point Text sets may land from where it was. +const TOLERANCE: f64 = 0.01; +/// Combine Point Text: pieces whose baselines are within this many ems of each other share a line +/// (the difference becomes baseline shift); a gap wider than `MAX_GAP` ems, or an overlap of more +/// than `MAX_OVERLAP`, starts another object. +const SAME_LINE: f64 = 0.4; +const MAX_GAP: f64 = 10.0; +const MAX_OVERLAP: f64 = 1.0; +/// Tracking Combine Point Text may give a character (thousandths of an em). +const TRACKING: std::ops::RangeInclusive = -1000.0..=10000.0; + +pub fn specs() -> Vec { + vec![ + cmd!( + "addon.cleanup.breakText", + "Break Text", + ["Object", "Plug-ins", "Artwork Cleanup"], + None, + "{by?: \"lines\"|\"paragraphs\"|\"words\"|\"glyphs\" (lines), ids?: [id…] (default: the selection)} each horizontal point or area type object becomes point type objects, one per line, paragraph, word or glyph, each where its characters were and with their character styles, as one undo step; spaces between pieces go, a paragraph's lines stay lines (a wrapped line ends in a line break), justified lines close up, and a paragraph broken out whole keeps its bullet (not its number; other pieces have no list markers). Type on a path, vertical type, threaded type and area type whose text doesn't fit stay as they are → {ids (the pieces, selected), skipped}", + has_selection, + break_text + ), + cmd!( + "addon.cleanup.combineText", + "Combine Point Text", + ["Object", "Plug-ins", "Artwork Cleanup"], + None, + "{ids?: [id…] (default: the selection)} merge one-line horizontal point type into as few objects as it can, every glyph staying where it was: pieces turned and sheared alike whose baselines line up (within 0.4 em; the difference becomes baseline shift) join left to right, a space goes between pieces at least half a space apart, and tracking on the character before each piece keeps the spacing; each object keeps its character styles, and the leftmost piece of each run its place and paint, as one undo step → {ids (the objects made, selected), combined (pieces merged into them)}", + has_selection, + combine_text + ), + cmd!( + "addon.cleanup.removeBreaks", + "Remove Breaks", + ["Object", "Plug-ins", "Artwork Cleanup"], + None, + "{kind: \"line\"|\"paragraph\", ids?: [id…]} remove the forced line breaks (line) or paragraph returns (paragraph) in the characters selected with a Type tool, else in all the text of the selected type, as one undo step; a break between two words becomes a space → {ids, removed}", + has_selection, + remove_breaks + ), + cmd!( + "addon.cleanup.splitText", + "Split Text at Cursor", + ["Object", "Plug-ins", "Artwork Cleanup"], + None, + "{} while a Type tool edits horizontal point or area type: the text before the selected characters, they and the text after become point type objects of their own (at a cursor: before and after it), each where its characters were, as one undo step; spaces at the ends of each piece go, and editing ends with the pieces selected → {ids}", + editing_text, + split_text + ), + cmd!( + "addon.cleanup.alignInPlace", + "Set Alignment, Keep Position", + ["Object", "Plug-ins", "Artwork Cleanup"], + None, + "{align: \"left\"|\"center\"|\"right\", ids?: [id…] (default: the selection)} align every paragraph of each horizontal point type object so, moving the object so its longest line stays where it is (one line: the text doesn't move), as one undo step → {ids (the objects changed)}", + has_selection, + align_in_place + ), + cmd!( + "addon.cleanup.resetTextTransform", + "Reset Text Transform", + ["Object", "Plug-ins", "Artwork Cleanup"], + None, + "{scale?: bool (false: the horizontal scale stays; true: it goes too, the object's and every character's), ids?: [id…] (default: the selection)} take the rotation, shear and reflection off each point type object, its size and the centre of its text staying, as one undo step → {ids (the objects changed)}", + has_selection, + reset_transform + ), + cmd!( + "addon.cleanup.replaceFonts", + "Replace Missing Fonts…", + ["Object", "Plug-ins", "Artwork Cleanup"], + None, + "{font?: family (default: the default type font, Source Sans 3; any of its names)} set every character of the document's type whose font family isn't available in `font`, in the style it has closest to the one each had, as one undo step → {runs (style runs changed), font}", + has_doc, + replace_fonts + ), + ] +} + +/// Enabled while a Type tool edits text. +fn editing_text(s: &Session) -> std::result::Result<(), String> { + match s.tool_options().get("editing") { + Some(v) if !v.is_null() => Ok(()), + _ => Err("Click in type with a Type tool to split it".into()), + } +} + +/// The type objects under `roots` (inside groups and layers, not live art) that can be edited. +fn texts_under(d: &Document, roots: &[NodeId]) -> Result> { + fn visit(n: &Node, out: &mut Vec) { + match &n.kind { + NodeKind::Text(_) => out.push(n.id), + NodeKind::Group { children, .. } | NodeKind::Layer { children, .. } => children.iter().for_each(|c| visit(c, out)), + _ => {} + } + } + let mut out = vec![]; + roots.iter().filter_map(|id| d.node(*id)).for_each(|n| visit(n, &mut out)); + let editable = d.editable(); + out.retain(|id| editable(*id)); + out.dedup(); + if out.len() > MAX_TEXTS { + return Err(EngineError::Other("Too many type objects to change at once".into())); + } + Ok(out) +} + +fn text_of(d: &Document, id: NodeId) -> Option<&TextObject> { + match &d.node(id)?.kind { + NodeKind::Text(t) => Some(t), + _ => None, + } +} + +fn layout(t: &TextObject) -> TextLayout { + vectorcraft_text::layout(FontDb::global(), t) +} + +/// Where the layout draws the character at `byte` (the one it starts in): its glyph's pen position. +fn glyph_at(lay: &TextLayout, byte: usize) -> Option { + let start = lay.glyphs.iter().filter(|g| g.len > 0 && g.byte <= byte).map(|g| g.byte).max()?; + lay.glyphs.iter().find(|g| g.len > 0 && g.byte == start).map(|g| g.origin) +} + +/// The pen position of the glyph that starts at `byte`, if one does. +fn glyph_starting(lay: &TextLayout, byte: usize) -> Option { + lay.glyphs.iter().find(|g| g.len > 0 && g.byte == byte).map(|g| g.origin) +} + +/// The first glyph of line `l`, in text order. +fn line_start(lay: &TextLayout, l: usize) -> Option { + let line = lay.lines.get(l)?; + let g = lay.glyphs.get(line.glyph_start..line.glyph_end)?.iter().filter(|g| g.len > 0).min_by_key(|g| g.byte)?; + Some(g.origin) +} + +/// `a..b` of `text` without the white space at its ends; None when nothing else is left. +fn trimmed(text: &str, a: usize, b: usize) -> Option<(usize, usize)> { + let s = text.get(a..b)?; + let start = a + (s.len() - s.trim_start().len()); + let end = a + s.trim_end().len(); + (start < end).then_some((start, end)) +} + +/// Paragraph alignment as point type keeps it: justified lines align to their side. +fn point_justify(j: Justify) -> Justify { + match j { + Justify::JustifyLeft | Justify::JustifyAll => Justify::Left, + Justify::JustifyCenter => Justify::Center, + Justify::JustifyRight => Justify::Right, + j => j, + } +} + +#[derive(Clone, Copy, PartialEq)] +enum By { + Lines, + Paragraphs, + Words, + Glyphs, +} + +/// A type object being cut into point type pieces: its text as drawn (Shrink Text to Fit's sizes +/// taken in) and its layout. +struct Source { + t: TextObject, + lay: TextLayout, + text: String, +} + +impl Source { + /// Horizontal point or area type that isn't threaded and whose text all fits; None otherwise. + fn of(d: &Document, id: NodeId) -> Option { + let t = text_of(d, id)?; + if t.vertical || matches!(t.kind, TextKind::OnPath { .. }) || d.text_threads.iter().any(|th| th.contains(&id)) { + return None; + } + let lay = layout(t); + // Text left out of a frame would be lost with it. + if lay.overflow { + return None; + } + let t = if (lay.fit_scale - 1.0).abs() > 1e-9 { vectorcraft_text::scaled(t, lay.fit_scale) } else { t.clone() }; + Some(Self { text: t.plain_text(), t, lay }) + } + + /// The byte ranges of the pieces `by` cuts the text into. + fn ranges(&self, by: By) -> Vec<(usize, usize)> { + let text = &self.text; + match by { + By::Paragraphs => { + let mut out = vec![]; + let mut a = 0; + for (i, _) in text.match_indices('\n') { + out.push((a, i)); + a = i + 1; + } + out.push((a, text.len())); + out + } + By::Lines => self.lay.lines.iter().map(|l| (l.start, l.end)).collect(), + By::Words => { + let mut out = vec![]; + for l in &self.lay.lines { + let Some(s) = text.get(l.start..l.end) else { continue }; + let mut word: Option = None; + for (i, c) in s.char_indices() { + match (c.is_whitespace(), word) { + (true, Some(w)) => { + out.push((l.start + w, l.start + i)); + word = None; + } + (false, None) => word = Some(i), + _ => {} + } + } + if let Some(w) = word { + out.push((l.start + w, l.end)); + } + } + out + } + By::Glyphs => { + // One piece per cluster (a ligature's characters stay together). + let mut clusters = std::collections::BTreeMap::new(); + for g in self.lay.glyphs.iter().filter(|g| g.len > 0) { + let end = clusters.entry(g.byte).or_insert(g.byte + g.len); + *end = (*end).max(g.byte + g.len); + } + clusters.into_iter().collect() + } + } + } + + /// Point type holding bytes `a..b` (white space at its ends left out) where they were drawn. + /// Lines the layout wrapped end in a forced line break; `lists` keeps bulleted paragraphs' + /// bullets where the piece starts its paragraph. + fn piece(&self, (a, b): (usize, usize), lists: bool) -> Option { + let (a, b) = trimmed(&self.text, a, b)?; + let mut p = TextObject::point(Point::ZERO, "", CharStyle::default()); + p.runs = edit::slice_runs(&self.t.runs, a, b); + p.xf = self.t.xf; + p.optical_margin = self.t.optical_margin; + p.system_layout = self.t.system_layout; + p.fractional_widths = self.t.fractional_widths; + p.ruby = + self.t.ruby.iter().filter(|r| a <= r.start && r.end <= b).map(|r| RubySpan { start: r.start - a, end: r.end - a, ..r.clone() }).collect(); + // The paragraphs it holds, with their styles; the first keeps its bullet only from its start. + let starts_para = self.text.get(..a).is_some_and(|s| s.rsplit('\n').next().is_some_and(|line| line.trim().is_empty())); + let styles = self.t.paragraph_styles(); + let mut paras: Vec = styles.get(self.t.paragraphs_in(a, b))?.to_vec(); + for (i, para) in paras.iter_mut().enumerate() { + para.justify = point_justify(para.justify); + if !(lists && (i > 0 || starts_para) && para.list.as_ref().is_some_and(|l| l.number.is_none())) { + para.list = None; + } + } + p.set_paragraph_styles(paras); + // Lines the layout wrapped end in a forced line break, in place of the spaces they ended in. + let mut wraps = vec![]; + for next in self.lay.lines.iter().skip(1).filter(|l| a < l.start && l.start < b) { + let content = self.text.get(..next.start)?.trim_end_matches([' ', '\t']); + // A line that ends in a break of its own keeps it. + if !content.ends_with(['\n', '\u{2028}']) { + wraps.push((content.len().max(a) - a, next.start - a)); + } + } + for &(s, e) in wraps.iter().rev() { + edit::replace_range(&mut p.runs, s, e, "\u{2028}"); + p.ruby_after_replace(s, e, '\u{2028}'.len_utf8()); + } + self.place(&mut p, a)?; + Some(p) + } + + /// Move `p` (cut from byte `a`) so the glyph of its first character lands where it was drawn. + /// A piece of several lines that starts inside a left-aligned line takes a first-line indent, + /// so its later lines stay where they were too. + fn place(&self, p: &mut TextObject, a: usize) -> Option<()> { + let lay = layout(p); + let mut shift: Vec2 = glyph_at(&self.lay, a)? - glyph_at(&lay, 0)?; + let first = self.lay.lines.iter().rposition(|l| l.start <= a); + if let (Some(now), Some(was)) = (line_start(&lay, 1), first.and_then(|l| line_start(&self.lay, l + 1))) { + let off = was.x - (now.x + shift.x); + let left = match p.para.justify { + Justify::Left => true, + Justify::Auto => lay.lines.first().is_some_and(|l| !l.rtl), + _ => false, + }; + if left && off.abs() > 1e-6 { + p.edit_paras(Some(0..1), |para| para.first_line_indent -= off); + shift.x += off; + } + } + p.xf = self.t.xf * Affine::translate(shift); + Some(()) + } +} + +/// Put each object of `items` (id, the node, its pieces) out of the document, its pieces in its +/// place, as one undo step labelled `label`, the pieces selected → their ids. +fn replace_with_pieces(s: &mut Session, label: &str, items: Vec<(NodeId, Node, Vec)>) -> Result> { + s.edit(label, |d, sel| { + let (mut made, mut places) = (vec![], vec![]); + for (id, mut node, pieces) in items { + // A light template: the pieces take its paint and attributes, not its text. + node.kind = NodeKind::Text(Box::new(TextObject::point(Point::ZERO, "", CharStyle::default()))); + let nodes: Vec = pieces + .into_iter() + .map(|mut t| { + refresh_bounds(&mut t); + let mut n = d.reid(&node); + n.kind = NodeKind::Text(Box::new(t)); + n + }) + .collect(); + made.extend(nodes.iter().map(|n| n.id)); + places.push((id, nodes)); + } + d.insert_beside(places, true)?; + sel.set(made.iter().copied()); + Ok(made.iter().map(|i| i.0).collect()) + }) +} + +fn ids_json(ids: &[NodeId]) -> Vec { + ids.iter().map(|i| i.0).collect() +} + +fn break_text(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.cleanup.breakText"; + let by = match text_param(p, "by", C)?.unwrap_or("lines") { + "lines" => By::Lines, + "paragraphs" => By::Paragraphs, + "words" => By::Words, + "glyphs" => By::Glyphs, + other => return Err(bad(C, format!("`by` must be lines, paragraphs, words or glyphs, not {other:?}"))), + }; + let d = &s.doc()?.doc; + let (mut items, mut skipped, mut count) = (vec![], vec![], 0); + for id in texts_under(d, &checked_ids_or_selection(s, p, C)?)? { + let (Some(src), Some(node)) = (Source::of(d, id), d.node(id)) else { + skipped.push(id); + continue; + }; + let ranges = src.ranges(by); + count += ranges.len(); + if count > MAX_PIECES { + return Err(EngineError::Other("Too many pieces to make at once".into())); + } + let pieces: Vec = ranges.into_iter().filter_map(|r| src.piece(r, by == By::Paragraphs)).collect(); + if pieces.is_empty() { + skipped.push(id); + } else { + items.push((id, node.clone(), pieces)); + } + } + if items.is_empty() { + return Err(EngineError::Other("Select horizontal point or area type whose text fits".into())); + } + let ids = replace_with_pieces(s, "Break Text", items)?; + Ok(json!({ "ids": ids, "skipped": ids_json(&skipped) })) +} + +fn split_text(s: &mut Session, _: &Value) -> Result { + let Some((id, a, b)) = editing_range(s)? else { + return Err(EngineError::Other("Click in type with a Type tool to split it".into())); + }; + let d = &s.doc()?.doc; + let (Some(src), Some(node)) = (Source::of(d, id), d.node(id).filter(|_| d.is_editable(id))) else { + return Err(EngineError::Other("Select horizontal point or area type whose text fits".into())); + }; + let text = &src.text; + let (a, b) = (edit::floor_char(text, a.min(b)), edit::floor_char(text, a.max(b))); + let cuts: Vec<(usize, usize)> = if a == b { vec![(0, a), (a, text.len())] } else { vec![(0, a), (a, b), (b, text.len())] }; + let pieces: Vec = cuts.into_iter().filter_map(|r| src.piece(r, true)).collect(); + if pieces.len() < 2 { + return Err(EngineError::Other("Nothing to split at the cursor".into())); + } + let node = node.clone(); + let ids = replace_with_pieces(s, "Split Text at Cursor", vec![(id, node, pieces)])?; + // The text edited is gone: the pieces stay selected. + s.set_tool_option("stopEditing", &Value::Bool(true)); + Ok(json!({ "ids": ids })) +} + +/// One piece of point type Combine Point Text takes: its text with its object's scale taken into +/// its characters, and where it starts and ends along its line in the frame of its turn and shear. +struct Piece { + id: NodeId, + t: TextObject, + /// The object's turn and shear (`xf` without its move). + turn: [f64; 4], + /// Where its first character's glyph starts on its baseline, in that frame. + at: Point, + /// Where its last glyph ends along the line, in that frame. + end: f64, + /// Its first character's size. + size: f64, + /// Each character's pen position from the first's (byte, x), as it lays out alone. + pens: Vec<(usize, f64)>, +} + +impl Piece { + fn of(d: &Document, id: NodeId) -> Option<(Self, &Node)> { + let node = d.node(id)?; + let NodeKind::Text(t) = &node.kind else { return None }; + let text = t.plain_text(); + if t.vertical || !matches!(t.kind, TextKind::Point) || text.trim().is_empty() || text.contains(['\n', '\u{2028}']) { + return None; + } + let mut t = (**t).clone(); + t.scale_text_attributes(); + t.style_scale()?; + let lay = layout(&t); + let line = lay.lines.first().filter(|l| !l.rtl && lay.lines.len() == 1)?; + let first = glyph_at(&lay, 0)?; + // The first glyph of each cluster (a mark drawn over it shares its byte). + let mut seen = std::collections::HashSet::new(); + let pens = lay.glyphs.iter().filter(|g| g.len > 0 && seen.insert(g.byte)).map(|g| (g.byte, g.origin.x - first.x)).collect(); + let end = lay.glyphs.iter().map(|g| g.origin.x + g.advance).fold(first.x, f64::max) - first.x; + let [a, b, c, dd, _, _] = t.xf.as_coeffs(); + let turn = Affine::new([a, b, c, dd, 0.0, 0.0]); + let at = turn.inverse() * (t.xf * Point::new(first.x, line.baseline)); + let size = t.runs.first()?.style.size; + if !(at.x.is_finite() && at.y.is_finite() && size > 0.0) { + return None; + } + Some((Self { id, t, turn: [a, b, c, dd], at, end: at.x + end, size, pens }, node)) + } + + /// Whether `o` is turned and sheared alike. + fn turned_like(&self, o: &Piece) -> bool { + self.turn.iter().zip(&o.turn).all(|(x, y)| (x - y).abs() <= 1e-6 * x.abs().max(y.abs()).max(1.0)) + } +} + +/// Whether two objects look alike apart from their text (paint, opacity, blending, effects). +fn same_look(a: &Node, b: &Node) -> bool { + a.appearance == b.appearance + && a.opacity == b.opacity + && a.blend == b.blend + && a.isolate == b.isolate + && a.knockout == b.knockout + && a.extras == b.extras +} + +/// How wide a space of `style` is. +fn space_width(style: &CharStyle) -> f64 { + let probe = TextObject::point(Point::ZERO, " ", CharStyle { tracking: 0.0, ..style.clone() }); + layout(&probe).glyphs.first().map_or(style.size * 0.25, |g| g.advance) +} + +/// `chain` (pieces left to right on one line) as one point type object whose glyphs land where +/// theirs were, or the index of the first piece that can't join the ones before it so. +fn merge(chain: &[&Piece]) -> std::result::Result { + let Some(first) = chain.first() else { return Err(0) }; + let mut runs = vec![]; + // Each piece's first byte, and the byte range of the character before it (whose tracking sets + // the gap). + let (mut starts, mut before) = (vec![], vec![]); + let mut text = String::new(); + for (k, p) in chain.iter().enumerate() { + if let Some(prev) = k.checked_sub(1).and_then(|i| chain.get(i)) { + let starts_blank = p.t.plain_text().starts_with(char::is_whitespace); + let last = prev.t.runs.iter().rev().find(|r| !r.text.is_empty()).map(|r| r.style.clone()).unwrap_or_default(); + if !text.ends_with(char::is_whitespace) && !starts_blank && p.at.x - prev.end >= 0.5 * space_width(&last) { + runs.push(vectorcraft_doc::TextRun::new(" ", last)); + text.push(' '); + } + let c = text.chars().next_back().map_or(1, char::len_utf8); + before.push((text.len() - c, text.len())); + } + starts.push(text.len()); + // Baselines a little apart: the difference is baseline shift (up is positive). + let shift = first.at.y - p.at.y; + for r in &p.t.runs { + let mut r = r.clone(); + r.style.baseline_shift += shift; + text.push_str(&r.text); + runs.push(r); + } + } + let mut m = first.t.clone(); + m.set_all_paras(ParaStyle { justify: Justify::Left, ..first.t.para.clone() }); + let [a, b, c, d] = first.turn; + let base = Affine::new([a, b, c, d, 0.0, 0.0]) * Affine::translate(first.at.to_vec2()); + m.xf = base; + m.runs = runs; + m.ruby.clear(); + // Tracking after the character before each piece, until each lands where it was. + let targets: Vec = chain.iter().map(|p| p.at.x - first.at.x).collect(); + let mut lay = layout(&m); + for _ in 0..4 { + // A piece whose first character joins the one before it (a ligature) can't keep its place. + let xs: Vec = match starts.iter().enumerate().map(|(k, b)| glyph_starting(&lay, *b).map(|g| g.x).ok_or(k)).collect() { + Ok(xs) => xs, + Err(k) => return Err(k.max(1)), + }; + let x0 = xs.first().copied().unwrap_or(0.0); + let off: Vec = targets.iter().zip(&xs).map(|(t, x)| t - (x - x0)).collect(); + if off.iter().all(|o| o.abs() <= TOLERANCE * 0.5) { + break; + } + // Moving piece k moves those after it as far. + for (k, w) in off.windows(2).enumerate() { + let (delta, Some(&(s, e))) = (w[1] - w[0], before.get(k)) else { continue }; + if delta.abs() > 1e-9 { + edit::style_range(&mut m.runs, s, e, |st| st.tracking += delta / st.size.max(1e-6) * 1000.0); + if !TRACKING.contains(&edit::style_at(&m.runs, s).tracking) { + return Err(k + 1); + } + } + } + lay = layout(&m); + } + // Every glyph where it was, within the tolerance; else the run ends before the piece that moved. + let x0 = glyph_starting(&lay, 0).map_or(0.0, |g| g.x); + for (k, p) in chain.iter().enumerate() { + let (Some(&start), Some(&target)) = (starts.get(k), targets.get(k)) else { return Err(k.max(1)) }; + let moved = p.pens.iter().any(|(byte, x)| glyph_starting(&lay, start + byte).is_none_or(|g| (g.x - x0 - target - x).abs() > TOLERANCE)); + if moved { + return Err(k.max(1)); + } + } + m.xf = base * Affine::translate((-x0, 0.0)); + Ok(m) +} + +fn combine_text(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.cleanup.combineText"; + let d = &s.doc()?.doc; + let mut pieces: Vec<(Piece, &Node)> = + texts_under(d, &checked_ids_or_selection(s, p, C)?)?.into_iter().filter_map(|id| Piece::of(d, id)).collect(); + // Lines: pieces turned alike and looking alike, by baseline, then left to right. + pieces.sort_by(|x, y| x.0.at.y.total_cmp(&y.0.at.y).then(x.0.at.x.total_cmp(&y.0.at.x))); + let mut lines: Vec> = vec![]; + for (piece, node) in &pieces { + let fits = |l: &Vec<(&Piece, &Node)>| { + l.first() + .is_some_and(|(f, n)| f.turned_like(piece) && same_look(n, node) && (f.at.y - piece.at.y).abs() <= SAME_LINE * f.size.min(piece.size)) + }; + match lines.iter_mut().find(|l| fits(l)) { + Some(l) => l.push((piece, node)), + None => lines.push(vec![(piece, node)]), + } + } + // Runs along each line: a wide gap or an overlap starts another. + let mut chains: Vec> = vec![]; + for mut l in lines { + l.sort_by(|x, y| x.0.at.x.total_cmp(&y.0.at.x)); + let mut chain: Vec<&Piece> = vec![]; + for (piece, _) in l { + if let Some(prev) = chain.last() { + let gap = piece.at.x - prev.end; + if gap > MAX_GAP * prev.size || gap < -MAX_OVERLAP * prev.size { + chains.push(std::mem::take(&mut chain)); + } + } + chain.push(piece); + } + chains.push(chain); + } + // Each run as one object, or as several where a piece can't keep its place joined. + let mut made: Vec<(NodeId, TextObject, Vec)> = vec![]; + let mut tries = 0; + 'chains: for chain in chains { + let mut rest: &[&Piece] = &chain; + while rest.len() > 1 { + let mut upto = rest.len(); + while let Some(part) = rest.get(..upto) { + tries += part.len(); + if tries > MAX_JOIN_TRIES { + break 'chains; + } + match merge(part) { + Ok(m) => { + let gone = part.iter().skip(1).map(|p| p.id).collect(); + if let Some(first) = part.first() { + made.push((first.id, m, gone)); + } + break; + } + // A run of one stays as it is. + Err(k) if k <= 1 => { + upto = 1; + break; + } + Err(k) => upto = k, + } + } + rest = rest.get(upto.max(1)..).unwrap_or_default(); + } + } + if made.is_empty() { + return Err(EngineError::Other("Select two or more one-line point type objects on one baseline to combine".into())); + } + let combined: usize = made.iter().map(|m| m.2.len()).sum(); + let ids: Vec = made.iter().map(|m| m.0.0).collect(); + s.edit("Combine Point Text", |d, sel| { + let mut gone = vec![]; + for (id, mut t, others) in made { + refresh_bounds(&mut t); + if let Some(n) = d.node_mut(id) { + n.kind = NodeKind::Text(Box::new(t)); + } + gone.extend(others); + } + d.remove_many(&gone)?; + sel.set(ids.iter().map(|i| NodeId(*i))); + Ok(()) + })?; + Ok(json!({ "ids": ids, "combined": combined })) +} + +/// Remove the breaks `brk` in bytes `a..b` of `t`: one between two words becomes a space → how many +/// went. +fn strip_breaks(t: &mut TextObject, a: usize, b: usize, brk: char) -> usize { + let text = t.plain_text(); + let (a, b) = (edit::floor_char(&text, a), edit::floor_char(&text, b)); + let Some(range) = text.get(a..b) else { return 0 }; + let mut prev = text.get(..a).and_then(|s| s.chars().next_back()); + let mut cuts = vec![]; + for (i, c) in range.char_indices() { + let at = a + i; + if c != brk { + prev = Some(c); + continue; + } + // The next character left: past the breaks that go too. + let after = at + c.len_utf8(); + let next = text.get(after..).and_then(|rest| rest.char_indices().find(|(j, n)| *n != brk || after + j >= b).map(|(_, n)| n)); + let space = prev.is_some_and(|p| !p.is_whitespace()) && next.is_some_and(|n| !n.is_whitespace()); + if space { + prev = Some(' '); + } + cuts.push((at, space)); + } + for &(at, space) in cuts.iter().rev() { + let insert = if space { " " } else { "" }; + let end = at + brk.len_utf8(); + t.splice_paras(at, end, insert); + edit::replace_range(&mut t.runs, at, end, insert); + t.ruby_after_replace(at, end, insert.len()); + } + cuts.len() +} + +fn remove_breaks(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.cleanup.removeBreaks"; + let (brk, label, none) = match text_param(p, "kind", C)? { + Some("line") => ('\u{2028}', "Remove Line Breaks", "No line breaks to remove"), + Some("paragraph") => ('\n', "Remove Paragraph Breaks", "No paragraph breaks to remove"), + Some(other) => return Err(bad(C, format!("`kind` must be \"line\" or \"paragraph\", not {other:?}"))), + None => return Err(bad(C, "missing `kind`")), + }; + // The characters a Type tool has selected, else all the text of the selected type. + let editing = if p.get("ids").is_some() { None } else { editing_range(s)?.filter(|(_, a, b)| a != b) }; + let d = &s.doc()?.doc; + let targets: Vec<(NodeId, usize, usize)> = match editing { + Some((id, a, b)) => vec![(id, a.min(b), a.max(b))].into_iter().filter(|(id, ..)| d.is_editable(*id)).collect(), + None => texts_under(d, &checked_ids_or_selection(s, p, C)?)?.into_iter().map(|id| (id, 0, usize::MAX)).collect(), + }; + let count: usize = targets + .iter() + .filter_map(|(id, a, b)| { + let text = text_of(d, *id)?.plain_text(); + let (a, b) = (edit::floor_char(&text, *a), edit::floor_char(&text, *b)); + Some(text.get(a..b)?.matches(brk).count()) + }) + .sum(); + if count == 0 { + return Err(EngineError::Other(none.into())); + } + if count > MAX_BREAKS { + return Err(EngineError::Other("Too many breaks to remove at once".into())); + } + let (removed, ids) = s.edit(label, |d, _| { + let (mut removed, mut ids) = (0, vec![]); + for (id, a, b) in targets { + let Some(NodeKind::Text(t)) = d.node_mut(id).map(|n| &mut n.kind) else { continue }; + let n = strip_breaks(t, a, b, brk); + if n > 0 { + refresh_bounds(t); + removed += n; + ids.push(id.0); + } + } + Ok((removed, ids)) + })?; + Ok(json!({ "ids": ids, "removed": removed })) +} + +/// Horizontal point type among the objects `p` names. +fn point_texts(s: &Session, p: &Value, cmd: &str) -> Result> { + let d = &s.doc()?.doc; + let ids: Vec = texts_under(d, &checked_ids_or_selection(s, p, cmd)?)? + .into_iter() + .filter(|id| text_of(d, *id).is_some_and(|t| matches!(t.kind, TextKind::Point))) + .collect(); + if ids.is_empty() { + return Err(EngineError::Other("Select point type".into())); + } + Ok(ids) +} + +/// Replace the type objects of `changed` as one undo step labelled `label` → their ids. +fn set_texts(s: &mut Session, label: &str, changed: Vec<(NodeId, TextObject)>, reset_angle: bool) -> Result { + let ids: Vec = changed.iter().map(|c| c.0.0).collect(); + s.edit(label, |d, _| { + for (id, mut t) in changed { + refresh_bounds(&mut t); + if let Some(n) = d.node_mut(id) { + n.kind = NodeKind::Text(Box::new(t)); + if reset_angle { + n.bbox_angle = 0.0; + } + } + } + Ok(()) + })?; + Ok(json!({ "ids": ids })) +} + +fn align_in_place(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.cleanup.alignInPlace"; + let justify = match text_param(p, "align", C)? { + Some("left") => Justify::Left, + Some("center") => Justify::Center, + Some("right") => Justify::Right, + Some(other) => return Err(bad(C, format!("`align` must be \"left\", \"center\" or \"right\", not {other:?}"))), + None => return Err(bad(C, "missing `align`")), + }; + let ids = point_texts(s, p, C)?; + let d = &s.doc()?.doc; + let mut changed = vec![]; + for id in ids { + let Some(t) = text_of(d, id).filter(|t| !t.vertical && t.para_styles().any(|para| para.justify != justify)) else { continue }; + let was = layout(t); + // The longest line stays where it is. + let Some((i, line)) = was.lines.iter().enumerate().max_by(|a, b| (a.1.x1 - a.1.x0).total_cmp(&(b.1.x1 - b.1.x0))) else { continue }; + let mut n = t.clone(); + n.edit_paras(None, |para| para.justify = justify); + let Some(now) = layout(&n).lines.get(i).map(|l| l.x0) else { continue }; + n.xf *= Affine::translate((line.x0 - now, 0.0)); + changed.push((id, n)); + } + if changed.is_empty() { + return Err(EngineError::Other("The point type is aligned that way already".into())); + } + set_texts(s, "Set Alignment, Keep Position", changed, false) +} + +fn reset_transform(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.cleanup.resetTextTransform"; + let scale = switch_or(p, "scale", false, C)?; + let ids = point_texts(s, p, C)?; + let d = &s.doc()?.doc; + let mut changed = vec![]; + for id in ids { + let Some(t) = text_of(d, id) else { continue }; + let [a, b, c, dd, _, _] = t.xf.as_coeffs(); + // The object's own axes: its width along its baseline, and its height square to it. + let (sx, det) = (a.hypot(b), a * dd - b * c); + if !(sx > 1e-12 && sx.is_finite() && det.is_finite() && det.abs() > 1e-12) { + continue; + } + let sy = det.abs() / sx; + let unscaled = |t: &TextObject| t.runs.iter().all(|r| r.style.h_scale == 100.0); + let upright = b.abs() <= 1e-9 * sx && c.abs() <= 1e-9 * sy && a > 0.0 && dd > 0.0; + if upright && (!scale || ((sx - sy).abs() <= 1e-9 * sy && unscaled(t))) { + continue; + } + let mut n = t.clone(); + let w = if scale { + n.runs.iter_mut().for_each(|r| r.style.h_scale = 100.0); + sy + } else { + sx + }; + // The centre of the text stays where it is. + let centre = t.xf * layout(t).bounds.center(); + let turn = Affine::scale_non_uniform(w, sy); + let now = turn * layout(&n).bounds.center(); + n.xf = Affine::translate(centre - now) * turn; + changed.push((id, n)); + } + if changed.is_empty() { + return Err(EngineError::Other("The point type has no transform to reset".into())); + } + set_texts(s, "Reset Text Transform", changed, true) +} + +fn replace_fonts(s: &mut Session, p: &Value) -> Result { + const C: &str = "addon.cleanup.replaceFonts"; + let default = CharStyle::default().font_family; + let wanted = text_param(p, "font", C)?.filter(|f| !f.trim().is_empty()).unwrap_or(&default); + let db = FontDb::global(); + // Any name of the family is stored as its own name. + let family = match db.resolve(wanted, "Regular") { + Some((f, m)) if m != FontMatch::Missing => f.family.clone(), + _ => return Err(bad(C, "the replacement font is not available")), + }; + let missing = |st: &CharStyle| db.resolve(&st.font_family, &st.font_style).is_none_or(|(_, m)| m == FontMatch::Missing); + let d = &s.doc()?.doc; + let mut ids = vec![]; + for l in &d.layers { + l.walk(&mut |n| { + if let NodeKind::Text(t) = &n.kind + && t.runs.iter().any(|r| missing(&r.style)) + { + ids.push(n.id); + } + }); + } + if ids.is_empty() { + return Err(EngineError::Other("No fonts are missing".into())); + } + let runs = s.edit("Replace Missing Fonts", |d, _| { + let mut runs = 0; + for id in &ids { + let Some(NodeKind::Text(t)) = d.node_mut(*id).map(|n| &mut n.kind) else { continue }; + for r in t.runs.iter_mut().filter(|r| missing(&r.style)) { + // The style the font has closest to the one the character had. + r.style.font_style = db.face(&family, &r.style.font_style).map_or_else(|| r.style.font_style.clone(), |f| f.style.clone()); + r.style.font_family = family.clone(); + r.style.font_version = None; + r.style.font_axes.clear(); + runs += 1; + } + edit::normalize(&mut t.runs); + refresh_bounds(t); + } + Ok(runs) + })?; + Ok(json!({ "runs": runs, "font": family })) +} diff --git a/crates/engine/src/cmd/addons/cleanup/text/tests.rs b/crates/engine/src/cmd/addons/cleanup/text/tests.rs new file mode 100644 index 0000000000..a2fa3225f0 --- /dev/null +++ b/crates/engine/src/cmd/addons/cleanup/text/tests.rs @@ -0,0 +1,307 @@ +//! Artwork Cleanup's text tools: pieces stay where their glyphs were drawn and keep their styles, +//! each command is one undo step and refuses cleanly when there is nothing to do. + +use serde_json::{Value, json}; +use vectorcraft_doc::{Justify, NodeId, NodeKind, TextKind, TextObject}; +use vectorcraft_geom::Point; + +use crate::{EngineError, Session}; + +fn session() -> Session { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 600, "height": 400})).unwrap(); + s +} + +fn text(s: &mut Session, p: Value) -> NodeId { + NodeId(s.execute("text.create", &p).unwrap()["id"].as_u64().unwrap()) +} + +fn obj(s: &Session, id: NodeId) -> TextObject { + match &s.doc().unwrap().doc.node(id).unwrap().kind { + NodeKind::Text(t) => (**t).clone(), + _ => panic!("not text"), + } +} + +fn select(s: &mut Session, ids: &[NodeId]) { + s.select(|_, sel| sel.set(ids.iter().copied())).unwrap(); +} + +fn ids(v: &Value) -> Vec { + v["ids"].as_array().unwrap().iter().map(|i| NodeId(i.as_u64().unwrap())).collect() +} + +/// Each drawn character of `ids` (spaces left out) with where its glyph starts on the page, in +/// the order of the objects and their text. +fn glyphs(s: &Session, ids: &[NodeId]) -> Vec<(char, Point)> { + let mut out = vec![]; + for id in ids { + let t = obj(s, *id); + let text = t.plain_text(); + let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t); + let mut gs: Vec<_> = lay.glyphs.iter().filter(|g| g.len > 0).collect(); + gs.sort_by_key(|g| g.byte); + gs.dedup_by_key(|g| g.byte); + for g in gs { + let c = text[g.byte..].chars().next().unwrap(); + if !c.is_whitespace() { + out.push((c, t.xf * g.origin)); + } + } + } + out +} + +fn assert_same_places(was: &[(char, Point)], now: &[(char, Point)]) { + assert_eq!(was.iter().map(|g| g.0).collect::(), now.iter().map(|g| g.0).collect::()); + for (a, b) in was.iter().zip(now) { + assert!((a.1 - b.1).hypot() < 0.02, "{:?} moved to {:?}", a, b); + } +} + +fn undo_steps(s: &Session) -> usize { + s.doc().unwrap().history.undo.len() +} + +fn doc_json(s: &Session) -> String { + serde_json::to_string(&s.doc().unwrap().doc.layers).unwrap() +} + +fn other(r: Result) -> String { + match r { + Err(EngineError::Other(m)) => m, + r => panic!("expected a refusal, got {r:?}"), + } +} + +#[test] +fn break_into_words_keeps_places_styles_and_is_one_step() { + let mut s = session(); + let id = text(&mut s, json!({"x": 40, "y": 100, "text": "Hello big World", "size": 24})); + s.execute("text.setRangeStyle", &json!({"id": id.0, "start": 6, "end": 9, "size": 36, "tracking": 50})).unwrap(); + let rotated = text(&mut s, json!({"x": 300, "y": 200, "text": "Turned words", "size": 18, "rotation": 30})); + let was = glyphs(&s, &[id, rotated]); + let before = doc_json(&s); + let steps = undo_steps(&s); + select(&mut s, &[id, rotated]); + let r = s.execute("addon.cleanup.breakText", &json!({"by": "words"})).unwrap(); + let pieces = ids(&r); + assert_eq!(pieces.len(), 5); + assert_eq!(undo_steps(&s), steps + 1); + assert_eq!(s.doc().unwrap().selection.objects.len(), 5, "the pieces are selected"); + let texts: Vec = pieces.iter().map(|p| obj(&s, *p).plain_text()).collect(); + assert_eq!(texts, ["Hello", "big", "World", "Turned", "words"]); + assert_same_places(&was, &glyphs(&s, &pieces)); + let big = obj(&s, pieces[1]); + assert!(matches!(big.kind, TextKind::Point)); + assert_eq!((big.runs[0].style.size, big.runs[0].style.tracking), (36.0, 50.0)); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(doc_json(&s), before); +} + +#[test] +fn break_area_type_into_lines_paragraphs_and_glyphs() { + for (by, count) in [("lines", None), ("paragraphs", Some(2)), ("glyphs", None)] { + let mut s = session(); + let id = text( + &mut s, + json!({"x": 40, "y": 40, "text": "A paragraph long enough to wrap in its frame\nSecond one", "size": 14, "area": {"width": 140, "height": 200}}), + ); + let t = obj(&s, id); + let lay = vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t); + assert!(lay.lines.len() >= 3, "the first paragraph wraps"); + let was = glyphs(&s, &[id]); + select(&mut s, &[id]); + let r = s.execute("addon.cleanup.breakText", &json!({"by": by})).unwrap(); + let pieces = ids(&r); + let want = count.unwrap_or(if by == "lines" { lay.lines.len() } else { was.len() }); + assert_eq!(pieces.len(), want, "{by}"); + assert_same_places(&was, &glyphs(&s, &pieces)); + if by == "paragraphs" { + // The wrapped lines end in line breaks. + assert!(obj(&s, pieces[0]).plain_text().contains('\u{2028}')); + } + } +} + +#[test] +fn break_text_refuses_what_it_cannot_break() { + let mut s = session(); + s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 40, "height": 40})).unwrap(); + assert!(other(s.execute("addon.cleanup.breakText", &json!({}))).contains("point or area type")); + let r = s.execute("addon.cleanup.breakText", &json!({"by": "sentences"})); + assert!(matches!(r, Err(EngineError::BadParams { .. })), "{r:?}"); +} + +#[test] +fn combine_puts_glyph_pieces_back_together_where_they_were() { + let mut s = session(); + let id = text(&mut s, json!({"x": 50, "y": 120, "text": "Water Lily", "size": 30})); + s.execute("text.setRangeStyle", &json!({"id": id.0, "start": 6, "end": 10, "fill": "#ff0000"})).unwrap(); + let was = glyphs(&s, &[id]); + select(&mut s, &[id]); + let pieces = ids(&s.execute("addon.cleanup.breakText", &json!({"by": "glyphs"})).unwrap()); + assert_eq!(pieces.len(), 9); + let steps = undo_steps(&s); + let r = s.execute("addon.cleanup.combineText", &json!({})).unwrap(); + assert_eq!(undo_steps(&s), steps + 1); + let made = ids(&r); + assert_eq!((made.len(), r["combined"].as_u64()), (1, Some(8))); + let t = obj(&s, made[0]); + assert_eq!(t.plain_text(), "Water Lily", "a space goes back between the words"); + assert_same_places(&was, &glyphs(&s, &made)); + let red = t.runs.iter().find(|r| r.text.contains('L')).unwrap(); + assert_ne!(red.style.fill, t.runs[0].style.fill, "styles stay"); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(s.doc().unwrap().doc.node(pieces[1]).is_some(), "undo brings the pieces back"); +} + +#[test] +fn combine_joins_only_pieces_on_one_line_turned_alike() { + let mut s = session(); + let a = text(&mut s, json!({"x": 50, "y": 100, "text": "Left", "size": 20})); + let b = text(&mut s, json!({"x": 110, "y": 100, "text": "Right", "size": 20})); + let c = text(&mut s, json!({"x": 50, "y": 200, "text": "Below", "size": 20})); + let d = text(&mut s, json!({"x": 300, "y": 100, "text": "Turned", "size": 20, "rotation": 45})); + let was = glyphs(&s, &[a, b]); + select(&mut s, &[a, b, c, d]); + let r = s.execute("addon.cleanup.combineText", &json!({})).unwrap(); + assert_eq!(ids(&r), [a]); + assert_eq!(obj(&s, a).plain_text(), "Left Right"); + assert_same_places(&was, &glyphs(&s, &[a])); + let doc = &s.doc().unwrap().doc; + assert!(doc.node(b).is_none() && doc.node(c).is_some() && doc.node(d).is_some()); + select(&mut s, &[c, d]); + assert!(other(s.execute("addon.cleanup.combineText", &json!({}))).contains("combine")); +} + +#[test] +fn remove_line_and_paragraph_breaks() { + let mut s = session(); + let id = text(&mut s, json!({"x": 40, "y": 60, "text": "one\u{2028}two \u{2028}three\nfour\n\nfive", "size": 12})); + select(&mut s, &[id]); + let before = doc_json(&s); + let r = s.execute("addon.cleanup.removeBreaks", &json!({"kind": "line"})).unwrap(); + assert_eq!(r["removed"], 2); + assert_eq!(obj(&s, id).plain_text(), "one two three\nfour\n\nfive"); + let r = s.execute("addon.cleanup.removeBreaks", &json!({"kind": "paragraph"})).unwrap(); + assert_eq!(r["removed"], 3); + let t = obj(&s, id); + assert_eq!((t.plain_text().as_str(), t.paragraph_count()), ("one two three four five", 1)); + assert_eq!(other(s.execute("addon.cleanup.removeBreaks", &json!({"kind": "line"}))), "No line breaks to remove"); + s.execute("edit.undo", &json!({})).unwrap(); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(doc_json(&s), before); + assert!(matches!(s.execute("addon.cleanup.removeBreaks", &json!({})), Err(EngineError::BadParams { .. }))); +} + +/// The Type tool editing `id` with bytes `anchor..caret` selected. +fn edit_text(s: &mut Session, id: NodeId, anchor: usize, caret: usize) { + s.select_tool("type", Default::default()).unwrap(); + s.set_tool_option("textSelection", &json!({"editing": id.0, "anchor": anchor, "caret": caret})); +} + +#[test] +fn remove_breaks_in_the_characters_a_type_tool_selected() { + let mut s = session(); + let id = text(&mut s, json!({"x": 40, "y": 60, "text": "a\nb\nc", "size": 12})); + select(&mut s, &[id]); + edit_text(&mut s, id, 0, 2); + s.execute("addon.cleanup.removeBreaks", &json!({"kind": "paragraph"})).unwrap(); + assert_eq!(obj(&s, id).plain_text(), "a b\nc"); +} + +#[test] +fn split_at_the_cursor_and_around_a_selection() { + for (anchor, caret, want) in [(6, 6, &["Split", "here please"][..]), (6, 10, &["Split", "here", "please"][..])] { + let mut s = session(); + let id = text(&mut s, json!({"x": 40, "y": 60, "text": "Split here please", "size": 20, "justify": "center"})); + let was = glyphs(&s, &[id]); + select(&mut s, &[id]); + let r = s.execute("addon.cleanup.splitText", &json!({})); + assert!(matches!(&r, Err(EngineError::Disabled(_, why)) if why.contains("Type tool")), "{r:?}"); + edit_text(&mut s, id, anchor, caret); + let steps = undo_steps(&s); + let r = s.execute("addon.cleanup.splitText", &json!({})).unwrap(); + assert_eq!(undo_steps(&s), steps + 1); + let pieces = ids(&r); + let texts: Vec = pieces.iter().map(|p| obj(&s, *p).plain_text()).collect(); + assert_eq!(texts, want); + assert_same_places(&was, &glyphs(&s, &pieces)); + assert!(s.tool_options()["editing"].is_null(), "editing ends"); + } +} + +#[test] +fn split_keeps_the_later_lines_of_a_wrapped_piece() { + let mut s = session(); + let id = text( + &mut s, + json!({"x": 40, "y": 40, "text": "First words then a long run of text that wraps in the frame", "size": 14, "area": {"width": 160, "height": 200}}), + ); + let was = glyphs(&s, &[id]); + select(&mut s, &[id]); + edit_text(&mut s, id, 6, 6); + let pieces = ids(&s.execute("addon.cleanup.splitText", &json!({})).unwrap()); + assert_eq!(pieces.len(), 2); + assert_same_places(&was, &glyphs(&s, &pieces)); +} + +#[test] +fn set_alignment_keeps_the_text_in_place() { + let mut s = session(); + let id = text(&mut s, json!({"x": 100, "y": 60, "text": "Stay put", "size": 20})); + let multi = text(&mut s, json!({"x": 100, "y": 160, "text": "Short\u{2028}The longest line", "size": 20})); + let was = glyphs(&s, &[id]); + let longest: Vec<_> = glyphs(&s, &[multi]).into_iter().skip(5).collect(); + select(&mut s, &[id, multi]); + for align in ["center", "right", "left"] { + s.execute("addon.cleanup.alignInPlace", &json!({"align": align})).unwrap(); + assert_same_places(&was, &glyphs(&s, &[id])); + assert_same_places(&longest, &glyphs(&s, &[multi]).into_iter().skip(5).collect::>()); + } + assert_eq!(obj(&s, id).para.justify, Justify::Left); + assert!(other(s.execute("addon.cleanup.alignInPlace", &json!({"align": "left"}))).contains("already")); + assert!(matches!(s.execute("addon.cleanup.alignInPlace", &json!({"align": "up"})), Err(EngineError::BadParams { .. }))); +} + +#[test] +fn reset_text_transform_takes_off_rotation_and_with_scale_the_horizontal_scale() { + let mut s = session(); + let id = text(&mut s, json!({"x": 100, "y": 100, "text": "Tilted", "size": 20, "rotation": 30})); + s.execute("text.setRangeStyle", &json!({"id": id.0, "hScale": 150})).unwrap(); + let centre = |s: &Session| { + let t = obj(s, id); + t.xf * vectorcraft_text::layout(vectorcraft_text::FontDb::global(), &t).bounds.center() + }; + let was = centre(&s); + let size = obj(&s, id).effective_char_style(&obj(&s, id).runs[0].style).unwrap().size; + select(&mut s, &[id]); + s.execute("addon.cleanup.resetTextTransform", &json!({})).unwrap(); + let t = obj(&s, id); + let [_, b, c, _, _, _] = t.xf.as_coeffs(); + assert!(b.abs() < 1e-9 && c.abs() < 1e-9, "{:?}", t.xf); + assert!((centre(&s) - was).hypot() < 1e-6); + assert!((t.effective_char_style(&t.runs[0].style).unwrap().size - size).abs() < 1e-6, "the size stays"); + assert!(t.runs[0].style.h_scale > 100.0, "the horizontal scale stays"); + assert!(other(s.execute("addon.cleanup.resetTextTransform", &json!({}))).contains("no transform")); + s.execute("addon.cleanup.resetTextTransform", &json!({"scale": true})).unwrap(); + assert_eq!(obj(&s, id).runs[0].style.h_scale, 100.0); +} + +#[test] +fn replace_missing_fonts_with_the_default_or_a_chosen_font() { + let mut s = session(); + let gone = text(&mut s, json!({"x": 40, "y": 60, "text": "Lost", "size": 20, "font": "No Such Font Family", "style": "Bold"})); + let kept = text(&mut s, json!({"x": 40, "y": 120, "text": "Fine", "size": 20})); + let fine = obj(&s, kept); + let r = s.execute("addon.cleanup.replaceFonts", &json!({})).unwrap(); + assert_eq!((r["runs"].as_u64(), r["font"].as_str()), (Some(1), Some("Source Sans 3"))); + let t = obj(&s, gone); + assert_eq!((t.runs[0].style.font_family.as_str(), t.runs[0].style.font_style.as_str()), ("Source Sans 3", "Bold")); + assert_eq!(obj(&s, kept), fine); + assert_eq!(other(s.execute("addon.cleanup.replaceFonts", &json!({}))), "No fonts are missing"); + let r = s.execute("addon.cleanup.replaceFonts", &json!({"font": "No Such Font Family"})); + assert!(matches!(r, Err(EngineError::BadParams { .. })), "{r:?}"); +} diff --git a/crates/engine/tests/command_sweep.rs b/crates/engine/tests/command_sweep.rs index c5f9fc9de4..d026908601 100644 --- a/crates/engine/tests/command_sweep.rs +++ b/crates/engine/tests/command_sweep.rs @@ -559,6 +559,23 @@ fn structured_junk() { ("addon.pen.reshape", json!({"id": 2, "segment": 0, "t": "x", "dx": 1, "dy": 1, "mode": "symmetric"})), ("addon.pen.nextSegment", json!({"curved": "yes"})), ("addon.pen.closeJoin", json!({"ids": [u64::MAX]})), + ("addon.cleanup.breakText", json!({"by": "glyphs", "ids": [0, 1, 2, 3, 4, 5, 6, 7, 8, u64::MAX]})), + ("addon.cleanup.breakText", json!({"by": ["lines"]})), + ("addon.cleanup.breakText", json!({"by": "paragraphs"})), + ("addon.cleanup.breakText", json!({"by": "words", "ids": "all"})), + ("addon.cleanup.combineText", json!({"ids": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]})), + ("addon.cleanup.combineText", json!({"ids": [-1, 1e308]})), + ("addon.cleanup.removeBreaks", json!({"kind": "paragraph", "ids": [1, 2, 3, 4, 5, 6, 7, 8, u64::MAX]})), + ("addon.cleanup.removeBreaks", json!({"kind": 3})), + ("addon.cleanup.removeBreaks", json!({"kind": "line", "ids": null})), + ("addon.cleanup.splitText", json!({"at": 1e308})), + ("addon.cleanup.alignInPlace", json!({"align": "right", "ids": [1, 2, 3, 4, 5, 6, 7, 8]})), + ("addon.cleanup.alignInPlace", json!({"align": null, "ids": [-1]})), + ("addon.cleanup.resetTextTransform", json!({"scale": "yes"})), + ("addon.cleanup.resetTextTransform", json!({"scale": true, "ids": [1, 2, 3, 4, 5, 6, 7, 8]})), + ("addon.cleanup.replaceFonts", json!({"font": ""})), + ("addon.cleanup.replaceFonts", json!({"font": ["Source Sans 3"]})), + ("addon.cleanup.replaceFonts", json!({"font": "\u{0}"})), ]; let mut failures = vec![]; for fx in Fixture::ALL { @@ -571,6 +588,43 @@ fn structured_junk() { assert!(failures.is_empty(), "{} failures:\n{}", failures.len(), failures.join("\n")); } +/// Artwork Cleanup's text tools while a Type tool edits type with junk ranges (past the end, +/// reversed, inside a character): never a panic, and the document stays sound. +#[test] +fn cleanup_text_tools_with_junk_editing_ranges() { + let ranges = [(0, u64::MAX / 4), (u64::MAX, 1), (5, 5), (1, 2), (u64::MAX / 4, u64::MAX / 4)]; + let mut failures = vec![]; + for fx in Fixture::ALL { + let mut texts = vec![]; + for l in &fx.session().doc().unwrap().doc.layers { + l.walk(&mut |n| { + if matches!(n.kind, vectorcraft_doc::NodeKind::Text(_)) { + texts.push(n.id.0); + } + }); + } + for id in texts { + for (anchor, caret) in ranges { + for (cmd, p) in [("addon.cleanup.splitText", json!({})), ("addon.cleanup.removeBreaks", json!({"kind": "paragraph"}))] { + let mut s = fx.session(); + let r = catch_quiet(|| { + let _ = s.execute("select.set", &json!({"ids": [id]})); + let _ = s.select_tool("type", Default::default()); + s.set_tool_option("textSelection", &json!({"editing": id, "anchor": anchor, "caret": caret})); + no_panic(s.execute(cmd, &p)) + }); + if let Err(msg) = r { + failures.push(format!("PANIC {cmd} {id} {anchor}..{caret} [{fx:?}]: {msg}")); + } else if let Err(e) = check_session(&s) { + failures.push(format!("{cmd} {id} {anchor}..{caret} [{fx:?}]: {e}")); + } + } + } + } + } + assert!(failures.is_empty(), "{} failures:\n{}", failures.len(), failures.join("\n")); +} + /// Shape Builder Tool Options (Gap Detection) with junk values: never a panic, and the tool still /// answers with options and works on a drag afterwards. #[test] diff --git a/crates/ui-egui/src/addons/cleanup.rs b/crates/ui-egui/src/addons/cleanup.rs index 66c7f537df..d44fe7b393 100644 --- a/crates/ui-egui/src/addons/cleanup.rs +++ b/crates/ui-egui/src/addons/cleanup.rs @@ -1,7 +1,8 @@ //! Artwork Cleanup's panel and submenu (Object › Plug-ins › Artwork Cleanup). The panel runs the //! Document Health Check on the selection, or the document while nothing is selected, lists what it //! found, and shows or fixes the issues picked in the list (Fix All: every issue listed), each fix -//! one undo step. Below, the add-on's one-click tools open their options as their menu items do. +//! one undo step. Below, the add-on's one-click tools open their options as their menu items do, +//! and its text tools, which the panel can hide, act on the selected type. use egui::{Align, Layout, Ui}; use serde_json::{Value, json}; @@ -16,6 +17,8 @@ pub const ID: &str = "artworkCleanup"; /// Where the panel keeps its last check (panel state). const STATE: &str = "artwork-cleanup"; +/// Where the panel keeps whether its text tools are hidden (panel state). +const TEXT_HIDDEN: &str = "artwork-cleanup-text-hidden"; /// The one-click tools: (menu label, command, the options their dialog opens with). fn tools() -> [(&'static str, &'static str, Value); 3] { @@ -26,11 +29,92 @@ fn tools() -> [(&'static str, &'static str, Value); 3] { ] } +/// Replace Missing Fonts' options: the default type font. +fn replace_fonts() -> Value { + json!({ "font": vectorcraft_doc::CharStyle::default().font_family }) +} + +/// A row of the panel's text tools: a label above (if any), then its buttons (label, what a +/// modifier click does, command, params). +type TextRow = (Option<&'static str>, Vec<(&'static str, Option<&'static str>, &'static str, Value)>); + +fn text_rows() -> [TextRow; 4] { + let align = |a: &str| json!({ "align": a }); + let by = |b: &str| json!({ "by": b }); + [ + ( + Some("Set Alignment, Keep Position:"), + vec![ + ("Left", None, "addon.cleanup.alignInPlace", align("left")), + ("Center", None, "addon.cleanup.alignInPlace", align("center")), + ("Right", None, "addon.cleanup.alignInPlace", align("right")), + ], + ), + ( + Some("Break Text into:"), + vec![ + ("Lines", Some("Shift-click: break into paragraphs"), "addon.cleanup.breakText", by("lines")), + ("Words", None, "addon.cleanup.breakText", by("words")), + ("Glyphs", None, "addon.cleanup.breakText", by("glyphs")), + ], + ), + ( + None, + vec![ + ("Split at Cursor", None, "addon.cleanup.splitText", json!({})), + ("Reset Transform", Some("Alt-click: reset the horizontal scale too"), "addon.cleanup.resetTextTransform", json!({})), + ], + ), + (None, vec![("Combine Point Text", None, "addon.cleanup.combineText", json!({}))]), + ] +} + +/// The text tools one to a row below the others: (label, command, params). +fn text_singles() -> [(&'static str, &'static str, Value); 3] { + [ + ("Remove Line Breaks", "addon.cleanup.removeBreaks", json!({ "kind": "line" })), + ("Remove Paragraph Breaks", "addon.cleanup.removeBreaks", json!({ "kind": "paragraph" })), + ("Replace Missing Fonts…", "addon.cleanup.replaceFonts", replace_fonts()), + ] +} + +/// `p` for a click with `held`: Shift-click on Lines breaks into paragraphs, Alt-click on Reset +/// Transform resets the horizontal scale too. +fn modified(id: &str, mut p: Value, held: egui::Modifiers) -> Value { + match id { + "addon.cleanup.breakText" if held.shift && p["by"] == "lines" => p["by"] = json!("paragraphs"), + "addon.cleanup.resetTextTransform" if held.alt => p["scale"] = json!(true), + _ => {} + } + p +} + /// Object › Plug-ins › Artwork Cleanup. pub fn menu() -> Vec { let mut items = vec![Item::Cmd("Document Health Check", "window.panel", json!({ "panel": ID })), Item::Sep]; items.extend(tools().into_iter().map(|(label, id, p)| Item::Cmd(label, id, p))); - items.extend([Item::Sep, Item::Cmd("Fix All Issues", "addon.cleanup.fix", Value::Null)]); + items.extend([Item::Sep, Item::Cmd("Fix All Issues", "addon.cleanup.fix", Value::Null), Item::Sep]); + let by = |b: &str| json!({ "by": b }); + let align = |a: &str| json!({ "align": a }); + items.extend([ + Item::Cmd("Combine Point Text", "addon.cleanup.combineText", json!({})), + Item::Cmd("Break Text into Lines", "addon.cleanup.breakText", by("lines")), + Item::Cmd("Break Text into Paragraphs", "addon.cleanup.breakText", by("paragraphs")), + Item::Cmd("Break Text into Words", "addon.cleanup.breakText", by("words")), + Item::Cmd("Break Text into Glyphs", "addon.cleanup.breakText", by("glyphs")), + Item::Cmd("Split Text at Cursor", "addon.cleanup.splitText", json!({})), + Item::Sub( + "Set Alignment, Keep Position", + vec![ + Item::Cmd("Left", "addon.cleanup.alignInPlace", align("left")), + Item::Cmd("Center", "addon.cleanup.alignInPlace", align("center")), + Item::Cmd("Right", "addon.cleanup.alignInPlace", align("right")), + ], + ), + Item::Cmd("Reset Text Transform", "addon.cleanup.resetTextTransform", json!({})), + Item::Cmd("Reset Text Transform and Scale", "addon.cleanup.resetTextTransform", json!({ "scale": true })), + ]); + items.extend(text_singles().into_iter().map(|(label, id, p)| Item::Cmd(label, id, p))); items } @@ -94,7 +178,8 @@ enum Action { Check, Show(String), Fix(Vec), - Tool(usize), + /// A tool's button: (its label, command, params), run as its menu item is. + Run(&'static str, &'static str, Value), } pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { @@ -121,12 +206,21 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } widgets::divider(ui); ui.add_enabled_ui(selected, |ui| { - for (i, (label, ..)) in tools().iter().enumerate() { + for (label, id, p) in tools() { if widgets::flat_button(ui, tl!(label), width).clicked() { - action = Some(Action::Tool(i)); + action = Some(Action::Run(label, id, p)); } } }); + let hidden: bool = pstate(ui.ctx(), TEXT_HIDDEN); + widgets::divider(ui); + if widgets::section_toggle(ui, "Text", !hidden) { + set_pstate(ui.ctx(), TEXT_HIDDEN, !hidden); + } + if !hidden { + let editing = app.session.tool_options().get("editing").is_some_and(|v| !v.is_null()); + text_tools(ui, width, selected, editing, &mut action); + } match action { Some(Action::Check) => r = check(app, None), Some(Action::Show(kind)) => { @@ -135,17 +229,53 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { } } Some(Action::Fix(kinds)) => r = fix(app, &r, kinds), - Some(Action::Tool(i)) => { - if let Some((label, id, p)) = tools().into_iter().nth(i) { - let (id, p) = crate::menus::click_target(label, id, &p); - crate::menus::invoke(app, &id, p); - } + Some(Action::Run(label, id, p)) => { + let (id, p) = crate::menus::click_target(label, id, &p); + crate::menus::invoke(app, &id, p); } None => {} } set_pstate(ui.ctx(), STATE, r); } +/// The text tools: rows of buttons, then one to a row. Each is enabled when its command can act: +/// Split at Cursor while a Type tool edits text, Replace Missing Fonts always, the others with a +/// selection. +fn text_tools(ui: &mut Ui, width: f32, selected: bool, editing: bool, action: &mut Option) { + let enabled = |id: &str| match id { + "addon.cleanup.splitText" => editing, + "addon.cleanup.replaceFonts" => true, + _ => selected, + }; + let mut button = |ui: &mut Ui, label: &'static str, tip: Option<&str>, id: &'static str, p: Value, w: f32| { + // Lines and words of text, not lines drawn: their own catalog rows (the button translates + // the others). + let shown = if id == "addon.cleanup.breakText" { crate::i18n::tr_ctx(crate::i18n::current(), "breakText", label) } else { label }; + let mut resp = ui.add_enabled_ui(enabled(id), |ui| widgets::flat_button(ui, shown, w)).inner; + if let Some(tip) = tip { + resp = resp.on_hover_text(tl!(tip)); + } + if resp.clicked() { + *action = Some(Action::Run(label, id, modified(id, p, ui.input(|i| i.modifiers)))); + } + }; + for (heading, buttons) in text_rows() { + if let Some(h) = heading { + widgets::subheader(ui, h); + } + ui.horizontal(|ui| { + let n = buttons.len() as f32; + let each = ((width - ui.spacing().item_spacing.x * (n - 1.0)) / n).max(40.0); + for (label, tip, id, p) in buttons { + button(ui, label, tip, id, p, each); + } + }); + } + for (label, id, p) in text_singles() { + button(ui, label, None, id, p, width); + } +} + /// The list of what the check found (click picks a row, Ctrl/Cmd- or Shift-click adds one), and /// Show, Fix Selected and Fix All. fn results(ui: &mut Ui, r: &mut Results, action: &mut Option) { diff --git a/crates/ui-egui/src/addons/cleanup/tests.rs b/crates/ui-egui/src/addons/cleanup/tests.rs index 041a3410b3..edf7159241 100644 --- a/crates/ui-egui/src/addons/cleanup/tests.rs +++ b/crates/ui-egui/src/addons/cleanup/tests.rs @@ -65,3 +65,111 @@ fn check_lists_what_it_found_and_fix_clears_it() { }); assert!(text.contains("No issues found."), "{text}"); } + +/// An app with the point type `text`, selected. +fn type_app(text: &str) -> (VectorcraftApp, u64) { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + let id = app.run("text.create", json!({"x": 20, "y": 60, "text": text, "size": 20})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [id]})).unwrap(); + (app, id) +} + +fn texts(app: &VectorcraftApp) -> Vec { + let mut out = vec![]; + for l in &app.session.doc().unwrap().doc.layers { + l.walk(&mut |n| { + if let vectorcraft_doc::NodeKind::Text(t) = &n.kind { + out.push(t.plain_text()); + } + }); + } + out +} + +#[test] +fn the_plugins_submenu_runs_the_text_tools() { + let (mut app, _) = type_app("one two"); + let entries = menus::menu_entries(&app); + let under = |path: &[&str], label: &str| entries.iter().find(|e| e.path == path && e.label == label); + let cleanup = ["Object", "Plug-ins", "Artwork Cleanup"]; + for (label, id) in [ + ("Combine Point Text", "addon.cleanup.combineText"), + ("Break Text into Lines", "addon.cleanup.breakText"), + ("Break Text into Paragraphs", "addon.cleanup.breakText"), + ("Break Text into Glyphs", "addon.cleanup.breakText"), + ("Split Text at Cursor", "addon.cleanup.splitText"), + ("Reset Text Transform", "addon.cleanup.resetTextTransform"), + ("Reset Text Transform and Scale", "addon.cleanup.resetTextTransform"), + ("Remove Line Breaks", "addon.cleanup.removeBreaks"), + ("Remove Paragraph Breaks", "addon.cleanup.removeBreaks"), + ("Replace Missing Fonts…", "addon.cleanup.replaceFonts"), + ] { + assert_eq!(under(&cleanup, label).and_then(|e| e.command.as_deref()), Some(id), "{label}"); + } + let center = under(&["Object", "Plug-ins", "Artwork Cleanup", "Set Alignment, Keep Position"], "Center").expect("listed"); + assert_eq!((center.command.as_deref(), ¢er.params), (Some("addon.cleanup.alignInPlace"), &json!({"align": "center"}))); + // Replace Missing Fonts opens its options first, with the default type font. + let fonts = under(&cleanup, "Replace Missing Fonts…").unwrap(); + let (target, p) = menus::click_target(&fonts.label, "addon.cleanup.replaceFonts", &fonts.params); + assert_eq!((target.as_str(), &p["params"]["font"]), ("ui.paramDialog", &json!("Source Sans 3"))); + let words = under(&cleanup, "Break Text into Words").unwrap(); + menus::invoke(&mut app, "addon.cleanup.breakText", words.params.clone()); + assert_eq!(texts(&app), ["one", "two"]); + let combine = under(&cleanup, "Combine Point Text").unwrap(); + menus::invoke(&mut app, "addon.cleanup.combineText", combine.params.clone()); + assert_eq!(texts(&app), ["one two"]); +} + +/// One frame of the panel in `ctx` with `events` and `modifiers` held: the texts drawn and where. +fn frame_with(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec, modifiers: egui::Modifiers) -> Vec<(String, egui::Rect)> { + fn collect(s: &egui::Shape, out: &mut Vec<(String, egui::Rect)>) { + match s { + egui::Shape::Text(t) => out.push((t.galley.text().to_string(), t.visual_bounding_rect())), + egui::Shape::Vec(v) => v.iter().for_each(|s| collect(s, out)), + _ => {} + } + } + let time = ctx.input(|i| i.time) + 0.1; + let events = std::iter::once(egui::Event::ModifiersChanged(modifiers)).chain(events).collect(); + let mut out = ctx.run_ui(egui::RawInput { events, time: Some(time), ..Default::default() }, |ui| show(app, ui)); + out.textures_delta.clear(); + let mut v = vec![]; + out.shapes.iter().for_each(|c| collect(&c.shape, &mut v)); + v +} + +fn panel_frame(app: &mut VectorcraftApp, ctx: &egui::Context, events: Vec) -> Vec<(String, egui::Rect)> { + frame_with(app, ctx, events, egui::Modifiers::NONE) +} + +/// Click the text `label` the panel draws, with `modifiers` held. +fn click(app: &mut VectorcraftApp, ctx: &egui::Context, label: &str, modifiers: egui::Modifiers) { + let shown = panel_frame(app, ctx, vec![]); + let at = shown.iter().find(|(s, _)| s == label).unwrap_or_else(|| panic!("no {label:?} in {shown:?}")).1.center(); + let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers }; + for events in [vec![egui::Event::PointerMoved(at)], vec![button(true)], vec![button(false)]] { + frame_with(app, ctx, events, modifiers); + } +} + +#[test] +fn the_panels_text_row_runs_the_text_tools_and_hides() { + let (mut app, _) = type_app("Hello there\nworld"); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let steps = app.session.doc().unwrap().history.undo.len(); + // Shift-click on Lines breaks into paragraphs. + click(&mut app, &ctx, "Lines", egui::Modifiers::SHIFT); + assert_eq!(texts(&app), ["Hello there", "world"]); + assert_eq!(app.session.doc().unwrap().history.undo.len(), steps + 1, "one undo step"); + click(&mut app, &ctx, "Words", egui::Modifiers::NONE); + assert_eq!(texts(&app), ["Hello", "there", "world"]); + click(&mut app, &ctx, "Combine Point Text", egui::Modifiers::NONE); + assert_eq!(texts(&app), ["Hello there", "world"]); + // The row hides and shows again. + click(&mut app, &ctx, "Text", egui::Modifiers::NONE); + assert!(!panel_frame(&mut app, &ctx, vec![]).iter().any(|(s, _)| s == "Words")); + click(&mut app, &ctx, "Text", egui::Modifiers::NONE); + assert!(panel_frame(&mut app, &ctx, vec![]).iter().any(|(s, _)| s == "Words")); +} diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 2a64dfdb74..a97c6c2d40 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -5772,3 +5772,47 @@ anchor Points: Точки: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` задайте `inkLimit`, `removeWhiteOverprint` или `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Корекциите на мастилата за печат работят върху CMYK документи: първо изберете Файл › Цветен режим на документа › CMYK цвят @msg `{key}` must be 0..{max} `{key}` трябва да е 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Разделяне на текст + Combine Point Text Обединяване на точков текст + Remove Breaks Премахване на прекъсвания + Split Text at Cursor Разделяне на текст при курсора + Set Alignment, Keep Position Задаване на подравняване със запазване на позицията + Reset Text Transform Нулиране на трансформацията на текста + Replace Missing Fonts… Замяна на липсващите шрифтове… + Replace Missing Fonts Замяна на липсващите шрифтове + Remove Line Breaks Премахване на прекъсванията на редове + Remove Paragraph Breaks Премахване на прекъсванията на абзаци + Break Text into Lines Разделяне на текста на редове + Break Text into Paragraphs Разделяне на текста на абзаци + Break Text into Words Разделяне на текста на думи + Break Text into Glyphs Разделяне на текста на глифи + Reset Text Transform and Scale Нулиране на трансформацията и мащаба на текста + Set Alignment, Keep Position: Подравняване със запазване на позицията: + Break Text into: Разделяне на текста на: + Split at Cursor Разделяне при курсора + Reset Transform Нулиране на трансформацията + Shift-click: break into paragraphs Shift-щракване: разделяне на абзаци + Alt-click: reset the horizontal scale too Alt-щракване: нулиране и на хоризонталния мащаб +breakText Lines Редове +breakText Words Думи +breakText Glyphs Глифи +@msg Click in type with a Type tool to split it Щракнете в текст с инструмента „Текст“, за да го разделите +@msg Too many type objects to change at once Твърде много текстови обекти за промяна наведнъж +@msg Too many pieces to make at once Твърде много части за създаване наведнъж +@msg Select horizontal point or area type whose text fits Изберете хоризонтален точков текст или текст в зона, чийто текст се побира +@msg Nothing to split at the cursor При курсора няма какво да се раздели +@msg Select two or more one-line point type objects on one baseline to combine Изберете два или повече едноредови обекта с точков текст на една базова линия, за да ги обедините +@msg No line breaks to remove Няма прекъсвания на редове за премахване +@msg No paragraph breaks to remove Няма прекъсвания на абзаци за премахване +@msg Too many breaks to remove at once Твърде много прекъсвания за премахване наведнъж +@msg Select point type Изберете точков текст +@msg The point type is aligned that way already Точковият текст вече е подравнен така +@msg The point type has no transform to reset Точковият текст няма трансформация за нулиране +@msg No fonts are missing Няма липсващи шрифтове +@msg the replacement font is not available заместващият шрифт не е наличен +@msg missing `align` липсва `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` трябва да е lines, paragraphs, words или glyphs, а не {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` трябва да е "line" или "paragraph", а не {other} +@msg `align` must be "left", "center" or "right", not {other} `align` трябва да е "left", "center" или "right", а не {other} diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 473c7b8bf9..7a044e61cc 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5873,3 +5873,47 @@ anchor Points: Punts: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` indiqueu `inkLimit`, `removeWhiteOverprint` o `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Les correccions de tinta per a impressió funcionen en documents CMYK: trieu primer Fitxer › Mode de color del document › Color CMYK @msg `{key}` must be 0..{max} `{key}` ha de ser 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Divideix el text + Combine Point Text Combina el text de punt + Remove Breaks Elimina els salts + Split Text at Cursor Divideix el text al cursor + Set Alignment, Keep Position Defineix l’alineació i manté la posició + Reset Text Transform Restableix la transformació del text + Replace Missing Fonts… Reemplaça els tipus de lletra que falten… + Replace Missing Fonts Reemplaça els tipus de lletra que falten + Remove Line Breaks Elimina els salts de línia + Remove Paragraph Breaks Elimina els salts de paràgraf + Break Text into Lines Divideix el text en línies + Break Text into Paragraphs Divideix el text en paràgrafs + Break Text into Words Divideix el text en paraules + Break Text into Glyphs Divideix el text en glifs + Reset Text Transform and Scale Restableix la transformació i l’escala del text + Set Alignment, Keep Position: Defineix l’alineació i manté la posició: + Break Text into: Divideix el text en: + Split at Cursor Divideix al cursor + Reset Transform Restableix la transformació + Shift-click: break into paragraphs Maj+clic: divideix en paràgrafs + Alt-click: reset the horizontal scale too Alt-clic: restableix també l’escala horitzontal +breakText Lines Línies +breakText Words Paraules +breakText Glyphs Glifs +@msg Click in type with a Type tool to split it Feu clic en un text amb una eina de text per dividir-lo +@msg Too many type objects to change at once Massa objectes de text per canviar-los alhora +@msg Too many pieces to make at once Massa peces per crear-les alhora +@msg Select horizontal point or area type whose text fits Seleccioneu text de punt o d’àrea horitzontal el text del qual hi càpiga +@msg Nothing to split at the cursor No hi ha res a dividir al cursor +@msg Select two or more one-line point type objects on one baseline to combine Seleccioneu dos o més objectes de text de punt d’una línia sobre una mateixa línia de base per combinar-los +@msg No line breaks to remove No hi ha salts de línia per eliminar +@msg No paragraph breaks to remove No hi ha salts de paràgraf per eliminar +@msg Too many breaks to remove at once Massa salts per eliminar-los alhora +@msg Select point type Seleccioneu text de punt +@msg The point type is aligned that way already El text de punt ja està alineat així +@msg The point type has no transform to reset El text de punt no té cap transformació per restablir +@msg No fonts are missing No falta cap tipus de lletra +@msg the replacement font is not available el tipus de lletra de reemplaçament no està disponible +@msg missing `align` falta `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` ha de ser lines, paragraphs, words o glyphs, no {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` ha de ser "line" o "paragraph", no {other} +@msg `align` must be "left", "center" or "right", not {other} `align` ha de ser "left", "center" o "right", no {other} diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 91be88b94f..14684ace52 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -5882,3 +5882,47 @@ anchor Points: Body: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` zadejte `inkLimit`, `removeWhiteOverprint` nebo `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Opravy tiskových barev fungují v dokumentech CMYK: nejprve zvolte Soubor › Barevný režim dokumentu › Barvy CMYK @msg `{key}` must be 0..{max} `{key}` musí být 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Rozdělit text + Combine Point Text Sloučit bodový text + Remove Breaks Odstranit zalomení + Split Text at Cursor Rozdělit text u kurzoru + Set Alignment, Keep Position Nastavit zarovnání, zachovat polohu + Reset Text Transform Obnovit transformaci textu + Replace Missing Fonts… Nahradit chybějící písma… + Replace Missing Fonts Nahradit chybějící písma + Remove Line Breaks Odstranit zalomení řádků + Remove Paragraph Breaks Odstranit zalomení odstavců + Break Text into Lines Rozdělit text na řádky + Break Text into Paragraphs Rozdělit text na odstavce + Break Text into Words Rozdělit text na slova + Break Text into Glyphs Rozdělit text na glyfy + Reset Text Transform and Scale Obnovit transformaci a měřítko textu + Set Alignment, Keep Position: Nastavit zarovnání, zachovat polohu: + Break Text into: Rozdělit text na: + Split at Cursor Rozdělit u kurzoru + Reset Transform Obnovit transformaci + Shift-click: break into paragraphs Shift+kliknutí: rozdělit na odstavce + Alt-click: reset the horizontal scale too Alt+kliknutí: obnovit i vodorovné měřítko +breakText Lines Řádky +breakText Words Slova +breakText Glyphs Glyfy +@msg Click in type with a Type tool to split it Klikněte do textu nástrojem Text, abyste jej rozdělili +@msg Too many type objects to change at once Příliš mnoho textových objektů ke změně najednou +@msg Too many pieces to make at once Příliš mnoho částí k vytvoření najednou +@msg Select horizontal point or area type whose text fits Vyberte vodorovný bodový text nebo text v oblasti, jehož text se vejde +@msg Nothing to split at the cursor U kurzoru není co rozdělit +@msg Select two or more one-line point type objects on one baseline to combine Vyberte dva nebo více jednořádkových objektů bodového textu na jednom účaří, abyste je sloučili +@msg No line breaks to remove Žádná zalomení řádků k odstranění +@msg No paragraph breaks to remove Žádná zalomení odstavců k odstranění +@msg Too many breaks to remove at once Příliš mnoho zalomení k odstranění najednou +@msg Select point type Vyberte bodový text +@msg The point type is aligned that way already Bodový text je již takto zarovnán +@msg The point type has no transform to reset Bodový text nemá žádnou transformaci k obnovení +@msg No fonts are missing Žádná písma nechybějí +@msg the replacement font is not available náhradní písmo není k dispozici +@msg missing `align` chybí `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` musí být lines, paragraphs, words nebo glyphs, ne {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` musí být "line" nebo "paragraph", ne {other} +@msg `align` must be "left", "center" or "right", not {other} `align` musí být "left", "center" nebo "right", ne {other} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index bc671274c4..5b8631c20d 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -5787,3 +5787,47 @@ anchor Points: Punkter: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` angiv `inkLimit`, `removeWhiteOverprint` eller `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Trykfarverettelser virker på CMYK-dokumenter: vælg først Filer › Dokumentets farvetilstand › CMYK-farve @msg `{key}` must be 0..{max} `{key}` skal være 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Opdel tekst + Combine Point Text Kombiner punkttekst + Remove Breaks Fjern skift + Split Text at Cursor Opdel tekst ved markøren + Set Alignment, Keep Position Angiv justering, bevar placering + Reset Text Transform Nulstil teksttransformation + Replace Missing Fonts… Erstat manglende skrifttyper… + Replace Missing Fonts Erstat manglende skrifttyper + Remove Line Breaks Fjern linjeskift + Remove Paragraph Breaks Fjern afsnitsskift + Break Text into Lines Opdel tekst i linjer + Break Text into Paragraphs Opdel tekst i afsnit + Break Text into Words Opdel tekst i ord + Break Text into Glyphs Opdel tekst i glyffer + Reset Text Transform and Scale Nulstil teksttransformation og skalering + Set Alignment, Keep Position: Angiv justering, bevar placering: + Break Text into: Opdel tekst i: + Split at Cursor Opdel ved markøren + Reset Transform Nulstil transformation + Shift-click: break into paragraphs Skift-klik: opdel i afsnit + Alt-click: reset the horizontal scale too Alt-klik: nulstil også den vandrette skalering +breakText Lines Linjer +breakText Words Ord +breakText Glyphs Glyffer +@msg Click in type with a Type tool to split it Klik i tekst med et tekstværktøj for at opdele den +@msg Too many type objects to change at once For mange tekstobjekter til at ændre på én gang +@msg Too many pieces to make at once For mange dele til at oprette på én gang +@msg Select horizontal point or area type whose text fits Vælg vandret punkt- eller områdetekst, hvis tekst kan være der +@msg Nothing to split at the cursor Intet at opdele ved markøren +@msg Select two or more one-line point type objects on one baseline to combine Vælg to eller flere punkttekstobjekter på én linje på samme grundlinje for at kombinere dem +@msg No line breaks to remove Ingen linjeskift at fjerne +@msg No paragraph breaks to remove Ingen afsnitsskift at fjerne +@msg Too many breaks to remove at once For mange skift til at fjerne på én gang +@msg Select point type Vælg punkttekst +@msg The point type is aligned that way already Punktteksten er allerede justeret sådan +@msg The point type has no transform to reset Punktteksten har ingen transformation at nulstille +@msg No fonts are missing Ingen skrifttyper mangler +@msg the replacement font is not available erstatningsskrifttypen er ikke tilgængelig +@msg missing `align` `align` mangler +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` skal være lines, paragraphs, words eller glyphs, ikke {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` skal være "line" eller "paragraph", ikke {other} +@msg `align` must be "left", "center" or "right", not {other} `align` skal være "left", "center" eller "right", ikke {other} diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index a87dcbc6a9..77ccc64605 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -5467,3 +5467,47 @@ anchor Points: Punkte: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` geben Sie `inkLimit`, `removeWhiteOverprint` oder `overprintBlack` an @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Druckfarbkorrekturen wirken in CMYK-Dokumenten: Wählen Sie zuerst Datei › Dokumentfarbmodus › CMYK-Farbe @msg `{key}` must be 0..{max} `{key}` muss 0..{max} sein + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Text aufteilen + Combine Point Text Punkttext zusammenfügen + Remove Breaks Umbrüche entfernen + Split Text at Cursor Text an der Einfügemarke teilen + Set Alignment, Keep Position Ausrichtung festlegen, Position beibehalten + Reset Text Transform Texttransformation zurücksetzen + Replace Missing Fonts… Fehlende Schriften ersetzen… + Replace Missing Fonts Fehlende Schriften ersetzen + Remove Line Breaks Zeilenumbrüche entfernen + Remove Paragraph Breaks Absatzumbrüche entfernen + Break Text into Lines Text in Zeilen aufteilen + Break Text into Paragraphs Text in Absätze aufteilen + Break Text into Words Text in Wörter aufteilen + Break Text into Glyphs Text in Glyphen aufteilen + Reset Text Transform and Scale Texttransformation und Skalierung zurücksetzen + Set Alignment, Keep Position: Ausrichtung festlegen, Position beibehalten: + Break Text into: Text aufteilen in: + Split at Cursor An Einfügemarke teilen + Reset Transform Transformation zurücksetzen + Shift-click: break into paragraphs Shift-Klick: in Absätze aufteilen + Alt-click: reset the horizontal scale too Alt-Klick: auch die horizontale Skalierung zurücksetzen +breakText Lines Zeilen +breakText Words Wörter +breakText Glyphs Glyphen +@msg Click in type with a Type tool to split it Klicken Sie mit einem Text-Werkzeug in Text, um ihn zu teilen +@msg Too many type objects to change at once Zu viele Textobjekte, um sie auf einmal zu ändern +@msg Too many pieces to make at once Zu viele Teile, um sie auf einmal zu erstellen +@msg Select horizontal point or area type whose text fits Wählen Sie horizontalen Punkt- oder Flächentext aus, dessen Text hineinpasst +@msg Nothing to split at the cursor An der Einfügemarke gibt es nichts zu teilen +@msg Select two or more one-line point type objects on one baseline to combine Wählen Sie zwei oder mehr einzeilige Punkttextobjekte auf einer Grundlinie aus, um sie zusammenzufügen +@msg No line breaks to remove Keine Zeilenumbrüche zu entfernen +@msg No paragraph breaks to remove Keine Absatzumbrüche zu entfernen +@msg Too many breaks to remove at once Zu viele Umbrüche, um sie auf einmal zu entfernen +@msg Select point type Wählen Sie Punkttext aus +@msg The point type is aligned that way already Der Punkttext ist bereits so ausgerichtet +@msg The point type has no transform to reset Der Punkttext hat keine Transformation zum Zurücksetzen +@msg No fonts are missing Es fehlen keine Schriften +@msg the replacement font is not available die Ersatzschrift ist nicht verfügbar +@msg missing `align` `align` fehlt +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` muss lines, paragraphs, words oder glyphs sein, nicht {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` muss "line" oder "paragraph" sein, nicht {other} +@msg `align` must be "left", "center" or "right", not {other} `align` muss "left", "center" oder "right" sein, nicht {other} diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 8b571c11f6..f500d2dc14 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -5834,3 +5834,47 @@ anchor Points: Σημεία: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` δώστε `inkLimit`, `removeWhiteOverprint` ή `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Οι διορθώσεις μελανιών εκτύπωσης ισχύουν σε έγγραφα CMYK: επιλέξτε πρώτα Αρχείο › Λειτουργία χρώματος εγγράφου › Χρώμα CMYK @msg `{key}` must be 0..{max} το `{key}` πρέπει να είναι 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Διαίρεση κειμένου + Combine Point Text Συνδυασμός κειμένου σημείου + Remove Breaks Αφαίρεση αλλαγών + Split Text at Cursor Διαίρεση κειμένου στον δρομέα + Set Alignment, Keep Position Ορισμός στοίχισης με διατήρηση θέσης + Reset Text Transform Επαναφορά μετασχηματισμού κειμένου + Replace Missing Fonts… Αντικατάσταση γραμματοσειρών που λείπουν… + Replace Missing Fonts Αντικατάσταση γραμματοσειρών που λείπουν + Remove Line Breaks Αφαίρεση αλλαγών γραμμής + Remove Paragraph Breaks Αφαίρεση αλλαγών παραγράφου + Break Text into Lines Διαίρεση κειμένου σε γραμμές + Break Text into Paragraphs Διαίρεση κειμένου σε παραγράφους + Break Text into Words Διαίρεση κειμένου σε λέξεις + Break Text into Glyphs Διαίρεση κειμένου σε γλύφους + Reset Text Transform and Scale Επαναφορά μετασχηματισμού και κλίμακας κειμένου + Set Alignment, Keep Position: Στοίχιση με διατήρηση θέσης: + Break Text into: Διαίρεση κειμένου σε: + Split at Cursor Διαίρεση στον δρομέα + Reset Transform Επαναφορά μετασχηματισμού + Shift-click: break into paragraphs Shift-κλικ: διαίρεση σε παραγράφους + Alt-click: reset the horizontal scale too Alt-κλικ: επαναφορά και της οριζόντιας κλίμακας +breakText Lines Γραμμές +breakText Words Λέξεις +breakText Glyphs Γλύφοι +@msg Click in type with a Type tool to split it Κάντε κλικ σε κείμενο με ένα εργαλείο κειμένου για να το διαιρέσετε +@msg Too many type objects to change at once Πάρα πολλά αντικείμενα κειμένου για αλλαγή ταυτόχρονα +@msg Too many pieces to make at once Πάρα πολλά κομμάτια για δημιουργία ταυτόχρονα +@msg Select horizontal point or area type whose text fits Επιλέξτε οριζόντιο κείμενο σημείου ή περιοχής του οποίου το κείμενο χωράει +@msg Nothing to split at the cursor Δεν υπάρχει τίποτα για διαίρεση στον δρομέα +@msg Select two or more one-line point type objects on one baseline to combine Επιλέξτε δύο ή περισσότερα μονογραμμικά αντικείμενα κειμένου σημείου στην ίδια γραμμή βάσης για να τα συνδυάσετε +@msg No line breaks to remove Δεν υπάρχουν αλλαγές γραμμής για αφαίρεση +@msg No paragraph breaks to remove Δεν υπάρχουν αλλαγές παραγράφου για αφαίρεση +@msg Too many breaks to remove at once Πάρα πολλές αλλαγές για αφαίρεση ταυτόχρονα +@msg Select point type Επιλέξτε κείμενο σημείου +@msg The point type is aligned that way already Το κείμενο σημείου είναι ήδη στοιχισμένο έτσι +@msg The point type has no transform to reset Το κείμενο σημείου δεν έχει μετασχηματισμό για επαναφορά +@msg No fonts are missing Δεν λείπει καμία γραμματοσειρά +@msg the replacement font is not available η γραμματοσειρά αντικατάστασης δεν είναι διαθέσιμη +@msg missing `align` λείπει το `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} το `by` πρέπει να είναι lines, paragraphs, words ή glyphs, όχι {other} +@msg `kind` must be "line" or "paragraph", not {other} το `kind` πρέπει να είναι "line" ή "paragraph", όχι {other} +@msg `align` must be "left", "center" or "right", not {other} το `align` πρέπει να είναι "left", "center" ή "right", όχι {other} diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index b84ce995a8..8b7707d49f 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -5825,3 +5825,47 @@ anchor Points: Puntos: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` indique `inkLimit`, `removeWhiteOverprint` u `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Las correcciones de tinta para impresión funcionan en documentos CMYK: elija primero Archivo › Modo de color del documento › Color CMYK @msg `{key}` must be 0..{max} `{key}` debe ser 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Dividir texto + Combine Point Text Combinar texto de punto + Remove Breaks Quitar saltos + Split Text at Cursor Dividir texto en el cursor + Set Alignment, Keep Position Definir alineación manteniendo la posición + Reset Text Transform Restablecer transformación del texto + Replace Missing Fonts… Reemplazar fuentes que faltan… + Replace Missing Fonts Reemplazar fuentes que faltan + Remove Line Breaks Quitar saltos de línea + Remove Paragraph Breaks Quitar saltos de párrafo + Break Text into Lines Dividir texto en líneas + Break Text into Paragraphs Dividir texto en párrafos + Break Text into Words Dividir texto en palabras + Break Text into Glyphs Dividir texto en glifos + Reset Text Transform and Scale Restablecer transformación y escala del texto + Set Alignment, Keep Position: Definir alineación manteniendo la posición: + Break Text into: Dividir texto en: + Split at Cursor Dividir en el cursor + Reset Transform Restablecer transformación + Shift-click: break into paragraphs Shift+clic: dividir en párrafos + Alt-click: reset the horizontal scale too Alt+clic: restablecer también la escala horizontal +breakText Lines Líneas +breakText Words Palabras +breakText Glyphs Glifos +@msg Click in type with a Type tool to split it Haga clic en un texto con una herramienta Texto para dividirlo +@msg Too many type objects to change at once Demasiados objetos de texto para cambiarlos a la vez +@msg Too many pieces to make at once Demasiadas piezas para crearlas a la vez +@msg Select horizontal point or area type whose text fits Seleccione texto de punto o de área horizontal cuyo texto quepa +@msg Nothing to split at the cursor No hay nada que dividir en el cursor +@msg Select two or more one-line point type objects on one baseline to combine Seleccione dos o más objetos de texto de punto de una línea sobre la misma línea base para combinarlos +@msg No line breaks to remove No hay saltos de línea que quitar +@msg No paragraph breaks to remove No hay saltos de párrafo que quitar +@msg Too many breaks to remove at once Demasiados saltos para quitarlos a la vez +@msg Select point type Seleccione texto de punto +@msg The point type is aligned that way already El texto de punto ya está alineado así +@msg The point type has no transform to reset El texto de punto no tiene ninguna transformación que restablecer +@msg No fonts are missing No falta ninguna fuente +@msg the replacement font is not available la fuente de reemplazo no está disponible +@msg missing `align` falta `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` debe ser lines, paragraphs, words o glyphs, no {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` debe ser "line" o "paragraph", no {other} +@msg `align` must be "left", "center" or "right", not {other} `align` debe ser "left", "center" o "right", no {other} diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 47aab93774..169977ede1 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -5913,3 +5913,47 @@ anchor Points: Pisteet: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` anna `inkLimit`, `removeWhiteOverprint` tai `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Painovärien korjaukset toimivat CMYK-asiakirjoissa: valitse ensin Tiedosto › Asiakirjan väritila › CMYK-väri @msg `{key}` must be 0..{max} `{key}` on oltava 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Jaa teksti + Combine Point Text Yhdistä pisteteksti + Remove Breaks Poista vaihdot + Split Text at Cursor Jaa teksti kohdistimen kohdalta + Set Alignment, Keep Position Aseta tasaus, säilytä sijainti + Reset Text Transform Palauta tekstin muunnos + Replace Missing Fonts… Korvaa puuttuvat fontit… + Replace Missing Fonts Korvaa puuttuvat fontit + Remove Line Breaks Poista rivinvaihdot + Remove Paragraph Breaks Poista kappaleenvaihdot + Break Text into Lines Jaa teksti riveiksi + Break Text into Paragraphs Jaa teksti kappaleiksi + Break Text into Words Jaa teksti sanoiksi + Break Text into Glyphs Jaa teksti merkeiksi + Reset Text Transform and Scale Palauta tekstin muunnos ja skaalaus + Set Alignment, Keep Position: Aseta tasaus, säilytä sijainti: + Break Text into: Jaa teksti: + Split at Cursor Jaa kohdistimen kohdalta + Reset Transform Palauta muunnos + Shift-click: break into paragraphs Vaihto-napsautus: jaa kappaleiksi + Alt-click: reset the horizontal scale too Alt-napsautus: palauta myös vaakaskaalaus +breakText Lines Rivit +breakText Words Sanat +breakText Glyphs Merkit +@msg Click in type with a Type tool to split it Napsauta tekstiä tekstityökalulla jakaaksesi sen +@msg Too many type objects to change at once Liian monta tekstiobjektia muutettavaksi kerralla +@msg Too many pieces to make at once Liian monta osaa luotavaksi kerralla +@msg Select horizontal point or area type whose text fits Valitse vaakasuora piste- tai alueteksti, jonka teksti mahtuu +@msg Nothing to split at the cursor Kohdistimen kohdalla ei ole jaettavaa +@msg Select two or more one-line point type objects on one baseline to combine Valitse kaksi tai useampia yksirivisiä pistetekstiobjekteja samalla perusviivalla yhdistääksesi ne +@msg No line breaks to remove Ei poistettavia rivinvaihtoja +@msg No paragraph breaks to remove Ei poistettavia kappaleenvaihtoja +@msg Too many breaks to remove at once Liian monta vaihtoa poistettavaksi kerralla +@msg Select point type Valitse pisteteksti +@msg The point type is aligned that way already Pisteteksti on jo tasattu näin +@msg The point type has no transform to reset Pistetekstillä ei ole palautettavaa muunnosta +@msg No fonts are missing Fontteja ei puutu +@msg the replacement font is not available korvaava fontti ei ole käytettävissä +@msg missing `align` `align` puuttuu +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` on oltava lines, paragraphs, words tai glyphs, ei {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` on oltava "line" tai "paragraph", ei {other} +@msg `align` must be "left", "center" or "right", not {other} `align` on oltava "left", "center" tai "right", ei {other} diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 8e1fb1a783..d253e590a1 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -5881,3 +5881,47 @@ anchor Points: Points : @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` indiquez `inkLimit`, `removeWhiteOverprint` ou `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Les corrections d’encres pour l’impression s’appliquent aux documents CMJN : choisissez d’abord Fichier › Mode colorimétrique du document › Couleur CMJN @msg `{key}` must be 0..{max} `{key}` doit être compris entre 0 et {max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Diviser le texte + Combine Point Text Combiner le texte de point + Remove Breaks Supprimer les sauts + Split Text at Cursor Diviser le texte au curseur + Set Alignment, Keep Position Définir l’alignement en conservant la position + Reset Text Transform Réinitialiser la transformation du texte + Replace Missing Fonts… Remplacer les polices manquantes… + Replace Missing Fonts Remplacer les polices manquantes + Remove Line Breaks Supprimer les sauts de ligne + Remove Paragraph Breaks Supprimer les sauts de paragraphe + Break Text into Lines Diviser le texte en lignes + Break Text into Paragraphs Diviser le texte en paragraphes + Break Text into Words Diviser le texte en mots + Break Text into Glyphs Diviser le texte en glyphes + Reset Text Transform and Scale Réinitialiser la transformation et l’échelle du texte + Set Alignment, Keep Position: Définir l’alignement en conservant la position : + Break Text into: Diviser le texte en : + Split at Cursor Diviser au curseur + Reset Transform Réinitialiser la transformation + Shift-click: break into paragraphs Maj+clic : diviser en paragraphes + Alt-click: reset the horizontal scale too Alt+clic : réinitialiser aussi l’échelle horizontale +breakText Lines Lignes +breakText Words Mots +breakText Glyphs Glyphes +@msg Click in type with a Type tool to split it Cliquez dans du texte avec un outil Texte pour le diviser +@msg Too many type objects to change at once Trop d’objets texte à modifier en une fois +@msg Too many pieces to make at once Trop de morceaux à créer en une fois +@msg Select horizontal point or area type whose text fits Sélectionnez du texte de point ou captif horizontal dont le texte tient dans son cadre +@msg Nothing to split at the cursor Rien à diviser au curseur +@msg Select two or more one-line point type objects on one baseline to combine Sélectionnez au moins deux objets texte de point d’une ligne sur une même ligne de base pour les combiner +@msg No line breaks to remove Aucun saut de ligne à supprimer +@msg No paragraph breaks to remove Aucun saut de paragraphe à supprimer +@msg Too many breaks to remove at once Trop de sauts à supprimer en une fois +@msg Select point type Sélectionnez du texte de point +@msg The point type is aligned that way already Le texte de point est déjà aligné ainsi +@msg The point type has no transform to reset Le texte de point n’a aucune transformation à réinitialiser +@msg No fonts are missing Aucune police ne manque +@msg the replacement font is not available la police de remplacement n’est pas disponible +@msg missing `align` `align` manquant +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` doit valoir lines, paragraphs, words ou glyphs, et non {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` doit valoir "line" ou "paragraph", et non {other} +@msg `align` must be "left", "center" or "right", not {other} `align` doit valoir "left", "center" ou "right", et non {other} diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index fa4728ec47..aaa956be01 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5869,3 +5869,47 @@ anchor Points: Pontok: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` adja meg: `inkLimit`, `removeWhiteOverprint` vagy `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first A nyomdai festékjavítások CMYK-dokumentumokon működnek: előbb válassza a Fájl › Dokumentum színmódja › CMYK-szín parancsot @msg `{key}` must be 0..{max} `{key}` értéke 0..{max} lehet + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Szöveg felosztása + Combine Point Text Pontszöveg egyesítése + Remove Breaks Törések eltávolítása + Split Text at Cursor Szöveg felosztása a kurzornál + Set Alignment, Keep Position Igazítás beállítása, helyzet megtartása + Reset Text Transform Szövegátalakítás visszaállítása + Replace Missing Fonts… Hiányzó betűtípusok cseréje… + Replace Missing Fonts Hiányzó betűtípusok cseréje + Remove Line Breaks Sortörések eltávolítása + Remove Paragraph Breaks Bekezdéstörések eltávolítása + Break Text into Lines Szöveg felosztása sorokra + Break Text into Paragraphs Szöveg felosztása bekezdésekre + Break Text into Words Szöveg felosztása szavakra + Break Text into Glyphs Szöveg felosztása glifákra + Reset Text Transform and Scale Szövegátalakítás és méretezés visszaállítása + Set Alignment, Keep Position: Igazítás beállítása, helyzet megtartása: + Break Text into: Szöveg felosztása: + Split at Cursor Felosztás a kurzornál + Reset Transform Átalakítás visszaállítása + Shift-click: break into paragraphs Shift+kattintás: felosztás bekezdésekre + Alt-click: reset the horizontal scale too Alt+kattintás: a vízszintes méretezés visszaállítása is +breakText Lines Sorok +breakText Words Szavak +breakText Glyphs Glifák +@msg Click in type with a Type tool to split it Kattintson a szövegbe egy szöveg eszközzel a felosztáshoz +@msg Too many type objects to change at once Túl sok szövegobjektum az egyszerre történő módosításhoz +@msg Too many pieces to make at once Túl sok darab az egyszerre történő létrehozáshoz +@msg Select horizontal point or area type whose text fits Jelöljön ki vízszintes pont- vagy területszöveget, amelynek szövege elfér +@msg Nothing to split at the cursor A kurzornál nincs mit felosztani +@msg Select two or more one-line point type objects on one baseline to combine Az egyesítéshez jelöljön ki legalább két egysoros pontszöveg-objektumot egy alapvonalon +@msg No line breaks to remove Nincs eltávolítandó sortörés +@msg No paragraph breaks to remove Nincs eltávolítandó bekezdéstörés +@msg Too many breaks to remove at once Túl sok törés az egyszerre történő eltávolításhoz +@msg Select point type Jelöljön ki pontszöveget +@msg The point type is aligned that way already A pontszöveg már így van igazítva +@msg The point type has no transform to reset A pontszövegnek nincs visszaállítandó átalakítása +@msg No fonts are missing Nem hiányzik betűtípus +@msg the replacement font is not available a helyettesítő betűtípus nem érhető el +@msg missing `align` hiányzik az `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} a `by` értéke lines, paragraphs, words vagy glyphs lehet, nem {other} +@msg `kind` must be "line" or "paragraph", not {other} a `kind` értéke "line" vagy "paragraph" lehet, nem {other} +@msg `align` must be "left", "center" or "right", not {other} az `align` értéke "left", "center" vagy "right" lehet, nem {other} diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 0907afd036..32ae389d0c 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -5787,3 +5787,47 @@ anchor Points: Titik: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` berikan `inkLimit`, `removeWhiteOverprint`, atau `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Perbaikan Tinta Cetak bekerja pada dokumen CMYK: pilih dulu Berkas › Mode warna dokumen › Warna CMYK @msg `{key}` must be 0..{max} `{key}` harus 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Pisahkan teks + Combine Point Text Gabungkan teks titik + Remove Breaks Hapus pemisah + Split Text at Cursor Pisahkan teks di kursor + Set Alignment, Keep Position Atur perataan, pertahankan posisi + Reset Text Transform Atur ulang transformasi teks + Replace Missing Fonts… Ganti font yang hilang… + Replace Missing Fonts Ganti font yang hilang + Remove Line Breaks Hapus putus baris + Remove Paragraph Breaks Hapus putus paragraf + Break Text into Lines Pisahkan teks menjadi baris + Break Text into Paragraphs Pisahkan teks menjadi paragraf + Break Text into Words Pisahkan teks menjadi kata + Break Text into Glyphs Pisahkan teks menjadi glif + Reset Text Transform and Scale Atur ulang transformasi dan skala teks + Set Alignment, Keep Position: Atur perataan, pertahankan posisi: + Break Text into: Pisahkan teks menjadi: + Split at Cursor Pisahkan di kursor + Reset Transform Atur ulang transformasi + Shift-click: break into paragraphs Shift+klik: pisahkan menjadi paragraf + Alt-click: reset the horizontal scale too Alt+klik: atur ulang juga skala horizontal +breakText Lines Baris +breakText Words Kata +breakText Glyphs Glif +@msg Click in type with a Type tool to split it Klik di dalam teks dengan alat teks untuk memisahkannya +@msg Too many type objects to change at once Terlalu banyak objek teks untuk diubah sekaligus +@msg Too many pieces to make at once Terlalu banyak bagian untuk dibuat sekaligus +@msg Select horizontal point or area type whose text fits Pilih teks titik atau teks area horizontal yang teksnya muat +@msg Nothing to split at the cursor Tidak ada yang dapat dipisahkan di kursor +@msg Select two or more one-line point type objects on one baseline to combine Pilih dua atau lebih objek teks titik satu baris pada satu garis dasar untuk menggabungkannya +@msg No line breaks to remove Tidak ada putus baris untuk dihapus +@msg No paragraph breaks to remove Tidak ada putus paragraf untuk dihapus +@msg Too many breaks to remove at once Terlalu banyak pemisah untuk dihapus sekaligus +@msg Select point type Pilih teks titik +@msg The point type is aligned that way already Teks titik sudah diratakan seperti itu +@msg The point type has no transform to reset Teks titik tidak memiliki transformasi untuk diatur ulang +@msg No fonts are missing Tidak ada font yang hilang +@msg the replacement font is not available font pengganti tidak tersedia +@msg missing `align` `align` tidak ada +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` harus lines, paragraphs, words, atau glyphs, bukan {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` harus "line" atau "paragraph", bukan {other} +@msg `align` must be "left", "center" or "right", not {other} `align` harus "left", "center", atau "right", bukan {other} diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 13b70da3c7..8c07d75d5c 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -5501,3 +5501,47 @@ anchor Points: Punti: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` indica `inkLimit`, `removeWhiteOverprint` o `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Le correzioni inchiostri di stampa funzionano nei documenti CMYK: scegli prima File › Metodo colore documento › Colore CMYK @msg `{key}` must be 0..{max} `{key}` deve essere 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Dividi testo + Combine Point Text Combina testo con punto + Remove Breaks Rimuovi interruzioni + Split Text at Cursor Dividi testo al cursore + Set Alignment, Keep Position Imposta allineamento mantenendo la posizione + Reset Text Transform Reimposta trasformazione testo + Replace Missing Fonts… Sostituisci font mancanti… + Replace Missing Fonts Sostituisci font mancanti + Remove Line Breaks Rimuovi interruzioni di riga + Remove Paragraph Breaks Rimuovi interruzioni di paragrafo + Break Text into Lines Dividi testo in righe + Break Text into Paragraphs Dividi testo in paragrafi + Break Text into Words Dividi testo in parole + Break Text into Glyphs Dividi testo in glifi + Reset Text Transform and Scale Reimposta trasformazione e scala testo + Set Alignment, Keep Position: Imposta allineamento mantenendo la posizione: + Break Text into: Dividi testo in: + Split at Cursor Dividi al cursore + Reset Transform Reimposta trasformazione + Shift-click: break into paragraphs Shift+clic: dividi in paragrafi + Alt-click: reset the horizontal scale too Alt+clic: reimposta anche la scala orizzontale +breakText Lines Righe +breakText Words Parole +breakText Glyphs Glifi +@msg Click in type with a Type tool to split it Fai clic nel testo con uno strumento Testo per dividerlo +@msg Too many type objects to change at once Troppi oggetti di testo da modificare in una volta +@msg Too many pieces to make at once Troppi pezzi da creare in una volta +@msg Select horizontal point or area type whose text fits Seleziona testo con punto o in area orizzontale il cui testo ci sta +@msg Nothing to split at the cursor Niente da dividere al cursore +@msg Select two or more one-line point type objects on one baseline to combine Seleziona due o più oggetti di testo con punto su una riga sulla stessa linea di base per combinarli +@msg No line breaks to remove Nessuna interruzione di riga da rimuovere +@msg No paragraph breaks to remove Nessuna interruzione di paragrafo da rimuovere +@msg Too many breaks to remove at once Troppe interruzioni da rimuovere in una volta +@msg Select point type Seleziona testo con punto +@msg The point type is aligned that way already Il testo con punto è già allineato così +@msg The point type has no transform to reset Il testo con punto non ha trasformazioni da reimpostare +@msg No fonts are missing Non mancano font +@msg the replacement font is not available il font sostitutivo non è disponibile +@msg missing `align` `align` mancante +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` deve essere lines, paragraphs, words o glyphs, non {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` deve essere "line" o "paragraph", non {other} +@msg `align` must be "left", "center" or "right", not {other} `align` deve essere "left", "center" o "right", non {other} diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 274d1eff83..97d99c32ec 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -5570,3 +5570,47 @@ anchor Points: ポイント: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` `inkLimit`、`removeWhiteOverprint` または `overprintBlack` を指定してください @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first 印刷インキの修正は CMYK ドキュメントで使用できます。先にファイル › ドキュメントのカラーモード › CMYK カラーを選択してください @msg `{key}` must be 0..{max} `{key}` は 0..{max} にしてください + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text テキストを分割 + Combine Point Text ポイント文字を結合 + Remove Breaks 改行を削除 + Split Text at Cursor カーソル位置でテキストを分割 + Set Alignment, Keep Position 位置を保って行揃えを設定 + Reset Text Transform テキストの変形をリセット + Replace Missing Fonts… 見つからないフォントを置換… + Replace Missing Fonts 見つからないフォントを置換 + Remove Line Breaks 強制改行を削除 + Remove Paragraph Breaks 段落の区切りを削除 + Break Text into Lines テキストを行に分割 + Break Text into Paragraphs テキストを段落に分割 + Break Text into Words テキストを単語に分割 + Break Text into Glyphs テキストを字形に分割 + Reset Text Transform and Scale テキストの変形と比率をリセット + Set Alignment, Keep Position: 位置を保って行揃えを設定: + Break Text into: テキストを分割: + Split at Cursor カーソル位置で分割 + Reset Transform 変形をリセット + Shift-click: break into paragraphs Shift+クリック:段落に分割 + Alt-click: reset the horizontal scale too Alt+クリック:水平比率もリセット +breakText Lines 行 +breakText Words 単語 +breakText Glyphs 字形 +@msg Click in type with a Type tool to split it 分割するには、文字ツールでテキスト内をクリックしてください +@msg Too many type objects to change at once 一度に変更するテキストオブジェクトが多すぎます +@msg Too many pieces to make at once 一度に作成する部分が多すぎます +@msg Select horizontal point or area type whose text fits テキストが収まっている横組みのポイント文字またはエリア内文字を選択してください +@msg Nothing to split at the cursor カーソル位置で分割するものがありません +@msg Select two or more one-line point type objects on one baseline to combine 結合するには、同じベースライン上にある 1 行のポイント文字オブジェクトを 2 つ以上選択してください +@msg No line breaks to remove 削除する強制改行がありません +@msg No paragraph breaks to remove 削除する段落の区切りがありません +@msg Too many breaks to remove at once 一度に削除する改行が多すぎます +@msg Select point type ポイント文字を選択してください +@msg The point type is aligned that way already ポイント文字はすでにその行揃えです +@msg The point type has no transform to reset ポイント文字にリセットする変形がありません +@msg No fonts are missing 見つからないフォントはありません +@msg the replacement font is not available 置換用のフォントを使用できません +@msg missing `align` `align` がありません +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` は lines、paragraphs、words、glyphs のいずれかにしてください({other} は使用できません) +@msg `kind` must be "line" or "paragraph", not {other} `kind` は "line" または "paragraph" にしてください({other} は使用できません) +@msg `align` must be "left", "center" or "right", not {other} `align` は "left"、"center"、"right" のいずれかにしてください({other} は使用できません) diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 236a14befb..df3777f4fb 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -5872,3 +5872,47 @@ anchor Points: წერტილები: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` მიუთითეთ `inkLimit`, `removeWhiteOverprint` ან `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first საბეჭდი მელნის შესწორებები მუშაობს CMYK დოკუმენტებზე: ჯერ აირჩიეთ ფაილი › დოკუმენტის ფერის რეჟიმი › CMYK ფერი @msg `{key}` must be 0..{max} `{key}` უნდა იყოს 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text ტექსტის დაყოფა + Combine Point Text წერტილის ტექსტის გაერთიანება + Remove Breaks წყვეტების წაშლა + Split Text at Cursor ტექსტის დაყოფა კურსორთან + Set Alignment, Keep Position სწორების დაყენება მდებარეობის შენარჩუნებით + Reset Text Transform ტექსტის გარდაქმნის ჩამოყრა + Replace Missing Fonts… დაკარგული შრიფტების ჩანაცვლება… + Replace Missing Fonts დაკარგული შრიფტების ჩანაცვლება + Remove Line Breaks სტრიქონის წყვეტების წაშლა + Remove Paragraph Breaks აბზაცის წყვეტების წაშლა + Break Text into Lines ტექსტის დაყოფა სტრიქონებად + Break Text into Paragraphs ტექსტის დაყოფა აბზაცებად + Break Text into Words ტექსტის დაყოფა სიტყვებად + Break Text into Glyphs ტექსტის დაყოფა გლიფებად + Reset Text Transform and Scale ტექსტის გარდაქმნისა და მასშტაბის ჩამოყრა + Set Alignment, Keep Position: სწორების დაყენება მდებარეობის შენარჩუნებით: + Break Text into: ტექსტის დაყოფა: + Split at Cursor დაყოფა კურსორთან + Reset Transform გარდაქმნის ჩამოყრა + Shift-click: break into paragraphs Shift-დაწკაპუნება: დაყოფა აბზაცებად + Alt-click: reset the horizontal scale too Alt-დაწკაპუნება: ჰორიზონტალური მასშტაბის ჩამოყრაც +breakText Lines სტრიქონები +breakText Words სიტყვები +breakText Glyphs გლიფები +@msg Click in type with a Type tool to split it დასაყოფად დააწკაპუნეთ ტექსტში ტექსტის ხელსაწყოთი +@msg Too many type objects to change at once ერთდროულად შესაცვლელად ძალიან ბევრი ტექსტური ობიექტია +@msg Too many pieces to make at once ერთდროულად შესაქმნელად ძალიან ბევრი ნაწილია +@msg Select horizontal point or area type whose text fits აირჩიეთ ჰორიზონტალური წერტილის ან არის ტექსტი, რომლის ტექსტიც ეტევა +@msg Nothing to split at the cursor კურსორთან დასაყოფი არაფერია +@msg Select two or more one-line point type objects on one baseline to combine გასაერთიანებლად აირჩიეთ ერთ საბაზისო ხაზზე მდებარე ორი ან მეტი ერთსტრიქონიანი წერტილის ტექსტის ობიექტი +@msg No line breaks to remove წასაშლელი სტრიქონის წყვეტები არ არის +@msg No paragraph breaks to remove წასაშლელი აბზაცის წყვეტები არ არის +@msg Too many breaks to remove at once ერთდროულად წასაშლელად ძალიან ბევრი წყვეტაა +@msg Select point type აირჩიეთ წერტილის ტექსტი +@msg The point type is aligned that way already წერტილის ტექსტი უკვე ასეა სწორებული +@msg The point type has no transform to reset წერტილის ტექსტს ჩამოსაყრელი გარდაქმნა არ აქვს +@msg No fonts are missing დაკარგული შრიფტები არ არის +@msg the replacement font is not available ჩამნაცვლებელი შრიფტი მიუწვდომელია +@msg missing `align` `align` აკლია +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` უნდა იყოს lines, paragraphs, words ან glyphs და არა {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` უნდა იყოს "line" ან "paragraph" და არა {other} +@msg `align` must be "left", "center" or "right", not {other} `align` უნდა იყოს "left", "center" ან "right" და არა {other} diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 2bc410a421..a960573555 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5464,3 +5464,47 @@ anchor Points: 포인트: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` `inkLimit`, `removeWhiteOverprint` 또는 `overprintBlack`을 지정하십시오 @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first 인쇄 잉크 수정은 CMYK 문서에서 작동합니다. 먼저 파일 › 문서 색상 모드 › CMYK 색상을 선택하십시오 @msg `{key}` must be 0..{max} `{key}`은(는) 0..{max}이어야 합니다 + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text 텍스트 나누기 + Combine Point Text 포인트 문자 결합 + Remove Breaks 나누기 제거 + Split Text at Cursor 커서 위치에서 텍스트 나누기 + Set Alignment, Keep Position 위치를 유지하며 정렬 설정 + Reset Text Transform 텍스트 변형 재설정 + Replace Missing Fonts… 누락된 글꼴 바꾸기… + Replace Missing Fonts 누락된 글꼴 바꾸기 + Remove Line Breaks 강제 줄 바꿈 제거 + Remove Paragraph Breaks 단락 나누기 제거 + Break Text into Lines 텍스트를 줄로 나누기 + Break Text into Paragraphs 텍스트를 단락으로 나누기 + Break Text into Words 텍스트를 단어로 나누기 + Break Text into Glyphs 텍스트를 글리프로 나누기 + Reset Text Transform and Scale 텍스트 변형 및 비율 재설정 + Set Alignment, Keep Position: 위치를 유지하며 정렬 설정: + Break Text into: 텍스트 나누기: + Split at Cursor 커서 위치에서 나누기 + Reset Transform 변형 재설정 + Shift-click: break into paragraphs Shift-클릭: 단락으로 나누기 + Alt-click: reset the horizontal scale too Alt-클릭: 가로 비율도 재설정 +breakText Lines 줄 +breakText Words 단어 +breakText Glyphs 글리프 +@msg Click in type with a Type tool to split it 나누려면 문자 도구로 텍스트 안을 클릭하십시오 +@msg Too many type objects to change at once 한 번에 변경할 문자 오브젝트가 너무 많습니다 +@msg Too many pieces to make at once 한 번에 만들 조각이 너무 많습니다 +@msg Select horizontal point or area type whose text fits 텍스트가 모두 들어가는 가로 포인트 문자 또는 영역 문자를 선택하십시오 +@msg Nothing to split at the cursor 커서 위치에서 나눌 내용이 없습니다 +@msg Select two or more one-line point type objects on one baseline to combine 결합하려면 같은 기준선에 있는 한 줄짜리 포인트 문자 오브젝트를 두 개 이상 선택하십시오 +@msg No line breaks to remove 제거할 강제 줄 바꿈이 없습니다 +@msg No paragraph breaks to remove 제거할 단락 나누기가 없습니다 +@msg Too many breaks to remove at once 한 번에 제거할 나누기가 너무 많습니다 +@msg Select point type 포인트 문자를 선택하십시오 +@msg The point type is aligned that way already 포인트 문자가 이미 그렇게 정렬되어 있습니다 +@msg The point type has no transform to reset 포인트 문자에 재설정할 변형이 없습니다 +@msg No fonts are missing 누락된 글꼴이 없습니다 +@msg the replacement font is not available 대체 글꼴을 사용할 수 없습니다 +@msg missing `align` `align`이 없습니다 +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by`는 lines, paragraphs, words 또는 glyphs여야 합니다({other}는 사용할 수 없음) +@msg `kind` must be "line" or "paragraph", not {other} `kind`는 "line" 또는 "paragraph"여야 합니다({other}는 사용할 수 없음) +@msg `align` must be "left", "center" or "right", not {other} `align`은 "left", "center" 또는 "right"여야 합니다({other}는 사용할 수 없음) diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index d5c08f815a..7c5f8c1bf3 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -5831,3 +5831,47 @@ anchor Points: Punten: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` geef `inkLimit`, `removeWhiteOverprint` of `overprintBlack` op @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Drukinktcorrecties werken in CMYK-documenten: kies eerst Bestand › Documentkleurmodus › CMYK-kleur @msg `{key}` must be 0..{max} `{key}` moet 0..{max} zijn + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Tekst splitsen + Combine Point Text Punttekst combineren + Remove Breaks Einden verwijderen + Split Text at Cursor Tekst splitsen bij cursor + Set Alignment, Keep Position Uitlijning instellen, positie behouden + Reset Text Transform Teksttransformatie herstellen + Replace Missing Fonts… Ontbrekende lettertypen vervangen… + Replace Missing Fonts Ontbrekende lettertypen vervangen + Remove Line Breaks Regeleinden verwijderen + Remove Paragraph Breaks Alinea-einden verwijderen + Break Text into Lines Tekst splitsen in regels + Break Text into Paragraphs Tekst splitsen in alinea's + Break Text into Words Tekst splitsen in woorden + Break Text into Glyphs Tekst splitsen in glyphs + Reset Text Transform and Scale Teksttransformatie en schaal herstellen + Set Alignment, Keep Position: Uitlijning instellen, positie behouden: + Break Text into: Tekst splitsen in: + Split at Cursor Splitsen bij cursor + Reset Transform Transformatie herstellen + Shift-click: break into paragraphs Shift-klik: splitsen in alinea's + Alt-click: reset the horizontal scale too Alt-klik: ook de horizontale schaal herstellen +breakText Lines Regels +breakText Words Woorden +breakText Glyphs Glyphs +@msg Click in type with a Type tool to split it Klik met een Type-gereedschap in tekst om deze te splitsen +@msg Too many type objects to change at once Te veel tekstobjecten om in één keer te wijzigen +@msg Too many pieces to make at once Te veel stukken om in één keer te maken +@msg Select horizontal point or area type whose text fits Selecteer horizontale punt- of vlaktekst waarvan de tekst past +@msg Nothing to split at the cursor Niets te splitsen bij de cursor +@msg Select two or more one-line point type objects on one baseline to combine Selecteer twee of meer punttekstobjecten van één regel op één basislijn om ze te combineren +@msg No line breaks to remove Geen regeleinden om te verwijderen +@msg No paragraph breaks to remove Geen alinea-einden om te verwijderen +@msg Too many breaks to remove at once Te veel einden om in één keer te verwijderen +@msg Select point type Selecteer punttekst +@msg The point type is aligned that way already De punttekst is al zo uitgelijnd +@msg The point type has no transform to reset De punttekst heeft geen transformatie om te herstellen +@msg No fonts are missing Er ontbreken geen lettertypen +@msg the replacement font is not available het vervangende lettertype is niet beschikbaar +@msg missing `align` `align` ontbreekt +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` moet lines, paragraphs, words of glyphs zijn, niet {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` moet "line" of "paragraph" zijn, niet {other} +@msg `align` must be "left", "center" or "right", not {other} `align` moet "left", "center" of "right" zijn, niet {other} diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index c456c6df8f..01bcb83fb3 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -5737,3 +5737,47 @@ anchor Points: Punkty: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` podaj `inkLimit`, `removeWhiteOverprint` lub `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Poprawki farb drukarskich działają w dokumentach CMYK: najpierw wybierz Plik › Tryb koloru dokumentu › Kolor CMYK @msg `{key}` must be 0..{max} `{key}` musi wynosić 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Podziel tekst + Combine Point Text Połącz tekst punktowy + Remove Breaks Usuń podziały + Split Text at Cursor Podziel tekst w miejscu kursora + Set Alignment, Keep Position Ustaw wyrównanie, zachowaj położenie + Reset Text Transform Resetuj przekształcenie tekstu + Replace Missing Fonts… Zastąp brakujące czcionki… + Replace Missing Fonts Zastąp brakujące czcionki + Remove Line Breaks Usuń podziały wiersza + Remove Paragraph Breaks Usuń podziały akapitu + Break Text into Lines Podziel tekst na wiersze + Break Text into Paragraphs Podziel tekst na akapity + Break Text into Words Podziel tekst na słowa + Break Text into Glyphs Podziel tekst na glify + Reset Text Transform and Scale Resetuj przekształcenie i skalę tekstu + Set Alignment, Keep Position: Ustaw wyrównanie, zachowaj położenie: + Break Text into: Podziel tekst na: + Split at Cursor Podziel w miejscu kursora + Reset Transform Resetuj przekształcenie + Shift-click: break into paragraphs Kliknięcie z Shift: podziel na akapity + Alt-click: reset the horizontal scale too Kliknięcie z Alt: resetuj także skalę poziomą +breakText Lines Wiersze +breakText Words Słowa +breakText Glyphs Glify +@msg Click in type with a Type tool to split it Kliknij w tekst narzędziem Tekst, aby go podzielić +@msg Too many type objects to change at once Zbyt wiele obiektów tekstowych do zmiany naraz +@msg Too many pieces to make at once Zbyt wiele części do utworzenia naraz +@msg Select horizontal point or area type whose text fits Zaznacz poziomy tekst punktowy lub akapitowy, którego tekst się mieści +@msg Nothing to split at the cursor Nie ma nic do podzielenia w miejscu kursora +@msg Select two or more one-line point type objects on one baseline to combine Zaznacz co najmniej dwa jednowierszowe obiekty tekstu punktowego na jednej linii bazowej, aby je połączyć +@msg No line breaks to remove Brak podziałów wiersza do usunięcia +@msg No paragraph breaks to remove Brak podziałów akapitu do usunięcia +@msg Too many breaks to remove at once Zbyt wiele podziałów do usunięcia naraz +@msg Select point type Zaznacz tekst punktowy +@msg The point type is aligned that way already Tekst punktowy jest już tak wyrównany +@msg The point type has no transform to reset Tekst punktowy nie ma przekształcenia do zresetowania +@msg No fonts are missing Nie brakuje żadnych czcionek +@msg the replacement font is not available czcionka zastępcza jest niedostępna +@msg missing `align` brak `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` musi mieć wartość lines, paragraphs, words lub glyphs, a nie {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` musi mieć wartość "line" lub "paragraph", a nie {other} +@msg `align` must be "left", "center" or "right", not {other} `align` musi mieć wartość "left", "center" lub "right", a nie {other} diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index b95ea47bda..7909264329 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -5800,3 +5800,47 @@ anchor Points: Pontos: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` informe `inkLimit`, `removeWhiteOverprint` ou `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first As Correções de Tinta para Impressão funcionam em documentos CMYK: escolha antes Arquivo › Modo de Cor do Documento › Cor CMYK @msg `{key}` must be 0..{max} `{key}` deve ser 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Dividir Texto + Combine Point Text Combinar Texto de Ponto + Remove Breaks Remover Quebras + Split Text at Cursor Dividir Texto no Cursor + Set Alignment, Keep Position Definir Alinhamento, Manter Posição + Reset Text Transform Redefinir Transformação do Texto + Replace Missing Fonts… Substituir Fontes Ausentes… + Replace Missing Fonts Substituir Fontes Ausentes + Remove Line Breaks Remover Quebras de Linha + Remove Paragraph Breaks Remover Quebras de Parágrafo + Break Text into Lines Dividir Texto em Linhas + Break Text into Paragraphs Dividir Texto em Parágrafos + Break Text into Words Dividir Texto em Palavras + Break Text into Glyphs Dividir Texto em Glifos + Reset Text Transform and Scale Redefinir Transformação e Escala do Texto + Set Alignment, Keep Position: Definir Alinhamento, Manter Posição: + Break Text into: Dividir Texto em: + Split at Cursor Dividir no Cursor + Reset Transform Redefinir Transformação + Shift-click: break into paragraphs Clique com Shift: dividir em parágrafos + Alt-click: reset the horizontal scale too Alt-clique: redefinir também a escala horizontal +breakText Lines Linhas +breakText Words Palavras +breakText Glyphs Glifos +@msg Click in type with a Type tool to split it Clique em um texto com uma ferramenta Texto para dividi-lo +@msg Too many type objects to change at once Objetos de texto demais para alterar de uma vez +@msg Too many pieces to make at once Partes demais para criar de uma vez +@msg Select horizontal point or area type whose text fits Selecione texto de ponto ou de área horizontal cujo texto caiba +@msg Nothing to split at the cursor Nada a dividir no cursor +@msg Select two or more one-line point type objects on one baseline to combine Selecione dois ou mais objetos de texto de ponto de uma linha na mesma linha de base para combiná-los +@msg No line breaks to remove Nenhuma quebra de linha a remover +@msg No paragraph breaks to remove Nenhuma quebra de parágrafo a remover +@msg Too many breaks to remove at once Quebras demais para remover de uma vez +@msg Select point type Selecione texto de ponto +@msg The point type is aligned that way already O texto de ponto já está alinhado assim +@msg The point type has no transform to reset O texto de ponto não tem transformação a redefinir +@msg No fonts are missing Nenhuma fonte está ausente +@msg the replacement font is not available a fonte substituta não está disponível +@msg missing `align` `align` ausente +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` deve ser lines, paragraphs, words ou glyphs, não {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` deve ser "line" ou "paragraph", não {other} +@msg `align` must be "left", "center" or "right", not {other} `align` deve ser "left", "center" ou "right", não {other} diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index bbeca6300c..0fb52e6883 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -5860,3 +5860,47 @@ anchor Points: Точки: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` задайте `inkLimit`, `removeWhiteOverprint` или `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Исправления печатных красок работают в документах CMYK: сначала выберите Файл › Цветовой режим документа › Цвет CMYK @msg `{key}` must be 0..{max} `{key}` должен быть 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Разбить текст + Combine Point Text Объединить текст из точки + Remove Breaks Удалить разрывы + Split Text at Cursor Разбить текст у курсора + Set Alignment, Keep Position Задать выравнивание, сохранив положение + Reset Text Transform Сбросить трансформацию текста + Replace Missing Fonts… Заменить отсутствующие шрифты… + Replace Missing Fonts Заменить отсутствующие шрифты + Remove Line Breaks Удалить разрывы строк + Remove Paragraph Breaks Удалить разрывы абзацев + Break Text into Lines Разбить текст на строки + Break Text into Paragraphs Разбить текст на абзацы + Break Text into Words Разбить текст на слова + Break Text into Glyphs Разбить текст на глифы + Reset Text Transform and Scale Сбросить трансформацию и масштаб текста + Set Alignment, Keep Position: Выравнивание с сохранением положения: + Break Text into: Разбить текст на: + Split at Cursor Разбить у курсора + Reset Transform Сбросить трансформацию + Shift-click: break into paragraphs Shift+щелчок: разбить на абзацы + Alt-click: reset the horizontal scale too Alt+щелчок: сбросить и масштаб по горизонтали +breakText Lines Строки +breakText Words Слова +breakText Glyphs Глифы +@msg Click in type with a Type tool to split it Щёлкните в тексте инструментом «Текст», чтобы разбить его +@msg Too many type objects to change at once Слишком много текстовых объектов для изменения за один раз +@msg Too many pieces to make at once Слишком много частей для создания за один раз +@msg Select horizontal point or area type whose text fits Выделите горизонтальный текст из точки или в области, текст которого помещается +@msg Nothing to split at the cursor У курсора нечего разбивать +@msg Select two or more one-line point type objects on one baseline to combine Выделите два или более однострочных объекта текста из точки на одной базовой линии, чтобы объединить их +@msg No line breaks to remove Нет разрывов строк для удаления +@msg No paragraph breaks to remove Нет разрывов абзацев для удаления +@msg Too many breaks to remove at once Слишком много разрывов для удаления за один раз +@msg Select point type Выделите текст из точки +@msg The point type is aligned that way already Текст из точки уже так выровнен +@msg The point type has no transform to reset У текста из точки нет трансформации для сброса +@msg No fonts are missing Отсутствующих шрифтов нет +@msg the replacement font is not available шрифт для замены недоступен +@msg missing `align` не указан `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` должен быть lines, paragraphs, words или glyphs, а не {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` должен быть "line" или "paragraph", а не {other} +@msg `align` must be "left", "center" or "right", not {other} `align` должен быть "left", "center" или "right", а не {other} diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 7ba6023b4c..07c4a92283 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -5938,3 +5938,47 @@ shape Open Öppen @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` ange `inkLimit`, `removeWhiteOverprint` eller `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Tryckfärgskorrigeringar fungerar i CMYK-dokument: välj först Fil › Dokumentets färgläge › CMYK-färg @msg `{key}` must be 0..{max} `{key}` måste vara 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Dela upp text + Combine Point Text Kombinera punkttext + Remove Breaks Ta bort brytningar + Split Text at Cursor Dela text vid markören + Set Alignment, Keep Position Ställ in justering, behåll position + Reset Text Transform Återställ texttransformering + Replace Missing Fonts… Ersätt saknade typsnitt… + Replace Missing Fonts Ersätt saknade typsnitt + Remove Line Breaks Ta bort radbrytningar + Remove Paragraph Breaks Ta bort styckebrytningar + Break Text into Lines Dela upp text i rader + Break Text into Paragraphs Dela upp text i stycken + Break Text into Words Dela upp text i ord + Break Text into Glyphs Dela upp text i glyfer + Reset Text Transform and Scale Återställ texttransformering och skala + Set Alignment, Keep Position: Ställ in justering, behåll position: + Break Text into: Dela upp text i: + Split at Cursor Dela vid markören + Reset Transform Återställ transformering + Shift-click: break into paragraphs Shift-klicka: dela upp i stycken + Alt-click: reset the horizontal scale too Alt-klick: återställ även den horisontella skalan +breakText Lines Rader +breakText Words Ord +breakText Glyphs Glyfer +@msg Click in type with a Type tool to split it Klicka i text med ett textverktyg för att dela den +@msg Too many type objects to change at once För många textobjekt att ändra på en gång +@msg Too many pieces to make at once För många delar att skapa på en gång +@msg Select horizontal point or area type whose text fits Markera vågrät punkt- eller områdestext vars text får plats +@msg Nothing to split at the cursor Inget att dela vid markören +@msg Select two or more one-line point type objects on one baseline to combine Markera två eller fler enradiga punkttextobjekt på samma baslinje för att kombinera dem +@msg No line breaks to remove Inga radbrytningar att ta bort +@msg No paragraph breaks to remove Inga styckebrytningar att ta bort +@msg Too many breaks to remove at once För många brytningar att ta bort på en gång +@msg Select point type Markera punkttext +@msg The point type is aligned that way already Punkttexten är redan justerad så +@msg The point type has no transform to reset Punkttexten har ingen transformering att återställa +@msg No fonts are missing Inga typsnitt saknas +@msg the replacement font is not available ersättningstypsnittet är inte tillgängligt +@msg missing `align` `align` saknas +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` måste vara lines, paragraphs, words eller glyphs, inte {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` måste vara "line" eller "paragraph", inte {other} +@msg `align` must be "left", "center" or "right", not {other} `align` måste vara "left", "center" eller "right", inte {other} diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index f445da8adb..8dbdfe2542 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -5840,3 +5840,47 @@ anchor Points: Noktalar: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` `inkLimit`, `removeWhiteOverprint` veya `overprintBlack` verin @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Baskı Mürekkebi Düzeltmeleri CMYK belgelerinde çalışır: önce Dosya › Belge Renk Modu › CMYK Rengi'ni seçin @msg `{key}` must be 0..{max} `{key}` 0..{max} olmalıdır + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Metni Böl + Combine Point Text Nokta Metnini Birleştir + Remove Breaks Kesmeleri Kaldır + Split Text at Cursor Metni İmleçte Böl + Set Alignment, Keep Position Hizalamayı Ayarla, Konumu Koru + Reset Text Transform Metin Dönüşümünü Sıfırla + Replace Missing Fonts… Eksik Yazı Tiplerini Değiştir… + Replace Missing Fonts Eksik Yazı Tiplerini Değiştir + Remove Line Breaks Satır Sonlarını Kaldır + Remove Paragraph Breaks Paragraf Sonlarını Kaldır + Break Text into Lines Metni Satırlara Böl + Break Text into Paragraphs Metni Paragraflara Böl + Break Text into Words Metni Sözcüklere Böl + Break Text into Glyphs Metni Gliflere Böl + Reset Text Transform and Scale Metin Dönüşümünü ve Ölçeğini Sıfırla + Set Alignment, Keep Position: Hizalamayı Ayarla, Konumu Koru: + Break Text into: Metni Böl: + Split at Cursor İmleçte Böl + Reset Transform Dönüşümü Sıfırla + Shift-click: break into paragraphs Shift tuşuyla tıklayın: paragraflara böl + Alt-click: reset the horizontal scale too Alt tuşuyla tıklayın: yatay ölçeği de sıfırla +breakText Lines Satırlar +breakText Words Sözcükler +breakText Glyphs Glifler +@msg Click in type with a Type tool to split it Bölmek için bir Yazım Aracıyla metnin içine tıklayın +@msg Too many type objects to change at once Bir kerede değiştirilecek çok fazla metin nesnesi var +@msg Too many pieces to make at once Bir kerede oluşturulacak çok fazla parça var +@msg Select horizontal point or area type whose text fits Metni sığan yatay nokta veya alan metni seçin +@msg Nothing to split at the cursor İmleçte bölünecek bir şey yok +@msg Select two or more one-line point type objects on one baseline to combine Birleştirmek için aynı taban çizgisinde iki veya daha fazla tek satırlı nokta metni nesnesi seçin +@msg No line breaks to remove Kaldırılacak satır sonu yok +@msg No paragraph breaks to remove Kaldırılacak paragraf sonu yok +@msg Too many breaks to remove at once Bir kerede kaldırılacak çok fazla kesme var +@msg Select point type Nokta metni seçin +@msg The point type is aligned that way already Nokta metni zaten bu şekilde hizalı +@msg The point type has no transform to reset Nokta metninin sıfırlanacak dönüşümü yok +@msg No fonts are missing Eksik yazı tipi yok +@msg the replacement font is not available yedek yazı tipi kullanılamıyor +@msg missing `align` `align` eksik +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by`, lines, paragraphs, words veya glyphs olmalı, {other} değil +@msg `kind` must be "line" or "paragraph", not {other} `kind`, "line" veya "paragraph" olmalı, {other} değil +@msg `align` must be "left", "center" or "right", not {other} `align`, "left", "center" veya "right" olmalı, {other} değil diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 26da71aac1..26ad9906a9 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -5481,3 +5481,47 @@ anchor Points: Точки: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` задайте `inkLimit`, `removeWhiteOverprint` або `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Виправлення друкарських фарб працюють у документах CMYK: спершу виберіть Файл › Колірний режим документа › Колір CMYK @msg `{key}` must be 0..{max} `{key}` має бути 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Розбити текст + Combine Point Text Об’єднати текст із точки + Remove Breaks Видалити розриви + Split Text at Cursor Розбити текст біля курсора + Set Alignment, Keep Position Задати вирівнювання, зберігши положення + Reset Text Transform Скинути трансформацію тексту + Replace Missing Fonts… Замінити відсутні шрифти… + Replace Missing Fonts Замінити відсутні шрифти + Remove Line Breaks Видалити розриви рядків + Remove Paragraph Breaks Видалити розриви абзаців + Break Text into Lines Розбити текст на рядки + Break Text into Paragraphs Розбити текст на абзаци + Break Text into Words Розбити текст на слова + Break Text into Glyphs Розбити текст на гліфи + Reset Text Transform and Scale Скинути трансформацію та масштаб тексту + Set Alignment, Keep Position: Вирівнювання зі збереженням положення: + Break Text into: Розбити текст на: + Split at Cursor Розбити біля курсора + Reset Transform Скинути трансформацію + Shift-click: break into paragraphs Shift+клацання: розбити на абзаци + Alt-click: reset the horizontal scale too Alt+клацання: скинути й горизонтальний масштаб +breakText Lines Рядки +breakText Words Слова +breakText Glyphs Гліфи +@msg Click in type with a Type tool to split it Клацніть у тексті інструментом «Текст», щоб розбити його +@msg Too many type objects to change at once Забагато текстових об’єктів, щоб змінити їх за раз +@msg Too many pieces to make at once Забагато частин, щоб створити їх за раз +@msg Select horizontal point or area type whose text fits Виділіть горизонтальний текст із точки або в області, текст якого вміщується +@msg Nothing to split at the cursor Біля курсора нічого розбивати +@msg Select two or more one-line point type objects on one baseline to combine Виділіть два або більше однорядкових об’єктів тексту з точки на одній базовій лінії, щоб об’єднати їх +@msg No line breaks to remove Немає розривів рядків для видалення +@msg No paragraph breaks to remove Немає розривів абзаців для видалення +@msg Too many breaks to remove at once Забагато розривів, щоб видалити їх за раз +@msg Select point type Виділіть текст із точки +@msg The point type is aligned that way already Текст із точки вже так вирівняно +@msg The point type has no transform to reset Текст із точки не має трансформації для скидання +@msg No fonts are missing Відсутніх шрифтів немає +@msg the replacement font is not available шрифт для заміни недоступний +@msg missing `align` не вказано `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` має бути lines, paragraphs, words або glyphs, а не {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` має бути "line" або "paragraph", а не {other} +@msg `align` must be "left", "center" or "right", not {other} `align` має бути "left", "center" або "right", а не {other} diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index f26f07db70..f58aed92be 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -5483,3 +5483,47 @@ anchor Points: Điểm: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` hãy cho `inkLimit`, `removeWhiteOverprint` hoặc `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first Sửa mực in hoạt động trên tài liệu CMYK: trước hết chọn Tệp › Chế độ màu tài liệu › Màu CMYK @msg `{key}` must be 0..{max} `{key}` phải là 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text Tách văn bản + Combine Point Text Kết hợp chữ điểm + Remove Breaks Xóa ngắt + Split Text at Cursor Tách văn bản tại con trỏ + Set Alignment, Keep Position Đặt căn lề, giữ vị trí + Reset Text Transform Đặt lại biến đổi văn bản + Replace Missing Fonts… Thay thế phông chữ thiếu… + Replace Missing Fonts Thay thế phông chữ thiếu + Remove Line Breaks Xóa xuống dòng + Remove Paragraph Breaks Xóa ngắt đoạn + Break Text into Lines Tách văn bản thành dòng + Break Text into Paragraphs Tách văn bản thành đoạn + Break Text into Words Tách văn bản thành từ + Break Text into Glyphs Tách văn bản thành glyph + Reset Text Transform and Scale Đặt lại biến đổi và tỷ lệ văn bản + Set Alignment, Keep Position: Đặt căn lề, giữ vị trí: + Break Text into: Tách văn bản thành: + Split at Cursor Tách tại con trỏ + Reset Transform Đặt lại biến đổi + Shift-click: break into paragraphs Shift-bấm: tách thành đoạn + Alt-click: reset the horizontal scale too Alt-bấm: đặt lại cả tỷ lệ ngang +breakText Lines Dòng +breakText Words Từ +breakText Glyphs Glyph +@msg Click in type with a Type tool to split it Nhấp vào văn bản bằng công cụ Chữ để tách văn bản +@msg Too many type objects to change at once Quá nhiều đối tượng chữ để thay đổi cùng lúc +@msg Too many pieces to make at once Quá nhiều phần để tạo cùng lúc +@msg Select horizontal point or area type whose text fits Chọn chữ điểm hoặc chữ vùng nằm ngang có văn bản vừa khung +@msg Nothing to split at the cursor Không có gì để tách tại con trỏ +@msg Select two or more one-line point type objects on one baseline to combine Chọn hai đối tượng chữ điểm một dòng trở lên trên cùng một đường cơ sở để kết hợp +@msg No line breaks to remove Không có xuống dòng nào để xóa +@msg No paragraph breaks to remove Không có ngắt đoạn nào để xóa +@msg Too many breaks to remove at once Quá nhiều ngắt để xóa cùng lúc +@msg Select point type Chọn chữ điểm +@msg The point type is aligned that way already Chữ điểm đã được căn như vậy +@msg The point type has no transform to reset Chữ điểm không có biến đổi nào để đặt lại +@msg No fonts are missing Không thiếu phông chữ nào +@msg the replacement font is not available phông chữ thay thế không có sẵn +@msg missing `align` thiếu `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` phải là lines, paragraphs, words hoặc glyphs, không phải {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` phải là "line" hoặc "paragraph", không phải {other} +@msg `align` must be "left", "center" or "right", not {other} `align` phải là "left", "center" hoặc "right", không phải {other} diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 76378e4e88..00cd38e03c 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -5724,3 +5724,47 @@ anchor Points: 点: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` 请指定 `inkLimit`、`removeWhiteOverprint` 或 `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first 印刷油墨修正适用于 CMYK 文档:请先选择 文件 › 文档颜色模式 › CMYK 颜色 @msg `{key}` must be 0..{max} `{key}` 必须为 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text 拆分文本 + Combine Point Text 合并点文字 + Remove Breaks 删除换行 + Split Text at Cursor 在光标处拆分文本 + Set Alignment, Keep Position 设置对齐并保持位置 + Reset Text Transform 重置文本变换 + Replace Missing Fonts… 替换缺失的字体… + Replace Missing Fonts 替换缺失的字体 + Remove Line Breaks 删除强制换行 + Remove Paragraph Breaks 删除段落换行 + Break Text into Lines 将文本拆分为行 + Break Text into Paragraphs 将文本拆分为段落 + Break Text into Words 将文本拆分为单词 + Break Text into Glyphs 将文本拆分为字形 + Reset Text Transform and Scale 重置文本变换和缩放 + Set Alignment, Keep Position: 设置对齐并保持位置: + Break Text into: 将文本拆分为: + Split at Cursor 在光标处拆分 + Reset Transform 重置变换 + Shift-click: break into paragraphs Shift+单击:拆分为段落 + Alt-click: reset the horizontal scale too Alt+点击:同时重置水平缩放 +breakText Lines 行 +breakText Words 单词 +breakText Glyphs 字形 +@msg Click in type with a Type tool to split it 请用文字工具在文字中单击以拆分 +@msg Too many type objects to change at once 一次要更改的文字对象过多 +@msg Too many pieces to make at once 一次要创建的部分过多 +@msg Select horizontal point or area type whose text fits 请选择文本能完全容纳的横排点文字或区域文字 +@msg Nothing to split at the cursor 光标处没有可拆分的内容 +@msg Select two or more one-line point type objects on one baseline to combine 请选择同一基线上两个或更多单行点文字对象以合并 +@msg No line breaks to remove 没有要删除的强制换行 +@msg No paragraph breaks to remove 没有要删除的段落换行 +@msg Too many breaks to remove at once 一次要删除的换行过多 +@msg Select point type 请选择点文字 +@msg The point type is aligned that way already 点文字已经是这种对齐方式 +@msg The point type has no transform to reset 点文字没有可重置的变换 +@msg No fonts are missing 没有缺失的字体 +@msg the replacement font is not available 替换字体不可用 +@msg missing `align` 缺少 `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` 必须是 lines、paragraphs、words 或 glyphs,而不是 {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` 必须是 "line" 或 "paragraph",而不是 {other} +@msg `align` must be "left", "center" or "right", not {other} `align` 必须是 "left"、"center" 或 "right",而不是 {other} diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 34597f4aa7..67383344b6 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -5520,3 +5520,47 @@ anchor Points: 點: @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` 請指定 `inkLimit`、`removeWhiteOverprint` 或 `overprintBlack` @msg Print Ink Fixes works on CMYK documents: choose File › Document Color Mode › CMYK Color first 印刷油墨修正適用於 CMYK 文件:請先選擇 檔案 › 文件色彩模式 › CMYK 色彩 @msg `{key}` must be 0..{max} `{key}` 必須為 0..{max} + +# Artwork Cleanup add-on: its text tools (Object › Plug-ins › Artwork Cleanup and the panel's Text row) and their messages. + Break Text 分割文字 + Combine Point Text 合併點文字 + Remove Breaks 移除換行 + Split Text at Cursor 在游標處分割文字 + Set Alignment, Keep Position 設定對齊並保持位置 + Reset Text Transform 重設文字變形 + Replace Missing Fonts… 取代遺失的字體… + Replace Missing Fonts 取代遺失的字體 + Remove Line Breaks 移除強制換行 + Remove Paragraph Breaks 移除段落換行 + Break Text into Lines 將文字分割為行 + Break Text into Paragraphs 將文字分割為段落 + Break Text into Words 將文字分割為單字 + Break Text into Glyphs 將文字分割為字符 + Reset Text Transform and Scale 重設文字變形與縮放 + Set Alignment, Keep Position: 設定對齊並保持位置: + Break Text into: 將文字分割為: + Split at Cursor 在游標處分割 + Reset Transform 重設變形 + Shift-click: break into paragraphs Shift-按一下:分割為段落 + Alt-click: reset the horizontal scale too Alt+點擊:一併重設水平縮放 +breakText Lines 行 +breakText Words 單字 +breakText Glyphs 字符 +@msg Click in type with a Type tool to split it 請用文字工具在文字中按一下以分割 +@msg Too many type objects to change at once 一次要變更的文字物件過多 +@msg Too many pieces to make at once 一次要建立的部分過多 +@msg Select horizontal point or area type whose text fits 請選取文字能完整容納的橫排點文字或區域文字 +@msg Nothing to split at the cursor 游標處沒有可分割的內容 +@msg Select two or more one-line point type objects on one baseline to combine 請選取同一基線上兩個或更多單行點文字物件以合併 +@msg No line breaks to remove 沒有要移除的強制換行 +@msg No paragraph breaks to remove 沒有要移除的段落換行 +@msg Too many breaks to remove at once 一次要移除的換行過多 +@msg Select point type 請選取點文字 +@msg The point type is aligned that way already 點文字已經是這種對齊方式 +@msg The point type has no transform to reset 點文字沒有可重設的變形 +@msg No fonts are missing 沒有遺失的字體 +@msg the replacement font is not available 替代字體無法使用 +@msg missing `align` 未提供 `align` +@msg `by` must be lines, paragraphs, words or glyphs, not {other} `by` 必須是 lines、paragraphs、words 或 glyphs,而不是 {other} +@msg `kind` must be "line" or "paragraph", not {other} `kind` 必須是 "line" 或 "paragraph",而不是 {other} +@msg `align` must be "left", "center" or "right", not {other} `align` 必須是 "left"、"center" 或 "right",而不是 {other} diff --git a/docs/mcp.md b/docs/mcp.md index d0568d5cdb..5902163c28 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -5731,6 +5731,49 @@ topmost piece. {"name":"run_command","arguments":{"command":"addon.cleanup.simplify","params":{"tolerance":40,"protectCorners":true}}} ``` +### Text tools + +The add-on's text tools act on the selected type (or `ids`), each as one undo step, and refuse with an error when there +is nothing for them to do. The pieces they make are point type that keeps its characters' styles, each placed so the +glyph of its first character lands where it was drawn. + +- `addon.cleanup.breakText {by?, ids?}` turns each horizontal point or area type object into point type objects, one + per line (`by: "lines"`, the default), paragraph (`"paragraphs"`), word (`"words"`) or glyph (`"glyphs"`; a ligature + stays one piece). Spaces between the pieces go. A paragraph keeps its lines: where the layout wrapped one, the piece + has a forced line break. Justified lines close up, and a paragraph broken out whole keeps its bullet (not its + number; the other pieces have no list markers). Type on a path, vertical type, threaded type and area type whose text doesn't fit stay as they are and are + listed in `skipped`. +- `addon.cleanup.combineText {ids?}` merges one-line horizontal point type into as few objects as it can, every glyph + staying where it was (within 0.01 pt). Pieces turned and sheared alike whose baselines lie within 0.4 em of each + other join left to right (a baseline a little off becomes baseline shift); a space goes between pieces at least half + a space apart, and tracking on the character before each piece keeps its place. A gap wider than 10 em, an overlap of + more than 1 em, another look (paint, opacity, effects) or a piece that can't keep its place once joined (a ligature + forming across the join) starts another object. Each object made takes the place and paint of its leftmost piece. The + main use is type from a PDF that arrives one glyph per object. +- `addon.cleanup.removeBreaks {kind, ids?}` removes the forced line breaks (`kind: "line"`) or paragraph returns + (`"paragraph"`) in the characters selected with a Type tool, else in all the text of the selected type. A break + between two words becomes a space; merged paragraphs take the first one's paragraph style. +- `addon.cleanup.splitText {}` works while a Type tool edits horizontal point or area type: the text before the + selected characters, those characters and the text after them become point type objects (at a bare cursor, the text + before and after it). Spaces at the ends of each piece go; a piece that starts inside a left-aligned line takes a + first-line indent, so its later lines stay where they were. Editing ends with the pieces selected. +- `addon.cleanup.alignInPlace {align, ids?}` aligns every paragraph of each horizontal point type object `left`, + `center` or `right` and moves the object so its longest line stays where it is: a single line doesn't move at all. +- `addon.cleanup.resetTextTransform {scale?, ids?}` takes the rotation, shear and reflection off point type, keeping its + size and the centre of its text. With `scale: true` the horizontal scale goes too, the object's and each character's. +- `addon.cleanup.replaceFonts {font?}` sets every character of the document's type whose font family isn't available + in `font` (by default the default type font, Source Sans 3), in that family's style closest to the one it had. + +In the panel, the Text row (which the panel can hide) runs them: Shift-click Lines to break into paragraphs, and +Alt-click Reset Transform to reset the horizontal scale too. Recovering live text from outlines, combining vertical +type and evening out horizontal scales are not there yet. + +```json +{"name":"run_command","arguments":{"command":"addon.cleanup.breakText","params":{"by":"words"}}} +{"name":"run_command","arguments":{"command":"addon.cleanup.combineText","params":{}}} +{"name":"run_command","arguments":{"command":"addon.cleanup.removeBreaks","params":{"kind":"paragraph"}}} +``` + ## Path Precision Tools add-on Path Precision Tools is a built-in add-on for exact anchor and path work: its commands are `addon.pathtools.*`, and in diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index e480a75256..d5071c4eb6 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1,6 +1,6 @@ # Parity with Adobe Illustrator -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: Duotone and Print Ink Fixes; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** minor (Artwork Cleanup add-on: text tools; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x; public release notes through 30.7, August 2026) ## Feature submission evidence @@ -1222,6 +1222,14 @@ Show, Fix Selected and Fix All (each one undo step), Deep Ungroup and Rejoin Pat alone; Fix All as one step; scopes; rejoin within the gap only) and `addons::cleanup::tests` in `vectorcraft-ui-egui` (the submenu opens the panel; Check lists what it finds). Commands: `docs/mcp.md` › Artwork Cleanup add-on. +The add-on's text tools (2026-10-31) work on the shared text layout: Break Text into lines, paragraphs, words or glyphs +and Split Text at Cursor make point type pieces placed by the glyph of their first character, Combine Point Text merges +one-line point type back with every glyph where it was (tracking and spaces, checked against the layout), and Remove +Line / Paragraph Breaks, Set Alignment, Keep Position, Reset Text Transform and Replace Missing Fonts. Tests: +`cmd::addons::cleanup::text::tests` in `vectorcraft-engine` (glyphs kept in place, styles kept, one undo step, +refusals), `addons::cleanup::tests` in `vectorcraft-ui-egui` (the submenu and the panel's Text row run them) and +`cleanup_text_tools_with_junk_editing_ranges` in the command sweep. + ## Path Precision Tools add-on (2026-10-30) A VectorCraft addition, not an Illustrator feature, so no area score moves. Object › Plug-ins › Path Precision Tools, @@ -1296,6 +1304,7 @@ add-on. | Date | Change | Summary | |---|---|---| +| 2026-10-31 | minor | Artwork Cleanup add-on (a VectorCraft addition): text tools; evidence added; scores unchanged. | | 2026-10-30 | minor | Color Effects add-on: live Duotone (one to four inks, spot tones kept) and Print Ink Fixes; scores and estimates unchanged | | 2026-10-30 | minor | 3D Extrude & Bevel, Inflate and Rotate apply to type, which stays editable (#4715); scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: live Vector Halftone; scores and estimates unchanged | diff --git a/docs/ui-parity.md b/docs/ui-parity.md index e8de7ef081..f56514e573 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -1,6 +1,6 @@ # UI and interaction parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Color Effects add-on: Duotone and Print Ink Fixes; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-31 · **Change:** minor (Artwork Cleanup add-on: text tools; scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) ## Feature submission evidence @@ -330,6 +330,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po | Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool, which the All Tools drawer lists under its own heading but neither toolbar shows as shipped (no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point); an Alt-drag away from paths selects the points inside a marquee | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not an Illustrator feature, so it is not scored | | Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not an Illustrator feature, so it is not scored | | Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not an Illustrator feature, so it is not scored | +| 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 an Illustrator feature, so it is not scored | ## Look and feel @@ -371,6 +372,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| +| 2026-10-31 | minor | Artwork Cleanup add-on (a VectorCraft addition): its text tools in the panel and Object › Plug-ins › Artwork Cleanup; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: live Duotone (one to four inks, spot tones kept) and Print Ink Fixes; scores and estimates unchanged | | 2026-10-30 | minor | Color Effects add-on: live Vector Halftone; scores and estimates unchanged | | 2026-10-30 | minor | Path Precision Tools add-on: the Parametric Shape Tool (ten re-editable shape kinds), its panel and Convert to Parametric Shape; scores and estimates unchanged | From 414aad10bd9bfa244a3c72eef63e8172ee1cc2e1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Oct 2026 10:41:20 +0000 Subject: [PATCH 074/227] chore(deps): bump the cargo-patch group across 2 directories with 4 updates Bumps the cargo-patch group with 3 updates in the / directory: [rustix](https://github.com/bytecodealliance/rustix), [clipboard-win](https://github.com/DoumanAsh/clipboard-win) and [smallvec](https://github.com/servo/rust-smallvec). Bumps the cargo-patch group with 1 update in the /crates/plugins/example directory: [serde_json](https://github.com/serde-rs/json). Updates `rustix` from 1.1.5 to 1.1.6 - [Release notes](https://github.com/bytecodealliance/rustix/releases) - [Changelog](https://github.com/bytecodealliance/rustix/blob/main/CHANGES.md) - [Commits](https://github.com/bytecodealliance/rustix/compare/v1.1.5...v1.1.6) Updates `clipboard-win` from 5.4.1 to 5.4.3 - [Commits](https://github.com/DoumanAsh/clipboard-win/commits) Updates `smallvec` from 1.16.3 to 1.16.4 - [Release notes](https://github.com/servo/rust-smallvec/releases) - [Commits](https://github.com/servo/rust-smallvec/compare/v1.16.3...v1.16.4) Updates `serde_json` from 1.0.151 to 1.0.154 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.151...v1.0.154) Updates `serde_json` from 1.0.151 to 1.0.154 - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.151...v1.0.154) --- updated-dependencies: - dependency-name: clipboard-win dependency-version: 5.4.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-patch - dependency-name: rustix dependency-version: 1.1.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-patch - dependency-name: serde_json dependency-version: 1.0.154 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-patch - dependency-name: serde_json dependency-version: 1.0.154 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-patch - dependency-name: smallvec dependency-version: 1.16.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: cargo-patch ... Signed-off-by: dependabot[bot] --- Cargo.lock | 68 +++++++++++++++---------------- crates/plugins/example/Cargo.lock | 4 +- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6bf8261a86..f0f4dfd948 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -217,7 +217,7 @@ dependencies = [ "objc2-foundation 0.3.2", "parking_lot", "percent-encoding", - "windows-sys 0.59.0", + "windows-sys 0.61.2", "wl-clipboard-rs", "x11rb", ] @@ -303,7 +303,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 1.1.5", + "rustix 1.1.6", "slab", "windows-sys 0.61.2", ] @@ -334,7 +334,7 @@ dependencies = [ "cfg-if", "event-listener", "futures-lite", - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] @@ -360,7 +360,7 @@ dependencies = [ "cfg-if", "futures-core", "futures-io", - "rustix 1.1.5", + "rustix 1.1.6", "signal-hook-registry", "slab", "windows-sys 0.61.2", @@ -665,7 +665,7 @@ checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e" dependencies = [ "bitflags 2.13.2", "polling", - "rustix 1.1.5", + "rustix 1.1.6", "tracing", ] @@ -688,7 +688,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa" dependencies = [ "calloop 0.14.5", - "rustix 1.1.5", + "rustix 1.1.6", "wayland-backend", "wayland-client", ] @@ -763,9 +763,9 @@ dependencies = [ [[package]] name = "clipboard-win" -version = "5.4.1" +version = "5.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4" +checksum = "052af7878466feccda12ba7a6a67d019d712f296809559b47c12c8cc196d3a9a" dependencies = [ "error-code", ] @@ -1563,7 +1563,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -1888,7 +1888,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8" dependencies = [ - "rustix 1.1.5", + "rustix 1.1.6", "windows-link", ] @@ -3618,7 +3618,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -3900,7 +3900,7 @@ dependencies = [ "concurrent-queue", "hermit-abi", "pin-project-lite", - "rustix 1.1.5", + "rustix 1.1.6", "windows-sys 0.61.2", ] @@ -4140,7 +4140,7 @@ dependencies = [ "once_cell", "socket2", "tracing", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4489,15 +4489,15 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" dependencies = [ "bitflags 2.13.2", "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -4556,7 +4556,7 @@ dependencies = [ "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -5097,9 +5097,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.16.3" +version = "1.16.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" dependencies = [ "serde", ] @@ -5142,7 +5142,7 @@ dependencies = [ "libc", "log", "memmap2", - "rustix 1.1.5", + "rustix 1.1.6", "thiserror 2.0.21", "wayland-backend", "wayland-client", @@ -5415,10 +5415,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.3", "once_cell", - "rustix 1.1.5", - "windows-sys 0.59.0", + "rustix 1.1.6", + "windows-sys 0.61.2", ] [[package]] @@ -6199,7 +6199,7 @@ dependencies = [ "log", "proptest", "roxmltree 0.21.2", - "rustix 1.1.5", + "rustix 1.1.6", "ruzstd", "serde", "serde_json", @@ -6256,7 +6256,7 @@ version = "0.18.0" dependencies = [ "flate2", "proptest", - "rustix 1.1.5", + "rustix 1.1.6", "serde", "serde_json", "thiserror 2.0.21", @@ -6517,7 +6517,7 @@ dependencies = [ "egui_kittest", "image", "log", - "rustix 1.1.5", + "rustix 1.1.6", "serde", "serde_json", "toml", @@ -6810,7 +6810,7 @@ checksum = "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078" dependencies = [ "cc", "downcast-rs", - "rustix 1.1.5", + "rustix 1.1.6", "scoped-tls", "smallvec", "wayland-sys", @@ -6823,7 +6823,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073" dependencies = [ "bitflags 2.13.2", - "rustix 1.1.5", + "rustix 1.1.6", "wayland-backend", "wayland-scanner", ] @@ -6845,7 +6845,7 @@ version = "0.31.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d" dependencies = [ - "rustix 1.1.5", + "rustix 1.1.6", "wayland-client", "xcursor", ] @@ -7183,7 +7183,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.61.2", ] [[package]] @@ -7520,7 +7520,7 @@ dependencies = [ "libc", "log", "os_pipe", - "rustix 1.1.5", + "rustix 1.1.6", "thiserror 2.0.21", "tree_magic_mini", "wayland-backend", @@ -7579,7 +7579,7 @@ dependencies = [ "libc", "libloading", "once_cell", - "rustix 1.1.5", + "rustix 1.1.6", "x11rb-protocol", ] @@ -7621,7 +7621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156" dependencies = [ "libc", - "rustix 1.1.5", + "rustix 1.1.6", ] [[package]] @@ -7725,7 +7725,7 @@ dependencies = [ "hex", "libc", "ordered-stream", - "rustix 1.1.5", + "rustix 1.1.6", "serde", "serde_repr", "tracing", diff --git a/crates/plugins/example/Cargo.lock b/crates/plugins/example/Cargo.lock index b429957002..a4cd2a3ea0 100644 --- a/crates/plugins/example/Cargo.lock +++ b/crates/plugins/example/Cargo.lock @@ -63,9 +63,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.151" +version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" dependencies = [ "itoa", "memchr", From c1971284ceed92c351c5ebbc8a3f263e0cb7ea35 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:34:57 +0300 Subject: [PATCH 075/227] Type: required lam-alef is not an alternate in fonts that put it in liga (#394) Highlight Alternate Glyphs compares each glyph with required shaping alone, which turns liga and calt off. Older Arabic fonts (such as the legacy Arial of the Microsoft core fonts) put the mandatory lam-alef ligature in liga instead of rlig, so every lam-alef was highlighted. A lam + alef cluster (any alef form, marks allowed) is now never an alternate candidate, whatever feature the font uses. Adds a test font built in code (lam-alef under liga or rlig) and host-independent regressions. Also two equivalent one-line repairs strict Clippy needs on main: a nonminimal_bool in the Path Precision Tools inspect check and is_none() in a gradient panel test. --- crates/engine/src/cmd/addons/pathtools.rs | 2 +- crates/render/src/tests/alternate.rs | 36 ++++++++++++++- crates/render/src/text_geom.rs | 16 ++++++- crates/text/src/test_fonts.rs | 50 +++++++++++++++++++++ crates/ui-egui/src/panels/gradient/tests.rs | 2 +- docs/type-parity.md | 5 ++- 6 files changed, 104 insertions(+), 7 deletions(-) diff --git a/crates/engine/src/cmd/addons/pathtools.rs b/crates/engine/src/cmd/addons/pathtools.rs index 4e78680ae7..47dbe73359 100644 --- a/crates/engine/src/cmd/addons/pathtools.rs +++ b/crates/engine/src/cmd/addons/pathtools.rs @@ -355,7 +355,7 @@ fn inspect(s: &mut Session, p: &Value) -> Result { let id = checked_id(s, p.get("id").unwrap_or(&Value::Null), C)?; let (x, y) = (number_or(p, "x", f64::NAN, C)?, number_or(p, "y", f64::NAN, C)?); let tolerance = number_or(p, "tolerance", 3.0, C)?; - if !(x.is_finite() && y.is_finite()) || !(tolerance >= 0.0 && tolerance.is_finite()) { + if !(x.is_finite() && y.is_finite() && tolerance >= 0.0 && tolerance.is_finite()) { return Err(bad(C, "give `x` and `y` (and a `tolerance` of 0 or more)")); } let path = s.doc()?.doc.node(id).and_then(|n| n.path_data()).ok_or_else(|| bad(C, "`id` is not a path"))?; diff --git a/crates/render/src/tests/alternate.rs b/crates/render/src/tests/alternate.rs index ad39ed065a..8ef6903301 100644 --- a/crates/render/src/tests/alternate.rs +++ b/crates/render/src/tests/alternate.rs @@ -118,7 +118,9 @@ fn arabic_joining_forms_are_not_alternates() { assert_eq!(alternates(&t), 0); } -/// #394: the lam-alef ligature is required (`rlig`), so it isn't highlighted either. +/// #394: the lam-alef ligature is required (`rlig`), so it isn't highlighted either. With an +/// older font that files it under `liga` (as the legacy Arial of Microsoft's core fonts does) it +/// is still required: [`lam_alef_in_liga_is_not_an_alternate`] checks that without an OS font. #[test] fn lam_alef_is_not_an_alternate() { // Looking up an installed font loads it, which changes the fonts. @@ -129,6 +131,38 @@ fn lam_alef_is_not_an_alternate() { } } +/// #394: a font whose lam-alef ligature is in `liga` (older Arabic fonts) or `rlig` gets no +/// highlight on it: the ligature is required by the characters, not chosen by an optional +/// feature. Built in code, so it runs whatever fonts the machine has. +#[test] +fn lam_alef_in_liga_is_not_an_alternate() { + use vectorcraft_text::test_fonts::{lam_alef_family, lam_alef_font}; + let _adding = crate::tests_fontchange::adding_fonts(); + let db = vectorcraft_text::FontDb::global(); + for feature in [b"liga", b"rlig"] { + db.add_font(lam_alef_font(feature).unwrap()); + let style = vectorcraft_doc::text::CharStyle { size: 36.0, font_family: lam_alef_family(feature).into(), ..Default::default() }; + for s in ["\u{0644}\u{0627}", "\u{0644}\u{0623}", "\u{0628}\u{0644}\u{0627}", "\u{0644}\u{064E}\u{0627}"] { + let t = text(s, style.clone()); + // The font's ligature glyph stands for the pair. + assert!(glyphs(&t).iter().any(|g| g.1 > 2), "{}: {s} is shaped to one ligature glyph", lam_alef_family(feature)); + assert_eq!(alternates(&t), 0, "{}: {s}", lam_alef_family(feature)); + } + } +} + +/// Only a lam followed by an alef (marks between or after allowed) is the required lam-alef. +#[test] +fn only_lam_alef_clusters_are_the_required_ligature() { + for s in ["\u{0644}\u{0627}", "\u{0644}\u{0622}", "\u{0644}\u{0623}", "\u{0644}\u{0625}", "\u{0644}\u{064E}\u{0627}", "\u{0644}\u{0627}\u{064B}"] + { + assert!(crate::text_geom::is_lam_alef(s), "{s:?}"); + } + for s in ["", "\u{0644}", "\u{0627}\u{0644}", "\u{0644}\u{0628}", "\u{0628}\u{0644}\u{0627}", "\u{0644}\u{0627}\u{0627}", "fi", "\u{064E}"] { + assert!(!crate::text_geom::is_lam_alef(s), "{s:?}"); + } +} + /// #394: an optional feature the characters turn on (a stylistic set, swash, stylistic or /// discretionary alternate…) is highlighted on the glyphs it changes, and only on those. #[test] diff --git a/crates/render/src/text_geom.rs b/crates/render/src/text_geom.rs index 1408b397b0..bf058d75fc 100644 --- a/crates/render/src/text_geom.rs +++ b/crates/render/src/text_geom.rs @@ -48,7 +48,8 @@ impl TextGeom { /// The boxes of the glyphs of `t` (the text this geometry is of) that optional OpenType features /// chose (Preferences › Highlight Alternate Glyphs): candidates the text's required shaping /// alone doesn't give ([`required_shaping`]). Arabic letters joining, Indic conjuncts and the - /// lam-alef ligature are what the script needs, not alternates. Measured once. + /// lam-alef ligature are what the script needs, not alternates (the lam-alef ligature also when + /// a font files it under `liga`: [`is_lam_alef`]). Measured once. pub(crate) fn alternate_glyphs(&self, t: &TextObject) -> &BezPath { self.alternate_glyphs.get_or_init(|| { let mut out = BezPath::new(); @@ -84,6 +85,17 @@ pub(crate) fn is_opentype_alternate(nominal_gid: u32, shaped_gid: u32, cluster_c shaped_gid != 0 && (cluster_chars > 1 || shaped_gid != nominal_gid) } +/// Whether `cluster` is a lam followed by an alef (plain, with madda, or with hamza above or below), +/// with any Arabic marks between or after them: the lam-alef ligature, which the Unicode +/// Standard's Arabic chapter treats as obligatory, not a stylistic choice. Fonts made before +/// `rlig` was common put it in `liga`, which [`required_shaping`] turns off, so it is required +/// by its characters whatever feature the font files it under. +pub(crate) fn is_lam_alef(cluster: &str) -> bool { + let is_mark = |c: &char| matches!(c, '\u{0610}'..='\u{061A}' | '\u{064B}'..='\u{065F}' | '\u{0670}' | '\u{06D6}'..='\u{06DC}' | '\u{06DF}'..='\u{06E4}' | '\u{06E7}' | '\u{06E8}' | '\u{06EA}'..='\u{06ED}'); + let mut letters = cluster.chars().filter(|c| !is_mark(c)); + matches!((letters.next(), letters.next(), letters.next()), (Some('\u{0644}'), Some('\u{0622}' | '\u{0623}' | '\u{0625}' | '\u{0627}'), None)) +} + /// A glyph [`is_opentype_alternate`] marks, in its cluster of the text (`byte`, `len`), with its /// box. #[derive(Debug)] @@ -181,7 +193,7 @@ pub(crate) fn text_geom_snapped(t: &TextObject, snap: Option) -> TextGeo let cluster_chars = cluster.chars().count(); let Some(first) = cluster.chars().next() else { continue }; let nominal = db.face_by_id(g.font_id).map(|f| f.glyph_for(first)).unwrap_or(0); - if is_opentype_alternate(nominal, g.gid, cluster_chars) { + if is_opentype_alternate(nominal, g.gid, cluster_chars) && !is_lam_alef(cluster) { alternate_candidates.push(AlternateCandidate { byte: g.byte, len: g.len, font_id: g.font_id, gid: g.gid, cell }); } } diff --git a/crates/text/src/test_fonts.rs b/crates/text/src/test_fonts.rs index 76f6603ffc..449221f9f1 100644 --- a/crates/text/src/test_fonts.rs +++ b/crates/text/src/test_fonts.rs @@ -343,6 +343,56 @@ pub fn half_form_font(half: bool) -> Option> { Some(builder.build()) } +/// The family of [`lam_alef_font`] whose lam-alef ligature is in `feature`. +pub fn lam_alef_family(feature: &[u8; 4]) -> &'static str { + match feature { + b"liga" => "Lamtest Liga", + b"rlig" => "Lamtest Rlig", + _ => "Lamtest Other", + } +} + +/// A test-only Arabic cmap over bundled Source Sans 3: lam uses l, alef I, alef with hamza above +/// J and beh b. The `GSUB` table's `arab` script has one ligature lookup, under `feature`, that +/// joins lam + alef into H and lam + alef with hamza above into K. Older fonts put the mandatory +/// lam-alef ligature in `liga` rather than `rlig`; this builds either, without an OS font. `None` +/// when it can't be built. +pub fn lam_alef_font(feature: &[u8; 4]) -> Option> { + use write_fonts::tables::cmap::Cmap; + use write_fonts::tables::gsub::{Gsub, Ligature, LigatureSet, LigatureSubstFormat1, SubstitutionLookup, SubstitutionLookupList}; + use write_fonts::tables::layout::{CoverageFormat1, Feature, FeatureList, FeatureRecord, LangSys, Lookup, Script, ScriptList, ScriptRecord}; + use write_fonts::types::GlyphId16; + + const BASE: &[u8] = include_bytes!("../../../assets/fonts/SourceSans3-Regular.ttf"); + let font = skrifa::FontRef::new(BASE).ok()?; + let charmap = font.charmap(); + let mapping = [('\u{0644}', 'l'), ('\u{0627}', 'I'), ('\u{0623}', 'J'), ('\u{0628}', 'b')]; + let mappings = mapping.into_iter().map(|(c, source)| Some((c, write_fonts::types::GlyphId::new(charmap.map(source)?.to_u32())))); + let cmap = Cmap::from_mappings(mappings.collect::>>()?).ok()?; + let family = lam_alef_family(feature); + let full = format!("{family} Regular"); + let postscript = format!("{}-Regular", family.replace(' ', "")); + let name = name_table(&[(1, family), (2, "Regular"), (4, &full), (6, &postscript)])?; + let mut builder = FontBuilder::new(); + builder.add_table(&cmap).ok()?; + builder.add_raw(Tag::new(b"name"), name); + let gid = |c| Some(GlyphId16::new(u16::try_from(charmap.map(c)?.to_u32()).ok()?)); + let coverage = CoverageFormat1::new(vec![gid('l')?]); + let ligatures = vec![Ligature::new(gid('H')?, vec![gid('I')?]), Ligature::new(gid('K')?, vec![gid('J')?])]; + let subst = LigatureSubstFormat1::new(coverage.into(), vec![LigatureSet::new(ligatures)]); + let features = FeatureList::new(vec![FeatureRecord::new(Tag::new(feature), Feature::new(None, vec![0]))]); + let lookups = SubstitutionLookupList::new(vec![SubstitutionLookup::Ligature(Lookup::new(Default::default(), vec![subst]))]); + let scripts = ScriptList::new(vec![ScriptRecord::new(Tag::new(b"arab"), Script::new(Some(LangSys::new(vec![0])), vec![]))]); + builder.add_table(&Gsub::new(scripts, features, lookups)).ok()?; + for r in font.table_directory.table_records() { + let tag = Tag::new(&r.tag().to_be_bytes()); + if !builder.contains(tag) { + builder.add_raw(tag, font.table_data(r.tag())?.as_bytes()); + } + } + Some(builder.build()) +} + /// The family of [`pair_kerning_font`]. pub const PAIR_KERNING_FAMILY: &str = "Pairtest Sans"; diff --git a/crates/ui-egui/src/panels/gradient/tests.rs b/crates/ui-egui/src/panels/gradient/tests.rs index 7d9dcbf9ea..a3b7f5cfa7 100644 --- a/crates/ui-egui/src/panels/gradient/tests.rs +++ b/crates/ui-egui/src/panels/gradient/tests.rs @@ -660,7 +660,7 @@ fn the_panel_menu_saves_deletes_and_hides_presets() { let mut p = Panel::new(); let texts = p.frame_of(&mut app, vec![], Modifiers::NONE, menu); let save = text_at(&texts, "Save Gradient Preset…").unwrap_or_else(|| panic!("{texts:?}")); - assert!(!app.session.active_saved_gradient_preset().is_some()); + assert!(app.session.active_saved_gradient_preset().is_none()); p.menu_click(&mut app, save); let d = app.ui.dialog.take().expect("the name dialog"); assert_eq!((d.fields["__command"].as_str(), d.fields["name"].as_str()), (Some("gradient.presets.save"), Some("Gradient Preset 1"))); diff --git a/docs/type-parity.md b/docs/type-parity.md index c4130f0e5c..c0220b1933 100644 --- a/docs/type-parity.md +++ b/docs/type-parity.md @@ -1,6 +1,6 @@ # Type parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Character panel menu › Show Snap to Glyph Options shows the Snap to Glyph section (Baseline, x-height, Glyph Bounds, Proximity Guides, Angular Guides, Anchor Point; `view.snapToGlyph.options`) (#4232); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (Highlight Alternate Glyphs leaves the required lam-alef ligature unhighlighted also in older Arabic fonts (such as legacy Arial) that put it in `liga` rather than `rlig` (#394); scores unchanged) · **Target:** Adobe Illustrator 2026 (30.x) Type is Illustrator's largest single area by use (weight 13 of 105 across "Type core" and "Type advanced" in [target-app-parity.md](target-app-parity.md)). This checklist lists the features one by one. Status is from the @@ -28,7 +28,7 @@ against Illustrator's public documentation; **estimated** unless noted. | Character and Paragraph panels, styles with overrides | done | Character-style Auto-leading resets, partial definitions, local leading overrides, override markers, Undo/Redo and native serialization have regression coverage; differing paragraph alignments leave the shared alignment buttons unselected (headless regressions, full integration CI and visual review pass); mixed-value display for other paragraph fields remains missing | | Character size and horizontal scale after object/group scaling | done | #1034: fields and setters compensate the stored affine; point size follows the transformed em-height axis, not the glyph ink bounds. Range edits, keyboard increments, leading and baseline shift use document points; rotation, reflection and shear remain editable. | | Preserve font sizes while scaling a group | missing | Separate enhancement; scaling still scales text with the other artwork. | -| OpenType panel, Glyphs panel, alternates | done | Highlight Alternate Glyphs preference (#394, off by default) paints pink behind OpenType substitutions on screen when on; stylistic sets ss01–ss20, stylistic and titling alternates, proportional and lining figures, superscript and subscript are character-style features (`text.setStyle {features}`, #1607) | +| OpenType panel, Glyphs panel, alternates | done | Highlight Alternate Glyphs preference (#394, off by default) paints pink behind OpenType substitutions on screen when on (required shaping such as Arabic joining forms and the lam-alef ligature, including a lam-alef older fonts file under `liga`, is not highlighted); stylistic sets ss01–ss20, stylistic and titling alternates, proportional and lining figures, superscript and subscript are character-style features (`text.setStyle {features}`, #1607) | | Font menu: samples, live preview, filters, favourites, recent families; font matching by any name; Find Font | done | #3515: recently applied families appear first, once each; missing families are omitted and the existing Number of Recent Fonts setting applies; #339; script filter: Japanese, Latin, Thai; the font scan on Linux also reads the folders fontconfig's configuration lists, such as TeX fonts under `/usr/share/texmf/fonts` (#1548, fixes #1529; not verified on Linux) | | Missing glyphs set in an installed font made for their script (Thai, Lao, Khmer, Myanmar first; then any font that has them) | done | Thai: Leelawadee UI, Tahoma, Thonburi, Sukhumvit Set, Noto Sans Thai, TLWG | | Full font-name matching (OpenType name ID 4) | done | #1258: loaded/cataloged faces and Missing Fonts searches; localized names and variable default faces; Windows font-service QA pending | @@ -71,6 +71,7 @@ Character Styles menu New/Redefine and footer New capture the first selected cha | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | Highlight Alternate Glyphs leaves the required lam-alef ligature unhighlighted also in older Arabic fonts (such as legacy Arial) that put it in `liga` rather than `rlig` (#394); scores unchanged | | 2026-10-30 | minor | Character panel menu › Show Snap to Glyph Options shows the Snap to Glyph section (Baseline, x-height, Glyph Bounds, Proximity Guides, Angular Guides, Anchor Point; `view.snapToGlyph.options`) (#4232); scores unchanged | | 2026-10-29 | minor | Font fallback keeps a letter and its combining marks in one face; Vietnamese stacked diacritics (Ể, Ứ, Ự) attach in precomposed, decomposed and keyboard forms (#4491); scores and hours unchanged | | 2026-10-25 | minor | Threading ports: a double-click on a threaded port with the Selection tool breaks the thread there (`text.thread.break`); the story flows into the frames before the break; scores unchanged | From ef3b5b0c95ee4c1bc5d3cccb434064ed4faa0c81 Mon Sep 17 00:00:00 2001 From: Don Omondi <282319807+mockydevs@users.noreply.github.com> Date: Fri, 30 Oct 2026 22:43:08 +0300 Subject: [PATCH 076/227] fix(eps): a layer's state after its last mesh stays the layer's An Xy right after a gradient mesh's /End X! is the mesh's only when the mesh's own 6 () XW follows. When the layer's LB follows (directly or after the layer's Xd and 7 () XW) it is the layer's, as before, and the mesh keeps the state it had. Also corrects the revision-history row that still said meshes with handle weights of 0 aren't read. --- crates/eps/src/import/ai/read.rs | 4 ++++ crates/eps/src/import/ai/read/containers.rs | 11 +++++++-- crates/eps/src/import/ai/read/ops.rs | 26 +++++++++++++++------ crates/eps/src/import/ai/tests.rs | 23 ++++++++++++++++++ docs/file-format-parity.md | 5 ++-- 5 files changed, 58 insertions(+), 11 deletions(-) diff --git a/crates/eps/src/import/ai/read.rs b/crates/eps/src/import/ai/read.rs index abcbf02190..b3050abeaf 100644 --- a/crates/eps/src/import/ai/read.rs +++ b/crates/eps/src/import/ai/read.rs @@ -187,6 +187,9 @@ struct Reader<'a> { mesh_ended: bool, /// A layer's own state (`Xy` after its art, before `LB`), until something says the art moves on. layer_state: Option<(f32, BlendMode, bool, Knockout)>, + /// The state a mesh had before an `Xy` right after its end, which is the layer's instead when + /// the layer's `LB` follows rather than the mesh's own `6 () XW`. + mesh_undo: Option<(f32, BlendMode, bool, Knockout)>, /// Painted copies of clipping paths that have a fill (drawn under what they clip). clip_fills: HashSet, /// Groups closed as an object's drawn look (`9 () XW`). @@ -292,6 +295,7 @@ impl<'a> Reader<'a> { group_ended: false, mesh_ended: false, layer_state: None, + mesh_undo: None, styles: HashMap::new(), palette: super::palette::Palette::default(), restyled: vec![], diff --git a/crates/eps/src/import/ai/read/containers.rs b/crates/eps/src/import/ai/read/containers.rs index 09ccd14aa6..19239fa870 100644 --- a/crates/eps/src/import/ai/read/containers.rs +++ b/crates/eps/src/import/ai/read/containers.rs @@ -171,7 +171,14 @@ impl<'a> Reader<'a> { } pub(super) fn end_layer(&mut self) -> Result<(), String> { - let f = self.close("LB", |k| matches!(k, Kind::Layer(_)))?; + let mut f = self.close("LB", |k| matches!(k, Kind::Layer(_)))?; + let state = self.layer_state.take(); + // An `Xy` right after the layer's last mesh, then `LB`: the layer's, not the mesh's. + if let (Some(_), Some(before)) = (state, self.mesh_undo.take()) + && let Some(mesh) = f.children.last_mut().filter(|n| matches!(n.kind, NodeKind::Mesh(_))) + { + (mesh.opacity, mesh.blend, mesh.isolate, mesh.knockout) = before; + } let Kind::Layer(a) = f.kind else { return Ok(()) }; let (children, clip) = self.clip_first(f.children, &f.clips); let color = a.color.unwrap_or(LayerColor::Preset(0)); @@ -183,7 +190,7 @@ impl<'a> Reader<'a> { layer.visible = a.visible; layer.locked = a.locked; // The layer's own opacity, blend and knockout, written after its art (#2003). - if let Some((opacity, blend, isolate, knockout)) = self.layer_state.take() { + if let Some((opacity, blend, isolate, knockout)) = state { (layer.opacity, layer.blend, layer.isolate, layer.knockout) = (opacity, blend, isolate, knockout); } match self.frames.last_mut() { diff --git a/crates/eps/src/import/ai/read/ops.rs b/crates/eps/src/import/ai/read/ops.rs index d9dbab22a2..42d6960a60 100644 --- a/crates/eps/src/import/ai/read/ops.rs +++ b/crates/eps/src/import/ai/read/ops.rs @@ -77,6 +77,7 @@ impl<'a> Reader<'a> { if !matches!(w, "Xy" | "Xd" | "XW" | "BB" | "LB") { self.after_object = false; self.layer_state = None; + self.mesh_undo = None; } let group_ended = std::mem::take(&mut self.group_ended); let mesh_ended = std::mem::take(&mut self.mesh_ended); @@ -213,7 +214,13 @@ impl<'a> Reader<'a> { } "Xw" => self.gs.hidden = Self::nums(&vals).last() == Some(&1.0), "A" => self.gs.locked = Self::nums(&vals).last() == Some(&1.0), - "XW" => self.style_marker(&vals, hidden), + "XW" => { + // An object's own state block ends `6 () XW`: an `Xy` after a mesh's end was the mesh's. + if Self::nums(&vals).last() == Some(&6.0) && self.mesh_undo.take().is_some() { + self.layer_state = None; + } + self.style_marker(&vals, hidden) + } // Gradients. "Bd" => self.gradient_def = GradientDef::begin(&vals), "Bs" | "BD" => {} @@ -390,7 +397,8 @@ impl<'a> Reader<'a> { } /// `mode opacity isolate knockout shape Xy`; after a group's end, the group's too, and right - /// after a gradient mesh's `/End X!` (before its `Xd` and `XW`), the mesh's. + /// after a gradient mesh's `/End X!` (before its `Xd` and `6 () XW`), the mesh's, unless the + /// layer's `LB` follows: then it is the layer's (see `end_layer`). fn transparency(&mut self, vals: &[V], mesh_ended: bool) { let n = Self::nums(vals); let [mode, opacity, rest @ ..] = n.as_slice() else { return }; @@ -405,9 +413,14 @@ impl<'a> Reader<'a> { }; gs.knockout_shape = rest.get(2).is_some_and(|v| *v != 0.0); let gs = self.gs.clone(); - if self.last_object().is_some_and(|n| { - matches!(n.kind, NodeKind::Group { .. } | NodeKind::Compound { .. }) || (mesh_ended && matches!(n.kind, NodeKind::Mesh(_))) - }) { + let in_layer = matches!(self.frames.last(), Some(Frame { kind: Kind::Layer(_), .. })); + if let Some(n) = self.last_object().filter(|n| mesh_ended && matches!(n.kind, NodeKind::Mesh(_))) { + // The mesh's, or the layer's when it is the layer's last object: kept for either. + let before = (n.opacity, n.blend, n.isolate, n.knockout); + (n.opacity, n.blend, n.isolate, n.knockout) = (gs.opacity, gs.blend, gs.isolate, gs.knockout); + self.mesh_undo = Some(before); + self.layer_state = in_layer.then_some((gs.opacity, gs.blend, gs.isolate, gs.knockout)); + } else if self.last_object().is_some_and(|n| matches!(n.kind, NodeKind::Group { .. } | NodeKind::Compound { .. })) { if let Some(n) = self.last_object() { n.opacity = gs.opacity; n.blend = gs.blend; @@ -419,8 +432,7 @@ impl<'a> Reader<'a> { // After a layer's art and before its `LB`: the layer's own state (#2003). Kept until // an operator that isn't part of the state block (or the `LB` that takes it) says the // art moves on, so a path's state before its paint isn't read as its layer's. - self.layer_state = - matches!(self.frames.last(), Some(Frame { kind: Kind::Layer(_), .. })).then_some((gs.opacity, gs.blend, gs.isolate, gs.knockout)); + self.layer_state = in_layer.then_some((gs.opacity, gs.blend, gs.isolate, gs.knockout)); } } diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index 813113d5b1..12eb54ee35 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -391,6 +391,29 @@ fn a_layer_keeps_its_own_transparency() { let doc = read_ok(&layer(&art_)).doc; assert_eq!(doc.layers[0].opacity, 1.0, "no layer state written: the layer stays opaque"); assert_eq!(art(&doc)[0].opacity, 0.5, "the group's own state"); + // A layer whose last object is a gradient mesh: an `Xy` right after the mesh's end is the + // layer's when `LB` follows (directly or after the layer's `Xd` and `7 () XW`), and the mesh's + // when its own `6 () XW` follows. + let corner = + |x: i32, y: i32, next: (i32, i32), prev: (i32, i32)| format!("%_[1 1 1 1 {x} {y} {} {} 1 {} {} 1] /N X#\n", next.0, next.1, prev.0, prev.1); + let mesh = format!( + "0 0.8 0 0 0 Xy\n/Mesh X!\n%_(DeviceRGB) /CS X#\n%_[0 0] /P X#\n{}{}{}{}%_0 /E X#\n/End X!\n", + corner(0, 0, (0, 10), (10, 0)), + corner(0, 40, (10, 40), (0, 30)), + corner(40, 40, (40, 30), (30, 40)), + corner(40, 0, (30, 0), (40, 10)), + ); + for (after, layer_state, mesh_state) in [ + ("1 0.35 0 0 0 Xy\n", (0.35, BlendMode::Multiply), (0.8, BlendMode::Normal)), + ("1 0.35 0 0 0 Xy\n0 0 Xd\n7 () XW\n", (0.35, BlendMode::Multiply), (0.8, BlendMode::Normal)), + ("1 0.35 0 0 0 Xy\n0 0 Xd\n6 () XW\n", (1.0, BlendMode::Normal), (0.35, BlendMode::Multiply)), + ] { + let doc = read_ok(&layer(&format!("{mesh}{after}"))).doc; + let l = &doc.layers[0]; + assert!(matches!(art(&doc)[0].kind, NodeKind::Mesh(_)), "{after:?}"); + assert_eq!((l.opacity, l.blend), layer_state, "the layer's state after {after:?}"); + assert_eq!((art(&doc)[0].opacity, art(&doc)[0].blend), mesh_state, "the mesh's state after {after:?}"); + } } #[test] diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 4b487b5a40..536c0069b7 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -1,6 +1,6 @@ # File format parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai` import: type on a path spaced round curves as the file lays it out) · **Target:** Adobe Illustrator 2026 (30.x) +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-30 · **Change:** minor (`.ai`/EPS editing data: a layer's state after its last mesh stays the layer's) · **Target:** Adobe Illustrator 2026 (30.x) Every format Illustrator opens, places, saves or exports, against VectorCraft's format table (`FORMATS`, `OPEN_EXTS`, `PLACE_EXTS` in `crates/engine/src/cmd/fileio/formats.rs`). Illustrator's list comes from its public @@ -132,6 +132,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | Date | Change | Summary | |---|---|---| +| 2026-10-30 | minor | `.ai`/EPS editing data: an `Xy` right after a gradient mesh's `/End X!` is the mesh's only when its own `6 () XW` follows; when the layer's `LB` follows (directly or after the layer's `Xd` and `7 () XW`) it is the layer's, as before #4744, and the mesh keeps the state it had. Test `import::ai::tests::a_layer_keeps_its_own_transparency`; scores unchanged | | 2026-10-30 | minor | `.ai`/EPS editing data: type on a path is spaced round curves as the file's own layout spaces it, closer round the outside and further apart round the inside, though its frame keeps no spacing: the Type on a Path Options › Spacing that does that is fitted from the layout's glyph positions, where it came in at the font's advances and ran on past where the page ends it. In 8 files of a user's set with type round curves (19 stories), the fitted spacing is a fifth of the line's ascent outside a curve (17 stories) and half of it inside (2), and the 4 files whose pages were measured space their glyphs as their layouts do. Own-fixture tests in `import::tests_native` and `import::ate`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file whose data gives two placements is put at the corner of its box when that draws closer to the page and the layers still match it, not only when the first placement fails the comparison: a small logo in the wrong place differed too little to fail, and stayed there. Test `import::tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a file whose layers hold placed (linked) PDFs and no text object comes in from its layers when all of its page's type lies inside the placed files (at either of their placements): the PDF part draws each placed file, type and all, where the layers show its preview, so that type needs no text object. Such a file came in as its PDF part, saying its layers had no text objects for its page's text; type outside the placed files still needs one. Own-fixture test in `import::tests_native`; scores unchanged | @@ -141,7 +142,7 @@ the app's own editing copy of a file (an EPS after its `%%EOF`, a `.ai`'s `AIPri | 2026-10-30 | minor | `.ai` import: when the layers are compared with the page again with placed files at the corner of their box, the text objects the page doesn't draw are weighed with the images there, from the layers as read: before, the text an image covered at its first placement had already been left out, so a file whose image covered type only there came in without that type or as its PDF part. Test `import::tests_native::text_a_placed_file_covers_only_at_its_first_placement_is_kept`; scores unchanged | | 2026-10-30 | minor | `.ai` import: type read from the editing data's text document keeps its case setting (character attribute 12: 1 Small Caps, at Document Setup's default size, 2 All Caps); it came in as typed, so a heading set in All Caps showed in lower or mixed case where the page draws capitals. Test `import::tests_native::type_from_the_text_document_keeps_its_case_setting`; checked locally against a user's files; scores unchanged | | 2026-10-30 | minor | PDF import: a patch or triangle mesh shading of up to 16,384 patches comes in as gradient meshes (it was 4,096; Illustrator writes up to 14,355 in files users sent), and a stroke painted with one (how Illustrator writes a freeform gradient on a stroke) is the meshes clipped to the area the stroke paints, with its width, caps, joins and dashes; both came in as a flat grey. In two files of a user's set, the formerly grey area now matches a reference rendering in 99% of its pixels. Own-fixture tests in `tests::import_fidelity`; scores unchanged | -| 2026-10-30 | minor | `.ai`/EPS editing data: gradient meshes the reader marked unread, which made the whole file come in as its page or PDF part, are read: a mesh starts grey and its `/CS` is written only where it changes, before the corner it applies to (within a patch too), so each corner takes the space last set before it; named colours (`[c m y k /DeviceCMYK (name) /Process]` or `/Spot`) paint at the corner's tint and `/NChannel` inks overprint at theirs; meshes up to 128 patches a side and 16,384 patches are read (files users sent had up to 97 × 72). Ten of eleven such files from a user's set now open from their layers; meshes with handle weights other than 1 still don't. Own-fixture tests in `import::ai::mesh`; scores unchanged | +| 2026-10-30 | minor | `.ai`/EPS editing data: gradient meshes the reader marked unread, which made the whole file come in as its page or PDF part, are read: a mesh starts grey and its `/CS` is written only where it changes, before the corner it applies to (within a patch too), so each corner takes the space last set before it; named colours (`[c m y k /DeviceCMYK (name) /Process]` or `/Spot`) paint at the corner's tint and `/NChannel` inks overprint at theirs; meshes up to 128 patches a side and 16,384 patches are read (files users sent had up to 97 × 72). Ten of eleven such files from a user's set now open from their layers; meshes with handle weights other than 0 or 1 still don't. Own-fixture tests in `import::ai::mesh`; scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file is put where its matrix takes the canvas point of art space's origin, and, when the layers then don't draw as the page, at the corner of the box it is written with, which many files use; six files of a user's set whose photos landed off their artboards now open from their layers. Own-fixture test in `import::tests_native`; scores unchanged | | 2026-10-30 | minor | SVG export: axis-aligned rectangles are written as ``, circles and ellipses drawn with four standard arcs as ``/``, straight lines as `` and other straight-segment paths as ``/``, at the written precision; a rectangle or ellipse with a dashed stroke, turned ellipses, curves and compound paths stay `` (#4652); scores unchanged | | 2026-10-30 | minor | `.ai` import: a placed (linked) file written as an object's copy on `%_` lines is read: its `%AI5_BeginPlace` and `%AI5_EndPlace` markers there were dropped, so the `~` that ends it was an unknown operator and the whole file came in as its PDF part; its preview's header, on a `%_` line too, is read. Own-fixture test in `import::ai::tests`; scores unchanged | From 86f88dfc96e90220346eb433fd3e0f073d0f77c4 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 11:51:23 -0700 Subject: [PATCH 077/227] Type: Alt+arrow spacing steps turn with vertical type In vertical type, Alt+Down/Up (with or without Shift) steps kerning at a caret or tracking of selected text, Alt+Left/Right steps leading, and Alt+Shift+Right/Left steps baseline shift; Cmd/Ctrl makes five steps. Horizontal type keeps its mapping. Selected type objects follow the same rule when all of them are vertical, and a selection that mixes horizontal and vertical type takes the horizontal mapping in one undo step. --- crates/engine/src/cmd/textedit.rs | 4 +- crates/tools/src/text.rs | 4 +- crates/tools/src/text/plain.rs | 24 +++++-- crates/tools/src/text/tests.rs | 59 ++++++++++++++++ crates/tools/src/text/tool.rs | 2 +- crates/ui-egui/src/shortcuts.rs | 25 ++++--- crates/ui-egui/src/shortcuts/tests.rs | 98 +++++++++++++++++++++++++++ docs/mcp.md | 6 +- docs/target-app-parity.md | 1 + 9 files changed, 203 insertions(+), 20 deletions(-) diff --git a/crates/engine/src/cmd/textedit.rs b/crates/engine/src/cmd/textedit.rs index 92a2758eea..ae272f93a6 100644 --- a/crates/engine/src/cmd/textedit.rs +++ b/crates/engine/src/cmd/textedit.rs @@ -84,7 +84,7 @@ pub fn specs() -> Vec { "Step Type", [], None, - "{attribute: \"size\"|\"leading\"|\"tracking\"|\"kerning\"|\"baselineShift\", by?: steps (1; negative steps down), id?, start?: byte, end?: byte, ids?: [id…] (instead of id)} step type by the Preferences › Type increments (size and leading: typeSizeIncrement, pt; tracking and kerning: trackingIncrement, 1/1000 em; baseline shift: baselineShiftIncrement, pt), what the Type tool's Alt+arrows do (Cmd/Ctrl too: five steps; ←/→ kerning at the caret or tracking of the selection, ↑/↓ leading, Shift+↑/↓ baseline shift). The range of `id`, else the type objects in `ids`, else the text the Type tool has selected (at a caret: kerning steps the character before it, leading its paragraph), else every selected type object → {ids}", + "{attribute: \"size\"|\"leading\"|\"tracking\"|\"kerning\"|\"baselineShift\", by?: steps (1; negative steps down), id?, start?: byte, end?: byte, ids?: [id…] (instead of id)} step type by the Preferences › Type increments (size and leading: typeSizeIncrement, pt; tracking and kerning: trackingIncrement, 1/1000 em; baseline shift: baselineShiftIncrement, pt), what the Type tool's Alt+arrows do (Cmd/Ctrl too: five steps; horizontal: ←/→ kerning at the caret or tracking of the selection, ↑/↓ leading, Shift+↑/↓ baseline shift; vertical: ↓/↑ with or without Shift kerning or tracking, ←/→ leading, Shift+→/← baseline shift; mixed selected text objects use the horizontal mapping). The range of `id`, else the type objects in `ids`, else the text the Type tool has selected (at a caret: kerning steps the character before it, leading its paragraph), else every selected type object → {ids}", has_doc, type_step ), @@ -1132,7 +1132,7 @@ fn type_step(s: &mut Session, p: &Value) -> Result { /// Cmd/Ctrl+Alt+Q: tracking 0 and kerning Auto (0 in the Character panel) in the type objects in /// `ids`, else in the Type tool's selected text, else in every selected type object. At a caret, -/// only the kerning of the character before it changes, as Alt+←/→ kerns there. +/// only the kerning of the character before it changes, as Alt+←/→ in horizontal type or Alt+↓/↑ in vertical type kerns there. fn reset_tracking(s: &mut Session, p: &Value) -> Result { let ranges = type_ranges(s, p, "type.resetTracking", |text, a| Some((edit::prev_char(text, a), a)))?; if !ranges.is_empty() { diff --git a/crates/tools/src/text.rs b/crates/tools/src/text.rs index 9729985c89..e86bd4c4f0 100644 --- a/crates/tools/src/text.rs +++ b/crates/tools/src/text.rs @@ -202,12 +202,12 @@ pub struct TypeTool { } impl TypeTool { - pub(super) fn step_attribute(&mut self, key: ToolKey, mods: Mods, a: usize, b: usize) -> Option> { + pub(super) fn step_attribute(&mut self, key: ToolKey, mods: Mods, a: usize, b: usize, vertical: bool) -> Option> { if !mods.alt { return None; } let id = self.editing?; - let (attribute, by) = plain::step_key(key, mods.shift, a == b)?; + let (attribute, by) = plain::step_key(key, mods.shift, a == b, vertical)?; let mut out = self.commit(); let by = if mods.cmd { by * 5.0 } else { by }; out.push(Action::Exec("type.step".into(), json!({"id": id.0, "start": a, "end": b, "attribute": attribute, "by": by}))); diff --git a/crates/tools/src/text/plain.rs b/crates/tools/src/text/plain.rs index 32db456c3c..6825bfbee9 100644 --- a/crates/tools/src/text/plain.rs +++ b/crates/tools/src/text/plain.rs @@ -1,10 +1,22 @@ use super::{ImeSurrounding, Range, ToolKey}; -/// Byte range in `s` of the characters `r` (IME ranges count characters; carets count bytes). -/// `None` when `r` runs past the end of `s` or backwards. -/// The `type.step` an Alt+arrow asks for, by one step: ←/→ kerning at a `caret`, else tracking; -/// ↑/↓ leading (down opens it up); Shift+↑/↓ baseline shift. -pub fn step_key(key: ToolKey, shift: bool, caret: bool) -> Option<(&'static str, f64)> { +/// Map Alt+arrows to one type step. Horizontal ←/→ changes kerning at a caret or +/// tracking on a range, ↑/↓ changes leading, and Shift+↑/↓ changes baseline shift. +/// Vertical ↑/↓ (with or without Shift) changes kerning or tracking, ←/→ changes +/// leading, and Shift+→/← changes baseline shift. +pub fn step_key(key: ToolKey, shift: bool, caret: bool, vertical: bool) -> Option<(&'static str, f64)> { + let shift = shift && !(vertical && matches!(key, ToolKey::Up | ToolKey::Down)); + let key = if vertical { + match key { + ToolKey::Up => ToolKey::Left, + ToolKey::Down => ToolKey::Right, + ToolKey::Right => ToolKey::Up, + ToolKey::Left => ToolKey::Down, + other => other, + } + } else { + key + }; let sign = |up: bool| if up { 1.0 } else { -1.0 }; Some(match (key, shift) { (ToolKey::Left | ToolKey::Right, false) => (if caret { "kerning" } else { "tracking" }, sign(key == ToolKey::Right)), @@ -14,6 +26,8 @@ pub fn step_key(key: ToolKey, shift: bool, caret: bool) -> Option<(&'static str, }) } +/// Byte range in `s` of the characters `r` (IME ranges count characters; carets count bytes). +/// `None` when `r` runs past the end of `s` or backwards. pub(super) fn char_range_to_bytes(s: &str, r: Range) -> Option> { let byte = |c: usize| if c == s.chars().count() { Some(s.len()) } else { s.char_indices().nth(c).map(|(i, _)| i) }; let (a, b) = (byte(r.start)?, byte(r.end)?); diff --git a/crates/tools/src/text/tests.rs b/crates/tools/src/text/tests.rs index 1502533d55..172a8613b9 100644 --- a/crates/tools/src/text/tests.rs +++ b/crates/tools/src/text/tests.rs @@ -898,6 +898,65 @@ fn marked_text_is_underlined_with_the_converting_clause_thick() { assert!(!tool.composing()); } +#[test] +fn spacing_arrows_follow_each_text_objects_orientation() { + let cases = [ + (ToolKey::Down, ALT, "kerning", 1.0), + (ToolKey::Up, ALT, "kerning", -1.0), + (ToolKey::Left, ALT, "leading", 1.0), + (ToolKey::Right, ALT, "leading", -1.0), + (ToolKey::Right, SHIFT_ALT, "baselineShift", 1.0), + (ToolKey::Left, SHIFT_ALT, "baselineShift", -1.0), + (ToolKey::Down, SHIFT_ALT, "kerning", 1.0), + (ToolKey::Up, SHIFT_ALT, "kerning", -1.0), + (ToolKey::Down, Mods { cmd: true, ..ALT }, "kerning", 5.0), + (ToolKey::Up, Mods { cmd: true, ..ALT }, "kerning", -5.0), + ]; + for kind in 0..3 { + for selected in [false, true] { + let (mut d, id, mut tool) = editing("abcd"); + let NodeKind::Text(t) = &mut d.node_mut(id).unwrap().kind else { panic!("text") }; + t.vertical = true; + let path = vectorcraft_geom::PathData::from_bezpath(&Rect::new(0.0, 0.0, 100.0, 100.0).to_path(0.1)); + t.kind = match kind { + 1 => TextKind::Area { frame: path }, + 2 => TextKind::OnPath { path, start: 0.0, end: None }, + _ => TextKind::Point, + }; + tool.caret = 2; + tool.anchor = if selected { 1 } else { 2 }; + for (key_code, mods, caret_attribute, by) in cases { + let before = (tool.anchor, tool.caret); + let actions = key(&mut tool, &d, key_code, mods); + let step = actions + .iter() + .find_map(|action| match action { + Action::Exec(command, params) if command == "type.step" => Some(params), + _ => None, + }) + .expect("spacing command"); + assert_eq!( + step["attribute"], + if selected && caret_attribute == "kerning" { "tracking" } else { caret_attribute }, + "kind {kind}, selected {selected}" + ); + assert_eq!(step["by"], by); + assert_eq!((tool.anchor, tool.caret), before); + } + } + } + let (mut d, id, mut tool) = editing("abcd"); + let NodeKind::Text(t) = &mut d.node_mut(id).unwrap().kind else { panic!("text") }; + t.vertical = true; + key(&mut tool, &d, ToolKey::Down, SHIFT); + assert_eq!((tool.anchor, tool.caret), (0, 1)); + let (d, _, mut tool) = editing("abcd"); + let actions = key(&mut tool, &d, ToolKey::Right, ALT); + assert!(actions.iter().any( + |action| matches!(action, Action::Exec(command, params) if command == "type.step" && params["attribute"] == "kerning" && params["by"] == 1.0) + )); +} + #[test] fn arrows_follow_the_columns_of_vertical_type() { let (mut d, id) = doc_with_text("§§§\n§§§"); diff --git a/crates/tools/src/text/tool.rs b/crates/tools/src/text/tool.rs index cef7f4a9b9..a3e27487aa 100644 --- a/crates/tools/src/text/tool.rs +++ b/crates/tools/src/text/tool.rs @@ -175,7 +175,7 @@ impl Tool for TypeTool { self.anchor = self.anchor.min(len); let (a, b) = self.sel(); // Alt+arrows step the type by the Preferences › Type increments (Cmd/Ctrl too: five steps). - if let Some(out) = self.step_attribute(key, mods, a, b) { + if let Some(out) = self.step_attribute(key, mods, a, b, t.vertical) { return out; } let word = mods.cmd || mods.alt; diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 76d6b3967f..37d9e70994 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -361,19 +361,28 @@ fn single_key_shortcuts(app: &mut VectorcraftApp, ctx: &egui::Context) { /// Route Alt+arrows to spacing controls when text objects are selected. fn alt_type_arrows(app: &mut VectorcraftApp, ctx: &egui::Context) -> bool { let m = ctx.input(|i| i.modifiers); - if !m.alt - || !app.session.active().is_some_and(|st| { - st.selection.guides.is_empty() - && !st.selection.objects.is_empty() - && st.selection.objects.iter().all(|id| matches!(st.doc.node(*id).map(|n| &n.kind), Some(vectorcraft_doc::NodeKind::Text(_)))) - }) - { + if !m.alt { return false; } + let orientation = app.session.active().and_then(|st| { + if !st.selection.guides.is_empty() || st.selection.objects.is_empty() { + return None; + } + let mut all_vertical = true; + for id in &st.selection.objects { + let node = st.doc.node(*id)?; + let vectorcraft_doc::NodeKind::Text(t) = &node.kind else { return None }; + all_vertical &= t.vertical; + } + Some(all_vertical) + }); + let Some(vertical) = orientation else { + return false; + }; let keys = [(Key::ArrowLeft, ToolKey::Left), (Key::ArrowRight, ToolKey::Right), (Key::ArrowUp, ToolKey::Up), (Key::ArrowDown, ToolKey::Down)]; for (key, tool_key) in keys { if ctx.input_mut(|i| i.consume_key(m, key)) { - if let Some((attribute, by)) = vectorcraft_tools::text::step_key(tool_key, m.shift, false) { + if let Some((attribute, by)) = vectorcraft_tools::text::step_key(tool_key, m.shift, false, vertical) { let by = if m.command { by * 5.0 } else { by }; let _ = app.run("type.step", json!({"attribute": attribute, "by": by})); } diff --git a/crates/ui-egui/src/shortcuts/tests.rs b/crates/ui-egui/src/shortcuts/tests.rs index e97b526f92..62686d34d1 100644 --- a/crates/ui-egui/src/shortcuts/tests.rs +++ b/crates/ui-egui/src/shortcuts/tests.rs @@ -1094,6 +1094,104 @@ fn cmd_alt_shift_period_and_comma_step_the_font_size_by_five() { assert_eq!(sizes(&mut app), [(json!("One "), json!(14.0)), (json!("Two"), json!(24.0))]); } +/// Spacing arrow keys change tracking, leading, and baseline shift for a selected vertical text object. +#[test] +fn alt_arrows_rotate_for_selected_vertical_type() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let vertical = app.session.execute("text.create", &json!({"x": 20, "y": 50, "text": "One Two", "size": 20, "vertical": true})).unwrap()["id"] + .as_u64() + .unwrap(); + app.select_tool("selection"); + app.session.execute("select.set", &json!({"ids": [vertical]})).unwrap(); + let press = |key, modifiers| egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers }; + let cases = [ + (Key::ArrowDown, Modifiers::ALT, "tracking", 20.0), + (Key::ArrowUp, Modifiers::ALT, "tracking", 0.0), + (Key::ArrowLeft, Modifiers::ALT, "leading", 26.0), + (Key::ArrowRight, Modifiers::ALT, "leading", 24.0), + (Key::ArrowRight, Modifiers::ALT | Modifiers::SHIFT, "baseline_shift", 2.0), + (Key::ArrowLeft, Modifiers::ALT | Modifiers::SHIFT, "baseline_shift", 0.0), + (Key::ArrowDown, Modifiers::ALT | Modifiers::COMMAND, "tracking", 100.0), + (Key::ArrowUp, Modifiers::ALT | Modifiers::COMMAND, "tracking", 0.0), + ]; + for (key, modifiers, field, value) in cases { + frame(&mut app, vec![egui::Event::ModifiersChanged(modifiers), press(key, modifiers)]); + let range = app.session.execute("text.getRange", &json!({"id": vertical})).unwrap(); + assert_eq!(range["runs"][0]["style"][field], json!(value), "{key:?}"); + assert_eq!(app.session.active().unwrap().selection.objects, [vectorcraft_doc::NodeId(vertical)]); + } +} + +#[test] +fn mixed_type_objects_take_horizontal_spacing_chords_in_both_orders() { + let press = |key, modifiers| egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers }; + for vertical_first in [true, false] { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let vertical = app.session.execute("text.create", &json!({"x": 20, "y": 50, "text": "One", "size": 20, "vertical": true})).unwrap()["id"] + .as_u64() + .unwrap(); + let horizontal = app.session.execute("text.create", &json!({"x": 80, "y": 50, "text": "Two", "size": 20})).unwrap()["id"].as_u64().unwrap(); + let ids = if vertical_first { [vertical, horizontal] } else { [horizontal, vertical] }; + app.select_tool("type"); + app.session.execute("select.set", &json!({"ids": ids})).unwrap(); + let before = app.session.active().unwrap().history.undo.len(); + let original = ids.map(|id| app.session.execute("text.getRange", &json!({"id": id})).unwrap()); + frame(&mut app, vec![egui::Event::ModifiersChanged(Modifiers::ALT), press(Key::ArrowDown, Modifiers::ALT)]); + for id in ids { + let range = app.session.execute("text.getRange", &json!({"id": id})).unwrap(); + assert_eq!(range["runs"][0]["style"]["leading"], json!(26.0)); + } + assert_eq!(app.session.active().unwrap().history.undo.len(), before + 1); + assert_eq!(app.session.active().unwrap().selection.objects.len(), 2); + app.session.execute("edit.undo", &json!({})).unwrap(); + for (id, expected) in ids.into_iter().zip(original) { + let range = app.session.execute("text.getRange", &json!({"id": id})).unwrap(); + assert_eq!(range, expected); + } + app.session.execute("edit.redo", &json!({})).unwrap(); + for id in ids { + let range = app.session.execute("text.getRange", &json!({"id": id})).unwrap(); + assert_eq!(range["runs"][0]["style"]["leading"], json!(26.0)); + } + frame(&mut app, vec![egui::Event::ModifiersChanged(Modifiers::ALT), press(Key::ArrowRight, Modifiers::ALT)]); + for id in ids { + let range = app.session.execute("text.getRange", &json!({"id": id})).unwrap(); + assert_eq!(range["runs"][0]["style"]["tracking"], json!(20.0)); + } + assert_eq!(app.session.active().unwrap().selection.objects.len(), 2); + } +} + +#[test] +fn selected_vertical_area_and_path_type_use_vertical_spacing_chords() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 300, "height": 300})).unwrap(); + let area_frame = app.session.execute("path.create", &json!({"d": "M10 10 L100 10 L100 100 L10 100 Z"})).unwrap()["id"].as_u64().unwrap(); + let path = app.session.execute("path.create", &json!({"d": "M150 10 L250 10"})).unwrap()["id"].as_u64().unwrap(); + let area = + app.session.execute("text.createInPath", &json!({"path": area_frame, "mode": "area", "text": "Area", "vertical": true, "size": 20})).unwrap() + ["id"] + .as_u64() + .unwrap(); + let on_path = app + .session + .execute("text.createInPath", &json!({"path": path, "mode": "onPath", "text": "Path", "vertical": true, "size": 20})) + .unwrap()["id"] + .as_u64() + .unwrap(); + app.select_tool("selection"); + app.session.execute("select.set", &json!({"ids": [area, on_path]})).unwrap(); + let modifiers = Modifiers::ALT; + let press = egui::Event::Key { key: Key::ArrowDown, physical_key: None, pressed: true, repeat: false, modifiers }; + frame(&mut app, vec![egui::Event::ModifiersChanged(modifiers), press]); + for id in [area, on_path] { + let range = app.session.execute("text.getRange", &json!({"id": id})).unwrap(); + assert_eq!(range["runs"][0]["style"]["tracking"], json!(20.0)); + } +} + /// #3786: Alt+arrows step a selected text object's spacing instead of copying and nudging it. #[test] fn alt_arrows_step_selected_type_object() { diff --git a/docs/mcp.md b/docs/mcp.md index 5902163c28..f2e5a246b6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -3173,8 +3173,10 @@ Pen's second anchor at (150, 431), in line with the square's centre. Cmd+Shift+,) step the size. `type.size.increaseByFive` (Cmd+Alt+Shift+., `press_key {key: ".", mods: {cmd: true, alt: true, shift: true}}`) and `type.size.decreaseByFive` (Cmd+Alt+Shift+,) step it by five times `typeSizeIncrement`. The Type tool's Alt+arrows (`press_key {key: "Right", mods: {alt: true}}`) step kerning at - a caret or tracking of the selection (←/→), leading (↑/↓) and baseline shift (Shift+↑/↓), five steps with Cmd/Ctrl - too. `type.resetTracking` (Cmd+Alt+Q, `press_key {key: "Q", mods: {cmd: true, alt: true}}`) sets tracking to 0 and + a caret or tracking of the selection (←/→ in horizontal type, ↓/↑ with or without Shift in vertical type), + leading (↑/↓ in horizontal type, ←/→ in vertical type), and baseline shift (Shift+↑/↓ in horizontal type, + Shift+→/← in vertical type). Mixed selected text objects use the horizontal mapping; Cmd/Ctrl makes five steps. + `type.resetTracking` (Cmd+Alt+Q, `press_key {key: "Q", mods: {cmd: true, alt: true}}`) sets tracking to 0 and kerning to Auto in the type objects in `ids`, the Type tool's selected text or the selected type objects; at a caret it resets only the kerning of the character before it. `type.resetHorizontalScale` (Cmd+Shift+X, `press_key {key: "X", mods: {cmd: true, shift: true}}`) sets the horizontal scale to 100%, as the Character panel diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index d5071c4eb6..453adabf01 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -814,6 +814,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur With anchors or segments of a path selected with Direct Selection, Simplify acts on just that part of the path, as the [Manually simplify paths](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/manually-simplify-paths.html) page puts it: the slider, Auto-Simplify and the dialog refit only each run of selected segments, between its end anchors, which keep their place and their handles on the side away from the run. The anchors and segments outside the runs stay exactly as they were, a closed path's run may cross its start point, separate runs on one path are refitted independently in one undo step, and the runs stay selected. A path with only lone anchors selected is still simplified whole, and `object.path.simplify {wholePaths: true}` simplifies partly selected paths whole. Tests: `crates/engine/src/tests/simplify_part.rs` and `simplify_slider_and_dialog_simplify_only_the_direct_selected_part_of_a_path`. Object › Path › Smooth… (#4115) opens a slider under the selection from Minimum to Maximum smoothing with an Auto-Smooth button, as the [Smooth slider](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-paths/refine-path-segments-with-the-smooth-slider.html) page describes; the canvas previews it and Enter or a click outside keeps it as one undo step (`object.path.smooth {level, auto, ids}`). The page names only the ends, so the rest is VectorCraft's own rule: each selected path, compound path members included, is refitted with curves within 0.1% (level 0) to 2.5% (level 100) of its longer side, corners kept only where it turns back and never with more anchors (a rectangle stays as it is); Auto-Smooth is level 50. Closed paths stay closed and open ones keep their end points. Tests: `crates/engine/src/tests/smooth_path.rs` and `smooth_slider_previews_auto_smooth_and_keeps_the_result`. - **Devanagari shaping:** with an OpenType Devanagari font, Ka, virama and Ssa (क्ष) form one conjunct glyph, Ra and virama before a consonant (र्क) become a reph drawn after it, the i matra (कि) is drawn before its consonant, and Ka with a nukta is drawn like the precomposed क़ (U+0958), as [Microsoft's Devanagari shaping specification](https://learn.microsoft.com/en-us/typography/script-development/devanagari) describes. Each syllable is one cluster of its source bytes, and the arrow keys stop at its ends. A click inside a syllable drawn with several glyphs puts the caret at the syllable's nearer end, in point, area and path type. Tests: `crates/text/src/tests/devanagari.rs`; they print SKIPPED when no such font is installed. +- **Vertical type spacing shortcuts:** The [Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html) page gives Alt+Down/Up for kerning at a caret or tracking of selected text, Alt+Left/Right for leading, and Alt+Shift+Right/Left for baseline shift. Alt+Shift+Down/Up also steps kerning or tracking. Down increases kerning or tracking, Left increases leading, and Shift+Right increases baseline shift; the opposite arrows decrease them. Cmd/Ctrl makes five steps. Horizontal type keeps its existing mapping; mixed horizontal and vertical text-object selections take the horizontal mapping for both objects in one undo step. Selected vertical point, area and path type use the same directions. Tests: `spacing_arrows_follow_each_text_objects_orientation`, `alt_arrows_rotate_for_selected_vertical_type`, `mixed_type_objects_take_horizontal_spacing_chords_in_both_orders`, and `selected_vertical_area_and_path_type_use_vertical_spacing_chords`. - **Vertical punctuation:** fullwidth `!` (U+FF01) and `?` (U+FF1F) use their nominal glyph upright when no vertical alternate is present, following the Tu fallback in [Unicode UAX #50 §3.1](https://www.unicode.org/reports/tr50/#vo). Code-built test fonts cover point and area type with and without `vert` alternates, retain the rotated fallback for a bracket and long vowel mark, and leave horizontal type unchanged. Tests: `crates/text/src/tests/vertical.rs`. - Free Distort's dialog (Effect › Distort & Transform › Free Distort…) shows a box in the proportions of the first selected object's bounds with a handle on each corner. Dragging a handle moves that corner. A handle focused by a click or Tab moves 1% of the box with each arrow key, and 10% with Shift. Reset puts the four corners back on the box. The preview and OK run `effect.apply`, or `effect.setParams` when the dialog edits an applied effect, and the Appearance panel's inline editor opens the dialog with Edit…. Behavior reference: Illustrator CC Help (2014, [PDF](https://help.adobe.com/archive/en/illustrator/cc/2014/illustrator_reference.pdf)), page 285 (PDF page 291). - **Kerning across style runs:** characters that differ only in fill, stroke, underline, strikethrough, overprint, character style name, leading, baseline shift, rotation, Character Alignment, kerning, or tracking that keeps or drops ligatures alike are shaped together, so restyling one character keeps the font's kerning pairs with its neighbors. A character with manual kerning that follows one with automatic kerning keeps the font's kerning with it (unless All Caps or Small Caps sets it as two letters, as ß becomes SS), and its value replaces the font's kerning after it. A ligature does not form across a change of style, and a change of font, size or OpenType features still shapes the characters apart. Behavior reference: [Line and character spacing](https://web.archive.org/web/20260916050333/https://helpx.adobe.com/illustrator/using/line-character-spacing.html) (public documentation). Tests: `crates/text/src/tests/typo.rs`, `crates/text/src/tests/bidi.rs`. From 38a68c3b85ffedf6092f3fc728a2d095de8a5fa1 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 06:35:25 -0700 Subject: [PATCH 078/227] View: Escape returns full screen modes to Normal In Full Screen Mode and Full Screen Mode with Menu Bar, an unmodified Escape that nothing earlier in the Escape chain takes (a popup, dialog, field, drawer, tool gesture, edit mode, flyout or the view rotation reset) runs view.screenMode with mode 0. Presentation Mode and the F cycle are unchanged. --- crates/ui-egui/src/shortcuts.rs | 9 ++ crates/ui-egui/src/tests/screenmode.rs | 111 +++++++++++++++++++++++++ docs/target-app-parity.md | 1 + 3 files changed, 121 insertions(+) diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 37d9e70994..e5f930a9b8 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -245,6 +245,15 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) { // Escape pressed twice resets a rotated view (with the Rotate View tool, once). let _ = app.run("view.rotateReset", json!({})); escape_pair = None; + } else if matches!(app.ui.screen_mode, 1 | 2) + && !egui::Popup::is_any_open(ctx) + && ctx.input(|i| { + i.events.iter().any(|e| { + matches!(e, egui::Event::Key { key: Key::Escape, pressed: true, repeat: false, modifiers, .. } if *modifiers == Modifiers::NONE) + }) + }) + { + let _ = app.run("view.screenMode", json!({ "mode": 0 })); } } // An Escape that ended something can start a pair too. One that closed a popup cannot. diff --git a/crates/ui-egui/src/tests/screenmode.rs b/crates/ui-egui/src/tests/screenmode.rs index 0c7f2d2e8e..6727d81d4a 100644 --- a/crates/ui-egui/src/tests/screenmode.rs +++ b/crates/ui-egui/src/tests/screenmode.rs @@ -68,6 +68,117 @@ fn snapshot(app: &VectorcraftApp) -> impl Fn(&VectorcraftApp) -> bool + use<> { } } +fn in_screen_mode(ctx: &egui::Context, mode: u8) -> VectorcraftApp { + let mut app = VectorcraftApp::new(Session::new(), crate::Services::default()); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + let id = app.run("shape.rectangle", json!({"x": 90, "y": 40, "width": 20, "height": 20})).unwrap()["id"].clone(); + app.run("select.set", json!({"ids": [id]})).unwrap(); + app.select_tool("selection"); + frame(&mut app, ctx, vec![]); + app.run("view.screenMode", json!({"mode": mode})).unwrap(); + frame(&mut app, ctx, vec![]); + app +} + +#[test] +fn escape_leaves_both_full_screen_modes_without_editing() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + let unchanged = snapshot(&app); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "mode {mode}"); + assert!(unchanged(&app), "mode {mode}: document, selection and undo history"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "Escape in Normal mode"); + } +} + +#[test] +fn modified_escape_keeps_full_screen_mode() { + for modifiers in [egui::Modifiers::SHIFT, egui::Modifiers::CTRL, egui::Modifiers::COMMAND, egui::Modifiers::ALT] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, 2); + let events = + [true, false].map(|pressed| egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed, repeat: false, modifiers }).to_vec(); + frame(&mut app, &ctx, events); + assert_eq!(app.ui.screen_mode, 2, "{modifiers:?}"); + } +} + +#[test] +fn drawer_and_isolation_take_escape_before_full_screen() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.ui.tools_drawer = true; + frame(&mut app, &ctx, escape()); + assert!(!app.ui.tools_drawer); + assert_eq!(app.ui.screen_mode, mode, "drawer"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "after drawer"); + + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.run("shape.rectangle", json!({"x": 130, "y": 40, "width": 20, "height": 20})).unwrap(); + app.run("select.all", json!({})).unwrap(); + app.run("object.group", json!({})).unwrap(); + app.run("object.isolate", json!({})).unwrap(); + assert!(app.session.active().unwrap().isolation.is_some()); + frame(&mut app, &ctx, escape()); + assert!(app.session.active().unwrap().isolation.is_none()); + assert_eq!(app.ui.screen_mode, mode, "isolation"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "after isolation"); + } +} + +#[test] +fn a_tool_drag_takes_escape_before_full_screen_exits() { + use vectorcraft_tools::{PointerEvent, PointerKind}; + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, 2); + let view = app.view_info(); + app.session.pointer(&PointerEvent::new(PointerKind::Down, 100.0, 50.0), view).unwrap(); + app.session.pointer(&PointerEvent::new(PointerKind::Drag, 120.0, 70.0), view).unwrap(); + assert!(app.session.tool_busy()); + frame(&mut app, &ctx, escape()); + assert!(!app.session.tool_busy()); + assert_eq!(app.ui.screen_mode, 2); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0); +} + +#[test] +fn a_popup_takes_escape_before_full_screen_exits() { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, 2); + let pos = app.canvas_rect.unwrap().center(); + let button = |pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Secondary, pressed, modifiers: Default::default() }; + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(pos), button(true)]); + frame(&mut app, &ctx, vec![button(false)]); + frame(&mut app, &ctx, vec![]); + assert!(egui::Popup::is_any_open(&ctx)); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 2); + assert!(!egui::Popup::is_any_open(&ctx)); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0); +} + +#[test] +fn a_rotated_view_resets_before_full_screen_exits() { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, 2); + app.select_tool("rotateView"); + app.run("view.rotate", json!({"angle": 30})).unwrap(); + frame(&mut app, &ctx, escape()); + assert_eq!(app.view().unwrap().rotation, 0.0); + assert_eq!(app.ui.screen_mode, 2); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0); +} + #[test] fn escape_leaves_presentation_mode() { let mut app = VectorcraftApp::new(Session::new(), crate::Services::default()); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 453adabf01..610b859d80 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -759,6 +759,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Views:** the status bar's artboard navigator (first, previous, next, last; `view.goToArtboard`) goes to an artboard, fits it and synchronizes the Artboard tool selection when that tool is active; ordinary object selection is preserved. Actual Next-button regressions cover keyboard/Properties deletion and Undo in `chrome.rs`. Fit Artboard in Window and Actual Size show the navigator's artboard. The Artboards panel highlights that active artboard: clicking a row makes it active (the Artboard tool's too, while it is chosen) as does clicking an artboard with the Artboard tool, double-clicking its number also fits it in the window and double-clicking its name renames it. Duplicate Artboards, or a row dragged onto New Artboard, copies the artboard with its art (#446). Escape leaves Presentation Mode, `view.screenMode` from it goes back to Normal Screen Mode, and the screen mode isn't saved with the preferences: the app always starts in Normal Screen Mode with its menus and panels (#472). View › Pixel Preview shows the art as the document pixels it rasterizes to, one per point and hard-edged when magnified, turning with a rotated view (it used to draw the smooth vectors, with only the pixel grid over them). In Outline view a template layer keeps drawing in Preview, dimmed, so a picture placed to be traced stays visible under the outlines (#1505, fixes #1486). In Presentation Mode, → and ← go to the next and the previous artboard, and a click anywhere goes to the next one, as the status bar navigator's Next and Previous do (`view.goToArtboard`): on the last artboard → and a click leave the view as it is, and so does ← on the first. The arrow keys do not move the selection there, and the tool does not receive a click, so a click selects and draws nothing (behavior reference: [View artwork](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)). Full Screen Mode and Presentation Mode put the window full screen, covering the taskbar and the window's frame, and Normal Screen Mode or Full Screen Mode with Menu Bar puts it back (#4365); a window the user made full screen stays so. + An unmodified Escape in either Full Screen Mode exits to Normal Screen Mode after any open popup, tool gesture, edit mode, drawer, flyout or view rotation has taken its Escape; a later Escape exits when that action is finished. This is a VectorCraft choice for both full screen variants, based on the public [shortcut list](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html); the list does not specify that priority or the return mode. Presentation Mode shows the active artboard fitted to the screen (fitted again as the window goes full screen) and hides the selection, guides, grids, slices and the artboards' edges and names, as [presentation mode](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/view-artwork-in-presentation-mode.html) describes. In Presentation Mode no key press other than ←, → and Escape runs a command or reaches the tool (tool keys, Delete, Enter, Tab, F, Shift+F and every command shortcut, the macOS menu bar's key equivalents included), a right click or a long touch opens no context menu, a tap of two or three fingers undoes or redoes nothing, and the pointer over the canvas is the default one instead of the tool's cursor. Align to Artboard uses the active artboard, the one the Artboards panel highlights (`object.align {artboard}`). A press with a selection tool inside an artboard makes that artboard active; with the Selection tool, a Shift-click on an empty spot inside an artboard makes it active and keeps the selection. One selected object is aligned to the active artboard too, whatever Align To says (a lone object is never the key object). When an action plays, its Align to Artboard, All on Active Artboard, Paste in Place, Paste in Front and Paste in Back steps that name no artboard use the artboard that is active then. From dcd4b437a510ffe93b84651eb00bd7787200d6c7 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 10:41:04 -0700 Subject: [PATCH 079/227] View: Escape that ends a field, ruler or Tools move keeps full screen In Full Screen Mode and Full Screen Mode with Menu Bar, an Escape that leaves a focused text field, cancels a ruler-origin drag or cancels a floating Tools panel move no longer also returns to Normal Screen Mode; the next Escape does. Tests cover a dialog, a focused field, a tool that claims Escape, pattern edit, Global Edit, a tool flyout and the rotation reset pair in both modes. --- crates/ui-egui/src/app.rs | 3 + crates/ui-egui/src/app/input.rs | 3 +- crates/ui-egui/src/shortcuts.rs | 19 +++ crates/ui-egui/src/tests/screenmode.rs | 164 +++++++++++++++++++++++++ crates/ui-egui/src/tools_float.rs | 21 +++- docs/target-app-parity.md | 2 +- 6 files changed, 209 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 0e5475b669..923459f898 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -500,6 +500,9 @@ impl VectorcraftApp { titlebar::resize_zones(ui); } self.ui_fonts.frame(&ctx); + if self.ui.dialog.is_none() && !self.ui.palette_open { + shortcuts::remember_text_focus(&ctx); + } scrub::end_frame(self, &ctx); native_menu::sync(self, &ctx); // Observe once, after all of this pass's input, dialogs, floating panels, palette and diff --git a/crates/ui-egui/src/app/input.rs b/crates/ui-egui/src/app/input.rs index 986ec60ae0..6bcfdfd3f2 100644 --- a/crates/ui-egui/src/app/input.rs +++ b/crates/ui-egui/src/app/input.rs @@ -1,4 +1,4 @@ -use super::{Arc, Ordering, VectorcraftApp, graphics, native_menu, shortcuts, take_frame_once}; +use super::{Arc, Ordering, VectorcraftApp, graphics, native_menu, shortcuts, take_frame_once, tools_float}; #[cfg(not(target_arch = "wasm32"))] use super::{fileio, place}; @@ -15,6 +15,7 @@ impl VectorcraftApp { self.write_formats_before_text_input(ctx); native_menu::run(self, ctx); if self.fonts_ready { + tools_float::cancel_move_on_escape(self, ctx); shortcuts::handle(self, ctx); } // A Copy taken in this UI phase (an egui copy event, or a command it runs) is published in diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index e5f930a9b8..2f40778d41 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -24,6 +24,22 @@ use typing::is_shortcut_chord; pub(crate) use typing::keep_marked_text; use typing::{drop_typing_presses, type_text}; +fn text_focus_frame_id() -> egui::Id { + egui::Id::unique("shortcut-text-focus-frame") +} + +pub(crate) fn remember_text_focus(ctx: &egui::Context) { + if ctx.egui_wants_keyboard_input() { + let frame = ctx.cumulative_frame_nr_for(ctx.viewport_id()); + ctx.data_mut(|d| d.insert_temp(text_focus_frame_id(), frame)); + } +} + +fn text_focused_in_previous_frame(ctx: &egui::Context) -> bool { + let previous = ctx.cumulative_frame_nr_for(ctx.viewport_id()).checked_sub(1); + ctx.data(|d| d.get_temp::(text_focus_frame_id())) == previous +} + /// Parse "Cmd+Shift+]" into an egui shortcut. `Cmd` is Command on macOS and Ctrl elsewhere. /// `+` and `=` name one chord key ([`Key::Equals`]): `+` is Shift+`=` on many layouts, so a /// `Cmd+=` chord also answers `+` however it is typed. @@ -247,6 +263,9 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) { escape_pair = None; } else if matches!(app.ui.screen_mode, 1 | 2) && !egui::Popup::is_any_open(ctx) + && !text_focused_in_previous_frame(ctx) + && !crate::canvas::ruler_origin_dragging(ctx) + && !crate::tools_float::escape_cancelled_move(ctx) && ctx.input(|i| { i.events.iter().any(|e| { matches!(e, egui::Event::Key { key: Key::Escape, pressed: true, repeat: false, modifiers, .. } if *modifiers == Modifiers::NONE) diff --git a/crates/ui-egui/src/tests/screenmode.rs b/crates/ui-egui/src/tests/screenmode.rs index 6727d81d4a..1217684225 100644 --- a/crates/ui-egui/src/tests/screenmode.rs +++ b/crates/ui-egui/src/tests/screenmode.rs @@ -149,6 +149,57 @@ fn a_tool_drag_takes_escape_before_full_screen_exits() { assert_eq!(app.ui.screen_mode, 0); } +#[test] +fn a_ruler_origin_drag_takes_escape_before_full_screen_exits() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.ui.view.rulers = true; + frame(&mut app, &ctx, vec![]); + let corner = ctx.read_response(egui::Id::unique("ruler-corner")).expect("the rulers' corner").rect.center(); + let to = app.canvas_rect.unwrap().center(); + let button = |pos, pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(corner)]); + frame(&mut app, &ctx, vec![button(corner, true)]); + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(to)]); + assert!(crate::canvas::ruler_origin_dragging(&ctx), "mode {mode}"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, mode, "Escape cancels the drag in mode {mode}"); + frame(&mut app, &ctx, vec![button(to, false)]); + assert!(!crate::canvas::ruler_origin_dragging(&ctx), "mode {mode}"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "Escape after the drag in mode {mode}"); + } +} + +#[test] +fn a_floating_tools_move_takes_escape_before_full_screen_exits() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.run("window.panel.float", json!({"panel": "tools", "x": 120, "y": 140})).unwrap(); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, vec![]); + let original = app.ui.toolbar_pos; + let [x, y] = original.expect("the Tools panel floats"); + let area = ctx.memory(|m| m.area_rect(egui::Id::unique("toolbar-floating"))).expect("the floating Tools area"); + let title = area.min + egui::vec2(20.0, 17.0); + let to = title + egui::vec2(100.0, 80.0); + let button = |pos, pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(title), button(title, true)]); + for step in 1..=6 { + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(title + (to - title) * (step as f32 / 6.0))]); + } + assert_ne!(app.ui.toolbar_pos, original, "the Tools panel moved in mode {mode}: saved {x} {y}, area {area:?}"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, mode, "Escape cancels the Tools move in mode {mode}"); + assert_eq!(app.ui.toolbar_pos, original, "Escape restores the Tools panel's position"); + frame(&mut app, &ctx, vec![button(to, false)]); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "Escape after the move in mode {mode}"); + } +} + #[test] fn a_popup_takes_escape_before_full_screen_exits() { let ctx = egui::Context::default(); @@ -179,6 +230,119 @@ fn a_rotated_view_resets_before_full_screen_exits() { assert_eq!(app.ui.screen_mode, 0); } +#[test] +fn a_dialog_takes_escape_before_full_screen_exits() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.ui.dialog = Some(crate::state::Dialog::new("rectangle", json!({"width": 20, "height": 20}))); + frame(&mut app, &ctx, vec![]); + frame(&mut app, &ctx, escape()); + assert!(app.ui.dialog.is_none(), "mode {mode}"); + assert_eq!(app.ui.screen_mode, mode, "mode {mode}"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "after the dialog in mode {mode}"); + } +} + +#[test] +fn a_focused_field_keeps_full_screen_mode() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + let id = egui::Id::unique("screen-mode-field"); + let mut value = String::new(); + let mut field_frame = |app: &mut VectorcraftApp, events, focus| { + let raw = egui::RawInput { + screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 600.0))), + events, + ..Default::default() + }; + let mut out = ctx.run_ui(raw, |ui| { + app.logic(ui.ctx()); + let response = ui.add(egui::TextEdit::singleline(&mut value).id(id)); + if focus { + response.request_focus(); + } + app.ui(ui); + }); + out.textures_delta.clear(); + }; + field_frame(&mut app, vec![], true); + assert!(ctx.egui_wants_keyboard_input()); + field_frame(&mut app, escape(), false); + assert_eq!(app.ui.screen_mode, mode, "focused field in mode {mode}"); + } +} + +#[test] +fn a_claimed_tool_key_keeps_full_screen_mode() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.select_tool("intertwine"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, mode, "Intertwine claims Escape in mode {mode}"); + app.select_tool("selection"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "after changing tools in mode {mode}"); + } +} + +#[test] +fn pattern_edit_and_global_edit_take_escape_before_full_screen() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.run("object.pattern.make", json!({"name": "Dots", "width": 20, "height": 20})).unwrap(); + assert!(app.session.active().unwrap().doc.pattern_edit.is_some()); + frame(&mut app, &ctx, escape()); + assert!(app.session.active().unwrap().doc.pattern_edit.is_none()); + assert_eq!(app.ui.screen_mode, mode, "pattern edit in mode {mode}"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "after pattern edit in mode {mode}"); + + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.run("shape.rectangle", json!({"x": 130, "y": 40, "width": 20, "height": 20})).unwrap(); + app.run("select.globalEdit", json!({})).unwrap(); + assert!(app.session.active().unwrap().global_edit.is_some()); + frame(&mut app, &ctx, escape()); + assert!(app.session.active().unwrap().global_edit.is_none()); + assert_eq!(app.ui.screen_mode, mode, "Global Edit in mode {mode}"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "after Global Edit in mode {mode}"); + } +} + +#[test] +fn a_tool_flyout_takes_escape_before_full_screen() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.ui.flyout = Some(0); + frame(&mut app, &ctx, escape()); + assert!(app.ui.flyout.is_none()); + assert_eq!(app.ui.screen_mode, mode, "flyout in mode {mode}"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "after flyout in mode {mode}"); + } +} + +#[test] +fn a_rotation_pair_exits_full_screen_then_resets_with_selection_tool() { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.run("view.rotate", json!({"angle": 30})).unwrap(); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "first Escape in mode {mode}"); + assert_eq!(app.view().unwrap().rotation, 30.0); + frame(&mut app, &ctx, escape()); + assert_eq!(app.view().unwrap().rotation, 0.0, "second Escape after mode {mode}"); + } +} + #[test] fn escape_leaves_presentation_mode() { let mut app = VectorcraftApp::new(Session::new(), crate::Services::default()); diff --git a/crates/ui-egui/src/tools_float.rs b/crates/ui-egui/src/tools_float.rs index 71101b7101..25d86b69f2 100644 --- a/crates/ui-egui/src/tools_float.rs +++ b/crates/ui-egui/src/tools_float.rs @@ -8,7 +8,7 @@ //! agents. Its position is kept with the preferences and in user workspaces, and a position saved //! on a bigger window is clamped into this one when drawn. -use egui::{CornerRadius, Id, Pos2, Rect, Stroke, Vec2, pos2, vec2}; +use egui::{CornerRadius, Id, Key, Pos2, Rect, Stroke, Vec2, pos2, vec2}; use serde_json::{Value, json}; use crate::VectorcraftApp; @@ -33,6 +33,14 @@ fn move_id() -> Id { Id::unique("tools-float-move") } +fn escape_cancel_id() -> Id { + Id::unique("tools-float-escape-cancel") +} + +pub(crate) fn escape_cancelled_move(ctx: &egui::Context) -> bool { + ctx.data(|d| d.get_temp::(escape_cancel_id())) == Some(ctx.cumulative_frame_nr_for(ctx.viewport_id())) +} + /// The strip along the window's left edge where the Tools panel docks, as last laid out. pub(crate) fn tools_zone_id() -> Id { Id::unique("tools-float-zone") @@ -50,6 +58,13 @@ fn gesture_allowed(ctx: &egui::Context) -> bool { ctx.input(|input| input.focused && !input.key_pressed(egui::Key::Escape)) } +/// Cancel a move before shortcuts route the same Escape press. +pub(crate) fn cancel_move_on_escape(app: &mut VectorcraftApp, ctx: &egui::Context) { + if ctx.input(|i| i.key_pressed(Key::Escape)) { + track(app, ctx); + } +} + fn start(app: &VectorcraftApp, ctx: &egui::Context, grab: Vec2) { let Some(from) = ctx.input(|i| i.pointer.press_origin().or(i.pointer.interact_pos())) else { return }; ctx.data_mut(|d| d.insert_temp(move_id(), Move { grab, from, original: app.ui.toolbar_pos })); @@ -94,6 +109,10 @@ pub fn track(app: &mut VectorcraftApp, ctx: &egui::Context) { if !gesture_allowed(ctx) { app.ui.toolbar_pos = m.original; ctx.data_mut(|d| d.remove::(move_id())); + if ctx.input(|i| i.key_pressed(Key::Escape)) { + let frame = ctx.cumulative_frame_nr_for(ctx.viewport_id()); + ctx.data_mut(|d| d.insert_temp(escape_cancel_id(), frame)); + } return; } let at = ctx.input(|i| i.pointer.interact_pos()); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 610b859d80..cbf1e4590c 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -759,7 +759,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - **Views:** the status bar's artboard navigator (first, previous, next, last; `view.goToArtboard`) goes to an artboard, fits it and synchronizes the Artboard tool selection when that tool is active; ordinary object selection is preserved. Actual Next-button regressions cover keyboard/Properties deletion and Undo in `chrome.rs`. Fit Artboard in Window and Actual Size show the navigator's artboard. The Artboards panel highlights that active artboard: clicking a row makes it active (the Artboard tool's too, while it is chosen) as does clicking an artboard with the Artboard tool, double-clicking its number also fits it in the window and double-clicking its name renames it. Duplicate Artboards, or a row dragged onto New Artboard, copies the artboard with its art (#446). Escape leaves Presentation Mode, `view.screenMode` from it goes back to Normal Screen Mode, and the screen mode isn't saved with the preferences: the app always starts in Normal Screen Mode with its menus and panels (#472). View › Pixel Preview shows the art as the document pixels it rasterizes to, one per point and hard-edged when magnified, turning with a rotated view (it used to draw the smooth vectors, with only the pixel grid over them). In Outline view a template layer keeps drawing in Preview, dimmed, so a picture placed to be traced stays visible under the outlines (#1505, fixes #1486). In Presentation Mode, → and ← go to the next and the previous artboard, and a click anywhere goes to the next one, as the status bar navigator's Next and Previous do (`view.goToArtboard`): on the last artboard → and a click leave the view as it is, and so does ← on the first. The arrow keys do not move the selection there, and the tool does not receive a click, so a click selects and draws nothing (behavior reference: [View artwork](https://helpx.adobe.com/illustrator/using/viewing-artwork.html)). Full Screen Mode and Presentation Mode put the window full screen, covering the taskbar and the window's frame, and Normal Screen Mode or Full Screen Mode with Menu Bar puts it back (#4365); a window the user made full screen stays so. - An unmodified Escape in either Full Screen Mode exits to Normal Screen Mode after any open popup, tool gesture, edit mode, drawer, flyout or view rotation has taken its Escape; a later Escape exits when that action is finished. This is a VectorCraft choice for both full screen variants, based on the public [shortcut list](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html); the list does not specify that priority or the return mode. + An unmodified Escape in either Full Screen Mode exits to Normal Screen Mode after any open popup, focused field, tool gesture, ruler-origin drag, floating Tools panel move, edit mode, drawer, flyout or view rotation has taken its Escape; a later Escape exits when that action is finished. This is a VectorCraft choice for both full screen variants, based on the public [shortcut list](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html); the list does not specify that priority or the return mode. Presentation Mode shows the active artboard fitted to the screen (fitted again as the window goes full screen) and hides the selection, guides, grids, slices and the artboards' edges and names, as [presentation mode](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/view-artwork-in-presentation-mode.html) describes. In Presentation Mode no key press other than ←, → and Escape runs a command or reaches the tool (tool keys, Delete, Enter, Tab, F, Shift+F and every command shortcut, the macOS menu bar's key equivalents included), a right click or a long touch opens no context menu, a tap of two or three fingers undoes or redoes nothing, and the pointer over the canvas is the default one instead of the tool's cursor. Align to Artboard uses the active artboard, the one the Artboards panel highlights (`object.align {artboard}`). A press with a selection tool inside an artboard makes that artboard active; with the Selection tool, a Shift-click on an empty spot inside an artboard makes it active and keeps the selection. One selected object is aligned to the active artboard too, whatever Align To says (a lone object is never the key object). When an action plays, its Align to Artboard, All on Active Artboard, Paste in Place, Paste in Front and Paste in Back steps that name no artboard use the artboard that is active then. From 030baab798577776671e6ff8d8695f862d74c671 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 11:28:52 -0700 Subject: [PATCH 080/227] View: Escape that cancels a ruler or Tools move ends nothing else An Escape press that cancels a ruler-origin drag or a floating Tools panel move no longer also closes Edit Toolbar's drawer, leaves pattern edit, isolation or Global Edit, closes the tool flyout or resets a rotated view. A later Escape does that action as usual. --- crates/ui-egui/src/shortcuts.rs | 7 +- crates/ui-egui/src/shortcuts/presentation.rs | 5 +- crates/ui-egui/src/tests/screenmode.rs | 136 +++++++++++++++++++ 3 files changed, 142 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 2f40778d41..d8a238ed15 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -205,9 +205,10 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) { presentation_keys(app, ctx, escape_pair); return; } + let escape_ended_gesture = crate::canvas::ruler_origin_dragging(ctx) || crate::tools_float::escape_cancelled_move(ctx); let typing = ctx.egui_wants_keyboard_input(); // Escape closes Edit Toolbar's drawer first (egui drops a drag from it on Escape already). - if app.ui.tools_drawer && !typing && ctx.input_mut(|i| i.consume_key(Modifiers::NONE, Key::Escape)) { + if app.ui.tools_drawer && !typing && !escape_ended_gesture && ctx.input_mut(|i| i.consume_key(Modifiers::NONE, Key::Escape)) { app.ui.tools_drawer = false; } let view = app.view_info(); @@ -248,7 +249,7 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) { ctx.input_mut(|i| i.consume_key(Modifiers::NONE, k)); ctx.input_mut(|i| i.consume_key(Modifiers::SHIFT, k)); } - if k == Key::Escape && !busy && !claimed { + if k == Key::Escape && !busy && !claimed && !escape_ended_gesture { if app.session.active().is_some_and(|d| d.doc.pattern_edit.is_some()) { let _ = app.run("object.pattern.done", json!({})); } else if app.session.active().is_some_and(|d| d.isolation.is_some()) { @@ -264,8 +265,6 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) { } else if matches!(app.ui.screen_mode, 1 | 2) && !egui::Popup::is_any_open(ctx) && !text_focused_in_previous_frame(ctx) - && !crate::canvas::ruler_origin_dragging(ctx) - && !crate::tools_float::escape_cancelled_move(ctx) && ctx.input(|i| { i.events.iter().any(|e| { matches!(e, egui::Event::Key { key: Key::Escape, pressed: true, repeat: false, modifiers, .. } if *modifiers == Modifiers::NONE) diff --git a/crates/ui-egui/src/shortcuts/presentation.rs b/crates/ui-egui/src/shortcuts/presentation.rs index c93ca762e8..da746cbf5f 100644 --- a/crates/ui-egui/src/shortcuts/presentation.rs +++ b/crates/ui-egui/src/shortcuts/presentation.rs @@ -34,13 +34,14 @@ pub(super) fn escape_press(ctx: &egui::Context) -> Option { } /// Does this Escape reset the view's rotation? It does when the view is rotated, no popup is open, -/// the ruler origin is not being dragged, and the press is the second of a pair (`second`) or the -/// Rotate View tool is chosen. +/// neither a ruler-origin drag nor a floating Tools move is ending, and the press is the second of +/// a pair (`second`) or the Rotate View tool is chosen. pub(super) fn escape_resets_rotation(app: &VectorcraftApp, ctx: &egui::Context, second: bool) -> bool { app.view().is_some_and(|v| v.rotation != 0.0) && (second || app.session.tool_id() == "rotateView") && !egui::Popup::is_any_open(ctx) && !crate::canvas::ruler_origin_dragging(ctx) + && !crate::tools_float::escape_cancelled_move(ctx) } /// The keys in Presentation Mode, where nothing is edited: Escape leaves the mode, and ← and → go to diff --git a/crates/ui-egui/src/tests/screenmode.rs b/crates/ui-egui/src/tests/screenmode.rs index 1217684225..3d6cc8dd63 100644 --- a/crates/ui-egui/src/tests/screenmode.rs +++ b/crates/ui-egui/src/tests/screenmode.rs @@ -80,6 +80,80 @@ fn in_screen_mode(ctx: &egui::Context, mode: u8) -> VectorcraftApp { app } +fn begin_tools_move(app: &mut VectorcraftApp, ctx: &egui::Context) -> (Option<[f32; 2]>, egui::Pos2) { + app.run("window.panel.float", json!({"panel": "tools", "x": 120, "y": 140})).unwrap(); + frame(app, ctx, vec![]); + frame(app, ctx, vec![]); + let original = app.ui.toolbar_pos; + let area = ctx.memory(|m| m.area_rect(egui::Id::unique("toolbar-floating"))).expect("the floating Tools area"); + let title = area.min + egui::vec2(20.0, 17.0); + let to = title + egui::vec2(100.0, 80.0); + let button = |pos, pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(app, ctx, vec![egui::Event::PointerMoved(title), button(title, true)]); + for step in 1..=6 { + frame(app, ctx, vec![egui::Event::PointerMoved(title + (to - title) * (step as f32 / 6.0))]); + } + assert_ne!(app.ui.toolbar_pos, original, "the Tools panel moved"); + (original, to) +} + +fn begin_ruler_origin_drag(app: &mut VectorcraftApp, ctx: &egui::Context) -> egui::Pos2 { + app.ui.view.rulers = true; + frame(app, ctx, vec![]); + let corner = ctx.read_response(egui::Id::unique("ruler-corner")).expect("the rulers' corner").rect.center(); + let to = app.canvas_rect.unwrap().center(); + let button = |pos, pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; + frame(app, ctx, vec![egui::Event::PointerMoved(corner)]); + frame(app, ctx, vec![button(corner, true)]); + frame(app, ctx, vec![egui::Event::PointerMoved(to)]); + assert!(crate::canvas::ruler_origin_dragging(ctx)); + to +} + +fn release_drag(app: &mut VectorcraftApp, ctx: &egui::Context, to: egui::Pos2) { + frame( + app, + ctx, + vec![egui::Event::PointerButton { pos: to, button: egui::PointerButton::Primary, pressed: false, modifiers: Default::default() }], + ); +} + +fn start_escape_action(app: &mut VectorcraftApp, ctx: &egui::Context, action: &str) { + match action { + "drawer" => app.ui.tools_drawer = true, + "pattern" => { + app.run("object.pattern.make", json!({"name": "Dots", "width": 20, "height": 20})).unwrap(); + } + "isolation" => { + app.run("shape.rectangle", json!({"x": 130, "y": 40, "width": 20, "height": 20})).unwrap(); + app.run("select.all", json!({})).unwrap(); + app.run("object.group", json!({})).unwrap(); + app.run("object.isolate", json!({})).unwrap(); + } + "global" => { + app.run("shape.rectangle", json!({"x": 130, "y": 40, "width": 20, "height": 20})).unwrap(); + app.run("select.globalEdit", json!({})).unwrap(); + } + "flyout" => { + app.ui.flyout = Some(0); + ctx.data_mut(|d| d.insert_temp(egui::Id::unique("flyout-tools"), vec!["selection".to_string(), "directSelection".to_string()])); + } + _ => panic!("unknown Escape action"), + } + assert!(escape_action_active(app, action), "{action} starts"); +} + +fn escape_action_active(app: &VectorcraftApp, action: &str) -> bool { + match action { + "drawer" => app.ui.tools_drawer, + "pattern" => app.session.active().unwrap().doc.pattern_edit.is_some(), + "isolation" => app.session.active().unwrap().isolation.is_some(), + "global" => app.session.active().unwrap().global_edit.is_some(), + "flyout" => app.ui.flyout.is_some(), + _ => false, + } +} + #[test] fn escape_leaves_both_full_screen_modes_without_editing() { for mode in [1, 2] { @@ -200,6 +274,68 @@ fn a_floating_tools_move_takes_escape_before_full_screen_exits() { } } +#[test] +fn cancelling_tools_move_keeps_rotation_in_both_full_screen_modes() { + for mode in [1, 2] { + for tool in ["rotateView", "selection"] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + app.select_tool(tool); + app.run("view.rotate", json!({"angle": 30})).unwrap(); + if tool == "selection" { + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "first Escape leaves mode {mode}"); + assert_eq!(app.view().unwrap().rotation, 30.0); + } + let (original, to) = begin_tools_move(&mut app, &ctx); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.toolbar_pos, original, "{tool} in mode {mode}"); + assert_eq!(app.view().unwrap().rotation, 30.0, "{tool} in mode {mode}"); + release_drag(&mut app, &ctx, to); + frame(&mut app, &ctx, escape()); + assert_eq!(app.view().unwrap().rotation, 0.0, "later Escape resets rotation"); + } + } +} + +#[test] +fn cancelling_tools_move_keeps_the_next_escape_action() { + for mode in [0, 1, 2] { + for action in ["drawer", "pattern", "isolation", "global", "flyout"] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + let (original, to) = begin_tools_move(&mut app, &ctx); + start_escape_action(&mut app, &ctx, action); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.toolbar_pos, original, "move cancelled in mode {mode}, {action}"); + assert!(escape_action_active(&app, action), "Escape keeps {action} in mode {mode}"); + assert_eq!(app.ui.screen_mode, mode, "mode {mode}, {action}"); + release_drag(&mut app, &ctx, to); + frame(&mut app, &ctx, escape()); + assert!(!escape_action_active(&app, action), "later Escape ends {action} in mode {mode}"); + } + } +} + +#[test] +fn cancelling_ruler_origin_drag_keeps_the_next_escape_action() { + for mode in [0, 1, 2] { + for action in ["pattern", "isolation", "flyout"] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + let to = begin_ruler_origin_drag(&mut app, &ctx); + start_escape_action(&mut app, &ctx, action); + frame(&mut app, &ctx, escape()); + assert!(escape_action_active(&app, action), "Escape keeps {action} in mode {mode}"); + assert_eq!(app.ui.screen_mode, mode, "mode {mode}, {action}"); + release_drag(&mut app, &ctx, to); + assert!(!crate::canvas::ruler_origin_dragging(&ctx)); + frame(&mut app, &ctx, escape()); + assert!(!escape_action_active(&app, action), "later Escape ends {action} in mode {mode}"); + } + } +} + #[test] fn a_popup_takes_escape_before_full_screen_exits() { let ctx = egui::Context::default(); From d792557bbe14588e79f61dc3d2698f663bba9464 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 11:53:07 -0700 Subject: [PATCH 081/227] View: Escape during a canvas pan or zoom drag keeps full screen A Hand or Space drag, a middle-button pan, a Zoom tool drag, a Rotate View drag or a touch gesture is held in the canvas's drag state, which the tool busy check does not see. Escape pressed while one is held no longer leaves Full Screen Mode, closes the Edit Toolbar drawer or ends another action; an Escape after the release does. --- crates/ui-egui/src/canvas.rs | 5 +++ crates/ui-egui/src/shortcuts.rs | 7 ++-- crates/ui-egui/src/tests/screenmode.rs | 48 ++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 58815f2e7f..cd2a142be3 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -164,6 +164,11 @@ enum Drag { Present, } +/// Whether the canvas is holding a pointer drag across frames. +pub(crate) fn dragging(ctx: &egui::Context) -> bool { + ctx.data(|d| d.get_temp::(drag_id()).is_some()) +} + /// Paint the document canvas, complete or cached artwork, navigation and tool overlays. pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let t = Tokens::get(ui.ctx()); diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index d8a238ed15..9f3a705152 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -205,10 +205,11 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) { presentation_keys(app, ctx, escape_pair); return; } - let escape_ended_gesture = crate::canvas::ruler_origin_dragging(ctx) || crate::tools_float::escape_cancelled_move(ctx); + let escape_held_by_drag = + crate::canvas::dragging(ctx) || crate::canvas::ruler_origin_dragging(ctx) || crate::tools_float::escape_cancelled_move(ctx); let typing = ctx.egui_wants_keyboard_input(); // Escape closes Edit Toolbar's drawer first (egui drops a drag from it on Escape already). - if app.ui.tools_drawer && !typing && !escape_ended_gesture && ctx.input_mut(|i| i.consume_key(Modifiers::NONE, Key::Escape)) { + if app.ui.tools_drawer && !typing && !escape_held_by_drag && ctx.input_mut(|i| i.consume_key(Modifiers::NONE, Key::Escape)) { app.ui.tools_drawer = false; } let view = app.view_info(); @@ -249,7 +250,7 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context) { ctx.input_mut(|i| i.consume_key(Modifiers::NONE, k)); ctx.input_mut(|i| i.consume_key(Modifiers::SHIFT, k)); } - if k == Key::Escape && !busy && !claimed && !escape_ended_gesture { + if k == Key::Escape && !busy && !claimed && !escape_held_by_drag { if app.session.active().is_some_and(|d| d.doc.pattern_edit.is_some()) { let _ = app.run("object.pattern.done", json!({})); } else if app.session.active().is_some_and(|d| d.isolation.is_some()) { diff --git a/crates/ui-egui/src/tests/screenmode.rs b/crates/ui-egui/src/tests/screenmode.rs index 3d6cc8dd63..783577ed42 100644 --- a/crates/ui-egui/src/tests/screenmode.rs +++ b/crates/ui-egui/src/tests/screenmode.rs @@ -223,6 +223,54 @@ fn a_tool_drag_takes_escape_before_full_screen_exits() { assert_eq!(app.ui.screen_mode, 0); } +fn navigation_drag_keeps_screen_mode(kind: &str) { + for mode in [1, 2] { + let ctx = egui::Context::default(); + let mut app = in_screen_mode(&ctx, mode); + let button = match kind { + "hand" => { + app.select_tool("hand"); + egui::PointerButton::Primary + } + "middle" => egui::PointerButton::Middle, + "zoom_box" => { + app.select_tool("zoom"); + app.session.prefs.animated_zoom = false; + egui::PointerButton::Primary + } + _ => panic!("unknown navigation drag"), + }; + frame(&mut app, &ctx, vec![]); + let start = app.canvas_rect.unwrap().center(); + let end = start + egui::vec2(35.0, 20.0); + let pointer = |pos, pressed| egui::Event::PointerButton { pos, button, pressed, modifiers: Default::default() }; + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(start), pointer(start, true)]); + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(end)]); + assert!(crate::canvas::dragging(&ctx), "{kind} drag began in mode {mode}"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, mode, "{kind} drag holds Escape in mode {mode}"); + frame(&mut app, &ctx, vec![pointer(end, false)]); + assert!(!crate::canvas::dragging(&ctx), "{kind} drag ended in mode {mode}"); + frame(&mut app, &ctx, escape()); + assert_eq!(app.ui.screen_mode, 0, "Escape after {kind} drag in mode {mode}"); + } +} + +#[test] +fn a_hand_drag_keeps_both_full_screen_modes_until_release() { + navigation_drag_keeps_screen_mode("hand"); +} + +#[test] +fn a_middle_button_pan_keeps_both_full_screen_modes_until_release() { + navigation_drag_keeps_screen_mode("middle"); +} + +#[test] +fn a_zoom_box_drag_keeps_both_full_screen_modes_until_release() { + navigation_drag_keeps_screen_mode("zoom_box"); +} + #[test] fn a_ruler_origin_drag_takes_escape_before_full_screen_exits() { for mode in [1, 2] { From a535d7b890ed6854657d7a3e033b7fc95780ecf9 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 07:39:07 -0700 Subject: [PATCH 082/227] Panels: a second press of a panel's function key hides the panel The function key shortcuts for Brushes, Color, Layers, Info, Gradient, Stroke, Attributes, Graphic Styles, Appearance, Align, Transform, Pathfinder, Transparency and Symbols now run window.panel with toggle: true, as the Window menu items do. A second press hides an active panel in the expanded dock, and the next press restores it in its group. A chord the user assigns to one of these panels toggles the same way. Plain window.panel calls still only show the panel. --- crates/ui-egui/src/menus/run.rs | 4 +- crates/ui-egui/src/panel_docking/tests.rs | 118 ++++++++++++++++++++++ crates/ui-egui/src/shortcuts.rs | 35 ++++++- crates/ui-egui/src/shortcuts/tests.rs | 24 +++++ docs/target-app-parity.md | 1 + 5 files changed, 177 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 339682c94a..f31c50c40e 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -40,8 +40,8 @@ pub fn check_params(session: &vectorcraft_engine::Session, id: &str, params: &Va /// handles its own way (a Window menu panel item that toggles, …) → `None` to leave it to the /// engine. pub fn run_ui_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option> { - // The Window menu's panel items toggle like its other checked items (#2361); the panel's - // other ways in (shortcuts, Show Properties Panel, a tool's double-click) only show it. + // Window menu items and the named panel function keys toggle against the checked state; + // other commands that open panels show them. if id == "window.panel" && p.get("toggle").and_then(Value::as_bool) == Some(true) && checked(app, id, p) == Some(true) { let panel = p.get("panel").and_then(Value::as_str).and_then(normalize_panel).unwrap_or_default(); if app.ui.open_panel.as_deref() == Some(panel) { diff --git a/crates/ui-egui/src/panel_docking/tests.rs b/crates/ui-egui/src/panel_docking/tests.rs index 4bb77928be..f72a433cf3 100644 --- a/crates/ui-egui/src/panel_docking/tests.rs +++ b/crates/ui-egui/src/panel_docking/tests.rs @@ -63,6 +63,11 @@ impl Harness { self.frame(vec![]); } + fn press(&mut self, key: egui::Key, modifiers: egui::Modifiers) { + self.frame(vec![Event::ModifiersChanged(modifiers), Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers }]); + self.frame(vec![Event::Key { key, physical_key: None, pressed: false, repeat: false, modifiers }]); + } + /// Press at `from` and move to `to` in steps, holding the button. fn press_and_move(&mut self, from: Pos2, to: Pos2) { self.frame(vec![Event::PointerMoved(from), button(from, true)]); @@ -497,3 +502,116 @@ fn window_menu_panels_without_a_place_open_in_their_icon_group_or_float() { h.frame(vec![]); assert!(h.tab("openType").is_some()); } + +#[test] +fn f7_hides_and_restores_the_expanded_layers_tab() { + let mut h = Harness::new(); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(showing(&h.app.ui, "layers"), "the first press activates the tab"); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(!showing(&h.app.ui, "layers"), "a second press hides the active tab"); + assert!(h.app.ui.docking_hidden.contains_key("layers")); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(showing(&h.app.ui, "layers"), "the next press restores it"); + assert_eq!(main_panels(&h.layout()), ["properties", "layers", "libraries"]); + + h.app.run("window.panel.collapse", json!({"panel": "layers", "collapsed": true})).unwrap(); + let layout = h.layout(); + let group = dock_columns(&layout).iter().flat_map(|c| &c.groups).find(|g| g.panels.contains(&"layers".to_string())).unwrap(); + assert!(group.minimized); + h.press(egui::Key::F7, egui::Modifiers::NONE); + let layout = h.layout(); + let group = dock_columns(&layout).iter().flat_map(|c| &c.groups).find(|g| g.panels.contains(&"layers".to_string())).unwrap(); + assert!(!group.minimized, "the first press expands a collapsed group"); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(!showing(&h.app.ui, "layers"), "the following press hides the expanded group"); +} + +#[test] +fn f7_activates_a_background_tab_before_hiding_it() { + let mut h = Harness::new(); + h.app.run("window.panel.move", json!({"panel": "layers", "anchor": "properties"})).unwrap(); + h.app.run("window.panel.activate", json!({"panel": "properties"})).unwrap(); + assert!(!showing(&h.app.ui, "layers")); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(showing(&h.app.ui, "layers")); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(!h.layout().contains(&"layers".to_string())); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(showing(&h.app.ui, "layers")); + assert_eq!(group_of(&h.layout(), &"layers".into()), vec!["properties".to_string(), "libraries".into(), "layers".into()]); +} + +#[test] +fn panel_function_keys_toggle_icon_flyouts_and_floating_groups() { + let mut h = Harness::new(); + h.press(egui::Key::F5, egui::Modifiers::NONE); + assert_eq!(h.app.ui.open_panel.as_deref(), Some("brushes")); + h.press(egui::Key::F5, egui::Modifiers::NONE); + assert_eq!(h.app.ui.open_panel, None); + h.press(egui::Key::F5, egui::Modifiers::NONE); + assert_eq!(h.app.ui.open_panel.as_deref(), Some("brushes")); + + h.app.run("window.panel.float", json!({"panel": "layers"})).unwrap(); + h.frame(vec![]); + let rect = floating_window(&h.layout(), "layers").unwrap().rect; + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(floating_window(&h.layout(), "layers").is_none()); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert_eq!(floating_window(&h.layout(), "layers").unwrap().rect, rect); + h.app.run("window.panel.dock", json!({"panel": "layers"})).unwrap(); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(!showing(&h.app.ui, "layers"), "the expanded dock also toggles"); +} + +#[test] +fn other_function_keys_and_keyboard_guards_keep_their_routes() { + let mut h = Harness::new(); + h.app.run("window.panel", json!({"panel": "layers"})).unwrap(); + let keymap = crate::shortcut_editor::current(); + for (chord, command) in [("F8", "ui.symbolOptions"), ("F12", "file.revert")] { + let bound = crate::keymap::vc_chord(chord).and_then(|c| crate::keymap::lookup(&keymap.keymap, &c)).unwrap(); + assert_eq!(bound.id, command); + } + h.app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap(); + h.press(egui::Key::F8, egui::Modifiers::NONE); + assert_eq!(h.app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some("symbolOptions")); + crate::dialogs::confirm(&mut h.app).unwrap(); + assert_eq!(h.app.session.doc().unwrap().doc.symbols.len(), 1); + crate::menus::invoke(&mut h.app, "view.rotate", json!({})); + assert!(h.app.ui.dialog.is_some()); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(showing(&h.app.ui, "layers"), "F7 does nothing while a dialog is open"); + h.app.ui.dialog = None; + + let field = egui::Id::unique("panel-shortcut-text-focus"); + h.ctx.memory_mut(|m| m.request_focus(field)); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(showing(&h.app.ui, "layers"), "F7 does nothing while a text field has focus"); + h.ctx.memory_mut(|m| m.surrender_focus(field)); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(!showing(&h.app.ui, "layers"), "F7 toggles when the field releases focus"); + + let dir = vectorcraft_testkit::temp_dir("panel-shortcut-revert"); + let path = dir.join(format!("panel-shortcut-revert-{}.vectorcraft", std::process::id())); + let services = crate::Services { + read: Some(Box::new(|p| std::fs::read(p).map_err(|e| e.to_string()))), + write: Some(Box::new(|p, data| std::fs::write(p, data).map_err(|e| e.to_string()))), + ..Default::default() + }; + let mut saved = VectorcraftApp::new(Session::new(), services); + saved.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + saved.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap(); + saved.run("file.saveAs", json!({"path": path.to_string_lossy()})).unwrap(); + saved.run("shape.rectangle", json!({"x": 40, "y": 40, "width": 20, "height": 20})).unwrap(); + assert_eq!(saved.session.doc().unwrap().doc.node_count(), 3); + let ctx = egui::Context::default(); + let key = Event::Key { key: egui::Key::F12, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE }; + ctx.run_ui(egui::RawInput { events: vec![key], ..Default::default() }, |ui| crate::shortcuts::handle(&mut saved, ui.ctx())) + .textures_delta + .clear(); + assert_eq!(saved.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some(crate::dialogs::confirm::KIND)); + crate::dialogs::confirm(&mut saved).unwrap(); + assert_eq!(saved.session.doc().unwrap().doc.node_count(), 2, "F12 reloads the saved document"); + std::fs::remove_dir_all(dir).unwrap(); +} diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 9f3a705152..5724f4d413 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -381,7 +381,7 @@ fn single_key_shortcuts(app: &mut VectorcraftApp, ctx: &egui::Context) { None if hit.params.is_null() => { let _ = app.run(&hit.id, json!({})); } - None => crate::menus::invoke(app, &hit.id, hit.params.clone()), + None => crate::menus::invoke(app, &hit.id, shortcut_params(hit)), } } } @@ -729,6 +729,36 @@ fn dispatch(app: &mut VectorcraftApp, ctx: &egui::Context, accept: impl FnMut(&H }) } +/// Params used when a shortcut invokes its command. The named panel function keys retain their +/// toggle action when their bindings are reassigned. +fn shortcut_params(c: &CommandRef) -> serde_json::Value { + let mut params = if c.params.is_null() { json!({}) } else { c.params.clone() }; + if c.id == "window.panel" + && matches!( + params.get("panel").and_then(serde_json::Value::as_str), + Some( + "brushes" + | "color" + | "layers" + | "info" + | "gradient" + | "stroke" + | "attributes" + | "graphicStyles" + | "appearance" + | "align" + | "transform" + | "pathfinder" + | "transparency" + | "symbols" + ) + ) + { + params["toggle"] = json!(true); + } + params +} + /// Runs what a shortcut is bound to: a tool, a panel (`window.panel {panel}`) or a command. fn run_hit(app: &mut VectorcraftApp, ctx: &egui::Context, c: &CommandRef) { if let Some(tool) = c.id.strip_prefix("tool:") { @@ -738,8 +768,7 @@ fn run_hit(app: &mut VectorcraftApp, ctx: &egui::Context, c: &CommandRef) { // every artboard instead of the art. crate::panels::artboards::select_all(app); } else { - let p = if c.params.is_null() { json!({}) } else { c.params.clone() }; - crate::menus::invoke(app, &c.id, p); + crate::menus::invoke(app, &c.id, shortcut_params(c)); } } diff --git a/crates/ui-egui/src/shortcuts/tests.rs b/crates/ui-egui/src/shortcuts/tests.rs index 62686d34d1..703d28f3f1 100644 --- a/crates/ui-egui/src/shortcuts/tests.rs +++ b/crates/ui-egui/src/shortcuts/tests.rs @@ -1,5 +1,29 @@ use super::*; +#[test] +fn rebound_layers_chord_toggles_and_plain_panel_command_reveals() { + let mut overrides = craft_keymap::Overrides::new(); + crate::keymap::set_override(&mut overrides, "panel:layers", "Cmd+Alt+Shift+F7"); + let keymap = crate::keymap::keymap_with(&overrides); + let old = crate::keymap::vc_chord("F7").unwrap(); + assert!(crate::keymap::lookup(&keymap, &old).is_none(), "the old F7 is free"); + let rebound = crate::keymap::vc_chord("Cmd+Alt+Shift+F7").unwrap(); + let hit = crate::keymap::lookup(&keymap, &rebound).unwrap(); + assert_eq!(hit.id, "window.panel"); + assert_eq!(hit.params["panel"], "layers"); + + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + app.run("window.panel", json!({"panel": "layers"})).unwrap(); + let ctx = egui::Context::default(); + run_hit(&mut app, &ctx, &hit); + assert_eq!(crate::menus::checked(&app, "window.panel", &json!({"panel": "layers"})), Some(false)); + run_hit(&mut app, &ctx, &hit); + assert_eq!(crate::menus::checked(&app, "window.panel", &json!({"panel": "layers"})), Some(true)); + app.run("window.panel", json!({"panel": "layers"})).unwrap(); + assert_eq!(crate::menus::checked(&app, "window.panel", &json!({"panel": "layers"})), Some(true), "a plain command still reveals"); +} + /// One headless frame delivering `events` to the shortcut handler. fn frame(app: &mut VectorcraftApp, events: Vec) -> egui::FullOutput { let ctx = egui::Context::default(); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index cbf1e4590c..4172d15fe3 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -611,6 +611,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Tab shows and hides the panels (in the Type tool it types a tab) without moving the keyboard focus onto a field, so the next shortcut or letter still works; in dialogs and panel fields it moves between fields. - Shift+Tab (`window.panels`) shows and hides the dock and the floating panels and leaves the toolbar and the Control bar as they are; hiding the panels with Tab or Shift+Tab also closes a panel popped out of the icon column. - The second Tab (`window.dock`) shows again only the bars the first Tab hid, after a restart too: a Control bar that was off stays off, a toolbar hidden with Window › Tools stays hidden, and panels shown with Shift+Tab in between stay shown. + - The function key shortcuts for Brushes, Color, Layers, Info, Gradient, Stroke, Attributes, Graphic Styles, Appearance, Align, Transform, Pathfinder, Transparency, and Symbols hide an active panel on a second press and restore it on the next press, using the same visibility state as the Window menu. A reassigned chord keeps that behavior. - Cmd/Ctrl+A follows the keyboard: in a panel, dialog or search field it selects the field's text, while the Type tool edits it selects all of that text (also `select.all` over MCP), and only otherwise every object. On macOS the menu bar's Select All, Cut, Copy and Paste (keys or clicks) act on a focused field too, and elsewhere the in-window menus' do: the field that had the keyboard when the menu opened gets them, with its selection, and the keyboard back (#516). Not yet: Select All across threaded frames (one frame's text is selected). - While the Type tool edits text, a character typed with AltGr is typed and runs no command. Firefox on Windows reports AltGr as Ctrl and Alt held, so in the web build AltGr+L (ł on a Polish layout) does not also open Layer Options for a new layer, and AltGr+Q (@ on a German layout) does not also run Reset Tracking and Kerning. A Ctrl+Alt chord that types no character runs its command. - With the Artboard tool, Cmd/Ctrl+A after a click on a row of the Artboards panel selects every artboard, as the macOS menu bar's Select All does then; the active artboard stays active, and the art's selection does not change. After a press outside the panel's list, Cmd/Ctrl+A selects every object again. It used to select every object after a click in the panel too. Public reference: [Select artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/select-artboards.html). From 78b01044fc9dd89978bdb2caf628271d857b19b3 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 10:56:01 -0700 Subject: [PATCH 083/227] Panels: a panel's function key hides and restores its whole group When Brushes, Color, Layers, Info, Gradient, Stroke, Attributes, Graphic Styles, Appearance, Align, Transform, Pathfinder, Transparency or Symbols is in front of an expanded dock group or a floating group, its function key now hides the whole group instead of closing only that tab. The next press brings the group back in the same place with every tab and the panel in front, and Window > a hidden sibling also restores the group. A background tab still comes to the front on the first press, and in an icon column the key opens and closes the flyout. Other panel shortcuts and plain window.panel calls keep their behavior. --- crates/ui-egui/src/menus/run.rs | 3 ++ crates/ui-egui/src/panel_docking.rs | 42 ++++++++++++++++++ crates/ui-egui/src/panel_docking/tests.rs | 53 ++++++++++++++++++++++- crates/ui-egui/src/shortcuts.rs | 1 + crates/ui-egui/src/shortcuts/tests.rs | 38 ++++++++++++++++ docs/target-app-parity.md | 2 +- docs/ui-parity.md | 2 +- 7 files changed, 137 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index f31c50c40e..8eff1fc12f 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -48,6 +48,9 @@ pub fn run_ui_command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option Result if !layout.contains(&panel.to_string()) && !app.ui.docking_hidden.contains_key(panel) && crate::panels::library_panel::parse(panel).is_some() { return crate::panels::library_panel::float(app, panel); } + if app.ui.docking_hidden.contains_key(panel) { + return restore_hidden_group(app, panel); + } let value = shared_command(app, "window.panel.activate", &json!({"panel": panel}))?; let layout = layout_of(&app.ui); Ok(match floating_window(&layout, panel) { @@ -345,6 +348,45 @@ fn show_panel(app: &mut VectorcraftApp, params: &Value) -> Result }) } +/// Hides the group holding an active panel and records each tab's return location. +pub(crate) fn hide_group(app: &mut VectorcraftApp, panel: &str) -> Result { + let mut txn = Transaction::begin(app)?; + let panel = panel.to_string(); + let closed = txn.apply(Action::CloseGroup { panel })?; + Ok(txn.commit(app, closed, None)) +} + +/// Reopens the hidden tabs connected to `panel` and brings it to the front. +fn restore_hidden_group(app: &mut VectorcraftApp, panel: &str) -> Result { + let mut txn = Transaction::begin(app)?; + let mut root = panel.to_string(); + for _ in 0..craft_ui::docking::MAX_PANELS { + let Some((_, location)) = txn.workspace.hidden.iter().find(|(id, _)| id == &root) else { break }; + let Some(anchor) = location.anchor.as_ref().filter(|_| matches!(location.placement, Placement::Tab { .. })) else { break }; + if !txn.workspace.hidden.iter().any(|(id, _)| id == anchor) || anchor == &root { + break; + } + root = anchor.clone(); + } + let mut members = vec![root]; + for _ in 0..craft_ui::docking::MAX_PANELS { + let next = txn.workspace.hidden.iter().find_map(|(id, location)| { + (matches!(location.placement, Placement::Tab { .. }) + && location.anchor.as_ref().is_some_and(|anchor| members.contains(anchor)) + && !members.contains(id)) + .then(|| id.clone()) + }); + let Some(next) = next else { break }; + members.push(next); + } + for member in members { + let fallback = first_dock_panel(&txn.workspace.layout, &member); + txn.workspace.set_visible(member, true, fallback, model_permissions).map_err(|e| e.to_string())?; + } + txn.apply(Action::Activate { panel: panel.to_string() })?; + Ok(txn.commit(app, Vec::new(), Some(panel.to_string()))) +} + /// Show `panel` as `window.panel` does, but leave it be when it already shows ([`showing`]): a /// command that opens a panel to work in (Edit › Color Settings…) never puts it away. pub(crate) fn reveal_panel(app: &mut VectorcraftApp, panel: &str) -> Result { diff --git a/crates/ui-egui/src/panel_docking/tests.rs b/crates/ui-egui/src/panel_docking/tests.rs index f72a433cf3..fe25133d24 100644 --- a/crates/ui-egui/src/panel_docking/tests.rs +++ b/crates/ui-egui/src/panel_docking/tests.rs @@ -536,10 +536,59 @@ fn f7_activates_a_background_tab_before_hiding_it() { h.press(egui::Key::F7, egui::Modifiers::NONE); assert!(showing(&h.app.ui, "layers")); h.press(egui::Key::F7, egui::Modifiers::NONE); - assert!(!h.layout().contains(&"layers".to_string())); + assert!(["properties", "layers", "libraries"].iter().all(|panel| !h.layout().contains(&panel.to_string()))); h.press(egui::Key::F7, egui::Modifiers::NONE); assert!(showing(&h.app.ui, "layers")); - assert_eq!(group_of(&h.layout(), &"layers".into()), vec!["properties".to_string(), "libraries".into(), "layers".into()]); + assert_eq!(group_of(&h.layout(), &"layers".into()), vec!["properties".to_string(), "layers".into(), "libraries".into()]); +} + +#[test] +fn f7_hides_and_restores_the_whole_expanded_group() { + let mut h = Harness::new(); + h.press(egui::Key::F7, egui::Modifiers::NONE); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(["properties", "layers", "libraries"].iter().all(|panel| !h.layout().contains(&panel.to_string()))); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert_eq!(group_of(&h.layout(), &"layers".into()), ["properties", "layers", "libraries"]); + assert!(showing(&h.app.ui, "layers")); + h.press(egui::Key::F7, egui::Modifiers::NONE); + h.app.run("window.panel", json!({"panel": "properties", "toggle": true})).unwrap(); + assert_eq!(group_of(&h.layout(), &"properties".into()), ["properties", "layers", "libraries"]); + assert!(showing(&h.app.ui, "properties")); +} + +#[test] +fn f7_hides_and_restores_a_floating_tab_group() { + let mut h = Harness::new(); + h.app.run("window.panel.float", json!({"panel": "layers", "group": true})).unwrap(); + h.app.run("window.panel.activate", json!({"panel": "layers"})).unwrap(); + h.frame(vec![]); + let before = h.layout(); + let window = floating_window(&before, "layers").unwrap(); + let rect = window.rect; + assert_eq!(group_of(&before, &"layers".into()), ["properties", "layers", "libraries"]); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert!(floating_window(&h.layout(), "layers").is_none()); + assert!(["properties", "layers", "libraries"].iter().all(|panel| !h.layout().contains(&panel.to_string()))); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert_eq!(floating_window(&h.layout(), "layers").unwrap().rect, rect); + assert_eq!(group_of(&h.layout(), &"layers".into()), ["properties", "layers", "libraries"]); + assert!(showing(&h.app.ui, "layers")); +} + +#[test] +fn f7_toggles_a_multi_tab_icon_flyout() { + let mut h = Harness::new(); + h.app.run("window.collapseDock", json!({"collapsed": true})).unwrap(); + h.frame(vec![]); + assert!(in_iconic_column(&h.layout(), "layers")); + assert_eq!(group_of(&h.layout(), &"layers".into()), ["properties", "layers", "libraries"]); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert_eq!(h.app.ui.open_panel.as_deref(), Some("layers")); + h.press(egui::Key::F7, egui::Modifiers::NONE); + assert_eq!(h.app.ui.open_panel, None); + assert!(in_iconic_column(&h.layout(), "layers")); + assert_eq!(group_of(&h.layout(), &"layers".into()), ["properties", "layers", "libraries"]); } #[test] diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index 5724f4d413..00249145d8 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -755,6 +755,7 @@ fn shortcut_params(c: &CommandRef) -> serde_json::Value { ) { params["toggle"] = json!(true); + params["toggleGroup"] = json!(true); } params } diff --git a/crates/ui-egui/src/shortcuts/tests.rs b/crates/ui-egui/src/shortcuts/tests.rs index 703d28f3f1..a8f9b08c16 100644 --- a/crates/ui-egui/src/shortcuts/tests.rs +++ b/crates/ui-egui/src/shortcuts/tests.rs @@ -1,5 +1,43 @@ use super::*; +#[test] +fn named_panel_default_chords_toggle_their_panels() { + let keymap = crate::keymap::keymap_with(&craft_keymap::Overrides::new()); + for (panel, chord) in [ + ("brushes", "F5"), + ("color", "F6"), + ("layers", "F7"), + ("graphicStyles", "Shift+F5"), + ("appearance", "Shift+F6"), + ("align", "Shift+F7"), + ("transform", "Shift+F8"), + ("info", "Cmd+F8"), + ("gradient", "Cmd+F9"), + ("pathfinder", "Cmd+Shift+F9"), + ("stroke", "Cmd+F10"), + ("transparency", "Cmd+Shift+F10"), + ("attributes", "Cmd+F11"), + ("symbols", "Cmd+Shift+F11"), + ] { + let chord = crate::keymap::vc_chord(chord).unwrap(); + let hit = crate::keymap::lookup(&keymap, &chord).unwrap(); + assert_eq!(hit.id, "window.panel"); + assert_eq!(hit.params["panel"], panel); + assert_eq!(shortcut_params(&hit)["toggle"], true); + assert_eq!(shortcut_params(&hit)["toggleGroup"], true); + } +} + +#[test] +fn other_panel_shortcuts_keep_plain_panel_params() { + for panel in ["character", "swatches"] { + let hit = CommandRef { id: "window.panel".into(), params: json!({"panel": panel}) }; + let params = shortcut_params(&hit); + assert!(params.get("toggle").is_none(), "{panel} gained toggle"); + assert!(params.get("toggleGroup").is_none(), "{panel} gained toggleGroup"); + } +} + #[test] fn rebound_layers_chord_toggles_and_plain_panel_command_reveals() { let mut overrides = craft_keymap::Overrides::new(); diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 4172d15fe3..55ad521f91 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -611,7 +611,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Tab shows and hides the panels (in the Type tool it types a tab) without moving the keyboard focus onto a field, so the next shortcut or letter still works; in dialogs and panel fields it moves between fields. - Shift+Tab (`window.panels`) shows and hides the dock and the floating panels and leaves the toolbar and the Control bar as they are; hiding the panels with Tab or Shift+Tab also closes a panel popped out of the icon column. - The second Tab (`window.dock`) shows again only the bars the first Tab hid, after a restart too: a Control bar that was off stays off, a toolbar hidden with Window › Tools stays hidden, and panels shown with Shift+Tab in between stay shown. - - The function key shortcuts for Brushes, Color, Layers, Info, Gradient, Stroke, Attributes, Graphic Styles, Appearance, Align, Transform, Pathfinder, Transparency, and Symbols hide an active panel on a second press and restore it on the next press, using the same visibility state as the Window menu. A reassigned chord keeps that behavior. + - The function key shortcuts for Brushes, Color, Layers, Info, Gradient, Stroke, Attributes, Graphic Styles, Appearance, Align, Transform, Pathfinder, Transparency, and Symbols activate a background tab on the first press, hide its expanded dock or floating group when that tab is in front, and restore the group with all its tabs together on the next press; in an icon column they open and close the flyout while keeping the icons. A reassigned chord keeps that behavior, and Window > a hidden sibling restores the group. - Cmd/Ctrl+A follows the keyboard: in a panel, dialog or search field it selects the field's text, while the Type tool edits it selects all of that text (also `select.all` over MCP), and only otherwise every object. On macOS the menu bar's Select All, Cut, Copy and Paste (keys or clicks) act on a focused field too, and elsewhere the in-window menus' do: the field that had the keyboard when the menu opened gets them, with its selection, and the keyboard back (#516). Not yet: Select All across threaded frames (one frame's text is selected). - While the Type tool edits text, a character typed with AltGr is typed and runs no command. Firefox on Windows reports AltGr as Ctrl and Alt held, so in the web build AltGr+L (ł on a Polish layout) does not also open Layer Options for a new layer, and AltGr+Q (@ on a German layout) does not also run Reset Tracking and Kerning. A Ctrl+Alt chord that types no character runs its command. - With the Artboard tool, Cmd/Ctrl+A after a click on a row of the Artboards panel selects every artboard, as the macOS menu bar's Select All does then; the active artboard stays active, and the art's selection does not change. After a press outside the panel's list, Cmd/Ctrl+A selects every object again. It used to select every object after a click in the panel too. Public reference: [Select artboards](https://helpx.adobe.com/illustrator/desktop/create-manage-artboards/add-edit-artboards/select-artboards.html). diff --git a/docs/ui-parity.md b/docs/ui-parity.md index f56514e573..68f5227a11 100644 --- a/docs/ui-parity.md +++ b/docs/ui-parity.md @@ -248,7 +248,7 @@ selected objects, as the Appearance panel's Add New Fill and Add New Stroke butt ~110 distinct modified shortcuts on menu commands plus single-key tool shortcuts for the default toolbar (`crates/tools/src/catalog.rs`), a shortcut editor with chords, and saved sets. Cmd/Ctrl+Alt+L (`ui.newLayer`) opens Layer Options for a new layer, as an Alt-click on the Layers panel's New Layer button does, and Cmd/Ctrl+L still adds a layer without the dialog. F8 (`ui.symbolOptions`) opens Symbol Options for a new symbol made from the selection, as the Symbols panel's New Symbol button does. Not yet diffed item by item -against Illustrator's published default shortcut list; estimated ~70% of it. Remaining: the panel shortcuts, +against Illustrator's published default shortcut list; estimated ~70% of it. Remaining: other panel shortcuts, the type shortcuts (tracking/kerning/leading/baseline steps with Alt/Shift), and selection shortcuts in the Layers panel. The shortcut editor also lists the commands that are in no menu but run without parameters (Edit › Duplicate, panel-menu commands such as Break Link to Symbol), so they can be given shortcuts (#1539). It lists each button of the From 7a16e302d28593e71002ddb6a3418a93d3b824ec Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Fri, 30 Oct 2026 12:12:31 -0700 Subject: [PATCH 084/227] Panels: a panel's function key restores only the tabs its group hid Hiding a group with a panel's function key records the tabs it closed, and the next press reopens only that set with the panel in front. A tab closed on its own before the group was hidden, or reopened and closed again while the group was hidden, stays closed. The record is saved with the workspace. --- crates/ui-egui/src/panel_docking.rs | 42 ++++++++++------------ crates/ui-egui/src/panel_docking/tests.rs | 38 +++++++++++++++++++- crates/ui-egui/src/panels/library_panel.rs | 7 ++++ crates/ui-egui/src/state.rs | 4 +++ crates/ui-egui/src/workspaces.rs | 5 +++ 5 files changed, 72 insertions(+), 24 deletions(-) diff --git a/crates/ui-egui/src/panel_docking.rs b/crates/ui-egui/src/panel_docking.rs index 54f9666ad5..02a95cfd5b 100644 --- a/crates/ui-egui/src/panel_docking.rs +++ b/crates/ui-egui/src/panel_docking.rs @@ -353,38 +353,30 @@ pub(crate) fn hide_group(app: &mut VectorcraftApp, panel: &str) -> Result