In Google Maps V3, how can I get a draggable marker to pan the map?

后端 未结 4 1164
情歌与酒
情歌与酒 2021-02-04 06:20

I have found several V2 examples of how to pan the map while a marker is being dragged. For example: http://www.putyourlightson.net/projects/coordinates

    //         


        
4条回答
  •  孤街浪徒
    2021-02-04 06:45

    use dragend instead of drag. the code will be,

      google.maps.event.addListener(marker, "dragend", function(event) {
    
           var point = marker.getPosition();
           map.panTo(point);
    
            });
    

提交回复
热议问题