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:
ocornut 2016-08-21 16:05:19 +02:00
parent 252f094101
commit 2303b67c40

View File

@ -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;