- Add freeupCanvasMemory method on Viewer.destroy method.

This commit is contained in:
Takuma Kira 2020-03-18 14:37:45 +09:00
parent abc11e3eb6
commit 798e49e4b2
2 changed files with 16 additions and 0 deletions

View File

@ -195,6 +195,18 @@
}
return context;
},
/**
* Free up canvas memory
* (iOS 12 or higher on 2GB RAM device has only 224MB canvas memory,
* and Safari keeps canvas until its height and width will be set to 0).
* @function
*/
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;
}
},
// private
//

View File

@ -742,6 +742,10 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
return;
}
if (this.source.freeupCanvasMemory) {
this.source.freeupCanvasMemory();
}
this.close();
this.clearOverlays();