The dropdown popup always opens downwards from the bottom left of the button and is never
clamped or flipped:
https://github.com/ebitengine/debugui/blob/85357fb/dropdown.go#L101-L112
dropdownPos := image.Pt(bounds.Min.X, bounds.Max.Y)
The widget never reads c.screenWidth / c.screenHeight, so when the button is near the
bottom of the screen the popup runs off it.
In the first screenshot the screen is 320x240, the window is at (10,130)-(310,230) and the
dropdown has 5 options. The button ends at y=199 and the popup is 120px tall, so it is drawn
from y=199 to y=319, 79px below the screen. Only Option 1 and part of Option 2 are on
screen; Option 3 to Option 5 cannot be seen or reached, because the content fits the popup
body and there is no scrollbar to bring them into view.
The second image is the same case with the popup opened above the button instead, just to
illustrate the expected result. I am not proposing that specific approach, only that the popup
stays inside the screen somehow.
Repro, with the button near the bottom of a small window:
ctx.Window("test", image.Rect(10, 130, 310, 230), func(layout debugui.ContainerLayout) {
ctx.Text("Dropdown near the bottom")
ctx.Dropdown(&selected, []string{"Option 1", "Option 2", "Option 3", "Option 4", "Option 5"})
})
The bounds are also only computed when the popup opens, so if the parent window is moved or
scrolled while the popup is open it does not follow the button.
The dropdown popup always opens downwards from the bottom left of the button and is never
clamped or flipped:
https://github.com/ebitengine/debugui/blob/85357fb/dropdown.go#L101-L112
The widget never reads
c.screenWidth/c.screenHeight, so when the button is near thebottom of the screen the popup runs off it.
In the first screenshot the screen is 320x240, the window is at
(10,130)-(310,230)and thedropdown has 5 options. The button ends at y=199 and the popup is 120px tall, so it is drawn
from y=199 to y=319, 79px below the screen. Only
Option 1and part ofOption 2are onscreen;
Option 3toOption 5cannot be seen or reached, because the content fits the popupbody and there is no scrollbar to bring them into view.
The second image is the same case with the popup opened above the button instead, just to
illustrate the expected result. I am not proposing that specific approach, only that the popup
stays inside the screen somehow.
Repro, with the button near the bottom of a small window:
The bounds are also only computed when the popup opens, so if the parent window is moved or
scrolled while the popup is open it does not follow the button.