@wcardinal/wcardinal-ui 0.441.0 → 0.442.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.
- package/dist/wcardinal/ui/d-dynamic-text.js +3 -8
- package/dist/wcardinal/ui/d-dynamic-text.js.map +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter-part-container.js +1 -1
- package/dist/wcardinal/ui/d-image-piece-layouter-part-container.js.map +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-dark-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-dark-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-dark.js +1 -1
- package/dist/wcardinal-ui-theme-dark.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.js +1 -1
- package/dist/wcardinal-ui-theme-white-en-us.min.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.js +1 -1
- package/dist/wcardinal-ui-theme-white-ja-jp.min.js +1 -1
- package/dist/wcardinal-ui-theme-white.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +5 -10
- package/dist/wcardinal-ui.js +5 -10
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -205,18 +205,13 @@ var DDynamicText = /** @class */ (function (_super) {
|
|
|
205
205
|
if (styleClipping || styleFitting || styleWordWrap) {
|
|
206
206
|
var parent_1 = this.parent;
|
|
207
207
|
if (parent_1 instanceof DBase) {
|
|
208
|
-
var
|
|
209
|
-
|
|
210
|
-
parent_1.padding.getRight() -
|
|
211
|
-
modifier.delta.width;
|
|
208
|
+
var padding = parent_1.padding;
|
|
209
|
+
var width = parent_1.width - padding.getLeft() - padding.getRight() - modifier.delta.width;
|
|
212
210
|
if (modifier.width !== width) {
|
|
213
211
|
modifier.width = width;
|
|
214
212
|
isChanged = true;
|
|
215
213
|
}
|
|
216
|
-
var height = parent_1.height -
|
|
217
|
-
parent_1.padding.getTop() -
|
|
218
|
-
parent_1.padding.getBottom() -
|
|
219
|
-
modifier.delta.height;
|
|
214
|
+
var height = parent_1.height - padding.getTop() - padding.getBottom() - modifier.delta.height;
|
|
220
215
|
if (modifier.height !== height) {
|
|
221
216
|
modifier.height = height;
|
|
222
217
|
isChanged = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-dynamic-text.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dynamic-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAY,OAAO,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAiB5C;IAAkC,gCAAI;IAcrC,sBAAY,KAAwB;QAApC,YACC,kBAAM,IAAI,oBAAoB,EAAE,EAAE,IAAI,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,SA0BlE;QAxBA,KAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE;YAClB,KAAI,CAAC,aAAa,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;QACH,KAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,KAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,KAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,KAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,K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AQ,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9E,CAAC;IAES,8BAAO,GAAjB,UAAkB,QAAmB;QACpC,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,iBAAM,OAAO,YAAC,QAAS,CAAC,CAAC;IAC1B,CAAC;IACF,mBAAC;AAAD,CAAC,AA1PD,CAAkC,IAAI,GA0PrC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Mesh, MeshMaterial, Renderer, Texture } from \"pixi.js\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase } from \"./d-base\";\nimport { DDynamicTextGeometry } from \"./d-dynamic-text-geometry\";\nimport { DDynamicTextStyle } from \"./d-dynamic-text-style\";\nimport { DDynamicTextStyleWordWrap } from \"./d-dynamic-text-style-word-wrap\";\nimport { DynamicFontAtlas } from \"./util/dynamic-font-atlas\";\nimport { UtilFont } from \"./util/util-font\";\n\nexport interface DDynamicTextClippingDelta {\n\twidth: number;\n\theight: number;\n}\n\nexport interface DDynamicTextModifier {\n\tclipping: boolean;\n\tfitting: boolean;\n\twordWrap: DDynamicTextStyleWordWrap;\n\twidth: number;\n\theight: number;\n\tlineHeight: number;\n\tdelta: DDynamicTextClippingDelta;\n}\n\nexport class DDynamicText extends Mesh {\n\tprotected _style: DDynamicTextStyle;\n\tprotected _text: string;\n\tprotected _textApproved: string;\n\tprotected _isDirty: boolean;\n\tprotected _isGeometryDirty: boolean;\n\tprotected _atlas: DynamicFontAtlas | null;\n\tprotected _atlasRevisionUpdated: number;\n\tprotected _width: number;\n\tprotected _height: number;\n\tprotected _modifier: DDynamicTextModifier;\n\n\treadonly geometry!: DDynamicTextGeometry;\n\n\tconstructor(style: DDynamicTextStyle) {\n\t\tsuper(new DDynamicTextGeometry(), new MeshMaterial(Texture.EMPTY));\n\n\t\tthis._style = style;\n\t\tstyle.on(\"change\", () => {\n\t\t\tthis.onStyleChange();\n\t\t});\n\t\tthis._text = \"\";\n\t\tthis._textApproved = \"\";\n\t\tthis._isDirty = true;\n\t\tthis._isGeometryDirty = true;\n\t\tthis._atlas = null;\n\t\tthis._atlasRevisionUpdated = 0;\n\t\tthis._width = 0;\n\t\tthis._height = 0;\n\t\tthis._modifier = {\n\t\t\tclipping: false,\n\t\t\tfitting: false,\n\t\t\twordWrap: DDynamicTextStyleWordWrap.NONE,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\tlineHeight: 0,\n\t\t\tdelta: {\n\t\t\t\twidth: 0,\n\t\t\t\theight: 0\n\t\t\t}\n\t\t};\n\t}\n\n\tprotected onStyleChange(): void {\n\t\tthis._isDirty = true;\n\t\tthis._isGeometryDirty = true;\n\t\tthis._atlas = null;\n\t\tthis.update_();\n\t}\n\n\tprotected update_(): void {\n\t\tconst layer = DApplications.getLayer(this);\n\t\tif (layer) {\n\t\t\tif (this._isDirty) {\n\t\t\t\tthis._isDirty = false;\n\n\t\t\t\tconst text = this._text;\n\t\t\t\tconst textApproved = this._textApproved;\n\t\t\t\tthis._textApproved = text;\n\t\t\t\tconst style = this._style;\n\t\t\t\tconst fontId = style.fontId;\n\t\t\t\tconst fontIdApproved = style.fontIdApproved;\n\t\t\t\tconst fontIdFontSize = style.fontIdFontSize;\n\t\t\t\tconst fill = style.fill;\n\t\t\t\tconst fillApproved = style.fillApproved;\n\t\t\t\tstyle.approve();\n\n\t\t\t\tconst atlases = layer.getDynamicFontAtlases();\n\t\t\t\tif (text !== textApproved || fontId !== fontIdApproved || fill !== fillApproved) {\n\t\t\t\t\tatlases.add(fontId, fontIdFontSize, fill, text);\n\t\t\t\t\tatlases.remove(fontIdApproved, fillApproved, textApproved);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tget text(): string {\n\t\treturn this._text;\n\t}\n\n\tset text(text: string) {\n\t\tif (this._text !== text) {\n\t\t\tthis._text = text;\n\t\t\tif (!this._style.unfit()) {\n\t\t\t\tthis._isDirty = true;\n\t\t\t\tthis._isGeometryDirty = true;\n\t\t\t\tthis.update_();\n\t\t\t}\n\t\t}\n\t}\n\n\t// @ts-ignore\n\tget width(): number {\n\t\tthis.update();\n\t\treturn Math.abs(this.scale.x) * this.geometry.width;\n\t}\n\n\tset width(width: number) {\n\t\tthis.update();\n\t\tconst geometryWidth = this.geometry.width;\n\t\tif (+1e-4 < geometryWidth) {\n\t\t\tconst newScale = width / geometryWidth;\n\t\t\tthis.scale.x = 0 <= this.scale.x ? +newScale : -newScale;\n\t\t}\n\t}\n\n\t// @ts-ignore\n\tget height(): number {\n\t\tthis.update();\n\t\treturn Math.abs(this.scale.y) * this.geometry.height;\n\t}\n\n\tset height(height: number) {\n\t\tthis.update();\n\t\tconst geometryHeight = this.geometry.height;\n\t\tif (+1e-4 < geometryHeight) {\n\t\t\tconst newScale = height / geometryHeight;\n\t\t\tthis.scale.y = 0 <= this.scale.y ? +newScale : -newScale;\n\t\t}\n\t}\n\n\tget clipped(): boolean {\n\t\treturn this.geometry.clipped;\n\t}\n\n\tget style(): DDynamicTextStyle {\n\t\treturn this._style;\n\t}\n\n\tupdate(): void {\n\t\tthis.update_();\n\n\t\tconst style = this._style;\n\t\tlet atlas = this._atlas;\n\t\tif (atlas == null) {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tatlas = layer.getDynamicFontAtlases().get(style.fontId, style.fill);\n\t\t\t\tif (atlas != null) {\n\t\t\t\t\tthis._atlasRevisionUpdated = atlas.getRevisionUpdate();\n\t\t\t\t\tthis._atlas = atlas;\n\t\t\t\t\tthis.texture = atlas.texture;\n\t\t\t\t\tthis._isGeometryDirty = true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst revisionUpdate = atlas.getRevisionUpdate();\n\t\t\tif (revisionUpdate !== this._atlasRevisionUpdated) {\n\t\t\t\tthis._atlasRevisionUpdated = revisionUpdate;\n\t\t\t\tthis._isGeometryDirty = true;\n\t\t\t}\n\t\t}\n\n\t\tconst modifier = this._modifier;\n\t\tif (this.updateClipping(style, modifier)) {\n\t\t\tthis._isGeometryDirty = true;\n\t\t}\n\n\t\tif (this._isGeometryDirty) {\n\t\t\tthis._isGeometryDirty = false;\n\t\t\tconst geometry = this.geometry;\n\t\t\tgeometry.update(this._text, atlas, modifier);\n\n\t\t\tif (modifier.fitting && !style.isFontFitted && geometry.scaled) {\n\t\t\t\tconst oldScale = geometry.scale;\n\t\t\t\tconst oldFontSize = style.fontSize;\n\t\t\t\tconst newFontId = style.toFontId(Math.ceil(oldFontSize * oldScale * 1000) / 1000);\n\t\t\t\tconst newFontSize = UtilFont.toSize(newFontId);\n\t\t\t\tconst newScale = newFontSize / oldFontSize;\n\t\t\t\tconst newLineHeight = style.lineHeight * newScale;\n\t\t\t\tif (style.fit(newFontSize, newLineHeight)) {\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tDApplications.update(this);\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected updateClipping(style: DDynamicTextStyle, modifier: DDynamicTextModifier): boolean {\n\t\tlet isChanged = false;\n\n\t\tconst styleClipping = style.clipping;\n\t\tif (modifier.clipping !== styleClipping) {\n\t\t\tmodifier.clipping = styleClipping;\n\t\t\tisChanged = true;\n\t\t}\n\n\t\tconst styleFitting = style.fitting;\n\t\tif (modifier.fitting !== styleFitting) {\n\t\t\tmodifier.fitting = styleFitting;\n\t\t\tisChanged = true;\n\t\t}\n\n\t\tconst styleWordWrap = style.wordWrap;\n\t\tif (modifier.wordWrap !== styleWordWrap) {\n\t\t\tmodifier.wordWrap = styleWordWrap;\n\t\t\tisChanged = true;\n\t\t}\n\n\t\tconst styleLineHeight = styleFitting ? style.lineHeightFitted : style.lineHeight;\n\t\tif (modifier.lineHeight !== styleLineHeight) {\n\t\t\tmodifier.lineHeight = styleLineHeight;\n\t\t\tisChanged = true;\n\t\t}\n\n\t\tif (styleClipping || styleFitting || styleWordWrap) {\n\t\t\tconst parent = this.parent;\n\t\t\tif (parent instanceof DBase) {\n\t\t\t\tconst width =\n\t\t\t\t\tparent.width -\n\t\t\t\t\tparent.padding.getLeft() -\n\t\t\t\t\tparent.padding.getRight() -\n\t\t\t\t\tmodifier.delta.width;\n\t\t\t\tif (modifier.width !== width) {\n\t\t\t\t\tmodifier.width = width;\n\t\t\t\t\tisChanged = true;\n\t\t\t\t}\n\n\t\t\t\tconst height =\n\t\t\t\t\tparent.height -\n\t\t\t\t\tparent.padding.getTop() -\n\t\t\t\t\tparent.padding.getBottom() -\n\t\t\t\t\tmodifier.delta.height;\n\t\t\t\tif (modifier.height !== height) {\n\t\t\t\t\tmodifier.height = height;\n\t\t\t\t\tisChanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn isChanged;\n\t}\n\n\tsetClippingDelta(width: number, height: number): void {\n\t\tconst delta = this._modifier.delta;\n\t\tdelta.width = width;\n\t\tdelta.height = height;\n\t}\n\n\tprotected _calculateBounds(): void {\n\t\tthis.update();\n\t\tconst geometry = this.geometry;\n\t\tthis._bounds.addFrame(this.transform, 0, 0, geometry.width, geometry.height);\n\t}\n\n\tprotected _render(renderer?: Renderer): void {\n\t\tthis.update();\n\t\tsuper._render(renderer!);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"d-dynamic-text.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-dynamic-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAEH,OAAO,EAAE,IAAI,EAAE,YAAY,EAAY,OAAO,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,yBAAyB,EAAE,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K,CAAC,MAAM,CAAC;gBAChF,IAAI,QAAQ,CAAC,MAAM,KAAK,MAAM,EAAE;oBAC/B,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC;oBACzB,SAAS,GAAG,IAAI,CAAC;iBACjB;aACD;SACD;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,uCAAgB,GAAhB,UAAiB,KAAa,EAAE,MAAc;QAC7C,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QACnC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;QACpB,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAES,uCAAgB,GAA1B;QACC,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC9E,CAAC;IAES,8BAAO,GAAjB,UAAkB,QAAmB;QACpC,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,iBAAM,OAAO,YAAC,QAAS,CAAC,CAAC;IAC1B,CAAC;IACF,mBAAC;AAAD,CAAC,AArPD,CAAkC,IAAI,GAqPrC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Mesh, MeshMaterial, Renderer, Texture } from \"pixi.js\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase } from \"./d-base\";\nimport { DDynamicTextGeometry } from \"./d-dynamic-text-geometry\";\nimport { DDynamicTextStyle } from \"./d-dynamic-text-style\";\nimport { DDynamicTextStyleWordWrap } from \"./d-dynamic-text-style-word-wrap\";\nimport { DynamicFontAtlas } from \"./util/dynamic-font-atlas\";\nimport { UtilFont } from \"./util/util-font\";\n\nexport interface DDynamicTextClippingDelta {\n\twidth: number;\n\theight: number;\n}\n\nexport interface DDynamicTextModifier {\n\tclipping: boolean;\n\tfitting: boolean;\n\twordWrap: DDynamicTextStyleWordWrap;\n\twidth: number;\n\theight: number;\n\tlineHeight: number;\n\tdelta: DDynamicTextClippingDelta;\n}\n\nexport class DDynamicText extends Mesh {\n\tprotected _style: DDynamicTextStyle;\n\tprotected _text: string;\n\tprotected _textApproved: string;\n\tprotected _isDirty: boolean;\n\tprotected _isGeometryDirty: boolean;\n\tprotected _atlas: DynamicFontAtlas | null;\n\tprotected _atlasRevisionUpdated: number;\n\tprotected _width: number;\n\tprotected _height: number;\n\tprotected _modifier: DDynamicTextModifier;\n\n\treadonly geometry!: DDynamicTextGeometry;\n\n\tconstructor(style: DDynamicTextStyle) {\n\t\tsuper(new DDynamicTextGeometry(), new MeshMaterial(Texture.EMPTY));\n\n\t\tthis._style = style;\n\t\tstyle.on(\"change\", () => {\n\t\t\tthis.onStyleChange();\n\t\t});\n\t\tthis._text = \"\";\n\t\tthis._textApproved = \"\";\n\t\tthis._isDirty = true;\n\t\tthis._isGeometryDirty = true;\n\t\tthis._atlas = null;\n\t\tthis._atlasRevisionUpdated = 0;\n\t\tthis._width = 0;\n\t\tthis._height = 0;\n\t\tthis._modifier = {\n\t\t\tclipping: false,\n\t\t\tfitting: false,\n\t\t\twordWrap: DDynamicTextStyleWordWrap.NONE,\n\t\t\twidth: 0,\n\t\t\theight: 0,\n\t\t\tlineHeight: 0,\n\t\t\tdelta: {\n\t\t\t\twidth: 0,\n\t\t\t\theight: 0\n\t\t\t}\n\t\t};\n\t}\n\n\tprotected onStyleChange(): void {\n\t\tthis._isDirty = true;\n\t\tthis._isGeometryDirty = true;\n\t\tthis._atlas = null;\n\t\tthis.update_();\n\t}\n\n\tprotected update_(): void {\n\t\tconst layer = DApplications.getLayer(this);\n\t\tif (layer) {\n\t\t\tif (this._isDirty) {\n\t\t\t\tthis._isDirty = false;\n\n\t\t\t\tconst text = this._text;\n\t\t\t\tconst textApproved = this._textApproved;\n\t\t\t\tthis._textApproved = text;\n\t\t\t\tconst style = this._style;\n\t\t\t\tconst fontId = style.fontId;\n\t\t\t\tconst fontIdApproved = style.fontIdApproved;\n\t\t\t\tconst fontIdFontSize = style.fontIdFontSize;\n\t\t\t\tconst fill = style.fill;\n\t\t\t\tconst fillApproved = style.fillApproved;\n\t\t\t\tstyle.approve();\n\n\t\t\t\tconst atlases = layer.getDynamicFontAtlases();\n\t\t\t\tif (text !== textApproved || fontId !== fontIdApproved || fill !== fillApproved) {\n\t\t\t\t\tatlases.add(fontId, fontIdFontSize, fill, text);\n\t\t\t\t\tatlases.remove(fontIdApproved, fillApproved, textApproved);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tget text(): string {\n\t\treturn this._text;\n\t}\n\n\tset text(text: string) {\n\t\tif (this._text !== text) {\n\t\t\tthis._text = text;\n\t\t\tif (!this._style.unfit()) {\n\t\t\t\tthis._isDirty = true;\n\t\t\t\tthis._isGeometryDirty = true;\n\t\t\t\tthis.update_();\n\t\t\t}\n\t\t}\n\t}\n\n\t// @ts-ignore\n\tget width(): number {\n\t\tthis.update();\n\t\treturn Math.abs(this.scale.x) * this.geometry.width;\n\t}\n\n\tset width(width: number) {\n\t\tthis.update();\n\t\tconst geometryWidth = this.geometry.width;\n\t\tif (+1e-4 < geometryWidth) {\n\t\t\tconst newScale = width / geometryWidth;\n\t\t\tthis.scale.x = 0 <= this.scale.x ? +newScale : -newScale;\n\t\t}\n\t}\n\n\t// @ts-ignore\n\tget height(): number {\n\t\tthis.update();\n\t\treturn Math.abs(this.scale.y) * this.geometry.height;\n\t}\n\n\tset height(height: number) {\n\t\tthis.update();\n\t\tconst geometryHeight = this.geometry.height;\n\t\tif (+1e-4 < geometryHeight) {\n\t\t\tconst newScale = height / geometryHeight;\n\t\t\tthis.scale.y = 0 <= this.scale.y ? +newScale : -newScale;\n\t\t}\n\t}\n\n\tget clipped(): boolean {\n\t\treturn this.geometry.clipped;\n\t}\n\n\tget style(): DDynamicTextStyle {\n\t\treturn this._style;\n\t}\n\n\tupdate(): void {\n\t\tthis.update_();\n\n\t\tconst style = this._style;\n\t\tlet atlas = this._atlas;\n\t\tif (atlas == null) {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tatlas = layer.getDynamicFontAtlases().get(style.fontId, style.fill);\n\t\t\t\tif (atlas != null) {\n\t\t\t\t\tthis._atlasRevisionUpdated = atlas.getRevisionUpdate();\n\t\t\t\t\tthis._atlas = atlas;\n\t\t\t\t\tthis.texture = atlas.texture;\n\t\t\t\t\tthis._isGeometryDirty = true;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconst revisionUpdate = atlas.getRevisionUpdate();\n\t\t\tif (revisionUpdate !== this._atlasRevisionUpdated) {\n\t\t\t\tthis._atlasRevisionUpdated = revisionUpdate;\n\t\t\t\tthis._isGeometryDirty = true;\n\t\t\t}\n\t\t}\n\n\t\tconst modifier = this._modifier;\n\t\tif (this.updateClipping(style, modifier)) {\n\t\t\tthis._isGeometryDirty = true;\n\t\t}\n\n\t\tif (this._isGeometryDirty) {\n\t\t\tthis._isGeometryDirty = false;\n\t\t\tconst geometry = this.geometry;\n\t\t\tgeometry.update(this._text, atlas, modifier);\n\n\t\t\tif (modifier.fitting && !style.isFontFitted && geometry.scaled) {\n\t\t\t\tconst oldScale = geometry.scale;\n\t\t\t\tconst oldFontSize = style.fontSize;\n\t\t\t\tconst newFontId = style.toFontId(Math.ceil(oldFontSize * oldScale * 1000) / 1000);\n\t\t\t\tconst newFontSize = UtilFont.toSize(newFontId);\n\t\t\t\tconst newScale = newFontSize / oldFontSize;\n\t\t\t\tconst newLineHeight = style.lineHeight * newScale;\n\t\t\t\tif (style.fit(newFontSize, newLineHeight)) {\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tDApplications.update(this);\n\t\t\t\t\t}, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected updateClipping(style: DDynamicTextStyle, modifier: DDynamicTextModifier): boolean {\n\t\tlet isChanged = false;\n\n\t\tconst styleClipping = style.clipping;\n\t\tif (modifier.clipping !== styleClipping) {\n\t\t\tmodifier.clipping = styleClipping;\n\t\t\tisChanged = true;\n\t\t}\n\n\t\tconst styleFitting = style.fitting;\n\t\tif (modifier.fitting !== styleFitting) {\n\t\t\tmodifier.fitting = styleFitting;\n\t\t\tisChanged = true;\n\t\t}\n\n\t\tconst styleWordWrap = style.wordWrap;\n\t\tif (modifier.wordWrap !== styleWordWrap) {\n\t\t\tmodifier.wordWrap = styleWordWrap;\n\t\t\tisChanged = true;\n\t\t}\n\n\t\tconst styleLineHeight = styleFitting ? style.lineHeightFitted : style.lineHeight;\n\t\tif (modifier.lineHeight !== styleLineHeight) {\n\t\t\tmodifier.lineHeight = styleLineHeight;\n\t\t\tisChanged = true;\n\t\t}\n\n\t\tif (styleClipping || styleFitting || styleWordWrap) {\n\t\t\tconst parent = this.parent;\n\t\t\tif (parent instanceof DBase) {\n\t\t\t\tconst padding = parent.padding;\n\t\t\t\tconst width =\n\t\t\t\t\tparent.width - padding.getLeft() - padding.getRight() - modifier.delta.width;\n\t\t\t\tif (modifier.width !== width) {\n\t\t\t\t\tmodifier.width = width;\n\t\t\t\t\tisChanged = true;\n\t\t\t\t}\n\n\t\t\t\tconst height =\n\t\t\t\t\tparent.height - padding.getTop() - padding.getBottom() - modifier.delta.height;\n\t\t\t\tif (modifier.height !== height) {\n\t\t\t\t\tmodifier.height = height;\n\t\t\t\t\tisChanged = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn isChanged;\n\t}\n\n\tsetClippingDelta(width: number, height: number): void {\n\t\tconst delta = this._modifier.delta;\n\t\tdelta.width = width;\n\t\tdelta.height = height;\n\t}\n\n\tprotected _calculateBounds(): void {\n\t\tthis.update();\n\t\tconst geometry = this.geometry;\n\t\tthis._bounds.addFrame(this.transform, 0, 0, geometry.width, geometry.height);\n\t}\n\n\tprotected _render(renderer?: Renderer): void {\n\t\tthis.update();\n\t\tsuper._render(renderer!);\n\t}\n}\n"]}
|
|
@@ -128,6 +128,7 @@ var DImagePieceLayouterPartContainer = /** @class */ (function () {
|
|
|
128
128
|
var textWidth = 0;
|
|
129
129
|
var textHeight = 0;
|
|
130
130
|
if (text != null) {
|
|
131
|
+
text.setClippingDelta(leftSize + rightSize, topSize + bottomSize);
|
|
131
132
|
textWidth = text.width;
|
|
132
133
|
textHeight = text.height;
|
|
133
134
|
}
|
|
@@ -162,7 +163,6 @@ var DImagePieceLayouterPartContainer = /** @class */ (function () {
|
|
|
162
163
|
}
|
|
163
164
|
if (text != null) {
|
|
164
165
|
text.position.set(textX, textY);
|
|
165
|
-
text.setClippingDelta(leftSize + rightSize, topSize + bottomSize);
|
|
166
166
|
}
|
|
167
167
|
left.execute(textX - leftSize);
|
|
168
168
|
center.execute(0, 0, textX * 2 + textWidth);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-image-piece-layouter-part-container.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-layouter-part-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAG/E;IAUC;QACC,IAAI,CAAC,IAAI,GAAG,IAAI,2BAA2B,EAAE,CAAC;QAC9C,IAAI,CAAC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GAAG,OAAO,CAAC,CAAC;YAC7B,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC;YAC7C,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,UAAU,CAAC,CAAC;SACnD;aAAM;YACN,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;YACrC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAC7B,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YACtC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAChC;IACF,CAAC;IACF,uCAAC;AAAD,CAAC,AA3LD,IA2LC","sourcesContent":["import { DAlignHorizontal } from \"./d-align-horizontal\";\nimport { DAlignVertical } from \"./d-align-vertical\";\nimport { DDynamicText } from \"./d-dynamic-text\";\nimport { DImagePiece } from \"./d-image-piece\";\nimport { DImagePieceLayouterPartBottom } from \"./d-image-piece-layouter-part-bottom\";\nimport { DImagePieceLayouterPartCenter } from \"./d-image-piece-layouter-part-center\";\nimport { DImagePieceLayouterPartLeft } from \"./d-image-piece-layouter-part-left\";\nimport { DImagePieceLayouterPartMiddle } from \"./d-image-piece-layouter-part-middle\";\nimport { DImagePieceLayouterPartRight } from \"./d-image-piece-layouter-part-right\";\nimport { DImagePieceLayouterPartTop } from \"./d-image-piece-layouter-part-top\";\nimport { DTextPieceAlign } from \"./d-text-piece-align\";\n\nexport class DImagePieceLayouterPartContainer {\n\tleft: DImagePieceLayouterPartLeft;\n\tcenter: DImagePieceLayouterPartCenter;\n\tright: DImagePieceLayouterPartRight;\n\ttop: DImagePieceLayouterPartTop;\n\tmiddle: DImagePieceLayouterPartMiddle;\n\tbottom: DImagePieceLayouterPartBottom;\n\n\ttext?: DDynamicText | null;\n\n\tconstructor() {\n\t\tthis.left = new DImagePieceLayouterPartLeft();\n\t\tthis.center = new DImagePieceLayouterPartCenter();\n\t\tthis.right = new DImagePieceLayouterPartRight();\n\t\tthis.top = new DImagePieceLayouterPartTop();\n\t\tthis.middle = new DImagePieceLayouterPartMiddle();\n\t\tthis.bottom = new DImagePieceLayouterPartBottom();\n\t}\n\n\tclear(): void {\n\t\tthis.left.clear();\n\t\tthis.center.clear();\n\t\tthis.right.clear();\n\t\tthis.top.clear();\n\t\tthis.middle.clear();\n\t\tthis.bottom.clear();\n\t\tthis.text = undefined;\n\t}\n\n\tadd(image: DImagePiece): void {\n\t\tconst object = image.object;\n\t\tif (object != null) {\n\t\t\tconst bound = object.getLocalBounds();\n\t\t\tconst margin = image.margin;\n\t\t\tconst align = image.align;\n\t\t\tswitch (align.horizontal) {\n\t\t\t\tcase DAlignHorizontal.LEFT:\n\t\t\t\t\tthis.left.add(image, bound, margin.horizontal);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.CENTER:\n\t\t\t\t\tthis.center.add(image, bound, margin.horizontal);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.RIGHT:\n\t\t\t\t\tthis.right.add(image, bound, margin.horizontal);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tswitch (align.vertical) {\n\t\t\t\tcase DAlignVertical.TOP:\n\t\t\t\t\tthis.top.add(image, bound, margin.vertical);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.MIDDLE:\n\t\t\t\t\tthis.middle.add(image, bound, margin.vertical);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.BOTTOM:\n\t\t\t\t\tthis.bottom.add(image, bound, margin.vertical);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tset(text: DDynamicText | null): void {\n\t\tthis.left.set(text);\n\t\tthis.center.set(text);\n\t\tthis.right.set(text);\n\t\tthis.top.set(text);\n\t\tthis.middle.set(text);\n\t\tthis.bottom.set(text);\n\t\tthis.text = text;\n\t}\n\n\tget width(): number {\n\t\tconst text = this.text;\n\t\tconst left = this.left;\n\t\tconst leftSize = left.size;\n\t\tconst center = this.center;\n\t\tconst centerSize = center.size;\n\t\tconst right = this.right;\n\t\tconst rightSize = right.size;\n\t\tif (text !== undefined) {\n\t\t\tif (text !== null) {\n\t\t\t\treturn Math.max(leftSize + text.width + rightSize, centerSize);\n\t\t\t} else {\n\t\t\t\treturn Math.max(leftSize + rightSize, centerSize);\n\t\t\t}\n\t\t} else {\n\t\t\treturn Math.max(leftSize, rightSize, centerSize);\n\t\t}\n\t}\n\n\tget height(): number {\n\t\tconst text = this.text;\n\t\tconst top = this.top;\n\t\tconst topSize = top.size;\n\t\tconst middle = this.middle;\n\t\tconst middleSize = middle.size;\n\t\tconst bottom = this.bottom;\n\t\tconst bottomSize = bottom.size;\n\t\tif (text !== undefined) {\n\t\t\tif (text !== null) {\n\t\t\t\treturn Math.max(topSize + text.height + bottomSize, middleSize);\n\t\t\t} else {\n\t\t\t\treturn Math.max(topSize + bottomSize, middleSize);\n\t\t\t}\n\t\t} else {\n\t\t\treturn Math.max(topSize, bottomSize, middleSize);\n\t\t}\n\t}\n\n\texecute(\n\t\tpleft: number,\n\t\tptop: number,\n\t\tpright: number,\n\t\tpbottom: number,\n\t\ttextAlign: DTextPieceAlign,\n\t\twidth: number,\n\t\theight: number\n\t): void {\n\t\tconst left = this.left;\n\t\tconst center = this.center;\n\t\tconst right = this.right;\n\t\tconst top = this.top;\n\t\tconst middle = this.middle;\n\t\tconst bottom = this.bottom;\n\n\t\tconst text = this.text;\n\t\tif (text !== undefined) {\n\t\t\tconst leftSize = left.size;\n\t\t\tconst rightSize = right.size;\n\t\t\tconst topSize = top.size;\n\t\t\tconst bottomSize = bottom.size;\n\n\t\t\tlet textX = 0;\n\t\t\tlet textWidth = 0;\n\t\t\tlet textHeight = 0;\n\t\t\tif (text != null) {\n\t\t\t\ttextWidth = text.width;\n\t\t\t\ttextHeight = text.height;\n\t\t\t}\n\t\t\tswitch (textAlign.horizontal) {\n\t\t\t\tcase DAlignHorizontal.LEFT:\n\t\t\t\t\ttextX = pleft + leftSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.CENTER:\n\t\t\t\t\ttextX =\n\t\t\t\t\t\tpleft +\n\t\t\t\t\t\t(width - pleft - pright - (leftSize + textWidth + rightSize)) * 0.5 +\n\t\t\t\t\t\tleftSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.RIGHT:\n\t\t\t\t\ttextX = width - pright - rightSize - textWidth;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tlet textY = 0;\n\t\t\tswitch (textAlign.vertical) {\n\t\t\t\tcase DAlignVertical.TOP:\n\t\t\t\t\ttextY = ptop + topSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.MIDDLE:\n\t\t\t\t\ttextY =\n\t\t\t\t\t\tptop +\n\t\t\t\t\t\t(height - ptop - pbottom - (topSize + textHeight + bottomSize)) * 0.5 +\n\t\t\t\t\t\ttopSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.BOTTOM:\n\t\t\t\t\ttextY = height - pbottom - bottomSize - textHeight;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (text != null) {\n\t\t\t\ttext.position.set(textX, textY);\n\t\t\t\ttext.setClippingDelta(leftSize + rightSize, topSize + bottomSize);\n\t\t\t}\n\t\t\tleft.execute(textX - leftSize);\n\t\t\tcenter.execute(0, 0, textX * 2 + textWidth);\n\t\t\tright.execute(0, textX + textWidth + rightSize);\n\t\t\ttop.execute(textY - topSize);\n\t\t\tmiddle.execute(0, 0, textY * 2 + textHeight);\n\t\t\tbottom.execute(0, textY + textHeight + bottomSize);\n\t\t} else {\n\t\t\tleft.execute(pleft);\n\t\t\tcenter.execute(pleft, pright, width);\n\t\t\tright.execute(pright, width);\n\t\t\ttop.execute(ptop);\n\t\t\tmiddle.execute(ptop, pbottom, height);\n\t\t\tbottom.execute(pbottom, height);\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"d-image-piece-layouter-part-container.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-image-piece-layouter-part-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAG/E;IAUC;QACC,IAAI,CAAC,IAAI,GAAG,IAAI,2BAA2B,EAAE,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,IAAI,6BAA6B,EAAE,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,IAAI,4BAA4B,EAAE,CAAC;QAChD,IAAI,CAAC,GAAG,GAAG,IAAI,0BAA0B,EAAE,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,6BAA6B,EAAE,CAAC;QAClD,IAAI,CAAC,MAAM,GAAG,IAAI,6BAA6B,EAAE,CAAC;IACnD,CAAC;IAED,gDAAK,GAAL;QACC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CA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AAC,CAAC;YAClB,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;YACtC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAChC;IACF,CAAC;IACF,uCAAC;AAAD,CAAC,AA3LD,IA2LC","sourcesContent":["import { DAlignHorizontal } from \"./d-align-horizontal\";\nimport { DAlignVertical } from \"./d-align-vertical\";\nimport { DDynamicText } from \"./d-dynamic-text\";\nimport { DImagePiece } from \"./d-image-piece\";\nimport { DImagePieceLayouterPartBottom } from \"./d-image-piece-layouter-part-bottom\";\nimport { DImagePieceLayouterPartCenter } from \"./d-image-piece-layouter-part-center\";\nimport { DImagePieceLayouterPartLeft } from \"./d-image-piece-layouter-part-left\";\nimport { DImagePieceLayouterPartMiddle } from \"./d-image-piece-layouter-part-middle\";\nimport { DImagePieceLayouterPartRight } from \"./d-image-piece-layouter-part-right\";\nimport { DImagePieceLayouterPartTop } from \"./d-image-piece-layouter-part-top\";\nimport { DTextPieceAlign } from \"./d-text-piece-align\";\n\nexport class DImagePieceLayouterPartContainer {\n\tleft: DImagePieceLayouterPartLeft;\n\tcenter: DImagePieceLayouterPartCenter;\n\tright: DImagePieceLayouterPartRight;\n\ttop: DImagePieceLayouterPartTop;\n\tmiddle: DImagePieceLayouterPartMiddle;\n\tbottom: DImagePieceLayouterPartBottom;\n\n\ttext?: DDynamicText | null;\n\n\tconstructor() {\n\t\tthis.left = new DImagePieceLayouterPartLeft();\n\t\tthis.center = new DImagePieceLayouterPartCenter();\n\t\tthis.right = new DImagePieceLayouterPartRight();\n\t\tthis.top = new DImagePieceLayouterPartTop();\n\t\tthis.middle = new DImagePieceLayouterPartMiddle();\n\t\tthis.bottom = new DImagePieceLayouterPartBottom();\n\t}\n\n\tclear(): void {\n\t\tthis.left.clear();\n\t\tthis.center.clear();\n\t\tthis.right.clear();\n\t\tthis.top.clear();\n\t\tthis.middle.clear();\n\t\tthis.bottom.clear();\n\t\tthis.text = undefined;\n\t}\n\n\tadd(image: DImagePiece): void {\n\t\tconst object = image.object;\n\t\tif (object != null) {\n\t\t\tconst bound = object.getLocalBounds();\n\t\t\tconst margin = image.margin;\n\t\t\tconst align = image.align;\n\t\t\tswitch (align.horizontal) {\n\t\t\t\tcase DAlignHorizontal.LEFT:\n\t\t\t\t\tthis.left.add(image, bound, margin.horizontal);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.CENTER:\n\t\t\t\t\tthis.center.add(image, bound, margin.horizontal);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.RIGHT:\n\t\t\t\t\tthis.right.add(image, bound, margin.horizontal);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tswitch (align.vertical) {\n\t\t\t\tcase DAlignVertical.TOP:\n\t\t\t\t\tthis.top.add(image, bound, margin.vertical);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.MIDDLE:\n\t\t\t\t\tthis.middle.add(image, bound, margin.vertical);\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.BOTTOM:\n\t\t\t\t\tthis.bottom.add(image, bound, margin.vertical);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tset(text: DDynamicText | null): void {\n\t\tthis.left.set(text);\n\t\tthis.center.set(text);\n\t\tthis.right.set(text);\n\t\tthis.top.set(text);\n\t\tthis.middle.set(text);\n\t\tthis.bottom.set(text);\n\t\tthis.text = text;\n\t}\n\n\tget width(): number {\n\t\tconst text = this.text;\n\t\tconst left = this.left;\n\t\tconst leftSize = left.size;\n\t\tconst center = this.center;\n\t\tconst centerSize = center.size;\n\t\tconst right = this.right;\n\t\tconst rightSize = right.size;\n\t\tif (text !== undefined) {\n\t\t\tif (text !== null) {\n\t\t\t\treturn Math.max(leftSize + text.width + rightSize, centerSize);\n\t\t\t} else {\n\t\t\t\treturn Math.max(leftSize + rightSize, centerSize);\n\t\t\t}\n\t\t} else {\n\t\t\treturn Math.max(leftSize, rightSize, centerSize);\n\t\t}\n\t}\n\n\tget height(): number {\n\t\tconst text = this.text;\n\t\tconst top = this.top;\n\t\tconst topSize = top.size;\n\t\tconst middle = this.middle;\n\t\tconst middleSize = middle.size;\n\t\tconst bottom = this.bottom;\n\t\tconst bottomSize = bottom.size;\n\t\tif (text !== undefined) {\n\t\t\tif (text !== null) {\n\t\t\t\treturn Math.max(topSize + text.height + bottomSize, middleSize);\n\t\t\t} else {\n\t\t\t\treturn Math.max(topSize + bottomSize, middleSize);\n\t\t\t}\n\t\t} else {\n\t\t\treturn Math.max(topSize, bottomSize, middleSize);\n\t\t}\n\t}\n\n\texecute(\n\t\tpleft: number,\n\t\tptop: number,\n\t\tpright: number,\n\t\tpbottom: number,\n\t\ttextAlign: DTextPieceAlign,\n\t\twidth: number,\n\t\theight: number\n\t): void {\n\t\tconst left = this.left;\n\t\tconst center = this.center;\n\t\tconst right = this.right;\n\t\tconst top = this.top;\n\t\tconst middle = this.middle;\n\t\tconst bottom = this.bottom;\n\n\t\tconst text = this.text;\n\t\tif (text !== undefined) {\n\t\t\tconst leftSize = left.size;\n\t\t\tconst rightSize = right.size;\n\t\t\tconst topSize = top.size;\n\t\t\tconst bottomSize = bottom.size;\n\n\t\t\tlet textX = 0;\n\t\t\tlet textWidth = 0;\n\t\t\tlet textHeight = 0;\n\t\t\tif (text != null) {\n\t\t\t\ttext.setClippingDelta(leftSize + rightSize, topSize + bottomSize);\n\t\t\t\ttextWidth = text.width;\n\t\t\t\ttextHeight = text.height;\n\t\t\t}\n\t\t\tswitch (textAlign.horizontal) {\n\t\t\t\tcase DAlignHorizontal.LEFT:\n\t\t\t\t\ttextX = pleft + leftSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.CENTER:\n\t\t\t\t\ttextX =\n\t\t\t\t\t\tpleft +\n\t\t\t\t\t\t(width - pleft - pright - (leftSize + textWidth + rightSize)) * 0.5 +\n\t\t\t\t\t\tleftSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignHorizontal.RIGHT:\n\t\t\t\t\ttextX = width - pright - rightSize - textWidth;\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tlet textY = 0;\n\t\t\tswitch (textAlign.vertical) {\n\t\t\t\tcase DAlignVertical.TOP:\n\t\t\t\t\ttextY = ptop + topSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.MIDDLE:\n\t\t\t\t\ttextY =\n\t\t\t\t\t\tptop +\n\t\t\t\t\t\t(height - ptop - pbottom - (topSize + textHeight + bottomSize)) * 0.5 +\n\t\t\t\t\t\ttopSize;\n\t\t\t\t\tbreak;\n\t\t\t\tcase DAlignVertical.BOTTOM:\n\t\t\t\t\ttextY = height - pbottom - bottomSize - textHeight;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (text != null) {\n\t\t\t\ttext.position.set(textX, textY);\n\t\t\t}\n\t\t\tleft.execute(textX - leftSize);\n\t\t\tcenter.execute(0, 0, textX * 2 + textWidth);\n\t\t\tright.execute(0, textX + textWidth + rightSize);\n\t\t\ttop.execute(textY - topSize);\n\t\t\tmiddle.execute(0, 0, textY * 2 + textHeight);\n\t\t\tbottom.execute(0, textY + textHeight + bottomSize);\n\t\t} else {\n\t\t\tleft.execute(pleft);\n\t\t\tcenter.execute(pleft, pright, width);\n\t\t\tright.execute(pright, width);\n\t\t\ttop.execute(ptop);\n\t\t\tmiddle.execute(ptop, pbottom, height);\n\t\t\tbottom.execute(pbottom, height);\n\t\t}\n\t}\n}\n"]}
|
package/dist/wcardinal-ui.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.442.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -31777,6 +31777,7 @@ var DImagePieceLayouterPartContainer = /** @class */ (function () {
|
|
|
31777
31777
|
var textWidth = 0;
|
|
31778
31778
|
var textHeight = 0;
|
|
31779
31779
|
if (text != null) {
|
|
31780
|
+
text.setClippingDelta(leftSize + rightSize, topSize + bottomSize);
|
|
31780
31781
|
textWidth = text.width;
|
|
31781
31782
|
textHeight = text.height;
|
|
31782
31783
|
}
|
|
@@ -31811,7 +31812,6 @@ var DImagePieceLayouterPartContainer = /** @class */ (function () {
|
|
|
31811
31812
|
}
|
|
31812
31813
|
if (text != null) {
|
|
31813
31814
|
text.position.set(textX, textY);
|
|
31814
|
-
text.setClippingDelta(leftSize + rightSize, topSize + bottomSize);
|
|
31815
31815
|
}
|
|
31816
31816
|
left.execute(textX - leftSize);
|
|
31817
31817
|
center.execute(0, 0, textX * 2 + textWidth);
|
|
@@ -32856,18 +32856,13 @@ var DDynamicText = /** @class */ (function (_super) {
|
|
|
32856
32856
|
if (styleClipping || styleFitting || styleWordWrap) {
|
|
32857
32857
|
var parent_1 = this.parent;
|
|
32858
32858
|
if (parent_1 instanceof DBase) {
|
|
32859
|
-
var
|
|
32860
|
-
|
|
32861
|
-
parent_1.padding.getRight() -
|
|
32862
|
-
modifier.delta.width;
|
|
32859
|
+
var padding = parent_1.padding;
|
|
32860
|
+
var width = parent_1.width - padding.getLeft() - padding.getRight() - modifier.delta.width;
|
|
32863
32861
|
if (modifier.width !== width) {
|
|
32864
32862
|
modifier.width = width;
|
|
32865
32863
|
isChanged = true;
|
|
32866
32864
|
}
|
|
32867
|
-
var height = parent_1.height -
|
|
32868
|
-
parent_1.padding.getTop() -
|
|
32869
|
-
parent_1.padding.getBottom() -
|
|
32870
|
-
modifier.delta.height;
|
|
32865
|
+
var height = parent_1.height - padding.getTop() - padding.getBottom() - modifier.delta.height;
|
|
32871
32866
|
if (modifier.height !== height) {
|
|
32872
32867
|
modifier.height = height;
|
|
32873
32868
|
isChanged = true;
|
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.442.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -31774,6 +31774,7 @@
|
|
|
31774
31774
|
var textWidth = 0;
|
|
31775
31775
|
var textHeight = 0;
|
|
31776
31776
|
if (text != null) {
|
|
31777
|
+
text.setClippingDelta(leftSize + rightSize, topSize + bottomSize);
|
|
31777
31778
|
textWidth = text.width;
|
|
31778
31779
|
textHeight = text.height;
|
|
31779
31780
|
}
|
|
@@ -31808,7 +31809,6 @@
|
|
|
31808
31809
|
}
|
|
31809
31810
|
if (text != null) {
|
|
31810
31811
|
text.position.set(textX, textY);
|
|
31811
|
-
text.setClippingDelta(leftSize + rightSize, topSize + bottomSize);
|
|
31812
31812
|
}
|
|
31813
31813
|
left.execute(textX - leftSize);
|
|
31814
31814
|
center.execute(0, 0, textX * 2 + textWidth);
|
|
@@ -32853,18 +32853,13 @@
|
|
|
32853
32853
|
if (styleClipping || styleFitting || styleWordWrap) {
|
|
32854
32854
|
var parent_1 = this.parent;
|
|
32855
32855
|
if (parent_1 instanceof DBase) {
|
|
32856
|
-
var
|
|
32857
|
-
|
|
32858
|
-
parent_1.padding.getRight() -
|
|
32859
|
-
modifier.delta.width;
|
|
32856
|
+
var padding = parent_1.padding;
|
|
32857
|
+
var width = parent_1.width - padding.getLeft() - padding.getRight() - modifier.delta.width;
|
|
32860
32858
|
if (modifier.width !== width) {
|
|
32861
32859
|
modifier.width = width;
|
|
32862
32860
|
isChanged = true;
|
|
32863
32861
|
}
|
|
32864
|
-
var height = parent_1.height -
|
|
32865
|
-
parent_1.padding.getTop() -
|
|
32866
|
-
parent_1.padding.getBottom() -
|
|
32867
|
-
modifier.delta.height;
|
|
32862
|
+
var height = parent_1.height - padding.getTop() - padding.getBottom() - modifier.delta.height;
|
|
32868
32863
|
if (modifier.height !== height) {
|
|
32869
32864
|
modifier.height = height;
|
|
32870
32865
|
isChanged = true;
|