Skip to content

Commit

Permalink
HSliderFilled can have skinny paint zone and broad hit zone (#118)
Browse files Browse the repository at this point in the history
verticalReduction is a settable member so you can distinguish
active zone from paint zone, making up for the lack of a handle
hit zone while still keeping a gutter-only look
  • Loading branch information
baconpaul authored Aug 29, 2024
1 parent 73f8c0d commit 22a0715
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/sst/jucegui/components/HSliderFilled.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ struct HSliderFilled : public HSlider
HSliderFilled();

void paint(juce::Graphics &g) override;
int verticalReduction{0}; // if you want the paint zone smaller than the hit zone set this
// to pixels to reduce vertically (both sids, so '1' takes 1 off top and bottom)

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(HSliderFilled);
};
Expand Down
4 changes: 2 additions & 2 deletions src/sst/jucegui/components/HSliderFilled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ void HSliderFilled::paint(juce::Graphics &g)
return;

// Gutter
auto b = getLocalBounds();
auto b = getLocalBounds().reduced(0, verticalReduction);
auto o = b.getHeight() - gutterheight;

auto r = getLocalBounds().toFloat();
auto r = getLocalBounds().reduced(0, verticalReduction).toFloat();
auto rectRad = 5;

if (isHovered)
Expand Down

0 comments on commit 22a0715

Please sign in to comment.