2
\$\begingroup\$

When scale is modulated, the item scales from the top-left corner. I tried changing anchors preset to "center" but it still scaled from the top-left corner. How do I make it scale from center?

Layout settings

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

Assuming you are scaling with scale, what you need to do is set the pivot_offset to the center of the Control, i.e. to half of size (which is the size of the Control before scaling).

In general the Control will scale and rotate keeping the point specified by pivot_offset in place. So when the pivot_offset is Vector2(0, 0) (which is the default) scale and rotation will keep the top left corner in place.

Thus - to reiterate - change pivot_offset to the center or whatever position you want to keep fixed during scaling and rotation.

\$\endgroup\$
2
  • \$\begingroup\$ So if I change size, I'll have to change pivot_offset every-time? \$\endgroup\$
    – Seph Reed
    Jul 9, 2023 at 0:21
  • \$\begingroup\$ @SephReed If you change the size? yes. If you change the scale of the Control? no. \$\endgroup\$
    – Theraot
    Jul 9, 2023 at 0:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .