fixed dimension point logic
This commit is contained in:
parent
542d5badbf
commit
67b65231fa
@ -137,7 +137,10 @@ func TestFlowLayout(t *testing.T) {
|
||||
textView := views.NewTextView("hello world!")
|
||||
textView.SetStyle(tui.StyleDefault.Background(tcell.ColorRed).Foreground(tcell.ColorBlack))
|
||||
|
||||
marginView := views.NewMarginView(textView, 3, 1, 1, 0)
|
||||
textView.MouseEvent = func(event *tui.MouseEvent) (consumed bool) {
|
||||
textView.Text = "hi"
|
||||
return true
|
||||
}
|
||||
|
||||
//borderView := views.NewBorderView(textView)
|
||||
|
||||
@ -151,27 +154,14 @@ func TestFlowLayout(t *testing.T) {
|
||||
growView2.SetStyle(tui.StyleDefault.Background(tcell.ColorYellow))
|
||||
|
||||
flowLayout := views.NewFlowLayout(tui.Vertical)
|
||||
flowLayout.AppendViews(marginView, growView, textView2)
|
||||
flowLayout.AppendViews(textView, growView, textView2)
|
||||
|
||||
constrainView := views.NewConstrainView(flowLayout, -1, -1)
|
||||
constrainView.SetStyle(tui.StyleDefault.Background(tcell.ColorPurple))
|
||||
|
||||
screen, err := tui.NewScreen(constrainView)
|
||||
screen, err := tui.NewScreen(flowLayout)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
screen.KeyPressed = func(event *tui.KeyEvent) (consumed bool) {
|
||||
textView.Text = event.When().String()
|
||||
|
||||
if event.Key() == tcell.KeyCtrlC {
|
||||
screen.StopWithError(errors.New(fmt.Sprintf("key: %#v | rune: %s", event.Key(), string(event.Rune()))))
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
err = screen.Start()
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user