|
@@ -94109,17 +94109,42 @@ var AbstractViewer = (function () {
|
|
|
}
|
|
|
};
|
|
|
AbstractViewer.prototype.dispose = function () {
|
|
|
+ if (this._isDisposed) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
window.removeEventListener('resize', this.resize);
|
|
|
if (this.sceneOptimizer) {
|
|
|
this.sceneOptimizer.stop();
|
|
|
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) {
|
|
|
this.scene.activeCamera.detachControl(this.canvas);
|
|
|
}
|
|
|
+ this.models.forEach(function (model) {
|
|
|
+ model.dispose();
|
|
|
+ });
|
|
|
+ this.models.length = 0;
|
|
|
this.scene.dispose();
|
|
|
this.engine.dispose();
|
|
|
this.templateManager.dispose();
|
|
|
+ this._isDisposed = true;
|
|
|
};
|
|
|
AbstractViewer.prototype.onTemplatesLoaded = function () {
|
|
|
return Promise.resolve(this);
|
|
@@ -94674,6 +94699,7 @@ var TemplateManager = (function () {
|
|
|
Object.keys(this.templates).forEach(function (template) {
|
|
|
_this.templates[template].dispose();
|
|
|
});
|
|
|
+ this.templates = {};
|
|
|
this.onInit.clear();
|
|
|
this.onAllLoaded.clear();
|
|
|
this.onEventTriggered.clear();
|
|
@@ -94827,10 +94853,15 @@ var Template = (function () {
|
|
|
this.onLoaded.clear();
|
|
|
this.onStateChange.clear();
|
|
|
this.isLoaded = false;
|
|
|
- this.parent.removeChild(this.fragment);
|
|
|
+ try {
|
|
|
+ this.parent.removeChild(this.fragment);
|
|
|
+ }
|
|
|
+ catch (e) {
|
|
|
+ }
|
|
|
this.loadRequests.forEach(function (request) {
|
|
|
request.abort();
|
|
|
});
|
|
|
+ delete this.fragment;
|
|
|
};
|
|
|
Template.prototype.getTemplateAsHtml = function (templateConfig) {
|
|
|
var _this = this;
|