Invert displayed scale for very high zoom levels
This prevents a scale of '1 : 0' being displayed and instead displays 'scale : 1'
This commit is contained in:
@@ -366,8 +366,11 @@ class ScaleLine extends Control {
|
|||||||
* @return {string} The stringified HTML of the scalebar.
|
* @return {string} The stringified HTML of the scalebar.
|
||||||
*/
|
*/
|
||||||
createScaleBar(width, scale, suffix) {
|
createScaleBar(width, scale, suffix) {
|
||||||
|
const resolutionScale = this.getScaleForResolution();
|
||||||
const mapScale =
|
const mapScale =
|
||||||
'1 : ' + Math.round(this.getScaleForResolution()).toLocaleString();
|
resolutionScale < 1
|
||||||
|
? Math.round(1 / resolutionScale).toLocaleString() + ' : 1'
|
||||||
|
: '1 : ' + Math.round(resolutionScale).toLocaleString();
|
||||||
const steps = this.scaleBarSteps_;
|
const steps = this.scaleBarSteps_;
|
||||||
const stepWidth = width / steps;
|
const stepWidth = width / steps;
|
||||||
const scaleSteps = [this.createMarker('absolute')];
|
const scaleSteps = [this.createMarker('absolute')];
|
||||||
|
|||||||
Reference in New Issue
Block a user