mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-12 02:00:58 +01:00
MultiSelect: Enter can alter selection if current item is not selected.
This commit is contained in:
parent
d2f208a30c
commit
85954c845e
@ -7301,11 +7301,13 @@ void ImGui::MultiSelectItemFooter(ImGuiID id, bool* p_selected, bool* p_pressed)
|
||||
}
|
||||
}
|
||||
|
||||
// Unlike Space, Enter doesn't alter selection (but can still return a press)
|
||||
// Unlike Space, Enter doesn't alter selection (but can still return a press) unless current item is not selected.
|
||||
// The later, "unless current item is not select", may become optional? It seems like a better default if Enter doesn't necessarily open something
|
||||
// (unlike e.g. Windows explorer). For use case where Enter always open something, we might decide to make this optional?
|
||||
const bool enter_pressed = pressed && (g.NavActivateId == id) && (g.NavActivateFlags & ImGuiActivateFlags_PreferInput);
|
||||
|
||||
// Alter selection
|
||||
if (pressed && !enter_pressed)
|
||||
if (pressed && (!enter_pressed || !selected))
|
||||
{
|
||||
//-------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
// ACTION | Begin | Item Old | Item New | End
|
||||
|
Loading…
Reference in New Issue
Block a user