Mercurial > gemma
changeset 1914:3d2b55d2d8a6
client: pdf-gen: fix scale bar calculation
* Fix scalebar calculation which was off by a factor of ten, because
10e3 is 10000 and 1e3 was meant.
* Fix smaller issues in the same code: Using 1 as correct default factor.
Compare for greater-than even if this is unlikely with a float.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Fri, 18 Jan 2019 18:17:23 +0100 |
parents | a24d3b4b7ccd |
children | 89844ae6323a |
files | client/src/components/Pdftool.vue |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/Pdftool.vue Fri Jan 18 17:54:18 2019 +0100 +++ b/client/src/components/Pdftool.vue Fri Jan 18 18:17:23 2019 +0100 @@ -275,15 +275,15 @@ let maxLength = maxWidth * scaleNominator; let unit = "mm"; - let unitConversionFactor = 0; - if (maxLength > 10e7) { - // >10 km + let unitConversionFactor = 1; + if (maxLength >= 1e7) { + // >= 10 km unit = "km"; - unitConversionFactor = 10e6; - } else if (maxLength > 10e4) { - // >10m + unitConversionFactor = 1e6; + } else if (maxLength >= 1e4) { + // >= 10 m unit = "m"; - unitConversionFactor = 10e3; + unitConversionFactor = 1e3; } maxLength /= unitConversionFactor;