mirror of
https://github.com/unidoc/unipdf.git
synced 2025-04-30 13:48:51 +08:00
Address review comments.
This commit is contained in:
parent
d5fc69b21b
commit
036ab51b79
@ -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?
|
newh += 0.5 * p.fontSize * p.lineHeight // TODO: Make the top margin configurable?
|
||||||
if newh > h {
|
if newh > h {
|
||||||
diffh := newh - h
|
diffh := newh - h
|
||||||
// Add diff to last row
|
// Add diff to last row.
|
||||||
table.rowHeights[cell.row+cell.rowspan-2] += diffh
|
table.rowHeights[cell.row+cell.rowspan-2] += diffh
|
||||||
}
|
}
|
||||||
case *Image:
|
case *Image:
|
||||||
@ -215,7 +215,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext,
|
|||||||
newh := img.Height() + img.margins.top + img.margins.bottom
|
newh := img.Height() + img.margins.top + img.margins.bottom
|
||||||
if newh > h {
|
if newh > h {
|
||||||
diffh := newh - h
|
diffh := newh - h
|
||||||
// Add diff to last row
|
// Add diff to last row.
|
||||||
table.rowHeights[cell.row+cell.rowspan-2] += diffh
|
table.rowHeights[cell.row+cell.rowspan-2] += diffh
|
||||||
}
|
}
|
||||||
case *Division:
|
case *Division:
|
||||||
@ -238,7 +238,7 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext,
|
|||||||
newh := ctx.Height - h
|
newh := ctx.Height - h
|
||||||
if newh > h {
|
if newh > h {
|
||||||
diffh := newh - h
|
diffh := newh - h
|
||||||
// Add diff to last row
|
// Add diff to last row.
|
||||||
table.rowHeights[cell.row+cell.rowspan-2] += diffh
|
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.
|
// Get available width and height.
|
||||||
if newh > h {
|
if newh > h {
|
||||||
diffh := newh - h
|
diffh := newh - h
|
||||||
// Add diff to last row
|
// Add diff to last row.
|
||||||
table.rowHeights[cell.row+cell.rowspan-2] += diffh
|
table.rowHeights[cell.row+cell.rowspan-2] += diffh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,9 +394,9 @@ func (table *Table) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext,
|
|||||||
// Relative mode.
|
// Relative mode.
|
||||||
// Move back X after.
|
// Move back X after.
|
||||||
ctx.X = origCtx.X
|
ctx.X = origCtx.X
|
||||||
// Return original width
|
// Return original width.
|
||||||
ctx.Width = origCtx.Width
|
ctx.Width = origCtx.Width
|
||||||
// Add the bottom margin
|
// Add the bottom margin.
|
||||||
ctx.Y += table.margins.bottom
|
ctx.Y += table.margins.bottom
|
||||||
|
|
||||||
return blocks, ctx, nil
|
return blocks, ctx, nil
|
||||||
|
@ -83,7 +83,7 @@ func TestTableWithImage(t *testing.T) {
|
|||||||
|
|
||||||
pageHistoryTable.SkipCells(1)
|
pageHistoryTable.SkipCells(1)
|
||||||
|
|
||||||
// Add image
|
// Add image.
|
||||||
imgData, err := ioutil.ReadFile(testImageFile1)
|
imgData, err := ioutil.ReadFile(testImageFile1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Fail: %v\n", err)
|
t.Errorf("Fail: %v\n", err)
|
||||||
@ -195,7 +195,7 @@ func TestTableWithDiv(t *testing.T) {
|
|||||||
|
|
||||||
pageHistoryTable.SkipCells(1)
|
pageHistoryTable.SkipCells(1)
|
||||||
|
|
||||||
// Add image
|
// Add image.
|
||||||
imgData, err := ioutil.ReadFile(testImageFile1)
|
imgData, err := ioutil.ReadFile(testImageFile1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Fail: %v\n", err)
|
t.Errorf("Fail: %v\n", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user