@wcardinal/wcardinal-ui 0.299.0 → 0.300.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-diagram-serialized.d.ts +2 -0
- package/dist/types/wcardinal/ui/shape/e-shape-text.d.ts +2 -1
- package/dist/types/wcardinal/ui/shape/variant/build-text.d.ts +1 -1
- package/dist/types/wcardinal/ui/shape/variant/builder-text.d.ts +1 -0
- package/dist/types/wcardinal/ui/shape/variant/e-shape-text-impl.d.ts +4 -1
- package/dist/wcardinal/ui/d-diagram-serialized.js.map +1 -1
- package/dist/wcardinal/ui/shape/e-shape-text.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/build-text.js +56 -62
- package/dist/wcardinal/ui/shape/variant/build-text.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/builder-text.js +7 -2
- package/dist/wcardinal/ui/shape/variant/builder-text.js.map +1 -1
- package/dist/wcardinal/ui/shape/variant/e-shape-text-impl.js +26 -5
- package/dist/wcardinal/ui/shape/variant/e-shape-text-impl.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 +89 -70
- package/dist/wcardinal-ui.js +89 -70
- package/dist/wcardinal-ui.min.js +2 -2
- package/dist/wcardinal-ui.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ export interface EShapeTextLike {
|
|
|
31
31
|
direction: EShapeTextDirection;
|
|
32
32
|
padding: EShapeTextOffsetLike;
|
|
33
33
|
clipping: boolean;
|
|
34
|
+
fitting: boolean;
|
|
34
35
|
}
|
|
35
36
|
export interface EShapeTextAtlasCharacter {
|
|
36
37
|
x: number;
|
|
@@ -63,7 +64,7 @@ export interface EShapeText extends EShapeTextLike {
|
|
|
63
64
|
atlas?: EShapeTextAtlas;
|
|
64
65
|
world?: number[];
|
|
65
66
|
copy(target?: DeepPartial<EShapeTextLike>): this;
|
|
66
|
-
set(value?: string, color?: number, alpha?: number, family?: string, size?: number, weight?: EShapeTextWeight, style?: EShapeTextStyle, direction?: EShapeTextDirection, clipping?: boolean): this;
|
|
67
|
+
set(value?: string, color?: number, alpha?: number, family?: string, size?: number, weight?: EShapeTextWeight, style?: EShapeTextStyle, direction?: EShapeTextDirection, clipping?: boolean, fitting?: boolean): this;
|
|
67
68
|
toObject(): EShapeTextLike;
|
|
68
69
|
serialize(manager: EShapeResourceManagerSerialization): number;
|
|
69
70
|
deserialize(target: number, manager: EShapeResourceManagerDeserialization): void;
|
|
@@ -11,4 +11,4 @@ export declare const toTextBufferCount: (shape: EShape) => number;
|
|
|
11
11
|
export declare const buildTextClipping: (clippings: Float32Array, voffset: number, vcount: number) => void;
|
|
12
12
|
export declare const buildTextIndex: (indices: Uint16Array | Uint32Array, voffset: number, ioffset: number, icount: number) => void;
|
|
13
13
|
export declare const buildTextStep: (steps: Float32Array, voffset: number, vcount: number, textAtlas: EShapeTextAtlas | undefined, textSize: number, textOutlineWidth: number, textWeight: EShapeTextWeight, scaleX: number, scaleY: number) => void;
|
|
14
|
-
export declare const buildTextVertex: (vertices: Float32Array, uvs: Float32Array, voffset: number, vcount: number, originX: number, originY: number, sizeX: number, sizeY: number, textAtlas: EShapeTextAtlas, textSize: number, textValue: string, textStyle: EShapeTextStyle, textAlignHorizontal: EShapeTextAlignHorizontal, textAlignVertical: EShapeTextAlignVertical, textOffsetHorizontal: number, textOffsetVertical: number, textSpacingHorizontal: number, textSpacingVertical: number, textDirection: EShapeTextDirection, textPaddingHorizontal: number, textPaddingVertical: number, textClipping: boolean, textWorld: number[], textureUvs: TextureUvs, internalTransform: Matrix) => void;
|
|
14
|
+
export declare const buildTextVertex: (vertices: Float32Array, uvs: Float32Array, voffset: number, vcount: number, originX: number, originY: number, sizeX: number, sizeY: number, textAtlas: EShapeTextAtlas, textSize: number, textValue: string, textStyle: EShapeTextStyle, textAlignHorizontal: EShapeTextAlignHorizontal, textAlignVertical: EShapeTextAlignVertical, textOffsetHorizontal: number, textOffsetVertical: number, textSpacingHorizontal: number, textSpacingVertical: number, textDirection: EShapeTextDirection, textPaddingHorizontal: number, textPaddingVertical: number, textClipping: boolean, textFitting: boolean, textWorld: number[], textureUvs: TextureUvs, internalTransform: Matrix) => void;
|
|
@@ -36,6 +36,7 @@ export declare class BuilderText implements Builder {
|
|
|
36
36
|
protected paddingHorizontal: number;
|
|
37
37
|
protected paddingVertical: number;
|
|
38
38
|
protected clipping: boolean;
|
|
39
|
+
protected fitting: boolean;
|
|
39
40
|
constructor(vertexOffset: number, indexOffset: number, vertexCount: number, indexCount: number);
|
|
40
41
|
init(buffer: EShapeBuffer): void;
|
|
41
42
|
isCompatible(shape: EShape): boolean;
|
|
@@ -25,6 +25,7 @@ export declare class EShapeTextImpl implements EShapeText {
|
|
|
25
25
|
protected _direction: EShapeTextDirection;
|
|
26
26
|
readonly padding: EShapeTextOffset;
|
|
27
27
|
protected _clipping: boolean;
|
|
28
|
+
protected _fitting: boolean;
|
|
28
29
|
texture?: Texture;
|
|
29
30
|
atlas?: EShapeTextAtlas;
|
|
30
31
|
world?: number[];
|
|
@@ -49,8 +50,10 @@ export declare class EShapeTextImpl implements EShapeText {
|
|
|
49
50
|
set direction(direction: EShapeTextDirection);
|
|
50
51
|
get clipping(): boolean;
|
|
51
52
|
set clipping(clipping: boolean);
|
|
53
|
+
get fitting(): boolean;
|
|
54
|
+
set fitting(fitting: boolean);
|
|
52
55
|
copy(target?: DeepPartial<EShapeTextLike>): this;
|
|
53
|
-
set(value?: string, color?: number, alpha?: number, family?: string, size?: number, weight?: EShapeTextWeight, style?: EShapeTextStyle, direction?: EShapeTextDirection, clipping?: boolean): this;
|
|
56
|
+
set(value?: string, color?: number, alpha?: number, family?: string, size?: number, weight?: EShapeTextWeight, style?: EShapeTextStyle, direction?: EShapeTextDirection, clipping?: boolean, fitting?: boolean): this;
|
|
54
57
|
toObject(): EShapeTextLike;
|
|
55
58
|
serialize(manager: EShapeResourceManagerSerialization): number;
|
|
56
59
|
deserialize(target: number, manager: EShapeResourceManagerDeserialization): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"d-diagram-serialized.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-diagram-serialized.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,MAAM,CAAC,IAAM,yBAAyB,GAAW,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DDiagramCanvasTileMapping } from \"./d-diagram-canvas-mapping\";\nimport { EShapeCorner } from \"./shape/e-shape-corner\";\nimport { EShapeStrokeSide } from \"./shape/e-shape-stroke-side\";\nimport { EShapeStrokeStyle } from \"./shape/e-shape-stroke-style\";\nimport { EShapeDataValueOrder } from \"./shape/e-shape-data-value-order\";\nimport { EShapeTextStyle, EShapeTextWeight } from \"./shape/e-shape-text\";\nimport { EShapeTextAlignHorizontal } from \"./shape/e-shape-text-align-horizontal\";\nimport { EShapeTextAlignVertical } from \"./shape/e-shape-text-align-vertical\";\nimport { EShapeTextDirection } from \"./shape/e-shape-text-direction\";\nimport { EShapeType } from \"./shape/e-shape-type\";\nimport { ESnapperTargetValueType } from \"./snapper/e-snapper-target-value\";\nimport { EShapeDataValueRangeType } from \"./shape/e-shape-data-value-range\";\nimport { EShapeDataValueType } from \"./shape/e-shape-data-value-type\";\nimport { EShapeDataValueScope } from \"./shape/e-shape-data-value-scope\";\n\nexport const DDiagramSerializedVersion: number = 1;\n\n/**\n * A serialized data range.\n */\nexport interface DDiagramSerializedDataRange {\n\t/** A type. */\n\t[0]: EShapeDataValueRangeType;\n\n\t/** A lower bound. */\n\t[1]: number;\n\n\t/** An upper bound. */\n\t[2]: number;\n}\n\n/**\n * A serialized data value.\n */\nexport interface DDiagramSerializedDataValue {\n\t/**\n\t * A resource index number of an ID.\n\t */\n\t[0]: number;\n\n\t/**\n\t * A resource index number of an initial value expression.\n\t */\n\t[1]: number;\n\n\t/**\n\t * A resource index number of a format expression.\n\t */\n\t[2]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedDataRange).\n\t */\n\t[3]: number;\n\n\t/**\n\t * A capacity.\n\t */\n\t[4]: number;\n\n\t/**\n\t * A order.\n\t */\n\t[5]: EShapeDataValueOrder;\n\n\t/**\n\t * A type.\n\t */\n\t[6]: EShapeDataValueType | undefined;\n\n\t/**\n\t * A scope.\n\t */\n\t[7]: EShapeDataValueScope | undefined;\n\n\t/**\n\t * A resource index number of an alias.\n\t */\n\t[8]: number | undefined;\n}\n\n/**\n * A serialized system data.\n */\nexport type DDiagramSerializedDataSystem = number[];\n\n/**\n * A serialized data mapping.\n * Each number at the index 2N+0 is a resource index number of the N-th mapping source.\n * Each number at the index 2N+1 is a resource index number of the N-th mapping destination.\n */\nexport type DDiagramSerializedDataMapping = number[];\n\n/**\n * A serialized data with a mapping data.\n */\nexport interface DDiagramSerializedDataWithMapping extends Array<unknown> {\n\t/**\n\t * Each number is a resource index number of JSON.stringify(DDiagramSerializedDataValue).\n\t * The last number is a resource index number of JSON.stringify(DDiagramSerializedDataMapping).\n\t */\n\t[0]: number[];\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedDataSystem).\n\t */\n\t[1]: number | undefined;\n}\n\n/**\n * A serialized data without a mapping data.\n * Each number is a resource index number of JSON.stringify(DDiagramSerializedDataValue).\n */\nexport type DDiagramSerializedDataWithoutMapping = number[];\n\n/**\n * A serialized data.\n */\nexport type DDiagramSerializedData =\n\t| DDiagramSerializedDataWithoutMapping\n\t| DDiagramSerializedDataWithMapping;\n\n/**\n * A serialized fill.\n */\nexport interface DDiagramSerializedFill {\n\t/** 0: Disabled, 1: Enabled */\n\t[0]: number;\n\n\t/** A color. */\n\t[1]: number;\n\n\t/** An alpha. */\n\t[2]: number;\n}\n\n/**\n * A serialized stroke.\n */\nexport interface DDiagramSerializedStroke {\n\t/** 0: Disabled, 1: Enabled */\n\t[0]: number;\n\n\t/** A color. */\n\t[1]: number;\n\n\t/** An alpha. */\n\t[2]: number;\n\n\t/** A width. */\n\t[3]: number;\n\n\t/** An align. */\n\t[4]: number;\n\n\t/** A side. */\n\t[5]: EShapeStrokeSide;\n\n\t/** A style */\n\t[6]: EShapeStrokeStyle | undefined;\n}\n\n/**\n * A serialized text outline.\n */\nexport interface DDiagramSerializedTextOutline {\n\t/** 0: Disabled, 1: Enabled */\n\t[0]: number;\n\n\t/** A color. */\n\t[1]: number;\n\n\t/** An alpha. */\n\t[2]: number;\n\n\t/** A width. */\n\t[3]: number;\n}\n\n/**\n * A serialized text align.\n */\nexport interface DDiagramSerializedTextAlign {\n\t/** A horizontal align. */\n\t[0]: EShapeTextAlignHorizontal;\n\n\t/** A vertical align. */\n\t[1]: EShapeTextAlignVertical;\n}\n\n/**\n * A serialized text offset.\n */\nexport interface DDiagramSerializedTextOffset {\n\t/** A horizontal offset. */\n\t[0]: number;\n\n\t/** A vertical offset. */\n\t[1]: number;\n}\n\n/**\n * A serialized text spacing.\n */\nexport interface DDiagramSerializedTextSpacing {\n\t/** A horizontal spacing. */\n\t[0]: number;\n\n\t/** A vertical spacing. */\n\t[1]: number;\n}\n\n/**\n * A serialized text padding.\n */\nexport interface DDiagramSerializedTextPadding {\n\t/** A horizontal padding. */\n\t[0]: number;\n\n\t/** A vertical padding. */\n\t[1]: number;\n}\n\n/**\n * A serialized text.\n */\nexport interface DDiagramSerializedText {\n\t/** A resource index number of a value. */\n\t[0]: number;\n\n\t/** A color. */\n\t[1]: number;\n\n\t/** An alpha. */\n\t[2]: number;\n\n\t/** A resource index number of a font family. */\n\t[3]: number;\n\n\t/** A size. */\n\t[4]: number;\n\n\t/** A weight. */\n\t[5]: EShapeTextWeight;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextAlign).\n\t */\n\t[6]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextOffset).\n\t */\n\t[7]: number;\n\n\t/** A style. */\n\t[8]: EShapeTextStyle;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextOutline).\n\t */\n\t[9]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextSpacing).\n\t */\n\t[10]: number;\n\n\t/** A direction. */\n\t[11]: EShapeTextDirection;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextPadding).\n\t */\n\t[12]: number;\n\n\t/** A clipping. (0: Off, 1: On) */\n\t[13]: number;\n}\n\n/**\n * A serialized item.\n */\nexport interface DDiagramSerializedItem {\n\t/** A type. */\n\t[0]: EShapeType;\n\n\t/** A resource index number of a ID. */\n\t[1]: number;\n\n\t/** A X-coordinate position. */\n\t[2]: number;\n\n\t/** A Y-coordinate position. */\n\t[3]: number;\n\n\t/** A width. */\n\t[4]: number;\n\n\t/** A height. */\n\t[5]: number;\n\n\t/** A rotation. */\n\t[6]: number;\n\n\t/** A skew. */\n\t[7]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedFill).\n\t */\n\t[8]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedStroke).\n\t */\n\t[9]: number;\n\n\t/** A resource index number of a cursor. */\n\t[10]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedText).\n\t */\n\t[11]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedData).\n\t */\n\t[12]: number;\n\n\t/** A radius. */\n\t[13]: number;\n\n\t/** A corner. */\n\t[14]: EShapeCorner;\n\n\t/** A resource index number of a shape-specific resource. */\n\t[15]: number;\n\n\t/** A layer index number. */\n\t[16]: number;\n\n\t/** Actions */\n\t[17]: number[];\n\n\t/** A resource index number of an image. */\n\t[18]: number;\n\n\t/**\n\t * A resource index number of a stringified serialized gradient.\n\t * A stringified serialized gradient is a stringified number array,\n\t * JSON.stringify(number[]).\n\t *\n\t * * The first number in the array is a direction in degree.\n\t * * Each number at the index 3N + 1 is a color of a N-th point.\n\t * * Each number at the index 3N + 2 is a alpha of a N-th point.\n\t * * Each number at the index 3N + 3 is a position of a N-th point whose range is [0, 1].\n\t */\n\t[19]: number;\n\n\t/** Children. */\n\t[20]: DDiagramSerializedItem[];\n\n\t/** A X pivot. */\n\t[21]: number;\n\n\t/** A Y pivot. */\n\t[22]: number;\n\n\t/** (interactive ? 1 : 0) | (unfocusable ? 2 : 0) */\n\t[23]: number;\n\n\t/** A resource index number of a shortcut. */\n\t[24]: number;\n\n\t/** A resource index number of a title. */\n\t[25]: number;\n\n\t/** UUID */\n\t[26]: number;\n\n\t/** Added capabilities */\n\t[27]: number;\n\n\t/** Removed capabilities */\n\t[28]: number;\n\n\t/** Locked capabilities */\n\t[29]: number;\n}\n\n/**\n * A serialized layer.\n */\nexport interface DDiagramSerializedLayer {\n\t/** A name or a resource index number of a name*/\n\t[0]: string | number;\n\n\t/**\n\t * A visibility.\n\t *\n\t * * 1st bit\n\t * * 0: Invisible when edit mode\n\t * * 1: Visible when edit mode\n\t * * 2nd bit\n\t * * 0: Invisible when non-edit mode\n\t * * 1: Visible when non-edit mode\n\t */\n\t[1]?: number;\n\n\t/** A X-coordinate position. */\n\t[2]?: number;\n\n\t/** A Y-coordinate position. */\n\t[3]?: number;\n\n\t/** A width. */\n\t[4]?: number;\n\n\t/** A height. */\n\t[5]?: number;\n\n\t/**\n\t * A resource index number of a stringified serialized fill,\n\t * JSON.stringify(DDiagramSerializedFill).\n\t */\n\t[6]?: number;\n\n\t/**\n\t * * 1st bit\n\t * * 0: Not interactive\n\t * * 1: Interactive\n\t * * 2nd bit\n\t * * 0: Not draggable\n\t * * 1: Draggable\n\t * * 3rd bit\n\t * * 0: Not pinchable\n\t * * 1: Pinchable\n\t */\n\t[7]?: number;\n}\n\n/**\n * A serialized snap target.\n */\nexport interface DDiagramSerializedSnapTargetValue {\n\t/** A type. */\n\t[0]: ESnapperTargetValueType;\n\n\t/** A position. */\n\t[1]: number;\n}\n\n/**\n * Serialized snap on guide settings.\n */\nexport interface DDiagramSerializedSnapTarget {\n\t/** Snap on guide (0: Off, 1: On) */\n\t[0]: number;\n\n\t/** A visibility (0: Invisible, 1: Visible). */\n\t[1]: number;\n\n\t/** Snap targets. */\n\t[2]: DDiagramSerializedSnapTargetValue[];\n}\n\n/**\n * Serialized grid snap settings without a visibility option.\n */\nexport interface DDiagramSerializedSnapGridWithoutVisibility {\n\t/** Snap on grid (0: Off, 1: On) */\n\t[0]: number;\n\n\t/** A grid size. */\n\t[1]: number;\n}\n\n/**\n * Serialized grid snap settings with a visibility option.\n */\nexport interface DDiagramSerializedSnapGridWithVisibility {\n\t/** Snap on grid (0: Off, 1: On) */\n\t[0]: number;\n\n\t/** A visibility (0: Invisible, 1: Visible). */\n\t[1]: number;\n\n\t/** A grid size. */\n\t[2]: number;\n}\n\n/**\n * Serialized grid snap settings with a visibility.\n */\nexport type DDiagramSerializedSnapGrid =\n\t| DDiagramSerializedSnapGridWithoutVisibility\n\t| DDiagramSerializedSnapGridWithVisibility;\n\n/**\n * Serialized snap settings.\n */\nexport interface DDiagramSerializedSnap {\n\t/** Snap (0: Off, 1: On). */\n\t[0]: number;\n\n\t/** Snap on targets */\n\t[1]: DDiagramSerializedSnapTarget;\n\n\t/** Snap on grid */\n\t[2]: DDiagramSerializedSnapGrid;\n}\n\n/**\n * Serialized background settings.\n */\nexport interface DDiagramSerializedBackground {\n\tcolor?: number | null;\n\talpha?: number;\n}\n\n/**\n * Serialized tile settings.\n */\nexport interface DDiagramSerializedTile {\n\tmapping?: DDiagramCanvasTileMapping;\n}\n\n/**\n * A serialized diagram.\n */\nexport interface DDiagramSerialized {\n\tversion: number;\n\tid?: number;\n\tname: string;\n\twidth: number;\n\theight: number;\n\tbackground?: DDiagramSerializedBackground;\n\ttile?: DDiagramSerializedTile;\n\tresources: string[];\n\t/** @deprecated in favor of {@link data} */\n\ttags?: string[];\n\tdata?: string[];\n\tpieces?: string[];\n\tlayers: DDiagramSerializedLayer[];\n\titems: DDiagramSerializedItem[];\n\tsnap?: DDiagramSerializedSnap;\n\tthumbnail?: string;\n}\n\nexport type DDiagramSerializedSimpleData = Omit<\n\tDDiagramSerialized,\n\t\"version\" | \"id\" | \"name\" | \"thumbnail\"\n>;\n\n/**\n * A simplified version of a serialized diagram.\n */\nexport interface DDiagramSerializedSimple {\n\tversion: number;\n\tid: number | undefined;\n\tname: string;\n\n\t/**\n\t * A stringified {@link DDiagramSerialized#data}.\n\t *\n\t * @deprecated in favor of {@link DDiagramSerializedSimpleData}.\n\t */\n\ttags?: string;\n\n\t/**\n\t * A stringified {@link DDiagramSerialized#pieces}.\n\t *\n\t * @deprecated in favor of {@link DDiagramSerializedSimpleData}.\n\t */\n\tpieces?: string;\n\n\t/**\n\t * Thumbnail data URL.\n\t */\n\tthumbnail?: string;\n\n\t/**\n\t * A stringified {@link DDiagramSerializedSimpleData}.\n\t */\n\tdata: string;\n}\n\nexport interface DDiagramSerializedName {\n\tid: number;\n\tname: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"d-diagram-serialized.js","sourceRoot":"","sources":["../../../src/main/typescript/wcardinal/ui/d-diagram-serialized.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,MAAM,CAAC,IAAM,yBAAyB,GAAW,CAAC,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { DDiagramCanvasTileMapping } from \"./d-diagram-canvas-mapping\";\nimport { EShapeCorner } from \"./shape/e-shape-corner\";\nimport { EShapeStrokeSide } from \"./shape/e-shape-stroke-side\";\nimport { EShapeStrokeStyle } from \"./shape/e-shape-stroke-style\";\nimport { EShapeDataValueOrder } from \"./shape/e-shape-data-value-order\";\nimport { EShapeTextStyle, EShapeTextWeight } from \"./shape/e-shape-text\";\nimport { EShapeTextAlignHorizontal } from \"./shape/e-shape-text-align-horizontal\";\nimport { EShapeTextAlignVertical } from \"./shape/e-shape-text-align-vertical\";\nimport { EShapeTextDirection } from \"./shape/e-shape-text-direction\";\nimport { EShapeType } from \"./shape/e-shape-type\";\nimport { ESnapperTargetValueType } from \"./snapper/e-snapper-target-value\";\nimport { EShapeDataValueRangeType } from \"./shape/e-shape-data-value-range\";\nimport { EShapeDataValueType } from \"./shape/e-shape-data-value-type\";\nimport { EShapeDataValueScope } from \"./shape/e-shape-data-value-scope\";\n\nexport const DDiagramSerializedVersion: number = 1;\n\n/**\n * A serialized data range.\n */\nexport interface DDiagramSerializedDataRange {\n\t/** A type. */\n\t[0]: EShapeDataValueRangeType;\n\n\t/** A lower bound. */\n\t[1]: number;\n\n\t/** An upper bound. */\n\t[2]: number;\n}\n\n/**\n * A serialized data value.\n */\nexport interface DDiagramSerializedDataValue {\n\t/**\n\t * A resource index number of an ID.\n\t */\n\t[0]: number;\n\n\t/**\n\t * A resource index number of an initial value expression.\n\t */\n\t[1]: number;\n\n\t/**\n\t * A resource index number of a format expression.\n\t */\n\t[2]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedDataRange).\n\t */\n\t[3]: number;\n\n\t/**\n\t * A capacity.\n\t */\n\t[4]: number;\n\n\t/**\n\t * A order.\n\t */\n\t[5]: EShapeDataValueOrder;\n\n\t/**\n\t * A type.\n\t */\n\t[6]: EShapeDataValueType | undefined;\n\n\t/**\n\t * A scope.\n\t */\n\t[7]: EShapeDataValueScope | undefined;\n\n\t/**\n\t * A resource index number of an alias.\n\t */\n\t[8]: number | undefined;\n}\n\n/**\n * A serialized system data.\n */\nexport type DDiagramSerializedDataSystem = number[];\n\n/**\n * A serialized data mapping.\n * Each number at the index 2N+0 is a resource index number of the N-th mapping source.\n * Each number at the index 2N+1 is a resource index number of the N-th mapping destination.\n */\nexport type DDiagramSerializedDataMapping = number[];\n\n/**\n * A serialized data with a mapping data.\n */\nexport interface DDiagramSerializedDataWithMapping extends Array<unknown> {\n\t/**\n\t * Each number is a resource index number of JSON.stringify(DDiagramSerializedDataValue).\n\t * The last number is a resource index number of JSON.stringify(DDiagramSerializedDataMapping).\n\t */\n\t[0]: number[];\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedDataSystem).\n\t */\n\t[1]: number | undefined;\n}\n\n/**\n * A serialized data without a mapping data.\n * Each number is a resource index number of JSON.stringify(DDiagramSerializedDataValue).\n */\nexport type DDiagramSerializedDataWithoutMapping = number[];\n\n/**\n * A serialized data.\n */\nexport type DDiagramSerializedData =\n\t| DDiagramSerializedDataWithoutMapping\n\t| DDiagramSerializedDataWithMapping;\n\n/**\n * A serialized fill.\n */\nexport interface DDiagramSerializedFill {\n\t/** 0: Disabled, 1: Enabled */\n\t[0]: number;\n\n\t/** A color. */\n\t[1]: number;\n\n\t/** An alpha. */\n\t[2]: number;\n}\n\n/**\n * A serialized stroke.\n */\nexport interface DDiagramSerializedStroke {\n\t/** 0: Disabled, 1: Enabled */\n\t[0]: number;\n\n\t/** A color. */\n\t[1]: number;\n\n\t/** An alpha. */\n\t[2]: number;\n\n\t/** A width. */\n\t[3]: number;\n\n\t/** An align. */\n\t[4]: number;\n\n\t/** A side. */\n\t[5]: EShapeStrokeSide;\n\n\t/** A style */\n\t[6]: EShapeStrokeStyle | undefined;\n}\n\n/**\n * A serialized text outline.\n */\nexport interface DDiagramSerializedTextOutline {\n\t/** 0: Disabled, 1: Enabled */\n\t[0]: number;\n\n\t/** A color. */\n\t[1]: number;\n\n\t/** An alpha. */\n\t[2]: number;\n\n\t/** A width. */\n\t[3]: number;\n}\n\n/**\n * A serialized text align.\n */\nexport interface DDiagramSerializedTextAlign {\n\t/** A horizontal align. */\n\t[0]: EShapeTextAlignHorizontal;\n\n\t/** A vertical align. */\n\t[1]: EShapeTextAlignVertical;\n}\n\n/**\n * A serialized text offset.\n */\nexport interface DDiagramSerializedTextOffset {\n\t/** A horizontal offset. */\n\t[0]: number;\n\n\t/** A vertical offset. */\n\t[1]: number;\n}\n\n/**\n * A serialized text spacing.\n */\nexport interface DDiagramSerializedTextSpacing {\n\t/** A horizontal spacing. */\n\t[0]: number;\n\n\t/** A vertical spacing. */\n\t[1]: number;\n}\n\n/**\n * A serialized text padding.\n */\nexport interface DDiagramSerializedTextPadding {\n\t/** A horizontal padding. */\n\t[0]: number;\n\n\t/** A vertical padding. */\n\t[1]: number;\n}\n\n/**\n * A serialized text.\n */\nexport interface DDiagramSerializedText {\n\t/** A resource index number of a value. */\n\t[0]: number;\n\n\t/** A color. */\n\t[1]: number;\n\n\t/** An alpha. */\n\t[2]: number;\n\n\t/** A resource index number of a font family. */\n\t[3]: number;\n\n\t/** A size. */\n\t[4]: number;\n\n\t/** A weight. */\n\t[5]: EShapeTextWeight;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextAlign).\n\t */\n\t[6]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextOffset).\n\t */\n\t[7]: number;\n\n\t/** A style. */\n\t[8]: EShapeTextStyle;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextOutline).\n\t */\n\t[9]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextSpacing).\n\t */\n\t[10]: number;\n\n\t/** A direction. */\n\t[11]: EShapeTextDirection;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedTextPadding).\n\t */\n\t[12]: number;\n\n\t/** A clipping. (0: Off, 1: On) */\n\t[13]: number;\n\n\t/** A fitting. (0: Off, 1: On) */\n\t[14]: number;\n}\n\n/**\n * A serialized item.\n */\nexport interface DDiagramSerializedItem {\n\t/** A type. */\n\t[0]: EShapeType;\n\n\t/** A resource index number of a ID. */\n\t[1]: number;\n\n\t/** A X-coordinate position. */\n\t[2]: number;\n\n\t/** A Y-coordinate position. */\n\t[3]: number;\n\n\t/** A width. */\n\t[4]: number;\n\n\t/** A height. */\n\t[5]: number;\n\n\t/** A rotation. */\n\t[6]: number;\n\n\t/** A skew. */\n\t[7]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedFill).\n\t */\n\t[8]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedStroke).\n\t */\n\t[9]: number;\n\n\t/** A resource index number of a cursor. */\n\t[10]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedText).\n\t */\n\t[11]: number;\n\n\t/**\n\t * A resource index number of JSON.stringify(DDiagramSerializedData).\n\t */\n\t[12]: number;\n\n\t/** A radius. */\n\t[13]: number;\n\n\t/** A corner. */\n\t[14]: EShapeCorner;\n\n\t/** A resource index number of a shape-specific resource. */\n\t[15]: number;\n\n\t/** A layer index number. */\n\t[16]: number;\n\n\t/** Actions */\n\t[17]: number[];\n\n\t/** A resource index number of an image. */\n\t[18]: number;\n\n\t/**\n\t * A resource index number of a stringified serialized gradient.\n\t * A stringified serialized gradient is a stringified number array,\n\t * JSON.stringify(number[]).\n\t *\n\t * * The first number in the array is a direction in degree.\n\t * * Each number at the index 3N + 1 is a color of a N-th point.\n\t * * Each number at the index 3N + 2 is a alpha of a N-th point.\n\t * * Each number at the index 3N + 3 is a position of a N-th point whose range is [0, 1].\n\t */\n\t[19]: number;\n\n\t/** Children. */\n\t[20]: DDiagramSerializedItem[];\n\n\t/** A X pivot. */\n\t[21]: number;\n\n\t/** A Y pivot. */\n\t[22]: number;\n\n\t/** (interactive ? 1 : 0) | (unfocusable ? 2 : 0) */\n\t[23]: number;\n\n\t/** A resource index number of a shortcut. */\n\t[24]: number;\n\n\t/** A resource index number of a title. */\n\t[25]: number;\n\n\t/** UUID */\n\t[26]: number;\n\n\t/** Added capabilities */\n\t[27]: number;\n\n\t/** Removed capabilities */\n\t[28]: number;\n\n\t/** Locked capabilities */\n\t[29]: number;\n}\n\n/**\n * A serialized layer.\n */\nexport interface DDiagramSerializedLayer {\n\t/** A name or a resource index number of a name*/\n\t[0]: string | number;\n\n\t/**\n\t * A visibility.\n\t *\n\t * * 1st bit\n\t * * 0: Invisible when edit mode\n\t * * 1: Visible when edit mode\n\t * * 2nd bit\n\t * * 0: Invisible when non-edit mode\n\t * * 1: Visible when non-edit mode\n\t */\n\t[1]?: number;\n\n\t/** A X-coordinate position. */\n\t[2]?: number;\n\n\t/** A Y-coordinate position. */\n\t[3]?: number;\n\n\t/** A width. */\n\t[4]?: number;\n\n\t/** A height. */\n\t[5]?: number;\n\n\t/**\n\t * A resource index number of a stringified serialized fill,\n\t * JSON.stringify(DDiagramSerializedFill).\n\t */\n\t[6]?: number;\n\n\t/**\n\t * * 1st bit\n\t * * 0: Not interactive\n\t * * 1: Interactive\n\t * * 2nd bit\n\t * * 0: Not draggable\n\t * * 1: Draggable\n\t * * 3rd bit\n\t * * 0: Not pinchable\n\t * * 1: Pinchable\n\t */\n\t[7]?: number;\n}\n\n/**\n * A serialized snap target.\n */\nexport interface DDiagramSerializedSnapTargetValue {\n\t/** A type. */\n\t[0]: ESnapperTargetValueType;\n\n\t/** A position. */\n\t[1]: number;\n}\n\n/**\n * Serialized snap on guide settings.\n */\nexport interface DDiagramSerializedSnapTarget {\n\t/** Snap on guide (0: Off, 1: On) */\n\t[0]: number;\n\n\t/** A visibility (0: Invisible, 1: Visible). */\n\t[1]: number;\n\n\t/** Snap targets. */\n\t[2]: DDiagramSerializedSnapTargetValue[];\n}\n\n/**\n * Serialized grid snap settings without a visibility option.\n */\nexport interface DDiagramSerializedSnapGridWithoutVisibility {\n\t/** Snap on grid (0: Off, 1: On) */\n\t[0]: number;\n\n\t/** A grid size. */\n\t[1]: number;\n}\n\n/**\n * Serialized grid snap settings with a visibility option.\n */\nexport interface DDiagramSerializedSnapGridWithVisibility {\n\t/** Snap on grid (0: Off, 1: On) */\n\t[0]: number;\n\n\t/** A visibility (0: Invisible, 1: Visible). */\n\t[1]: number;\n\n\t/** A grid size. */\n\t[2]: number;\n}\n\n/**\n * Serialized grid snap settings with a visibility.\n */\nexport type DDiagramSerializedSnapGrid =\n\t| DDiagramSerializedSnapGridWithoutVisibility\n\t| DDiagramSerializedSnapGridWithVisibility;\n\n/**\n * Serialized snap settings.\n */\nexport interface DDiagramSerializedSnap {\n\t/** Snap (0: Off, 1: On). */\n\t[0]: number;\n\n\t/** Snap on targets */\n\t[1]: DDiagramSerializedSnapTarget;\n\n\t/** Snap on grid */\n\t[2]: DDiagramSerializedSnapGrid;\n}\n\n/**\n * Serialized background settings.\n */\nexport interface DDiagramSerializedBackground {\n\tcolor?: number | null;\n\talpha?: number;\n}\n\n/**\n * Serialized tile settings.\n */\nexport interface DDiagramSerializedTile {\n\tmapping?: DDiagramCanvasTileMapping;\n}\n\n/**\n * A serialized diagram.\n */\nexport interface DDiagramSerialized {\n\tversion: number;\n\tid?: number;\n\tname: string;\n\twidth: number;\n\theight: number;\n\tbackground?: DDiagramSerializedBackground;\n\ttile?: DDiagramSerializedTile;\n\tresources: string[];\n\t/** @deprecated in favor of {@link data} */\n\ttags?: string[];\n\tdata?: string[];\n\tpieces?: string[];\n\tlayers: DDiagramSerializedLayer[];\n\titems: DDiagramSerializedItem[];\n\tsnap?: DDiagramSerializedSnap;\n\tthumbnail?: string;\n}\n\nexport type DDiagramSerializedSimpleData = Omit<\n\tDDiagramSerialized,\n\t\"version\" | \"id\" | \"name\" | \"thumbnail\"\n>;\n\n/**\n * A simplified version of a serialized diagram.\n */\nexport interface DDiagramSerializedSimple {\n\tversion: number;\n\tid: number | undefined;\n\tname: string;\n\n\t/**\n\t * A stringified {@link DDiagramSerialized#data}.\n\t *\n\t * @deprecated in favor of {@link DDiagramSerializedSimpleData}.\n\t */\n\ttags?: string;\n\n\t/**\n\t * A stringified {@link DDiagramSerialized#pieces}.\n\t *\n\t * @deprecated in favor of {@link DDiagramSerializedSimpleData}.\n\t */\n\tpieces?: string;\n\n\t/**\n\t * Thumbnail data URL.\n\t */\n\tthumbnail?: string;\n\n\t/**\n\t * A stringified {@link DDiagramSerializedSimpleData}.\n\t */\n\tdata: string;\n}\n\nexport interface DDiagramSerializedName {\n\tid: number;\n\tname: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"e-shape-text.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC/B,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;CACE,CAAC;AAIX,MAAM,CAAC,IAAM,eAAe,GAAG;IAC9B,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACA,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Texture } from \"pixi.js\";\nimport { DeepPartial } from \"../util/deep-partial\";\nimport { EShapeResourceManagerDeserialization } from \"./e-shape-resource-manager-deserialization\";\nimport { EShapeResourceManagerSerialization } from \"./e-shape-resource-manager-serialization\";\nimport { EShapeTextAlign, EShapeTextAlignLike } from \"./e-shape-text-align\";\nimport { EShapeTextDirection } from \"./e-shape-text-direction\";\nimport { EShapeTextOffset, EShapeTextOffsetLike } from \"./e-shape-text-offset\";\nimport { EShapeTextOutline, EShapeTextOutlineLike } from \"./e-shape-text-outline\";\n\nexport const EShapeTextWeight = {\n\tNORMAL: 0,\n\tBOLD: 1\n} as const;\n\nexport type EShapeTextWeight = typeof EShapeTextWeight[keyof typeof EShapeTextWeight];\n\nexport const EShapeTextStyle = {\n\tNORMAL: 0,\n\tITALIC: 1\n} as const;\n\nexport type EShapeTextStyle = typeof EShapeTextStyle[keyof typeof EShapeTextStyle];\n\nexport interface EShapeTextLike {\n\tvalue: string;\n\tcolor: number;\n\talpha: number;\n\tfamily: string;\n\tsize: number;\n\tweight: EShapeTextWeight;\n\talign: EShapeTextAlignLike;\n\toffset: EShapeTextOffsetLike;\n\tstyle: EShapeTextStyle;\n\toutline: EShapeTextOutlineLike;\n\tspacing: EShapeTextOffsetLike;\n\tdirection: EShapeTextDirection;\n\tpadding: EShapeTextOffsetLike;\n\tclipping: boolean;\n}\n\nexport interface EShapeTextAtlasCharacter {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n\tadvance: number;\n\torigin: {\n\t\tx: number;\n\t\ty: number;\n\t};\n}\n\nexport type EShapeTextAtlasCharacters = Record<string, EShapeTextAtlasCharacter>;\n\nexport interface EShapeTextAtlas {\n\twidth: number;\n\theight: number;\n\tfont: {\n\t\tsize: number;\n\t};\n\tcharacters: EShapeTextAtlasCharacters;\n}\n\nexport interface EShapeText extends EShapeTextLike {\n\tenable: boolean;\n\n\talign: EShapeTextAlign;\n\toffset: EShapeTextOffset;\n\toutline: EShapeTextOutline;\n\tspacing: EShapeTextOffset;\n\tpadding: EShapeTextOffset;\n\n\ttexture?: Texture; // Used for rendering and updated when rendered\n\tatlas?: EShapeTextAtlas; // Used for rendering and updated when rendered\n\tworld?: number[]; // Updated when rendered\n\n\tcopy(target?: DeepPartial<EShapeTextLike>): this;\n\tset(\n\t\tvalue?: string,\n\t\tcolor?: number,\n\t\talpha?: number,\n\t\tfamily?: string,\n\t\tsize?: number,\n\t\tweight?: EShapeTextWeight,\n\t\tstyle?: EShapeTextStyle,\n\t\tdirection?: EShapeTextDirection,\n\t\tclipping?: boolean\n\t): this;\n\ttoObject(): EShapeTextLike;\n\tserialize(manager: EShapeResourceManagerSerialization): number;\n\tdeserialize(target: number, manager: EShapeResourceManagerDeserialization): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"e-shape-text.js","sourceRoot":"","sources":["../../../../src/main/typescript/wcardinal/ui/shape/e-shape-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,MAAM,CAAC,IAAM,gBAAgB,GAAG;IAC/B,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;CACE,CAAC;AAIX,MAAM,CAAC,IAAM,eAAe,GAAG;IAC9B,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACA,CAAC","sourcesContent":["/*\n * Copyright (C) 2019 Toshiba Corporation\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport { Texture } from \"pixi.js\";\nimport { DeepPartial } from \"../util/deep-partial\";\nimport { EShapeResourceManagerDeserialization } from \"./e-shape-resource-manager-deserialization\";\nimport { EShapeResourceManagerSerialization } from \"./e-shape-resource-manager-serialization\";\nimport { EShapeTextAlign, EShapeTextAlignLike } from \"./e-shape-text-align\";\nimport { EShapeTextDirection } from \"./e-shape-text-direction\";\nimport { EShapeTextOffset, EShapeTextOffsetLike } from \"./e-shape-text-offset\";\nimport { EShapeTextOutline, EShapeTextOutlineLike } from \"./e-shape-text-outline\";\n\nexport const EShapeTextWeight = {\n\tNORMAL: 0,\n\tBOLD: 1\n} as const;\n\nexport type EShapeTextWeight = typeof EShapeTextWeight[keyof typeof EShapeTextWeight];\n\nexport const EShapeTextStyle = {\n\tNORMAL: 0,\n\tITALIC: 1\n} as const;\n\nexport type EShapeTextStyle = typeof EShapeTextStyle[keyof typeof EShapeTextStyle];\n\nexport interface EShapeTextLike {\n\tvalue: string;\n\tcolor: number;\n\talpha: number;\n\tfamily: string;\n\tsize: number;\n\tweight: EShapeTextWeight;\n\talign: EShapeTextAlignLike;\n\toffset: EShapeTextOffsetLike;\n\tstyle: EShapeTextStyle;\n\toutline: EShapeTextOutlineLike;\n\tspacing: EShapeTextOffsetLike;\n\tdirection: EShapeTextDirection;\n\tpadding: EShapeTextOffsetLike;\n\tclipping: boolean;\n\tfitting: boolean;\n}\n\nexport interface EShapeTextAtlasCharacter {\n\tx: number;\n\ty: number;\n\twidth: number;\n\theight: number;\n\tadvance: number;\n\torigin: {\n\t\tx: number;\n\t\ty: number;\n\t};\n}\n\nexport type EShapeTextAtlasCharacters = Record<string, EShapeTextAtlasCharacter>;\n\nexport interface EShapeTextAtlas {\n\twidth: number;\n\theight: number;\n\tfont: {\n\t\tsize: number;\n\t};\n\tcharacters: EShapeTextAtlasCharacters;\n}\n\nexport interface EShapeText extends EShapeTextLike {\n\tenable: boolean;\n\n\talign: EShapeTextAlign;\n\toffset: EShapeTextOffset;\n\toutline: EShapeTextOutline;\n\tspacing: EShapeTextOffset;\n\tpadding: EShapeTextOffset;\n\n\ttexture?: Texture; // Used for rendering and updated when rendered\n\tatlas?: EShapeTextAtlas; // Used for rendering and updated when rendered\n\tworld?: number[]; // Updated when rendered\n\n\tcopy(target?: DeepPartial<EShapeTextLike>): this;\n\tset(\n\t\tvalue?: string,\n\t\tcolor?: number,\n\t\talpha?: number,\n\t\tfamily?: string,\n\t\tsize?: number,\n\t\tweight?: EShapeTextWeight,\n\t\tstyle?: EShapeTextStyle,\n\t\tdirection?: EShapeTextDirection,\n\t\tclipping?: boolean,\n\t\tfitting?: boolean\n\t): this;\n\ttoObject(): EShapeTextLike;\n\tserialize(manager: EShapeResourceManagerSerialization): number;\n\tdeserialize(target: number, manager: EShapeResourceManagerDeserialization): void;\n}\n"]}
|
|
@@ -358,7 +358,7 @@ var invertAlignVertical = function (align) {
|
|
|
358
358
|
return EShapeTextAlignVertical.OUTSIDE_TOP;
|
|
359
359
|
}
|
|
360
360
|
};
|
|
361
|
-
export var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY, sizeX, sizeY, textAtlas, textSize, textValue, textStyle, textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textSpacingHorizontal, textSpacingVertical, textDirection, textPaddingHorizontal, textPaddingVertical, textClipping, textWorld, textureUvs, internalTransform) {
|
|
361
|
+
export var buildTextVertex = function (vertices, uvs, voffset, vcount, originX, originY, sizeX, sizeY, textAtlas, textSize, textValue, textStyle, textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textSpacingHorizontal, textSpacingVertical, textDirection, textPaddingHorizontal, textPaddingVertical, textClipping, textFitting, textWorld, textureUvs, internalTransform) {
|
|
362
362
|
// Calculate the transformed positions
|
|
363
363
|
//
|
|
364
364
|
// 0 1
|
|
@@ -448,6 +448,7 @@ export var buildTextVertex = function (vertices, uvs, voffset, vcount, originX,
|
|
|
448
448
|
var textSizeY = textSize * vnl;
|
|
449
449
|
var lineHeight = Math.max(0, textSize + textSpacingVertical) * vnl;
|
|
450
450
|
var lineWidth = 0;
|
|
451
|
+
var lineCount = 1;
|
|
451
452
|
var textAtlasCharacters = textAtlas.characters;
|
|
452
453
|
var iterator = UtilCharacterIterator.from(textValue);
|
|
453
454
|
var advancePrevious = 0;
|
|
@@ -472,16 +473,41 @@ export var buildTextVertex = function (vertices, uvs, voffset, vcount, originX,
|
|
|
472
473
|
width = Math.max(width, lineWidth);
|
|
473
474
|
lineWidth = 0;
|
|
474
475
|
height += lineHeight;
|
|
476
|
+
lineCount += 1;
|
|
475
477
|
}
|
|
476
478
|
}
|
|
479
|
+
lineWidth += advancePrevious;
|
|
480
|
+
width = Math.max(width, lineWidth);
|
|
481
|
+
height += textSizeY;
|
|
482
|
+
lineWidth = 0;
|
|
483
|
+
if (textFitting && isIn(textAlignHorizontal, textAlignVertical)) {
|
|
484
|
+
var w0 = 0;
|
|
485
|
+
var h0 = 0;
|
|
486
|
+
switch (textDirection) {
|
|
487
|
+
case EShapeTextDirection.LEFT_TO_RIGHT:
|
|
488
|
+
case EShapeTextDirection.RIGHT_TO_LEFT:
|
|
489
|
+
w0 = Math.max(0, hl - textPaddingHorizontal * 2);
|
|
490
|
+
h0 = Math.max(0, vl - textPaddingVertical * 2);
|
|
491
|
+
break;
|
|
492
|
+
case EShapeTextDirection.TOP_TO_BOTTOM:
|
|
493
|
+
case EShapeTextDirection.BOTTOM_TO_TOP:
|
|
494
|
+
w0 = Math.max(0, vl - textPaddingVertical * 2);
|
|
495
|
+
h0 = Math.max(0, hl - textPaddingHorizontal * 2);
|
|
496
|
+
break;
|
|
497
|
+
}
|
|
498
|
+
var w1 = width * hnl * (textSize / textAtlas.font.size);
|
|
499
|
+
var h1 = height;
|
|
500
|
+
var s = Math.min(1, Math.min(w0 / w1, h0 / h1));
|
|
501
|
+
textSize *= s;
|
|
502
|
+
textSizeY *= s;
|
|
503
|
+
lineHeight *= s;
|
|
504
|
+
height *= s;
|
|
505
|
+
}
|
|
477
506
|
var scaleZ = textSize / textAtlas.font.size;
|
|
478
507
|
var scaleX = hnl * scaleZ;
|
|
479
508
|
var scaleY = vnl * scaleZ;
|
|
480
|
-
|
|
481
|
-
width = Math.max(width, lineWidth) * scaleX;
|
|
482
|
-
lineWidth = 0;
|
|
509
|
+
width *= scaleX;
|
|
483
510
|
heightChar *= scaleY;
|
|
484
|
-
height += textSizeY;
|
|
485
511
|
//
|
|
486
512
|
var tx0 = 0;
|
|
487
513
|
var ty0 = 0;
|
|
@@ -491,80 +517,32 @@ export var buildTextVertex = function (vertices, uvs, voffset, vcount, originX,
|
|
|
491
517
|
getTextBBox(textAlignHorizontal, textAlignVertical, textOffsetHorizontal, textOffsetVertical, textPaddingHorizontal, textPaddingVertical, width, height, x0, y0, x1, y1, x2, y2, x3, y3, hnx, hny, vnx, vny, work);
|
|
492
518
|
tx0 = work.x;
|
|
493
519
|
ty0 = work.y;
|
|
494
|
-
if (textClipping) {
|
|
495
|
-
|
|
496
|
-
case EShapeTextAlignHorizontal.LEFT:
|
|
497
|
-
case EShapeTextAlignHorizontal.CENTER:
|
|
498
|
-
case EShapeTextAlignHorizontal.RIGHT:
|
|
499
|
-
switch (textAlignVertical) {
|
|
500
|
-
case EShapeTextAlignVertical.TOP:
|
|
501
|
-
case EShapeTextAlignVertical.MIDDLE:
|
|
502
|
-
case EShapeTextAlignVertical.BOTTOM:
|
|
503
|
-
lineWidthMaximum = hl - textPaddingHorizontal * 2;
|
|
504
|
-
break;
|
|
505
|
-
}
|
|
506
|
-
break;
|
|
507
|
-
}
|
|
520
|
+
if (textClipping && isIn(textAlignHorizontal, textAlignVertical)) {
|
|
521
|
+
lineWidthMaximum = hl - textPaddingHorizontal * 2;
|
|
508
522
|
}
|
|
509
523
|
break;
|
|
510
524
|
case EShapeTextDirection.TOP_TO_BOTTOM:
|
|
511
525
|
getTextBBox(rotateAlignVerticalRight(textAlignVertical), rotateAlignHorizontalRight(textAlignHorizontal), textOffsetVertical, textOffsetHorizontal, textPaddingVertical, textPaddingHorizontal, width, height, x1, y1, x2, y2, x3, y3, x0, y0, hnx, hny, vnx, vny, work);
|
|
512
526
|
tx0 = work.x;
|
|
513
527
|
ty0 = work.y;
|
|
514
|
-
if (textClipping) {
|
|
515
|
-
|
|
516
|
-
case EShapeTextAlignVertical.TOP:
|
|
517
|
-
case EShapeTextAlignVertical.MIDDLE:
|
|
518
|
-
case EShapeTextAlignVertical.BOTTOM:
|
|
519
|
-
switch (textAlignHorizontal) {
|
|
520
|
-
case EShapeTextAlignHorizontal.LEFT:
|
|
521
|
-
case EShapeTextAlignHorizontal.CENTER:
|
|
522
|
-
case EShapeTextAlignHorizontal.RIGHT:
|
|
523
|
-
lineWidthMaximum = vl - textPaddingVertical * 2;
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
break;
|
|
527
|
-
}
|
|
528
|
+
if (textClipping && isIn(textAlignHorizontal, textAlignVertical)) {
|
|
529
|
+
lineWidthMaximum = vl - textPaddingVertical * 2;
|
|
528
530
|
}
|
|
529
531
|
break;
|
|
530
532
|
case EShapeTextDirection.BOTTOM_TO_TOP:
|
|
531
533
|
getTextBBox(rotateAlignVerticalLeft(textAlignVertical), rotateAlignHorizontalLeft(textAlignHorizontal), textOffsetVertical, textOffsetHorizontal, textPaddingVertical, textPaddingHorizontal, width, height, x3, y3, x0, y0, x1, y1, x2, y2, hnx, hny, vnx, vny, work);
|
|
532
534
|
tx0 = work.x;
|
|
533
535
|
ty0 = work.y;
|
|
534
|
-
if (textClipping) {
|
|
535
|
-
|
|
536
|
-
case EShapeTextAlignVertical.TOP:
|
|
537
|
-
case EShapeTextAlignVertical.MIDDLE:
|
|
538
|
-
case EShapeTextAlignVertical.BOTTOM:
|
|
539
|
-
switch (textAlignHorizontal) {
|
|
540
|
-
case EShapeTextAlignHorizontal.LEFT:
|
|
541
|
-
case EShapeTextAlignHorizontal.CENTER:
|
|
542
|
-
case EShapeTextAlignHorizontal.RIGHT:
|
|
543
|
-
lineWidthMaximum = vl - textPaddingVertical * 2;
|
|
544
|
-
break;
|
|
545
|
-
}
|
|
546
|
-
break;
|
|
547
|
-
}
|
|
536
|
+
if (textClipping && isIn(textAlignHorizontal, textAlignVertical)) {
|
|
537
|
+
lineWidthMaximum = vl - textPaddingVertical * 2;
|
|
548
538
|
}
|
|
549
539
|
break;
|
|
550
540
|
case EShapeTextDirection.RIGHT_TO_LEFT:
|
|
551
541
|
getTextBBox(invertAlignHorizontal(textAlignHorizontal), invertAlignVertical(textAlignVertical), textOffsetHorizontal, textOffsetVertical, textPaddingHorizontal, textPaddingVertical, width, height, x2, y2, x3, y3, x0, y0, x1, y1, hnx, hny, vnx, vny, work);
|
|
552
542
|
tx0 = work.x;
|
|
553
543
|
ty0 = work.y;
|
|
554
|
-
if (textClipping) {
|
|
555
|
-
|
|
556
|
-
case EShapeTextAlignHorizontal.LEFT:
|
|
557
|
-
case EShapeTextAlignHorizontal.CENTER:
|
|
558
|
-
case EShapeTextAlignHorizontal.RIGHT:
|
|
559
|
-
switch (textAlignVertical) {
|
|
560
|
-
case EShapeTextAlignVertical.TOP:
|
|
561
|
-
case EShapeTextAlignVertical.MIDDLE:
|
|
562
|
-
case EShapeTextAlignVertical.BOTTOM:
|
|
563
|
-
lineWidthMaximum = hl - textPaddingHorizontal * 2;
|
|
564
|
-
break;
|
|
565
|
-
}
|
|
566
|
-
break;
|
|
567
|
-
}
|
|
544
|
+
if (textClipping && isIn(textAlignHorizontal, textAlignVertical)) {
|
|
545
|
+
lineWidthMaximum = hl - textPaddingHorizontal * 2;
|
|
568
546
|
}
|
|
569
547
|
break;
|
|
570
548
|
}
|
|
@@ -625,7 +603,7 @@ export var buildTextVertex = function (vertices, uvs, voffset, vcount, originX,
|
|
|
625
603
|
lineWidth = 0;
|
|
626
604
|
advancePrevious = 0;
|
|
627
605
|
iterator.position = 0;
|
|
628
|
-
|
|
606
|
+
lineCount = 0;
|
|
629
607
|
var iv = voffset * 2;
|
|
630
608
|
for (; iterator.hasNext(); iv += 8) {
|
|
631
609
|
var character = iterator.next();
|
|
@@ -713,6 +691,22 @@ export var buildTextVertex = function (vertices, uvs, voffset, vcount, originX,
|
|
|
713
691
|
uvs[iv + 1] = uvy0;
|
|
714
692
|
}
|
|
715
693
|
};
|
|
694
|
+
var isIn = function (textAlignHorizontal, textAlignVertical) {
|
|
695
|
+
switch (textAlignHorizontal) {
|
|
696
|
+
case EShapeTextAlignHorizontal.LEFT:
|
|
697
|
+
case EShapeTextAlignHorizontal.CENTER:
|
|
698
|
+
case EShapeTextAlignHorizontal.RIGHT:
|
|
699
|
+
switch (textAlignVertical) {
|
|
700
|
+
case EShapeTextAlignVertical.TOP:
|
|
701
|
+
case EShapeTextAlignVertical.MIDDLE:
|
|
702
|
+
case EShapeTextAlignVertical.BOTTOM:
|
|
703
|
+
return true;
|
|
704
|
+
break;
|
|
705
|
+
}
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
return false;
|
|
709
|
+
};
|
|
716
710
|
var writeCharacterEmpty = function (vertices, uvs, iv, cx0, cy0, cx3, cy3, uvx0, uvy0, uvx3, uvy3) {
|
|
717
711
|
vertices[iv + 0] = cx0;
|
|
718
712
|
vertices[iv + 1] = cy0;
|