Normalize pixel-mode wheel events to correct scroll distance scaling on Web. - #3262
Normalize pixel-mode wheel events to correct scroll distance scaling on Web.#3262Konstantin (terrakok) wants to merge 3 commits into
Conversation
05d3700 to
32a0ec2
Compare
| * on the same ~1-per-notch scale as other targets. | ||
| */ | ||
| @InternalComposeUiApi | ||
| const val WebWheelDeltaPerNotch = 120.0 |
There was a problem hiding this comment.
Do you have 120 on one tick in https://jsfiddle.net/64p5r459/2/?
Can you describe on which OS with which device you tested?
I have 100 on Windows + real mouse, 4 with acceleration on macOs + real mouse
There was a problem hiding this comment.
Also I noticed if you change the page scale, the value changes
There was a problem hiding this comment.
The system scale doesn't affect it
There was a problem hiding this comment.
120 is a constant for a "standard wheel click"
https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-mousewheel
There was a problem hiding this comment.
it shouldn't be exactly 120. this is the divider
There was a problem hiding this comment.
I found a good enough value which works well on my macos. Could you check it on your windows?
There was a problem hiding this comment.
(added a demo case for that)
There was a problem hiding this comment.
I checked, it doesn't work good on Windows, one tick is 10.0, but it should be 1.0. I.e. we should divide by 100, not by 10.
As a note, mouse wheel doesn't work good on macOs in native apps too. What do you mean by works well?
There was a problem hiding this comment.
As a note, mouse wheel doesn't work good on macOs in native apps too. What do you mean by works well?
The first tick on macOs is 0.1 on my macOs machine on Desktop. As I wrote in the issue, we considered this "by design" as an macOs quirk for a wheel. It accelerates to greater values if you scroll fast.
The main issue is that it is 0.04 on Web if we divide by 100. I am not sure why is it different from Swing. We probably should understand that to reason about it objectively (by reading Chromium/JDK sources)
There was a problem hiding this comment.
The delta adjusted to be good on every platform. We manually checked it on every platform and it seems OK
32a0ec2 to
af988de
Compare
af988de to
eeb9a75
Compare
| * on the same ~1-per-notch scale as other targets. | ||
| */ | ||
| @InternalComposeUiApi | ||
| const val WebWheelDeltaPerNotch = 120.0 |
There was a problem hiding this comment.
I checked, it doesn't work good on Windows, one tick is 10.0, but it should be 1.0. I.e. we should divide by 100, not by 10.
As a note, mouse wheel doesn't work good on macOs in native apps too. What do you mean by works well?
Igor Demin (igordmn)
left a comment
There was a problem hiding this comment.
Let's not merge until we resolve the comment
Fixes https://youtrack.jetbrains.com/issue/CMP-10524
Release Notes
Fixes - Web