0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-25 07:58:49 -05:00

🐛 Fixes issue with showing interactions on click

This commit is contained in:
alonso.torres 2021-01-14 12:33:43 +01:00
parent cf4a4b2b25
commit 9ee54d6267

View file

@ -207,6 +207,7 @@
(let [on-click
(fn [event]
(dom/stop-propagation event)
(st/emit! (dcm/close-thread))
(let [mode (get state :interactions-mode)]
(when (= mode :show-on-click)
(st/emit! dv/flash-interactions))))
@ -221,10 +222,6 @@
(st/emit! dv/decrease-zoom)
(st/emit! dv/increase-zoom)))))
on-click
(fn [event]
(st/emit! (dcm/close-thread)))
on-key-down
(fn [event]
(when (kbd/esc? event)
@ -235,8 +232,8 @@
;; bind with passive=false to allow the event to be cancelled
;; https://stackoverflow.com/a/57582286/3219895
(let [key1 (events/listen goog/global "wheel" on-mouse-wheel #js {"passive" false})
key2 (events/listen js/document "keydown" on-key-down)
key3 (events/listen js/document "click" on-click)]
key2 (events/listen js/window "keydown" on-key-down)
key3 (events/listen js/window "click" on-click)]
(fn []
(events/unlistenByKey key1)
(events/unlistenByKey key2)