]> git.openstreetmap.org Git - rails.git/blobdiff - app/assets/javascripts/index/directions-endpoint.js
Put map key presence in js layer definitions
[rails.git] / app / assets / javascripts / index / directions-endpoint.js
index e3f6afa46d4a49a4984a94097347878411b854ff..97b841f1443c6dceae67daeb7845a167708159e2 100644 (file)
@@ -1,15 +1,8 @@
-OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, changeCallback) {
+OSM.DirectionsEndpoint = function Endpoint(map, input, marker, dragCallback, changeCallback) {
   const endpoint = {};
 
   endpoint.marker = L.marker([0, 0], {
-    icon: L.icon({
-      iconUrl: iconUrl,
-      iconSize: [25, 41],
-      iconAnchor: [12, 41],
-      popupAnchor: [1, -34],
-      shadowUrl: OSM.MARKER_SHADOW,
-      shadowSize: [41, 41]
-    }),
+    icon: OSM.getMarker(marker),
     draggable: true,
     autoPan: true
   });
@@ -117,7 +110,7 @@ OSM.DirectionsEndpoint = function Endpoint(map, input, iconUrl, dragCallback, ch
       if (json.length === 0) {
         input.addClass("is-invalid");
         // eslint-disable-next-line no-alert
-        alert(I18n.t("javascripts.directions.errors.no_place", { place: endpoint.value }));
+        alert(OSM.i18n.t("javascripts.directions.errors.no_place", { place: endpoint.value }));
         return;
       }