mirror of
https://github.com/penpot/penpot.git
synced 2025-08-02 15:18:24 +02:00
Add zoom events.
This commit is contained in:
parent
bc2e7c46a9
commit
4aaa5c3e7a
1 changed files with 36 additions and 0 deletions
|
@ -242,3 +242,39 @@
|
|||
"Copy selected shapes to clipboard."
|
||||
([] (PasteFromClipboard. nil))
|
||||
([id] (PasteFromClipboard. id)))
|
||||
|
||||
;; --- Increase Zoom
|
||||
|
||||
(defrecord IncreaseZoom []
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(let [increase #(+ % 0.1)]
|
||||
(update-in state [:workspace :zoom] (fnil increase 1)))))
|
||||
|
||||
(defn increase-zoom
|
||||
[]
|
||||
(IncreaseZoom.))
|
||||
|
||||
;; --- Decrease Zoom
|
||||
|
||||
(defrecord DecreaseZoom []
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(let [decrease #(if (> % 0) (- % 0.1) 0)]
|
||||
(update-in state [:workspace :zoom] (fnil decrease 1)))))
|
||||
|
||||
(defn decrease-zoom
|
||||
[]
|
||||
(DecreaseZoom.))
|
||||
|
||||
;; --- Reset Zoom
|
||||
|
||||
(defrecord ResetZoom []
|
||||
rs/UpdateEvent
|
||||
(-apply-update [_ state]
|
||||
(assoc-in state [:workspace :zoom] 1)))
|
||||
|
||||
(defn reset-zoom
|
||||
[]
|
||||
(ResetZoom.))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue