mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-12 02:00:58 +01:00
Internals: add ImGuiNavMoveFlags_NoSelect and use in FocusItem().
(amend 31f11cf
which broke raage-select)
This commit is contained in:
parent
31f11cf304
commit
956a1a17fb
12
imgui.cpp
12
imgui.cpp
@ -7557,7 +7557,7 @@ void ImGui::FocusItem()
|
||||
return;
|
||||
}
|
||||
|
||||
ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_FocusApi; // No activation/selection
|
||||
ImGuiNavMoveFlags move_flags = ImGuiNavMoveFlags_Tabbing | ImGuiNavMoveFlags_FocusApi | ImGuiNavMoveFlags_NoSelect;
|
||||
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
||||
SetNavWindow(window);
|
||||
NavMoveRequestSubmit(ImGuiDir_None, ImGuiDir_Up, move_flags, scroll_flags);
|
||||
@ -11605,8 +11605,8 @@ void ImGui::NavMoveRequestApplyResult()
|
||||
if (result == NULL)
|
||||
{
|
||||
if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
||||
g.NavMoveFlags |= ImGuiNavMoveFlags_DontSetNavHighlight;
|
||||
if (g.NavId != 0 && (g.NavMoveFlags & ImGuiNavMoveFlags_DontSetNavHighlight) == 0)
|
||||
g.NavMoveFlags |= ImGuiNavMoveFlags_NoSetNavHighlight;
|
||||
if (g.NavId != 0 && (g.NavMoveFlags & ImGuiNavMoveFlags_NoSetNavHighlight) == 0)
|
||||
NavRestoreHighlightAfterMove();
|
||||
NavClearPreferredPosForAxis(axis); // On a failed move, clear preferred pos for this axis.
|
||||
IMGUI_DEBUG_LOG_NAV("[nav] NavMoveSubmitted but not led to a result!\n");
|
||||
@ -11645,7 +11645,7 @@ void ImGui::NavMoveRequestApplyResult()
|
||||
}
|
||||
if (g.ActiveId != result->ID)
|
||||
ClearActiveID();
|
||||
if (g.NavId != result->ID && (g.NavMoveFlags & ImGuiNavMoveFlags_Activate) != 0)
|
||||
if (g.NavId != result->ID && (g.NavMoveFlags & ImGuiNavMoveFlags_NoSelect) == 0)
|
||||
{
|
||||
// Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)
|
||||
g.NavJustMovedToId = result->ID;
|
||||
@ -11675,13 +11675,13 @@ void ImGui::NavMoveRequestApplyResult()
|
||||
{
|
||||
g.NavNextActivateId = result->ID;
|
||||
g.NavNextActivateFlags = ImGuiActivateFlags_None;
|
||||
g.NavMoveFlags |= ImGuiNavMoveFlags_DontSetNavHighlight;
|
||||
g.NavMoveFlags |= ImGuiNavMoveFlags_NoSetNavHighlight;
|
||||
if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
||||
g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState;
|
||||
}
|
||||
|
||||
// Enable nav highlight
|
||||
if ((g.NavMoveFlags & ImGuiNavMoveFlags_DontSetNavHighlight) == 0)
|
||||
if ((g.NavMoveFlags & ImGuiNavMoveFlags_NoSetNavHighlight) == 0)
|
||||
NavRestoreHighlightAfterMove();
|
||||
}
|
||||
|
||||
|
@ -1482,7 +1482,8 @@ enum ImGuiNavMoveFlags_
|
||||
ImGuiNavMoveFlags_FocusApi = 1 << 9, // Requests from focus API can land/focus/activate items even if they are marked with _NoTabStop (see NavProcessItemForTabbingRequest() for details)
|
||||
ImGuiNavMoveFlags_Tabbing = 1 << 10, // == Focus + Activate if item is Inputable + DontChangeNavHighlight
|
||||
ImGuiNavMoveFlags_Activate = 1 << 11, // Activate/select target item.
|
||||
ImGuiNavMoveFlags_DontSetNavHighlight = 1 << 12, // Do not alter the visible state of keyboard vs mouse nav highlight
|
||||
ImGuiNavMoveFlags_NoSelect = 1 << 12, // Don't trigger selection by not setting g.NavJustMovedTo
|
||||
ImGuiNavMoveFlags_NoSetNavHighlight = 1 << 13, // Do not alter the visible state of keyboard vs mouse nav highlight
|
||||
};
|
||||
|
||||
enum ImGuiNavLayer
|
||||
|
Loading…
Reference in New Issue
Block a user