map data now handles refreshes itself. this is so it can ensure that it doesn't start the refresh timer until all requests are complete

this avoids the situation where map data requests are slow enough that requests get aborted before a complete refresh has been done
This commit is contained in:
Jon Atkins
2013-08-27 05:42:59 +01:00
parent 0302d76a67
commit dc41671279
5 changed files with 107 additions and 77 deletions

View File

@ -192,13 +192,15 @@ window.setupMap = function() {
map.on('moveend zoomend', function() { window.mapRunsUserAction = false; window.startRefreshTimeout(ON_MOVE_REFRESH*1000); });
window.addResumeFunction(function() { window.startRefreshTimeout(ON_MOVE_REFRESH*1000); });
window.requests.addRefreshFunction(window.requestData);
// start the refresh process with a small timeout, so the first data request happens quickly
// (the code originally called the request function directly, and triggered a normal delay for the nxt refresh.
// however, the moveend/zoomend gets triggered on map load, causing a duplicate refresh. this helps prevent that
window.startRefreshTimeout(ON_MOVE_REFRESH*1000);
// create the map data requester
window.mapDataRequest = new MapDataRequest();
window.mapDataRequest.start();
};
//adds a base layer to the map. done separately from the above, so that plugins that add base layers can be the default