]> git.openstreetmap.org Git - rails.git/commitdiff
Merge remote-tracking branch 'upstream/pull/5064' master live
authorTom Hughes <tom@compton.nu>
Sun, 2 Feb 2025 12:44:27 +0000 (12:44 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 2 Feb 2025 12:44:27 +0000 (12:44 +0000)
1  2 
app/assets/javascripts/index/directions-endpoint.js
app/assets/javascripts/index/directions.js

index 2cc3ea66256488c3bbd426d31f175e3836b3c3dd,6a3cd7c269edda3a3bdbc68f7a73e0ee68fa9683..30d499ad731707b404dc1ca3448af2e215cfb7d7
@@@ -34,8 -34,11 +34,11 @@@ OSM.DirectionsEndpoint = function Endpo
    };
  
    function markerDragListener(e) {
 -    var latlng = convertLatLngToZoomPrecision(e.target.getLatLng());
 +    const latlng = L.latLng(OSM.cropLocation(e.target.getLatLng(), map.getZoom()));
  
+     if (endpoint.geocodeRequest) endpoint.geocodeRequest.abort();
+     delete endpoint.geocodeRequest;
      setLatLng(latlng);
      setInputValueFromLatLng(latlng);
      endpoint.value = input.val();
index 4eb0e09f46c13bbfb83edb59ae773f65d18d601c,df56771055c51db6870db4c1a016b7a4f399349e..0847318cf9440ac49d1768710a5f4a6a5db5dfe4
@@@ -281,8 -284,9 +280,8 @@@ 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);
 -      var precision = OSM.zoomPrecision(map.getZoom());
 -      var value = ll.lat.toFixed(precision) + ", " + ll.lng.toFixed(precision);
 -      endpoints[type === "from" ? 0 : 1].setValue(value);
 +      const llWithPrecision = OSM.cropLocation(ll, map.getZoom());
-       endpoints[type === "from" ? 0 : 1].setValue(llWithPrecision.join(", "), llWithPrecision);
++      endpoints[type === "from" ? 0 : 1].setValue(llWithPrecision.join(", "));
      });
  
      endpoints[0].enable();