mirror of https://github.com/rivo/tview.git
Drawing the Box in Modal, not in contained Frame. Fixes #946
This commit is contained in:
parent
9c17885289
commit
e804876934
7
modal.go
7
modal.go
|
@ -32,7 +32,7 @@ type Modal struct {
|
||||||
// NewModal returns a new modal message window.
|
// NewModal returns a new modal message window.
|
||||||
func NewModal() *Modal {
|
func NewModal() *Modal {
|
||||||
m := &Modal{
|
m := &Modal{
|
||||||
Box: NewBox(),
|
Box: NewBox().SetBorder(true).SetBackgroundColor(Styles.ContrastBackgroundColor),
|
||||||
textColor: Styles.PrimaryTextColor,
|
textColor: Styles.PrimaryTextColor,
|
||||||
}
|
}
|
||||||
m.form = NewForm().
|
m.form = NewForm().
|
||||||
|
@ -46,8 +46,7 @@ func NewModal() *Modal {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
m.frame = NewFrame(m.form).SetBorders(0, 0, 1, 0, 0, 0)
|
m.frame = NewFrame(m.form).SetBorders(0, 0, 1, 0, 0, 0)
|
||||||
m.frame.SetBorder(true).
|
m.frame.SetBackgroundColor(Styles.ContrastBackgroundColor).
|
||||||
SetBackgroundColor(Styles.ContrastBackgroundColor).
|
|
||||||
SetBorderPadding(1, 1, 1, 1)
|
SetBorderPadding(1, 1, 1, 1)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
@ -183,6 +182,8 @@ func (m *Modal) Draw(screen tcell.Screen) {
|
||||||
m.SetRect(x, y, width, height)
|
m.SetRect(x, y, width, height)
|
||||||
|
|
||||||
// Draw the frame.
|
// Draw the frame.
|
||||||
|
m.Box.DrawForSubclass(screen, m)
|
||||||
|
x, y, width, height = m.GetInnerRect()
|
||||||
m.frame.SetRect(x, y, width, height)
|
m.frame.SetRect(x, y, width, height)
|
||||||
m.frame.Draw(screen)
|
m.frame.Draw(screen)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue