mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-25 14:46:10 +03:00
- Undo removing prefixUrl option in memorycheck-with-simple-image demo.
- Define destroy method in TileSource class, call ImageTileSource.freeupCanvasMemory method as optional from TileSource.destroy method and remove TODO.
This commit is contained in:
parent
6cb57aa66c
commit
344ddb924f
@ -196,11 +196,16 @@
|
|||||||
return context;
|
return context;
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Destroys ImageTileSource
|
* 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
|
* @function
|
||||||
*/
|
*/
|
||||||
destroy: function () {
|
freeupCanvasMemory: function () {
|
||||||
this._freeupCanvasMemory();
|
for (var i = 0; i < this.levels.length; i++) {
|
||||||
|
this.levels[i].context2D.canvas.height = 0;
|
||||||
|
this.levels[i].context2D.canvas.width = 0;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// private
|
// private
|
||||||
@ -265,19 +270,7 @@
|
|||||||
bigContext = smallContext;
|
bigContext = smallContext;
|
||||||
}
|
}
|
||||||
return levels;
|
return levels;
|
||||||
},
|
|
||||||
/**
|
|
||||||
* 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;
|
|
||||||
}
|
}
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}(OpenSeadragon));
|
}(OpenSeadragon));
|
||||||
|
@ -615,7 +615,17 @@ $.TileSource.prototype = {
|
|||||||
y >= 0 &&
|
y >= 0 &&
|
||||||
x < numTiles.x &&
|
x < numTiles.x &&
|
||||||
y < numTiles.y;
|
y < numTiles.y;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroys TileSource
|
||||||
|
* @function
|
||||||
|
*/
|
||||||
|
destroy: function () {
|
||||||
|
if ( this.freeupCanvasMemory ) {
|
||||||
|
this.freeupCanvasMemory();
|
||||||
}
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -742,10 +742,7 @@ $.extend( $.Viewer.prototype, $.EventSource.prototype, $.ControlDock.prototype,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: implement destroy and _freeupCanvasMemory method for all child classes of TileSource, then remove if statement wrap below.
|
|
||||||
if (this.source.destroy) {
|
|
||||||
this.source.destroy();
|
this.source.destroy();
|
||||||
}
|
|
||||||
|
|
||||||
this.close();
|
this.close();
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
_viewer = OpenSeadragon({
|
_viewer = OpenSeadragon({
|
||||||
element: document.getElementById("contentDiv"),
|
element: document.getElementById("contentDiv"),
|
||||||
showNavigationControl: false,
|
showNavigationControl: false,
|
||||||
|
prefixUrl: "../../build/openseadragon/images/",
|
||||||
tileSources: {
|
tileSources: {
|
||||||
type: "image",
|
type: "image",
|
||||||
url: "../data/CCyan.png"
|
url: "../data/CCyan.png"
|
||||||
|
Loading…
Reference in New Issue
Block a user