🐛 Fix incorrect type handling on group operation.

And improve specs related to group attrs.
This commit is contained in:
Andrey Antukh 2020-11-13 11:46:57 +01:00 committed by Alonso Torres
parent 388d255243
commit 48663eacdc
3 changed files with 18 additions and 15 deletions

View file

@ -1479,8 +1479,7 @@
selected (get-in state [:workspace-local :selected])
shapes (dws/shapes-for-grouping objects selected)]
(when-not (empty? shapes)
(let [[group rchanges uchanges]
(dws/prepare-create-group page-id shapes "Group-" false)]
(let [[group rchanges uchanges] (dws/prepare-create-group page-id shapes "Group-" false)]
(rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})
(dws/select-shapes (d/ordered-set (:id group))))))))))

View file

@ -118,7 +118,7 @@
objects (dwc/lookup-page-objects state page-id)]
(rx/of (dwc/expand-all-parents ids objects))))))
(defn deselect-all
(defn deselect-all
"Clear all possible state of drawing, edition
or any similar action taken by the user.
When `check-modal` the method will check if a modal is opened
@ -202,7 +202,7 @@
(name (gensym prefix)))]
(-> (cp/make-minimal-group frame-id selrect group-name)
(geom/setup selrect)
(assoc :shapes (map :id shapes)))))
(assoc :shapes (mapv :id shapes)))))
(defn prepare-create-group
[page-id shapes prefix keep-name]
@ -217,15 +217,15 @@
{:type :mov-objects
:page-id page-id
:parent-id (:id group)
:shapes (map :id shapes)}]
:shapes (mapv :id shapes)}]
uchanges (conj
(map (fn [obj] {:type :mov-objects
:page-id page-id
:parent-id (:parent-id obj)
:index (::index obj)
:shapes [(:id obj)]})
shapes)
(mapv (fn [obj] {:type :mov-objects
:page-id page-id
:parent-id (:parent-id obj)
:index (::index obj)
:shapes [(:id obj)]})
shapes)
{:type :del-obj
:id (:id group)
:page-id page-id})]