@@ -25638,9 +25638,6 @@ requestAnimationFrame = (typeof window !== 'undefined'
2563825638 * (renderer) (renderer)
2563925639 * / \
2564025640 * ViewGL ViewGL
25641- *
25642- * @module echarts-gl/core/LayerGL
25643- * @author Yi Shen(http://github.com/pissang)
2564425641 */
2564525642
2564625643
@@ -25732,6 +25729,8 @@ var LayerGL = function (id, zr) {
2573225729 });
2573325730
2573425731 this._backgroundColor = null;
25732+
25733+ this._disposed = false;
2573525734};
2573625735
2573725736LayerGL.prototype.setUnpainted = function () {};
@@ -26048,10 +26047,18 @@ function collectResources(scene, textureResourceList, geometryResourceList) {
2604826047 * Dispose the layer
2604926048 */
2605026049LayerGL.prototype.dispose = function () {
26050+ if (this._disposed) {
26051+ return;
26052+ }
2605126053 this._stopAccumulating();
26052- this.renderer.disposeScene(this.scene);
26053-
26054+ if (this._textureList) {
26055+ markUnused(this._textureList);
26056+ markUnused(this._geometriesList);
26057+ checkAndDispose(this.renderer, this._textureList);
26058+ checkAndDispose(this.renderer, this._geometriesList);
26059+ }
2605426060 this.zr.off('globalout', this.onglobalout);
26061+ this._disposed = true;
2605526062};
2605626063
2605726064// Event handlers
@@ -26533,7 +26540,18 @@ EChartsGL.prototype.update = function (ecModel, api) {
2653326540// TODO
2653426541
2653526542external_echarts_.registerPostInit(function (chart) {
26536- chart.getZr().painter.getRenderedCanvas = function (opts) {
26543+ var zr = chart.getZr();
26544+ var oldDispose = zr.painter.dispose;
26545+
26546+ zr.painter.dispose = function () {
26547+ this.eachOtherLayer(function (layer) {
26548+ if (layer instanceof core_LayerGL) {
26549+ layer.dispose();
26550+ }
26551+ });
26552+ oldDispose.call(this);
26553+ }
26554+ zr.painter.getRenderedCanvas = function (opts) {
2653726555 opts = opts || {};
2653826556 if (this._singleCanvas) {
2653926557 return this._layers[0].dom;
@@ -40363,6 +40381,10 @@ ZRTextureAtlasSurface.prototype = {
4036340381 */
4036440382 getCoords: function (id) {
4036540383 return this._coords[id];
40384+ },
40385+
40386+ dispose: function () {
40387+ this._zr.dispose();
4036640388 }
4036740389};
4036840390
@@ -41833,6 +41855,8 @@ var Grid3DView_dimIndicesMap = {
4183341855 dispose: function () {
4183441856 this.groupGL.removeAll();
4183541857 this._control.dispose();
41858+ this._axisLabelSurface.dispose();
41859+ this._axisPointerLabelsSurface.dispose();
4183641860 }
4183741861}));
4183841862;// CONCATENATED MODULE: ./node_modules/echarts/lib/coord/cartesian/Cartesian.js
@@ -51528,6 +51552,10 @@ LabelsBuilder.prototype.updateLabels = function (highlightDataIndices) {
5152851552 this._labelsMesh.geometry.dirty();
5152951553};
5153051554
51555+ LabelsBuilder.prototype.dispose = function () {
51556+ this._labelTextureSurface.dispose();
51557+ }
51558+
5153151559/* harmony default export */ const common_LabelsBuilder = (LabelsBuilder);
5153251560;// CONCATENATED MODULE: ./src/component/common/Geo3DBuilder.js
5153351561
@@ -52282,6 +52310,10 @@ Geo3DBuilder.prototype = {
5228252310 this._setColorOfDataIndex(data, dataIndex, colorArr);
5228352311 },
5228452312
52313+ dispose: function () {
52314+ this._labelsBuilder.dispose();
52315+ },
52316+
5228552317 _setColorOfDataIndex: function (data, dataIndex, colorArr) {
5228652318 if (dataIndex < this._startIndex && dataIndex > this._endIndex) {
5228752319 return;
@@ -52390,6 +52422,7 @@ Geo3DBuilder.prototype = {
5239052422
5239152423 dispose: function () {
5239252424 this._control.dispose();
52425+ this._geo3DBuilder.dispose();
5239352426 }
5239452427}));
5239552428;// CONCATENATED MODULE: ./node_modules/echarts/lib/coord/geo/fix/textCoord.js
@@ -56328,6 +56361,7 @@ var Bar3DView_vec3 = dep_glmatrix.vec3;
5632856361 },
5632956362
5633056363 dispose: function () {
56364+ this._labelsBuilder.dispose();
5633156365 this.groupGL.removeAll();
5633256366 }
5633356367}));
@@ -57453,6 +57487,10 @@ PointsBuilder.prototype = {
5745357487 this.rootNode.add(this._labelsBuilder.getMesh());
5745457488 },
5745557489
57490+ dispose: function () {
57491+ this._labelsBuilder.dispose();
57492+ },
57493+
5745657494 _updateSymbolSprite: function (seriesModel, itemStyle, symbolInfo, dpr) {
5745757495 symbolInfo.maxSize = Math.min(symbolInfo.maxSize * 2, 200);
5745857496 var symbolSize = [];
@@ -57941,6 +57979,9 @@ PointsBuilder.prototype = {
5794157979 },
5794257980
5794357981 dispose: function () {
57982+ this._pointsBuilderList.forEach(function (pointsBuilder) {
57983+ pointsBuilder.dispose();
57984+ });
5794457985 this.groupGL.removeAll();
5794557986 },
5794657987
@@ -58822,6 +58863,9 @@ external_echarts_.util.merge(Polygons3DSeries.prototype, componentShadingMixin);
5882258863
5882358864 dispose: function () {
5882458865 this.groupGL.removeAll();
58866+ this._geo3DBuilderList.forEach(function (geo3DBuilder) {
58867+ geo3DBuilder.dispose();
58868+ })
5882558869 }
5882658870}));
5882758871;// CONCATENATED MODULE: ./src/chart/polygons3D/install.js
@@ -59854,6 +59898,7 @@ external_echarts_.util.merge(Map3DSeries.prototype, componentShadingMixin);
5985459898 dispose: function () {
5985559899 this.groupGL.removeAll();
5985659900 this._control.dispose();
59901+ this._geo3DBuilder.dispose();
5985759902 }
5985859903}));
5985959904;// CONCATENATED MODULE: ./src/chart/map3D/install.js
@@ -60147,6 +60192,9 @@ GLViewHelper.prototype._updateCamera = function (width, height, dpr) {
6014760192
6014860193 dispose: function () {
6014960194 this.groupGL.removeAll();
60195+ this._pointsBuilderList.forEach(function (pointsBuilder) {
60196+ pointsBuilder.dispose();
60197+ });
6015060198 },
6015160199
6015260200 remove: function () {
@@ -64010,6 +64058,8 @@ var globalLayoutId = 1;
6401064058
6401164059 // Stop layout.
6401264060 this._layoutId = -1;
64061+
64062+ this._pointsBuilder.dispose();
6401364063 },
6401464064
6401564065 remove: function () {
0 commit comments