BugFix IconButton (pop id)

This commit is contained in:
Bruno
2021-05-25 22:17:57 +02:00
parent bcbeee7247
commit ab512b76aa
2 changed files with 109 additions and 102 deletions

View File

@@ -192,8 +192,11 @@ bool ImGuiToolkit::IconButton(int i, int j, const char *tooltip)
ImVec2 draw_pos = window->DC.CursorPos; ImVec2 draw_pos = window->DC.CursorPos;
const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size); const ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);
ImGui::ItemSize(size); ImGui::ItemSize(size);
if (!ImGui::ItemAdd(bb, id))
if (!ImGui::ItemAdd(bb, id)){
ImGui::PopID();
return false; return false;
}
ImGuiButtonFlags flags = 0; ImGuiButtonFlags flags = 0;
if (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat) if (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat)

View File

@@ -1556,8 +1556,12 @@ void UserInterface::RenderMetrics(bool *p_open, int* p_corner, int *p_mode)
ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background
if (ImGui::Begin("Metrics", NULL, (corner != -1 ? ImGuiWindowFlags_NoMove : 0) | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav)) if (!ImGui::Begin("Metrics", NULL, (corner != -1 ? ImGuiWindowFlags_NoMove : 0) | ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav))
{ {
ImGui::End();
return;
}
ImGui::SetNextItemWidth(200); ImGui::SetNextItemWidth(200);
ImGui::Combo("##mode", p_mode, ImGui::Combo("##mode", p_mode,
ICON_FA_TACHOMETER_ALT " Performance\0" ICON_FA_TACHOMETER_ALT " Performance\0"
@@ -1658,9 +1662,9 @@ void UserInterface::RenderMetrics(bool *p_open, int* p_corner, int *p_mode)
if (p_open && ImGui::MenuItem( ICON_FA_TIMES " Close")) *p_open = false; if (p_open && ImGui::MenuItem( ICON_FA_TIMES " Close")) *p_open = false;
ImGui::EndPopup(); ImGui::EndPopup();
} }
ImGui::End(); ImGui::End();
} }
}
void UserInterface::RenderAbout(bool* p_open) void UserInterface::RenderAbout(bool* p_open)
{ {