From d5e636f6963cab8965ed1a76a1ba2fd7ef1cf467 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 21 Jan 2016 00:12:38 +0200 Subject: [PATCH] Add event for alter shapes stroke properties. --- src/uxbox/data/workspace.cljs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/uxbox/data/workspace.cljs b/src/uxbox/data/workspace.cljs index 492c824cbb..823ed6d167 100644 --- a/src/uxbox/data/workspace.cljs +++ b/src/uxbox/data/workspace.cljs @@ -36,6 +36,10 @@ {:fill [sc/color] :opacity [v/number]}) +(def ^:static +shape-update-stroke-schema+ + {:color [sc/color] + :opacity [v/number]}) + (def ^:static +shape-update-position-schema+ {:x [v/integer] :y [v/integer]}) @@ -232,6 +236,17 @@ (when fill {:fill fill}) (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 [sid]