Internals: adding ImGuiNavMoveFlags_NoClearActiveId even though there's currently no satisfying way to take advantage of it. (#1418)

This commit is contained in:
ocornut 2024-03-27 12:00:50 +09:00
parent 742e53434f
commit 9638c2839a
2 changed files with 5 additions and 2 deletions

View File

@ -12303,8 +12303,10 @@ void ImGui::NavMoveRequestApplyResult()
g.NavLastValidSelectionUserData = ImGuiSelectionUserData_Invalid;
}
// FIXME: Could become optional e.g. ImGuiNavMoveFlags_NoClearActiveId if we later want to apply navigation requests without altering active input.
if (g.ActiveId != result->ID)
// Clear active id unless requested not to
// FIXME: ImGuiNavMoveFlags_NoClearActiveId is currently unused as we don't have a clear strategy to preserve active id after interaction,
// so this is mostly provided as a gateway for further experiments (see #1418, #2890)
if (g.ActiveId != result->ID && (g.NavMoveFlags & ImGuiNavMoveFlags_NoClearActiveId) == 0)
ClearActiveID();
// Don't set NavJustMovedToId if just landed on the same spot (which may happen with ImGuiNavMoveFlags_AllowCurrentNavId)

View File

@ -1578,6 +1578,7 @@ enum ImGuiNavMoveFlags_
ImGuiNavMoveFlags_Activate = 1 << 12, // Activate/select target item.
ImGuiNavMoveFlags_NoSelect = 1 << 13, // Don't trigger selection by not setting g.NavJustMovedTo
ImGuiNavMoveFlags_NoSetNavHighlight = 1 << 14, // Do not alter the visible state of keyboard vs mouse nav highlight
ImGuiNavMoveFlags_NoClearActiveId = 1 << 15, // (Experimental) Do not clear active id when applying move result
};
enum ImGuiNavLayer