More cleanup in the WebGL tile layer's dispose method

This commit is contained in:
Tim Schaub
2021-09-23 11:05:16 +00:00
parent 2ebbee2340
commit a332842540
6 changed files with 61 additions and 0 deletions
+5
View File
@@ -348,6 +348,11 @@ class Layer extends BaseLayer {
* Clean up.
*/
disposeInternal() {
if (this.renderer_) {
this.renderer_.dispose();
delete this.renderer_;
}
this.setSource(null);
super.disposeInternal();
}
+10
View File
@@ -255,6 +255,9 @@ function parseStyle(style, bandCount) {
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* **Important**: after removing a `WebGLTile` layer from your map, call `layer.dispose()`
* to clean up underlying resources.
*
* @extends BaseTileLayer<import("../source/DataTile.js").default|import("../source/TileImage.js").default>
* @api
*/
@@ -320,4 +323,11 @@ class WebGLTileLayer extends BaseTileLayer {
}
}
/**
* Clean up underlying WebGL resources.
* @function
* @api
*/
WebGLTileLayer.prototype.dispose;
export default WebGLTileLayer;