Make LuaStyle.height/width readable

Things that we aren't going to implement
Post Reply
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Make LuaStyle.height/width readable

Post by Therenas »

Currently, you can't read the actual width and height of a GuiElement. With the addition of moveable windows, it would be useful to know the actual sizes of your GuiElements (after stretching, squashing etc, which you can not really predict easily) to be able to set the .location of your windows properly. The LuaStyle.height/width attributes would be a perfect fit for this, as they are currently read only.

Now I don't know for sure how difficult this would be, but that data has to be available somewhere internally, to do auto_center and similar, and to display the size in the Ctrl-F6-debug mode. I would be fine with it only being available on frames, but all Elements would be cool.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13204
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Make LuaStyle.height/width readable

Post by Rseding91 »

That information is not likely to ever be exposed. It's not deterministic which means you can't just read it from Lua. The game would have to detect every time it changed and send an event into the game with what element changed and what the new width/height are.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

Re: Make LuaStyle.height/width readable

Post by Therenas »

Alright, that is a bit sad to hear, but understandable.

Edit: Just realised I can use a combination of auto_center and .location read to get it to behave how I want (probably)

Post Reply

Return to “Won't implement”