mirror of
https://github.com/ocornut/imgui.git
synced 2026-06-02 11:06:51 +08:00
Demo: Style Editor: clarify how _CalcCircleAutoSegmentCount() doesn't always get exact final segment count. (#7731)
This commit is contained in:
+3
-2
@@ -6932,10 +6932,10 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
|
ImGui::SetNextWindowPos(ImGui::GetCursorScreenPos());
|
||||||
if (show_samples && ImGui::BeginTooltip())
|
if (show_samples && ImGui::BeginTooltip())
|
||||||
{
|
{
|
||||||
ImGui::TextUnformatted("(R = radius, N = number of segments)");
|
ImGui::TextUnformatted("(R = radius, N = approx number of segments)");
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
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++)
|
for (int n = 0; n < 8; n++)
|
||||||
{
|
{
|
||||||
const float RAD_MIN = 5.0f;
|
const float RAD_MIN = 5.0f;
|
||||||
@@ -6944,6 +6944,7 @@ void ImGui::ShowStyleEditor(ImGuiStyle* ref)
|
|||||||
|
|
||||||
ImGui::BeginGroup();
|
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));
|
ImGui::Text("R: %.f\nN: %d", rad, draw_list->_CalcCircleAutoSegmentCount(rad));
|
||||||
|
|
||||||
const float canvas_width = IM_MAX(min_widget_width, rad * 2.0f);
|
const float canvas_width = IM_MAX(min_widget_width, rad * 2.0f);
|
||||||
|
|||||||
Reference in New Issue
Block a user