- var endpoints = [
- Endpoint($("input[name='route_from']"), OSM.MARKER_GREEN),
- Endpoint($("input[name='route_to']"), OSM.MARKER_RED)
- ];
-
- function Endpoint(input, iconUrl) {
- var 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]
- }),
- draggable: true
- });
-
- endpoint.marker.on('drag dragend', function (e) {
- dragging = (e.type === 'drag');
- if (dragging && !chosenEngine.draggable) return;
- if (dragging && awaitingRoute) return;
- endpoint.setLatLng(e.target.getLatLng());
- if (map.hasLayer(polyline)) {
- getRoute();
- }
- });
+ var endpointDragCallback = function (dragging) {
+ if (!map.hasLayer(polyline)) return;
+ if (dragging && !chosenEngine.draggable) return;
+ if (dragging && routeRequest) return;