mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-01 22:17:29 +08:00
Remove unnecessary util function
This commit is contained in:
parent
9fd0b08297
commit
2c50caf6a4
@ -189,7 +189,7 @@ func (l *List) GeneratePageBlocks(ctx DrawContext) ([]*Block, DrawContext, error
|
||||
marker.SetTextAlignment(TextAlignmentRight)
|
||||
marker.Append(item.marker.Text).Style = item.marker.Style
|
||||
|
||||
width := round((marker.getTextWidth()/1000.0)/ctx.Width, 0.001, 3)
|
||||
width := marker.getTextWidth() / 1000.0 / ctx.Width
|
||||
if markerWidth < width {
|
||||
markerWidth = width
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
package creator
|
||||
|
||||
import (
|
||||
"math"
|
||||
"os"
|
||||
|
||||
"github.com/unidoc/unidoc/pdf/model"
|
||||
@ -44,21 +43,3 @@ func loadPagesFromFile(path string) ([]*model.PdfPage, error) {
|
||||
|
||||
return pages, nil
|
||||
}
|
||||
|
||||
func round(val float64, roundOn float64, places int) float64 {
|
||||
var round float64
|
||||
|
||||
pow := math.Pow(10, float64(places))
|
||||
digit := pow * val
|
||||
_, div := math.Modf(digit)
|
||||
div = math.Copysign(div, val)
|
||||
|
||||
roundOn = math.Copysign(roundOn, val)
|
||||
if div >= roundOn {
|
||||
round = math.Ceil(digit)
|
||||
} else {
|
||||
round = math.Floor(digit)
|
||||
}
|
||||
|
||||
return round / pow
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user