浏览代码

ImDrawList: Fixed AddCircle() to fit precisely within bounding box like AddCircleFilled() and AddRectFilled() (followup #457

ocornut 9 年之前
父节点
当前提交
6dbdc69131
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      imgui_demo.cpp
  2. 1 1
      imgui_draw.cpp

+ 1 - 1
imgui_demo.cpp

@@ -1780,7 +1780,7 @@ static void ShowExampleAppCustomRendering(bool* opened)
     ImGui::Text("Primitives");
     static float sz = 36.0f;
     static ImVec4 col = ImVec4(1.0f,1.0f,0.4f,1.0f);
-    ImGui::DragFloat("Size", &sz, 0.2f, 1.0f, 72.0f, "%.0f"); 
+    ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f"); 
     ImGui::ColorEdit3("Color", &col.x);
     {
         const ImVec2 p = ImGui::GetCursorScreenPos();

+ 1 - 1
imgui_draw.cpp

@@ -827,7 +827,7 @@ void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int nu
         return;
 
     const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;
-    PathArcTo(centre, radius, 0.0f, a_max, num_segments);
+    PathArcTo(centre, radius-0.5f, 0.0f, a_max, num_segments);
     PathStroke(col, true);
 }