@@ -92,6 +92,7 @@ class Knob final : public Component
9292 }
9393
9494 onDragStart ();
95+ onValueChange (); // else/knob always outputs on mouseDown
9596 }
9697
9798 void mouseDrag (MouseEvent const & e) override
@@ -101,7 +102,8 @@ class Knob final : public Component
101102
102103 float delta = e.getDistanceFromDragStartY () - e.getDistanceFromDragStartX ();
103104 bool jumpMouseDownEvent = jumpOnClick && !e.mouseWasDraggedSinceMouseDown ();
104-
105+ bool valueChanged = false ;
106+
105107 if (isCircular || jumpMouseDownEvent) {
106108 float dx = e.position .x - getLocalBounds ().getCentreX ();
107109 float dy = e.position .y - getLocalBounds ().getCentreY ();
@@ -132,13 +134,17 @@ class Knob final : public Component
132134 newValue = std::ceil (newValue / interval) * interval;
133135 if (jumpMouseDownEvent)
134136 originalValue = newValue;
137+ valueChanged = !approximatelyEqual (newValue, value);
135138 setValue (newValue);
136139 } else {
137140 float newValue = originalValue - (delta / mouseDragSensitivity);
138141 newValue = std::ceil (newValue / interval) * interval;
139- setValue (std::clamp (newValue, minValue, maxValue));
142+ newValue = std::clamp (newValue, minValue, maxValue);
143+ valueChanged = !approximatelyEqual (newValue, value);
144+ setValue (newValue);
140145 }
141- onValueChange ();
146+
147+ if (valueChanged) onValueChange ();
142148 }
143149
144150 void mouseUp (MouseEvent const & e) override
0 commit comments