0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

🐛 Fix copy paste can produce nested components in copies

This commit is contained in:
Pablo Alba 2023-06-06 16:29:09 +02:00 committed by Andrés Moya
parent 291180816a
commit 55a821f193

View file

@ -312,14 +312,13 @@
(defn components-nesting-loop?
"Check if a nesting loop would be created if the given shape is moved below the given parent"
[objects shape-id parent-id]
(let [children (get-children-with-self objects shape-id)
xf-get-component-id (keep :component-id)
(let [xf-get-component-id (keep :component-id)
children (get-children-with-self objects shape-id)
child-components (into #{} xf-get-component-id children)
parents (get-parents-with-self objects parent-id)
xf-get-main-id (comp (filter :main-instance?)
xf-get-component-id)
parent-components (into #{} xf-get-main-id parents)]
parent-components (into #{} xf-get-component-id parents)]
(seq (set/intersection child-components parent-components))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;