@wcardinal/wcardinal-ui 0.401.0 → 0.403.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.
@@ -1 +1 @@
1
- {"version":3,"file":"util-svg-atlas-builder.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/util-svg-atlas-builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAgB,SAAS,EAAe,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAiBxC;IAgBC,6BAAY,OAAmC;;QAC9C,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,KAAK,mCAAI,GAAG,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,KAAK,mCAAI,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,CAAC,CAAC;QACnC,IAAI,CAAC,WAAW,GAAG,MAAA,MAAA,OAAO,CAAC,UAAU,mCAAI,MAAM,CAAC,gBAAgB,mCAAI,CAAC,CAAC;QACtE,IAAI,CAAC,QAAQ,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,QAAQ,CAAC,UAAU,CAAC;QACvD,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,QAAQ,CAAC,eAAe,CAAC;QAE1D,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QAChB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IAClB,CAAC;IAED,sBAAI,sCAAK;aAAT;YACC,OAAO,IAAI,CAAC,MAAM,CAAC;QACpB,CAAC;;;OAAA;I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AAC;YAC5C,IAAM,WAAW,GAAG,wBAAgB,KAAK,GAAG,KAAK,cAAI,MAAM,GAAG,KAAK,OAAG,CAAC;YACvE,IAAM,SAAS,GAAG,sCAAoC,CAAC;YACvD,IAAM,GAAG,GAAG,QAAQ,CACnB,eAAQ,SAAS,cAAI,UAAU,cAAI,WAAW,cAAI,SAAS,cAAI,IAAI,CAAC,IAAI,WAAQ,CAChF,CAAC;YACF,IAAM,SAAS,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,IAAI,CAAC,QAAQ,CAAC;YACpD,IAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE;gBACzC,UAAU,YAAA;gBACV,SAAS,WAAA;gBACT,MAAM,EAAE,IAAI,CAAC,OAAO;aACpB,CAAC,CAAC;YACH,IAAM,QAAM,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACzB,KAAK,IAAM,MAAI,IAAI,QAAM,EAAE;gBAC1B,KAAK,CAAC,MAAI,CAAC,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,QAAM,CAAC,MAAI,CAAC,CAAC,CAAC;aACrD;SACD;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IACF,0BAAC;AAAD,CAAC,AAtID,IAsIC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { BaseTexture, MIPMAP_MODES, Rectangle, SCALE_MODES, Texture, settings } from \"pixi.js\";\nimport { toSvgUrl } from \"./to-svg-url\";\n\nexport interface UtilSvgAtlasBuilderBuildOptions {\n\tforce?: boolean;\n\tscaling?: SCALE_MODES;\n\tresolution?: number;\n}\n\nexport interface UtilSvgAtlasBuilderOptions {\n\twidth?: number;\n\tratio?: number;\n\tmargin?: number;\n\tresolution?: number;\n\tscaling?: SCALE_MODES;\n\tmipmap?: MIPMAP_MODES;\n}\n\nexport class UtilSvgAtlasBuilder {\n\tprotected _width: number;\n\tprotected _ratio: number;\n\tprotected _margin: number;\n\tprotected _resolution: number;\n\tprotected _scaling: SCALE_MODES;\n\tprotected _mipmap: MIPMAP_MODES;\n\n\tprotected _frames: Record<string, Rectangle>;\n\tprotected _svg: string;\n\tprotected _nextX: number;\n\tprotected _nextY: number;\n\tprotected _height: number;\n\n\tprotected _built?: Record<string, Texture>;\n\n\tconstructor(options: UtilSvgAtlasBuilderOptions) {\n\t\tthis._width = options.width ?? 256;\n\t\tthis._ratio = options.ratio ?? 1;\n\t\tthis._margin = options.margin ?? 3;\n\t\tthis._resolution = options.resolution ?? window.devicePixelRatio ?? 1;\n\t\tthis._scaling = options.scaling ?? settings.SCALE_MODE;\n\t\tthis._mipmap = options.mipmap ?? settings.MIPMAP_TEXTURES;\n\n\t\tthis._frames = {};\n\t\tthis._svg = \"\";\n\t\tthis._nextX = 0;\n\t\tthis._nextY = 0;\n\t\tthis._height = 0;\n\t}\n\n\tget width(): number {\n\t\treturn this._width;\n\t}\n\n\tget ratio(): number {\n\t\treturn this._ratio;\n\t}\n\n\tget margin(): number {\n\t\treturn this._margin;\n\t}\n\n\tadd(name: string, width: number, height: number, path: string): boolean;\n\tadd(\n\t\tname: string,\n\t\twidth: number,\n\t\theight: number,\n\t\tpath: string,\n\t\tframeX: number,\n\t\tframeY: number,\n\t\tframeWidth: number,\n\t\tframeHeight: number\n\t): boolean;\n\tadd(\n\t\tname: string,\n\t\twidth: number,\n\t\theight: number,\n\t\tpath: string,\n\t\tframeX?: number,\n\t\tframeY?: number,\n\t\tframeWidth?: number,\n\t\tframeHeight?: number\n\t): boolean {\n\t\tconst frames = this._frames;\n\t\tif (!(name in frames)) {\n\t\t\t// Position\n\t\t\tconst margin = this._margin;\n\t\t\tlet x = this._nextX;\n\t\t\tlet y = this._nextY;\n\t\t\tif (this._width <= x + width) {\n\t\t\t\tx = 0;\n\t\t\t\ty = this._nextY + this._height + margin;\n\t\t\t\tthis._height = height;\n\t\t\t\tthis._nextY = y;\n\t\t\t} else {\n\t\t\t\tthis._height = Math.max(this._height, height);\n\t\t\t}\n\t\t\tthis._nextX = x + width + margin;\n\n\t\t\t// Frame\n\t\t\tframes[name] = new Rectangle(\n\t\t\t\tx + (frameX ?? 0),\n\t\t\t\ty + (frameY ?? 0),\n\t\t\t\tframeWidth ?? width,\n\t\t\t\tframeHeight ?? height\n\t\t\t);\n\n\t\t\t// Svg\n\t\t\tconst ratio = this._ratio;\n\t\t\tthis._svg += `<g transform=\"translate(${x * ratio},${y * ratio})\">${path}</g>`;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\thas(name: string): boolean {\n\t\treturn name in this._frames;\n\t}\n\n\tget mappings(): Record<string, Texture> {\n\t\treturn this.build();\n\t}\n\n\tbuild(options?: UtilSvgAtlasBuilderBuildOptions): Record<string, Texture> {\n\t\tlet built = this._built;\n\t\tif (built == null || options?.force) {\n\t\t\tconst resolution = options?.resolution ?? this._resolution;\n\t\t\tconst width = this._width;\n\t\t\tconst height = Math.pow(2, Math.ceil(Math.log(this._nextY + this._height) / Math.LN2));\n\t\t\tconst realWidth = width * resolution;\n\t\t\tconst realHeight = height * resolution;\n\t\t\tconst ratio = this._ratio;\n\t\t\tconst attrWidth = `width=\"${realWidth}\"`;\n\t\t\tconst attrHeight = `height=\"${realHeight}\"`;\n\t\t\tconst attrViewBox = `viewBox=\"0 0 ${width * ratio} ${height * ratio}\"`;\n\t\t\tconst attrXmlns = `xmlns=\"http://www.w3.org/2000/svg\"`;\n\t\t\tconst url = toSvgUrl(\n\t\t\t\t`<svg ${attrWidth} ${attrHeight} ${attrViewBox} ${attrXmlns}>${this._svg}</svg>`\n\t\t\t);\n\t\t\tconst scaleMode = options?.scaling ?? this._scaling;\n\t\t\tconst baseTexture = BaseTexture.from(url, {\n\t\t\t\tresolution,\n\t\t\t\tscaleMode,\n\t\t\t\tmipmap: this._mipmap\n\t\t\t});\n\t\t\tconst frames = this._frames;\n\t\t\tbuilt = this._built = {};\n\t\t\tfor (const name in frames) {\n\t\t\t\tbuilt[name] = new Texture(baseTexture, frames[name]);\n\t\t\t}\n\t\t}\n\t\treturn built;\n\t}\n}\n"]}
1
+ {"version":3,"file":"util-svg-atlas-builder.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/util/util-svg-atlas-builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAgB,SAAS,EAAe,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAiBxC;IAgBC,6BAAY,OAAmC;;QAC9C,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,KAAK,mCAAI,GAAG,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,KAAK,mCAAI,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,CAAC,CAAC;QACnC,IAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACtC,IAAI,UAAU,IAAI,IAAI,EAAE;YACvB,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;SAC9B;aAAM;YACN,IAAM,GAAG,GAAG,MAAA,MAAM,CAAC,gBAAgB,mCAAI,CAAC,CAAC;YACzC,IAAI,CAAC,WAAW,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;SAC3C;QACD,IAAI,CAAC,QAAQ,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,QAAQ,CAAC,UAAU,CAAC;QACvD,IAAI,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,QAAQ,CAAC,eAAe,CAAC;QAE1D,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,GAAG,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AM,SAAS,GAAG,KAAK,GAAG,UAAU,CAAC;YACrC,IAAM,UAAU,GAAG,MAAM,GAAG,UAAU,CAAC;YACvC,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC;YAC1B,IAAM,SAAS,GAAG,kBAAU,SAAS,OAAG,CAAC;YACzC,IAAM,UAAU,GAAG,mBAAW,UAAU,OAAG,CAAC;YAC5C,IAAM,WAAW,GAAG,wBAAgB,KAAK,GAAG,KAAK,cAAI,MAAM,GAAG,KAAK,OAAG,CAAC;YACvE,IAAM,SAAS,GAAG,sCAAoC,CAAC;YACvD,IAAM,GAAG,GAAG,QAAQ,CACnB,eAAQ,SAAS,cAAI,UAAU,cAAI,WAAW,cAAI,SAAS,cAAI,IAAI,CAAC,IAAI,WAAQ,CAChF,CAAC;YACF,IAAM,SAAS,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,mCAAI,IAAI,CAAC,QAAQ,CAAC;YACpD,IAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE;gBACzC,UAAU,YAAA;gBACV,SAAS,WAAA;gBACT,MAAM,EAAE,IAAI,CAAC,OAAO;aACpB,CAAC,CAAC;YACH,IAAM,QAAM,GAAG,IAAI,CAAC,OAAO,CAAC;YAC5B,KAAK,GAAG,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;YACzB,KAAK,IAAM,MAAI,IAAI,QAAM,EAAE;gBAC1B,KAAK,CAAC,MAAI,CAAC,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,QAAM,CAAC,MAAI,CAAC,CAAC,CAAC;aACrD;SACD;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IACF,0BAAC;AAAD,CAAC,AA5ID,IA4IC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { BaseTexture, MIPMAP_MODES, Rectangle, SCALE_MODES, Texture, settings } from \"pixi.js\";\nimport { toSvgUrl } from \"./to-svg-url\";\n\nexport interface UtilSvgAtlasBuilderBuildOptions {\n\tforce?: boolean;\n\tscaling?: SCALE_MODES;\n\tresolution?: number;\n}\n\nexport interface UtilSvgAtlasBuilderOptions {\n\twidth?: number;\n\tratio?: number;\n\tmargin?: number;\n\tresolution?: number;\n\tscaling?: SCALE_MODES;\n\tmipmap?: MIPMAP_MODES;\n}\n\nexport class UtilSvgAtlasBuilder {\n\tprotected _width: number;\n\tprotected _ratio: number;\n\tprotected _margin: number;\n\tprotected _resolution: number;\n\tprotected _scaling: SCALE_MODES;\n\tprotected _mipmap: MIPMAP_MODES;\n\n\tprotected _frames: Record<string, Rectangle>;\n\tprotected _svg: string;\n\tprotected _nextX: number;\n\tprotected _nextY: number;\n\tprotected _height: number;\n\n\tprotected _built?: Record<string, Texture>;\n\n\tconstructor(options: UtilSvgAtlasBuilderOptions) {\n\t\tthis._width = options.width ?? 256;\n\t\tthis._ratio = options.ratio ?? 1;\n\t\tthis._margin = options.margin ?? 3;\n\t\tconst resolution = options.resolution;\n\t\tif (resolution != null) {\n\t\t\tthis._resolution = resolution;\n\t\t} else {\n\t\t\tconst dpr = window.devicePixelRatio ?? 1;\n\t\t\tthis._resolution = 2 < dpr ? dpr : dpr * 2;\n\t\t}\n\t\tthis._scaling = options.scaling ?? settings.SCALE_MODE;\n\t\tthis._mipmap = options.mipmap ?? settings.MIPMAP_TEXTURES;\n\n\t\tthis._frames = {};\n\t\tthis._svg = \"\";\n\t\tthis._nextX = 0;\n\t\tthis._nextY = 0;\n\t\tthis._height = 0;\n\t}\n\n\tget width(): number {\n\t\treturn this._width;\n\t}\n\n\tget ratio(): number {\n\t\treturn this._ratio;\n\t}\n\n\tget margin(): number {\n\t\treturn this._margin;\n\t}\n\n\tadd(name: string, width: number, height: number, path: string): boolean;\n\tadd(\n\t\tname: string,\n\t\twidth: number,\n\t\theight: number,\n\t\tpath: string,\n\t\tframeX: number,\n\t\tframeY: number,\n\t\tframeWidth: number,\n\t\tframeHeight: number\n\t): boolean;\n\tadd(\n\t\tname: string,\n\t\twidth: number,\n\t\theight: number,\n\t\tpath: string,\n\t\tframeX?: number,\n\t\tframeY?: number,\n\t\tframeWidth?: number,\n\t\tframeHeight?: number\n\t): boolean {\n\t\tconst frames = this._frames;\n\t\tif (!(name in frames)) {\n\t\t\t// Position\n\t\t\tconst margin = this._margin;\n\t\t\tlet x = this._nextX;\n\t\t\tlet y = this._nextY;\n\t\t\tif (this._width <= x + width) {\n\t\t\t\tx = 0;\n\t\t\t\ty = this._nextY + this._height + margin;\n\t\t\t\tthis._height = height;\n\t\t\t\tthis._nextY = y;\n\t\t\t} else {\n\t\t\t\tthis._height = Math.max(this._height, height);\n\t\t\t}\n\t\t\tthis._nextX = x + width + margin;\n\n\t\t\t// Frame\n\t\t\tframes[name] = new Rectangle(\n\t\t\t\tx + (frameX ?? 0),\n\t\t\t\ty + (frameY ?? 0),\n\t\t\t\tframeWidth ?? width,\n\t\t\t\tframeHeight ?? height\n\t\t\t);\n\n\t\t\t// Svg\n\t\t\tconst ratio = this._ratio;\n\t\t\tthis._svg += `<g transform=\"translate(${x * ratio},${y * ratio})\">${path}</g>`;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\thas(name: string): boolean {\n\t\treturn name in this._frames;\n\t}\n\n\tget mappings(): Record<string, Texture> {\n\t\treturn this.build();\n\t}\n\n\tbuild(options?: UtilSvgAtlasBuilderBuildOptions): Record<string, Texture> {\n\t\tlet built = this._built;\n\t\tif (built == null || options?.force) {\n\t\t\tconst resolution = options?.resolution ?? this._resolution;\n\t\t\tconst width = this._width;\n\t\t\tconst height = Math.pow(2, Math.ceil(Math.log(this._nextY + this._height) / Math.LN2));\n\t\t\tconst realWidth = width * resolution;\n\t\t\tconst realHeight = height * resolution;\n\t\t\tconst ratio = this._ratio;\n\t\t\tconst attrWidth = `width=\"${realWidth}\"`;\n\t\t\tconst attrHeight = `height=\"${realHeight}\"`;\n\t\t\tconst attrViewBox = `viewBox=\"0 0 ${width * ratio} ${height * ratio}\"`;\n\t\t\tconst attrXmlns = `xmlns=\"http://www.w3.org/2000/svg\"`;\n\t\t\tconst url = toSvgUrl(\n\t\t\t\t`<svg ${attrWidth} ${attrHeight} ${attrViewBox} ${attrXmlns}>${this._svg}</svg>`\n\t\t\t);\n\t\t\tconst scaleMode = options?.scaling ?? this._scaling;\n\t\t\tconst baseTexture = BaseTexture.from(url, {\n\t\t\t\tresolution,\n\t\t\t\tscaleMode,\n\t\t\t\tmipmap: this._mipmap\n\t\t\t});\n\t\t\tconst frames = this._frames;\n\t\t\tbuilt = this._built = {};\n\t\t\tfor (const name in frames) {\n\t\t\t\tbuilt[name] = new Texture(baseTexture, frames[name]);\n\t\t\t}\n\t\t}\n\t\treturn built;\n\t}\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.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.401.0
2
+ Winter Cardinal UI v0.403.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15159,15 +15159,7 @@ var DBase = /** @class */ (function (_super) {
15159
15159
  };
15160
15160
  //
15161
15161
  DBase.prototype._calculateBounds = function () {
15162
- var worldTransform = this.transform.worldTransform;
15163
- var bounds = this._bounds;
15164
- var work = DBase.WORK_CONTAINS_POINT;
15165
- work.set(0, 0);
15166
- worldTransform.apply(work, work);
15167
- bounds.addPoint(work);
15168
- work.set(this._width, this._height);
15169
- worldTransform.apply(work, work);
15170
- bounds.addPoint(work);
15162
+ this._bounds.addFrame(this.transform, 0, 0, this._width, this._height);
15171
15163
  _super.prototype._calculateBounds.call(this);
15172
15164
  };
15173
15165
  DBase.prototype.containsPoint = function (point) {
@@ -29472,7 +29464,8 @@ var DDynamicText = /** @class */ (function (_super) {
29472
29464
  };
29473
29465
  DDynamicText.prototype._calculateBounds = function () {
29474
29466
  this.update();
29475
- _super.prototype._calculateBounds.call(this);
29467
+ var geometry = this.geometry;
29468
+ this._bounds.addFrame(this.transform, 0, 0, geometry.width, geometry.height);
29476
29469
  };
29477
29470
  DDynamicText.prototype._render = function (renderer) {
29478
29471
  this.update();
@@ -47178,13 +47171,20 @@ var ESnapper = /** @class */ (function (_super) {
47178
47171
  */
47179
47172
  var UtilSvgAtlasBuilder = /** @class */ (function () {
47180
47173
  function UtilSvgAtlasBuilder(options) {
47181
- var _a, _b, _c, _d, _e, _f, _g;
47174
+ var _a, _b, _c, _d, _e, _f;
47182
47175
  this._width = (_a = options.width) !== null && _a !== void 0 ? _a : 256;
47183
47176
  this._ratio = (_b = options.ratio) !== null && _b !== void 0 ? _b : 1;
47184
47177
  this._margin = (_c = options.margin) !== null && _c !== void 0 ? _c : 3;
47185
- this._resolution = (_e = (_d = options.resolution) !== null && _d !== void 0 ? _d : window.devicePixelRatio) !== null && _e !== void 0 ? _e : 1;
47186
- this._scaling = (_f = options.scaling) !== null && _f !== void 0 ? _f : pixi_js.settings.SCALE_MODE;
47187
- this._mipmap = (_g = options.mipmap) !== null && _g !== void 0 ? _g : pixi_js.settings.MIPMAP_TEXTURES;
47178
+ var resolution = options.resolution;
47179
+ if (resolution != null) {
47180
+ this._resolution = resolution;
47181
+ }
47182
+ else {
47183
+ var dpr = (_d = window.devicePixelRatio) !== null && _d !== void 0 ? _d : 1;
47184
+ this._resolution = 2 < dpr ? dpr : dpr * 2;
47185
+ }
47186
+ this._scaling = (_e = options.scaling) !== null && _e !== void 0 ? _e : pixi_js.settings.SCALE_MODE;
47187
+ this._mipmap = (_f = options.mipmap) !== null && _f !== void 0 ? _f : pixi_js.settings.MIPMAP_TEXTURES;
47188
47188
  this._frames = {};
47189
47189
  this._svg = "";
47190
47190
  this._nextX = 0;
@@ -1,5 +1,5 @@
1
1
  /*
2
- Winter Cardinal UI v0.401.0
2
+ Winter Cardinal UI v0.403.0
3
3
  Copyright (C) 2019 Toshiba Corporation
4
4
  SPDX-License-Identifier: Apache-2.0
5
5
 
@@ -15156,15 +15156,7 @@
15156
15156
  };
15157
15157
  //
15158
15158
  DBase.prototype._calculateBounds = function () {
15159
- var worldTransform = this.transform.worldTransform;
15160
- var bounds = this._bounds;
15161
- var work = DBase.WORK_CONTAINS_POINT;
15162
- work.set(0, 0);
15163
- worldTransform.apply(work, work);
15164
- bounds.addPoint(work);
15165
- work.set(this._width, this._height);
15166
- worldTransform.apply(work, work);
15167
- bounds.addPoint(work);
15159
+ this._bounds.addFrame(this.transform, 0, 0, this._width, this._height);
15168
15160
  _super.prototype._calculateBounds.call(this);
15169
15161
  };
15170
15162
  DBase.prototype.containsPoint = function (point) {
@@ -29469,7 +29461,8 @@
29469
29461
  };
29470
29462
  DDynamicText.prototype._calculateBounds = function () {
29471
29463
  this.update();
29472
- _super.prototype._calculateBounds.call(this);
29464
+ var geometry = this.geometry;
29465
+ this._bounds.addFrame(this.transform, 0, 0, geometry.width, geometry.height);
29473
29466
  };
29474
29467
  DDynamicText.prototype._render = function (renderer) {
29475
29468
  this.update();
@@ -47783,13 +47776,20 @@
47783
47776
  */
47784
47777
  var UtilSvgAtlasBuilder = /** @class */ (function () {
47785
47778
  function UtilSvgAtlasBuilder(options) {
47786
- var _a, _b, _c, _d, _e, _f, _g;
47779
+ var _a, _b, _c, _d, _e, _f;
47787
47780
  this._width = (_a = options.width) !== null && _a !== void 0 ? _a : 256;
47788
47781
  this._ratio = (_b = options.ratio) !== null && _b !== void 0 ? _b : 1;
47789
47782
  this._margin = (_c = options.margin) !== null && _c !== void 0 ? _c : 3;
47790
- this._resolution = (_e = (_d = options.resolution) !== null && _d !== void 0 ? _d : window.devicePixelRatio) !== null && _e !== void 0 ? _e : 1;
47791
- this._scaling = (_f = options.scaling) !== null && _f !== void 0 ? _f : pixi_js.settings.SCALE_MODE;
47792
- this._mipmap = (_g = options.mipmap) !== null && _g !== void 0 ? _g : pixi_js.settings.MIPMAP_TEXTURES;
47783
+ var resolution = options.resolution;
47784
+ if (resolution != null) {
47785
+ this._resolution = resolution;
47786
+ }
47787
+ else {
47788
+ var dpr = (_d = window.devicePixelRatio) !== null && _d !== void 0 ? _d : 1;
47789
+ this._resolution = 2 < dpr ? dpr : dpr * 2;
47790
+ }
47791
+ this._scaling = (_e = options.scaling) !== null && _e !== void 0 ? _e : pixi_js.settings.SCALE_MODE;
47792
+ this._mipmap = (_f = options.mipmap) !== null && _f !== void 0 ? _f : pixi_js.settings.MIPMAP_TEXTURES;
47793
47793
  this._frames = {};
47794
47794
  this._svg = "";
47795
47795
  this._nextX = 0;