开发者

Google Maps V3 custom controls problem

开发者 https://www.devze.com 2023-01-21 03:01 出处:网络
I have a Google map into which I add some custom tooltips using custom overlays: http://goo.gl/M6in However, sometimes the map will work and sometimes it will appear to be \"frozen\". I can\'t drag i

I have a Google map into which I add some custom tooltips using custom overlays: http://goo.gl/M6in

However, sometimes the map will work and sometimes it will appear to be "frozen". I can't drag it, I can't click any of the buttons, etc.

The only clue that I've found is that, if I use setTimeout() to wait for ~ 5 seconds, things work. If I don't, it's a crapshoot.

I'm trying to figure out how I can know when the map is ready to accept these custom overlays, and it doesn't seem to follow any of the typical events. I add these overlays AFTER "bounds_changed" and "tilesloaded" events, but a change must occur even later 开发者_JS百科than that that determines whether the map will be broken or functional.

The problem is, I don't know what that change is and how to detect it. Any ideas?


According to the current documentation:

Implement an onAdd() method within your prototype, and attach the overlay to the map. OverlayView.onAdd() will be called when the map is ready for the overlay to be attached.

From https://developers.google.com/maps/documentation/javascript/customoverlays#add

0

精彩评论

暂无评论...
验证码 换一张
取 消