From e367a007e50e8e835bc461b38f339077b44fcdd6 Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Tue, 24 Jan 2023 16:45:08 -0800 Subject: [PATCH] chopPrecision once at end --- lib/label/label.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/label/label.go b/lib/label/label.go index 19da6b7e9..fff93e1a0 100644 --- a/lib/label/label.go +++ b/lib/label/label.go @@ -266,7 +266,7 @@ func (labelPosition Position) GetPointOnRoute(route geo.Route, strokeWidth, labe offsetX := strokeWidth/2 + float64(PADDING) + width/2 offsetY := strokeWidth/2 + float64(PADDING) + height/2 - return geo.NewPoint(chopPrecision(basePoint.X+normalX*offsetX), chopPrecision(basePoint.Y+normalY*offsetY)) + return geo.NewPoint(basePoint.X+normalX*offsetX, basePoint.Y+normalY*offsetY) } var labelCenter *geo.Point @@ -310,8 +310,8 @@ func (labelPosition Position) GetPointOnRoute(route geo.Route, strokeWidth, labe return nil } // convert from center to top left - labelCenter.X -= chopPrecision(width / 2) - labelCenter.Y -= chopPrecision(height / 2) + labelCenter.X = chopPrecision(labelCenter.X - width/2) + labelCenter.Y = chopPrecision(labelCenter.Y - height/2) return labelCenter }