Oleg Dats
Oleg Dats

Reputation: 4133

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. The next code is not ok because 'idle' fires every time I move the map. 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()

Upvotes: 0

Views: 4597

Answers (2)

Bhasker The Navigator
Bhasker The Navigator

Reputation: 49

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;

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();
        }
    });

Upvotes: 0

puckhead
puckhead

Reputation: 1891

Try the tilesloaded event instead of idle.

Upvotes: 4

Related Questions