Merge pull request #7908 from hyperknot/scaleline-fix

ScaleLine fix for non-degree based units
This commit is contained in:
Andreas Hocevar
2018-04-20 15:40:56 +02:00
committed by GitHub
2 changed files with 39 additions and 1 deletions

View File

@@ -191,7 +191,8 @@ ScaleLine.prototype.updateElement_ = function() {
Units.METERS;
let pointResolution =
getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
if (projection.getUnits() != Units.DEGREES && units == ScaleLineUnits.METRIC) {
if (projection.getUnits() != Units.DEGREES && projection.getMetersPerUnit()
&& pointResolutionUnits == Units.METERS) {
pointResolution *= projection.getMetersPerUnit();
}