-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
ListClipper jumps back when scrolls down to bottom #7798
Comments
This looks like a single precision floating point issue. At least that's part of it, the jumps in your video look a bit too big to be that alone. It is important for this to know how floating point types work. 32 bit floats can represent integer values exactly up to 16777216, after that they increment in steps of 2 (for a while, then 4 and so on). With 586k rows of 31 pixels height each you are exceeding this limit. If you scroll down far enough, the very first row that the list clipper asks for cannot be measured exactly due to this imprecision. You can circumvent this part of the problem if you give an explicit item height to the clipper in advance. It might also help if you can increase the row height slightly to 32 (a power of 2). @ocornut: small suggestion, if the list clipper has a height (measured or explicitly given), it could assert on each subsequent |
The clipper has mechanism to deal a little better with precision loss but it's not perfect. You may use Tools->Debug Log->Clipper to logs clipper step, by Shift+clicking on Generally speaking, although in principle I agree we should improve this (and I eventually aim to), it's not actually meaningfully useful to browse a 500k list without filter. There's however another issue with scrollbar themselves (#3609?). Please note that since 1.90.8 we changed scrollbar logic to make clicks outside the scroll grab to scroll by a single page. This may or not also work better in your situation. |
Giving an explicit height to the clipper helps solve this issue. Thanks for the explanation and help! I will now close this issue as it's already solved. |
Version/Branch of Dear ImGui:
Version 1.90, Branch: master
Back-ends:
imgui_impl_dx11.cpp + imgui_impl_win32.cpp
Compiler, OS:
MSVC 2022
Full config/build information:
No response
Details:
I have a vector of items (roughly 586k) and use clipper to display that. When I try to scroll down to the bottom (until some point) it just jumps back up a lot. Sorry I have no idea how to really describe the problem, so a video might help to tell.
Screenshots/Video:
Recording.2024-07-16.145021.online-video-cutter.com.mp4
Example code:
The text was updated successfully, but these errors were encountered: