mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-29 20:27:05 -06:00
Objects on Path: clipping paths and parts of blends, envelopes and repeats stay in place
object.objectsOnPath.attach took a path inside a compound path, blend, envelope, repeat or Intertwine group, or a clipping path, as the path and put it into the new Objects on Path group, so it was no longer a part of its container. As objects, a blend's key path, a repeat's source art, an envelope's content and a clipping path were put into the new group the same way. The Objects on Path tool highlighted a blend's key path or a clipping path and attached the selection to it. objects_on_path::held now finds the container that holds an object. The command refuses such a path or object with a reason, and the tool does not highlight it or attach to it. A member of a compound path given as an object still attaches as its whole compound path. The four new messages have rows in every complete-message catalog. Docs: docs/mcp.md (Objects on Path).
This commit is contained in:
@@ -21,7 +21,7 @@ use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use serde_json::{Value, json};
|
||||
use vectorcraft_doc::objects_on_path::{CENTER, ObjectsOnPath, attachable_path, is_objects_on_path, place};
|
||||
use vectorcraft_doc::objects_on_path::{CENTER, Held, ObjectsOnPath, attachable_path, held, is_objects_on_path, place};
|
||||
use vectorcraft_doc::{Document, Node, NodeId, NodeKind};
|
||||
use vectorcraft_geom::Rect;
|
||||
|
||||
@@ -168,7 +168,10 @@ fn path_refused(d: &Document, path: NodeId) -> Option<&'static str> {
|
||||
if group_around(d, path).is_some() {
|
||||
return Some("the path is already in an Objects on Path group");
|
||||
}
|
||||
None
|
||||
match held(d, path)? {
|
||||
Held::Live => Some("a path inside a compound path, blend, envelope, repeat or Intertwine group can't take objects"),
|
||||
Held::Clipping => Some("a clipping path can't take objects"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Why `n` can't be attached to a path, if it can't (the help page names graphs).
|
||||
@@ -179,6 +182,11 @@ fn object_refused(d: &Document, n: &Node) -> Option<&'static str> {
|
||||
if group_around(d, n.id).is_some() {
|
||||
return Some("an object already on a path can't be attached again");
|
||||
}
|
||||
match held(d, n.id) {
|
||||
Some(Held::Live) => return Some("objects inside a blend, envelope, repeat or Intertwine group can't be attached to a path"),
|
||||
Some(Held::Clipping) => return Some("a clipping path can't be attached to a path"),
|
||||
None => {}
|
||||
}
|
||||
let mut graph = false;
|
||||
n.walk(&mut |c| graph |= c.extras().graph.is_some());
|
||||
graph.then_some("graphs can't be attached to a path")
|
||||
|
||||
Reference in New Issue
Block a user