Skip to content

Commit

Permalink
MultiSelect+Tables: fixed an issue where box-select would skip items …
Browse files Browse the repository at this point in the history
…while drag-scrolling in a table with outer borders. (ocornut#7970, ocornut#7821).

See "widgets_multiselect_boxselect_2" test.
  • Loading branch information
ocornut committed Sep 12, 2024
1 parent 6dcb7be commit 4d00bf8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Other changes:
#6223, #6364, #6387, #6567, #6692, #6724, #6939, #6984, #7246, #7270, #7375, #7421, #7434,
#7472, #7581, #7724, #7926, #7937 and probably more..)
- Nav: pressing any keyboard key while holding Alt disable toggling nav layer on Alt release. (#4439)
- MultiSelect+Tables: fixed an issue where box-select would skip items while drag-scrolling
in a table with outer borders. (#7970, #7821).
- InputText: internal refactoring to simplify and optimize the code. The ImWchar buffer has been
removed. Simplifications allowed to implement new optimizations for handling very large text buffers
(e.g. in our testing, handling of a 1 MB text buffer is now 3 times faster in VS2022 Debug build).
Expand Down
7 changes: 6 additions & 1 deletion imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7403,15 +7403,20 @@ static void DebugLogMultiSelectRequests(const char* function, const ImGuiMultiSe

static ImRect CalcScopeRect(ImGuiMultiSelectTempData* ms, ImGuiWindow* window)
{
ImGuiContext& g = *GImGui;
if (ms->Flags & ImGuiMultiSelectFlags_ScopeRect)
{
// Warning: this depends on CursorMaxPos so it means to be called by EndMultiSelect() only
return ImRect(ms->ScopeRectMin, ImMax(window->DC.CursorMaxPos, ms->ScopeRectMin));
}
else
{
// Add inner table decoration (#7821) // FIXME: Why not baking in InnerClipRect?
// When a table, pull HostClipRect, which allows us to predict ClipRect before first row/layout is performed. (#7970)
ImRect scope_rect = window->InnerClipRect;
if (g.CurrentTable != NULL)
scope_rect = g.CurrentTable->HostClipRect;

// Add inner table decoration (#7821) // FIXME: Why not baking in InnerClipRect?
scope_rect.Min = ImMin(scope_rect.Min + ImVec2(window->DecoInnerSizeX1, window->DecoInnerSizeY1), scope_rect.Max);
return scope_rect;
}
Expand Down

0 comments on commit 4d00bf8

Please sign in to comment.