Skip to content

Commit d94160d

Browse files
committed
# Conflicts: # src/openlayers/mapping/WebMap.js
2 parents 3249ccf + 00aa0f3 commit d94160d

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -739,34 +739,30 @@ 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-
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+
770766
if (options.visibleExtent) {
771767
const view = this.map.getView();
772768
const resolution = view.getResolutionForExtent(options.visibleExtent, this.map.getSize());

src/openlayers/overlay/vectortile/MapboxStyles.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ export class MapboxStyles extends Observable {
275275
this._spriteImage = img;
276276
this._initStyleFunction();
277277
};
278+
img.onerror = () => {
279+
this._spriteImage = null;
280+
this._initStyleFunction();
281+
}
278282
img.src = this._spriteImageUrl;
279283
});
280284
} else {

0 commit comments

Comments
 (0)