Merge remote-tracking branch 'origin/main' into HEAD

# Conflicts:
#	docs/gaps.md
#	docs/target-app-parity.md
This commit is contained in:
Taha-Mahmoodi
2026-11-15 11:21:06 +04:30
17 changed files with 603 additions and 47 deletions
+2 -1
View File
@@ -2,7 +2,7 @@
**Stage: alpha** · next: beta, ~13 points (ready for real work ~62% → ~75%, and reliable `.ai` exchange) and ~170–270 h away
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-14 · **Change:** minor (Tech Circuit brush library, G5; previously: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: Raster effects 85% → 88%, gallery thumbnails and in-dialog preview in; headline numbers unchanged; Symbols area ~87% → ~88%: dynamic instance parts take opacity, blend, gradient and pattern on the canvas; G5 docs sync for Overlap and Pattern auto corners; previously minor: Tools stays beside the canvas with left-side panels; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-15 · **Change:** minor (G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); G5 estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: Raster effects 85% → 88%, gallery thumbnails and in-dialog preview in; headline numbers unchanged; Symbols area ~87% → ~88%: dynamic instance parts take opacity, blend, gradient and pattern on the canvas; G5 docs sync for Overlap and Pattern auto corners; previously minor: Tools stays beside the canvas with left-side panels; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Compound Shapes add-on, beyond Illustrator; scores and estimates unchanged; Contour add-on, beyond Illustrator; scores and estimates unchanged; new gradients follow document color mode; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
VectorCraft is a clean-room, open-source, pure-Rust reimplementation of the Adobe Illustrator workflow. It runs
on macOS, Windows, Linux, FreeBSD and the web (WASM), and agents can drive all of it over MCP, the CLI and a JSON
@@ -225,6 +225,7 @@ The full earlier record of what landed is kept in [docs/roadmap.md](docs/roadmap
| Date | Change | Summary |
|---|---|---|
| 2026-11-15 | minor | Graphic Styles: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); G5 estimate unchanged (3–13 h). |
| 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. |
| 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. |
| 2026-11-10 | minor | Tidy-up, no content change: the unheaded change bullets at the top of the file and a revision row inside the headline-numbers table move to this table under their commit dates. Scores and estimates unchanged. |
+71
View File
@@ -162,6 +162,7 @@ pub const STYLE_LIBRARIES: &[BuiltinStyleLibrary] = &[
BuiltinStyleLibrary { id: "blends-transparency", name: "Blends and Transparency", make: blends_transparency },
BuiltinStyleLibrary { id: "game-hud", name: "Game HUD", make: game_hud },
BuiltinStyleLibrary { id: "status-effects", name: "Status Effects", make: status_effects },
BuiltinStyleLibrary { id: "neon-glow", name: "Neon & Glow", make: neon_glow },
];
/// Built-in library `id`, made once.
@@ -619,6 +620,44 @@ fn status_effects() -> Vec<GraphicStyle> {
]
}
/// Neon & Glow: original multi-layer procedural styles with neon tubes, laser beams, and glowing halos.
fn neon_glow() -> Vec<GraphicStyle> {
vec![
style(
"Cyan Neon",
vec![S(StrokeLayer { opacity: 0.7, ..round("#00e5ff", 6.0) }), S(round("#ffffff", 1.5))],
vec![fx("stylize.dropShadow", json!({"mode": "screen", "opacity": 85.0, "x": 0.0, "y": 0.0, "blur": 8.0, "color": "#00e5ff"}))],
),
GraphicStyle {
blend: BlendMode::Screen,
..style(
"Magenta Laser",
vec![S(StrokeLayer { blend: BlendMode::Screen, ..round("#ff007f", 5.0) }), S(round("#ffffff", 1.5))],
vec![fx("stylize.outerGlow", json!({"mode": "screen", "opacity": 90.0, "blur": 8.0, "color": "#ff007f"}))],
)
},
style(
"Amber Tube",
vec![S(StrokeLayer { opacity: 0.8, ..round("#ff8c00", 6.0) }), S(round("#ffea00", 1.5))],
vec![fx("stylize.outerGlow", json!({"mode": "screen", "opacity": 85.0, "blur": 8.0, "color": "#ff8c00"}))],
),
style(
"Electric Lime",
vec![S(StrokeLayer { opacity: 0.75, ..round("#39ff14", 6.0) }), S(round("#ffffff", 1.5))],
vec![fx("stylize.outerGlow", json!({"mode": "screen", "opacity": 90.0, "blur": 8.0, "color": "#39ff14"}))],
),
style(
"Pulse Violet",
vec![S(StrokeLayer { opacity: 0.75, ..round("#7b2cbf", 5.0) }), S(round("#e0aaff", 1.5))],
vec![
fx("stylize.innerGlow", json!({"mode": "screen", "opacity": 75.0, "blur": 6.0, "color": "#c77dff", "source": "edge"})),
fx("stylize.outerGlow", json!({"mode": "screen", "opacity": 85.0, "blur": 8.0, "color": "#7b2cbf"})),
],
),
style("Cobalt Phosphor", vec![S(round("#0047ab", 6.0)), S(round("#ffffff", 1.5))], vec![fx("blur.gaussian", json!({"radius": 2.0}))]),
]
}
#[cfg(test)]
mod tests {
use super::*;
@@ -750,4 +789,36 @@ mod tests {
let Paint::Gradient(gp) = g.appearance.fill_paint() else { panic!("a gradient") };
assert!(gp.swatch.is_none() && gp.gradient.stops.iter().all(|s| s.swatch.is_none() && s.tint == 1.0));
}
#[test]
fn neon_and_glow_styles_are_defined_with_multi_strokes_and_effects() {
let lib = builtin_style_library("neon-glow").expect("neon-glow library exists");
assert_eq!(lib.name, "Neon & Glow");
assert_eq!(lib.len(), 6);
let names: Vec<&str> = lib.styles.iter().map(|g| g.name.as_str()).collect();
assert_eq!(names, ["Cyan Neon", "Magenta Laser", "Amber Tube", "Electric Lime", "Pulse Violet", "Cobalt Phosphor"]);
for g in &lib.styles {
let strokes = g.appearance.items.iter().filter(|i| matches!(i, AppearanceItem::Stroke(_))).count();
assert!(strokes >= 2, "{} has {} strokes, expected >= 2", g.name, strokes);
assert!(!g.appearance.effects.is_empty(), "{} has effects", g.name);
}
let cyan = lib.style("Cyan Neon").unwrap();
assert_eq!(cyan.appearance.effects[0].id, "stylize.dropShadow");
let magenta = lib.style("Magenta Laser").unwrap();
assert_eq!(magenta.blend, BlendMode::Screen);
let pulse = lib.style("Pulse Violet").unwrap();
let pulse_fx: Vec<&str> = pulse.appearance.effects.iter().map(|e| e.id.as_str()).collect();
assert_eq!(pulse_fx, ["stylize.innerGlow", "stylize.outerGlow"]);
let cobalt = lib.style("Cobalt Phosphor").unwrap();
assert_eq!(cobalt.appearance.effects[0].id, "blur.gaussian");
}
#[test]
fn neon_glow_round_trips_through_vcstyles() {
let lib = builtin_style_library("neon-glow").unwrap();
let text = write(&lib);
assert!(sniff(&text));
let read_back = read(&text, "Fallback").unwrap();
assert_eq!(*lib, read_back);
}
}
+6 -1
View File
@@ -27,7 +27,9 @@ use vectorcraft_geom::{Affine, FillRule, PathData, Rect, Vec2};
use crate::distort::{transform_move, transform_offsets};
use crate::group::{has_own_paint, paints};
use crate::reshape::{as_art, clipping_text_outline, dressed, geometry_effects, glyph_outlines, outline_nested_text, reshape_leaves};
use crate::reshape::{
as_art, clipping_text_outline, dressed, geometry_effects, glyph_outlines, outline_nested_text, paint_type_clip, reshape_leaves,
};
use crate::{
GeomContext, adjust_in_document, apply_geometry_carrying, crop_marks_art, evaluate_container, has_adjustment, has_crop_marks, has_geometry,
has_instance_row_raster, has_item_geometry, has_pathfinder, is_pathfinder, merged_params, needs_outline, reshape,
@@ -689,6 +691,9 @@ fn moved_type_group(n: &Node) -> Option<Node> {
/// them. `None` when no type stays type.
fn container_keeping_type(d: &Document, n: &Node) -> Option<Node> {
fn keep(d: &Document, n: &mut Node, moves: &[serde_json::Value], clipping: bool, kept: &mut bool) {
if !clipping {
paint_type_clip(Some(d), n);
}
let clips = n.clips();
let Some(ch) = n.children_mut() else { return };
for (i, c) in ch.iter_mut().enumerate() {
+36 -2
View File
@@ -746,9 +746,13 @@ pub(crate) fn clipping_text_outline(t: &Node) -> Option<Node> {
/// Replace type anywhere inside `n` by its outlines, as art that keeps the type's look
/// ([`as_art`]). Type in a clip group's clipping path (all of `n` when `clipping` is set) becomes
/// its outlines with its visibility and effects ([`clipping_text_outline`]). The swatches and
/// patterns that live-effect plug-ins painting their pieces name are looked up in `doc`.
/// its outlines with its visibility and effects ([`clipping_text_outline`]), and its fills and
/// strokes become art of their own ([`paint_type_clip`]). The swatches and patterns that
/// live-effect plug-ins painting their pieces name are looked up in `doc`.
pub(crate) fn outline_nested_text(doc: Option<&Document>, n: &mut Node, clipping: bool) {
if !clipping {
paint_type_clip(doc, n);
}
let clips = n.clips();
let Some(ch) = n.children_mut() else { return };
for (i, c) in ch.iter_mut().enumerate() {
@@ -766,6 +770,36 @@ pub(crate) fn outline_nested_text(doc: Option<&Document>, n: &mut Node, clipping
}
}
/// When `n` is a clip group or clipping layer whose clipping path is type that paints
/// ([`Node::clip_paint`]), make it the art the canvas draws for it: the type's outlines clip
/// ([`clipping_text_outline`]), its fills as art ([`as_art`]) paint behind the clipped art inside
/// the clip, and its strokes as art paint over it, outside the clip, in a group that `n` becomes
/// (keeping its id, name and transparency) with the clip group inside. The other members stay as
/// they are. Hidden type paints nothing.
pub(crate) fn paint_type_clip(doc: Option<&Document>, n: &mut Node) {
let Some((first, rest)) = n.children().and_then(|ch| ch.split_first()) else { return };
if !n.clips() || !matches!(first.kind, NodeKind::Text(_)) || !first.visible {
return;
}
let paint = first.clip_paint();
if paint.fill.is_none() && paint.stroke.is_none() {
return;
}
let Some(clip) = clipping_text_outline(first) else { return };
let art = |part: Option<Node>| part.and_then(|p| as_art(doc, &p, None)).map(Arc::new);
let members: Vec<Arc<Node>> = std::iter::once(Arc::new(clip)).chain(art(paint.fill)).chain(rest.iter().cloned()).collect();
let stroke = art(paint.stroke);
let id = n.id;
match (&mut n.kind, stroke) {
(NodeKind::Group { children, .. } | NodeKind::Layer { children, .. }, None) => *children = members,
(NodeKind::Group { children, clip } | NodeKind::Layer { children, clip, .. }, Some(stroke)) => {
*children = vec![Arc::new(Node::new(id, NodeKind::Group { children: members, clip: true })), stroke];
*clip = false;
}
_ => {}
}
}
/// `n` (see [`needs_outline`]) with its object-level geometry effects and its perspective applied:
/// its [`outline_art`] reshaped as one piece, or for an image the image clipped by its reshaped
/// frame. Type's own fills and strokes keep their effects on its whole outline. An image's own
+24 -2
View File
@@ -386,10 +386,32 @@ fn replacing_a_clipped_psd_keeps_its_scale() {
assert_eq!((r["width"].as_f64(), r["height"].as_f64()), (Some(200.0), Some(100.0)), "{r}");
let (anchors, _, _) = clip_group(&s.doc().unwrap().doc, NodeId(r["ids"][0].as_u64().unwrap()));
assert_eq!(anchors, [[200.0, 150.0], [300.0, 250.0], [100.0, 250.0]]);
// Other art replacing the clip group takes its centre only, as before.
// A plain image replacing the clip group keeps its scale too.
let plain = vectorcraft_format::base64_encode(&red_psd(&[]));
let r = s.execute("file.place", &json!({"name": "plain.psd", "dataBase64": plain, "replace": true})).unwrap();
assert_eq!((r["width"].as_f64(), r["height"].as_f64()), (Some(100.0), Some(50.0)), "{r}");
assert_eq!((r["width"].as_f64(), r["height"].as_f64()), (Some(200.0), Some(100.0)), "{r}");
}
/// A plain image replacing a clipped PSD file takes the clipped image's scale and rotation.
#[test]
fn a_plain_image_replacing_a_clipped_psd_keeps_its_rotation() {
let data = vectorcraft_format::base64_encode(&red_psd(&triangle_resources()));
let plain = vectorcraft_format::base64_encode(&red_psd(&[]));
let mut s = Session::new();
s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap();
let r = s.execute("file.place", &json!({"name": "cut.psd", "dataBase64": data, "at": [200, 200]})).unwrap();
let group = NodeId(r["ids"][0].as_u64().unwrap());
s.execute("object.scale", &json!({"sx": 200, "sy": 150})).unwrap();
s.execute("object.rotate", &json!({"angle": 30})).unwrap();
let xf = |s: &Session, id: NodeId| match s.doc().unwrap().doc.node(id).map(|n| &n.kind) {
Some(NodeKind::Image(im)) => im.xf.as_coeffs(),
other => panic!("not an image: {other:?}"),
};
let (_, _, image) = clip_group(&s.doc().unwrap().doc, group);
let before = xf(&s, image);
let r = s.execute("file.place", &json!({"name": "plain.psd", "dataBase64": plain, "replace": true})).unwrap();
let after = xf(&s, NodeId(r["ids"][0].as_u64().unwrap()));
assert!(after.iter().zip(before).all(|(a, b)| (a - b).abs() < 1e-9), "{after:?} != {before:?}");
}
#[test]
+7 -7
View File
@@ -495,14 +495,14 @@ fn at_param(p: &Value) -> Result<Option<Point>> {
/// The transform that puts new art with the natural box `natural` where `old` is: an image's scale
/// and rotation relative to its 100% size (its resolution's) and its centre are kept (with
/// `image_xf`), also for an image alone in a clip group when the new art is an image clipped by
/// its file's clipping path (`clipped`); other objects keep their centre.
fn replace_xf(d: &Document, old: &Node, natural: Rect, image_xf: bool, clipped: bool) -> Affine {
/// `image_xf`), also for an image alone in a clip group when the new art is an image, clipped by
/// its file's clipping path or not (`new_image`); other objects keep their centre.
fn replace_xf(d: &Document, old: &Node, natural: Rect, image_xf: bool, new_image: bool) -> Affine {
// An image alone in a clip group (as a PSD or PSB file's clipping path places it,
// [`fileio::file_clipped`]) is measured as the image when the new art brings its own clip
// group; a DCS file's plates are not.
// [`fileio::file_clipped`]) is measured as the image when the new art is an image; a DCS
// file's plates are not.
let image = match &old.kind {
NodeKind::Group { children, clip: true } if clipped => match &children[..] {
NodeKind::Group { children, clip: true } if new_image => match &children[..] {
[path, image] if matches!(path.kind, NodeKind::Path { clipping: true, .. }) => match &image.kind {
NodeKind::Image(im) if d.images.get(&im.key).is_none_or(|b| b.separated().is_none()) => image,
_ => old,
@@ -681,7 +681,7 @@ fn apply(s: &mut Session, read: PlaceRead) -> Result<Value> {
}
let natural = loaded.natural;
let m = match (old_node, rect) {
(Some(o), _) => replace_xf(&st.doc, o, natural, !is_text, matches!(loaded.art, Art::Image(_, Some(_)))),
(Some(o), _) => replace_xf(&st.doc, o, natural, !is_text, matches!(loaded.art, Art::Image(..))),
(None, Some(r)) => fit(natural, r),
// Its artboard's bottom-left corner on the target's.
(None, None) if let (Some(src), Some(to)) = (loaded.board, target) => Affine::translate((to.x0 - src.x0, to.y1 - src.y1)),
+57
View File
@@ -84,6 +84,63 @@ fn release_and_ungroup_keep_the_clipping_paths_paint() {
}
}
/// Pixels of `doc` rendered on white that are mostly blue and mostly green.
fn blue_and_green(doc: &Document) -> (usize, usize) {
let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() };
let r = Renderer::new().render(doc, 200, 200, Affine::IDENTITY, &opts);
let (mut blue, mut green) = (0, 0);
for y in 0..200 {
for x in 0..200 {
let p = r.pixel(x, y);
blue += usize::from(p[2] > 200 && p[0] < 60 && p[1] < 60);
green += usize::from(p[1] > 200 && p[0] < 60 && p[2] < 60);
}
}
(blue, green)
}
#[test]
fn painted_type_clipping_inside_a_group_with_geometry_effects_keeps_its_paint() {
// The canvas and the SVG and PDF output paint the type's fill and stroke as they did before
// the effect. Type that stays type beside the clip group takes the second Transform case
// through baking that keeps type.
let cases =
[("distort.transform", json!({"moveH": 5}), false), ("distort.transform", json!({"moveH": 5}), true), ("distort.roughen", json!({}), false)];
for (effect, params, other_type) in cases {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 200, "height": 200})).unwrap();
rect(&mut s, 0.0, 30.0, "#ff0000");
let t = NodeId(s.execute("text.create", &json!({"x": 10, "y": 120, "text": "Clip", "size": 72})).unwrap()["id"].as_u64().unwrap());
s.execute("select.all", &json!({})).unwrap();
let clip = NodeId(s.execute("object.clippingMask.make", &json!({})).unwrap()["id"].as_u64().unwrap());
s.execute("paint.setFill", &json!({"color": "#0000ff", "ids": [t.0]})).unwrap();
s.execute("paint.setStroke", &json!({"color": "#00ff00", "ids": [t.0]})).unwrap();
s.execute("stroke.set", &json!({"weight": 2, "ids": [t.0]})).unwrap();
let before = blue_and_green(&s.doc().unwrap().doc);
let mut ids = vec![clip.0];
if other_type {
ids.push(s.execute("text.create", &json!({"x": 10, "y": 190, "text": "x", "size": 10})).unwrap()["id"].as_u64().unwrap());
}
let group = NodeId(s.execute("object.group", &json!({"ids": ids})).unwrap()["id"].as_u64().unwrap());
s.execute("effect.apply", &json!({"effect": effect, "params": params, "ids": [group.0], "item": null})).unwrap();
let doc = s.doc().unwrap().doc.clone();
let (blue, green) = blue_and_green(&doc);
assert!(
blue * 2 > before.0 && green * 2 > before.1,
"{effect} {other_type}: the canvas paints the type's fill and stroke: {blue} {green}, {before:?} before"
);
let svg = vectorcraft_svg::export(&doc, &Default::default());
let pdf = vectorcraft_pdf::export(&doc, &Default::default()).unwrap();
for (what, out) in [("SVG", vectorcraft_svg::import(&svg).unwrap()), ("PDF", vectorcraft_pdf::import(&pdf).unwrap())] {
let (b, g) = blue_and_green(&out);
assert!(
b.abs_diff(blue) * 10 < blue && g.abs_diff(green) * 5 < green,
"{effect} {other_type}, {what}: {b} {g} against the canvas's {blue} {green}"
);
}
}
}
#[test]
fn type_as_a_clipping_path_paints_its_characters() {
let mut s = Session::new();
+54
View File
@@ -45,6 +45,7 @@ fn builtin_libraries_are_listed_with_original_styles_using_catalogued_effects()
assert!(libs.iter().any(|l| l["id"] == "game-hud" && l["name"] == "Game HUD"), "{libs:?}");
assert!(libs.iter().any(|l| l["id"] == "status-effects" && l["name"] == "Status Effects"), "{libs:?}");
assert!(libs.iter().any(|l| l["id"] == "textures" && l["name"] == "Textures" && l["count"] == 8), "{libs:?}");
assert!(libs.iter().any(|l| l["id"] == "neon-glow" && l["name"] == "Neon & Glow" && l["count"] == 6), "{libs:?}");
for l in libs {
let id = l["id"].as_str().unwrap();
let g = run(&mut s, "graphicStyle.library", json!({"library": id}));
@@ -69,6 +70,9 @@ fn builtin_libraries_are_listed_with_original_styles_using_catalogued_effects()
let texture_names: Vec<&str> = textures["styles"].as_array().unwrap().iter().map(|x| x["name"].as_str().unwrap()).collect();
let expected = ["Fine Grain", "Canvas Weave", "Burlap Sack", "Cracked Glaze", "Mosaic Floor", "Quilted Squares", "Leaded Glass", "Damp Paper"];
assert_eq!(texture_names, expected);
let neon = run(&mut s, "graphicStyle.library", json!({"library": "neon-glow"}));
let neon_names: Vec<&str> = neon["styles"].as_array().unwrap().iter().map(|x| x["name"].as_str().unwrap()).collect();
assert_eq!(neon_names, ["Cyan Neon", "Magenta Laser", "Amber Tube", "Electric Lime", "Pulse Violet", "Cobalt Phosphor"]);
let id = rect(&mut s, 10.0, 20.0, 40.0, 30.0);
let r = run(&mut s, "graphicStyle.addFromLibrary", json!({"library": "game-hud", "name": "Mana Glow", "apply": true, "ids": [id.0]}));
assert_eq!((names(&r["added"]), r["applied"].as_str()), (vec!["Mana Glow"], Some("Mana Glow")));
@@ -419,3 +423,53 @@ fn every_builtin_style_paints_visibly_on_a_rectangle() {
}
}
}
#[test]
fn neon_and_glow_library_adds_and_applies_multi_stroke_styles() {
let mut s = session();
let list = run(&mut s, "graphicStyle.libraries", json!({}));
let libs = list["libraries"].as_array().unwrap();
let at = libs.iter().position(|l| l["id"] == "neon-glow").expect("neon-glow listed");
assert_eq!(libs[at]["name"], "Neon & Glow");
assert_eq!(libs[at]["count"], 6);
let (_, lib) = cmd::stylelib::library(&s, "neon-glow").unwrap();
assert_eq!(lib.len(), 6);
let want = [
("Cyan Neon", 2, "stylize.dropShadow"),
("Magenta Laser", 2, "stylize.outerGlow"),
("Amber Tube", 2, "stylize.outerGlow"),
("Electric Lime", 2, "stylize.outerGlow"),
("Pulse Violet", 2, "stylize.innerGlow"),
("Cobalt Phosphor", 2, "blur.gaussian"),
];
for (i, (name, stroke_count, first_effect)) in want.iter().enumerate() {
let id = rect(&mut s, 10.0 + 30.0 * i as f64, 15.0, 25.0, 25.0);
let before_undo = undo_len(&s);
let r = run(&mut s, "graphicStyle.addFromLibrary", json!({"library": "neon-glow", "name": name, "apply": true, "ids": [id.0]}));
assert_eq!((names(&r["added"]), r["applied"].as_str()), (vec![*name], Some(*name)));
assert_eq!(undo_len(&s), before_undo + 1, "{name}");
let node = doc(&s).node(id).unwrap();
let strokes = node.appearance.items.iter().filter(|it| matches!(it, vectorcraft_doc::AppearanceItem::Stroke(_))).count();
assert_eq!(strokes, *stroke_count, "{name}");
assert_eq!(node.appearance.effects[0].id, *first_effect, "{name}");
}
// Adding existing style dedupes and creates no new undo step.
let before = (undo_len(&s), doc(&s).graphic_styles.len());
let r = run(&mut s, "graphicStyle.addFromLibrary", json!({"library": "neon-glow", "name": "Cyan Neon"}));
assert_eq!((names(&r["added"]), names(&r["existing"])), (vec![], vec!["Cyan Neon"]));
assert_eq!((undo_len(&s), doc(&s).graphic_styles.len()), before);
// Round-trip through serialize / open
let b64 = run(&mut s, "document.serialize", json!({}))["dataBase64"].as_str().unwrap().to_string();
run(&mut s, "document.open", json!({"name": "neon.vectorcraft", "dataBase64": b64}));
for (name, _, _) in want {
let d = doc(&s);
let st = d.graphic_style(name).unwrap();
assert!(st.same_look(lib.style(name).unwrap()), "{name}");
}
}
+42 -9
View File
@@ -758,7 +758,15 @@ struct Ctx {
/// The path each `<textPath>` read so far follows ([`Self::text_path`]); `None` where it has
/// no usable one. The styles of a `<use>` instance share it, so each path is found and parsed
/// once however many `<use>` elements show its text.
paths: Rc<RefCell<HashMap<roxmltree::NodeId, Option<Rc<BezPath>>>>>,
paths: Rc<RefCell<HashMap<roxmltree::NodeId, Option<Rc<FollowedPath>>>>>,
}
/// The path a `<textPath>` follows ([`Ctx::text_path`]).
struct FollowedPath {
path: BezPath,
/// The `pathLength` of the element the `<textPath>` points at, 0 or greater; `None` when the
/// `<textPath>` has its own `path` or the element has no such value.
author_length: Option<f64>,
}
#[cfg(test)]
@@ -1172,7 +1180,7 @@ impl Ctx {
/// The path a `<textPath>` follows, in the text's user space. It is read from the file once
/// ([`Self::paths`]).
fn text_path(&self, xml: &roxmltree::Document, tp: XNode) -> Option<Rc<BezPath>> {
fn text_path(&self, xml: &roxmltree::Document, tp: XNode) -> Option<Rc<FollowedPath>> {
if let Some(known) = self.paths.borrow().get(&tp.id()) {
return known.clone();
}
@@ -1184,13 +1192,14 @@ impl Ctx {
/// How many elements the path of `<textPath>` `tp` has, when a text built so far follows it
/// ([`Self::text_path`]); 0 for any other node.
fn path_elements(&self, tp: XNode) -> usize {
self.paths.borrow().get(&tp.id()).and_then(|p| p.as_deref()).map_or(0, |p| p.elements().len())
self.paths.borrow().get(&tp.id()).and_then(|p| p.as_deref()).map_or(0, |p| p.path.elements().len())
}
/// Find and parse the path `<textPath>` `tp` follows.
fn read_text_path(&self, xml: &roxmltree::Document, tp: XNode) -> Option<BezPath> {
fn read_text_path(&self, xml: &roxmltree::Document, tp: XNode) -> Option<FollowedPath> {
#[cfg(test)]
TEXT_PATH_READS.set(TEXT_PATH_READS.get() + 1);
let mut author_length = None;
let mut bp = match tp.attribute("path") {
Some(d) => BezPath::from_svg(d).ok()?,
None => {
@@ -1202,6 +1211,8 @@ impl Ctx {
};
let mut bp = BezPath::from_svg(&d).ok()?;
bp.apply_affine(parse_transform(el.attribute("transform")));
author_length =
el.attribute("pathLength").and_then(|v| v.trim().parse::<f64>().ok()).filter(|l| l.is_finite() && *l >= 0.0).map(f64::abs);
bp
}
};
@@ -1209,7 +1220,7 @@ impl Ctx {
bp = bp.reverse_subpaths();
}
let usable = bp.segments().next().is_some();
usable.then_some(bp)
usable.then_some(FollowedPath { path: bp, author_length })
}
/// The equivalent path of a basic shape (SVG 2 › Basic Shapes), as path data: what a
@@ -1458,7 +1469,8 @@ impl Ctx {
let mut obj = TextObject::point(Point::ZERO, "", CharStyle::default());
let mut breaks: Vec<Break> = vec![];
let mut para_styles: Vec<ParaStyle> = vec![];
if let Some((tp, bp)) = path {
if let Some((tp, followed)) = path {
let bp = &followed.path;
// Along the path: dx is extra advance, dy shifts off the path.
let mut off = 0.0;
for i in 0..n {
@@ -1470,13 +1482,34 @@ impl Ctx {
}
let len: f64 = bp.segments().map(|s| s.arclen(1e-4)).sum();
let em = self.font_size(tp);
let offset = tp.attribute("startOffset").and_then(|v| self.length(v, em, len)).unwrap_or(0.0) + dx[0];
// `startOffset` as a share of the path's length. A percentage is of the path's computed
// length. Any other length is in the units of the referenced element's `pathLength`
// when it has one, and a `pathLength` of 0 puts any offset other than 0 infinitely far
// along (SVG 2 › Paths › The pathLength attribute). An offset infinitely far along
// starts as far past the path's end, or before its start, as type may go.
let share = tp
.attribute("startOffset")
.and_then(|v| {
let o = self.length(v, em, len)?;
let share = match followed.author_length {
Some(p) if !v.trim().ends_with('%') => {
if o == 0.0 {
0.0
} else {
o / p
}
}
_ => o / len,
};
Some(if share.is_infinite() { vectorcraft_doc::PATH_LEAD_MAX.copysign(share) } else { share })
})
.unwrap_or(0.0);
let width = if anchor > 0.0 { advance(&point_text(&cells)) } else { 0.0 };
// On a path of one closed subpath, text that starts before the path's start or past its
// end wraps around the path. On an open path text may start before the path's start,
// and its characters before the start are not drawn; text that starts past the end
// starts at the end. Other paths start it at the path's start or end.
let path = PathData::from_bezpath(&bp);
let path = PathData::from_bezpath(bp);
let wraps = path.subpaths.len() == 1 && path.is_closed();
let open = !path.is_closed();
let wrap = |s: f64| {
@@ -1484,7 +1517,7 @@ impl Ctx {
let s = s.rem_euclid(1.0);
if s < 1.0 { s } else { 0.0 }
};
let start = Some((offset - anchor * width) / len).filter(|s| s.is_finite()).map_or(0.0, |s| {
let start = Some(share + (dx[0] - anchor * width) / len).filter(|s| s.is_finite()).map_or(0.0, |s| {
if wraps {
wrap(s)
} else if open {
+5
View File
@@ -21,4 +21,9 @@ fn uses_of_a_text_on_a_path_read_the_path_once() {
// A path with no usable data is not read again either.
let (texts, reads, _) = prepared(&format!(r##"<defs><text id="t"><textPath href="#none">Path</textPath></text></defs>{uses}"##));
assert_eq!((texts, reads), (51, 1));
// The path's pathLength is read with it.
let (texts, reads, _) = prepared(&format!(
r##"<defs><path id="p" d="M0 20L150 20" pathLength="10"/><text id="t"><textPath href="#p" startOffset="5">Path</textPath></text></defs>{uses}"##
));
assert_eq!((texts, reads), (51, 1));
}
+32
View File
@@ -299,6 +299,38 @@ fn text_path_becomes_type_on_a_path() {
assert_eq!(t[2].para.justify, Justify::Left);
}
#[test]
fn text_path_start_offset_is_scaled_by_the_path_length() {
// A path 400 long whose pathLength is 100: a startOffset of 50 lies 200 along it. A
// percentage stays a share of the computed length. Huge values of both still give their
// ratio. With a pathLength of 0, an offset of 0 stays at the start and any other offset lies
// past the end, as does an offset too large to scale on a short path.
let d = open(
r##"<path id="p" d="M0 100 H400" pathLength="100" fill="none" stroke="black"/>
<path id="z" d="M0 200 H400" pathLength="0" fill="none" stroke="black"/>
<path id="h" d="M0 300 H400" pathLength="1e308" fill="none" stroke="black"/>
<path id="s" d="M0 400 H0.1" pathLength="1e-10" fill="none" stroke="black"/>
<text font-size="10"><textPath href="#p" startOffset="50">Half</textPath></text>
<text font-size="10"><textPath href="#p" startOffset="25%">Quarter</textPath></text>
<text font-size="10"><textPath href="#h" startOffset="5e307">Huge</textPath></text>
<text font-size="10"><textPath href="#z" startOffset="0">Zero</textPath></text>
<text font-size="10"><textPath href="#z" startOffset="50">Fifty</textPath></text>
<text font-size="10"><textPath href="#s" startOffset="1e308">Past</textPath></text>"##,
);
let t = texts(&d);
assert_eq!(t.len(), 6);
let start_of = |t: &TextObject| match t.kind {
TextKind::OnPath { start, .. } => start,
_ => panic!("{:?}", t.kind),
};
assert!(close(start_of(t[0]), 0.5, 1e-9), "{}", start_of(t[0]));
assert!(close(start_of(t[1]), 0.25, 1e-9), "{}", start_of(t[1]));
assert!(close(start_of(t[2]), 0.5, 1e-9), "{}", start_of(t[2]));
assert_eq!(start_of(t[3]), 0.0);
assert_eq!(start_of(t[4]), 1.0);
assert_eq!(start_of(t[5]), 1.0);
}
#[test]
fn text_on_a_closed_path_wraps_past_the_path_start() {
// A closed path 400 long: text anchored before its start, or offset past its end, wraps
+97 -7
View File
@@ -1,7 +1,7 @@
use super::cache::RegionCache;
use super::lookup::{
connected_edges, flood_faces, is_live_paint, leaf_shapes, live_paint_at, live_paint_at_where, lp_stroke_paint, node_outline, visible_edge_near,
visible_face_at,
connected_edges, edges, faces, flood_faces, is_live_paint, leaf_shapes, live_paint_at, live_paint_at_where, lp_stroke_paint, node_outline,
visible_edge_near, visible_face_at,
};
use super::map::{HIGHLIGHT_RED, sorted_roots};
use super::{
@@ -711,8 +711,14 @@ pub const LP_SELECT_WIDTH_RANGE: (f64, f64) = (1.0, 20.0);
/// with Shift held at the press, each of them leaves the selection if it is selected and joins it
/// otherwise. A double-click on a face selects it and the faces of its group that are not parted
/// from it by a stroked edge; on an edge, it selects the edge and the edges joined to it end to end
/// that have its stroke paint ([`LivePaintSelectionTool::reach_at`]). With Shift held, each of them
/// leaves the selection if it is selected and joins it otherwise.
/// that have its stroke paint ([`LivePaintSelectionTool::reach_at`]). A triple-click on a face
/// selects every face of its group with that face's fill; on an edge, every edge of its group with
/// that edge's stroke paint ([`LivePaintSelectionTool::same_paint_at`]). With Shift held, each part a
/// double-click reaches leaves the selection if it is selected and joins it otherwise, and after a
/// Shift-triple-click each part with the clicked part's paint is toggled from the selection there
/// was before the three clicks. Clicks of the three made without Shift select as they do alone, so
/// when Shift is first held at a later click, the parts are toggled from the selection there was
/// before that click.
/// A click and a marquee change the selection on release, so Escape between the press
/// and the release (which removes the marquee) leaves the selection as it was. The tool does not
/// highlight or select the faces and edges of a Live Paint group that is locked, on a locked layer
@@ -733,6 +739,33 @@ pub struct LivePaintSelectionTool {
width: f64,
/// The drag in progress, from the press to the release.
drag: Option<LpDrag>,
/// The part each of the last two clicks toggled with Shift held, the latest last (None for a
/// click that toggled nothing). A click or marquee without Shift clears both.
recent: [Option<NodeId>; 2],
/// The parts the last double-click, the two clicks before it and the Shift-clicks after it
/// toggled, each listed once when toggled an odd number of times. A Shift-triple-click toggles
/// them back as it toggles the parts with the clicked part's paint, so the selection ends as it
/// was before the clicks with those parts toggled.
toggled: Vec<NodeId>,
}
/// `a` (which lists each id once) with each id of `b` toggled in turn: an id `b` lists an odd number
/// of times is removed when `a` holds it and added at the end otherwise, in `b`'s order.
fn toggle_ids(a: &mut Vec<NodeId>, b: &[NodeId]) {
use std::collections::HashSet;
let mut odd = HashSet::new();
for id in b {
if !odd.insert(*id) {
odd.remove(id);
}
}
let held: HashSet<NodeId> = a.iter().copied().collect();
a.retain(|x| !odd.contains(x));
for id in b {
if !held.contains(id) && odd.remove(id) {
a.push(*id);
}
}
}
/// A press and drag of the Live Paint Selection tool.
@@ -770,6 +803,8 @@ impl Default for LivePaintSelectionTool {
color: HIGHLIGHT_RED,
width: LP_SELECT_WIDTH,
drag: None,
recent: [None; 2],
toggled: vec![],
}
}
}
@@ -812,6 +847,25 @@ impl LivePaintSelectionTool {
let Some(group) = cx.doc.node(gid) else { return vec![] };
if edge { connected_edges(group, part.id, &lp_stroke_paint(part)) } else { flood_faces(group, part.id) }
}
/// What a triple-click at `p` selects, Alt held or not: on the face a click there picks
/// ([`LivePaintSelectionTool::picks_edge`]), that face and every other face of its group that is
/// not hidden and has its fill; on the edge a click picks, that edge and every other edge of its
/// group that is not hidden and draws with the stroke paint it draws with ([`lp_stroke_paint`]).
/// The part under the pointer comes first. Empty where a click selects no face or edge.
fn same_paint_at(&self, cx: &ToolContext, p: Point, alt: bool) -> Vec<NodeId> {
let Some(edge) = self.picks_edge(alt) else { return vec![] };
let Some((gid, Some(part))) = lp_part_at(cx.doc, p, cx.tol(4.0), edge, &|id| lp_selectable(cx, id)) else { return vec![] };
let Some(group) = cx.doc.node(gid) else { return vec![] };
let others: Vec<NodeId> = if edge {
let like = lp_stroke_paint(part);
edges(group).into_iter().filter(|e| e.visible && e.id != part.id && lp_stroke_paint(e) == like).map(|e| e.id).collect()
} else {
let like = part.appearance.fill_paint();
faces(group).into_iter().filter(|f| f.visible && f.id != part.id && f.appearance.fill_paint() == like).map(|f| f.id).collect()
};
std::iter::once(part.id).chain(others).collect()
}
}
/// The faces (with `faces`) and edges (with `edges`) that marquee `r` touches, among the faces and
@@ -918,6 +972,17 @@ impl Tool for LivePaintSelectionTool {
let d = LpDrag { cur: p, ..d };
let Some(r) = d.marquee(cx) else {
// A click selects what the press picked.
// A click without Shift replaces the selection, so what earlier clicks toggled
// no longer counts.
if d.shift {
self.recent = [self.recent[1], d.hit];
if let Some(id) = d.hit {
toggle_ids(&mut self.toggled, &[id]);
}
} else {
self.recent = [None; 2];
self.toggled.clear();
}
return match (d.hit, d.shift) {
(Some(id), true) => vec![Action::Exec("select.toggle".into(), json!({ "id": id.0 }))],
(Some(id), false) => vec![Action::Exec("select.set".into(), json!({ "ids": [id.0] }))],
@@ -925,6 +990,8 @@ impl Tool for LivePaintSelectionTool {
(None, false) => vec![Action::Exec("select.none".into(), json!({}))],
};
};
self.recent = [None; 2];
self.toggled.clear();
let ids = lp_parts_in(cx, r, self.fills, self.strokes);
match (ids.is_empty(), d.shift) {
(true, true) => vec![],
@@ -937,15 +1004,36 @@ impl Tool for LivePaintSelectionTool {
// The two clicks before it already selected the part under the pointer (or, with
// Shift, toggled it twice); the double-click selects the part with what it reaches.
let ids = self.reach_at(cx, p, ev.mods.alt);
self.toggled.clear();
if ev.mods.shift {
let clicks: Vec<NodeId> = self.recent.iter().flatten().copied().collect();
toggle_ids(&mut self.toggled, &clicks);
toggle_ids(&mut self.toggled, &ids);
}
match (ids.is_empty(), ev.mods.shift) {
(true, _) => vec![],
(false, true) => vec![Action::Exec("select.toggle".into(), json!({ "ids": json_ids(&ids) }))],
(false, false) => vec![Action::Exec("select.set".into(), json!({ "ids": json_ids(&ids) }))],
}
}
// The tool takes no action on a triple-click; its third press and release select as a
// click does.
PointerKind::TripleClick => vec![],
PointerKind::TripleClick => {
// The clicks before it already selected the part under the pointer; the
// triple-click selects the part with every part of its group that has its paint.
// With Shift held, the double-click and the third click toggled parts too, and the
// triple-click toggles those back.
let ids = self.same_paint_at(cx, p, ev.mods.alt);
let toggled = std::mem::take(&mut self.toggled);
self.recent = [None; 2];
if ids.is_empty() {
return vec![];
}
if !ev.mods.shift {
return vec![Action::Exec("select.set".into(), json!({ "ids": json_ids(&ids) }))];
}
let mut flip = ids;
toggle_ids(&mut flip, &toggled);
if flip.is_empty() { vec![] } else { vec![Action::Exec("select.toggle".into(), json!({ "ids": json_ids(&flip) }))] }
}
}
}
@@ -963,6 +1051,8 @@ impl Tool for LivePaintSelectionTool {
fn deactivate(&mut self, _cx: &ToolContext) -> Vec<Action> {
self.drag = None;
self.recent = [None; 2];
self.toggled.clear();
vec![]
}
+154 -7
View File
@@ -2573,20 +2573,167 @@ fn live_paint_selection_double_click_selects_connected_faces_or_edges() {
assert!(dbl(&mut t, 25.0, 1.0, alt).is_empty());
}
/// A triple-click on a face selects every face of its group with that face's fill, joined to it or
/// not; on an edge (Alt), every edge of its group that draws with that edge's stroke paint. Shift
/// toggles them. Hidden parts, other groups and parts with another paint are left out.
#[test]
fn live_paint_selection_triple_click_adds_nothing_to_its_clicks() {
fn live_paint_selection_triple_click_selects_every_part_of_the_same_paint() {
let mut d = Document::new(500.0, 500.0);
let (_, [a, ..], _) = live_strip(&mut d);
let (_, [a, b, c], [ab, bc, top_a, top_b, top_c, bottom]) = live_strip(&mut d);
let (other, [_, other_top, ..]) = live_square(&mut d, Rect::new(200.0, 0.0, 300.0, 100.0));
let other_face = faces(d.node(other).unwrap())[0].id;
let red = Paint::solid(vectorcraft_color::Color::rgb(1.0, 0.0, 0.0));
let blue = Paint::solid(vectorcraft_color::Color::rgb(0.0, 0.0, 1.0));
// A and C are red and B is blue; the other group's face is red and its top edge black, too.
for (id, fill) in [(a, &red), (b, &blue), (c, &red), (other_face, &red)] {
d.node_mut(id).unwrap().appearance.set_fill(fill.clone());
}
d.node_mut(other_top).unwrap().appearance.set_stroke(Paint::solid(vectorcraft_color::Color::BLACK));
let s = Selection::default();
let p = paint();
let set = |ids: &[NodeId]| vec![Action::Exec("select.set".into(), json!({ "ids": ids.iter().map(|i| i.0).collect::<Vec<_>>() }))];
let toggle = |ids: &[NodeId]| vec![Action::Exec("select.toggle".into(), json!({ "ids": ids.iter().map(|i| i.0).collect::<Vec<_>>() }))];
let alt = Mods { alt: true, ..Default::default() };
let shift = Mods { shift: true, ..Default::default() };
let tri = |d: &Document, t: &mut LivePaintSelectionTool, x: f64, y: f64, m: Mods| {
let cx = cx(d, &s, &p);
t.pointer(&cx, &ev(PointerKind::TripleClick, x, y).with_mods(m))
};
let mut t = LivePaintSelectionTool::default();
// A face: every face of its group with its fill, even across the stroked edge BC; the clicked face first.
assert_eq!(tri(&d, &mut t, 125.0, 25.0, Mods::default()), set(&[c, a]));
assert_eq!(tri(&d, &mut t, 75.0, 25.0, Mods::default()), set(&[b]));
// An edge: every edge of its group that draws with its stroke paint, joined to it or not.
assert_eq!(tri(&d, &mut t, 25.0, 1.0, alt), set(&[top_a, top_b, bottom]));
assert_eq!(tri(&d, &mut t, 125.0, 1.0, alt), set(&[top_c, bc]));
assert_eq!(tri(&d, &mut t, 50.0, 25.0, alt), set(&[ab]));
// With Shift held, the parts leave the selection or join it.
assert_eq!(tri(&d, &mut t, 25.0, 25.0, shift), toggle(&[a, c]));
assert_eq!(tri(&d, &mut t, 125.0, 1.0, Mods { alt: true, shift: true, ..Default::default() }), toggle(&[top_c, bc]));
// Away from the group, a triple-click adds nothing to what its clicks did.
assert!(tri(&d, &mut t, 400.0, 400.0, Mods::default()).is_empty());
// A hidden face of the same fill is left out.
d.node_mut(c).unwrap().visible = false;
assert_eq!(tri(&d, &mut t, 25.0, 25.0, Mods::default()), set(&[a]));
// On the other group, a triple-click selects that group's parts alone.
assert_eq!(tri(&d, &mut t, 250.0, 50.0, Mods::default()), set(&[other_face]));
assert_eq!(tri(&d, &mut t, 250.0, 1.0, alt), set(&[other_top]));
// Select Fills off: the triple-click picks the edge nearest the pointer; both off: nothing.
t.set_option("selectFills", &json!(false));
assert_eq!(tri(&d, &mut t, 25.0, 1.0, Mods::default()), set(&[top_a, top_b, bottom]));
t.set_option("selectStrokes", &json!(false));
assert!(tri(&d, &mut t, 25.0, 25.0, Mods::default()).is_empty());
assert!(tri(&d, &mut t, 25.0, 1.0, alt).is_empty());
}
/// The whole event series of a triple-click (three presses and releases, the double-click after
/// the second release and the triple-click after the third), applied to a selection: without
/// Shift the selection ends as the parts with the clicked part's paint, and with Shift as the
/// selection from before the clicks with those parts toggled, whatever the double-click reached.
#[test]
fn live_paint_selection_triple_click_series_ends_with_the_same_paint_parts() {
let mut d = Document::new(500.0, 500.0);
let (_, [a, b, c], [_, bc, top_a, top_b, top_c, bottom]) = live_strip(&mut d);
let red = Paint::solid(vectorcraft_color::Color::rgb(1.0, 0.0, 0.0));
let blue = Paint::solid(vectorcraft_color::Color::rgb(0.0, 0.0, 1.0));
// A and C are red and B is blue; a double-click on A also reaches B across the unstroked edge AB.
for (id, fill) in [(a, &red), (b, &blue), (c, &red)] {
d.node_mut(id).unwrap().appearance.set_fill(fill.clone());
}
let s = Selection::default();
let p = paint();
let cx = cx(&d, &s, &p);
let apply = |sel: &mut Vec<u64>, acts: Vec<Action>| {
for act in acts {
let Action::Exec(cmd, args) = act else { panic!("{act:?}") };
let ids: Vec<u64> = match (args.get("ids"), args.get("id")) {
(Some(v), _) => v.as_array().unwrap().iter().map(|i| i.as_u64().unwrap()).collect(),
(None, Some(i)) => vec![i.as_u64().unwrap()],
(None, None) => vec![],
};
match cmd.as_str() {
"select.set" => *sel = ids,
"select.none" => sel.clear(),
"select.toggle" => {
for i in ids {
match sel.iter().position(|x| *x == i) {
Some(k) => {
sel.remove(k);
}
None => sel.push(i),
}
}
}
other => panic!("{other}"),
}
}
};
// The first click at `first`, every later event at (`x`, `y`).
let series = |t: &mut LivePaintSelectionTool, sel: &mut Vec<u64>, first: (f64, f64), x: f64, y: f64, m: Mods| {
for kind in [PointerKind::Down, PointerKind::Up] {
apply(sel, t.pointer(&cx, &ev(kind, first.0, first.1).with_mods(m)));
}
for kind in [PointerKind::Down, PointerKind::Up, PointerKind::DoubleClick, PointerKind::Down, PointerKind::Up, PointerKind::TripleClick] {
apply(sel, t.pointer(&cx, &ev(kind, x, y).with_mods(m)));
}
};
let sorted = |ids: &[NodeId]| {
let mut v: Vec<u64> = ids.iter().map(|i| i.0).collect();
v.sort_unstable();
v
};
let alt = Mods { alt: true, ..Default::default() };
let shift = Mods { shift: true, ..Default::default() };
let mut t = LivePaintSelectionTool::default();
// The third click's press and release select the face under the pointer, as a click does.
assert_eq!(lp_click(&mut t, &cx, ev(PointerKind::Down, 25.0, 25.0)), vec![Action::Exec("select.set".into(), json!({ "ids": [a.0] }))]);
for m in [Mods::default(), Mods { alt: true, ..Default::default() }, Mods { shift: true, ..Default::default() }] {
assert!(t.pointer(&cx, &ev(PointerKind::TripleClick, 25.0, 25.0).with_mods(m)).is_empty());
assert!(t.pointer(&cx, &ev(PointerKind::TripleClick, 25.0, 1.0).with_mods(m)).is_empty());
for (start, first, x, y, m, want) in [
(vec![], (25.0, 25.0), 25.0, 25.0, Mods::default(), sorted(&[a, c])),
(vec![top_c.0], (25.0, 25.0), 25.0, 25.0, Mods::default(), sorted(&[a, c])),
(vec![], (25.0, 25.0), 25.0, 25.0, shift, sorted(&[a, c])),
(vec![top_c.0, c.0], (25.0, 25.0), 25.0, 25.0, shift, sorted(&[a, top_c])),
(vec![], (25.0, 1.0), 25.0, 1.0, Mods { alt: true, shift: true, ..Default::default() }, sorted(&[top_a, top_b, bottom])),
(vec![bc.0], (125.0, 1.0), 125.0, 1.0, alt, sorted(&[top_c, bc])),
// The first click on A and the rest on B, beside it: B alone has B's fill.
(vec![], (49.0, 25.0), 51.0, 25.0, shift, sorted(&[b])),
(vec![c.0], (49.0, 25.0), 51.0, 25.0, shift, sorted(&[b, c])),
] {
let mut sel = start.clone();
series(&mut t, &mut sel, first, x, y, m);
sel.sort_unstable();
assert_eq!(sel, want, "from {start:?} at {first:?} then ({x}, {y}) with {m:?}");
}
// Shift first held at the third click: the two clicks and the double-click select A and B, and
// the parts with A's fill are toggled from that selection.
let mut sel = vec![top_c.0];
for (kind, m) in [
(PointerKind::Down, Mods::default()),
(PointerKind::Up, Mods::default()),
(PointerKind::Down, Mods::default()),
(PointerKind::Up, Mods::default()),
(PointerKind::DoubleClick, Mods::default()),
(PointerKind::Down, shift),
(PointerKind::Up, shift),
(PointerKind::TripleClick, shift),
] {
apply(&mut sel, t.pointer(&cx, &ev(kind, 25.0, 25.0).with_mods(m)));
}
sel.sort_unstable();
assert_eq!(sel, sorted(&[b, c]));
// A Shift-click on C, then a click on A without Shift, which selects A alone, and Shift held
// from the double-click on: the parts with A's fill are toggled from that selection.
let mut sel = vec![];
for (kind, x, m) in [
(PointerKind::Down, 125.0, shift),
(PointerKind::Up, 125.0, shift),
(PointerKind::Down, 25.0, Mods::default()),
(PointerKind::Up, 25.0, Mods::default()),
(PointerKind::DoubleClick, 25.0, shift),
(PointerKind::Down, 25.0, shift),
(PointerKind::Up, 25.0, shift),
(PointerKind::TripleClick, 25.0, shift),
] {
apply(&mut sel, t.pointer(&cx, &ev(kind, x, 25.0).with_mods(m)));
}
assert_eq!(sel, vec![c.0]);
}
#[test]
+7 -5
View File
File diff suppressed because one or more lines are too long
+2 -1
View File
@@ -8455,7 +8455,8 @@ that can be edited or released. `file.place` answers `image`, the id of the imag
[import options help page](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-from-other-apps/photoshop-import-options.html)
says that a file imported as one flattened image keeps the document's clipping path when it has one. `links.update`
and `links.relink` read the file's pixels again and leave the clip group and its clipping path as they are. Files that name no clipping path, or name a path
they don't have, come in as a plain image.
they don't have, come in as a plain image. `file.place` with `replace` on such a clip group puts a new image, clipped or
not, at the scale and rotation of the image in the group.
`document.open` converts a PSD or PSB file's layers to objects. In
[PSD import options](https://helpx.adobe.com/illustrator/desktop/add-and-import-files/import-from-other-apps/photoshop-import-options.html),
+2 -1
View File
@@ -1,6 +1,6 @@
# Roadmap: milestones and what's next
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-14 · **Change:** minor (Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-15 · **Change:** minor (M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides toggles (#6164); scores and estimates unchanged; custom dictionary and Ignore All: `text.spelling.addWord`, `removeWord`, `changeWord`, `dictionary` and `ignoreAll`, #4936; previously minor: EPS import: embedded fonts (composite, Type 42, CID-keyed, Type 1, CFF FontSet) draw their glyphs; spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, #4936; previously minor: floating tab groups collapse into the side icon rail and opened rail panels fold back into it, #5925 in part; M4/M7: `.ai`/EPS type keeps its tab stops, and right-aligned lines with tabs lay out as the file's page, #6147; M4/M7: `.ai`/EPS type from the text document lays its lines out closer to the file's page, within limits, #6137; numeric fields step on wheel hover without taking keyboard focus, #5949; Character Styles panel: a double-click on a style's row opens its Character Style Options; the dialog keeps a fixed width and scrolls its sections, so its buttons stay on screen; Selection QoL: marquee modes and visible feedback, #5313; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; #3380 deletion-only review follow-up: independent survivors keep gradient placement, owned subpaths avoid discarded copies, and contracts/status/evidence are clarified; endpoint highlighting remains open; scores and estimates unchanged; Indian-language hyphenation review and license allowlist, #4947; Hindi catalog and contributor loanword preferences; full wording review in progress; Effect dialogs: a colour swatch beside a hex colour opens the Color Picker, #5365; shape tools move the selection from its centre point and turn it from the zone outside a box corner, #5477; scores and estimates unchanged) · **Target:** Adobe Illustrator 2026 (30.x)
>
> Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865).
>
@@ -207,6 +207,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development
| Date | Change | Summary |
|---|---|---|
| 2026-11-15 | minor | M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimates unchanged |
| 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. |
| 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. |
| 2026-11-12 | minor | Gujarati (`gu`): 4,286-row machine-assisted catalog reviewed by a native speaker, zero/one singular plurals, desktop font fallback and optional Gujarati craft-fonts fallback; all 72 translation tests pass; a web font and about 2,600 untranslated messages remain; scores and estimates unchanged |
File diff suppressed because one or more lines are too long