mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-01-31 23:21:42 +03:00
Added option in addTiledImage to replace tiledImage at index.
This commit is contained in:
parent
5a2733bbc1
commit
f13691f60d
@ -1193,6 +1193,10 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
* named 'getTileUrl', it is treated as a custom TileSource.
|
* named 'getTileUrl', it is treated as a custom TileSource.
|
||||||
* @param {Number} [options.index] The index of the item. Added on top of
|
* @param {Number} [options.index] The index of the item. Added on top of
|
||||||
* all other items if not specified.
|
* all other items if not specified.
|
||||||
|
* @param {Boolean} [options.replace=false] If true, the item at options.index will be
|
||||||
|
* removed and the new item is added in its place. options.tileSource will be
|
||||||
|
* interpreted and fetched if necessary before the old item is removed to avoid leaving
|
||||||
|
* a gap in the world.
|
||||||
* @param {Number} [options.x=0] The X position for the image in viewport coordinates.
|
* @param {Number} [options.x=0] The X position for the image in viewport coordinates.
|
||||||
* @param {Number} [options.y=0] The Y position for the image in viewport coordinates.
|
* @param {Number} [options.y=0] The Y position for the image in viewport coordinates.
|
||||||
* @param {Number} [options.width=1] The width for the image in viewport coordinates.
|
* @param {Number} [options.width=1] The width for the image in viewport coordinates.
|
||||||
@ -1216,6 +1220,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
addTiledImage: function( options ) {
|
addTiledImage: function( options ) {
|
||||||
$.console.assert(options, "[Viewer.addTiledImage] options is required");
|
$.console.assert(options, "[Viewer.addTiledImage] options is required");
|
||||||
$.console.assert(options.tileSource, "[Viewer.addTiledImage] options.tileSource is required");
|
$.console.assert(options.tileSource, "[Viewer.addTiledImage] options.tileSource is required");
|
||||||
|
$.console.assert(!options.replace || (options.index > -1 && options.index < this.world.getItemCount()),
|
||||||
|
"[Viewer.addTiledImage] if options.replace is used, options.index must be a valid index in Viewer.world");
|
||||||
|
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
@ -1283,6 +1289,10 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
|
|
||||||
_this._loadQueue.splice(0, 1);
|
_this._loadQueue.splice(0, 1);
|
||||||
|
|
||||||
|
if (queueItem.options.replace) {
|
||||||
|
_this.world.removeItem(_this.world.getItemAt(queueItem.options.index));
|
||||||
|
}
|
||||||
|
|
||||||
tiledImage = new $.TiledImage({
|
tiledImage = new $.TiledImage({
|
||||||
viewer: _this,
|
viewer: _this,
|
||||||
source: queueItem.tileSource,
|
source: queueItem.tileSource,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user