Issue with DrawablePath


if parentHierarchyChanged is called after setBounds has been called on a DrawablePath/Shape it looks like it removes the custom setBounds set previously.
So there is no way to set the bounds of a DrawablePath before being in the hierarchy.

Is this a bug ?

Thanks !

Can you post an example of what you are trying to do and what isn’t working as expected?

I just use a DrawablePatth to display a path inside a widget hierarchy.
The issue in the following

I have a drawable A as a widget in another component B
I set the position of this drawable in a resized function of B that it call by its parent.
Afterward the parent of B is added in another widget hierarchy (when my plugin is shown actually)
This results in the bounds of my drawable to be changed because of the code in parentHierarchyChanged that changes those.
If my plugin is already shown and I display the widget that contains the drawable, it works fine.

I doubt that changing the order of the widget hierarchy are added should change in any way the bounds of my drawable so I think this is a bug :slight_smile:

Thanks !

The general advice for Drawable objects is to not use the Component::setBounds() methods (see here).

Instead, I’d recommend using the Drawable::setTransformToFit() method to position your child Drawable inside its parent.

oh boy…
You guy probably need to deprecate it and replace it with something similar that works with setBounds because it’s a component after all, no matter how the drawing inside has been setup.

That fixes the issue though.

Thanks !

I’d definitely love to deprecate those classes, but I think I’d replace them with some types that aren’t Components at all.


Well a component that hold stuff like that would be great for easily placing an SVG or a shape inside a widget hierarchy but you need to define how the shape/svg react to component bounding changes using dedicated methods and set the shape default bounding box.
I though it was the case and the default was to topLeft placement with same size as your original shape.