-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Wrong row returned in TableGetHoveredRow() #7350
Comments
Thank you for your report. I agree with your reasoning and correction and applied it as 725f919 (I gave you authorship of that commit).
Correct. Presently due to how we implement the draw channels I have little hope to introduce frozen rows at the bottom of a table without larger changes. But I think there is a rather acceptable workaround: to submit another table instance with just that row, and no spacing between both table instance. Anecdotally, the "Assets Browser" demo in range-select also use a table for its header row only (without other rows). Keeping this open as I'd like to write a test for it too. |
Thank you. I (currently) don't need frozen rows at the bottom, I just thought to mention them since this fix would then break hovering in those if they ever became a thing. If I ever do need them, synced table instances without a gap between them will do fine. |
Added a simple test for it : |
Version/Branch of Dear ImGui:
Version 1.90.4 WIP (19032), Branch: master/docking
Back-ends:
imgui_impl_win32.cpp + imgui_impl_dx11/dx12.cpp
Compiler, OS:
Windows 10/11 + MSVC 2019/2022
Full config/build information:
Details:
I know it is an internal API, but currently
TableGetHoveredRow()
has situations in which it doesn't return the row that was actually hovered in the last frame. In the screenshots you can see that the header row (row 0) is hovered (not seen: in the bottom half of it). When scrolled to the top, the hovered row is reported correctly. When scrolled so that the first row (submitted for the list clipper) is completely hidden by the frozen header (but still within the tables clip rect), it is still hovered through the header row instead of the header row. Hovering the bottom of the header row where a partially scrolled out row would otherwise be visible, that row will be reported as hovered instead. Table setups with multiple frozen rows and no list clipper will have it worse.The source of problem is here in
imgui_tables.cpp
:If multiple rows operlap the mouse cursor, the last submitted one of those will get marked as hovered by this code. Adding
table_instance->HoveredRowNext < 0
to the list of conditions will change this to the first submitted row, that should already be a proper fix. At least as long as frozen rows at the bottom of a table are not a thing, rows that are submitted first will always hide overlapping rows that are submitted later.Screenshots/Video:
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: