Respect metersPerUnit in ScaleLine control

This commit is contained in:
Andreas Hocevar
2017-11-10 12:47:21 +01:00
parent dbfca19e09
commit 9c45f9a8d6
3 changed files with 40 additions and 3 deletions

View File

@@ -174,6 +174,9 @@ ol.control.ScaleLine.prototype.updateElement_ = function() {
ol.proj.Units.METERS;
var pointResolution =
ol.proj.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
if (units != ol.control.ScaleLineUnits.DEGREES) {
pointResolution *= projection.getMetersPerUnit();
}
var nominalCount = this.minWidth_ * pointResolution;
var suffix = '';