|
@@ -53,6 +53,8 @@
|
|
|
*/
|
|
|
public static CACHESTRATEGY_DONTCACHE = 4;
|
|
|
|
|
|
+ private static _INSTANCES : Array<Canvas2D> = [];
|
|
|
+
|
|
|
constructor(scene: Scene, settings?: {
|
|
|
id?: string,
|
|
|
children?: Array<Prim2DBase>,
|
|
@@ -183,6 +185,9 @@
|
|
|
//this._supprtInstancedArray = false; // TODO REMOVE!!!
|
|
|
|
|
|
this._setupInteraction(enableInteraction);
|
|
|
+
|
|
|
+ // Register this instance
|
|
|
+ Canvas2D._INSTANCES.push(this);
|
|
|
}
|
|
|
|
|
|
public get drawCallsOpaqueCounter(): PerfCounter {
|
|
@@ -233,6 +238,10 @@
|
|
|
return this._boundingInfoRecomputeCounter;
|
|
|
}
|
|
|
|
|
|
+ public static get instances() : Array<Canvas2D> {
|
|
|
+ return Canvas2D._INSTANCES;
|
|
|
+ }
|
|
|
+
|
|
|
protected _canvasPreInit(settings: any) {
|
|
|
let cachingStrategy = (settings.cachingStrategy == null) ? Canvas2D.CACHESTRATEGY_DONTCACHE : settings.cachingStrategy;
|
|
|
this._cachingStrategy = cachingStrategy;
|
|
@@ -817,7 +826,13 @@
|
|
|
if (this._groupCacheMaps) {
|
|
|
this._groupCacheMaps.forEach((k, m) => m.forEach(e => e.dispose()));
|
|
|
this._groupCacheMaps = null;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Unregister this instance
|
|
|
+ let index = Canvas2D._INSTANCES.indexOf(this);
|
|
|
+ if (index > -1) {
|
|
|
+ Canvas2D._INSTANCES.splice(index, 1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|