From 8d0a0b81fa6441d25d5c0539bdab570fe36d2a60 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Thu, 3 May 2018 15:56:06 -0700 Subject: [PATCH] Less crap display of the help modal. Just need to figure out key events now --- wtf/billboard_modal.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wtf/billboard_modal.go b/wtf/billboard_modal.go index 428a01a3..eb7dde99 100644 --- a/wtf/billboard_modal.go +++ b/wtf/billboard_modal.go @@ -5,6 +5,10 @@ import ( "github.com/rivo/tview" ) +const offscreen = -1000 +const modalWidth = 80 +const modalHeight = 22 + func NewBillboardModal(text string) *tview.Frame { textView := tview.NewTextView() textView.SetWrap(true) @@ -13,10 +17,11 @@ func NewBillboardModal(text string) *tview.Frame { textView.SetBackgroundColor(tview.Styles.ContrastBackgroundColor) 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) { 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 }