Closed marcobiedermann closed 8 years ago
I don't think, re-running the initialization-function is the best option. You'll just trigger lots of functions, that don't need to be triggered. The following code should work fine, when placed inside gmap*_initialize():
google.maps.event.addDomListener(window, "resize", function() { var center = gmap<?=$this->map['id'];?>.getCenter(); google.maps.event.trigger(gmap<?=$this->map['id'];?>, "resize"); gmap<?=$this->map['id'];?>.setCenter(center); });
@KaiserCh is right, you don't need to re-initialize the whole map. Just make sure that the map stays in the center upon window resize.
+1
@KaiserCh Thank you, I will update my PR later :)
Update map center point on browser resize.