mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-29 23:06:35 +00:00
CloseButton: Fixed cross positioning.
This commit is contained in:
parent
68d3e139a7
commit
942c140710
@ -7587,12 +7587,13 @@ bool ImGui::CloseButton(ImGuiID id, const ImVec2& pos, float radius)
|
|||||||
|
|
||||||
// Render
|
// Render
|
||||||
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_CloseButtonActive : hovered ? ImGuiCol_CloseButtonHovered : ImGuiCol_CloseButton);
|
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);
|
window->DrawList->AddCircleFilled(center, ImMax(2.0f, radius), col, 12);
|
||||||
|
|
||||||
const float cross_extent = (radius * 0.7071f) - 1.0f;
|
const float cross_extent = (radius * 0.7071f) - 1.0f;
|
||||||
if (hovered)
|
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));
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user