dburles / meteor-google-maps

🗺 Meteor package for the Google Maps Javascript API v3
https://atmospherejs.com/dburles/google-maps
MIT License
196 stars 49 forks source link

work around showing map on modals #150

Closed vany0114 closed 6 years ago

vany0114 commented 7 years ago

Hi everyone,

Just in case, if you'll use a map over a modal it doesn't show correctly by default, indeed displays a "Grey" area's when it is placed inside a dynamic element. So do you need the next work around:

var currentCenter = GoogleMaps.maps.yourMap.instance.getCenter(); google.maps.event.trigger(GoogleMaps.maps.yourMap.instance, "resize"); GoogleMaps.maps.loadCenterMap.instance.setCenter(currentCenter); // Re-set previous center

The first and the third lines are just for reset the center because the resizing affects the center.

I lost a lot of time thinking that the problem was in api or something like that.

dburles commented 7 years ago

Also see #58 and #107