mirror of
https://github.com/penpot/penpot.git
synced 2025-05-12 18:56:38 +02:00
Merge pull request #4250 from penpot/superalex-fix-restore-component
🐛 Fix restore component
This commit is contained in:
commit
2d5e1f7792
2 changed files with 2 additions and 3 deletions
|
@ -263,9 +263,6 @@
|
||||||
parent (get-in page [:objects parent-id])
|
parent (get-in page [:objects parent-id])
|
||||||
main-inst (get-in component [:objects (:main-instance-id component)])
|
main-inst (get-in component [:objects (:main-instance-id component)])
|
||||||
inside-component? (some? (ctn/get-instance-root (:objects page) parent))
|
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 (cfh/get-children-with-self (:objects component) (:main-instance-id component))
|
||||||
shapes (map #(gsh/move % delta) shapes)
|
shapes (map #(gsh/move % delta) shapes)
|
||||||
|
|
||||||
|
|
|
@ -433,6 +433,8 @@
|
||||||
main-component (ctf/get-component libraries file-id component-id)
|
main-component (ctf/get-component libraries file-id component-id)
|
||||||
moved-component (gsh/move component-root delta)
|
moved-component (gsh/move component-root delta)
|
||||||
pos (gpt/point (:x moved-component) (:y moved-component))
|
pos (gpt/point (:x moved-component) (:y moved-component))
|
||||||
|
origin-frame (get-in page [:objects frame-id])
|
||||||
|
delta (gpt/subtract delta (-> origin-frame :selrect gpt/point))
|
||||||
|
|
||||||
instantiate-component
|
instantiate-component
|
||||||
#(dwlh/generate-instantiate-component changes
|
#(dwlh/generate-instantiate-component changes
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue