mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
Fix transfer-state bug on mouse mixin.
This commit is contained in:
parent
79e3f95fb8
commit
5b6fe0c94b
1 changed files with 12 additions and 4 deletions
|
@ -85,19 +85,27 @@
|
|||
y (.-clientY event)]
|
||||
(rx/push! mouse-bus [(- x offset-x)
|
||||
(- y offset-y)])))]
|
||||
(->> (events/listen js/document EventType.MOUSEMOVE on-mousemove)
|
||||
(assoc own ::eventkey))))
|
||||
(let [key (events/listen js/document EventType.MOUSEMOVE on-mousemove)]
|
||||
(js/console.log "mouse-mixin-did-mount" key)
|
||||
(assoc own ::eventkey key))))
|
||||
|
||||
(defn- mouse-mixin-will-unmount
|
||||
[own]
|
||||
(println "mouse-mixin-will-unmount")
|
||||
(let [key (::eventkey own)]
|
||||
(js/console.log "mouse-mixin-will-unmount" key)
|
||||
(events/unlistenByKey key)
|
||||
(dissoc own ::eventkey)))
|
||||
|
||||
(defn- mouse-mixin-transfer-state
|
||||
[old-own own]
|
||||
(let [key (::eventkey old-own)]
|
||||
(js/console.log "mouse-mixin-transfer-state" key)
|
||||
(assoc own ::eventkey key)))
|
||||
|
||||
(def ^:static mouse-mixin
|
||||
{:did-mount mouse-mixin-did-mount
|
||||
:will-unmount mouse-mixin-will-unmount})
|
||||
:will-unmount mouse-mixin-will-unmount
|
||||
:transfer-state mouse-mixin-transfer-state})
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Constants
|
||||
|
|
Loading…
Add table
Reference in a new issue