|
@@ -94112,17 +94112,42 @@ var AbstractViewer = (function () {
|
|
}
|
|
}
|
|
};
|
|
};
|
|
AbstractViewer.prototype.dispose = function () {
|
|
AbstractViewer.prototype.dispose = function () {
|
|
|
|
+ if (this._isDisposed) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
window.removeEventListener('resize', this.resize);
|
|
window.removeEventListener('resize', this.resize);
|
|
if (this.sceneOptimizer) {
|
|
if (this.sceneOptimizer) {
|
|
this.sceneOptimizer.stop();
|
|
this.sceneOptimizer.stop();
|
|
this.sceneOptimizer.dispose();
|
|
this.sceneOptimizer.dispose();
|
|
}
|
|
}
|
|
|
|
+ if (this.environmentHelper) {
|
|
|
|
+ this.environmentHelper.dispose();
|
|
|
|
+ }
|
|
|
|
+ this.onEngineInitObservable.clear();
|
|
|
|
+ delete this.onEngineInitObservable;
|
|
|
|
+ this.onInitDoneObservable.clear();
|
|
|
|
+ delete this.onInitDoneObservable;
|
|
|
|
+ this.onLoaderInitObservable.clear();
|
|
|
|
+ delete this.onLoaderInitObservable;
|
|
|
|
+ this.onModelLoadedObservable.clear();
|
|
|
|
+ delete this.onModelLoadedObservable;
|
|
|
|
+ this.onModelLoadErrorObservable.clear();
|
|
|
|
+ delete this.onModelLoadErrorObservable;
|
|
|
|
+ this.onModelLoadProgressObservable.clear();
|
|
|
|
+ delete this.onModelLoadProgressObservable;
|
|
|
|
+ this.onSceneInitObservable.clear();
|
|
|
|
+ delete this.onSceneInitObservable;
|
|
if (this.scene.activeCamera) {
|
|
if (this.scene.activeCamera) {
|
|
this.scene.activeCamera.detachControl(this.canvas);
|
|
this.scene.activeCamera.detachControl(this.canvas);
|
|
}
|
|
}
|
|
|
|
+ this.models.forEach(function (model) {
|
|
|
|
+ model.dispose();
|
|
|
|
+ });
|
|
|
|
+ this.models.length = 0;
|
|
this.scene.dispose();
|
|
this.scene.dispose();
|
|
this.engine.dispose();
|
|
this.engine.dispose();
|
|
this.templateManager.dispose();
|
|
this.templateManager.dispose();
|
|
|
|
+ this._isDisposed = true;
|
|
};
|
|
};
|
|
AbstractViewer.prototype.onTemplatesLoaded = function () {
|
|
AbstractViewer.prototype.onTemplatesLoaded = function () {
|
|
return Promise.resolve(this);
|
|
return Promise.resolve(this);
|
|
@@ -94677,6 +94702,7 @@ var TemplateManager = (function () {
|
|
Object.keys(this.templates).forEach(function (template) {
|
|
Object.keys(this.templates).forEach(function (template) {
|
|
_this.templates[template].dispose();
|
|
_this.templates[template].dispose();
|
|
});
|
|
});
|
|
|
|
+ this.templates = {};
|
|
this.onInit.clear();
|
|
this.onInit.clear();
|
|
this.onAllLoaded.clear();
|
|
this.onAllLoaded.clear();
|
|
this.onEventTriggered.clear();
|
|
this.onEventTriggered.clear();
|
|
@@ -94830,10 +94856,15 @@ var Template = (function () {
|
|
this.onLoaded.clear();
|
|
this.onLoaded.clear();
|
|
this.onStateChange.clear();
|
|
this.onStateChange.clear();
|
|
this.isLoaded = false;
|
|
this.isLoaded = false;
|
|
- this.parent.removeChild(this.fragment);
|
|
|
|
|
|
+ try {
|
|
|
|
+ this.parent.removeChild(this.fragment);
|
|
|
|
+ }
|
|
|
|
+ catch (e) {
|
|
|
|
+ }
|
|
this.loadRequests.forEach(function (request) {
|
|
this.loadRequests.forEach(function (request) {
|
|
request.abort();
|
|
request.abort();
|
|
});
|
|
});
|
|
|
|
+ delete this.fragment;
|
|
};
|
|
};
|
|
Template.prototype.getTemplateAsHtml = function (templateConfig) {
|
|
Template.prototype.getTemplateAsHtml = function (templateConfig) {
|
|
var _this = this;
|
|
var _this = this;
|