Prechádzať zdrojové kódy

backcompat for people extending the abstract viewer

Raanan Weber 7 rokov pred
rodič
commit
a1c449babc

+ 2 - 5
Viewer/src/viewer/defaultViewer.ts

@@ -15,10 +15,7 @@ import { IModelAnimation, AnimationState } from '../model/modelAnimation';
  */
 export class DefaultViewer extends AbstractViewer {
 
-    /**
-     * The corresponsing template manager of this viewer.
-     */
-    public templateManager: TemplateManager;
+
 
     /**
      * Create a new default viewer
@@ -494,7 +491,7 @@ export class DefaultViewer extends AbstractViewer {
 
         // initialize the templates
         let templateConfiguration = this.configuration.templates || {};
-        this.templateManager = new TemplateManager(this.containerElement);
+
         this.templateManager.initTemplate(templateConfiguration);
         // when done, execute onTemplatesLoaded()
         this.templateManager.onAllLoaded.add(() => {

+ 8 - 0
Viewer/src/viewer/viewer.ts

@@ -15,6 +15,7 @@ import { Version } from '..';
 import { deepmerge } from '../helper/';
 import { ObservablesManager } from '../managers/observablesManager';
 import { ConfigurationContainer } from '../configuration/configurationContainer';
+import { TemplateManager } from '../templating/templateManager';
 
 /**
  * The AbstractViewr is the center of Babylon's viewer.
@@ -23,6 +24,11 @@ import { ConfigurationContainer } from '../configuration/configurationContainer'
 export abstract class AbstractViewer {
 
     /**
+     * The corresponsing template manager of this viewer.
+     */
+    public templateManager: TemplateManager;
+
+    /**
      * Babylon Engine corresponding with this viewer
      */
     public engine: Engine;
@@ -273,6 +279,8 @@ export abstract class AbstractViewer {
                 }
             }))
         }
+
+        this.templateManager = new TemplateManager(this.containerElement);
     }
 
     /**