mirror of
https://github.com/penpot/penpot.git
synced 2025-02-10 17:18:21 -05:00
🐛 Fix ordering on grouping multiple shapes.
This commit is contained in:
parent
84bf0e26b2
commit
cfaf09a5c1
1 changed files with 11 additions and 9 deletions
|
@ -279,7 +279,6 @@
|
||||||
(update :height #(/ % hprop))
|
(update :height #(/ % hprop))
|
||||||
(assoc :left-offset left-offset)))))))))))
|
(assoc :left-offset left-offset)))))))))))
|
||||||
|
|
||||||
;; ---
|
|
||||||
|
|
||||||
(defn adjust-group-shapes
|
(defn adjust-group-shapes
|
||||||
[ids]
|
[ids]
|
||||||
|
@ -1284,7 +1283,10 @@
|
||||||
objects (get-in state [:workspace-data page-id :objects])
|
objects (get-in state [:workspace-data page-id :objects])
|
||||||
items (->> selected
|
items (->> selected
|
||||||
(map #(get objects %))
|
(map #(get objects %))
|
||||||
(filter #(not= :frame (:type %))))]
|
(filter #(not= :frame (:type %)))
|
||||||
|
(map #(assoc % ::index (cph/position-on-parent (:id %) objects)))
|
||||||
|
(sort-by ::index))]
|
||||||
|
|
||||||
(when (not-empty items)
|
(when (not-empty items)
|
||||||
(let [selrect (geom/selection-rect items)
|
(let [selrect (geom/selection-rect items)
|
||||||
frame-id (-> items first :frame-id)
|
frame-id (-> items first :frame-id)
|
||||||
|
@ -1292,7 +1294,7 @@
|
||||||
group (-> (group-shape id frame-id selected selrect)
|
group (-> (group-shape id frame-id selected selrect)
|
||||||
(geom/setup selrect))
|
(geom/setup selrect))
|
||||||
|
|
||||||
index (cph/position-on-parent (:id (first items)) objects)
|
index (::index (first items))
|
||||||
|
|
||||||
rchanges [{:type :add-obj
|
rchanges [{:type :add-obj
|
||||||
:id id
|
:id id
|
||||||
|
@ -1302,19 +1304,19 @@
|
||||||
:index index}
|
:index index}
|
||||||
{:type :mov-objects
|
{:type :mov-objects
|
||||||
:parent-id id
|
:parent-id id
|
||||||
:shapes (vec selected)}]
|
:shapes (->> items
|
||||||
|
(map :id)
|
||||||
|
(into #{})
|
||||||
|
(vec))}]
|
||||||
|
|
||||||
uchanges
|
uchanges
|
||||||
(reduce (fn [res obj]
|
(reduce (fn [res obj]
|
||||||
(conj res {:type :mov-objects
|
(conj res {:type :mov-objects
|
||||||
:parent-id (:parent-id obj)
|
:parent-id (:parent-id obj)
|
||||||
:index (:index obj)
|
:index (::index obj)
|
||||||
:shapes [(:id obj)]}))
|
:shapes [(:id obj)]}))
|
||||||
[]
|
[]
|
||||||
(->> selected
|
items)
|
||||||
(map #(get objects %))
|
|
||||||
(map #(assoc % :index (cph/position-on-parent (:id %) objects)))
|
|
||||||
(sort-by :index)))
|
|
||||||
|
|
||||||
uchanges (conj uchanges {:type :del-obj :id id})]
|
uchanges (conj uchanges {:type :del-obj :id id})]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue