MCPcopy Create free account
hub / github.com/VictorGordan/opengl-tutorials / RenderNavHighlight

Method RenderNavHighlight

ImGUI GLFW Tutorial/imgui/imgui.cpp:2856–2886  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2854}
2855
2856void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFlags flags)
2857{
2858 ImGuiContext& g = *GImGui;
2859 if (id != g.NavId)
2860 return;
2861 if (g.NavDisableHighlight && !(flags & ImGuiNavHighlightFlags_AlwaysDraw))
2862 return;
2863 ImGuiWindow* window = g.CurrentWindow;
2864 if (window->DC.NavHideHighlightOneFrame)
2865 return;
2866
2867 float rounding = (flags & ImGuiNavHighlightFlags_NoRounding) ? 0.0f : g.Style.FrameRounding;
2868 ImRect display_rect = bb;
2869 display_rect.ClipWith(window->ClipRect);
2870 if (flags & ImGuiNavHighlightFlags_TypeDefault)
2871 {
2872 const float THICKNESS = 2.0f;
2873 const float DISTANCE = 3.0f + THICKNESS * 0.5f;
2874 display_rect.Expand(ImVec2(DISTANCE, DISTANCE));
2875 bool fully_visible = window->ClipRect.Contains(display_rect);
2876 if (!fully_visible)
2877 window->DrawList->PushClipRect(display_rect.Min, display_rect.Max);
2878 window->DrawList->AddRect(display_rect.Min + ImVec2(THICKNESS * 0.5f, THICKNESS * 0.5f), display_rect.Max - ImVec2(THICKNESS * 0.5f, THICKNESS * 0.5f), GetColorU32(ImGuiCol_NavHighlight), rounding, 0, THICKNESS);
2879 if (!fully_visible)
2880 window->DrawList->PopClipRect();
2881 }
2882 if (flags & ImGuiNavHighlightFlags_TypeThin)
2883 {
2884 window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavHighlight), rounding, 0, 1.0f);
2885 }
2886}
2887
2888//-----------------------------------------------------------------------------
2889// [SECTION] MAIN CODE (most of the code! lots of stuff, needs tidying up!)

Callers

nothing calls this directly

Calls 4

ImVec2Function · 0.70
PushClipRectMethod · 0.45
AddRectMethod · 0.45
PopClipRectMethod · 0.45

Tested by

no test coverage detected