hpneo / gmaps

the easiest way to use Google Maps
https://hpneo.dev/gmaps/
7.03k stars 1.29k forks source link

Overlay - on drawing complete event #569

Closed vvaldersteins closed 6 years ago

vvaldersteins commented 6 years ago

Hi,

Is there a possibility to add a function for drawOverlay() method that will be fired when the drawing of the overlay is finished?

I checked the code, and you are calling "ready" event of the map, when that's done, but it's not called. Would be cool, to have such a feature.

vvaldersteins commented 6 years ago

I found out a solution myself, was listening for "ready" on the map, but should have done that on the .drawOverlay() function. Works like a charm. Small example, in case anybody else requires that -

const overlay = this.map.drawOverlay({
    lat: marker.getPosition().lat(),
    lng: marker.getPosition().lng(),
});
overlay.addListener("ready", this.doSomething.bind(this));