Drawing the Box in Modal, not in contained Frame. Fixes #946

This commit is contained in:
Oliver 2024-03-07 18:33:18 +01:00
parent 9c17885289
commit e804876934
1 changed files with 4 additions and 3 deletions

View File

@ -32,7 +32,7 @@ type Modal struct {
// NewModal returns a new modal message window.
func NewModal() *Modal {
m := &Modal{
Box: NewBox(),
Box: NewBox().SetBorder(true).SetBackgroundColor(Styles.ContrastBackgroundColor),
textColor: Styles.PrimaryTextColor,
}
m.form = NewForm().
@ -46,8 +46,7 @@ func NewModal() *Modal {
}
})
m.frame = NewFrame(m.form).SetBorders(0, 0, 1, 0, 0, 0)
m.frame.SetBorder(true).
SetBackgroundColor(Styles.ContrastBackgroundColor).
m.frame.SetBackgroundColor(Styles.ContrastBackgroundColor).
SetBorderPadding(1, 1, 1, 1)
return m
}
@ -183,6 +182,8 @@ func (m *Modal) Draw(screen tcell.Screen) {
m.SetRect(x, y, width, height)
// Draw the frame.
m.Box.DrawForSubclass(screen, m)
x, y, width, height = m.GetInnerRect()
m.frame.SetRect(x, y, width, height)
m.frame.Draw(screen)
}