浏览代码

Allow Set*WindowSize() calls to be used with popups (fix for using e.g. scroll function on the first frame)

ocornut 10 年之前
父节点
当前提交
6f1dd7a688
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      imgui.cpp

+ 3 - 1
imgui.cpp

@@ -3573,7 +3573,9 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
         if ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0 && !window_was_visible)
         if ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0 && !window_was_visible)
         {
         {
             window->HiddenFrames = 1;
             window->HiddenFrames = 1;
-            window->Size = window->SizeFull = window->SizeContents = ImVec2(0.f, 0.f);  // TODO: We don't support SetNextWindowSize() for tooltips or popups yet
+            if (!window_size_set_by_api)
+                window->Size = window->SizeFull = ImVec2(0.f, 0.f);
+            window->SizeContents = ImVec2(0.f, 0.f);
         }
         }
 
 
         // Calculate auto-fit size
         // Calculate auto-fit size