From aa190905bff04bd83438960779ce912b048b1f5f Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sun, 14 Dec 2014 11:51:42 +0000 Subject: Use a boolean to track whether we are scrolling in CursorHider --- content_scripts/vimium_frontend.coffee | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 23e320c0..30d76523 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -1073,21 +1073,21 @@ CursorHider = # Hides the cursor when the browser scrolls, and prevent mouse from hovering while invisible # cursorHideStyle: null + isScrolling: false showCursor: -> @cursorHideStyle.remove() hideCursor: -> document.head.appendChild @cursorHideStyle unless @cursorHideStyle.parentElement - onMouseMove: (event) -> CursorHider.showCursor() + onMouseMove: (event) -> + if CursorHider.isScrolling # This event was caused by scrolling, don't show the cursor. + CursorHider.isScrolling = false + else + CursorHider.showCursor() onScroll: (event) -> + CursorHider.isScrolling = true CursorHider.hideCursor() - # Ignore next mousemove, caused by the scrolling, so the mouse doesn't re-show straight away. - window.removeEventListener "mousemove", CursorHider.onMouseMove - window.addEventListener "mousemove", -> - window.addEventListener "mousemove", CursorHider.onMouseMove - window.removeEventListener "mousemove", arguments.callee - init: -> @cursorHideStyle = document.createElement("style") @cursorHideStyle.innerHTML = """ -- cgit v1.2.3