-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Tables: Angled headers: fix border position, hit box, and overflowing contents in some cases #7416
Conversation
…leHeadersRow stops being called
…ngleHeadersRow stops being called. (#7416)
Thank you Christian for the quality PR and explanations. I've merged all three commits now. About the clipper rounding issue, mapping the rowHeight to a slider e.g. static void ImGuiListClipper_SeekCursorForItem(ImGuiListClipper* clipper, int item_n)
{
// StartPosY starts from ItemsFrozen hence the subtraction
// Perform the add and multiply with double to allow seeking through larger ranges
ImGuiListClipperData* data = (ImGuiListClipperData*)clipper->TempData;
float pos_y = (float)((double)clipper->StartPosY + data->LossynessOffset + (double)(item_n - data->ItemsFrozen) * clipper->ItemsHeight);
ImGuiListClipper_SeekCursorAndSetupPrevLine(pos_y, clipper->ItemsHeight);
} Where the rounding is not taken into account. I have a bit of an issue right now changing that function because I think support for non-float should probably indeed be done elsewhere (e.g. in ItemSize ItemAdd functions), so I'll work on that later. Thanks a lot! (PS: I have to cherry-pick and amend with changelog etc, in vast majority of PR i don't expect user to fill in changelog as it would conflicts or be misplaced if not merged right away, so that's normal), but as I result actual PR is not marked as merged but all commits are rightly attributed to you) |
…ngleHeadersRow stops being called. (ocornut#7416)
Bug 1: Border hit box extends beyond non-scrollable tables.
table->AngledHeadersHeight
was added to the top and bottom coordinates instead of just the top.Bug 2: Borders remain offset after the user stops calling
TableAngleHeadersRow
.table->AngledHeadersHeight
was not reset.Bug 3: Table contents overflow the table's outer box when an angled header is used in combination with a list clipper. Angled header's row height could have a fractional part, while this line in
ItemSize
truncateswindow->DC.CursorMaxPos.y
, leading to accumulating error at each subsequent row.The root issue remains if the user does eg.
ImGui::TableNextRow(0, 78.396423);
, but this fixes the case withTableAngleHeadersRow
.This also improves rendering quality because header row's border lines are a bit fuzzy with a fractional part.
Duplication code