mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-31 23:21:42 +03:00
Optimized adding large numbers of items to the world.
This commit is contained in:
parent
9bd84928dc
commit
4643851da9
@ -1250,6 +1250,10 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_this._loadQueue.length === 0) {
|
||||||
|
refreshWorld(myQueueItem);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raised when an error occurs while adding a item.
|
* Raised when an error occurs while adding a item.
|
||||||
* @event add-item-failed
|
* @event add-item-failed
|
||||||
@ -1268,6 +1272,19 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refreshWorld(theItem) {
|
||||||
|
if (_this.collectionMode) {
|
||||||
|
_this.world.arrange({
|
||||||
|
immediately: theItem.options.collectionImmediately,
|
||||||
|
rows: _this.collectionRows,
|
||||||
|
columns: _this.collectionColumns,
|
||||||
|
layout: _this.collectionLayout,
|
||||||
|
tileSize: _this.collectionTileSize,
|
||||||
|
tileMargin: _this.collectionTileMargin
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._loadQueue.push(myQueueItem);
|
this._loadQueue.push(myQueueItem);
|
||||||
|
|
||||||
getTileSourceImplementation( this, options.tileSource, function( tileSource ) {
|
getTileSourceImplementation( this, options.tileSource, function( tileSource ) {
|
||||||
@ -1328,19 +1345,16 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
debugMode: _this.debugMode
|
debugMode: _this.debugMode
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (_this.collectionMode) {
|
||||||
|
_this.world.setAutoRefigureSizes(false);
|
||||||
|
}
|
||||||
_this.world.addItem( tiledImage, {
|
_this.world.addItem( tiledImage, {
|
||||||
index: queueItem.options.index
|
index: queueItem.options.index
|
||||||
});
|
});
|
||||||
|
|
||||||
if (_this.collectionMode) {
|
if (_this._loadQueue.length === 0) {
|
||||||
_this.world.arrange({
|
//this restores the autoRefigureSizes flag to true.
|
||||||
immediately: queueItem.options.collectionImmediately,
|
refreshWorld(queueItem);
|
||||||
rows: _this.collectionRows,
|
|
||||||
columns: _this.collectionColumns,
|
|
||||||
layout: _this.collectionLayout,
|
|
||||||
tileSize: _this.collectionTileSize,
|
|
||||||
tileMargin: _this.collectionTileMargin
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_this.world.getItemCount() === 1 && !_this.preserveViewport) {
|
if (_this.world.getItemCount() === 1 && !_this.preserveViewport) {
|
||||||
|
@ -85,7 +85,12 @@ $.extend( $.World.prototype, $.EventSource.prototype, /** @lends OpenSeadragon.W
|
|||||||
this._items.push( item );
|
this._items.push( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this._autoRefigureSizes) {
|
||||||
this._figureSizes();
|
this._figureSizes();
|
||||||
|
} else {
|
||||||
|
this._needsSizesFigured = true;
|
||||||
|
}
|
||||||
|
|
||||||
this._needsDraw = true;
|
this._needsDraw = true;
|
||||||
|
|
||||||
item.addHandler('bounds-change', this._delegatedFigureSizes);
|
item.addHandler('bounds-change', this._delegatedFigureSizes);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user