Allow mods to properly center a frame

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
Therenas
Fast Inserter
Fast Inserter
Posts: 142
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Allow mods to properly center a frame

Post 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:

Image

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.

MegaMech
Burner Inserter
Burner Inserter
Posts: 12
Joined: Tue Mar 22, 2016 10:02 pm
Contact:

Re: Allow mods to properly center a frame

Post 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.

Post Reply

Return to “Modding interface requests”

Who is online

Users browsing this forum: No registered users