]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions.js
Don't call endpoint.setLatLng() from outside of endpoint module
[rails.git] / app / assets / javascripts / index / directions.js
index ccd4a68c253ada6b537f063f465b9fb61f2e7a18..974a40e850edc685c09ce7043eed1ae4ba70df05 100644 (file)
@@ -300,7 +300,9 @@ OSM.Directions = function (map) {
       var pt = L.DomEvent.getMousePosition(oe, map.getContainer()); // co-ordinates of the mouse pointer at present
       pt.y += 20;
       var ll = map.containerPointToLatLng(pt);
-      endpoints[type === "from" ? 0 : 1].setLatLng(ll);
+      var precision = OSM.zoomPrecision(map.getZoom());
+      var value = ll.lat.toFixed(precision) + ", " + ll.lng.toFixed(precision);
+      endpoints[type === "from" ? 0 : 1].setValue(value, ll);
       getRoute(true, true);
     });