Skip to content

Commit

Permalink
Formatting cleanups in drawRotarySliderBase
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseDiazRohena committed Jan 5, 2024
1 parent a30da39 commit 6909cfa
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions libs/tote_bag/juce_gui/lookandfeel/LookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,23 +125,21 @@ void LookAndFeel::drawRotarySliderBase (juce::Graphics& g,
{
const auto centreX = bounds.getCentreX();
const auto centreY = bounds.getCentreY();
const auto rx = centreX - radius;
const auto ry = centreY - radius;
const auto rw = radius * 2.0f;

auto rx = centreX - radius;
auto ry = centreY - radius;
auto rw = radius * 2.0f;

// Fill main knob area
auto fillColour = findColour (juce::Slider::backgroundColourId);
g.setColour (fillColour);
g.setColour (findColour (juce::Slider::backgroundColourId));
g.fillEllipse (rx, ry, rw, rw);

// Pointer
juce::Path p;
auto pointerLength = radius * 0.33f;
auto pointerThickness = pointerLength * .2f;
const auto pointerLength = radius * 0.33f;
const auto pointerThickness = pointerLength * .2f;
const auto pointerX = -pointerThickness * 0.5f;
const auto pointerY = juce::roundToInt (juce::jmax ((rw * .05f), 1.0f)) - radius;
auto cornerSize = pointerThickness * .35f;
p.addRoundedRectangle (-pointerThickness * 0.5f,
const auto cornerSize = pointerThickness * .35f;

p.addRoundedRectangle (pointerX,
pointerY,
pointerThickness,
pointerLength,
Expand All @@ -151,12 +149,12 @@ void LookAndFeel::drawRotarySliderBase (juce::Graphics& g,
true,
true,
true);

p.applyTransform (
juce::AffineTransform::rotation (toAngle).translated (bounds.getCentreX(),
bounds.getCentreY()));

auto pointerColour = findColour (juce::Slider::thumbColourId);
g.setColour (pointerColour);
g.setColour (findColour (juce::Slider::thumbColourId));
g.fillPath (p);
}

Expand Down

0 comments on commit 6909cfa

Please sign in to comment.