0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-20 03:31:24 -05:00

🐛 Fix restore component

This commit is contained in:
Alejandro Alonso 2024-03-12 12:43:42 +01:00
parent fb58d7a4cc
commit 56bc70dffe
2 changed files with 2 additions and 3 deletions
frontend/src/app/main/data/workspace

View file

@ -263,9 +263,6 @@
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)

View file

@ -433,6 +433,8 @@
main-component (ctf/get-component libraries file-id component-id)
moved-component (gsh/move component-root delta)
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
#(dwlh/generate-instantiate-component changes