Hi guys,
I have a custom slider class that uses a filmstrip skin. The slider can be created and used just fine, however, the mouse dragging direction is currently horizontal, how can I change this to vertical?
My custom slider class can be seen below.
Thanks! ![]()
class Knob : public juce::Slider
{
public:
Knob(juce::Image stripToShow)
: filmStrip(stripToShow)
{
//Assumes square frames
filmStripWidth = filmStrip.getWidth();
numFrames = filmStrip.getHeight() / filmStripWidth;
}
void paint(juce::Graphics &g) override
{
std::size_t imageNumber = static_cast<std::size_t>(0.5 + (getValue() - getMinimum()) / (getMaximum() - getMinimum()) * (numFrames - 1));
g.drawImage(filmStrip, 0, 0, filmStripWidth, filmStripWidth, 0, imageNumber * filmStripWidth, filmStripWidth, filmStripWidth);
}
std::size_t getFilmStripWidth() { return filmStripWidth; }
private:
std::size_t numFrames, filmStripWidth;
juce::Image filmStrip;
};
