mirror of
https://github.com/penpot/penpot.git
synced 2025-05-13 11:16:39 +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
|
||||
|
||||
- Fixes problem with pan and space [#811](https://github.com/penpot/penpot/issues/811)
|
||||
|
||||
### :arrow_up: Deps updates
|
||||
|
||||
### :heart: Community contributions by (Thank you!)
|
||||
|
|
|
@ -441,24 +441,22 @@
|
|||
|
||||
(defn start-panning []
|
||||
(ptk/reify ::start-panning
|
||||
ptk/UpdateEvent
|
||||
(update [_ state]
|
||||
(-> state
|
||||
(assoc-in [:workspace-local :panning] true)))
|
||||
|
||||
ptk/WatchEvent
|
||||
(watch [_ state stream]
|
||||
(let [stopper (->> stream (rx/filter (ptk/type? ::finish-panning)))
|
||||
zoom (-> (get-in state [:workspace-local :zoom]) gpt/point)]
|
||||
(->> stream
|
||||
(rx/filter ms/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))})))))))))
|
||||
(when-not (get-in state [:workspace-local :panning])
|
||||
(rx/concat
|
||||
(rx/of #(-> % (assoc-in [:workspace-local :panning] true)))
|
||||
(->> stream
|
||||
(rx/filter ms/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))})))))))))))
|
||||
|
||||
(defn finish-panning []
|
||||
(ptk/reify ::finish-panning
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue