diff --git a/docs/CHANGELOG.txt b/docs/CHANGELOG.txt index a160931c3..ab70c87fd 100644 --- a/docs/CHANGELOG.txt +++ b/docs/CHANGELOG.txt @@ -92,6 +92,8 @@ Other Changes: instead of _NavEnableGamepad. (#9454, #8803, #9270) [@Clownacy] - TreeNode: - Fixed nav cursor rendering with rounding even though tree nodes don't have it. (#7589) +- Style: + - Scale the NavCursor border thickness when using large values with `ScallAllSizes()`. - DrawList: - Minor optimization to `AddLine()`, `AddLineH()`, `AddLineV()` functions. (#4091) - Added `ImDrawListFlags_TextNoPixelSnap` to disable snapping of AddText() diff --git a/imgui.cpp b/imgui.cpp index c45606863..93d188782 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -4045,14 +4045,15 @@ void ImGui::RenderNavCursor(const ImRect& bb, ImGuiID id, ImGuiNavRenderCursorFl float rounding = (flags & ImGuiNavRenderCursorFlags_NoRounding) ? 0.0f : g.Style.FrameRounding; ImRect display_rect = bb; display_rect.ClipWith(window->ClipRect); - const float thickness = 2.0f; + const float scale_factor = GetScale(); // FIXME-DPI + const float thickness = (float)(int)ImMax(2.0f, 1.5f * scale_factor); if (flags & ImGuiNavRenderCursorFlags_Compact) { window->DrawList->AddRect(display_rect.Min, display_rect.Max, GetColorU32(ImGuiCol_NavCursor), rounding, thickness); } else { - const float distance = 3.0f + thickness * 0.5f; + const float distance = (float)(int)(3.0f + thickness * 0.5f); display_rect.Expand(ImVec2(distance, distance)); bool fully_visible = window->ClipRect.Contains(display_rect); if (!fully_visible)