Nav: Refactor NavMoveResult** flags into ImGuiNavMoveResult structure as we are going to want two instances of it. (#787) (+1 squashed commits)

+ store window inside result.
This commit is contained in:
omar
2018-01-29 18:28:46 +01:00
parent 1cf38d0334
commit 72485a5d04
2 changed files with 45 additions and 36 deletions

View File

@ -504,6 +504,19 @@ struct ImDrawDataBuilder
IMGUI_API void FlattenIntoSingleLayer();
};
struct ImGuiNavMoveResult
{
ImGuiID ID; // Best candidate
ImGuiID ParentID; // Best candidate window->IDStack.back() - to compare context
ImGuiWindow* Window; // Best candidate window
float DistBox; // Best candidate box distance to current NavId
float DistCenter; // Best candidate center distance to current NavId
float DistAxial; // Best candidate selected distance (box/center) to current NavId
ImRect RectRel; // Best candidate bounding box in window relative space
ImGuiNavMoveResult() { ID = ParentID = 0; Window = NULL; DistBox = DistCenter = DistAxial = 0.0f; }
};
// Storage for SetNexWindow** functions
struct ImGuiNextWindowData
{
@ -620,12 +633,7 @@ struct ImGuiContext
ImGuiNavForward NavMoveRequestForward; // None / ForwardQueued / ForwardActive (this is used to navigate sibling parent menus from a child menu)
ImGuiDir NavMoveDir; // Direction of the move request (left/right/up/down)
ImGuiDir NavMoveDirLast; // Direction of the previous move request
ImGuiID NavMoveResultId; // Best move request candidate
ImGuiID NavMoveResultParentId; // Best move request candidate window->IDStack.back() - to compare context
float NavMoveResultDistBox; // Best move request candidate box distance to current NavId
float NavMoveResultDistCenter; // Best move request candidate center distance to current NavId
float NavMoveResultDistAxial;
ImRect NavMoveResultRectRel; // Best move request candidate bounding box in window relative space
ImGuiNavMoveResult NavMoveResult; // Best move request candidate
// Render
ImDrawData DrawData; // Main ImDrawData instance to pass render information to the user
@ -738,9 +746,6 @@ struct ImGuiContext
NavMoveRequest = false;
NavMoveRequestForward = ImGuiNavForward_None;
NavMoveDir = NavMoveDirLast = ImGuiDir_None;
NavMoveResultId = 0;
NavMoveResultParentId = 0;
NavMoveResultDistBox = NavMoveResultDistCenter = NavMoveResultDistAxial = 0.0f;
ModalWindowDarkeningRatio = 0.0f;
OverlayDrawList._Data = &DrawListSharedData;