Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2016
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. my bounds code:
  2.  
  3. var allowedBounds = new google.maps.LatLngBounds(
  4. new google.maps.LatLng(85, -180), // top left corner of map
  5. new google.maps.LatLng(-85, 180) // bottom right corner
  6. );
  7.  
  8. var lastValidCenter = map.getCenter();
  9.  
  10. google.maps.event.addListener(map, 'center_changed', function() {
  11. if(allowedBounds.contains(map.getCenter())) {
  12. lastValidCenter = map.getCenter();
  13. return;
  14. }
  15.  
  16. map.panTo(lastValidCenter);
  17. });
  18.  
  19.  
  20. Full code overview: http://codepen.io/HyperGainZ/pen/adVQvY
  21. 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
  22. [![enter image description here][1]][1]
  23. ----------
  24.  
  25.  
  26. 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
  27. [![enter image description here][2]][2]
  28.  
  29.  
  30. [1]: http://i.stack.imgur.com/ltaID.png
  31. [2]: http://i.stack.imgur.com/IKNsv.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement