mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-15 00:44:20 +00:00
Nav, TreeNode: Pressing Left with ImGuiTreeNodeFlags_NavLeftJumpsBackHere now goes through proper navigation logic: honor scrolling and selection. (#1079, #1131)
Added a stack for this purpose which other features might build on (e.g. #2920). However this is currently gated by many tests and not a performance concern, but making stack happen all the time may be undesirable.
This commit is contained in:
parent
edebb90a9a
commit
bc3c0ce772
5 changed files with 57 additions and 14 deletions
14
imgui.cpp
14
imgui.cpp
|
|
@ -3653,6 +3653,7 @@ void ImGui::Shutdown()
|
|||
g.FontStack.clear();
|
||||
g.OpenPopupStack.clear();
|
||||
g.BeginPopupStack.clear();
|
||||
g.NavTreeNodeStack.clear();
|
||||
|
||||
g.Viewports.clear_delete();
|
||||
|
||||
|
|
@ -11191,6 +11192,19 @@ void ImGui::NavMoveRequestResolveWithLastItem(ImGuiNavItemData* result)
|
|||
NavUpdateAnyRequestFlag();
|
||||
}
|
||||
|
||||
// Called by TreePop() to implement ImGuiTreeNodeFlags_NavLeftJumpsBackHere
|
||||
void ImGui::NavMoveRequestResolveWithPastTreeNode(ImGuiNavItemData* result, ImGuiNavTreeNodeData* tree_node_data)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
g.NavMoveScoringItems = false;
|
||||
g.LastItemData.ID = tree_node_data->ID;
|
||||
g.LastItemData.InFlags = tree_node_data->InFlags;
|
||||
g.LastItemData.NavRect = tree_node_data->NavRect;
|
||||
NavApplyItemToResult(result); // Result this instead of implementing a NavApplyPastTreeNodeToResult()
|
||||
NavClearPreferredPosForAxis(ImGuiAxis_Y);
|
||||
NavUpdateAnyRequestFlag();
|
||||
}
|
||||
|
||||
void ImGui::NavMoveRequestCancel()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue