mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-26 13:37:00 +00: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;
|
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;
|
ImGuiScrollFlags scroll_flags = window->Appearing ? ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_AlwaysCenterY : ImGuiScrollFlags_KeepVisibleEdgeX | ImGuiScrollFlags_KeepVisibleEdgeY;
|
||||||
SetNavWindow(window);
|
SetNavWindow(window);
|
||||||
NavMoveRequestSubmit(ImGuiDir_None, ImGuiDir_Up, move_flags, scroll_flags);
|
NavMoveRequestSubmit(ImGuiDir_None, ImGuiDir_Up, move_flags, scroll_flags);
|
||||||
@ -11605,8 +11605,8 @@ void ImGui::NavMoveRequestApplyResult()
|
|||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
{
|
{
|
||||||
if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
||||||
g.NavMoveFlags |= ImGuiNavMoveFlags_DontSetNavHighlight;
|
g.NavMoveFlags |= ImGuiNavMoveFlags_NoSetNavHighlight;
|
||||||
if (g.NavId != 0 && (g.NavMoveFlags & ImGuiNavMoveFlags_DontSetNavHighlight) == 0)
|
if (g.NavId != 0 && (g.NavMoveFlags & ImGuiNavMoveFlags_NoSetNavHighlight) == 0)
|
||||||
NavRestoreHighlightAfterMove();
|
NavRestoreHighlightAfterMove();
|
||||||
NavClearPreferredPosForAxis(axis); // On a failed move, clear preferred pos for this axis.
|
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");
|
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)
|
if (g.ActiveId != result->ID)
|
||||||
ClearActiveID();
|
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)
|
// Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)
|
||||||
g.NavJustMovedToId = result->ID;
|
g.NavJustMovedToId = result->ID;
|
||||||
@ -11675,13 +11675,13 @@ void ImGui::NavMoveRequestApplyResult()
|
|||||||
{
|
{
|
||||||
g.NavNextActivateId = result->ID;
|
g.NavNextActivateId = result->ID;
|
||||||
g.NavNextActivateFlags = ImGuiActivateFlags_None;
|
g.NavNextActivateFlags = ImGuiActivateFlags_None;
|
||||||
g.NavMoveFlags |= ImGuiNavMoveFlags_DontSetNavHighlight;
|
g.NavMoveFlags |= ImGuiNavMoveFlags_NoSetNavHighlight;
|
||||||
if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
if (g.NavMoveFlags & ImGuiNavMoveFlags_Tabbing)
|
||||||
g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState;
|
g.NavNextActivateFlags |= ImGuiActivateFlags_PreferInput | ImGuiActivateFlags_TryToPreserveState;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Enable nav highlight
|
// Enable nav highlight
|
||||||
if ((g.NavMoveFlags & ImGuiNavMoveFlags_DontSetNavHighlight) == 0)
|
if ((g.NavMoveFlags & ImGuiNavMoveFlags_NoSetNavHighlight) == 0)
|
||||||
NavRestoreHighlightAfterMove();
|
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_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_Tabbing = 1 << 10, // == Focus + Activate if item is Inputable + DontChangeNavHighlight
|
||||||
ImGuiNavMoveFlags_Activate = 1 << 11, // Activate/select target item.
|
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
|
enum ImGuiNavLayer
|
||||||
|
Loading…
Reference in New Issue
Block a user