Make device panel scrollable

Previous panel caused main window to resize when device panel was enabled so if the vertical resolution wasn't big enough you'd lose visibility of the toolbar and the text would be noticeably distorted.
This commit is contained in:
Chris Green 2023-10-25 11:26:23 +10:00 committed by GitHub
parent c1d25536a3
commit 33b4a3f88c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -14,17 +14,20 @@ type panelDevices struct {
func newPanelDevices(s *state) *panelDevices {
var pd panelDevices
pd.s = s
pd.w = container.NewVBox()
pd.w = container.NewMax()
c := container.NewVBox()
pd.joystick = newPanelJoystick()
pd.w.Add(pd.joystick.w)
c.Add(pd.joystick.w)
var cards = s.a.GetCards()
for i, card := range cards {
if card != nil && card.GetName() != "" {
pd.w.Add(newPanelCard(i, card).w)
c.Add(newPanelCard(i, card).w)
}
}
pd.w.Add(container.NewVScroll(c))
return &pd
}