From 70d464189f750fa88ac111e28c07c2bc8d932157 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Wed, 13 Jan 2021 13:02:27 +0100 Subject: [PATCH] :bug: Fixes scroll speed on firefox --- frontend/src/app/main/ui/workspace/viewport.cljs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/viewport.cljs b/frontend/src/app/main/ui/workspace/viewport.cljs index ed0815c25..a0c70c56a 100644 --- a/frontend/src/app/main/ui/workspace/viewport.cljs +++ b/frontend/src/app/main/ui/workspace/viewport.cljs @@ -56,7 +56,8 @@ [potok.core :as ptk] [promesa.core :as p] [rumext.alpha :as mf]) - (:import goog.events.EventType)) + (:import goog.events.EventType + goog.events.WheelEvent)) ;; --- Coordinates Widget @@ -432,7 +433,14 @@ (.contains ^js node target) (let [event (.getBrowserEvent ^js event) - delta (.-deltaY ^js event) + delta-mode (.-deltaMode ^js event) + + unit (cond + (= delta-mode WheelEvent.DeltaMode.PIXEL) 1 + (= delta-mode WheelEvent.DeltaMode.LINE) 16 + (= delta-mode WheelEvent.DeltaMode.PAGE) 100) + + delta (* (.-deltaY ^js event) unit) delta (/ delta @refs/selected-zoom)] (dom/prevent-default event) (dom/stop-propagation event)