mirror of
https://github.com/google-map-react/google-map-react.git
synced 2025-12-08 18:26:32 +00:00
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:
parent
7be0f10591
commit
affee2a8dd
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user