0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

🐛 Fix problem when copy/pasting shapes

This commit is contained in:
alonso.torres 2023-03-24 15:09:40 +01:00
parent 26aec7d129
commit f11c782c0f
2 changed files with 12 additions and 6 deletions

View file

@ -54,6 +54,7 @@
- Fix problem with guides not showing when moving over nested frames [Taiga #4905](https://tree.taiga.io/project/penpot/issue/4905)
- Fix change email and password for users signed in via social login [Taiga #4273](https://tree.taiga.io/project/penpot/issue/4273)
- Fix drag and drop files from browser or file explorer under circumstances [Taiga #5054](https://tree.taiga.io/project/penpot/issue/5054)
- Fix problem when copy/pasting shapes [Taiga #4931](https://tree.taiga.io/project/penpot/issue/4931)
### :heart: Community contributions by (Thank you!)
- To @ondrejkonec: for contributing to the code with:

View file

@ -1326,14 +1326,19 @@
res)))
(maybe-translate [shape objects selected+children]
(let [root-frame-id (cph/get-shape-id-root-frame objects (:id shape))]
(if (and (not (cph/root-frame? shape))
(not (contains? selected+children root-frame-id)))
;; When the parent frame is not selected we change to relative
;; coordinates
(let [frame-id (:frame-id shape)
root-frame-id (cph/get-shape-id-root-frame objects (:id shape))]
(cond
(cph/root-frame? shape) shape
(contains? selected+children root-frame-id) shape
(cph/frame-shape? shape)
(let [frame (get objects root-frame-id)]
(gsh/translate-to-frame shape frame))
shape)))
:else
(let [frame (get objects frame-id)]
(gsh/translate-to-frame shape frame)))))
(on-copy-error [error]
(js/console.error "Clipboard blocked:" error)