1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Less crap display of the help modal. Just need to figure out key events now

This commit is contained in:
Chris Cummer 2018-05-03 15:56:06 -07:00
parent 351f5100bc
commit 8d0a0b81fa

View File

@ -5,6 +5,10 @@ import (
"github.com/rivo/tview" "github.com/rivo/tview"
) )
const offscreen = -1000
const modalWidth = 80
const modalHeight = 22
func NewBillboardModal(text string) *tview.Frame { func NewBillboardModal(text string) *tview.Frame {
textView := tview.NewTextView() textView := tview.NewTextView()
textView.SetWrap(true) textView.SetWrap(true)
@ -13,10 +17,11 @@ func NewBillboardModal(text string) *tview.Frame {
textView.SetBackgroundColor(tview.Styles.ContrastBackgroundColor) textView.SetBackgroundColor(tview.Styles.ContrastBackgroundColor)
thing := tview.NewFrame(textView) thing := tview.NewFrame(textView)
thing.SetRect(offscreen, offscreen, modalWidth, modalHeight) // First draw it offscreen and then reposition below
drawFunc := func(screen tcell.Screen, x, y, width, height int) (int, int, int, int) { drawFunc := func(screen tcell.Screen, x, y, width, height int) (int, int, int, int) {
w, h := screen.Size() w, h := screen.Size()
thing.SetRect((w/2)-40, (h/2)-11, 80, 22) thing.SetRect((w/2)-(width/2), (h/2)-(height/2), width, height)
return x, y, width, height return x, y, width, height
} }