mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-16 12:03:31 +00:00
Symbols: Symbol Options › Align to Pixel Grid keeps a symbol's instances on the pixel grid
symbol.new and symbol.options take alignToPixelGrid (off by default), symbol.list rows report it, and the New Symbol and Symbol Options dialogs show the checkbox. When it is on, the horizontal and vertical straight segments of the paths in the symbol's art, opacity mask art included, snap to whole points (half points for an odd centered stroke) at the symbol's natural size, and its stroke weights become whole points. Each instance placed at that size, reflected across one axis or not, moves to whole points and goes back to them after every move. A scaled, rotated or sheared instance, and an instance in another symbol's art, stays where it is. In symbol editing mode the stored art and the editing layer snap after each edit. Duplicate Symbol, rename, copy and paste and symbol libraries keep the setting, and Delete Symbol removes it. Docs: docs/mcp.md, docs/ui-parity.md.
This commit is contained in:
@@ -28,6 +28,7 @@ pub mod shared;
|
||||
mod symbol_export_type;
|
||||
mod symbol_nine_slice;
|
||||
pub mod symbol_overrides;
|
||||
mod symbol_pixel_aligned;
|
||||
mod symbol_registration;
|
||||
pub use inline::{SYMBOL_HALF, SYMBOL_SIZES};
|
||||
pub use shared::Shared;
|
||||
@@ -37,6 +38,7 @@ pub use symbol_nine_slice::{
|
||||
SymbolNineSlice, charge_symbol_art,
|
||||
};
|
||||
pub use symbol_overrides::SymbolOverride;
|
||||
pub use symbol_pixel_aligned::SYMBOL_PIXEL_ALIGNED;
|
||||
pub use symbol_registration::{SYMBOL_REGISTRATION, SymbolRegistration};
|
||||
pub mod links;
|
||||
pub mod live;
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
//! Symbol Options › Align to Pixel Grid: a symbol whose instances stay on the pixel grid at their
|
||||
//! actual size wherever they are placed
|
||||
//! (<https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=28>).
|
||||
//!
|
||||
//! Stored under [`SYMBOL_PIXEL_ALIGNED`] keyed by symbol name; a symbol that is not pixel-aligned
|
||||
//! (the default) is left out of the map.
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
use crate::Document;
|
||||
|
||||
/// Document unknown key: `{ symbolName: true }` for each pixel-aligned symbol.
|
||||
pub const SYMBOL_PIXEL_ALIGNED: &str = "symbolPixelAligned";
|
||||
|
||||
impl Document {
|
||||
/// Whether symbol `name` has Symbol Options › Align to Pixel Grid on (default: off).
|
||||
pub fn symbol_pixel_aligned(&self, name: &str) -> bool {
|
||||
self.unknown.get(SYMBOL_PIXEL_ALIGNED).and_then(|m| m.get(name)).and_then(serde_json::Value::as_bool).unwrap_or(false)
|
||||
}
|
||||
|
||||
/// Turn Align to Pixel Grid on or off for symbol `name`. Off removes the symbol from the map,
|
||||
/// and the map goes when it is empty.
|
||||
pub fn set_symbol_pixel_aligned(&mut self, name: &str, on: bool) {
|
||||
if on {
|
||||
let m = self.unknown.entry(SYMBOL_PIXEL_ALIGNED.to_string()).or_insert_with(|| serde_json::json!({}));
|
||||
if let Some(o) = m.as_object_mut() {
|
||||
o.insert(name.into(), serde_json::json!(true));
|
||||
}
|
||||
return;
|
||||
}
|
||||
let Some(o) = self.unknown.get_mut(SYMBOL_PIXEL_ALIGNED).and_then(|m| m.as_object_mut()) else { return };
|
||||
o.remove(name);
|
||||
if o.is_empty() {
|
||||
self.unknown.remove(SYMBOL_PIXEL_ALIGNED);
|
||||
}
|
||||
}
|
||||
|
||||
/// Move the stored setting when a symbol is renamed.
|
||||
pub fn rename_symbol_pixel_aligned(&mut self, from: &str, to: &str) {
|
||||
if from == to {
|
||||
return;
|
||||
}
|
||||
let on = self.symbol_pixel_aligned(from);
|
||||
self.set_symbol_pixel_aligned(from, false);
|
||||
self.set_symbol_pixel_aligned(to, on);
|
||||
}
|
||||
|
||||
/// The names of the pixel-aligned symbols the document holds (empty for most documents).
|
||||
pub fn pixel_aligned_symbols(&self) -> HashSet<String> {
|
||||
let Some(o) = self.unknown.get(SYMBOL_PIXEL_ALIGNED).and_then(|m| m.as_object()) else { return HashSet::new() };
|
||||
o.iter()
|
||||
.filter(|(name, v)| v.as_bool() == Some(true) && self.symbols.iter().any(|s| &s.name == *name))
|
||||
.map(|(name, _)| name.clone())
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn the_setting_is_off_by_default_and_follows_a_rename() {
|
||||
let mut d = Document::new(100.0, 100.0);
|
||||
let art = std::sync::Arc::new(crate::Node::group(d.alloc_id(), vec![]));
|
||||
d.symbols.push(crate::Symbol { dynamic: false, name: "A".into(), art });
|
||||
assert!(!d.symbol_pixel_aligned("A"));
|
||||
assert!(d.unknown.get(SYMBOL_PIXEL_ALIGNED).is_none());
|
||||
d.set_symbol_pixel_aligned("A", true);
|
||||
assert!(d.symbol_pixel_aligned("A"));
|
||||
assert_eq!(d.pixel_aligned_symbols(), HashSet::from(["A".to_string()]));
|
||||
d.symbols[0].name = "B".into();
|
||||
d.rename_symbol_pixel_aligned("A", "B");
|
||||
assert!(!d.symbol_pixel_aligned("A"));
|
||||
assert!(d.symbol_pixel_aligned("B"));
|
||||
d.set_symbol_pixel_aligned("B", false);
|
||||
assert!(d.unknown.get(SYMBOL_PIXEL_ALIGNED).is_none());
|
||||
assert!(d.pixel_aligned_symbols().is_empty());
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Symbols",
|
||||
[],
|
||||
None,
|
||||
"{} → {symbols: [{name, instances, size: [w,h], registration: 0..8, exportType: movieClip|graphic, nineSlice, type: static|dynamic}], current}",
|
||||
"{} → {symbols: [{name, instances, size: [w,h], registration: 0..8, exportType: movieClip|graphic, nineSlice, type: static|dynamic, alignToPixelGrid: bool}], current}",
|
||||
has_doc,
|
||||
symbol_list
|
||||
),
|
||||
@@ -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 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}",
|
||||
"{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), alignToPixelGrid?: bool (default false; Symbol Options › Align to Pixel Grid)} 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; alignToPixelGrid keeps the symbol's instances on the pixel grid as symbol.options describes → {name, id, registration, exportType, nineSlice, type, alignToPixelGrid}",
|
||||
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 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}",
|
||||
"{name?, newName?, registration?: 0..8, exportType?: movieClip|graphic, nineSlice?: bool, nineSliceGuides?: array, type?: static|dynamic, alignToPixelGrid?: bool} 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), 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) and Align to Pixel Grid (on: the horizontal and vertical straight segments of the paths in the symbol's art snap to whole points, or half points for an odd centered stroke, at the symbol's natural size, its stroke weights become whole points, and every instance placed at that size, reflected across one axis or not, moves to whole points and goes back to them after each move; a scaled, rotated (a half turn included) or sheared instance, and an instance in another symbol's art, is left where it is; the art snaps again after it is edited); alignToPixelGrid alone with the value the symbol already has changes nothing and adds no undo step; default name: current → {name, registration, exportType, nineSlice, type, alignToPixelGrid}",
|
||||
has_doc,
|
||||
symbol_options
|
||||
),
|
||||
|
||||
@@ -69,6 +69,15 @@ fn nine_slice_param(p: &Value, cmd: &str, current: Option<SymbolNineSlice>) -> R
|
||||
})
|
||||
}
|
||||
|
||||
/// `alignToPixelGrid` (Symbol Options › Align to Pixel Grid): `None` when it is not given; any
|
||||
/// value other than true or false, null included, is an error.
|
||||
fn pixel_grid_param(p: &Value, cmd: &str) -> Result<Option<bool>> {
|
||||
match p.get("alignToPixelGrid") {
|
||||
None => Ok(None),
|
||||
Some(v) => v.as_bool().map(Some).ok_or_else(|| bad(cmd, "alignToPixelGrid must be true or false")),
|
||||
}
|
||||
}
|
||||
|
||||
fn nine_slice_json(d: &Document, name: &str) -> Value {
|
||||
d.symbol_nine_slice(name).map_or(Value::Null, SymbolNineSlice::to_value)
|
||||
}
|
||||
@@ -187,6 +196,7 @@ pub(super) fn symbol_list(s: &mut Session, _: &Value) -> Result<Value> {
|
||||
"exportType": d.symbol_export_type(&sym.name).id(),
|
||||
"nineSlice": nine_slice_json(d, &sym.name),
|
||||
"type": type_id(sym.dynamic),
|
||||
"alignToPixelGrid": d.symbol_pixel_aligned(&sym.name),
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
@@ -239,6 +249,7 @@ pub(super) fn symbol_new(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let export = export_type_param(p, C)?.unwrap_or_default();
|
||||
let nine = nine_slice_param(p, C, None)?.flatten();
|
||||
let dynamic = type_param(p, C)?.unwrap_or(false);
|
||||
let pixel = pixel_grid_param(p, C)?.unwrap_or(false);
|
||||
// Keep the art where it was: the geometric centre stays at `c`, whatever the registration is.
|
||||
let place = place_xf(c + reg.offset_from_center(size.0, size.1), size, reg);
|
||||
let id = s.edit("New Symbol", |d, sel| {
|
||||
@@ -249,6 +260,7 @@ pub(super) fn symbol_new(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
d.set_symbol_registration(&name, reg);
|
||||
d.set_symbol_export_type(&name, export);
|
||||
d.set_symbol_nine_slice(&name, nine);
|
||||
d.set_symbol_pixel_aligned(&name, pixel);
|
||||
let id = instance_in_place(d, &ids, &name, place)?;
|
||||
sel.set([id]);
|
||||
Ok(id)
|
||||
@@ -260,6 +272,7 @@ pub(super) fn symbol_new(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
"exportType": export.id(),
|
||||
"nineSlice": nine.map_or(Value::Null, SymbolNineSlice::to_value),
|
||||
"type": type_id(dynamic),
|
||||
"alignToPixelGrid": pixel,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -270,9 +283,15 @@ pub(super) fn symbol_options(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let reg = registration_param(p, C)?;
|
||||
let nine = nine_slice_param(p, C, s.doc()?.doc.symbol_nine_slice(&name))?;
|
||||
let dynamic = type_param(p, C)?;
|
||||
let pixel = pixel_grid_param(p, C)?;
|
||||
let new_name = str_param(p, "newName").map(str::trim).filter(|n| !n.is_empty()).map(str::to_string);
|
||||
if new_name.is_none() && export.is_none() && reg.is_none() && nine.is_none() && dynamic.is_none() {
|
||||
return Err(bad(C, "pass newName, registration, exportType, nineSlice and/or type"));
|
||||
match pixel {
|
||||
None => return Err(bad(C, "pass newName, registration, exportType, nineSlice, type and/or alignToPixelGrid")),
|
||||
// Align to Pixel Grid alone, already as asked: nothing changes and no undo step is added.
|
||||
Some(on) if on == s.doc()?.doc.symbol_pixel_aligned(&name) => return Ok(options_json(&s.doc()?.doc, &name)),
|
||||
Some(_) => {}
|
||||
}
|
||||
}
|
||||
if let Some(ref n) = new_name
|
||||
&& n != &name
|
||||
@@ -324,6 +343,7 @@ pub(super) fn symbol_options(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
d.rename_symbol_registration(&name, n);
|
||||
d.rename_symbol_export_type(&name, n);
|
||||
d.rename_symbol_nine_slice(&name, n);
|
||||
d.rename_symbol_pixel_aligned(&name, n);
|
||||
if d.unknown.get(CURRENT_SYMBOL).and_then(Value::as_str) == Some(name.as_str()) {
|
||||
d.unknown.insert(CURRENT_SYMBOL.into(), json!(n));
|
||||
}
|
||||
@@ -352,16 +372,26 @@ pub(super) fn symbol_options(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
sym.dynamic = dynamic;
|
||||
fit_overrides(d, &instances_of(d, Some(&final_name)));
|
||||
}
|
||||
// Turning it on snaps the art and the instances at actual size when the edit ends
|
||||
// (`object::refresh_pixel_aligned`).
|
||||
if let Some(on) = pixel {
|
||||
d.set_symbol_pixel_aligned(&final_name, on);
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
let d = &s.doc()?.doc;
|
||||
Ok(json!({
|
||||
"name": final_name,
|
||||
"registration": d.symbol_registration(&final_name).0,
|
||||
"exportType": d.symbol_export_type(&final_name).id(),
|
||||
"nineSlice": nine_slice_json(d, &final_name),
|
||||
"type": type_id(d.symbols.iter().any(|x| x.name == final_name && x.dynamic)),
|
||||
}))
|
||||
Ok(options_json(&s.doc()?.doc, &final_name))
|
||||
}
|
||||
|
||||
/// What `symbol.options` answers for symbol `name`.
|
||||
fn options_json(d: &Document, name: &str) -> Value {
|
||||
json!({
|
||||
"name": name,
|
||||
"registration": d.symbol_registration(name).0,
|
||||
"exportType": d.symbol_export_type(name).id(),
|
||||
"nineSlice": nine_slice_json(d, name),
|
||||
"type": type_id(d.symbols.iter().any(|x| x.name == name && x.dynamic)),
|
||||
"alignToPixelGrid": d.symbol_pixel_aligned(name),
|
||||
})
|
||||
}
|
||||
|
||||
fn resolve_symbol(d: &Document, p: &Value, cmd: &str) -> Result<String> {
|
||||
@@ -702,6 +732,7 @@ pub(super) fn symbol_delete(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
d.set_symbol_registration(name, SymbolRegistration::CENTER);
|
||||
d.clear_symbol_export_type(name);
|
||||
d.set_symbol_nine_slice(name, None);
|
||||
d.set_symbol_pixel_aligned(name, false);
|
||||
if d.unknown.get(CURRENT_SYMBOL).and_then(Value::as_str) == Some(name.as_str()) {
|
||||
d.unknown.remove(CURRENT_SYMBOL);
|
||||
}
|
||||
@@ -725,6 +756,7 @@ pub(super) fn symbol_duplicate(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let reg = d.symbol_registration(&name);
|
||||
let export = d.symbol_export_type(&name);
|
||||
let nine = d.symbol_nine_slice(&name);
|
||||
let pixel = d.symbol_pixel_aligned(&name);
|
||||
s.edit("Duplicate Symbol", |d, _| {
|
||||
let art = d.reid(&sym.art);
|
||||
d.symbols.push(Symbol { dynamic: sym.dynamic, name: new.clone(), art: Arc::new(art) });
|
||||
@@ -732,6 +764,7 @@ pub(super) fn symbol_duplicate(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
d.set_symbol_registration(&new, reg);
|
||||
d.set_symbol_export_type(&new, export);
|
||||
d.set_symbol_nine_slice(&new, nine);
|
||||
d.set_symbol_pixel_aligned(&new, pixel);
|
||||
Ok(())
|
||||
})?;
|
||||
Ok(json!({ "name": new, "registration": reg.0, "exportType": export.id(), "nineSlice": nine.map_or(Value::Null, SymbolNineSlice::to_value) }))
|
||||
|
||||
@@ -766,6 +766,8 @@ pub struct SymbolOptions {
|
||||
pub export_type: SymbolExportType,
|
||||
/// 9-slice guides (`None`: 9-slice scaling off).
|
||||
pub nine_slice: Option<SymbolNineSlice>,
|
||||
/// Align to Pixel Grid.
|
||||
pub pixel_aligned: bool,
|
||||
}
|
||||
|
||||
impl SymbolOptions {
|
||||
@@ -776,6 +778,7 @@ impl SymbolOptions {
|
||||
registration: d.symbol_registration(name),
|
||||
export_type: d.symbol_export_type(name),
|
||||
nine_slice: d.symbol_nine_slice(name),
|
||||
pixel_aligned: d.symbol_pixel_aligned(name),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,6 +788,7 @@ impl SymbolOptions {
|
||||
d.set_symbol_registration(name, self.registration);
|
||||
d.set_symbol_export_type(name, self.export_type);
|
||||
d.set_symbol_nine_slice(name, self.nine_slice);
|
||||
d.set_symbol_pixel_aligned(name, self.pixel_aligned);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ pub use commands::specs;
|
||||
pub(super) use compound::{as_clipping_path, make_clipping_path, release_clip};
|
||||
pub(crate) use pixelgrid::{
|
||||
align_new_object, can_align, keep_aligned_in, keep_compound_aligned, keep_pixel_aligned, refresh as refresh_pixel_aligned, resnap,
|
||||
snap_if_aligned,
|
||||
snap_if_aligned, snap_symbol_art,
|
||||
};
|
||||
pub(super) use shape::recut;
|
||||
pub(crate) use transform::{apply_transform, preview_copies, scaling, transform_node, transform_patterns, transforms_objects};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
//! Transform panel › Align to Pixel Grid: an object's pixel-aligned property, and the snapping that
|
||||
//! keeps the horizontal and vertical segments of a pixel-aligned object on the pixel grid
|
||||
//! (<https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/pixel-preview-mode-for-web-graphics.html>).
|
||||
//! (<https://helpx.adobe.com/illustrator/desktop/get-started/learn-the-basics/pixel-preview-mode-for-web-graphics.html>),
|
||||
//! and Symbol Options › Align to Pixel Grid, which keeps a symbol's instances on the pixel grid.
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use vectorcraft_doc::{AppearanceItem, LiveShape, StrokeAlign};
|
||||
|
||||
@@ -150,10 +153,234 @@ pub(crate) fn refresh(before: &Document, doc: &mut Document) {
|
||||
keep_pixel_aligned(n, Scaling::default());
|
||||
}
|
||||
}
|
||||
refresh_symbols(before, doc);
|
||||
}
|
||||
|
||||
/// How far the linear part of an instance's transform may be from its symbol's natural size, as a
|
||||
/// fraction of that size, for the instance to count as placed at actual size.
|
||||
const ACTUAL_SIZE_TOLERANCE: f64 = 1e-9;
|
||||
|
||||
/// After any edit: Symbol Options › Align to Pixel Grid. The art of a pixel-aligned symbol snaps to
|
||||
/// the pixel grid at the symbol's natural size ([`snap_symbol_art`]) when the symbol becomes
|
||||
/// pixel-aligned, when its art or natural size changes, and when symbol editing mode for it ends
|
||||
/// (while it is edited, the art snaps as the editing layer is written back to it). Every instance
|
||||
/// of such a symbol then goes to whole points ([`snap_instance`]), and so does each instance of a
|
||||
/// pixel-aligned symbol in an object the edit changed or added, the art of opacity masks included.
|
||||
/// An instance in another symbol's art is placed by that symbol's instances and is left as it is.
|
||||
/// A document without pixel-aligned symbols is not walked.
|
||||
fn refresh_symbols(before: &Document, doc: &mut Document) {
|
||||
let aligned = doc.pixel_aligned_symbols();
|
||||
if aligned.is_empty() {
|
||||
return;
|
||||
}
|
||||
let was = before.pixel_aligned_symbols();
|
||||
let edited_before = before.symbol_edit.as_ref().map(|e| e.symbol.as_str());
|
||||
let mut every = false;
|
||||
for name in &aligned {
|
||||
let art_before = before.symbols.iter().find(|s| &s.name == name).map(|s| &s.art);
|
||||
let art_now = doc.symbols.iter().find(|s| &s.name == name).map(|s| &s.art);
|
||||
let art_changed = match (art_before, art_now) {
|
||||
(Some(b), Some(a)) => !Arc::ptr_eq(b, a),
|
||||
_ => true,
|
||||
};
|
||||
let size_changed = before.symbol_natural_xf(name) != doc.symbol_natural_xf(name);
|
||||
if !was.contains(name) || edited_before == Some(name.as_str()) || art_changed || size_changed {
|
||||
snap_symbol_art(doc, name);
|
||||
every = true;
|
||||
}
|
||||
}
|
||||
let natural: HashMap<String, Affine> = aligned.iter().map(|name| (name.clone(), doc.symbol_natural_xf(name))).collect();
|
||||
if every {
|
||||
for layer in doc.layers.iter_mut() {
|
||||
if holds_instance(layer, &natural) {
|
||||
snap_instances_in(Arc::make_mut(layer), &natural);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
let (mut ids, mut masked) = (vec![], vec![]);
|
||||
changed_instances(&before.layers, &doc.layers, &natural, &mut ids, &mut masked);
|
||||
for id in ids {
|
||||
if let Some(n) = doc.node_mut(id) {
|
||||
snap_instance(n, &natural);
|
||||
}
|
||||
}
|
||||
for id in masked {
|
||||
if let Some(m) = doc.node_mut(id).and_then(|n| n.extras_if_any()).and_then(|e| e.mask.as_mut()) {
|
||||
snap_instances_in(Arc::make_mut(&mut m.art), &natural);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Among the objects of `after` that differ from their counterparts in `before` (or are new), in
|
||||
/// groups too: the instances of the symbols in `natural` (`ids`), and the objects whose opacity
|
||||
/// mask art holds such instances (`masked`).
|
||||
fn changed_instances(before: &[Arc<Node>], after: &[Arc<Node>], natural: &HashMap<String, Affine>, ids: &mut Vec<NodeId>, masked: &mut Vec<NodeId>) {
|
||||
let mut by_id: Option<HashMap<NodeId, &Arc<Node>>> = None;
|
||||
for (i, a) in after.iter().enumerate() {
|
||||
let b = match before.get(i) {
|
||||
Some(b) if b.id == a.id => Some(b),
|
||||
_ => by_id.get_or_insert_with(|| before.iter().map(|b| (b.id, b)).collect()).get(&a.id).copied(),
|
||||
};
|
||||
if b.is_some_and(|b| Arc::ptr_eq(b, a)) {
|
||||
continue;
|
||||
}
|
||||
if a.extras().mask.as_ref().is_some_and(|m| holds_instance(&m.art, natural)) {
|
||||
masked.push(a.id);
|
||||
}
|
||||
if let NodeKind::SymbolInstance { symbol, .. } = &a.kind {
|
||||
if natural.contains_key(symbol) {
|
||||
ids.push(a.id);
|
||||
}
|
||||
} else if let Some(children) = a.children() {
|
||||
changed_instances(b.and_then(|b| b.children()).map_or(&[], Vec::as_slice), children, natural, ids, masked);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether `n`, an object in it or the art of an opacity mask in it is an instance of a symbol in
|
||||
/// `natural`.
|
||||
fn holds_instance(n: &Node, natural: &HashMap<String, Affine>) -> bool {
|
||||
matches!(&n.kind, NodeKind::SymbolInstance { symbol, .. } if natural.contains_key(symbol))
|
||||
|| n.extras().mask.as_ref().is_some_and(|m| holds_instance(&m.art, natural))
|
||||
|| n.children().is_some_and(|ch| ch.iter().any(|c| holds_instance(c, natural)))
|
||||
}
|
||||
|
||||
/// [`snap_instance`] on every instance of a symbol in `natural` in `n`, the art of its opacity
|
||||
/// masks included. Only what holds such an instance is copied for editing.
|
||||
fn snap_instances_in(n: &mut Node, natural: &HashMap<String, Affine>) {
|
||||
snap_instance(n, natural);
|
||||
if let Some(m) = n.extras_if_any().and_then(|e| e.mask.as_mut())
|
||||
&& holds_instance(&m.art, natural)
|
||||
{
|
||||
snap_instances_in(Arc::make_mut(&mut m.art), natural);
|
||||
}
|
||||
if let Some(children) = n.children_mut() {
|
||||
for c in children.iter_mut() {
|
||||
if holds_instance(c, natural) {
|
||||
snap_instances_in(Arc::make_mut(c), natural);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Snap the art of pixel-aligned symbol `name` to the pixel grid as it is drawn at the symbol's
|
||||
/// natural size: each path and compound path in it snaps as a pixel-aligned object does
|
||||
/// ([`snap_object`]), measured from the symbol's origin. The art is stored again only when
|
||||
/// something in it moved, and the answer says whether it did.
|
||||
pub(crate) fn snap_symbol_art(doc: &mut Document, name: &str) -> bool {
|
||||
let natural = doc.symbol_natural_xf(name);
|
||||
let det = natural.determinant();
|
||||
if !det.is_finite() || det.abs() < 1e-18 {
|
||||
return false;
|
||||
}
|
||||
let Some(sym) = doc.symbols.iter_mut().find(|s| s.name == name) else { return false };
|
||||
// Instances draw the art's strokes at their stored width, and the art of unlinked opacity
|
||||
// masks, which `Node::transform` leaves alone, at the natural size too.
|
||||
let mut art = (*sym.art).clone();
|
||||
art.transform(natural, false);
|
||||
transform_unlinked_masks(&mut art, natural);
|
||||
if !snap_art(&mut art) {
|
||||
return false;
|
||||
}
|
||||
let inverse = natural.inverse();
|
||||
art.transform(inverse, false);
|
||||
transform_unlinked_masks(&mut art, inverse);
|
||||
sym.art = Arc::new(art);
|
||||
true
|
||||
}
|
||||
|
||||
/// Transform the art of every unlinked opacity mask in `n` by `xf`, in the art of other masks
|
||||
/// too. Only what holds such a mask is copied for editing.
|
||||
fn transform_unlinked_masks(n: &mut Node, xf: Affine) {
|
||||
if let Some(m) = n.extras_if_any().and_then(|e| e.mask.as_mut())
|
||||
&& holds_unlinked_mask(&m.art, !m.linked)
|
||||
{
|
||||
let linked = m.linked;
|
||||
let art = Arc::make_mut(&mut m.art);
|
||||
if !linked {
|
||||
art.transform(xf, false);
|
||||
}
|
||||
transform_unlinked_masks(art, xf);
|
||||
}
|
||||
if let Some(children) = n.children_mut() {
|
||||
for c in children.iter_mut() {
|
||||
if holds_unlinked_mask(c, false) {
|
||||
transform_unlinked_masks(Arc::make_mut(c), xf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether `n` is the art of an unlinked mask (`unlinked`), or it or an object in it, in the art of
|
||||
/// its masks too, has an unlinked opacity mask.
|
||||
fn holds_unlinked_mask(n: &Node, unlinked: bool) -> bool {
|
||||
unlinked
|
||||
|| n.extras().mask.as_ref().is_some_and(|m| holds_unlinked_mask(&m.art, !m.linked))
|
||||
|| n.children().is_some_and(|ch| ch.iter().any(|c| holds_unlinked_mask(c, false)))
|
||||
}
|
||||
|
||||
/// Snap every path and compound path in `n` ([`can_align`]) with [`snap_object`], the art of
|
||||
/// opacity masks included (those of a compound path's paths too). Returns whether anything
|
||||
/// changed.
|
||||
fn snap_art(n: &mut Node) -> bool {
|
||||
let mut moved = false;
|
||||
if can_align(n) {
|
||||
let was = n.clone();
|
||||
snap_object(n, Scaling::default());
|
||||
moved = *n != was;
|
||||
if let Some(children) = n.children_mut() {
|
||||
for c in children.iter_mut() {
|
||||
if c.extras().mask.is_some() {
|
||||
moved |= snap_mask(Arc::make_mut(c));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let Some(children) = n.children_mut() {
|
||||
for c in children.iter_mut() {
|
||||
moved |= snap_art(Arc::make_mut(c));
|
||||
}
|
||||
}
|
||||
// After the object itself, which a linked mask follows.
|
||||
snap_mask(n) || moved
|
||||
}
|
||||
|
||||
/// [`snap_art`] on the art of `n`'s opacity mask. Returns whether anything changed.
|
||||
fn snap_mask(n: &mut Node) -> bool {
|
||||
let Some(m) = n.extras_if_any().and_then(|e| e.mask.as_mut()) else { return false };
|
||||
let mut art = (*m.art).clone();
|
||||
if !snap_art(&mut art) {
|
||||
return false;
|
||||
}
|
||||
m.art = Arc::new(art);
|
||||
true
|
||||
}
|
||||
|
||||
/// Move symbol instance `n` to whole points when its transform places its symbol's art at the
|
||||
/// symbol's natural size (`natural`, by symbol name), reflected across one axis or not. A scaled,
|
||||
/// rotated (a half turn included) or sheared instance stays where it is.
|
||||
fn snap_instance(n: &mut Node, natural: &HashMap<String, Affine>) {
|
||||
let NodeKind::SymbolInstance { symbol, xf } = &mut n.kind else { return };
|
||||
let Some(nat) = natural.get(symbol.as_str()) else { return };
|
||||
let [a, b, c, d, e, f] = xf.as_coeffs();
|
||||
let [na, _, _, nd, _, _] = nat.as_coeffs();
|
||||
let near = |v: f64, to: f64| (v.abs() - to.abs()).abs() <= ACTUAL_SIZE_TOLERANCE * to.abs().max(1.0);
|
||||
let actual =
|
||||
near(a, na) && near(d, nd) && b.abs() <= ACTUAL_SIZE_TOLERANCE * na.abs().max(1.0) && c.abs() <= ACTUAL_SIZE_TOLERANCE * nd.abs().max(1.0);
|
||||
// Flipped along both axes is a half turn, which counts as rotated.
|
||||
let half_turn = a * na < 0.0 && d * nd < 0.0;
|
||||
if !actual || half_turn || !e.is_finite() || !f.is_finite() {
|
||||
return;
|
||||
}
|
||||
let (x, y) = (e.round(), f.round());
|
||||
if x != e || y != f {
|
||||
*xf = Affine::new([a, b, c, d, x, y]);
|
||||
}
|
||||
}
|
||||
|
||||
/// After a pass that moved what objects `ids` hold (Objects on Path placing its members): snap the
|
||||
/// pixel-aligned objects in them to the pixel grid again.
|
||||
/// pixel-aligned objects and the instances of pixel-aligned symbols in them to the pixel grid
|
||||
/// again.
|
||||
pub(crate) fn keep_aligned_in(doc: &mut Document, ids: &[NodeId]) {
|
||||
for id in ids {
|
||||
if doc.node(*id).is_some_and(holds_aligned)
|
||||
@@ -162,6 +389,18 @@ pub(crate) fn keep_aligned_in(doc: &mut Document, ids: &[NodeId]) {
|
||||
keep_pixel_aligned(n, Scaling::default());
|
||||
}
|
||||
}
|
||||
let aligned = doc.pixel_aligned_symbols();
|
||||
if aligned.is_empty() {
|
||||
return;
|
||||
}
|
||||
let natural: HashMap<String, Affine> = aligned.iter().map(|name| (name.clone(), doc.symbol_natural_xf(name))).collect();
|
||||
for id in ids {
|
||||
if doc.node(*id).is_some_and(|n| holds_instance(n, &natural))
|
||||
&& let Some(n) = doc.node_mut(*id)
|
||||
{
|
||||
snap_instances_in(n, &natural);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The objects of `after` that differ from their counterparts in `before` (or are new) and are
|
||||
|
||||
@@ -529,6 +529,24 @@ pub(crate) fn sync(before: &Document, d: &mut Document) -> Result<()> {
|
||||
};
|
||||
d.symbols[index].art = Arc::new(new_art);
|
||||
follow_objects(d, &se.symbol, (&old, old_group), (&art, group));
|
||||
// A pixel-aligned symbol stores its art on the pixel grid while it is edited too, and the
|
||||
// editing layer shows the snapped art.
|
||||
if d.symbol_pixel_aligned(&se.symbol) && super::object::snap_symbol_art(d, &se.symbol) {
|
||||
let stored = &d.symbols[index].art;
|
||||
let snapped: Vec<Arc<Node>> = if group { stored.children().map(|c| c.to_vec()).unwrap_or_default() } else { vec![stored.clone()] };
|
||||
let mut snapped = snapped.into_iter().map(|n| {
|
||||
let mut n = (*n).clone();
|
||||
n.transform(se.xf, false);
|
||||
Arc::new(n)
|
||||
});
|
||||
if let Some(ch) = d.node_mut(se.layer).and_then(Node::children_mut) {
|
||||
for c in ch.iter_mut().filter(|c| !c.is_ruler_guide()) {
|
||||
if let Some(n) = snapped.next() {
|
||||
*c = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(e) = d.symbol_edit.as_mut() {
|
||||
e.changed = true;
|
||||
e.group = group;
|
||||
|
||||
@@ -499,12 +499,13 @@ fn instance(name: &str) -> Node {
|
||||
}
|
||||
|
||||
/// Symbol `from`'s Symbol Options in `src` (natural size, registration, export type, 9-slice
|
||||
/// guides) given to symbol `to` of `d`.
|
||||
/// guides, Align to Pixel Grid) given to symbol `to` of `d`.
|
||||
fn copy_options(src: &Document, from: &str, d: &mut Document, to: &str) {
|
||||
set_natural_size(d, to, Some(natural_size(src, from)));
|
||||
d.set_symbol_registration(to, src.symbol_registration(from));
|
||||
d.set_symbol_export_type(to, src.symbol_export_type(from));
|
||||
d.set_symbol_nine_slice(to, src.symbol_nine_slice(from));
|
||||
d.set_symbol_pixel_aligned(to, src.symbol_pixel_aligned(from));
|
||||
}
|
||||
|
||||
fn builtin_info(b: &BuiltinSymbolLibrary) -> LibraryInfo {
|
||||
|
||||
@@ -1158,3 +1158,304 @@ fn not_aligned_to_pixel_grid_takes_a_compound_path_by_its_own_property() {
|
||||
assert!(!aligned(&s, off));
|
||||
assert_eq!(not_aligned(&mut s, &[compound]), vec![other]);
|
||||
}
|
||||
|
||||
/// The anchors of the paths in the art of symbol instance `inst`, where its transform places them.
|
||||
fn placed_points(s: &Session, inst: u64) -> Vec<(f64, f64)> {
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let NodeKind::SymbolInstance { symbol, xf } = &d.node(NodeId(inst)).unwrap().kind else { panic!("{inst} is not a symbol instance") };
|
||||
let art = &d.symbols.iter().find(|x| &x.name == symbol).unwrap().art;
|
||||
let mut out = vec![];
|
||||
art.walk(&mut |n| {
|
||||
if let Some(p) = n.path_data() {
|
||||
out.extend(p.anchors().map(|(_, _, a)| {
|
||||
let q = *xf * a.p;
|
||||
(q.x, q.y)
|
||||
}));
|
||||
}
|
||||
});
|
||||
out
|
||||
}
|
||||
|
||||
/// The transform of symbol instance `inst`.
|
||||
fn instance_xf(s: &Session, inst: u64) -> vectorcraft_geom::Affine {
|
||||
match &s.doc().unwrap().doc.node(NodeId(inst)).unwrap().kind {
|
||||
NodeKind::SymbolInstance { xf, .. } => *xf,
|
||||
_ => panic!("{inst} is not a symbol instance"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Symbol Options › Align to Pixel Grid on a new symbol: the instance that replaces the selection
|
||||
/// draws its art's edges on whole points, and goes back to them after a move by a fraction of a
|
||||
/// point; a symbol made without it keeps the art where it was drawn.
|
||||
#[test]
|
||||
fn a_pixel_aligned_symbol_keeps_its_instance_on_whole_points() {
|
||||
let mut s = new_doc();
|
||||
path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 2.0);
|
||||
let r = s.execute("symbol.new", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap();
|
||||
assert_eq!(r["alignToPixelGrid"], true);
|
||||
let inst = r["id"].as_u64().unwrap();
|
||||
let pts = placed_points(&s, inst);
|
||||
assert_eq!(pts.len(), 4);
|
||||
assert!(whole(&pts), "{pts:?}");
|
||||
s.execute("object.move", &json!({"dx": 0.3, "dy": 0.45})).unwrap();
|
||||
let pts = placed_points(&s, inst);
|
||||
assert!(whole(&pts), "{pts:?}");
|
||||
let list = s.execute("symbol.list", &json!({})).unwrap();
|
||||
assert_eq!(list["symbols"][0]["alignToPixelGrid"], true);
|
||||
|
||||
path(&mut s, "M100.3 20.6 L140.7 20.6 L140.7 30.3 L100.3 30.3 Z", 2.0);
|
||||
let plain = s.execute("symbol.new", &json!({"name": "Plain"})).unwrap();
|
||||
assert_eq!(plain["alignToPixelGrid"], false);
|
||||
let pts = placed_points(&s, plain["id"].as_u64().unwrap());
|
||||
assert!(!whole(&pts), "{pts:?}");
|
||||
}
|
||||
|
||||
/// A centered stroke of odd weight puts the art's edges on half points, so the stroke's own edges
|
||||
/// fall on the grid.
|
||||
#[test]
|
||||
fn a_pixel_aligned_symbol_with_an_odd_stroke_goes_to_half_points() {
|
||||
let mut s = new_doc();
|
||||
path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 1.0);
|
||||
let inst = s.execute("symbol.new", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap()["id"].as_u64().unwrap();
|
||||
let pts = placed_points(&s, inst);
|
||||
assert!(halves(&pts), "{pts:?}");
|
||||
}
|
||||
|
||||
/// Turning it on in Symbol Options snaps the instances placed at actual size and leaves a scaled
|
||||
/// one where it is; instances placed later land on whole points; asking again for the value the
|
||||
/// symbol has adds no undo step; a duplicate and a rename keep it, a delete clears it, and a value
|
||||
/// that is not true or false is refused.
|
||||
#[test]
|
||||
fn symbol_options_align_to_pixel_grid_snaps_instances_at_actual_size() {
|
||||
let mut s = new_doc();
|
||||
path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 2.0);
|
||||
let a = s.execute("symbol.new", &json!({"name": "Px"})).unwrap()["id"].as_u64().unwrap();
|
||||
let b = s.execute("symbol.place", &json!({"name": "Px", "x": 100.3, "y": 200.7})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("select.set", &json!({"ids": [b]})).unwrap();
|
||||
s.execute("object.scale", &json!({"sx": 150, "sy": 150})).unwrap();
|
||||
let scaled = instance_xf(&s, b);
|
||||
assert!(!whole(&placed_points(&s, a)));
|
||||
|
||||
let r = s.execute("symbol.options", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap();
|
||||
assert_eq!(r["alignToPixelGrid"], true);
|
||||
let pts = placed_points(&s, a);
|
||||
assert!(whole(&pts), "{pts:?}");
|
||||
assert_eq!(instance_xf(&s, b), scaled);
|
||||
let c = s.execute("symbol.place", &json!({"name": "Px", "x": 50.3, "y": 60.6})).unwrap()["id"].as_u64().unwrap();
|
||||
let pts = placed_points(&s, c);
|
||||
assert!(whole(&pts), "{pts:?}");
|
||||
|
||||
let steps = undo_len(&s);
|
||||
s.execute("symbol.options", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap();
|
||||
assert_eq!(undo_len(&s), steps);
|
||||
|
||||
assert_eq!(s.execute("symbol.duplicate", &json!({"name": "Px"})).unwrap()["name"], "Px copy");
|
||||
assert!(s.doc().unwrap().doc.symbol_pixel_aligned("Px copy"));
|
||||
s.execute("symbol.options", &json!({"name": "Px", "newName": "Grid"})).unwrap();
|
||||
assert!(s.doc().unwrap().doc.symbol_pixel_aligned("Grid"));
|
||||
assert!(!s.doc().unwrap().doc.symbol_pixel_aligned("Px"));
|
||||
s.execute("symbol.delete", &json!({"names": ["Grid", "Px copy"]})).unwrap();
|
||||
assert!(s.doc().unwrap().doc.unknown.get(vectorcraft_doc::SYMBOL_PIXEL_ALIGNED).is_none());
|
||||
|
||||
path(&mut s, "M10 10 L20 10 L20 20 L10 20 Z", 1.0);
|
||||
assert!(s.execute("symbol.new", &json!({"alignToPixelGrid": "yes"})).is_err());
|
||||
assert!(s.execute("symbol.new", &json!({"alignToPixelGrid": null})).is_err());
|
||||
s.execute("symbol.new", &json!({"name": "Q"})).unwrap();
|
||||
assert!(s.execute("symbol.options", &json!({"name": "Q", "alignToPixelGrid": 1})).is_err());
|
||||
assert!(s.execute("symbol.options", &json!({"name": "Q", "alignToPixelGrid": null})).is_err());
|
||||
}
|
||||
|
||||
/// An instance reflected across one axis goes back to whole points after a move; one turned a half
|
||||
/// turn counts as rotated and moves by exactly the amount asked.
|
||||
#[test]
|
||||
fn a_reflected_instance_snaps_and_a_half_turned_one_does_not() {
|
||||
let mut s = new_doc();
|
||||
path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 2.0);
|
||||
let inst = s.execute("symbol.new", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("object.reflect", &json!({"axis": "vertical"})).unwrap();
|
||||
s.execute("object.move", &json!({"dx": 0.3, "dy": 0.45})).unwrap();
|
||||
let [.., e, f] = instance_xf(&s, inst).as_coeffs();
|
||||
assert!(whole(&[(e, f)]), "{e} {f}");
|
||||
s.execute("object.reflect", &json!({"axis": "vertical"})).unwrap();
|
||||
s.execute("object.rotate", &json!({"angle": 180})).unwrap();
|
||||
let [.., e0, f0] = instance_xf(&s, inst).as_coeffs();
|
||||
s.execute("object.move", &json!({"dx": 0.3, "dy": 0.45})).unwrap();
|
||||
let [.., e1, f1] = instance_xf(&s, inst).as_coeffs();
|
||||
assert!((e1 - e0 - 0.3).abs() < 1e-9 && (f1 - f0 - 0.45).abs() < 1e-9, "{e0} {f0} -> {e1} {f1}");
|
||||
}
|
||||
|
||||
/// An instance of a pixel-aligned symbol attached to a path goes back to whole points each time the
|
||||
/// path places it.
|
||||
#[test]
|
||||
fn an_instance_on_a_path_stays_on_whole_points() {
|
||||
let mut s = new_doc();
|
||||
path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 2.0);
|
||||
let inst = s.execute("symbol.new", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap()["id"].as_u64().unwrap();
|
||||
let spine = s.execute("path.create", &json!({"d": "M 0.3 100.4 L 300.3 100.4"})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("object.objectsOnPath.attach", &json!({"path": spine, "ids": [inst]})).unwrap();
|
||||
let pts = placed_points(&s, inst);
|
||||
assert!(whole(&pts), "attached: {pts:?}");
|
||||
let anchors = json!([{"x": 0.6, "y": 120.7}, {"x": 300.6, "y": 120.7}]);
|
||||
s.execute("path.setAnchors", &json!({"id": spine, "subpaths": [{"anchors": anchors, "closed": false}]})).unwrap();
|
||||
let pts = placed_points(&s, inst);
|
||||
assert!(whole(&pts), "path edited: {pts:?}");
|
||||
}
|
||||
|
||||
/// A path in the art of an opacity mask in a pixel-aligned symbol's art snaps with the rest of
|
||||
/// the art.
|
||||
#[test]
|
||||
fn mask_art_in_a_pixel_aligned_symbol_snaps() {
|
||||
let mut s = new_doc();
|
||||
let r = path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 2.0);
|
||||
let m = path(&mut s, "M12.3 22.6 L30.7 22.6 L30.7 28.3 L12.3 28.3 Z", 2.0);
|
||||
{
|
||||
let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
|
||||
let art = d.remove(NodeId(m)).unwrap();
|
||||
d.node_mut(NodeId(r)).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new((*art).clone(), true)));
|
||||
}
|
||||
s.execute("select.set", &json!({"ids": [r]})).unwrap();
|
||||
let inst = s.execute("symbol.new", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap()["id"].as_u64().unwrap();
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let xf = instance_xf(&s, inst);
|
||||
let art = &d.symbols.iter().find(|x| x.name == "Px").unwrap().art;
|
||||
let mut pts = vec![];
|
||||
art.walk(&mut |n| {
|
||||
if let Some(mask) = n.extras().mask.as_ref() {
|
||||
mask.art.walk(&mut |c| {
|
||||
if let Some(p) = c.path_data() {
|
||||
pts.extend(p.anchors().map(|(_, _, a)| {
|
||||
let q = xf * a.p;
|
||||
(q.x, q.y)
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
assert_eq!(pts.len(), 4);
|
||||
assert!(whole(&pts), "{pts:?}");
|
||||
}
|
||||
|
||||
/// A path in the art of an unlinked opacity mask in a pixel-aligned symbol's art snaps as the mask
|
||||
/// is drawn at the symbol's natural size.
|
||||
#[test]
|
||||
fn unlinked_mask_art_in_a_pixel_aligned_symbol_snaps_at_natural_size() {
|
||||
let mut s = new_doc();
|
||||
let r = path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 2.0);
|
||||
let m = path(&mut s, "M12.3 22.6 L30.7 22.6 L30.7 28.3 L12.3 28.3 Z", 2.0);
|
||||
{
|
||||
let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
|
||||
let art = d.remove(NodeId(m)).unwrap();
|
||||
d.node_mut(NodeId(r)).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new((*art).clone(), false)));
|
||||
}
|
||||
s.execute("select.set", &json!({"ids": [r]})).unwrap();
|
||||
let inst = s.execute("symbol.new", &json!({"name": "Px"})).unwrap()["id"].as_u64().unwrap();
|
||||
assert_ne!(s.doc().unwrap().doc.symbol_natural_xf("Px"), vectorcraft_geom::Affine::IDENTITY);
|
||||
{
|
||||
let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
|
||||
let sym = d.symbols.iter_mut().find(|x| x.name == "Px").unwrap();
|
||||
std::sync::Arc::make_mut(&mut sym.art).extras_mut().mask.as_mut().unwrap().linked = false;
|
||||
}
|
||||
s.execute("symbol.options", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap();
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let xf = instance_xf(&s, inst);
|
||||
let art = &d.symbols.iter().find(|x| x.name == "Px").unwrap().art;
|
||||
let mut pts = vec![];
|
||||
art.walk(&mut |n| {
|
||||
if let Some(mask) = n.extras().mask.as_ref() {
|
||||
mask.art.walk(&mut |c| {
|
||||
if let Some(p) = c.path_data() {
|
||||
pts.extend(p.anchors().map(|(_, _, a)| {
|
||||
let q = xf * a.p;
|
||||
(q.x, q.y)
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
assert_eq!(pts.len(), 4);
|
||||
assert!(whole(&pts), "{pts:?}");
|
||||
}
|
||||
|
||||
/// A path in the art of an opacity mask on a path of a compound path in a pixel-aligned symbol's
|
||||
/// art snaps with the rest of the art.
|
||||
#[test]
|
||||
fn mask_art_on_a_compound_paths_path_in_a_pixel_aligned_symbol_snaps() {
|
||||
let mut s = new_doc();
|
||||
let a = path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 2.0);
|
||||
let b = path(&mut s, "M50.3 20.6 L60.7 20.6 L60.7 30.3 L50.3 30.3 Z", 2.0);
|
||||
s.execute("select.set", &json!({"ids": [a, b]})).unwrap();
|
||||
let c = s.execute("object.compoundPath.make", &json!({})).unwrap()["id"].as_u64().unwrap();
|
||||
let m = path(&mut s, "M12.3 22.6 L30.7 22.6 L30.7 28.3 L12.3 28.3 Z", 2.0);
|
||||
{
|
||||
let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
|
||||
let art = d.remove(NodeId(m)).unwrap();
|
||||
let first = d.node(NodeId(c)).unwrap().children().unwrap()[0].id;
|
||||
d.node_mut(first).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new((*art).clone(), true)));
|
||||
}
|
||||
s.execute("select.set", &json!({"ids": [c]})).unwrap();
|
||||
let inst = s.execute("symbol.new", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap()["id"].as_u64().unwrap();
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let xf = instance_xf(&s, inst);
|
||||
let art = &d.symbols.iter().find(|x| x.name == "Px").unwrap().art;
|
||||
let mut pts = vec![];
|
||||
art.walk(&mut |n| {
|
||||
if let Some(mask) = n.extras().mask.as_ref() {
|
||||
mask.art.walk(&mut |c| {
|
||||
if let Some(p) = c.path_data() {
|
||||
pts.extend(p.anchors().map(|(_, _, a)| {
|
||||
let q = xf * a.p;
|
||||
(q.x, q.y)
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
assert_eq!(pts.len(), 4);
|
||||
assert!(whole(&pts), "{pts:?}");
|
||||
}
|
||||
|
||||
/// An instance in the art of an object's opacity mask goes to whole points when its symbol is made
|
||||
/// pixel-aligned.
|
||||
#[test]
|
||||
fn an_instance_in_an_opacity_mask_snaps_with_its_symbol() {
|
||||
let mut s = new_doc();
|
||||
path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 2.0);
|
||||
s.execute("symbol.new", &json!({"name": "Px"})).unwrap();
|
||||
let b = s.execute("symbol.place", &json!({"name": "Px", "x": 100.3, "y": 200.7})).unwrap()["id"].as_u64().unwrap();
|
||||
let r = path(&mut s, "M80 180 L160 180 L160 240 L80 240 Z", 1.0);
|
||||
{
|
||||
let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc);
|
||||
let inst = d.remove(NodeId(b)).unwrap();
|
||||
d.node_mut(NodeId(r)).unwrap().extras_mut().mask = Some(Box::new(vectorcraft_doc::OpacityMask::new((*inst).clone(), true)));
|
||||
}
|
||||
s.execute("symbol.options", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap();
|
||||
let d = &s.doc().unwrap().doc;
|
||||
let mask = d.node(NodeId(r)).unwrap().extras().mask.clone().unwrap();
|
||||
let NodeKind::SymbolInstance { xf, .. } = &mask.art.kind else { panic!("the mask art is not the instance") };
|
||||
let [.., e, f] = xf.as_coeffs();
|
||||
assert!(whole(&[(e, f)]), "{e} {f}");
|
||||
}
|
||||
|
||||
/// While a pixel-aligned symbol is edited, the art written back from the editing layer is stored
|
||||
/// on the pixel grid, so its instances stay on it.
|
||||
#[test]
|
||||
fn art_edited_in_symbol_editing_mode_stays_on_the_pixel_grid() {
|
||||
let mut s = new_doc();
|
||||
path(&mut s, "M10.3 20.6 L40.7 20.6 L40.7 30.3 L10.3 30.3 Z", 2.0);
|
||||
let inst = s.execute("symbol.new", &json!({"name": "Px", "alignToPixelGrid": true})).unwrap()["id"].as_u64().unwrap();
|
||||
s.execute("symbol.edit", &json!({"ids": [inst]})).unwrap();
|
||||
let st = s.doc().unwrap();
|
||||
let layer = st.doc.symbol_edit.as_ref().unwrap().layer;
|
||||
let part = st.doc.node(layer).unwrap().children().unwrap()[0].id.0;
|
||||
s.execute("select.set", &json!({"ids": [part]})).unwrap();
|
||||
s.execute("object.move", &json!({"dx": 0.3, "dy": 0.45})).unwrap();
|
||||
assert!(s.doc().unwrap().doc.symbol_edit.is_some());
|
||||
let pts = placed_points(&s, inst);
|
||||
assert!(whole(&pts), "{pts:?}");
|
||||
// The editing layer shows the art as it is stored.
|
||||
let shown = points(&s, part);
|
||||
assert!(whole(&shown), "{shown:?}");
|
||||
s.execute("symbol.exitEditing", &json!({})).unwrap();
|
||||
let pts = placed_points(&s, inst);
|
||||
assert!(whole(&pts), "{pts:?}");
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
//! (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:
|
||||
//! 4 = centre), `alignToPixelGrid` (bool, off for a new symbol), `__edit` (true when editing an
|
||||
//! existing symbol). Help:
|
||||
//! <https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-and-place-symbols.html>.
|
||||
|
||||
use serde_json::{Map, Value, json};
|
||||
@@ -75,7 +76,8 @@ pub fn open(app: &mut VectorcraftApp) -> Result<Value, String> {
|
||||
return Err("nothing selected".into());
|
||||
}
|
||||
let name = st.doc.unique_symbol_name("New Symbol");
|
||||
let mut fields = json!({ "name": name, "exportType": "movieClip", "type": "dynamic", "registration": 4, "__edit": false });
|
||||
let mut fields =
|
||||
json!({ "name": name, "exportType": "movieClip", "type": "dynamic", "registration": 4, "alignToPixelGrid": false, "__edit": false });
|
||||
if let Some(o) = fields.as_object_mut() {
|
||||
o.extend(slice_fields(None));
|
||||
}
|
||||
@@ -107,6 +109,7 @@ pub fn open_edit(app: &mut VectorcraftApp, name: Option<&str>) -> Result<Value,
|
||||
"exportType": export,
|
||||
"type": kind,
|
||||
"registration": registration,
|
||||
"alignToPixelGrid": st.doc.symbol_pixel_aligned(&name),
|
||||
"__edit": true,
|
||||
"__from": name,
|
||||
});
|
||||
@@ -160,6 +163,9 @@ fn body(_: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool {
|
||||
ui.end_row();
|
||||
}
|
||||
}
|
||||
label(ui, "");
|
||||
form::check(ui, d, "alignToPixelGrid", tl!("Align to Pixel Grid"));
|
||||
ui.end_row();
|
||||
});
|
||||
false
|
||||
}
|
||||
@@ -175,16 +181,17 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
|
||||
let kind = d.str("type");
|
||||
let registration = d.fields.get("registration").and_then(Value::as_u64).unwrap_or(4);
|
||||
let edit = d.fields.get("__edit").and_then(Value::as_bool).unwrap_or(false);
|
||||
let pixel = d.bool("alignToPixelGrid");
|
||||
let r = if edit {
|
||||
let from = d.fields.get("__from").and_then(Value::as_str).unwrap_or(name);
|
||||
let mut params = json!({ "name": from, "exportType": export, "type": kind, "registration": registration });
|
||||
let mut params = json!({ "name": from, "exportType": export, "type": kind, "registration": registration, "alignToPixelGrid": pixel });
|
||||
merge(&mut params, slice_params(d));
|
||||
if from != name {
|
||||
params["newName"] = json!(name);
|
||||
}
|
||||
app.run("symbol.options", params)
|
||||
} else {
|
||||
let mut params = json!({ "name": name, "exportType": export, "type": kind, "registration": registration });
|
||||
let mut params = json!({ "name": name, "exportType": export, "type": kind, "registration": registration, "alignToPixelGrid": pixel });
|
||||
merge(&mut params, slice_params(d));
|
||||
app.run("symbol.new", params)
|
||||
};
|
||||
|
||||
@@ -944,6 +944,26 @@ mod tests {
|
||||
assert_eq!(nine, json!([-0.123456789, 1.5, -1.255, -2.75]));
|
||||
}
|
||||
|
||||
/// Symbol Options › Align to Pixel Grid is off for a new symbol, OK sends it, and the dialog
|
||||
/// reopens with the symbol's setting.
|
||||
#[test]
|
||||
fn symbol_options_sets_align_to_pixel_grid() {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 200, "height": 100})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 10.3, "y": 10.6, "width": 30, "height": 20})).unwrap();
|
||||
app.run("ui.symbolOptions", json!({})).unwrap();
|
||||
assert!(!app.ui.dialog.as_ref().unwrap().bool("alignToPixelGrid"));
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("alignToPixelGrid".into(), json!(true));
|
||||
crate::dialogs::confirm(&mut app).unwrap();
|
||||
let name = symbols(&mut app)[0].clone();
|
||||
assert_eq!(app.run("symbol.list", json!({})).unwrap()["symbols"][0]["alignToPixelGrid"], true);
|
||||
app.run("ui.symbolOptions", json!({"edit": true, "name": name})).unwrap();
|
||||
assert!(app.ui.dialog.as_ref().unwrap().bool("alignToPixelGrid"));
|
||||
app.ui.dialog.as_mut().unwrap().fields.insert("alignToPixelGrid".into(), json!(false));
|
||||
crate::dialogs::confirm(&mut app).unwrap();
|
||||
assert_eq!(app.run("symbol.list", json!({})).unwrap()["symbols"][0]["alignToPixelGrid"], false);
|
||||
}
|
||||
|
||||
/// F8 is Symbol Options… (`ui.symbolOptions`) by default, on every platform. Shift+F8 and Cmd+F8
|
||||
/// are still the Transform and Info panels' keys, and Cmd+Shift+F8 is still Edit Pattern's. No
|
||||
/// other command, tool or panel has F8 by default.
|
||||
|
||||
+13
-5
@@ -3271,16 +3271,24 @@ horizontal guide between its top and bottom. Released anywhere else, it makes no
|
||||
These families are in the live catalog (`command_list` / `vectorcraft://commands`); the prompt `trace-and-style`
|
||||
already walks Image Trace. Short agent entry points:
|
||||
|
||||
- Symbols: `symbol.list` (each row includes `registration` 0..8, `exportType`: `movieClip`|`graphic` and `type`:
|
||||
`static`|`dynamic`),
|
||||
`symbol.new {name?, registration?, exportType?, nineSlice?, nineSliceGuides?, type?, ids?}`,
|
||||
`symbol.options {name?, newName?, registration?, exportType?, nineSlice?, nineSliceGuides?, type?}` (`nineSlice` bool turns
|
||||
- Symbols: `symbol.list` (each row includes `registration` 0..8, `exportType`: `movieClip`|`graphic`, `type`:
|
||||
`static`|`dynamic` and `alignToPixelGrid`),
|
||||
`symbol.new {name?, registration?, exportType?, nineSlice?, nineSliceGuides?, type?, alignToPixelGrid?, ids?}`,
|
||||
`symbol.options {name?, newName?, registration?, exportType?, nineSlice?, nineSliceGuides?, type?, alignToPixelGrid?}` (`nineSlice` bool turns
|
||||
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),
|
||||
Symbol Type, `static` by default for the command and `dynamic` by default in the Symbol Options dialog;
|
||||
`alignToPixelGrid` is Symbol Options › Align to Pixel Grid, off by default: when it is on, the horizontal and
|
||||
vertical straight segments of the paths in the symbol's art snap to whole points (half points for an odd centered
|
||||
stroke) as the art is drawn at the symbol's natural size, its stroke weights become whole points, and each instance
|
||||
placed at that size, reflected across one axis or not, moves to whole points and goes back to them after every move;
|
||||
VectorCraft leaves a scaled, rotated (a half turn included) or sheared instance, and an instance in another symbol's
|
||||
art, where it is, snaps the art again after it is edited, and does not count
|
||||
instances in `select.object.notAlignedToPixelGrid`; `alignToPixelGrid` alone with the value the symbol already has
|
||||
adds no undo step),
|
||||
`symbol.place {name?, x?, y?}`, `symbol.breakLink {ids?}` (the art keeps the instance's opacity mask and its bounding box, square after
|
||||
`object.resetBoundingBox`; a hidden or locked instance's
|
||||
art stays hidden or locked and is not selected), `symbol.replace`,
|
||||
|
||||
+1
-1
@@ -436,7 +436,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
|
||||
| Make Compound Path on a group (such as outlined type) keeps its backmost path's paint; compound paths joined into one keep their holes | done | #1537 |
|
||||
| Symbol libraries: Window › Symbol Libraries (Basic Shapes, UI Frames, Map Markers, Inventory Icons, Skill Icons, User Defined, Other Library…, Save Symbols…) and the Symbols panel's Symbol Libraries Menu button and its menu's Open Symbol Library / Save Symbol Library…; a click on a library symbol adds it to the document's Symbols (one undo step, it becomes the current symbol), Shift/Cmd-clicks select for Add to Symbols, and a symbol dragged onto the canvas is added and placed where it is dropped | done | [public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-or-import-symbol-libraries.html), [Symbols panel options](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/symbols-panel-options.html), [placing from a library](https://helpx.adobe.com/illustrator/desktop/manage-objects/traces-mockups-symbols/create-and-place-symbols.html); `window.symbolLibrary`, `window.symbolLibrary.other`, `ui.saveSymbolLibrary` (dialog `saveSymbolLibrary`), `window.userSymbolLibrary1`…`10`; `panels::tests_symbol_libraries`; five built-in libraries (Basic Shapes, UI Frames with default 9-slice, Map Markers, Inventory Icons, Skill Icons; original, generated in code) |
|
||||
| Brush libraries: Window › Brush Libraries (Art Ribbons, Ink and Wash, Calligraphic Nibs, Bristle Brushes, Pattern Borders, Scatter Shapes, Game Trails, Energy Beams, Dry Media, Tech Circuit, User Defined, Other Library…, Save Brushes…) and the Brushes panel's Brush Libraries Menu button and its menu's Open Brush Library / Save Brush Library…; a click on a library brush adds it to the document's Brushes (one undo step, it becomes the current brush, and selected paths take it in the same step), Shift/Cmd-clicks select for Add to Brushes, a brush dragged onto a path is added and applied to it and one dragged onto the Brushes panel is added; thumbnails render with the library's patterns and symbols | done | [public source](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/create-new-brush-libraries.html), [import brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/import-brushes-from-brush-libraries-or-other-files.html), [Brushes panel overview](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/brushes-panel-overview.html); `window.brushLibrary`, `window.brushLibrary.other`, `ui.saveBrushLibrary` (dialog `saveBrushLibrary`), `window.userBrushLibrary1`…`10`; `panels::tests_brush_libraries`; ten built-in libraries (original, generated in code) |
|
||||
| Symbols panel: New Symbol opens Symbol Options (Name) before making the symbol; Alt-click skips it | partial | #1560 (#1566); Registration 9-point grid in Symbol Options (`symbol.new` / `symbol.place`); Export Type (Graphic / Movie Clip) and Enable Guides for 9-Slice Scaling (scaled instances keep their corners; in symbol editing mode the guides are drawn over the art and the Selection tool drags them); Symbol Type (Dynamic Symbol / Static Symbol, new symbols dynamic; #4938) |
|
||||
| Symbols panel: New Symbol opens Symbol Options (Name) before making the symbol; Alt-click skips it | partial | #1560 (#1566); Registration 9-point grid in Symbol Options (`symbol.new` / `symbol.place`); Export Type (Graphic / Movie Clip) and Enable Guides for 9-Slice Scaling (scaled instances keep their corners; in symbol editing mode the guides are drawn over the art and the Selection tool drags them); Symbol Type (Dynamic Symbol / Static Symbol, new symbols dynamic; #4938); Align to Pixel Grid (`alignToPixelGrid` on `symbol.new` / `symbol.options`: the art snaps at the symbol's natural size and instances at that size stay on whole points; [Aligning symbols to pixel grid](https://web.archive.org/web/20220911143322/https://helpx.adobe.com/pdf/cs6/illustrator_reference.pdf#page=28)) |
|
||||
| Dynamic symbols: an instance changes the fill, stroke, opacity and blend of objects in its symbol's art and stays linked; Reset in the Properties panel's Quick Actions and the Symbols panel menu (Reset Symbol Instance) | partial | #4938; `symbol.instance.setAppearance` (by child-index path) and `symbol.instance.reset`; redefining keeps the changes, Break Link bakes them; Direct Selection of a path, compound path or type object inside an instance, with the Fill/Stroke controls setting its solid fill or stroke, is on canvas; on-canvas editing beyond a solid fill and stroke, and `.ai` read and write, remain |
|
||||
| Pathfinder Trim, Merge and Crop remove strokes; Merge joins same-fill objects whatever their strokes | done | #1570 (#1572) |
|
||||
| Pathfinder panel on one group selected alone; a greyed-out button says what it needs | partial | #1450; the group's members are combined; one plain path selected alone stays disabled (the public documentation doesn't say what the operations do to a single path) |
|
||||
|
||||
Reference in New Issue
Block a user