Prevent accidental loading of many tiles at low zoom

This could happen because `editable` was checked before the call was scheduled
not before the `loadTiles`.  The user can zoom out more while the call is deferred.
This commit is contained in:
Bryan Housel
2019-05-16 16:44:19 -04:00
parent aa7820b699
commit ec0145de3a
2 changed files with 11 additions and 12 deletions

View File

@@ -135,21 +135,21 @@ export function coreContext() {
context.loadTiles = function(projection, callback) {
if (connection && context.editable()) {
var cid = connection.getConnectionId();
utilCallWhenIdle(function() {
utilCallWhenIdle(function() {
if (connection && context.editable()) {
var cid = connection.getConnectionId();
connection.loadTiles(projection, afterLoad(cid, callback));
})();
}
}
})();
};
context.loadTileAtLoc = function(loc, callback) {
if (connection && context.editable()) {
var cid = connection.getConnectionId();
utilCallWhenIdle(function() {
utilCallWhenIdle(function() {
if (connection && context.editable()) {
var cid = connection.getConnectionId();
connection.loadTileAtLoc(loc, afterLoad(cid, callback));
})();
}
}
})();
};
context.loadEntity = function(entityID, callback) {

View File

@@ -25,8 +25,7 @@ export function utilIdleWorker(tasks, processor, callback) {
callback(results);
})();
// alternatively, each task deferred in its own callback
// seems to not work because it
// alternatively, each task deferred in its own callback seems to not work
// var processed = [];
// var currentPos = 0;