Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grid items can be cleared after the given index #802

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions grid.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@ func (g *Grid) Clear() *Grid {
return g
}

// ClearAfter removes all items starting with the given index.
func (g *Grid) ClearAfter(index int) *Grid {
if len(g.items) <= index {
return g
}
g.items = g.items[:index]
return g
}

// SetOffset sets the number of rows and columns which are skipped before
// drawing the first grid cell in the top-left corner. As the grid will never
// completely move off the screen, these values may be adjusted the next time
Expand Down