PR: Added lambdas valueToProportionOfLengthFunction to Slider

I was about to propose this PR to have lambdas on Slider to change the proportionToValue behaviour without inheriting:

However, now I am confused, since the interacting with the Slider (LinearVertical) is reacting correctly, but is drawing the knob wrong. I am setting it like this:

Slider slider (Slider::LinearHorizontal, Slider::TextBoxLeft);
// setting attachment and then:
slider.valueToProportionOfLengthFunction = [range = timeSlider.getNormalisableRange()](double value) { return 1.0 - range.convertTo0to1 (value); };
slider.proportionOfLengthToValueFunction = [range = timeSlider.getNormalisableRange()](double proportion) { return range.convertFrom0to1 (1.0 - proportion); };

I wonder, if that’s on my end or in the Slider?
Debugging also raised some questions about the architecture, how come, that values like sliderRegionStart conversions etc. are not handled in LookAndFeel?

Or maybe it’s just too late at night for that questions…

1 Like