You can now open multiple images when creating via OpenSeadragon()

This commit is contained in:
Ian Gilman 2014-10-29 17:14:46 -07:00
parent 72aa6c4669
commit a68be6ac68
2 changed files with 19 additions and 33 deletions

View File

@ -221,41 +221,11 @@ $.Viewer = function( options ) {
$.ControlDock.call( this, options );
//Deal with tile sources
var initialTileSource;
if ( this.xmlPath ){
//Deprecated option. Now it is preferred to use the tileSources option
this.tileSources = [ this.xmlPath ];
}
if ( this.tileSources ){
// tileSources is a complex option...
//
// It can be a string, object, or an array of any of strings and objects.
// At this point we only care about if it is an Array or not.
//
if( $.isArray( this.tileSources ) ){
//must be a sequence of tileSource since the first item
//is a legacy tile source
if( this.tileSources.length > 1 ){
THIS[ this.hash ].sequenced = true;
}
//Keeps the initial page within bounds
if ( this.initialPage > this.tileSources.length - 1 ){
this.initialPage = this.tileSources.length - 1;
}
initialTileSource = this.tileSources[ this.initialPage ];
//Update the sequence (aka currrent page) property
THIS[ this.hash ].sequence = this.initialPage;
} else {
initialTileSource = this.tileSources;
}
}
this.element = this.element || document.getElementById( this.id );
this.canvas = $.makeNeutralElement( "div" );
this.keyboardCommandArea = $.makeNeutralElement( "textarea" );
@ -540,8 +510,8 @@ $.Viewer = function( options ) {
}
// Open initial tilesources
if ( initialTileSource ) {
this.open( initialTileSource );
if ( this.tileSources ) {
this.open( this.tileSources );
if ( this.tileSources.length > 1 ) {
this._updateSequenceButtons( this.initialPage );

View File

@ -6,15 +6,31 @@
init: function() {
var self = this;
var tileSources = [
{
tileSource: "../../data/tall.dzi",
x: 1.5,
y: 0,
width: 1
}, {
tileSource: '../../data/wide.dzi',
opacity: 1,
x: 0,
y: 1.5,
height: 1
}
];
this.viewer = OpenSeadragon( {
// debugMode: true,
zoomPerScroll: 1.02,
showNavigator: true,
id: "contentDiv",
tileSources: tileSources,
prefixUrl: "../../../build/openseadragon/images/"
} );
this.crossTest3();
// this.crossTest3();
},
// ----------