-
-
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
When using MultiSelect with BoxSelect in a Table with ScrollY and BordersOuter, items sometimes get skipped #7970
Comments
Thanks for the reporting this. The box-select system requires very precise matching of how cliprect clips item logic, and I guess there is a calculation in there will a mismatch due to border size which breaks it. Will investigate. |
Some details:
Specifically caused by adding: if (inner_window->DecoOuterSizeY2 == 0.0f)
table->HostClipRect.Max.y = ImMax(table->HostClipRect.Max.y - TABLE_BORDER_SIZE, table->HostClipRect.Min.y); and changing: table->InnerClipRect.Max.y = (flags & ImGuiTableFlags_NoHostExtendY) ? ImMin(table->InnerClipRect.Max.y, inner_window->WorkRect.Max.y) : inner_window->ClipRect.Max.y; to
So there's what I do, add a dynamic toggle to either of the change: if (g.IO.KeyShift)
table->InnerClipRect.Max.y = (flags & ImGuiTableFlags_NoHostExtendY) ? ImMin(table->InnerClipRect.Max.y, inner_window->WorkRect.Max.y) : inner_window->ClipRect.Max.y; // this problem fixed
else
table->InnerClipRect.Max.y = (flags & ImGuiTableFlags_NoHostExtendY) ? ImMin(table->InnerClipRect.Max.y, inner_window->WorkRect.Max.y) : table->HostClipRect.Max.y; // this problem exists Then I look in Metrics->Tables and Metrics->Tools->Show Rectangles to visualize what values are affected: Commit 864a2bf moved the Max.y of table->HostClipRect, table->InnerClipRect, table->BackgroundClipRect and column's ColumnsClipRect up by 1.0f (from 395 to 394), which in turns affected the ImDrawCmd's ClipRect the same way. That seems correct and desirable to align with the intent of that fix. The problem is that at the time of the call It didn't happen before that fix because before it the value of Max.y didn't change between/after entering the table. My fix b847c41 for #7821 (also your issue) was a bit flawed since it basically aim to "predict" what the ClipRect will be when inside the table. So essentially it is that fix for #7821 which is in fault. Additionally, subtly, this logic means that the value of CalcScopeRect() in BeginMultiSelect() is incorrect while the one in EndMultiSelect() is correct. One possible solution would be to store a |
Pushed a fix 4d00bf8 And a test: ocornut/imgui_test_engine@ec15ef4 |
Thanks for the fix and the detailed explanation! |
Version/Branch of Dear ImGui:
Version 1.91.2 WIP, Branch: master
Back-ends:
imgui_impl_glfw.cpp + imgui_impl_opengl3.cpp
Compiler, OS:
Linux + GCC
Full config/build information:
Details:
My Issue/Question:
Hello! As described in the title, I've noticed that MultiSelect_BoxSelect1d sometimes skips items when the Table has the ScrollY and BordersOuter flags set. The BordersInner flag seems to have no effect either way, probably because it doesn't change the layout of the table like the BordersOuter flag does.
Screenshots/Video:
multi-select-borders-outer-issue.mp4
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: