mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-06 05:53:08 -05:00
Artwork Cleanup: Release All Containers keeps paths with Live Corners whole
A path of several subpaths with Live Corners was split into one path per subpath, and each part lost its editable corners. Such a path now stays whole, as other live objects do. A plain path of several subpaths still splits. The Artwork Cleanup entries in docs/target-app-parity.md and docs/ui-parity.md now say that only containers of the kinds asked for are released, and name what stays whole. docs/mcp.md and the command help name paths with Live Corners among the objects that stay whole.
This commit is contained in:
1 parent
780fac72c5
commit
2116be3cf6
5 files changed
+46
-12
No files matched your search
@@ -8,7 +8,7 @@ mod tests;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::{Document, Node, NodeId, NodeKind};
|
||||
use vectorcraft_doc::{Document, LiveShape, Node, NodeId, NodeKind};
|
||||
use vectorcraft_geom::PathData;
|
||||
use vectorcraft_tools::builder::is_live_paint;
|
||||
|
||||
@@ -26,7 +26,7 @@ pub(super) fn specs() -> Vec<CommandSpec> {
|
||||
"Release All Containers…",
|
||||
["Object", "Plug-ins", "Artwork Cleanup"],
|
||||
None,
|
||||
"{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping, their clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or layer that stays is left as it is, also when it is selected or named itself; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}",
|
||||
"{scope?: \"selection\"|\"document\" (default: the selection, or the document while nothing is selected), ids?: [id…] (the objects, groups and layers to release in, instead of `scope`), groups?: bool (true: groups are ungrouped), clipGroups?: bool (true: clipping groups are ungrouped and layers stop clipping, their clipping paths kept as plain paths), compoundPaths?: bool (true: compound paths, and paths of several subpaths, become one path per subpath); at least one of the three} take apart every container of the kinds asked for, at every level of nesting, as one undo step when one goes; layers stay; each object keeps the opacity of the groups and compound paths it was in, and a compound path's paths take its paint; objects with an opacity mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups, Image Trace objects, paths with Live Corners, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or layer that stays is left as it is, also when it is selected or named itself; from the selection or the document, locked and hidden objects, and objects on a locked artboard, stay whole; named by `ids`, locked and hidden ones are taken apart too (their objects become locked or hidden as they were), but not those on a locked artboard; the selection keeps what it held, each object taken apart replaced by what it left, locked and hidden objects left out → {scope (\"selection\", \"document\" or \"ids\"), ids (the objects selected), groups, clipGroups, compoundPaths (how many of each were released)}",
|
||||
has_doc,
|
||||
release_all
|
||||
)]
|
||||
@@ -64,11 +64,13 @@ struct Release<'a> {
|
||||
|
||||
/// Whether `n` stays whole whatever is asked: a live object kept as a group or compound path
|
||||
/// (a compound shape, Live Paint group, graph, dimension, flare, Objects on Path, generated art,
|
||||
/// Shaper Group, Image Trace object, a clipping path's painted pieces) or one with an opacity mask,
|
||||
/// whose contents would lose what it does to them.
|
||||
/// Shaper Group, Image Trace object, a clipping path's painted pieces), a path with Live Corners,
|
||||
/// whose parts would lose their editable corners, or one with an opacity mask, whose contents
|
||||
/// would lose what it does to them.
|
||||
fn live(n: &Node) -> bool {
|
||||
let x = n.extras();
|
||||
x.mask.is_some()
|
||||
matches!(&n.kind, NodeKind::Path { live: Some(l), .. } if matches!(**l, LiveShape::Path { .. }))
|
||||
|| x.mask.is_some()
|
||||
|| x.shaper.is_some()
|
||||
|| x.trace.is_some()
|
||||
|| x.graph.is_some()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::{Appearance, Node, NodeId, NodeKind};
|
||||
use vectorcraft_doc::{Appearance, LiveShape, Node, NodeId, NodeKind};
|
||||
|
||||
use crate::Session;
|
||||
|
||||
@@ -212,6 +212,37 @@ fn release_all_splits_paths_of_several_subpaths() {
|
||||
assert_eq!(node(&s, left[1]).unwrap().appearance, node(&s, a).unwrap().appearance, "each part keeps the path's paint");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn release_all_keeps_a_path_of_several_subpaths_with_live_corners_whole() {
|
||||
let mut s = session();
|
||||
let a = rect(&mut s, 10.0, 10.0);
|
||||
let b = rect(&mut s, 40.0, 10.0);
|
||||
let plain_path = rect(&mut s, 80.0, 10.0);
|
||||
let second = node(&s, b).unwrap().path_data().unwrap().subpaths[0].clone();
|
||||
for id in [a, plain_path] {
|
||||
let second = second.clone();
|
||||
change(&mut s, id, |n| {
|
||||
if let NodeKind::Path { path, live, .. } = &mut n.kind {
|
||||
path.subpaths.push(second);
|
||||
*live = None;
|
||||
}
|
||||
});
|
||||
}
|
||||
change(&mut s, a, |n| {
|
||||
if let NodeKind::Path { path, live, .. } = &mut n.kind {
|
||||
let base = path.clone();
|
||||
*live = Some(Box::new(LiveShape::Path { base, radii: vec![4.0], kinds: vec![], radii_relative: false }));
|
||||
}
|
||||
});
|
||||
s.edit("t", |d, _| Ok(d.remove_many(&[b])?)).unwrap();
|
||||
select(&mut s, &[a, plain_path]);
|
||||
let r = s.execute(C, &json!({})).unwrap();
|
||||
assert_eq!(counts(&r), (0, 0, 1), "only the plain path is split: {r}");
|
||||
let kept = node(&s, a).unwrap();
|
||||
assert!(matches!(kept.kind, NodeKind::Path { live: Some(_), ref path, .. } if path.subpaths.len() == 2), "Live Corners stay");
|
||||
assert_eq!(layer(&s, 0).len(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn release_all_runs_on_the_document_while_nothing_is_selected() {
|
||||
let mut s = session();
|
||||
|
||||
+2
-2
@@ -16590,8 +16590,8 @@ clipping paths stay as plain paths), and `compoundPaths` turns compound paths, a
|
||||
path per subpath. Each is true by default, and at least one must be true. Layers stay. Objects keep the opacity of
|
||||
the groups and compound paths they were in, and the paths of a compound path take its paint. Objects with an opacity
|
||||
mask, compound shapes, Live Paint groups, graphs, dimensions, flares, Objects on Path, generated art, Shaper Groups,
|
||||
Image Trace objects, blends, envelopes and other live objects stay whole, and the clipping path of a clipping group or
|
||||
layer that stays is left as it is, also when it is selected or named itself. From the selection or the document, locked and hidden objects
|
||||
Image Trace objects, paths with Live Corners, blends, envelopes and other live objects stay whole, and the clipping
|
||||
path of a clipping group or layer that stays is left as it is, also when it is selected or named itself. From the selection or the document, locked and hidden objects
|
||||
and objects on a locked artboard stay whole. With `ids`, the locked and hidden containers it names, or that are in what
|
||||
it names, are taken apart too and their objects become locked or hidden as the containers were, but containers on a
|
||||
locked artboard stay whole. The selection keeps what it held, with each object taken apart replaced by the objects
|
||||
|
||||
@@ -2998,9 +2998,10 @@ alike in being hidden and in being locked, and the objects of a group Deep Ungro
|
||||
state. Tests: `simplify_named_locked_and_hidden_paths`, `deep_ungroup_named_locked_and_hidden_groups` and
|
||||
`rejoin_named_locked_and_hidden_pieces` in `cmd::addons::cleanup::tests`.
|
||||
|
||||
Release All Containers… (`addon.cleanup.releaseAll`) takes apart every group, clipping group and compound path in the
|
||||
selection, the objects named or the whole document, at every level of nesting, as one undo step; layers stay and stop
|
||||
clipping, and paths of several subpaths split into one path per subpath. Its dialog previews on the canvas and picks
|
||||
Release All Containers… (`addon.cleanup.releaseAll`) takes apart the groups, clipping groups and compound paths of the
|
||||
kinds asked for in the selection, the objects named or the whole document, at every level of nesting, as one undo step;
|
||||
layers stay, and stop clipping when clipping groups are released; paths of several subpaths split into one path per
|
||||
subpath. Objects with an opacity mask, live objects and paths with Live Corners stay whole. Its dialog previews on the canvas and picks
|
||||
where to release and which kinds (VectorCraft's own tool). Tests: `cmd::addons::cleanup::release::tests` in
|
||||
`vectorcraft-engine` and `addons::cleanup::release::tests` in `vectorcraft-ui-egui`.
|
||||
|
||||
|
||||
+1
-1
@@ -592,7 +592,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its six tools (Anchor Eraser Brush, Extend Path, Measure & Inspect, Parametric Shape, Corner Tool, Slide Anchor Along Path), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and the Parametric Shape panel (kind, count, W/H, rotation, the kind's own values and corner radius of the selected parametric shape, or of the tool's next one), and runs Add Points at / Split at Crossings and Convert to Parametric Shape; the Parametric Shape Tool draws ten re-editable kinds from the centre (↑/↓ and ←/→ change their numbers while dragging) and edits a selected one with handles; the Corner Tool cuts editable corners on any path (hover shows the anchor, a click uses its radius and kind, a drag sizes the corner, Shift whole values; a corner's marker selects it and loads its values, drags to resize, to 0 or double-clicked removes it; never past what fits; Alt-marquee cuts every anchor inside) with a Corners section in the Anchor Inspector (radius, kind, selected count, Apply to Selected Anchors); Slide Anchor Along Path drags an anchor along its curve with the segments beside it refitted, Shift snapping where the tangent is a multiple of 45°; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs`, `crates/ui-egui/src/addons/pathtools/` and their tests; not a feature of the reference app, so it is not scored |
|
||||
| Smart Pen add-on (VectorCraft addition): Object › Plug-ins › Smart Pen selects the Smart Pen Tool (also in the Pen tool's group in both shipped toolbars, after the Quick Pen; the All Tools drawer lists it under Draw; a toolbar edited before keeps its saved layout until Reset Toolbar; no shortcut), and opens the Smart Pen panel (next segment straight or curved; Remove Points Keep Shape, Make Smooth, Make Corner, Retract Handles, Close or Join). The tool draws (click: straight or curved segment, a curve after a straight one tangent; drag: smooth anchor, Alt breaks the handle, Shift 45°, Space moves it; Tab switches a segment; rubber band; close, join, continue) and edits without switching tools (click selects a point, drag moves it, Alt-click removes it keeping the shape, Shift+Alt-click deletes it, double-click toggles smooth/corner; handle drags with Shift and Alt; segment drags reshape, Alt-click adds a point); an Alt-drag away from paths selects the points inside a marquee | done | `addon.pen.*`, `crates/tools/src/addons/smart_pen.rs`, `crates/ui-egui/src/addons/pen.rs` and their tests; not a feature of the reference app, so it is not scored |
|
||||
| Path Precision Tools add-on (VectorCraft addition): Object › Plug-ins › Path Precision Tools selects its three tools (Anchor Eraser Brush, Extend Path, Measure & Inspect), which the All Tools drawer lists under their own heading but neither toolbar shows as shipped, opens the Anchor Inspector panel (the selected anchor's X/Y and handle lengths and angles as fields; Make Smooth, Make Corner, Equalize Handles, Remove Points Keep Shape, Add Points, the three ways to close) and runs Add Points at / Split at Crossings; a double-click on the brush or Extend Path tool opens its options | done | `addon.pathtools.*`, `crates/tools/src/addons/`, `crates/ui-egui/src/addons/pathtools.rs` and their tests; not a feature of the reference app, so it is not scored |
|
||||
| Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first; Release All Containers… takes apart every group, clipping mask and compound path in the selection or the document as one undo step | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not a feature of the reference app, so it is not scored |
|
||||
| Artwork Cleanup add-on (VectorCraft addition): Object › Plug-ins › Artwork Cleanup opens its panel, which checks the selection or the document for 16 kinds of issue, lists them with counts, and shows or fixes the picked rows or all of them, each fix one undo step; Simplify Anchors (Keep Shape), Rejoin Path Pieces and Deep Ungroup open their options first; Release All Containers… takes apart the groups, clipping masks and compound paths of the kinds asked for in the selection or the document as one undo step, leaving objects with an opacity mask, live objects and paths with Live Corners whole | done | `addon.cleanup.*`, `crates/ui-egui/src/addons/cleanup.rs` and its tests; not a feature of the reference app, so it is not scored |
|
||||
| Artwork Cleanup add-on text tools (VectorCraft addition): the panel's Text row, which the panel can hide, and Object › Plug-ins › Artwork Cleanup set the alignment of point type keeping its place, break type into lines (Shift-click: paragraphs), words or glyphs, split type at the cursor, reset a text transform (Alt-click: and its horizontal scale), combine point type, remove line or paragraph breaks and replace missing fonts, each one undo step | done | `addon.cleanup.*` text commands, `crates/ui-egui/src/addons/cleanup.rs` and its tests; a VectorCraft addition, so it is not scored |
|
||||
| Color Effects add-on (VectorCraft addition): live Exposure, Desaturate and Invert Colors in Effect › Color Effects and Object › Plug-ins › Color Effects; its panel picks a colour adjustment and its values and adds it as a live effect or applies it as a filter, into the colours, as one undo step; Select by Color Kind selects the objects that use spot colours, carry colour effects, or are RGB, CMYK or grayscale images; Vector Halftone draws an object as halftone dots live (the dots Object › Vector Halftone makes), which Expand Appearance and the exporters write as paths; Duotone prints each colour's tone with one to four inks (a tint of a spot tone's swatch, or the CMYK mix of several), live or as a filter, its dialog a row per tone and the picked tone's curve; Print Ink Fixes (a CMYK document's ink limit, white overprint removed, black overprint set) opens its options from the submenu and the panel's Inks | done | `addon.color.*`, `crates/ui-egui/src/addons/color.rs` and its tests; not a feature of the reference app, so it is not scored |
|
||||
| Color Effects add-on (VectorCraft addition): Object › Plug-ins › Color Effects › Find Nearest Swatch… picks a Library (Document Swatches, a built-in library, or a library or colour book the user saved or loaded) and Fill and Stroke, lists each colour of the selection with its three closest swatches (chip, name, ΔE 2000), and Apply gives each colour its nearest swatch (global and spot swatches linked; a library's swatches added to the document first), one undo step | done | #4923; `addon.color.nearestSwatch`, `addon.color.applyNearestSwatch`, `crates/engine/src/cmd/addons/color/nearest.rs`, `crates/ui-egui/src/addons/color/nearest.rs` and their tests; not a feature of the reference app, so it is not scored |
|
||||
|
||||
Reference in new issue
Block a user