mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-11 00:04:24 +00:00
Selectable: ImGuiSelectableFlags_SelectOnNav doesn't select when holding Ctrl, to be consistent with multi-select.
Amend e66afbb + remove needless line in CloseCurrentPopup() block
This commit is contained in:
parent
5e5658e68f
commit
55f590c1d1
3 changed files with 4 additions and 5 deletions
|
|
@ -73,7 +73,7 @@ Other Changes:
|
||||||
on InputTextMultiline() fields with ImGuiInputTextFlags_AllowTabInput, since
|
on InputTextMultiline() fields with ImGuiInputTextFlags_AllowTabInput, since
|
||||||
they normally inhibit activation to allow tabbing through multiple items. (#8928)
|
they normally inhibit activation to allow tabbing through multiple items. (#8928)
|
||||||
- Selectable: added ImGuiSelectableFlags_SelectOnNav to auto-select an item when
|
- Selectable: added ImGuiSelectableFlags_SelectOnNav to auto-select an item when
|
||||||
moved into (automatic when in a BeginMultiSelect() block).
|
moved into, unless Ctrl is held. (automatic when in a BeginMultiSelect() block).
|
||||||
- TabBar: fixed an issue were forcefully selecting a tab using internal API would
|
- TabBar: fixed an issue were forcefully selecting a tab using internal API would
|
||||||
be ignored on first/appearing frame before tabs are submitted (#8929, #6681)
|
be ignored on first/appearing frame before tabs are submitted (#8929, #6681)
|
||||||
- DrawList: fixed CloneOutput() unnecessarily taking a copy of the ImDrawListSharedData
|
- DrawList: fixed CloneOutput() unnecessarily taking a copy of the ImDrawListSharedData
|
||||||
|
|
|
||||||
2
imgui.h
2
imgui.h
|
|
@ -1341,7 +1341,7 @@ enum ImGuiSelectableFlags_
|
||||||
ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text
|
ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text
|
||||||
ImGuiSelectableFlags_AllowOverlap = 1 << 4, // (WIP) Hit testing to allow subsequent widgets to overlap this one
|
ImGuiSelectableFlags_AllowOverlap = 1 << 4, // (WIP) Hit testing to allow subsequent widgets to overlap this one
|
||||||
ImGuiSelectableFlags_Highlight = 1 << 5, // Make the item be displayed as if it is hovered
|
ImGuiSelectableFlags_Highlight = 1 << 5, // Make the item be displayed as if it is hovered
|
||||||
ImGuiSelectableFlags_SelectOnNav = 1 << 6, // Auto-select when moved into. Automatic when in a BeginMultiSelect() block.
|
ImGuiSelectableFlags_SelectOnNav = 1 << 6, // Auto-select when moved into, unless Ctrl is held. Automatic when in a BeginMultiSelect() block.
|
||||||
|
|
||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
ImGuiSelectableFlags_DontClosePopups = ImGuiSelectableFlags_NoAutoClosePopups, // Renamed in 1.91.0
|
ImGuiSelectableFlags_DontClosePopups = ImGuiSelectableFlags_NoAutoClosePopups, // Renamed in 1.91.0
|
||||||
|
|
|
||||||
|
|
@ -7366,7 +7366,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
||||||
// - (2) usage will fail with clipped items
|
// - (2) usage will fail with clipped items
|
||||||
// The multi-select API aim to fix those issues, e.g. may be replaced with a BeginSelection() API.
|
// The multi-select API aim to fix those issues, e.g. may be replaced with a BeginSelection() API.
|
||||||
if ((flags & ImGuiSelectableFlags_SelectOnNav) && g.NavJustMovedToId != 0 && g.NavJustMovedToFocusScopeId == g.CurrentFocusScopeId)
|
if ((flags & ImGuiSelectableFlags_SelectOnNav) && g.NavJustMovedToId != 0 && g.NavJustMovedToFocusScopeId == g.CurrentFocusScopeId)
|
||||||
if (g.NavJustMovedToId == id)
|
if (g.NavJustMovedToId == id && (g.NavJustMovedToKeyMods & ImGuiMod_Ctrl) == 0)
|
||||||
selected = pressed = auto_selected = true;
|
selected = pressed = auto_selected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -7419,8 +7419,7 @@ bool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags fl
|
||||||
|
|
||||||
// Automatically close popups
|
// Automatically close popups
|
||||||
if (pressed && !auto_selected && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_NoAutoClosePopups) && (g.LastItemData.ItemFlags & ImGuiItemFlags_AutoClosePopups))
|
if (pressed && !auto_selected && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_NoAutoClosePopups) && (g.LastItemData.ItemFlags & ImGuiItemFlags_AutoClosePopups))
|
||||||
if (!(flags & ImGuiSelectableFlags_SelectOnNav) || g.NavJustMovedToId != id)
|
CloseCurrentPopup();
|
||||||
CloseCurrentPopup();
|
|
||||||
|
|
||||||
if (disabled_item && !disabled_global)
|
if (disabled_item && !disabled_global)
|
||||||
EndDisabled();
|
EndDisabled();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue