mirror of
https://github.com/penpot/penpot.git
synced 2025-02-23 07:16:07 -05:00
🐛 Fix problem with middle mouse button press moving the canvas when not moving mouse
This commit is contained in:
parent
33a2f8d788
commit
2a4849cf8f
3 changed files with 10 additions and 31 deletions
|
@ -22,6 +22,7 @@
|
|||
- Fix issue when undo after changing the artboard of a shape [Taiga #1304](https://tree.taiga.io/project/penpot/issue/1304)
|
||||
- Fix problem with system shortcuts and application [#737](https://github.com/penpot/penpot/issues/737)
|
||||
- Fix issue with typographies panel cannot be collapsed [#707](https://github.com/penpot/penpot/issues/707)
|
||||
- Fix problem with middle mouse button press moving the canvas when not moving mouse [#717](https://github.com/penpot/penpot/issues/717)
|
||||
|
||||
### :heart: Community contributions by (Thank you!)
|
||||
|
||||
|
|
|
@ -143,28 +143,3 @@
|
|||
(rx/dedupe))]
|
||||
(rx/subscribe-with ob sub)
|
||||
sub))
|
||||
|
||||
(defn mouse-position-deltas
|
||||
[current]
|
||||
(->> (rx/concat (rx/of current)
|
||||
(rx/sample 10 mouse-position))
|
||||
(rx/buffer 2 1)
|
||||
(rx/map (fn [[old new]]
|
||||
(gpt/subtract new old)))))
|
||||
|
||||
|
||||
(defonce mouse-position-delta
|
||||
(let [sub (rx/behavior-subject nil)
|
||||
ob (->> st/stream
|
||||
(rx/filter pointer-event?)
|
||||
(rx/filter #(= :delta (:source %)))
|
||||
(rx/map :pt))]
|
||||
(rx/subscribe-with ob sub)
|
||||
sub))
|
||||
|
||||
(defonce viewport-scroll
|
||||
(let [sub (rx/behavior-subject nil)
|
||||
sob (->> (rx/filter scroll-event? st/stream)
|
||||
(rx/map :point))]
|
||||
(rx/subscribe-with sob sub)
|
||||
sub))
|
||||
|
|
|
@ -131,18 +131,21 @@
|
|||
(defn- handle-viewport-positioning
|
||||
[viewport-ref]
|
||||
(let [node (mf/ref-val viewport-ref)
|
||||
stoper (rx/filter #(= ::finish-positioning %) st/stream)
|
||||
stoper (rx/filter #(= ::finish-positioning %) st/stream)]
|
||||
|
||||
stream (->> ms/mouse-position-delta
|
||||
(rx/take-until stoper))]
|
||||
(st/emit! dw/start-pan)
|
||||
(rx/subscribe stream
|
||||
(fn [delta]
|
||||
|
||||
(->> st/stream
|
||||
(rx/filter ms/pointer-event?)
|
||||
(rx/filter #(= :delta (:source %)))
|
||||
(rx/map :pt)
|
||||
(rx/take-until stoper)
|
||||
(rx/subs (fn [delta]
|
||||
(let [zoom (gpt/point @refs/selected-zoom)
|
||||
delta (gpt/divide delta zoom)]
|
||||
(st/emit! (dw/update-viewport-position
|
||||
{:x #(- % (:x delta))
|
||||
:y #(- % (:y delta))})))))))
|
||||
:y #(- % (:y delta))}))))))))
|
||||
|
||||
;; --- Viewport
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue