mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02: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)]
|
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)
|
(let [key (events/listen js/document EventType.MOUSEMOVE on-mousemove)]
|
||||||
(assoc own ::eventkey))))
|
(js/console.log "mouse-mixin-did-mount" key)
|
||||||
|
(assoc own ::eventkey key))))
|
||||||
|
|
||||||
(defn- mouse-mixin-will-unmount
|
(defn- mouse-mixin-will-unmount
|
||||||
[own]
|
[own]
|
||||||
(println "mouse-mixin-will-unmount")
|
|
||||||
(let [key (::eventkey own)]
|
(let [key (::eventkey own)]
|
||||||
|
(js/console.log "mouse-mixin-will-unmount" key)
|
||||||
(events/unlistenByKey key)
|
(events/unlistenByKey key)
|
||||||
(dissoc own ::eventkey)))
|
(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
|
(def ^:static mouse-mixin
|
||||||
{:did-mount mouse-mixin-did-mount
|
{: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
|
;; Constants
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue