Demo: Fixed Fonts "set as default button" not having collading id on collapsed nodes.

This commit is contained in:
omar 2017-10-22 10:21:49 +02:00
parent 08e411c310
commit fce41d0b55

View File

@ -1951,6 +1951,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
for (int i = 0; i < atlas->Fonts.Size; i++) for (int i = 0; i < atlas->Fonts.Size; i++)
{ {
ImFont* font = atlas->Fonts[i]; ImFont* font = atlas->Fonts[i];
ImGui::PushID(font);
bool font_details_opened = ImGui::TreeNode(font, "Font %d: \'%s\', %.2f px, %d glyphs", i, font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size); bool font_details_opened = ImGui::TreeNode(font, "Font %d: \'%s\', %.2f px, %d glyphs", i, font->ConfigData ? font->ConfigData[0].Name : "", font->FontSize, font->Glyphs.Size);
ImGui::SameLine(); if (ImGui::SmallButton("Set as default")) ImGui::GetIO().FontDefault = font; ImGui::SameLine(); if (ImGui::SmallButton("Set as default")) ImGui::GetIO().FontDefault = font;
if (font_details_opened) if (font_details_opened)
@ -2011,6 +2012,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
} }
ImGui::TreePop(); ImGui::TreePop();
} }
ImGui::PopID();
} }
static float window_scale = 1.0f; static float window_scale = 1.0f;
ImGui::DragFloat("this window scale", &window_scale, 0.005f, 0.3f, 2.0f, "%.1f"); // scale only this window ImGui::DragFloat("this window scale", &window_scale, 0.005f, 0.3f, 2.0f, "%.1f"); // scale only this window