React-google-maps: minZoom and maxZoom seems to not work

Created on 14 Dec 2015  路  7Comments  路  Source: tomchentw/react-google-maps

Passing minZoom and maxZoom has no effect on zoom restrictions, any idea?

Simple google maps example without react-google-maps is ok

Most helpful comment

Put them in the options or defaultOptions property

All 7 comments

Any idea?

Put them in the options or defaultOptions property

Close for now.

We're also looking for maintainers. Involve in #266 to help strengthen our community!

@tomchentw when I put it in the options, it doesn't seem to work either

@woniesong92 @vvo

Add this parameters in options 
maxZoom: 18, // for max zoom
minZoom: 2, // for min zoom
zoom: 2 // default zoom view

//Redraw after user zoom/drag interactions
google.maps.event.addListener(this.map, 'zoom_changed', _.bind(function() {
    if (this.map.getZoom() > this.maxZoom) {
        this.map.setZoom(this.maxZoom);
    }
    if (this.map.getZoom() < this.minZoom) {
        this.map.setZoom(this.minZoom);
    }
    this.drawMap();
}, this));

google.maps.event.addListener(this.map, 'dragend', _.bind(function() {
    this.drawMap();
}, this));

Following code is used for react-google-maps. Hope you get some help from this.

Is minZoom or maxZoom supported by the official Google Maps JavaScript API v3? If not, then use the solution proposed by @sameerkambli .

@tomchentw minZoom and maxZoom is supported by the official Google Maps Javascript API v3.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shrimpy picture shrimpy  路  3Comments

ShintaroNippon picture ShintaroNippon  路  3Comments

julienvincent picture julienvincent  路  3Comments

manoj150283 picture manoj150283  路  3Comments

PaulieScanlon picture PaulieScanlon  路  3Comments