First version of sequence mode

This commit is contained in:
Ian Gilman 2014-11-14 16:51:02 -08:00
parent 1ebfc28d47
commit 0dd97dbc56
2 changed files with 30 additions and 15 deletions

View File

@ -207,6 +207,7 @@ $.Viewer = function( options ) {
"onfullscreenchange": null "onfullscreenchange": null
}; };
this._firstOpen = true;
this._updateRequestId = null; this._updateRequestId = null;
this.currentOverlays = []; this.currentOverlays = [];
@ -374,7 +375,6 @@ $.Viewer = function( options ) {
} }
this.bindStandardControls(); this.bindStandardControls();
this.bindSequenceControls();
THIS[ this.hash ].prevContainerSize = _getSafeElemSize( this.container ); 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 // Open initial tilesources
if ( this.tileSources ) { if ( this.tileSources ) {
this.open( this.tileSources ); if (this.sequenceMode) {
this.open(this.tileSources[this.initialPage]);
if ( this.tileSources.length > 1 ) {
this._updateSequenceButtons( 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() { var checkCompletion = function() {
if (successes + failures === expected) { if (successes + failures === expected) {
if (successes) { if (successes) {
if (!_this.preserveViewport) { if (_this._firstOpen || !_this.preserveViewport) {
_this.viewport.goHome( true ); _this.viewport.goHome( true );
} }
_this._firstOpen = false;
var source = tileSources[0]; var source = tileSources[0];
if (source.tileSource) { if (source.tileSource) {
source = source.tileSource; source = source.tileSource;

View File

@ -6,7 +6,7 @@
init: function() { init: function() {
var self = this; var self = this;
var testInitialOpen = false; var testInitialOpen = true;
var testOverlays = false; var testOverlays = false;
var testMargins = false; var testMargins = false;
var testNavigator = false; var testNavigator = false;
@ -16,9 +16,12 @@
// debugMode: true, // debugMode: true,
zoomPerScroll: 1.02, zoomPerScroll: 1.02,
showNavigator: testNavigator, showNavigator: testNavigator,
collectionMode: true, sequenceMode: true,
collectionRows: 3, navPrevNextWrap: false,
collectionLayout: 'vertical', preserveViewport: false,
// collectionMode: true,
// collectionRows: 3,
// collectionLayout: 'vertical',
// collectionTileSize: 10, // collectionTileSize: 10,
// collectionTileMargin: 10, // collectionTileMargin: 10,
// wrapHorizontal: true, // wrapHorizontal: true,
@ -29,12 +32,13 @@
if (testInitialOpen) { if (testInitialOpen) {
config.tileSources = [ 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', tileSource: '../../data/wide.dzi',
opacity: 1, opacity: 1,
x: 0, x: 0,
@ -101,7 +105,7 @@
} }
// this.crossTest3(); // this.crossTest3();
this.collectionTest(); // this.collectionTest();
}, },
// ---------- // ----------