Closed wdanilo closed 10 years ago
What browser are you using? Can you paste the exact output you get from the text box?
I see the same problem on Mac OS 10.6.8 using Safari 5.1.10 and Chrome 32.0.1700.77. Note that it seems to work fine on Firefox 27.0 (ie. the pos value goes up and down).
Here's the full output from Chrome (after moving the mouse wheel forwards and back a few times):
GLFW version is 2.7.7 Window size is 800 600 Left control is released Mouse button 1 is released Mouse position is 0 0 Mouse wheel pos is 0 Time is 0.050000 GL version is 0.0.1 1 processors are available
Moved 0 to 0 0 Moved 0 to 803 356 Moved 0 to 783 359 Moved 0 to 736 361 Moved 0 to 695 361 Moved 0 to 635 361 Moved 0 to 611 361 Moved 0 to 586 361 Moved 0 to 577 361 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0 Mouse wheel has been moved to 0
Our current glfw tests pass on chrome AFAICT, so this must be something not covered. Can you please make a testcase showing the issue?
Not sure what you mean by "make a testcase". Isn't emscripten/tests/glfw.c a suitable test? The above output was created by using that file to build glfw.html and opening it in my Chrome browser. This is on Mac OS 10.6.8 (SnowLeopard) which is quite old I guess, so maybe the bug is in WebKit given that I see the problem in Safari and Chrome but not in Firefox.
If you want a more "real world" test then see this web app I'm currently working on (it's a port of Golly, an open source app for exploring Conway's Game of Life and many other types of cellular automata):
http://golly.sourceforge.net/webapp/golly.html
It's nowhere near finished but you can draw in a pattern and then try to zoom in/out using the mouse wheel. I'd be interested to hear if that works in Chrome/Safari on newer Macs (or in any other browser/platform combinations).
Sorry, I meant, something requiring no user interaction. When I build glfw.c it shows some animation, but for a good testcase for wheel callback the test should create a mousewheel event artificially and show a result about whether things worked or not. That way it's easy to test, and easy to add to the test suite when we fix it.
I've managed to fix my mouse wheel problems. The onMouseWheel function in src/library_glfw.js fails to use event.wheelDelta, which is what the onmousewheel event sets in Chrome and Safari (at least on my Mac). I think these lines:
if (event.detail > 0) {
GLFW.wheelPos++;
}
if (event.detail < 0) {
GLFW.wheelPos--;
}
should be replaced with something like this:
var delta = Math.max(-1, Math.min(1, (event.detail || -event.wheelDelta)));
GLFW.wheelPos += delta;
Works for me in Firefox, Chrome and Safari.
I think we just need to refactor the whole mouse handling code across all backends - I'll do that.
Done, and verified working on the glfw testcase.
Hi! Take a look at emscripten/tests/glfw.c file - after its compiled and runned inside web browser, when you're scrolling with mouse wheel, you're getting information, that such event happened, but the scroll value is always 0.