mirror of
https://github.com/ocornut/imgui.git
synced 2026-03-27 23:37:03 -05:00
MultiSelect: added ImGuiMultiSelectFlags_SelectOnClickAlways mode. Prevents Drag and Drop of multiple items but allows BoxSelect to always reselect even when clicking inside a selecttion. (#9307, #1861)
This commit is contained in:
@@ -8170,10 +8170,13 @@ void ImGui::MultiSelectItemHeader(ImGuiID id, bool* p_selected, ImGuiButtonFlags
|
||||
{
|
||||
ImGuiButtonFlags button_flags = *p_button_flags;
|
||||
button_flags |= ImGuiButtonFlags_NoHoveredOnFocus;
|
||||
if ((!selected || (g.ActiveId == id && g.ActiveIdHasBeenPressedBefore)) && !(ms->Flags & ImGuiMultiSelectFlags_SelectOnClickRelease))
|
||||
button_flags = (button_flags | ImGuiButtonFlags_PressedOnClick) & ~ImGuiButtonFlags_PressedOnClickRelease;
|
||||
else
|
||||
button_flags &= ~(ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClickRelease);
|
||||
if (ms->Flags & ImGuiMultiSelectFlags_SelectOnClickAlways)
|
||||
button_flags |= ImGuiButtonFlags_PressedOnClick;
|
||||
else if (ms->Flags & ImGuiMultiSelectFlags_SelectOnClickRelease)
|
||||
button_flags |= ImGuiButtonFlags_PressedOnClickRelease;
|
||||
else // ImGuiMultiSelectFlags_SelectOnAuto
|
||||
button_flags |= (!selected || (g.ActiveId == id && g.ActiveIdHasBeenPressedBefore)) ? ImGuiButtonFlags_PressedOnClick : ImGuiButtonFlags_PressedOnClickRelease;
|
||||
*p_button_flags = button_flags;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user