mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-13 17:32:42 -06:00
Expand: selected symbol instances become their art, as Break Link places it
Object > Expand with Object on now turns each symbol instance in the selection, including one in a selected group or in a placed document's art, into its art, as Break Link to Symbol places it. It goes one level deep: the instances in that art stay instances. The art keeps the instance's id and place in the stacking order, and Expand stays one undo step. - Instances with effects stay instances, and Expand Appearance bakes them as before. Instances with an effect on a fill or stroke, instances in perspective, and those in blends, repeats and Intertwine groups stay instances. - The art keeps the instance's opacity mask, as Break Link gives it. - A hidden or locked instance's art stays hidden or locked. - A placed document in an instance's art is expanded too. - When the instances' art would make more than 1,000,000 objects, they stay instances, the limit Break Link uses. - The Fill and Stroke options (object.expand.info, and the Expand dialog) count the fills, strokes and gradients in the art of those instances, with a dynamic instance's own changes applied. The info reports under symbolArt which of them only that art holds, and the dialog enables those options only while Object is on.
This commit is contained in:
@@ -851,6 +851,24 @@ fn expand_turns_a_placed_document_into_editable_art_with_its_resources() {
|
||||
assert_eq!(info["object"], false, "nothing left to expand: {info}");
|
||||
}
|
||||
|
||||
/// Expand also expands a placed document in the art of a selected symbol instance, in the same
|
||||
/// command.
|
||||
#[test]
|
||||
fn expand_expands_a_placed_document_in_a_symbol_instances_art() {
|
||||
let dir = Folder::new("placed-expand-symbol");
|
||||
let src = dir.file("badge.vectorcraft");
|
||||
star_source(&src, "star");
|
||||
let mut s = session();
|
||||
let id = place(&mut s, &src);
|
||||
s.select(|_, sel| sel.set([id])).unwrap();
|
||||
let inst = NodeId(s.execute("symbol.new", &json!({"name": "Badge"})).unwrap()["id"].as_u64().unwrap());
|
||||
s.execute("object.expand", &json!({})).unwrap();
|
||||
let doc = &s.doc().unwrap().doc;
|
||||
let mut placed = 0;
|
||||
doc.node(inst).unwrap().walk(&mut |c| placed += usize::from(matches!(c.kind, NodeKind::PlacedDocument(_))));
|
||||
assert_eq!(placed, 0, "the placed document in the art is expanded");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn saving_a_document_refreshes_the_open_documents_that_place_it() {
|
||||
let dir = Folder::new("placed-refresh");
|
||||
|
||||
Reference in New Issue
Block a user