mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 20:07:01 +00:00
Nav: when browsing a window that has no activable items (scroll only) we keep a highlight on the child. (#787)
This commit is contained in:
parent
aa2dda7610
commit
76d8af4036
12
imgui.cpp
12
imgui.cpp
@ -4960,7 +4960,8 @@ bool ImGui::BeginChild(ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWin
|
|||||||
|
|
||||||
void ImGui::EndChild()
|
void ImGui::EndChild()
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiContext& g = *GImGui;
|
||||||
|
ImGuiWindow* window = g.CurrentWindow;
|
||||||
|
|
||||||
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() callss
|
IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() callss
|
||||||
if (window->BeginCount > 1)
|
if (window->BeginCount > 1)
|
||||||
@ -4977,13 +4978,18 @@ void ImGui::EndChild()
|
|||||||
sz.y = ImMax(4.0f, sz.y);
|
sz.y = ImMax(4.0f, sz.y);
|
||||||
End();
|
End();
|
||||||
|
|
||||||
ImGuiWindow* parent_window = GetCurrentWindow();
|
ImGuiWindow* parent_window = g.CurrentWindow;
|
||||||
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
|
ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);
|
||||||
|
|
||||||
ItemSize(sz);
|
ItemSize(sz);
|
||||||
if (!(window->Flags & ImGuiWindowFlags_NavFlattened) && (window->DC.NavLayerActiveMask != 0 || window->DC.NavHasScroll))
|
if ((window->DC.NavLayerActiveMask != 0 || window->DC.NavHasScroll) && !(window->Flags & ImGuiWindowFlags_NavFlattened))
|
||||||
{
|
{
|
||||||
ItemAdd(bb, window->ChildId);
|
ItemAdd(bb, window->ChildId);
|
||||||
RenderNavHighlight(bb, window->ChildId);
|
RenderNavHighlight(bb, window->ChildId);
|
||||||
|
|
||||||
|
// When browsing a window that has no activable items (scroll only) we keep a highlight on the child
|
||||||
|
if (window->DC.NavLayerActiveMask == 0 && window == g.NavWindow)
|
||||||
|
RenderNavHighlight(ImRect(bb.Min - ImVec2(2,2), bb.Max + ImVec2(2,2)), g.NavId, ImGuiNavHighlightFlags_TypeThin);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user