diff --git a/changelog.txt b/changelog.txt index a7082d6f..8e53e930 100644 --- a/changelog.txt +++ b/changelog.txt @@ -8,7 +8,7 @@ OPENSEADRAGON CHANGELOG * Added isFullScreen method to Viewer (#2067 @JachiOnuoha) * Fixed an issue where turning off panVertical or panHorizontal would not affect the panning keyboard combos (#2069 @JachiOnuoha) * Cleaned up console.logs so that errors and warnings use console.error and console.warn as appropriate (#2073 @Abhishek-90) -* Improved documentation (#2067 @JachiOnuoha, #2112 @shyamkumaryadav, #2152 @joedf) +* Improved documentation (#2067 @JachiOnuoha, #2112 @shyamkumaryadav, #2152 @joedf, #2155 @samwilson) * Added option to include POST data when loading files via Ajax (#2072 @Aiosa) * Fixed: Setting useCanvas to false would break the viewer (#2116 @rvv-bouvet) * Allow silencing multi-image warnings on viewport coordinate conversion functions (#2120 @claycoleman) @@ -20,6 +20,8 @@ OPENSEADRAGON CHANGELOG * Now if you pass an error handler into makeAjaxRequest, it doesn't report errors into the console (#2142 @Aiosa) * Fixed error caused by attaching MouseTracker to the page's document element (#2145 @tdiprima) * Added fallback and deprecation warning for Viewer.buttons (which got changed to buttonGroup in 3.0.0) (#2153 @devbyjonah) +* Pinch to zoom now zooms around the center of the pinch, rather than the center of the viewer (#2158 @cavenel) +* Fixed an issue that would sometimes cause problems with freeing up ImageTileSource memory (#2162 @pearcetm) 3.0.0: diff --git a/package-lock.json b/package-lock.json index b65a2524..b43d15bb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -295,7 +295,7 @@ "array-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/array-each/-/array-each-1.0.1.tgz", - "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", + "integrity": "sha512-zHjL5SZa68hkKHBFBK6DJCTtr9sfTCPCaph/L7tMSLcTFgy+zX7E+6q5UArbtOtMBCtxdICpfTCspRse+ywyXA==", "dev": true }, "array-slice": { @@ -1908,9 +1908,9 @@ "dev": true }, "grunt": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.2.tgz", - "integrity": "sha512-XCtfaIu72OyDqK24MjWiGC9SwlkuhkS1mrULr1xzuJ2XqAFhP3ZAchZGHJeSCY6mkaOXU4F7SbmmCF7xIVoC9w==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/grunt/-/grunt-1.5.3.tgz", + "integrity": "sha512-mKwmo4X2d8/4c/BmcOETHek675uOqw0RuA/zy12jaspWqvTp4+ZeQF1W+OTpcbncnaBsfbQJ6l0l4j+Sn/GmaQ==", "dev": true, "requires": { "dateformat": "~3.0.3", diff --git a/src/imagetilesource.js b/src/imagetilesource.js index cbea1ef0..6d49bbd3 100644 --- a/src/imagetilesource.js +++ b/src/imagetilesource.js @@ -272,8 +272,10 @@ */ _freeupCanvasMemory: function () { for (var i = 0; i < this.levels.length; i++) { - this.levels[i].context2D.canvas.height = 0; - this.levels[i].context2D.canvas.width = 0; + if(this.levels[i].context2D){ + this.levels[i].context2D.canvas.height = 0; + this.levels[i].context2D.canvas.width = 0; + } } }, }); diff --git a/src/openseadragon.js b/src/openseadragon.js index 9c84c369..545aef5d 100644 --- a/src/openseadragon.js +++ b/src/openseadragon.js @@ -2319,7 +2319,7 @@ function OpenSeadragon( options ){ * @param {Function} options.success - a function to call on a successful response * @param {Function} options.error - a function to call on when an error occurs * @param {Object} options.headers - headers to add to the AJAX request - * @param {String} options.responseType - the response type of the the AJAX request + * @param {String} options.responseType - the response type of the AJAX request * @param {String} options.postData - HTTP POST data (usually but not necessarily in k=v&k2=v2... form, * see TileSource::getPostData), GET method used if null * @param {Boolean} [options.withCredentials=false] - whether to set the XHR's withCredentials diff --git a/src/rectangle.js b/src/rectangle.js index 8f255506..3ef381dc 100644 --- a/src/rectangle.js +++ b/src/rectangle.js @@ -230,7 +230,7 @@ $.Rect.prototype = { * Returns the width and height component as a vector OpenSeadragon.Point * @function * @returns {OpenSeadragon.Point} The 2 dimensional vector representing the - * the width and height of the rectangle. + * width and height of the rectangle. */ getSize: function() { return new $.Point(this.width, this.height); diff --git a/src/viewer.js b/src/viewer.js index ab779142..d33a4a26 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -3289,9 +3289,6 @@ function onCanvasPinch( event ) { if ( gestureSettings.pinchToZoom && (!canvasPinchEventArgs.preventDefaultPanAction || !canvasPinchEventArgs.preventDefaultZoomAction) ) { centerPt = this.viewport.pointFromPixel( event.center, true ); - if ( !canvasPinchEventArgs.preventDefaultZoomAction ) { - this.viewport.zoomBy( event.distance / event.lastDistance, centerPt, true ); - } if ( gestureSettings.zoomToRefPoint && !canvasPinchEventArgs.preventDefaultPanAction ) { lastCenterPt = this.viewport.pointFromPixel( event.lastCenter, true ); panByPt = lastCenterPt.minus( centerPt ); @@ -3303,6 +3300,9 @@ function onCanvasPinch( event ) { } this.viewport.panBy(panByPt, true); } + if ( !canvasPinchEventArgs.preventDefaultZoomAction ) { + this.viewport.zoomBy( event.distance / event.lastDistance, centerPt, true ); + } this.viewport.applyConstraints(); } if ( gestureSettings.pinchRotate && !canvasPinchEventArgs.preventDefaultRotateAction ) {