mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Close button submitted after collapse button. Should have no effect. Consistent with expectation & will be used as fallback for nav (#323)
This commit is contained in:
parent
252f094101
commit
2303b67c40
18
imgui.cpp
18
imgui.cpp
@ -5088,15 +5088,6 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
||||
window->DC.ItemFlags &= ~ImGuiItemFlags_AllowNavDefaultFocus;
|
||||
window->DC.NavLayerCurrent++;
|
||||
|
||||
// Close button
|
||||
if (p_open != NULL)
|
||||
{
|
||||
const float PAD = 2.0f;
|
||||
const float rad = (window->TitleBarHeight() - PAD*2.0f) * 0.5f;
|
||||
if (CloseButton(window->GetID("#CLOSE"), window->Rect().GetTR() + ImVec2(-PAD - rad, PAD + rad), rad))
|
||||
*p_open = false;
|
||||
}
|
||||
|
||||
// Collapse button
|
||||
const ImVec2 text_size = CalcTextSize(name, NULL, true);
|
||||
if (!(flags & ImGuiWindowFlags_NoCollapse))
|
||||
@ -5110,6 +5101,15 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
||||
RenderCollapseTriangle(window->Pos + style.FramePadding, !window->Collapsed, 1.0f, true);
|
||||
}
|
||||
|
||||
// Close button
|
||||
if (p_open != NULL)
|
||||
{
|
||||
const float PAD = 2.0f;
|
||||
const float rad = (window->TitleBarHeight() - PAD*2.0f) * 0.5f;
|
||||
if (CloseButton(window->GetID("#CLOSE"), window->Rect().GetTR() + ImVec2(-PAD - rad, PAD + rad), rad))
|
||||
*p_open = false;
|
||||
}
|
||||
|
||||
window->DC.NavLayerCurrent--;
|
||||
window->DC.ItemFlags = backup_item_options;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user