diff --git a/src/viewer.js b/src/viewer.js index 2b2ea1f1..52583764 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -207,6 +207,7 @@ $.Viewer = function( options ) { "onfullscreenchange": null }; + this._firstOpen = true; this._updateRequestId = null; this.currentOverlays = []; @@ -374,7 +375,6 @@ $.Viewer = function( options ) { } this.bindStandardControls(); - this.bindSequenceControls(); THIS[ this.hash ].prevContainerSize = _getSafeElemSize( this.container ); @@ -505,12 +505,21 @@ $.Viewer = function( options ) { }); } + // Sequence mode + if (this.sequenceMode) { + THIS[ this.hash ].sequenced = true; + this.initialPage = Math.max(0, Math.min(this.tileSources.length - 1, this.initialPage)); + THIS[ this.hash ].sequence = this.initialPage; + this.bindSequenceControls(); + } + // Open initial tilesources if ( this.tileSources ) { - this.open( this.tileSources ); - - if ( this.tileSources.length > 1 ) { + if (this.sequenceMode) { + this.open(this.tileSources[this.initialPage]); this._updateSequenceButtons( this.initialPage ); + } else { + this.open( this.tileSources ); } } @@ -589,10 +598,12 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, var checkCompletion = function() { if (successes + failures === expected) { if (successes) { - if (!_this.preserveViewport) { + if (_this._firstOpen || !_this.preserveViewport) { _this.viewport.goHome( true ); } + _this._firstOpen = false; + var source = tileSources[0]; if (source.tileSource) { source = source.tileSource; diff --git a/test/demo/collections/main.js b/test/demo/collections/main.js index 426015b2..f026453e 100644 --- a/test/demo/collections/main.js +++ b/test/demo/collections/main.js @@ -6,7 +6,7 @@ init: function() { var self = this; - var testInitialOpen = false; + var testInitialOpen = true; var testOverlays = false; var testMargins = false; var testNavigator = false; @@ -16,9 +16,12 @@ // debugMode: true, zoomPerScroll: 1.02, showNavigator: testNavigator, - collectionMode: true, - collectionRows: 3, - collectionLayout: 'vertical', + sequenceMode: true, + navPrevNextWrap: false, + preserveViewport: false, + // collectionMode: true, + // collectionRows: 3, + // collectionLayout: 'vertical', // collectionTileSize: 10, // collectionTileMargin: 10, // wrapHorizontal: true, @@ -29,12 +32,13 @@ if (testInitialOpen) { config.tileSources = [ + // { + // tileSource: "../../data/tall.dzi", + // x: 1.5, + // y: 0, + // width: 1 + // }, { - tileSource: "../../data/tall.dzi", - x: 1.5, - y: 0, - width: 1 - }, { tileSource: '../../data/wide.dzi', opacity: 1, x: 0, @@ -101,7 +105,7 @@ } // this.crossTest3(); - this.collectionTest(); + // this.collectionTest(); }, // ----------