Skip to content

Commit

Permalink
Fix VSlider ContMod (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul authored Oct 12, 2023
1 parent 2b9342e commit 1b56269
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/sst/jucegui/components/VSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ void VSlider::paint(juce::Graphics &g)

auto hr = juce::Rectangle<float>(2 * hanRadius, 2 * hanRadius).withCentre(hc);

auto mvplus = std::clamp(v + continuousModulatable()->getModulationValuePM1(), 0.f, 1.f);
auto mvminus = std::clamp(v - continuousModulatable()->getModulationValuePM1(), 0.f, 1.f);
auto hm = (1.0 - mvplus) * gutter.getHeight();
auto mpc = gutter.withTrimmedTop(hm).withHeight(1).expanded(0, 4).getCentre();
auto mpr = juce::Rectangle<float>(2 * hanRadius, 2 * hanRadius).withCentre(mpc);
juce::Point<float> mpc;
juce::Rectangle<float> mpr;

if (isEditingMod)

if (continuousModulatable() && isEditingMod)
{
auto mvplus = std::clamp(v + continuousModulatable()->getModulationValuePM1(), 0.f, 1.f);
auto mvminus = std::clamp(v - continuousModulatable()->getModulationValuePM1(), 0.f, 1.f);
auto hm = (1.0 - mvplus) * gutter.getHeight();
mpc = gutter.withTrimmedTop(hm).withHeight(1).expanded(0, 4).getCentre();
mpr = juce::Rectangle<float>(2 * hanRadius, 2 * hanRadius).withCentre(mpc);

// draw rules
{
auto t = hc.getY();
Expand Down

0 comments on commit 1b56269

Please sign in to comment.