Can I move the anchor point of a component?

I looked into “centre” (setCentre…) but it’s miles away from what I need if I understood clearly. I could write down a transform matrix just for that and use just that for everything, but I would have to replace everything that is related to graphics and I’m already deep in. Any idea on how to move the anchor point, it may be silly, but I thought it was a common thing to have in a graphics api almost forgetting it’s an audio api first

what do you mean by anchor point? the x/y of the upper left corner? setBounds will give you access to that…

1 Like

Adding to that, have a look at the Rectangle class. It offers a lot of those geometric modifications you seem to be after.

1 Like

Maybe I should have asked if there is a way to move a component with just an x and a y value, relative to the component’s own center without having to add or substract an anchor point each time. If I setBounds with a negative value, I end up with the same problem, I’d have to each time account for the anchor point, or did I miss a setBounds overload?

I’ll look if the rectangle class can help me in some ways, or maybe the positioner class?

Since the juce components hierarchy doesn’t actively maintain a layout, there is no such thing like an anchor.
In the resized() callback you figure out the placement of the children and call setBounds(). Setting a child component outside it’s parent area will result in the child being cropped.

Hope that helps.

1 Like

Yes it does, thanks a lot!