+ var id=e.originalEvent.dataTransfer.getData('id');
+ var ll=r.map.mouseEventToLatLng(e.originalEvent);
+ // *** ^^^ this is slightly off - we need to work out the latLng of the tip
+ r.createMarker(ll,id);
+ // update to/from field
+ };
+ r.createMarker=function(latlng,id) {
+ if (r[id]) r.map.removeLayer(r[id]);
+ r[id]=L.marker(latlng, {
+ icon: id=='marker_from' ? icon_from : icon_to,
+ draggable: true,
+ name: id
+ }).addTo(r.map);
+ r[id].on('drag',r.markerDragged);
+ r[id].on('dragend',r.markerDragged);
+ };
+ r.updateMarkers=function(id) {
+ };
+ r.markerDragged=function(e) {
+ // marker has been dragged
+ if (e.type=='drag' && !r.chosenEngine.draggable) return;
+ // *** also return if e.type=='drag' and not long enough since last request returned
+ // *** but always do if e.type=='dragend'
+ console.log(e.target.options.name);
+ console.log(e.target.getLatLng());