flamendless / Slab

An immediate mode GUI for the Love2D framework.
MIT License
294 stars 25 forks source link

MessageBox expands if there are more than one button #99

Closed maw3193 closed 3 years ago

maw3193 commented 3 years ago

Hi, I'm having a bit of a problem when I try to use the FileDialog to in "savefile" mode - the confirm overwrite dialog expands until it goes off the edge of the screen. From trying to find the root cause, it seems to be every MessageBox, and it seems to only happen when the buttons are aligned to the bottom-right.

The specific issue is: When I create a MessageBox with more than one button, the messagebox constantly expands, moving the buttons off the side of the screen (as seen in the below gif) expand

I see this every time when I run love on https://github.com/maw3193/slab-test/tree/messagebox-multi-button.

This is on Ubuntu 21.04, running love 11.3, with Slab master as of September 14th (commit 938aea04dc8cbcc638b1e0831747a308bebe2b5f)

flamendless commented 3 years ago

Hi. Thanks for reporting this. I'll get this fixed as soon as i can.

flamendless commented 3 years ago

Hi, this has been fixed now in the latest commit @maw3193

Please let me know if the patch breaks other things.

maw3193 commented 3 years ago

That works, thanks!

I'll have a look and see if anything else crops up.

flamendless commented 3 years ago

It seems that there is regression with the patch. A simple

    Slab.BeginWindow("test", {
        Title = "Test",
    })
    Slab.Text("test")
    Slab.Button("test")
    Slab.Button("test test test")
    Slab.EndWindow()

will show the problem with the fix. If button width exceeds the window's width, the window's width should stretch as well to compensate for the space.

EDIT: latest patch should fix this regression