1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Slider: Ensure that current Value is always treated as a double

This commit is contained in:
reuk 2021-10-18 16:03:19 +01:00
parent 05c2261efe
commit 7f0a305199
No known key found for this signature in database
GPG key ID: 9ADCD339CFC98A11

View file

@ -191,9 +191,10 @@ public:
lastCurrentValue = newValue;
// (need to do this comparison because the Value will use equalsWithSameType to compare
// the new and old values, so will generate unwanted change events if the type changes)
if (currentValue != newValue)
// Need to do this comparison because the Value will use equalsWithSameType to compare
// the new and old values, so will generate unwanted change events if the type changes.
// Cast to double before comparing, to prevent comparing as another type (e.g. String).
if (static_cast<double> (currentValue.getValue()) != newValue)
currentValue = newValue;
updateText();