MultiSelect: Simplified ImGuiSelectionBasicStorage by using a single SetItemSelected() entry point.

This commit is contained in:
ocornut
2024-03-06 15:04:03 +01:00
parent f36a03c317
commit dbc67bbf23
3 changed files with 14 additions and 16 deletions

View File

@@ -7744,11 +7744,11 @@ void ImGuiSelectionBasicStorage::ApplyRequests(ImGuiMultiSelectIO* ms_io, int it
{
Storage.Data.reserve(items_count);
for (int idx = 0; idx < items_count; idx++)
AddItem(AdapterIndexToStorageId(this, idx));
SetItemSelected(AdapterIndexToStorageId(this, idx), true);
}
if (req.Type == ImGuiSelectionRequestType_SetRange)
for (int idx = (int)req.RangeFirstItem; idx <= (int)req.RangeLastItem; idx++)
UpdateItem(AdapterIndexToStorageId(this, idx), req.Selected);
SetItemSelected(AdapterIndexToStorageId(this, idx), req.Selected);
}
}