diff --git a/API.md b/API.md index 45f3dd1..0b358a4 100644 --- a/API.md +++ b/API.md @@ -309,14 +309,13 @@ and if so, uses it, so it won't load a second copy of the library. ### Override the default minimum zoom -*WARNING*: Setting these options can break markers calculation, causing no homeomorphism between screen coordinates and map. +*WARNING*: Setting this option can break markers calculation, causing no homeomorphism between screen coordinates and map. -You can use the `minZoomOverride` associated with the `minZoom` in the custom map options to prevent a minimum zoom from being calculated: +You can use the `minZoom` custom option to prevent our minimum-zoom calculation: ```javascript function createMapOptions() { return { - minZoomOverride: true, minZoom: 2, }; } diff --git a/src/google_map.js b/src/google_map.js index 3fa8676..1ffd286 100644 --- a/src/google_map.js +++ b/src/google_map.js @@ -365,10 +365,7 @@ export default class GoogleMap extends Component { options = omit(options, ['zoom', 'center', 'draggable']); if ('minZoom' in options) { - const minZoom = this._computeMinZoom( - options.minZoomOverride, - options.minZoom - ); + const minZoom = this._computeMinZoom(options.minZoom); options.minZoom = _checkMinZoom(options.minZoom, minZoom); } @@ -453,9 +450,9 @@ export default class GoogleMap extends Component { return DEFAULT_MIN_ZOOM; }; - _computeMinZoom = (minZoomOverride, minZoom) => { - if (minZoomOverride) { - return minZoom || DEFAULT_MIN_ZOOM; + _computeMinZoom = minZoom => { + if (minZoom !== undefined && minZoom !== null) { + return minZoom; } return this._getMinZoom(); }; @@ -546,10 +543,7 @@ export default class GoogleMap extends Component { draggable: this.props.draggable, }; - const minZoom = this._computeMinZoom( - options.minZoomOverride, - options.minZoom - ); + const minZoom = this._computeMinZoom(options.minZoom); this.minZoom_ = minZoom; const preMapOptions = { @@ -700,7 +694,6 @@ export default class GoogleMap extends Component { if (this.resetSizeOnIdle_) { this._setViewSize(); const currMinZoom = this._computeMinZoom( - this.props.options.minZoomOverride, this.props.options.minZoom );