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 c68c7ce commit 6f6bb3e
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 @@ -140,7 +140,7 @@ void LookAndFeel::drawRotarySliderBase (juce::Graphics& g,

// Increasing this value will cause the pointer to be drawn closer
// to the center of the slider.
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 6f6bb3e

Please sign in to comment.