From 1cb2d8143e32df4ebe6c3dca9f0a81934359224f Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 4 Oct 2017 09:31:37 +0100 Subject: [PATCH] Fixed an assertion when enabling the popup display with a two-value slider and disabled the popup display when using an IncDec slider --- .../juce_gui_basics/widgets/juce_Slider.cpp | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/juce_gui_basics/widgets/juce_Slider.cpp b/modules/juce_gui_basics/widgets/juce_Slider.cpp index 5b40afb9c4..5c7aaa0ca5 100644 --- a/modules/juce_gui_basics/widgets/juce_Slider.cpp +++ b/modules/juce_gui_basics/widgets/juce_Slider.cpp @@ -953,9 +953,12 @@ public: void mouseMove() { + auto isTwoValue = (style == TwoValueHorizontal || style == TwoValueVertical); + auto isThreeValue = (style == ThreeValueHorizontal || style == ThreeValueVertical); + if (showPopupOnHover - && style != TwoValueHorizontal - && style != TwoValueVertical) + && ! isTwoValue + && ! isThreeValue) { if (owner.isMouseOver (true)) { @@ -975,11 +978,23 @@ public: void showPopupDisplay() { + if (style == IncDecButtons) + return; + if (popupDisplay == nullptr) { popupDisplay = new PopupDisplayComponent (owner); - updatePopupDisplay (getValue()); + if (style == SliderStyle::TwoValueHorizontal + || style == SliderStyle::TwoValueVertical) + { + updatePopupDisplay (sliderBeingDragged == 2 ? getMaxValue() + : getMinValue()); + } + else + { + updatePopupDisplay (getValue()); + } if (parentForPopupDisplay != nullptr) parentForPopupDisplay->addChildComponent (popupDisplay);