mirror of
https://github.com/penpot/penpot.git
synced 2025-05-20 07:36:10 +02:00
🐛 Fix copy paste can produce nested components
This commit is contained in:
parent
33fb979b2c
commit
fc038998d5
3 changed files with 28 additions and 16 deletions
|
@ -1646,9 +1646,18 @@
|
|||
tree-root (get-tree-root-shapes paste-objects)
|
||||
only-one-root-shape? (and
|
||||
(< 1 (count paste-objects))
|
||||
(= 1 (count tree-root)))]
|
||||
(= 1 (count tree-root)))
|
||||
all-objects (merge page-objects paste-objects)
|
||||
comps-nesting-loop? (not (->> (keys paste-objects)
|
||||
(map #(cph/components-nesting-loop? all-objects % (:id base)))
|
||||
(every? nil?)))]
|
||||
|
||||
(cond
|
||||
comps-nesting-loop?
|
||||
;; Avoid placing a shape as a direct or indirect child of itself,
|
||||
;; or inside its main component if it's in a copy.
|
||||
[uuid/zero uuid/zero (gpt/subtract mouse-pos orig-pos)]
|
||||
|
||||
(selected-frame? state)
|
||||
|
||||
(if (or (any-same-frame-from-selected? state (keys paste-objects))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue