[kovarex] [1.0.0] Setting certain elements to stretch leads to weird results

Things that we don't consider worth fixing at this moment.
Post Reply
User avatar
Therenas
Factorio Staff
Factorio Staff
Posts: 232
Joined: Tue Dec 11, 2018 2:10 pm
Contact:

[kovarex] [1.0.0] Setting certain elements to stretch leads to weird results

Post by Therenas »

Sorry for the bad title, the situation is somewhat complex to explain in words. So, to save me a thousand words, a picture:

Image

I'm not going to try and explain the exact situation in words, as it requires a somewhat particular setup to exhibit this behavior. The attached mod creates both the problematic top version and the 'working' bottom one.

In very rough terms though, the difference between those two setups is that in the upper frame, the button is set to horizontally stretch, while it is not in the bottom one. For some reason, telling the button on top (which is in a different flow altogether than the table) to stretch makes the scroll pane that the table is in not stretch correctly. In essence, the top frame's table/scrollpane should stretch the same way the bottom one does, while still allowing me to set the button on the left to stretch.

Please feel free to ask any questions, the code should explain it somewhat well though.
Attachments
test.zip
(2.11 KiB) Downloaded 79 times

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [1.0.0] Setting certain elements to stretch leads to weird results

Post by kovarex »

We have a special tool to calculate the distribution of squash sizes between individual items, as some of them are squashable and some of them have some minimal sizes.
And I was thinking, well, maybe we should have this also for stretching, but we will probably never need that ....
And yes, we are avoiding this in the base game gui, but it was only question of time until someone would encounter it in the mod gui.

Just to explain the problem. The layouting algorithm figures the size available for stretching and evenly (naivly) distributes it between the two elements. But the algorithm doesn't account for the maximum size of the button, so it gets stretched much less than it was planned.

The fact that the button is in completely different flow and still affected by the logic is a feature specifically designed to work like that, so that the stretching works regardless of layouting structure.

But, it also depends what you need to do, if you don't want to stretch the button to fill the size of frame, but you only want to stretch it to fill the space relative to some other things that might be added into the flow, you might just mark the flow to not be stretchable, so the "stretching property" wont "leak" outside the flow.

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

Re: [kovarex] [1.0.0] Setting certain elements to stretch leads to weird results

Post by Therenas »

Thanks for the explanations, that's interesting! I (and Raiguard too) actually ran into this before several times, but always worked around it somehow. I just got the motivation to write a reproduction this time.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [kovarex] [1.0.0] Setting certain elements to stretch leads to weird results

Post by kovarex »

To be honest, I think it is not worth it, and almost always when this happens, you actually want some different behaviour, so I'm moving it to won't fix for now.

Post Reply

Return to “Won't fix.”