Browse Source

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

omar 8 năm trước cách đây
mục cha
commit
fce41d0b55
1 tập tin đã thay đổi với 2 bổ sung0 xóa
  1. 2 0
      imgui_demo.cpp

+ 2 - 0
imgui_demo.cpp

@@ -1951,6 +1951,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
         for (int i = 0; i < atlas->Fonts.Size; 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);
             ImGui::SameLine(); if (ImGui::SmallButton("Set as default")) ImGui::GetIO().FontDefault = font;
             if (font_details_opened)
@@ -2011,6 +2012,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
                 }
                 ImGui::TreePop();
             }
+            ImGui::PopID();
         }
         static float window_scale = 1.0f;
         ImGui::DragFloat("this window scale", &window_scale, 0.005f, 0.3f, 2.0f, "%.1f");              // scale only this window