Slider background issue

Hey there, how are you?
So, I’m working on my own Look and Feel classes and have a bit of an issue with the linear vertical slider background.
I copied the entire drawLinearSliderBackground() function over and modified a few things with the intention of having a color fill the slider background from the bottom up to the thumb. Basically, I simply copied the way juce does it and added a second path and addRoundedRectangle function.

This all works well, with the exception that the new rectangle that’s being drawn extends further down than the original one, which means that when the thumb reaches the end of the slider, you can still see the bottom part of the new rectangle.

The images below show the problem:
slider background

and here’s part of the code I’m using:

        g.setGradientFill(ColourGradient::horizontal(gradCol1, ix, gradCol2, ix + iw));


        VerticalSliderValueFill.addRoundedRectangle(ix, sliderPos,
            iw, (float)height + sliderRadius * 2,
            0.0f);    
        //juce
        indent.addRoundedRectangle(ix, (float)y - sliderRadius * 0.5f,
            iw, (float)height + sliderRadius,
            0.0f);
    }

    g.fillPath(indent);
    g.strokePath(indent, PathStrokeType(0.5f));

    g.setColour(enabledColour.darker(0.7));
    g.fillPath(VerticalSliderValueFill);
    g.strokePath(VerticalSliderValueFill, PathStrokeType(0.5f));

when using the sliderPos variable in the VerticalSliderValueFill.addRoundedRectangle function, the rectangle fills from the bottom up to the thumb but is longer than the indent rectangle.

Does anyone know what may be causing this behavior?

I vaguely remember having a similar problem at some point. Implementing getSliderThumbRadius() fixed it for me. In my case the slider ‘thumb’ had a height of 1 pixel.

int SliderLookAndFeel::getSliderThumbRadius (juce::Slider& slider)

{

return 1;

}

Thanks! Sorry for the delay, gonna try that!