From fc972df52ebc21bce4368439c45a64d231fac703 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Tue, 8 Oct 2013 14:53:08 -0700 Subject: [PATCH 01/14] Update openseadragon.js --- src/openseadragon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 4e63fd22..cacd19b4 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -489,7 +489,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ xmlPath: null, tileSources: null, tileHost: null, - + initialPage 0, //PAN AND ZOOM SETTINGS AND CONSTRAINTS panHorizontal: true, panVertical: true, From ec71a4416eb9a43fdab571eb1860c6a30301dd69 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Tue, 8 Oct 2013 15:01:28 -0700 Subject: [PATCH 02/14] Update viewer.js --- src/viewer.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index ecd8560f..88b20db0 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -200,12 +200,14 @@ $.Viewer = function( options ) { if( this.tileSources.length > 1 ){ THIS[ this.hash ].sequenced = true; } - initialTileSource = this.tileSources[ 0 ]; + initialTileSource = this.tileSources[ this.initialPage ]; + this.goToPage( this.initialPage ); } else { initialTileSource = this.tileSources; + this.open( initialTileSource ); } - this.open( initialTileSource ); + } this.element = this.element || document.getElementById( this.id ); @@ -1066,7 +1068,10 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, } return this; }, - + + currentPage: function () { + return THIS[ this.hash ].sequence; + }, /** * @function From 54bcd6ea7904edbfdb6fa316b1d486b9635df952 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Tue, 8 Oct 2013 17:07:49 -0700 Subject: [PATCH 03/14] Update viewer.js Remove the sequence control update and put it into its own function. This way it can be called after a tilesource is loaded. --- src/viewer.js | 48 +++++++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 17 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 88b20db0..a44316c5 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -200,11 +200,14 @@ $.Viewer = function( options ) { 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 ]; - this.goToPage( this.initialPage ); + THIS[ this.hash ].sequence = this.initialPage; } else { initialTileSource = this.tileSources; - this.open( initialTileSource ); } @@ -345,6 +348,12 @@ $.Viewer = function( options ) { this.bindStandardControls(); this.bindSequenceControls(); + this.open( initialTileSource ); + + if (_this.tileSources.length > 1){ + _this.sequenceButtons(_this.initialPage); + } + for ( i = 0; i < this.customControls.length; i++ ) { this.addControl( this.customControls[ i ].id, @@ -1069,23 +1078,11 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, return this; }, - currentPage: function () { + currentPage: function () { return THIS[ this.hash ].sequence; }, - - /** - * @function - * @name OpenSeadragon.Viewer.prototype.goToPage - * @return {OpenSeadragon.Viewer} Chainable. - */ - goToPage: function( page ){ - //page is a 1 based index so normalize now - //page = page; - this.raiseEvent( 'page', { page: page, viewer: this } ); - - if( this.tileSources.length > page ){ - - THIS[ this.hash ].sequence = page; + + sequenceButtons: function (page) { if( this.nextButton ){ if( ( this.tileSources.length - 1 ) === page ){ @@ -1107,6 +1104,23 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, } } } + }, + + /** + * @function + * @name OpenSeadragon.Viewer.prototype.goToPage + * @return {OpenSeadragon.Viewer} Chainable. + */ + goToPage: function( page ){ + //page is a 1 based index so normalize now + //page = page; + this.raiseEvent( 'page', { page: page, viewer: this } ); + + if( this.tileSources.length > page ){ + + THIS[ this.hash ].sequence = page; + + this.sequenceButtons(page); this.open( this.tileSources[ page ] ); } From c6597806ba4f7f30d63af384056dc3f777a7c1b6 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Tue, 8 Oct 2013 17:10:26 -0700 Subject: [PATCH 04/14] Update viewer.js --- src/viewer.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/viewer.js b/src/viewer.js index a44316c5..8d43b7cc 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -205,6 +205,8 @@ $.Viewer = function( options ) { 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; From 2f33e6c66671a1f498af9bc5aabae0264b618372 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Tue, 8 Oct 2013 21:45:26 -0700 Subject: [PATCH 05/14] Update viewer.js --- src/viewer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/viewer.js b/src/viewer.js index 8d43b7cc..88e2dec7 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -203,7 +203,8 @@ $.Viewer = function( options ) { //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 From 81664251cc8ea2b2162ef3c433aa0f6cf651a6f6 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Wed, 9 Oct 2013 15:22:36 -0700 Subject: [PATCH 06/14] Update openseadragon.js Missing colon --- src/openseadragon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index cacd19b4..a16b33d4 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -489,7 +489,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ xmlPath: null, tileSources: null, tileHost: null, - initialPage 0, + initialPage: 0, //PAN AND ZOOM SETTINGS AND CONSTRAINTS panHorizontal: true, panVertical: true, From 0d8d770327824f173c6955d1acb53aec89dd70e8 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Wed, 9 Oct 2013 15:27:43 -0700 Subject: [PATCH 07/14] Update viewer.js --- src/viewer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 88e2dec7..9d6e19be 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -11,7 +11,7 @@ * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - * - Redistributions in binary form must reproduce the above copyright + * - Redistributions in binary form must reproduce the above copyrightthis * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * @@ -201,8 +201,8 @@ $.Viewer = function( options ) { THIS[ this.hash ].sequenced = true; } //Keeps the initial page within bounds - if ( this.initialPage > this.tileSources.length - 1){ - this.initialPage = this.tileSources.length - 1 + if ( this.initialPage > this.tileSources.length - 1 ){ + this.initialPage = this.tileSources.length - 1; } initialTileSource = this.tileSources[ this.initialPage ]; @@ -353,8 +353,8 @@ $.Viewer = function( options ) { this.open( initialTileSource ); - if (_this.tileSources.length > 1){ - _this.sequenceButtons(_this.initialPage); + if (this.tileSources.length > 1){ + this.sequenceButtons(this.initialPage); } for ( i = 0; i < this.customControls.length; i++ ) { From 0f705d093a44ce086a42585b53a5a8852d776547 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Wed, 9 Oct 2013 15:31:33 -0700 Subject: [PATCH 08/14] Update viewer.js --- src/viewer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viewer.js b/src/viewer.js index 9d6e19be..c1754d88 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -11,7 +11,7 @@ * - Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * - * - Redistributions in binary form must reproduce the above copyrightthis + * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * From 6f79f80fe031a017d5a473f3f24837eda70f6dc5 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Wed, 9 Oct 2013 15:36:21 -0700 Subject: [PATCH 09/14] Update viewer.js trailing white space.... --- src/viewer.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index c1754d88..6f1db293 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -208,7 +208,7 @@ $.Viewer = function( options ) { initialTileSource = this.tileSources[ this.initialPage ]; //Update the sequence (aka currrent page) property - THIS[ this.hash ].sequence = this.initialPage; + THIS[ this.hash ].sequence = this.initialPage; } else { initialTileSource = this.tileSources; } @@ -1082,7 +1082,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, }, currentPage: function () { - return THIS[ this.hash ].sequence; + return THIS[ this.hash ].sequence; }, sequenceButtons: function (page) { @@ -1107,7 +1107,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, } } } - }, + }, /** * @function From 7aac7ffd9c5e26b3e4c04871f94cda97f605c7a1 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Thu, 10 Oct 2013 12:05:05 -0700 Subject: [PATCH 10/14] Update openseadragon.js Align initialPage value --- src/openseadragon.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index a16b33d4..0c0a01ca 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -489,7 +489,8 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ xmlPath: null, tileSources: null, tileHost: null, - initialPage: 0, + initialPage: 0, + //PAN AND ZOOM SETTINGS AND CONSTRAINTS panHorizontal: true, panVertical: true, From a862870883e9ad6f3857745ad381d05500a16e4e Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Thu, 10 Oct 2013 12:25:11 -0700 Subject: [PATCH 11/14] Update viewer.js Formatting; descriptions; rename sequenceButtons to _updateSequenceButtons --- src/viewer.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 6f1db293..6ac66609 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -200,6 +200,7 @@ $.Viewer = function( options ) { 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; @@ -212,8 +213,6 @@ $.Viewer = function( options ) { } else { initialTileSource = this.tileSources; } - - } this.element = this.element || document.getElementById( this.id ); @@ -351,10 +350,12 @@ $.Viewer = function( options ) { this.bindStandardControls(); this.bindSequenceControls(); - this.open( initialTileSource ); + if ( initialTileSource ) { + this.open( initialTileSource ); + } - if (this.tileSources.length > 1){ - this.sequenceButtons(this.initialPage); + if ( this.tileSources.length > 1 ) { + this._updateSequenceButtons( this.initialPage ); } for ( i = 0; i < this.customControls.length; i++ ) { @@ -1081,11 +1082,22 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, return this; }, + /** + * @function + * @name OpenSeadragon.Viewer.prototype.currentPage + * @return {Number} + */ currentPage: function () { return THIS[ this.hash ].sequence; }, - - sequenceButtons: function (page) { + + /** + * Updates the sequence buttons. + * @function + * @private + * @param {Number} Sequence Value + */ + _updateSequenceButtons: function (page) { if( this.nextButton ){ if( ( this.tileSources.length - 1 ) === page ){ @@ -1123,7 +1135,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, THIS[ this.hash ].sequence = page; - this.sequenceButtons(page); + this._updateSequenceButtons( page ); this.open( this.tileSources[ page ] ); } From 6b90687ab46ab0de94317edea94cb8b0987b96c0 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Thu, 10 Oct 2013 12:27:49 -0700 Subject: [PATCH 12/14] Update viewer.js description; Move _updateSequenceButtons behind goToPage() --- src/viewer.js | 61 ++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 6ac66609..cfb6d02a 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1083,6 +1083,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, }, /** + * Gets the active page of a sequence * @function * @name OpenSeadragon.Viewer.prototype.currentPage * @return {Number} @@ -1090,36 +1091,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, currentPage: function () { return THIS[ this.hash ].sequence; }, - - /** - * Updates the sequence buttons. - * @function - * @private - * @param {Number} Sequence Value - */ - _updateSequenceButtons: function (page) { - - if( this.nextButton ){ - if( ( this.tileSources.length - 1 ) === page ){ - //Disable next button - if(!this.navPrevNextWrap){ - this.nextButton.disable(); - } - } else { - this.nextButton.enable(); - } - } - if( this.previousButton ){ - if( page > 0 ){ - //Enable previous button - this.previousButton.enable(); - } else { - if(!this.navPrevNextWrap){ - this.previousButton.disable(); - } - } - } - }, /** * @function @@ -1152,6 +1123,36 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, return this; }, + /** + * Updates the sequence buttons. + * @function + * @private + * @param {Number} Sequence Value + */ + _updateSequenceButtons: function (page) { + + if( this.nextButton ){ + if( ( this.tileSources.length - 1 ) === page ){ + //Disable next button + if(!this.navPrevNextWrap){ + this.nextButton.disable(); + } + } else { + this.nextButton.enable(); + } + } + if( this.previousButton ){ + if( page > 0 ){ + //Enable previous button + this.previousButton.enable(); + } else { + if(!this.navPrevNextWrap){ + this.previousButton.disable(); + } + } + } + }, + /** * Display a message in the viewport * @function From 4535f47e8dc2a942e9e07df4b83fe2bff495e7ec Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Thu, 10 Oct 2013 12:35:49 -0700 Subject: [PATCH 13/14] Update viewer.js trailing whitespace... --- src/viewer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viewer.js b/src/viewer.js index cfb6d02a..a1100bb1 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1128,7 +1128,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, * @function * @private * @param {Number} Sequence Value - */ + */ _updateSequenceButtons: function (page) { if( this.nextButton ){ From 30786429278ae1fc66b08c2142e80e2f55e22798 Mon Sep 17 00:00:00 2001 From: Sharpbarb Date: Thu, 10 Oct 2013 12:57:02 -0700 Subject: [PATCH 14/14] Update viewer.js Moved call to _updateSequenceButtons inside if ( initialTileSource ) --- src/viewer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index a1100bb1..7c3fd2d7 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -352,12 +352,12 @@ $.Viewer = function( options ) { if ( initialTileSource ) { this.open( initialTileSource ); + + if ( this.tileSources.length > 1 ) { + this._updateSequenceButtons( this.initialPage ); + } } - - if ( this.tileSources.length > 1 ) { - this._updateSequenceButtons( this.initialPage ); - } - + for ( i = 0; i < this.customControls.length; i++ ) { this.addControl( this.customControls[ i ].id,