mirror of
https://github.com/penpot/penpot.git
synced 2025-08-06 08:08:29 +02:00
Add event for alter shapes stroke properties.
This commit is contained in:
parent
b7afe65272
commit
d5e636f696
1 changed files with 15 additions and 0 deletions
|
@ -36,6 +36,10 @@
|
||||||
{:fill [sc/color]
|
{:fill [sc/color]
|
||||||
:opacity [v/number]})
|
:opacity [v/number]})
|
||||||
|
|
||||||
|
(def ^:static +shape-update-stroke-schema+
|
||||||
|
{:color [sc/color]
|
||||||
|
:opacity [v/number]})
|
||||||
|
|
||||||
(def ^:static +shape-update-position-schema+
|
(def ^:static +shape-update-position-schema+
|
||||||
{:x [v/integer]
|
{:x [v/integer]
|
||||||
:y [v/integer]})
|
:y [v/integer]})
|
||||||
|
@ -232,6 +236,17 @@
|
||||||
(when fill {:fill fill})
|
(when fill {:fill fill})
|
||||||
(when opacity {:opacity opacity})))))
|
(when opacity {:opacity opacity})))))
|
||||||
|
|
||||||
|
(defn update-shape-stroke
|
||||||
|
[sid {:keys [color opacity width] :as opts}]
|
||||||
|
(sc/validate! +shape-update-stroke-schema+ opts)
|
||||||
|
(reify
|
||||||
|
rs/UpdateEvent
|
||||||
|
(-apply-update [_ state]
|
||||||
|
(update-in state [:shapes-by-id sid]
|
||||||
|
merge
|
||||||
|
(when width {:stroke-width width})
|
||||||
|
(when color {:stroke color})
|
||||||
|
(when opacity {:stroke-opacity opacity})))))
|
||||||
|
|
||||||
(defn toggle-shape-visibility
|
(defn toggle-shape-visibility
|
||||||
[sid]
|
[sid]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue