I'm trying to create a custom control like the one in the image below:
Basically, it is a rectangle positioned at viewport center with a label inside it. The label must be anchored at top left corner of the rectangle.
So, I've created a scene with an empty Control node and I've added a Label child node to it. I've attached a script to the control node which takes care to draw the rectangle and set its size. Here is the code:
draw_rect(Rect2(-100, -100, 200, 200), Color(0.0, 0.0, 0.0), false)
Just for sake of simplicity, in the code above the rectangle has a fixed size of 200x200, but in a real scenario it would have a dynamic size. My problem is the label node doesn't take in account the rectangle dimension, set with the set_size method, in calculating its anchorage. I guess I have to inform the label node about the real rectangle size... but how?