From c4fc87950897ca5f0a1861c4f3d2a60d1f2f331a Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 1 Feb 2018 22:32:52 +0100 Subject: [PATCH] CloseButton: Fixed cross positioning. --- imgui.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui.cpp b/imgui.cpp index 9d8755771..fe71f4f06 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6458,12 +6458,13 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos, float radius) // Render const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_CloseButtonActive : hovered ? ImGuiCol_CloseButtonHovered : ImGuiCol_CloseButton); - const ImVec2 center = bb.GetCenter(); + ImVec2 center = bb.GetCenter(); window->DrawList->AddCircleFilled(center, ImMax(2.0f, radius), col, 12); const float cross_extent = (radius * 0.7071f) - 1.0f; if (hovered) { + center -= ImVec2(0.5f, 0.5f); window->DrawList->AddLine(center + ImVec2(+cross_extent,+cross_extent), center + ImVec2(-cross_extent,-cross_extent), GetColorU32(ImGuiCol_Text)); window->DrawList->AddLine(center + ImVec2(+cross_extent,-cross_extent), center + ImVec2(-cross_extent,+cross_extent), GetColorU32(ImGuiCol_Text)); }