From 7330b4a7262732e095a6215ac5e28e8912420fdf Mon Sep 17 00:00:00 2001 From: David Steinbrunner Date: Tue, 28 May 2013 17:36:09 -0300 Subject: [PATCH 01/10] Correction to setControlsEnabled function name in comments --- src/viewer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/viewer.js b/src/viewer.js index 9ea2caed..976243c0 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -523,7 +523,7 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, /** * @function - * @name OpenSeadragon.Viewer.prototype.setDashboardEnabled + * @name OpenSeadragon.Viewer.prototype.setControlsEnabled * @return {OpenSeadragon.Viewer} Chainable. */ setControlsEnabled: function( enabled ) { From b7eb78a57ac10d4c96e0d7eea340fa4458caaad0 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 28 May 2013 13:54:13 -0700 Subject: [PATCH 02/10] Additional doc comments for setControlsEnabled() --- src/viewer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/viewer.js b/src/viewer.js index 976243c0..a44717ee 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -522,8 +522,11 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, /** + * Shows or hides the controls (e.g. the default navigation buttons). + * * @function * @name OpenSeadragon.Viewer.prototype.setControlsEnabled + * @param {Boolean} true to show, false to hide. * @return {OpenSeadragon.Viewer} Chainable. */ setControlsEnabled: function( enabled ) { From 91da6af39293505be2f265116a0bba1631300c82 Mon Sep 17 00:00:00 2001 From: David Steinbrunner Date: Tue, 28 May 2013 17:34:20 -0400 Subject: [PATCH 03/10] domn to down typo fixes --- src/button.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/button.js b/src/button.js index 88c73274..32e15950 100644 --- a/src/button.js +++ b/src/button.js @@ -57,7 +57,7 @@ $.ButtonState = { * @param {String} options.srcRest URL of image to use in 'rest' state * @param {String} options.srcGroup URL of image to use in 'up' state * @param {String} options.srcHover URL of image to use in 'hover' state - * @param {String} options.srcDown URL of image to use in 'domn' state + * @param {String} options.srcDown URL of image to use in 'down' state * @param {Element} [options.element] Element to use as a container for the * button. * @property {String} tooltip Provides context help for the button we the @@ -65,7 +65,7 @@ $.ButtonState = { * @property {String} srcRest URL of image to use in 'rest' state * @property {String} srcGroup URL of image to use in 'up' state * @property {String} srcHover URL of image to use in 'hover' state - * @property {String} srcDown URL of image to use in 'domn' state + * @property {String} srcDown URL of image to use in 'down' state * @property {Object} config Configurable settings for this button. DEPRECATED. * @property {Element} [element] Element to use as a container for the * button. From 1d51b72785f4d14ca0e26fd1d1f69c25f9deb2e7 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Wed, 29 May 2013 11:18:25 -0700 Subject: [PATCH 04/10] Fixed blendTile()-related blurriness issue We were setting drawer.updateAgain to the result of each blendTile(), which meant it was keeping only the last result. Instead we should have been only setting it to true if blendTile returned true, but never setting it to false. Fixed. --- src/drawer.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/drawer.js b/src/drawer.js index 72c932d5..833d1fe6 100644 --- a/src/drawer.js +++ b/src/drawer.js @@ -709,8 +709,7 @@ function updateTile( drawer, drawLevel, haveDrawn, x, y, level, levelOpacity, le ); if ( tile.loaded ) { - - drawer.updateAgain = blendTile( + var needsUpdate = blendTile( drawer, tile, x, y, @@ -718,6 +717,10 @@ function updateTile( drawer, drawLevel, haveDrawn, x, y, level, levelOpacity, le levelOpacity, currentTime ); + + if ( needsUpdate ) { + drawer.updateAgain = true; + } } else if ( tile.loading ) { // the tile is already in the download queue // thanks josh1093 for finally translating this typo From b5d977d593557cfffda139a1035b1e7a6b218bca Mon Sep 17 00:00:00 2001 From: Robert Hickman Date: Wed, 29 May 2013 17:10:45 -0600 Subject: [PATCH 05/10] Adding an option that allows the previous and next buttons to wrap around past the end or beginning images. --- changelog.txt | 1 + src/openseadragon.js | 1 + src/viewer.js | 18 ++++++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 9e696ade..af8a9d18 100644 --- a/changelog.txt +++ b/changelog.txt @@ -9,6 +9,7 @@ OPENSEADRAGON CHANGELOG * Keyboard handling is now done in the viewer rather than navigator (#46) * Additional navigator fixes (#46) * Fixed an error in EventHandler.removeHandler() (#48) +* You can now choose to have previous and next buttons wrap using the config.navPrevNextWrap. 0.9.127: diff --git a/src/openseadragon.js b/src/openseadragon.js index 83f417fa..ab899aa0 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -588,6 +588,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){ DOWN: 'next_pressed.png' } }, + navPrevNextWrap: false, //DEVELOPER SETTINGS debugMode: false, diff --git a/src/viewer.js b/src/viewer.js index a44717ee..7c7c4722 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -345,6 +345,10 @@ $.Viewer = function( options ) { beginControlsAutoHide( _this ); } ); // initial fade out + if(this.navPrevNextWrap){ + this.previousButton.enable(); + } + }; $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, { @@ -1021,7 +1025,9 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, if( this.nextButton ){ if( ( this.tileSources.length - 1 ) === page ){ //Disable next button - this.nextButton.disable(); + if(!this.navPrevNextWrap){ + this.nextButton.disable(); + } } else { this.nextButton.enable(); } @@ -1031,7 +1037,9 @@ $.extend( $.Viewer.prototype, $.EventHandler.prototype, $.ControlDock.prototype, //Enable previous button this.previousButton.enable(); } else { - this.previousButton.disable(); + if(!this.navPrevNextWrap){ + this.previousButton.disable(); + } } } @@ -1625,12 +1633,18 @@ function onFullPage() { function onPrevious(){ var previous = THIS[ this.hash ].sequence - 1; + if(this.navPrevNextWrap && previous < 0){ + previous += this.tileSources.length; + } this.goToPage( previous ); } function onNext(){ var next = THIS[ this.hash ].sequence + 1; + if(this.navPrevNextWrap && next >= this.tileSources.length){ + next = 0; + } this.goToPage( next ); } From b66dd7bed026d19d3f388a99bc35227cdad4f972 Mon Sep 17 00:00:00 2001 From: Ventero Date: Thu, 30 May 2013 02:49:45 +0200 Subject: [PATCH 06/10] Don't load the tile source again when creating a navigator. Previously, when showNavigator was set to true when creating the viewer, the navigator would unnecessarily load and parse the tile source, even though a fully parsed object already exists. --- src/viewer.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index a44717ee..233c245e 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1147,7 +1147,10 @@ function openTileSource( viewer, source ) { sizeRatio: _this.navigatorSizeRatio, height: _this.navigatorHeight, width: _this.navigatorWidth, - tileSources: _this.tileSources, + // By passing the fully parsed source here, the navigator doesn't + // have to load it again. Additionally, we don't have to call + // navigator.open, as it's implicitly called in the ctor. + tileSources: source, tileHost: _this.tileHost, prefixUrl: _this.prefixUrl, overlays: _this.overlays, @@ -1212,10 +1215,6 @@ function openTileSource( viewer, source ) { } VIEWERS[ _this.hash ] = _this; - if( _this.navigator ){ - _this.navigator.open( source ); - } - _this.raiseEvent( 'open', { source: source, viewer: _this } ); return _this; From 498d972ef82e2e9cc0805d78f87db23c3de05600 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 30 May 2013 10:03:25 -0700 Subject: [PATCH 07/10] Removed changelog recommendation from readme as per discussion in #90 --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 28aae1c9..757ea619 100644 --- a/README.md +++ b/README.md @@ -68,9 +68,8 @@ When contributing, please attempt to match the code style already in the codebas When fixing bugs and adding features, when appropriate please also: -* Update changelog.txt -* Add/update related unit tests * Update related doc comments +* Add/update related unit tests If you're new to the project, check out our [good first bug](https://github.com/openseadragon/openseadragon/issues?labels=good+first+bug&page=1&state=open) issues for some places to dip your toe in the water. From a551922537ef92c172966a028a4a9cd02934b349 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 30 May 2013 10:03:37 -0700 Subject: [PATCH 08/10] Update changelog for recent fixes --- changelog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.txt b/changelog.txt index 9e696ade..e8bbdbe6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -9,6 +9,9 @@ OPENSEADRAGON CHANGELOG * Keyboard handling is now done in the viewer rather than navigator (#46) * Additional navigator fixes (#46) * Fixed an error in EventHandler.removeHandler() (#48) +* Better requestAnimationFrame detection on older Firefox (#103) +* More efficient navigator loading (#115) +* Sometimes tiles wouldn't resolve if you used the blendTime option; fixed. (#95) 0.9.127: From 699a5dd101e0dbbe99c6e915b8855e87057e2618 Mon Sep 17 00:00:00 2001 From: Robert Hickman Date: Thu, 30 May 2013 12:46:54 -0600 Subject: [PATCH 09/10] Adding documentation about navPrevNextWrap. --- src/openseadragon.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/openseadragon.js b/src/openseadragon.js index ab899aa0..ee5e0dac 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -251,6 +251,11 @@ * these paths, prefer setting the option.prefixUrl rather than overriding * every image path directly through this setting. * + * @param {Boolean} [options.navPrevNextWrap=false] + * If the 'previous' button will wrap to the last image when viewing the first + * image and if the 'next' button will wrap to the first image when viewing + * the last image. + * * @returns {OpenSeadragon.Viewer} */ window.OpenSeadragon = window.OpenSeadragon || function( options ){ From c1f0b384c896ba913b2154f874663e8e892b54f6 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Fri, 31 May 2013 09:04:32 -0700 Subject: [PATCH 10/10] Added pull number to changelog item --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 1f0d10b6..e87729b5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -12,7 +12,7 @@ OPENSEADRAGON CHANGELOG * Better requestAnimationFrame detection on older Firefox (#103) * More efficient navigator loading (#115) * Sometimes tiles wouldn't resolve if you used the blendTime option; fixed. (#95) -* You can now choose to have previous and next buttons wrap using the config.navPrevNextWrap. +* You can now choose to have previous and next buttons wrap using the config.navPrevNextWrap. (#114) 0.9.127: