Then above draws black text on a white background which lists the value of a counter and the mouse's coordinates relative to the canvas. When the mouse wheel is scrolled, counter gets incremented or decremented depending on the scroll direction.
In Chrome, counter will not change if the mouse's coordinates fall outside of (0, 0) - (canvas width, canvas height). It works as expected in Firefox, however.
Attaching the wheel event listener to document rather than the canvas would fix this issue, but would prevent the rest of the document from scrolling, making that solution less than ideal.
If the mouse is not focused on the canvas, even if the mouse is locked to the canvas,
Momo.getMouseWheel()
will not work in Chrome.Observe the following:
Then above draws black text on a white background which lists the value of a counter and the mouse's coordinates relative to the canvas. When the mouse wheel is scrolled,
counter
gets incremented or decremented depending on the scroll direction.In Chrome,
counter
will not change if the mouse's coordinates fall outside of (0, 0) - (canvas width, canvas height). It works as expected in Firefox, however.