0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 00:10:11 -05:00

Added round and limit to zoom steps (#7)

This commit is contained in:
Jesús Espino 2016-04-10 19:07:24 +02:00 committed by Andrey Antukh
parent 55dfbd73e5
commit e43ca70245

View file

@ -16,6 +16,7 @@
[uxbox.data.shapes :as uds]
[uxbox.data.worker :as wrk]
[uxbox.util.datetime :as dt]
[uxbox.util.math :as mth]
[uxbox.util.geom.point :as gpt]))
;; --- Workspace Initialization
@ -115,7 +116,7 @@
(defrecord IncreaseZoom []
rs/UpdateEvent
(-apply-update [_ state]
(let [increase #(* % 1.05)]
(let [increase #(min (mth/precision (* % 1.05) 2) 3)]
(update-in state [:workspace :zoom] (fnil increase 1)))))
(defn increase-zoom
@ -127,7 +128,7 @@
(defrecord DecreaseZoom []
rs/UpdateEvent
(-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)))))
(defn decrease-zoom