mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 08:29:42 -05:00
🐛 Fix cut/paste component inside a board
This commit is contained in:
parent
c4e707d5a2
commit
5cbb3f76c7
1 changed files with 30 additions and 27 deletions
|
@ -258,9 +258,12 @@
|
|||
parent (get-in page [:objects parent-id])
|
||||
main-inst (get-in component [:objects (:main-instance-id component)])
|
||||
inside-component? (some? (ctn/get-instance-root (:objects page) parent))
|
||||
|
||||
origin-frame (get-in page [:objects (:frame-id main-inst)])
|
||||
;; We are using a deleted component andit's coordenates are absolute, we must adjust them to its containing frame to adjust the delta
|
||||
delta (gpt/subtract delta (-> origin-frame :selrect gpt/point))
|
||||
shapes (cfh/get-children-with-self (:objects component) (:main-instance-id component))
|
||||
shapes (map #(gsh/move % delta) shapes)
|
||||
|
||||
first-shape (cond-> (first shapes)
|
||||
(not (nil? parent-id))
|
||||
(assoc :parent-id parent-id)
|
||||
|
|
Loading…
Add table
Reference in a new issue