From 311d107b36f00a6d046ac062e257bcf35ee462c6 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 28 Dec 2015 20:39:24 +0200 Subject: [PATCH] Add select-shape event. --- frontend/uxbox/data/workspace.cljs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/uxbox/data/workspace.cljs b/frontend/uxbox/data/workspace.cljs index 82a30870e..13af36cad 100644 --- a/frontend/uxbox/data/workspace.cljs +++ b/frontend/uxbox/data/workspace.cljs @@ -65,6 +65,18 @@ (-pr-writer [mv writer _] (-write writer "#")))) +(defn select-shape + "Mark a shape selected for drawing in the canvas." + [id] + (reify + rs/UpdateEvent + (-apply-update [_ state] + (let [selected (get-in state [:workspace :selected])] + (if (contains? selected id) + (update-in state [:workspace :selected] disj id) + (update-in state [:workspace :selected] conj id)))))) + + ;; TODO: validate shape (defn add-shape