mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-27 19:27:21 -06:00
Pathfinder panel: a group selected alone counts its nested shapes, so an expanded stroke keeps the Shape Modes enabled (fixes #1635)
This commit is contained in:
committed by
bflatastic
parent
359d9bb833
commit
7ea75b01ba
@@ -493,6 +493,9 @@ pub use flatten::FlattenOptions;
|
||||
/// A built-in or saved flattener preset ([`crate::Prefs::flattener_presets`]).
|
||||
pub use flatten::FlattenerPreset;
|
||||
|
||||
/// The shapes a group selected alone gives the Pathfinder panel.
|
||||
pub use pathops::shape_count;
|
||||
|
||||
/// Command ids kept only so older scripts keep working: `(alias, the command it duplicates)`.
|
||||
/// They run as before but the command palette leaves them out (it lists the command once).
|
||||
pub const ALIASES: &[(&str, &str)] = &[("object.convertDocumentColorMode", "file.documentColorMode")];
|
||||
|
||||
@@ -258,6 +258,14 @@ fn leaves(n: &Node, out: &mut Vec<Node>) {
|
||||
}
|
||||
}
|
||||
|
||||
/// How many shapes a Pathfinder operation takes from `n` selected alone: its leaf shapes, however
|
||||
/// deep its groups nest (an expanded stroke is a group inside the group, #1635).
|
||||
pub fn shape_count(n: &Node) -> usize {
|
||||
let mut lv = vec![];
|
||||
leaves(n, &mut lv);
|
||||
lv.len()
|
||||
}
|
||||
|
||||
/// A node for `path`: a plain path for one subpath, else a compound path.
|
||||
pub(crate) fn shape_node(d: &mut Document, path: PathData, style_src: Option<&Node>) -> Node {
|
||||
let id = d.alloc_id();
|
||||
|
||||
Reference in New Issue
Block a user