mirror of
https://github.com/penpot/penpot.git
synced 2026-09-11 06:28:47 +00:00
Add absolute mouse position stream.
This commit is contained in:
parent
0b5de2d2b8
commit
c3ddf2ad32
@ -89,7 +89,12 @@
|
|||||||
(defonce mouse-s
|
(defonce mouse-s
|
||||||
(->> mouse-b
|
(->> mouse-b
|
||||||
(rx/filter #(= (:id %) (:id @page-l)))
|
(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
|
(defn- coords-delta
|
||||||
[[old new]]
|
[[old new]]
|
||||||
|
|||||||
@ -112,8 +112,9 @@
|
|||||||
(let [x (.-clientX event)
|
(let [x (.-clientX event)
|
||||||
y (.-clientY event)
|
y (.-clientY event)
|
||||||
event {:id (:id page)
|
event {:id (:id page)
|
||||||
:coords [(- x offset-x)
|
:window-coords [x y]
|
||||||
(- y offset-y)]}]
|
:canvas-coords [(- x offset-x)
|
||||||
|
(- y offset-y)]}]
|
||||||
(rx/push! wb/mouse-b event)))]
|
(rx/push! wb/mouse-b event)))]
|
||||||
(let [[page] (:rum/props own)
|
(let [[page] (:rum/props own)
|
||||||
canvas (mx/get-ref-dom own (str "canvas" (:id page)))
|
canvas (mx/get-ref-dom own (str "canvas" (:id page)))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user