Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
madebr opened this issue Aug 2, 2024 · 4 comments
Closed

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

madebr opened this issue Aug 2, 2024 · 4 comments
Assignees
Milestone

Comments

@madebr
Copy link
Contributor

madebr commented Aug 2, 2024

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?

@icculus icculus self-assigned this Aug 2, 2024
@slouken
Copy link
Collaborator

slouken commented Oct 6, 2024

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 slouken added this to the 3.2.0 milestone Oct 6, 2024
@icculus
Copy link
Collaborator

icculus commented Oct 6, 2024

I'll take a look at this.

icculus added a commit that referenced this issue Oct 24, 2024
icculus added a commit that referenced this issue Oct 24, 2024
@icculus
Copy link
Collaborator

icculus commented Oct 24, 2024

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).

ocornut added a commit to ocornut/imgui that referenced this issue Oct 24, 2024
@ocornut
Copy link

ocornut commented Oct 24, 2024

Thank you Sam, pushed ocornut/imgui@06092a9 for Dear ImGui.

klukaszek pushed a commit to klukaszek/SDL that referenced this issue Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants