mirror of
https://github.com/penpot/penpot.git
synced 2025-05-13 15:16:37 +02:00
🐛 Fixes problem with pan and space
This commit is contained in:
parent
fa2d0f5ed7
commit
0a44dbd921
2 changed files with 14 additions and 14 deletions
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
- Fixes problem with pan and space [#811](https://github.com/penpot/penpot/issues/811)
|
||||||
|
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
|
|
||||||
### :heart: Community contributions by (Thank you!)
|
### :heart: Community contributions by (Thank you!)
|
||||||
|
|
|
@ -441,24 +441,22 @@
|
||||||
|
|
||||||
(defn start-panning []
|
(defn start-panning []
|
||||||
(ptk/reify ::start-panning
|
(ptk/reify ::start-panning
|
||||||
ptk/UpdateEvent
|
|
||||||
(update [_ state]
|
|
||||||
(-> state
|
|
||||||
(assoc-in [:workspace-local :panning] true)))
|
|
||||||
|
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [stopper (->> stream (rx/filter (ptk/type? ::finish-panning)))
|
(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]) gpt/point)]
|
||||||
(->> stream
|
(when-not (get-in state [:workspace-local :panning])
|
||||||
(rx/filter ms/pointer-event?)
|
(rx/concat
|
||||||
(rx/filter #(= :delta (:source %)))
|
(rx/of #(-> % (assoc-in [:workspace-local :panning] true)))
|
||||||
(rx/map :pt)
|
(->> stream
|
||||||
(rx/take-until stopper)
|
(rx/filter ms/pointer-event?)
|
||||||
(rx/map (fn [delta]
|
(rx/filter #(= :delta (:source %)))
|
||||||
(let [delta (gpt/divide delta zoom)]
|
(rx/map :pt)
|
||||||
(update-viewport-position {:x #(- % (:x delta))
|
(rx/take-until stopper)
|
||||||
:y #(- % (:y delta))})))))))))
|
(rx/map (fn [delta]
|
||||||
|
(let [delta (gpt/divide delta zoom)]
|
||||||
|
(update-viewport-position {:x #(- % (:x delta))
|
||||||
|
:y #(- % (:y delta))})))))))))))
|
||||||
|
|
||||||
(defn finish-panning []
|
(defn finish-panning []
|
||||||
(ptk/reify ::finish-panning
|
(ptk/reify ::finish-panning
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue