From 54721608a41c249a93a5ccae210c1147b1087ab1 Mon Sep 17 00:00:00 2001 From: Waylon Peng Date: Fri, 12 Mar 2021 23:03:18 -0800 Subject: [PATCH 1/3] Create setImageFormatsSupported function --- src/openseadragon.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/openseadragon.js b/src/openseadragon.js index f61e0133..e638c750 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -2453,6 +2453,20 @@ function OpenSeadragon( options ){ extension = extension ? extension : ""; // eslint-disable-next-line no-use-before-define return !!FILEFORMATS[ extension.toLowerCase() ]; + }, + + /** + * Updates supported image formats with user-specified values. + * @function + * @example + * // sets webp as supported and png as unsupported + * setImageFormatsSupported({webp: true, png: false}); + * @param {Object} formats An object containing format extensions as + * keys and booleans as values. + */ + setImageFormatsSupported: function(formats) { + // eslint-disable-next-line no-use-before-define + Object.assign(FILEFORMATS, formats); } }); From 1ccefd9f6a2925e656d0387e682f0d8a01078cfc Mon Sep 17 00:00:00 2001 From: Waylon Peng Date: Mon, 15 Mar 2021 16:20:26 -0700 Subject: [PATCH 2/3] Update jsdoc, replace Object.assign with $.extend --- src/openseadragon.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/openseadragon.js b/src/openseadragon.js index e638c750..b26a152c 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -2457,6 +2457,17 @@ function OpenSeadragon( options ){ /** * Updates supported image formats with user-specified values. + * Preexisting formats that are not being updated are left unchanged. + * By default, the defined formats are + *
{
+         *      bmp:  false,
+         *      jpeg: true,
+         *      jpg:  true,
+         *      png:  true,
+         *      tif:  false,
+         *      wdp:  false
+         * }
+         * 
* @function * @example * // sets webp as supported and png as unsupported @@ -2466,7 +2477,7 @@ function OpenSeadragon( options ){ */ setImageFormatsSupported: function(formats) { // eslint-disable-next-line no-use-before-define - Object.assign(FILEFORMATS, formats); + $.extend(FILEFORMATS, formats); } }); From 3caf4a0da4ce4e0509e3fec07328faf5c542c067 Mon Sep 17 00:00:00 2001 From: Ian Gilman Date: Tue, 16 Mar 2021 11:53:13 -0700 Subject: [PATCH 3/3] Added changelog for #1954 and bumped upcoming version to 3.0.0 --- changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index ab324cfb..979366e5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,7 @@ OPENSEADRAGON CHANGELOG ======================= -2.5.0: (In progress) +3.0.0: (In progress) * BREAKING CHANGE: Dropped support for older browsers (IE < 11) (#1872 #1949 #1951 @msalsbery, #1950 @rmontroy) * BREAKING CHANGE: Removed deprecated OpenSeadragon.getEvent function (#1949 @msalsbery) @@ -38,6 +38,7 @@ OPENSEADRAGON CHANGELOG * 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) * Fixed preventDefaultAction functionality in viewer events (#1953 @msalsbery) +* Added setImageFormatsSupported function (#1954 @pandaxtc) 2.4.2: