Keep original center on _mapDomResizeCallback (#282)

When the resize event is triggered, the original center was lost. 
This issue is significant when the map is renders outside visible dom with zero height and width.
When placed into the visible dom, the resize is triggered correctly. With this change the center will persist. (Without this fix the old center is the top left corner)
This commit is contained in:
Andries Smit 2016-11-24 18:09:06 +01:00 committed by Ivan Starkov
parent 7be0f10591
commit affee2a8dd

View File

@ -391,7 +391,9 @@ export default class GoogleMap extends Component {
_mapDomResizeCallback = () => {
this.resetSizeOnIdle_ = true;
if (this.maps_) {
const originalCenter = this.maps_.getCenter();
this.maps_.event.trigger(this.map_, 'resize');
this.maps_.setCenter(originalCenter);
}
}