mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-13 00:09:55 +02:00
Nav: tweak RenderNavHighlight() syntax. ImGuiNavHighlightFlags_TypeThin -> ImGuiNavHighlightFlags_Compact.
This commit is contained in:
20
imgui.cpp
20
imgui.cpp
@ -3452,22 +3452,22 @@ void ImGui::RenderNavHighlight(const ImRect& bb, ImGuiID id, ImGuiNavHighlightFl
|
||||
float rounding = (flags & ImGuiNavHighlightFlags_NoRounding) ? 0.0f : g.Style.FrameRounding;
|
||||
ImRect display_rect = bb;
|
||||
display_rect.ClipWith(window->ClipRect);
|
||||
if (flags & ImGuiNavHighlightFlags_TypeDefault)
|
||||
const float thickness = 2.0f;
|
||||
if (flags & ImGuiNavHighlightFlags_Compact)
|
||||
{
|
||||
const float THICKNESS = 2.0f;
|
||||
const float DISTANCE = 3.0f + THICKNESS * 0.5f;
|
||||
display_rect.Expand(ImVec2(DISTANCE, DISTANCE));
|
||||
window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavHighlight), rounding, 0, thickness);
|
||||
}
|
||||
else
|
||||
{
|
||||
const float distance = 3.0f + thickness * 0.5f;
|
||||
display_rect.Expand(ImVec2(distance, distance));
|
||||
bool fully_visible = window->ClipRect.Contains(display_rect);
|
||||
if (!fully_visible)
|
||||
window->DrawList->PushClipRect(display_rect.Min, display_rect.Max);
|
||||
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);
|
||||
window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavHighlight), rounding, 0, thickness);
|
||||
if (!fully_visible)
|
||||
window->DrawList->PopClipRect();
|
||||
}
|
||||
if (flags & ImGuiNavHighlightFlags_TypeThin)
|
||||
{
|
||||
window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavHighlight), rounding, 0, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void ImGui::RenderMouseCursor(ImVec2 base_pos, float base_scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
|
||||
@ -5543,7 +5543,7 @@ void ImGui::EndChild()
|
||||
|
||||
// When browsing a window that has no activable items (scroll only) we keep a highlight on the child (pass g.NavId to trick into always displaying)
|
||||
if (child_window->DC.NavLayersActiveMask == 0 && child_window == g.NavWindow)
|
||||
RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_TypeThin);
|
||||
RenderNavHighlight(ImRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2)), g.NavId, ImGuiNavHighlightFlags_Compact);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user