mirror of
https://github.com/penpot/penpot.git
synced 2025-02-08 16:18:11 -05:00
Add select-shape event.
This commit is contained in:
parent
a5dc634e35
commit
311d107b36
1 changed files with 12 additions and 0 deletions
|
@ -65,6 +65,18 @@
|
||||||
(-pr-writer [mv writer _]
|
(-pr-writer [mv writer _]
|
||||||
(-write writer "#<event:u.d.w/select-for-drawing>"))))
|
(-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
|
;; TODO: validate shape
|
||||||
|
|
||||||
(defn add-shape
|
(defn add-shape
|
||||||
|
|
Loading…
Add table
Reference in a new issue