Demo: Style Editor: clarify how _CalcCircleAutoSegmentCount() doesn't always get exact final segment count. (#7731)

This commit is contained in:
ocornut 2024-06-24 12:57:39 -07:00
parent 48e7e7bfe8
commit aab27130a6

View File

@ -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;
@ -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);