Google Maps API 3 - limit pan/map bounds

前端 未结 3 1705

I am completely new to Google Maps and am just creating my first map so that I can incorporate it into my website.

I am trying to limit the area that the user can m

3条回答
  •  余生分开走
    2020-12-14 05:26

    You have your strictBounds mixed up - change the order of them and it should work fine.

    A LatLngBounds should be SW corner first, NE corner second: http://code.google.com/apis/maps/documentation/javascript/reference.html#LatLngBounds

    var strictBounds = new google.maps.LatLngBounds(
      new google.maps.LatLng(49.90878, -7.69042),
      new google.maps.LatLng(60.88770, -0.83496) 
    );
    

提交回复
热议问题