Skip to content

Commit 98d8a1b

Browse files
committed
回归classic例子的缺陷 review by tangq
1 parent 7e7bdac commit 98d8a1b

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

examples/classic/map_dynamiclayers.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<script type="text/javascript">
1212
var map, layer, host = window.isLocal ? window.server : "http://support.supermap.com.cn:8090";
1313
url = host + "/iserver/services/map-world/rest/maps/World";
14-
var bounds = new SuperMap.Bounds(-120, -60, 120, 60);
1514
map = new SuperMap.Map("map", {
1615
controls: [
1716
new SuperMap.Control.Navigation(),
@@ -22,7 +21,6 @@
2221
cacheEnabled: true
2322
}, {
2423
dpi: 95.99999999999939,
25-
maxExtent: bounds,
2624
resolutions: [
2725
0.34615384615384615, 0.17307692307692307,
2826
0.08653846153846154, 0.04326923076923077,
@@ -34,8 +32,13 @@
3432
0.00002112755408653846, 0.00001056377704326923
3533
]
3634
});
37-
map.addLayer(layer);
38-
map.setCenter(new SuperMap.LonLat(0, 0), 1.5);
35+
//监听图层信息加载完成事件
36+
layer.events.on({"layerInitialized": addLayer});
37+
function addLayer() {
38+
map.addLayer(layer);
39+
map.setCenter(new SuperMap.LonLat(0, 0), 1.5);
40+
}
41+
3942
</script>
4043
</body>
4144
</html>

0 commit comments

Comments
 (0)