Address review comments.

This commit is contained in:
Gunnsteinn Hall 2018-08-14 17:57:26 +00:00
parent d5fc69b21b
commit 036ab51b79
2 changed files with 8 additions and 8 deletions

View File

@ -207,7 +207,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext,
newh += 0.5 * p.fontSize * p.lineHeight // TODO: Make the top margin configurable?
if newh > h {
diffh := newh - h
// Add diff to last row
// Add diff to last row.
table.rowHeights[cell.row+cell.rowspan-2] += diffh
}
case *Image:
@ -215,7 +215,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext,
newh := img.Height() + img.margins.top + img.margins.bottom
if newh > h {
diffh := newh - h
// Add diff to last row
// Add diff to last row.
table.rowHeights[cell.row+cell.rowspan-2] += diffh
}
case *Division:
@ -238,7 +238,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext,
newh := ctx.Height - h
if newh > h {
diffh := newh - h
// Add diff to last row
// Add diff to last row.
table.rowHeights[cell.row+cell.rowspan-2] += diffh
}
}
@ -249,7 +249,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext,
// Get available width and height.
if newh > h {
diffh := newh - h
// Add diff to last row
// Add diff to last row.
table.rowHeights[cell.row+cell.rowspan-2] += diffh
}
}
@ -394,9 +394,9 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext,
// Relative mode.
// Move back X after.
ctx.X = origCtx.X
// Return original width
// Return original width.
ctx.Width = origCtx.Width
// Add the bottom margin
// Add the bottom margin.
ctx.Y += table.margins.bottom
return blocks, ctx, nil

View File

@ -83,7 +83,7 @@ func TestTableWithImage(t *testing.T) {
pageHistoryTable.SkipCells(1)
// Add image
// Add image.
imgData, err := ioutil.ReadFile(testImageFile1)
if err != nil {
t.Errorf("Fail: %v\n", err)
@ -195,7 +195,7 @@ func TestTableWithDiv(t *testing.T) {
pageHistoryTable.SkipCells(1)
// Add image
// Add image.
imgData, err := ioutil.ReadFile(testImageFile1)
if err != nil {
t.Errorf("Fail: %v\n", err)