简体   繁体   English

如何检查Google地图是否已满载?

[英]How to check if Google Maps is fully loaded?

I need to know when google map is fully loaded and only then enable another controls. 我需要知道Google地图何时完全加载,然后才能启用其他控件。 The next code is not ok because 'idle' fires every time I move the map. 下一个代码不正确,因为每次我移动地图时都会触发“ idle”。 So I need to know that map is ready for use only once. 因此,我需要知道该地图只能使用一次。

google.maps.event.addListenerOnce(map, 'idle', function(){
    // do something only the first time the map is loaded
});

It would be nice to have the next code: 最好有下一个代码:

if map.isReady() then map.getBounds()

尝试Tilesloaded事件,而不是空闲事件。

I had to one loading window when click on map view button, and it must be cloase is map is completely loaded .This is what you can do GWT private DimdipPopupWindow dimDipPanel; 当单击地图视图按钮时,我必须进入一个加载窗口,并且必须将Cloase完全加载到地图中。

To show progress bar On Button clicked 要显示进度条,请单击“按钮”

 dimDipPanel = new DimdipPopupWindow();
 dimDipPanel.show();

To hide when Map completely loaded. 当地图完全加载时隐藏。

 map.addTilesLoadedListenerOnce(new TilesLoadedHandler() {
        @Override
        public void handle() {
            // Do Whatever you want here.
            dimDipPanel.hide();
        }
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM