Drawables and SVGs

If I have a drawable with an SVG in it, what are the steps to have it render, fitted, but with it’s original proportions within a specific area of a component?

I was doing this:

    // constructor
    addAndMakeVisible(logoArea);

    // resized
auto area = getLocalBounds().reduced(10);
auto logoArea = area.removeFromRight(200);
logo->setTransformToFit(logoArea.toFloat(), RectanglePlacement::xRight | RectanglePlacement::yMid);
logo->setBounds(logoArea);

But that ain’t right :slight_smile: As it ends up partially off screen to the right!

Does adding logoArea.withZeroOrigin().toFloat() help when calling setTransformToFit?

1 Like