You need to add a GDirections object handler for the addoverlay event:
GEvent.addListener(gdir, "addoverlay", onGDirectionsAddOverlay);
When the onGDirectionsAddOverlay handler is called, you can iterate over new markers and replace them with dragged copies:
for (var i = 0; i <= gdir.getNumRoutes(); i++) { var originalMarker = gdir.getMarker(i); latLngs[i] = originalMarker.getLatLng(); icons[i] = originalMarker.getIcon(); newMarkers[i] = new GMarker(latLngs[i], { icon: icons[i], draggable: true, title: 'Kan flyttes' }); map.addOverlay(newMarkers[i]);
You can find a working example of this here ( source ).
source share