@wcardinal/wcardinal-ui 0.440.0 → 0.441.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,5 +23,6 @@ export declare class DynamicAtlas {
23
23
  getDefaultTexture(): Texture;
24
24
  getBaseTexture(): BaseTexture;
25
25
  release(id: string): void;
26
+ destroy(): void;
26
27
  static ITEM_COMPARATOR: (a: DynamicAtlasItem, b: DynamicAtlasItem) => number;
27
28
  }
@@ -159,6 +159,13 @@ var EShapeContainer = /** @class */ (function (_super) {
159
159
  children[i].destroy();
160
160
  }
161
161
  children.length = 0;
162
+ // Atlas
163
+ var atlas = this._atlas;
164
+ if (atlas != null) {
165
+ atlas.destroy();
166
+ }
167
+ // Font Atlas
168
+ this._fontAtlases.destroy();
162
169
  //
163
170
  _super.prototype.destroy.call(this);
164
171
  };
@@ -1 +1 @@
1
- {"version":3,"file":"e-shape-container.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-container.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,aAAa,EAAU,KAAK,EAAY,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;IAAqC,mCAAa;IAoBjD;QAAA,YACC,iBAAO,SAkBP;QAtCS,oBAAc,GAA0B,IAAI,CAAC;QAsBtD,KAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,KAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,KAAI,CAAC,mBAAmB,GAAG,CAAC,CAAC,CAAC;QAE9B,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,KAAI,CAAC,YAAY,GAAG,IAA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,EAAE;gBACrD,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;aACrB;SACD;QACD,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAEzB,SAAS;QACT,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;YAC9C,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACtB;QACD,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAEpB,EAAE;QACF,iBAAM,OAAO,WAAE,CAAC;IACjB,CAAC;IACF,sBAAC;AAAD,CAAC,AAvMD,CAAqC,aAAa,GAuMjD","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DisplayObject, IPoint, Point, Renderer } from \"pixi.js\";\nimport { DynamicAtlas } from \"../util/dynamic-atlas\";\nimport { DynamicSDFFontAtlases } from \"../util/dynamic-sdf-font-atlases\";\nimport { EShape } from \"./e-shape\";\nimport { EShapeBuffer } from \"./e-shape-buffer\";\nimport { EShapeRenderer } from \"./e-shape-renderer\";\n\nexport class EShapeContainer extends DisplayObject {\n\tprotected _shapeRenderer: EShapeRenderer | null = null;\n\n\treadonly children: EShape[];\n\tprotected _shape: EShape | null;\n\tprotected _childrenId: number;\n\tprotected _childrenIdRendered: number;\n\n\tprotected _atlas: DynamicAtlas | null;\n\tprotected _fontAtlases: DynamicSDFFontAtlases;\n\n\tprotected _pixelScale: number;\n\tprotected _pixelScaleId: number;\n\tprotected _shapeScale: number;\n\tprotected _shapeScaleId: number;\n\n\tprotected _work: Point;\n\n\tprotected _buffers: EShapeBuffer[];\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.children = [];\n\t\tthis._shape = null;\n\t\tthis._childrenId = 0;\n\t\tthis._childrenIdRendered = -1;\n\n\t\tthis._atlas = null;\n\t\tthis._fontAtlases = new DynamicSDFFontAtlases();\n\n\t\tthis._pixelScale = 1;\n\t\tthis._pixelScaleId = -2; // Since this._shapeScaleId starts from -1.\n\t\tthis._shapeScale = 1;\n\t\tthis._shapeScaleId = -1; // Since Transform._worldID starts from zero.\n\n\t\tthis._work = new Point();\n\n\t\tthis._buffers = [];\n\t}\n\n\tcalculateBounds(): void {\n\t\tthis._bounds.clear();\n\t}\n\n\tonChildTransformChange(): void {\n\t\t// DO NOTHING\n\t}\n\n\ttoDirty(): number {\n\t\treturn (this._childrenId += 1);\n\t}\n\n\tisDirty(): boolean {\n\t\treturn this._childrenIdRendered < this._childrenId;\n\t}\n\n\trender(renderer: Renderer): void {\n\t\tif (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst childrenId = this._childrenId;\n\t\tconst childrenIdRendered = this._childrenIdRendered;\n\t\tthis._childrenIdRendered = childrenId;\n\t\tconst isChildrenDirty = childrenIdRendered < childrenId;\n\n\t\tlet shapeRenderer: EShapeRenderer | null = this._shapeRenderer;\n\t\tif (shapeRenderer == null) {\n\t\t\tshapeRenderer = this._shapeRenderer = new EShapeRenderer(renderer);\n\t\t}\n\t\trenderer.batch.setObjectRenderer(shapeRenderer);\n\n\t\tconst mask = this.mask;\n\t\tconst shape = this._shape;\n\t\tconst shapes = this.children;\n\t\tif (mask) {\n\t\t\trenderer.mask.push(this, mask);\n\t\t\tshapeRenderer.render_(this, shape, shapes, isChildrenDirty);\n\t\t\trenderer.mask.pop(this);\n\t\t} else {\n\t\t\tshapeRenderer.render_(this, shape, shapes, isChildrenDirty);\n\t\t}\n\t}\n\n\tcontainsPoint(point: Point): boolean {\n\t\treturn false;\n\t}\n\n\tgetFontAtlases(): DynamicSDFFontAtlases {\n\t\treturn this._fontAtlases;\n\t}\n\n\tgetAtlas(resolution: number): DynamicAtlas {\n\t\tlet atlas = this._atlas;\n\t\tif (atlas == null) {\n\t\t\tatlas = new DynamicAtlas(resolution);\n\t\t\tthis._atlas = atlas;\n\t\t}\n\t\treturn atlas;\n\t}\n\n\tgetBuffers(): EShapeBuffer[] {\n\t\treturn this._buffers;\n\t}\n\n\ttoShapeScale(): number {\n\t\tthis.updateTransform();\n\t\tconst transform = this.transform;\n\t\tconst worldID = (transform as any)._worldID;\n\t\tif (worldID !== this._shapeScaleId) {\n\t\t\tthis._shapeScaleId = worldID;\n\t\t\tconst worldTransform = transform.worldTransform;\n\t\t\tconst a = worldTransform.a;\n\t\t\tconst b = worldTransform.b;\n\t\t\tthis._shapeScale = 1 / Math.sqrt(a * a + b * b);\n\t\t}\n\t\treturn this._shapeScale;\n\t}\n\n\tgetShapeScale(): number {\n\t\treturn this._shapeScale;\n\t}\n\n\ttoPixelScale(resolution: number): number {\n\t\tconst shapeScale = this.toShapeScale();\n\t\tconst shapeScaleId = this._shapeScaleId;\n\t\tif (this._pixelScaleId !== shapeScaleId) {\n\t\t\tthis._pixelScaleId = shapeScaleId;\n\t\t\tthis._pixelScale = (1 / resolution) * shapeScale;\n\t\t}\n\t\treturn this._pixelScale;\n\t}\n\n\tgetPixelScale(): number {\n\t\treturn this._pixelScale;\n\t}\n\n\ttoAntialiasWeight(resolution: number): number {\n\t\treturn 1.25 / resolution;\n\t}\n\n\thitTest(global: IPoint, onHit?: (shape: EShape) => boolean): EShape | null {\n\t\tconst local = this._work;\n\t\tconst children = this.children;\n\t\tfor (let i = children.length - 1; 0 <= i; --i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child.visible) {\n\t\t\t\tchild.toLocal(global, undefined, local);\n\t\t\t\tconst result = child.contains(local.x, local.y);\n\t\t\t\tif (result != null) {\n\t\t\t\t\tif (onHit == null || onHit(result)) {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\thitTestBBox(global: IPoint, onHit?: (shape: EShape) => boolean): EShape | null {\n\t\tconst local = this._work;\n\t\tconst children = this.children;\n\t\tfor (let i = children.length - 1; 0 <= i; --i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child.visible) {\n\t\t\t\tchild.toLocal(global, undefined, local);\n\t\t\t\tif (child.containsBBox(local.x, local.y)) {\n\t\t\t\t\tif (onHit == null || onHit(child)) {\n\t\t\t\t\t\treturn child;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tdestroy(): void {\n\t\t// Buffer\n\t\tconst buffers = this._buffers;\n\t\tif (buffers != null) {\n\t\t\tfor (let i = 0, imax = buffers.length; i < imax; ++i) {\n\t\t\t\tbuffers[i].destroy();\n\t\t\t}\n\t\t}\n\t\tthis._buffers.length = 0;\n\n\t\t// Shapes\n\t\tconst children = this.children;\n\t\tfor (let i = children.length - 1; 0 <= i; --i) {\n\t\t\tchildren[i].destroy();\n\t\t}\n\t\tchildren.length = 0;\n\n\t\t//\n\t\tsuper.destroy();\n\t}\n}\n"]}
1
+ {"version":3,"file":"e-shape-container.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-container.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,aAAa,EAAU,KAAK,EAAY,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAGzE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;IAAqC,mCAAa;IAoBjD;QAAA,YACC,iBAAO,SAkBP;QAtCS,oBAAc,GAA0B,IAAI,CAAC;QAsBtD,KAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACnB,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,KAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,KAAI,CAAC,mBAAmB,GAAG,C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AAC,GAAG,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE;gBACrD,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;aACrB;SACD;QACD,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAEzB,SAAS;QACT,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE;YAC9C,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;SACtB;QACD,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;QAEpB,QAAQ;QACR,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,KAAK,IAAI,IAAI,EAAE;YAClB,KAAK,CAAC,OAAO,EAAE,CAAC;SAChB;QAED,aAAa;QACb,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QAE5B,EAAE;QACF,iBAAM,OAAO,WAAE,CAAC;IACjB,CAAC;IACF,sBAAC;AAAD,CAAC,AAhND,CAAqC,aAAa,GAgNjD","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DisplayObject, IPoint, Point, Renderer } from \"pixi.js\";\nimport { DynamicAtlas } from \"../util/dynamic-atlas\";\nimport { DynamicSDFFontAtlases } from \"../util/dynamic-sdf-font-atlases\";\nimport { EShape } from \"./e-shape\";\nimport { EShapeBuffer } from \"./e-shape-buffer\";\nimport { EShapeRenderer } from \"./e-shape-renderer\";\n\nexport class EShapeContainer extends DisplayObject {\n\tprotected _shapeRenderer: EShapeRenderer | null = null;\n\n\treadonly children: EShape[];\n\tprotected _shape: EShape | null;\n\tprotected _childrenId: number;\n\tprotected _childrenIdRendered: number;\n\n\tprotected _atlas: DynamicAtlas | null;\n\tprotected _fontAtlases: DynamicSDFFontAtlases;\n\n\tprotected _pixelScale: number;\n\tprotected _pixelScaleId: number;\n\tprotected _shapeScale: number;\n\tprotected _shapeScaleId: number;\n\n\tprotected _work: Point;\n\n\tprotected _buffers: EShapeBuffer[];\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.children = [];\n\t\tthis._shape = null;\n\t\tthis._childrenId = 0;\n\t\tthis._childrenIdRendered = -1;\n\n\t\tthis._atlas = null;\n\t\tthis._fontAtlases = new DynamicSDFFontAtlases();\n\n\t\tthis._pixelScale = 1;\n\t\tthis._pixelScaleId = -2; // Since this._shapeScaleId starts from -1.\n\t\tthis._shapeScale = 1;\n\t\tthis._shapeScaleId = -1; // Since Transform._worldID starts from zero.\n\n\t\tthis._work = new Point();\n\n\t\tthis._buffers = [];\n\t}\n\n\tcalculateBounds(): void {\n\t\tthis._bounds.clear();\n\t}\n\n\tonChildTransformChange(): void {\n\t\t// DO NOTHING\n\t}\n\n\ttoDirty(): number {\n\t\treturn (this._childrenId += 1);\n\t}\n\n\tisDirty(): boolean {\n\t\treturn this._childrenIdRendered < this._childrenId;\n\t}\n\n\trender(renderer: Renderer): void {\n\t\tif (!this.visible || this.worldAlpha <= 0 || !this.renderable) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst childrenId = this._childrenId;\n\t\tconst childrenIdRendered = this._childrenIdRendered;\n\t\tthis._childrenIdRendered = childrenId;\n\t\tconst isChildrenDirty = childrenIdRendered < childrenId;\n\n\t\tlet shapeRenderer: EShapeRenderer | null = this._shapeRenderer;\n\t\tif (shapeRenderer == null) {\n\t\t\tshapeRenderer = this._shapeRenderer = new EShapeRenderer(renderer);\n\t\t}\n\t\trenderer.batch.setObjectRenderer(shapeRenderer);\n\n\t\tconst mask = this.mask;\n\t\tconst shape = this._shape;\n\t\tconst shapes = this.children;\n\t\tif (mask) {\n\t\t\trenderer.mask.push(this, mask);\n\t\t\tshapeRenderer.render_(this, shape, shapes, isChildrenDirty);\n\t\t\trenderer.mask.pop(this);\n\t\t} else {\n\t\t\tshapeRenderer.render_(this, shape, shapes, isChildrenDirty);\n\t\t}\n\t}\n\n\tcontainsPoint(point: Point): boolean {\n\t\treturn false;\n\t}\n\n\tgetFontAtlases(): DynamicSDFFontAtlases {\n\t\treturn this._fontAtlases;\n\t}\n\n\tgetAtlas(resolution: number): DynamicAtlas {\n\t\tlet atlas = this._atlas;\n\t\tif (atlas == null) {\n\t\t\tatlas = new DynamicAtlas(resolution);\n\t\t\tthis._atlas = atlas;\n\t\t}\n\t\treturn atlas;\n\t}\n\n\tgetBuffers(): EShapeBuffer[] {\n\t\treturn this._buffers;\n\t}\n\n\ttoShapeScale(): number {\n\t\tthis.updateTransform();\n\t\tconst transform = this.transform;\n\t\tconst worldID = (transform as any)._worldID;\n\t\tif (worldID !== this._shapeScaleId) {\n\t\t\tthis._shapeScaleId = worldID;\n\t\t\tconst worldTransform = transform.worldTransform;\n\t\t\tconst a = worldTransform.a;\n\t\t\tconst b = worldTransform.b;\n\t\t\tthis._shapeScale = 1 / Math.sqrt(a * a + b * b);\n\t\t}\n\t\treturn this._shapeScale;\n\t}\n\n\tgetShapeScale(): number {\n\t\treturn this._shapeScale;\n\t}\n\n\ttoPixelScale(resolution: number): number {\n\t\tconst shapeScale = this.toShapeScale();\n\t\tconst shapeScaleId = this._shapeScaleId;\n\t\tif (this._pixelScaleId !== shapeScaleId) {\n\t\t\tthis._pixelScaleId = shapeScaleId;\n\t\t\tthis._pixelScale = (1 / resolution) * shapeScale;\n\t\t}\n\t\treturn this._pixelScale;\n\t}\n\n\tgetPixelScale(): number {\n\t\treturn this._pixelScale;\n\t}\n\n\ttoAntialiasWeight(resolution: number): number {\n\t\treturn 1.25 / resolution;\n\t}\n\n\thitTest(global: IPoint, onHit?: (shape: EShape) => boolean): EShape | null {\n\t\tconst local = this._work;\n\t\tconst children = this.children;\n\t\tfor (let i = children.length - 1; 0 <= i; --i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child.visible) {\n\t\t\t\tchild.toLocal(global, undefined, local);\n\t\t\t\tconst result = child.contains(local.x, local.y);\n\t\t\t\tif (result != null) {\n\t\t\t\t\tif (onHit == null || onHit(result)) {\n\t\t\t\t\t\treturn result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\thitTestBBox(global: IPoint, onHit?: (shape: EShape) => boolean): EShape | null {\n\t\tconst local = this._work;\n\t\tconst children = this.children;\n\t\tfor (let i = children.length - 1; 0 <= i; --i) {\n\t\t\tconst child = children[i];\n\t\t\tif (child.visible) {\n\t\t\t\tchild.toLocal(global, undefined, local);\n\t\t\t\tif (child.containsBBox(local.x, local.y)) {\n\t\t\t\t\tif (onHit == null || onHit(child)) {\n\t\t\t\t\t\treturn child;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tdestroy(): void {\n\t\t// Buffer\n\t\tconst buffers = this._buffers;\n\t\tif (buffers != null) {\n\t\t\tfor (let i = 0, imax = buffers.length; i < imax; ++i) {\n\t\t\t\tbuffers[i].destroy();\n\t\t\t}\n\t\t}\n\t\tthis._buffers.length = 0;\n\n\t\t// Shapes\n\t\tconst children = this.children;\n\t\tfor (let i = children.length - 1; 0 <= i; --i) {\n\t\t\tchildren[i].destroy();\n\t\t}\n\t\tchildren.length = 0;\n\n\t\t// Atlas\n\t\tconst atlas = this._atlas;\n\t\tif (atlas != null) {\n\t\t\tatlas.destroy();\n\t\t}\n\n\t\t// Font Atlas\n\t\tthis._fontAtlases.destroy();\n\n\t\t//\n\t\tsuper.destroy();\n\t}\n}\n"]}
@@ -10,10 +10,11 @@ var DynamicAtlas = /** @class */ (function () {
10
10
  function DynamicAtlas(resolution) {
11
11
  var canvas = (this._canvas = document.createElement("canvas"));
12
12
  canvas.width = canvas.height = 256;
13
- var baseTexture = (this._baseTexture = BaseTexture.from(canvas, {
13
+ var baseTexture = BaseTexture.from(canvas, {
14
14
  mipmap: MIPMAP_MODES.OFF,
15
15
  resolution: resolution
16
- }));
16
+ });
17
+ this._baseTexture = baseTexture;
17
18
  this._idToDatum = {};
18
19
  this._sortedData = [];
19
20
  this._predefined = {
@@ -167,6 +168,12 @@ var DynamicAtlas = /** @class */ (function () {
167
168
  }
168
169
  }
169
170
  };
171
+ DynamicAtlas.prototype.destroy = function () {
172
+ var baseTexture = this._baseTexture;
173
+ if (baseTexture != null) {
174
+ baseTexture.destroy();
175
+ }
176
+ };
170
177
  DynamicAtlas.ITEM_COMPARATOR = function (a, b) {
171
178
  if (a.ref <= 0) {
172
179
  if (b.ref <= 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-atlas.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/dynamic-atlas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAW,MAAM,SAAS,CAAC;AAE7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,IAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC;IAUC,sBAAY,UAAkB;QAC7B,IAAM,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC;QAEnC,IAAM,WAAW,GAAG,CAAC,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE;YACjE,MAAM,EAAE,YAAY,CAAC,GAAG;YACxB,UAAU,YAAA;SACV,CAAC,CAAC,CAAC;QAEJ,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IA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AAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;aACrB;SACD;IACF,CAAC;IAEM,4BAAe,GAAG,UAAC,CAAmB,EAAE,CAAmB;QACjE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE;YACf,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE;gBACf,OAAO,CAAC,CAAC;aACT;iBAAM;gBACN,OAAO,CAAC,CAAC,CAAC;aACV;SACD;aAAM;YACN,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE;gBACf,OAAO,CAAC,CAAC,CAAC;aACV;SACD;QAED,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;YACpC,OAAO,CAAC,CAAC,CAAC;SACV;aAAM,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;YAC3C,OAAO,CAAC,CAAC,CAAC;SACV;aAAM;YACN,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;SACrC;IACF,CAAC,CAAC;IACH,mBAAC;CAAA,AAlND,IAkNC;SAlNY,YAAY","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { BaseTexture, MIPMAP_MODES, Texture } from \"pixi.js\";\nimport { DynamicAtlasItem } from \"./dynamic-atlas-item\";\nimport { DynamicAtlasItemEmpty } from \"./dynamic-atlas-item-empty\";\nimport { DynamicAtlasItemWhite } from \"./dynamic-atlas-item-white\";\n\nconst MAXIMUM_TEXTURE_SIZE = 4096;\n\nexport class DynamicAtlas {\n\tprotected static INSTANCE: DynamicAtlas | null;\n\n\tprotected _canvas: HTMLCanvasElement;\n\tprotected _sortedData: DynamicAtlasItem[];\n\tprotected _idToDatum: Record<string, DynamicAtlasItem>;\n\tprotected _baseTexture: BaseTexture;\n\tprotected _isDirty: boolean;\n\tprotected _predefined: Record<string, DynamicAtlasItem>;\n\n\tconstructor(resolution: number) {\n\t\tconst canvas = (this._canvas = document.createElement(\"canvas\"));\n\t\tcanvas.width = canvas.height = 256;\n\n\t\tconst baseTexture = (this._baseTexture = BaseTexture.from(canvas, {\n\t\t\tmipmap: MIPMAP_MODES.OFF,\n\t\t\tresolution\n\t\t}));\n\n\t\tthis._idToDatum = {};\n\t\tthis._sortedData = [];\n\t\tthis._predefined = {\n\t\t\tempty: new DynamicAtlasItemEmpty(\"empty\", 10, 10, 0, baseTexture),\n\t\t\twhite: new DynamicAtlasItemWhite(\"white\", 10, 10, 0, baseTexture)\n\t\t};\n\n\t\tthis._isDirty = true;\n\t}\n\n\tupdateFrames(width: number, data: DynamicAtlasItem[]): number {\n\t\tconst padding = 4;\n\t\tlet x = padding;\n\t\tlet y = padding;\n\t\tlet maxRowHeight = 0;\n\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\tconst datum = data[i];\n\t\t\tif (width < x + datum.frame.width + padding) {\n\t\t\t\tx = padding;\n\t\t\t\ty += maxRowHeight + padding;\n\t\t\t\tmaxRowHeight = 0;\n\t\t\t}\n\t\t\tdatum.frame.x = x | 0;\n\t\t\tdatum.frame.y = y | 0;\n\t\t\tx += datum.frame.width + padding;\n\t\t\tmaxRowHeight = Math.max(maxRowHeight, datum.frame.height);\n\t\t}\n\n\t\tconst minHeight = y + maxRowHeight + padding;\n\t\tlet result = 256;\n\t\twhile (result < minHeight) {\n\t\t\tresult <<= 1;\n\t\t}\n\t\treturn Math.min(MAXIMUM_TEXTURE_SIZE, result);\n\t}\n\n\trenderFrames(width: number, height: number, data: DynamicAtlasItem[]): void {\n\t\tconst canvas = this._canvas;\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tif (context != null) {\n\t\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\t\tconst datum = data[i];\n\t\t\t\tdatum.render(context);\n\t\t\t}\n\t\t}\n\t}\n\n\tapplyFrames(data: DynamicAtlasItem[]): void {\n\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\tconst datum = data[i];\n\t\t\tdatum.applyFrame();\n\t\t}\n\t}\n\n\tcalcCanvasWidth(data: DynamicAtlasItem[]): number {\n\t\tlet result = 512;\n\t\tfor (let i = data.length - 1; 0 <= i; --i) {\n\t\t\tconst datum = data[i];\n\t\t\tconst size = Math.max(datum.frame.width, datum.frame.height);\n\t\t\twhile (result < size) {\n\t\t\t\tresult <<= 1;\n\t\t\t}\n\t\t}\n\t\treturn Math.min(MAXIMUM_TEXTURE_SIZE, result << 1);\n\t}\n\n\tcleanup(data: DynamicAtlasItem[]): void {\n\t\tdata.sort(DynamicAtlas.ITEM_COMPARATOR);\n\t\tfor (let i = data.length - 1; 0 <= i; --i) {\n\t\t\tconst datum = data[i];\n\t\t\tif (0 < datum.ref) {\n\t\t\t\tdata.length = i + 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tdata.length = 0;\n\t}\n\n\tbegin(): void {\n\t\tconst data = this._sortedData;\n\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\tconst datum = data[i];\n\t\t\tdatum.ref = 0;\n\t\t}\n\n\t\tthis._isDirty = false;\n\t}\n\n\tend(): void {\n\t\tconst idToDatum = this._idToDatum;\n\t\tconst data = this._sortedData;\n\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\tconst datum = data[i];\n\t\t\tif (datum.ref <= 0) {\n\t\t\t\tif (!(datum.id in this._predefined)) {\n\t\t\t\t\tdatum.destroy();\n\t\t\t\t}\n\t\t\t\tdelete idToDatum[datum.id];\n\t\t\t\tthis._isDirty = true;\n\t\t\t}\n\t\t}\n\t}\n\n\trepack(forcibly?: boolean): void {\n\t\tif (forcibly === true || this._isDirty) {\n\t\t\tthis._isDirty = false;\n\t\t\tconst data = this._sortedData;\n\t\t\tthis.cleanup(data);\n\t\t\tconst canvasWidth = this.calcCanvasWidth(data);\n\t\t\tconst canvasHeight = this.updateFrames(canvasWidth, data);\n\t\t\tthis.renderFrames(canvasWidth, canvasHeight, data);\n\t\t\tthis._baseTexture.setRealSize(canvasWidth, canvasHeight);\n\t\t\tthis.applyFrames(data);\n\t\t}\n\t}\n\n\tget(id: string): DynamicAtlasItem | null {\n\t\tconst idToDatum = this._idToDatum;\n\t\tconst datum = idToDatum[id];\n\t\tif (datum != null) {\n\t\t\tdatum.ref += 1;\n\t\t\treturn datum;\n\t\t} else {\n\t\t\tconst predefined = this._predefined[id];\n\t\t\tif (predefined != null) {\n\t\t\t\tthis.set(id, predefined);\n\t\t\t\treturn predefined;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tset(id: string, item: DynamicAtlasItem): DynamicAtlasItem | undefined {\n\t\tconst result = this._idToDatum[id];\n\t\titem.ref += 1;\n\t\tthis._idToDatum[id] = item;\n\t\tthis._sortedData.push(item);\n\t\tthis._isDirty = true;\n\t\treturn result;\n\t}\n\n\ttoDirty(): void {\n\t\tthis._isDirty = true;\n\t}\n\n\tgetDefaultTexture(): Texture {\n\t\treturn this.get(\"white\")!.texture;\n\t}\n\n\tgetBaseTexture(): BaseTexture {\n\t\treturn this._baseTexture;\n\t}\n\n\trelease(id: string): void {\n\t\tconst idToDatum = this._idToDatum;\n\t\tconst datum = idToDatum[id];\n\t\tif (datum != null) {\n\t\t\tdatum.ref -= 1;\n\t\t\tif (datum.ref <= 0) {\n\t\t\t\tif (!(datum.id in this._predefined)) {\n\t\t\t\t\tdatum.destroy();\n\t\t\t\t}\n\t\t\t\tdelete idToDatum[id];\n\t\t\t\tthis._isDirty = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tstatic ITEM_COMPARATOR = (a: DynamicAtlasItem, b: DynamicAtlasItem): number => {\n\t\tif (a.ref <= 0) {\n\t\t\tif (b.ref <= 0) {\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn +1;\n\t\t\t}\n\t\t} else {\n\t\t\tif (b.ref <= 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\n\t\tif (a.frame.height < b.frame.height) {\n\t\t\treturn -1;\n\t\t} else if (b.frame.height < a.frame.height) {\n\t\t\treturn +1;\n\t\t} else {\n\t\t\treturn a.frame.width - b.frame.width;\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"file":"dynamic-atlas.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/dynamic-atlas.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAW,MAAM,SAAS,CAAC;AAE7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,IAAM,oBAAoB,GAAG,IAAI,CAAC;AAElC;IAUC,sBAAY,UAAkB;QAC7B,IAAM,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC;QACjE,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC;QAEnC,IAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE;YAC5C,MAAM,EAAE,YAAY,CAAC,GAAG;YACxB,UAAU,YAAA;SACV,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;QAEhC,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG;YAClB,KAAK,EAAE,IAAI,qBAAqB,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,WAAW,CAAC;YACjE,KAAK,EAAE,IAAI,qBAAqB,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE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O,EAAE,CAAC;SACtB;IACF,CAAC;IAEM,4BAAe,GAAG,UAAC,CAAmB,EAAE,CAAmB;QACjE,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE;YACf,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE;gBACf,OAAO,CAAC,CAAC;aACT;iBAAM;gBACN,OAAO,CAAC,CAAC,CAAC;aACV;SACD;aAAM;YACN,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE;gBACf,OAAO,CAAC,CAAC,CAAC;aACV;SACD;QAED,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;YACpC,OAAO,CAAC,CAAC,CAAC;SACV;aAAM,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE;YAC3C,OAAO,CAAC,CAAC,CAAC;SACV;aAAM;YACN,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC;SACrC;IACF,CAAC,CAAC;IACH,mBAAC;CAAA,AA1ND,IA0NC;SA1NY,YAAY","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { BaseTexture, MIPMAP_MODES, Texture } from \"pixi.js\";\nimport { DynamicAtlasItem } from \"./dynamic-atlas-item\";\nimport { DynamicAtlasItemEmpty } from \"./dynamic-atlas-item-empty\";\nimport { DynamicAtlasItemWhite } from \"./dynamic-atlas-item-white\";\n\nconst MAXIMUM_TEXTURE_SIZE = 4096;\n\nexport class DynamicAtlas {\n\tprotected static INSTANCE: DynamicAtlas | null;\n\n\tprotected _canvas: HTMLCanvasElement;\n\tprotected _sortedData: DynamicAtlasItem[];\n\tprotected _idToDatum: Record<string, DynamicAtlasItem>;\n\tprotected _baseTexture: BaseTexture;\n\tprotected _isDirty: boolean;\n\tprotected _predefined: Record<string, DynamicAtlasItem>;\n\n\tconstructor(resolution: number) {\n\t\tconst canvas = (this._canvas = document.createElement(\"canvas\"));\n\t\tcanvas.width = canvas.height = 256;\n\n\t\tconst baseTexture = BaseTexture.from(canvas, {\n\t\t\tmipmap: MIPMAP_MODES.OFF,\n\t\t\tresolution\n\t\t});\n\t\tthis._baseTexture = baseTexture;\n\n\t\tthis._idToDatum = {};\n\t\tthis._sortedData = [];\n\t\tthis._predefined = {\n\t\t\tempty: new DynamicAtlasItemEmpty(\"empty\", 10, 10, 0, baseTexture),\n\t\t\twhite: new DynamicAtlasItemWhite(\"white\", 10, 10, 0, baseTexture)\n\t\t};\n\n\t\tthis._isDirty = true;\n\t}\n\n\tupdateFrames(width: number, data: DynamicAtlasItem[]): number {\n\t\tconst padding = 4;\n\t\tlet x = padding;\n\t\tlet y = padding;\n\t\tlet maxRowHeight = 0;\n\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\tconst datum = data[i];\n\t\t\tif (width < x + datum.frame.width + padding) {\n\t\t\t\tx = padding;\n\t\t\t\ty += maxRowHeight + padding;\n\t\t\t\tmaxRowHeight = 0;\n\t\t\t}\n\t\t\tdatum.frame.x = x | 0;\n\t\t\tdatum.frame.y = y | 0;\n\t\t\tx += datum.frame.width + padding;\n\t\t\tmaxRowHeight = Math.max(maxRowHeight, datum.frame.height);\n\t\t}\n\n\t\tconst minHeight = y + maxRowHeight + padding;\n\t\tlet result = 256;\n\t\twhile (result < minHeight) {\n\t\t\tresult <<= 1;\n\t\t}\n\t\treturn Math.min(MAXIMUM_TEXTURE_SIZE, result);\n\t}\n\n\trenderFrames(width: number, height: number, data: DynamicAtlasItem[]): void {\n\t\tconst canvas = this._canvas;\n\t\tcanvas.width = width;\n\t\tcanvas.height = height;\n\t\tconst context = canvas.getContext(\"2d\");\n\t\tif (context != null) {\n\t\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\t\tconst datum = data[i];\n\t\t\t\tdatum.render(context);\n\t\t\t}\n\t\t}\n\t}\n\n\tapplyFrames(data: DynamicAtlasItem[]): void {\n\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\tconst datum = data[i];\n\t\t\tdatum.applyFrame();\n\t\t}\n\t}\n\n\tcalcCanvasWidth(data: DynamicAtlasItem[]): number {\n\t\tlet result = 512;\n\t\tfor (let i = data.length - 1; 0 <= i; --i) {\n\t\t\tconst datum = data[i];\n\t\t\tconst size = Math.max(datum.frame.width, datum.frame.height);\n\t\t\twhile (result < size) {\n\t\t\t\tresult <<= 1;\n\t\t\t}\n\t\t}\n\t\treturn Math.min(MAXIMUM_TEXTURE_SIZE, result << 1);\n\t}\n\n\tcleanup(data: DynamicAtlasItem[]): void {\n\t\tdata.sort(DynamicAtlas.ITEM_COMPARATOR);\n\t\tfor (let i = data.length - 1; 0 <= i; --i) {\n\t\t\tconst datum = data[i];\n\t\t\tif (0 < datum.ref) {\n\t\t\t\tdata.length = i + 1;\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tdata.length = 0;\n\t}\n\n\tbegin(): void {\n\t\tconst data = this._sortedData;\n\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\tconst datum = data[i];\n\t\t\tdatum.ref = 0;\n\t\t}\n\n\t\tthis._isDirty = false;\n\t}\n\n\tend(): void {\n\t\tconst idToDatum = this._idToDatum;\n\t\tconst data = this._sortedData;\n\t\tfor (let i = 0, imax = data.length; i < imax; ++i) {\n\t\t\tconst datum = data[i];\n\t\t\tif (datum.ref <= 0) {\n\t\t\t\tif (!(datum.id in this._predefined)) {\n\t\t\t\t\tdatum.destroy();\n\t\t\t\t}\n\t\t\t\tdelete idToDatum[datum.id];\n\t\t\t\tthis._isDirty = true;\n\t\t\t}\n\t\t}\n\t}\n\n\trepack(forcibly?: boolean): void {\n\t\tif (forcibly === true || this._isDirty) {\n\t\t\tthis._isDirty = false;\n\t\t\tconst data = this._sortedData;\n\t\t\tthis.cleanup(data);\n\t\t\tconst canvasWidth = this.calcCanvasWidth(data);\n\t\t\tconst canvasHeight = this.updateFrames(canvasWidth, data);\n\t\t\tthis.renderFrames(canvasWidth, canvasHeight, data);\n\t\t\tthis._baseTexture.setRealSize(canvasWidth, canvasHeight);\n\t\t\tthis.applyFrames(data);\n\t\t}\n\t}\n\n\tget(id: string): DynamicAtlasItem | null {\n\t\tconst idToDatum = this._idToDatum;\n\t\tconst datum = idToDatum[id];\n\t\tif (datum != null) {\n\t\t\tdatum.ref += 1;\n\t\t\treturn datum;\n\t\t} else {\n\t\t\tconst predefined = this._predefined[id];\n\t\t\tif (predefined != null) {\n\t\t\t\tthis.set(id, predefined);\n\t\t\t\treturn predefined;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tset(id: string, item: DynamicAtlasItem): DynamicAtlasItem | undefined {\n\t\tconst result = this._idToDatum[id];\n\t\titem.ref += 1;\n\t\tthis._idToDatum[id] = item;\n\t\tthis._sortedData.push(item);\n\t\tthis._isDirty = true;\n\t\treturn result;\n\t}\n\n\ttoDirty(): void {\n\t\tthis._isDirty = true;\n\t}\n\n\tgetDefaultTexture(): Texture {\n\t\treturn this.get(\"white\")!.texture;\n\t}\n\n\tgetBaseTexture(): BaseTexture {\n\t\treturn this._baseTexture;\n\t}\n\n\trelease(id: string): void {\n\t\tconst idToDatum = this._idToDatum;\n\t\tconst datum = idToDatum[id];\n\t\tif (datum != null) {\n\t\t\tdatum.ref -= 1;\n\t\t\tif (datum.ref <= 0) {\n\t\t\t\tif (!(datum.id in this._predefined)) {\n\t\t\t\t\tdatum.destroy();\n\t\t\t\t}\n\t\t\t\tdelete idToDatum[id];\n\t\t\t\tthis._isDirty = true;\n\t\t\t}\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\tconst baseTexture = this._baseTexture;\n\t\tif (baseTexture != null) {\n\t\t\tbaseTexture.destroy();\n\t\t}\n\t}\n\n\tstatic ITEM_COMPARATOR = (a: DynamicAtlasItem, b: DynamicAtlasItem): number => {\n\t\tif (a.ref <= 0) {\n\t\t\tif (b.ref <= 0) {\n\t\t\t\treturn 0;\n\t\t\t} else {\n\t\t\t\treturn +1;\n\t\t\t}\n\t\t} else {\n\t\t\tif (b.ref <= 0) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\n\t\tif (a.frame.height < b.frame.height) {\n\t\t\treturn -1;\n\t\t} else if (b.frame.height < a.frame.height) {\n\t\t\treturn +1;\n\t\t} else {\n\t\t\treturn a.frame.width - b.frame.width;\n\t\t}\n\t};\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15085,10 +15085,11 @@ var DynamicAtlas = /** @class */ (function () {
15085
15085
  function DynamicAtlas(resolution) {
15086
15086
  var canvas = (this._canvas = document.createElement("canvas"));
15087
15087
  canvas.width = canvas.height = 256;
15088
- var baseTexture = (this._baseTexture = pixi_js.BaseTexture.from(canvas, {
15088
+ var baseTexture = pixi_js.BaseTexture.from(canvas, {
15089
15089
  mipmap: pixi_js.MIPMAP_MODES.OFF,
15090
15090
  resolution: resolution
15091
- }));
15091
+ });
15092
+ this._baseTexture = baseTexture;
15092
15093
  this._idToDatum = {};
15093
15094
  this._sortedData = [];
15094
15095
  this._predefined = {
@@ -15242,6 +15243,12 @@ var DynamicAtlas = /** @class */ (function () {
15242
15243
  }
15243
15244
  }
15244
15245
  };
15246
+ DynamicAtlas.prototype.destroy = function () {
15247
+ var baseTexture = this._baseTexture;
15248
+ if (baseTexture != null) {
15249
+ baseTexture.destroy();
15250
+ }
15251
+ };
15245
15252
  DynamicAtlas.ITEM_COMPARATOR = function (a, b) {
15246
15253
  if (a.ref <= 0) {
15247
15254
  if (b.ref <= 0) {
@@ -16729,6 +16736,13 @@ var EShapeContainer = /** @class */ (function (_super) {
16729
16736
  children[i].destroy();
16730
16737
  }
16731
16738
  children.length = 0;
16739
+ // Atlas
16740
+ var atlas = this._atlas;
16741
+ if (atlas != null) {
16742
+ atlas.destroy();
16743
+ }
16744
+ // Font Atlas
16745
+ this._fontAtlases.destroy();
16732
16746
  //
16733
16747
  _super.prototype.destroy.call(this);
16734
16748
  };
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.440.0
2
+ Winter Cardinal UI v0.441.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15082,10 +15082,11 @@
15082
15082
  function DynamicAtlas(resolution) {
15083
15083
  var canvas = (this._canvas = document.createElement("canvas"));
15084
15084
  canvas.width = canvas.height = 256;
15085
- var baseTexture = (this._baseTexture = pixi_js.BaseTexture.from(canvas, {
15085
+ var baseTexture = pixi_js.BaseTexture.from(canvas, {
15086
15086
  mipmap: pixi_js.MIPMAP_MODES.OFF,
15087
15087
  resolution: resolution
15088
- }));
15088
+ });
15089
+ this._baseTexture = baseTexture;
15089
15090
  this._idToDatum = {};
15090
15091
  this._sortedData = [];
15091
15092
  this._predefined = {
@@ -15239,6 +15240,12 @@
15239
15240
  }
15240
15241
  }
15241
15242
  };
15243
+ DynamicAtlas.prototype.destroy = function () {
15244
+ var baseTexture = this._baseTexture;
15245
+ if (baseTexture != null) {
15246
+ baseTexture.destroy();
15247
+ }
15248
+ };
15242
15249
  DynamicAtlas.ITEM_COMPARATOR = function (a, b) {
15243
15250
  if (a.ref <= 0) {
15244
15251
  if (b.ref <= 0) {
@@ -16726,6 +16733,13 @@
16726
16733
  children[i].destroy();
16727
16734
  }
16728
16735
  children.length = 0;
16736
+ // Atlas
16737
+ var atlas = this._atlas;
16738
+ if (atlas != null) {
16739
+ atlas.destroy();
16740
+ }
16741
+ // Font Atlas
16742
+ this._fontAtlases.destroy();
16729
16743
  //
16730
16744
  _super.prototype.destroy.call(this);
16731
16745
  };