From 3265792c3b0a2722c200aec61d0df97ea7f3c140 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 11 May 2021 20:57:19 -0700 Subject: [PATCH 01/22] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index a2f8957c..7b7ae7d6 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -2,7 +2,7 @@ github: iangilman patreon: iangilman -open_collective: # Replace with a single Open Collective username +open_collective: openseadragon ko_fi: iangilman tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry From d04ccddebeb63a5645109c8f3cd4637848ed8bc4 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 11 May 2021 20:58:53 -0700 Subject: [PATCH 02/22] Update FUNDING.yml --- .github/FUNDING.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 7b7ae7d6..50fdd83b 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,9 +1,9 @@ # These are supported funding model platforms -github: iangilman -patreon: iangilman +github: # iangilman +patreon: # iangilman open_collective: openseadragon -ko_fi: iangilman +ko_fi: # iangilman tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry liberapay: # Replace with a single Liberapay username From e78e6646e637127481f31008272135f2955f377a Mon Sep 17 00:00:00 2001 From: Chris Wilkinson Date: Fri, 18 Jun 2021 16:24:38 +0100 Subject: [PATCH 03/22] Force the display of body to be block when fullscreen --- src/viewer.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/viewer.js b/src/viewer.js index ba3c1e2a..f86bd0c9 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1000,6 +1000,9 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, bodyStyle.height = "100%"; docStyle.height = "100%"; + this.bodyDisplay = bodyStyle.display; + bodyStyle.display = "block"; + //when entering full screen on the ipad it wasn't sufficient to leave //the body intact as only only the top half of the screen would //respond to touch events on the canvas, while the bottom half treated @@ -1064,6 +1067,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, bodyStyle.height = this.bodyHeight; docStyle.height = this.docHeight; + bodyStyle.display = this.bodyDisplay; + body.removeChild( this.element ); nodes = this.previousBody.length; for ( i = 0; i < nodes; i++ ) { From cac0e5c9bd64460b8d1e5ab97052751d13f0d7a5 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 21 Jun 2021 11:44:01 -0700 Subject: [PATCH 04/22] Changelog for #1995 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index e3c57618..282cd640 100644 --- a/changelog.txt +++ b/changelog.txt @@ -51,6 +51,7 @@ OPENSEADRAGON CHANGELOG * MouseTracker: Added workaround for WebKit Pointer Event Implicit Capture Bug (#1972 @msalsbery) * Removed test for move-leave (fly-over, no enter event)...not a valid, handleable event state, no longer supported (#1972 @msalsbery) * Added OpenSeadragon.setElementPointerEvents() for setting pointer-events to other values besides 'none' on DOM elements (#1972 @msalsbery) +* Now ensuring the page body is display:block when in fullscreen (#1995 @thewilkybarkid) 2.4.2: From ef297a2c2cacb85e46c51245842513390ab618c2 Mon Sep 17 00:00:00 2001 From: Tammy DiPrima Date: Tue, 22 Jun 2021 12:32:59 -0400 Subject: [PATCH 05/22] Reference globalCompositeOperation doc Fixes openseadragon/openseadragon#1994 --- src/openseadragon.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index 01cfc864..cf4331d8 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -195,8 +195,9 @@ * * @property {String} [compositeOperation=null] * Valid values are 'source-over', 'source-atop', 'source-in', 'source-out', - * 'destination-over', 'destination-atop', 'destination-in', - * 'destination-out', 'lighter', 'copy' or 'xor' + * 'destination-over', 'destination-atop', 'destination-in', 'destination-out', + * 'lighter', 'destination', 'copy', 'xor', etc. + * For complete list of modes, please @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation/ globalCompositeOperation} * * @property {Boolean} [imageSmoothingEnabled=true] * Image smoothing for canvas rendering (only if canvas is used). Note: Ignored From 1ca9b161583dc2f7bdfb97214e644b428c56f503 Mon Sep 17 00:00:00 2001 From: Tammy DiPrima Date: Tue, 22 Jun 2021 14:52:06 -0400 Subject: [PATCH 06/22] correction difference; not destination --- src/openseadragon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index cf4331d8..d7362ae2 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -196,7 +196,7 @@ * @property {String} [compositeOperation=null] * Valid values are 'source-over', 'source-atop', 'source-in', 'source-out', * 'destination-over', 'destination-atop', 'destination-in', 'destination-out', - * 'lighter', 'destination', 'copy', 'xor', etc. + * 'lighter', 'difference', 'copy', 'xor', etc. * For complete list of modes, please @see {@link https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation/ globalCompositeOperation} * * @property {Boolean} [imageSmoothingEnabled=true] From fd85d5e22f8a8cf9f0b534c2428f4c7f645268bf Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Wed, 23 Jun 2021 11:54:13 -0700 Subject: [PATCH 07/22] Changelog for #1996 --- changelog.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 282cd640..9afd7c3e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -7,7 +7,7 @@ OPENSEADRAGON CHANGELOG * BREAKING CHANGE: Removed deprecated OpenSeadragon.getEvent function (#1949 @msalsbery) * DEPRECATION: MouseTracker exitHandler deprecated for name change to leaveHandler for consistency with DOM event names (#1872 @msalsbery) * Now when "simple image" tile sources are removed from the viewer, they free the memory used by the pyramid they create (#1789 @TakumaKira) -* Documentation fix (#1814 @kenanchristian) +* Improvements to docs (#1814 @kenanchristian, #1872 @msalsbery, #1996 @tdiprima) * Better cleanup on destruction, to avoid memory leaks (#1832 @JoFrMueller) * Better handle destruction when navigator in custom location (#1884 @woodchuck) * Miscellaneous code cleanup (#1840 @msalsbery) @@ -33,7 +33,6 @@ OPENSEADRAGON CHANGELOG * Added OpenSeadragon.setElementPointerEventsNone() for setting pointer-events:'none' on DOM elements (#1872 @msalsbery) * MouseTracker: added contextMenuHandler option for handling contextmenu events (#1872 @msalsbery) * Viewer: added a canvas-contextmenu event (#1872 @msalsbery) -* Added additional documentation for the zoomPerSecond viewer option (#1872 @msalsbery) * Fixed simulated drag events in navigator tests (#1949 @msalsbery) * Added preventDefault option to MouseTracker.contextMenuHandler and Viewer 'canvas-contextmenu' event args (#1951 @msalsbery) * MouseTracker: Added preProcessEventHandler for keydown, keyup, keypress, focus, blur Events (#1951 @msalsbery) From c639dd15e3b28d01e663f1932bf8870ee3723a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Cervera?= Date: Tue, 29 Jun 2021 19:14:46 -0500 Subject: [PATCH 08/22] Provide a static method in OpenSeadragon to get an existing viewer From limited testing, this method allows retrieval even when the viewer was instantiated in a different file. OpenSeadragon keeps internal private state in _viewers, following the convention of the underscore prefix for private members. --- src/openseadragon.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index d7362ae2..e9ca02fb 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -749,7 +749,9 @@ /* eslint-disable no-redeclare */ function OpenSeadragon( options ){ - return new OpenSeadragon.Viewer( options ); + var viewer = new OpenSeadragon.Viewer( options ); + OpenSeadragon._viewers.set(viewer.element, viewer); + return viewer; } (function( $ ){ @@ -1403,6 +1405,26 @@ function OpenSeadragon( options ){ CHROMEEDGE: 7 }, + /** + * Keep track of which {@link Viewer}s have been created. + * - Key: {@link Element} to which a Viewer is attached. + * - Value: {@link Viewer} of the element defined by the key. + * @static + * @type {Object} + */ + // eslint-disable-next-line no-undef + _viewers: new Map(), + + /** + * Returns the {@link Viewer} attached to a given DOM element. If there is + * no viewer attached to the provided element, undefined is returned. + * @function + * @param {String|Element} element Accepts an id or element. + * @returns {Viewer} The viewer attached to the given element, or undefined. + */ + getViewer: function(element) { + return $._viewers.get(this.getElement(element)); + }, /** * Returns a DOM Element for the given id or element. From 94f269d6d0b50341e547592c9feb8f6c8124f0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Cervera?= Date: Fri, 2 Jul 2021 07:33:55 -0500 Subject: [PATCH 09/22] Update globals in .eslintrc files 1. Add Map as a global 2. Use readonly/writable over false/true Change 2 was done to use non-deprecated values (last paragraph of the section): https://eslint.org/docs/user-guide/configuring/language-options#using-configuration-files-1 --- .eslintrc.hound.json | 7 ++++--- .eslintrc.json | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.eslintrc.hound.json b/.eslintrc.hound.json index 027542f4..9f651a1b 100644 --- a/.eslintrc.hound.json +++ b/.eslintrc.hound.json @@ -278,8 +278,9 @@ ] }, "globals": { - "OpenSeadragon": true, - "define": false, - "module": false + "OpenSeadragon": "writable", + "define": "readonly", + "module": "readonly", + "Map": "readonly" } } diff --git a/.eslintrc.json b/.eslintrc.json index e3495e52..75715c85 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -17,9 +17,10 @@ } }, "globals": { - "OpenSeadragon": true, - "define": false, - "module": false + "OpenSeadragon": "writable", + "define": "readonly", + "module": "readonly", + "Map": "readonly" }, "rules": { "no-unused-vars": [ From 69aba71f79c06bc8637d1b0e81a585520ca93b56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Cervera?= Date: Fri, 2 Jul 2021 07:38:01 -0500 Subject: [PATCH 10/22] Cleanup on viewer destroy and register on Viewer() Other changes: - ESLint comment about undeclared variable Map removed, since Map is now registered as a global in .eslintrc.* // eslint-disable-next-line no-undef - Mark as private the property _viewers of OpenSeadragon --- src/openseadragon.js | 6 ++---- src/viewer.js | 5 +++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index e9ca02fb..5b0accb0 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -749,9 +749,7 @@ /* eslint-disable no-redeclare */ function OpenSeadragon( options ){ - var viewer = new OpenSeadragon.Viewer( options ); - OpenSeadragon._viewers.set(viewer.element, viewer); - return viewer; + return new OpenSeadragon.Viewer( options ); } (function( $ ){ @@ -1409,10 +1407,10 @@ function OpenSeadragon( options ){ * Keep track of which {@link Viewer}s have been created. * - Key: {@link Element} to which a Viewer is attached. * - Value: {@link Viewer} of the element defined by the key. + * @private * @static * @type {Object} */ - // eslint-disable-next-line no-undef _viewers: new Map(), /** diff --git a/src/viewer.js b/src/viewer.js index f86bd0c9..ad0668ed 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -481,6 +481,8 @@ $.Viewer = function( options ) { this.drawer.setImageSmoothingEnabled(this.imageSmoothingEnabled); } + // Register the viewer + $._viewers.set(this.element, this); }; $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, /** @lends OpenSeadragon.Viewer.prototype */{ @@ -824,6 +826,9 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, this.canvas = null; this.container = null; + // Unregister the viewer + $._viewers.delete(this.element); + // clear our reference to the main element - they will need to pass it in again, creating a new viewer this.element = null; }, From b0fb8e836d6ecc67ac8727f91f8ecce4c446a5a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A1n=20Cervera?= Date: Fri, 2 Jul 2021 12:18:46 -0500 Subject: [PATCH 11/22] Add tests for OpenSeadragon.getViewer --- test/modules/viewerretrieval.js | 93 +++++++++++++++++++++++++++++++++ test/test.html | 1 + 2 files changed, 94 insertions(+) create mode 100644 test/modules/viewerretrieval.js diff --git a/test/modules/viewerretrieval.js b/test/modules/viewerretrieval.js new file mode 100644 index 00000000..79c1c7b2 --- /dev/null +++ b/test/modules/viewerretrieval.js @@ -0,0 +1,93 @@ +/* global QUnit, $, testLog */ + +(function() { + var viewer1; + var viewer2; + + QUnit.module('ViewerRetrieval', { + beforeEach: function () { + $('
') + .appendTo("#qunit-fixture"); + + testLog.reset(); + + viewer1 = OpenSeadragon({ + id: 'example1', + prefixUrl: 'build/openseadragon/images/', + springStiffness: 100 // Faster animation = faster tests + }); + + viewer2 = OpenSeadragon({ + id: 'example2', + prefixUrl: 'build/openseadragon/images/', + springStiffness: 100 + }); + }, + + afterEach: function () { + if (viewer1 && viewer1.destroy) { + viewer1.destroy(); + } + if (viewer2 && viewer2.destroy) { + viewer2.destroy(); + } + viewer1 = viewer2 = null; + } + }); + + QUnit.test('Get Viewers by Id', function(assert) { + var retrievedViewer1 = OpenSeadragon.getViewer('example1'); + assert.ok(retrievedViewer1, 'Attached viewer retrieved'); + assert.equal(retrievedViewer1, viewer1, 'Viewers are same instance'); + + var retrievedViewer2 = OpenSeadragon.getViewer('example2'); + assert.ok(retrievedViewer2, 'Attached viewer retrieved'); + assert.equal(retrievedViewer2, viewer2, 'Viewers are same instance'); + + // Internal state + assert.equal(OpenSeadragon._viewers.size, 2, 'Correct amount of viewers'); + }); + + QUnit.test('Get Viewers by Element', function(assert) { + var retrievedViewer1 = OpenSeadragon.getViewer( + document.getElementById('example1')); + assert.ok(retrievedViewer1, 'Attached viewer retrieved'); + assert.equal(retrievedViewer1, viewer1, 'Viewers are same instance'); + + var retrievedViewer2 = OpenSeadragon.getViewer( + document.getElementById('example2')); + assert.ok(retrievedViewer2, 'Attached viewer retrieved'); + assert.equal(retrievedViewer2, viewer2, 'Viewers are same instance'); + + // Internal state + assert.equal(OpenSeadragon._viewers.size, 2, 'Correct amount of viewers'); + }); + + QUnit.test('Undefined on Get Non-Existent Viewer by Id', function(assert) { + var notFoundViewer = OpenSeadragon.getViewer('no-viewer'); + assert.equal(notFoundViewer, undefined, "Not found viewer is undefined"); + }); + + QUnit.test('Undefined on Get Non-Existent Viewer by Element', function(assert) { + var element = document.createElement('div'); + element.id = 'no-viewer'; + document.body.appendChild(element); + + var notFoundViewer = OpenSeadragon.getViewer(element); + assert.equal(notFoundViewer, undefined, "Not found viewer is undefined"); + }); + + QUnit.test('Cleanup Viewers Registration', function(assert) { + viewer1.destroy(); + viewer2.destroy(); + viewer1 = viewer2 = null; + + var retrievedViewer1 = OpenSeadragon.getViewer('example1'); + var retrievedViewer2 = OpenSeadragon.getViewer('example2'); + assert.equal(retrievedViewer1, undefined, 'Viewer was destroyed'); + assert.equal(retrievedViewer2, undefined, 'Viewer was destroyed'); + + // Internal state + assert.equal(OpenSeadragon._viewers.size, 0, 'No viewers are registered'); + }); +})(); diff --git a/test/test.html b/test/test.html index c740b01c..f971a257 100644 --- a/test/test.html +++ b/test/test.html @@ -22,6 +22,7 @@ + From 577622a210956b0ed84b25f2e5f15b619aedc64a Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 5 Jul 2021 11:48:04 -0700 Subject: [PATCH 12/22] Changelog for #2000 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 9afd7c3e..c0282795 100644 --- a/changelog.txt +++ b/changelog.txt @@ -51,6 +51,7 @@ OPENSEADRAGON CHANGELOG * Removed test for move-leave (fly-over, no enter event)...not a valid, handleable event state, no longer supported (#1972 @msalsbery) * Added OpenSeadragon.setElementPointerEvents() for setting pointer-events to other values besides 'none' on DOM elements (#1972 @msalsbery) * Now ensuring the page body is display:block when in fullscreen (#1995 @thewilkybarkid) +* Added a static method in OpenSeadragon to get an existing viewer (#2000 @HerCerM) 2.4.2: From 932b826c4db1e90f016beb01ba82d04d1019e625 Mon Sep 17 00:00:00 2001 From: Luis Nieto Date: Mon, 5 Jul 2021 15:17:30 -0500 Subject: [PATCH 13/22] Flip the order in which view and navigator add a new item This change ensures that the added items are updated first in the navigator's world. If the viewer's world is updated first, it fires an add-item event, which in turn it may encounter a setItemIndex call; since the navigator's world does not have the item yet, an error occurs. --- src/viewer.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index ad0668ed..ffbe0f4f 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1502,6 +1502,17 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, if (_this.collectionMode) { _this.world.setAutoRefigureSizes(false); } + + if (_this.navigator) { + optionsClone = $.extend({}, queueItem.options, { + replace: false, // navigator already removed the layer, nothing to replace + originalTiledImage: tiledImage, + tileSource: queueItem.tileSource + }); + + _this.navigator.addTiledImage(optionsClone); + } + _this.world.addItem( tiledImage, { index: queueItem.options.index }); @@ -1515,16 +1526,6 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, _this.viewport.goHome(true); } - if (_this.navigator) { - optionsClone = $.extend({}, queueItem.options, { - replace: false, // navigator already removed the layer, nothing to replace - originalTiledImage: tiledImage, - tileSource: queueItem.tileSource - }); - - _this.navigator.addTiledImage(optionsClone); - } - if (queueItem.options.success) { queueItem.options.success({ item: tiledImage From eff2ef6f1b76adb1f272b4d6479bec5309d350bc Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 8 Jul 2021 11:11:58 -0700 Subject: [PATCH 14/22] Changelog for #2005 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index c0282795..0d6104a3 100644 --- a/changelog.txt +++ b/changelog.txt @@ -52,6 +52,7 @@ OPENSEADRAGON CHANGELOG * Added OpenSeadragon.setElementPointerEvents() for setting pointer-events to other values besides 'none' on DOM elements (#1972 @msalsbery) * Now ensuring the page body is display:block when in fullscreen (#1995 @thewilkybarkid) * Added a static method in OpenSeadragon to get an existing viewer (#2000 @HerCerM) +* Now ensuring that the new item is already in the navigator when the "add-item" event fires (#2005 @RammasEchor) 2.4.2: From 5889f346958dfefd83d633ced681127abd1c678f Mon Sep 17 00:00:00 2001 From: Luis Nieto Date: Thu, 8 Jul 2021 23:43:38 -0500 Subject: [PATCH 15/22] Add keys to change image source in sequence mode Add the keys 'j' and 'k' to change the image source in the viewer. - 'j': previous source - 'k': next source --- src/viewer.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/viewer.js b/src/viewer.js index ffbe0f4f..03276a7b 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -2782,6 +2782,12 @@ function onCanvasKeyPress( event ) { this.viewport.toggleFlip(); event.preventDefault = true; break; + case 106: //j - previous image source + onPrevious.bind(this)(); + break; + case 107: //k - next image source + onNext.bind(this)(); + break; default: // console.log( 'navigator keycode %s', event.keyCode ); event.preventDefault = false; From 1f73dde983d1b1aafcc408e5f2d9fa7d2799d9e1 Mon Sep 17 00:00:00 2001 From: Luis Nieto Date: Fri, 9 Jul 2021 16:09:46 -0500 Subject: [PATCH 16/22] Move change image source's methods inside viewer Added the methods inside the extend function, so that they appear as properties. Since we cannot reference properties of an object inside said object, we extract them as properties when needed. --- src/viewer.js | 61 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index 03276a7b..e6f116bc 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1646,8 +1646,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, ////////////////////////////////////////////////////////////////////////// var onFocusHandler = $.delegate( this, onFocus ), onBlurHandler = $.delegate( this, onBlur ), - onNextHandler = $.delegate( this, onNext ), - onPreviousHandler = $.delegate( this, onPrevious ), + onNextHandler = $.delegate( this, this['goToNextPage'] ), + onPreviousHandler = $.delegate( this, this['goToPreviousPage'] ), navImages = this.navImages, useGroup = true; @@ -2316,7 +2316,40 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, this.world.resetItems(); this.forceRedraw(); } - } + }, + + /** + * Sets the image source to the source with index equal to + * currentIndex - 1. Changes current image in sequence mode. + * If specified, wraps around (see navPrevNextWrap in + * {@link OpenSeadragon.Options}) + * + * @method + */ + + goToPreviousPage: function () { + var previous = this._sequenceIndex - 1; + if(this.navPrevNextWrap && previous < 0){ + previous += this.tileSources.length; + } + this.goToPage( previous ); + }, + + /** + * Sets the image source to the source with index equal to + * currentIndex + 1. Changes current image in sequence mode. + * If specified, wraps around (see navPrevNextWrap in + * {@link OpenSeadragon.Options}) + * + * @method + */ + goToNextPage: function () { + var next = this._sequenceIndex + 1; + if(this.navPrevNextWrap && next >= this.tileSources.length){ + next = 0; + } + this.goToPage( next ); + }, }); @@ -2783,10 +2816,10 @@ function onCanvasKeyPress( event ) { event.preventDefault = true; break; case 106: //j - previous image source - onPrevious.bind(this)(); + this.goToPreviousPage(); break; case 107: //k - next image source - onNext.bind(this)(); + this.goToNextPage(); break; default: // console.log( 'navigator keycode %s', event.keyCode ); @@ -3677,22 +3710,4 @@ function onFlip() { this.viewport.toggleFlip(); } -function onPrevious(){ - var previous = this._sequenceIndex - 1; - if(this.navPrevNextWrap && previous < 0){ - previous += this.tileSources.length; - } - this.goToPage( previous ); -} - - -function onNext(){ - var next = this._sequenceIndex + 1; - if(this.navPrevNextWrap && next >= this.tileSources.length){ - next = 0; - } - this.goToPage( next ); -} - - }( OpenSeadragon )); From 22bb516bc068db5458df1d593f1bfe98f69d5ddc Mon Sep 17 00:00:00 2001 From: Luis Nieto Date: Mon, 12 Jul 2021 13:42:31 -0500 Subject: [PATCH 17/22] Change the way we access some viewer methods --- src/viewer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/viewer.js b/src/viewer.js index e6f116bc..d8e75857 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -1646,8 +1646,8 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype, ////////////////////////////////////////////////////////////////////////// var onFocusHandler = $.delegate( this, onFocus ), onBlurHandler = $.delegate( this, onBlur ), - onNextHandler = $.delegate( this, this['goToNextPage'] ), - onPreviousHandler = $.delegate( this, this['goToPreviousPage'] ), + onNextHandler = $.delegate( this, this.goToNextPage ), + onPreviousHandler = $.delegate( this, this.goToPreviousPage ), navImages = this.navImages, useGroup = true; From 6cb2c9e7bc4adebe28e386a093890a6c3e353c6b Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 13 Jul 2021 11:16:35 -0700 Subject: [PATCH 18/22] Changelog for #2007 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index 0d6104a3..df98f533 100644 --- a/changelog.txt +++ b/changelog.txt @@ -53,6 +53,7 @@ OPENSEADRAGON CHANGELOG * Now ensuring the page body is display:block when in fullscreen (#1995 @thewilkybarkid) * Added a static method in OpenSeadragon to get an existing viewer (#2000 @HerCerM) * Now ensuring that the new item is already in the navigator when the "add-item" event fires (#2005 @RammasEchor) +* Added keys to change image in sequence mode (j: previous, k: next) (#2007 @RammasEchor) 2.4.2: From db64c2083769df25a34311b8b17f5f5731e4b73f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Aug 2021 17:47:56 +0000 Subject: [PATCH 19/22] Bump path-parse from 1.0.6 to 1.0.7 Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7. - [Release notes](https://github.com/jbgutierrez/path-parse/releases) - [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7) --- updated-dependencies: - dependency-name: path-parse dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 42bff69d..44260921 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4069,9 +4069,9 @@ "dev": true }, "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, "path-root": { From 9724174a5b75041f00e791755f25d71513b5a78c Mon Sep 17 00:00:00 2001 From: crydell <31703366+crydell@users.noreply.github.com> Date: Wed, 11 Aug 2021 12:59:14 +0200 Subject: [PATCH 20/22] Navigator is matched to viewer when it succeeds --- src/navigator.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/navigator.js b/src/navigator.js index 5414a53e..81993b74 100644 --- a/src/navigator.js +++ b/src/navigator.js @@ -404,6 +404,8 @@ $.extend( $.Navigator.prototype, $.EventSource.prototype, $.Viewer.prototype, /* var myItem = event.item; myItem._originalForNavigator = original; _this._matchBounds(myItem, original, true); + _this._matchOpacity(myItem, original); + _this._matchCompositeOperation(myItem, original); function matchBounds() { _this._matchBounds(myItem, original); From 23983698835c4b5da6ad5dce470ccc943630c8b3 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Thu, 12 Aug 2021 11:21:58 -0700 Subject: [PATCH 21/22] Changelog for #2018 --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index df98f533..58cf8804 100644 --- a/changelog.txt +++ b/changelog.txt @@ -54,6 +54,7 @@ OPENSEADRAGON CHANGELOG * Added a static method in OpenSeadragon to get an existing viewer (#2000 @HerCerM) * Now ensuring that the new item is already in the navigator when the "add-item" event fires (#2005 @RammasEchor) * Added keys to change image in sequence mode (j: previous, k: next) (#2007 @RammasEchor) +* Fixed a bug where the navigator wouldn't pick up opacity/composite changes made while it is loading (#2018 @crydell) 2.4.2: From f097808c95ea11ed8ac9cd57044d98ce3da38914 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Mon, 20 Sep 2021 11:58:45 -0700 Subject: [PATCH 22/22] Added "funding" to package.json --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 54131a7e..4f5e033f 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "osm", "tms" ], - "homepage": "http://openseadragon.github.io/", + "homepage": "https://openseadragon.github.io/", + "funding": "https://opencollective.com/openseadragon", "bugs": { "url": "https://github.com/openseadragon/openseadragon/issues" },