Google Maps API Range Limiting© 2006, 2009 Mike Williams |
Translate this page: |
Limiting the rangeIf you want to limit the range of zoom levels that the user is allowed to use on your map, you can overwrite the .getMinimumResolution() and .getMaximumResolution() methods of all the map types.If you want to limit the range of movement that the user is allowed to use on your map, you can add listeners for the "move" event, and countermand any operations that go outside the permitted region. Things happen so quickly that there's no time for anything out of bounds to get plotted, so it all looks reasonably smooth. Here's an example What I've done for the position is to specify an allowable region in GLatLngBounds() format, and require that the centre point lie within that region. Potential Pitfalls
|