标签存档: google

Google Map API V3 加入可拖动的路径功能

到目前还没有在API文档中体现, 不过已经在官方实例中给DirectionsRendererOptions加入了draggable属性,例子如下:


var directionDisplay;

directionsDisplay = new google.maps.DirectionsRenderer({

draggable: true,

suppressPolylines:false,markerOptions:{visible : false}

});

如果要监听路径改变,可以监听DirectionsRenderer对象的directions_changed时间, 例子如下:

google.maps.event.addListener(directionsDisplay, 'directions_changed', function() {
     alert(directionsDisplay.getDirections());
});