Skip to content

Commit 50a5397

Browse files
committed
[bug] 小范围地图直接作为底图情况 通过webmap打开内存耗尽
1 parent 1173a79 commit 50a5397

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/openlayers/mapping/WebMap.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,23 @@ export class WebMap extends ol.Observable {
212212
this.mapParams.extent = extent;
213213
this.mapParams.projection = projection;
214214
}
215+
216+
// 计算当前最大分辨率
217+
let maxResolution;
218+
if(extent && extent.length === 4){
219+
let width = extent[2] - extent[0];
220+
let height = extent[3] - extent[1];
221+
let maxResolution1 = width/256;
222+
let maxResolution2 = height/256;
223+
maxResolution = Math.max(maxResolution1, maxResolution2);
224+
}
225+
215226
this.map.setView(new ol.View({
216227
zoom,
217228
center,
218229
projection,
219-
extent
230+
extent,
231+
maxResolution
220232
}));
221233
}
222234
/**

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