Internals: adding ImGuiNavMoveFlags_NoClearActiveId even though there's currently no satisfying way to take advantage of it. (#1418)
diff --git a/imgui.cpp b/imgui.cpp
index 5832b50..0b0c583 100644
--- a/imgui.cpp
+++ b/imgui.cpp
@@ -12303,8 +12303,10 @@
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)
diff --git a/imgui_internal.h b/imgui_internal.h
index cb25183..25d85f4 100644
--- a/imgui_internal.h
+++ b/imgui_internal.h
@@ -1578,6 +1578,7 @@
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