mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 17:56:50 -06:00
These commands removed, moved or copied one row or object at a time: the Layers panel's Delete Selection, Duplicate Selection, Collect in New Layer, row drags, Merge Selected, Flatten Artwork and Release to Layers, and Cut Artboard, Duplicate Artboard and the Artboard tool's Alt-drags that copy art. Each edit moved the later rows of the same layer or group to other indices. The next lookup by id then walked the tree, and after every fourth such walk Document::index_path rebuilt the whole lookup cache. Release to Layers also walked the document twice for each new layer to name and color it. With 25,000 rectangles in one layer, a release build of vectorcraft-cli took 11.9 s for Duplicate Selection and 17.7 s for Release to Layers. The commands now remove, move and copy the rows in one pass over each layer or group, with Document::remove_many and Document::wrap, and with copy_above, the copy pass of duplicate_in, which Duplicate Selection and the artboard copies now share. Release to Layers names its new layers from one walk of the document. Merge Selected checks the target layer's objects against a set of the listed rows, and Delete Selection checks the top-level layers against such a set. In a document whose ids are unique, the rows keep their order, new rows and layers take the same ids, names and colors, and the selection, the undo step and the journal are the same. A release build with this change takes 98 ms for Duplicate Selection and 26 ms for Release to Layers. Docs: docs/target-app-parity.md.