SDL icon indicating copy to clipboard operation
SDL copied to clipboard

On emscripten, is delta-x of mousewheel event scaled correctly?

Open madebr opened this issue 1 year ago • 2 comments

Whilst looking at imgui's SDL support code, I noticed it scales the wheel delta x of a mouse wheel event by around 100. link to code

Is the need for this extra scale factor expected?

madebr avatar Aug 02 '24 10:08 madebr

We probably need to divide the values coming in by 120. Take a look at the WHEEL_DELTA code in SDL_windowsevents.c for reference.

slouken avatar Oct 06 '24 20:10 slouken

I'll take a look at this.

icculus avatar Oct 06 '24 20:10 icculus

Actually it turns out 100 is the right value for the browser (rather, it's one of three possible units of measurement, and we handle them all).

But we were only adjusting the Y value and not the X value, which is why Dear Imgui has a hardcoded / 100 in there for X.

CC @ocornut: that extra division on Emscripten can be removed now for SDL3 (and the fix has been applied to SDL2, too, and will be in the 2.30.9 release).

icculus avatar Oct 24 '24 03:10 icculus

Thank you Sam, pushed https://github.com/ocornut/imgui/commit/06092a9756b5476ad0b36d6f980fe904a87418da for Dear ImGui.

ocornut avatar Oct 24 '24 12:10 ocornut