Merge pull request #734 from fs-webdev/master

Added cancel pending images to world.removeAll
This commit is contained in:
Ian Gilman 2015-09-24 09:11:46 -07:00
commit 8368138e17
2 changed files with 10 additions and 1 deletions

View File

@ -1243,7 +1243,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
};
function raiseAddItemFailed( event ) {
for (var i = 0; i < _this._loadQueue; i++) {
for (var i = 0; i < _this._loadQueue.length; i++) {
if (_this._loadQueue[i] === myQueueItem) {
_this._loadQueue.splice(i, 1);
break;
@ -1982,6 +1982,13 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
for ( i = 0; i < length; i++ ) {
this.currentOverlays[ i ].drawHTML( this.overlaysContainer, this.viewport );
}
},
/**
* Cancel the "in flight" images.
*/
_cancelPendingImages: function() {
this._loadQueue = [];
}
});

View File

@ -202,6 +202,8 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
* @fires OpenSeadragon.World.event:metrics-change
*/
removeAll: function() {
// We need to make sure any pending images are canceled so the world items don't get messed up
this.viewer._cancelPendingImages();
var item;
for (var i = 0; i < this._items.length; i++) {
item = this._items[i];