Merge main into feat/3d-custom-bevels

This commit is contained in:
dotCooCoo committed 2026-11-13 00:10:20 -08:00
commit e1a5bb3795
103 files changed
+3522 -277

No files matched your search

Generated
+1
View File
@@ -6855,6 +6855,7 @@ dependencies = [
"serde",
"serde_json",
"toml",
"vectorcraft-apischema",
"vectorcraft-brush",
"vectorcraft-cad",
"vectorcraft-color",
+4 -4
View File
@@ -33,8 +33,8 @@ pub use inline::{SYMBOL_HALF, SYMBOL_SIZES};
pub use shared::Shared;
pub use symbol_export_type::{SYMBOL_EXPORT_TYPE, SymbolExportType};
pub use symbol_nine_slice::{
EditedNineSlice, MAX_SLICE_GROWTH, MIN_CENTER_BAND, NineSliceGuide, NineSliceMap, PAINTED_EFFECTS, SYMBOL_NINE_SLICE, SymbolNineSlice,
charge_symbol_art,
EditedNineSlice, MAX_GUIDE_FRACTION, MAX_SLICE_GROWTH, MIN_CENTER_BAND, NineSliceGuide, NineSliceMap, PAINTED_EFFECTS, SYMBOL_NINE_SLICE,
SymbolNineSlice, charge_symbol_art,
};
pub use symbol_overrides::SymbolOverride;
pub use symbol_registration::{SYMBOL_REGISTRATION, SymbolRegistration};
@@ -265,8 +265,8 @@ pub struct Document {
/// File → Document Setup (bleed, transparency grid, paper, type options).
#[serde(default, skip_serializing_if = "skip::is_default")]
pub setup: DocSetup,
/// Layers panel → Paste Remembers Layers: pasted objects go back into the layers (by name)
/// they were copied from instead of the current layer.
/// Layers panel → Paste Remembers Layers: pasted objects go back into the layers and
/// sublayers they were copied from instead of the current layer.
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub paste_remembers_layers: bool,
/// File → File Info (its title is [`Document::info_title`]).
+1 -1
View File
@@ -55,7 +55,7 @@ use blend_spec::{blend_color_shift, blend_ramp};
pub use envelope::{
EnvelopeKind, EnvelopeMap, EnvelopeOptions, H_DOWN, H_LEFT, H_RIGHT, H_UP, PreserveShape, TypeInk, envelope_bounds, envelope_content_bounds,
envelope_content_boxes, envelope_expand, envelope_frame, envelope_grid, envelope_mapper, envelope_of, envelope_overlay, envelope_stroke_margin,
set_type_ink, smooth_handles,
set_type_ink, smooth_handles, warp_grid,
};
pub(crate) use expand::max_outset;
pub use expand::{
+250 -8
View File
@@ -525,21 +525,106 @@ pub fn envelope_of(doc: &crate::Document, id: NodeId) -> Option<&Node> {
doc.ancestry(id)?.into_iter().rev().find_map(|a| doc.node(a).filter(|n| matches!(n.kind, NodeKind::Envelope { .. })))
}
/// What a selected envelope shows on the canvas: its mesh lines (a warp's surface on a 4×4 grid,
/// a mesh envelope's own grid) or its top object's outline, and for a mesh envelope the grid to
/// edit (its points and handles).
/// What a selected envelope shows on the canvas: its mesh lines (a warp's surface on its
/// [`warp_grid`], a mesh envelope's own grid) or its top object's outline, and for a warp or mesh
/// envelope the grid to edit (its points and handles; none while its contents are edited).
pub fn envelope_overlay(n: &Node) -> Option<(PathData, Option<GradientMesh>)> {
let NodeKind::Envelope { kind, .. } = &n.kind else { return None };
let NodeKind::Envelope { kind, editing, .. } = &n.kind else { return None };
let points = |grid: GradientMesh| (!*editing).then_some(grid);
match &**kind {
EnvelopeKind::Mesh { rows, cols, points, handles } => {
let grid = envelope_grid(*rows, *cols, points, handles)?;
Some((grid.lines(), Some(grid)))
EnvelopeKind::Mesh { rows, cols, points: at, handles } => {
let grid = envelope_grid(*rows, *cols, at, handles)?;
Some((grid.lines(), points(grid)))
}
EnvelopeKind::Warp { .. } => Some((EnvelopeMap::of(n)?.surface_mesh(4, 4, Color::BLACK).lines(), None)),
EnvelopeKind::Warp { .. } => match warp_grid(n) {
Some(grid) => Some((grid.lines(), points(grid))),
None => Some((EnvelopeMap::of(n)?.surface_mesh(4, 4, Color::BLACK).lines(), None)),
},
EnvelopeKind::TopObject { path, .. } => Some((path.clone(), None)),
}
}
/// The grid sizes [`warp_grid`] tries, in order: patches per row and per column.
const WARP_GRIDS: [u32; 3] = [4, 8, 16];
/// How far a [`warp_grid`] may draw from the warp it replaces, as a share of the diagonal of the
/// warp's bounds.
const WARP_GRID_TOLERANCE: f64 = 1e-3;
/// The grid a warp envelope's points and handles are edited on: its surface sampled on the first
/// of 4×4, 8×8 and 16×16 patches whose curves draw within [`WARP_GRID_TOLERANCE`] of the warp, with
/// handles along it, as a gradient mesh with black points. Editing a point makes the envelope a
/// mesh envelope with this grid. `None` for other nodes, for content with no bounds, and for a warp
/// that no such grid follows closely enough or whose grid isn't finite.
/// Built again only when the envelope's content objects, warp, frame or options change, or what
/// type is measured with ([`set_type_ink`]).
pub fn warp_grid(n: &Node) -> Option<GradientMesh> {
let NodeKind::Envelope { content, kind, frame, options, .. } = &n.kind else { return None };
if !matches!(**kind, EnvelopeKind::Warp { .. }) {
return None;
}
// `None` until a measure is registered, so a grid kept before then is built again after.
let inputs = TYPE_INK.get().map(|(_, inputs)| inputs());
let key: Vec<usize> = content.iter().map(|c| Arc::as_ptr(c) as usize).collect();
let same = |k: &KeptGrid| k.kind == **kind && k.frame == **frame && k.options == *options && k.inputs == inputs;
if let Some(grid) = WARP_GRIDS_KEPT.with_borrow(|kept| kept.get(&key).filter(|k| same(k)).map(|k| k.grid.clone())) {
return grid;
}
let grid = build_warp_grid(n);
WARP_GRIDS_KEPT.with_borrow_mut(|kept| {
if kept.len() >= WARP_GRID_KEPT {
// Entries for content that no longer exists go first, then one entry at a time.
kept.retain(|_, k| k.content.iter().all(|c| c.strong_count() > 0));
if kept.len() >= WARP_GRID_KEPT
&& let Some(any) = kept.keys().next().cloned()
{
kept.remove(&any);
}
}
// The weak pointers keep the content's addresses from being reused while the entry is kept.
let kept_content = content.iter().map(Arc::downgrade).collect();
kept.insert(key, KeptGrid { content: kept_content, kind: (**kind).clone(), frame: **frame, options: *options, inputs, grid: grid.clone() });
});
grid
}
/// A grid [`warp_grid`] built, with what it was built from.
struct KeptGrid {
content: Vec<std::sync::Weak<Node>>,
kind: EnvelopeKind,
frame: Affine,
options: EnvelopeOptions,
inputs: Option<u64>,
grid: Option<GradientMesh>,
}
/// How many grids [`warp_grid`] keeps on one thread.
const WARP_GRID_KEPT: usize = 1024;
std::thread_local! {
/// The grids [`warp_grid`] built on this thread, by the addresses of their envelopes' content.
static WARP_GRIDS_KEPT: std::cell::RefCell<std::collections::HashMap<Vec<usize>, KeptGrid>> = Default::default();
}
/// [`warp_grid`], built from scratch.
fn build_warp_grid(n: &Node) -> Option<GradientMesh> {
let map = EnvelopeMap::of(n)?;
let bounds = map.bounds()?;
let tol = bounds.width().hypot(bounds.height()) * WARP_GRID_TOLERANCE;
if !tol.is_finite() {
return None;
}
WARP_GRIDS.into_iter().find_map(|k| {
let m = map.surface_mesh(k, k, Color::BLACK);
let finite = m.points.iter().all(|q| q.p.is_finite() && q.handles.iter().all(|h| h.is_finite()));
// Each patch is checked at its corners, the middles of its sides and its middle.
let steps = 2 * k as usize;
let at = |i: usize| i as f64 / steps as f64;
let fits = || (0..=steps).all(|j| (0..=steps).all(|i| mesh_at(&m, at(i), at(j)).distance(map.at(at(i), at(j))) <= tol));
(finite && fits()).then_some(m)
})
}
/// The frame an envelope keeps after transform `m` (its frame so far composed with the
/// transform): identity when its axes stay square to the page, unflipped, since evaluating on
/// the page axes gives the same result then.
@@ -760,6 +845,163 @@ mod tests {
assert!(content_box(&nested, false, Affine::IDENTITY).is_some());
}
/// A warp envelope of `style` at `bend` with map `version` around a 200×100 rectangle at
/// (100, 50).
fn warp_node(style: &str, bend: f64, h: f64, version: u32) -> Node {
let rect = vectorcraft_geom::shapes::rectangle(Rect::new(100.0, 50.0, 300.0, 150.0));
let content = Arc::new(Node::path(NodeId(1), rect, crate::Appearance::default_art()));
let kind = EnvelopeKind::Warp { style: style.into(), bend, h, v: 0.0, horizontal: true, version };
Node::new(
NodeId(2),
NodeKind::Envelope {
content: vec![content],
kind: Box::new(kind),
fidelity: 50.0,
editing: false,
options: EnvelopeOptions::NEW,
frame: Box::new(Affine::IDENTITY),
},
)
}
const STYLES: [&str; 15] = [
"arc",
"arcLower",
"arcUpper",
"arch",
"bulge",
"shellLower",
"shellUpper",
"flag",
"wave",
"fish",
"rise",
"fisheye",
"inflate",
"squeeze",
"twist",
];
/// Every warp style's Bézier net has a grid to edit: its points lie on the warp, and the grid
/// draws within a thousandth of the warp's diagonal of it, between the grid lines too. The
/// overlay shows that grid's lines and points.
#[test]
fn every_warp_style_has_a_grid_that_keeps_its_shape() {
for style in STYLES {
for (bend, h) in [(50.0, 0.0), (100.0, 0.0), (-100.0, 60.0)] {
let n = warp_node(style, bend, h, crate::live::WARP_NET);
let grid = warp_grid(&n).unwrap_or_else(|| panic!("{style} {bend} {h}: no grid"));
assert!(WARP_GRIDS.contains(&grid.rows) && grid.rows == grid.cols, "{style}: {}×{}", grid.rows, grid.cols);
let map = EnvelopeMap::of(&n).unwrap();
let b = map.bounds().unwrap();
let tol = b.width().hypot(b.height()) * 1e-3;
let k = grid.cols as usize;
for (i, q) in grid.points.iter().enumerate() {
let want = map.at((i % (k + 1)) as f64 / k as f64, (i / (k + 1)) as f64 / k as f64);
assert!(q.p.distance(want) < 1e-9, "{style}: point {i} at {:?}, the warp at {want:?}", q.p);
}
for j in 0..=20 {
for i in 0..=20 {
let (u, v) = (i as f64 / 20.0, j as f64 / 20.0);
let off = mesh_at(&grid, u, v).distance(map.at(u, v));
assert!(off <= tol, "{style} {bend} {h}: {off} off at ({u}, {v})");
}
}
let (lines, shown) = envelope_overlay(&n).unwrap();
assert_eq!(shown.as_ref(), Some(&grid), "{style}");
assert_eq!(lines, grid.lines(), "{style}");
}
}
}
/// A kept warp grid is built again when the content, the warp, the frame or the options change,
/// and is the grid built from scratch otherwise.
#[test]
fn a_kept_warp_grid_follows_changes() {
let n = warp_node("arc", 50.0, 0.0, crate::live::WARP_NET);
let first = warp_grid(&n);
assert!(first.is_some());
assert_eq!(warp_grid(&n), first);
assert_eq!(build_warp_grid(&n), first);
let changed = |f: &dyn Fn(&mut Node)| {
let mut m = n.clone();
f(&mut m);
let grid = warp_grid(&m);
assert_eq!(grid, build_warp_grid(&m));
assert_ne!(grid, first);
};
changed(&|m| {
if let NodeKind::Envelope { content, .. } = &mut m.kind {
Arc::make_mut(&mut content[0]).transform(Affine::translate((40.0, 0.0)), true);
}
});
changed(&|m| {
if let NodeKind::Envelope { kind, .. } = &mut m.kind
&& let EnvelopeKind::Warp { bend, .. } = &mut **kind
{
*bend = -30.0;
}
});
changed(&|m| {
if let NodeKind::Envelope { frame, .. } = &mut m.kind {
**frame = Affine::rotate(0.3);
}
});
changed(&|m| {
if let NodeKind::Envelope { options, .. } = &mut m.kind {
options.bounds_margin = [0.1; 4];
}
});
}
/// The table of kept warp grids stays bounded: full of envelopes that still exist, it drops one
/// entry at a time instead of emptying, and it drops the entries of envelopes that are gone
/// first.
#[test]
fn the_kept_warp_grids_stay_bounded() {
let nodes: Vec<Node> = (0..WARP_GRID_KEPT + 10).map(|i| warp_node("arc", (i % 100) as f64, 0.0, crate::live::WARP_NET)).collect();
for n in &nodes {
assert!(warp_grid(n).is_some());
}
assert_eq!(WARP_GRIDS_KEPT.with_borrow(|kept| kept.len()), WARP_GRID_KEPT);
// Once the envelopes are gone, their entries are the ones dropped.
drop(nodes);
assert!(warp_grid(&warp_node("arc", 10.0, 0.0, crate::live::WARP_NET)).is_some());
assert_eq!(WARP_GRIDS_KEPT.with_borrow(|kept| kept.len()), 1);
}
/// A warp drawn by the old point map that no grid of up to 16×16 patches follows closely
/// enough, content without bounds and other envelopes have no warp grid; the overlay still
/// draws the old warp's lines. While an envelope's contents are edited, it shows no points.
#[test]
fn a_warp_no_grid_follows_has_no_grid_to_edit() {
let n = warp_node("fisheye", 100.0, 0.0, 0);
assert!(warp_grid(&n).is_none());
let (lines, grid) = envelope_overlay(&n).unwrap();
assert!(grid.is_none());
assert!(lines.anchor_count() > 0);
// The same style on its Bézier net has one.
assert!(warp_grid(&warp_node("fisheye", 100.0, 0.0, crate::live::WARP_NET)).is_some());
let mut empty = warp_node("arc", 50.0, 0.0, crate::live::WARP_NET);
if let NodeKind::Envelope { content, .. } = &mut empty.kind {
content.clear();
}
assert!(warp_grid(&empty).is_none());
let mut mesh = warp_node("arc", 50.0, 0.0, crate::live::WARP_NET);
if let NodeKind::Envelope { kind, .. } = &mut mesh.kind {
**kind = EnvelopeKind::Mesh { rows: 1, cols: 1, points: grid_points(Rect::new(0.0, 0.0, 1.0, 1.0), 1, 1), handles: vec![] };
}
assert!(warp_grid(&mesh).is_none());
// While the contents are edited, a warp's and a mesh envelope's lines show without points.
for mut n in [warp_node("arc", 50.0, 0.0, crate::live::WARP_NET), mesh] {
if let NodeKind::Envelope { editing, .. } = &mut n.kind {
*editing = true;
}
let (lines, grid) = envelope_overlay(&n).unwrap();
assert!(grid.is_none() && lines.anchor_count() > 0);
}
}
/// A table that fills up is emptied instead of growing, and what is looked up after that is
/// measured again.
#[test]
+180 -30
View File
@@ -10,9 +10,19 @@
//! The cells are sized along the symbol's own axes, and the instance's rotation, shear, reflection
//! and position then apply to them.
//!
//! The guides are stored as fractions (0..1) of the symbol's natural size, measured from the left
//! and top edges and from the right and bottom edges, so they survive resizing the art. Stored
//! under [`SYMBOL_NINE_SLICE`] keyed by symbol name; symbols without 9-slice have no entry.
//! A guide may lie outside the art, and the instance still scales, by the slices the art falls in
//! ([the help page](https://help.adobe.com/archive/en/illustrator/cs6/illustrator_reference.pdf),
//! Use 9-slice scaling section). VectorCraft's own rules for that: a guide past an edge of the art
//! cuts the art at that edge, so the outer cell on its side holds no art; with both guides of an
//! axis past opposite edges the art scales as a whole along it; with both past the same edge the
//! art lies in the outer cell at the other edge and keeps its size, from that edge of the instance,
//! or shrinks to the instance's width or height when the instance is smaller than the art.
//!
//! The guides are stored as fractions of the symbol's natural size, measured from the left and top
//! edges and from the right and bottom edges, so they survive resizing the art. A fraction below 0
//! puts a guide past its own edge, and one above 1 past the opposite edge; each lies within
//! ±[`MAX_GUIDE_FRACTION`], and the two guides of an axis keep their order. Stored under
//! [`SYMBOL_NINE_SLICE`] keyed by symbol name; symbols without 9-slice have no entry.
//!
//! [`NineSliceMap`] places such an instance's art for the canvas, bounds, Break Link, Expand and
//! the exporters ([`Document::place_symbol_art`]).
@@ -49,11 +59,16 @@ impl Default for SymbolNineSlice {
}
}
/// The farthest a guide may lie from its edge, as a fraction of the symbol's width or height, in
/// either direction (VectorCraft's own rule).
pub const MAX_GUIDE_FRACTION: f64 = 16.0;
impl SymbolNineSlice {
/// Guides from `[left, top, right, bottom]`; `None` unless each is finite, within 0..1, and the
/// two on each axis leave a gap between them.
/// Guides from `[left, top, right, bottom]`; `None` unless each is finite and within
/// ±[`MAX_GUIDE_FRACTION`], and the two on each axis leave a gap between them
/// (`left + right < 1`, `top + bottom < 1`).
pub fn new(left: f64, top: f64, right: f64, bottom: f64) -> Option<Self> {
let ok = |v: f64| v.is_finite() && (0.0..=1.0).contains(&v);
let ok = |v: f64| v.is_finite() && (-MAX_GUIDE_FRACTION..=MAX_GUIDE_FRACTION).contains(&v);
(ok(left) && ok(top) && ok(right) && ok(bottom) && left + right < 1.0 && top + bottom < 1.0).then_some(Self { left, top, right, bottom })
}
@@ -102,7 +117,8 @@ pub struct EditedNineSlice {
}
impl EditedNineSlice {
/// Guide `g` as a line across the art's box, from one edge to the other, in the document.
/// Guide `g` as a line across the art's box, from one edge to the other, in the document. A
/// guide outside the art spans the art's height or width beside it.
pub fn line(&self, g: NineSliceGuide) -> (Point, Point) {
let (b, s) = (self.art, self.guides);
let (a, c) = match g {
@@ -126,14 +142,17 @@ impl EditedNineSlice {
})
}
/// The guides with guide `g` moved across its axis to document point `p`. The guide stays
/// within the art's box, and [`MIN_CENTER_BAND`] short of the opposite guide, or where it is
/// when the guides are already closer than that. A point that is not finite leaves the guides
/// as they are.
/// The guides with guide `g` moved across its axis to document point `p`. The guide may pass
/// either edge of the art, up to [`MAX_GUIDE_FRACTION`] from its own edge, and stops
/// [`MIN_CENTER_BAND`] short of the opposite guide, or where it is when the guides are already
/// closer than that. A point that is not finite, or that gives a fraction that is not, leaves
/// the guides as they are.
pub fn moved(&self, g: NineSliceGuide, p: Point) -> SymbolNineSlice {
let (b, mut out) = (self.art, self.guides);
let q = self.to_doc.inverse() * p;
let fit = |v: f64, other: f64, now: f64| if v.is_finite() { v.clamp(0.0, (1.0 - other - MIN_CENTER_BAND).max(now)) } else { now };
let fit = |v: f64, other: f64, now: f64| {
if v.is_finite() { v.clamp(-MAX_GUIDE_FRACTION, (1.0 - other - MIN_CENTER_BAND).min(MAX_GUIDE_FRACTION).max(now)) } else { now }
};
match g {
NineSliceGuide::Left => out.left = fit((q.x - b.x0) / b.width(), out.right, out.left),
NineSliceGuide::Right => out.right = fit((b.x1 - q.x) / b.width(), out.left, out.right),
@@ -181,20 +200,27 @@ const MAX_SLICE_DEPTH: u32 = 64;
/// One axis of a 9-slice map: the three cells between the cuts and where each one goes.
#[derive(Clone, Copy, Debug, PartialEq)]
struct AxisMap {
/// The cuts in the art at its natural size: its start, the two guides, its end.
/// The cuts in the art at its natural size: its start, the two guides, its end. A guide
/// outside the art cuts it at the nearer end, so a cell can be empty.
src: [f64; 4],
/// Where the cuts go. The outer cells keep their length unless the scaled length is shorter
/// than both together; then both shrink in proportion and the middle cell is empty.
/// than both together; then both shrink in proportion and the middle cell is empty. An empty
/// cell's start is where the cell before it ends, so the map stays continuous.
dst: [f64; 4],
}
impl AxisMap {
/// The axis from `lo` to `hi` with guides `near` and `far` (fractions of its length in from
/// each end), scaled by `k` (above 0).
/// The axis from `lo` to `hi` (`lo < hi`) with guides `near` and `far` (fractions of its
/// length in from each end, `near + far < 1`; either may lie past an end), scaled by `k`
/// (above 0). With both guides past the far end the art keeps its length from the scaled
/// start, and with both past the near end it keeps its length up to the scaled end; when the
/// scaled length is shorter than the art, the art shrinks to the scaled length.
fn new(lo: f64, hi: f64, near: f64, far: f64, k: f64) -> Self {
let len = hi - lo;
let (a, b) = (near * len, far * len);
let src = [lo, lo + a, hi - b, hi];
let c1 = (lo + near * len).clamp(lo, hi);
let c2 = (hi - far * len).clamp(c1, hi);
let src = [lo, c1, c2, hi];
let (a, b) = (c1 - lo, hi - c2);
let (t0, t3) = (k * lo, k * hi);
let room = t3 - t0;
let (a, b) = if a + b <= room {
@@ -203,9 +229,15 @@ impl AxisMap {
let f = (room / (a + b)).max(0.0);
(a * f, b * f)
};
let t1 = t0 + a;
let t2 = (t3 - b).max(t1);
Self { src, dst: [t0, t1, t2, t3] }
let dst = if c2 > c1 {
let t1 = t0 + a;
[t0, t1, (t3 - b).max(t1), t3]
} else if a > 0.0 {
[t0, t0 + a, t0 + a, t3]
} else {
[t3 - b, t3 - b, t3 - b, t3]
};
Self { src, dst }
}
/// The cell `v` lies in; values outside the art belong to the outer cells.
@@ -279,10 +311,11 @@ pub struct NineSliceMap {
impl NineSliceMap {
/// The map for an instance placed by `xf` that shows art with natural-size transform
/// `natural` and geometric bounds `art` (in symbol space). `None` when the art or the
/// transform is degenerate, or when the instance is at its natural size on both axes (then
/// `xf` places the art as it is).
/// `natural` and geometric bounds `art` (in symbol space). `None` when the guides are not ones
/// [`SymbolNineSlice::new`] accepts, when the art or the transform is degenerate, or when the
/// instance is at its natural size on both axes (then `xf` places the art as it is).
pub fn new(guides: SymbolNineSlice, art: Rect, natural: Affine, xf: Affine) -> Option<Self> {
let guides = SymbolNineSlice::new(guides.left, guides.top, guides.right, guides.bottom)?;
let b = natural.transform_rect_bbox(art);
if ![b.x0, b.y0, b.x1, b.y1].into_iter().all(f64::is_finite) || b.width() <= 1e-9 || b.height() <= 1e-9 {
return None;
@@ -894,6 +927,113 @@ mod tests {
assert!(got.iter().all(|b| finite(*b)), "{got:?}");
}
/// Guides may lie outside the art, up to 16 times its size from their edge, as long as the
/// two on each axis keep their order; values that are not finite are refused.
#[test]
fn guides_outside_the_art_are_accepted_in_order_and_within_the_limit() {
let ok = |l, t, r, b| SymbolNineSlice::new(l, t, r, b).is_some();
assert!(ok(-0.25, 0.25, 0.25, 0.25));
assert!(ok(1.25, 0.25, -0.5, 0.25), "both past the right edge");
assert!(ok(0.25, -16.0, 0.25, 16.0) && ok(-16.0, 0.25, -16.0, 0.25));
assert!(!ok(-16.5, 0.25, 0.25, 0.25) && !ok(0.25, 0.25, 0.25, 17.0));
assert!(!ok(f64::NAN, 0.25, 0.25, 0.25) && !ok(0.25, f64::INFINITY, 0.25, 0.25) && !ok(0.25, 0.25, f64::NEG_INFINITY, 0.25));
assert!(!ok(1.2, 0.25, -0.2, 0.25), "the left guide on the right one");
assert!(!ok(0.25, 0.6, 0.25, 0.6), "crossed");
let g = SymbolNineSlice::from_value(&json!([-0.25, 1.5, 0.5, -1.0])).unwrap();
assert_eq!(g, SymbolNineSlice { left: -0.25, top: 1.5, right: 0.5, bottom: -1.0 });
assert_eq!(SymbolNineSlice::from_value(&g.to_value()), Some(g));
assert!(SymbolNineSlice::from_value(&json!([-0.25, 0.1, 1.5])).is_none());
assert!(SymbolNineSlice::from_value(&json!([-20.0, 0.1, 0.5, 0.1])).is_none());
// Guides built without the check are not used to place art.
let bad = SymbolNineSlice { left: f64::NAN, ..SymbolNineSlice::default() };
assert!(NineSliceMap::new(bad, Rect::new(0.0, 0.0, 100.0, 100.0), Affine::IDENTITY, Affine::scale(2.0)).is_none());
// Art without width or height has no map, whatever the guides.
let out = SymbolNineSlice::new(-0.25, 1.25, 0.25, -0.5).unwrap();
for art in [Rect::new(0.0, 0.0, 0.0, 100.0), Rect::new(0.0, 0.0, 100.0, 0.0)] {
assert!(NineSliceMap::new(out, art, Affine::IDENTITY, Affine::scale(2.0)).is_none(), "{art:?}");
}
}
/// At 200 × 150, a left guide 25 % outside the art leaves the art in the center and right
/// columns: the left column holds no art, the center one (0..75) stretches to 0..175 and the
/// right one keeps its 25. Both guides outside on opposite sides scale the art as a whole on
/// that axis; both past the same side keep the art at its size in the outer cell at the other
/// side, from that side of the instance.
#[test]
fn art_scales_by_the_cells_it_falls_in_when_guides_lie_outside_it() {
let xf = Affine::scale_non_uniform(2.0, 1.5);
let d = markers(SymbolNineSlice::new(-0.25, 0.25, 0.25, 0.25));
let got = boxes(&d, xf);
let k = 175.0 / 75.0;
assert!(near(got[0], Rect::new(0.0, 0.0, 200.0, 150.0)), "{:?}", got[0]);
assert!(near(got[1], Rect::new(0.0, 0.0, 10.0 * k, 10.0)), "the top-left square stretches: {:?}", got[1]);
assert!(near(got[2], Rect::new(190.0, 0.0, 200.0, 10.0)), "the top-right corner keeps its size: {:?}", got[2]);
assert!(near(got[5], Rect::new(45.0 * k, 65.0, 55.0 * k, 85.0)), "{:?}", got[5]);
// Both vertical guides outside, on opposite sides: the art scales as a whole across.
let d = markers(SymbolNineSlice::new(-0.25, 0.25, -1.0, 0.25));
let got = boxes(&d, xf);
assert!(near(got[1], Rect::new(0.0, 0.0, 20.0, 10.0)) && near(got[2], Rect::new(180.0, 0.0, 200.0, 10.0)), "{got:?}");
assert!(near(got[5], Rect::new(90.0, 65.0, 110.0, 85.0)), "{:?}", got[5]);
// Both past the right edge: the art keeps its width from the instance's left edge.
let d = markers(SymbolNineSlice::new(1.2, 0.25, -0.5, 0.25));
let got = boxes(&d, xf);
assert!(near(got[0], Rect::new(0.0, 0.0, 100.0, 150.0)), "{:?}", got[0]);
assert!(near(got[2], Rect::new(90.0, 0.0, 100.0, 10.0)) && near(got[5], Rect::new(45.0, 65.0, 55.0, 85.0)), "{got:?}");
// Both past the left edge: the art keeps its width up to the instance's right edge.
let d = markers(SymbolNineSlice::new(-0.5, 0.25, 1.2, 0.25));
let got = boxes(&d, xf);
assert!(near(got[0], Rect::new(100.0, 0.0, 200.0, 150.0)), "{:?}", got[0]);
assert!(near(got[1], Rect::new(100.0, 0.0, 110.0, 10.0)), "{:?}", got[1]);
// The same rules apply to rows: both horizontal guides above the art keep its height up to
// the instance's bottom edge.
let d = markers(SymbolNineSlice::new(0.25, -0.5, 0.25, 1.2));
let got = boxes(&d, xf);
assert!(near(got[0], Rect::new(0.0, 50.0, 200.0, 150.0)), "{:?}", got[0]);
assert!(near(got[3], Rect::new(0.0, 140.0, 10.0, 150.0)), "{:?}", got[3]);
// Smaller than the art, an art-covered outer cell shrinks in proportion.
let d = markers(SymbolNineSlice::new(1.2, 0.25, -0.5, 0.25));
let got = boxes(&d, Affine::scale_non_uniform(0.5, 1.5));
assert!(near(got[0], Rect::new(0.0, 0.0, 50.0, 150.0)) && near(got[1], Rect::new(0.0, 0.0, 5.0, 10.0)), "{got:?}");
}
/// With guides outside the art, the map stays finite, never runs backward, and does not jump
/// at the art's edges or at the guides; objects keep to the cells that hold art.
#[test]
fn the_map_with_guides_outside_the_art_is_continuous_and_monotone() {
let cases = [(-0.25, 0.25), (-0.25, -1.0), (1.2, -0.5), (-0.5, 1.2), (0.0, -16.0), (-16.0, 16.0), (0.25, 0.25)];
for (l, r) in cases {
let d = markers(SymbolNineSlice::new(l, 0.25, r, 0.25));
for sx in [0.3, 2.0, 1e6] {
let m = d.symbol_slice_map("S", Affine::scale_non_uniform(sx, 1.5)).unwrap();
let at = |x: f64| m.map_point(Point::new(x, 40.0)).x;
let mut last = f64::NEG_INFINITY;
for i in 0..=1200 {
let x = -10.0 + i as f64 * 0.1;
let v = at(x);
assert!(v.is_finite() && v >= last - 1e-12 * last.abs().max(1.0), "{l} {r} {sx}: {x} → {v} after {last}");
last = v;
}
for edge in [0.0, 75.0, 100.0] {
let jump = (at(edge + 1e-9) - at(edge - 1e-9)).abs();
assert!(jump < 1e-6 * sx.max(1.0), "{l} {r} {sx}: a jump of {jump} at {edge}");
}
}
}
// A gradient bar across the art with the left guide outside is drawn in the two columns
// that hold art, not three.
let mut d = markers(SymbolNineSlice::new(-0.25, 0.25, 0.25, 0.25));
let gradient = Paint::Gradient(Box::new(GradientPaint::new(Gradient::default())));
let bar = Node::path(d.alloc_id(), shapes::rectangle(Rect::new(0.0, 40.0, 100.0, 60.0)), Appearance::basic(gradient, Paint::None, 0.0));
let m = d.symbol_slice_map("S", Affine::scale_non_uniform(2.0, 1.5)).unwrap();
assert_eq!(m.place(&bar, &d).children().map(Vec::len), Some(2));
assert_eq!(m.most_placed(&bar, &d), 7);
// With both guides outside on opposite sides, the bar lies in one cell and is moved whole.
let d = markers(SymbolNineSlice::new(-0.25, 0.25, -0.25, 0.25));
let m = d.symbol_slice_map("S", Affine::scale_non_uniform(2.0, 1.5)).unwrap();
assert!(matches!(m.place(&bar, &d).kind, NodeKind::Path { .. }));
assert_eq!(m.most_placed(&bar, &d), 1);
}
/// A negative scale reflects the sized cells; a rotation turns them, the corners keeping
/// their size along the symbol's own axes.
#[test]
@@ -1456,27 +1596,37 @@ mod tests {
assert!(d.edited_nine_slice().is_none());
}
/// Moving a guide changes that guide alone, follows the pointer across its axis only, stays
/// within the art's box and stops short of the opposite guide.
/// Moving a guide changes that guide alone, follows the pointer across its axis only, may pass
/// either edge of the art up to [`MAX_GUIDE_FRACTION`], and stops short of the opposite guide.
#[test]
fn a_moved_guide_stays_in_the_art_and_short_of_the_opposite_guide() {
fn a_moved_guide_passes_the_arts_edges_and_stops_short_of_the_opposite_guide() {
let xf = Affine::translate((10.0, 20.0)) * Affine::scale(2.0);
let e = editing(Some(SymbolNineSlice::default()), xf).edited_nine_slice().unwrap();
let q = SymbolNineSlice { left: 0.25, top: 0.25, right: 0.25, bottom: 0.25 };
assert_eq!(e.moved(NineSliceGuide::Left, Point::new(30.0, 999.0)), SymbolNineSlice { left: 0.1, ..q });
assert_eq!(e.moved(NineSliceGuide::Bottom, Point::new(-50.0, 180.0)), SymbolNineSlice { bottom: 0.2, ..q });
assert_eq!(e.moved(NineSliceGuide::Top, Point::new(0.0, -500.0)), SymbolNineSlice { top: 0.0, ..q });
assert_eq!(e.moved(NineSliceGuide::Right, Point::new(1e6, 0.0)), SymbolNineSlice { right: 0.0, ..q });
// Past the art's near edges: the art spans 10..210 across and 20..220 down.
assert_eq!(e.moved(NineSliceGuide::Left, Point::new(-40.0, 50.0)), SymbolNineSlice { left: -0.25, ..q });
assert_eq!(e.moved(NineSliceGuide::Top, Point::new(0.0, -500.0)), SymbolNineSlice { top: -2.6, ..q });
assert_eq!(e.moved(NineSliceGuide::Right, Point::new(1e6, 0.0)), SymbolNineSlice { right: -MAX_GUIDE_FRACTION, ..q });
assert_eq!(e.moved(NineSliceGuide::Left, Point::new(-1e300, 0.0)), SymbolNineSlice { left: -MAX_GUIDE_FRACTION, ..q });
let crossed = e.moved(NineSliceGuide::Left, Point::new(200.0, 50.0));
assert!((crossed.left - (0.75 - MIN_CENTER_BAND)).abs() < 1e-12, "{crossed:?}");
assert!(SymbolNineSlice::new(crossed.left, crossed.top, crossed.right, crossed.bottom).is_some());
assert_eq!(e.moved(NineSliceGuide::Top, Point::new(f64::NAN, f64::NAN)), q);
assert_eq!(e.moved(NineSliceGuide::Top, Point::new(0.0, f64::INFINITY)), q);
// With the right guide past the art's right edge, the left one may pass that edge too.
let wide = SymbolNineSlice { right: -0.5, ..q };
let e = editing(Some(wide), xf).edited_nine_slice().unwrap();
assert_eq!(e.moved(NineSliceGuide::Left, Point::new(260.0, 50.0)), SymbolNineSlice { left: 1.25, ..wide });
assert!(near_point(e.line(NineSliceGuide::Right).0, Point::new(310.0, 20.0)));
assert!(near_point(e.line(NineSliceGuide::Right).1, Point::new(310.0, 220.0)));
// Saved guides closer than the minimum center band keep their place when a drag does not
// move them closer.
let narrow = SymbolNineSlice::new(0.00005, 0.25, 0.9999, 0.25).unwrap();
let e = editing(Some(narrow), xf).edited_nine_slice().unwrap();
assert_eq!(e.moved(NineSliceGuide::Left, Point::new(200.0, 50.0)), narrow);
assert_eq!(e.moved(NineSliceGuide::Left, Point::new(0.0, 50.0)), SymbolNineSlice { left: 0.0, ..narrow });
assert_eq!(e.moved(NineSliceGuide::Left, Point::new(0.0, 50.0)), SymbolNineSlice { left: -0.05, ..narrow });
// A mirrored placement measures along the symbol's own axes.
let e = editing(Some(SymbolNineSlice::default()), Affine::scale_non_uniform(-1.0, 1.0)).edited_nine_slice().unwrap();
assert!(near_point(e.line(NineSliceGuide::Left).0, Point::new(-25.0, 0.0)));
+49
View File
@@ -0,0 +1,49 @@
//! A warp grid kept before type's measure is registered is built again once it is, even when the
//! registered inputs number is 0. One test in its own process, so nothing has registered the
//! measure before it runs.
// Integration tests: unwrapping and panicking on failure is fine here, unlike in shipped code (AGENTS.md › Robustness).
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
use std::sync::Arc;
use vectorcraft_doc::live::{EnvelopeOptions, set_type_ink, warp_grid};
use vectorcraft_doc::{CharStyle, EnvelopeKind, Node, NodeId, NodeKind, TextObject};
use vectorcraft_geom::{Affine, Point, Rect};
/// A measure that gives every type the same box, well away from its laid-out box.
fn fixed_ink(_: &TextObject, _: Affine, _: Option<(vectorcraft_geom::Homography, Affine)>) -> Option<Rect> {
Some(Rect::new(0.0, 0.0, 400.0, 300.0))
}
fn no_inputs() -> u64 {
0
}
/// An arc warp around `t`, its content in a new `Arc`.
fn warp_of(t: &TextObject) -> Node {
let content = Arc::new(Node::new(NodeId(1), NodeKind::Text(Box::new(t.clone()))));
let kind = EnvelopeKind::Warp { style: "arc".into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true, version: 1 };
Node::new(
NodeId(2),
NodeKind::Envelope {
content: vec![content],
kind: Box::new(kind),
fidelity: 50.0,
editing: false,
options: EnvelopeOptions::NEW,
frame: Box::new(Affine::IDENTITY),
},
)
}
#[test]
fn a_warp_grid_kept_before_the_type_measure_is_built_again() {
let t = TextObject::point(Point::new(100.0, 100.0), "Type", CharStyle::default());
let n = warp_of(&t);
let before = warp_grid(&n);
set_type_ink(fixed_ink, no_inputs);
let fresh = warp_grid(&warp_of(&t));
assert!(fresh.is_some());
assert_ne!(fresh, before, "the registered measure moves the grid");
assert_eq!(warp_grid(&n), fresh, "the grid kept from before the registration is built again");
}
+1 -1
View File
@@ -1351,7 +1351,7 @@ mod tests {
group.appearance = Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0).into();
for id in [REVOLVE, crate::EXTRUDE] {
assert!(crate::validate_three_d(&group, id, &json!({})).is_ok(), "{id} on the group itself");
let refused = crate::validate_three_d_at(&group, id, &json!({}), Some((0, 0))).unwrap_err();
let refused = crate::validate_three_d_at(&group, id, &json!({}), (Some(0), 0)).unwrap_err();
assert!(refused.contains("on the group itself"), "{id}: {refused}");
}
}
+123 -38
View File
@@ -6,7 +6,7 @@ use serde_json::Value;
use vectorcraft_doc::color::{BlendMode, Paint};
use vectorcraft_doc::{Appearance, AppearanceItem, Document, Effect, Node, NodeId, NodeKind, OpacityMask, StrokeLayer};
use vectorcraft_geom::{FillRule, PathData, Rect};
use vectorcraft_three_d::{Bevel, BevelProfile, BevelShape, Extrude, Facet, Inflate, Mesh, PlanarFace, View};
use vectorcraft_three_d::{Bevel, BevelProfile, BevelShape, Extrude, Facet, Inflate, MAX_OBJECT_FACES, Mesh, PlanarFace, View};
#[cfg(test)]
use vectorcraft_doc::color::Color;
@@ -311,36 +311,64 @@ pub fn validate_solid(n: &Node, id: &str, p: &Value) -> Result<(), String> {
/// [`validate_solid`] with the symbols of `doc`: a symbol instance, a blend and a clipping group
/// build from the art they show ([`resolve`]).
pub fn validate_solid_in(doc: Option<&Document>, n: &Node, id: &str, p: &Value) -> Result<(), String> {
validate_solid_for(doc, n, id, p, None)
validate_solid_for(doc, n, id, p, (None, None))
}
/// [`validate_solid_in`] for the effect on the object (`item` `None`) or on its appearance item
/// `item`, whose shadow is cast by that item's solid alone.
fn validate_solid_for(doc: Option<&Document>, n: &Node, id: &str, p: &Value, item: Option<usize>) -> Result<(), String> {
/// [`validate_solid_in`] for the effect at `(item, index)`: index `index` of the effects of the
/// object (`item` `None`) or of its appearance item `item`, whose shadow is cast by that item's
/// solid alone. The index is the effects' length for a new effect. The solids are checked as
/// [`solid_art_in`] draws them: from the shapes after the geometry effects before the 3D effect.
/// On the object (or group) with `index` `None`, that effect is its first visible Extrude & Bevel,
/// Inflate or Rotate, as drawn, or a new one after its other effects when it has none.
fn validate_solid_for(doc: Option<&Document>, n: &Node, id: &str, p: &Value, at: (Option<usize>, Option<usize>)) -> Result<(), String> {
validate_solid_params(id, p)?;
if let Some(doc) = doc {
graphics::validate_symbols(doc, p)?;
}
let label = label_of(id);
let n = &*source::resolve_for(doc, n, label, is_plane(id))?;
let effects = &n.appearance.effects;
let index = match at {
(None, Some(index)) => index,
_ => solid(effects).map_or(effects.len(), |(index, _)| index),
};
let before = effects.get(..index).unwrap_or(effects);
if is_container(n) {
let shapes = members(n, label)?;
let mut shapes = members(n, label)?;
reshape_members(n, before, &mut shapes);
let b = union_bounds(&shapes).ok_or_else(|| format!("{label} requires a group holding a shape with at least two anchors"))?;
shapes.iter().try_for_each(|s| facets(id, &s.path, s.rule, b, p).map(|_| ()))?;
check_solids(id, p, &shapes)?;
return cast_shadow(id, p, &shapes).map(|_| ());
}
let (path, rule) = object_profile(n, label)?;
let b = path.bounds().ok_or_else(|| format!("{label} requires a shape with at least two anchors"))?;
facets(id, &path, rule, b, p)?;
let anchors = || format!("{label} requires a shape with at least two anchors");
path.bounds().ok_or_else(anchors)?;
let ctx = GeomContext::of(n);
// With its shadow on, the shadow of the object's solids (or of the item's) must fit too.
let items = match item.and_then(|i| n.appearance.items.get(i)) {
Some(item) => vec![item.clone()],
None => solid_paints(n),
let (path, items) = match at.0.and_then(|i| Some((n.appearance.items.get(i)?, at.1.unwrap_or(usize::MAX)))) {
Some((item, index)) => {
let path = geometry(&path, effects, &ctx);
(geometry(&path, item.effects().get(..index).unwrap_or(item.effects()), &ctx.item(item)), vec![item.clone()])
}
None => (geometry(&path, before, &ctx), solid_paints(n)),
};
let b = path.bounds().ok_or_else(anchors)?;
facets(id, &path, rule, b, p)?;
let shapes = [Profile { path, rule, items, opacity: 1.0, scopes: vec![] }];
check_solids(id, p, &shapes)?;
cast_shadow(id, p, &shapes).map(|_| ())
}
/// Do the solids 3D effect `id` with parameters `p` builds from the fills and strokes of `shapes`
/// fit, each on its own and all of them together ([`built_solids`])? Rotate's planes are not
/// counted.
fn check_solids(id: &str, p: &Value, shapes: &[Profile]) -> Result<(), String> {
let Some(b) = union_bounds(shapes).filter(|_| !is_plane(id)) else { return Ok(()) };
let (parts, bounds) = solid_parts(shapes, b);
built_solids(id, p, &parts, bounds, MAX_OBJECT_FACES).try_for_each(|r| r.map(|_| ()))
}
/// [`profile`], or the error a command reports for object `n`: type with no outlines to build from
/// (empty, or only spaces) is a shape without anchors, an image is traced first, and any other
/// object is the wrong kind.
@@ -518,26 +546,28 @@ pub fn validate_three_d_in(doc: Option<&Document>, n: &Node, id: &str, p: &Value
if crate::revolve::is_revolve(id) { crate::revolve::validate_in(doc, n, id, p) } else { validate_solid_in(doc, n, id, p) }
}
/// [`validate_three_d`] for an effect at `(item, index)`, index `index` of the effects of
/// appearance item `item` of `n` (the effects' length for a new effect), or on the object itself
/// when `at` is `None`. A Revolve on a fill or stroke is checked in that item's paint, after the
/// item's geometry effects before it, together with the object's other items that carry a Revolve.
/// A group's or layer's fills and strokes take no 3D effect: only the group's own effect draws.
pub fn validate_three_d_at(n: &Node, id: &str, p: &Value, at: Option<(usize, usize)>) -> Result<(), String> {
/// [`validate_three_d`] for an effect at `(item, index)`: index `index` of the effects of
/// appearance item `item` of `n`, or of the object itself when `item` is `None` (the effects'
/// length for a new effect). An Extrude & Bevel, Inflate or Rotate is checked on the shapes after
/// the geometry effects before that index. A Revolve on a fill or stroke is checked in that item's
/// paint, after the item's geometry effects before it, together with the object's other items that
/// carry a Revolve. A group's or layer's fills and strokes take no 3D effect: only the group's own
/// effect draws.
pub fn validate_three_d_at(n: &Node, id: &str, p: &Value, at: (Option<usize>, usize)) -> Result<(), String> {
validate_three_d_at_in(None, n, id, p, at)
}
/// [`validate_three_d_at`] with the symbols of `doc` ([`validate_solid_in`]). A symbol instance, a
/// blend and a clipping group take a 3D effect as groups do: on the object itself.
pub fn validate_three_d_at_in(doc: Option<&Document>, n: &Node, id: &str, p: &Value, at: Option<(usize, usize)>) -> Result<(), String> {
pub fn validate_three_d_at_in(doc: Option<&Document>, n: &Node, id: &str, p: &Value, at: (Option<usize>, usize)) -> Result<(), String> {
graphics::validate(id, p)?;
match at {
Some(_) if is_container(n) || source::resolves(n) => {
(Some(_), _) if is_container(n) || source::resolves(n) => {
Err("A 3D effect on a group or layer goes on the group itself, not on its fill or stroke".into())
}
Some((item, index)) if crate::revolve::is_revolve(id) => crate::revolve::validate_item_of(n, id, p, item, index),
Some((item, _)) => validate_solid_for(doc, n, id, p, Some(item)),
None => validate_three_d_in(doc, n, id, p),
(Some(item), index) if crate::revolve::is_revolve(id) => crate::revolve::validate_item_of(n, id, p, item, index),
(None, _) if crate::revolve::is_revolve(id) => crate::revolve::validate_in(doc, n, id, p),
(item, index) => validate_solid_for(doc, n, id, p, (item, Some(index))),
}
}
@@ -657,6 +687,55 @@ fn solid_parts(shapes: &[Profile], fallback: Rect) -> (Vec<Part<'_>>, Rect) {
(parts, bounds)
}
#[cfg(test)]
thread_local! {
/// How many solids [`built_solids`] has built on this thread, for the tests.
static SOLIDS_BUILT: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
}
/// The solids Extrude & Bevel (Classic included) or Inflate `id` with parameters `p` builds from
/// `parts` ([`solid_parts`]) about `bounds`, one result for each part in order, each built only as
/// the iterator reaches it. A stroke's solid past its own limits is `None` (left out of the art, its
/// faces not counted); a fill's is an error. The faces of the solids kept count together: once they
/// pass `limit` ([`MAX_OBJECT_FACES`] for the art) the result is an error, and
/// no later part is built. An error ends the iterator.
fn built_solids<'a>(
id: &'a str,
p: &'a Value,
parts: &'a [Part<'a>],
bounds: Rect,
limit: usize,
) -> impl Iterator<Item = Result<Option<Vec<Facet>>, String>> + 'a {
// Inflate's eye is placed for every puff together, as far away as the highest needs.
let mut inflated = (id == INFLATE).then(|| {
let shapes: Vec<(&PathData, FillRule)> = parts.iter().map(|(_, _, area, rule, _, _)| (area, *rule)).collect();
vectorcraft_three_d::inflate_each(&shapes, bounds, inflate_options(p), view_options(p))
});
let mut kept = 0usize;
let mut ended = false;
parts.iter().map_while(move |(item, _, area, rule, _, _)| {
if ended {
return None;
}
#[cfg(test)]
SOLIDS_BUILT.with(|n| n.set(n.get() + 1));
let built = match inflated.as_mut() {
Some(each) => each.next().unwrap_or_else(|| Ok(vec![])),
None => facets(id, area, *rule, bounds, p),
};
let result = match built {
Ok(f) => {
kept = kept.saturating_add(f.len());
if kept > limit { Err(vectorcraft_three_d::TOO_COMPLEX_SOLID.to_string()) } else { Ok(Some(f)) }
}
Err(_) if matches!(item, AppearanceItem::Stroke(_)) => Ok(None),
Err(e) => Err(e),
};
ended = result.is_err();
Some(result)
})
}
/// What a face of one of the solids [`art_for`] draws in one order was built from: the facet's
/// depth, whether it is a side face and whether it is turned away from the viewer, the bounds of
/// its polygon, the index of its shape, and whether its solid is that shape's fill or one of its
@@ -1044,24 +1123,19 @@ fn surfaces_for(doc: Option<&Document>, n: &Node, fx: &Effect, shapes: &[Profile
return Some(if masks { masked(n.id, out) } else { out.into_iter().map(|(_, s)| s).collect() });
}
let (parts, bounds) = solid_parts(shapes, b);
let built = if fx.id == INFLATE {
// One eye for every puff, as far away as the highest needs.
let shapes: Vec<(&PathData, FillRule)> = parts.iter().map(|(_, _, area, rule, _, _)| (area, *rule)).collect();
vectorcraft_three_d::inflate_together(&shapes, bounds, inflate_options(&p), view_options(&p))
} else {
parts.iter().map(|(_, _, area, rule, _, _)| facets(&fx.id, area, *rule, bounds, &p)).collect()
};
let mut solids = vec![];
for ((item, opacity, _, _, scopes, member), f) in parts.iter().zip(built) {
for ((item, opacity, _, _, scopes, member), f) in parts.iter().zip(built_solids(&fx.id, &p, &parts, bounds, MAX_OBJECT_FACES)) {
let item: &AppearanceItem = item;
match f {
Ok(f) if !crate::revolve::paint_copies_add(&mut paint_bytes, facet_copies(&f, paint_ref(item), colored), paint_ref(item)) => return None,
Ok(f) => solids.push((item, *opacity, *scopes, f, *member)),
Ok(Some(f)) if !crate::revolve::paint_copies_add(&mut paint_bytes, facet_copies(&f, paint_ref(item), colored), paint_ref(item)) => {
return None;
}
Ok(Some(f)) => solids.push((item, *opacity, *scopes, f, *member)),
// A stroke's outline past the limits is left out; the fill's solid still draws.
Err(_) if matches!(item, AppearanceItem::Stroke(_)) => {}
// A loaded file or a shape edited past the limits keeps drawing its source path
// instead of failing the frame; commands validate the same evaluator and report its
// errors.
Ok(None) => {}
// A loaded file or a shape edited past the limits (its own, or those of the object's
// solids together) keeps drawing its source path instead of failing the frame;
// commands validate the same evaluator and report its errors.
Err(_) => return None,
}
}
@@ -1435,15 +1509,26 @@ fn meshes_for(fx: &Effect, shapes: &[Profile], total: &mut usize, limit: usize)
return Ok(out);
}
let (parts, bounds) = solid_parts(shapes, b);
// The solids the art draws, past the limits of the object's solids together as it is
// ([`built_solids`]), each built and its faces counted as the loop reaches it, then dropped.
let drawn = built_solids(&fx.id, &p, &parts, bounds, MAX_OBJECT_FACES).map(|r| r.map(|f| f.is_some()));
// Inflate lays out every puff at once (they share one eye); each Inflate and Extrude & Bevel
// solid and its mesh are built as the loop reaches them.
let mut inflated = (fx.id == INFLATE).then(|| {
let shapes: Vec<(&PathData, FillRule)> = parts.iter().map(|(_, _, area, rule, _, _)| (area, *rule)).collect();
vectorcraft_three_d::inflate_meshes(&shapes, bounds, inflate_options(&p), view)
});
let extrude = extrude_options(&p);
for (item, member, area, rule, _, _) in &parts {
let extrude = if fx.id == CLASSIC_EXTRUDE { classic_extrude_options(&p) } else { extrude_options(&p) };
for ((item, member, area, rule, _, _), drawn) in parts.iter().zip(drawn) {
let item: &AppearanceItem = item;
if !drawn? {
// A stroke the art leaves out is left out of the meshes too; Inflate's next puff
// still belongs to the next part.
if let Some(built) = inflated.as_mut() {
built.next();
}
continue;
}
let mesh = match inflated.as_mut() {
Some(built) => built.next().unwrap_or_else(|| Ok(Mesh::default())),
None => vectorcraft_three_d::extrude_mesh(area, *rule, bounds, extrude, view),
+136
View File
@@ -353,6 +353,142 @@ fn a_stroke_past_the_limits_is_left_out() {
}
}
/// Each solid [`built_solids`] gives for effect `id` on `n` within `limit` faces together, as its
/// face count (`None` for a stroke left out) or the error, every result the iterator gives.
fn solid_faces(id: &str, n: &Node, limit: usize) -> Vec<Result<Option<usize>, String>> {
let shapes = [Profile { path: profile(n).unwrap().0, rule: FillRule::NonZero, items: solid_paints(n), opacity: 1.0, scopes: vec![] }];
let p = crate::merged_params(id, &json!({}));
let (parts, bounds) = solid_parts(&shapes, union_bounds(&shapes).unwrap());
built_solids(id, &p, &parts, bounds, limit).map(|r| r.map(|f| f.map(|f| f.len()))).collect()
}
/// The solids of one object count their faces together: at the limit they all build, one face past
/// it is an error, and the solids after the one that passes it are never built.
#[test]
fn an_objects_solids_count_their_faces_together() {
for id in [EXTRUDE, CLASSIC_EXTRUDE, INFLATE] {
let mut n = square_node();
// A second stroke, so a solid follows the one that passes the limit.
let stroke = n.appearance.items[1].clone();
n.appearance.items.push(stroke);
let counts: Vec<usize> = solid_faces(id, &n, MAX_OBJECT_FACES).into_iter().map(|c| c.unwrap().unwrap()).collect();
assert!(counts.len() == 3 && counts.iter().all(|c| *c > 0), "{id}: {counts:?}");
let total: usize = counts.iter().sum();
assert!(solid_faces(id, &n, total).iter().all(Result::is_ok), "{id}: at the limit");
let past = solid_faces(id, &n, total - 1);
assert_eq!(past.last(), Some(&Err(vectorcraft_three_d::TOO_COMPLEX_SOLID.to_string())), "{id}");
SOLIDS_BUILT.with(|b| b.set(0));
let past = solid_faces(id, &n, counts[0] + counts[1] - 1);
assert!(past.len() == 2 && past[1].is_err(), "{id}: {past:?}");
assert_eq!(SOLIDS_BUILT.with(std::cell::Cell::get), 2, "{id}: the second stroke's solid is never built");
}
}
/// A convex polygon of `corners` corners about (20,000, 20,000), filled red, with no stroke.
fn polygon_node(id: u64, corners: usize) -> Node {
let points: Vec<Point> = (0..corners)
.map(|k| {
let (s, c) = (k as f64 * std::f64::consts::TAU / corners as f64).sin_cos();
Point::new(20_000.0 + 10_000.0 * c, 20_000.0 + 10_000.0 * s)
})
.collect();
let path = PathData::single(vectorcraft_geom::SubPath::polyline(&points, true));
Node::path(NodeId(id), path, Appearance::basic(Paint::solid(RED), Paint::None, 0.0))
}
/// A group whose members' solids each fit, but not all of them together, draws its source art, and
/// the commands that check the effect report the error, as do its mesh and its wireframe; one
/// member fewer, within the limit, draws.
#[test]
fn a_groups_solids_together_past_the_limit_draw_the_source() {
let member = polygon_node(1, 16_384);
let mut alone = member.clone();
alone.appearance.effects.push(fx(EXTRUDE, json!({})));
let [Ok(Some(each))] = solid_faces(EXTRUDE, &alone, MAX_OBJECT_FACES)[..] else { panic!("one solid") };
// Members stacked in one place each build the same solid.
let fits = MAX_OBJECT_FACES / each;
let group = |count: usize| {
let members = (0..count)
.map(|k| {
let mut m = member.clone();
m.id = NodeId(k as u64 + 1);
Arc::new(m)
})
.collect();
let mut g = Node::group(NodeId(9999), members);
g.appearance.effects.push(fx(EXTRUDE, json!({})));
g
};
let within = group(fits);
assert!(validate_solid(&within, EXTRUDE, &json!({})).is_ok(), "{fits} × {each} faces");
assert!(solid_art(&within).is_some());
let past = group(fits + 1);
assert_eq!(validate_solid(&past, EXTRUDE, &json!({})), Err(vectorcraft_three_d::TOO_COMPLEX_SOLID.to_string()));
assert!(solid_art(&past).is_none(), "the source art draws");
assert_eq!(three_d_meshes(&past), Err(vectorcraft_three_d::TOO_COMPLEX_SOLID.to_string()));
assert_eq!(three_d_wireframe_in(None, &past), Err(vectorcraft_three_d::TOO_COMPLEX_SOLID.to_string()));
}
/// A fill and strokes whose solids each fit, but not all of them together, draw the source art,
/// and the strokes after the one past the limit are not left out to make room.
#[test]
fn a_fill_and_strokes_together_past_the_limit_draw_the_source() {
let mut n = polygon_node(1, 16_384);
n.appearance.effects.push(fx(EXTRUDE, json!({})));
let stroke = AppearanceItem::Stroke(StrokeLayer::new(Paint::solid(BLUE), 20.0));
n.appearance.items.push(stroke.clone());
// Strokes alike each build the same solid.
let [Ok(Some(fill)), Ok(Some(each))] = solid_faces(EXTRUDE, &n, MAX_OBJECT_FACES)[..] else { panic!("a fill's solid and a stroke's") };
let fits = (MAX_OBJECT_FACES - fill) / each;
assert!(fits >= 2, "{fill} + {fits} × {each}");
n.appearance.items.extend(std::iter::repeat_n(stroke, fits - 1));
assert!(validate_solid(&n, EXTRUDE, &json!({})).is_ok(), "{fill} + {fits} × {each}");
let art = solid_art(&n).unwrap();
assert!(faces(&art).iter().any(|f| blue(f)));
n.appearance.items.push(AppearanceItem::Stroke(StrokeLayer::new(Paint::solid(BLUE), 20.0)));
assert_eq!(validate_solid(&n, EXTRUDE, &json!({})), Err(vectorcraft_three_d::TOO_COMPLEX_SOLID.to_string()));
assert!(solid_art(&n).is_none(), "the source art draws");
}
/// The check builds the solids from the shapes the art draws them from: after the geometry effects
/// before the 3D effect, on an object, on its fill and on a group. Copies a Transform effect before
/// it makes that take the solids past the limit fail the check, as the art then draws the source.
#[test]
fn the_check_counts_the_faces_after_the_geometry_effects_before() {
let mut alone = polygon_node(1, 16_384);
alone.appearance.effects.push(fx(EXTRUDE, json!({})));
let [Ok(Some(each))] = solid_faces(EXTRUDE, &alone, MAX_OBJECT_FACES)[..] else { panic!("one solid") };
// Side by side, each copy builds the same solid.
let copies = |k: usize| fx("distort.transform", json!({"moveH": 30_000.0, "copies": k}));
for (k, fits) in [(1, true), (MAX_OBJECT_FACES / each, false)] {
let mut n = polygon_node(1, 16_384);
n.appearance.effects = vec![copies(k), fx(EXTRUDE, json!({}))];
assert_eq!(validate_solid(&n, EXTRUDE, &json!({})).is_ok(), fits, "on the object, {k} copies");
assert_eq!(solid_art(&n).is_some(), fits, "on the object, {k} copies");
let mut f = polygon_node(1, 16_384);
f.appearance.items[0].effects_mut().extend([copies(k), fx(EXTRUDE, json!({}))]);
assert_eq!(validate_three_d_at(&f, EXTRUDE, &json!({}), (Some(0), 1)).is_ok(), fits, "on the fill, {k} copies");
assert_eq!(solid_art(&f).is_some(), fits, "on the fill, {k} copies");
let mut g = Node::group(NodeId(9999), vec![Arc::new(polygon_node(1, 16_384))]);
g.appearance.effects = vec![copies(k), fx(EXTRUDE, json!({}))];
assert_eq!(validate_solid(&g, EXTRUDE, &json!({})).is_ok(), fits, "on a group, {k} copies");
assert_eq!(solid_art(&g).is_some(), fits, "on a group, {k} copies");
// A new effect goes after the copies.
let mut new = polygon_node(1, 16_384);
new.appearance.effects = vec![copies(k)];
assert_eq!(validate_three_d_at(&new, EXTRUDE, &json!({}), (None, 1)).is_ok(), fits, "a new effect, {k} copies");
}
// A hidden effect checked at its own index counts only the effects before it: copies after it
// copy the drawn art once it is shown again.
let mut hidden = polygon_node(1, 16_384);
let mut extrude = fx(EXTRUDE, json!({}));
extrude.visible = false;
hidden.appearance.effects = vec![extrude, copies(MAX_OBJECT_FACES / each)];
assert!(validate_three_d_at(&hidden, EXTRUDE, &json!({}), (None, 0)).is_ok());
hidden.appearance.effects[0].visible = true;
assert!(solid_art(&hidden).is_some());
}
/// At no volume Inflate's front is flat: turned, the fill's cells are all drawn before the stroke's,
/// whatever their depths, as the extrusion's caps are. When the fill puffs, a stroke too narrow to
/// puff on the grid stays flat and keeps its depths: the fill's puff is drawn over its far side.
+30
View File
@@ -59,6 +59,20 @@ fn the_meshes_of_one_object_share_one_triangle_budget() {
assert!(meshes_for(effect, &shapes, &mut total, MAX_MESH_TRIANGLES).is_err_and(|e| e.contains("too complex")));
}
/// A mesh past the budget stops the export before the solids after it are built.
#[test]
fn the_solids_after_a_mesh_past_the_budget_are_not_built() {
let mut n = square_node(1, 100.0);
n.appearance.effects.push(fx(EXTRUDE, json!({})));
let first = three_d_meshes(&n).unwrap()[0].mesh.triangles.len();
let shapes = [Profile { path: profile(&n).unwrap().0, rule: FillRule::NonZero, items: solid_paints(&n), opacity: 1.0, scopes: vec![] }];
let Some(effect) = n.appearance.effects.first() else { panic!("no effect") };
let mut total = MAX_MESH_TRIANGLES - first + 1;
SOLIDS_BUILT.with(|b| b.set(0));
assert!(meshes_for(effect, &shapes, &mut total, MAX_MESH_TRIANGLES).is_err_and(|e| e.contains("too complex")));
assert_eq!(SOLIDS_BUILT.with(std::cell::Cell::get), 1, "the stroke's solid is never built");
}
#[test]
fn revolve_stops_at_the_first_mesh_past_the_budget() {
// The fill revolves into a mesh; the stroke's profile, copied 1000 times, is too complex to
@@ -109,6 +123,22 @@ fn an_extruded_mesh_is_as_deep_as_the_effect() {
assert!((hi[2] - lo[2] - 30.0).abs() < 1e-9 && (hi[0] - lo[0] - 100.0).abs() < 1e-9, "{lo:?} {hi:?}");
}
/// Extrude & Bevel (Classic) exports the solid it draws: its bevel as wide as it is high.
#[test]
fn a_classic_extrusion_exports_its_own_bevel() {
let mut n = square_node(1, 100.0);
n.appearance.items.truncate(1);
let params = json!({ "bevel": "classic", "bevelHeight": 10.0 });
n.appearance.effects.push(fx(CLASSIC_EXTRUDE, params.clone()));
let meshes = three_d_meshes(&n).unwrap();
let p = crate::merged_params(CLASSIC_EXTRUDE, &params);
let path = profile(&n).unwrap().0;
let bounds = path.bounds().unwrap();
let own = vectorcraft_three_d::extrude_mesh(&path, FillRule::NonZero, bounds, classic_extrude_options(&p), view_options(&p)).unwrap();
assert_eq!(meshes.len(), 1);
assert_eq!(meshes[0].mesh, own);
}
#[test]
fn revolve_gives_a_mesh_in_the_top_fill() {
let mut b = BezPath::new();
+8 -16
View File
@@ -4,13 +4,13 @@ use std::collections::{HashMap, HashSet, VecDeque};
use std::sync::Arc;
use vectorcraft_doc::color::{Color, Paint};
use vectorcraft_doc::{Appearance, AppearanceItem, Document, Effect, Node, NodeId};
use vectorcraft_doc::{Appearance, Document, Effect, Node, NodeId};
use vectorcraft_geom::{Anchor, CubicBez, PathData, Point, SubPath};
use vectorcraft_three_d::Facet;
use super::{
INFLATE, Profile, ROTATE, facets, geometry, has_solid, inflate_options, is_container, is_plane, is_three_d, label_of, members, object_profile,
region, reshape_members, resolve, resolve_for, solid, solid_paints, solid_parts, union_bounds, view_options,
Profile, ROTATE, built_solids, facets, geometry, has_solid, is_container, is_plane, is_three_d, label_of, members, object_profile, region,
reshape_members, resolve, resolve_for, solid, solid_paints, solid_parts, union_bounds,
};
use crate::{GeomContext, is_geometry};
@@ -125,7 +125,8 @@ fn solid_face_paths(doc: Option<&Document>, n: &Node) -> Result<Vec<PathData>, S
/// The outlines of the facets effect `fx` builds from `shapes`, as `art_for` builds them: Rotate and
/// Rotate (Classic) turn every fill and stroke; Extrude & Bevel and Inflate build a solid from each shape's
/// top fill and from the outline of each stroke. A stroke whose solid is past the limits is left out,
/// as it is left out of the drawn art.
/// as it is left out of the drawn art; past the limits of the object's solids together, the result
/// is an error, as the canvas draws the source art.
fn facet_paths(fx: &Effect, shapes: &[Profile]) -> Result<Vec<PathData>, String> {
let label = label_of(&fx.id);
let b = union_bounds(shapes).ok_or_else(|| format!("{label} requires a shape with at least two anchors"))?;
@@ -141,18 +142,9 @@ fn facet_paths(fx: &Effect, shapes: &[Profile]) -> Result<Vec<PathData>, String>
return Ok(out);
}
let (parts, bounds) = solid_parts(shapes, b);
let built: Vec<Result<Vec<Facet>, String>> = if fx.id == INFLATE {
let shapes: Vec<(&PathData, vectorcraft_geom::FillRule)> = parts.iter().map(|(_, _, area, rule, ..)| (area, *rule)).collect();
vectorcraft_three_d::inflate_together(&shapes, bounds, inflate_options(&p), view_options(&p))
} else {
parts.iter().map(|(_, _, area, rule, ..)| facets(&fx.id, area, *rule, bounds, &p)).collect()
};
for ((item, ..), f) in parts.iter().zip(built) {
match f {
Ok(f) => out.extend(f.iter().map(Facet::path)),
Err(_) if matches!(item, AppearanceItem::Stroke(_)) => {}
Err(e) => return Err(e),
}
// The solids the art draws, each past the limits of the object's solids together as it is.
for f in built_solids(&fx.id, &p, &parts, bounds, vectorcraft_three_d::MAX_OBJECT_FACES) {
out.extend(f?.iter().flatten().map(Facet::path));
}
Ok(out)
}
+1 -1
View File
@@ -1,6 +1,6 @@
use serde_json::{Value, json};
use vectorcraft_doc::color::{Color, Paint};
use vectorcraft_doc::{Appearance, Node, NodeId};
use vectorcraft_doc::{Appearance, AppearanceItem, Node, NodeId};
use vectorcraft_geom::{BezPath, Rect};
use super::*;
+2 -2
View File
@@ -199,7 +199,7 @@ pub fn specs() -> Vec<CommandSpec> {
"New Symbol…",
[],
None,
"{name?, ids?|id?, registration?: 0..8 (9-point grid, 4 = centre; Symbol Options › Registration), exportType?: movieClip (default)|graphic, nineSlice?: bool, nineSliceGuides?: array, type?: static (default)|dynamic (Symbol Options › Symbol Type)} make a symbol from the selection and replace it with an instance; a frame of threaded text in the selection leaves its thread with the text it shows, which the symbol's art holds; nineSlice is Symbol Options › Enable Guides for 9-Slice Scaling, nineSliceGuides [left, top, right, bottom] as fractions 0..1 of the natural size (default a quarter each); an instance of a symbol with guides keeps its corners' size when scaled, its edges stretch along their length and its center in both directions → {name, id, registration, exportType, nineSlice, type}",
"{name?, ids?|id?, registration?: 0..8 (9-point grid, 4 = centre; Symbol Options › Registration), exportType?: movieClip (default)|graphic, nineSlice?: bool, nineSliceGuides?: array, type?: static (default)|dynamic (Symbol Options › Symbol Type)} make a symbol from the selection and replace it with an instance; a frame of threaded text in the selection leaves its thread with the text it shows, which the symbol's art holds; nineSlice is Symbol Options › Enable Guides for 9-Slice Scaling, nineSliceGuides [left, top, right, bottom] as fractions of the natural size in from each edge, each -16..16 (below 0 or above 1 puts a guide outside the art), with left + right < 1 and top + bottom < 1 (default a quarter each); an instance of a symbol with guides keeps its corners' size when scaled, its edges stretch along their length and its center in both directions → {name, id, registration, exportType, nineSlice, type}",
has_selection,
symbol_new
),
@@ -208,7 +208,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Symbol Options…",
[],
None,
"{name?, newName?, registration?: 0..8, exportType?: movieClip|graphic, nineSlice?: bool, nineSliceGuides?: array, type?: static|dynamic} rename a symbol (its instances and the graphics mapped onto 3D objects follow the new name) and/or set Symbol Options › Registration, Export Type, 9-slice guides (nineSliceGuides [left, top, right, bottom] fractions 0..1) and Symbol Type (a dynamic symbol's instances may change the appearance of objects in its art and stay linked; making it static drops those changes); default name: current → {name, registration, exportType, nineSlice, type}",
"{name?, newName?, registration?: 0..8, exportType?: movieClip|graphic, nineSlice?: bool, nineSliceGuides?: array, type?: static|dynamic} rename a symbol (its instances and the graphics mapped onto 3D objects follow the new name) and/or set Symbol Options › Registration, Export Type, 9-slice guides (nineSliceGuides [left, top, right, bottom] fractions in from each edge, each -16..16, with left + right < 1 and top + bottom < 1) and Symbol Type (a dynamic symbol's instances may change the appearance of objects in its art and stay linked; making it static drops those changes); default name: current → {name, registration, exportType, nineSlice, type}",
has_doc,
symbol_options
),
+9 -10
View File
@@ -47,21 +47,20 @@ fn export_type_param(p: &Value, cmd: &str) -> Result<Option<SymbolExportType>> {
}
/// `nineSlice` (bool) and `nineSliceGuides` ([left, top, right, bottom] fractions of the natural
/// size): `None` leaves the symbol alone, `Some(None)` turns 9-slice off, `Some(Some(g))` turns it
/// on with guides `g` (the symbol's current ones, else a quarter in from each edge, when none are
/// given).
/// size, below 0 or above 1 for a guide outside the art): `None` leaves the symbol alone,
/// `Some(None)` turns 9-slice off, `Some(Some(g))` turns it on with guides `g` (the symbol's
/// current ones, else a quarter in from each edge, when none are given).
fn nine_slice_param(p: &Value, cmd: &str, current: Option<SymbolNineSlice>) -> Result<Option<Option<SymbolNineSlice>>> {
let on = match p.get("nineSlice") {
None | Some(Value::Null) => None,
Some(v) => Some(v.as_bool().ok_or_else(|| bad(cmd, "nineSlice must be true or false"))?),
};
let guides =
match p.get("nineSliceGuides") {
None | Some(Value::Null) => None,
Some(v) => Some(SymbolNineSlice::from_value(v).ok_or_else(|| {
bad(cmd, "nineSliceGuides must be [left, top, right, bottom], each 0..1, with left + right < 1 and top + bottom < 1")
})?),
};
let guides = match p.get("nineSliceGuides") {
None | Some(Value::Null) => None,
Some(v) => Some(SymbolNineSlice::from_value(v).ok_or_else(|| {
bad(cmd, "nineSliceGuides must be [left, top, right, bottom], each -16..16, with left + right < 1 and top + bottom < 1")
})?),
};
Ok(match (on, guides) {
(Some(false), _) => Some(None),
(None, None) => None,
+29 -5
View File
@@ -88,8 +88,9 @@ pub struct Clipboard {
/// The artboard the objects were copied from (none when they lie on no artboard; the first of
/// [`Self::artboards`] when there are any): Paste on All Artboards keeps their offset to it.
pub source_artboard: Option<Rect>,
/// Per object: the name of the layer it was copied from (Paste Remembers Layers).
pub source_layers: Vec<Option<String>>,
/// Per object: the layer or sublayer it was copied from and the layers around it (Paste
/// Remembers Layers); none when that layer has no name.
pub source_layers: Vec<Option<SourceLayer>>,
/// The open document the objects came from ([`DocState::uid`]): pasting back into it uses its
/// own resources as they are now.
pub source_doc: Option<u64>,
@@ -101,6 +102,29 @@ pub struct Clipboard {
pub guides: Vec<vectorcraft_doc::Guide>,
}
/// The layer an object was copied from, as Paste Remembers Layers finds it again: the top-level
/// layer first, down to the layer or sublayer that holds the object.
#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)]
pub struct SourceLayer {
/// The layers' ids in the source document ([`Clipboard::source_doc`]).
pub ids: Vec<NodeId>,
/// The layers' names (an unnamed layer above the one that holds the object is "").
pub names: Vec<String>,
}
impl SourceLayer {
/// The layers around the object `anc` ends with ([`Document::ancestry`]); none when the layer
/// that holds it has no name.
fn of(d: &Document, anc: &[NodeId]) -> Option<Self> {
let layers: Vec<&Node> = anc.iter().rev().skip(1).filter_map(|a| d.node(*a).filter(|l| l.is_layer())).collect();
layers.first()?.name.as_ref()?;
Some(Self {
ids: layers.iter().rev().map(|l| l.id).collect(),
names: layers.iter().rev().map(|l| l.name.clone().unwrap_or_default()).collect(),
})
}
}
/// Indices of segments selected on `sp` (either explicitly or via incident anchors).
pub(crate) fn subpath_selected_segments(
sp: &vectorcraft_geom::SubPath,
@@ -256,7 +280,7 @@ impl Clipboard {
let mut compound_bounds: std::collections::HashMap<NodeId, Option<vectorcraft_geom::Rect>> = std::collections::HashMap::new();
for id in roots {
let (Some(n), Some(anc)) = (d.node(*id), d.ancestry(*id)) else { continue };
let layer_name = anc.iter().rev().skip(1).find_map(|a| d.node(*a).filter(|l| l.is_layer())).and_then(|l| l.name.clone());
let source_layer = SourceLayer::of(d, &anc);
let compound_parent = anc.iter().rev().skip(1).find_map(|a| d.node(*a).filter(|p| matches!(p.kind, NodeKind::Compound { .. })));
// Gradients fitted to the compound's bounds are pinned there, as a split pins them.
let gradient_box = compound_parent
@@ -299,11 +323,11 @@ impl Clipboard {
if direct && let Some(pieces) = extract_direct_selection(n, &st.selection) {
for piece in pieces {
nodes.push(inherit_appearance(piece));
source_layers.push(layer_name.clone());
source_layers.push(source_layer.clone());
}
} else {
nodes.push(inherit_appearance(n.clone()));
source_layers.push(layer_name);
source_layers.push(source_layer);
}
}
// Symbol instances are measured by their art.
+114 -15
View File
@@ -1,6 +1,6 @@
//! File (document-level) and Edit commands, plus document queries.
use std::collections::{BTreeMap, BTreeSet};
use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::sync::Arc;
use serde_json::{Value, json};
@@ -13,7 +13,7 @@ use super::{
f64_req, finite_numbers, has_clipboard, has_doc, has_selection, has_selection_guides_or_artboard_tool, has_selection_or_guides, index, number_or,
object_param, ok, point_param, str_param, switch_or,
};
use crate::{Clipboard, EngineError, inspect};
use crate::{Clipboard, EngineError, SourceLayer, inspect};
/// Register editing commands, including document-to-document artwork drops and their parameter contracts.
pub fn specs() -> Vec<CommandSpec> {
@@ -179,7 +179,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Paste",
["Edit"],
Some("Cmd+V"),
"{center?: [x, y], artboardsAt?: [x, y], dx?, dy?, swatchConflict?} paste centred on `center` (the app passes the view centre), else offset by dx/dy (default: the Paste Offset preference). Pasting brings the image blobs, symbols, patterns, global and spot swatches (with the tint swatches of the tints used), gradient swatches, graphic styles, character and paragraph styles and brushes the objects use; one of the same name that differs comes in renamed. swatchConflict, for a swatch whose name the document gives another colour (clipboard.conflicts): \"merge\" (default: the objects take the document's swatch) | \"add\" (the pasted swatch comes in renamed) | {name: \"merge\"|\"add\"}. With Paste Remembers Layers on (layer.pasteRemembersLayers), objects go back into the layers they came from (by name; made when missing). Artboards copied with artboard.copy come with their art, together right of the last artboard as they lay, or centered on `artboardsAt` (the Artboard tool's canvas menu passes the right-click point; a value that is not [x, y] is an error) (the other paste commands but Paste on All Artboards: where they were), their art back in the layers it came from, and the Artboard tool, when chosen, selects them. In Draw Inside (view.drawMode) the objects go inside the object drawn into, as new art does, and Paste Remembers Layers doesn't apply; edit.pasteInPlace and edit.pasteOnAllArtboards do the same, and in Draw Behind they go behind the selection as edit.pasteInBack puts them; edit.pasteInFront and edit.pasteInBack ignore the drawing mode → {ids, artboard: the first new artboard's index or null, artboards: the new artboards' indices, added: resources added, merged: conflicts merged, renamed: [{kind, from, to}]}",
"{center?: [x, y], artboardsAt?: [x, y], dx?, dy?, swatchConflict?} paste centred on `center` (the app passes the view centre), else offset by dx/dy (default: the Paste Offset preference). Pasting brings the image blobs, symbols, patterns, global and spot swatches (with the tint swatches of the tints used), gradient swatches, graphic styles, character and paragraph styles and brushes the objects use; one of the same name that differs comes in renamed. swatchConflict, for a swatch whose name the document gives another colour (clipboard.conflicts): \"merge\" (default: the objects take the document's swatch) | \"add\" (the pasted swatch comes in renamed) | {name: \"merge\"|\"add\"}. With Paste Remembers Layers on (layer.pasteRemembersLayers), objects go back into the layers and sublayers they came from (by the names of the layer and the layers around it in another document; a missing sublayer is made inside its layer; a hidden or locked one is an error and nothing is pasted). Artboards copied with artboard.copy come with their art, together right of the last artboard as they lay, or centered on `artboardsAt` (the Artboard tool's canvas menu passes the right-click point; a value that is not [x, y] is an error) (the other paste commands but Paste on All Artboards: where they were), their art back in the layers it came from, and the Artboard tool, when chosen, selects them. In Draw Inside (view.drawMode) the objects go inside the object drawn into, as new art does, and Paste Remembers Layers doesn't apply; edit.pasteInPlace and edit.pasteOnAllArtboards do the same, and in Draw Behind they go behind the selection as edit.pasteInBack puts them; edit.pasteInFront and edit.pasteInBack ignore the drawing mode → {ids, artboard: the first new artboard's index or null, artboards: the new artboards' indices, added: resources added, merged: conflicts merged, renamed: [{kind, from, to}]}",
has_clipboard,
|s, p| paste(s, p, PasteMode::Offset)
),
@@ -1380,6 +1380,9 @@ fn paste_clip(s: &mut Session, p: &Value, mode: PasteMode, clip: &Clipboard, cho
&& inside.is_none()
&& (st.doc.paste_remembers_layers || boards.is_some())
&& parent.is_some_and(|p| st.doc.node(p).is_some_and(Node::is_layer));
// Each object's remembered layer, found before anything is pasted: a hidden or locked one
// refuses the whole paste.
let remembered = if remember { remembered_layers(&st.doc, &clip.source_layers, same_doc)? } else { vec![] };
// Front/back: relative to the selection (top-most / bottom-most selected object); with
// nothing selected, the top / bottom of the current layer. Art other than paths goes beside
// the compound path that holds the selected object, not into it.
@@ -1423,7 +1426,8 @@ fn paste_clip(s: &mut Session, p: &Value, mode: PasteMode, clip: &Clipboard, cho
.flat_map(|(all, dv)| all.iter().map(move |a| (a, dv)))
.map(|(a, dv)| super::panelcmds::push_artboard_copy(d, a, a.rect + dv))
.collect();
let mut layers: BTreeMap<&str, NodeId> = BTreeMap::new();
// The layers made for remembered layers the document lacks, by parent and name.
let mut made = HashMap::new();
// Objects pasted into each parent so far (keeps their order in front and back pastes).
let mut placed: BTreeMap<Option<NodeId>, usize> = BTreeMap::new();
let mut new_ids = vec![];
@@ -1437,8 +1441,9 @@ fn paste_clip(s: &mut Session, p: &Value, mode: PasteMode, clip: &Clipboard, cho
// including the pattern phase, independently of transform-tool settings.
c.transform(xf, sc);
}
let layer = match clip.source_layers.get(k) {
Some(Some(name)) if remember => Some(*layers.entry(name).or_insert_with(|| layer_named(d, name))),
let layer = match remembered.get(k) {
Some(Some(Remembered::Layer(l))) => Some(*l),
Some(Some(Remembered::Make { parent, names })) => make_layers(d, &mut made, *parent, names)?,
_ => None,
};
// In a clip group or a clipping layer the bottom child is the clipping path: art pasted
@@ -1557,17 +1562,111 @@ fn paste_anchor(doc: &Document, id: NodeId, can_enter_compound: bool) -> NodeId
}
}
/// The first unlocked layer or sublayer called `name` (topmost first), or a new top layer.
fn layer_named(d: &mut Document, name: &str) -> NodeId {
let mut found = None;
for l in d.layers.iter().rev() {
l.walk(&mut |n| {
if found.is_none() && n.is_layer() && !n.locked && n.name.as_deref() == Some(name) {
found = Some(n.id);
/// Where Paste Remembers Layers puts an object: a layer or sublayer of the document, or new
/// layers `names`, each inside the one before, the first under `parent` (none: on top).
#[derive(Clone, Debug, PartialEq)]
enum Remembered {
Layer(NodeId),
Make { parent: Option<NodeId>, names: Vec<String> },
}
/// [`remembered_layer`] for each object's source layer, worked out once for each layer.
fn remembered_layers(d: &Document, sources: &[Option<SourceLayer>], same_doc: bool) -> Result<Vec<Option<Remembered>>> {
let mut found: HashMap<&SourceLayer, Remembered> = HashMap::new();
sources
.iter()
.map(|src| {
let Some(src) = src else { return Ok(None) };
if let Some(r) = found.get(src) {
return Ok(Some(r.clone()));
}
});
let r = remembered_layer(d, src, same_doc)?;
found.insert(src, r.clone());
Ok(Some(r))
})
.collect()
}
/// The layer `src` names in `d`. In the document it was copied from, the layer that held the
/// object is kept while it is there with its name, wherever it was moved; else the layers around
/// it still where they were (by id) are kept. Below them, and in another document from the top,
/// each name is matched among the layers inside the one above (the topmost of the same name whose
/// layers match the most names, a shown and unlocked one first). The names left unmatched are
/// made. A matched layer that is hidden or locked, or inside one that is, is an error.
fn remembered_layer(d: &Document, src: &SourceLayer, same_doc: bool) -> Result<Remembered> {
let held = |id: &NodeId| d.node(*id).is_some_and(|n| n.is_layer() && n.name.as_ref() == src.names.last());
let kept = if same_doc && src.ids.last().is_some_and(held) {
src.ids.len()
} else if same_doc {
(1..=src.ids.len())
.rev()
.find(|&j| d.node(src.ids[j - 1]).is_some_and(Node::is_layer) && d.ancestry(src.ids[j - 1]).is_some_and(|a| a == src.ids[..j]))
.unwrap_or(0)
} else {
0
};
let rest = &src.names[kept..];
let (end, matched, _) = named_chain(d, kept.checked_sub(1).map(|j| src.ids[j]), rest);
if let Some(l) = end
&& !d.ancestry(l).is_some_and(|a| a.iter().all(|i| d.node(*i).is_some_and(|n| n.visible && !n.locked)))
{
return Err(EngineError::Other("the target layer is locked or hidden".into()));
}
found.unwrap_or_else(|| d.add_layer(Some(name)))
Ok(match end {
Some(l) if matched == rest.len() => Remembered::Layer(l),
parent => Remembered::Make { parent, names: rest[matched..].to_vec() },
})
}
/// The deepest chain of layers inside `parent` (none: the top level) named `names` one inside the
/// other: its last layer (`parent` when none matches), how many names it matched and whether all
/// its layers are shown and unlocked. Of chains as deep, the topmost shown and unlocked one wins.
fn named_chain(d: &Document, parent: Option<NodeId>, names: &[String]) -> (Option<NodeId>, usize, bool) {
let mut best = (parent, 0, true);
let Some((name, rest)) = names.split_first() else { return best };
let siblings = match parent {
None => Some(&d.layers),
Some(p) => d.node(p).and_then(Node::children),
};
for l in siblings.into_iter().flatten().rev().filter(|l| l.is_layer() && l.name.as_deref() == Some(name.as_str())) {
let (end, n, open) = named_chain(d, Some(l.id), rest);
let chain = (end, n + 1, open && l.visible && !l.locked);
if (chain.1, chain.2) > (best.1, best.2) {
best = chain;
}
}
best
}
/// Layers `names`, each inside the one before, the first under `parent` (none: on top); `made`
/// keeps the ones a paste has made, by parent and name, so they are made once. The last one, or
/// none when `names` is empty.
fn make_layers(
d: &mut Document,
made: &mut HashMap<(Option<NodeId>, String), NodeId>,
parent: Option<NodeId>,
names: &[String],
) -> Result<Option<NodeId>> {
let mut at = parent;
for name in names {
let key = (at, name.clone());
let id = match made.get(&key) {
Some(id) => *id,
None => {
let id = match at {
None => d.add_layer(Some(name)),
Some(p) => {
let layer = super::layer::make_layer(d, Some(name));
d.insert(Some(p), usize::MAX, layer)?
}
};
made.insert(key, id);
id
}
};
at = Some(id);
}
Ok(at.filter(|_| !names.is_empty()))
}
fn duplicate(s: &mut Session, p: &Value) -> Result<Value> {
+4 -3
View File
@@ -461,9 +461,10 @@ pub(crate) fn apply(s: &mut Session, p: &Value) -> Result<Value> {
for (target, at) in targets.iter().copied().zip(item.per_target(s, &targets)) {
let d = &s.doc()?.doc;
let n = d.node(target).ok_or(EngineError::NoNode(target))?;
// A new effect goes after the item's others.
// A new effect goes after the item's (or the object's) others.
let on = at.and_then(|at| at.effects_item(&n.appearance, C).ok()).flatten();
let on = on.and_then(|i| Some((i, n.appearance.items.get(i)?.effects().len())));
let on = on.and_then(|i| Some((Some(i), n.appearance.items.get(i)?.effects().len())));
let on = on.unwrap_or((None, n.appearance.effects.len()));
effects::validate_three_d_at_in(Some(d), n, id, &effect.params, on).map_err(|e| bad(C, e))?;
if let Some(name) = effects::missing_symbol(d, &effect.params, None) {
return Err(bad(C, format!("no symbol named `{name}`")));
@@ -793,7 +794,7 @@ fn set_params(s: &mut Session, p: &Value) -> Result<Value> {
return Err(bad(C, format!("no symbol named `{name}`")));
}
if visible != Some(false) {
effects::validate_three_d_at_in(Some(d), n, to, &prospective, target.map(|item| (item, index))).map_err(|e| bad(C, e))?;
effects::validate_three_d_at_in(Some(d), n, to, &prospective, (target, index)).map_err(|e| bad(C, e))?;
} else {
// Hidden, the effect draws nothing, so its object need not fit. The values given are
// checked, and after a change of 3D type so is every value it keeps.
+1 -1
View File
@@ -131,7 +131,7 @@ fn map_graphic(s: &mut Session, p: &Value) -> Result<Value> {
graphic.scale = frame.fitting_scale(art);
}
let params = effects::with_graphic(&effects::merged_params(&effect.id, &effect.params), &graphic);
effects::validate_three_d_at_in(Some(d), n, &effect.id, &params, item.map(|i| (i, index))).map_err(|e| bad(C, e))?;
effects::validate_three_d_at_in(Some(d), n, &effect.id, &params, (item, index)).map_err(|e| bad(C, e))?;
edits.push((id, item, index, graphic));
}
let first = edits.first().map(|(.., g)| g.to_value());
+38
View File
@@ -169,6 +169,44 @@ fn solid_effects_apply_to_a_group_and_its_members_stay_editable() {
assert_eq!(s.doc().unwrap().doc, before, "nothing changed");
}
/// Extrude & Bevel is refused, and nothing changes, on a path whose fill's and strokes' solids each
/// fit but together pass the limit of their faces; with one stroke the effect applies.
#[test]
fn extrude_is_refused_when_its_solids_together_are_too_complex() {
use vectorcraft_doc::color::{Color, Paint};
use vectorcraft_doc::{Appearance, AppearanceItem};
let (mut s, id) = session_with_rect();
let points: Vec<vectorcraft_geom::Point> = (0..16_384)
.map(|k| {
let (sin, cos) = (k as f64 * std::f64::consts::TAU / 16_384.0).sin_cos();
vectorcraft_geom::Point::new(20_000.0 + 10_000.0 * cos, 20_000.0 + 10_000.0 * sin)
})
.collect();
let polygon = vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&points, true));
let painted = |strokes: usize| {
let mut items = Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0).items;
let stroke = AppearanceItem::Stroke(vectorcraft_doc::StrokeLayer::new(Paint::solid(Color::WHITE), 20.0));
items.extend(std::iter::repeat_n(stroke, strokes));
items
};
let set = |s: &mut Session, strokes: usize| {
let n = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc).node_mut(id).unwrap();
let NodeKind::Path { path, live, .. } = &mut n.kind else { panic!("a path") };
*path = polygon.clone();
*live = None;
n.appearance.items = painted(strokes);
};
// The fill's solid and each stroke's fit on their own; sixty strokes' together do not.
set(&mut s, 60);
let before = s.doc().unwrap().doc.clone();
let err = s.execute("effect.apply", &json!({"effect": "threeD.extrude", "ids": [id.0], "item": null})).unwrap_err().to_string();
assert!(err.contains("The 3D surface is too complex; simplify the shape"), "{err}");
assert_eq!(s.doc().unwrap().doc, before, "nothing changed");
set(&mut s, 1);
s.execute("effect.apply", &json!({"effect": "threeD.extrude", "ids": [id.0], "item": null})).unwrap();
assert!(effects::solid_art(&node(&s, id)).is_some());
}
/// A group of a clipping group (a rectangle clipped by an ellipse) and a rectangle: the session,
/// the clipping group and the group.
fn group_with_a_clipping_group() -> (Session, NodeId, NodeId) {
+1 -1
View File
@@ -200,7 +200,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Paste Remembers Layers",
["Window", "Layers"],
None,
"{on?} (default: toggle) the document option: on, the Paste commands put objects back into the layers they were copied from (by name; a missing one is made on top), off into the current layer; one undo step when it changes (document.inspect → pasteRemembersLayers) → {on}",
"{on?} (default: toggle) the document option: on, the Paste commands put objects back into the layers or sublayers they were copied from (in that document while they are still there, else by the names of the layer and the layers around it, the topmost match first; a missing sublayer is made inside its layer, a missing top-level layer on top; a hidden or locked one is an error and nothing is pasted), off into the current layer; one undo step when it changes (document.inspect → pasteRemembersLayers) → {on}",
has_doc,
paste_remembers_layers
),
+89 -19
View File
@@ -387,6 +387,26 @@ fn keep_eps_preview(low_res_proxy_eps: bool, g: &Group, d: &Document) -> bool {
low_res_proxy_eps && g.document.is_none() && linked_eps(&g.link) && previewing(d, &g.key)
}
/// Is the linked file `f` found a DCS file? Only the start of the file is read, unless a binary EPS
/// header puts its PostScript further on; a DCS file read in full stays in `f`. A file that can't
/// be read is not one.
fn is_dcs_file(f: &mut Found) -> bool {
use super::place::dcs;
if let Some(b) = &f.bytes {
return dcs::is_dcs(b);
}
let Ok(head) = fileio::read_file_head(&f.path, dcs::HEAD_BYTES) else { return false };
if let Some(is) = dcs::head_is_dcs(&head, f.size) {
return is;
}
let Ok(b) = f.read() else { return false };
let is = dcs::is_dcs(&b);
if is {
f.bytes = Some(b);
}
is
}
/// Does group `g` of `d` show something other than its file: an image its preview, a placed
/// document nothing (its file's bytes are gone)?
fn stale(d: &Document, g: &Group) -> bool {
@@ -609,9 +629,13 @@ fn clip_shape((frame, room): Clip) -> PathData {
enum ClipTo {
/// It stays as it is.
Keep,
/// It is clipped to this path: the clipping path of the clip group holding just it changes,
/// else it goes into a new clip group.
/// It is clipped to this path (Placement Options' clip): the clipping path of the clip group
/// holding just it changes, else it goes into a new clip group.
Path(PathData),
/// It is clipped to this path, the clipping path its DCS file draws it through: as [`ClipTo::Path`],
/// except that a plain group holding just it (as [`ClipTo::Off`] leaves one) becomes a clip group
/// again.
File(PathData),
/// It goes into a new clip group of this path, inside the clip group that holds it.
Nest(PathData),
/// The clipping path of the clip group holding just it goes (a DCS file's clipping path that
@@ -673,7 +697,7 @@ fn clip_to(
match img.clip.as_ref().map(|path| path.transformed(new_xf)) {
// A clipping mask made in the document stays, with the file's clip group inside it.
Some(path) if held.is_some() && !file_held => ClipTo::Nest(path),
Some(path) => ClipTo::Path(path),
Some(path) => ClipTo::File(path),
None if file_held => ClipTo::Off,
None => ClipTo::Keep,
}
@@ -722,7 +746,7 @@ impl Nested<'_> {
let mut new = Arc::new(new);
self.update(&mut new, true);
*n = match clip {
ClipTo::Path(path) | ClipTo::Nest(path) => Arc::new(self.clip_group(new, path)),
ClipTo::Path(path) | ClipTo::File(path) | ClipTo::Nest(path) => Arc::new(self.clip_group(new, path)),
ClipTo::Keep | ClipTo::Off => new,
};
}
@@ -738,12 +762,16 @@ impl Nested<'_> {
let mut slots: Vec<(usize, Arc<Node>)> = vec![];
// The object a clip group that loses its clipping path holds alone.
let mut declipped = None;
// The clipping path and object of a plain group holding just the object, which becomes a
// clip group again.
let mut reclipped = None;
if let Some(children) = n.children() {
// A clip group holding just the object: its clipping path changes.
let clip_path = match (&n.kind, &children[..]) {
(NodeKind::Group { clip: true, .. }, [c, _]) if matches!(c.kind, NodeKind::Path { clipping: true, .. }) => Some(c),
_ => None,
};
let plain = matches!((&n.kind, &children[..]), (NodeKind::Group { clip: false, .. }, [_]));
for (i, c) in children.iter().enumerate() {
if !(nested && (self.pick)(c)) {
let mut new = Arc::clone(c);
@@ -762,14 +790,15 @@ impl Nested<'_> {
self.update(&mut new, true);
match (clip, clip_path) {
(ClipTo::Keep, _) => slots.push((i, new)),
(ClipTo::Path(clip), Some(path)) if i == 1 => {
(ClipTo::Path(clip) | ClipTo::File(clip), Some(path)) if i == 1 => {
let mut path = Node::clone(path);
if let NodeKind::Path { path: p, .. } = &mut path.kind {
*p = clip;
}
slots.extend([(0, Arc::new(path)), (1, new)]);
}
(ClipTo::Path(clip) | ClipTo::Nest(clip), _) => {
(ClipTo::File(clip), None) if plain => reclipped = Some((clip, new)),
(ClipTo::Path(clip) | ClipTo::File(clip) | ClipTo::Nest(clip), _) => {
let group = self.clip_group(new, clip);
slots.push((i, Arc::new(group)));
}
@@ -778,13 +807,21 @@ impl Nested<'_> {
}
}
}
if mask.is_none() && slots.is_empty() && declipped.is_none() {
if mask.is_none() && slots.is_empty() && declipped.is_none() && reclipped.is_none() {
return;
}
let reclipped = reclipped.map(|(clip, object)| (Arc::new(self.clipping_path(clip)), object));
let n = Arc::make_mut(n);
if let (Some(art), Some(m)) = (mask, n.extras_if_any().and_then(|e| e.mask.as_mut())) {
m.art = art;
}
// A plain group of just the object that becomes a clip group again.
if let Some((path, object)) = reclipped {
if let NodeKind::Group { children, clip } = &mut n.kind {
(*children, *clip) = (vec![path, object], true);
}
return;
}
// A clip group that stays as a plain group of just the object.
if let Some(object) = declipped {
if let NodeKind::Group { children, clip } = &mut n.kind {
@@ -803,15 +840,18 @@ impl Nested<'_> {
/// A clip group of `object` clipped to `clip`, as [`clip_image_to`] makes one in the layers.
fn clip_group(&mut self, object: Arc<Node>, clip: PathData) -> Node {
let (path_id, group_id) = (NodeId(self.next), NodeId(self.next + 1));
self.next += 2;
let none = vectorcraft_color::Paint::None;
let mut path = Node::path(path_id, clip, Appearance::basic(none.clone(), none, 0.0));
if let NodeKind::Path { clipping, .. } = &mut path.kind {
*clipping = true;
}
let path = self.clipping_path(clip);
let group_id = NodeId(self.next);
self.next += 1;
Node::new(group_id, NodeKind::Group { children: vec![Arc::new(path), object], clip: true })
}
/// A clipping path of `clip`, with the next node id.
fn clipping_path(&mut self, clip: PathData) -> Node {
let id = NodeId(self.next);
self.next += 1;
clipping_path(id, clip)
}
}
/// Placed documents `ids` show `src`, read from the file `link` points at, each placed as its
@@ -944,15 +984,41 @@ fn clip_image_to(d: &mut Document, id: NodeId, path: PathData) -> Result<()> {
new_clip_group(d, id, path)
}
/// Clip object `id` of `d` to `path`, the clipping path its DCS file draws it through: the clipping
/// path of the clip group holding just it changes, a plain group holding just it (as [`unclip`]
/// leaves one) becomes a clip group again, else it goes into a new clip group.
fn clip_file_to(d: &mut Document, id: NodeId, path: PathData) -> Result<()> {
if set_clip_path(d, id, path.clone()) {
return Ok(());
}
let plain = d.parent_of(id).filter(|g| match d.node(*g).map(|n| &n.kind) {
Some(NodeKind::Group { children, clip: false }) => matches!(&children[..], [o] if o.id == id),
_ => false,
});
let Some(g) = plain else { return new_clip_group(d, id, path) };
let clip = clipping_path(d.alloc_id(), path);
d.insert(Some(g), 0, clip)?;
if let Some(Node { kind: NodeKind::Group { clip, .. }, .. }) = d.node_mut(g) {
*clip = true;
}
Ok(())
}
/// A clipping path `id` of `path`, unpainted.
fn clipping_path(id: NodeId, path: PathData) -> Node {
let none = vectorcraft_color::Paint::None;
let mut clip = Node::path(id, path, Appearance::basic(none.clone(), none, 0.0));
if let NodeKind::Path { clipping, .. } = &mut clip.kind {
*clipping = true;
}
clip
}
/// Put object `id` of `d` into a new clip group of `path`, where it is.
fn new_clip_group(d: &mut Document, id: NodeId, path: PathData) -> Result<()> {
let (par, index, _) = d.position(id).ok_or(EngineError::NoNode(id))?;
let image = d.remove(id)?;
let none = vectorcraft_color::Paint::None;
let mut clip = Node::path(d.alloc_id(), path, Appearance::basic(none.clone(), none, 0.0));
if let NodeKind::Path { clipping, .. } = &mut clip.kind {
*clipping = true;
}
let clip = clipping_path(d.alloc_id(), path);
let group = Node::new(d.alloc_id(), NodeKind::Group { children: vec![std::sync::Arc::new(clip), image], clip: true });
d.insert(par, index, group)?;
Ok(())
@@ -1017,6 +1083,7 @@ fn install(d: &mut Document, ids: &[NodeId], (link, img): FileRead, force: Optio
clips.into_iter().try_for_each(|(id, clip)| match clip {
ClipTo::Keep => Ok(()),
ClipTo::Path(path) => clip_image_to(d, id, path),
ClipTo::File(path) => clip_file_to(d, id, path),
ClipTo::Nest(path) => new_clip_group(d, id, path),
ClipTo::Off => unclip(d, id),
})
@@ -1159,6 +1226,9 @@ pub fn resolve(d: &mut Document, base: LinkBase, update: bool, low_res_proxy_eps
}
(Status::Ok, Some(mut f)) => {
let preview = previewing(d, &g.key);
// A DCS file is read in full even with the proxy: its plates print and separate on
// their own inks.
let eps_preview = eps_preview && !is_dcs_file(&mut f);
if let Some((blob, hash)) = read_images.get(&f.path).filter(|_| preview && !eps_preview).cloned() {
store_image(d, &g.key, blob, true);
let link = f.link_hashed(hash, &g.link);
+6 -6
View File
@@ -244,7 +244,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Move Envelope Mesh Point",
[],
None,
"{id, index, x, y, handle?: 0 right|1 left|2 down|3 up} move a point of a mesh envelope (its handles follow), or with `handle` place that handle end at (x, y); object.mesh.movePoint, addLine and deletePoint edit mesh envelopes too",
"{id, index, x, y, handle?: 0 right|1 left|2 down|3 up} move a point of a mesh or warp envelope (its handles follow), or with `handle` place that handle end at (x, y); a warp's points are those of its grid (4×4 patches, or 8×8 or 16×16 where 4×4 draws more than 0.1% of its diagonal away from the warp), and its first edit makes it a mesh envelope on that grid in the same undo step (a warp no such grid follows is refused: Reset with Mesh first); object.mesh.movePoint, movePoints, addLine and deletePoint edit mesh and warp envelopes too",
has_doc,
env_set_mesh_point
),
@@ -263,7 +263,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Set Mesh Point Color",
[],
None,
"{id, index | points: [index…] | items: [{id, index | points}…], color? (#rrggbbaa and #rgba are refused), keepModel?: bool (as paint.setFill), opacity?: 0..1} colour and/or opacity of gradient mesh points (one undo step; an index out of range changes nothing)",
"{id, index | points: [index…] | items: [{id, index | points}…], color? (#rrggbbaa and #rgba are refused), keepModel?: bool (as paint.setFill), opacity?: 0..1} colour and/or opacity of gradient mesh points (one undo step; an index out of range changes nothing, and so does a call that changes no point, with no undo step)",
has_doc,
mesh_set_color
),
@@ -272,7 +272,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Move Mesh Point",
[],
None,
"{id, index, x, y, handle?: 0 right|1 left|2 down|3 up} move a point of a gradient mesh or mesh envelope (its handles follow), or with `handle` place that handle end at (x, y)",
"{id, index, x, y, handle?: 0 right|1 left|2 down|3 up} move a point of a gradient mesh or a mesh or warp envelope (its handles follow; a warp becomes a mesh envelope, see object.envelope.setMeshPoint), or with `handle` place that handle end at (x, y)",
has_doc,
mesh_move_point
),
@@ -281,7 +281,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Move Mesh Points",
[],
None,
"{id, points: [index…] | items: [{id, index | points}…], dx, dy} move points of gradient meshes or mesh envelopes by (dx, dy), their handles with them (one undo step; an index out of range changes nothing)",
"{id, points: [index…] | items: [{id, index | points}…], dx, dy} move points of gradient meshes or mesh or warp envelopes by (dx, dy), their handles with them (warps become mesh envelopes, see object.envelope.setMeshPoint; one undo step; an index out of range changes nothing, and so does a call that moves no point, with no undo step)",
has_doc,
mesh_move_points
),
@@ -290,7 +290,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Add Mesh Line",
[],
None,
"{id, x, y, color? (#rrggbbaa and #rgba are refused), keepModel?: bool (as paint.setFill), tolerance?: pt (0)} add a row and a column through (x, y), inside or on the edge, to a gradient mesh (new point in `color`) or a mesh envelope; a point outside within `tolerance` of the edge adds them through the nearest point of the edge; at a point that is already a mesh point it adds no line, and records no undo step unless `color` changes a gradient mesh's point (a mesh envelope's points have no color) → {index}",
"{id, x, y, color? (#rrggbbaa and #rgba are refused), keepModel?: bool (as paint.setFill), tolerance?: pt (0)} add a row and a column through (x, y), inside or on the edge, to a gradient mesh (new point in `color`) or a mesh or warp envelope (a warp becomes a mesh envelope, see object.envelope.setMeshPoint); a point outside within `tolerance` of the edge adds them through the nearest point of the edge; at a point that is already a mesh point it adds no line, and records no undo step unless `color` changes a gradient mesh's point (an envelope's points have no color) → {index}",
has_doc,
mesh_add_line
),
@@ -299,7 +299,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Delete Mesh Point",
[],
None,
"{id, index} delete the mesh lines through a point of a gradient mesh or mesh envelope",
"{id, index} delete the mesh lines through a point of a gradient mesh or a mesh or warp envelope (a warp becomes a mesh envelope, see object.envelope.setMeshPoint)",
has_doc,
mesh_delete_point
),
+15 -3
View File
@@ -1,6 +1,6 @@
use super::super::object::choice;
use super::common::{fix_ids, ids_json, is_envelope, roots_param, selected_of, wrap};
use super::mesh::{handle_param, index_param, whole};
use super::mesh::{envelope_edit_grid, handle_param, index_param, mesh_envelope, warp_point_stays, whole};
use super::{
Affine, Appearance, Arc, Beside, Color, Document, EngineError, EnvelopeKind, EnvelopeMap, EnvelopeOptions, Node, NodeId, NodeKind, Paint,
PathData, Point, PreserveShape, Result, Session, Value, bad, check_numbers, f64_or, f64_req, json, live, object_param, ok, switch_or, text_param,
@@ -79,8 +79,7 @@ fn mesh_kind(map: &EnvelopeMap, maintain: bool, rows: u32, cols: u32) -> Envelop
return EnvelopeKind::Mesh { rows, cols, points: map.grid(rows, cols), handles: vec![] };
}
// The surface's points with handles along it: the grid lines keep the current shape.
let m = map.surface_mesh(rows, cols, Color::BLACK);
EnvelopeKind::Mesh { rows, cols, points: m.points.iter().map(|q| q.p).collect(), handles: m.points.iter().map(|q| q.handles).collect() }
mesh_envelope(&map.surface_mesh(rows, cols, Color::BLACK))
}
pub(super) fn env_make_mesh(s: &mut Session, p: &Value) -> Result<Value> {
@@ -428,7 +427,20 @@ pub(super) fn env_set_mesh_point(s: &mut Session, p: &Value) -> Result<Value> {
let index = index_param(p, "index", C)?;
let q = Point::new(f64_req(p, "x", C)?, f64_req(p, "y", C)?);
let handle = handle_param(p, C)?;
// A warp whose point or handle stays where it is stays a warp.
if warp_point_stays(&s.doc()?.doc, id, index, handle, q, C)? {
return ok();
}
s.edit("Move Envelope Point", |d, _| {
// A warp's first edited point makes it a mesh envelope on its grid, in the same step.
if let Some(n) = d.node(id)
&& matches!(&n.kind, NodeKind::Envelope { kind, .. } if matches!(**kind, EnvelopeKind::Warp { .. }))
{
let grid = envelope_edit_grid(n, C).ok_or_else(|| bad(C, "not a mesh envelope point"))??;
if let Some(NodeKind::Envelope { kind, .. }) = d.node_mut(id).map(|n| &mut n.kind) {
**kind = mesh_envelope(&grid);
}
}
let Some(NodeKind::Envelope { kind, .. }) = d.node_mut(id).map(|n| &mut n.kind) else {
return Err(bad(C, "not a mesh envelope point"));
};
+108 -30
View File
@@ -119,31 +119,90 @@ fn with_mesh<T>(s: &mut Session, p: &Value, cmd: &str, label: &str, envelopes: b
s.edit(label, move |d, _| edit_grid(d, id, cmd, envelopes, f))
}
/// Run `f` on the gradient mesh `id` of `d`; with `envelopes`, a mesh envelope's grid too (its
/// points and handles are written back: editing fills in the handles).
fn edit_grid<T>(d: &mut Document, id: NodeId, cmd: &str, envelopes: bool, f: impl FnOnce(&mut GradientMesh) -> Result<T>) -> Result<T> {
edit_kind(&mut d.node_mut(id).ok_or(EngineError::NoNode(id))?.kind, cmd, envelopes, f)
/// The grid an edit of envelope `n`'s points starts from: a mesh envelope's own grid, or a warp's
/// grid ([`live::warp_grid`]), which the edit turns into a mesh envelope. `None` for other nodes.
pub(super) fn envelope_edit_grid(n: &Node, cmd: &str) -> Option<Result<GradientMesh>> {
let NodeKind::Envelope { kind, .. } = &n.kind else { return None };
match &**kind {
EnvelopeKind::Mesh { rows, cols, points, handles } => {
Some(live::envelope_grid(*rows, *cols, points, handles).ok_or_else(|| bad(cmd, "the envelope's mesh is malformed")))
}
EnvelopeKind::Warp { .. } => {
Some(live::warp_grid(n).ok_or_else(|| bad(cmd, "this warp's points can't be edited: use Reset with Mesh first")))
}
EnvelopeKind::TopObject { .. } => None,
}
}
/// [`edit_grid`] on a node's kind.
fn edit_kind<T>(k: &mut NodeKind, cmd: &str, envelopes: bool, f: impl FnOnce(&mut GradientMesh) -> Result<T>) -> Result<T> {
match k {
NodeKind::Mesh(m) => f(m),
NodeKind::Envelope { kind, .. } if envelopes && matches!(**kind, EnvelopeKind::Mesh { .. }) => {
let EnvelopeKind::Mesh { rows, cols, points, handles } = &mut **kind else {
return Err(bad(cmd, "not a gradient mesh or mesh envelope"));
};
let mut m = live::envelope_grid(*rows, *cols, points, handles).ok_or_else(|| bad(cmd, "the envelope's mesh is malformed"))?;
let r = f(&mut m)?;
(*rows, *cols) = (m.rows, m.cols);
*points = m.points.iter().map(|q| q.p).collect();
*handles = m.points.iter().map(|q| q.handles).collect();
Ok(r)
}
_ => Err(bad(cmd, if envelopes { "not a gradient mesh or mesh envelope" } else { "not a gradient mesh" })),
/// The mesh envelope kind of grid `m`, with its points' handles.
pub(super) fn mesh_envelope(m: &GradientMesh) -> EnvelopeKind {
EnvelopeKind::Mesh {
rows: m.rows,
cols: m.cols,
points: m.points.iter().map(|q| q.p).collect(),
handles: m.points.iter().map(|q| q.handles).collect(),
}
}
/// Does placing point `index` of warp envelope `id` of `d`, or that point's `handle` end, at `q`
/// leave it where it is? Such a placement is no edit. `false` for other objects and for an index
/// out of range, whose edits run as before.
pub(super) fn warp_point_stays(d: &Document, id: NodeId, index: usize, handle: Option<usize>, q: Point, cmd: &str) -> Result<bool> {
let Some(n) = d.node(id).filter(|n| matches!(&n.kind, NodeKind::Envelope { kind, .. } if matches!(**kind, EnvelopeKind::Warp { .. }))) else {
return Ok(false);
};
let grid = envelope_grid_to_edit(n, cmd, true)?;
Ok(grid.points.get(index).is_some_and(|pt| match handle {
// The caller sends a handle's end as point plus handle; `q - p` can round away from it.
Some(h) => pt.handles.get(h).is_some_and(|v| pt.p + *v == q),
None => pt.p == q,
}))
}
/// The grid of envelope `n` that [`edit_grid`] edits (only `envelopes`), or the error it fails with.
fn envelope_grid_to_edit(n: &Node, cmd: &str, envelopes: bool) -> Result<GradientMesh> {
match envelope_edit_grid(n, cmd).filter(|_| envelopes) {
Some(grid) => grid,
None => Err(bad(cmd, if envelopes { "not a gradient mesh or mesh envelope" } else { "not a gradient mesh" })),
}
}
/// The grid of mesh `id` of `d` that [`edit_grid`] edits, as it is now.
fn grid_to_edit(d: &Document, id: NodeId, cmd: &str, envelopes: bool) -> Result<GradientMesh> {
match d.node(id) {
Some(Node { kind: NodeKind::Mesh(m), .. }) => Ok(m.clone()),
Some(n) => envelope_grid_to_edit(n, cmd, envelopes),
None => Err(EngineError::NoNode(id)),
}
}
/// Run `f` on the gradient mesh `id` of `d`; with `envelopes`, a warp or mesh envelope's grid too
/// (see [`edit_node`]).
fn edit_grid<T>(d: &mut Document, id: NodeId, cmd: &str, envelopes: bool, f: impl FnOnce(&mut GradientMesh) -> Result<T>) -> Result<T> {
edit_node(d.node_mut(id).ok_or(EngineError::NoNode(id))?, cmd, envelopes, f)
}
/// [`edit_grid`] on a node: with `envelopes`, a warp or mesh envelope's grid
/// ([`envelope_edit_grid`]) is edited too, and its points and handles are written back as a mesh
/// envelope (editing fills in the handles, and makes a warp a mesh envelope).
fn edit_node<T>(n: &mut Node, cmd: &str, envelopes: bool, f: impl FnOnce(&mut GradientMesh) -> Result<T>) -> Result<T> {
if let NodeKind::Mesh(m) = &mut n.kind {
return f(m);
}
let start = envelope_grid_to_edit(n, cmd, envelopes)?;
let mut m = start.clone();
let r = f(&mut m)?;
// A warp stays a warp when the edit changed nothing.
let warp = matches!(&n.kind, NodeKind::Envelope { kind, .. } if matches!(**kind, EnvelopeKind::Warp { .. }));
if warp && m == start {
return Ok(r);
}
if let NodeKind::Envelope { kind, .. } = &mut n.kind {
**kind = mesh_envelope(&m);
}
Ok(r)
}
/// Most mesh points one command names, over all its meshes.
const MAX_POINTS: usize = 1 << 20;
@@ -178,7 +237,8 @@ fn point_items(p: &Value, cmd: &str) -> Result<Vec<(NodeId, BTreeSet<usize>)>> {
}
/// Run `f` on each mesh point `items` names, as one undo step `label` (an index out of range
/// fails it, changing nothing); with `envelopes`, on mesh envelopes' points too.
/// fails it, changing nothing); with `envelopes`, on warp and mesh envelopes' points too. When `f`
/// changes no point, nothing changes and no undo step is recorded.
fn with_points(
s: &mut Session,
items: &[(NodeId, BTreeSet<usize>)],
@@ -187,6 +247,20 @@ fn with_points(
envelopes: bool,
mut f: impl FnMut(&mut live::MeshPoint) -> Result<()>,
) -> Result<()> {
let doc = &s.doc()?.doc;
let mut changes = false;
for (id, points) in items {
let mut m = grid_to_edit(doc, *id, cmd, envelopes)?;
for i in points {
let q = m.points.get_mut(*i).ok_or_else(|| bad(cmd, "index out of range"))?;
let before = q.clone();
f(q)?;
changes |= *q != before;
}
}
if !changes {
return Ok(());
}
s.edit(label, |d, _| {
for (id, points) in items {
edit_grid(d, *id, cmd, envelopes, |m| {
@@ -255,6 +329,10 @@ pub(super) fn mesh_move_point(s: &mut Session, p: &Value) -> Result<Value> {
let index = index_param(p, "index", C)?;
let q = Point::new(f64_req(p, "x", C)?, f64_req(p, "y", C)?);
let handle = handle_param(p, C)?;
let id = object_param(p, "id", C)?.ok_or_else(|| bad(C, "missing `id`"))?;
if warp_point_stays(&s.doc()?.doc, id, index, handle, q, C)? {
return ok();
}
with_mesh(s, p, C, "Move Mesh Point", true, |m| {
let pt = m.points.get_mut(index).ok_or_else(|| bad(C, "index out of range"))?;
match handle {
@@ -298,12 +376,12 @@ pub(super) fn mesh_add_line(s: &mut Session, p: &Value) -> Result<Value> {
}
// The lines are added to a copy of the object. A point that is already a mesh point adds none:
// when its color stays too, nothing changes and no undo step is recorded. The grid is compared,
// not the node: a mesh envelope stored without handles takes them in any edit, and keeps no
// colors, so only its points and handles count.
let orig = s.doc()?.doc.node(id).ok_or(EngineError::NoNode(id))?.kind.clone();
let colored = matches!(orig, NodeKind::Mesh(_));
let mut kind = orig.clone();
let (i, same) = edit_kind(&mut kind, C, true, |m| {
// not the node: a mesh envelope stored without handles takes them in any edit, a warp becomes
// a mesh envelope, and neither keeps colors, so only their points and handles count.
let orig = s.doc()?.doc.node(id).ok_or(EngineError::NoNode(id))?.clone();
let colored = matches!(orig.kind, NodeKind::Mesh(_));
let mut node = orig.clone();
let (i, same) = edit_node(&mut node, C, true, |m| {
let before = m.clone();
let i = add(m)?;
let shape = |g: &GradientMesh| (g.rows, g.cols, g.points.iter().map(|q| (q.p, q.handles)).collect::<Vec<_>>());
@@ -315,10 +393,10 @@ pub(super) fn mesh_add_line(s: &mut Session, p: &Value) -> Result<Value> {
let index = s.edit("Add Mesh Line", move |d, _| {
let n = d.node_mut(id).ok_or(EngineError::NoNode(id))?;
// Settling typed values before the edit may have changed the object: add the lines again.
if n.kind != orig {
return edit_kind(&mut n.kind, C, true, add);
if n.kind != orig.kind {
return edit_node(n, C, true, add);
}
n.kind = kind;
n.kind = node.kind;
Ok(i)
})?;
Ok(json!({ "index": index }))
+49
View File
@@ -39,6 +39,55 @@ pub(crate) fn is_dcs(bytes: &[u8]) -> bool {
vectorcraft_eps::dcs::read(bytes).is_some()
}
/// The most bytes read from the start of a file to look at its DCS header.
pub(crate) const HEAD_BYTES: usize = 1 << 20;
/// Does the header of the PostScript in file `head` (the first bytes of a file `size` bytes long,
/// at most [`HEAD_BYTES`]) name DCS plates? `None` when `head` can't tell: that PostScript doesn't
/// start within it (a binary EPS header that puts it further on), or its header goes on past it. A
/// `head` that holds the whole file is read as [`is_dcs`] reads it, and a binary EPS header whose
/// PostScript or TIFF preview ends past `size` names none, as [`is_dcs`] finds for the whole file.
pub(crate) fn head_is_dcs(head: &[u8], size: u64) -> Option<bool> {
const DOS_MAGIC: [u8; 4] = [0xC5, 0xD0, 0xD3, 0xC6];
if head.len() < HEAD_BYTES || head.len() as u64 >= size {
return Some(is_dcs(head));
}
let (ps, whole) = if head.starts_with(&DOS_MAGIC) {
let word = |at: usize| head.get(at..at + 4).and_then(|b| <[u8; 4]>::try_from(b).ok()).map(|b| u32::from_le_bytes(b) as usize);
let fits = |at: usize| Some((word(at)? as u64).checked_add(word(at + 4)? as u64).is_some_and(|end| end <= size));
if !fits(4)? || (word(24)? != 0 && !fits(20)?) {
return Some(false);
}
let (start, len) = (word(4)?, word(8)?);
let ps = head.get(start..).filter(|ps| !ps.is_empty())?;
(ps.get(..len).unwrap_or(ps), start.checked_add(len).is_some_and(|end| end <= head.len()))
} else {
(head, false)
};
if is_dcs(ps) {
return Some(true);
}
(whole || header_ended(ps)).then_some(false)
}
/// Does `ps`, the start of some PostScript, hold all of the header [`vectorcraft_eps::dcs::read`]
/// looks at (up to `%%EndComments`, a line that isn't a comment, or its 10,000th line)? Its last
/// line may be cut off, so it doesn't count.
fn header_ended(ps: &[u8]) -> bool {
let mut lines = ps.split(|b| matches!(b, b'\n' | b'\r')).filter(|l| !l.is_empty()).peekable();
let mut n = 0;
while let Some(line) = lines.next() {
if lines.peek().is_none() {
return false;
}
n += 1;
if line.starts_with(b"%%EndComments") || !line.starts_with(b"%") || n >= 10_000 {
return true;
}
}
false
}
/// DCS file `bytes`, read from `path` (when there is one: plate files of their own are found in its
/// folder), with every plate.
pub(crate) fn read(bytes: &[u8], path: Option<&str>) -> Result<DcsArt> {
+1 -1
View File
@@ -26,7 +26,7 @@ use vectorcraft_doc::{Document, NodeId, NodeKind, Selection};
use vectorcraft_geom::Affine;
use vectorcraft_tools::{PaintDefaults, Tool};
pub use cmd::clipboard::Clipboard;
pub use cmd::clipboard::{Clipboard, SourceLayer};
pub use cmd::create::constrain_click;
pub use cmd::distortcmds::perspective_click;
pub use cmd::params::{check_keys, check_params};
+153 -1
View File
@@ -1094,7 +1094,8 @@ fn paste_remembers_layers_restores_the_source_layers() {
let art = id_of(&s.execute("layer.new", &json!({"name": "Art"})).unwrap());
let b = rect(&mut s, 20.0, 0.0, 10.0, 10.0);
copy(&mut s, &[a, b]);
assert_eq!(s.clipboard.source_layers, [Some("Layer 1".to_string()), Some("Art".to_string())]);
let names: Vec<_> = s.clipboard.source_layers.iter().map(|l| l.as_ref().map(|l| l.names.clone())).collect();
assert_eq!(names, [Some(vec!["Layer 1".to_string()]), Some(vec!["Art".to_string()])]);
let other = id_of(&s.execute("layer.new", &json!({"name": "Other"})).unwrap());
assert_eq!(s.execute("layer.pasteRemembersLayers", &json!({})).unwrap()["on"], true);
assert!(doc(&s).paste_remembers_layers);
@@ -1121,6 +1122,157 @@ fn paste_remembers_layers_restores_the_source_layers() {
assert!(ids.iter().all(|id| doc(&s).parent_of(*id) == Some(other)));
}
/// A sublayer `name` made inside `parent`; it becomes the current layer.
fn sublayer(s: &mut Session, parent: NodeId, name: &str) -> NodeId {
id_of(&s.execute("layer.newSublayer", &json!({"parent": parent.0, "name": name})).unwrap())
}
/// The names of the layers around `id`, the top-level layer first.
fn layer_path(s: &Session, id: NodeId) -> Vec<String> {
let d = doc(s);
d.ancestry(id).unwrap().iter().filter_map(|a| d.node(*a).filter(|n| n.is_layer())).map(|l| l.name.clone().unwrap()).collect()
}
/// Art from two sublayers of the same name in different layers pastes back into each one; in
/// another document a missing sublayer is made inside its layer, and a missing layer on top with
/// the sublayer inside, in the paste's one undo step.
#[test]
fn paste_remembers_layers_keeps_same_named_sublayers_apart() {
let mut s = session();
let first = doc(&s).layers[0].id;
let sub1 = sublayer(&mut s, first, "Sub");
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
let second = id_of(&s.execute("layer.new", &json!({"name": "Layer 2", "top": true})).unwrap());
let sub2 = sublayer(&mut s, second, "Sub");
let b = rect(&mut s, 20.0, 0.0, 10.0, 10.0);
copy(&mut s, &[a, b]);
s.execute("layer.pasteRemembersLayers", &json!({"on": true})).unwrap();
s.execute("layer.setCurrent", &json!({"id": first.0})).unwrap();
let ids = ids_of(&s.execute("edit.paste", &json!({})).unwrap());
let parents: Vec<_> = ids.iter().map(|id| doc(&s).parent_of(*id)).collect();
assert_eq!(parents, [Some(sub1), Some(sub2)]);
new_doc(&mut s);
s.execute("layer.pasteRemembersLayers", &json!({"on": true})).unwrap();
let before = doc(&s).clone();
let ids = ids_of(&s.execute("edit.paste", &json!({})).unwrap());
let paths: Vec<_> = ids.iter().map(|id| layer_path(&s, *id)).collect();
assert_eq!(paths, [["Layer 1", "Sub"], ["Layer 2", "Sub"]]);
assert_eq!(doc(&s).layers.len(), 2, "Layer 1 is kept; Layer 2 is new");
assert_eq!(doc(&s).layers[0].children().unwrap().len(), 1, "Sub is made inside Layer 1");
let after = doc(&s).clone();
// Pasting again finds the layers made.
let again = ids_of(&s.execute("edit.paste", &json!({})).unwrap());
let parents: Vec<_> = again.iter().map(|id| doc(&s).parent_of(*id)).collect();
assert_eq!(parents, ids.iter().map(|id| doc(&s).parent_of(*id)).collect::<Vec<_>>());
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(*doc(&s), after);
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(*doc(&s), before, "one undo step takes the art and the layers made for it");
}
/// Art whose sublayer was deleted after the copy pastes into a new sublayer of that name inside
/// the same layer, not into a sublayer of that name in another layer.
#[test]
fn paste_remembers_layers_makes_a_deleted_sublayer_again_inside_its_layer() {
let mut s = session();
let first = doc(&s).layers[0].id;
let sub = sublayer(&mut s, first, "Sub");
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
let second = id_of(&s.execute("layer.new", &json!({"name": "Layer 2", "top": true})).unwrap());
let elsewhere = sublayer(&mut s, second, "Sub");
copy(&mut s, &[a]);
s.execute("layer.delete", &json!({"id": sub.0})).unwrap();
s.execute("layer.pasteRemembersLayers", &json!({"on": true})).unwrap();
let ids = ids_of(&s.execute("edit.paste", &json!({})).unwrap());
let made = doc(&s).parent_of(ids[0]).unwrap();
assert_ne!(made, elsewhere);
assert_eq!(doc(&s).parent_of(made), Some(first));
assert_eq!(layer_path(&s, ids[0]), ["Layer 1", "Sub"]);
}
/// Art whose sublayer was moved into another layer after the copy pastes into that sublayer where
/// it is now; no sublayer is made where it was.
#[test]
fn paste_remembers_layers_follows_a_moved_sublayer() {
let mut s = session();
let first = doc(&s).layers[0].id;
let sub = sublayer(&mut s, first, "Sub");
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
let second = id_of(&s.execute("layer.new", &json!({"name": "Layer 2", "top": true})).unwrap());
copy(&mut s, &[a]);
s.execute("layer.move", &json!({"id": sub.0, "target": second.0})).unwrap();
s.execute("layer.pasteRemembersLayers", &json!({"on": true})).unwrap();
let ids = ids_of(&s.execute("edit.paste", &json!({})).unwrap());
assert_eq!(doc(&s).parent_of(ids[0]), Some(sub));
assert_eq!(layer_path(&s, ids[0]), ["Layer 2", "Sub"]);
assert!(node(&s, first).children().unwrap().is_empty(), "no Sub is made in Layer 1");
}
/// In another document with layers of the same names, art goes into the topmost chain of layers
/// that matches the most names, a shown and unlocked one before a hidden or locked one.
#[test]
fn paste_remembers_layers_takes_the_topmost_open_match_of_repeated_names() {
let mut s = session();
let first = doc(&s).layers[0].id;
sublayer(&mut s, first, "Sub");
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
copy(&mut s, &[a]);
new_doc(&mut s);
s.execute("layer.pasteRemembersLayers", &json!({"on": true})).unwrap();
let lower = doc(&s).layers[0].id;
let lower_sub = sublayer(&mut s, lower, "Sub");
s.execute("layer.new", &json!({"name": "Sub", "top": true})).unwrap();
let upper = id_of(&s.execute("layer.new", &json!({"name": "Layer 1", "top": true})).unwrap());
// The upper Layer 1 has no Sub, and a top-level Sub is not inside a Layer 1: the lower chain
// matches both names.
let ids = ids_of(&s.execute("edit.paste", &json!({})).unwrap());
assert_eq!(doc(&s).parent_of(ids[0]), Some(lower_sub));
let upper_sub = sublayer(&mut s, upper, "Sub");
let ids = ids_of(&s.execute("edit.paste", &json!({})).unwrap());
assert_eq!(doc(&s).parent_of(ids[0]), Some(upper_sub), "the topmost of two full matches");
s.execute("layer.setProps", &json!({"id": upper_sub.0, "locked": true})).unwrap();
let ids = ids_of(&s.execute("edit.paste", &json!({})).unwrap());
assert_eq!(doc(&s).parent_of(ids[0]), Some(lower_sub), "an unlocked match before a locked one");
}
/// A remembered layer or sublayer that is hidden or locked, or inside a layer that is, refuses the
/// whole paste: the document, the selection and the undo history stay as they were.
#[test]
fn paste_remembers_layers_refuses_a_hidden_or_locked_layer() {
let (locked, hidden) = (json!({"locked": true}), json!({"visible": false}));
for (on_sub, props) in [(true, &locked), (true, &hidden), (false, &locked), (false, &hidden)] {
let mut s = session();
let first = doc(&s).layers[0].id;
let sub = sublayer(&mut s, first, "Sub");
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
let other = id_of(&s.execute("layer.new", &json!({"name": "Other", "top": true})).unwrap());
let b = rect(&mut s, 20.0, 0.0, 10.0, 10.0);
copy(&mut s, &[b, a]);
s.execute("layer.pasteRemembersLayers", &json!({"on": true})).unwrap();
let mut p = props.clone();
p["id"] = json!(if on_sub { sub.0 } else { first.0 });
s.execute("layer.setProps", &p).unwrap();
s.execute("layer.setCurrent", &json!({"id": other.0})).unwrap();
let before = s.doc().unwrap().clone();
assert!(s.execute("edit.paste", &json!({})).is_err(), "{p}");
assert_eq!(s.doc().unwrap().doc, before.doc, "{p}");
assert_eq!(s.doc().unwrap().selection, before.selection, "{p}");
assert_eq!(s.doc().unwrap().history.undo.len(), before.history.undo.len(), "{p}");
}
// In another document, a locked layer of the copied layer's name is refused too.
let mut s = session();
let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0);
copy(&mut s, &[a]);
new_doc(&mut s);
s.execute("layer.pasteRemembersLayers", &json!({"on": true})).unwrap();
let locked = doc(&s).layers[0].id;
id_of(&s.execute("layer.new", &json!({"name": "Flyer"})).unwrap());
s.execute("layer.setProps", &json!({"id": locked.0, "locked": true})).unwrap();
let before = doc(&s).clone();
assert!(s.execute("edit.paste", &json!({})).is_err());
assert_eq!(*doc(&s), before, "no second Layer 1 is made");
}
#[test]
fn paste_remembers_layers_survives_save_and_old_files_load_without_it() {
let mut s = session();
+116
View File
@@ -357,6 +357,42 @@ fn a_file_that_lost_its_clipping_path_unclips_the_image() {
);
}
#[test]
fn a_file_that_gains_its_clipping_path_again_clips_the_group_that_stayed() {
let dir = temp_dir("update-regained-clip");
let path = write(&dir, "pic.eps", &two_plates());
let mut s = session();
let r = s.execute("file.place", &json!({ "path": path, "at": [100, 100] })).unwrap();
let placed = NodeId(r["ids"][0].as_u64().unwrap());
let id = image_of(&s, &r["ids"][0]).id;
let other = s.execute("file.place", &json!({ "path": path, "at": [200, 100] })).unwrap();
s.execute("symbol.new", &json!({ "name": "Pic", "ids": [other["ids"][0]] })).unwrap();
let unclipped = String::from_utf8(two_plates()).unwrap().replacen("closepath clip newpath", "closepath newpath ", 1);
// The symbol's art: how deep the image is.
let depth = |s: &Session| {
fn find(n: &Node, at: usize) -> Option<usize> {
if matches!(n.kind, NodeKind::Image(_)) {
return Some(at);
}
n.children().and_then(|ch| ch.iter().find_map(|c| find(c, at + 1)))
}
find(&s.doc().unwrap().doc.symbols.iter().find(|w| w.name == "Pic").expect("the symbol").art, 0)
};
let clipped_depth = depth(&s);
for _ in 0..2 {
std::fs::write(&path, unclipped.as_bytes()).unwrap();
s.execute("links.update", &json!({ "ids": [id.0] })).unwrap();
std::fs::write(&path, two_plates()).unwrap();
s.execute("links.update", &json!({ "ids": [id.0] })).unwrap();
let doc = &s.doc().unwrap().doc;
assert_eq!(doc.parent_of(id), Some(placed), "the placed group holds the image itself");
let NodeKind::Group { children, clip: true } = &doc.node(placed).unwrap().kind else { panic!("a clip group again") };
assert!(matches!(&children[..], [c, im] if matches!(c.kind, NodeKind::Path { clipping: true, .. }) && im.id == id));
assert_eq!(depth(&s), clipped_depth, "the symbol's image is not nested deeper");
assert!(symbol_clip_width(&s, "Pic").is_some(), "the symbol's image is clipped again");
}
}
/// The kind of group `g` is, as (clip, the kinds of its children are just one image).
fn plain_group_of_image(g: &Node) -> Option<(bool, bool)> {
match &g.kind {
@@ -632,6 +668,86 @@ fn a_saved_document_reads_the_plates_again_and_prints_the_spot_ink() {
assert_eq!(inks, ["Cyan", "Magenta", "Yellow", "Black", "PANTONE 185 C"]);
}
#[test]
fn a_saved_document_reads_the_plates_again_with_the_low_resolution_eps_proxy() {
let dir = temp_dir("saved-proxy");
// Plates wider than a preview, so the saved document keeps a preview of the image.
let wide = |gray: u8| {
let hex = format!("{gray:02x}").repeat(300);
format!(
"%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 20 10\n%%EndComments\n20 10 scale\n300 1 8 [300 0 0 -1 0 1] <{hex}> image\nshowpage\n%%Trailer\n%%EOF\n"
)
};
let file = single_file(&[("Cyan", wide(0)), ("PANTONE 185 C", wide(128))], "%%CMYKCustomColor: 0 .91 .76 0 (PANTONE 185 C)\n");
let path = write(&dir, "pic.eps", &file);
let saved = dir.join("doc.vectorcraft").to_string_lossy().into_owned();
let mut s = session();
s.execute("file.place", &json!({ "path": path })).unwrap();
s.execute("document.save", &json!({ "path": saved })).unwrap();
let mut s = Session::new();
s.execute("prefs.set", &json!({"key": "lowResProxyEps", "value": true})).unwrap();
s.execute("document.open", &json!({ "path": saved })).unwrap();
let list = s.execute("links.list", &json!({})).unwrap();
assert_eq!(list["links"][0]["format"], "DCS", "{list}");
let id = NodeId(list["links"][0]["id"].as_u64().unwrap());
let NodeKind::Image(im) = &s.doc().unwrap().doc.node(id).unwrap().kind else { not_an_image() };
assert!(s.doc().unwrap().doc.images[&im.key].separated().is_some(), "the plates, read from the file again");
}
#[test]
fn a_dcs_header_is_found_at_the_start_of_a_file_or_behind_a_binary_eps_header() {
use crate::cmd::place::dcs::{HEAD_BYTES, head_is_dcs, is_dcs};
// A whole file, as `is_dcs` reads it.
let whole = |b: &[u8]| {
let is = head_is_dcs(b, b.len() as u64);
assert_eq!(is, Some(is_dcs(b)));
is
};
let ps = two_plates();
assert_eq!(whole(&ps), Some(true));
assert_eq!(whole(b"%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: 0 0 20 10\n%%EndComments\n"), Some(false));
let binary = |start: u32| {
let mut b = vec![0xC5, 0xD0, 0xD3, 0xC6];
b.extend(start.to_le_bytes());
b.extend((ps.len() as u32).to_le_bytes());
b.resize(start as usize, 0);
b.extend(&ps);
b
};
assert_eq!(whole(&binary(30)), Some(true));
// A binary header whose PostScript or TIFF preview ends past the end of the file names none.
let mut cut = binary(30);
cut[8..12].copy_from_slice(&(64u32 << 20).to_le_bytes());
assert_eq!(whole(&cut), Some(false));
let mut tiff = binary(30);
tiff[20..24].copy_from_slice(&30u32.to_le_bytes());
tiff[24..28].copy_from_slice(&(64u32 << 20).to_le_bytes());
assert_eq!(whole(&tiff), Some(false));
// A file longer than the bytes read, its PostScript running past them: its header is read from
// the part there is, unless the header puts the PostScript or the preview past the file's end.
let mut big = binary(30);
big.resize(HEAD_BYTES, b' ');
big[8..12].copy_from_slice(&(64u32 << 20).to_le_bytes());
assert_eq!(head_is_dcs(&big, 30 + (64 << 20)), Some(true));
assert_eq!(head_is_dcs(&big, 30 + (64 << 20) - 1), Some(false));
big[20..24].copy_from_slice(&30u32.to_le_bytes());
big[24..28].copy_from_slice(&(65u32 << 20).to_le_bytes());
assert_eq!(head_is_dcs(&big, 30 + (64 << 20)), Some(false));
// PostScript that starts past the bytes read: the whole file is needed.
let far = binary(HEAD_BYTES as u32 + 10);
assert_eq!(head_is_dcs(&far[..HEAD_BYTES], far.len() as u64), None);
// A header that goes on past the bytes read may name its plates further on.
let mut long = b"%!PS-Adobe-3.0 EPSF-3.0\n".to_vec();
while long.len() < HEAD_BYTES {
long.extend(format!("%%Title: {}\n", "x".repeat(190)).as_bytes());
}
long.truncate(HEAD_BYTES);
assert_eq!(head_is_dcs(&long, HEAD_BYTES as u64 + 1), None);
// One that ended within them names none.
long[30..45].copy_from_slice(b"\n%%EndComments\n");
assert_eq!(head_is_dcs(&long, HEAD_BYTES as u64 + 1), Some(false));
}
#[test]
fn dcs_transparency_marks_transparent_and_overlapped_dcs_images() {
let dir = temp_dir("transparency");
+233
View File
@@ -151,6 +151,239 @@ fn mesh_handles_turn_with_the_envelope_and_round_trip() {
assert!(matches!(n.kind, NodeKind::Envelope { kind, .. } if matches!(&*kind, EnvelopeKind::Mesh { handles, .. } if handles.is_empty())));
}
/// The kind of envelope `e`.
fn kind(s: &Session, e: NodeId) -> EnvelopeKind {
match node(s, e).kind {
NodeKind::Envelope { kind, .. } => *kind,
k => panic!("{k:?}"),
}
}
fn undo_len(s: &Session) -> usize {
s.doc().unwrap().history.undo.len()
}
/// Moving a point of a warp envelope makes it a mesh envelope on the warp's grid with that point
/// moved, as one undo step: the other points and every handle stay where the warp had them, and
/// the shape away from the moved point stays the warp's. Undo gives back the warp, Redo the edit.
#[test]
fn moving_a_warp_point_makes_it_a_mesh_envelope_in_one_step() {
let mut s = session();
let (_, e) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "arc", "bend": 50}));
let warp = node(&s, e);
let grid = live::warp_grid(&warp).unwrap();
assert_eq!((grid.rows, grid.cols), (4, 4));
let before = EnvelopeMap::of(&warp).unwrap();
let n = undo_len(&s);
// An interior point.
s.execute("object.mesh.movePoint", &json!({"id": e.0, "index": 6, "x": 160, "y": 120})).unwrap();
assert_eq!(undo_len(&s), n + 1, "one undo step");
let (rows, cols, points, handles) = mesh(&s, e);
assert_eq!((rows, cols, points.len(), handles.len()), (4, 4, 25, 25));
for (i, q) in grid.points.iter().enumerate() {
let want = if i == 6 { Point::new(160.0, 120.0) } else { q.p };
assert!(points[i].distance(want) < 1e-9, "point {i}: {:?} vs {want:?}", points[i]);
assert_eq!(handles[i], q.handles, "handles of point {i}");
}
let moved = node(&s, e);
let after = EnvelopeMap::of(&moved).unwrap();
let b = before.src();
let tol = b.width().hypot(b.height()) * 1e-3;
for (u, v) in [(0.9, 0.9), (0.6, 0.875), (1.0, 0.5), (0.0, 1.0)] {
assert!(after.at(u, v).distance(before.at(u, v)) <= tol, "({u}, {v}): {:?} vs {:?}", after.at(u, v), before.at(u, v));
}
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(node(&s, e), warp, "Undo gives back the warp, style and bend included");
s.execute("edit.redo", &json!({})).unwrap();
assert_eq!(mesh(&s, e).2[6], Point::new(160.0, 120.0));
// A corner of a warp, and a handle with object.envelope.setMeshPoint.
s.execute("edit.undo", &json!({})).unwrap();
s.execute("object.mesh.movePoints", &json!({"id": e.0, "points": [0], "dx": -10, "dy": -5})).unwrap();
assert!(mesh(&s, e).2[0].distance(grid.points[0].p + Vec2::new(-10.0, -5.0)) < 1e-9);
s.execute("edit.undo", &json!({})).unwrap();
let end = grid.points[12].p + Vec2::new(30.0, -30.0);
s.execute("object.envelope.setMeshPoint", &json!({"id": e.0, "index": 12, "x": end.x, "y": end.y, "handle": 0})).unwrap();
let (_, _, points, handles) = mesh(&s, e);
assert!((points[12] + handles[12][live::H_RIGHT]).distance(end) < 1e-9);
assert_eq!(handles[12][live::H_LEFT], grid.points[12].handles[live::H_LEFT]);
assert_eq!(undo_len(&s), n + 1);
}
/// After a warp's point is edited, the envelope keeps its content, options and fidelity; it saves
/// and opens again as it is; Reset with Mesh with Maintain Shape keeps the edited shape and Reset
/// with Warp gives the chosen style; Release gives back the edited mesh as its shape and Expand
/// keeps the edited distortion.
#[test]
fn an_edited_warp_saves_resets_releases_and_expands_as_edited() {
let mut s = session();
let (_, e) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "flag", "bend": 40}));
s.execute("object.envelope.options", &json!({"fidelity": 80, "distortAppearance": false})).unwrap();
let warp = node(&s, e);
// The middle of the bottom edge, 30 down.
s.execute("object.mesh.movePoints", &json!({"id": e.0, "points": [22], "dx": 0, "dy": 30})).unwrap();
let edited = node(&s, e);
let (NodeKind::Envelope { content: c0, options: o0, fidelity: f0, .. }, NodeKind::Envelope { content: c1, options: o1, fidelity: f1, .. }) =
(&warp.kind, &edited.kind)
else {
panic!("envelopes")
};
assert_eq!((c0, o0, f0), (c1, o1, f1), "content, options and fidelity stay");
let d = s.doc().unwrap().doc.clone();
let back = vectorcraft_format::load(&vectorcraft_format::save(&d, false)).unwrap();
assert_eq!(back.node(e), d.node(e), "a save opens again as edited");
// Reset with Mesh, keeping the shape: the edited points.
let (_, _, points, _) = mesh(&s, e);
s.execute("object.envelope.resetWithMesh", &json!({"maintainShape": true})).unwrap();
let (rows, cols, kept, _) = mesh(&s, e);
assert_eq!((rows, cols), (4, 4));
for (p, q) in points.iter().zip(&kept) {
assert!(p.distance(*q) < 1e-6, "{p:?} vs {q:?}");
}
// Reset with Warp: the chosen style replaces the edit.
s.execute("object.envelope.resetWithWarp", &json!({"style": "bulge", "bend": 30})).unwrap();
assert!(matches!(kind(&s, e), EnvelopeKind::Warp { style, bend, .. } if style == "bulge" && bend == 30.0));
s.execute("edit.undo", &json!({})).unwrap();
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(node(&s, e), edited);
// Release: the content and the edited mesh as the envelope's shape.
s.execute("select.set", &json!({"ids": [e.0]})).unwrap();
let ids = s.execute("object.envelope.release", &json!({})).unwrap();
let ids: Vec<NodeId> = ids["ids"].as_array().unwrap().iter().map(|v| NodeId(v.as_u64().unwrap())).collect();
let shape = ids.iter().find_map(|id| match node(&s, *id).kind {
NodeKind::Mesh(m) => Some(m),
_ => None,
});
let shape = shape.expect("the envelope's shape");
assert_eq!(shape.points.iter().map(|q| q.p).collect::<Vec<_>>(), points);
s.execute("edit.undo", &json!({})).unwrap();
// Expand: the distorted content follows the moved point, unlike the warp's.
let expanded = |s: &mut Session| {
s.execute("select.set", &json!({"ids": [e.0]})).unwrap();
s.execute("object.envelope.expand", &json!({})).unwrap();
let b = node(s, e).geometric_bounds().unwrap();
s.execute("edit.undo", &json!({})).unwrap();
b
};
let edited_bounds = expanded(&mut s);
s.execute("edit.undo", &json!({})).unwrap();
let warp_bounds = expanded(&mut s);
assert!(edited_bounds.y1 > warp_bounds.y1 + 5.0, "{edited_bounds:?} vs {warp_bounds:?}");
}
/// An edit of a warp's points that fails (an index out of range, here on the second of two
/// warps) changes neither warp and adds no undo step; a warp that no grid follows closely enough
/// shows no points and is refused, and so is a top object envelope.
#[test]
fn a_warp_point_edit_that_fails_changes_nothing() {
let mut s = session();
let (_, e) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "arc", "bend": 50}));
let (_, f) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "wave", "bend": 50}));
let (we, wf, n) = (node(&s, e), node(&s, f), undo_len(&s));
let r = s.execute("object.mesh.movePoints", &json!({"items": [{"id": e.0, "points": [0]}, {"id": f.0, "points": [3, 99999]}], "dx": 5, "dy": 5}));
assert!(r.is_err(), "{r:?}");
let r = s.execute("object.envelope.setMeshPoint", &json!({"id": e.0, "index": 25, "x": 0, "y": 0}));
assert!(r.is_err(), "{r:?}");
assert_eq!((node(&s, e), node(&s, f), undo_len(&s)), (we, wf, n), "nothing changed");
// The old point map's fisheye: no grid of up to 16×16 patches follows it.
let (_, g) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "fisheye", "bend": 100, "version": 0}));
let old = node(&s, g);
assert!(live::warp_grid(&old).is_none());
assert!(live::envelope_overlay(&old).unwrap().1.is_none(), "no points show");
let n = undo_len(&s);
for (cmd, p) in [
("object.mesh.movePoint", json!({"id": g.0, "index": 0, "x": 0, "y": 0})),
("object.envelope.setMeshPoint", json!({"id": g.0, "index": 0, "x": 0, "y": 0})),
("object.mesh.addLine", json!({"id": g.0, "x": 200, "y": 150})),
] {
let r = s.execute(cmd, &p);
assert!(
matches!(&r, Err(EngineError::BadParams { msg, .. }) if msg == "this warp's points can't be edited: use Reset with Mesh first"),
"{cmd}: {r:?}"
);
}
assert_eq!((node(&s, g), undo_len(&s)), (old, n));
}
/// An edit that moves no point of a warp (no points named, a move by nothing, a point placed where
/// it is, a line added through one of its points) leaves it a warp and records no undo step.
#[test]
fn a_warp_edit_that_moves_nothing_leaves_the_warp() {
let mut s = session();
let (_, e) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "arc", "bend": 50}));
let (warp, n) = (node(&s, e), undo_len(&s));
let grid = live::warp_grid(&warp).unwrap();
s.execute("object.mesh.movePoints", &json!({"id": e.0, "points": [], "dx": 10, "dy": 0})).unwrap();
s.execute("object.mesh.movePoints", &json!({"id": e.0, "points": [3, 6], "dx": 0, "dy": 0})).unwrap();
assert_eq!((node(&s, e), undo_len(&s)), (warp.clone(), n));
let q = grid.points[6].clone();
s.execute("object.mesh.movePoint", &json!({"id": e.0, "index": 6, "x": q.p.x, "y": q.p.y})).unwrap();
s.execute("object.envelope.setMeshPoint", &json!({"id": e.0, "index": 6, "x": q.p.x, "y": q.p.y})).unwrap();
// A line added through a point of the warp's grid adds none.
let r = s.execute("object.mesh.addLine", &json!({"id": e.0, "x": q.p.x, "y": q.p.y})).unwrap();
assert_eq!(r["index"], json!(6));
assert_eq!((node(&s, e), undo_len(&s)), (warp, n));
// An unknown mesh still fails.
assert!(s.execute("object.mesh.movePoints", &json!({"id": 99999, "points": [], "dx": 1, "dy": 0})).is_err());
}
/// A handle placed at its own end, sent as point plus handle, leaves a warp a warp, even where
/// `(p + v) - p` rounds to a value other than `v`.
#[test]
fn a_warp_handle_placed_at_its_end_leaves_the_warp() {
let mut s = session();
let (_, e) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "arc", "bend": 50}));
let (warp, n) = (node(&s, e), undo_len(&s));
let grid = live::warp_grid(&warp).unwrap();
let mut rounds = 0;
for (index, pt) in grid.points.iter().enumerate() {
for (h, v) in pt.handles.iter().enumerate() {
let end = pt.p + *v;
if end - pt.p != *v {
rounds += 1;
}
for cmd in ["object.mesh.movePoint", "object.envelope.setMeshPoint"] {
s.execute(cmd, &json!({"id": e.0, "index": index, "x": end.x, "y": end.y, "handle": h})).unwrap();
assert_eq!((node(&s, e), undo_len(&s)), (warp.clone(), n), "{cmd}: point {index}, handle {h}");
}
}
}
assert!(rounds > 0, "the grid has a handle whose end does not give the handle back");
}
/// With Direct Selection, a selected warp's point drags as `object.mesh.movePoint`: the preview
/// makes it a mesh envelope, Escape gives back the warp with no undo step, and a finished drag is
/// one undo step. While its contents are edited, its points don't take the press.
#[test]
fn direct_selection_drags_a_warps_point_and_escape_gives_it_back() {
let mut s = session();
let (_, e) = enveloped(&mut s, "object.envelope.makeWithWarp", json!({"style": "arc", "bend": 50}));
let warp = node(&s, e);
let corner = live::warp_grid(&warp).unwrap().points[24].p;
s.execute("select.set", &json!({"ids": [e.0]})).unwrap();
let v = ViewInfo::default();
s.select_tool("directSelection", v).unwrap();
let n = undo_len(&s);
s.pointer(&PointerEvent::new(PointerKind::Down, corner.x, corner.y), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Drag, corner.x + 20.0, corner.y + 10.0), v).unwrap();
assert!(mesh(&s, e).2[24].distance(corner + Vec2::new(20.0, 10.0)) < 1e-9, "the preview moves the point");
s.tool_key(vectorcraft_tools::ToolKey::Escape, vectorcraft_tools::Mods::default(), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, corner.x + 20.0, corner.y + 10.0), v).unwrap();
assert_eq!((node(&s, e), undo_len(&s)), (warp.clone(), n), "Escape gives back the warp");
s.pointer(&PointerEvent::new(PointerKind::Down, corner.x, corner.y), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Drag, corner.x + 20.0, corner.y + 10.0), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, corner.x + 20.0, corner.y + 10.0), v).unwrap();
assert_eq!(undo_len(&s), n + 1);
assert!(mesh(&s, e).2[24].distance(corner + Vec2::new(20.0, 10.0)) < 1e-9);
// Edit Contents: the press doesn't take the envelope's point.
s.execute("edit.undo", &json!({})).unwrap();
s.execute("object.envelope.editContents", &json!({"editing": true})).unwrap();
s.execute("select.set", &json!({"ids": [e.0]})).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Down, corner.x, corner.y), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Drag, corner.x + 20.0, corner.y + 10.0), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, corner.x + 20.0, corner.y + 10.0), v).unwrap();
assert!(matches!(kind(&s, e), EnvelopeKind::Warp { .. }), "{:?}", kind(&s, e));
}
#[test]
fn reset_with_mesh_keeps_the_warp_shape_along_the_grid() {
let mut s = session();
+36
View File
@@ -576,6 +576,42 @@ fn update_links_reads_files_again_inside_symbols_patterns_and_masks() {
assert!(images(&s).iter().all(|(_, _, _, size)| *size == (20, 10)), "{:?}", images(&s));
}
/// An image that Placement Options clip, alone in a group the user made, goes into a new clip group
/// inside that group when its file grows, in the layers and in a symbol's art; the user's group
/// stays a plain group.
#[test]
fn placement_options_clip_an_image_alone_in_a_group_inside_that_group() {
let dir = Folder::new("clip-in-group");
let photo = dir.file("photo.png");
write(&photo, &png(20, 10, RED));
let mut s = session();
let mut groups = vec![];
for _ in 0..2 {
let id = place(&mut s, &photo);
s.execute("links.placementOptions", &json!({"ids": [id.0], "preserve": "fill", "clip": true})).unwrap();
let g = NodeId(s.execute("object.group", &json!({"ids": [id.0]})).unwrap()["id"].as_u64().unwrap());
groups.push((g, id));
}
let (in_symbol, _) = groups[1];
s.execute("symbol.new", &json!({"name": "Mark", "ids": [in_symbol.0]})).unwrap();
write(&photo, &png(60, 20, BLUE));
s.execute("links.update", &json!({})).unwrap();
// A plain group holding just a clip group of a clipping path and an image.
let plain_of_clip = |n: &vectorcraft_doc::Node| match &n.kind {
NodeKind::Group { children, clip: false } => matches!(&children[..], [c] if matches!(&c.kind,
NodeKind::Group { children, clip: true } if matches!(&children[..], [p, im]
if matches!(p.kind, NodeKind::Path { clipping: true, .. }) && matches!(im.kind, NodeKind::Image(_))))),
_ => false,
};
let d = &s.doc().unwrap().doc;
let (g, id) = groups[0];
assert!(plain_of_clip(d.node(g).unwrap()), "{:?}", d.node(g));
assert_ne!(d.parent_of(id), Some(g), "the image is in a new clip group");
let mut found = false;
d.symbols[0].art.walk(&mut |n| found |= plain_of_clip(n));
assert!(found, "{:?}", d.symbols[0].art);
}
#[test]
fn a_missing_link_renders_its_preview_and_relinks() {
let dir = Folder::new("missing");
+6 -1
View File
@@ -1136,7 +1136,12 @@ fn mesh_points_move_and_colour_together() {
assert!(s.execute("object.mesh.movePoints", &p).is_err(), "{p}");
}
assert!(s.execute("object.mesh.setPointColor", &json!({"id": a.0, "points": [0, 9], "color": "#000000"})).is_err());
assert_eq!(((mesh_of(&s, a), mesh_of(&s, b)), undo_len(&s)), (before, n), "nothing changed");
assert_eq!(((mesh_of(&s, a), mesh_of(&s, b)), undo_len(&s)), (before.clone(), n), "nothing changed");
// A call that changes no point records no undo step.
s.execute("object.mesh.movePoints", &json!({"id": a.0, "points": [], "dx": 1, "dy": 1})).unwrap();
s.execute("object.mesh.movePoints", &json!({"id": a.0, "points": [0, 1], "dx": 0, "dy": 0})).unwrap();
s.execute("object.mesh.setPointColor", &json!({"id": a.0, "points": [2, 6], "color": "#0000ff", "opacity": 0.25})).unwrap();
assert_eq!(((mesh_of(&s, a), mesh_of(&s, b)), undo_len(&s)), (before, n), "no change, no undo step");
}
#[test]
@@ -250,3 +250,103 @@ fn a_guide_dragged_on_the_canvas_changes_how_a_scaled_instance_draws() {
let left = s.doc().unwrap().doc.symbol_nine_slice("Panel").unwrap().left;
assert!((left - 0.05).abs() < 1e-9, "{left}");
}
/// The 200 × 150 [`panel`] instance with its left guide 25 % outside the art: the left column
/// holds no art, so the corner square is in the center column, which runs 0..75 in the art and
/// 0..175 in the instance, and the center square moves with it. The rows are as before.
fn assert_left_outside(boxes: &[Rect]) {
let k = 175.0 / 75.0;
let want = [
Rect::new(50.0, 50.0, 250.0, 200.0),
Rect::new(50.0, 50.0, 50.0 + 10.0 * k, 60.0),
Rect::new(50.0 + 45.0 * k, 115.0, 50.0 + 55.0 * k, 135.0),
];
assert_eq!(boxes.len(), want.len(), "{boxes:?}");
for (b, w) in boxes.iter().zip(want) {
assert!(close(*b, w), "{b:?} vs {w:?} in {boxes:?}");
}
}
/// `symbol.options` takes guides outside the art, within -16..16 and in order on each axis, as
/// one undo step; a scaled instance then draws by the cells its art falls in, and Break Link to
/// Symbol gives that art. Values out of range or out of order are refused without an edit.
#[test]
fn guides_outside_the_art_are_set_by_command_and_scale_by_the_cells_that_hold_art() {
let (mut s, id) = panel();
s.execute("symbol.options", &json!({"name": "Panel", "nineSliceGuides": [-0.25, 0.25, 0.25, 0.25]})).unwrap();
assert_left_outside(&placed_boxes(&s, id));
let list = s.execute("symbol.list", &json!({})).unwrap();
assert_eq!(list["symbols"][0]["nineSlice"], json!([-0.25, 0.25, 0.25, 0.25]));
for bad in [json!([-16.5, 0.25, 0.25, 0.25]), json!([0.25, 0.25, 0.25, 17]), json!([1.2, 0.25, -0.2, 0.25]), json!([0.25, 0.6, 0.25, 0.6])] {
let e = s.execute("symbol.options", &json!({"name": "Panel", "nineSliceGuides": bad})).unwrap_err().to_string();
assert!(e.contains("each -16..16"), "{e}");
}
assert_eq!(s.doc().unwrap().doc.symbol_nine_slice("Panel").unwrap().left, -0.25, "no edit");
s.execute("symbol.options", &json!({"name": "Panel", "nineSliceGuides": [1.25, 0.25, -0.5, 0.25]})).unwrap();
// Both vertical guides past the art's right edge: the art keeps its width from the left.
let boxes = placed_boxes(&s, id);
assert!(close(boxes[0], Rect::new(50.0, 50.0, 150.0, 200.0)) && close(boxes[1], Rect::new(50.0, 50.0, 60.0, 60.0)), "{boxes:?}");
s.execute("edit.undo", &json!({})).unwrap();
assert_left_outside(&placed_boxes(&s, id));
let r = s.execute("symbol.breakLink", &json!({})).unwrap();
let art = NodeId(r["ids"][0].as_u64().unwrap());
assert_left_outside(&path_boxes(s.doc().unwrap().doc.node(art).unwrap()));
}
/// Dragging the left guide past the art's left edge on the canvas puts it outside the art, as one
/// undo step, and the scaled instance draws by the cells that hold art.
#[test]
fn a_guide_dragged_past_the_arts_edge_lies_outside_it() {
let (mut s, id) = panel();
s.execute("symbol.edit", &json!({"name": "Panel"})).unwrap();
let v = ViewInfo::default();
s.select_tool("selection", v).unwrap();
let e = s.doc().unwrap().doc.edited_nine_slice().unwrap();
let ((a, b), (l, r)) = (e.line(NineSliceGuide::Left), (e.line(NineSliceGuide::Left).0.x, e.line(NineSliceGuide::Right).0.x));
let y = (a.y + b.y) / 2.0;
// The guides lie a quarter in from each edge, so the art's left edge lies half the guides'
// distance to the left of the left guide, and 25 % outside it lies as far again.
let to = l - (r - l);
s.pointer(&PointerEvent::new(PointerKind::Down, l + 1.0, y), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Drag, to, y), v).unwrap();
s.pointer(&PointerEvent::new(PointerKind::Up, to, y), v).unwrap();
let g = s.doc().unwrap().doc.symbol_nine_slice("Panel").unwrap();
assert!((g.left + 0.25).abs() < 1e-9, "{g:?}");
let e = s.doc().unwrap().doc.edited_nine_slice().unwrap();
assert!((e.line(NineSliceGuide::Left).0.x - to).abs() < 1e-9, "the guide is drawn where it was dropped");
s.execute("edit.undo", &json!({})).unwrap();
assert_eq!(s.doc().unwrap().doc.symbol_nine_slice("Panel").unwrap().left, 0.25, "one undo step");
s.execute("edit.redo", &json!({})).unwrap();
s.execute("symbol.exitEditing", &json!({})).unwrap();
assert_left_outside(&placed_boxes(&s, id));
}
/// A native file keeps guides outside the art exactly, and an instance opened from it draws as
/// before saving; a file whose saved guides are out of range or out of order opens with 9-slice
/// off for that symbol.
#[test]
fn guides_outside_the_art_survive_saving_and_reopening_a_native_file() {
let (mut s, id) = panel();
let guides = [-0.123456789, 1.5, 0.3, -2.75];
s.execute("symbol.options", &json!({"name": "Panel", "nineSliceGuides": guides})).unwrap();
s.execute("symbol.options", &json!({"name": "Panel", "nineSliceGuides": [-0.25, 0.25, 0.25, 0.25]})).unwrap();
s.execute("symbol.options", &json!({"name": "Panel", "nineSliceGuides": guides})).unwrap();
let doc = s.doc().unwrap().doc.clone();
let back = vectorcraft_format::load(&vectorcraft_format::save(&doc, false)).unwrap();
let g = back.symbol_nine_slice("Panel").unwrap();
assert_eq!([g.left, g.top, g.right, g.bottom], guides);
let placed = |d: &vectorcraft_doc::Document| {
let NodeKind::SymbolInstance { symbol, xf } = &d.node(id).unwrap().kind else { panic!("an instance") };
let art = d.symbols.iter().find(|s| &s.name == symbol).unwrap().art.clone();
path_boxes(&d.place_symbol_art(symbol, &art, *xf).unwrap())
};
assert_eq!(placed(&back), placed(&doc));
for bad in [json!([-20.0, 0.25, 0.25, 0.25]), json!([0.8, 0.25, 0.5, 0.25]), json!([0.25, 0.25, 0.25]), json!("x")] {
let mut d = (*doc).clone();
d.unknown.insert(vectorcraft_doc::SYMBOL_NINE_SLICE.into(), json!({ "Panel": bad }));
let back = vectorcraft_format::load(&vectorcraft_format::save(&d, false)).unwrap();
assert!(back.symbol_nine_slice("Panel").is_none(), "{bad}");
let NodeKind::SymbolInstance { symbol, xf } = &back.node(id).unwrap().kind else { panic!("an instance") };
assert!(back.symbol_slice_map(symbol, *xf).is_none(), "{bad}: scaled as a whole");
}
}
+28
View File
@@ -980,6 +980,34 @@ fn a_scaled_nine_slice_symbol_instance_keeps_its_corner_size() {
assert!(sizes.contains(&(200, 150)), "the frame is scaled: {sizes:?}");
}
/// A scaled instance of a symbol whose left 9-slice guide lies outside its art is written as the
/// canvas draws it: the corner square is in the center column, which runs 0..75 in the art and
/// 0..175 in the instance, so it is about 23 wide. The editing copy read alone has no guides.
#[test]
fn a_nine_slice_instance_with_a_guide_outside_its_art_is_written_as_drawn() {
let mut doc = Document::new(400.0, 400.0);
let layer = doc.layers[0].id;
let square = |doc: &mut Document, r: Rect| {
Node::path(doc.alloc_id(), shapes::rectangle(r), Appearance::basic(solid(Color::rgb(0.0, 0.0, 1.0)), Paint::None, 0.0))
};
let frame = Arc::new(square(&mut doc, Rect::new(0.0, 0.0, 100.0, 100.0)));
let corner = Arc::new(square(&mut doc, Rect::new(0.0, 0.0, 10.0, 10.0)));
let art = Node::group(doc.alloc_id(), vec![frame, corner]);
doc.symbols.push(Symbol { dynamic: false, name: "S".into(), art: Arc::new(art) });
doc.set_symbol_nine_slice("S", vectorcraft_doc::SymbolNineSlice::new(-0.25, 0.25, 0.25, 0.25));
let xf = Affine::scale_non_uniform(2.0, 1.5);
let instance = Node::new(doc.alloc_id(), NodeKind::SymbolInstance { symbol: "S".into(), xf });
doc.insert(Some(layer), usize::MAX, instance).unwrap();
let back = read_back(&doc);
let mut all = vec![];
paths(back.layers[0].children().unwrap(), &mut all);
let sizes: Vec<(i64, i64)> =
all.iter().filter_map(|p| p.geometric_bounds()).map(|b| (b.width().round() as i64, b.height().round() as i64)).collect();
assert!(sizes.contains(&(23, 10)), "the corner stretches with the center column: {sizes:?}");
assert!(sizes.contains(&(200, 150)), "the frame is scaled: {sizes:?}");
assert!(back.symbol_nine_slice("S").is_none());
}
/// Nested symbols whose instances multiply, written as their art (on a large canvas), stop at
/// [`vectorcraft_doc::MAX_SYMBOL_NODES`] objects of symbol art in all, with a warning.
#[test]
+6
View File
@@ -731,6 +731,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{key, value} | {values: {key: value…}}, tool?: id (default: the active tool) → the tool's options (`{}` reads them). The options a tool keeps (Liquify brush and tool options, Mirror & Cut, Puppet Warp, drawing tools…) last across tool switches and are saved with the preferences; another tool's are stored for when it is chosen",
),
(
"tool.toggleTouchMode",
"Switch Selection and Drawing Modes",
"",
"{} from the Selection, Direct Selection, Group Selection, Magic Wand, Lasso or Perspective Selection tool, choose the drawing tool chosen last in this window (none yet: the Pencil tool); from any other tool, choose the Selection tool, remembering the tool left as the drawing tool unless it is the Hand, Rotate View, Zoom or Print Tiling tool → {tool}. A two-finger tap on the canvas runs it in the Touch workspace (Enable Touch Gestures on)",
),
(
"effect.dialog",
"Effect…",
+13 -1
View File
@@ -11,6 +11,9 @@ pub(super) struct ActualText {
depth: usize,
owner: Option<usize>,
pending: Option<String>,
/// The owner's replacement is empty: its content has no text, so its glyphs stay art
/// ([`Self::textless`], #6971).
empty: bool,
}
impl ActualText {
@@ -22,6 +25,7 @@ impl ActualText {
if self.owner == Some(self.depth) {
self.owner = None;
self.pending = None;
self.empty = false;
}
self.depth = self.depth.saturating_sub(1);
}
@@ -30,6 +34,12 @@ impl ActualText {
self.owner.is_some()
}
/// Inside a span whose replacement text is empty: the glyphs there are no text, but they
/// still draw, so they come in as outlines rather than as type with no characters (#6971).
pub(super) fn textless(&self) -> bool {
self.owner.is_some() && self.empty
}
pub(super) fn set(&mut self, bytes: &[u8]) -> bool {
if self.active() {
return true;
@@ -39,8 +49,10 @@ impl ActualText {
if self.depth == 0 || self.depth > 128 || bytes.len() > 64 * 1024 {
return false;
}
let text = crate::import_scan::text_string(bytes);
self.owner = Some(self.depth);
self.pending = Some(crate::import_scan::text_string(bytes));
self.empty = text.is_empty();
self.pending = Some(text);
true
}
}
+3 -2
View File
@@ -800,7 +800,8 @@ impl<'p> Builder<'p> {
}
/// Glyph `o` as type: added to the line being gathered (or starting one). `false`: it keeps
/// its outline (no Unicode text, mirrored, or not type mode). No `paint`: invisible text,
/// its outline (no Unicode text, mirrored, not type mode, or in a span whose ActualText is
/// empty). No `paint`: invisible text,
/// type with neither fill nor stroke.
pub(super) fn type_glyph(
&mut self,
@@ -811,7 +812,7 @@ impl<'p> Builder<'p> {
stroke: Option<&StrokeProps>,
overprint: bool,
) -> bool {
if self.text_as != TextAs::Text || self.nested > 0 {
if self.text_as != TextAs::Text || self.nested > 0 || self.actual.textless() {
return false;
}
let authored = self.actual.active();
+25
View File
@@ -121,6 +121,31 @@ fn actual_text_empty_and_nested_owners() {
}
}
/// Glyphs in a span whose ActualText is empty have no text, but they still draw: they stay on the
/// page as outlines in their paint, filled and stroked as the text rendering mode says (#6971).
#[test]
fn empty_actual_text_keeps_the_glyphs_art() {
let outlines = |report: &ImportReport| {
let mut found = vec![];
report.document.walk(|node| {
if matches!(node.kind, NodeKind::Path { .. }) {
found.push((node.appearance.fill().is_some(), node.appearance.stroke().is_some(), node.geometric_bounds()));
}
});
found
};
for (mode, fill, stroke) in [("0", true, false), ("1", false, true), ("2", true, true)] {
let content = format!("/Span << /ActualText () >> BDC 1 0 0 rg 0 0 1 RG 3 w {mode} Tr (Halo) Tj 0 Tr EMC 0 0 0 rg (C) Tj");
let report = open(&content);
assert_eq!(plain(&report), "C", "mode {mode}: the span adds no text");
let found = outlines(&report);
assert!(found.iter().any(|(f, _, _)| *f == fill) && found.iter().any(|(_, s, _)| *s == stroke), "mode {mode}: the glyphs' art: {found:?}");
let ink = found.iter().filter_map(|(_, _, b)| *b).fold(None, |acc: Option<kurbo::Rect>, b| Some(acc.map_or(b, |a| a.union(b))));
let ink = ink.unwrap_or_else(|| panic!("mode {mode}: no outlines"));
assert!(ink.x0 >= 15.0 && ink.x1 > 40.0 && ink.y0 > 50.0 && ink.y1 < 140.0, "mode {mode}: where the word is set: {ink:?}");
}
}
#[test]
fn actual_text_decodes_pdf_strings_and_preserves_authored_order() {
for (encoded, expected) in [
+35
View File
@@ -115,6 +115,41 @@ fn a_scaled_nine_slice_instance_is_written_as_the_canvas_draws_it() {
assert_similar(&canvas, &resvg_render(&svg, 300, 200), 24.0, 0.002);
}
/// A scaled instance of a symbol whose left 9-slice guide lies outside its art is written as the
/// canvas draws it: the corner square is in the stretched center column. Reading the file back
/// gives that art and no 9-slice guides, which SVG has no place for.
#[test]
fn a_nine_slice_instance_with_a_guide_outside_its_art_is_written_as_drawn() {
let mut d = Document::new(300.0, 200.0);
let fill = |c: Color| Appearance::basic(Paint::solid(c), Paint::None, 0.0);
let rects = [(Rect::new(0.0, 0.0, 100.0, 100.0), Color::rgb8(220, 220, 220)), (Rect::new(0.0, 0.0, 10.0, 10.0), Color::BLACK)];
let art: Vec<Arc<Node>> = rects.iter().map(|(r, c)| Arc::new(Node::path(d.alloc_id(), shapes::rectangle(*r), fill(*c)))).collect();
let group = Node::group(d.alloc_id(), art);
d.symbols.push(Symbol { dynamic: false, name: "Panel".into(), art: Arc::new(group) });
d.set_symbol_nine_slice("Panel", vectorcraft_doc::SymbolNineSlice::new(-0.25, 0.25, 0.25, 0.25));
instance(&mut d, "Panel", Affine::translate((20.0, 20.0)) * Affine::scale_non_uniform(2.0, 1.5));
let svg = export(&d, &ExportOptions::default());
assert_eq!(svg.matches("<use ").count(), 0, "{svg}");
let canvas = render_artboard(&d);
let dark = |im: &Image, x: u32, y: u32| im.rgba[((y * im.width + x) * 4) as usize] < 60;
// The corner square covers 20..43.3 across: the center column runs 0..75 in the art and
// 0..175 in the instance. With the guide inside the art it would end at x = 30.
assert!(dark(&canvas, 40, 25) && !dark(&canvas, 46, 25) && !dark(&canvas, 40, 32));
assert_similar(&canvas, &resvg_render(&svg, 300, 200), 24.0, 0.002);
let back = import(&svg).unwrap();
assert!(back.unknown.get(vectorcraft_doc::SYMBOL_NINE_SLICE).is_none());
let mut boxes = vec![];
back.walk(|n| {
if let NodeKind::Path { path, .. } = &n.kind {
boxes.extend(path.bounds());
}
});
assert!(
boxes.iter().any(|b| (b.x0 - 20.0).abs() < 1e-3 && (b.x1 - 20.0 - 70.0 / 3.0).abs() < 1e-3 && (b.height() - 10.0).abs() < 1e-3),
"{boxes:?}"
);
}
/// A scaled instance of a symbol with 9-slice guides whose art placed through the guides could
/// hold more than `MAX_SYMBOL_NODES` objects is left out, as the canvas leaves it out: here a
/// gradient square in all nine cells, each copy with a disabled opacity mask of 2,251,501 objects.
+5 -2
View File
@@ -9,8 +9,8 @@
mod solid;
mod visibility;
pub use solid::{
Bevel, BevelProfile, BevelShape, Extrude, FaceMap, Facet, Inflate, PlanarFace, View, extrude, extrude_face_map, inflate, inflate_together, plane,
plane_face_map,
Bevel, BevelProfile, BevelShape, Extrude, FaceMap, Facet, Inflate, PlanarFace, TOO_COMPLEX_SOLID, View, extrude, extrude_face_map, inflate,
inflate_each, inflate_together, plane, plane_face_map,
};
pub use visibility::{VisibleFace, visible_faces};
mod shading;
@@ -32,6 +32,9 @@ const MAX_FACES: usize = 32768;
const MAX_REVOLVE_FACES: usize = 163_840;
/// Most faces Extrude & Bevel and Inflate build for one solid, as many as Revolve's.
const MAX_SOLID_FACES: usize = MAX_REVOLVE_FACES;
/// Most faces the Extrude & Bevel or Inflate solids of one effect on one object keep together: the
/// solid of its fill and those of its strokes, a group's members' all counted, as many as one solid's.
pub const MAX_OBJECT_FACES: usize = MAX_SOLID_FACES;
/// Samples a curved profile segment takes, and the fewest it takes on a surface over its budget.
const CURVE_SAMPLES: usize = 16;
const MIN_CURVE_SAMPLES: usize = 4;
+2 -1
View File
@@ -30,9 +30,10 @@ use inflate::GRID_WORK;
#[cfg(test)]
pub(crate) use inflate::INFLATED;
pub(crate) use inflate::inflate_faces;
pub use inflate::{inflate, inflate_together};
pub use inflate::{inflate, inflate_each, inflate_together};
#[cfg(test)]
use membrane::{Edges, GRID_BUDGET, MAX_EDGE_ENTRIES, MAX_GRID_WORK, Membrane, cell_triangles};
pub use rings::TOO_COMPLEX_SURFACE as TOO_COMPLEX_SOLID;
use rings::signed_area;
#[cfg(test)]
use rings::{MAX_SOLID_POINTS, rings};
+12 -1
View File
@@ -62,7 +62,18 @@ pub fn inflate(path: &PathData, rule: FillRule, bounds: Rect, options: Inflate,
/// on its own over the grid of `bounds`, and one eye sees them all, as far away as the highest
/// puff needs with Perspective. One result for each shape, in order.
pub fn inflate_together(shapes: &[(&PathData, FillRule)], bounds: Rect, options: Inflate, view: View) -> Vec<Result<Vec<Facet>, String>> {
inflate_faces(shapes, bounds, options, view, false).map(|r| r.map(|(facets, ..)| facets)).collect()
inflate_each(shapes, bounds, options, view).collect()
}
/// [`inflate_together`], each solid built only as the iterator reaches it: a caller that stops early
/// builds none of the solids after.
pub fn inflate_each(
shapes: &[(&PathData, FillRule)],
bounds: Rect,
options: Inflate,
view: View,
) -> impl Iterator<Item = Result<Vec<Facet>, String>> + use<> {
inflate_faces(shapes, bounds, options, view, false).map(|r| r.map(|(facets, ..)| facets))
}
/// [`inflate_together`], or with `mesh` each solid's faces before projection instead of its facets.
+3 -1
View File
@@ -17,7 +17,9 @@ pub(super) const CURVE_PIECES: u32 = 32;
pub(super) const MIN_CURVE_PIECES: u32 = 4;
const TOO_COMPLEX_SHAPE: &str = "The shape is too complex for a 3D effect";
pub(super) const TOO_COMPLEX_SURFACE: &str = "The 3D surface is too complex; simplify the shape";
/// The error a solid past its limits returns, and a 3D effect whose solids together pass
/// [`crate::MAX_OBJECT_FACES`].
pub const TOO_COMPLEX_SURFACE: &str = "The 3D surface is too complex; simplify the shape";
/// How many straight pieces follow `c` within `tolerance` (Wang's bound on a cubic's distance from
/// its chords), 1 to [`CURVE_PIECES`].
+1 -1
View File
@@ -28,7 +28,7 @@
//! Direct Selection also edits a blend's spine: drag its points (Shift-click picks several, which
//! drag together; a key object on a point moves with it) and, once a point is clicked, its
//! handles; and the points of selected gradient meshes
//! and mesh envelopes and their handles ([`MeshEdit`]): Shift-clicks and the marquee pick several,
//! and of mesh and warp envelopes and their handles ([`MeshEdit`]): Shift-clicks and the marquee pick several,
//! a click on a gradient mesh's line picks its two ends and one inside a patch the four points
//! around it, a drag of picked points moves them all, the arrow keys nudge them, and a solid fill
//! colour or the Transparency panel's opacity goes to a gradient mesh's picked points. Dragging a
+5 -5
View File
@@ -21,7 +21,7 @@ use vectorcraft_doc::{NodeId, NodeKind};
use vectorcraft_geom::Point;
use crate::blendwidget::{self, BlendWidgetDrag};
use crate::meshedit::{MeshEdit, grid_of};
use crate::meshedit::{MeshEdit, grid_of, may_have_grid};
use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey};
const FEEDBACK: [u8; 3] = [0x4f, 0x9d, 0xff];
@@ -246,13 +246,13 @@ pub struct MeshTool {
}
impl MeshTool {
/// Meshes (gradient meshes and mesh envelopes) to consider for point hits: selected ones
/// first, then any in the document.
/// Meshes (gradient meshes, and mesh and warp envelopes) to consider for point hits: selected
/// ones first, then any in the document.
fn meshes(cx: &ToolContext) -> Vec<NodeId> {
let mut v: Vec<NodeId> = cx.selection.objects.iter().copied().filter(|id| cx.doc.node(*id).and_then(grid_of).is_some()).collect();
let mut v: Vec<NodeId> = cx.selection.objects.iter().copied().filter(|id| cx.doc.node(*id).is_some_and(may_have_grid)).collect();
let mut rest = vec![];
cx.doc.walk(|n| {
if grid_of(n).is_some() {
if may_have_grid(n) {
rest.push(n.id);
}
});
+65 -5
View File
@@ -1,5 +1,5 @@
//! Picking and dragging mesh points and their handles on the canvas, shared by the Mesh tool and
//! Direct Selection: gradient meshes and mesh envelopes alike. A click on a point picks it alone
//! Direct Selection: gradient meshes, mesh envelopes and warp envelopes alike. A click on a point picks it alone
//! and focuses it: its handles show and can be dragged too. Shift-clicks add points to the picked
//! ones or take them away, and Direct Selection's marquee and its clicks on a gradient mesh's line
//! or patch pick points too ([`part_points`]). The picked points show filled; a drag of one of
@@ -11,7 +11,7 @@ use std::borrow::Cow;
use std::collections::BTreeSet;
use serde_json::{Value, json};
use vectorcraft_doc::live::{GradientMesh, envelope_grid};
use vectorcraft_doc::live::{GradientMesh, envelope_grid, warp_grid};
use vectorcraft_doc::{EnvelopeKind, Node, NodeId, NodeKind};
use vectorcraft_geom::{Point, Vec2};
@@ -19,19 +19,30 @@ use crate::{Action, Mods, Overlay, ToolContext, ToolKey};
const FEEDBACK: [u8; 3] = [0x4f, 0x9d, 0xff];
/// The editable grid of `n`: a gradient mesh, or a mesh envelope's grid (not while its contents
/// are being edited).
/// The editable grid of `n`: a gradient mesh, a mesh envelope's grid or a warp envelope's
/// ([`warp_grid`], which its first edit makes a mesh envelope of); not while an envelope's contents
/// are being edited.
pub fn grid_of(n: &Node) -> Option<Cow<'_, GradientMesh>> {
match &n.kind {
NodeKind::Mesh(m) => Some(Cow::Borrowed(m)),
NodeKind::Envelope { kind, editing: false, .. } => match &**kind {
EnvelopeKind::Mesh { rows, cols, points, handles } => envelope_grid(*rows, *cols, points, handles).map(Cow::Owned),
_ => None,
EnvelopeKind::Warp { .. } => warp_grid(n).map(Cow::Owned),
EnvelopeKind::TopObject { .. } => None,
},
_ => None,
}
}
/// Can `n` have an editable grid ([`grid_of`])? Its kind alone answers, without building the grid.
pub fn may_have_grid(n: &Node) -> bool {
match &n.kind {
NodeKind::Mesh(_) => true,
NodeKind::Envelope { kind, editing: false, .. } => matches!(**kind, EnvelopeKind::Mesh { .. } | EnvelopeKind::Warp { .. }),
_ => false,
}
}
/// The points of gradient mesh `m` a Direct Selection click at `p` picks: the point within
/// `point_tol`, else the two ends of the mesh line within `line_tol`, else the four points around
/// the patch under `p`.
@@ -433,6 +444,55 @@ mod tests {
assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, 90.0, 210.0)), vec![Action::Commit]);
}
/// The rectangle of [`doc_with_rect`] in an arc warp envelope.
fn doc_with_warp() -> (Document, NodeId) {
let (mut d, e) = doc_with_envelope();
if let Some(NodeKind::Envelope { kind, .. }) = d.node_mut(e).map(|n| &mut n.kind) {
**kind =
EnvelopeKind::Warp { style: "arc".into(), bend: 50.0, h: 0.0, v: 0.0, horizontal: true, version: vectorcraft_doc::live::WARP_NET };
}
(d, e)
}
/// The Mesh tool and Direct Selection drag a warp envelope's points (on its grid) and the
/// clicked point's handles, as they do a mesh envelope's; while its contents are edited, its
/// points take no press.
#[test]
fn the_mesh_tool_and_direct_selection_drag_warp_envelope_points() {
let (mut d, e) = doc_with_warp();
let grid = grid_of(d.node(e).unwrap()).unwrap().into_owned();
assert_eq!(Some(&grid), warp_grid(d.node(e).unwrap()).as_ref());
let mut s = Selection::default();
s.set([e]);
let p = paint();
let c = cx(&d, &s, &p);
let tools: [(&str, Box<dyn Tool>); 2] =
[("mesh", crate::meshblend::create("mesh").unwrap()), ("directSelection", Box::new(crate::direct::DirectSelectionTool::new(false)))];
let (i, q) = (6, grid.points[6].clone());
for (what, mut t) in tools {
assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Down, q.p.x, q.p.y)), vec![Action::Begin("Move Mesh Point".into())], "{what}");
assert_eq!(
t.pointer(&c, &PointerEvent::new(PointerKind::Drag, q.p.x + 10.0, q.p.y - 10.0)),
vec![Action::Preview("object.mesh.movePoint".into(), json!({"id": e.0, "index": i, "x": q.p.x + 10.0, "y": q.p.y - 10.0}))],
"{what}"
);
assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Up, q.p.x + 10.0, q.p.y - 10.0)), vec![Action::Commit], "{what}");
// The clicked point's handle.
let end = q.p + q.handles[0];
assert_eq!(t.pointer(&c, &PointerEvent::new(PointerKind::Down, end.x, end.y)), vec![Action::Begin("Move Mesh Point".into())], "{what}");
let drag = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, end.x + 5.0, end.y));
assert!(matches!(&drag[..], [Action::Preview(id, p)] if id == "object.mesh.movePoint" && p["handle"] == json!(0)), "{what}: {drag:?}");
t.pointer(&c, &PointerEvent::new(PointerKind::Up, end.x + 5.0, end.y));
}
if let Some(NodeKind::Envelope { editing, .. }) = d.node_mut(e).map(|n| &mut n.kind) {
*editing = true;
}
assert!(grid_of(d.node(e).unwrap()).is_none(), "Edit Contents: no envelope points");
let c = cx(&d, &s, &p);
let mut t = crate::meshblend::create("mesh").unwrap();
assert_ne!(t.pointer(&c, &PointerEvent::new(PointerKind::Down, q.p.x, q.p.y)), vec![Action::Begin("Move Mesh Point".into())]);
}
#[test]
fn mesh_drag_honors_measurement_labels() {
let (d, _e) = doc_with_envelope();
+39 -4
View File
@@ -5,10 +5,15 @@
//! takes the Move cursor, and dragging the guide moves it (`symbol.options`'s
//! `nineSliceGuides`), in one undo step.
//!
//! VectorCraft's own rules: a guide stays within the art's box and stops short of the opposite
//! guide; the drag does not snap and its modifiers change nothing; a guide within reach takes the
//! press before the art and the bounding box, and of two guides within reach the nearer one, else
//! the first of left, top, right and bottom; Escape during the drag puts the guide back.
//! A guide may be dragged past the art's edges, and the instance still scales by the slices its
//! art falls in.
//!
//! VectorCraft's own rules: a guide stays within 16 times the art's width or height of its edge
//! and stops short of the opposite guide; a guide outside the art is drawn and taken along the
//! art's height or width beside it; the drag does not snap and its modifiers change nothing; a
//! guide within reach takes the press before the art and the bounding box, and of two guides
//! within reach the nearer one, else the first of left, top, right and bottom; Escape during the
//! drag puts the guide back.
use serde_json::json;
use vectorcraft_doc::{EditedNineSlice, NineSliceGuide};
@@ -203,6 +208,36 @@ mod tests {
assert_eq!(preview(&a[1]).1["nineSliceGuides"], json!([0.25, 0.4, 0.25, 0.25]));
}
/// A guide outside the art is taken beside the art, along its height, and a drag may take a
/// guide past the art's edge and back; Escape puts it back where it was.
#[test]
fn a_guide_outside_the_art_is_taken_and_dragged_past_the_arts_edge() {
let d = editing(SymbolNineSlice::new(-0.25, 0.25, 0.25, 0.25));
let (s, p) = (Selection::default(), paint());
let c = cx(&d, &s, &p);
let at = |x: f64, y: f64| guide_at(&c, Point::new(x, y)).map(|(_, g)| g);
assert_eq!(at(75.0, 150.0), Some(NineSliceGuide::Left), "25 % left of the art at x = 100");
assert_eq!(at(77.0, 110.0), Some(NineSliceGuide::Left));
assert_eq!(at(75.0, 95.0), None, "the guide ends with the art's height");
let mut t = SelectionTool::default();
assert_eq!(t.cursor(&c, Point::new(75.0, 150.0), Mods::default()), Cursor::Move);
t.pointer(&c, &ev(PointerKind::Down, 75.0, 150.0));
let a = t.pointer(&c, &ev(PointerKind::Drag, 50.0, 150.0));
assert_eq!(a[0], Action::Begin("Symbol Options".into()));
assert_eq!(preview(&a[1]).1["nineSliceGuides"], json!([-0.5, 0.25, 0.25, 0.25]));
let (_, v) = preview(&t.pointer(&c, &ev(PointerKind::Drag, 110.0, 150.0))[0]);
assert_eq!(v["nineSliceGuides"], json!([0.1, 0.25, 0.25, 0.25]), "back inside the art");
assert_eq!(t.key(&c, ToolKey::Escape, Mods::default()), vec![Action::Cancel]);
// From inside the art, the default bottom guide passes the art's bottom edge at y = 200.
let d = editing(Some(SymbolNineSlice::default()));
let c = cx(&d, &s, &p);
let mut t = SelectionTool::default();
t.pointer(&c, &ev(PointerKind::Down, 150.0, 175.0));
let a = t.pointer(&c, &ev(PointerKind::Drag, 150.0, 250.0));
assert_eq!(preview(&a[1]).1["nineSliceGuides"], json!([0.25, 0.25, 0.25, -0.5]));
assert_eq!(t.pointer(&c, &ev(PointerKind::Up, 150.0, 250.0)), vec![Action::Commit]);
}
/// Escape during a guide drag cancels it and is the tool's; the release after it commits
/// nothing. A double-click on a guide neither edits the art nor leaves the mode.
#[test]
+1
View File
@@ -68,6 +68,7 @@ rustix = { workspace = true, features = ["std", "process"] }
[dev-dependencies]
egui_kittest = { workspace = true, features = ["wgpu", "snapshot"] }
vectorcraft-apischema = { workspace = true }
vectorcraft-testkit = { workspace = true }
# A variable font built in code (no font file is committed).
vectorcraft-text = { workspace = true, features = ["test-fonts"] }
+4
View File
@@ -416,6 +416,10 @@ impl VectorcraftApp {
self.pen_end.forget_tool();
self.held_tool.clear();
self.activate_tool(id, true);
let now = self.session.tool_id();
if crate::touch::is_drawing_tool(now) {
self.ui.touch_drawing_tool = Some(now.to_string());
}
}
/// Go back to tool `id` after a tool that stood in for it (the pen's eraser end, [`stylus`]):
+92
View File
@@ -966,6 +966,88 @@ fn two_finger_tap_undoes_and_three_finger_tap_redoes() {
assert_eq!(count(&app), 2, "off: the first finger draws as the pointer, and nothing is undone");
}
/// In the Touch workspace a two-finger tap switches between the Selection tool and the drawing tool
/// chosen last, and undoes nothing; three fingers still redo. Outside it, two fingers undo again.
#[test]
fn two_finger_tap_in_touch_switches_selection_and_drawing_modes() {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap();
app.session.execute("shape.rectangle", &json!({"x": 50, "y": 50, "width": 40, "height": 40})).unwrap();
crate::workspaces::switch(&mut app.ui, crate::workspaces::TOUCH).unwrap();
app.select_tool("rectangle");
let ctx = egui::Context::default();
frame(&mut app, &ctx, vec![]);
let count = |app: &VectorcraftApp| app.session.active().unwrap().doc.layers[0].children().unwrap().len();
let c = app.canvas_rect.unwrap().center();
let touch = |n: u64, phase, pos| egui::Event::Touch { device_id: egui::TouchDeviceId(1), id: egui::TouchId(n), phase, pos, force: None };
let button = |pos, pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
let tap = |app: &mut VectorcraftApp, fingers: u64| {
let at = |n: u64| c + vec2(n as f32 * 50.0, 0.0);
frame(app, &ctx, vec![touch(0, egui::TouchPhase::Start, at(0)), egui::Event::PointerMoved(at(0)), button(at(0), true)]);
frame(app, &ctx, vec![touch(0, egui::TouchPhase::Move, at(0) + vec2(6.0, 6.0)), egui::Event::PointerMoved(at(0) + vec2(6.0, 6.0))]);
frame(app, &ctx, (1..fingers).map(|n| touch(n, egui::TouchPhase::Start, at(n))).collect());
frame(app, &ctx, vec![touch(0, egui::TouchPhase::End, at(0)), button(at(0) + vec2(6.0, 6.0), false), egui::Event::PointerGone]);
frame(app, &ctx, (1..fingers).map(|n| touch(n, egui::TouchPhase::End, at(n))).collect());
frame(app, &ctx, vec![]);
};
tap(&mut app, 2);
assert_eq!((app.session.tool_id(), count(&app)), ("selection", 1), "selection mode, nothing undone or drawn");
tap(&mut app, 2);
assert_eq!((app.session.tool_id(), count(&app)), ("rectangle", 1), "back to the drawing tool");
// A tool chosen by hand becomes the drawing tool a switch returns to.
app.select_tool("ellipse");
tap(&mut app, 2);
tap(&mut app, 2);
assert_eq!((app.session.tool_id(), count(&app)), ("ellipse", 1));
// The switches added no undo step: undo still takes the rectangle away, and three fingers redo it.
app.run("edit.undo", json!({})).unwrap();
assert_eq!(count(&app), 0);
tap(&mut app, 3);
assert_eq!(count(&app), 1, "three fingers redo in Touch too");
// Presentation Mode runs neither.
app.ui.screen_mode = 3;
frame(&mut app, &ctx, vec![]);
tap(&mut app, 2);
assert_eq!(app.session.tool_id(), "ellipse", "Presentation Mode: no switch");
app.ui.screen_mode = 0;
// Enable Touch Gestures off: no switch.
app.session.prefs.touch_gestures = false;
app.select_tool("selection");
frame(&mut app, &ctx, vec![]);
tap(&mut app, 2);
assert_eq!(app.session.tool_id(), "selection", "off: no switch");
app.session.prefs.touch_gestures = true;
// Another workspace: two fingers undo again and switch no tool.
crate::workspaces::switch(&mut app.ui, crate::workspaces::ESSENTIALS).unwrap();
app.select_tool("rectangle");
frame(&mut app, &ctx, vec![]);
let before = count(&app);
tap(&mut app, 2);
assert_eq!(app.session.tool_id(), "rectangle");
assert_eq!(count(&app), before - 1, "Essentials: undone");
}
/// Switch Selection and Drawing Modes from the command: Pencil when no drawing tool was chosen yet,
/// a view tool is left for Selection without becoming the drawing tool, and every selection tool
/// switches to drawing mode.
#[test]
fn switch_selection_and_drawing_modes_command() {
let mut app = VectorcraftApp::new(Session::new(), Default::default());
app.session.execute("file.new", &json!({"width": 400, "height": 300})).unwrap();
assert!(app.ui.touch_drawing_tool.is_none());
app.select_tool("selection");
let r = app.run(crate::touch::TOGGLE_MODE, json!({})).unwrap();
assert_eq!((r, app.session.tool_id()), (json!({"tool": "pencil"}), "pencil"), "no drawing tool chosen yet: Pencil");
app.select_tool("hand");
assert_eq!(app.run(crate::touch::TOGGLE_MODE, json!({})).unwrap(), json!({"tool": "selection"}));
assert_eq!(app.run(crate::touch::TOGGLE_MODE, json!({})).unwrap(), json!({"tool": "pencil"}), "the Hand tool is no drawing tool");
app.select_tool("pen");
for id in ["directSelection", "groupSelection", "magicWand", "lasso"] {
app.select_tool(id);
assert_eq!(app.run(crate::touch::TOGGLE_MODE, json!({})).unwrap(), json!({"tool": "pen"}), "{id}");
}
}
/// The Artboard tool's label holds the artboard's name (never translated); the tools' own
/// labels are interface text.
#[test]
@@ -3881,6 +3963,16 @@ fn the_edited_symbols_nine_slice_guides_are_drawn_and_dragged_on_the_canvas() {
assert_eq!(guides_now(&app).left, 0.25, "one undo step");
app.run("edit.redo", json!({})).unwrap();
assert!((guides_now(&app).left - 0.1).abs() < 1e-3);
// Dragged on past the art's left edge at x = 100, the guide lies outside the art and is drawn
// there, along the art's height.
let (from, to) = (xf.to_screen(Point::new(110.0, 150.0)), xf.to_screen(Point::new(80.0, 150.0)));
frame(&mut app, &ctx, vec![egui::Event::PointerMoved(from), button(from, true)]);
for k in 1..=4 {
frame(&mut app, &ctx, vec![egui::Event::PointerMoved(from + (to - from) * k as f32 / 4.0)]);
}
frame(&mut app, &ctx, vec![button(to, false)]);
assert!((guides_now(&app).left + 0.2).abs() < 1e-3, "{:?}", guides_now(&app));
assert!(dots(&mut app, Point::new(80.0, 100.0), Point::new(80.0, 200.0)) > 10, "the guide drawn outside the art");
app.run("symbol.exitEditing", json!({})).unwrap();
assert_eq!(dots(&mut app, Point::new(110.0, 100.0), Point::new(110.0, 200.0)), 0, "none outside the mode");
}
+4 -3
View File
@@ -532,7 +532,8 @@ pub(super) fn wheel(
/// Enable Touch Gestures: this frame's finger contacts on the canvas ([`crate::touch`]). A second
/// finger drops the press the first one began (its tool interaction rolled back; the rest of the
/// gesture presses nothing), and a tap of two fingers undoes, one of three redoes.
/// gesture presses nothing), and a tap of two fingers undoes, one of three redoes. In the Touch
/// workspace a tap of two fingers switches between selection and drawing modes instead.
pub(super) fn touch_gestures(app: &mut VectorcraftApp, ui: &Ui, rect: egui::Rect, view: vectorcraft_engine::ViewInfo) {
if !app.session.prefs.touch_gestures {
return;
@@ -564,12 +565,12 @@ pub(super) fn touch_gestures(app: &mut VectorcraftApp, ui: &Ui, rect: egui::Rect
drop_press(app, ui, view);
ui.data_mut(|d| d.insert_temp(drag_id(), Drag::Gesture));
}
Some(crate::touch::Touch::Tap(n)) => tap = crate::touch::tap_command(n),
Some(crate::touch::Touch::Tap(n)) => tap = crate::touch::tap_command(n, app.ui.workspace == crate::workspaces::TOUCH),
None => {}
}
}
ui.data_mut(|d| d.insert_temp(key, taps));
// In Presentation Mode a tap of two or three fingers undoes or redoes nothing.
// In Presentation Mode a tap of two or three fingers runs nothing.
if let Some(cmd) = tap
&& app.ui.screen_mode < 3
{
+15
View File
@@ -497,4 +497,19 @@ mod tests {
assert_eq!(bar_of(&app).map(|b| b.1), Some(Bar::Mesh { rows: 3, cols: 2 }));
bar_frame(&mut app, &ctx, vec![]);
}
#[test]
fn the_control_bar_shows_mesh_rows_and_columns_after_a_warp_point_is_moved() {
let (mut app, _) = app_with_rect();
app.run(MAKE_WARP, json!({"style": "arc", "bend": 50})).unwrap();
assert!(bar_of(&app).is_some_and(|(_, bar)| matches!(bar, Bar::Warp { ref style, .. } if style == "arc")));
let (id, warp) = envelope(&app);
let grid = vectorcraft_doc::live::warp_grid(&warp).unwrap();
let p = grid.points[6].p;
app.run("object.mesh.movePoint", json!({"id": id.0, "index": 6, "x": p.x + 10.0, "y": p.y + 10.0})).unwrap();
assert_eq!(bar_of(&app), Some((false, Bar::Mesh { rows: grid.rows, cols: grid.cols })));
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
bar_frame(&mut app, &ctx, vec![]);
}
}
+7 -6
View File
@@ -59,12 +59,13 @@ fn label_w(ui: &egui::Ui) -> f32 {
CONTENT_W - FIELD_W - ui.spacing().item_spacing.x
}
/// The top of the Fidelity slider (points); it starts at the lowest Fidelity the tool takes, and
/// the field takes up to 100.
/// The top of the Fidelity slider, in the tool's unit (screen pixels for the Pencil and
/// Paintbrush, points for Smooth and Blob Brush); it starts at the lowest Fidelity the tool takes,
/// and the field takes up to 100.
const FIDELITY_MAX: f64 = 20.0;
/// Fidelity `v` stepped `n` steps by the slider's and the field's keys: an arrow steps hundredths up to 0.1 pt,
/// tenths up to 1 pt and whole points above (a step down from 0.1 or 1 takes the finer step below
/// Fidelity `v` stepped `n` steps by the slider's and the field's keys: an arrow steps hundredths up to 0.1,
/// tenths up to 1 and whole units above, in the tool's unit (a step down from 0.1 or 1 takes the finer step below
/// it); ten steps at once (Shift with an arrow, Page Up/Down) multiply or divide by ten, so they go
/// 0.01 → 0.1 → 1 → 10.
fn fidelity_step(v: f64, n: f64) -> f64 {
@@ -96,7 +97,7 @@ fn fidelity_step(v: f64, n: f64) -> f64 {
/// Where Fidelity `v` sits on a slider over `(min, max)`, from 0 to 1. The rail is logarithmic, so
/// the low values, where the stroke is followed closely, get as much of it as the high ones
/// (0.01–1 pt takes most of a 0.01–20 rail).
/// (0.01–1 takes most of a 0.01–20 rail, in the tool's unit).
fn fidelity_at(v: f64, (min, max): (f64, f64)) -> f32 {
if !(v.is_finite() && min > 0.0 && max > min) {
return 0.0;
@@ -104,7 +105,7 @@ fn fidelity_at(v: f64, (min, max): (f64, f64)) -> f32 {
((v.clamp(min, max) / min).ln() / (max / min).ln()) as f32
}
/// The Fidelity at `x` (0 to 1) on a slider over `(min, max)`: hundredths below 1 pt, tenths above.
/// The Fidelity at `x` (0 to 1) on a slider over `(min, max)`: hundredths below 1, tenths above, in the tool's unit.
fn fidelity_from(x: f32, (min, max): (f64, f64)) -> f64 {
let v = min * (max / min).powf(f64::from(x.clamp(0.0, 1.0)));
let step = if v < 1.0 { 100.0 } else { 10.0 };
+3 -2
View File
@@ -151,13 +151,14 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
let start =
move |app: &mut VectorcraftApp| background::run(app, enabled, label, None, work, move |app, r| packaged(app, r, web, in_background.get()));
// Both in the background: the package, collected from the document as it is now, starts once
// the save is written.
// the save is written, with the automation roots in force at OK.
if let Some(id) = saving.filter(|_| enabled) {
later.set(true);
app.ui.dialog = None;
let scope = vectorcraft_engine::file_access::ScopeHandle::capture();
background::after(app, id, move |app, r| {
if saved(r)
&& let Err(e) = start(app)
&& let Err(e) = scope.run(|| start(app))
{
app.status(e);
}
@@ -979,7 +979,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
ui.separator();
let section = d.str("section");
let content_w = ui.available_width();
egui::ScrollArea::both()
let shown = egui::ScrollArea::both()
.id_salt(("para-style-sections", section))
.max_height(room)
.min_scrolled_height(room)
@@ -987,15 +987,17 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
.auto_shrink([false, true])
.show(ui, |ui| {
ui.vertical(|ui| section_body(ui, d));
})
.inner_rect
.height()
});
// `inner_rect` is the height offered before a short section shrinks the area to its content.
shown.inner_rect.height().min(shown.content_size.y)
});
let content_h = drawn.inner;
let was = ui.ctx().data(|m| m.get_temp::<f32>(content_id(ui)));
ui.ctx().data_mut(|m| m.insert_temp(content_id(ui), content_h));
// A new height lays the frame out again before it is shown, so the window is placed at its new
// size and OK and Cancel stay on the screen in the frame of a section switch.
if was.is_none_or(|was| (was - content_h).abs() > 0.5) {
ui.ctx().request_repaint();
ui.ctx().request_discard("paragraph style content height changed");
}
reset_button(ui, d);
match edited_attrs(d) {
@@ -578,3 +578,62 @@ fn every_section_draws_its_fields() {
}
}
}
/// The texts of one headless frame at a screen `w` by `h`, with their screen rects.
fn texts_at(ctx: &egui::Context, app: &mut VectorcraftApp, w: f32, h: f32) -> 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 screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(w, h));
let mut out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| super::super::show(app, ui.ctx()));
out.textures_delta.clear();
let mut texts = vec![];
for c in &out.shapes {
collect(&c.shape, &mut texts);
}
texts
}
/// Going from a shorter section to a longer one keeps OK and Cancel on a small screen in the first
/// frame after the switch, not only once the window has measured itself again.
#[test]
fn switching_to_a_long_section_keeps_the_buttons_on_a_small_screen() {
let mut app = app();
let mut attrs: Value = serde_json::from_str(KEPT).unwrap();
for (key, value) in [
("right_indent", json!(4.0)),
("first_line_indent", json!(12.0)),
("space_after", json!(6.0)),
("composer", json!("singleLine")),
("roman_hanging", json!(true)),
("hyphenate", json!(true)),
("justification", json!({"auto_leading": 150.0})),
("korean_line_break_anywhere", json!(true)),
] {
attrs[key] = value;
}
app.run("paraStyle.new", json!({"name": "Body", "attrs": attrs})).unwrap();
app.run("ui.paraStyleOptions", json!({"name": "Body"})).unwrap();
for h in [500.0, 560.0, 640.0, 720.0] {
for to in SECTIONS {
for from in SECTIONS.into_iter().filter(|s| *s != to) {
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
set(&mut app, "section", json!(from));
for _ in 0..5 {
let _ = texts_at(&ctx, &mut app, 900.0, h);
}
set(&mut app, "section", json!(to));
let texts = texts_at(&ctx, &mut app, 900.0, h);
for label in ["OK", "Cancel"] {
let r = texts.iter().find(|(text, _)| text == label).unwrap_or_else(|| panic!("{label} is drawn")).1;
assert!(r.bottom() <= h + 1.0, "{label} stays on a {h}-point screen going from {from} to {to}: {r:?}");
}
}
}
}
}
+27 -7
View File
@@ -4,7 +4,8 @@
//! (`symbol.options`).
//!
//! Fields: `name`, `nineSlice` (bool) with `sliceLeft` / `sliceTop` / `sliceRight` / `sliceBottom`
//! (percent of the symbol's size), `exportType` (`movieClip` | `graphic`), `type` (`dynamic` |
//! (percent of the symbol's size, -1600..1600: below 0 or above 100 for a guide outside the art),
//! `exportType` (`movieClip` | `graphic`), `type` (`dynamic` |
//! `static`; a new symbol is dynamic), `registration` (0..8, the 9-point grid;
//! 4 = centre), `__edit` (true when editing an existing symbol). Help:
//! <https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-and-place-symbols.html>.
@@ -26,20 +27,39 @@ const SLICE_KEYS: [&str; 4] = ["sliceLeft", "sliceTop", "sliceRight", "sliceBott
/// A guide field's value when the dialog has none: a quarter of the symbol's size, in percent.
const DEFAULT_SLICE_PERCENT: f64 = 25.0;
/// The 9-slice dialog fields for `guides` (percent of the symbol's size; a quarter each when off).
/// The field that keeps the guides the dialog opened with, as fractions, in `[left, top, right,
/// bottom]` order.
const SLICE_OPENED: &str = "__sliceOpened";
/// The range of a guide field, in percent: a guide may lie outside the art, up to
/// [`vectorcraft_doc::MAX_GUIDE_FRACTION`] times its size from its edge.
const SLICE_PERCENT_RANGE: std::ops::RangeInclusive<f64> = -vectorcraft_doc::MAX_GUIDE_FRACTION * 100.0..=vectorcraft_doc::MAX_GUIDE_FRACTION * 100.0;
/// The 9-slice dialog fields for `guides` (percent of the symbol's size, unrounded; a quarter each
/// when off).
fn slice_fields(guides: Option<vectorcraft_doc::SymbolNineSlice>) -> Map<String, Value> {
let g = guides.unwrap_or_default();
let mut m = Map::new();
m.insert("nineSlice".into(), json!(guides.is_some()));
for (key, v) in SLICE_KEYS.iter().zip([g.left, g.top, g.right, g.bottom]) {
m.insert((*key).to_string(), json!((v * 100.0).round()));
let opened = [g.left, g.top, g.right, g.bottom];
for (key, v) in SLICE_KEYS.iter().zip(opened) {
m.insert((*key).to_string(), json!(v * 100.0));
}
m.insert(SLICE_OPENED.into(), json!(opened));
m
}
/// The guides the dialog's fields describe, as the `nineSlice` / `nineSliceGuides` params.
/// The guides the dialog's fields describe, as the `nineSlice` / `nineSliceGuides` params. A field
/// still showing the guide it opened with gives that guide exactly.
fn slice_params(d: &Dialog) -> Value {
let [l, t, r, b] = SLICE_KEYS.map(|key| d.f64(key, DEFAULT_SLICE_PERCENT) / 100.0);
let opened = d.fields.get(SLICE_OPENED).and_then(Value::as_array);
let [l, t, r, b] = std::array::from_fn(|i| {
let percent = d.f64(SLICE_KEYS[i], DEFAULT_SLICE_PERCENT);
match opened.and_then(|a| a.get(i)).and_then(Value::as_f64) {
Some(g) if g * 100.0 == percent => g,
_ => percent / 100.0,
}
});
if d.bool("nineSlice") { json!({ "nineSlice": true, "nineSliceGuides": [l, t, r, b] }) } else { json!({ "nineSlice": false }) }
}
@@ -134,7 +154,7 @@ fn body(_: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
for (key, text) in SLICE_KEYS.into_iter().zip([tl!("Left:"), tl!("Top:"), tl!("Right:"), tl!("Bottom:")]) {
label(ui, text);
let v = d.f64(key, DEFAULT_SLICE_PERCENT);
if let Some(n) = widgets::range_field(ui, ("dlg-field", key), v, 0.0..=100.0, "%", 0, 64.0) {
if let Some(n) = widgets::range_field(ui, ("dlg-field", key), v, SLICE_PERCENT_RANGE, "%", 3, 64.0) {
d.fields.insert(key.into(), json!(n));
}
ui.end_row();
@@ -248,6 +248,35 @@ fn a_failed_save_before_packaging_writes_no_package() {
}
}
/// A package that an automation request confined to its roots asks for, started once the
/// document's background save is written, is still confined to those roots, though the save's
/// result arrives outside the request.
#[test]
fn a_package_started_after_its_save_keeps_the_automation_roots() {
let (dir, elsewhere) = (Folder::new("scope"), Folder::new("scope-elsewhere"));
let (doc, out) = (dir.path("card.vectorcraft"), elsewhere.path("out"));
let root = std::path::Path::new(&out).join("card Folder");
let mut app = saved(&dir);
let files = Files::default();
let recorded = files.clone();
app.services.write_shared = Some(Arc::new(move |p: &str, b: &[u8]| {
vectorcraft_engine::file_access::check_write(p)?;
recorded.lock().unwrap().push((p.to_string(), b.to_vec()));
Ok(())
}));
let roots = AutomationRoots::new(&[dir.0.as_path()], &[dir.0.as_path()]).unwrap();
app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap();
package_dialog(&mut app, &out);
let r = vectorcraft_engine::file_access::confine(roots.as_ref(), || confirm(&mut app)).unwrap();
assert_eq!(r["background"], true, "{r}");
// The save's result is applied outside the request, as the next frame does.
background::wait_all(&mut app);
assert_eq!(written(&files), [doc], "only the save, inside the roots");
assert!(!root.exists(), "no package folder outside the roots");
assert!(!app.session.active().unwrap().is_dirty(), "the save was written");
assert!(app.ui.status.contains("failed"), "the package was refused: {}", app.ui.status);
}
#[test]
fn a_package_made_at_once_waits_for_one_in_the_background() {
let dir = Folder::new("twice");
+37 -3
View File
@@ -300,8 +300,9 @@ struct MenuState {
/// The highlighted row and the query and filters it belongs to.
highlight: Option<usize>,
query: String,
/// The filters (kept from one opening to the next): script (0..[`SCRIPTS`]), kind, font
/// technology (variable fonts only) and favourites only.
/// The filters (kept from one opening to the next, and the same in every font menu:
/// [`Filters`]): script (0..[`SCRIPTS`]), kind, font technology (variable fonts only) and
/// favorites only.
script: usize,
class: Option<FontClass>,
variable_only: bool,
@@ -324,6 +325,35 @@ struct MenuState {
wheel_target: Option<WheelTarget>,
}
/// The filters of [`MenuState`], one set for every font menu (the Character panel's, the Control
/// bar's, the Properties panel's…): a filter chosen in one menu is on in all of them. They last
/// for the session.
#[derive(Clone, Copy, Debug, Default, PartialEq)]
struct Filters {
script: usize,
class: Option<FontClass>,
variable_only: bool,
favorites_only: bool,
}
impl Filters {
fn of(st: &MenuState) -> Self {
Self { script: st.script, class: st.class, variable_only: st.variable_only, favorites_only: st.favorites_only }
}
fn apply(self, st: &mut MenuState) {
st.script = self.script;
st.class = self.class;
st.variable_only = self.variable_only;
st.favorites_only = self.favorites_only;
}
}
/// Where the filters every font menu shares are kept ([`Filters`]).
fn filters_id() -> egui::Id {
egui::Id::unique("font-menu-filters")
}
/// The font family menu showing `current`, `width` points wide, rows sampling `sample` (the
/// selected text; `None`: a generic sample).
pub fn font_menu(
@@ -336,6 +366,7 @@ pub fn font_menu(
) -> Option<FontPick> {
let state_id = ui.scope_id().with(&id).with("font-menu");
let mut st: MenuState = ui.data(|d| d.get_temp(state_id)).unwrap_or_default();
ui.data(|d| d.get_temp::<Filters>(filters_id())).unwrap_or_default().apply(&mut st);
let target = ui.data(|d| d.get_temp(wheel_fields_id(ui.ctx().viewport_id()).with("target")));
let target_changed = st.wheel_target != target;
if target_changed {
@@ -416,7 +447,10 @@ pub fn font_menu(
if matches!(out, Some(FontPick::Chosen(..))) {
st.previewed = None;
}
ui.data_mut(|d| d.insert_temp(state_id, st));
ui.data_mut(|d| {
d.insert_temp(filters_id(), Filters::of(&st));
d.insert_temp(state_id, st);
});
out
}
+102
View File
@@ -790,6 +790,108 @@ fn a_modified_turn_that_starts_a_stream_keeps_it_off_the_field() {
assert_eq!((left, notches), (1, 0), "the stream began as a modified turn");
}
/// The font menus of two panels (other ids, other scopes) share their filters: a filter chosen in
/// one menu is on when the other opens, and it lists its rows by it.
#[test]
fn a_filter_chosen_in_one_panels_menu_is_on_in_the_others() {
use vectorcraft_text::FontClass;
let ctx = egui::Context::default();
crate::theme::install_fonts(&ctx);
let fields = [("character", "character-font", 10.0), ("control-bar", "control-font", 60.0)];
let field = |top: f32| egui::Rect::from_min_size(egui::pos2(10.0, top), egui::vec2(200.0, 30.0));
// Draws both fields (and the open menu), and returns the texts drawn with their centers and
// each menu's state.
let frame = |events: Vec<egui::Event>| {
let input =
egui::RawInput { events, screen_rect: Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(800.0, 900.0))), ..Default::default() };
let mut ids = [egui::Id::NULL; 2];
let mut out = ctx.run_ui(input, |ui| {
for (i, (scope, id, top)) in fields.into_iter().enumerate() {
ui.push_id(scope, |ui| {
ui.scope_builder(egui::UiBuilder::new().max_rect(field(top)), |ui| {
ids[i] = ui.scope_id().with(id).with("font-menu");
super::font_menu(ui, id, "Inter", 200.0, None, super::MenuLook { samples: false, ..Default::default() });
});
});
}
});
out.textures_delta.clear();
let texts: Vec<(String, egui::Pos2)> = out
.shapes
.iter()
.filter_map(|c| match &c.shape {
egui::Shape::Text(t) => Some((t.galley.text().to_string(), t.visual_bounding_rect().center())),
_ => None,
})
.collect();
let states = ids.map(|id| ctx.data(|d| d.get_temp::<super::MenuState>(id)).unwrap_or_default());
(texts, states)
};
let press = |at: egui::Pos2| {
let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() };
frame(vec![egui::Event::PointerMoved(at), button(true)]);
frame(vec![button(false)]);
for _ in 0..3 {
frame(vec![]);
}
};
let open = |i: usize| press(field(fields[i].2).min + egui::vec2(10.0, 10.0));
let close = || {
let escape = [true, false].map(|pressed| egui::Event::Key {
key: egui::Key::Escape,
physical_key: None,
pressed,
repeat: false,
modifiers: Default::default(),
});
frame(escape.to_vec());
for _ in 0..3 {
frame(vec![]);
}
};
// The topmost text `label`: a filter chip, above the rows.
let chip = |label: &str| {
let (texts, _) = frame(vec![]);
texts
.into_iter()
.filter(|(t, _)| t == label)
.map(|(_, at)| at)
.min_by(|a, b| a.y.total_cmp(&b.y))
.unwrap_or_else(|| panic!("{label} is drawn"))
};
let families = |st: &super::MenuState| st.rows.iter().filter(|r| matches!(r, Row::Family(_))).count();
let filters = |st: &super::MenuState| (st.script, st.class, st.variable_only, st.favorites_only);
frame(vec![]);
// Favorites only, chosen in the first panel's menu, with no favorites: the second lists nothing.
open(0);
press(chip("★"));
close();
let (_, [first, second]) = frame(vec![]);
assert!(first.favorites_only && second.favorites_only, "the second menu has the filter before it opens");
open(1);
let (_, [_, second]) = frame(vec![]);
assert!(second.favorites_only);
assert_eq!(families(&second), 0, "no favorites, so the second menu lists no family");
// A script, a kind and Variable chosen in the second panel's menu are on in the first.
press(chip(super::script_label(3)));
press(chip(super::class_label(FontClass::Monospaced)));
press(chip(super::variable_label()));
close();
open(0);
let (_, [first, _]) = frame(vec![]);
assert_eq!(filters(&first), (3, Some(FontClass::Monospaced), true, true));
// Every filter, turned off in the first menu, is off in the second, which lists families again.
press(chip("★"));
press(chip(super::script_label(0)));
press(chip(super::class_label(FontClass::Monospaced)));
press(chip(super::variable_label()));
close();
open(1);
let (_, [_, second]) = frame(vec![]);
assert_eq!(filters(&second), (0, None, false, false));
assert!(families(&second) > 0, "every family is listed again");
}
/// The Font Technology filter's Variable is the font adjective, not the Variables panel's noun.
#[test]
fn the_variable_filter_is_named_as_fonts_are() {
+12 -4
View File
@@ -660,7 +660,8 @@ const MESSAGE_DEPTH: usize = 5;
/// Translate a status or error message for display (see the module docs). Unknown messages, and
/// parts of them (file names, numbers, a reason with no entry, a JSON object or array such as
/// `{"objects": [...]}`, a value the message quotes in `"…"`, `“…”` or backticks, such as a
/// symbol's name), stay as they are.
/// symbol's name), stay as they are. A part that starts with `{` or `[` is translated only
/// when it is a whole message with an exact entry, such as `[x, y] (two numbers)`.
pub fn message(lang: Lang, s: &str) -> String {
message_at(lang, s, MESSAGE_DEPTH)
}
@@ -671,9 +672,16 @@ fn message_at(lang: Lang, s: &str, depth: usize) -> String {
let form = count.map_or(forms.len().saturating_sub(1), |n| (lang.0.plural)(n).min(forms.len().saturating_sub(1)));
let Some(template) = forms.get(form) else { return s.to_string() };
let quoted = |v: &str| [('"', '"'), ('“', '”'), ('`', '`')].iter().any(|(a, b)| s.contains(&format!("{a}{v}{b}")));
let nested = |v: &str| depth > 1 && !v.starts_with(['{', '[']) && !quoted(v);
let values: Vec<(&str, String)> =
caps.into_iter().map(|(k, v)| (k, if nested(v) { message_at(lang, v, depth - 1) } else { v.to_string() })).collect();
let nested = |v: &str| {
if depth <= 1 || quoted(v) {
v.to_string()
} else if v.starts_with(['{', '[']) {
lang.catalog().exact_message(v).unwrap_or(v).to_string()
} else {
message_at(lang, v, depth - 1)
}
};
let values: Vec<(&str, String)> = caps.into_iter().map(|(k, v)| (k, nested(v))).collect();
let args: Vec<(&str, &str)> = values.iter().map(|(k, v)| (*k, v.as_str())).collect();
fill_once(template, &args)
}
+2
View File
@@ -1018,6 +1018,7 @@ font-technology Variable Променливи
Enable Rubber Band for Разрешаване на ластик за
Enable text access for screen readers Разрешаване на достъп до текст за екранни четци
Enable Touch Gestures Разрешаване на докосващи жестове
Switch Selection and Drawing Modes Превключване между режим на селекция и рисуване
Enable Touch Workspace Разрешаване на работно пространство за докосване
Encoding Кодиране
Encoding: Кодиране:
@@ -4196,6 +4197,7 @@ axis Both И двете
@msg `{key}` must be a whole number between {min} and {max} (got {x}) `{key}` трябва да бъде цяло число между {min} и {max} (получено е {x})
@msg `{key}` must be between {min} and {max} (got {x}) `{key}` трябва да бъде между {min} и {max} (получено е {x})
@msg `{key}` must be one of {_1} `{key}` трябва да бъде едно от {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` трябва да бъде едно от {_1}, а не {got}
@msg `{key}` must be true or false `{key}` трябва да бъде true или false
@msg `{k}` must be [x, y] `{k}` трябва да бъде [x, y]
@msg `{name}` has no options `{name}` няма опции
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -3739,6 +3739,7 @@ theme Appearance Izgled
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
Switch Selection and Drawing Modes Prebaci između načina odabira i crtanja
Enable Touch Workspace Omogući radni prostor za dodir
English: UK Engleski: UK
Every (minutes) Svakih (minuta)
@@ -4566,6 +4567,7 @@ imageTrace Outline Obris
@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 `{path}` must be one of {_1}, not {got} `{path}` mora biti jedno od {_1}, a ne {got}
@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
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -1481,6 +1481,7 @@ antiAlias Sharp Nítid
Enable Rubber Band for Activa la goma elàstica per a
Enable text access for screen readers Activa l’accés al text per als lectors de pantalla
Enable Touch Gestures Activa els gestos tàctils
Switch Selection and Drawing Modes Canvia entre els modes de selecció i de dibuix
Enable Touch Workspace Activa l’espai de treball tàctil
Encoding Codificació
Encoding and writing the file… S’està codificant i escrivint el fitxer…
@@ -6482,6 +6483,35 @@ digits Malayalam Malaiàlam
@msg the path has no anchor points el traçat no té punts d’ancoratge
@msg too many anchor points (limit {MAX_ANCHORS}) massa punts d’ancoratge (límit {MAX_ANCHORS})
@msg true or false true o false
@msg a number >= {_1} un nombre >= {_1}
@msg a number > {_1} un nombre > {_1}
@msg a number <= {_1} un nombre <= {_1}
@msg a number < {_1} un nombre < {_1}
@msg a number {_1} to {_2} un nombre de {_1} a {_2}
@msg a number >= {_1} and < {_2} un nombre >= {_1} i < {_2}
@msg a number > {_1} and <= {_2} un nombre > {_1} i <= {_2}
@msg a number > {_1} and < {_2} un nombre > {_1} i < {_2}
@msg a number ({_1}) un nombre ({_1})
@msg a number >= {_1} ({_2}) un nombre >= {_1} ({_2})
@msg a number > {_1} ({_2}) un nombre > {_1} ({_2})
@msg a number <= {_1} ({_2}) un nombre <= {_1} ({_2})
@msg a number < {_1} ({_2}) un nombre < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) un nombre de {_1} a {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) un nombre >= {_1} i < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) un nombre > {_1} i <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) un nombre > {_1} i < {_2} ({_3})
@msg an integer un enter
@msg an integer >= {_1} un enter >= {_1}
@msg an integer <= {_1} un enter <= {_1}
@msg an integer {_1} to {_2} un enter de {_1} a {_2}
@msg one of {_1} un de {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` ha de ser un de {_1}, no {got}
@msg an object id (a non-negative integer) un identificador d’objecte (un enter no negatiu)
@msg a list of object ids una llista d’identificadors d’objecte
@msg a color (a string, [r, g, b] or an object) un color (una cadena, [r, g, b] o un objecte)
@msg [x, y] (two numbers) [x, y] (dos nombres)
@msg an object un objecte
@msg a list una llista
@msg unknown key `{k}`; the keys here are {_1} clau desconeguda `{k}`; les claus aquí són {_1}
@msg {_1} is listed twice {_1} apareix dues vegades
@msg {_1} is not the id of an input object {_1} no és l’id d’un objecte d’entrada
Can't render this file because it contains an unexpected character in line 2 and column 73.
+6
View File
@@ -249,6 +249,12 @@ impl Catalog {
self.templates.iter().find_map(|t| t.captures(s).map(|caps| (t.forms.as_slice(), caps)))
}
/// The translation of a status or error message that has an exact `@msg` entry; templates are
/// not tried.
pub fn exact_message(&self, s: &str) -> Option<&str> {
self.messages.get(s).map(String::as_str)
}
/// The plural form `index` of the message whose English forms are `one|other`.
pub fn plural(&self, one: &str, other: &str, index: usize) -> Option<&str> {
let forms = self.plurals.get(&format!("{one}|{other}"))?;
+30
View File
@@ -3793,6 +3793,7 @@ theme Appearance Motiv
Enable Missing Glyph Protection Povolit ochranu chybějících glyfů
Enable Rubber Band for Povolit gumovou čáru pro
Enable Touch Gestures Povolit dotyková gesta
Switch Selection and Drawing Modes Přepnout mezi režimem výběru a kreslení
Enable Touch Workspace Povolit dotykový pracovní prostor
English: UK Angličtina: Spojené království
Every (minutes) Každých (minut)
@@ -6397,6 +6398,35 @@ axis Y Axis osa Y
@msg the path has no anchor points cesta nemá žádné kotevní body
@msg too many anchor points (limit {MAX_ANCHORS}) příliš mnoho kotevních bodů (limit {MAX_ANCHORS})
@msg true or false true nebo false
@msg a number >= {_1} číslo >= {_1}
@msg a number > {_1} číslo > {_1}
@msg a number <= {_1} číslo <= {_1}
@msg a number < {_1} číslo < {_1}
@msg a number {_1} to {_2} číslo od {_1} do {_2}
@msg a number >= {_1} and < {_2} číslo >= {_1} a < {_2}
@msg a number > {_1} and <= {_2} číslo > {_1} a <= {_2}
@msg a number > {_1} and < {_2} číslo > {_1} a < {_2}
@msg a number ({_1}) číslo ({_1})
@msg a number >= {_1} ({_2}) číslo >= {_1} ({_2})
@msg a number > {_1} ({_2}) číslo > {_1} ({_2})
@msg a number <= {_1} ({_2}) číslo <= {_1} ({_2})
@msg a number < {_1} ({_2}) číslo < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) číslo od {_1} do {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) číslo >= {_1} a < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) číslo > {_1} a <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) číslo > {_1} a < {_2} ({_3})
@msg an integer celé číslo
@msg an integer >= {_1} celé číslo >= {_1}
@msg an integer <= {_1} celé číslo <= {_1}
@msg an integer {_1} to {_2} celé číslo od {_1} do {_2}
@msg one of {_1} jedna z hodnot {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` musí být jedna z hodnot {_1}, nikoli {got}
@msg an object id (a non-negative integer) ID objektu (nezáporné celé číslo)
@msg a list of object ids seznam ID objektů
@msg a color (a string, [r, g, b] or an object) barva (řetězec, [r, g, b] nebo objekt)
@msg [x, y] (two numbers) [x, y] (dvě čísla)
@msg an object objekt
@msg a list seznam
@msg unknown key `{k}`; the keys here are {_1} neznámý klíč `{k}`; zde platné klíče jsou {_1}
@msg {_1} is listed twice {_1} je uveden dvakrát
@msg {_1} is not the id of an input object {_1} není ID vstupního objektu
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -3526,6 +3526,7 @@ theme Appearance Udseende
Enable Missing Glyph Protection Aktivér beskyttelse mod manglende glyffer
Enable Rubber Band for Aktivér gummibånd for
Enable Touch Gestures Aktivér berøringsbevægelser
Switch Selection and Drawing Modes Skift mellem markerings- og tegnetilstand
Enable Touch Workspace Aktivér touch-arbejdsområde
English: UK Engelsk: UK
Every (minutes) Hvert (minut)
@@ -4312,6 +4313,7 @@ imageTrace Outline Kontur
@msg `{key}` must be a whole number between {min} and {max} (got {x}) `{key}` skal være et heltal mellem {min} og {max} (fik {x})
@msg `{key}` must be between {min} and {max} (got {x}) `{key}` skal være mellem {min} og {max} (fik {x})
@msg `{key}` must be one of {_1} `{key}` skal være en af {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` skal være en af {_1}, ikke {got}
@msg `{key}` must be true or false `{key}` skal være true eller false
@msg `{k}` must be [x, y] `{k}` skal være [x, y]
@msg `{name}` has no options `{name}` har ingen indstillinger
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -1020,6 +1020,7 @@ font-technology Variable Variabel
Enable Rubber Band for Gummiband aktivieren für
Enable text access for screen readers Textzugriff für Bildschirmlesegeräte zulassen
Enable Touch Gestures Touch-Gesten aktivieren
Switch Selection and Drawing Modes Zwischen Auswahl- und Zeichenmodus wechseln
Enable Touch Workspace Touch-Arbeitsbereich aktivieren
Encoding Kodierung
Encoding: Kodierung:
@@ -5988,6 +5989,35 @@ axis Y Axis Y-Achse
@msg the path has no anchor points der Pfad hat keine Ankerpunkte
@msg too many anchor points (limit {MAX_ANCHORS}) zu viele Ankerpunkte (Grenze {MAX_ANCHORS})
@msg true or false true oder false
@msg a number >= {_1} eine Zahl >= {_1}
@msg a number > {_1} eine Zahl > {_1}
@msg a number <= {_1} eine Zahl <= {_1}
@msg a number < {_1} eine Zahl < {_1}
@msg a number {_1} to {_2} eine Zahl von {_1} bis {_2}
@msg a number >= {_1} and < {_2} eine Zahl >= {_1} und < {_2}
@msg a number > {_1} and <= {_2} eine Zahl > {_1} und <= {_2}
@msg a number > {_1} and < {_2} eine Zahl > {_1} und < {_2}
@msg a number ({_1}) eine Zahl ({_1})
@msg a number >= {_1} ({_2}) eine Zahl >= {_1} ({_2})
@msg a number > {_1} ({_2}) eine Zahl > {_1} ({_2})
@msg a number <= {_1} ({_2}) eine Zahl <= {_1} ({_2})
@msg a number < {_1} ({_2}) eine Zahl < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) eine Zahl von {_1} bis {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) eine Zahl >= {_1} und < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) eine Zahl > {_1} und <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) eine Zahl > {_1} und < {_2} ({_3})
@msg an integer eine ganze Zahl
@msg an integer >= {_1} eine ganze Zahl >= {_1}
@msg an integer <= {_1} eine ganze Zahl <= {_1}
@msg an integer {_1} to {_2} eine ganze Zahl von {_1} bis {_2}
@msg one of {_1} einer der Werte {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` muss einer der Werte {_1} sein, nicht {got}
@msg an object id (a non-negative integer) eine Objekt-ID (eine nicht negative ganze Zahl)
@msg a list of object ids eine Liste von Objekt-IDs
@msg a color (a string, [r, g, b] or an object) eine Farbe (eine Zeichenkette, [r, g, b] oder ein Objekt)
@msg [x, y] (two numbers) [x, y] (zwei Zahlen)
@msg an object ein Objekt
@msg a list eine Liste
@msg unknown key `{k}`; the keys here are {_1} unbekannter Schlüssel `{k}`; die Schlüssel hier sind {_1}
@msg {_1} is listed twice {_1} ist doppelt aufgeführt
@msg {_1} is not the id of an input object {_1} ist nicht die ID eines Eingabeobjekts
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -988,6 +988,7 @@ font-technology Variable Μεταβλητές
Enable Rubber Band for Ενεργοποίηση δυναμικής προεπισκόπησης γραμμής για
Enable text access for screen readers Ενεργοποίηση πρόσβασης κειμένου για αναγνώστες οθόνης
Enable Touch Gestures Ενεργοποίηση χειρονομιών αφής
Switch Selection and Drawing Modes Εναλλαγή λειτουργιών επιλογής και σχεδίασης
Enable Touch Workspace Ενεργοποίηση χώρου εργασίας αφής
Encoding Κωδικοποίηση
Encoding: Κωδικοποίηση:
@@ -6348,6 +6349,35 @@ axis Y Axis Άξονας Y
@msg the path has no anchor points η διαδρομή δεν έχει σημεία αγκύρωσης
@msg too many anchor points (limit {MAX_ANCHORS}) πάρα πολλά σημεία αγκύρωσης (όριο {MAX_ANCHORS})
@msg true or false true ή false
@msg a number >= {_1} αριθμός >= {_1}
@msg a number > {_1} αριθμός > {_1}
@msg a number <= {_1} αριθμός <= {_1}
@msg a number < {_1} αριθμός < {_1}
@msg a number {_1} to {_2} αριθμός από {_1} έως {_2}
@msg a number >= {_1} and < {_2} αριθμός >= {_1} και < {_2}
@msg a number > {_1} and <= {_2} αριθμός > {_1} και <= {_2}
@msg a number > {_1} and < {_2} αριθμός > {_1} και < {_2}
@msg a number ({_1}) αριθμός ({_1})
@msg a number >= {_1} ({_2}) αριθμός >= {_1} ({_2})
@msg a number > {_1} ({_2}) αριθμός > {_1} ({_2})
@msg a number <= {_1} ({_2}) αριθμός <= {_1} ({_2})
@msg a number < {_1} ({_2}) αριθμός < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) αριθμός από {_1} έως {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) αριθμός >= {_1} και < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) αριθμός > {_1} και <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) αριθμός > {_1} και < {_2} ({_3})
@msg an integer ακέραιος
@msg an integer >= {_1} ακέραιος >= {_1}
@msg an integer <= {_1} ακέραιος <= {_1}
@msg an integer {_1} to {_2} ακέραιος από {_1} έως {_2}
@msg one of {_1} μία από τις τιμές {_1}
@msg `{path}` must be one of {_1}, not {got} Το `{path}` πρέπει να είναι μία από τις τιμές {_1}, όχι {got}
@msg an object id (a non-negative integer) αναγνωριστικό αντικειμένου (μη αρνητικός ακέραιος)
@msg a list of object ids λίστα αναγνωριστικών αντικειμένων
@msg a color (a string, [r, g, b] or an object) χρώμα (συμβολοσειρά, [r, g, b] ή αντικείμενο)
@msg [x, y] (two numbers) [x, y] (δύο αριθμοί)
@msg an object αντικείμενο
@msg a list λίστα
@msg unknown key `{k}`; the keys here are {_1} άγνωστο κλειδί `{k}`· τα κλειδιά εδώ είναι {_1}
@msg {_1} is listed twice το {_1} αναφέρεται δύο φορές
@msg {_1} is not the id of an input object το {_1} δεν είναι αναγνωριστικό αντικειμένου εισόδου
Can't render this file because it is too large.
+30
View File
@@ -1041,6 +1041,7 @@ font-technology Variable Variables
Enable Rubber Band for Activar banda elástica para
Enable text access for screen readers Permitir el acceso al texto para lectores de pantalla
Enable Touch Gestures Activar gestos táctiles
Switch Selection and Drawing Modes Cambiar entre modos de selección y dibujo
Enable Touch Workspace Activar espacio de trabajo táctil
Encoding Codificación
Encoding: Codificación:
@@ -6339,6 +6340,35 @@ axis Y Axis Eje Y
@msg the path has no anchor points el trazado no tiene puntos de ancla
@msg too many anchor points (limit {MAX_ANCHORS}) demasiados puntos de ancla (límite {MAX_ANCHORS})
@msg true or false true o false
@msg a number >= {_1} un número >= {_1}
@msg a number > {_1} un número > {_1}
@msg a number <= {_1} un número <= {_1}
@msg a number < {_1} un número < {_1}
@msg a number {_1} to {_2} un número de {_1} a {_2}
@msg a number >= {_1} and < {_2} un número >= {_1} y < {_2}
@msg a number > {_1} and <= {_2} un número > {_1} y <= {_2}
@msg a number > {_1} and < {_2} un número > {_1} y < {_2}
@msg a number ({_1}) un número ({_1})
@msg a number >= {_1} ({_2}) un número >= {_1} ({_2})
@msg a number > {_1} ({_2}) un número > {_1} ({_2})
@msg a number <= {_1} ({_2}) un número <= {_1} ({_2})
@msg a number < {_1} ({_2}) un número < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) un número de {_1} a {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) un número >= {_1} y < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) un número > {_1} y <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) un número > {_1} y < {_2} ({_3})
@msg an integer un entero
@msg an integer >= {_1} un entero >= {_1}
@msg an integer <= {_1} un entero <= {_1}
@msg an integer {_1} to {_2} un entero de {_1} a {_2}
@msg one of {_1} uno de {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` debe ser uno de {_1}, no {got}
@msg an object id (a non-negative integer) un id. de objeto (un entero no negativo)
@msg a list of object ids una lista de id. de objeto
@msg a color (a string, [r, g, b] or an object) un color (una cadena, [r, g, b] o un objeto)
@msg [x, y] (two numbers) [x, y] (dos números)
@msg an object un objeto
@msg a list una lista
@msg unknown key `{k}`; the keys here are {_1} clave desconocida `{k}`; las claves aquí son {_1}
@msg {_1} is listed twice {_1} aparece dos veces
@msg {_1} is not the id of an input object {_1} no es el id de un objeto de entrada
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -3731,6 +3731,7 @@ theme Appearance Ulkoasu
Enable Missing Glyph Protection Ota puuttuvien merkkien suojaus käyttöön
Enable Rubber Band for Ota kumilankavalinta käyttöön kohteelle
Enable Touch Gestures Ota kosketuseleet käyttöön
Switch Selection and Drawing Modes Vaihda valinta- ja piirtotilan välillä
Enable Touch Workspace Ota kosketustyötila käyttöön
English: UK Englanti: UK
Every (minutes) Välein (minuuttia)
@@ -6427,6 +6428,35 @@ axis Y Axis Y-akseli
@msg the path has no anchor points polulla ei ole ankkuripisteitä
@msg too many anchor points (limit {MAX_ANCHORS}) liian monta ankkuripistettä (raja {MAX_ANCHORS})
@msg true or false true tai false
@msg a number >= {_1} luku >= {_1}
@msg a number > {_1} luku > {_1}
@msg a number <= {_1} luku <= {_1}
@msg a number < {_1} luku < {_1}
@msg a number {_1} to {_2} luku, joka on vähintään {_1} ja enintään {_2}
@msg a number >= {_1} and < {_2} luku >= {_1} ja < {_2}
@msg a number > {_1} and <= {_2} luku > {_1} ja <= {_2}
@msg a number > {_1} and < {_2} luku > {_1} ja < {_2}
@msg a number ({_1}) luku ({_1})
@msg a number >= {_1} ({_2}) luku >= {_1} ({_2})
@msg a number > {_1} ({_2}) luku > {_1} ({_2})
@msg a number <= {_1} ({_2}) luku <= {_1} ({_2})
@msg a number < {_1} ({_2}) luku < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) luku, joka on vähintään {_1} ja enintään {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) luku >= {_1} ja < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) luku > {_1} ja <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) luku > {_1} ja < {_2} ({_3})
@msg an integer kokonaisluku
@msg an integer >= {_1} kokonaisluku >= {_1}
@msg an integer <= {_1} kokonaisluku <= {_1}
@msg an integer {_1} to {_2} kokonaisluku, joka on vähintään {_1} ja enintään {_2}
@msg one of {_1} jokin arvoista {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` on oltava jokin arvoista {_1}, ei {got}
@msg an object id (a non-negative integer) objektitunnus (ei-negatiivinen kokonaisluku)
@msg a list of object ids objektitunnusten luettelo
@msg a color (a string, [r, g, b] or an object) väri (merkkijono, [r, g, b] tai objekti)
@msg [x, y] (two numbers) [x, y] (kaksi lukua)
@msg an object objekti
@msg a list luettelo
@msg unknown key `{k}`; the keys here are {_1} tuntematon avain `{k}`; tässä käytettävät avaimet ovat {_1}
@msg {_1} is listed twice {_1} on luettelossa kahdesti
@msg {_1} is not the id of an input object {_1} ei ole syöteobjektin tunnus
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -1036,6 +1036,7 @@ font-technology Variable Variables
Enable Rubber Band for Activer l’élastique pour
Enable text access for screen readers Autoriser l’accès au texte pour les lecteurs d’écran
Enable Touch Gestures Activer les gestes tactiles
Switch Selection and Drawing Modes Basculer entre les modes sélection et dessin
Enable Touch Workspace Activer l’espace de travail tactile
Encoding Codage
Encoding: Codage :
@@ -6392,6 +6393,35 @@ axis Y Axis Axe Y
@msg the path has no anchor points le tracé n’a aucun point d’ancrage
@msg too many anchor points (limit {MAX_ANCHORS}) trop de points d’ancrage (limite {MAX_ANCHORS})
@msg true or false true ou false
@msg a number >= {_1} un nombre >= {_1}
@msg a number > {_1} un nombre > {_1}
@msg a number <= {_1} un nombre <= {_1}
@msg a number < {_1} un nombre < {_1}
@msg a number {_1} to {_2} un nombre de {_1} à {_2}
@msg a number >= {_1} and < {_2} un nombre >= {_1} et < {_2}
@msg a number > {_1} and <= {_2} un nombre > {_1} et <= {_2}
@msg a number > {_1} and < {_2} un nombre > {_1} et < {_2}
@msg a number ({_1}) un nombre ({_1})
@msg a number >= {_1} ({_2}) un nombre >= {_1} ({_2})
@msg a number > {_1} ({_2}) un nombre > {_1} ({_2})
@msg a number <= {_1} ({_2}) un nombre <= {_1} ({_2})
@msg a number < {_1} ({_2}) un nombre < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) un nombre de {_1} à {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) un nombre >= {_1} et < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) un nombre > {_1} et <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) un nombre > {_1} et < {_2} ({_3})
@msg an integer un entier
@msg an integer >= {_1} un entier >= {_1}
@msg an integer <= {_1} un entier <= {_1}
@msg an integer {_1} to {_2} un entier de {_1} à {_2}
@msg one of {_1} l’une des valeurs {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` doit être l’une des valeurs {_1}, pas {got}
@msg an object id (a non-negative integer) un identifiant d’objet (un entier positif ou nul)
@msg a list of object ids une liste d’identifiants d’objet
@msg a color (a string, [r, g, b] or an object) une couleur (une chaîne, [r, g, b] ou un objet)
@msg [x, y] (two numbers) [x, y] (deux nombres)
@msg an object un objet
@msg a list une liste
@msg unknown key `{k}`; the keys here are {_1} clé inconnue `{k}` ; les clés ici sont {_1}
@msg {_1} is listed twice {_1} figure deux fois
@msg {_1} is not the id of an input object {_1} n’est pas l’identifiant d’un objet d’entrée
Can't render this file because it contains an unexpected character in line 2 and column 73.
+31 -1
View File
@@ -1632,6 +1632,7 @@ antiAlias Sharp शार्प
Enable Rubber Band for के लिए रबर बैंड सक्षम करें
Enable text access for screen readers स्क्रीन रीडर के लिए टेक्स्ट एक्सेस सक्षम करें
Enable Touch Gestures टच जेस्चर ऑन करें
Switch Selection and Drawing Modes चयन और ड्रॉइंग मोड के बीच बदलें
Enable Touch Workspace टच वर्कस्पेस सक्षम करें
Enclosing Lasso लासो संलग्न करना
Enclosing Lasso Tool लासो टूल संलग्न करना
@@ -5550,6 +5551,35 @@ antiAlias Sharp शार्प
@msg the path has no anchor points पाथ में कोई एंकर पॉइंट नहीं है
@msg too many anchor points (limit {MAX_ANCHORS}) बहुत अधिक एंकर पॉइंट (सीमा {MAX_ANCHORS})
@msg true or false true या false
@msg a number >= {_1} एक संख्या >= {_1}
@msg a number > {_1} एक संख्या > {_1}
@msg a number <= {_1} एक संख्या <= {_1}
@msg a number < {_1} एक संख्या < {_1}
@msg a number {_1} to {_2} {_1} से {_2} तक की एक संख्या
@msg a number >= {_1} and < {_2} एक संख्या >= {_1} और < {_2}
@msg a number > {_1} and <= {_2} एक संख्या > {_1} और <= {_2}
@msg a number > {_1} and < {_2} एक संख्या > {_1} और < {_2}
@msg a number ({_1}) एक संख्या ({_1})
@msg a number >= {_1} ({_2}) एक संख्या >= {_1} ({_2})
@msg a number > {_1} ({_2}) एक संख्या > {_1} ({_2})
@msg a number <= {_1} ({_2}) एक संख्या <= {_1} ({_2})
@msg a number < {_1} ({_2}) एक संख्या < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) {_1} से {_2} तक की एक संख्या ({_3})
@msg a number >= {_1} and < {_2} ({_3}) एक संख्या >= {_1} और < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) एक संख्या > {_1} और <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) एक संख्या > {_1} और < {_2} ({_3})
@msg an integer एक पूर्णांक
@msg an integer >= {_1} एक पूर्णांक >= {_1}
@msg an integer <= {_1} एक पूर्णांक <= {_1}
@msg an integer {_1} to {_2} {_1} से {_2} तक का एक पूर्णांक
@msg one of {_1} {_1} में से एक
@msg `{path}` must be one of {_1}, not {got} `{path}` {_1} में से एक होना चाहिए, {got} नहीं
@msg an object id (a non-negative integer) एक ऑब्जेक्ट id (एक गैर-नकारात्मक पूर्णांक)
@msg a list of object ids ऑब्जेक्ट ids की एक सूची
@msg a color (a string, [r, g, b] or an object) एक रंग (एक स्ट्रिंग, [r, g, b] या एक ऑब्जेक्ट)
@msg [x, y] (two numbers) [x, y] (दो संख्याएँ)
@msg an object एक ऑब्जेक्ट
@msg a list एक सूची
@msg unknown key `{k}`; the keys here are {_1} अज्ञात कुंजी `{k}`; यहाँ की कुंजियाँ {_1} हैं
@msg {_1} is listed twice {_1} दो बार सूचीबद्ध है
@msg {_1} is not the id of an input object {_1} किसी इनपुट ऑब्जेक्ट का id नहीं है
@@ -7113,7 +7143,7 @@ antiAlias Sharp शार्प
@msg needs points जरूरत अंक
@msg New Window isn't available yet: a document opens in one window नई विंडो अभी तक उपलब्ध नहीं है: एक डॉक्यूमेंट एक विंडो में खुलता है
@msg nineSlice must be true or false nineSlice को true या false होना चाहिए
@msg nineSliceGuides must be [left, top, right, bottom], each 0..1, with left + right < 1 and top + bottom < 1 nineSliceGuides को [left, top, right, bottom] होना चाहिए, हर मान 0..1, और left + right < 1 तथा top + bottom < 1
@msg nineSliceGuides must be [left, top, right, bottom], each -16..16, with left + right < 1 and top + bottom < 1 nineSliceGuides को [left, top, right, bottom] होना चाहिए, हर मान -16..16, और left + right < 1 तथा top + bottom < 1
@msg no action set is current कोई कार्रवाई सेट चालू नहीं है
@msg no action set to save बचाने के लिए कोई कार्रवाई सेट नहीं
@msg no active data set कोई सक्रिय डेटा सेट नहीं
Can't render this file because it is too large.
+30
View File
@@ -1317,6 +1317,7 @@ font-technology Variable Változó
Enable Rubber Band for Gumiszalag-előnézet ehhez:
Enable text access for screen readers Szöveghozzáférés engedélyezése képernyőolvasóknak
Enable Touch Gestures Érintési kézmozdulatok
Switch Selection and Drawing Modes Váltás a kijelölési és a rajzolási mód között
Enable Touch Workspace Érintőképernyős munkaterület
Encoding Kódolás
Encoding: Kódolás:
@@ -6380,6 +6381,35 @@ axis Y Axis Y tengely
@msg the path has no anchor points az útvonalnak nincsenek horgonypontjai
@msg too many anchor points (limit {MAX_ANCHORS}) túl sok horgonypont (korlát: {MAX_ANCHORS})
@msg true or false true vagy false
@msg a number >= {_1} szám >= {_1}
@msg a number > {_1} szám > {_1}
@msg a number <= {_1} szám <= {_1}
@msg a number < {_1} szám < {_1}
@msg a number {_1} to {_2} {_1} és {_2} közötti szám
@msg a number >= {_1} and < {_2} szám >= {_1} és < {_2}
@msg a number > {_1} and <= {_2} szám > {_1} és <= {_2}
@msg a number > {_1} and < {_2} szám > {_1} és < {_2}
@msg a number ({_1}) szám ({_1})
@msg a number >= {_1} ({_2}) szám >= {_1} ({_2})
@msg a number > {_1} ({_2}) szám > {_1} ({_2})
@msg a number <= {_1} ({_2}) szám <= {_1} ({_2})
@msg a number < {_1} ({_2}) szám < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) {_1} és {_2} közötti szám ({_3})
@msg a number >= {_1} and < {_2} ({_3}) szám >= {_1} és < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) szám > {_1} és <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) szám > {_1} és < {_2} ({_3})
@msg an integer egész szám
@msg an integer >= {_1} egész szám >= {_1}
@msg an integer <= {_1} egész szám <= {_1}
@msg an integer {_1} to {_2} {_1} és {_2} közötti egész szám
@msg one of {_1} {_1} közül az egyik
@msg `{path}` must be one of {_1}, not {got} `{path}`: {_1} közül az egyik kell, nem ez: {got}
@msg an object id (a non-negative integer) objektumazonosító (nemnegatív egész szám)
@msg a list of object ids objektumazonosítók listája
@msg a color (a string, [r, g, b] or an object) szín (karakterlánc, [r, g, b] vagy objektum)
@msg [x, y] (two numbers) [x, y] (két szám)
@msg an object objektum
@msg a list lista
@msg unknown key `{k}`; the keys here are {_1} ismeretlen kulcs: `{k}`; az itt használható kulcsok: {_1}
@msg {_1} is listed twice {_1} kétszer szerepel
@msg {_1} is not the id of an input object {_1} nem egy bemeneti objektum azonosítója
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -3526,6 +3526,7 @@ theme Appearance Tampilan
Enable Missing Glyph Protection Aktifkan perlindungan glyph yang hilang
Enable Rubber Band for Aktifkan rubber band untuk
Enable Touch Gestures Aktifkan gestur sentuh
Switch Selection and Drawing Modes Beralih antara mode seleksi dan menggambar
Enable Touch Workspace Aktifkan ruang kerja sentuh
English: UK Inggris: UK
Every (minutes) Setiap (menit)
@@ -4312,6 +4313,7 @@ imageTrace Outline Kontur
@msg `{key}` must be a whole number between {min} and {max} (got {x}) `{key}` harus berupa bilangan bulat antara {min} dan {max} (diperoleh {x})
@msg `{key}` must be between {min} and {max} (got {x}) `{key}` harus di antara {min} dan {max} (diperoleh {x})
@msg `{key}` must be one of {_1} `{key}` harus salah satu dari {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` harus salah satu dari {_1}, bukan {got}
@msg `{key}` must be true or false `{key}` harus true atau false
@msg `{k}` must be [x, y] `{k}` harus [x, y]
@msg `{name}` has no options `{name}` tidak memiliki opsi
Can't render this file because it contains an unexpected character in line 2418 and column 5.
+30
View File
@@ -1050,6 +1050,7 @@ font-technology Variable Variabili
Enable Rubber Band for Attiva elastico per
Enable text access for screen readers Consenti l'accesso al testo per le utilità di lettura dello schermo
Enable Touch Gestures Attiva gesti touch
Switch Selection and Drawing Modes Passa tra modalità selezione e disegno
Enable Touch Workspace Attiva area di lavoro touch
Encoding Codifica
Encoding: Codifica:
@@ -6022,6 +6023,35 @@ axis Y Axis Asse Y
@msg the path has no anchor points il tracciato non ha punti di ancoraggio
@msg too many anchor points (limit {MAX_ANCHORS}) troppi punti di ancoraggio (limite {MAX_ANCHORS})
@msg true or false true o false
@msg a number >= {_1} un numero >= {_1}
@msg a number > {_1} un numero > {_1}
@msg a number <= {_1} un numero <= {_1}
@msg a number < {_1} un numero < {_1}
@msg a number {_1} to {_2} un numero da {_1} a {_2}
@msg a number >= {_1} and < {_2} un numero >= {_1} e < {_2}
@msg a number > {_1} and <= {_2} un numero > {_1} e <= {_2}
@msg a number > {_1} and < {_2} un numero > {_1} e < {_2}
@msg a number ({_1}) un numero ({_1})
@msg a number >= {_1} ({_2}) un numero >= {_1} ({_2})
@msg a number > {_1} ({_2}) un numero > {_1} ({_2})
@msg a number <= {_1} ({_2}) un numero <= {_1} ({_2})
@msg a number < {_1} ({_2}) un numero < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) un numero da {_1} a {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) un numero >= {_1} e < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) un numero > {_1} e <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) un numero > {_1} e < {_2} ({_3})
@msg an integer un intero
@msg an integer >= {_1} un intero >= {_1}
@msg an integer <= {_1} un intero <= {_1}
@msg an integer {_1} to {_2} un intero da {_1} a {_2}
@msg one of {_1} uno tra {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` deve essere uno tra {_1}, non {got}
@msg an object id (a non-negative integer) un ID di oggetto (un intero non negativo)
@msg a list of object ids un elenco di ID di oggetti
@msg a color (a string, [r, g, b] or an object) un colore (una stringa, [r, g, b] o un oggetto)
@msg [x, y] (two numbers) [x, y] (due numeri)
@msg an object un oggetto
@msg a list un elenco
@msg unknown key `{k}`; the keys here are {_1} chiave sconosciuta `{k}`; le chiavi qui sono {_1}
@msg {_1} is listed twice {_1} è elencato due volte
@msg {_1} is not the id of an input object {_1} non è l’id di un oggetto di input
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -1641,6 +1641,7 @@ antiAlias Sharp シャープ
Enable Opacity Mask 不透明マスクを有効にする
Enable Rubber Band for ラバーバンドを有効にする対象
Enable Touch Gestures タッチジェスチャーを有効にする
Switch Selection and Drawing Modes 選択モードと描画モードを切り替え
Enable Touch Workspace タッチワークスペースを有効にする
Enable copying of text, images and other content テキスト、イメージ、その他のコンテンツのコピーを許可
Enable in-menu font previews メニュー内でフォントプレビューを有効にする
@@ -6087,6 +6088,35 @@ axis Y Axis Y 軸
@msg the path has no anchor points パスにアンカーポイントがありません
@msg too many anchor points (limit {MAX_ANCHORS}) アンカーポイントが多すぎます (上限 {MAX_ANCHORS})
@msg true or false true または false
@msg a number >= {_1} {_1} 以上の数値
@msg a number > {_1} {_1} より大きい数値
@msg a number <= {_1} {_1} 以下の数値
@msg a number < {_1} {_1} 未満の数値
@msg a number {_1} to {_2} {_1} から {_2} までの数値
@msg a number >= {_1} and < {_2} {_1} 以上 {_2} 未満の数値
@msg a number > {_1} and <= {_2} {_1} より大きく {_2} 以下の数値
@msg a number > {_1} and < {_2} {_1} より大きく {_2} 未満の数値
@msg a number ({_1}) 数値 ({_1})
@msg a number >= {_1} ({_2}) {_1} 以上の数値 ({_2})
@msg a number > {_1} ({_2}) {_1} より大きい数値 ({_2})
@msg a number <= {_1} ({_2}) {_1} 以下の数値 ({_2})
@msg a number < {_1} ({_2}) {_1} 未満の数値 ({_2})
@msg a number {_1} to {_2} ({_3}) {_1} から {_2} までの数値 ({_3})
@msg a number >= {_1} and < {_2} ({_3}) {_1} 以上 {_2} 未満の数値 ({_3})
@msg a number > {_1} and <= {_2} ({_3}) {_1} より大きく {_2} 以下の数値 ({_3})
@msg a number > {_1} and < {_2} ({_3}) {_1} より大きく {_2} 未満の数値 ({_3})
@msg an integer 整数
@msg an integer >= {_1} {_1} 以上の整数
@msg an integer <= {_1} {_1} 以下の整数
@msg an integer {_1} to {_2} {_1} から {_2} までの整数
@msg one of {_1} {_1} のいずれか
@msg `{path}` must be one of {_1}, not {got} `{path}` は {_1} のいずれかにしてください ({got} は使えません)
@msg an object id (a non-negative integer) オブジェクト ID (0 以上の整数)
@msg a list of object ids オブジェクト ID のリスト
@msg a color (a string, [r, g, b] or an object) カラー (文字列、[r, g, b] またはオブジェクト)
@msg [x, y] (two numbers) [x, y] (2 つの数値)
@msg an object オブジェクト
@msg a list リスト
@msg unknown key `{k}`; the keys here are {_1} `{k}` は不明なキーです。ここで使えるキー: {_1}
@msg {_1} is listed twice {_1} が 2 回指定されています
@msg {_1} is not the id of an input object {_1} は入力オブジェクトの ID ではありません
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -3370,6 +3370,7 @@ theme Appearance იერსახე
Enable Missing Glyph Protection გამოტოვებული გლიფებისგან დაცვის ჩართვა
Enable Rubber Band for რეზინის ზოლის ჩართვა:
Enable Touch Gestures შეხების ჟესტების ჩართვა
Switch Selection and Drawing Modes მონიშვნისა და ხატვის რეჟიმების გადართვა
Enable Touch Workspace სენსორული სამუშაო სივრცის ჩართვა
English: UK ინგლისური: ბრიტანეთი
Every (minutes) ყოველ (წუთში)
@@ -6348,6 +6349,35 @@ axis Y Axis Y ღერძი
@msg the path has no anchor points ტრაექტორიას საყრდენი წერტილები არ აქვს
@msg too many anchor points (limit {MAX_ANCHORS}) ძალიან ბევრი საყრდენი წერტილი (ლიმიტი {MAX_ANCHORS})
@msg true or false true ან false
@msg a number >= {_1} რიცხვი >= {_1}
@msg a number > {_1} რიცხვი > {_1}
@msg a number <= {_1} რიცხვი <= {_1}
@msg a number < {_1} რიცხვი < {_1}
@msg a number {_1} to {_2} რიცხვი {_1}-დან {_2}-მდე
@msg a number >= {_1} and < {_2} რიცხვი >= {_1} და < {_2}
@msg a number > {_1} and <= {_2} რიცხვი > {_1} და <= {_2}
@msg a number > {_1} and < {_2} რიცხვი > {_1} და < {_2}
@msg a number ({_1}) რიცხვი ({_1})
@msg a number >= {_1} ({_2}) რიცხვი >= {_1} ({_2})
@msg a number > {_1} ({_2}) რიცხვი > {_1} ({_2})
@msg a number <= {_1} ({_2}) რიცხვი <= {_1} ({_2})
@msg a number < {_1} ({_2}) რიცხვი < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) რიცხვი {_1}-დან {_2}-მდე ({_3})
@msg a number >= {_1} and < {_2} ({_3}) რიცხვი >= {_1} და < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) რიცხვი > {_1} და <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) რიცხვი > {_1} და < {_2} ({_3})
@msg an integer მთელი რიცხვი
@msg an integer >= {_1} მთელი რიცხვი >= {_1}
@msg an integer <= {_1} მთელი რიცხვი <= {_1}
@msg an integer {_1} to {_2} მთელი რიცხვი {_1}-დან {_2}-მდე
@msg one of {_1} ერთ-ერთი მნიშვნელობა {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` უნდა იყოს ერთ-ერთი მნიშვნელობა {_1} და არა {got}
@msg an object id (a non-negative integer) ობიექტის იდენტიფიკატორი (არაუარყოფითი მთელი რიცხვი)
@msg a list of object ids ობიექტების იდენტიფიკატორების სია
@msg a color (a string, [r, g, b] or an object) ფერი (სტრიქონი, [r, g, b] ან ობიექტი)
@msg [x, y] (two numbers) [x, y] (ორი რიცხვი)
@msg an object ობიექტი
@msg a list სია
@msg unknown key `{k}`; the keys here are {_1} უცნობი გასაღები `{k}`; აქ გასაღებებია: {_1}
@msg {_1} is listed twice {_1} ორჯერაა მითითებული
@msg {_1} is not the id of an input object {_1} შემავალი ობიექტის ID არ არის
Can't render this file because it is too large.
+30
View File
@@ -1631,6 +1631,7 @@ antiAlias Sharp 날카롭게
Enable Opacity Mask 불투명 마스크 사용
Enable Rubber Band for 러버 밴드 사용 대상
Enable Touch Gestures 터치 제스처 사용
Switch Selection and Drawing Modes 선택 모드와 그리기 모드 전환
Enable Touch Workspace 터치 작업 영역 사용
Enable copying of text, images and other content 텍스트, 이미지 및 기타 콘텐츠 복사 허용
Enable in-menu font previews 메뉴에서 글꼴 미리 보기 사용
@@ -5983,6 +5984,35 @@ axis Y Axis Y축
@msg the path has no anchor points 패스에 앵커 포인트가 없습니다
@msg too many anchor points (limit {MAX_ANCHORS}) 앵커 포인트가 너무 많습니다(한도 {MAX_ANCHORS})
@msg true or false true 또는 false
@msg a number >= {_1} {_1} 이상인 숫자
@msg a number > {_1} {_1} 초과인 숫자
@msg a number <= {_1} {_1} 이하인 숫자
@msg a number < {_1} {_1} 미만인 숫자
@msg a number {_1} to {_2} {_1} 이상 {_2} 이하인 숫자
@msg a number >= {_1} and < {_2} {_1} 이상 {_2} 미만인 숫자
@msg a number > {_1} and <= {_2} {_1} 초과 {_2} 이하인 숫자
@msg a number > {_1} and < {_2} {_1} 초과 {_2} 미만인 숫자
@msg a number ({_1}) 숫자({_1})
@msg a number >= {_1} ({_2}) {_1} 이상인 숫자({_2})
@msg a number > {_1} ({_2}) {_1} 초과인 숫자({_2})
@msg a number <= {_1} ({_2}) {_1} 이하인 숫자({_2})
@msg a number < {_1} ({_2}) {_1} 미만인 숫자({_2})
@msg a number {_1} to {_2} ({_3}) {_1} 이상 {_2} 이하인 숫자({_3})
@msg a number >= {_1} and < {_2} ({_3}) {_1} 이상 {_2} 미만인 숫자({_3})
@msg a number > {_1} and <= {_2} ({_3}) {_1} 초과 {_2} 이하인 숫자({_3})
@msg a number > {_1} and < {_2} ({_3}) {_1} 초과 {_2} 미만인 숫자({_3})
@msg an integer 정수
@msg an integer >= {_1} {_1} 이상인 정수
@msg an integer <= {_1} {_1} 이하인 정수
@msg an integer {_1} to {_2} {_1} 이상 {_2} 이하인 정수
@msg one of {_1} {_1} 중 하나
@msg `{path}` must be one of {_1}, not {got} `{path}`은(는) {_1} 중 하나여야 합니다({got} 사용 불가)
@msg an object id (a non-negative integer) 개체 ID(음수가 아닌 정수)
@msg a list of object ids 개체 ID 목록
@msg a color (a string, [r, g, b] or an object) 색상(문자열, [r, g, b] 또는 개체)
@msg [x, y] (two numbers) [x, y](숫자 두 개)
@msg an object 개체
@msg a list 목록
@msg unknown key `{k}`; the keys here are {_1} 알 수 없는 키 `{k}`: 여기서 사용할 수 있는 키: {_1}
@msg {_1} is listed twice {_1}이(가) 두 번 나열되었습니다
@msg {_1} is not the id of an input object {_1}은(는) 입력 개체의 ID가 아닙니다
Can't render this file because it contains an unexpected character in line 2 and column 73.
+2
View File
@@ -3540,6 +3540,7 @@ theme Appearance Vormgeving
Enable Missing Glyph Protection Beveiliging tegen ontbrekende glyphs inschakelen
Enable Rubber Band for Rubberband inschakelen voor
Enable Touch Gestures Touchgebaren inschakelen
Switch Selection and Drawing Modes Wisselen tussen selectie- en tekenmodus
Enable Touch Workspace Touch-werkruimte inschakelen
English: UK Engels: VK
Every (minutes) Elke (minuten)
@@ -4326,6 +4327,7 @@ imageTrace Outline Contour
@msg `{key}` must be a whole number between {min} and {max} (got {x}) `{key}` moet een geheel getal tussen {min} en {max} zijn (kreeg {x})
@msg `{key}` must be between {min} and {max} (got {x}) `{key}` moet tussen {min} en {max} liggen (kreeg {x})
@msg `{key}` must be one of {_1} `{key}` moet een van {_1} zijn
@msg `{path}` must be one of {_1}, not {got} `{path}` moet een van {_1} zijn, niet {got}
@msg `{key}` must be true or false `{key}` moet true of false zijn
@msg `{k}` must be [x, y] `{k}` moet [x, y] zijn
@msg `{name}` has no options `{name}` heeft geen opties
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -3670,6 +3670,7 @@ theme Appearance Wygląd
Enable Missing Glyph Protection Włącz ochronę przed brakującymi glifami
Enable Rubber Band for Włącz gumkę podglądu dla
Enable Touch Gestures Włącz gesty dotykowe
Switch Selection and Drawing Modes Przełącz tryby zaznaczania i rysowania
Enable Touch Workspace Włącz dotykowy obszar roboczy
English: UK Angielski: Wielka Brytania
Every (minutes) Co (minuty)
@@ -6251,6 +6252,35 @@ axis Y Axis Oś Y
@msg the path has no anchor points ścieżka nie ma punktów kontrolnych
@msg too many anchor points (limit {MAX_ANCHORS}) za dużo punktów kontrolnych (limit {MAX_ANCHORS})
@msg true or false true lub false
@msg a number >= {_1} liczbą >= {_1}
@msg a number > {_1} liczbą > {_1}
@msg a number <= {_1} liczbą <= {_1}
@msg a number < {_1} liczbą < {_1}
@msg a number {_1} to {_2} liczbą od {_1} do {_2}
@msg a number >= {_1} and < {_2} liczbą >= {_1} i < {_2}
@msg a number > {_1} and <= {_2} liczbą > {_1} i <= {_2}
@msg a number > {_1} and < {_2} liczbą > {_1} i < {_2}
@msg a number ({_1}) liczbą ({_1})
@msg a number >= {_1} ({_2}) liczbą >= {_1} ({_2})
@msg a number > {_1} ({_2}) liczbą > {_1} ({_2})
@msg a number <= {_1} ({_2}) liczbą <= {_1} ({_2})
@msg a number < {_1} ({_2}) liczbą < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) liczbą od {_1} do {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) liczbą >= {_1} i < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) liczbą > {_1} i <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) liczbą > {_1} i < {_2} ({_3})
@msg an integer liczbą całkowitą
@msg an integer >= {_1} liczbą całkowitą >= {_1}
@msg an integer <= {_1} liczbą całkowitą <= {_1}
@msg an integer {_1} to {_2} liczbą całkowitą od {_1} do {_2}
@msg one of {_1} jedną z wartości {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` musi być jedną z wartości {_1}, a nie {got}
@msg an object id (a non-negative integer) identyfikatorem obiektu (nieujemną liczbą całkowitą)
@msg a list of object ids listą identyfikatorów obiektów
@msg a color (a string, [r, g, b] or an object) kolorem (ciągiem znaków, [r, g, b] lub obiektem)
@msg [x, y] (two numbers) [x, y] (dwiema liczbami)
@msg an object obiektem
@msg a list listą
@msg unknown key `{k}`; the keys here are {_1} nieznany klucz `{k}`; klucze w tym miejscu to {_1}
@msg {_1} is listed twice {_1} występuje dwa razy
@msg {_1} is not the id of an input object {_1} nie jest identyfikatorem obiektu wejściowego
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -931,6 +931,7 @@ antiAlias Sharp Nítido
Enable Opacity Mask Habilitar Máscara de Opacidade
Enable Rubber Band for Habilitar Elástico para
Enable Touch Gestures Habilitar Gestos de Toque
Switch Selection and Drawing Modes Alternar Modos de Seleção e Desenho
Enable Touch Workspace Habilitar Espaço de Trabalho de Toque
Enable copying of text, images and other content Habilitar cópia de texto, imagens e outro conteúdo
Enable in-menu font previews Habilitar visualizações de fonte no menu
@@ -6312,6 +6313,35 @@ axis Y Axis Eixo Y
@msg the path has no anchor points o caminho não tem pontos de ancoragem
@msg too many anchor points (limit {MAX_ANCHORS}) pontos de ancoragem demais (limite {MAX_ANCHORS})
@msg true or false true ou false
@msg a number >= {_1} um número >= {_1}
@msg a number > {_1} um número > {_1}
@msg a number <= {_1} um número <= {_1}
@msg a number < {_1} um número < {_1}
@msg a number {_1} to {_2} um número de {_1} a {_2}
@msg a number >= {_1} and < {_2} um número >= {_1} e < {_2}
@msg a number > {_1} and <= {_2} um número > {_1} e <= {_2}
@msg a number > {_1} and < {_2} um número > {_1} e < {_2}
@msg a number ({_1}) um número ({_1})
@msg a number >= {_1} ({_2}) um número >= {_1} ({_2})
@msg a number > {_1} ({_2}) um número > {_1} ({_2})
@msg a number <= {_1} ({_2}) um número <= {_1} ({_2})
@msg a number < {_1} ({_2}) um número < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) um número de {_1} a {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) um número >= {_1} e < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) um número > {_1} e <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) um número > {_1} e < {_2} ({_3})
@msg an integer um inteiro
@msg an integer >= {_1} um inteiro >= {_1}
@msg an integer <= {_1} um inteiro <= {_1}
@msg an integer {_1} to {_2} um inteiro de {_1} a {_2}
@msg one of {_1} um de {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` deve ser um de {_1}, não {got}
@msg an object id (a non-negative integer) um ID de objeto (um inteiro não negativo)
@msg a list of object ids uma lista de IDs de objeto
@msg a color (a string, [r, g, b] or an object) uma cor (uma string, [r, g, b] ou um objeto)
@msg [x, y] (two numbers) [x, y] (dois números)
@msg an object um objeto
@msg a list uma lista
@msg unknown key `{k}`; the keys here are {_1} chave desconhecida `{k}`; as chaves aqui são {_1}
@msg {_1} is listed twice {_1} aparece duas vezes
@msg {_1} is not the id of an input object {_1} não é o id de um objeto de entrada
Can't render this file because it contains an unexpected character in line 6 and column 47.
+30
View File
@@ -1039,6 +1039,7 @@ font-technology Variable Вариативные
Enable Rubber Band for Включить «резиновую полосу» для
Enable text access for screen readers Разрешить доступ к тексту для программ чтения с экрана
Enable Touch Gestures Включить сенсорные жесты
Switch Selection and Drawing Modes Переключить режимы выделения и рисования
Enable Touch Workspace Включить сенсорную рабочую среду
Encoding Кодировка
Encoding: Кодировка:
@@ -6008,6 +6009,35 @@ axis Y Axis Ось Y
@msg the path has no anchor points у контура нет опорных точек
@msg too many anchor points (limit {MAX_ANCHORS}) слишком много опорных точек (предел {MAX_ANCHORS})
@msg true or false true или false
@msg a number >= {_1} число >= {_1}
@msg a number > {_1} число > {_1}
@msg a number <= {_1} число <= {_1}
@msg a number < {_1} число < {_1}
@msg a number {_1} to {_2} число от {_1} до {_2}
@msg a number >= {_1} and < {_2} число >= {_1} и < {_2}
@msg a number > {_1} and <= {_2} число > {_1} и <= {_2}
@msg a number > {_1} and < {_2} число > {_1} и < {_2}
@msg a number ({_1}) число ({_1})
@msg a number >= {_1} ({_2}) число >= {_1} ({_2})
@msg a number > {_1} ({_2}) число > {_1} ({_2})
@msg a number <= {_1} ({_2}) число <= {_1} ({_2})
@msg a number < {_1} ({_2}) число < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) число от {_1} до {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) число >= {_1} и < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) число > {_1} и <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) число > {_1} и < {_2} ({_3})
@msg an integer целое число
@msg an integer >= {_1} целое число >= {_1}
@msg an integer <= {_1} целое число <= {_1}
@msg an integer {_1} to {_2} целое число от {_1} до {_2}
@msg one of {_1} одно из значений {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` должно быть одним из значений {_1}, а не {got}
@msg an object id (a non-negative integer) идентификатор объекта (неотрицательное целое число)
@msg a list of object ids список идентификаторов объектов
@msg a color (a string, [r, g, b] or an object) цвет (строка, [r, g, b] или объект)
@msg [x, y] (two numbers) [x, y] (два числа)
@msg an object объект
@msg a list список
@msg unknown key `{k}`; the keys here are {_1} неизвестный ключ `{k}`; здесь допустимы ключи {_1}
@msg {_1} is listed twice {_1} указан дважды
@msg {_1} is not the id of an input object {_1} не является идентификатором входного объекта
Can't render this file because it is too large.
+31 -1
View File
@@ -1020,6 +1020,7 @@ font-technology Variable Variabla
Enable Rubber Band for Aktivera gummiband för
Enable text access for screen readers Ge skärmläsare åtkomst till text
Enable Touch Gestures Aktivera pekgester
Switch Selection and Drawing Modes Växla mellan markerings- och ritläge
Enable Touch Workspace Aktivera arbetslayout för pekskärm
Encoding Kodning
Encoding: Kodning:
@@ -6383,6 +6384,35 @@ axis Y Axis Y-axel
@msg the path has no anchor points banan har inga ankarpunkter
@msg too many anchor points (limit {MAX_ANCHORS}) för många ankarpunkter (gräns {MAX_ANCHORS})
@msg true or false true eller false
@msg a number >= {_1} ett tal >= {_1}
@msg a number > {_1} ett tal > {_1}
@msg a number <= {_1} ett tal <= {_1}
@msg a number < {_1} ett tal < {_1}
@msg a number {_1} to {_2} ett tal från {_1} till {_2}
@msg a number >= {_1} and < {_2} ett tal >= {_1} och < {_2}
@msg a number > {_1} and <= {_2} ett tal > {_1} och <= {_2}
@msg a number > {_1} and < {_2} ett tal > {_1} och < {_2}
@msg a number ({_1}) ett tal ({_1})
@msg a number >= {_1} ({_2}) ett tal >= {_1} ({_2})
@msg a number > {_1} ({_2}) ett tal > {_1} ({_2})
@msg a number <= {_1} ({_2}) ett tal <= {_1} ({_2})
@msg a number < {_1} ({_2}) ett tal < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) ett tal från {_1} till {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) ett tal >= {_1} och < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) ett tal > {_1} och <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) ett tal > {_1} och < {_2} ({_3})
@msg an integer ett heltal
@msg an integer >= {_1} ett heltal >= {_1}
@msg an integer <= {_1} ett heltal <= {_1}
@msg an integer {_1} to {_2} ett heltal från {_1} till {_2}
@msg one of {_1} ett av {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` måste vara ett av {_1}, inte {got}
@msg an object id (a non-negative integer) ett objekt-id (ett icke-negativt heltal)
@msg a list of object ids en lista med objekt-id:n
@msg a color (a string, [r, g, b] or an object) en färg (en sträng, [r, g, b] eller ett objekt)
@msg [x, y] (two numbers) [x, y] (två tal)
@msg an object ett objekt
@msg a list en lista
@msg unknown key `{k}`; the keys here are {_1} okänd nyckel `{k}`; nycklarna här är {_1}
@msg {_1} is listed twice {_1} finns två gånger
@msg {_1} is not the id of an input object {_1} är inte id:t för ett indataobjekt
@@ -8071,7 +8101,7 @@ digits Hindi Hindi
@msg need at least two points minst två punkter krävs
@msg needs points punkter krävs
@msg nineSlice must be true or false nineSlice måste vara true eller false
@msg nineSliceGuides must be [left, top, right, bottom], each 0..1, with left + right < 1 and top + bottom < 1 nineSliceGuides måste vara [left, top, right, bottom], vart och ett 0..1, med left + right < 1 och top + bottom < 1
@msg nineSliceGuides must be [left, top, right, bottom], each -16..16, with left + right < 1 and top + bottom < 1 nineSliceGuides måste vara [left, top, right, bottom], vart och ett -16..16, med left + right < 1 och top + bottom < 1
@msg no action set is current ingen åtgärdsuppsättning är aktuell
@msg no active data set ingen aktiv datauppsättning
@msg no appearance item {index} inget utseendeobjekt {index}
Can't render this file because it is too large.
+155 -1
View File
@@ -2058,7 +2058,7 @@ fn three_d_refusals_translate_with_their_values() {
vectorcraft_engine::EngineError::BadParams { cmd: "effect.apply".into(), msg: e }.to_string()
};
let errors = [
(refuse(vectorcraft_effects::validate_three_d_at(&group, EXTRUDE, &json!({}), Some((0, 0)))), "goes on the group itself", vec![]),
(refuse(vectorcraft_effects::validate_three_d_at(&group, EXTRUDE, &json!({}), (Some(0), 0))), "goes on the group itself", vec![]),
(
refuse(vectorcraft_effects::validate_three_d(&rect, EXTRUDE, &json!({"lights": [{"intensity": 500}]}))),
"must be a number from",
@@ -2915,6 +2915,14 @@ fn parameter_schema_errors_are_translated() {
s.execute("file.new", &json!({})).unwrap();
let errors = [
(s.execute("view.saved.new", &json!({"center": [0, 0], "zoom": -1})).unwrap_err().to_string(), "`zoom`", "must be", "-1"),
(s.execute("view.saved.new", &json!({"center": [0, 0], "zoom": -1})).unwrap_err().to_string(), "`zoom`", "a number > 0", "-1"),
(s.execute("view.saved.new", &json!({"center": 5, "zoom": 1})).unwrap_err().to_string(), "`center`", "two numbers", "5"),
(
s.execute("view.saved.new", &json!({"center": [0, 0], "zoom": 1, "rotation": "x"})).unwrap_err().to_string(),
"`rotation`",
"a number (deg)",
"\"x\"",
),
(s.execute("view.saved.new", &json!({"center": [0, 0]})).unwrap_err().to_string(), "`zoom`", "missing", ""),
(s.execute("view.saved.list", &json!(5)).unwrap_err().to_string(), "5", "must be", ""),
];
@@ -2936,6 +2944,152 @@ fn parameter_schema_errors_are_translated() {
}
}
/// The phrases a parameter schema's error uses for what a value must be, as `@msg` sources: one
/// for each type, and for a number each range and unit form.
const SCHEMA_PHRASES: &[&str] = &[
"a number",
"a number >= {_1}",
"a number > {_1}",
"a number <= {_1}",
"a number < {_1}",
"a number {_1} to {_2}",
"a number >= {_1} and < {_2}",
"a number > {_1} and <= {_2}",
"a number > {_1} and < {_2}",
"a number ({_1})",
"a number >= {_1} ({_2})",
"a number > {_1} ({_2})",
"a number <= {_1} ({_2})",
"a number < {_1} ({_2})",
"a number {_1} to {_2} ({_3})",
"a number >= {_1} and < {_2} ({_3})",
"a number > {_1} and <= {_2} ({_3})",
"a number > {_1} and < {_2} ({_3})",
"an integer",
"an integer >= {_1}",
"an integer <= {_1}",
"an integer {_1} to {_2}",
"true or false",
"a string",
"one of {_1}",
"an object id (a non-negative integer)",
"a list of object ids",
"a color (a string, [r, g, b] or an object)",
"[x, y] (two numbers)",
"an object",
"a list",
];
/// What a value of each parameter type must be is translated in every language that translates
/// every message, for every range and unit of a number: the matched row's placeholders take the
/// bounds, the unit and the names exactly as the English gives them, and the whole error keeps
/// the parameter's path and the refused value.
#[test]
fn parameter_schema_expected_phrases_are_translated() {
use serde_json::{Value, json};
use vectorcraft_apischema::{Bound, Param, ParamSchema, Problem, Type};
let number = |min, max, unit| Type::Number { min, max, unit };
let (incl, excl) = (|x| Some(Bound::Inclusive(x)), |x| Some(Bound::Exclusive(x)));
// (type, a value it refuses, the placeholder values of the phrase's row)
let cases: Vec<(Type, Value, Vec<&str>)> = vec![
(Type::NUMBER, json!("x"), vec![]),
(number(incl(-2.5), None, None), json!(-3), vec!["-2.5"]),
(number(excl(0.0), None, None), json!(0), vec!["0"]),
(number(None, incl(1.5), None), json!(2), vec!["1.5"]),
(number(None, excl(100.0), None), json!(100), vec!["100"]),
(number(incl(-1.0), incl(1.0), None), json!(2), vec!["-1", "1"]),
(number(incl(0.0), excl(360.0), None), json!(360), vec!["0", "360"]),
(number(excl(0.0), incl(1.0), None), json!(0), vec!["0", "1"]),
(number(excl(-0.5), excl(0.5), None), json!(1), vec!["-0.5", "0.5"]),
(number(None, None, Some("deg")), json!("x"), vec!["deg"]),
(number(incl(0.25), None, Some("pt")), json!(0), vec!["0.25", "pt"]),
(number(excl(0.0), None, Some("pt")), json!(0), vec!["0", "pt"]),
(number(None, incl(-1.0), Some("mm")), json!(0), vec!["-1", "mm"]),
(number(None, excl(10.0), Some("px")), json!(10), vec!["10", "px"]),
(number(incl(0.0), incl(100.0), Some("%")), json!(101), vec!["0", "100", "%"]),
(number(incl(-180.0), excl(180.0), Some("deg")), json!(180), vec!["-180", "180", "deg"]),
(number(excl(0.0), incl(1000.0), Some("pt")), json!(0), vec!["0", "1000", "pt"]),
(number(excl(-1.0), excl(1.0), Some("in")), json!(1), vec!["-1", "1", "in"]),
(Type::Integer { min: None, max: None }, json!(1.5), vec![]),
(Type::Integer { min: Some(1), max: None }, json!(0), vec!["1"]),
(Type::Integer { min: None, max: Some(-1) }, json!(0), vec!["-1"]),
(Type::Integer { min: Some(1), max: Some(25) }, json!(26), vec!["1", "25"]),
(Type::Boolean, json!(1), vec![]),
(Type::String, json!(1), vec![]),
(Type::Enum(&["left", "center", "right"]), json!("top"), vec![r#""left", "center", "right""#]),
(Type::Enum(&["only"]), json!("other"), vec![r#""only""#]),
(Type::Id, json!(-1), vec![]),
(Type::Ids, json!(5), vec![]),
(Type::Color, json!(5), vec![]),
(Type::Point, json!(5), vec![]),
(Type::Object(&[]), json!(5), vec![]),
(Type::Array(&Type::NUMBER), json!(5), vec![]),
];
let one = |name: &'static str, ty: Type| ParamSchema::new(Box::leak(Box::new([Param::new(name, ty)])), "");
let inner: &'static [Param] = Box::leak(Box::new([Param::new("zoom", number(excl(0.0), None, None))]));
let nested = one("edits", Type::Array(Box::leak(Box::new(Type::Object(inner)))));
let mut errors: Vec<_> = cases.iter().map(|(ty, bad, caps)| (one("x", *ty).validate(&json!({ "x": bad })), caps.clone())).collect();
errors.push((nested.validate(&json!({"edits": [{"zoom": 1}, {"zoom": -1}]})), vec!["0"]));
let mut seen = std::collections::BTreeSet::new();
for code in COMPLETE_MESSAGES {
let lang = Lang::from_code(code).expect("registered");
let (entries, _) = parse_entries(lang.0.source);
for phrase in SCHEMA_PHRASES {
assert!(entries.iter().any(|(ctx, src, _)| ctx == "@msg" && src == phrase), "{code}: no row for {phrase:?}");
}
for (result, caps) in &errors {
let Err(e) = result else { panic!("accepted: {result:?}") };
let Problem::WrongType { expected, got } = &e.problem else { panic!("{e}") };
seen.insert(expected.clone());
let (_, matched) = lang.catalog().message(expected).unwrap_or_else(|| panic!("{code}: no row matches {expected:?}"));
let values: Vec<&str> = matched.iter().map(|(_, v)| *v).collect();
assert_eq!(&values, caps, "{code}: {expected:?}");
let phrase = message(lang, expected);
assert_ne!(&phrase, expected, "{code}");
let mut from = 0;
for value in caps {
let at = phrase[from..].find(value).unwrap_or_else(|| panic!("{code}: {value:?} in {expected:?} -> {phrase:?}"));
from += at + value.len();
}
let shown = message(lang, &e.to_string());
let path = format!("`{}`", e.path);
let kept = caps.iter().all(|value| shown.contains(value));
assert!(kept && shown.contains(&path) && shown.contains(got.as_str()), "{code}: {shown}");
assert!(!holds_word(&shown, expected) && !shown.contains("must be") && !shown.contains(", not "), "{code}: {shown}");
}
}
// A catalog's `{key}` must be one of {_1}` row would take `"a", "b", not "c"` as its list.
let enum_error = one("x", Type::Enum(&["a", "b"])).validate(&json!({"x": "c"})).map_or_else(|e| e.to_string(), |_| String::new());
assert_eq!(enum_error, r#"`x` must be one of "a", "b", not "c""#);
for lang in Lang::all().filter(|l| l.code() != Lang::EN.code() && !l.0.source.is_empty()) {
let shown = message(lang, &enum_error);
assert!(!shown.contains(", not ") && shown.contains(r#""a", "b""#) && shown.contains(r#""c""#), "{}: {shown}", lang.code());
}
for phrase in
["a number > -0.5 and < 0.5", "a number 0 to 100 (%)", "an integer 1 to 25", r#"one of "left", "center", "right""#, "[x, y] (two numbers)"]
{
assert!(seen.contains(phrase), "{phrase:?} not in {seen:?}");
}
}
/// A JSON object or array inside a translated message stays as it is, and an exact message that
/// starts with a bracket is still translated.
#[test]
fn bracketed_message_parts_translate_only_as_exact_messages() {
for code in COMPLETE_MESSAGES {
let lang = Lang::from_code(code).expect("registered");
let point = message(lang, "[x, y] (two numbers)");
assert_ne!(point, "[x, y] (two numbers)", "{code}");
assert!(point.contains("[x, y]"), "{code}: {point}");
for got in ["[1]", "[1, 2, 3]", r#"{"objects": [1]}"#, r#"[{"a": 1}, "b: c", …"#] {
let shown = message(lang, &format!("`center` must be [x, y] (two numbers), not {got}"));
assert!(shown.contains(&point) && shown.contains(got), "{code}: {shown}");
let shown = message(lang, &format!("`p` must be an object, not {got}"));
assert!(shown.contains(got) && !shown.contains("an object"), "{code}: {shown}");
}
}
}
/// The warning for a PDF/X file that leaves out the document's bleed is translated in every catalog,
/// alone and in the status bar's note.
#[test]
+30
View File
@@ -1012,6 +1012,7 @@ font-technology Variable Değişken
Enable Rubber Band for Lastik Bandı Etkinleştir
Enable text access for screen readers Ekran okuyucular için metin erişimini etkinleştirin
Enable Touch Gestures Dokunma Hareketlerini Etkinleştir
Switch Selection and Drawing Modes Seçim ve Çizim Modları Arasında Geçiş Yap
Enable Touch Workspace Dokunmatik Çalışma Alanını Etkinleştir
Encoding Kodlama
Encoding: Kodlama:
@@ -6353,6 +6354,35 @@ axis Y Axis Y ekseni
@msg the path has no anchor points yolun bağlantı noktası yok
@msg too many anchor points (limit {MAX_ANCHORS}) çok fazla bağlantı noktası (sınır {MAX_ANCHORS})
@msg true or false true veya false
@msg a number >= {_1} bir sayı >= {_1}
@msg a number > {_1} bir sayı > {_1}
@msg a number <= {_1} bir sayı <= {_1}
@msg a number < {_1} bir sayı < {_1}
@msg a number {_1} to {_2} {_1} ile {_2} arasında bir sayı
@msg a number >= {_1} and < {_2} bir sayı >= {_1} ve < {_2}
@msg a number > {_1} and <= {_2} bir sayı > {_1} ve <= {_2}
@msg a number > {_1} and < {_2} bir sayı > {_1} ve < {_2}
@msg a number ({_1}) bir sayı ({_1})
@msg a number >= {_1} ({_2}) bir sayı >= {_1} ({_2})
@msg a number > {_1} ({_2}) bir sayı > {_1} ({_2})
@msg a number <= {_1} ({_2}) bir sayı <= {_1} ({_2})
@msg a number < {_1} ({_2}) bir sayı < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) {_1} ile {_2} arasında bir sayı ({_3})
@msg a number >= {_1} and < {_2} ({_3}) bir sayı >= {_1} ve < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) bir sayı > {_1} ve <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) bir sayı > {_1} ve < {_2} ({_3})
@msg an integer bir tam sayı
@msg an integer >= {_1} bir tam sayı >= {_1}
@msg an integer <= {_1} bir tam sayı <= {_1}
@msg an integer {_1} to {_2} {_1} ile {_2} arasında bir tam sayı
@msg one of {_1} {_1} değerlerinden biri
@msg `{path}` must be one of {_1}, not {got} `{path}` {_1} değerlerinden biri olmalıdır, {got} değil
@msg an object id (a non-negative integer) bir nesne kimliği (negatif olmayan bir tam sayı)
@msg a list of object ids bir nesne kimlikleri listesi
@msg a color (a string, [r, g, b] or an object) bir renk (bir dize, [r, g, b] veya bir nesne)
@msg [x, y] (two numbers) [x, y] (iki sayı)
@msg an object bir nesne
@msg a list bir liste
@msg unknown key `{k}`; the keys here are {_1} bilinmeyen anahtar `{k}`; buradaki anahtarlar: {_1}
@msg {_1} is listed twice {_1} iki kez listelenmiş
@msg {_1} is not the id of an input object {_1} bir girdi nesnesinin kimliği değil
Can't render this file because it contains an unexpected character in line 5 and column 25.
+30
View File
@@ -1044,6 +1044,7 @@ font-technology Variable Варіативні
Enable Rubber Band for Включити «гумову смугу» для
Enable text access for screen readers Дозволити доступ до тексту для програм читання з екрану
Enable Touch Gestures Увімкнути сенсорні жести
Switch Selection and Drawing Modes Перемкнути режими виділення та малювання
Enable Touch Workspace Включити сенсорне робоче середовище
Encoding Кодування
Encoding: Кодування:
@@ -6002,6 +6003,35 @@ axis Y Axis Вісь Y
@msg the path has no anchor points контур не має опорних точок
@msg too many anchor points (limit {MAX_ANCHORS}) забагато опорних точок (межа {MAX_ANCHORS})
@msg true or false true або false
@msg a number >= {_1} число >= {_1}
@msg a number > {_1} число > {_1}
@msg a number <= {_1} число <= {_1}
@msg a number < {_1} число < {_1}
@msg a number {_1} to {_2} число від {_1} до {_2}
@msg a number >= {_1} and < {_2} число >= {_1} і < {_2}
@msg a number > {_1} and <= {_2} число > {_1} і <= {_2}
@msg a number > {_1} and < {_2} число > {_1} і < {_2}
@msg a number ({_1}) число ({_1})
@msg a number >= {_1} ({_2}) число >= {_1} ({_2})
@msg a number > {_1} ({_2}) число > {_1} ({_2})
@msg a number <= {_1} ({_2}) число <= {_1} ({_2})
@msg a number < {_1} ({_2}) число < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) число від {_1} до {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) число >= {_1} і < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) число > {_1} і <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) число > {_1} і < {_2} ({_3})
@msg an integer ціле число
@msg an integer >= {_1} ціле число >= {_1}
@msg an integer <= {_1} ціле число <= {_1}
@msg an integer {_1} to {_2} ціле число від {_1} до {_2}
@msg one of {_1} одне зі значень {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` має бути одним зі значень {_1}, а не {got}
@msg an object id (a non-negative integer) ідентифікатор об’єкта (невід’ємне ціле число)
@msg a list of object ids список ідентифікаторів об’єктів
@msg a color (a string, [r, g, b] or an object) колір (рядок, [r, g, b] або об’єкт)
@msg [x, y] (two numbers) [x, y] (два числа)
@msg an object об’єкт
@msg a list список
@msg unknown key `{k}`; the keys here are {_1} невідомий ключ `{k}`; тут допустимі ключі {_1}
@msg {_1} is listed twice {_1} вказано двічі
@msg {_1} is not the id of an input object {_1} не є ідентифікатором вхідного об’єкта
Can't render this file because it is too large.
+30
View File
@@ -1207,6 +1207,7 @@ font-technology Variable Biến thiên
Enable Rubber Band for Bật vùng chọn kéo cho
Enable text access for screen readers Bật truy cập văn bản cho trình đọc màn hình
Enable Touch Gestures Bật cử chỉ cảm ứng
Switch Selection and Drawing Modes Chuyển giữa chế độ chọn và vẽ
Enable Touch Workspace Bật không gian làm việc cảm ứng
Encoding Mã hóa
Encoding: Mã hóa:
@@ -6003,6 +6004,35 @@ axis Y Axis Trục Y
@msg the path has no anchor points đường dẫn không có điểm neo
@msg too many anchor points (limit {MAX_ANCHORS}) quá nhiều điểm neo (giới hạn {MAX_ANCHORS})
@msg true or false true hoặc false
@msg a number >= {_1} một số >= {_1}
@msg a number > {_1} một số > {_1}
@msg a number <= {_1} một số <= {_1}
@msg a number < {_1} một số < {_1}
@msg a number {_1} to {_2} một số từ {_1} đến {_2}
@msg a number >= {_1} and < {_2} một số >= {_1} và < {_2}
@msg a number > {_1} and <= {_2} một số > {_1} và <= {_2}
@msg a number > {_1} and < {_2} một số > {_1} và < {_2}
@msg a number ({_1}) một số ({_1})
@msg a number >= {_1} ({_2}) một số >= {_1} ({_2})
@msg a number > {_1} ({_2}) một số > {_1} ({_2})
@msg a number <= {_1} ({_2}) một số <= {_1} ({_2})
@msg a number < {_1} ({_2}) một số < {_1} ({_2})
@msg a number {_1} to {_2} ({_3}) một số từ {_1} đến {_2} ({_3})
@msg a number >= {_1} and < {_2} ({_3}) một số >= {_1} và < {_2} ({_3})
@msg a number > {_1} and <= {_2} ({_3}) một số > {_1} và <= {_2} ({_3})
@msg a number > {_1} and < {_2} ({_3}) một số > {_1} và < {_2} ({_3})
@msg an integer một số nguyên
@msg an integer >= {_1} một số nguyên >= {_1}
@msg an integer <= {_1} một số nguyên <= {_1}
@msg an integer {_1} to {_2} một số nguyên từ {_1} đến {_2}
@msg one of {_1} một trong các giá trị {_1}
@msg `{path}` must be one of {_1}, not {got} `{path}` phải là một trong các giá trị {_1}, không phải {got}
@msg an object id (a non-negative integer) một ID đối tượng (một số nguyên không âm)
@msg a list of object ids một danh sách ID đối tượng
@msg a color (a string, [r, g, b] or an object) một màu (một chuỗi, [r, g, b] hoặc một đối tượng)
@msg [x, y] (two numbers) [x, y] (hai số)
@msg an object một đối tượng
@msg a list một danh sách
@msg unknown key `{k}`; the keys here are {_1} khóa không xác định `{k}`; các khóa ở đây là {_1}
@msg {_1} is listed twice {_1} được liệt kê hai lần
@msg {_1} is not the id of an input object {_1} không phải là id của một đối tượng đầu vào
Can't render this file because it contains an unexpected character in line 204 and column 5.
+30
View File
@@ -982,6 +982,7 @@ antiAlias Sharp 锐利
Enable Rubber Band for 为这些工具启用橡皮筋预览
Enable text access for screen readers 启用屏幕阅读器的文字访问
Enable Touch Gestures 启用触控手势
Switch Selection and Drawing Modes 切换选择与绘图模式
Enable Touch Workspace 启用触控工作区
Encoding 编码
Encoding: 编码:
@@ -6235,6 +6236,35 @@ axis Y Axis Y 轴
@msg the path has no anchor points 路径没有锚点
@msg too many anchor points (limit {MAX_ANCHORS}) 锚点过多(上限 {MAX_ANCHORS})
@msg true or false true 或 false
@msg a number >= {_1} 大于或等于 {_1} 的数字
@msg a number > {_1} 大于 {_1} 的数字
@msg a number <= {_1} 小于或等于 {_1} 的数字
@msg a number < {_1} 小于 {_1} 的数字
@msg a number {_1} to {_2} {_1} 到 {_2} 之间的数字
@msg a number >= {_1} and < {_2} 大于或等于 {_1} 且小于 {_2} 的数字
@msg a number > {_1} and <= {_2} 大于 {_1} 且小于或等于 {_2} 的数字
@msg a number > {_1} and < {_2} 大于 {_1} 且小于 {_2} 的数字
@msg a number ({_1}) 数字({_1})
@msg a number >= {_1} ({_2}) 大于或等于 {_1} 的数字({_2})
@msg a number > {_1} ({_2}) 大于 {_1} 的数字({_2})
@msg a number <= {_1} ({_2}) 小于或等于 {_1} 的数字({_2})
@msg a number < {_1} ({_2}) 小于 {_1} 的数字({_2})
@msg a number {_1} to {_2} ({_3}) {_1} 到 {_2} 之间的数字({_3})
@msg a number >= {_1} and < {_2} ({_3}) 大于或等于 {_1} 且小于 {_2} 的数字({_3})
@msg a number > {_1} and <= {_2} ({_3}) 大于 {_1} 且小于或等于 {_2} 的数字({_3})
@msg a number > {_1} and < {_2} ({_3}) 大于 {_1} 且小于 {_2} 的数字({_3})
@msg an integer 整数
@msg an integer >= {_1} 大于或等于 {_1} 的整数
@msg an integer <= {_1} 小于或等于 {_1} 的整数
@msg an integer {_1} to {_2} {_1} 到 {_2} 之间的整数
@msg one of {_1} {_1} 之一
@msg `{path}` must be one of {_1}, not {got} `{path}` 必须是 {_1} 之一,而不是 {got}
@msg an object id (a non-negative integer) 对象 ID(非负整数)
@msg a list of object ids 对象 ID 列表
@msg a color (a string, [r, g, b] or an object) 颜色(字符串、[r, g, b] 或对象)
@msg [x, y] (two numbers) [x, y](两个数字)
@msg an object 对象
@msg a list 列表
@msg unknown key `{k}`; the keys here are {_1} 未知键 `{k}`;此处可用的键:{_1}
@msg {_1} is listed twice {_1} 列出了两次
@msg {_1} is not the id of an input object {_1} 不是输入对象的 ID
Can't render this file because it contains an unexpected character in line 2 and column 73.
+30
View File
@@ -1012,6 +1012,7 @@ font-technology Variable 可變
Enable Rubber Band for 啟用橡皮筋預覽,適用於
Enable text access for screen readers 啟用螢幕閱讀器的文字存取
Enable Touch Gestures 啟用觸控手勢
Switch Selection and Drawing Modes 切換選取與繪圖模式
Enable Touch Workspace 啟用觸控工作區
Encoding 編碼
Encoding: 編碼:
@@ -6040,6 +6041,35 @@ axis Y Axis Y 軸
@msg the path has no anchor points 路徑沒有錨點
@msg too many anchor points (limit {MAX_ANCHORS}) 錨點過多(上限 {MAX_ANCHORS})
@msg true or false true 或 false
@msg a number >= {_1} 大於或等於 {_1} 的數字
@msg a number > {_1} 大於 {_1} 的數字
@msg a number <= {_1} 小於或等於 {_1} 的數字
@msg a number < {_1} 小於 {_1} 的數字
@msg a number {_1} to {_2} 介於 {_1} 到 {_2} 之間的數字
@msg a number >= {_1} and < {_2} 大於或等於 {_1} 且小於 {_2} 的數字
@msg a number > {_1} and <= {_2} 大於 {_1} 且小於或等於 {_2} 的數字
@msg a number > {_1} and < {_2} 大於 {_1} 且小於 {_2} 的數字
@msg a number ({_1}) 數字({_1})
@msg a number >= {_1} ({_2}) 大於或等於 {_1} 的數字({_2})
@msg a number > {_1} ({_2}) 大於 {_1} 的數字({_2})
@msg a number <= {_1} ({_2}) 小於或等於 {_1} 的數字({_2})
@msg a number < {_1} ({_2}) 小於 {_1} 的數字({_2})
@msg a number {_1} to {_2} ({_3}) 介於 {_1} 到 {_2} 之間的數字({_3})
@msg a number >= {_1} and < {_2} ({_3}) 大於或等於 {_1} 且小於 {_2} 的數字({_3})
@msg a number > {_1} and <= {_2} ({_3}) 大於 {_1} 且小於或等於 {_2} 的數字({_3})
@msg a number > {_1} and < {_2} ({_3}) 大於 {_1} 且小於 {_2} 的數字({_3})
@msg an integer 整數
@msg an integer >= {_1} 大於或等於 {_1} 的整數
@msg an integer <= {_1} 小於或等於 {_1} 的整數
@msg an integer {_1} to {_2} 介於 {_1} 到 {_2} 之間的整數
@msg one of {_1} {_1} 其中之一
@msg `{path}` must be one of {_1}, not {got} `{path}` 必須是 {_1} 其中之一,而不是 {got}
@msg an object id (a non-negative integer) 物件 ID(非負整數)
@msg a list of object ids 物件 ID 清單
@msg a color (a string, [r, g, b] or an object) 顏色(字串、[r, g, b] 或物件)
@msg [x, y] (two numbers) [x, y](兩個數字)
@msg an object 物件
@msg a list 清單
@msg unknown key `{k}`; the keys here are {_1} 未知的鍵 `{k}`;此處可用的鍵:{_1}
@msg {_1} is listed twice {_1} 列出了兩次
@msg {_1} is not the id of an input object {_1} 不是輸入物件的 ID
Can't render this file because it contains an unexpected character in line 6 and column 47.
+1
View File
@@ -684,6 +684,7 @@ fn run_ui_part6(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option<Result<
Some(t) => Err(format!("unknown tool `{t}`")),
None => Err("missing `tool`".into()),
},
crate::touch::TOGGLE_MODE => Ok(crate::touch::toggle_mode(app)),
crate::addons::pathtools::corner::COMMAND => crate::addons::pathtools::corner::open(app),
crate::addons::pathtools::shared_edge::COMMAND => crate::addons::pathtools::shared_edge::open(app),
crate::addons::arrange::ZOOM => crate::addons::arrange::zoom(app),
+6
View File
@@ -732,6 +732,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
"",
"{key, value} | {values: {key: value…}}, tool?: id (default: the active tool) → the tool's options (`{}` reads them). The options a tool keeps (Liquify brush and tool options, Mirror & Cut, Puppet Warp, drawing tools…) last across tool switches and are saved with the preferences; another tool's are stored for when it is chosen",
),
(
crate::touch::TOGGLE_MODE,
"Switch Selection and Drawing Modes",
"",
"{} from the Selection, Direct Selection, Group Selection, Magic Wand, Lasso or Perspective Selection tool, choose the drawing tool chosen last in this window (none yet: the Pencil tool); from any other tool, choose the Selection tool, remembering the tool left as the drawing tool unless it is the Hand, Rotate View, Zoom or Print Tiling tool → {tool}. A two-finger tap on the canvas runs it in the Touch workspace (Enable Touch Gestures on)",
),
(
"effect.dialog",
"Effect…",
+17
View File
@@ -837,6 +837,23 @@ mod tests {
app.run("ui.symbolOptions", json!({"edit": true, "name": "Mark"})).unwrap();
assert!(app.ui.dialog.as_ref().unwrap().bool("nineSlice"));
assert_eq!(app.ui.dialog.as_ref().unwrap().f64("sliceLeft", 0.0), 20.0);
app.ui.dialog = None;
// Guides outside the art, and ones that are not whole percents, open as they are and come
// back unchanged from OK; a field changed to a value past 100 % puts that guide outside.
let guides = [-0.123456789, 1.5, 0.013, -2.75];
app.run("symbol.options", json!({"name": "Mark", "nineSliceGuides": guides})).unwrap();
app.run("ui.symbolOptions", json!({"edit": true, "name": "Mark"})).unwrap();
let dialog = app.ui.dialog.as_ref().unwrap();
for (key, want) in [("sliceLeft", -12.3456789), ("sliceTop", 150.0), ("sliceRight", 1.3), ("sliceBottom", -275.0)] {
assert!((dialog.f64(key, 0.0) - want).abs() < 1e-9, "{key}: {}", dialog.f64(key, 0.0));
}
crate::dialogs::confirm(&mut app).unwrap();
assert_eq!(app.run("symbol.list", json!({})).unwrap()["symbols"][1]["nineSlice"], json!(guides));
app.run("ui.symbolOptions", json!({"edit": true, "name": "Mark"})).unwrap();
app.ui.dialog.as_mut().unwrap().fields.insert("sliceRight".into(), json!(-125.5));
crate::dialogs::confirm(&mut app).unwrap();
let nine = app.run("symbol.list", json!({})).unwrap()["symbols"][1]["nineSlice"].clone();
assert_eq!(nine, json!([-0.123456789, 1.5, -1.255, -2.75]));
}
/// F8 is Symbol Options… (`ui.symbolOptions`) by default, on every platform. Shift+F8 and Cmd+F8
+5
View File
@@ -565,6 +565,10 @@ pub struct UiState {
pub flyout: Option<usize>,
/// Last tool shown for each toolbar group (flyout selection sticks).
pub group_tool: Vec<String>,
/// The drawing tool last chosen in this window, which a two-finger tap in the Touch workspace
/// returns to from the Selection tool ([`crate::touch::toggle_mode`]). Not saved.
#[serde(skip)]
pub touch_drawing_tool: Option<String>,
pub status: String,
/// The Replace Font request behind the status bar's warning ([`ReplaceFontWarning`]). Not saved.
#[serde(skip)]
@@ -1129,6 +1133,7 @@ impl Default for UiState {
answering_control: false,
flyout: None,
group_tool: vectorcraft_tools::TOOL_GROUPS.iter().map(|g| g[0].id.to_string()).collect(),
touch_drawing_tool: None,
status: String::new(),
replace_font_warning: None,
status_notes: None,
+55 -4
View File
@@ -1,5 +1,6 @@
//! Touch gestures on the canvas (Preferences › Devices › Enable Touch Gestures, #585): a tap with
//! two fingers undoes, one with three redoes.
//! two fingers undoes, one with three redoes. In the Touch workspace a tap with two fingers
//! switches between selection and drawing modes instead ([`TOGGLE_MODE`]).
//!
//! egui hands every finger's contact over as [`egui::Event::Touch`] (winit reads them from the
//! system: `WM_POINTER` on Windows), and makes the first finger the mouse pointer too. So the first
@@ -121,15 +122,52 @@ impl Taps {
}
}
/// The command a tap of `fingers` runs: two undo, three redo.
pub(crate) fn tap_command(fingers: usize) -> Option<&'static str> {
/// The command a tap of `fingers` runs: two undo, three redo. In the Touch workspace (`touch_workspace`)
/// two switch between the Selection tool and the last drawing tool ([`TOGGLE_MODE`]).
pub(crate) fn tap_command(fingers: usize, touch_workspace: bool) -> Option<&'static str> {
match fingers {
2 if touch_workspace => Some(TOGGLE_MODE),
2 => Some("edit.undo"),
3 => Some("edit.redo"),
_ => None,
}
}
/// Switch between selection and drawing modes: the Selection tool, and back to the drawing tool
/// chosen last.
pub const TOGGLE_MODE: &str = "tool.toggleTouchMode";
/// The drawing tool a switch out of selection mode chooses when none has been chosen in this window.
pub const FIRST_DRAWING_TOOL: &str = "pencil";
/// A tool of selection mode: one that selects objects or parts of them.
fn selects(id: &str) -> bool {
vectorcraft_tools::catalog::is_selection_tool(id) || matches!(id, "magicWand" | "lasso" | "perspectiveSelection")
}
/// A tool of drawing mode: any tool but those of selection mode and those that only move, turn or
/// zoom the view.
pub(crate) fn is_drawing_tool(id: &str) -> bool {
!selects(id) && !matches!(id, "hand" | "rotateView" | "zoom" | "printTiling")
}
/// [`TOGGLE_MODE`]: from a tool of selection mode, choose the drawing tool chosen last (none yet:
/// [`FIRST_DRAWING_TOOL`]); from any other tool, keep it as the drawing tool and choose the
/// Selection tool. → `{tool}`, the tool now active.
pub(crate) fn toggle_mode(app: &mut crate::VectorcraftApp) -> serde_json::Value {
let now = app.session.tool_id().to_string();
let next = if selects(&now) {
app.ui.touch_drawing_tool.clone().unwrap_or_else(|| FIRST_DRAWING_TOOL.to_string())
} else {
if is_drawing_tool(&now) {
app.ui.touch_drawing_tool = Some(now);
}
"selection".to_string()
};
app.select_tool(&next);
serde_json::json!({"tool": app.session.tool_id()})
}
#[cfg(test)]
mod tests {
use super::*;
@@ -155,7 +193,20 @@ mod tests {
}
let ends: Vec<_> = [4, 5, 6].into_iter().map(|n| t.feed(id(n), TouchPhase::End, p, 1.2)).collect();
assert_eq!(ends, [None, None, Some(Touch::Tap(3))]);
assert_eq!((tap_command(2), tap_command(3), tap_command(1)), (Some("edit.undo"), Some("edit.redo"), None));
assert_eq!((tap_command(2, false), tap_command(3, false), tap_command(1, false)), (Some("edit.undo"), Some("edit.redo"), None));
assert_eq!((tap_command(2, true), tap_command(3, true), tap_command(1, true)), (Some(TOGGLE_MODE), Some("edit.redo"), None));
}
#[test]
fn drawing_tools_are_neither_selection_nor_view_tools() {
for id in ["pencil", "pen", "rectangle", "paintbrush", "type", "eraser", "shapeBuilder"] {
assert!(is_drawing_tool(id), "{id}");
}
let selecting = ["selection", "directSelection", "groupSelection", "magicWand", "lasso", "perspectiveSelection"];
for id in selecting.into_iter().chain(["hand", "rotateView", "zoom", "printTiling"]) {
assert!(!is_drawing_tool(id), "{id}");
}
assert!(vectorcraft_tools::tool_info(FIRST_DRAWING_TOOL).is_some_and(|t| is_drawing_tool(t.id)));
}
#[test]
+3 -2
View File
@@ -1,6 +1,6 @@
# File format parity
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-12 · **Change:** minor (`.ai` and EPS import: type from the text document, type a PostScript program sets and legacy `.ai` type are set in an installed face of their font's PostScript name, exact name first, in the version a text document's record keeps; the `.ai` save writes a static font's version when its name alone gives another copy, #6983; `.ai` and EPS import: type keeps the manual kerning of its text document, #6899; `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, its strokes' miter tips and strokes a Transform effect moves included, after its glyphs grown by half its strokes' weight, #6824; `.ai` and EPS import: type filled or stroked with a pattern swatch keeps its pattern, from the art style its text document paint names, #6856; #6865: explicitly requested oversized editing artboard; PDF import: Indic type keeps its marks on their line, and a line whose type would not draw as the file does keeps the file's glyphs as outlines, #5235; previously: newly imported SVG/SVGZ titles are filtered and bounded without changing restored titles, #3626; `.ai` and EPS import, and what every export and `.ai` save draw: type's strokes in an envelope paint at their own weight along its bent outlines, Distort Appearance on or off, #6644; `.ai` and EPS import: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as the file's page aligns them, #6610; `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art, #6570; `.ai` save and open: layer colour presets Yellow, Magenta and Cyan keep their colour, as the `Lb` colour index now follows the file's numbering, #6502; `.ai` save: stroked type keeps its stroke's cap, join and miter limit in the text document, #6472; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (30.x)
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-13 · **Change:** minor (PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: `.ai` and EPS import: type from the text document, type a PostScript program sets and legacy `.ai` type are set in an installed face of their font's PostScript name, exact name first, in the version a text document's record keeps; the `.ai` save writes a static font's version when its name alone gives another copy, #6983; `.ai` and EPS import: type keeps the manual kerning of its text document, #6899; `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, its strokes' miter tips and strokes a Transform effect moves included, after its glyphs grown by half its strokes' weight, #6824; `.ai` and EPS import: type filled or stroked with a pattern swatch keeps its pattern, from the art style its text document paint names, #6856; #6865: explicitly requested oversized editing artboard; PDF import: Indic type keeps its marks on their line, and a line whose type would not draw as the file does keeps the file's glyphs as outlines, #5235; previously: newly imported SVG/SVGZ titles are filtered and bounded without changing restored titles, #3626; `.ai` and EPS import, and what every export and `.ai` save draw: type's strokes in an envelope paint at their own weight along its bent outlines, Distort Appearance on or off, #6644; `.ai` and EPS import: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as the file's page aligns them, #6610; `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art, #6570; `.ai` save and open: layer colour presets Yellow, Magenta and Cyan keep their colour, as the `Lb` colour index now follows the file's numbering, #6502; `.ai` save: stroked type keeps its stroke's cap, join and miter limit in the text document, #6472; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-keyed fonts in FontSets (CFF) draw their glyphs; EPS import: `kshow` procedures kern live type; EPS import: embedded Type 1 fonts' glyphs and widths; EPS import: CID-keyed fonts draw their glyphs; EPS import: Type 42 fonts' characters and widths from the font they carry, show operators' spacing kept as tracking; EPS import: an image decoder's own buffers stop counting against the memory budget once it is decoded; EPS import: sampled functions interpolate between their samples; `.ai` and EPS type from the text document keeps its tab stops; it keeps auto leading and hyphenation options, and may show more of the file's last lines in an area frame; `.ai` and EPS import: Art brushes in the older form of their objects come into the Brushes panel; EPS import: gradients drawn as abutting strips come in as one gradient, without seams; EPS import: composite fonts draw their Type 42 glyphs; SVG import: filter and mask regions clip, #5876, #5875; SVG import: Gaussian blurs keep `color-interpolation-filters`, #5877; PDF and `.ai` export: objects' URLs as links, #5785; SVG import: `color-interpolation="linearRGB"` gradients, #5878; `.ai` import: paths with a Calligraphic brush open brushed, #372) · **Target:** Adobe Illustrator 2026 (Line truncated
>
> Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865).
@@ -309,7 +309,7 @@ Stop opacity on translated artboards remains outside this regression coverage.
## PDF editable imports
- [x] Explicit `/ActualText` replaces covered glyph text once, including empty strings and nested spans (outer owner wins), while later glyphs retain pen geometry. Synthetic regressions in `crates/pdf/src/tests/actual_text.rs`; no added fonts/assets. UTF-16BE, BOM UTF-8 and PDFDocEncoding reuse the reader's text-string decoder.
- [x] Explicit `/ActualText` replaces covered glyph text once, including empty strings and nested spans (outer owner wins), while later glyphs retain pen geometry. Glyphs inside a span whose ActualText is empty add no text but still draw: they come in as outlines in their fill and stroke (#6971, `empty_actual_text_keeps_the_glyphs_art`). Synthetic regressions in `crates/pdf/src/tests/actual_text.rs`; no added fonts/assets. UTF-16BE, BOM UTF-8 and PDFDocEncoding reuse the reader's text-string decoder.
- [x] Authored ordering is protected per stretch; ordinary stretches still reconstruct visual-order text. Outlines mode is unchanged.
- [ ] Exact redistribution of one replacement over several lines/styles, and general mixed-direction paragraph layout. Replacement uses the first placed glyph's line/style. Tags deeper than 128 and replacements over 64 KiB encoded (at most 192 KiB decoded) fall back to glyph mappings with a warning; an outer accepted owner survives deeper tags.
@@ -323,6 +323,7 @@ Stop opacity on translated artboards remains outside this regression coverage.
| Date | Change | Summary |
|---|---|---|
| 2026-11-13 | minor | PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke instead of being left out, adding no text (#6971; `empty_actual_text_keeps_the_glyphs_art` in `crates/pdf/src/tests/actual_text.rs`). Scores and estimates unchanged. |
| 2026-11-12 | minor | `.ai` and EPS import (#6983): type from the text document is set in an installed face of the PostScript name its font record gives, one of exactly that name first. That face's family is no longer swapped for another family spelled alike but for case and punctuation (`FontDb::find_family`, which picked `SAMPLE INK` for `SampleInk`, the PostScript name of `Sample/Ink`); among the faces `FontDb::postscript_faces` lists for the name, the import takes one whose name matches in case and punctuation before one that matches only without them; and when the family and style alone resolve to another installed copy, the type names the face's version. A font record's key 5, the version string (name ID 5), picks that version among the faces of its PostScript name, also when the record spells the name with other punctuation (`Sample-Slab` for faces named `SampleSlab`); each record is resolved once. Type a PostScript program sets and legacy `.ai` type take the face of their font's name the same way. The `.ai` save writes a static font's version (`/5`) when its PostScript name alone would give the reader another installed copy (another version, or the same name in another family), so two such copies are two fonts of the set, and checks that the type comes back in the same family, style and face, taking the record's version as the reader does (up to 256 bytes): such type round-trips without the type attributes note, and so does a version that isn't installed, which draws in the face the font resolves to anyway. In 224 users' files (used locally, never committed; all PDF-compatible, so the PostScript and legacy paths are not exercised), 16 files set some type in another installed face; 12 render differently against their own page, 10 closer (in one from 2.55% to 0.01% of the page differing) and 2 further by 0.03% of the page (an envelope of type that now opens live, and a copy of the same widths in the version the record names); envelopes of type that open live go from 154 to 159, none fewer in any file; no file opens in another way. The notes of how far a file's layers differ from its page shrink in 2 files and appear in 2 where an envelope of type now opens live, so the file is compared with its page. Two installed copies of one PostScript name, family and style that differ in widths, in files whose records keep no version, still take the copy the family and style resolve to: only the page's widths tell them apart. Tests: `tests_native::type_from_the_text_document_takes_the_face_of_its_exact_postscript_name`, `tests_native::type_from_the_text_document_takes_the_version_its_font_record_keeps`, `tests_fontnames::shown_type_takes_the_face_of_its_exact_postscript_name`, `ai::tests::legacy_type_takes_the_face_of_its_exact_postscript_name`, `ai_editing::tests::type_in_a_font_beside_a_family_spelled_alike_keeps_its_font`, `ai_editing::tests::type_in_another_version_of_a_static_font_keeps_it`, `ai_editing::tests::type_in_a_copy_its_postscript_name_alone_doesnt_give_keeps_it`, `ai_editing::tests::a_version_longer_than_the_reader_takes_is_reported`, `vectorcraft-text` `tests::versions::every_face_of_a_postscript_name_is_found`. Scores unchanged. |
| 2026-11-12 | minor | `.ai` and EPS import: type from the text document keeps its manual kerning (#6899). Key 8 of a story's text holds it as runs of characters (key 1), each with a value (key 0 of key 0, in thousandths of an em) or empty where the automatic kerning applies; a character with a value takes it as its Kerning, the space between it and the next character ([Line and character spacing](https://helpx.adobe.com/illustrator/using/line-character-spacing.html)), of the em as its Horizontal Scale draws it, as tracking. It wasn't read, so type kerned by hand came in spaced by the font alone and drifted from the page from each kerned pair on, and envelopes of such type drew apart from their drawn art and kept it. In users' files, used locally and never committed, 48 stories in 17 of 224 files have it, and the drawn art of envelopes of such type sets each kerned gap wider or narrower by exactly that value (a heading's first pair at -140, the letters of a line at 20 to 220). Measured against each file's own page, 14 of those files draw closer (in 4 the pixels that differ go from 2.7–4.7% to under 0.6%) and 2 a little further, both where an envelope of type now opens live in place of its drawn art; envelopes of type that open live go from 154 to 159 of 203, none fewer in any file, and two notes that the type differs from the page go. A value that can't be read keeps the automatic kerning, a run whose length can't be read ends the runs there, and past 65,536 runs the characters keep the automatic kerning. `.ai` save still leaves kerning out of the editing data, so saving such a file as `.ai` again now gives the note that attributes of type are left out for type with manual kerning. Tests `ate::tests::a_story_keeps_its_manual_kerning`, `tests_native::type_keeps_its_manual_kerning`; scores unchanged |
| 2026-11-12 | minor | `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, after the ways it was tried before (its glyphs alone and grown by half its strokes' weight, #6535, on its own warp and on its saved grid), before a grid moved onto its drawn art, and only where that box is another: its glyph outlines with their fills and strokes baked as the envelope bakes them (geometry effects on them applied: a stroke a Transform effect moves counts where it is moved to), each piece measured by its visual bounds, which are exact for miter joins (a tip counts where the miter limit keeps it, not the miter allowance at every corner that the bounds with strokes take) and round joins and an upper bound for bevel joins, miters the limit cuts, width profiles and square-capped dashes; a contour of zero length, which paints nothing, doesn't count. Effects on the type object itself are left out, as VectorCraft applies them after the envelope bends the type. The box is measured only when that try comes and the import has a check left for it, and once for an envelope. Groups round type and other objects in the contents are measured as before. In users' files (used locally, never committed) the drawn art of some stroked type in an envelope maps from that box: where the type has sharp corners at its edges (slanted stems, pointed feet) and miter joins, or a stroke moved by a Transform effect (a drop shadow), its glyphs grown by half the weight gave too small a box and the envelope kept its drawn art; and where a glyph holds a contour of zero length at its edge, the glyphs' box counted it. On 224 of our own files: envelopes of type that open live go from 154 in 45 files to 161 in 50, and no file loses one; no file changes whether it opens from its layers or its PDF part; renders at 40 ppi change in 6 files, by at most 0.94% of their pixels, each where an envelope of type now opens live in place of its drawn art (the page's own art): 1 closer to the file's own page and 5 further; the notes change in the same 6 files: the note on type in an envelope goes where none keeps its drawn art, and a file whose envelopes of type all kept their drawn art, which opened without the page comparison, now opens with it and carries its notes (the share of art or type that differs from the page, type the page has without a text object, the PDF part's note on DeviceN colours). A synthetic file of 256 such envelopes of 2,000 characters each opens in the same time as before (13.3 s in a debug build): the box is measured only when its try comes. Tests `ai::envelope::tests::mitred_type_is_also_tried_mapped_from_what_its_stroke_paints_miter_tips_included`, `type_with_a_mitred_character_stroke_is_also_tried_mapped_from_what_it_paints`, `a_stroke_moved_by_a_transform_effect_counts_where_it_paints`, `round_joined_type_is_not_tried_twice_for_the_same_box`, `a_contour_of_zero_length_paints_nothing`, `a_side_within_the_slack_of_the_geometric_box_is_that_side`, `tests_native::a_warp_of_mitred_type_maps_from_what_its_stroke_paints_where_its_drawn_art_does` (#6824, part of #3179) |
+1 -1
View File
@@ -663,7 +663,7 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
`graphicStyle.addFromLibrary`).
- **Missing:** more built-in brush libraries beyond the eight shipped (and further graphic-style libraries beyond the ten shipped, and further symbol libraries beyond Basic
Shapes, UI Frames, Map Markers, Inventory Icons and Skill Icons; original, generated in code, never Adobe's); dynamic symbols' `.ai` read and write;
Global Edit of groups holding type or images, and rotated copies as matches; 9-slice guides outside the symbol's art (a dragged guide stops at the art's edge).
Global Edit of groups holding type or images, and rotated copies as matches.
- **Estimate:** 5–15 h.
## G3 3D and Materials
+1 -1
View File
@@ -24,7 +24,7 @@ It reads the pen's tilt and barrel rotation on macOS and on Linux under X11 and
| Pen pressure | yes (Wacom, Windows Ink, macOS tablet events) | yes, read from AppKit's tablet events before the window gets them (winit reports none), each move of a stroke with its own pressure, mouse event coalescing off (#852; not yet tried on a Mac) | yes (pointer force via `WM_POINTER`) | under X11 and XWayland (Preferences › Performance › Linux Display Server, #1151, #2028; Automatic uses XWayland when a pen is attached on a Wayland session, #4967), read from XInput2 raw events (#764); **no** on native Wayland, where winit reports none and the pen may not reach the window (#491) | browser pointer events, with coalesced events; Apple Pencil on iPad (hover, palm rejection: fingers navigate after a pen contact until reload) | partial: 2–4 h for Wayland (winit 0.31), plus a check on a Mac |
| Pen tilt, bearing, barrel rotation (6D Art Pen) | yes, drives brushes | read from AppKit's tablet events (tilt, and the barrel rotation of a pen that reports one); Calligraphic and Scatter brushes vary with them (#764; not yet tried on a Mac) | with Windows Ink, read from the pen's `POINTER_PEN_INFO` (tilt and barrel rotation where its pen mask says the pen reports them); Calligraphic and Scatter brushes vary with them (#372; not yet tried with a pen) | under X11 and XWayland, read from XInput2 raw events; Calligraphic and Scatter brushes vary with them (#764); **no** on native Wayland | no | partial: native Wayland and the web read none, and Pattern and Bristle brushes do not use them (an Art brush's Width follows them); 3–6 h (#372) |
| Pen eraser end | yes | the eraser end (AppKit's tablet proximity events) selects the Eraser tool and the tip brings back the tool used before, as on Linux (#852; not yet tried on a Mac) | with Windows Ink, an inverted pen or its eraser button (`PEN_FLAG_INVERTED`, `PEN_FLAG_ERASER` in the pen's pointer messages) selects the Eraser tool and the tip brings back the tool used before, as on Linux (not yet tried with a pen) | under X11 and XWayland, the eraser end selects the Eraser tool and the tip brings back the tool used before (#764); **no** on native Wayland | a press of the eraser end (Pointer Events eraser button, `button` 5) selects the Eraser tool, and that press erases; a press of the tip brings back the tool used before; Pointer Events report no end while the pen hovers | partial |
| Touch gestures (pinch zoom, two-finger pan, rotate view, Touch workspace) | yes (Windows touch, Surface) | trackpad pinch, scroll and rotate | pinch, pan (a second finger cancels the first finger's tool press, #4198); two-finger tap undo, three-finger redo (#585) | same where winit reports touch | eframe until the first pen contact, then Pointer Events (pen and fingers told apart); long press opens the context menu | partial: touch workspace and touch-screen rotation missing, 3–5 h |
| Touch gestures (pinch zoom, two-finger pan, rotate view, Touch workspace) | yes (Windows touch, Surface) | trackpad pinch, scroll and rotate | pinch, pan (a second finger cancels the first finger's tool press, #4198); two-finger tap undo, three-finger redo (#585); in the Touch workspace a two-finger tap switches between the Selection tool and the last drawing tool | same where winit reports touch | eframe until the first pen contact, then Pointer Events (pen and fingers told apart); long press opens the context menu | partial: touch workspace and touch-screen rotation missing, 3–5 h |
| Trackpad (smooth scroll, pinch) | yes | yes | precision touchpads | yes | yes | done |
| HiDPI / Retina, per-monitor scale | yes | yes | yes | yes | yes | done; a window dragged between monitors of different scale can still grow on Windows (#1459, open); the custom title bar's window on Windows stays truly borderless so the pointer lines up with what is drawn (#1791, #1758; awaiting the reporter's confirmation) ; macOS cursors use aligned 1×/2× native image representations (#2292), covered by headless construction tests; mixed-display transitions and physical cursor sizing remain unverified, no additional hardware validated |
| Multiple monitors: panels and document windows on another screen | yes | no (one OS window) | no | no | — | missing: 6–10 h (with multiple windows, gap G7) |
+43 -7
View File
@@ -1823,6 +1823,11 @@ parameter error, ``invalid parameters for `<id>`: `<path>` is nested too deeply`
value. A schema that is wrong in itself, such as one that nests past 16 levels or puts a list of ids or a point
inside 16 lists, is an internal error in the command, and the command does not run.
The command API returns these errors in English. The desktop app's status bar shows them in the interface language,
the requirement after "must be" included (a number and its range and unit, an integer, a list of names, an object id,
a color, a point, an object or a list); the parameter's path, the refused value, the bounds, the unit and the names stay
as the English gives them.
An omitted value with a `default` takes it (`rotation` 0 in `view.saved.new`); the journal keeps the params as they
were given. Saved steps played from a journal or an action keep a key the schema does not name, unless its value nests
more than 16 levels deep, and the values of the parameters it names are checked as in a new call. The schemas of built-in commands belong to API level 3
@@ -2774,8 +2779,9 @@ already walks Image Trace. Short agent entry points:
`static`|`dynamic`),
`symbol.new {name?, registration?, exportType?, nineSlice?, nineSliceGuides?, type?, ids?}`,
`symbol.options {name?, newName?, registration?, exportType?, nineSlice?, nineSliceGuides?, type?}` (`nineSlice` bool turns
9-slice guides on or off; `nineSliceGuides` is `[left, top, right, bottom]`, fractions 0..1 of the symbol size, a
quarter each when none are given; rows of `symbol.list` carry `nineSlice`: the guides or `null`; a scaled instance of
9-slice guides on or off; `nineSliceGuides` is `[left, top, right, bottom]`, fractions of the symbol size in from
each edge, each -16..16 with `left + right < 1` and `top + bottom < 1`, a quarter each when none are given; below 0
or above 1 puts a guide outside the art, and the art then scales by the cells it falls in; rows of `symbol.list` carry `nineSlice`: the guides or `null`; a scaled instance of
a symbol with guides keeps its corners at their size, and `symbol.breakLink` gives its art as it draws; dragging a
guide on the canvas in symbol editing mode sends `nineSliceGuides` in one undo step; `type` is
Symbol Type, `static` by default for the command and `dynamic` by default in the Symbol Options dialog),
@@ -5572,6 +5578,15 @@ point deltas from an unnamed source in the desktop app, or line deltas that are
trackpad gesture holds Alt, it zooms until it ends, also after Alt is let go. The control channel's
`ui.wheel` with `cmd: true` turns the wheel with Cmd/Ctrl held.
With Preferences › Devices › Enable Touch Gestures on, a two-finger tap on the canvas undoes and a three-finger tap
redoes. In the Touch workspace a two-finger tap runs `tool.toggleTouchMode` (Switch Selection and Drawing Modes, `{}`,
desktop app) instead and undoes nothing ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/touch-workspace-in-illustrator.html)).
From the Selection, Direct Selection, Group Selection, Magic Wand, Lasso or Perspective Selection tool it chooses the
drawing tool chosen last in the window, or the Pencil tool when none has been chosen yet; from any other tool it
chooses the Selection tool, and the tool left becomes the drawing tool unless it is the Hand, Rotate View, Zoom or Print
Tiling tool. It returns `{tool}` and adds no undo step. Pencil as the first drawing tool and the list of selection tools
are VectorCraft's own rules. A tap in Presentation Mode runs nothing.
`gridlineEvery` (72 pt by default) and `gridSubdivisions` (8 by default) set the document grid that View › Show Grid
draws, and View › Snap to Grid snaps to its subdivisions. Changing either sets the grid of every open document.
`file.new` gives a new document that grid, and `document.open`, `file.newFromTemplate` and `file.revert` give it to
@@ -6085,14 +6100,15 @@ while such an image that the art shows has a plate of its name; deleting the swa
file's composite is drawn through clips the image (a clipping group, its path under the nonzero fill rule, an even-odd
clipping path kept as the same area), and `file.place` answers the image's id as
`image`, since the Links commands take the image and not the group. `links.update` and `links.relink` clip the image
by the file's clipping path again (in a new clipping group when none holds it, and inside a clipping mask made in the
by the file's clipping path again (a plain group holding just the image becomes its clipping group, a new clipping group holds it when no group does, and it goes inside a clipping mask made in the
document, whose path is kept), unless Placement Options clip the image, the same way for the images in symbols, graph designs, patterns and opacity masks; when the new file has no
clipping path, a clipping group holding just the image whose path is the old file's clipping path loses that path and
stays as a plain group of the image, with its id, name, visibility and transparency (one whose path was given the
even-odd fill rule stays as it is). The link shows as modified when a plate file of its own changes
or is gone, as it does when the DCS file changes, and the app's link watch acts on a changed plate file as on a
changed DCS file. `links.relink {copy: true}` fails for a DCS file that reads plate files of its own, and copies
nothing. These rules are VectorCraft's own: the screen, composite print and exports show the image as its plates
nothing. Opening a document reads a DCS file and its plates again even with the `lowResProxyEps` preference, which
keeps the saved preview of other linked EPS files. These rules are VectorCraft's own: the screen, composite print and exports show the image as its plates
mixed into CMYK (each ink amount times the ink's CMYK values, plates combined as `1 − (1 − a)(1 − b)`); Separations
Preview and `file.print` separations show each plate on its own ink, and a spot plate prints as the document's swatch
of its ink (else its CMYK values) with `spotsToProcess`. Separations Preview shows a reduced image's plates as the
@@ -6151,7 +6167,11 @@ recorded action leaves both out. Art copied from no artboard keeps its place on
offset to that one on the others. An index the document does not have, a repeated index, a value that is not an index
or an empty list fails, and nothing is pasted. Copied artboards come back once, where they were, whichever artboards
are named. `layer.pasteRemembersLayers {on?}` (a document option, `document.inspect` → `pasteRemembersLayers`)
pastes objects back into the layers they came from, by name, making missing ones. Drawing modes (`view.drawMode`) apply
pastes objects back into the layers and sublayers they came from: in the same document while those are still there,
else by the names of the layer and the layers around it (the topmost chain that matches the most names, a shown and
unlocked one first). A missing sublayer is made inside its layer, and a missing top-level layer on top, in the paste's
undo step. When a matched layer, or a layer around it, is hidden or locked, the paste fails and nothing is pasted.
Drawing modes (`view.drawMode`) apply
too: in Draw Inside, `edit.paste`, `edit.pasteInPlace` and `edit.pasteOnAllArtboards` put the objects inside the
object drawn into (its clip group, made on the first paste), whatever Paste Remembers Layers says; in Draw Behind,
`edit.pasteInPlace` and `edit.pasteOnAllArtboards` put them just below the selection. `edit.pasteInFront` and
@@ -9936,7 +9956,22 @@ adds a row and a column where it clicks inside. `object.mesh.addLine`, and `obje
the mesh's outline (within a millionth of a point) on any side without `tolerance`; a point outside needs `tolerance`. `object.mesh.addLine` at a point that is already a mesh
point adds no line and records no undo step unless its `color` changes a gradient mesh's point (a mesh envelope's points
have no color). `press_key` Escape during a drag of a point or handle of a mesh
envelope or a gradient mesh cancels it: the point goes back and no undo step is added. The Control bar shows Edit Envelope / Edit Contents, the warp's
envelope or a gradient mesh cancels it: the point goes back and no undo step is added.
A warp envelope's points can be edited the same way, with the same commands. Its points are those of its surface
sampled on 4×4 patches, with handles along it; where 4×4 patches draw more than 0.1% of the warp's diagonal away from
the warp, on 8×8 or 16×16 patches (these sizes and the 0.1% are VectorCraft's own values). The canvas shows those
points on a selected warp. The first point or handle moved, or the first line added or deleted, makes the warp a mesh
envelope on that grid and applies the edit, as one undo step: Undo, or Escape during the drag, gives back the warp
with its style and bend. From then on the Control bar shows the mesh's rows and columns, Reset with Mesh with Maintain
Shape keeps the edited shape, and Reset with Warp replaces it with the chosen warp style. Release gives back the
edited mesh as the envelope's shape, and Expand keeps the edited distortion. A warp that no grid of up to 16×16
patches follows that closely (some warps saved before the Bézier warp net existed, `version: 0`) shows no points, and
editing it fails with "this warp's points can't be edited: use Reset with Mesh first" and changes nothing. The help
page on reshaping envelopes:
https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/distort-objects-with-envelopes.html
The Control bar shows Edit Envelope / Edit Contents, the warp's
style, orientation, bend and distortions (or the mesh's rows and columns), Reset (an unbent warp, a flat mesh) and
Envelope Options.
@@ -9962,7 +9997,8 @@ Color panel, Swatches or the Eyedropper) recolours just the picked points, and w
`object.mesh.movePoints {id, points: [index…], dx, dy}` (or `{items: [{id, points}…], dx, dy}` over several meshes)
moves points by (dx, dy), their handles with them; `object.mesh.setPointColor` takes `points` or `items` the same
way to colour or fade several points at once. An index out of range, an index that is not a whole number ≥ 0, or a
move past the coordinate range fails and changes nothing.
move past the coordinate range fails and changes nothing. A call that changes no point (no points named, a move by
(0, 0), the colour a point already has) changes nothing and records no undo step.
```json
{"name":"run_command","arguments":{"command":"object.mesh.movePoints","params":{"id":12,"points":[0,4],"dx":10,"dy":-5}}}
+3 -2
View File
@@ -1,6 +1,6 @@
# Roadmap: milestones and what's next
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-13 · **Change:** minor (library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-13 · **Change:** minor (PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
>
> Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865).
>
@@ -52,6 +52,7 @@ M7 type: Touch Type moves a right-to-left character along its line and up from i
| Date | Change | Summary |
|---|---|---|
| 2026-11-13 | minor | PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke instead of being left out, adding no text (#6971; `empty_actual_text_keeps_the_glyphs_art` in `crates/pdf/src/tests/actual_text.rs`). Scores and estimates unchanged. |
| 2026-11-13 | minor | Library panels (swatch, Color Book, brush, symbol and graphic style libraries): in a panel made taller the list fills the space above the footer instead of scrolling inside 220 or 280 pt (#2992; `the_list_fills_a_tall_panel_above_its_footer` in `crates/ui-egui/src/panels/library_panel/tests.rs`). Scores and estimates unchanged. |
| 2026-11-13 | minor | Swatches: in a panel made taller the swatch list fills the space above the footer instead of scrolling inside 150 or 200 pt (#1638; `the_list_fills_a_tall_panel_above_its_footer` in `crates/ui-egui/src/panels/swatches/tests.rs`). Scores and estimates unchanged. |
| 2026-11-10 | minor | M13 / G6: MCP catalogue (#6460): headless lists UI commands, eight prompts, 33 tools, effect vs command ids; scores and estimates unchanged. |
@@ -150,7 +151,7 @@ native wording review, layout checks and a web Devanagari font remain. [Notes](l
| M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 |
| M2 | Drawing tools + smart guides | ✅ mostly done (#3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 |
| M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel, Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); | Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); 4–8 |
| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts | 3–6 (existing scope; Affinity export unestimated) |
| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) |
| M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 |
| M6 | Path operations (Pathfinder, Shape Builder, offset…) | ✅ mostly done (live compound shapes: Make, Alt-click a Shape Mode, member modes, Release, Expand (#4522); single-result Pathfinder names and SVG IDs retained (#1293); Divide open-cutting-path geometry, appearance and history verified (#1307; existing segment cap remains); Simplify preview/counts and rewritten-path component selection verified (#1272; the slider opens at the Auto-Simplify level; a Direct Selection part of a path simplifies on its own); Compound appearance and member fill-rule edits verified (#1197); Boolean precision on almost-horizontal edges fixed and the property tests made deterministic; Shape Builder gap detection, large-offset bug open); Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog | 3–6 |
| M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof and the custom dictionary and Ignore All commands and Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, and Spelling › Auto Spell Check in the context menu of type, and the Edit Custom Dictionary dialog (#4936; the Check Spelling dialog remains); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs (feature-valued alternates and unencoded glyphs applied in one Undo step while keeping Arabic joining, #5514), OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, spell check, vertical type pending | 45–60 |
+12 -4
View File
@@ -1,6 +1,6 @@
# Parity with Adobe Illustrator
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-13 · **Change:** minor (library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#Line truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-13 · **Change:** minor (PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously minor: Object › Rasterize with the Grayscale or Bitmap colour model makes a grayscale image, #6969; scores and estimates unchanged; previously minor: `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, miter tips and moved strokes included, after its glyphs grown by half its strokes' weight (#6824; #6617: Swatches panel menu: Show Recent Colors; scores unchanged; previously minor: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; macOS: the canvas cursor stays after the pointer moves, #6362; scores and estimates unchanged; previously minor: Type tool: kerning at a caret at the start of a line moves the character after it, #5111; scores and estimates unchanged; previously minor: Rulers: the zero point dragged out of the rulers' corner snaps as a drawn point does; previously minor: Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: Envelopes: with Distort Appearance, type's strokes paint along the bent glyph outlines at their own weight, as users' `.ai` files draw them, which changes how VectorCraft's own envelopes of stroked type draw (#6644; scores and estimates unchanged); previously minor: G5: Energy Beams brush library; bundled content ~44% → ~46%; previously minor: G5: Skill Icons symbol library; bundled content ~42% → ~44%; previously minor: `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art (#6570; scores and estimates unchanged); previously minor: ruler double-click adds a guide at the pointer, #5239; G5: Status Effects graphic style library; bundled content ~40% → ~42%; MCP symbol libraries list UI Frames and Map Markers; previously minor: G5: Inventory Icons built-in symbol library; bundled content ~38% → ~40%; previously minor: `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke (#3179; scores and estimates unchanged); previously minor: `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid where VectorCraft's warp doesn't draw as their drawn art (#3179; scores and estimates unchanged); G5: Game Trails brush library; bundled content ~36% → ~38%; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page (#3179; scores and estimates unchanged); G5: Game HUD graphic style library; bundled content ~34% → ~36%; previously minor: Line Arrow arrowhead (#5421; scores and estimates unchanged); G5: Map Markers built-in symbol library; bundled content ~32% → ~34%; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: Canvas: a 3D effect changed on type or a group redraws where its solid was; Fit to Artwork Bounds and per-artboard SVG export build each solid once for all artboards; previously minor: Effect Gallery: a thumbnail for each filter and a preview area inside the dialog, on an original drawing; Raster effects 52% → 55%, hours 1–2 → none; headline numbers unchanged; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: UI Frames built-in symbol library with default 9-slice; bundled content ~32%; previously minor: G5: dynamic symbol part on-canvas opacity/blend/gradient/pattern; strokes remaining no longer lists Overlap/auto corners; symbols ~88%; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: harakat paint fallback clarified; previously minor: current Guides feature-area rows consolidated using existing ruler evidence; scores and estimLine truncated
>
> Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865).
>
@@ -53,6 +53,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard
| Date | Change | Summary |
|---|---|---|
| 2026-11-13 | minor | PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke instead of being left out, adding no text (#6971; `empty_actual_text_keeps_the_glyphs_art` in `crates/pdf/src/tests/actual_text.rs`). Scores and estimates unchanged. |
| 2026-11-13 | minor | Library panels (swatch, Color Book, brush, symbol and graphic style libraries): in a panel made taller the list fills the space above the footer instead of scrolling inside 220 or 280 pt (#2992; `the_list_fills_a_tall_panel_above_its_footer` in `crates/ui-egui/src/panels/library_panel/tests.rs`). Scores and estimates unchanged. |
| 2026-11-13 | minor | Swatches: in a panel made taller the swatch list fills the space above the footer instead of scrolling inside 150 or 200 pt (#1638; `the_list_fills_a_tall_panel_above_its_footer` in `crates/ui-egui/src/panels/swatches/tests.rs`). Scores and estimates unchanged. |
| 2026-11-13 | minor | Swatches panel: its menu's Show Recent Colors hides and shows the panel's Recent Colors row, checked by default and kept between sessions apart from the Color panel's (#6617); scores unchanged. |
@@ -511,7 +512,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale)
| Layers, artboards, document setup | 5 | 82% | Layers panel: a confirmation before deleting layers that hold art, Collect for Export, row context menus, the Layer Options dialog for several rows with mixed values, Paste Remembers Layers for sublayers, drag-scrolling a long panel while dragging rows; artboard preset polish (artboard escape routing and document setup modal handoff done; Move Artwork for artboard X/Y edits, Rearrange All Artboards, Document Setup, New Document and the rest of the Layers panel are done) | 4–7 |
| View & navigation | 3 | 70% | New View/Edit Views, multiple windows/arrange, Snap to Pixel/Glyph (print tiling is done) | 9–14 |
| Guides, grids, smart guides, snapping, rulers | 3 | 85% | global/video rulers, Spacing Guides' distance readouts and spacing for resized or drawn art, Alt swapping a ruler guide's orientation, ruler guides selected together with art (marquee, Shift-click), ruler guides as Layers rows with their own lock and hide (#451: Lock Guides locks them all; Make Guides paths are Layers rows already) (dragging existing guides is done, #414; new guides snapping to side midpoints and artboards, and artboard guides, #451; the drawing tools snapping, with Construction Guides, #506; Spacing Guides for moves, #394; moves snapping to the grid, #740; ruler guides pulling drawn points with Smart Guides on, and "center" and "anchor" labels while hovering with the Selection tool, #812; distance and angle labels while drawing, #2983) | 2–4; status-bar X/Y uses the active ruler origin and General units |
| File formats | 6 | 85% | Explicit editing-data oversized single-artboard import fixed (#6865); scores and estimates unchanged. Affinity export, and the rest of Affinity import (adjustments, blur and bevel effects, brushes, live symbol instances, text threading), DWG (no open spec: DXF instead), PSD placement as layers (Photoshop Import Options; the merged image is done), EPS checked against more real files users send (Inkscape files open as vectors; other generators' constructs are tested with programs written from the PostScript Language Reference only; CID-keyed CJK type and `CCITTFaxDecode` images not read), legacy `.ai` files saved without the prolog that defines their operators (their own operator set isn't read yet), the rest of Illustrator's editing data (appearances and live effects, symbols, pattern fills, brushes, placed files: #637), the remaining fidelity polish; EPS, DXF, EMF/WMF, TIFF, BMP, Targa, PSD export, SVGZ, PDF security, PDF/X, PDF layers, presets and Affinity import are done | 6–10 (existing scope; Affinity export unestimated) |
| File formats | 6 | 85% | PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); Explicit editing-data oversized single-artboard import fixed (#6865); scores and estimates unchanged. Affinity export, and the rest of Affinity import (adjustments, blur and bevel effects, brushes, live symbol instances, text threading), DWG (no open spec: DXF instead), PSD placement as layers (Photoshop Import Options; the merged image is done), EPS checked against more real files users send (Inkscape files open as vectors; other generators' constructs are tested with programs written from the PostScript Language Reference only; CID-keyed CJK type and `CCITTFaxDecode` images not read), legacy `.ai` files saved without the prolog that defines their operators (their own operator set isn't read yet), the rest of Illustrator's editing data (appearances and live effects, symbols, pattern fills, brushes, placed files: #637), the remaining fidelity polish; EPS, DXF, EMF/WMF, TIFF, BMP, Targa, PSD export, SVGZ, PDF security, PDF/X, PDF layers, presets and Affinity import are done | 6–10 (existing scope; Affinity export unestimated) |
| Export for Screens, Asset Export, slices, Save for Web | 3 | 85% | polish only (all four are done) | 2–4 |
| Print, colour management, separations, flattener | 3 | 80% | print preview fidelity (flattener presets in PDF and print, overprint in PDF and composite print, Print dialog, presets, PostScript, marks, separations, Print Tiling, print overprint/flattener/bitmap options and printer profile are done, as are the Japanese papers in its Media list: JIS B4/B5/B6, はがき, 往復はがき, 封筒 長形3号/長形4号/角形2号/角形3号 and 四六判, beside the ISO B4/B5 that settings saved before them keep) | 1–2 |
| 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 |
@@ -866,6 +867,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- The errors of the blend spine commands (Move Spine Point, Reshape Spine Segment, Add Spine Point and Delete Spine Point) show in the status bar in the interface language: each has a row in every catalog that translates all status and error messages and in Bulgarian (`blend_spine_param_errors_are_translated`).
- The errors of the 3D effects (Extrude & Bevel, Revolve, Inflate, Rotate and their Classic forms) show in the status bar in the interface language: the art a 3D effect cannot build a solid from, invalid light, graphics and surface settings, and the notes for an object that draws no 3D faces or more wireframe edges than the limit. Each has a row in every catalog that translates all status and error messages, and the effect's name and the values in the message are translated or kept as written (`three_d_refusals_are_translated_in_every_complete_catalog`, `three_d_refusals_translate_with_their_values`).
- The errors of the parameter checks that many commands share show in the status bar in the interface language: a value that is not a number where a number goes (`object.move` with `"dx": "60 mm"`, and `object.rotate`, `object.setBounds` and the other commands that call `check_numbers`), a missing number or index, `ids` that are not a list of object ids, an object id that is not a non-negative integer or names no object, and a date that is not Unix seconds. Each has a row in every catalog that translates all status and error messages, and in Bulgarian, Danish, Indonesian and Dutch (`shared_param_check_errors_are_translated`).
- A parameter schema's errors show in the status bar with what the value must be in the interface language, for every type a schema has (a number with each kind of range and with a unit, an integer and its range, true or false, a string, a list of names, an object id, a list of object ids, a color, a point, an object and a list), in every catalog that translates all status and error messages; the path, the refused value, the bounds, the unit and the names stay as the English gives them. The error for a value that is not one of its names is also translated in Bulgarian, Bosnian, Danish, Indonesian and Dutch (`parameter_schema_expected_phrases_are_translated`, `bracketed_message_parts_translate_only_as_exact_messages`).
- Export commands run through MCP, the control channel or the CLI refuse a key that no format takes, and a command that writes one format (`document.exportPdf`, `document.exportEps`, `document.exportDxf`) or takes one format's options (`document.pdfSettings`, `pdf.preset.save`) refuses a key that format doesn't take. An unknown key inside `marks`, `bleed`, `compression`, `output`, `advanced`, `security` or `flattener` is refused by its path.
- Save commands run through MCP, the control channel or the CLI (`document.save`, `file.saveAs`, `file.saveCopy`, `file.saveAsTemplate`, `app.save`) refuse a key that no save format takes, beside the path or in `options`. Export for Screens refuses a key it doesn't take, and a key that no format takes in a format row or in a format's settings, by its path (`formats[1].marks.useDocumentBleed`); Export Assets (`assets.export`, `assets.settings.set`) checks the rows and settings it is given the same way.
- Commands that read their `ids` (or `slices`) list themselves refuse a list with an entry that is not a non-negative integer, and a value that is not a list, and change nothing; they no longer drop the entry and act on the rest (Copy Appearance From, the Edit Colors commands and Overprint Black, Find and Replace, `layer.highlight`, `layer.move`, `library.add`, the Links panel commands, `object.transform`, Make Pattern, the Repeat commands, the slice commands, Join, Average and Join, `plugin.run`, `symbol.edit`, Make Opacity Mask; `tests::ids_without_selection::an_ids_entry_that_is_not_an_id_is_refused_and_changes_nothing`). The error for an entry of an object id list names the key, the entry and its value ("`ids` entry 1 is true, not a non-negative integer object id"), with a row in every catalog that has the other object id errors.
@@ -881,7 +883,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Dynamic symbol appearance follows what an object draws** (VectorCraft's own rule): `symbol.instance.setAppearance` refuses a fill or stroke for an object of the art that does not draw it (a guide, blend, envelope, Repeat, Intertwine group, gradient mesh or placed document; a nested symbol instance's stroke, and its fill unless a solid color or none, which stains its art; an image's fill or stroke without a Convert to Shape or Outline Object effect) with an error that names the key and the object, and the call changes nothing. Opacity, blend and `null`, which takes a stored change back, are taken for every object. Tests: `crates/engine/src/tests/dynamic_symbols.rs`.
- Symbol editing mode keeps every instance in step: instances of a dynamic symbol inside other symbols' art, pattern tiles, graph designs, stored brushes and opacity masks keep their appearance changes on the objects an edit reorders and drop the changes to objects it deletes. The view does not draw the instance the edit was entered from. Area type in the symbol's art takes the text wrap that moving a wrap object gives it. Editing another symbol at a place that fails keeps the current edit open, and only the editing layer or art on it can be isolated. Tests: `crates/engine/src/tests/symboledit.rs`, `isolation::symbol_editing_does_not_draw_the_instance_it_was_entered_from`, `panels::symbols::tests::double_clicking_a_symbol_in_the_panel_edits_it_in_either_view`, `the_panel_menus_edit_symbol_edits_the_instances_symbol_or_the_panels`, `the_control_bars_edit_symbol_edits_the_selected_instances_symbol`, `chrome::tests::the_control_bar_exits_symbol_editing_mode`.
- **Dynamic symbol instances on the canvas** ([Symbols, archived copy](https://web.archive.org/web/20240206075757/https://helpx.adobe.com/illustrator/using/symbols.html)): each instance of a dynamic symbol can have an appearance of its own while it shares the symbol's shape. The rest of this entry is VectorCraft's own rules. A Direct Selection click on an instance of a dynamic symbol selects the path, compound path or type object of the symbol's art under the pointer and outlines it (`symbol.instance.selectPart`); the Swatches and Color panels, the Control bar, the Eyedropper and the other fill and stroke controls then change that object's fill or stroke (solid, none, gradient or pattern) for this instance only, each as one undo step, and `transparency.set` changes its opacity and blend the same way; the symbol's art and its other instances stay as they were. Alt or Shift picks the instance whole. An Eyedropper source that is not a path, compound path or type, a click on any other object of the art (a group, image, blend or nested instance) and the commands that change the selected objects (moving, Delete, Group, Hide, Lock, Arrange, Expand, the gradient annotator, isolate/knockout on Transparency, the Appearance panel's rows and others) are refused with a status message. Copy, Export Selection, Fit to Selection, Liquify, Isolate, Add to Library and Save Selection use the whole instance (`docs/mcp.md`), and another selection tool selects the instance whole again. Tests: `crates/engine/src/tests/dynamic_symbols.rs` (`gradients_and_patterns_on_a_picked_object_are_taken`, `opacity_and_blend_on_a_picked_object_go_through_transparency_set`), `direct::tests::a_click_on_a_dynamic_instance_picks_the_object_under_the_pointer`.
- **9-slice guides on the canvas** ([public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/maintain-proportions-while-scaling-symbols.html)): while a symbol with Enable Guides for 9-Slice Scaling on is edited in symbol editing mode, the canvas draws its two horizontal and two vertical guides as dotted lines across its art, with any tool and with ruler guides hidden. With the Selection tool the pointer near a guide shows the Move cursor, and dragging the guide moves it (`symbol.options`'s `nineSliceGuides`) as one undo step; Escape during the drag puts it back. VectorCraft's own rules: a guide within 4 screen pixels takes the press before the art and the bounding box; it stays within the art's box (guides outside the art are not supported yet) and stops short of the opposite guide; the drag does not snap. Tests: `nineslice::tests`, `symbol_nine_slice::tests::the_edited_symbols_guides_cross_its_art_where_the_editing_layer_shows_it`, `a_moved_guide_stays_in_the_art_and_short_of_the_opposite_guide`, `canvas::tests::the_edited_symbols_nine_slice_guides_are_drawn_and_dragged_on_the_canvas`.
- **9-slice guides on the canvas** ([public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/maintain-proportions-while-scaling-symbols.html)): while a symbol with Enable Guides for 9-Slice Scaling on is edited in symbol editing mode, the canvas draws its two horizontal and two vertical guides as dotted lines across its art, with any tool and with ruler guides hidden. With the Selection tool the pointer near a guide shows the Move cursor, and dragging the guide moves it (`symbol.options`'s `nineSliceGuides`) as one undo step; Escape during the drag puts it back. VectorCraft's own rules: a guide within 4 screen pixels takes the press before the art and the bounding box; it may pass the art's edges (see the next entry) and stops short of the opposite guide; the drag does not snap. Tests: `nineslice::tests`, `symbol_nine_slice::tests::the_edited_symbols_guides_cross_its_art_where_the_editing_layer_shows_it`, `a_moved_guide_passes_the_arts_edges_and_stops_short_of_the_opposite_guide`, `canvas::tests::the_edited_symbols_nine_slice_guides_are_drawn_and_dragged_on_the_canvas`.
- **9-slice guides outside the art** ([the help page](https://help.adobe.com/archive/en/illustrator/cs6/illustrator_reference.pdf), Use 9-slice scaling section): a guide may lie outside the symbol's art, set by dragging it past the art's edge in symbol editing mode, by `symbol.options`'s `nineSliceGuides` or by a Symbol Options field below 0% or above 100%, and a scaled instance still scales, by the cells its art falls in. VectorCraft's own rules: each guide lies within 16 times the art's width or height of its edge (`-16..16` as a fraction, `-1600..1600` in percent) and the two guides of an axis keep their order; a guide past an edge of the art cuts the art at that edge, so the outer cell on its side holds no art; with both guides of an axis past opposite edges the art scales as a whole along it; with both past the same edge the art lies in the outer cell at the other edge and keeps its size, from that edge of the instance, or shrinks to the instance's width or height when the instance is smaller than the art; Symbol Options shows and keeps the guides unrounded. Native files keep the guides exactly; SVG and `.ai` write such an instance as its placed art and keep no guides. Tests: `symbol_nine_slice::tests::guides_outside_the_art_are_accepted_in_order_and_within_the_limit`, `art_scales_by_the_cells_it_falls_in_when_guides_lie_outside_it`, `the_map_with_guides_outside_the_art_is_continuous_and_monotone` in `crates/doc`, `guides_outside_the_art_are_set_by_command_and_scale_by_the_cells_that_hold_art`, `a_guide_dragged_past_the_arts_edge_lies_outside_it`, `guides_outside_the_art_survive_saving_and_reopening_a_native_file` in `crates/engine`, `nineslice::tests::a_guide_outside_the_art_is_taken_and_dragged_past_the_arts_edge`, `a_nine_slice_instance_with_a_guide_outside_its_art_is_written_as_drawn` (SVG and `.ai`).
- **Delete Symbol asks first** ([Symbols panel](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/symbols-panel-options.html), [symbol libraries](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-or-import-symbol-libraries.html), [Alt-click Delete](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)): the Symbols panel's Delete Symbol button and menu item ask "Delete the selected symbol?" with Yes and No for a symbol no instance uses. For a symbol with placed instances they ask with Expand Instances (the instances become ordinary art), Delete Instances and Cancel; either Instances button deletes the symbol in one undo step. Alt-click on the button deletes an unused symbol without asking and still asks about one with instances. A question left open while another document became active deletes nothing. `symbol.delete` itself does not ask. Tests: `panels::symbols::tests::delete_symbol_asks_first_and_alt_click_deletes_an_unused_symbol_at_once`, `the_in_use_question_expands_or_deletes_the_instances`, `a_stale_delete_symbol_question_deletes_nothing`, `the_delete_symbol_questions_show_their_buttons`.
- **Symbols › Select All Unused** ([Symbols panel](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/symbols-panel-options.html), #4918): the Symbols panel menu's Select All Unused shows the symbols nothing places selected (`symbol.unused`): instances in the art (opacity masks included), graph designs, pattern tiles and brush art count, and so do instances in a used symbol's art. Delete Symbol, the button or the menu item, then asks "Delete the selected symbols?" once and deletes those still unused in one undo step (`symbol.delete {names}`); Alt-click on the button deletes them without asking, and a click on a symbol picks just it again. Tests: `tests::brushsym::symbol_unused_lists_the_symbols_nothing_places_and_delete_takes_several`, `panels::symbols::tests::select_all_unused_picks_the_unused_symbols_and_delete_deletes_them`, `dialogs::symbol_delete::tests::several_symbols_get_the_plural_question`.
- **Symbols › Sort by Name and the list views** ([the help page](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/symbols-panel-options.html)): the Symbols panel menu's Sort by Name puts the symbols in alphabetical order (`symbol.sortByName`), and its Thumbnail View, Small List View and Large List View show them as thumbnails, in a compact list or in a list with larger thumbnails. VectorCraft's own rules: the sort ignores case and keeps names that differ only in case in their order; it changes the document's order, which `symbol.list` reports, as one undo step, keeps the current symbol and adds no undo step when the symbols are already in order; Thumbnail View is the default, Small List View has 18-point rows with 14-point thumbnails and Large List View 26-point rows with 22-point thumbnails, and a click or double-click on a symbol does the same in every view. Tests: `tests::brushsym::symbol_sort_by_name_orders_the_symbols_in_one_undo_step`, `panels::symbols::tests::sort_by_name_and_the_small_and_large_list_views`.
@@ -1081,6 +1084,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
A closed arc from Arc Segment Tool Options or `shape.arc` with `lengthX` and `lengthY` closes through the corner of its box across from the one a convex arc bulges toward, with either Base Along, so a closed arc at Slope 100 is a quarter-ellipse sector and the Y Axis arc is the X Axis arc mirrored top to bottom. The [Draw arcs](https://web.archive.org/web/20251025042220/https://helpx.adobe.com/illustrator/using/drawing-simple-lines-shapes.html) section's Type option chooses whether the arc is open or closed; the corner it closes through is VectorCraft's own rule. Tests: `shapes::tests::a_y_base_arc_is_the_x_base_arc_mirrored_top_to_bottom`, `a_closed_convex_arc_is_a_quarter_ellipse_sector_with_either_base`, `tests::draw2::shape_arc_closed_along_y_closes_through_the_top_left_corner`.
Live curve fitting in the Pencil Tool Options is on by default; while it is off, the path shown while a stroke is drawn joins the stroke's points with straight segments, and the release fits the curve, as [Pencil Tool Options](https://web.archive.org/web/20261002104400/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/pencil-tool-options.html) describes (`path.freehand` `fit`).
In the Pencil and Paintbrush Tool Options, Edit selected paths within 0 px turns editing off, so a stroke that starts exactly on an end of a selected open path draws a new path; Close paths when ends are within 0 px turns closing off, so a stroke that ends exactly where it started stays open.
The Pencil's and the Paintbrush's Fidelity is in screen pixels, the same at any zoom: their Tool Options give it in px, from 0.01 px on the logarithmic slider to 20 px and up to 100 px in the field, and the tool sends `path.freehand` the value in points at the current zoom (#5729). The Smooth tool's and the Blob Brush's Fidelity stays in points.
Before a press that draws a new path, the Pencil cursor shows a small star, as [Draw freeform paths with the Pencil tool](https://web.archive.org/web/20260926095638/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-freeform-paths-with-the-pencil-tool.html) describes; over a selected path within Edit selected paths' distance, which the press continues from an end or redraws, the star is not shown ([Reshape paths with the Pencil tool](https://web.archive.org/web/20260106004407/https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/reshape-paths-with-the-pencil-tool.html)).
Keep selected in the Pencil and Paintbrush Tool Options is on by default: while it is on, a stroke selects the path it draws or continues and replaces the earlier selection. While it is off, a new stroke leaves nothing selected, the earlier selection included, as the reference application starts the stroke by dropping it (#5752); a continued or redrawn path is deselected while the rest of the selection stays (`path.freehand` `keepSelected`).
With two open paths selected, a Pencil stroke from an end of one that ends within Edit selected paths' distance of an end of the other connects them into one path with the first path's appearance, in one undo step, as [Connect two paths with the Pencil tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/connect-two-paths-with-the-pencil-tool.html) describes (`path.freehand` `connect`).
@@ -1099,6 +1103,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Ruler guides as layer objects:** a guide goes on the current layer, shows, hides, locks and is deleted with it, is listed in the Layers panel (its row selects it) and moves to another layer (`guide.setLayer`, or its row dragged onto that layer's rows); guides on a hidden or locked layer can't be selected, moved or deleted, Duplicate copies a layer's guides and Merge Selected and Flatten Artwork keep them on the merged layer; guides from files saved before guides had layers go on the top visible, unlocked layer when the document opens. Not done: guides stacked among the art of their layer (they are listed above it), a guide row's own eye and lock. Lock Guides also locks the objects made into guides: they can't be selected, moved or deleted (#1543); they are drawn in the guide colour and style of Preferences, and a dragged selection snaps to ruler guides with Smart Guides on (#1583, fixes #1534). Preferences › Guides & Grid › Lock Guides by Default locks guides when the app starts; it is off by default, and new guides can still be dragged out of a ruler while guides are locked. The Transform panel shows a selected ruler guide's X or Y, and typing a value moves it (#1659, part of #1597). This is not established by the documentation we could find: the public help pages on guides, rulers and the Transform, Control and Properties panels (read again on 2026-10-14) describe selecting and dragging unlocked guides and the panels' X and Y for a selection, not a guide's position in a panel, and the one public statement of it is a user's [community answer](https://community.adobe.com/questions-652/adding-a-new-custom-guide-785586), which is not documentation. It is kept as a convenience pending the owner's decision, with no parity claim and nothing counted towards a score.
- **Releasing ruler guides:** View › Guides › Release Guides turns the selected ruler guides into paths with no fill or stroke. An artboard guide becomes a line across its artboard, and a canvas guide becomes a line across the artboards (`view.guides.release {index?, ids?}`). A Cmd/Ctrl+Shift double-click with the Selection, Direct Selection or Group Selection tool releases the ruler guide or guide path under the pointer.
- **Layers panel:** every layer, sublayer, group and object is a clickable row at any depth: a click highlights it and makes its layer current (new art goes there), Shift-click a range, Ctrl/Cmd-click toggles. Sublayers are no longer treated as objects: clicks, marquees, Select All and the Select menu take the art inside them, and each sublayer selects in its own colour. Selection squares on rows with selected art (click selects a row's art, Shift adds or removes; dragging the square moves the selection to another row, Alt copies), the eye and lock on every row with drag-down-the-column (one undo step), Ctrl/Cmd-click an eye for per-layer Outline, Alt-click an eye or lock to hide or lock the other layers (again: show or unlock them all), triangles with Alt to open or close everything inside, drag and drop rows above, below or into layers and groups with a drop line (Alt copies) and a dimmed copy of the row under the pointer (layers dropped in the empty space under the last row go below the bottom layer, #2260; dropped on the trash rows are deleted, on New Layer duplicated, as in Illustrator), inline rename, Delete key on highlighted rows. Buttons and the full panel menu: New Layer/Sublayer (Alt: options, Ctrl: on top), Duplicate, Delete, Options for Selection, clipping mask, isolation, Locate Object, Merge Selected, Flatten Artwork, Collect in New Layer, Release to Layers (Sequence and Build), Reverse Order, Template, Hide/Outline/Lock Others and Show/Preview/Unlock All, Paste Remembers Layers, Panel Options (row size, thumbnails per kind, Show Layers Only). Layer Options: name, colour (presets, each with a chip of its colour, or custom), Template, Lock, Show, Print, Preview (outline drawing and clicking) and Dim Images to %. Every operation is a command (`layer.move`, `layer.highlight`, `layer.merge`…) with validation against cycles and invalid nesting. A document opens with only its top-level layers open; the rows left open are saved in the native file (nothing is written for the default) and reopen that way. Only the rows scrolled into view are laid out, from a row list made once per change: a layer of 5,000 groups of 10 paths, all open, draws the panel in 0.4 ms a frame instead of about 29 s (#638).
With Paste Remembers Layers on, art copied from a sublayer pastes back into that sublayer, as [the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=223) describes art going back to the layer it was copied from: in the same document while the sublayer is still there, two sublayers of the same name in different layers kept apart; in another document by the names of the sublayer and the layers around it. These rules are VectorCraft's own: a missing sublayer is made inside its layer (a missing layer on top, with the sublayer inside it), in the paste's one undo step; of layers with the same names, the topmost chain that matches the most names wins, a shown and unlocked one first; a matched layer that is hidden or locked, or inside one that is, refuses the paste, and nothing is pasted.
The Filter button at the right of Search All keeps the rows that are of an object kind ticked under By Object (paths, shapes, text, images, effects, groups, linked files, guides) and in a state ticked under By Layer (locked, hidden), with the rows that hold them; a section with nothing ticked takes every row. The filter combines with the search, the button is lit while a filter is on, and Clear All in its popup turns the filter off (`ui.layersFilter`). The filter lasts the session.
The panel menu's Save Selection submenu has Save Selection…, Update Selection and Edit Selection…, enabled and run as in the Select menu, and lists the document's saved selections: choosing one selects its objects again (`select.recall`).
Deleting rows from the Layers panel (the trash button, rows dragged onto it, the panel menu's Delete Selection, and Delete or Backspace on highlighted rows) asks "Delete this layer and its artwork?" when a layer or sublayer among them holds art, hidden, locked and nested art included, and "Delete the selected items and their artwork?" when several rows are deleted; OK deletes the rows it asked about in one undo step, and Cancel keeps them (`ui.layerDelete`). The help page's shortcut list names the Layers panel as the place where deleting asks for confirmation ([Default keyboard shortcuts](https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html)). An empty layer, a layer with only guides, and groups or objects alone are deleted without a question, and `layer.delete` itself does not ask (`panels::layers` tests `deleting_a_layer_that_holds_art_asks_first`, `delete_selection_asks_only_for_layers_with_art`).
@@ -1157,6 +1162,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
With the view rotated, an Escape that has nothing else to end resets the rotation, as Reset Rotate View does, with or without a selection, which stays selected. An Escape that ends something else ends only that, and the next Escape resets the view: to reset the view while another tool or feature is in use, Escape is pressed twice ([Rotate canvas view](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/start-a-new-file/rotate-canvas-view.html)). Under VectorCraft's own rule, the things an Escape ends first are isolation mode, pattern editing, Global Edit, a tool flyout, a full screen mode, Presentation Mode, a path being drawn with the Pen, Smart Pen or Curvature tool, the Blend tool's first pick, the Artboard tool, a tool's drag, a menu, a dialog, a text field and a drag of the ruler origin, and the second press may come any time later, after clicks or other keys. With the Rotate View tool, the view resets before a full screen mode ends; with another tool, Escape leaves a full screen mode first, and Shift+Escape, which does not leave it, resets the view. An Escape does not reset the view while About, a progress window or an Appearance row's popup is open, while a pointer button is held, or in the frame a button is let go. It used to reset the view only as the second of two Escape presses less than a second apart.
A two-finger rotation on a Mac trackpad turns the view about the pointer once it reaches 5° (Preferences › General › Trackpad Gesture to Rotate View, on by default).
On a touch screen a second finger cancels the tool press the first finger began, in the frame it lands or later: the Pencil's stroke or a Selection move is rolled back with no undo entry, and a finger that lands while another is down presses nothing, so a pinch or two-finger pan only zooms and pans (#4198; canvas test `a_second_finger_cancels_the_tool_gesture_the_first_began`).
In the Touch workspace a two-finger tap switches between the Selection tool and the drawing tool chosen last (the Pencil tool when none has been chosen yet) and undoes nothing; outside Touch it still undoes, and a three-finger tap still redoes ([the help page](https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/touch-workspace-in-illustrator.html); `tool.toggleTouchMode`; canvas test `two_finger_tap_in_touch_switches_selection_and_drawing_modes`).
A tool press dropped by a second finger, a long touch or a canceled touch cancels the tool's drag as Escape does: the tool gets back the options it had when the press began (the Polygon tool's sides, set with ↑ and ↓) and they are not stored, a press held still opens no size dialog, a Selection or Artboard tool marquee selects nothing, and the Pen goes on drawing its path without the dropped anchor (canvas tests `a_canceled_touch_drops_the_drag_without_keeping_its_options` and `long_touch_drops_a_tool_press_without_committing_art`; engine tests in `tests::toolsettings`).
The status bar navigator's field shows the active artboard's number and name, and its drop-down lists every artboard by number and name, as the Artboards panel does. Choosing an artboard in the list makes it the active artboard and fits it in the window (`view.goToArtboard`). The list opens on the active artboard's row and lays out only the rows in view and at most one more.
- **Geometry and effects:**
@@ -1172,6 +1178,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- 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)).
- Extrude & Bevel and Inflate build detailed shapes: each solid takes up to 65,536 outline points and 163,840 faces (VectorCraft's own limits, was 2,048 points and 32,768 faces), counted before any point is sampled; when the faces do not fit, every curve takes fewer pieces, down to 4. A closed path of 2,000 curves extrudes with a bevel and inflates, and paths of 5,000 and 10,000 curves build at the default settings (`crates/three-d/src/solid/tests_limits.rs`).
- The solids of one Extrude & Bevel (both kinds) or Inflate effect on one object, its fill's, its strokes' and a group's members' together, keep up to 163,840 faces (VectorCraft's own limit). Each solid is built in turn; once their faces pass the limit, no later solid is built, the object draws its source art, and applying or editing the effect, Export 3D Object and Expand as Wireframes report that the 3D surface is too complex. Tests `solids::tests::an_objects_solids_count_their_faces_together`, `a_groups_solids_together_past_the_limit_draw_the_source`, `a_fill_and_strokes_together_past_the_limit_draw_the_source`.
- Extrude & Bevel (both kinds) and Rotate keep the art's curves in the faces they draw, export and expand: caps and the edges of walls and bevels where they meet a cap are cubics with smooth anchors where the art's are, fitted within 0.001 pt in perspective and within the sampling tolerance on a bevel's inset. An edge of a twisted wall that is cut into pieces, a piece of curve that does not fit after 8 halvings, and the curves past 1,048,576 for one solid stay straight (VectorCraft's own values; [three-d.md](three-d.md#what-differs-from-the-public-documentation)). Tests `solid::tests::a_cap_keeps_the_curves_of_the_art`, `a_cap_in_perspective_fits_the_projected_curves`, `a_beveled_cap_and_its_walls_share_their_curves`, `twisted_beveled_tiny_and_degenerate_caps_keep_their_curves`.
- Export 3D Object (Asset Export's menu): an object with Extrude & Bevel, Revolve, Inflate or Rotate becomes a 3D asset whose Format is USDA (the default), USDZ, glTF or OBJ, and Export writes each of its solids as a mesh with a material in its paint's color (`assets.add3D`, `assets.set3DFormat`, `assets.export3D`; [export 3D vector artwork](https://helpx.adobe.com/illustrator/desktop/special-effects-styles/create-3d-graphics/export-3d-vector-artwork.html)).
- 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)).
@@ -1215,7 +1222,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
- **Find Font: Replace With Font From:** a dropdown under Replace With Font chooses the list the replacement font comes from: Document lists the families the document uses, once each; Recent lists the recently applied families that are installed (fonts applied with Find Font's Change and Change All included), newest first, as many as Preferences › Type › Number of Recent Fonts allows; System, the default, lists the installed families available in the font menu. The dialog opens on System with Source Sans 3 chosen, or the font menu's first family when Source Sans 3 is not installed. Choosing a list keeps the chosen font when the list has it and it is installed; otherwise Document and Recent choose the list's first installed font, and System chooses Source Sans 3 or the font menu's first family. Change and Change All are unavailable when the list has no installed font (Recent before any font was applied) and when the chosen family is not installed or is not in the shown list. Behavior reference: [Find and replace fonts](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/find-and-replace-fonts.html) (public documentation). Tests: `crates/ui-egui/src/find_font.rs`.
- **Select Text by Font: scope (a VectorCraft addition, #5529):** `select.font` takes `scope`: `"document"` (the default, as before), `{artboards: [index, …]}` or `{layers: [id, …]}` (sublayers included). On an artboard means what All on Active Artboard takes (the bounds overlap it or the center is on it; one shared test, `select::on_artboard`); hidden and locked text stays out as before; a symbol instance counts where the instance is. Type › Find Font…'s Find In dropdown passes the active artboard or the selected layers (else the current layer). Tests: `crates/engine/src/cmd/fonts.rs`, `crates/ui-egui/src/find_font.rs`, `crates/engine/tests/command_sweep.rs`.
- **Find Font: type in opacity masks and pattern swatches:** Type › Find Font…'s Document list (`text.fonts`), Find (`select.font`), Change and Change All (`text.replaceFont`), Replace Missing Fonts (`addon.cleanup.replaceFonts`), the Missing Fonts dialog (`text.missingFonts`), Document Info's Fonts and Font Details for the whole document (`document.info`), File › Package and the export warning about fonts that aren't available include the type in opacity masks (on objects and layers, disabled masks and masks inside mask, symbol or pattern art included) and in the art of pattern swatches, also a swatch that nothing paints with. A pattern's type is listed and changed once, however many objects the pattern paints. Find selects the objects whose mask holds the font, the text whose inline graphics draw a symbol whose art uses it, and the objects painted with a pattern whose art uses it by a visible fill or stroke above 0% opacity (VectorCraft's own rule; a layer's mask and a swatch that nothing paints with select nothing); Change and Change All leave the type in the mask of a hidden or locked object in its font and count it in `skipped`, and Change does the same with the type of a pattern that only hidden or locked selected objects paint with. The help page (https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/find-and-replace-fonts.html) says the Document list holds all the fonts the document uses. Tests: `crates/engine/src/cmd/fonts.rs`, `crates/engine/src/cmd/addons/cleanup/text/tests.rs`, `crates/engine/src/cmd/docinfo.rs`.
- **Mouse wheel over the font family field (#5253):** In the Character and Properties panels and the Control bar, turning the mouse wheel over the closed font family field applies the next family to the selected type (the previous one when turned up), keeping the style when the family has it, else its closest. Each notch is one undo step; leaving the field or Escape keeps the family, and Undo takes it back. The steps use the font menu's order at the first turn and keep it until the pointer leaves the field or the text selection changes, so recent-font updates do not reshuffle later turns. That order follows the menu's saved font filters but ignores its search text, puts recent families first, and stops at the first and last family. A turn with a modifier key is left to the panel and the canvas. Behavior reference: the [Illustrator CS6 reference](https://help.adobe.com/archive/en/illustrator/cs6/illustrator_reference.pdf#page=10) describes editing hovered dropdown controls with the mouse wheel; [Find and apply fonts](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/find-and-apply-fonts.html) names the family field's places. Applying it to the font field, the order, the ends and the undo steps are VectorCraft's own rules. Tests: `crates/ui-egui/src/tests/font_menu.rs`, `crates/ui-egui/src/font_menu/tests.rs`, `crates/ui-egui/tests/font_wheel.rs`.
- **Mouse wheel over the font family field (#5253):** In the Character and Properties panels and the Control bar, turning the mouse wheel over the closed font family field applies the next family to the selected type (the previous one when turned up), keeping the style when the family has it, else its closest. Each notch is one undo step; leaving the field or Escape keeps the family, and Undo takes it back. The steps use the font menu's order at the first turn and keep it until the pointer leaves the field or the text selection changes, so recent-font updates do not reshuffle later turns. That order follows the font filters every font menu shares (one chosen in the Glyphs panel's menu or a dialog's applies too) but ignores its search text, puts recent families first, and stops at the first and last family. A turn with a modifier key is left to the panel and the canvas. Behavior reference: the [Illustrator CS6 reference](https://help.adobe.com/archive/en/illustrator/cs6/illustrator_reference.pdf#page=10) describes editing hovered dropdown controls with the mouse wheel; [Find and apply fonts](https://helpx.adobe.com/illustrator/desktop/design-with-text/fonts-and-scripts/find-and-apply-fonts.html) names the family field's places. Applying it to the font field, the order, the ends and the undo steps are VectorCraft's own rules. Tests: `crates/ui-egui/src/tests/font_menu.rs`, `crates/ui-egui/src/font_menu/tests.rs`, `crates/ui-egui/tests/font_wheel.rs`.
- **Type:** Character size, leading, baseline shift and horizontal-scale controls account for object/group transforms (#1034): exact document-point sizes, mixed-value display and keyboard increments, range edits, resettable horizontal stretch, undo/redo and native save/reopen (`tests_typescale`, Character panel tests). Point size is the transformed em-height axis, independent of glyph ink bounds; affine rotation, reflection and shear are retained. Group scaling still scales text; preserving font sizes is a separate enhancement. Behaviour reference: [Transform text](https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/transform-text.html) (public documentation). Text Wrap, Type on a Path effects (Rainbow/Skew/3D Ribbon/Stair Step/Gravity) and Options (Flip, Align to Path, Spacing; OK keeps the type where it is), type on a path's start, centre and end brackets (Selection and Direct Selection drag them to set where the type runs, slide it along its path and, across the path, flip it: #429), Character and Paragraph Styles (override-preserving redefine), paragraph attributes per paragraph (alignment, indents, spacing, hyphenation, hanging punctuation, tab stops, paragraph style, direction, mojikumi and leading model; the Paragraph, Tabs and Paragraph Styles panels act on the paragraphs the Type tool's selection or caret touches, Return continues the paragraph's style, threads and SVG keep them), Area Type Options (rows/columns/inset/first baseline, Text Flow by rows or by columns (#4978), vertical Align Top/Center/Bottom/Justify per row/column, reflowing non-rectangular frames and text wrap), threaded text across any closed shapes, Fit Headline, the Every-line Composer for justified and ragged text (paragraph-wide breaks for an even rag, Single-line per object from the Paragraph panel menu or `text.setFormat {composer}`). Area type resizes like Illustrator's type areas: a bounding-box handle drag (Selection tool) or Area Type Options Width/Height size the frame and the text reflows at its size (threads too); Direct Selection drags a frame corner or edge (`text.reshapeArea`), and an anchor of the path of type on a path outside perspective, the type reflowing along it (`text.reshapePath`, #3980). Point type still scales. Auto Size: the frame height follows the text after every edit, in the same undo step (rectangular frames of horizontal type in one row; columns get the least height that holds them; a height set by hand or threading turns it off), and the "Auto Size New Area Type" preference gives it to new area type. Shrink Text to Fit (beyond Illustrator): overflowing area type scales its sizes, leading and baseline shifts down by the largest factor (in 0.1 pt steps of the first run, down to a minimum percentage) that fits, at layout time so every export sees it. `text.areaOptions` and `document.inspect` report overflow and the shrink factor. The Selection tool shows the type widget beside selected type's bounding box (hollow on point type, filled on area type); double-clicking it converts between them (Type › Convert To Area Type / Convert To Point Type), keeping the text and its styles in place. Variable fonts list every named instance as a style of their family (Figtree Light to Black and their italics, Bahnschrift, Segoe UI Variable), and the instance chosen is shaped, drawn, outlined and measured at its axis settings; PDF and SVG embed it as that instance. The Character panel's Variable Font sliders set each axis (see Fonts). Beyond Illustrator: inline graphics (`text.insertInline`, Type ▸ Insert Inline Symbol) set a document symbol in a run of type as one character that flows, wraps and justifies like a glyph (InDesign-style inline objects, e.g. mana symbols in card rules text): sized to a multiple of the font size, centred on the cap height, opening up tall lines, following Redefine Symbol; a character of its run's size for Character Alignment and Top-to-Top leading, placed by the bidi reordering in right-to-left text (a neutral U+FFFC); drawn on the canvas, kept as live text plus a `<use>` in SVG and as vector art in PDF; Backspace removes it whole. Hebrew and Arabic are laid out right to left with the Unicode bidirectional algorithm (embedded Latin and numbers keep their direction, lines put in visual order after wrapping) in point, area and path type, with caret, selection and arrow keys in visual order; each paragraph's direction comes from its first strong character unless Paragraph Direction sets it (Paragraph panel with Show Indic Options, `text.setFormat {direction}`), and new type aligns to the start of its direction. SVG export outlines right-to-left text. Arabic typefaces: builds made with a craft-fonts checkout that holds its Arabic families (Noto Sans Arabic, the Arabic fallback, plus Cairo, Tajawal, Almarai, IBM Plex Sans Arabic, Noto Kufi Arabic, Amiri, Alexandria, Fustat, Reem Kufi, Aref Ruqaa and Gulzar once craft-fonts adds them, storytold/craft-fonts#11; reLine truncated
The Character panel menu's Show Font Height Options shows a Set Font Height Reference dropdown under Font Size (`text.setFormat` or `text.setRangeStyle` `{fontHeightReference}`). With Em Box, the default, the font size is the size of the em square; with Cap Height, x-Height or ICF Box, the characters are set at the em size at which the font's OS/2 cap height, its x height or the height of its ideographic character face equals the font size. With a font that has no such value, or one outside 0.1 to 2 em, the size measures the em box. SVG, PDF and legacy `.ai` export and the CSS Properties rules write the em size the characters are drawn at, and DXF export writes 0.7 times that em size as each TEXT entity's height (group 40, the height of its capitals). Behavior reference: [Vary font height](https://web.archive.org/web/20251118174722/https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/vary-font-height.html).
The Every-line Composer composes a paragraph whose characters differ in line metrics (type size, font, leading or vertical scale, or an inline graphic taller than the text) in rectangular area type, rows and columns included. In area type of another shape, or with text wrap, such a paragraph is broken with the Single-line Composer.
@@ -1336,6 +1343,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
Window › Blend exposes easing Type, Ramp and independent color Shift through `object.blend.options`.
Smooth Color counts the steps of each pair of keys from their color change, or from the distance between their visible bounding-box edges when their colors match or they hold gradients or patterns ([Blend Options](https://web.archive.org/web/20241217212108/https://helpx.adobe.com/illustrator/using/blending-objects.html)); the step counts, their caps and the colors compared are VectorCraft's own.
Envelope Options › Anti-Alias off draws an envelope's distorted images without smoothing, and Preserve Shape Using › Transparency gives each piece of a distorted image an opacity mask in its shape instead of a clipping mask ([Envelope panel options](http://web.archive.org/web/20260513013456/https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/envelope-panel-options.html)).
The Mesh tool and Direct Selection drag the points and handles of an envelope made with Warp, as the help page describes for any envelope ([Distort objects with envelopes](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/distort-objects-with-envelopes.html)). A selected warp shows the points of its surface on 4×4 patches (8×8 or 16×16 where 4×4 draws more than 0.1% of its diagonal away from the warp), and the first edit makes it a mesh envelope on that grid in the same undo step; Undo or Escape gives back the warp with its style and bend. The grid sizes, the 0.1% and the change to a mesh envelope are VectorCraft's own rules. Tests: `every_warp_style_has_a_grid_that_keeps_its_shape` in `crates/doc/src/live/envelope.rs`, `moving_a_warp_point_makes_it_a_mesh_envelope_in_one_step` and `an_edited_warp_saves_resets_releases_and_expands_as_edited` in `crates/engine/src/tests/envelope_edit.rs`, `the_mesh_tool_and_direct_selection_drag_warp_envelope_points` in `crates/tools/src/meshedit.rs`.
With Envelope Options › Distort Appearance on, type's strokes (its characters' and those on its own appearance) paint along the bent glyph outlines at their own weight instead of bending with the art, as the drawn art of users' `.ai` files strokes type in an envelope. This is VectorCraft's own rule from those files: the public page names applied effects and graphic styles, not strokes. This holds in an envelope inside an envelope too. Paths' strokes, geometry effects (type's included), opacity masks (on type too), linear gradients and pattern fills bend as before; Expand gives type's bent outlines with their strokes on them. The visual bounds of envelopes, blends and repeats, and the reach of symbol art, count type's character strokes as type's own visual bounds do (half the weight of a centred stroke); they left them out, though those strokes already painted past an envelope's grid. Envelopes of stroked type made in VectorCraft before this draw their strokes at their own weight now (#6644; `crates/engine/src/tests/envelope_distort.rs`, `crates/effects/src/bake/tests.rs`).
The four polynomial distributions are original approximations of the public description, not measured
numeric parity. See [Blend panel overview](https://helpx.adobe.com/illustrator/desktop/manage-colors/apply-transparency-and-blending/blend-panel-overview.html).
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff. Show more