Merge pull request #9305 from KaiVolland/fix-scaleline-test
Fixes failing tests for Chrome v74
@@ -79,7 +79,7 @@
|
|||||||
"pixelmatch": "^4.0.2",
|
"pixelmatch": "^4.0.2",
|
||||||
"pngjs": "^3.3.3",
|
"pngjs": "^3.3.3",
|
||||||
"proj4": "2.5.0",
|
"proj4": "2.5.0",
|
||||||
"puppeteer": "~1.11.0",
|
"puppeteer": "~1.13.0",
|
||||||
"serve-static": "^1.13.2",
|
"serve-static": "^1.13.2",
|
||||||
"shx": "^0.3.2",
|
"shx": "^0.3.2",
|
||||||
"sinon": "^7.2.3",
|
"sinon": "^7.2.3",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 139 KiB |
|
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
@@ -260,10 +260,11 @@ class ScaleLine extends Control {
|
|||||||
|
|
||||||
let i = 3 * Math.floor(
|
let i = 3 * Math.floor(
|
||||||
Math.log(this.minWidth_ * pointResolution) / Math.log(10));
|
Math.log(this.minWidth_ * pointResolution) / Math.log(10));
|
||||||
let count, width;
|
let count, width, decimalCount;
|
||||||
while (true) {
|
while (true) {
|
||||||
count = LEADING_DIGITS[((i % 3) + 3) % 3] *
|
decimalCount = Math.floor(i / 3);
|
||||||
Math.pow(10, Math.floor(i / 3));
|
const decimal = Math.pow(10, decimalCount);
|
||||||
|
count = LEADING_DIGITS[((i % 3) + 3) % 3] * decimal;
|
||||||
width = Math.round(count / pointResolution);
|
width = Math.round(count / pointResolution);
|
||||||
if (isNaN(width)) {
|
if (isNaN(width)) {
|
||||||
this.element.style.display = 'none';
|
this.element.style.display = 'none';
|
||||||
@@ -274,12 +275,11 @@ class ScaleLine extends Control {
|
|||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
||||||
let html;
|
let html;
|
||||||
if (this.scaleBar_) {
|
if (this.scaleBar_) {
|
||||||
html = this.createScaleBar(width, count, suffix);
|
html = this.createScaleBar(width, count, suffix);
|
||||||
} else {
|
} else {
|
||||||
html = count + ' ' + suffix;
|
html = count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.renderedHTML_ != html) {
|
if (this.renderedHTML_ != html) {
|
||||||
|
|||||||