aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authormrmr19932014-12-14 11:51:42 +0000
committermrmr19932014-12-14 11:51:42 +0000
commitaa190905bff04bd83438960779ce912b048b1f5f (patch)
tree9bcef821b263319bbfd0732a629f66dc2ccd14e8 /content_scripts
parent9b9cee761f4c718f08dec92c46027a7effe39991 (diff)
downloadvimium-aa190905bff04bd83438960779ce912b048b1f5f.tar.bz2
Use a boolean to track whether we are scrolling in CursorHider
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/vimium_frontend.coffee14
1 files changed, 7 insertions, 7 deletions
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 = """