@wcardinal/wcardinal-ui 0.450.0 → 0.450.1

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.
@@ -18,6 +18,7 @@ export declare class DynamicAtlas {
18
18
  end(): void;
19
19
  repack(forcibly?: boolean): void;
20
20
  get(id: string): DynamicAtlasItem | null;
21
+ contains(id: string): boolean;
21
22
  set(id: string, item: DynamicAtlasItem): DynamicAtlasItem | undefined;
22
23
  toDirty(): void;
23
24
  getDefaultTexture(): Texture;
@@ -137,6 +137,9 @@ var DynamicAtlas = /** @class */ (function () {
137
137
  }
138
138
  return null;
139
139
  };
140
+ DynamicAtlas.prototype.contains = function (id) {
141
+ return id in this._idToDatum;
142
+ };
140
143
  DynamicAtlas.prototype.set = function (id, item) {
141
144
  var result = this._idToDatum[id];
142
145
  item.ref += 1;
@@ -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,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE;YAC5C,MAAM,EAAE,YAAY,CAAC,GAAG;YACxB,UAAU,YAAA;SACV,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,GAAG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,CAAC,WAAW,CAAC,EAAE;oBACpC,KAAK,CAAC,OAAO,EAAE,CAAC;iBAChB;gBACD,OAAO,SAAS,CAAC,EAAE,CAAC,CAAC;gBACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;aACrB;SACD;IACF,CAAC;IAED,8BAAO,GAAP;QACC,IAAM,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;QACtC,IAAI,WAAW,IAAI,IAAI,EAAE;YACxB,WAAW,CAAC,OAAO,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
+ {"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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019 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\tcontains(id: string): boolean {\n\t\treturn id in this._idToDatum;\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"]}
@@ -45,8 +45,8 @@ var DynamicSDFFontAtlases = /** @class */ (function () {
45
45
  DynamicSDFFontAtlases.prototype.update = function (baseAtlas) {
46
46
  var baseTexture = baseAtlas.getBaseTexture();
47
47
  this._atlases.forEach(function (atlas) {
48
+ var atlasId = atlas.id;
48
49
  if (atlas.update()) {
49
- var atlasId = atlas.id;
50
50
  var item = baseAtlas.get(atlasId);
51
51
  if (item != null) {
52
52
  var width = atlas.width;
@@ -62,6 +62,11 @@ var DynamicSDFFontAtlases = /** @class */ (function () {
62
62
  baseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));
63
63
  }
64
64
  }
65
+ else {
66
+ if (!baseAtlas.contains(atlasId)) {
67
+ baseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));
68
+ }
69
+ }
65
70
  });
66
71
  };
67
72
  DynamicSDFFontAtlases.prototype.destroy = function () {
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-sdf-font-atlases.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/dynamic-sdf-font-atlases.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;IAGC;QACC,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAA+B,CAAC;IACxD,CAAC;IAED,qCAAK,GAAL;QACC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAC,KAAK;YAC3B,KAAK,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,mCAAG,GAAH;QACC,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,OAAO,CAAC,OAAO,CAAC,UAAC,KAAK,EAAE,MAAM;YAC7B,KAAK,CAAC,GAAG,EAAE,CAAC;YACZ,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE;gBACtB,KAAK,CAAC,OAAO,EAAE,CAAC;gBAChB,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACvB;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,mCAAG,GAAH,UAAI,MAAc,EAAE,UAAoB,EAAE,YAAsB;QAC/D,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAClC,IAAI,KAAK,IAAI,IAAI,EAAE;YAClB,KAAK,CAAC,GAAG,CAAC,UAAU,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GAAG,CAAC,OAAO,EAAE,IAAI,yBAAyB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;iBAC1E;aACD;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;IAED,uCAAO,GAAP;QACC,IAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,OAAO,CAAC,OAAO,CAAC,UAAC,KAAK;YACrB,KAAK,CAAC,OAAO,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IACF,4BAAC;AAAD,CAAC,AAzED,IAyEC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DynamicAtlas } from \"./dynamic-atlas\";\nimport { DynamicAtlasItemFontAtlas } from \"./dynamic-atlas-item-font-atlas\";\nimport { DynamicSDFFontAtlas } from \"./dynamic-sdf-font-atlas\";\n\nexport class DynamicSDFFontAtlases {\n\tprotected _atlases: Map<string, DynamicSDFFontAtlas>;\n\n\tconstructor() {\n\t\tthis._atlases = new Map<string, DynamicSDFFontAtlas>();\n\t}\n\n\tbegin(): void {\n\t\tthis._atlases.forEach((atlas) => {\n\t\t\tatlas.begin();\n\t\t});\n\t}\n\n\tend(): void {\n\t\tconst atlases = this._atlases;\n\t\tatlases.forEach((atlas, family) => {\n\t\t\tatlas.end();\n\t\t\tif (atlas.length <= 0) {\n\t\t\t\tatlas.destroy();\n\t\t\t\tatlases.delete(family);\n\t\t\t}\n\t\t});\n\t}\n\n\tadd(family: string, characters: string[], nacharacters: string[]): void {\n\t\tconst atlases = this._atlases;\n\t\tconst atlas = atlases.get(family);\n\t\tif (atlas != null) {\n\t\t\tatlas.add(characters, nacharacters);\n\t\t} else {\n\t\t\tconst newAtlas = new DynamicSDFFontAtlas(family);\n\t\t\tnewAtlas.add(characters, nacharacters);\n\t\t\tatlases.set(family, newAtlas);\n\t\t}\n\t}\n\n\tget(family: string): DynamicSDFFontAtlas | null {\n\t\tconst atlas = this._atlases.get(family);\n\t\tif (atlas != null) {\n\t\t\treturn atlas;\n\t\t}\n\t\treturn null;\n\t}\n\n\tupdate(baseAtlas: DynamicAtlas): void {\n\t\tconst baseTexture = baseAtlas.getBaseTexture();\n\t\tthis._atlases.forEach((atlas) => {\n\t\t\tif (atlas.update()) {\n\t\t\t\tconst atlasId = atlas.id;\n\t\t\t\tconst item = baseAtlas.get(atlasId);\n\t\t\t\tif (item != null) {\n\t\t\t\t\tconst width = atlas.width;\n\t\t\t\t\tconst height = atlas.height;\n\t\t\t\t\tconst resolution = baseTexture.resolution;\n\t\t\t\t\titem.frame.width = width;\n\t\t\t\t\titem.frame.height = height;\n\t\t\t\t\titem.width = width / resolution;\n\t\t\t\t\titem.height = height / resolution;\n\t\t\t\t\tbaseAtlas.toDirty();\n\t\t\t\t} else {\n\t\t\t\t\tbaseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tdestroy(): void {\n\t\tconst atlases = this._atlases;\n\t\tatlases.forEach((atlas) => {\n\t\t\tatlas.destroy();\n\t\t});\n\t\tatlases.clear();\n\t}\n}\n"]}
1
+ {"version":3,"file":"dynamic-sdf-font-atlases.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/dynamic-sdf-font-atlases.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D;IAGC;QACC,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAA+B,CAAC;IACxD,CAAC;IAED,qCAAK,GAAL;QACC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAC,KAAK;YAC3B,KAAK,CAAC,KAAK,EAAE,CAAC;QACf,CAAC,CAAC,CAAC;IACJ,CAAC;IA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from \"./dynamic-atlas\";\nimport { DynamicAtlasItemFontAtlas } from \"./dynamic-atlas-item-font-atlas\";\nimport { DynamicSDFFontAtlas } from \"./dynamic-sdf-font-atlas\";\n\nexport class DynamicSDFFontAtlases {\n\tprotected _atlases: Map<string, DynamicSDFFontAtlas>;\n\n\tconstructor() {\n\t\tthis._atlases = new Map<string, DynamicSDFFontAtlas>();\n\t}\n\n\tbegin(): void {\n\t\tthis._atlases.forEach((atlas) => {\n\t\t\tatlas.begin();\n\t\t});\n\t}\n\n\tend(): void {\n\t\tconst atlases = this._atlases;\n\t\tatlases.forEach((atlas, family) => {\n\t\t\tatlas.end();\n\t\t\tif (atlas.length <= 0) {\n\t\t\t\tatlas.destroy();\n\t\t\t\tatlases.delete(family);\n\t\t\t}\n\t\t});\n\t}\n\n\tadd(family: string, characters: string[], nacharacters: string[]): void {\n\t\tconst atlases = this._atlases;\n\t\tconst atlas = atlases.get(family);\n\t\tif (atlas != null) {\n\t\t\tatlas.add(characters, nacharacters);\n\t\t} else {\n\t\t\tconst newAtlas = new DynamicSDFFontAtlas(family);\n\t\t\tnewAtlas.add(characters, nacharacters);\n\t\t\tatlases.set(family, newAtlas);\n\t\t}\n\t}\n\n\tget(family: string): DynamicSDFFontAtlas | null {\n\t\tconst atlas = this._atlases.get(family);\n\t\tif (atlas != null) {\n\t\t\treturn atlas;\n\t\t}\n\t\treturn null;\n\t}\n\n\tupdate(baseAtlas: DynamicAtlas): void {\n\t\tconst baseTexture = baseAtlas.getBaseTexture();\n\t\tthis._atlases.forEach((atlas) => {\n\t\t\tconst atlasId = atlas.id;\n\t\t\tif (atlas.update()) {\n\t\t\t\tconst item = baseAtlas.get(atlasId);\n\t\t\t\tif (item != null) {\n\t\t\t\t\tconst width = atlas.width;\n\t\t\t\t\tconst height = atlas.height;\n\t\t\t\t\tconst resolution = baseTexture.resolution;\n\t\t\t\t\titem.frame.width = width;\n\t\t\t\t\titem.frame.height = height;\n\t\t\t\t\titem.width = width / resolution;\n\t\t\t\t\titem.height = height / resolution;\n\t\t\t\t\tbaseAtlas.toDirty();\n\t\t\t\t} else {\n\t\t\t\t\tbaseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (!baseAtlas.contains(atlasId)) {\n\t\t\t\t\tbaseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tdestroy(): void {\n\t\tconst atlases = this._atlases;\n\t\tatlases.forEach((atlas) => {\n\t\t\tatlas.destroy();\n\t\t});\n\t\tatlases.clear();\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
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.450.0
2
+ Winter Cardinal UI v0.450.1
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15221,6 +15221,9 @@ var DynamicAtlas = /** @class */ (function () {
15221
15221
  }
15222
15222
  return null;
15223
15223
  };
15224
+ DynamicAtlas.prototype.contains = function (id) {
15225
+ return id in this._idToDatum;
15226
+ };
15224
15227
  DynamicAtlas.prototype.set = function (id, item) {
15225
15228
  var result = this._idToDatum[id];
15226
15229
  item.ref += 1;
@@ -16036,8 +16039,8 @@ var DynamicSDFFontAtlases = /** @class */ (function () {
16036
16039
  DynamicSDFFontAtlases.prototype.update = function (baseAtlas) {
16037
16040
  var baseTexture = baseAtlas.getBaseTexture();
16038
16041
  this._atlases.forEach(function (atlas) {
16042
+ var atlasId = atlas.id;
16039
16043
  if (atlas.update()) {
16040
- var atlasId = atlas.id;
16041
16044
  var item = baseAtlas.get(atlasId);
16042
16045
  if (item != null) {
16043
16046
  var width = atlas.width;
@@ -16053,6 +16056,11 @@ var DynamicSDFFontAtlases = /** @class */ (function () {
16053
16056
  baseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));
16054
16057
  }
16055
16058
  }
16059
+ else {
16060
+ if (!baseAtlas.contains(atlasId)) {
16061
+ baseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));
16062
+ }
16063
+ }
16056
16064
  });
16057
16065
  };
16058
16066
  DynamicSDFFontAtlases.prototype.destroy = function () {
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.450.0
2
+ Winter Cardinal UI v0.450.1
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15218,6 +15218,9 @@
15218
15218
  }
15219
15219
  return null;
15220
15220
  };
15221
+ DynamicAtlas.prototype.contains = function (id) {
15222
+ return id in this._idToDatum;
15223
+ };
15221
15224
  DynamicAtlas.prototype.set = function (id, item) {
15222
15225
  var result = this._idToDatum[id];
15223
15226
  item.ref += 1;
@@ -16033,8 +16036,8 @@
16033
16036
  DynamicSDFFontAtlases.prototype.update = function (baseAtlas) {
16034
16037
  var baseTexture = baseAtlas.getBaseTexture();
16035
16038
  this._atlases.forEach(function (atlas) {
16039
+ var atlasId = atlas.id;
16036
16040
  if (atlas.update()) {
16037
- var atlasId = atlas.id;
16038
16041
  var item = baseAtlas.get(atlasId);
16039
16042
  if (item != null) {
16040
16043
  var width = atlas.width;
@@ -16050,6 +16053,11 @@
16050
16053
  baseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));
16051
16054
  }
16052
16055
  }
16056
+ else {
16057
+ if (!baseAtlas.contains(atlasId)) {
16058
+ baseAtlas.set(atlasId, new DynamicAtlasItemFontAtlas(atlas, baseTexture));
16059
+ }
16060
+ }
16053
16061
  });
16054
16062
  };
16055
16063
  DynamicSDFFontAtlases.prototype.destroy = function () {