mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-06 19:31:41 +00:00
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:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user