Path, DrawablePath Usage


Hi Jules,

When moving from 1.46 to the tip, some stuff stopped working.
I am wondering if the problem is in my code or in the new implementation.

I used to do this to draw a little arrow in a button like a prev/next button.
The following code being the previous one.

const float sqrt3div2 = sqrt(3.f)/2.f;

juce::Path triangleClosed;
triangleClosed.addTriangle(-0.5, -sqrt3div2, 1, 0, -0.5, sqrt3div2);

juce::DrawablePath triangle;

juce::DrawableComposite normal;

juce::DrawableButton *pButton = new juce::DrawableButton("next", juce::DrawableButton::ImageOnButtonBackground);
pButton->setImages(&normal, &normal, &normal, &normal, &normal, &normal, &normal, &normal);
pButton->setBackgroundColours(juce::Colour(0xff91989B), juce::Colours::royalblue);

Any idea what is going wrong ?



For what it worth
if I use triangleClosed.applyTransform(juce::AffineTransform::scale(100.f,100.f));
instead of the 0.5f, it works fine.

Did the DrawableButton used to expand the path but now only resize it ?



The DrawableComposite now has a bounding box that marks the active area, so you need to set that appropriately to tell the button what area it should use. There’s a method to do it automatically: resetContentAreaAndBoundingBoxToFitChildren().


Works fine with that.

Thanks a lot.