-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Feature Smooth Scrolling #7348
base: master
Are you sure you want to change the base?
Feature Smooth Scrolling #7348
Conversation
… of smoothness (by default disabled).Included example in demo New feature: Smooth Scrolling
Hello,
I don't have many concrete actions to suggest, but I believe this may need further thought. |
Hi Omar! Smoothing logic is frame dependent yes. I added that way to avoid add more variables into the window structure. [Frame dependent] [Mouse with high resolution / smoother values] [API] If you prefer to keep the system intact if the style var is 1.0f i can modify the PR for that. Just ask :) |
Then it's incorrect/buggy! Of course things needs to behave more or less the same no matter the framerate, some users are running 15 hz some are running 240 hz or unthrolled.
This is not what I meant. When you do an API call, e.g. |
Got it. Requirements: It should be time bounded. Functions: Let me take a look into the new flags / the req list. You can forget / close this PR but I'll not delete it since maybe is useful for someone. |
Feature: Smooth scrolling
This capture was with smooth at 20.0f which is so higher but just to demonstrate how it works.
ImGuiStyleVar_ScrollSmooth float added.
Default value: 1.0 = means no smooth scrolling
Values over 1.0 = starts to smooth the scroll.
Code in the demo added. Same example as the verticaller scrollers but with smooth activated.
MouseWheel and others like SetScrollHereY continue setting ScrollTarget
SetScrollX/SetScrollY/GetScrollX/GetScrollY and scroll bar widget works against a new value in ImWindow "ScrollExpected"
Function CalcNextScrollFromScrollTargetAndClamp now applies the smooth scrolling no matter if it comes from "ScrollExpected" or "ScrollTarget".
The formula is pretty simple. Is frame bounded and no time bounded but as counter part it is only one new style var and one new var in ImWindow, nothing else. Simple and small change.