diff --git a/changelog.txt b/changelog.txt index 08023eaa..27c5e976 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,8 @@ OPENSEADRAGON CHANGELOG 5.0.1: (in progress...) +* Fixed: If you switched from WebGL drawer to canvas drawer, it didn't clean up properly (#2570 @pearcetm) + 5.0.0: * BREAKING CHANGE: Dropped support for IE11 (#2300, #2361, #2553 @AndrewADev, @msalsbery) diff --git a/src/webgldrawer.js b/src/webgldrawer.js index e3896deb..23266347 100644 --- a/src/webgldrawer.js +++ b/src/webgldrawer.js @@ -822,8 +822,8 @@ this._renderingCanvas.height = this._clippingCanvas.height = this._outputCanvas.height; this._gl = this._renderingCanvas.getContext('webgl'); - //make the additional canvas elements mirror size changes to the output canvas - this.viewer.addHandler("resize", function(){ + + this._resizeHandler = function(){ if(_this._outputCanvas !== _this.viewer.drawer.canvas){ _this._outputCanvas.style.width = _this.viewer.drawer.canvas.clientWidth + 'px'; @@ -844,7 +844,10 @@ // important - update the size of the rendering viewport! _this._resizeRenderer(); - }); + }; + + //make the additional canvas elements mirror size changes to the output canvas + this.viewer.addHandler("resize", this._resizeHandler); } _setupTextureHandlers(thisType) {