mirror of
https://github.com/ocornut/imgui.git
synced 2026-05-08 23:02:21 +00:00
MultiSelect: Box-Select + Tables: Amend ac88294. fix usage of box-selection columns with items straying out of columns. (#7994, #2221)
This commit is contained in:
@@ -8359,12 +8359,16 @@ void ImGui::MultiSelectItemFooter(ImGuiID id, bool* p_selected, bool* p_pressed)
|
||||
if (ImGuiBoxSelectState* bs = GetBoxSelectState(ms->BoxSelectId))
|
||||
{
|
||||
ImRect item_rect = g.LastItemData.Rect;
|
||||
if (!window->DC.NavIsScrollPushableX)
|
||||
{
|
||||
const ImRect& clip_rect = (g.LastItemData.StatusFlags & ImGuiItemStatusFlags_HasClipRect) ? g.LastItemData.ClipRect : window->ClipRect;
|
||||
item_rect.Min.x = ImMax(item_rect.Min.x, clip_rect.Min.x);
|
||||
item_rect.Max.x = ImMin(item_rect.Max.x, clip_rect.Max.x);
|
||||
}
|
||||
if (!window->DC.NavIsScrollPushableX) // FIXME: Rename to be more generic.
|
||||
if (ImGuiTable* table = g.CurrentTable)
|
||||
if (table->CurrentColumn != -1)
|
||||
{
|
||||
// FIXME: We cannot use current ClipRect as it includes HostClipRect.
|
||||
// A more generic version would be nice, but window->WorkRect.Min/Max exclude CellPadding. (#7994)
|
||||
ImGuiTableColumn* column = &table->Columns[table->CurrentColumn];
|
||||
item_rect.Min.x = ImMax(item_rect.Min.x, column->MinX);
|
||||
item_rect.Max.x = ImMin(item_rect.Max.x, column->MaxX);
|
||||
}
|
||||
const bool rect_overlap_curr = bs->BoxSelectRectCurr.Overlaps(item_rect);
|
||||
const bool rect_overlap_prev = bs->BoxSelectRectPrev.Overlaps(item_rect);
|
||||
if ((rect_overlap_curr && !rect_overlap_prev && !selected) || (rect_overlap_prev && !rect_overlap_curr))
|
||||
|
||||
Reference in New Issue
Block a user