Closed NikoUY closed 2 years ago
The idea is that the application can determine what the current position is as this can be application specific. You can implement it something like this
...
let mut scroll_pos = (0, 0);
while window.open(...) {
window.get_scroll_wheel().map(|scroll| {
// user has now moved the scroll wheel/trackpad
scroll_pos += scroll;
});
}
How would I know when the user stopped scrolling?, the value never resets to 0 and it's a constant depending on the direction and the speed of the scroll wheel (1 is slow and 4 is fast), I could check if the value changed but since it never resets to 0 I would only be able to know if the user changed direction but I won't be able to tell if the user scrolled more than once on the same direction or if the user stopped scrolling.
I see. I have only tested this with trackpad where it works correct, I will have to check how it differs with mouse wheel.
So the problem seems to be that the callback code for mouse wheel gets called all the time since the first time the user has done scrolling even when no scrolling is active. Not really sure why that is the case
Seems to be a macOS
only problem. Works correct on Linux and Windows
I think I have found the problem. Looking into a fix
I have pushed a fix now. Give the git version a try and see if it solves your issue. If it does I will release a new version
Yep, that works! 😄, thanks for fixing it!
Great! Thanks for the report. I will release a new version in a bit :)
Version 0.20 has now been released with this fix
I'm not sure how it works on other platforms but on MacOS you only get the delta, it's pretty useless without a way to get notified when someone uses the scroll wheel or a way to check for changes.
You can add the deltas to the current position here, that way you can check if the value changed.