mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 08:09:14 -05:00
Update changes
This commit is contained in:
parent
3bd0318999
commit
4ae467987a
3 changed files with 15 additions and 14 deletions
|
@ -12,7 +12,8 @@
|
||||||
[app.common.geom.point :as gpt]
|
[app.common.geom.point :as gpt]
|
||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.main.data.workspace.changes :as dch]
|
[app.main.data.changes :as dch]
|
||||||
|
[app.main.data.workspace.shapes :as dwsh]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.ui.workspace.tokens.common :refer [workspace-shapes]]
|
[app.main.ui.workspace.tokens.common :refer [workspace-shapes]]
|
||||||
[beicon.v2.core :as rx]
|
[beicon.v2.core :as rx]
|
||||||
|
@ -35,7 +36,7 @@
|
||||||
(ptk/reify ::update-shape
|
(ptk/reify ::update-shape
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ _]
|
(watch [_ _ _]
|
||||||
(rx/of (dch/update-shapes [id] #(merge % attrs))))))
|
(rx/of (dwsh/update-shapes [id] #(merge % attrs))))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; TOKENS Actions
|
;; TOKENS Actions
|
||||||
|
|
|
@ -245,7 +245,7 @@
|
||||||
undo-id (js/Symbol)]
|
undo-id (js/Symbol)]
|
||||||
(st/emit! (udw/trigger-bounding-box-cloaking ids)
|
(st/emit! (udw/trigger-bounding-box-cloaking ids)
|
||||||
(dwu/start-undo-transaction undo-id)
|
(dwu/start-undo-transaction undo-id)
|
||||||
(dch/update-shapes ids
|
(dwsh/update-shapes ids
|
||||||
(if token-value
|
(if token-value
|
||||||
#(assoc-in % [:applied-tokens attr] (:id value))
|
#(assoc-in % [:applied-tokens attr] (:id value))
|
||||||
#(d/dissoc-in % [:applied-tokens attr]))
|
#(d/dissoc-in % [:applied-tokens attr]))
|
||||||
|
@ -294,7 +294,7 @@
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps ids-with-children)
|
(mf/deps ids-with-children)
|
||||||
(fn [update-fn]
|
(fn [update-fn]
|
||||||
(dch/update-shapes ids-with-children
|
(dwsh/update-shapes ids-with-children
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(if (ctsr/has-radius? shape)
|
(if (ctsr/has-radius? shape)
|
||||||
(update-fn shape)
|
(update-fn shape)
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
[app.common.types.shape.radius :as ctsr]
|
[app.common.types.shape.radius :as ctsr]
|
||||||
[app.common.types.token :as ctt]
|
[app.common.types.token :as ctt]
|
||||||
[app.main.data.workspace :as udw]
|
[app.main.data.workspace :as udw]
|
||||||
[app.main.data.workspace.changes :as dch]
|
|
||||||
[app.main.data.workspace.shape-layout :as dwsl]
|
[app.main.data.workspace.shape-layout :as dwsl]
|
||||||
|
[app.main.data.workspace.shapes :as dwsh]
|
||||||
[app.main.data.workspace.state-helpers :as wsh]
|
[app.main.data.workspace.state-helpers :as wsh]
|
||||||
[app.main.data.workspace.transforms :as dwt]
|
[app.main.data.workspace.transforms :as dwt]
|
||||||
[app.main.data.workspace.undo :as dwu]
|
[app.main.data.workspace.undo :as dwu]
|
||||||
|
@ -41,10 +41,10 @@
|
||||||
tokenized-attributes (wtt/attributes-map attributes (:id token))]
|
tokenized-attributes (wtt/attributes-map attributes (:id token))]
|
||||||
(rx/of
|
(rx/of
|
||||||
(dwu/start-undo-transaction undo-id)
|
(dwu/start-undo-transaction undo-id)
|
||||||
(dch/update-shapes shape-ids (fn [shape]
|
(dwsh/update-shapes shape-ids (fn [shape]
|
||||||
(cond-> shape
|
(cond-> shape
|
||||||
attributes-to-remove (update :applied-tokens #(apply (partial dissoc %) attributes-to-remove))
|
attributes-to-remove (update :applied-tokens #(apply (partial dissoc %) attributes-to-remove))
|
||||||
:always (update :applied-tokens merge tokenized-attributes))))
|
:always (update :applied-tokens merge tokenized-attributes))))
|
||||||
(when on-update-shape
|
(when on-update-shape
|
||||||
(on-update-shape resolved-value shape-ids attributes))
|
(on-update-shape resolved-value shape-ids attributes))
|
||||||
(dwu/commit-undo-transaction undo-id)))))))))
|
(dwu/commit-undo-transaction undo-id)))))))))
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
(watch [_ _ _]
|
(watch [_ _ _]
|
||||||
(rx/of
|
(rx/of
|
||||||
(let [remove-token #(when % (wtt/remove-attributes-for-token-id attributes (:id token) %))]
|
(let [remove-token #(when % (wtt/remove-attributes-for-token-id attributes (:id token) %))]
|
||||||
(dch/update-shapes
|
(dwsh/update-shapes
|
||||||
shape-ids
|
shape-ids
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(update shape :applied-tokens remove-token))))))))
|
(update shape :applied-tokens remove-token))))))))
|
||||||
|
@ -86,7 +86,7 @@
|
||||||
;; Shape Updates ---------------------------------------------------------------
|
;; Shape Updates ---------------------------------------------------------------
|
||||||
|
|
||||||
(defn update-shape-radius-all [value shape-ids]
|
(defn update-shape-radius-all [value shape-ids]
|
||||||
(dch/update-shapes shape-ids
|
(dwsh/update-shapes shape-ids
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(when (ctsr/has-radius? shape)
|
(when (ctsr/has-radius? shape)
|
||||||
(ctsr/set-radius-1 shape value)))
|
(ctsr/set-radius-1 shape value)))
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
|
|
||||||
(defn update-opacity [value shape-ids]
|
(defn update-opacity [value shape-ids]
|
||||||
(when (<= 0 value 1)
|
(when (<= 0 value 1)
|
||||||
(dch/update-shapes shape-ids #(assoc % :opacity value))))
|
(dwsh/update-shapes shape-ids #(assoc % :opacity value))))
|
||||||
|
|
||||||
(defn update-rotation [value shape-ids]
|
(defn update-rotation [value shape-ids]
|
||||||
(ptk/reify ::update-shape-dimensions
|
(ptk/reify ::update-shape-dimensions
|
||||||
|
@ -106,7 +106,7 @@
|
||||||
(udw/increase-rotation shape-ids value)))))
|
(udw/increase-rotation shape-ids value)))))
|
||||||
|
|
||||||
(defn update-shape-radius-single-corner [value shape-ids attributes]
|
(defn update-shape-radius-single-corner [value shape-ids attributes]
|
||||||
(dch/update-shapes shape-ids
|
(dwsh/update-shapes shape-ids
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(when (ctsr/has-radius? shape)
|
(when (ctsr/has-radius? shape)
|
||||||
(cond-> shape
|
(cond-> shape
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
|
|
||||||
(defn update-stroke-width
|
(defn update-stroke-width
|
||||||
[value shape-ids]
|
[value shape-ids]
|
||||||
(dch/update-shapes shape-ids
|
(dwsh/update-shapes shape-ids
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(when (seq (:strokes shape))
|
(when (seq (:strokes shape))
|
||||||
(assoc-in shape [:strokes 0 :stroke-width] value)))
|
(assoc-in shape [:strokes 0 :stroke-width] value)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue