mirror of
https://github.com/Drezil/imgui.git
synced 2025-04-21 10:34:00 +00:00
RangeSelect/MultiSelect: Added IMGUI_HAS_MULTI_SELECT define. Fixed right-click toggling selection without clearing active id, could lead to MarkItemEdited() asserting. Fixed demo.
This commit is contained in:
parent
9b925d51bb
commit
0d73bf3755
1
imgui.h
1
imgui.h
@ -2368,6 +2368,7 @@ struct ImGuiListClipper
|
|||||||
// 5) Call EndMultiSelect(). Save the value of ->RangeSrc for the next frame (you may convert the value in a format that is safe for persistance)
|
// 5) Call EndMultiSelect(). Save the value of ->RangeSrc for the next frame (you may convert the value in a format that is safe for persistance)
|
||||||
// 6) Honor Clear/SelectAll/SetRange requests by updating your selection data. Always process them in this order (as you will receive Clear+SetRange request simultaneously)
|
// 6) Honor Clear/SelectAll/SetRange requests by updating your selection data. Always process them in this order (as you will receive Clear+SetRange request simultaneously)
|
||||||
// If you submit all items (no clipper), Step 2 and 3 and will be handled by Selectable() on a per-item basis.
|
// If you submit all items (no clipper), Step 2 and 3 and will be handled by Selectable() on a per-item basis.
|
||||||
|
#define IMGUI_HAS_MULTI_SELECT // Multi-Select/Range-Select WIP branch // <-- This is currently _not_ in the top of imgui.h to prevent merge conflicts.
|
||||||
struct ImGuiMultiSelectData
|
struct ImGuiMultiSelectData
|
||||||
{
|
{
|
||||||
bool RequestClear; // Begin, End // Request user to clear selection
|
bool RequestClear; // Begin, End // Request user to clear selection
|
||||||
|
@ -6504,7 +6504,9 @@ void ImGui::MultiSelectItemFooter(ImGuiID id, bool* p_selected, bool* p_pressed)
|
|||||||
bool hovered = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup);
|
bool hovered = IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup);
|
||||||
if (hovered && IsMouseClicked(1))
|
if (hovered && IsMouseClicked(1))
|
||||||
{
|
{
|
||||||
SetFocusID(g.LastItemData.ID, window);
|
if (g.ActiveId != 0 && g.ActiveId != id)
|
||||||
|
ClearActiveID();
|
||||||
|
SetFocusID(id, window);
|
||||||
if (!pressed && !selected)
|
if (!pressed && !selected)
|
||||||
{
|
{
|
||||||
pressed = true;
|
pressed = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user