Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my bounds code:
- var allowedBounds = new google.maps.LatLngBounds(
- new google.maps.LatLng(85, -180), // top left corner of map
- new google.maps.LatLng(-85, 180) // bottom right corner
- );
- var lastValidCenter = map.getCenter();
- google.maps.event.addListener(map, 'center_changed', function() {
- if(allowedBounds.contains(map.getCenter())) {
- lastValidCenter = map.getCenter();
- return;
- }
- map.panTo(lastValidCenter);
- });
- Full code overview: http://codepen.io/HyperGainZ/pen/adVQvY
- Note: i wanna have it so a user can pan all they want and zoom in and out but dont have a reapeating map like this
- [![enter image description here][1]][1]
- ----------
- but I want it so when they are all the way zoomed out they see this and can't pan up, down, left or right
- [![enter image description here][2]][2]
- [1]: http://i.stack.imgur.com/ltaID.png
- [2]: http://i.stack.imgur.com/IKNsv.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement