Page 1 of 1

Allow mods to properly center a frame

Posted: Sun Dec 01, 2019 4:59 pm
by Therenas
Currently, when using auto_center or force_auto_center() on frames, it centers it vertically between the top of the screen and the top of your quickbar. This is weird. Now it probably is that way so it doesn't overlap with the quickbar, which is fair, but that is not a good solution for every use. For very large windows that are supposed to take over the screen, it produces wierd results. The window will be glued to the top, like in this example:


So I'd like a way to tell it to center it in the 'true' center of the screen.

As a side note, you can, as a modder, make it center the frame properly yourself with a bit of math, but only if you know the height and width of your frame, which you don't always (due to automatic stretching and such). So short of this request being implemented (which is unlikely), we can't solve this ourselves.

Re: Allow mods to properly center a frame

Posted: Mon Dec 16, 2019 9:34 pm
by MegaMech
style="margin-top: %hotbar_heighth%";

It would be nice if there was a wiki-page with the default sizings of all elements, or a debug that shows sizings of all elements in-game. Can also check style.lua under core or whatever. I just guessed with my mod until I got it kinda where I wanted it. I think if you input the same value that they used for hotbar heighth the size of a players UI will be irrelevant.
At this point you might as well take up the entire screen and not worry about centering it.