@@ -739,34 +739,30 @@ export class WebMap extends Observable {
739
739
// maxZoom = options.baseLayer.visibleScales.length;
740
740
// }
741
741
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
- }
748
742
if ( baseLayer . layerType === "WMTS" ) {
749
743
if ( baseLayer . scales && baseLayer . scales . length > 0 ) {
750
744
//因为新版extent超出,不可见。所以将extent去除
751
745
viewOptions = { zoom, center, projection, resolutions : this . resolutionArray , maxZoom} ;
752
- this . map . setView ( new View ( viewOptions ) ) ;
753
746
} else {
754
747
viewOptions = { zoom, center, projection, maxZoom} ;
755
- this . map . setView ( new View ( viewOptions ) ) ;
756
748
this . getScales ( baseLayer ) ;
757
749
}
758
750
} else {
759
751
if ( this . resolutionArray && this . resolutionArray . length > 0 ) {
760
752
viewOptions = { zoom, center, projection, resolutions : this . resolutionArray , maxZoom} ;
761
- this . map . setView ( new View ( viewOptions ) ) ;
762
753
} else {
763
754
viewOptions = { zoom, center, projection, maxResolution, minResolution, maxZoom} ;
764
- this . map . setView ( new View ( viewOptions ) ) ;
765
755
this . getScales ( baseLayer ) ;
766
756
}
767
757
}
768
-
769
-
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 ) ) ;
765
+
770
766
if ( options . visibleExtent ) {
771
767
const view = this . map . getView ( ) ;
772
768
const resolution = view . getResolutionForExtent ( options . visibleExtent , this . map . getSize ( ) ) ;
0 commit comments