|Topic was automatically imported from the old Question2Answer platform.
i´m feeling dumb, but i cannot place a simple panel at the bottom left of the screen.
I´m using a Control node (simple control, no container or anything), and i resize it every time with
$Control.rect_size=OS.get_real_window_size() so that it is always of the same dimension of the screen.
Now, as a children of this control there is a 100x100 pixel panel.
In the editor of this panel, I set Top and Bottom anchor=1 while left and right =0. Doing so the anchor of the panel is at the bottom left of the screen.
Then i set the margins to 0 for left and bottom, Top=-100, Right=100.
Now if I look to the vertical positioning only, the panel bottom should lay at the bottom of the screen (0 pixel from the anchor) while the top of the panel should be 100 pixel above (-100 from the anchor).
BUT IT IS NOT WORKING! >:(
Somehow the panel top is around 50 pixel above the bottom of the screen.
I´m saying around because no matter what property i track (position, anchor, margin), everything has the right value and should place the panel in the right position, but i can clearly see the panel is not a square but a rectangle.
I´m getting crazy, please help!
can it be that the get_real_windows_size() include the dimension of the window borders and this offsets everything?
That was exactly the problem, the right function is
get_window_size() without real (but this function is not displayed in the helper)
Instead of resizing your Control try using Layout → Full Rect. Layout is available in the same menu as Select Mode/Pan Mode if any Control Node is selected.
hilfazer | 2018-08-10 14:49
Thanks! I thought layout only placed the control in a position and then didnt update it in game, that’s much easier!
Andrea | 2018-08-12 14:27