0

I'm displaying a custom layer on top of the standard google map (v3). Now the users can pan out of the extents of my custom layer.

Is it possible to constrain the viewable area to a square given by the top-left and bottom right coordinates?

Janak Nirmal
  • 22,706
  • 18
  • 63
  • 99
stUrb
  • 6,612
  • 8
  • 43
  • 71
  • Sure! See http://stackoverflow.com/questions/3818016/google-maps-v3-limit-viewable-area-and-zoom-level – miguev Feb 09 '12 at 14:12

1 Answers1

0

What you could do is prevent the user being able to pan the map at all. Set draggable:false in the mapOptions, and perhaps remove the pan control as well - panControl:false

Another idea; you could allow the user to drag/pan the map, but then if they move it outwith your bounds, you could call the panToBounds function on the map to move it back to where you want it.

duncan
  • 31,401
  • 13
  • 78
  • 99