mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 16:35:29 +00:00
emscripten: Decrease vertical scroll speed by using deltaMode
Reference issue #4623.
This commit is contained in:
parent
6657cbce8d
commit
94c1276a5f
|
@ -409,7 +409,22 @@ static EM_BOOL
|
|||
Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData)
|
||||
{
|
||||
SDL_WindowData *window_data = userData;
|
||||
SDL_SendMouseWheel(window_data->window, 0, (float)wheelEvent->deltaX, (float)-wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL);
|
||||
|
||||
float deltaY = wheelEvent->deltaY;
|
||||
|
||||
switch (wheelEvent->deltaMode) {
|
||||
case DOM_DELTA_PIXEL:
|
||||
deltaY /= 100; /* 100 pixels make up a step */
|
||||
break;
|
||||
case DOM_DELTA_LINE:
|
||||
deltaY /= 3; /* 3 lines make up a step */
|
||||
break;
|
||||
case DOM_DELTA_PAGE:
|
||||
deltaY *= 80; /* A page makes up 80 steps */
|
||||
break;
|
||||
}
|
||||
|
||||
SDL_SendMouseWheel(window_data->window, 0, (float)wheelEvent->deltaX, -deltaY, SDL_MOUSEWHEEL_NORMAL);
|
||||
return SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue