mirror of
https://github.com/penpot/penpot.git
synced 2025-05-16 18:16:12 +02:00
Added round and limit to zoom steps (#7)
This commit is contained in:
parent
55dfbd73e5
commit
e43ca70245
1 changed files with 3 additions and 2 deletions
|
@ -16,6 +16,7 @@
|
||||||
[uxbox.data.shapes :as uds]
|
[uxbox.data.shapes :as uds]
|
||||||
[uxbox.data.worker :as wrk]
|
[uxbox.data.worker :as wrk]
|
||||||
[uxbox.util.datetime :as dt]
|
[uxbox.util.datetime :as dt]
|
||||||
|
[uxbox.util.math :as mth]
|
||||||
[uxbox.util.geom.point :as gpt]))
|
[uxbox.util.geom.point :as gpt]))
|
||||||
|
|
||||||
;; --- Workspace Initialization
|
;; --- Workspace Initialization
|
||||||
|
@ -115,7 +116,7 @@
|
||||||
(defrecord IncreaseZoom []
|
(defrecord IncreaseZoom []
|
||||||
rs/UpdateEvent
|
rs/UpdateEvent
|
||||||
(-apply-update [_ state]
|
(-apply-update [_ state]
|
||||||
(let [increase #(* % 1.05)]
|
(let [increase #(min (mth/precision (* % 1.05) 2) 3)]
|
||||||
(update-in state [:workspace :zoom] (fnil increase 1)))))
|
(update-in state [:workspace :zoom] (fnil increase 1)))))
|
||||||
|
|
||||||
(defn increase-zoom
|
(defn increase-zoom
|
||||||
|
@ -127,7 +128,7 @@
|
||||||
(defrecord DecreaseZoom []
|
(defrecord DecreaseZoom []
|
||||||
rs/UpdateEvent
|
rs/UpdateEvent
|
||||||
(-apply-update [_ state]
|
(-apply-update [_ state]
|
||||||
(let [decrease #(* % 0.95)]
|
(let [decrease #(max (mth/precision (* % 0.95) 2) 0.15)]
|
||||||
(update-in state [:workspace :zoom] (fnil decrease 1)))))
|
(update-in state [:workspace :zoom] (fnil decrease 1)))))
|
||||||
|
|
||||||
(defn decrease-zoom
|
(defn decrease-zoom
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue