mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-27 21:29:35 +00:00
#8538 review: drop kept guides on transform, finish the marquee rule
A transform no longer leaves locked guide paths in place: a guide in a group moves with its group again, as on main. Keeping them put made Align, Transform Each, the pixel-grid snap and Objects on Path measure or place art the transform did not move. Scaling::keep_guides and its engine wiring and test are removed. The marquee rule now covers the rest of the selection side, while guides are locked or hidden: - the guide rule goes down the walk as an explicit Rules value instead of a thread-local guard; - an Enclosing Lasso loop does not take a compound path for its guide contours; - an enclosing marquee measures a group without its guide paths (Node::without_guides); - Direct Selection's marquee takes no anchor or crossed segment of a guide path. Docs: the Guides area row, its evidence entry and the M1 row describe the marquee behaviour; status lines and revision rows say a guide in a group still moves with it.
This commit is contained in:
@@ -90,6 +90,42 @@ impl Node {
|
||||
matches!(self.kind, NodeKind::RulerGuide { .. } | NodeKind::Path { guide: true, .. })
|
||||
}
|
||||
|
||||
/// This object without the paths made into guides among the members of its groups, layers,
|
||||
/// Intertwine groups and compound paths, at any depth, for measuring the art around them while
|
||||
/// Lock Guides or Hide Guides leaves them out (#8538). The clipping path of a clip group or
|
||||
/// layer and the original shapes of a Shaper group stay, guides or not, so the object keeps
|
||||
/// its structure. `None` when it holds no such guide.
|
||||
pub fn without_guides(&self) -> Option<Node> {
|
||||
let (NodeKind::Layer { children, .. }
|
||||
| NodeKind::Group { children, .. }
|
||||
| NodeKind::Intertwine { children }
|
||||
| NodeKind::Compound { children, .. }) = &self.kind
|
||||
else {
|
||||
return None;
|
||||
};
|
||||
let keep = usize::from(self.clips() || self.extras().shaper.is_some());
|
||||
let mut changed = false;
|
||||
let mut out = Vec::with_capacity(children.len());
|
||||
for (i, c) in children.iter().enumerate() {
|
||||
if i >= keep && matches!(c.kind, NodeKind::Path { guide: true, .. }) {
|
||||
changed = true;
|
||||
} else if let Some(stripped) = c.without_guides() {
|
||||
changed = true;
|
||||
out.push(Arc::new(stripped));
|
||||
} else {
|
||||
out.push(c.clone());
|
||||
}
|
||||
}
|
||||
if !changed {
|
||||
return None;
|
||||
}
|
||||
let mut n = self.clone();
|
||||
if let Some(c) = n.children_mut() {
|
||||
*c = out;
|
||||
}
|
||||
Some(n)
|
||||
}
|
||||
|
||||
/// A template layer (Layer Options → Template).
|
||||
pub fn is_template(&self) -> bool {
|
||||
matches!(self.kind, NodeKind::Layer { template: true, .. })
|
||||
@@ -527,13 +563,10 @@ impl Node {
|
||||
}
|
||||
}
|
||||
}
|
||||
NodeKind::Layer { children, .. } | NodeKind::Group { children, .. } | NodeKind::Intertwine { children } => {
|
||||
// Locked guides stay where they are ([`Scaling::keep_guides`]).
|
||||
for c in children.iter_mut().filter(|c| !(sc.keep_guides && matches!(c.kind, NodeKind::Path { guide: true, .. }))) {
|
||||
Arc::make_mut(c).transform_scaled(a, sc);
|
||||
}
|
||||
}
|
||||
NodeKind::Compound { children, .. } => {
|
||||
NodeKind::Layer { children, .. }
|
||||
| NodeKind::Group { children, .. }
|
||||
| NodeKind::Compound { children, .. }
|
||||
| NodeKind::Intertwine { children } => {
|
||||
for c in children.iter_mut() {
|
||||
Arc::make_mut(c).transform_scaled(a, sc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user