0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-23 23:18:48 -05:00

🐛 Fix pinch to zoom on mac

This commit is contained in:
alonso.torres 2022-04-19 13:21:45 +02:00
parent b78d9dcc52
commit b6f2800aa3

View file

@ -379,6 +379,7 @@
(dom/stop-propagation event)
(let [pt (->> (dom/get-client-position event)
(utils/translate-point-to-viewport viewport zoom))
ctrl? (kbd/ctrl? event)
delta-mode (.-deltaMode ^js event)
@ -394,7 +395,7 @@
delta-x (-> (.-deltaX ^js event)
(* unit)
(/ zoom))]
(if mod?
(if (or ctrl? mod?)
(let [delta (* -1 (+ (.-deltaY ^js event) (.-deltaX ^js event)))
scale (-> (+ 1 (/ delta 100)) (mth/clamp 0.77 1.3))]
(st/emit! (dw/set-zoom pt scale)))