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

🐛 Fix send to back several shapes at a time

This commit is contained in:
Eva 2022-04-04 17:15:23 +02:00 committed by Alonso Torres
parent b904237c5a
commit 3822be76a8
2 changed files with 10 additions and 8 deletions

View file

@ -43,6 +43,7 @@
### :bug: Bugs fixed
- Fix send to back several shapes at a time [Taiga #3077](https://tree.taiga.io/project/penpot/issue/3077)
- Fix duplicate multi selected elements [Taiga #3155](https://tree.taiga.io/project/penpot/issue/3155)
- Fix add fills to artboard modify children [Taiga #3151](https://tree.taiga.io/project/penpot/issue/3151)
- Avoid numeric inputs to allow big numbers [Taiga #2858](https://tree.taiga.io/project/penpot/issue/2858)

View file

@ -578,19 +578,20 @@
(watch [it state _]
(let [page-id (:current-page-id state)
objects (wsh/lookup-page-objects state page-id)
selected-shapes (->> (wsh/lookup-selected state)
(map (d/getf objects)))
selected-ids (wsh/lookup-selected state)
selected-shapes (map (d/getf objects) selected-ids)
move-shape
(fn [changes shape]
(let [parent (get objects (:parent-id shape))
sibling-ids (:shapes parent)
current-index (d/index-of sibling-ids (:id shape))
index-in-selection (d/index-of selected-ids (:id shape))
new-index (case loc
:top (count sibling-ids)
:down (max 0 (- current-index 1))
:up (min (count sibling-ids) (+ (inc current-index) 1))
:bottom 0)]
:bottom index-in-selection)]
(pcb/change-parent changes
(:id parent)
[shape]
@ -631,11 +632,11 @@
(pcb/update-shapes shapes-to-detach
(fn [shape]
(assoc shape :component-id nil
:component-file nil
:component-root? nil
:remote-synced? nil
:shape-ref nil
:touched nil)))
:component-file nil
:component-root? nil
:remote-synced? nil
:shape-ref nil
:touched nil)))
; Make non root a component moved inside another one
(pcb/update-shapes shapes-to-deroot