0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 00:58:26 -05:00

Add toggle shape locking event.

This commit is contained in:
Andrey Antukh 2016-01-22 19:36:23 +02:00
parent c3105fd698
commit 4b6ad74f6b

View file

@ -282,6 +282,17 @@
(assoc-in state [:shapes-by-id sid] (assoc shape :blocked false))
(assoc-in state [:shapes-by-id sid] (assoc shape :blocked true)))))))
(defn toggle-shape-locking
[sid]
(reify
rs/UpdateEvent
(-apply-update [_ state]
(let [shape (get-in state [:shapes-by-id sid])
locked? (:locked shape false)]
(if locked?
(assoc-in state [:shapes-by-id sid] (assoc shape :locked false))
(assoc-in state [:shapes-by-id sid] (assoc shape :locked true)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Events (for selected)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;