Remove global "awaiting geocode" routing state
This commit is contained in:
parent
280917c756
commit
5944feb008
1 changed files with 1 additions and 9 deletions
|
@ -3,7 +3,6 @@
|
||||||
//= require qs/dist/qs
|
//= require qs/dist/qs
|
||||||
|
|
||||||
OSM.Directions = function (map) {
|
OSM.Directions = function (map) {
|
||||||
var awaitingGeocode; // true if the user has requested a route, but we're waiting on a geocode result
|
|
||||||
var awaitingRoute; // true if we've asked the engine for a route and are waiting to hear back
|
var awaitingRoute; // true if we've asked the engine for a route and are waiting to hear back
|
||||||
var chosenEngine;
|
var chosenEngine;
|
||||||
|
|
||||||
|
@ -74,8 +73,6 @@ OSM.Directions = function (map) {
|
||||||
});
|
});
|
||||||
|
|
||||||
input.on("change", function (e) {
|
input.on("change", function (e) {
|
||||||
awaitingGeocode = true;
|
|
||||||
|
|
||||||
// make text the same in both text boxes
|
// make text the same in both text boxes
|
||||||
var value = e.target.value;
|
var value = e.target.value;
|
||||||
endpoint.setValue(value);
|
endpoint.setValue(value);
|
||||||
|
@ -118,10 +115,7 @@ OSM.Directions = function (map) {
|
||||||
|
|
||||||
input.val(json[0].display_name);
|
input.val(json[0].display_name);
|
||||||
|
|
||||||
if (awaitingGeocode) {
|
getRoute(true, true);
|
||||||
awaitingGeocode = false;
|
|
||||||
getRoute(true, true);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -209,11 +203,9 @@ OSM.Directions = function (map) {
|
||||||
var endpoint = endpoints[ep_i];
|
var endpoint = endpoints[ep_i];
|
||||||
if (!endpoint.hasGeocode && !endpoint.awaitingGeocode) {
|
if (!endpoint.hasGeocode && !endpoint.awaitingGeocode) {
|
||||||
endpoint.getGeocode();
|
endpoint.getGeocode();
|
||||||
awaitingGeocode = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (endpoints[0].awaitingGeocode || endpoints[1].awaitingGeocode) {
|
if (endpoints[0].awaitingGeocode || endpoints[1].awaitingGeocode) {
|
||||||
awaitingGeocode = true;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue