Skip to content

Commit

Permalink
Make resetBoundsOnResize preserve center when full-screened (#482)
Browse files Browse the repository at this point in the history
* lockCenter prop added

* Resolve conflicts

* Fix lint with `yarn lint --fix`

* Add documentation for `lockCenter` prop

* Remove `lockCenter`, add its behavior to `resetBoundsOnResize`

See https://github.com/istarkov/google-map-react/pull/482/files#r158330791
  • Loading branch information
josephfrazier authored and itsmichaeldiego committed Dec 22, 2017
1 parent 2e7bd79 commit 0db8020
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/google_map.js
Expand Up @@ -453,9 +453,12 @@ export default class GoogleMap extends Component {
_mapDomResizeCallback = () => {
this.resetSizeOnIdle_ = true;
if (this.maps_) {
const originalCenter = this.map_.getCenter();
const originalCenter = this.props.center || this.props.defaultCenter;
const currentCenter = this.map_.getCenter();
this.maps_.event.trigger(this.map_, 'resize');
this.map_.setCenter(originalCenter);
this.map_.setCenter(
this.props.resetBoundsOnResize ? originalCenter : currentCenter
);
}
};

Expand Down

0 comments on commit 0db8020

Please sign in to comment.