diff --git a/frontend/src/app/main/data/workspace/viewport.cljs b/frontend/src/app/main/data/workspace/viewport.cljs index 55eadd321..0637eb246 100644 --- a/frontend/src/app/main/data/workspace/viewport.cljs +++ b/frontend/src/app/main/data/workspace/viewport.cljs @@ -10,7 +10,6 @@ [app.common.data.macros :as dm] [app.common.files.helpers :as cfh] [app.common.geom.align :as gal] - [app.common.geom.point :as gpt] [app.common.geom.rect :as gpr] [app.common.geom.shapes :as gsh] [app.common.math :as mth] @@ -150,19 +149,18 @@ ptk/WatchEvent (watch [_ state stream] (let [stopper (->> stream (rx/filter (ptk/type? ::finish-panning))) - zoom (-> (get-in state [:workspace-local :zoom]) gpt/point)] + zoom (get-in state [:workspace-local :zoom])] (when-not (get-in state [:workspace-local :panning]) (rx/concat (rx/of #(-> % (assoc-in [:workspace-local :panning] true))) (->> stream (rx/filter mse/pointer-event?) (rx/filter #(= :delta (:source %))) - (rx/map :pt) (rx/take-until stopper) - (rx/map (fn [delta] - (let [delta (gpt/divide delta zoom)] - (update-viewport-position {:x #(- % (:x delta)) - :y #(- % (:y delta))}))))))))))) + (rx/map (fn [event] + (let [delta (dm/get-prop event :pt)] + (update-viewport-position {:x #(- % (/ (:x delta) zoom)) + :y #(- % (/ (:y delta) zoom))}))))))))))) (defn finish-panning [] (ptk/reify ::finish-panning