Skip to content

Commit

Permalink
Use radius instead of rw when defining sliderEdgeOffset
Browse files Browse the repository at this point in the history
A sliderEdgeOffset greater than radius will cause the pointer
to draw incorrectly. Using radius instead of radius * 2, which
is how we get rw, makes the reasonable bounds of the offset
more clear.

We could clip it at sliderEdgeOffset > radius, but that seems
excessive, as the condition could only obtain due to coder error.
  • Loading branch information
JoseDiazRohena committed Jan 6, 2024
1 parent 7edab72 commit 681da5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/tote_bag/juce_gui/lookandfeel/LookAndFeel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void LookAndFeel::drawRotarySliderBase (juce::Graphics& g,
const auto pointerThickness = radius * .066f;
const auto pointerX = -pointerThickness * 0.5f;
const auto initialPointerY = -radius;
const auto sliderEdgeOffset = juce::roundToInt (juce::jmax ((rw * .05f), 1.0f));
const auto sliderEdgeOffset = juce::roundToInt (juce::jmax ((radius * .1f), 1.0f));
const auto pointerY = initialPointerY + sliderEdgeOffset;

const auto cornerSize = pointerThickness * .35f;
Expand Down

0 comments on commit 681da5e

Please sign in to comment.