mirror of
https://github.com/penpot/penpot.git
synced 2025-03-18 10:41:29 -05:00
Minor change on mouse mixin.
This commit is contained in:
parent
3e336112ca
commit
79e3f95fb8
2 changed files with 11 additions and 31 deletions
|
@ -76,20 +76,17 @@
|
|||
|
||||
(defn- mouse-mixin-did-mount
|
||||
[own]
|
||||
(println "mouse-mixin-did-mount")
|
||||
(let [canvas (util/get-ref-dom own "canvas")
|
||||
on-mousemove (fn [event]
|
||||
(let [brect (.getBoundingClientRect canvas)
|
||||
offset-x (.-left brect)
|
||||
offset-y (.-top brect)
|
||||
x (.-clientX event)
|
||||
y (.-clientY event)]
|
||||
(rx/push! mouse-bus [(- x offset-x)
|
||||
(- y offset-y)])))
|
||||
key (events/listen js/document
|
||||
EventType.MOUSEMOVE
|
||||
on-mousemove)]
|
||||
(assoc own ::eventkey key)))
|
||||
(letfn [(on-mousemove [event]
|
||||
(let [canvas (util/get-ref-dom own "canvas")
|
||||
brect (.getBoundingClientRect canvas)
|
||||
offset-x (.-left brect)
|
||||
offset-y (.-top brect)
|
||||
x (.-clientX event)
|
||||
y (.-clientY event)]
|
||||
(rx/push! mouse-bus [(- x offset-x)
|
||||
(- y offset-y)])))]
|
||||
(->> (events/listen js/document EventType.MOUSEMOVE on-mousemove)
|
||||
(assoc own ::eventkey))))
|
||||
|
||||
(defn- mouse-mixin-will-unmount
|
||||
[own]
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
:name "background"
|
||||
:mixins [mx/static]}))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Grid
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -123,22 +122,6 @@
|
|||
;; Canvas
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; (rum/defc canvas < rum/reactive
|
||||
;; shapes-push-mixin
|
||||
;; (mx/cmds-mixin
|
||||
;; [::draw draw! (fn [[conn page] shape]
|
||||
;; (actions/draw-shape conn page shape))]
|
||||
|
||||
;; [::move move! (fn [[conn] selections]
|
||||
;; (actions/update-shapes conn selections))])
|
||||
;; [conn
|
||||
;; page
|
||||
;; shapes
|
||||
;; {:keys [viewport-height
|
||||
;; viewport-width
|
||||
;; document-start-x
|
||||
;; document-start-y]}]
|
||||
|
||||
(defn canvas-render
|
||||
[]
|
||||
(let [page (rum/react wb/page-state)
|
||||
|
|
Loading…
Add table
Reference in a new issue