emscripten-core / emscripten-core/emscripten

Mouse wheel direction wrong for glut and glfw

Open
#3,171 5 comments 3 reactions 0 assignees View on GitHub
GLFW GLUT wontfix
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

The mouse wheel direction is upside down for
glfw3 with every browser I tested
and
glut with chromium.
sdl2 appears to be correct.

Test results for scrolling down and up once with code:
https://gist.github.com/00v1/0ddc40dec5d395456193#file-mousewheel-txt

```
Xubuntu Desktop

glfw3 down -1.000000
glfw3 up 1.00000

glut down button = 4, state = 0
glut down button = 4, state = 1
glut up button = 3, state = 0
glut up button = 3, state = 1

sdl2 down -1
sdl2 up 1

Linux Firefox

glfw3 up 3.000000 // wrong direction
glfw3 down -3.000000 // wrong direction

glut down button = 4, state = 0
// missing state = 1
glut up button = 3, state = 0
// missing state = 1

sdl2 down -3
sdl2 up 3

Linux Chromium

glfw3 up 53.000000 // wrong direction
glfw3 down -53.000000 // wrong direction

glut up button = 3, state = 0 // wrong direction
// missing state = 1
glut down button = 4, state = 0 // wrong direction
// missing state = 1

sdl2 down -53
sdl2 up 53

Windows Firefox // Same as on Linux

glfw3 up 3.000000
glfw3 down -3.000000

glut down button = 4, state = 0
glut up button = 3, state = 0

sdl2 down -3
sdl2 up 3

Windows Chrome // Same as on Linux, different scaling

glfw3 up 100.000000
glfw3 down -100.000000

glut up button = 3, state = 0
glut down button = 4, state = 0

sdl2 down -100
sdl2 up 100

Windows Opera // Same as Chrome

glfw3 up 100.000000
glfw3 down -100.000000

glut up button = 3, state = 0
glut down button = 4, state = 0

sdl2 down -100
sdl2 up 100

```

Compile with

```
emcc glfw3.cpp -o glfw3.html -s USE_GLFW=3
emcc glut.cpp -o glut.html
emcc sdl2.cpp -o sdl2.html -s USE_SDL=2
```

Relevant function:
https://github.com/kripken/emscripten/search?utf8=%E2%9C%93&q=getMouseWheelDelta

To avoid confusion:
"Down" is when the upper side of the mouse wheel travels towards you, or when you scroll "down" a website.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.