add offset sanity check to CompactGrid Align()

This commit is contained in:
Bradley Cicenas 2017-07-07 12:43:03 +00:00
parent 0a05007c4e
commit b88c143914
1 changed files with 5 additions and 0 deletions

View File

@ -22,9 +22,14 @@ func NewCompactGrid() *CompactGrid {
func (cg *CompactGrid) Align() {
y := cg.Y
if cg.Offset >= len(cg.Rows) {
cg.Offset = 0
}
if cg.Offset < 0 {
cg.Offset = 0
}
// update row ypos, width recursively
for _, r := range cg.pageRows() {
r.SetY(y)