mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 22:48:28 +02:00
⚡ Improved copy objects performance
This commit is contained in:
parent
9492dd7856
commit
581c50b5ff
2 changed files with 26 additions and 29 deletions
|
@ -502,3 +502,20 @@
|
|||
(reduce process-shape (transient {}))
|
||||
(persistent!))
|
||||
persistent!)))
|
||||
|
||||
(defn selected-subtree
|
||||
"Given a set of shapes, returns an objects subtree with the parents
|
||||
of the selected items up to the root. Useful to calculate a partial z-index"
|
||||
[objects selected]
|
||||
|
||||
(let [selected+parents
|
||||
(into selected
|
||||
(mapcat #(get-parent-ids objects %))
|
||||
selected)
|
||||
|
||||
remove-children
|
||||
(fn [shape]
|
||||
(update shape :shapes #(filterv selected+parents %)))]
|
||||
|
||||
(-> (select-keys objects selected+parents)
|
||||
(d/update-vals remove-children))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue