mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 07:41:43 -05:00
🐛 Fix incorrect type handling on group operation.
And improve specs related to group attrs.
This commit is contained in:
parent
388d255243
commit
48663eacdc
3 changed files with 18 additions and 15 deletions
|
@ -262,10 +262,13 @@
|
||||||
:internal.shape/height]))
|
:internal.shape/height]))
|
||||||
|
|
||||||
(s/def :internal.shape/point
|
(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/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/def ::shape-attrs
|
||||||
(s/keys :opt-un [:internal.shape/blocked
|
(s/keys :opt-un [:internal.shape/blocked
|
||||||
|
@ -292,6 +295,7 @@
|
||||||
:internal.shape/x
|
:internal.shape/x
|
||||||
:internal.shape/y
|
:internal.shape/y
|
||||||
:internal.shape/exports
|
:internal.shape/exports
|
||||||
|
:internal.shape/shapes
|
||||||
:internal.shape/stroke-color
|
:internal.shape/stroke-color
|
||||||
:internal.shape/stroke-color-ref-file
|
:internal.shape/stroke-color-ref-file
|
||||||
:internal.shape/stroke-color-ref-id
|
:internal.shape/stroke-color-ref-id
|
||||||
|
@ -475,7 +479,7 @@
|
||||||
(s/keys :req-un [::page-id :internal.changes.reg-objects/shapes]))
|
(s/keys :req-un [::page-id :internal.changes.reg-objects/shapes]))
|
||||||
|
|
||||||
(defmethod change-spec :mov-objects [_]
|
(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]))
|
:opt-un [::index]))
|
||||||
|
|
||||||
(defmethod change-spec :add-page [_]
|
(defmethod change-spec :add-page [_]
|
||||||
|
|
|
@ -1479,8 +1479,7 @@
|
||||||
selected (get-in state [:workspace-local :selected])
|
selected (get-in state [:workspace-local :selected])
|
||||||
shapes (dws/shapes-for-grouping objects selected)]
|
shapes (dws/shapes-for-grouping objects selected)]
|
||||||
(when-not (empty? shapes)
|
(when-not (empty? shapes)
|
||||||
(let [[group rchanges uchanges]
|
(let [[group rchanges uchanges] (dws/prepare-create-group page-id shapes "Group-" false)]
|
||||||
(dws/prepare-create-group page-id shapes "Group-" false)]
|
|
||||||
(rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})
|
(rx/of (dwc/commit-changes rchanges uchanges {:commit-local? true})
|
||||||
(dws/select-shapes (d/ordered-set (:id group))))))))))
|
(dws/select-shapes (d/ordered-set (:id group))))))))))
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@
|
||||||
(name (gensym prefix)))]
|
(name (gensym prefix)))]
|
||||||
(-> (cp/make-minimal-group frame-id selrect group-name)
|
(-> (cp/make-minimal-group frame-id selrect group-name)
|
||||||
(geom/setup selrect)
|
(geom/setup selrect)
|
||||||
(assoc :shapes (map :id shapes)))))
|
(assoc :shapes (mapv :id shapes)))))
|
||||||
|
|
||||||
(defn prepare-create-group
|
(defn prepare-create-group
|
||||||
[page-id shapes prefix keep-name]
|
[page-id shapes prefix keep-name]
|
||||||
|
@ -217,15 +217,15 @@
|
||||||
{:type :mov-objects
|
{:type :mov-objects
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
:parent-id (:id group)
|
:parent-id (:id group)
|
||||||
:shapes (map :id shapes)}]
|
:shapes (mapv :id shapes)}]
|
||||||
|
|
||||||
uchanges (conj
|
uchanges (conj
|
||||||
(map (fn [obj] {:type :mov-objects
|
(mapv (fn [obj] {:type :mov-objects
|
||||||
:page-id page-id
|
:page-id page-id
|
||||||
:parent-id (:parent-id obj)
|
:parent-id (:parent-id obj)
|
||||||
:index (::index obj)
|
:index (::index obj)
|
||||||
:shapes [(:id obj)]})
|
:shapes [(:id obj)]})
|
||||||
shapes)
|
shapes)
|
||||||
{:type :del-obj
|
{:type :del-obj
|
||||||
:id (:id group)
|
:id (:id group)
|
||||||
:page-id page-id})]
|
:page-id page-id})]
|
||||||
|
|
Loading…
Add table
Reference in a new issue