mirror of
https://github.com/penpot/penpot.git
synced 2025-01-10 00:40:30 -05:00
Add absolute mouse position stream.
This commit is contained in:
parent
0b5de2d2b8
commit
c3ddf2ad32
2 changed files with 9 additions and 3 deletions
|
@ -89,7 +89,12 @@
|
|||
(defonce mouse-s
|
||||
(->> mouse-b
|
||||
(rx/filter #(= (:id %) (:id @page-l)))
|
||||
(rx/map :coords)))
|
||||
(rx/map :canvas-coords)))
|
||||
|
||||
(defonce mouse-absolute-s
|
||||
(->> mouse-b
|
||||
(rx/filter #(= (:id %) (:id @page-l)))
|
||||
(rx/map :window-coords)))
|
||||
|
||||
(defn- coords-delta
|
||||
[[old new]]
|
||||
|
|
|
@ -112,7 +112,8 @@
|
|||
(let [x (.-clientX event)
|
||||
y (.-clientY event)
|
||||
event {:id (:id page)
|
||||
:coords [(- x offset-x)
|
||||
:window-coords [x y]
|
||||
:canvas-coords [(- x offset-x)
|
||||
(- y offset-y)]}]
|
||||
(rx/push! wb/mouse-b event)))]
|
||||
(let [[page] (:rum/props own)
|
||||
|
|
Loading…
Reference in a new issue