MCPcopy Create free account
hub / github.com/jerryuhoo/Fire / hitTest

Method hitTest

Source/GUI/ModulatableSlider.cpp:30–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30bool ModulatableSlider::hitTest(int x, int y)
31{
32 auto sliderBounds = getLocalBounds();
33 auto center = sliderBounds.getCentre().toFloat();
34 auto distFromCentre = juce::Point<float>((float) x, (float) y).getDistanceFrom(center);
35
36 auto outerBounds = sliderBounds.toFloat().reduced(10);
37 auto outerRadius = juce::jmin(outerBounds.getWidth(), outerBounds.getHeight()) / 2.0f;
38 float maxSliderClickableRadius = outerRadius + (outerRadius * 0.2f * 0.5f);
39
40 if (distFromCentre <= maxSliderClickableRadius)
41 {
42 return true;
43 }
44
45 if (isModulated && getModulationHandleBounds().contains((float) x, (float) y))
46 {
47 return true;
48 }
49
50 return false;
51}
52
53juce::Rectangle<float> ModulatableSlider::getModulationHandleBounds()
54{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected