]> git.openstreetmap.org Git - rails.git/commitdiff
Don't call endpoint.setLatLng() from outside of endpoint module
authorAnton Khorev <tony29@yandex.ru>
Sun, 11 Aug 2024 02:13:36 +0000 (05:13 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 14 Aug 2024 02:11:56 +0000 (05:11 +0300)
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);
     });