@@ -424,7 +424,7 @@ export class WebMap extends Observable {
424424 baseLayerInfo . visibleScales . forEach ( scale => {
425425 let value = 1 / scale ;
426426 res = this . getResFromScale ( value , coordUnit ) ;
427- scale = `1:${ value . toLocaleString ( ) } ` ;
427+ scale = `1:${ value } ` ;
428428 //多此一举转换,因为toLocalString会自动保留小数点后三位,and当第二位小数是0就会保存小数点后两位。所有为了统一。
429429 resolutions [ this . formatScale ( scale ) ] = res ;
430430 resolutionArray . push ( res ) ;
@@ -433,7 +433,7 @@ export class WebMap extends Observable {
433433 } else if ( baseLayerInfo . layerType === 'WMTS' ) {
434434 baseLayerInfo . scales . forEach ( scale => {
435435 res = this . getResFromScale ( scale , coordUnit , 90.7 ) ;
436- scale = `1:${ scale . toLocaleString ( ) } ` ;
436+ scale = `1:${ scale } ` ;
437437 //多此一举转换,因为toLocalString会自动保留小数点后三位,and当第二位小数是0就会保存小数点后两位。所有为了统一。
438438 resolutions [ this . formatScale ( scale ) ] = res ;
439439 resolutionArray . push ( res ) ;
@@ -480,7 +480,7 @@ export class WebMap extends Observable {
480480 getScaleFromRes ( resolution , coordUnit = "DEGREE" , dpi = 96 ) {
481481 let scale , mpu = metersPerUnit [ coordUnit . toUpperCase ( ) ] ;
482482 scale = resolution * dpi * mpu / .0254 ;
483- return '1:' + scale . toLocaleString ( ) ;
483+ return '1:' + scale ;
484484 }
485485 /**
486486 * @private
@@ -703,11 +703,20 @@ export class WebMap extends Observable {
703703 const scales = this . scales . map ( ( scale ) => {
704704 return 1 / scale . split ( ':' ) [ 1 ] ;
705705 } ) ;
706- visibleScales = baseLayer . visibleScales || scales ;
706+ if ( Array . isArray ( baseLayer . visibleScales ) && baseLayer . visibleScales . length && baseLayer . visibleScales ) {
707+ visibleScales = baseLayer . visibleScales ;
708+ } else {
709+ visibleScales = scales ;
710+ }
707711 minScale = 1 / mapInfo . minScale . split ( ':' ) [ 1 ] ;
708712 maxScale = 1 / mapInfo . maxScale . split ( ':' ) [ 1 ] ;
709713 }
710-
714+ if ( minScale > maxScale ) {
715+ let temp = null ;
716+ temp = minScale ;
717+ minScale = maxScale ;
718+ maxScale = temp ;
719+ }
711720 const minVisibleScale = this . findNearest ( visibleScales , minScale ) ;
712721 const maxVisibleScale = this . findNearest ( visibleScales , maxScale ) ;
713722 const minZoom = visibleScales . indexOf ( minVisibleScale ) ;
@@ -829,7 +838,7 @@ export class WebMap extends Observable {
829838 // if(options.baseLayer.visibleScales && options.baseLayer.visibleScales.length > 0){
830839 // maxZoom = options.baseLayer.visibleScales.length;
831840 // }
832- this . map . setView ( new View ( { zoom, center, projection, maxZoom } ) ) ;
841+ this . map . setView ( new View ( { zoom, center, projection, maxZoom, maxResolution } ) ) ;
833842 let viewOptions = { } ;
834843
835844 if ( baseLayer . scales && baseLayer . scales . length > 0 && baseLayer . layerType === "WMTS" ||
0 commit comments