Page 1 of 1

[raiguard][1.1.80] Layout bug with nested frames and stretching

Posted: Thu Apr 13, 2023 6:13 pm
by BiterUnion
I have already posted this in Modding help (viewtopic.php?f=25&t=105879), but it did not get any answers and might be bug, so I am reposting here. Please feel free to delete this post, if that is not allowed.

I have two nested frames (outer_frame and inner_frame) and am trying to understand how horizontally_stretchable changes the layout, when setting it on inner_frame:

Code: Select all

local window = player.gui.screen.add {
    type = 'frame'
}
window.style.size = 150
window.force_auto_center()

local outer_frame = window.add {
    type = 'frame',
    style = 'inside_shallow_frame_with_padding'
}
outer_frame.style.horizontally_stretchable = true
outer_frame.style.vertically_stretchable = true

local inner_frame = outer_frame.add {
    type = 'frame',
    style = 'deep_frame_in_shallow_frame'
}
inner_frame.style.natural_width = 50
inner_frame.style.maximal_width = 70
inner_frame.style.horizontally_stretchable = true  -- this is the line I am talking about
inner_frame.style.vertically_stretchable = true
Without setting inner_frame.style.horizontally_stretchable = true, the frames look as I would expect it:

Image

The inner frame has its natural width and stretches vertically and the outer frame completely fills the window. However, when I set inner_frame.style.horizontally_stretchable = true, it looks like this:

Image

The inner frame behaves as expected (it stretches to its maximal width), but the outer frame no longer stretches to the full width of the window. I would expect for the outer frame to stay the same (i.e. fill the window completely), as I have only changed the stretching behavior of the inner frame. What's also making me think this might be a bug is that I can add direction = 'vertical' to the outer frame, and that causes the outer frame to completely fill the window again.

Re: [1.1.80] Layout bug with nested frames and stretching

Posted: Mon May 01, 2023 8:30 pm
by raiguard
Might be related to 100896.