Skip to content

Commit

Permalink
Demo: Style Editor: clarify how _CalcCircleAutoSegmentCount() doesn't…
Browse files Browse the repository at this point in the history
… always get exact final segment count. (#7731)
  • Loading branch information
ocornut committed Jun 24, 2024
1 parent 48e7e7b commit aab2713
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions imgui_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6932,10 +6932,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
if (show_samples && ImGui::BeginTooltip())
{
ImGui::TextUnformatted("(R = radius, N = number of segments)");
ImGui::TextUnformatted("(R = radius, N = approx number of segments)");
ImGui::Spacing();
ImDrawList* draw_list = ImGui::GetWindowDrawList();
const float min_widget_width = ImGui::CalcTextSize("N: MMM\nR: MMM").x;
const float min_widget_width = ImGui::CalcTextSize("R: MMM\nN: MMM").x;
for (int n = 0; n < 8; n++)
{
const float RAD_MIN = 5.0f;
Expand All @@ -6944,6 +6944,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)

ImGui::BeginGroup();

// N is not always exact here due to how PathArcTo() function work internally
ImGui::Text("R: %.f\nN: %d", rad, draw_list->_CalcCircleAutoSegmentCount(rad));

const float canvas_width = IM_MAX(min_widget_width, rad * 2.0f);
Expand Down

0 comments on commit aab2713

Please sign in to comment.