@@ -739,33 +739,29 @@ export class WebMap extends Observable {
739739 // maxZoom = options.baseLayer.visibleScales.length;
740740 // }
741741 let viewOptions = { } ;
742- if ( [ '4' , '5' ] . indexOf ( Util . getOlVersion ( ) ) < 0 ) { // 兼容 ol 4,5,6
743- viewOptions . multiWorld = true ;
744- viewOptions . showFullExtent = true ;
745- viewOptions . enableRotation = false ;
746- viewOptions . constrainResolution = true ; //设置此参数,是因为需要显示整数级别。为了可视比例尺中包含当前比例尺
747- }
748742 if ( baseLayer . layerType === "WMTS" ) {
749743 if ( baseLayer . scales && baseLayer . scales . length > 0 ) {
750744 //因为新版extent超出,不可见。所以将extent去除
751745 viewOptions = { zoom, center, projection, resolutions : this . resolutionArray , maxZoom} ;
752- this . map . setView ( new View ( viewOptions ) ) ;
753746 } else {
754747 viewOptions = { zoom, center, projection, maxZoom} ;
755- this . map . setView ( new View ( viewOptions ) ) ;
756748 this . getScales ( baseLayer ) ;
757749 }
758750 } else {
759751 if ( this . resolutionArray && this . resolutionArray . length > 0 ) {
760752 viewOptions = { zoom, center, projection, resolutions : this . resolutionArray , maxZoom} ;
761- this . map . setView ( new View ( viewOptions ) ) ;
762753 } else {
763754 viewOptions = { zoom, center, projection, maxResolution, minResolution, maxZoom} ;
764- this . map . setView ( new View ( viewOptions ) ) ;
765755 this . getScales ( baseLayer ) ;
766756 }
767757 }
768-
758+ if ( [ '4' , '5' ] . indexOf ( Util . getOlVersion ( ) ) < 0 ) { // 兼容 ol 4,5,6
759+ viewOptions . multiWorld = true ;
760+ viewOptions . showFullExtent = true ;
761+ viewOptions . enableRotation = false ;
762+ viewOptions . constrainResolution = true ; //设置此参数,是因为需要显示整数级别。为了可视比例尺中包含当前比例尺
763+ }
764+ this . map . setView ( new View ( viewOptions ) ) ;
769765
770766 if ( options . visibleExtent ) {
771767 const view = this . map . getView ( ) ;
0 commit comments