@wcardinal/wcardinal-ui 0.352.0 → 0.354.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/types/wcardinal/ui/d-dynamic-text.d.ts +1 -2
- package/dist/types/wcardinal/ui/d-text-base.d.ts +1 -1
- package/dist/wcardinal/ui/d-dynamic-text.js +2 -7
- package/dist/wcardinal/ui/d-dynamic-text.js.map +1 -1
- package/dist/wcardinal/ui/d-menu-item-text.js +3 -2
- package/dist/wcardinal/ui/d-menu-item-text.js.map +1 -1
- package/dist/wcardinal/ui/d-text-base.js +4 -3
- package/dist/wcardinal/ui/d-text-base.js.map +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.js +1 -1
- package/dist/wcardinal-ui-theme-white.min.js +1 -1
- package/dist/wcardinal-ui.cjs.js +10 -13
- package/dist/wcardinal-ui.js +10 -13
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -24,12 +24,11 @@ export declare class DDynamicText extends Mesh {
|
|
|
24
24
|
protected _isGeometryDirty: boolean;
|
|
25
25
|
protected _atlas: DynamicFontAtlas | null;
|
|
26
26
|
protected _atlasRevisionUpdated: number;
|
|
27
|
-
protected _onAtlasTextureUpdateBound: () => void;
|
|
28
27
|
protected _width: number;
|
|
29
28
|
protected _height: number;
|
|
30
29
|
protected _modifier: DDynamicTextModifier;
|
|
31
30
|
readonly geometry: DDynamicTextGeometry;
|
|
32
|
-
constructor(
|
|
31
|
+
constructor(options?: DDynamicTextStyleOptions);
|
|
33
32
|
protected update_(): void;
|
|
34
33
|
get text(): string;
|
|
35
34
|
set text(text: string);
|
|
@@ -95,7 +95,7 @@ export declare class DTextBase<VALUE = unknown, THEME extends DThemeTextBase<VAL
|
|
|
95
95
|
protected onTextChange(): void;
|
|
96
96
|
protected computeTextValue(): VALUE | undefined;
|
|
97
97
|
protected createOrUpdateText(): void;
|
|
98
|
-
protected
|
|
98
|
+
protected newText(): DDynamicText;
|
|
99
99
|
getOverflowMask(): Graphics | null;
|
|
100
100
|
protected updateTextPosition(text: DDynamicText): void;
|
|
101
101
|
protected getTextColor(theme: THEME, state: DBaseStateSet): number;
|
|
@@ -12,7 +12,7 @@ import { DDynamicTextStyleWordWrap } from "./d-dynamic-text-style-word-wrap";
|
|
|
12
12
|
import { UtilFont } from "./util/util-font";
|
|
13
13
|
var DDynamicText = /** @class */ (function (_super) {
|
|
14
14
|
__extends(DDynamicText, _super);
|
|
15
|
-
function DDynamicText(
|
|
15
|
+
function DDynamicText(options) {
|
|
16
16
|
var _this = _super.call(this, new DDynamicTextGeometry(), new MeshMaterial(Texture.EMPTY)) || this;
|
|
17
17
|
_this._style = new DDynamicTextStyle(options, function () {
|
|
18
18
|
_this._isDirty = true;
|
|
@@ -20,15 +20,12 @@ var DDynamicText = /** @class */ (function (_super) {
|
|
|
20
20
|
_this._atlas = null;
|
|
21
21
|
_this.update_();
|
|
22
22
|
});
|
|
23
|
-
_this._text =
|
|
23
|
+
_this._text = "";
|
|
24
24
|
_this._textApproved = "";
|
|
25
25
|
_this._isDirty = true;
|
|
26
26
|
_this._isGeometryDirty = true;
|
|
27
27
|
_this._atlas = null;
|
|
28
28
|
_this._atlasRevisionUpdated = 0;
|
|
29
|
-
_this._onAtlasTextureUpdateBound = function () {
|
|
30
|
-
DApplications.update(_this);
|
|
31
|
-
};
|
|
32
29
|
_this._width = 0;
|
|
33
30
|
_this._height = 0;
|
|
34
31
|
_this._modifier = {
|
|
@@ -43,7 +40,6 @@ var DDynamicText = /** @class */ (function (_super) {
|
|
|
43
40
|
height: 0
|
|
44
41
|
}
|
|
45
42
|
};
|
|
46
|
-
_this.update_();
|
|
47
43
|
return _this;
|
|
48
44
|
}
|
|
49
45
|
DDynamicText.prototype.update_ = function () {
|
|
@@ -147,7 +143,6 @@ var DDynamicText = /** @class */ (function (_super) {
|
|
|
147
143
|
this._atlasRevisionUpdated = atlas.getRevisionUpdate();
|
|
148
144
|
this._atlas = atlas;
|
|
149
145
|
this.texture = atlas.texture;
|
|
150
|
-
this.texture.on("update", this._onAtlasTextureUpdateBound);
|
|
151
146
|
this._isGeometryDirty = true;
|
|
152
147
|
}
|
|
153
148
|
}
|
|
@@ -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;AACjE,OAAO,EAAE,iBAAiB,EAA4B,MAAM,wBAAwB,CAAC;AACrF,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAiB5C;IAAkC,gCAAI;IAerC,sBAAY,IAAY,EAAE,OAAkC;QAA5D,YACC,kBAAM,IAAI,oBAAoB,EAAE,EAAE,IAAI,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,SAgClE;QA9BA,KAAI,CAAC,MAAM,GAAG,IAAI,iBAAiB,CAAC,OAAO,EAAE;YAC5C,KAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,KAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,KAAI,CAAC,MAAM,GAAG,IAAI,CAAC;YACnB,KAAI,CAAC,OAAO,EAAE,CAAC;QAChB,CAAC,CAAC,CAAC;QACH,KAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,KAAI,CAAC,aAAa,GA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IAES,uCAAgB,GAA1B;QACC,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,iBAAM,gBAAgB,WAAE,CAAC;IAC1B,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, DDynamicTextStyleOptions } 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 _onAtlasTextureUpdateBound: () => void;\n\tprotected _width: number;\n\tprotected _height: number;\n\tprotected _modifier: DDynamicTextModifier;\n\n\treadonly geometry!: DDynamicTextGeometry;\n\n\tconstructor(text: string, options?: DDynamicTextStyleOptions) {\n\t\tsuper(new DDynamicTextGeometry(), new MeshMaterial(Texture.EMPTY));\n\n\t\tthis._style = new DDynamicTextStyle(options, (): void => {\n\t\t\tthis._isDirty = true;\n\t\t\tthis._isGeometryDirty = true;\n\t\t\tthis._atlas = null;\n\t\t\tthis.update_();\n\t\t});\n\t\tthis._text = 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._onAtlasTextureUpdateBound = () => {\n\t\t\tDApplications.update(this);\n\t\t};\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\tthis.update_();\n\t}\n\n\tprotected update_(): void {\n\t\tconst layer = DApplications.getLayer(this);\n\t\tif (layer) {\n\t\t\tconst style = this._style;\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 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.texture.on(\"update\", this._onAtlasTextureUpdateBound);\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\tsuper._calculateBounds();\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,EA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;oBAC1B,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;gBACvB,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,iBAAM,gBAAgB,WAAE,CAAC;IAC1B,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,AApPD,CAAkC,IAAI,GAoPrC","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, DDynamicTextStyleOptions } 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(options?: DDynamicTextStyleOptions) {\n\t\tsuper(new DDynamicTextGeometry(), new MeshMaterial(Texture.EMPTY));\n\n\t\tthis._style = new DDynamicTextStyle(options, (): void => {\n\t\t\tthis._isDirty = true;\n\t\t\tthis._isGeometryDirty = true;\n\t\t\tthis._atlas = null;\n\t\t\tthis.update_();\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 update_(): void {\n\t\tconst layer = DApplications.getLayer(this);\n\t\tif (layer) {\n\t\t\tconst style = this._style;\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 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\tsuper._calculateBounds();\n\t}\n\n\tprotected _render(renderer?: Renderer): void {\n\t\tthis.update();\n\t\tsuper._render(renderer!);\n\t}\n}\n"]}
|
|
@@ -33,9 +33,10 @@ var DMenuItemText = /** @class */ (function (_super) {
|
|
|
33
33
|
var shortcuts = this._shortcuts;
|
|
34
34
|
if (shortcuts != null && 0 < shortcuts.length) {
|
|
35
35
|
var shortcut = shortcuts[0];
|
|
36
|
-
var
|
|
37
|
-
this._shortcutText =
|
|
36
|
+
var shortcutText = this.newText();
|
|
37
|
+
this._shortcutText = shortcutText;
|
|
38
38
|
this.snippet.add(this._shortcutText, true);
|
|
39
|
+
shortcutText.text = UtilKeyboardEvent.toString(shortcut);
|
|
39
40
|
}
|
|
40
41
|
else {
|
|
41
42
|
this._shortcutText = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-menu-item-text.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-menu-item-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,OAAO,EAAE,SAAS,EAAoC,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAa7D;IAIU,iCAAgC;IAJ1C;;
|
|
1
|
+
{"version":3,"file":"d-menu-item-text.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-menu-item-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAGjC,OAAO,EAAE,SAAS,EAAoC,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAa7D;IAIU,iCAAgC;IAJ1C;;IAsGA,CAAC;IA9FU,4BAAI,GAAd,UAAe,OAAiB;QAC/B,iBAAM,IAAI,YAAC,OAAO,CAAC,CAAC;QACpB,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzB,IAAI,CAA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CAAC,kBAAkB,EAAE,CAAC;IAC3B,CAAC;IAES,+BAAO,GAAjB;QACC,OAAO,eAAe,CAAC;IACxB,CAAC;IAES,gCAAQ,GAAlB,UACC,CAA0E;QAE1E,iBAAM,QAAQ,YAAC,CAAC,CAAC,CAAC;QAClB,IAAM,SAAS,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QACtC,IAAI,SAAS,IAAI,IAAI,EAAE;YACtB,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;SACtD;IACF,CAAC;IAES,kCAAU,GAApB,UAAqB,CAAgB;QACpC,iBAAM,UAAU,YAAC,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACF,oBAAC;AAAD,CAAC,AAtGD,CAIU,SAAS,GAkGlB","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { interaction } from \"pixi.js\";\nimport { DBase } from \"./d-base\";\nimport { DBaseStateSet } from \"./d-base-state-set\";\nimport { DDynamicText } from \"./d-dynamic-text\";\nimport { DMenuItem, DMenuItemOptions, DThemeMenuItem } from \"./d-menu-item\";\nimport { UtilKeyboardEvent } from \"./util/util-keyboard-event\";\nimport { UtilPointerEvent } from \"./util/util-pointer-event\";\n\nexport interface DMenuItemTextOptions<\n\tVALUE = unknown,\n\tTHEME extends DThemeMenuItemText = DThemeMenuItemText\n> extends DMenuItemOptions<VALUE, THEME> {}\n\nexport interface DThemeMenuItemText extends DThemeMenuItem {\n\tgetShortcutTextMargin(): number;\n\tgetShortcutColor(state: DBaseStateSet): number;\n\tgetShortcutAlpha(state: DBaseStateSet): number;\n}\n\nexport class DMenuItemText<\n\tVALUE = unknown,\n\tTHEME extends DThemeMenuItemText = DThemeMenuItemText,\n\tOPTIONS extends DMenuItemTextOptions<VALUE, THEME> = DMenuItemTextOptions<VALUE, THEME>\n> extends DMenuItem<VALUE, THEME, OPTIONS> {\n\tprotected _shortcutText?: DDynamicText | null;\n\tprotected _shortcutMargin?: number;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\t\tthis.initOnOver(options);\n\t\tthis.initShortcuts(options);\n\t}\n\n\tprotected initOnOver(options?: OPTIONS): void {\n\t\tthis.on(UtilPointerEvent.over, (): void => {\n\t\t\tconst context = this.getContext();\n\t\t\tif (context != null) {\n\t\t\t\tconst parent = this.parent;\n\t\t\t\tif (parent instanceof DBase) {\n\t\t\t\t\tcontext.trim(this.getCloseable());\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tprotected initShortcuts(options?: OPTIONS): void {\n\t\tconst shortcuts = this._shortcuts;\n\t\tif (shortcuts != null && 0 < shortcuts.length) {\n\t\t\tconst shortcut = shortcuts[0];\n\t\t\tconst shortcutText = this.newText();\n\t\t\tthis._shortcutText = shortcutText;\n\t\t\tthis.snippet.add(this._shortcutText, true);\n\t\t\tshortcutText.text = UtilKeyboardEvent.toString(shortcut);\n\t\t} else {\n\t\t\tthis._shortcutText = null;\n\t\t}\n\n\t\tthis._shortcutMargin = this.theme.getShortcutTextMargin();\n\t}\n\n\tprotected updateShortcutText(): void {\n\t\tconst text = this._shortcutText;\n\t\tconst margin = this._shortcutMargin;\n\t\tif (text != null && margin != null) {\n\t\t\tconst auto = this._auto;\n\n\t\t\tlet textX = 0;\n\t\t\tif (auto.width.isOn) {\n\t\t\t\ttextX = margin;\n\t\t\t} else {\n\t\t\t\ttextX = this.width - text.width - margin;\n\t\t\t}\n\n\t\t\tlet textY = 0;\n\t\t\tconst padding = this._padding;\n\t\t\tconst ptop = padding.getTop();\n\t\t\tif (auto.height.isOn) {\n\t\t\t\ttextY = ptop;\n\t\t\t} else {\n\t\t\t\ttextY = ptop + (this.height - ptop - padding.getBottom() - text.height) * 0.5;\n\t\t\t}\n\n\t\t\ttext.position.set(textX, textY);\n\t\t}\n\t}\n\n\tprotected updateTextColor(text: DDynamicText): void {\n\t\tsuper.updateTextColor(text);\n\n\t\tconst shortcutText = this._shortcutText;\n\t\tif (shortcutText != null) {\n\t\t\tconst theme = this.theme;\n\t\t\tconst state = this.state;\n\t\t\tshortcutText.style.fill = theme.getShortcutColor(state);\n\t\t\tshortcutText.alpha = theme.getShortcutAlpha(state);\n\t\t}\n\t}\n\n\tprotected updateText(): void {\n\t\tsuper.updateText();\n\t\tthis.updateShortcutText();\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DMenuItemText\";\n\t}\n\n\tprotected onSelect(\n\t\te?: interaction.InteractionEvent | KeyboardEvent | MouseEvent | TouchEvent\n\t): void {\n\t\tsuper.onSelect(e);\n\t\tconst closeable = this.getCloseable();\n\t\tif (closeable != null) {\n\t\t\tcloseable.emit(\"select\", this.value, this, closeable);\n\t\t}\n\t}\n\n\tprotected onShortcut(e: KeyboardEvent): void {\n\t\tsuper.onShortcut(e);\n\t\tthis.activate(e);\n\t}\n}\n"]}
|
|
@@ -123,7 +123,7 @@ var DTextBase = /** @class */ (function (_super) {
|
|
|
123
123
|
var text = this._text;
|
|
124
124
|
if (text == null) {
|
|
125
125
|
if (0 < formatted.length) {
|
|
126
|
-
var newText = this.
|
|
126
|
+
var newText = this.newText();
|
|
127
127
|
newText.visible = this._isTextVisible;
|
|
128
128
|
this._text = newText;
|
|
129
129
|
this.addChild(newText);
|
|
@@ -132,6 +132,7 @@ var DTextBase = /** @class */ (function (_super) {
|
|
|
132
132
|
if (overflowMask) {
|
|
133
133
|
newText.mask = overflowMask;
|
|
134
134
|
}
|
|
135
|
+
newText.text = formatted;
|
|
135
136
|
this.toDirty();
|
|
136
137
|
DApplications.update(this);
|
|
137
138
|
}
|
|
@@ -143,8 +144,8 @@ var DTextBase = /** @class */ (function (_super) {
|
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
146
|
};
|
|
146
|
-
DTextBase.prototype.
|
|
147
|
-
return new DDynamicText(
|
|
147
|
+
DTextBase.prototype.newText = function () {
|
|
148
|
+
return new DDynamicText(this._textStyle);
|
|
148
149
|
};
|
|
149
150
|
DTextBase.prototype.getOverflowMask = function () {
|
|
150
151
|
if (this._isOverflowMaskEnabled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-text-base.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-text-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAqD,MAAM,UAAU,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAKhD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAgFxC,IAAM,WAAW,GAAG,UACnB,KAAY,EACZ,OAAmD,EACnD,KAAoB;;IAEpB,IAAM,KAAK,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,KAAK,CAAC;IACnC,IAAI,KAAK,IAAI,IAAI,EAAE;QAClB,IAAM,IAAI,GAAG,MAAA,KAAK,CAAC,IAAI,mCAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACjD,IAAM,QAAQ,GAAG,MAAA,KAAK,CAAC,QAAQ,mCAAI,KAAK,CAAC,WAAW,EAAE,CAAC;QACvD,IAAM,UAAU,GAAG,MAAA,KAAK,CAAC,UAAU,mCAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAC9D,IAAM,UAAU,GAAG,MAAA,KAAK,CAAC,UAAU,mCAAI,KAAK,CAAC,aAAa,E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SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Graphics } from \"pixi.js\";\nimport { DAlignHorizontal } from \"./d-align-horizontal\";\nimport { DAlignVertical } from \"./d-align-vertical\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase, DBaseEvents, DBaseOptions, DRefitable, DThemeBase } from \"./d-base\";\nimport { DBaseOverflowMaskSimple } from \"./d-base-overflow-mask-simple\";\nimport { DBaseStateSet } from \"./d-base-state-set\";\nimport { DDynamicText } from \"./d-dynamic-text\";\nimport { DDynamicTextStyleOptions } from \"./d-dynamic-text-style\";\nimport { DDynamicTextStyleWordWrap } from \"./d-dynamic-text-style-word-wrap\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DStateAwareOrValueMightBe } from \"./d-state-aware\";\nimport { isFunction } from \"./util/is-function\";\nimport { toEnum } from \"./util/to-enum\";\n\n/**\n * {@link DTextBase} text align options.\n */\nexport interface DTextBaseTextAlignOptions {\n\tvertical?: keyof typeof DAlignVertical | DAlignVertical;\n\thorizontal?: keyof typeof DAlignHorizontal | DAlignHorizontal;\n}\n\n/**\n * {@link DTextBase} text options.\n */\nexport interface DTextBaseTextOptions<VALUE = unknown> {\n\tvalue?: DStateAwareOrValueMightBe<VALUE>;\n\tcolor?: DStateAwareOrValueMightBe<number>;\n\talpha?: DStateAwareOrValueMightBe<number>;\n\tstyle?: DDynamicTextStyleOptions;\n\talign?: DTextBaseTextAlignOptions;\n\tformatter?: (value: VALUE, caller: any) => string;\n}\n\n/**\n * {@link DTextBase} events.\n */\nexport interface DTextBaseEvents<VALUE, EMITTER> extends DBaseEvents<EMITTER> {}\n\n/**\n * {@link DTextBase} \"on\" options.\n */\nexport interface DTextBaseOnOptions<VALUE, EMITTER>\n\textends Partial<DTextBaseEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DTextBase} options.\n */\nexport interface DTextBaseOptions<\n\tVALUE = unknown,\n\tTHEME extends DThemeTextBase<VALUE> = DThemeTextBase<VALUE>,\n\tEMITTER = any\n> extends DBaseOptions<THEME, EMITTER> {\n\ttext?: DTextBaseTextOptions<VALUE>;\n\tmask?: boolean;\n\ton?: DTextBaseOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DTextBase} theme.\n */\nexport interface DThemeTextBase<VALUE = unknown> extends DThemeBase {\n\tgetTextFormatter(): (value: VALUE, caller: any) => string;\n\n\t/**\n\t * Returns a new text value.\n\t * Called to initialize a text value if a text value is not given.\n\t */\n\tnewTextValue(): DStateAwareOrValueMightBe<VALUE>;\n\n\t/**\n\t * Returns a text value.\n\t * Called to get a text vale if there is no text value.\n\t *\n\t * @param state a state\n\t */\n\tgetTextValue(state: DBaseStateSet): VALUE | undefined;\n\n\tgetTextAlignVertical(): DAlignVertical;\n\tgetTextAlignHorizontal(): DAlignHorizontal;\n\tgetTextStyleClipping(): boolean;\n\tgetTextStyleFitting(): boolean;\n\tgetTextStyleWordWrap(): DDynamicTextStyleWordWrap;\n\tisOverflowMaskEnabled(): boolean;\n}\n\nexport interface DTextBaseAlign {\n\tvertical: DAlignVertical;\n\thorizontal: DAlignHorizontal;\n}\n\nconst toTextStyle = <VALUE, THEME extends DThemeTextBase<VALUE>>(\n\ttheme: THEME,\n\toptions: DTextBaseOptions<VALUE, THEME> | undefined,\n\tstate: DBaseStateSet\n): DDynamicTextStyleOptions => {\n\tconst style = options?.text?.style;\n\tif (style != null) {\n\t\tconst fill = style.fill ?? theme.getColor(state);\n\t\tconst fontSize = style.fontSize ?? theme.getFontSize();\n\t\tconst fontFamily = style.fontFamily ?? theme.getFontFamilly();\n\t\tconst fontWeight = style.fontWeight ?? theme.getFontWeight();\n\t\tconst fontStyle = style.fontStyle ?? theme.getFontStyle();\n\t\tconst fontVariant = style.fontVariant ?? theme.getFontVariant();\n\t\tconst clipping = style.clipping ?? theme.getTextStyleClipping();\n\t\tconst fitting = style.fitting ?? theme.getTextStyleFitting();\n\t\tconst wordWrap = style.wordWrap ?? theme.getTextStyleWordWrap();\n\t\tconst lineHeight = style.lineHeight ?? theme.getLineHeight();\n\t\treturn {\n\t\t\tfill,\n\t\t\tfontSize,\n\t\t\tfontFamily,\n\t\t\tfontWeight,\n\t\t\tfontStyle,\n\t\t\tfontVariant,\n\t\t\tclipping,\n\t\t\tfitting,\n\t\t\twordWrap,\n\t\t\tlineHeight\n\t\t};\n\t}\n\n\treturn {\n\t\tfill: theme.getColor(state),\n\t\tfontSize: theme.getFontSize(),\n\t\tfontFamily: theme.getFontFamilly(),\n\t\tfontWeight: theme.getFontWeight(),\n\t\tfontStyle: theme.getFontStyle(),\n\t\tfontVariant: theme.getFontVariant(),\n\t\tclipping: theme.getTextStyleClipping(),\n\t\tfitting: theme.getTextStyleFitting(),\n\t\twordWrap: theme.getTextStyleWordWrap(),\n\t\tlineHeight: theme.getLineHeight()\n\t};\n};\n\nconst toTextAlign = <VALUE, THEME extends DThemeTextBase<VALUE>>(\n\ttheme: THEME,\n\toptions?: DTextBaseOptions<VALUE, THEME>\n): DTextBaseAlign => {\n\tconst align = options?.text?.align;\n\treturn {\n\t\tvertical: toEnum(align?.vertical ?? theme.getTextAlignVertical(), DAlignVertical),\n\t\thorizontal: toEnum(align?.horizontal ?? theme.getTextAlignHorizontal(), DAlignHorizontal)\n\t};\n};\n\n/**\n * A base class for UI classes with a text support.\n * See {@link DTextBaseEvents} for event defaults.\n */\nexport class DTextBase<\n\tVALUE = unknown,\n\tTHEME extends DThemeTextBase<VALUE> = DThemeTextBase<VALUE>,\n\tOPTIONS extends DTextBaseOptions<VALUE, THEME> = DTextBaseOptions<VALUE, THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected _text?: DDynamicText | null;\n\tprotected _textValue?: DStateAwareOrValueMightBe<VALUE>;\n\tprotected _textValueComputed?: VALUE;\n\tprotected _textColor!: DStateAwareOrValueMightBe<number>;\n\tprotected _textAlpha!: DStateAwareOrValueMightBe<number>;\n\tprotected _textStyle!: DDynamicTextStyleOptions;\n\tprotected _textAlign!: DTextBaseAlign;\n\tprotected _textFormatter!: (value: VALUE, caller: any) => string;\n\tprotected _isOverflowMaskEnabled!: boolean;\n\tprotected _overflowMask?: DBaseOverflowMaskSimple | null;\n\tprotected _isTextVisible!: boolean;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tconst theme = this.theme;\n\t\tthis._textValue = options?.text?.value ?? theme.newTextValue();\n\t\tthis._textValueComputed = this.computeTextValue();\n\t\tconst text = options?.text;\n\t\tthis._textColor = text?.color;\n\t\tthis._textAlpha = text?.alpha;\n\t\tthis._textStyle = toTextStyle(theme, options, this.state);\n\t\tthis._textAlign = toTextAlign(theme, options);\n\t\tthis._textFormatter = text?.formatter ?? theme.getTextFormatter();\n\t\tthis._isTextVisible = true;\n\t\tthis._isOverflowMaskEnabled = options?.mask ?? theme.isOverflowMaskEnabled();\n\t\tthis.onTextChange();\n\t\tthis.createOrUpdateText();\n\t}\n\n\tset text(text: DStateAwareOrValueMightBe<VALUE>) {\n\t\tif (this._textValue !== text) {\n\t\t\tthis._textValue = text;\n\t\t\tthis.updateTextValue();\n\t\t}\n\t}\n\n\tget text(): DStateAwareOrValueMightBe<VALUE> {\n\t\treturn this._textValue;\n\t}\n\n\tprotected onTextChange(): void {\n\t\t// DO NOTHING\n\t}\n\n\tprotected computeTextValue(): VALUE | undefined {\n\t\tconst textValue = this._textValue;\n\t\tif (textValue !== undefined) {\n\t\t\tif (isFunction(textValue)) {\n\t\t\t\tconst result = textValue(this.state);\n\t\t\t\tif (result !== undefined) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn textValue;\n\t\t\t}\n\t\t}\n\t\treturn this.theme.getTextValue(this.state);\n\t}\n\n\tprotected createOrUpdateText(): void {\n\t\tconst textValueComputed = this._textValueComputed;\n\t\tif (textValueComputed !== undefined) {\n\t\t\tconst formatted = this._textFormatter(textValueComputed, this);\n\t\t\tconst text = this._text;\n\t\t\tif (text == null) {\n\t\t\t\tif (0 < formatted.length) {\n\t\t\t\t\tconst newText = this.createText(formatted);\n\t\t\t\t\tnewText.visible = this._isTextVisible;\n\t\t\t\t\tthis._text = newText;\n\t\t\t\t\tthis.addChild(newText);\n\t\t\t\t\tthis.updateTextPosition(newText);\n\t\t\t\t\tconst overflowMask = this.getOverflowMask();\n\t\t\t\t\tif (overflowMask) {\n\t\t\t\t\t\tnewText.mask = overflowMask;\n\t\t\t\t\t}\n\t\t\t\t\tthis.toDirty();\n\t\t\t\t\tDApplications.update(this);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttext.text = formatted;\n\t\t\t\tthis.toDirty();\n\t\t\t\tDApplications.update(this);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected createText(formatted: string): DDynamicText {\n\t\treturn new DDynamicText(formatted, this._textStyle);\n\t}\n\n\tgetOverflowMask(): Graphics | null {\n\t\tif (this._isOverflowMaskEnabled) {\n\t\t\tif (this._overflowMask == null) {\n\t\t\t\tthis._overflowMask = new DBaseOverflowMaskSimple(this);\n\t\t\t\tthis._reflowable.add(this._overflowMask);\n\t\t\t\tthis.toDirty();\n\t\t\t}\n\t\t\treturn this._overflowMask;\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected updateTextPosition(text: DDynamicText): void {\n\t\tconst align = this._textAlign;\n\t\tconst padding = this._padding;\n\t\tconst auto = this._auto;\n\n\t\tlet textX = 0;\n\t\tconst pleft = padding.getLeft();\n\t\tconst alignHorizontal = align.horizontal;\n\t\tif (auto.width.isOn || alignHorizontal === DAlignHorizontal.LEFT) {\n\t\t\ttextX = pleft;\n\t\t} else {\n\t\t\tconst width = this.width;\n\t\t\tconst textWidth = text.width;\n\t\t\tconst pright = padding.getRight();\n\t\t\tif (alignHorizontal === DAlignHorizontal.CENTER) {\n\t\t\t\ttextX = pleft + (width - pleft - pright - textWidth) * 0.5;\n\t\t\t} else {\n\t\t\t\ttextX = width - textWidth - pright;\n\t\t\t}\n\t\t}\n\n\t\tlet textY = 0;\n\t\tconst ptop = padding.getTop();\n\t\tconst alignVertical = align.vertical;\n\t\tif (auto.height.isOn || alignVertical === DAlignVertical.TOP) {\n\t\t\ttextY = ptop;\n\t\t} else {\n\t\t\tconst height = this.height;\n\t\t\tconst textHeight = text.height;\n\t\t\tconst pbottom = padding.getBottom();\n\t\t\tif (alignVertical === DAlignVertical.MIDDLE) {\n\t\t\t\ttextY = ptop + (height - ptop - pbottom - textHeight) * 0.5;\n\t\t\t} else {\n\t\t\t\ttextY = height - textHeight - pbottom;\n\t\t\t}\n\t\t}\n\n\t\ttext.position.set(textX, textY);\n\t}\n\n\tprotected getTextColor(theme: THEME, state: DBaseStateSet): number {\n\t\tconst color = this._textColor;\n\t\tif (color !== undefined) {\n\t\t\tif (isFunction(color)) {\n\t\t\t\tconst result = color(state);\n\t\t\t\tif (result !== undefined) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn color;\n\t\t\t}\n\t\t}\n\t\treturn theme.getColor(state);\n\t}\n\n\tprotected getTextAlpha(theme: THEME, state: DBaseStateSet): number {\n\t\tconst alpha = this._textAlpha;\n\t\tif (alpha !== undefined) {\n\t\t\tif (isFunction(alpha)) {\n\t\t\t\tconst result = alpha(state);\n\t\t\t\tif (result !== undefined) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn alpha;\n\t\t\t}\n\t\t}\n\t\treturn theme.getAlpha(state);\n\t}\n\n\tprotected updateTextColor(text: DDynamicText): void {\n\t\tconst theme = this.theme;\n\t\tconst state = this.state;\n\t\ttext.style.fill = this.getTextColor(theme, state);\n\t\ttext.alpha = this.getTextAlpha(theme, state);\n\t}\n\n\tprotected updateTextValue(): void {\n\t\tconst newTextValueComputed = this.computeTextValue();\n\t\tif (this._textValueComputed !== newTextValueComputed) {\n\t\t\tthis._textValueComputed = newTextValueComputed;\n\t\t\tthis.onTextChange();\n\t\t\tthis.createOrUpdateText();\n\t\t}\n\t}\n\n\tprotected updateText(): void {\n\t\tconst text = this._text;\n\t\tif (text) {\n\t\t\tthis.updateTextValue();\n\t\t\tthis.updateTextPosition(text);\n\t\t\tthis.updateTextColor(text);\n\t\t}\n\t}\n\n\tprotected showText(): void {\n\t\tconst text = this._text;\n\t\tif (text) {\n\t\t\ttext.visible = true;\n\t\t}\n\t\tthis._isTextVisible = true;\n\t}\n\n\tprotected hideText(): void {\n\t\tconst text = this._text;\n\t\tif (text) {\n\t\t\ttext.visible = false;\n\t\t}\n\t\tthis._isTextVisible = false;\n\t}\n\n\tprotected onReflow(): void {\n\t\tsuper.onReflow();\n\t\tthis.updateText();\n\t}\n\n\tprotected isRefitable(target: any): target is DRefitable {\n\t\treturn super.isRefitable(target) || (target != null && target === this._text);\n\t}\n\n\tprotected applyTitle(): void {\n\t\tconst text = this._text;\n\t\tif (this._title.length <= 0 && text && \"clipped\" in text && text.clipped) {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tlayer.view.title = text.text;\n\t\t\t}\n\t\t} else {\n\t\t\tsuper.applyTitle();\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DTextBase\";\n\t}\n\n\tdestroy(): void {\n\t\t// Text\n\t\tconst text = this._text;\n\t\tif (text) {\n\t\t\tthis._text = null;\n\t\t\ttext.destroy();\n\t\t}\n\n\t\t// Overflow mask\n\t\tconst overflowMask = this._overflowMask;\n\t\tif (overflowMask) {\n\t\t\tthis._overflowMask = null;\n\t\t\toverflowMask.destroy();\n\t\t}\n\n\t\tsuper.destroy();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"d-text-base.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-text-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;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AI,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;YACzE,IAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YAC3C,IAAI,KAAK,EAAE;gBACV,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC;aAC7B;SACD;aAAM;YACN,iBAAM,UAAU,WAAE,CAAC;SACnB;IACF,CAAC;IAES,2BAAO,GAAjB;QACC,OAAO,WAAW,CAAC;IACpB,CAAC;IAED,2BAAO,GAAP;QACC,OAAO;QACP,IAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,IAAI,EAAE;YACT,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;YAClB,IAAI,CAAC,OAAO,EAAE,CAAC;SACf;QAED,gBAAgB;QAChB,IAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC;QACxC,IAAI,YAAY,EAAE;YACjB,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;YAC1B,YAAY,CAAC,OAAO,EAAE,CAAC;SACvB;QAED,iBAAM,OAAO,WAAE,CAAC;IACjB,CAAC;IACF,gBAAC;AAAD,CAAC,AAtQD,CAIU,KAAK,GAkQd","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Graphics } from \"pixi.js\";\nimport { DAlignHorizontal } from \"./d-align-horizontal\";\nimport { DAlignVertical } from \"./d-align-vertical\";\nimport { DApplications } from \"./d-applications\";\nimport { DBase, DBaseEvents, DBaseOptions, DRefitable, DThemeBase } from \"./d-base\";\nimport { DBaseOverflowMaskSimple } from \"./d-base-overflow-mask-simple\";\nimport { DBaseStateSet } from \"./d-base-state-set\";\nimport { DDynamicText } from \"./d-dynamic-text\";\nimport { DDynamicTextStyleOptions } from \"./d-dynamic-text-style\";\nimport { DDynamicTextStyleWordWrap } from \"./d-dynamic-text-style-word-wrap\";\nimport { DOnOptions } from \"./d-on-options\";\nimport { DStateAwareOrValueMightBe } from \"./d-state-aware\";\nimport { isFunction } from \"./util/is-function\";\nimport { toEnum } from \"./util/to-enum\";\n\n/**\n * {@link DTextBase} text align options.\n */\nexport interface DTextBaseTextAlignOptions {\n\tvertical?: keyof typeof DAlignVertical | DAlignVertical;\n\thorizontal?: keyof typeof DAlignHorizontal | DAlignHorizontal;\n}\n\n/**\n * {@link DTextBase} text options.\n */\nexport interface DTextBaseTextOptions<VALUE = unknown> {\n\tvalue?: DStateAwareOrValueMightBe<VALUE>;\n\tcolor?: DStateAwareOrValueMightBe<number>;\n\talpha?: DStateAwareOrValueMightBe<number>;\n\tstyle?: DDynamicTextStyleOptions;\n\talign?: DTextBaseTextAlignOptions;\n\tformatter?: (value: VALUE, caller: any) => string;\n}\n\n/**\n * {@link DTextBase} events.\n */\nexport interface DTextBaseEvents<VALUE, EMITTER> extends DBaseEvents<EMITTER> {}\n\n/**\n * {@link DTextBase} \"on\" options.\n */\nexport interface DTextBaseOnOptions<VALUE, EMITTER>\n\textends Partial<DTextBaseEvents<VALUE, EMITTER>>,\n\t\tDOnOptions {}\n\n/**\n * {@link DTextBase} options.\n */\nexport interface DTextBaseOptions<\n\tVALUE = unknown,\n\tTHEME extends DThemeTextBase<VALUE> = DThemeTextBase<VALUE>,\n\tEMITTER = any\n> extends DBaseOptions<THEME, EMITTER> {\n\ttext?: DTextBaseTextOptions<VALUE>;\n\tmask?: boolean;\n\ton?: DTextBaseOnOptions<VALUE, EMITTER>;\n}\n\n/**\n * {@link DTextBase} theme.\n */\nexport interface DThemeTextBase<VALUE = unknown> extends DThemeBase {\n\tgetTextFormatter(): (value: VALUE, caller: any) => string;\n\n\t/**\n\t * Returns a new text value.\n\t * Called to initialize a text value if a text value is not given.\n\t */\n\tnewTextValue(): DStateAwareOrValueMightBe<VALUE>;\n\n\t/**\n\t * Returns a text value.\n\t * Called to get a text vale if there is no text value.\n\t *\n\t * @param state a state\n\t */\n\tgetTextValue(state: DBaseStateSet): VALUE | undefined;\n\n\tgetTextAlignVertical(): DAlignVertical;\n\tgetTextAlignHorizontal(): DAlignHorizontal;\n\tgetTextStyleClipping(): boolean;\n\tgetTextStyleFitting(): boolean;\n\tgetTextStyleWordWrap(): DDynamicTextStyleWordWrap;\n\tisOverflowMaskEnabled(): boolean;\n}\n\nexport interface DTextBaseAlign {\n\tvertical: DAlignVertical;\n\thorizontal: DAlignHorizontal;\n}\n\nconst toTextStyle = <VALUE, THEME extends DThemeTextBase<VALUE>>(\n\ttheme: THEME,\n\toptions: DTextBaseOptions<VALUE, THEME> | undefined,\n\tstate: DBaseStateSet\n): DDynamicTextStyleOptions => {\n\tconst style = options?.text?.style;\n\tif (style != null) {\n\t\tconst fill = style.fill ?? theme.getColor(state);\n\t\tconst fontSize = style.fontSize ?? theme.getFontSize();\n\t\tconst fontFamily = style.fontFamily ?? theme.getFontFamilly();\n\t\tconst fontWeight = style.fontWeight ?? theme.getFontWeight();\n\t\tconst fontStyle = style.fontStyle ?? theme.getFontStyle();\n\t\tconst fontVariant = style.fontVariant ?? theme.getFontVariant();\n\t\tconst clipping = style.clipping ?? theme.getTextStyleClipping();\n\t\tconst fitting = style.fitting ?? theme.getTextStyleFitting();\n\t\tconst wordWrap = style.wordWrap ?? theme.getTextStyleWordWrap();\n\t\tconst lineHeight = style.lineHeight ?? theme.getLineHeight();\n\t\treturn {\n\t\t\tfill,\n\t\t\tfontSize,\n\t\t\tfontFamily,\n\t\t\tfontWeight,\n\t\t\tfontStyle,\n\t\t\tfontVariant,\n\t\t\tclipping,\n\t\t\tfitting,\n\t\t\twordWrap,\n\t\t\tlineHeight\n\t\t};\n\t}\n\n\treturn {\n\t\tfill: theme.getColor(state),\n\t\tfontSize: theme.getFontSize(),\n\t\tfontFamily: theme.getFontFamilly(),\n\t\tfontWeight: theme.getFontWeight(),\n\t\tfontStyle: theme.getFontStyle(),\n\t\tfontVariant: theme.getFontVariant(),\n\t\tclipping: theme.getTextStyleClipping(),\n\t\tfitting: theme.getTextStyleFitting(),\n\t\twordWrap: theme.getTextStyleWordWrap(),\n\t\tlineHeight: theme.getLineHeight()\n\t};\n};\n\nconst toTextAlign = <VALUE, THEME extends DThemeTextBase<VALUE>>(\n\ttheme: THEME,\n\toptions?: DTextBaseOptions<VALUE, THEME>\n): DTextBaseAlign => {\n\tconst align = options?.text?.align;\n\treturn {\n\t\tvertical: toEnum(align?.vertical ?? theme.getTextAlignVertical(), DAlignVertical),\n\t\thorizontal: toEnum(align?.horizontal ?? theme.getTextAlignHorizontal(), DAlignHorizontal)\n\t};\n};\n\n/**\n * A base class for UI classes with a text support.\n * See {@link DTextBaseEvents} for event defaults.\n */\nexport class DTextBase<\n\tVALUE = unknown,\n\tTHEME extends DThemeTextBase<VALUE> = DThemeTextBase<VALUE>,\n\tOPTIONS extends DTextBaseOptions<VALUE, THEME> = DTextBaseOptions<VALUE, THEME>\n> extends DBase<THEME, OPTIONS> {\n\tprotected _text?: DDynamicText | null;\n\tprotected _textValue?: DStateAwareOrValueMightBe<VALUE>;\n\tprotected _textValueComputed?: VALUE;\n\tprotected _textColor!: DStateAwareOrValueMightBe<number>;\n\tprotected _textAlpha!: DStateAwareOrValueMightBe<number>;\n\tprotected _textStyle!: DDynamicTextStyleOptions;\n\tprotected _textAlign!: DTextBaseAlign;\n\tprotected _textFormatter!: (value: VALUE, caller: any) => string;\n\tprotected _isOverflowMaskEnabled!: boolean;\n\tprotected _overflowMask?: DBaseOverflowMaskSimple | null;\n\tprotected _isTextVisible!: boolean;\n\n\tprotected init(options?: OPTIONS): void {\n\t\tsuper.init(options);\n\n\t\tconst theme = this.theme;\n\t\tthis._textValue = options?.text?.value ?? theme.newTextValue();\n\t\tthis._textValueComputed = this.computeTextValue();\n\t\tconst text = options?.text;\n\t\tthis._textColor = text?.color;\n\t\tthis._textAlpha = text?.alpha;\n\t\tthis._textStyle = toTextStyle(theme, options, this.state);\n\t\tthis._textAlign = toTextAlign(theme, options);\n\t\tthis._textFormatter = text?.formatter ?? theme.getTextFormatter();\n\t\tthis._isTextVisible = true;\n\t\tthis._isOverflowMaskEnabled = options?.mask ?? theme.isOverflowMaskEnabled();\n\t\tthis.onTextChange();\n\t\tthis.createOrUpdateText();\n\t}\n\n\tset text(text: DStateAwareOrValueMightBe<VALUE>) {\n\t\tif (this._textValue !== text) {\n\t\t\tthis._textValue = text;\n\t\t\tthis.updateTextValue();\n\t\t}\n\t}\n\n\tget text(): DStateAwareOrValueMightBe<VALUE> {\n\t\treturn this._textValue;\n\t}\n\n\tprotected onTextChange(): void {\n\t\t// DO NOTHING\n\t}\n\n\tprotected computeTextValue(): VALUE | undefined {\n\t\tconst textValue = this._textValue;\n\t\tif (textValue !== undefined) {\n\t\t\tif (isFunction(textValue)) {\n\t\t\t\tconst result = textValue(this.state);\n\t\t\t\tif (result !== undefined) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn textValue;\n\t\t\t}\n\t\t}\n\t\treturn this.theme.getTextValue(this.state);\n\t}\n\n\tprotected createOrUpdateText(): void {\n\t\tconst textValueComputed = this._textValueComputed;\n\t\tif (textValueComputed !== undefined) {\n\t\t\tconst formatted = this._textFormatter(textValueComputed, this);\n\t\t\tconst text = this._text;\n\t\t\tif (text == null) {\n\t\t\t\tif (0 < formatted.length) {\n\t\t\t\t\tconst newText = this.newText();\n\t\t\t\t\tnewText.visible = this._isTextVisible;\n\t\t\t\t\tthis._text = newText;\n\t\t\t\t\tthis.addChild(newText);\n\t\t\t\t\tthis.updateTextPosition(newText);\n\t\t\t\t\tconst overflowMask = this.getOverflowMask();\n\t\t\t\t\tif (overflowMask) {\n\t\t\t\t\t\tnewText.mask = overflowMask;\n\t\t\t\t\t}\n\t\t\t\t\tnewText.text = formatted;\n\t\t\t\t\tthis.toDirty();\n\t\t\t\t\tDApplications.update(this);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttext.text = formatted;\n\t\t\t\tthis.toDirty();\n\t\t\t\tDApplications.update(this);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected newText(): DDynamicText {\n\t\treturn new DDynamicText(this._textStyle);\n\t}\n\n\tgetOverflowMask(): Graphics | null {\n\t\tif (this._isOverflowMaskEnabled) {\n\t\t\tif (this._overflowMask == null) {\n\t\t\t\tthis._overflowMask = new DBaseOverflowMaskSimple(this);\n\t\t\t\tthis._reflowable.add(this._overflowMask);\n\t\t\t\tthis.toDirty();\n\t\t\t}\n\t\t\treturn this._overflowMask;\n\t\t}\n\t\treturn null;\n\t}\n\n\tprotected updateTextPosition(text: DDynamicText): void {\n\t\tconst align = this._textAlign;\n\t\tconst padding = this._padding;\n\t\tconst auto = this._auto;\n\n\t\tlet textX = 0;\n\t\tconst pleft = padding.getLeft();\n\t\tconst alignHorizontal = align.horizontal;\n\t\tif (auto.width.isOn || alignHorizontal === DAlignHorizontal.LEFT) {\n\t\t\ttextX = pleft;\n\t\t} else {\n\t\t\tconst width = this.width;\n\t\t\tconst textWidth = text.width;\n\t\t\tconst pright = padding.getRight();\n\t\t\tif (alignHorizontal === DAlignHorizontal.CENTER) {\n\t\t\t\ttextX = pleft + (width - pleft - pright - textWidth) * 0.5;\n\t\t\t} else {\n\t\t\t\ttextX = width - textWidth - pright;\n\t\t\t}\n\t\t}\n\n\t\tlet textY = 0;\n\t\tconst ptop = padding.getTop();\n\t\tconst alignVertical = align.vertical;\n\t\tif (auto.height.isOn || alignVertical === DAlignVertical.TOP) {\n\t\t\ttextY = ptop;\n\t\t} else {\n\t\t\tconst height = this.height;\n\t\t\tconst textHeight = text.height;\n\t\t\tconst pbottom = padding.getBottom();\n\t\t\tif (alignVertical === DAlignVertical.MIDDLE) {\n\t\t\t\ttextY = ptop + (height - ptop - pbottom - textHeight) * 0.5;\n\t\t\t} else {\n\t\t\t\ttextY = height - textHeight - pbottom;\n\t\t\t}\n\t\t}\n\n\t\ttext.position.set(textX, textY);\n\t}\n\n\tprotected getTextColor(theme: THEME, state: DBaseStateSet): number {\n\t\tconst color = this._textColor;\n\t\tif (color !== undefined) {\n\t\t\tif (isFunction(color)) {\n\t\t\t\tconst result = color(state);\n\t\t\t\tif (result !== undefined) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn color;\n\t\t\t}\n\t\t}\n\t\treturn theme.getColor(state);\n\t}\n\n\tprotected getTextAlpha(theme: THEME, state: DBaseStateSet): number {\n\t\tconst alpha = this._textAlpha;\n\t\tif (alpha !== undefined) {\n\t\t\tif (isFunction(alpha)) {\n\t\t\t\tconst result = alpha(state);\n\t\t\t\tif (result !== undefined) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn alpha;\n\t\t\t}\n\t\t}\n\t\treturn theme.getAlpha(state);\n\t}\n\n\tprotected updateTextColor(text: DDynamicText): void {\n\t\tconst theme = this.theme;\n\t\tconst state = this.state;\n\t\ttext.style.fill = this.getTextColor(theme, state);\n\t\ttext.alpha = this.getTextAlpha(theme, state);\n\t}\n\n\tprotected updateTextValue(): void {\n\t\tconst newTextValueComputed = this.computeTextValue();\n\t\tif (this._textValueComputed !== newTextValueComputed) {\n\t\t\tthis._textValueComputed = newTextValueComputed;\n\t\t\tthis.onTextChange();\n\t\t\tthis.createOrUpdateText();\n\t\t}\n\t}\n\n\tprotected updateText(): void {\n\t\tconst text = this._text;\n\t\tif (text) {\n\t\t\tthis.updateTextValue();\n\t\t\tthis.updateTextPosition(text);\n\t\t\tthis.updateTextColor(text);\n\t\t}\n\t}\n\n\tprotected showText(): void {\n\t\tconst text = this._text;\n\t\tif (text) {\n\t\t\ttext.visible = true;\n\t\t}\n\t\tthis._isTextVisible = true;\n\t}\n\n\tprotected hideText(): void {\n\t\tconst text = this._text;\n\t\tif (text) {\n\t\t\ttext.visible = false;\n\t\t}\n\t\tthis._isTextVisible = false;\n\t}\n\n\tprotected onReflow(): void {\n\t\tsuper.onReflow();\n\t\tthis.updateText();\n\t}\n\n\tprotected isRefitable(target: any): target is DRefitable {\n\t\treturn super.isRefitable(target) || (target != null && target === this._text);\n\t}\n\n\tprotected applyTitle(): void {\n\t\tconst text = this._text;\n\t\tif (this._title.length <= 0 && text && \"clipped\" in text && text.clipped) {\n\t\t\tconst layer = DApplications.getLayer(this);\n\t\t\tif (layer) {\n\t\t\t\tlayer.view.title = text.text;\n\t\t\t}\n\t\t} else {\n\t\t\tsuper.applyTitle();\n\t\t}\n\t}\n\n\tprotected getType(): string {\n\t\treturn \"DTextBase\";\n\t}\n\n\tdestroy(): void {\n\t\t// Text\n\t\tconst text = this._text;\n\t\tif (text) {\n\t\t\tthis._text = null;\n\t\t\ttext.destroy();\n\t\t}\n\n\t\t// Overflow mask\n\t\tconst overflowMask = this._overflowMask;\n\t\tif (overflowMask) {\n\t\t\tthis._overflowMask = null;\n\t\t\toverflowMask.destroy();\n\t\t}\n\n\t\tsuper.destroy();\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.354.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -29336,7 +29336,7 @@ var UtilFont = /** @class */ (function () {
|
|
|
29336
29336
|
*/
|
|
29337
29337
|
var DDynamicText = /** @class */ (function (_super) {
|
|
29338
29338
|
__extends(DDynamicText, _super);
|
|
29339
|
-
function DDynamicText(
|
|
29339
|
+
function DDynamicText(options) {
|
|
29340
29340
|
var _this = _super.call(this, new DDynamicTextGeometry(), new pixi_js.MeshMaterial(pixi_js.Texture.EMPTY)) || this;
|
|
29341
29341
|
_this._style = new DDynamicTextStyle(options, function () {
|
|
29342
29342
|
_this._isDirty = true;
|
|
@@ -29344,15 +29344,12 @@ var DDynamicText = /** @class */ (function (_super) {
|
|
|
29344
29344
|
_this._atlas = null;
|
|
29345
29345
|
_this.update_();
|
|
29346
29346
|
});
|
|
29347
|
-
_this._text =
|
|
29347
|
+
_this._text = "";
|
|
29348
29348
|
_this._textApproved = "";
|
|
29349
29349
|
_this._isDirty = true;
|
|
29350
29350
|
_this._isGeometryDirty = true;
|
|
29351
29351
|
_this._atlas = null;
|
|
29352
29352
|
_this._atlasRevisionUpdated = 0;
|
|
29353
|
-
_this._onAtlasTextureUpdateBound = function () {
|
|
29354
|
-
DApplications.update(_this);
|
|
29355
|
-
};
|
|
29356
29353
|
_this._width = 0;
|
|
29357
29354
|
_this._height = 0;
|
|
29358
29355
|
_this._modifier = {
|
|
@@ -29367,7 +29364,6 @@ var DDynamicText = /** @class */ (function (_super) {
|
|
|
29367
29364
|
height: 0
|
|
29368
29365
|
}
|
|
29369
29366
|
};
|
|
29370
|
-
_this.update_();
|
|
29371
29367
|
return _this;
|
|
29372
29368
|
}
|
|
29373
29369
|
DDynamicText.prototype.update_ = function () {
|
|
@@ -29471,7 +29467,6 @@ var DDynamicText = /** @class */ (function (_super) {
|
|
|
29471
29467
|
this._atlasRevisionUpdated = atlas.getRevisionUpdate();
|
|
29472
29468
|
this._atlas = atlas;
|
|
29473
29469
|
this.texture = atlas.texture;
|
|
29474
|
-
this.texture.on("update", this._onAtlasTextureUpdateBound);
|
|
29475
29470
|
this._isGeometryDirty = true;
|
|
29476
29471
|
}
|
|
29477
29472
|
}
|
|
@@ -29683,7 +29678,7 @@ var DTextBase = /** @class */ (function (_super) {
|
|
|
29683
29678
|
var text = this._text;
|
|
29684
29679
|
if (text == null) {
|
|
29685
29680
|
if (0 < formatted.length) {
|
|
29686
|
-
var newText = this.
|
|
29681
|
+
var newText = this.newText();
|
|
29687
29682
|
newText.visible = this._isTextVisible;
|
|
29688
29683
|
this._text = newText;
|
|
29689
29684
|
this.addChild(newText);
|
|
@@ -29692,6 +29687,7 @@ var DTextBase = /** @class */ (function (_super) {
|
|
|
29692
29687
|
if (overflowMask) {
|
|
29693
29688
|
newText.mask = overflowMask;
|
|
29694
29689
|
}
|
|
29690
|
+
newText.text = formatted;
|
|
29695
29691
|
this.toDirty();
|
|
29696
29692
|
DApplications.update(this);
|
|
29697
29693
|
}
|
|
@@ -29703,8 +29699,8 @@ var DTextBase = /** @class */ (function (_super) {
|
|
|
29703
29699
|
}
|
|
29704
29700
|
}
|
|
29705
29701
|
};
|
|
29706
|
-
DTextBase.prototype.
|
|
29707
|
-
return new DDynamicText(
|
|
29702
|
+
DTextBase.prototype.newText = function () {
|
|
29703
|
+
return new DDynamicText(this._textStyle);
|
|
29708
29704
|
};
|
|
29709
29705
|
DTextBase.prototype.getOverflowMask = function () {
|
|
29710
29706
|
if (this._isOverflowMaskEnabled) {
|
|
@@ -43608,9 +43604,10 @@ var DMenuItemText = /** @class */ (function (_super) {
|
|
|
43608
43604
|
var shortcuts = this._shortcuts;
|
|
43609
43605
|
if (shortcuts != null && 0 < shortcuts.length) {
|
|
43610
43606
|
var shortcut = shortcuts[0];
|
|
43611
|
-
var
|
|
43612
|
-
this._shortcutText =
|
|
43607
|
+
var shortcutText = this.newText();
|
|
43608
|
+
this._shortcutText = shortcutText;
|
|
43613
43609
|
this.snippet.add(this._shortcutText, true);
|
|
43610
|
+
shortcutText.text = UtilKeyboardEvent.toString(shortcut);
|
|
43614
43611
|
}
|
|
43615
43612
|
else {
|
|
43616
43613
|
this._shortcutText = null;
|
package/dist/wcardinal-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Winter Cardinal UI v0.
|
|
2
|
+
Winter Cardinal UI v0.354.0
|
|
3
3
|
Copyright (C) 2019 Toshiba Corporation
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
@@ -29333,7 +29333,7 @@
|
|
|
29333
29333
|
*/
|
|
29334
29334
|
var DDynamicText = /** @class */ (function (_super) {
|
|
29335
29335
|
__extends(DDynamicText, _super);
|
|
29336
|
-
function DDynamicText(
|
|
29336
|
+
function DDynamicText(options) {
|
|
29337
29337
|
var _this = _super.call(this, new DDynamicTextGeometry(), new pixi_js.MeshMaterial(pixi_js.Texture.EMPTY)) || this;
|
|
29338
29338
|
_this._style = new DDynamicTextStyle(options, function () {
|
|
29339
29339
|
_this._isDirty = true;
|
|
@@ -29341,15 +29341,12 @@
|
|
|
29341
29341
|
_this._atlas = null;
|
|
29342
29342
|
_this.update_();
|
|
29343
29343
|
});
|
|
29344
|
-
_this._text =
|
|
29344
|
+
_this._text = "";
|
|
29345
29345
|
_this._textApproved = "";
|
|
29346
29346
|
_this._isDirty = true;
|
|
29347
29347
|
_this._isGeometryDirty = true;
|
|
29348
29348
|
_this._atlas = null;
|
|
29349
29349
|
_this._atlasRevisionUpdated = 0;
|
|
29350
|
-
_this._onAtlasTextureUpdateBound = function () {
|
|
29351
|
-
DApplications.update(_this);
|
|
29352
|
-
};
|
|
29353
29350
|
_this._width = 0;
|
|
29354
29351
|
_this._height = 0;
|
|
29355
29352
|
_this._modifier = {
|
|
@@ -29364,7 +29361,6 @@
|
|
|
29364
29361
|
height: 0
|
|
29365
29362
|
}
|
|
29366
29363
|
};
|
|
29367
|
-
_this.update_();
|
|
29368
29364
|
return _this;
|
|
29369
29365
|
}
|
|
29370
29366
|
DDynamicText.prototype.update_ = function () {
|
|
@@ -29468,7 +29464,6 @@
|
|
|
29468
29464
|
this._atlasRevisionUpdated = atlas.getRevisionUpdate();
|
|
29469
29465
|
this._atlas = atlas;
|
|
29470
29466
|
this.texture = atlas.texture;
|
|
29471
|
-
this.texture.on("update", this._onAtlasTextureUpdateBound);
|
|
29472
29467
|
this._isGeometryDirty = true;
|
|
29473
29468
|
}
|
|
29474
29469
|
}
|
|
@@ -29680,7 +29675,7 @@
|
|
|
29680
29675
|
var text = this._text;
|
|
29681
29676
|
if (text == null) {
|
|
29682
29677
|
if (0 < formatted.length) {
|
|
29683
|
-
var newText = this.
|
|
29678
|
+
var newText = this.newText();
|
|
29684
29679
|
newText.visible = this._isTextVisible;
|
|
29685
29680
|
this._text = newText;
|
|
29686
29681
|
this.addChild(newText);
|
|
@@ -29689,6 +29684,7 @@
|
|
|
29689
29684
|
if (overflowMask) {
|
|
29690
29685
|
newText.mask = overflowMask;
|
|
29691
29686
|
}
|
|
29687
|
+
newText.text = formatted;
|
|
29692
29688
|
this.toDirty();
|
|
29693
29689
|
DApplications.update(this);
|
|
29694
29690
|
}
|
|
@@ -29700,8 +29696,8 @@
|
|
|
29700
29696
|
}
|
|
29701
29697
|
}
|
|
29702
29698
|
};
|
|
29703
|
-
DTextBase.prototype.
|
|
29704
|
-
return new DDynamicText(
|
|
29699
|
+
DTextBase.prototype.newText = function () {
|
|
29700
|
+
return new DDynamicText(this._textStyle);
|
|
29705
29701
|
};
|
|
29706
29702
|
DTextBase.prototype.getOverflowMask = function () {
|
|
29707
29703
|
if (this._isOverflowMaskEnabled) {
|
|
@@ -43605,9 +43601,10 @@
|
|
|
43605
43601
|
var shortcuts = this._shortcuts;
|
|
43606
43602
|
if (shortcuts != null && 0 < shortcuts.length) {
|
|
43607
43603
|
var shortcut = shortcuts[0];
|
|
43608
|
-
var
|
|
43609
|
-
this._shortcutText =
|
|
43604
|
+
var shortcutText = this.newText();
|
|
43605
|
+
this._shortcutText = shortcutText;
|
|
43610
43606
|
this.snippet.add(this._shortcutText, true);
|
|
43607
|
+
shortcutText.text = UtilKeyboardEvent.toString(shortcut);
|
|
43611
43608
|
}
|
|
43612
43609
|
else {
|
|
43613
43610
|
this._shortcutText = null;
|