Simplify select-for-drawing event implementation.

This commit is contained in:
Andrey Antukh
2016-10-21 00:19:57 +02:00
parent 1530464432
commit d6a2fee09a

View File

@@ -109,9 +109,11 @@
(reify
rs/UpdateEvent
(-apply-update [_ state]
(if (or (nil? shape) (= (get-in state [:workspace :drawing]) shape))
(update-in state [:workspace] dissoc :drawing)
(assoc-in state [:workspace :drawing] shape)))))
(let [current (get-in state [:workspace :drawing])]
(if (or (nil? shape)
(= shape current))
(update state :workspace dissoc :drawing)
(assoc-in state [:workspace :drawing] shape))))))
;; --- Activate Workspace Flag