Merge pull request #4230 from penpot/azazeln28-component-layers-incorrectly-relocated

🐛 Component layers are incorrectly relocated on drag'n'drop
This commit is contained in:
Alejandro 2024-03-08 09:48:49 +01:00 committed by GitHub
commit e25c1e987c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -262,6 +262,9 @@
(mf/use-fn
(mf/deps id index objects expanded? selected)
(fn [side _data]
(let [single? (= (count selected) 1)
same? (and single? (= (first selected) id))]
(when-not same?
(let [shape (get objects id)
parent-id
@ -284,7 +287,7 @@
(and expanded? (= side :bot) (d/not-empty? (:shapes shape))) (count (:shapes parent))
(= side :top) (inc index)
:else index)]
(st/emit! (dw/relocate-selected-shapes parent-id to-index)))))
(st/emit! (dw/relocate-selected-shapes parent-id to-index)))))))
on-hold
(mf/use-fn