Willy-JL / F95Checker

GNU General Public License v3.0
123 stars 20 forks source link

Quickly reverse direction when smooth scrolling #139

Closed harikattar closed 6 months ago

harikattar commented 9 months ago

First affects everybody: if you're at the top or bottom of the page, it will keep imparting scroll energy that takes time to expend. This makes the UI feel laggy and unresponsive if you've spun the scrollwheel to the top or bottom and want to start moving the other direction and it's still trying to scroll past the page.

Second affects people with enough games that they have pages of scroll. If you've scrolled to the game you're looking for it will keep coasting on past, and attempting to scroll back up doesn't work until you've imparted enough energy in the opposite direction. This can lead to overshoot.

FaceCrap commented 8 months ago

Forgive me if I see this wrong, but if you only test if scroll_energy * imgui.io.mouse_wheel produces a negative result, than you don't actually detect a change in scroll direction. You're only detecting scroll movements in that particular direction, regardless whether the previous direction was the same.

You're assuming here that the previous direction gave a positive result in that calculation.

Effectively, what you're doing here is dampening the direction that produces a negative result. Because if you are already scrolling in that direction, your scroll_energy gets reset to 0.0 instead of allowing it to build up.

harikattar commented 7 months ago

Forgive me if I see this wrong, but if you only test if scroll_energy * imgui.io.mouse_wheel produces a negative result, than you don't actually detect a change in scroll direction. You're only detecting scroll movements in that particular direction, regardless whether the previous direction was the same.

You're assuming here that the previous direction gave a positive result in that calculation.

Effectively, what you're doing here is dampening the direction that produces a negative result. Because if you are already scrolling in that direction, your scroll_energy gets reset to 0.0 instead of allowing it to build up.

No, it works like this: -1 -1 = 1 1 -1 = -1 1 1 = 1 -1 1 = -1

the value is only negative if the signs are opposite - your input is the opposite of the scroll energy. Try it for yourself.

Willy-JL commented 6 months ago

indeed feels better, i never noticed it because i dont have a huge smoothing amount active (8, lower smoothens more) and so it would invert direction rather quickly. but with more smoothing, this is a night and day difference