Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Browser inconsistencies in scrollY because deltaMode not used calculate wheelEvent deltas #149

Closed
thomasballinger opened this issue Aug 6, 2021 · 5 comments · Fixed by #154

Comments

@thomasballinger
Copy link
Contributor

Part of the solution to emscripten-core/emscripten#6283 appears to be to use wheelEvent->deltaMode in Emscripten_HandleWheel to calculate the deltaY.

The conversions used in a fix for libraries using library_browser.js instead of library_html5.js are:

case 0:
  // DOM_DELTA_PIXEL: 100 pixels make up a step
  delta /= 100;
  break;
case 1:
  // DOM_DELTA_LINE: 3 lines make up a step
  delta /= 3;
  break;
case 2:
  // DOM_DELTA_PAGE: A page makes up 80 steps
  delta *= 80;
  break;

Does adding this logic here make sense, should I prep a PR?

@kripken
Copy link
Member

kripken commented Aug 16, 2021

I think that makes sense, yes - PR would be great.

Testing might be the hard part, but at least we can test it manually.

@thomasballinger
Copy link
Contributor Author

#154 has been approved, are there any next steps I can help with here?

@kripken
Copy link
Member

kripken commented Oct 26, 2021

Next steps after landing that PR are probably to update the port in emscripten to the commit after that PR landed.

@andrewevstyukhin
Copy link

Hi,
I wonder the reasons of the existing solution's asymmetry - why divide deltaY but not both (deltaX, deltaY) ?

https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent

WheelEvent.deltaMode
Returns an unsigned long representing the unit of the delta* values' scroll amount.

@thomasballinger
Copy link
Contributor Author

No reason not to for me, this patch fixes the behavior of scrolling I didn't like which was vertical. Matching this for x sounds like a good idea if horizontal scroll sensitivity also feels bad.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants