mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-21 20:28:51 +00:00
Merge pull request #8871 from dotCooCoo/feat/draw-behind-place-symbol
Symbols: in Draw Behind a placed instance goes directly below the selection
This commit is contained in:
@@ -48,7 +48,7 @@ use dynamic::{symbol_instance_reset, symbol_instance_select_part, symbol_instanc
|
||||
use symbolism::symbol_set_density;
|
||||
use symbols::selected_instances;
|
||||
pub(crate) use symbols::{
|
||||
expand_instances_under, expandable_instances, instance_in_place, natural_size, normalize, place_xf, set_natural_size, store_symbol,
|
||||
Placement, expand_instances_under, expandable_instances, instance_in_place, natural_size, normalize, place_xf, set_natural_size, store_symbol,
|
||||
stored_natural_size,
|
||||
};
|
||||
use symbols::{
|
||||
@@ -234,7 +234,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Place Symbol Instance",
|
||||
[],
|
||||
None,
|
||||
"{name?, x?, y?} place an instance so its registration point is at (x, y) (default: artboard centre; name default: current) → {id}",
|
||||
"{name?, x?, y?} place an instance so its registration point is at (x, y) (default: artboard centre; name default: current), on top of the current layer, or in Draw Behind directly below the bottommost selected object (at the bottom of the current layer with nothing selected) → {id}",
|
||||
has_doc,
|
||||
symbol_place
|
||||
),
|
||||
|
||||
@@ -33,6 +33,40 @@ pub(crate) fn place_xf(at: Point, (w, h): (f64, f64), reg: SymbolRegistration) -
|
||||
Affine::translate(c.to_vec2()) * Affine::scale_non_uniform(w / (2.0 * HALF), h / (2.0 * HALF))
|
||||
}
|
||||
|
||||
/// Where a placed symbol instance goes in the active document, worked out before the edit from
|
||||
/// the drawing mode, the selection and the layer new art goes into.
|
||||
pub(crate) struct Placement {
|
||||
parent: Option<NodeId>,
|
||||
behind: bool,
|
||||
anchor: Option<NodeId>,
|
||||
}
|
||||
|
||||
impl Placement {
|
||||
/// On top of the layer new art goes into; in Draw Behind, directly below the bottommost
|
||||
/// selected object (beside the compound path that holds it), or at the bottom of that layer
|
||||
/// when nothing is selected. An error when that layer is locked or hidden.
|
||||
pub(crate) fn of(s: &Session) -> Result<Self> {
|
||||
let st = s.doc()?;
|
||||
let parent = st.target_parent()?;
|
||||
let behind = s.draw_mode == crate::DrawMode::Behind;
|
||||
let compound_of = |id: NodeId| st.doc.parent_of(id).filter(|p| st.doc.node(*p).is_some_and(|n| matches!(n.kind, NodeKind::Compound { .. })));
|
||||
let anchor = behind.then(|| st.selection.in_paint_order(&st.doc).first().copied()).flatten().map(|id| compound_of(id).unwrap_or(id));
|
||||
Ok(Self { parent, behind, anchor })
|
||||
}
|
||||
|
||||
/// Inserts instance `n` where this placement puts it. In a clip group or a clipping layer the
|
||||
/// clipping path stays at the bottom.
|
||||
pub(crate) fn insert(&self, d: &mut Document, n: Node) -> Result<NodeId> {
|
||||
let (parent, index) = match (self.behind, self.anchor.and_then(|a| d.position(a))) {
|
||||
(false, _) => return Ok(d.insert(self.parent, usize::MAX, n)?),
|
||||
(true, Some((par, i, _))) => (par, i),
|
||||
(true, None) => (self.parent, 0),
|
||||
};
|
||||
let floor = usize::from(parent.and_then(|p| d.node(p)).is_some_and(Node::clips));
|
||||
Ok(d.insert(parent, index.max(floor), n)?)
|
||||
}
|
||||
}
|
||||
|
||||
fn registration_param(p: &Value, cmd: &str) -> Result<Option<SymbolRegistration>> {
|
||||
match p.get("registration") {
|
||||
None => Ok(None),
|
||||
@@ -437,10 +471,10 @@ pub(super) fn symbol_place(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let at = Point::new(number_or(p, "x", centre.x, "symbol.place")?, number_or(p, "y", centre.y, "symbol.place")?);
|
||||
let size = natural_size(d, &name);
|
||||
let reg = d.symbol_registration(&name);
|
||||
let parent = s.doc()?.target_parent()?;
|
||||
let spot = Placement::of(s)?;
|
||||
let id = s.edit("Place Symbol Instance", |d, sel| {
|
||||
let id = d.alloc_id();
|
||||
d.insert(parent, usize::MAX, Node::new(id, NodeKind::SymbolInstance { symbol: name.clone(), xf: place_xf(at, size, reg) }))?;
|
||||
spot.insert(d, Node::new(id, NodeKind::SymbolInstance { symbol: name.clone(), xf: place_xf(at, size, reg) }))?;
|
||||
sel.set([id]);
|
||||
Ok(id)
|
||||
})?;
|
||||
|
||||
@@ -15,7 +15,7 @@ use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::{Appearance, Document, Node, NodeId, NodeKind, Symbol, SymbolNineSlice};
|
||||
use vectorcraft_geom::{Affine, Anchor, AnchorKind, PathData, Point, Rect, SubPath, shapes};
|
||||
|
||||
use super::brushsym::{CURRENT_SYMBOL, natural_size, normalize, place_xf, set_natural_size};
|
||||
use super::brushsym::{CURRENT_SYMBOL, Placement, natural_size, normalize, place_xf, set_natural_size};
|
||||
use super::clipboard::Clipboard;
|
||||
use super::clipboard::resources::SwatchChoices;
|
||||
use super::swatch::str_list;
|
||||
@@ -50,7 +50,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Add to Symbols",
|
||||
["Window", "Symbol Libraries"],
|
||||
None,
|
||||
"{library: id or name, name? | names?: [symbol names in the library] (default: all of it), place?: false (also place an instance of the first one, its registration point at x, y: default the first artboard's centre), x?, y?, swatchConflict? (as edit.paste)} copy library symbols into the document's Symbols as one undo step (with the place), with their Symbol Options and the resources they use (the symbols they nest, patterns, swatches, brushes, graphic styles, images). A symbol the document already has (same name and art) isn't added again; a name another symbol has gets a number (\"Star 2\"). The first one becomes the current symbol → {library, names: [each symbol's name in the document], added: [names added], existing: [names already there], placed?: id}",
|
||||
"{library: id or name, name? | names?: [symbol names in the library] (default: all of it), place?: false (also place an instance of the first one, its registration point at x, y: default the first artboard's centre, in the stacking order symbol.place gives it, Draw Behind included), x?, y?, swatchConflict? (as edit.paste)} copy library symbols into the document's Symbols as one undo step (with the place), with their Symbol Options and the resources they use (the symbols they nest, patterns, swatches, brushes, graphic styles, images). A symbol the document already has (same name and art) isn't added again; a name another symbol has gets a number (\"Star 2\"). The first one becomes the current symbol → {library, names: [each symbol's name in the document], added: [names added], existing: [names already there], placed?: id}",
|
||||
has_doc,
|
||||
add
|
||||
),
|
||||
@@ -59,7 +59,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"Place Symbol Instance",
|
||||
[],
|
||||
None,
|
||||
"{sourceDocument: uid, name: a symbol of that document, x?, y?} place an instance of a symbol of another open document so its registration point is at (x, y) (default: the first artboard's center), as a symbol dragged from that document's Symbols panel onto the canvas is placed. The symbol, the symbols it nests and the resources they use are added as a drop of art from that document adds them, in the same undo step as the instance: a symbol the active document already has with the same name, art and Symbol Options is used, and one with the same name but other art or Symbol Options gets a number (\"Leaf 2\"); each symbol added takes its Symbol Options along. When sourceDocument is the active document, its own symbol is placed, as symbol.place places it. An error, with no edit, when that document is no longer open or has no symbol `name` → {id, name: the symbol's name in the active document}",
|
||||
"{sourceDocument: uid, name: a symbol of that document, x?, y?} place an instance of a symbol of another open document so its registration point is at (x, y) (default: the first artboard's center), in the stacking order symbol.place gives it (Draw Behind included), as a symbol dragged from that document's Symbols panel onto the canvas is placed. The symbol, the symbols it nests and the resources they use are added as a drop of art from that document adds them, in the same undo step as the instance: a symbol the active document already has with the same name, art and Symbol Options is used, and one with the same name but other art or Symbol Options gets a number (\"Leaf 2\"); each symbol added takes its Symbol Options along. When sourceDocument is the active document, its own symbol is placed, as symbol.place places it. An error, with no edit, when that document is no longer open or has no symbol `name` → {id, name: the symbol's name in the active document}",
|
||||
has_doc,
|
||||
place_from_document
|
||||
),
|
||||
@@ -816,7 +816,7 @@ fn add(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let doc_names: Vec<String> = picked.iter().map(|n| target(&imported.renamed, n)).collect();
|
||||
let centre = st.doc.artboards.first().map(|a| a.rect.center()).unwrap_or(Point::ZERO);
|
||||
let at = if place { Some(Point::new(number_or(p, "x", centre.x, C)?, number_or(p, "y", centre.y, C)?)) } else { None };
|
||||
let parent = if place { st.target_parent()? } else { None };
|
||||
let spot = if place { Some(Placement::of(s)?) } else { None };
|
||||
let mut out = json!({ "library": shown_library_id(s, &info.id) });
|
||||
if imported.added > 0 || place {
|
||||
let placed = s.edit("Add to Symbols", |d, sel| {
|
||||
@@ -830,10 +830,10 @@ fn add(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
}
|
||||
let Some(first) = doc_names.first() else { return Ok(None) };
|
||||
d.unknown.insert(CURRENT_SYMBOL.into(), json!(first));
|
||||
let Some(at) = at else { return Ok(None) };
|
||||
let (Some(at), Some(spot)) = (at, &spot) else { return Ok(None) };
|
||||
let xf = place_xf(at, natural_size(d, first), d.symbol_registration(first));
|
||||
let id = d.alloc_id();
|
||||
d.insert(parent, usize::MAX, Node::new(id, NodeKind::SymbolInstance { symbol: first.clone(), xf }))?;
|
||||
spot.insert(d, Node::new(id, NodeKind::SymbolInstance { symbol: first.clone(), xf }))?;
|
||||
sel.set([id]);
|
||||
Ok(Some(id))
|
||||
})?;
|
||||
@@ -860,7 +860,7 @@ fn place_from_document(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let st = s.doc()?;
|
||||
let centre = st.doc.artboards.first().map(|a| a.rect.center()).unwrap_or(Point::ZERO);
|
||||
let at = Point::new(number_or(p, "x", centre.x, C)?, number_or(p, "y", centre.y, C)?);
|
||||
let parent = st.target_parent()?;
|
||||
let spot = Placement::of(s)?;
|
||||
let same = uid == st.uid;
|
||||
let src = s.documents().iter().find(|d| d.uid == uid).map(|d| Arc::clone(&d.doc));
|
||||
let src = src.ok_or_else(|| bad(C, "the document the symbol came from is no longer open"))?;
|
||||
@@ -883,7 +883,7 @@ fn place_from_document(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
};
|
||||
let xf = place_xf(at, natural_size(d, &placed), d.symbol_registration(&placed));
|
||||
let id = d.alloc_id();
|
||||
d.insert(parent, usize::MAX, Node::new(id, NodeKind::SymbolInstance { symbol: placed.clone(), xf }))?;
|
||||
spot.insert(d, Node::new(id, NodeKind::SymbolInstance { symbol: placed.clone(), xf }))?;
|
||||
sel.set([id]);
|
||||
Ok((id, placed))
|
||||
})?;
|
||||
|
||||
@@ -2228,6 +2228,73 @@ fn place_and_break_link_round_trip_geometry() {
|
||||
assert_eq!(n.appearance.stroke_width(), 1.0, "strokes are not scaled by normalisation");
|
||||
}
|
||||
|
||||
/// In Draw Behind, Place Symbol Instance puts the instance directly below the bottommost selected
|
||||
/// object (beside the compound path that holds a selected path, above a clipping path), or at the
|
||||
/// bottom of the current layer with nothing selected, selected and in one undo step. Draw Normal
|
||||
/// and Draw Inside keep it on top, and a locked layer refuses it with no edit.
|
||||
#[test]
|
||||
fn placed_instances_go_below_the_selection_in_draw_behind() {
|
||||
let mut s = session();
|
||||
let (inst, name, _) = make_symbol(&mut s);
|
||||
let (a, b) = (rect(&mut s, 0.0, 0.0, 10.0, 10.0), rect(&mut s, 20.0, 0.0, 10.0, 10.0));
|
||||
let layer = s.doc().unwrap().doc.layers[0].id;
|
||||
let kids = |s: &Session, id: NodeId| node(s, id).children().unwrap().iter().map(|c| c.id).collect::<Vec<_>>();
|
||||
let place = |s: &mut Session| NodeId(s.execute("symbol.place", &json!({"name": name, "x": 300, "y": 200})).unwrap()["id"].as_u64().unwrap());
|
||||
s.execute("view.drawMode", &json!({"mode": "behind"})).unwrap();
|
||||
select(&mut s, &[b]);
|
||||
let before = undo_len(&s);
|
||||
let p = place(&mut s);
|
||||
assert_eq!(kids(&s, layer), vec![inst, a, p, b], "directly below the selected object");
|
||||
assert_eq!(undo_len(&s), before + 1);
|
||||
assert_eq!(s.doc().unwrap().selection.objects, [p]);
|
||||
assert!(close(bounds(&s, p), Rect::new(260.0, 180.0, 340.0, 220.0), 1e-9), "{:?}", bounds(&s, p));
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
assert_eq!(kids(&s, layer), vec![inst, a, b]);
|
||||
// Below the bottommost of several selected objects.
|
||||
select(&mut s, &[b, a]);
|
||||
let p = place(&mut s);
|
||||
assert_eq!(kids(&s, layer), vec![inst, p, a, b]);
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
// With nothing selected, at the bottom of the current layer.
|
||||
select(&mut s, &[]);
|
||||
let p = place(&mut s);
|
||||
assert_eq!(kids(&s, layer), vec![p, inst, a, b]);
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
// A path selected in a compound path: beside the compound path, not inside it.
|
||||
select(&mut s, &[a, b]);
|
||||
s.execute("object.compoundPath.make", &json!({})).unwrap();
|
||||
let compound = kids(&s, layer)[1];
|
||||
let member = kids(&s, compound)[1];
|
||||
select(&mut s, &[member]);
|
||||
let p = place(&mut s);
|
||||
assert_eq!(kids(&s, layer), vec![inst, p, compound]);
|
||||
assert_eq!(kids(&s, compound).len(), 2);
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
// Draw Normal and Draw Inside put it on top of the layer.
|
||||
for mode in ["normal", "inside"] {
|
||||
select(&mut s, &[compound]);
|
||||
s.execute("view.drawMode", &json!({"mode": mode})).unwrap();
|
||||
let p = place(&mut s);
|
||||
assert_eq!(kids(&s, layer), vec![inst, compound, p], "{mode}");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
}
|
||||
// In a clipping layer the clipping path stays at the bottom, the selected clipping path too.
|
||||
s.execute("view.drawMode", &json!({"mode": "behind"})).unwrap();
|
||||
s.execute("layer.clippingMask.toggle", &json!({"id": layer.0})).unwrap();
|
||||
assert_eq!(kids(&s, layer), vec![compound, inst]);
|
||||
for picked in [&[][..], &[compound]] {
|
||||
select(&mut s, picked);
|
||||
let p = place(&mut s);
|
||||
assert_eq!(kids(&s, layer), vec![compound, p, inst], "{picked:?}");
|
||||
s.execute("edit.undo", &json!({})).unwrap();
|
||||
}
|
||||
// A locked layer takes nothing.
|
||||
s.execute("layer.setProps", &json!({"id": layer.0, "locked": true})).unwrap();
|
||||
let before = (undo_len(&s), s.doc().unwrap().doc.clone());
|
||||
assert!(s.execute("symbol.place", &json!({"name": name})).is_err());
|
||||
assert_eq!((undo_len(&s), &s.doc().unwrap().doc), (before.0, &before.1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hidden_instance_fill_does_not_tint_expanded_symbol_art() {
|
||||
for command in ["symbol.breakLink", "object.expand"] {
|
||||
|
||||
@@ -514,3 +514,45 @@ fn another_documents_symbol_is_added_and_placed_in_one_step() {
|
||||
let e = s.execute("symbol.placeFromDocument", &json!({"sourceDocument": source, "name": "Star"})).unwrap_err();
|
||||
assert!(e.to_string().contains("no longer open"), "{e}");
|
||||
}
|
||||
|
||||
/// A symbol dragged onto the canvas, from another document's Symbols panel or from a symbol
|
||||
/// library, is stacked as Place Symbol Instance stacks it: in Draw Behind directly below the
|
||||
/// selected object, or at the bottom of the current layer with nothing selected, in one undo step
|
||||
/// with the symbol it adds. A locked layer refuses it with no edit.
|
||||
#[test]
|
||||
fn dropped_symbols_go_below_the_selection_in_draw_behind() {
|
||||
let mut s = kit();
|
||||
let source = s.doc().unwrap().uid;
|
||||
run(&mut s, "file.new", json!({"width": 100, "height": 100}));
|
||||
let rect =
|
||||
|s: &mut Session, x: f64| NodeId(run(s, "shape.rectangle", json!({"x": x, "y": 0, "width": 10, "height": 10}))["id"].as_u64().unwrap());
|
||||
let (a, b) = (rect(&mut s, 0.0), rect(&mut s, 20.0));
|
||||
let layer = doc(&s).layers[0].id;
|
||||
let kids = |s: &Session| doc(s).node(layer).unwrap().children().unwrap().iter().map(|c| c.id).collect::<Vec<_>>();
|
||||
run(&mut s, "view.drawMode", json!({"mode": "behind"}));
|
||||
let drops = [
|
||||
("symbol.placeFromDocument", json!({"sourceDocument": source, "name": "Badge", "x": 30, "y": 40}), "id"),
|
||||
("symbol.addFromLibrary", json!({"library": "basic shapes", "name": "Square", "place": true, "x": 30, "y": 40}), "placed"),
|
||||
];
|
||||
for (cmd, p, key) in &drops {
|
||||
for (picked, at) in [(vec![b], 1), (vec![], 0)] {
|
||||
run(&mut s, "select.set", json!({"ids": picked.iter().map(|i| i.0).collect::<Vec<_>>()}));
|
||||
let before = undo_len(&s);
|
||||
let placed = NodeId(run(&mut s, cmd, p.clone())[*key].as_u64().unwrap());
|
||||
let mut want = vec![a, b];
|
||||
want.insert(at, placed);
|
||||
assert_eq!(kids(&s), want, "{cmd} {picked:?}");
|
||||
assert_eq!(undo_len(&s), before + 1, "{cmd}");
|
||||
assert_eq!(s.doc().unwrap().selection.objects, [placed]);
|
||||
run(&mut s, "edit.undo", json!({}));
|
||||
assert!(symbols(&s).is_empty(), "{cmd}: the undo takes the added symbol too");
|
||||
}
|
||||
}
|
||||
// A locked layer takes nothing.
|
||||
run(&mut s, "layer.setProps", json!({"id": layer.0, "locked": true}));
|
||||
let before = (undo_len(&s), doc(&s).clone());
|
||||
for (cmd, p, _) in &drops {
|
||||
assert!(s.execute(cmd, p).is_err(), "{cmd}");
|
||||
assert_eq!((undo_len(&s), doc(&s)), (before.0, &before.1), "{cmd}");
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -3885,7 +3885,10 @@ already walks Image Trace. Short agent entry points:
|
||||
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.placeFromDocument {sourceDocument, name, x?, y?}` (an instance of a symbol
|
||||
`symbol.place {name?, x?, y?}` (on top of the current layer; in Draw Behind directly below the bottommost selected
|
||||
object, beside the compound path that holds it, or at the bottom of the current layer with nothing selected, above
|
||||
a clipping path; `symbol.placeFromDocument` and `symbol.addFromLibrary` with `place` stack the instance the same
|
||||
way), `symbol.placeFromDocument {sourceDocument, name, x?, y?}` (an instance of a symbol
|
||||
of another open document, as a symbol dragged from that document's Symbols panel onto the canvas places it: the
|
||||
symbol, the symbols it nests and the resources they use are added as `edit.dropSelection` adds them, in the same
|
||||
undo step, and a symbol with the same name but other art or Symbol Options is added under a free name; an error
|
||||
@@ -9136,7 +9139,8 @@ undo step. When a matched layer, or a layer around it, is hidden or locked, the
|
||||
Drawing modes (`view.drawMode`) apply
|
||||
too: in Draw Inside, `edit.paste`, `edit.pasteInPlace` and `edit.pasteOnAllArtboards` put the objects inside the
|
||||
object drawn into (its clip group, made on the first paste), whatever Paste Remembers Layers says; in Draw Behind,
|
||||
`edit.pasteInPlace` and `edit.pasteOnAllArtboards` put them just below the selection. `edit.pasteInFront` and
|
||||
`edit.pasteInPlace` and `edit.pasteOnAllArtboards` put them just below the selection, and a placed symbol instance
|
||||
(`symbol.place`) goes just below the selection too. `edit.pasteInFront` and
|
||||
`edit.pasteInBack` ignore the drawing mode. When the object drawn into is the one isolation mode isolates (`object.isolate`,
|
||||
or a double-click on it with the Selection tool), art drawn or pasted inside it takes isolation mode into its clip group,
|
||||
so the new art can be picked and isn't dimmed; `edit.undo` or `edit.redo` that removes the isolated object ends
|
||||
|
||||
@@ -1423,7 +1423,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Compound paths:** Make keeps the backmost object's appearance and each contour; selecting a member in Direct Selection reads and changes the compound's fill rule in Attributes. Direction remains a per-member edit. Rendered holes, unchanged contour geometry, no-op history and Undo/Redo are covered by `engine/tests/it/compound_attributes.rs` (#1197). Behaviour reference: [public compound-path documentation](https://helpx.adobe.com/illustrator/desktop/manage-objects/reshape-transform-objects/create-compound-paths.html). Make Compound Path on a group (such as outlined type) keeps the paint of its backmost path instead of drawing nothing, and compound paths joined into one keep their holes (#1537).
|
||||
- **Saved selections:** Select ▸ Save Selection… asks for a name and keeps the selection in the document (saved with the file, undoable, up to 25); each one is listed at the bottom of the Select menu and a click selects its objects again; Edit Selection… lists them to rename or delete, applied together on OK. A file's saved selections are capped and checked against its objects when it opens.
|
||||
Select ▸ Update Selection replaces the objects of the saved selection last recalled with the selected objects, in one undo step that marks the document changed (`select.update`). After Edit Selection… renames that saved selection, Update Selection replaces it under the new name; after Edit Selection… deletes it, Update Selection is disabled until another saved selection is recalled or the delete is undone. Undo and Redo do not change which saved selection is recalled.
|
||||
- **Drawing modes:** in Draw Inside, a double-click with a selection tool outside the object being drawn into sets the drawing mode to Draw Normal, as Shift+D does. Pastes follow the drawing mode ([drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html)) (#3705): in Draw Inside, Paste, Paste in Place and Paste on All Artboards put the copies inside the object drawn into, in one undo step, Paste Remembers Layers aside; in Draw Behind, Paste in Place and Paste on All Artboards put them just below the selection; Paste in Front and Paste in Back ignore the mode. Shift+D cycles Draw Normal → Draw Behind → Draw Inside → Draw Normal, skipping Draw Inside unless one path, compound path or type is selected. With the object drawn into isolated (a double-click on it with the Selection tool), art drawn or pasted inside it takes isolation mode into its clip group, so it can be clicked and isn't dimmed, as art added in isolation mode belongs with what is isolated ([isolation mode](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/isolate-objects.html)) (#3705); undo or redo that removes the isolated object ends isolation mode. While Draw Inside lasts, a dotted open rectangle marks the corners of the object drawn into (#4319). In Draw Behind, New Layer (the Layers panel's button, its menu, Ctrl/Cmd+L and the Layer Options dialog) puts the new layer directly below the current layer, at its level, as [the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=234) describes and [drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html) lists; Ctrl/Cmd-click still puts it on top and Ctrl/Cmd+Alt-click below, and New Sublayer is not affected (VectorCraft's own rule).
|
||||
- **Drawing modes:** in Draw Inside, a double-click with a selection tool outside the object being drawn into sets the drawing mode to Draw Normal, as Shift+D does. Pastes follow the drawing mode ([drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html)) (#3705): in Draw Inside, Paste, Paste in Place and Paste on All Artboards put the copies inside the object drawn into, in one undo step, Paste Remembers Layers aside; in Draw Behind, Paste in Place and Paste on All Artboards put them just below the selection; Paste in Front and Paste in Back ignore the mode. Shift+D cycles Draw Normal → Draw Behind → Draw Inside → Draw Normal, skipping Draw Inside unless one path, compound path or type is selected. With the object drawn into isolated (a double-click on it with the Selection tool), art drawn or pasted inside it takes isolation mode into its clip group, so it can be clicked and isn't dimmed, as art added in isolation mode belongs with what is isolated ([isolation mode](https://helpx.adobe.com/illustrator/desktop/manage-objects/select-objects/isolate-objects.html)) (#3705); undo or redo that removes the isolated object ends isolation mode. While Draw Inside lasts, a dotted open rectangle marks the corners of the object drawn into (#4319). In Draw Behind, New Layer (the Layers panel's button, its menu, Ctrl/Cmd+L and the Layer Options dialog) puts the new layer directly below the current layer, at its level, as [the help page](https://help.adobe.com/archive/en_US/illustrator/cs5/illustrator_cs5_help.pdf#page=234) describes and [drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html) lists; Ctrl/Cmd-click still puts it on top and Ctrl/Cmd+Alt-click below, and New Sublayer is not affected (VectorCraft's own rule). In Draw Behind, a placed symbol instance (Place Symbol Instance in the Symbols panel, and a symbol dragged onto the canvas from the Symbols panel or a symbol library) goes directly below the selected object, or at the bottom of the current layer with nothing selected, as [drawing modes](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/learn-drawing-basics/drawing-modes-overview.html) describes for placing symbols; below the bottommost of several selected objects, beside the compound path that holds a selected path, and above a clipping path are VectorCraft's own rules. Draw Normal and Draw Inside keep it on top of the current layer.
|
||||
- **Drawing:** Pen, Curvature, anchor tools, Pencil, Paintbrush, Blob Brush, Smooth, Path Eraser, Join. Direction handles dragged with Direct Selection or the Anchor Point tool snap to smart guides, and Shift keeps them at 45° steps from their anchor. The Pen continues any open path from the end clicked, and while drawing, a click on an end of another open path joins the two into one (#776). The Curvature tool edits any selected path, whatever drew it, keeping its shape except where edited (#798): a click on a point makes it current and a drag moves it, re-curving only its two segments; double-click, or Alt-click on any point but an end of an open path, toggles it smooth or corner and Delete removes it; a click on a segment adds a point without changing the shape; with an end of an open path current, clicks go on from it and its other end closes it (`path.curvatureEdit`). An Alt-click on an end of a selected open path makes that end current without changing it, so the next click goes on from it, as [the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-shapes-with-the-curvature-tool.html) describes for continuing a path; an Alt-click that starts a new path places a corner point, as later Alt-clicks do. Every point a drawing tool places snaps to Smart Guides through one snapper (#506): the Pen's and Curvature tool's anchors, the Pencil's ends, the shape tools' start and dragged corner or radius (Rectangle, Rounded Rectangle, Ellipse, Polygon, Star, Line Segment, Arc, Spiral, the grids), the Type tool's click and frame, a new artboard's corners. A filled Pencil path keeps a stroke of None (#1804, part of #1679). While a Pencil or Paintbrush stroke is drawn back to within Close Paths When Ends Are Within of its start, the cursor shows the closing ring and a release there closes the path, as [Draw straight lines with the Pencil tool](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/draw-shapes/draw-straight-lines-with-the-pencil-tool.html) describes for the Pencil. The [ and ] keys reach the Blob Brush, the Eraser and the Symbolism tools in the app (#1734, part of #1661).
|
||||
Blob Brush and Eraser Tool Options' Size is Fixed or Pressure with a Variation (#4590, #3961): with Pressure a pen stroke is Size − Variation wide where it presses lightest and Size + Variation where it presses hardest, and a mouse stroke keeps the Size.
|
||||
`path.blob` and `path.eraseRegion` refuse a Size outside 0.1 to 1000 pt and a Variation outside 0 to 1000 pt, also with Size set to Fixed, and the drawing commands that read pen values refuse a pressure outside 0 to 1, a tilt outside −90° to 90°, a rotation outside 0° to 360° and a point array of more than six numbers, with an error naming the key; the document, the selection and the undo history stay as they were. The pressure and tilt ranges are those of [Pointer Events](https://www.w3.org/TR/pointerevents3/); the Size, Variation and rotation ranges are VectorCraft's own values (`tests::draw2::pen_values_outside_their_ranges_are_refused`).
|
||||
|
||||
Reference in New Issue
Block a user