FR: make the bubble component used for the Slider::popup display customizable

Right now we can only override its “paint” function but we have almost no control over its size or layout. A simple

Rectangle<int> getSliderPopupLayout (Slider&)

callback in the LAF would be enough. It could return a “Rectangle” relative to its Slider.

We would like to make the popup display a minimum width to make it visually more stable in case of drastic value changes. Right now the popup changes it’s width dramatically and that simply looks ugly.

+1 for this, I implemented my own options for repositioning the pop up as they are designed to show relative to the edge of the slider bounds, which if you have a large margin looks really disconnected from the control.

The bubble also has a drop shadow effect by default, which can be quite CPU-heavy. Right now I remove it in every Slider's mouseDown:

if (auto* popupDisplay = getCurrentPopupDisplay())
        popupDisplay->setComponentEffect(nullptr);

So maybe a more general createSliderPopupDisplay(Slider&) would be good. You could implement it by first calling super, and then doing your own setSize on the BubbleComponent, or remove its drop shadow.

1 Like

+1 for that! I also had to implement my own “double-click on a slider to show its TextEditor” thing but always wished it could be the PopupDisplay that would turn into a TextEditor, right in place (and positioned with more control).

1 Like