Skip to content

Commit 3e6edf8

Browse files
committed
【bug】1) webmap,出图extent不对
(reviewed by chengl)
1 parent 563c2ec commit 3e6edf8

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy