From 9b26743c6b30d647662c3ef315d9968fde4c1033 Mon Sep 17 00:00:00 2001 From: Diego Mateos Date: Fri, 29 Nov 2024 13:31:11 +0100 Subject: [PATCH] SliderAngle: only write back to value v_rad on value_changed. (#8193) --- imgui_widgets.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/imgui_widgets.cpp b/imgui_widgets.cpp index 81b480cb1..f9939cec4 100644 --- a/imgui_widgets.cpp +++ b/imgui_widgets.cpp @@ -3329,7 +3329,8 @@ bool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, fl format = "%.0f deg"; float v_deg = (*v_rad) * 360.0f / (2 * IM_PI); bool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, format, flags); - *v_rad = v_deg * (2 * IM_PI) / 360.0f; + if (value_changed) + *v_rad = v_deg * (2 * IM_PI) / 360.0f; return value_changed; }