0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-22 14:39:45 -05:00

Add select-shape event.

This commit is contained in:
Andrey Antukh 2015-12-28 20:39:24 +02:00
parent a5dc634e35
commit 311d107b36

View file

@ -65,6 +65,18 @@
(-pr-writer [mv writer _]
(-write writer "#<event:u.d.w/select-for-drawing>"))))
(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