diff --git a/common/app/common/pages.cljc b/common/app/common/pages.cljc index c5ad442da7..d202743d96 100644 --- a/common/app/common/pages.cljc +++ b/common/app/common/pages.cljc @@ -262,10 +262,13 @@ :internal.shape/height])) (s/def :internal.shape/point - (s/keys :req-un [:internal.shape/x :internal.shape/y])) + (s/and (s/keys :req-un [:internal.shape/x :internal.shape/y]) gpt/point?)) (s/def :internal.shape/points - (s/coll-of :internal.shape/point :kind vector?)) + (s/every :internal.shape/point :kind vector?)) + +(s/def :internal.shape/shapes + (s/every uuid? :kind vector?)) (s/def ::shape-attrs (s/keys :opt-un [:internal.shape/blocked @@ -292,6 +295,7 @@ :internal.shape/x :internal.shape/y :internal.shape/exports + :internal.shape/shapes :internal.shape/stroke-color :internal.shape/stroke-color-ref-file :internal.shape/stroke-color-ref-id @@ -433,7 +437,7 @@ (s/def :internal.operations.set/attr keyword?) (s/def :internal.operations.set/val any?) -(s/def :internal.operations.set/touched +(s/def :internal.operations.set/touched (s/nilable (s/every keyword? :kind set?))) (defmethod operation-spec :set [_] @@ -475,7 +479,7 @@ (s/keys :req-un [::page-id :internal.changes.reg-objects/shapes])) (defmethod change-spec :mov-objects [_] - (s/keys :req-un [::page-id ::parent-id ::shapes] + (s/keys :req-un [::page-id ::parent-id :internal.shape/shapes] :opt-un [::index])) (defmethod change-spec :add-page [_] diff --git a/frontend/src/app/main/data/workspace.cljs b/frontend/src/app/main/data/workspace.cljs index ef40318313..24cbc6b989 100644 --- a/frontend/src/app/main/data/workspace.cljs +++ b/frontend/src/app/main/data/workspace.cljs @@ -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)))))))))) diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 136333ef6b..f2ef8af360 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -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})]