mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02: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
|
(defn- mouse-mixin-did-mount
|
||||||
[own]
|
[own]
|
||||||
(println "mouse-mixin-did-mount")
|
(letfn [(on-mousemove [event]
|
||||||
(let [canvas (util/get-ref-dom own "canvas")
|
(let [canvas (util/get-ref-dom own "canvas")
|
||||||
on-mousemove (fn [event]
|
brect (.getBoundingClientRect canvas)
|
||||||
(let [brect (.getBoundingClientRect canvas)
|
offset-x (.-left brect)
|
||||||
offset-x (.-left brect)
|
offset-y (.-top brect)
|
||||||
offset-y (.-top brect)
|
x (.-clientX event)
|
||||||
x (.-clientX event)
|
y (.-clientY event)]
|
||||||
y (.-clientY event)]
|
(rx/push! mouse-bus [(- x offset-x)
|
||||||
(rx/push! mouse-bus [(- x offset-x)
|
(- y offset-y)])))]
|
||||||
(- y offset-y)])))
|
(->> (events/listen js/document EventType.MOUSEMOVE on-mousemove)
|
||||||
key (events/listen js/document
|
(assoc own ::eventkey))))
|
||||||
EventType.MOUSEMOVE
|
|
||||||
on-mousemove)]
|
|
||||||
(assoc own ::eventkey key)))
|
|
||||||
|
|
||||||
(defn- mouse-mixin-will-unmount
|
(defn- mouse-mixin-will-unmount
|
||||||
[own]
|
[own]
|
||||||
|
|
|
@ -43,7 +43,6 @@
|
||||||
:name "background"
|
:name "background"
|
||||||
:mixins [mx/static]}))
|
:mixins [mx/static]}))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Grid
|
;; Grid
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -123,22 +122,6 @@
|
||||||
;; Canvas
|
;; 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
|
(defn canvas-render
|
||||||
[]
|
[]
|
||||||
(let [page (rum/react wb/page-state)
|
(let [page (rum/react wb/page-state)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue