mirror of
https://github.com/penpot/penpot.git
synced 2025-06-12 11:41:42 +02:00
🐛 Group shapes in the correct parent.
This commit is contained in:
parent
a1ff567b30
commit
9ed6d23041
1 changed files with 27 additions and 22 deletions
|
@ -1236,29 +1236,34 @@
|
||||||
(when (not-empty selected)
|
(when (not-empty selected)
|
||||||
(let [page-id (get-in state [:workspace-page :id])
|
(let [page-id (get-in state [:workspace-page :id])
|
||||||
objects (get-in state [:workspace-data page-id :objects])
|
objects (get-in state [:workspace-data page-id :objects])
|
||||||
selected-objects (map (partial get objects) selected)
|
|
||||||
selrect (geom/selection-rect selected-objects)
|
|
||||||
frame-id (-> selected-objects first :frame-id)
|
|
||||||
group (-> (group-shape id frame-id selected selrect)
|
|
||||||
(geom/setup selrect))
|
|
||||||
|
|
||||||
index (->> (get-in objects [frame-id :shapes])
|
items (map #(get objects %) selected)
|
||||||
(map-indexed vector)
|
selrect (geom/selection-rect items)
|
||||||
(filter #(selected (second %)))
|
frame-id (-> items first :frame-id)
|
||||||
(ffirst))
|
parent-id (-> items first :parent-id)
|
||||||
rchanges [{:type :add-obj
|
group (-> (group-shape id frame-id selected selrect)
|
||||||
:id id
|
(geom/setup selrect))
|
||||||
:frame-id frame-id
|
|
||||||
:obj group
|
index (->> (get-in objects [frame-id :shapes])
|
||||||
:index index}
|
(map-indexed vector)
|
||||||
{:type :mov-objects
|
(filter #(selected (second %)))
|
||||||
:parent-id id
|
(ffirst))
|
||||||
:shapes (vec selected)}]
|
|
||||||
uchanges [{:type :mov-objects
|
rchanges [{:type :add-obj
|
||||||
:parent-id frame-id
|
:id id
|
||||||
:shapes (vec selected)}
|
:frame-id frame-id
|
||||||
{:type :del-obj
|
:parent-id parent-id
|
||||||
:id id}]]
|
:obj group
|
||||||
|
:index index}
|
||||||
|
{:type :mov-objects
|
||||||
|
:parent-id id
|
||||||
|
:shapes (vec selected)}]
|
||||||
|
uchanges [{:type :mov-objects
|
||||||
|
:parent-id frame-id
|
||||||
|
:shapes (vec selected)}
|
||||||
|
{:type :del-obj
|
||||||
|
:id id}]]
|
||||||
|
|
||||||
(rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})
|
(rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})
|
||||||
(dws/select-shapes #{id}))))))))
|
(dws/select-shapes #{id}))))))))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue