diff --git a/frontend/src/app/main/streams.cljs b/frontend/src/app/main/streams.cljs index 597f89223..54b633d0e 100644 --- a/frontend/src/app/main/streams.cljs +++ b/frontend/src/app/main/streams.cljs @@ -101,13 +101,24 @@ (rx/subscribe-with ob sub) sub)) + +(defonce window-blur + (->> (rx/from-event js/window "blur") + (rx/share))) + (defonce keyboard-alt (let [sub (rx/behavior-subject nil) - ob (->> st/stream - (rx/filter keyboard-event?) - (rx/map :alt) + ob (->> (rx/merge + (->> st/stream + (rx/filter keyboard-event?) + (rx/map :alt)) + ;; Fix a situation caused by using `ctrl+alt` kind of shortcuts, + ;; that makes keyboard-alt stream registring the key pressed but + ;; on bluring the window (unfocus) the key down is never arrived. + (->> window-blur + (rx/map (constantly false)))) (rx/dedupe))] - (rx/subscribe-with ob sub) + (rx/subscribe-with ob sub) sub)) (defn mouse-position-deltas diff --git a/frontend/src/app/main/ui/workspace/shapes.cljs b/frontend/src/app/main/ui/workspace/shapes.cljs index 2652591d4..bb6e9603f 100644 --- a/frontend/src/app/main/ui/workspace/shapes.cljs +++ b/frontend/src/app/main/ui/workspace/shapes.cljs @@ -86,7 +86,6 @@ (geom/translate-to-frame frame)) opts #js {:shape shape :frame frame} - alt? (mf/use-state false) on-mouse-enter (use-mouse-enter shape) on-mouse-leave (use-mouse-leave shape)