Remove references to global variables from endpoint drag listener
This causes visible input value updates even when the route is not recalculated. The upside is that it lets endpoints not know about the route and its update state.
This commit is contained in:
parent
6b179c4e9b
commit
d065f88b1a
1 changed files with 6 additions and 7 deletions
|
@ -21,9 +21,11 @@ OSM.Directions = function (map) {
|
|||
});
|
||||
|
||||
var endpointDragCallback = function (dragging) {
|
||||
if (map.hasLayer(polyline)) {
|
||||
getRoute(false, !dragging);
|
||||
}
|
||||
if (!map.hasLayer(polyline)) return;
|
||||
if (dragging && !chosenEngine.draggable) return;
|
||||
if (dragging && awaitingRoute) return;
|
||||
|
||||
getRoute(false, !dragging);
|
||||
};
|
||||
var endpointGeocodeCallback = function () {
|
||||
getRoute(true, true);
|
||||
|
@ -68,11 +70,8 @@ OSM.Directions = function (map) {
|
|||
});
|
||||
|
||||
endpoint.marker.on("drag dragend", function (e) {
|
||||
var dragging = (e.type === "drag");
|
||||
if (dragging && !chosenEngine.draggable) return;
|
||||
if (dragging && awaitingRoute) return;
|
||||
endpoint.setLatLng(e.target.getLatLng());
|
||||
dragCallback(dragging);
|
||||
dragCallback(e.type === "drag");
|
||||
});
|
||||
|
||||
input.on("keydown", function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue