mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 08:20:45 -05: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)
|
||||
(let [page-id (get-in state [:workspace-page :id])
|
||||
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])
|
||||
(map-indexed vector)
|
||||
(filter #(selected (second %)))
|
||||
(ffirst))
|
||||
rchanges [{:type :add-obj
|
||||
:id id
|
||||
:frame-id frame-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}]]
|
||||
items (map #(get objects %) selected)
|
||||
selrect (geom/selection-rect items)
|
||||
frame-id (-> items first :frame-id)
|
||||
parent-id (-> items first :parent-id)
|
||||
group (-> (group-shape id frame-id selected selrect)
|
||||
(geom/setup selrect))
|
||||
|
||||
index (->> (get-in objects [frame-id :shapes])
|
||||
(map-indexed vector)
|
||||
(filter #(selected (second %)))
|
||||
(ffirst))
|
||||
|
||||
rchanges [{:type :add-obj
|
||||
:id id
|
||||
:frame-id frame-id
|
||||
:parent-id parent-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})
|
||||
(dws/select-shapes #{id}))))))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue