fixed RemoveViews again
This commit is contained in:
parent
6acfa615db
commit
24c4d68b0c
@ -62,8 +62,8 @@ func TestScrollView(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
screen.MouseClicked = func(event *tui.MouseEvent) (consumed bool) {
|
screen.MouseClicked = func(event *tui.MouseEvent) (consumed bool) {
|
||||||
textViews[0].(*views.TextView).Text = fmt.Sprintf("mouse position: %d | %d", event.X, event.Y)
|
//textViews[0].(*views.TextView).Text = fmt.Sprintf("mouse position: %d | %d", event.X, event.Y)
|
||||||
textViews[1].(*views.TextView).Text = fmt.Sprintf("mouse button: %d", event.Button)
|
//textViews[1].(*views.TextView).Text = fmt.Sprintf("mouse button: %d", event.Button)
|
||||||
|
|
||||||
if event.Button == tui.MouseWheelUp {
|
if event.Button == tui.MouseWheelUp {
|
||||||
scrollView.Scroll(-1, 0)
|
scrollView.Scroll(-1, 0)
|
||||||
|
@ -24,7 +24,7 @@ func NewFlowLayout(orientation tui.Orientation) *FlowLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *FlowLayout) Views() []tui.View {
|
func (g *FlowLayout) Views() []tui.View {
|
||||||
return g.views[:]
|
return g.views
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *FlowLayout) AppendViews(v ...tui.View) {
|
func (g *FlowLayout) AppendViews(v ...tui.View) {
|
||||||
@ -49,7 +49,11 @@ func (g *FlowLayout) removeView(v tui.View) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *FlowLayout) RemoveViews(v ...tui.View) {
|
func (g *FlowLayout) RemoveViews(v ...tui.View) {
|
||||||
|
views := make([]tui.View, 0, len(v))
|
||||||
for _, view := range v {
|
for _, view := range v {
|
||||||
|
views = append(views, view)
|
||||||
|
}
|
||||||
|
for _, view := range views {
|
||||||
g.removeView(view)
|
g.removeView(view)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user