Google Maps v3 - can I ensure smooth panning every time?

后端 未结 6 1441
醉梦人生
醉梦人生 2021-02-01 20:49

My map has several hundred markers within a city. Usually no more than a 20 mile radius. I\'ve read through the documentation and haven\'t found a way to set the init to automat

6条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-01 21:15

    The threshold of the smooth panning does not depend on the distance between the current center and the new target. It depends on whether the change will require a full page scroll (horizontally and vertically) or not:

    Quoting from the API Reference:

    panTo(latLng:LatLng)

    Changes the center of the map to the given LatLng. If the change is less than both the width and height of the map, the transition will be smoothly animated.

    Therefore, as long as you are zoomed out such that your viewport is 20 miles in height and width, you should be guaranteed smooth panning for distances under 20 miles.

提交回复
热议问题