X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/7915a22cafafc1fcbd59d798ac1734ecfd083adc..9a05a7ba490cbf2ed7fdc50ef5ae203dc5cbfd18:/app/assets/javascripts/routing.js.erb diff --git a/app/assets/javascripts/routing.js.erb b/app/assets/javascripts/routing.js.erb index 2a10a9d5e..c774928b9 100644 --- a/app/assets/javascripts/routing.js.erb +++ b/app/assets/javascripts/routing.js.erb @@ -115,9 +115,12 @@ OSM.Routing=function(map,name,jqSearch) { // Drag and drop markers r.handleDrop=function(e) { - 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 + var oe=e.originalEvent; + var id=oe.dataTransfer.getData('id'); + var pt=L.DomEvent.getMousePosition(oe,map.getContainer()); // co-ordinates of the mouse pointer at present + pt.x+=Number(oe.dataTransfer.getData('offsetX')); + pt.y+=Number(oe.dataTransfer.getData('offsetY')); + var ll=map.containerPointToLatLng(pt); r.createMarker(ll,id); r.setNumericInput(ll,id); r.requestRoute(true, false); @@ -248,6 +251,9 @@ OSM.Routing=function(map,name,jqSearch) { script.src = url+r.name+".gotRoute"+num; document.body.appendChild(script); }; + list[num].requestCORS=function(url) { + $.ajax({ url: url, method: "GET", data: {}, dataType: 'json', success: r['gotRoute'+num] }); + }; r['gotRoute'+num]=function(data) { r.awaitingRoute=false; $(".query_wrapper.routing .spinner").hide();