mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-23 21:56:10 +03:00
Merge pull request #2570 from pearcetm/resize-after-drawer-swap
Remove resize handler from viewer when webgl drawer is destroyed
This commit is contained in:
commit
a9f81190dd
@ -160,6 +160,7 @@
|
|||||||
// unbind our event listeners from the viewer
|
// unbind our event listeners from the viewer
|
||||||
this.viewer.removeHandler("tile-ready", this._boundToTileReady);
|
this.viewer.removeHandler("tile-ready", this._boundToTileReady);
|
||||||
this.viewer.removeHandler("image-unloaded", this._boundToImageUnloaded);
|
this.viewer.removeHandler("image-unloaded", this._boundToImageUnloaded);
|
||||||
|
this.viewer.removeHandler("resize", this._resizeHandler);
|
||||||
|
|
||||||
// set our webgl context reference to null to enable garbage collection
|
// set our webgl context reference to null to enable garbage collection
|
||||||
this._gl = null;
|
this._gl = null;
|
||||||
@ -839,8 +840,7 @@
|
|||||||
|
|
||||||
this._gl = this._renderingCanvas.getContext('webgl');
|
this._gl = this._renderingCanvas.getContext('webgl');
|
||||||
|
|
||||||
//make the additional canvas elements mirror size changes to the output canvas
|
this._resizeHandler = function(){
|
||||||
this.viewer.addHandler("resize", function(){
|
|
||||||
|
|
||||||
if(_this._outputCanvas !== _this.viewer.drawer.canvas){
|
if(_this._outputCanvas !== _this.viewer.drawer.canvas){
|
||||||
_this._outputCanvas.style.width = _this.viewer.drawer.canvas.clientWidth + 'px';
|
_this._outputCanvas.style.width = _this.viewer.drawer.canvas.clientWidth + 'px';
|
||||||
@ -861,7 +861,10 @@
|
|||||||
|
|
||||||
// important - update the size of the rendering viewport!
|
// important - update the size of the rendering viewport!
|
||||||
_this._resizeRenderer();
|
_this._resizeRenderer();
|
||||||
});
|
};
|
||||||
|
|
||||||
|
//make the additional canvas elements mirror size changes to the output canvas
|
||||||
|
this.viewer.addHandler("resize", this._resizeHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private
|
// private
|
||||||
|
Loading…
Reference in New Issue
Block a user