mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-28 16:16:08 +03:00
Merge pull request #1196 from VipSaran/master
fix for #1191 (extension of Viewer.open() function with initialPage argument)
This commit is contained in:
commit
bf1b5fd793
@ -96,6 +96,12 @@ $.Viewer = function( options ) {
|
|||||||
//internal state and dom identifiers
|
//internal state and dom identifiers
|
||||||
id: options.id,
|
id: options.id,
|
||||||
hash: options.hash || nextHash++,
|
hash: options.hash || nextHash++,
|
||||||
|
/**
|
||||||
|
* If sequenceMode is true, display this page initially for the given tileSources.
|
||||||
|
* @member {Number} initialPage
|
||||||
|
* @memberof OpenSeadragon.Viewer#
|
||||||
|
*/
|
||||||
|
initialPage: 0,
|
||||||
|
|
||||||
//dom nodes
|
//dom nodes
|
||||||
/**
|
/**
|
||||||
@ -482,11 +488,13 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
* except for the index property; images are added in sequence.
|
* except for the index property; images are added in sequence.
|
||||||
* A TileSource specifier is anything you could pass as the tileSource property
|
* A TileSource specifier is anything you could pass as the tileSource property
|
||||||
* of the options parameter for {@link OpenSeadragon.Viewer#addTiledImage}.
|
* of the options parameter for {@link OpenSeadragon.Viewer#addTiledImage}.
|
||||||
|
* @param {Number} initialPage - If sequenceMode is true, display this page initially
|
||||||
|
* for the given tileSources. If specified, will overwrite the existing homonymous option.
|
||||||
* @return {OpenSeadragon.Viewer} Chainable.
|
* @return {OpenSeadragon.Viewer} Chainable.
|
||||||
* @fires OpenSeadragon.Viewer.event:open
|
* @fires OpenSeadragon.Viewer.event:open
|
||||||
* @fires OpenSeadragon.Viewer.event:open-failed
|
* @fires OpenSeadragon.Viewer.event:open-failed
|
||||||
*/
|
*/
|
||||||
open: function (tileSources) {
|
open: function (tileSources, initialPage) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
|
||||||
this.close();
|
this.close();
|
||||||
@ -501,6 +509,10 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
this.referenceStrip = null;
|
this.referenceStrip = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof initialPage != 'undefined' && !isNaN(initialPage)) {
|
||||||
|
this.initialPage = initialPage;
|
||||||
|
}
|
||||||
|
|
||||||
this.tileSources = tileSources;
|
this.tileSources = tileSources;
|
||||||
this._sequenceIndex = Math.max(0, Math.min(this.tileSources.length - 1, this.initialPage));
|
this._sequenceIndex = Math.max(0, Math.min(this.tileSources.length - 1, this.initialPage));
|
||||||
if (this.tileSources.length) {
|
if (this.tileSources.length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user