laymur 0.2.18 → 0.3.3
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/README.md +87 -274
- package/dist/builders/UIConstraint2DBuilder.d.ts +1 -1
- package/dist/builders/UICoverConstraintBuilder.d.ts +3 -1
- package/dist/builders/UIFitConstraintBuilder.d.ts +3 -1
- package/dist/constraints/UIAspectConstraint.d.ts +0 -1
- package/dist/constraints/UIConstraint.d.ts +3 -0
- package/dist/constraints/UIHorizontalDistanceConstraint.d.ts +0 -1
- package/dist/constraints/UIHorizontalProportionConstraint.d.ts +2 -3
- package/dist/constraints/UISingleParameterConstraint.d.ts +0 -2
- package/dist/constraints/UIVerticalDistanceConstraint.d.ts +0 -1
- package/dist/constraints/UIVerticalProportionConstraint.d.ts +2 -3
- package/dist/elements/UIDummy.d.ts +7 -1
- package/dist/elements/UIElement.d.ts +52 -38
- package/dist/elements/UIImage.d.ts +30 -42
- package/dist/elements/UINineSline.d.ts +61 -68
- package/dist/elements/UIProgress.d.ts +86 -110
- package/dist/elements/UIScene.d.ts +21 -30
- package/dist/elements/UIText.d.ts +27 -41
- package/dist/index.d.ts +6 -1
- package/dist/index.js +1663 -939
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/layers/UIFullscreenLayer.d.ts +0 -4
- package/dist/layers/UILayer.d.ts +62 -4
- package/dist/miscellaneous/UIColor.d.ts +171 -0
- package/dist/miscellaneous/UIGenericInstancedPlane.d.ts +32 -0
- package/dist/miscellaneous/UIInputEvent.d.ts +7 -0
- package/dist/miscellaneous/UIMicro.d.ts +3 -3
- package/dist/miscellaneous/{UIAnchorMode.d.ts → UIMicroAnchorMode.d.ts} +1 -1
- package/dist/miscellaneous/UINineSliceBorder.d.ts +6 -6
- package/dist/miscellaneous/UISceneWrapperClientAPI.d.ts +12 -0
- package/dist/miscellaneous/UITextPadding.d.ts +1 -1
- package/dist/miscellaneous/UITransparencyMode.d.ts +26 -0
- package/dist/miscellaneous/asserts.d.ts +9 -9
- package/dist/miscellaneous/textTools.d.ts +4 -4
- package/dist/wrappers/UISceneWrapper.d.ts +21 -14
- package/dist/wrappers/UISolverWrapper.d.ts +185 -0
- package/package.json +7 -4
- package/dist/materials/UIMaterial.d.ts +0 -13
- package/dist/materials/UINineSliceMaterial.d.ts +0 -27
- package/dist/materials/UIProgressMaterial.d.ts +0 -29
- package/dist/miscellaneous/threeInstances.d.ts +0 -2
- package/dist/scalable/UIScalableMesh.d.ts +0 -16
- package/dist/scalable/UIScalablePlaneMesh.d.ts +0 -14
|
@@ -1,31 +1,43 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Mesh } from "three";
|
|
1
|
+
import { Texture } from "three";
|
|
3
2
|
import type { UILayer } from "../layers/UILayer";
|
|
3
|
+
import { UIColor } from "../miscellaneous/UIColor";
|
|
4
4
|
import { UIElement } from "./UIElement";
|
|
5
|
+
/**
|
|
6
|
+
* Predefined mask functions that control how the progress bar fills.
|
|
7
|
+
* Each function defines a different fill pattern using GLSL shader code.
|
|
8
|
+
*/
|
|
9
|
+
export declare enum UIProgressMaskFunction {
|
|
10
|
+
/** Fill horizontally from left to right (or right to left if inverse) */
|
|
11
|
+
HORIZONTAL = "float calculateMask() {\n return step((direction * io_UV.x + (1.0 - direction) * 0.5), progress);\n }",
|
|
12
|
+
/** Fill vertically from bottom to top (or top to bottom if inverse) */
|
|
13
|
+
VERTICAL = "float calculateMask() {\n return step((direction * io_UV.y + (1.0 - direction) * 0.5), progress);\n }",
|
|
14
|
+
/** Fill diagonally from bottom-left to top-right */
|
|
15
|
+
DIAGONAL = "float calculateMask() {\n float d = (io_UV.x + io_UV.y) * (0.1);\n return step((direction * d + (1.0 - direction) * 0.5), progress);\n }",
|
|
16
|
+
/** Fill in a circular pattern around the center */
|
|
17
|
+
CIRCLE = "float calculateMask() {\n vec2 p = io_UV - 0.5;\n float angle = atan(p.y, p.x);\n angle = (angle + 3.14159265) / 3.14159265;\n angle *= 0.5;\n return step((direction * angle + (1.0 - direction) * 0.5), progress);\n }"
|
|
18
|
+
}
|
|
5
19
|
/**
|
|
6
20
|
* Configuration options for creating a UIProgress element.
|
|
7
21
|
*/
|
|
8
22
|
export interface UIProgressOptions {
|
|
9
23
|
/** X position of the element */
|
|
10
|
-
x
|
|
24
|
+
x?: number;
|
|
11
25
|
/** Y position of the element */
|
|
12
|
-
y
|
|
13
|
-
/** Optional background texture (if not provided,
|
|
14
|
-
|
|
26
|
+
y?: number;
|
|
27
|
+
/** Optional background texture (if not provided, default texture is used) */
|
|
28
|
+
backgroundTexture?: Texture;
|
|
29
|
+
/** Overall color tint applied to the entire progress bar */
|
|
30
|
+
color?: UIColor;
|
|
31
|
+
/** Foreground color tint applied to the filled portion */
|
|
32
|
+
foregroundColor?: UIColor;
|
|
33
|
+
/** Background color tint applied to the unfilled portion */
|
|
34
|
+
backgroundColor?: UIColor;
|
|
35
|
+
/** Mask function that defines how the progress bar fills (predefined enum or custom GLSL code) */
|
|
36
|
+
maskFunction?: UIProgressMaskFunction | string;
|
|
15
37
|
/** Progress value between 0.0 (empty) and 1.0 (full) */
|
|
16
|
-
progress
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
/** Angle of progress fill in degrees (0 = horizontal, 90 = vertical) */
|
|
20
|
-
angle: number;
|
|
21
|
-
/** Background color tint as hex number (e.g., 0xFFFFFF) */
|
|
22
|
-
backgroundColor: number;
|
|
23
|
-
/** Foreground color tint as hex number (e.g., 0xFFFFFF) */
|
|
24
|
-
foregroundColor: number;
|
|
25
|
-
/** Background opacity between 0.0 (transparent) and 1.0 (opaque) */
|
|
26
|
-
backgroundOpacity: number;
|
|
27
|
-
/** Foreground opacity between 0.0 (transparent) and 1.0 (opaque) */
|
|
28
|
-
foregroundOpacity: number;
|
|
38
|
+
progress?: number;
|
|
39
|
+
/** Whether to fill in reverse direction (true for reverse, false for normal) */
|
|
40
|
+
inverseDirection?: boolean;
|
|
29
41
|
}
|
|
30
42
|
/**
|
|
31
43
|
* Progress bar UI element with customizable fill direction and appearance.
|
|
@@ -37,86 +49,64 @@ export interface UIProgressOptions {
|
|
|
37
49
|
* The progress value ranges from 0.0 (empty) to 1.0 (completely filled).
|
|
38
50
|
* The fill direction can be controlled both by angle and forward/reverse direction.
|
|
39
51
|
*/
|
|
40
|
-
export declare class UIProgress extends UIElement
|
|
41
|
-
|
|
52
|
+
export declare class UIProgress extends UIElement {
|
|
53
|
+
/** Internal storage for the foreground texture */
|
|
54
|
+
private foregroundTextureInternal;
|
|
55
|
+
/** Internal storage for the optional background texture */
|
|
56
|
+
private backgroundTextureInternal?;
|
|
57
|
+
/** Internal storage for the overall color tint */
|
|
58
|
+
private readonly colorInternal;
|
|
59
|
+
/** Internal storage for the foreground color tint */
|
|
60
|
+
private readonly foregroundColorInternal;
|
|
61
|
+
/** Internal storage for the background color tint */
|
|
62
|
+
private readonly backgroundColorInternal;
|
|
63
|
+
/** Internal storage for the current progress value */
|
|
64
|
+
private progressInternal;
|
|
65
|
+
/** Internal storage for the fill direction flag */
|
|
66
|
+
private inverseDirectionInternal;
|
|
42
67
|
/**
|
|
43
68
|
* Creates a new progress bar UI element.
|
|
44
69
|
*
|
|
45
70
|
* @param layer - The UI layer to add this element to
|
|
46
|
-
* @param
|
|
71
|
+
* @param foregroundTexture - The texture used for the progress fill
|
|
47
72
|
* @param options - Configuration options for the progress bar
|
|
48
73
|
*/
|
|
49
|
-
constructor(layer: UILayer,
|
|
74
|
+
constructor(layer: UILayer, foregroundTexture: Texture, options?: Partial<UIProgressOptions>);
|
|
50
75
|
/**
|
|
51
|
-
* Gets the
|
|
52
|
-
* @returns
|
|
76
|
+
* Gets the foreground (fill) texture.
|
|
77
|
+
* @returns The foreground texture
|
|
53
78
|
*/
|
|
54
|
-
get
|
|
79
|
+
get foregroundTexture(): Texture;
|
|
55
80
|
/**
|
|
56
81
|
* Gets the background texture.
|
|
57
82
|
* @returns The background texture, or undefined if none is set
|
|
58
83
|
*/
|
|
59
84
|
get backgroundTexture(): Texture | undefined;
|
|
60
|
-
/**
|
|
61
|
-
* Gets the foreground (fill) texture.
|
|
62
|
-
* @returns The foreground texture
|
|
63
|
-
*/
|
|
64
|
-
get foregroundTexture(): Texture;
|
|
65
85
|
/**
|
|
66
86
|
* Gets the color tint.
|
|
67
|
-
* @returns The
|
|
87
|
+
* @returns The UIColor instance
|
|
68
88
|
*/
|
|
69
|
-
get color():
|
|
70
|
-
/**
|
|
71
|
-
* Gets the background color tint.
|
|
72
|
-
* @returns The background color as a hex number (e.g., 0xFFFFFF)
|
|
73
|
-
*/
|
|
74
|
-
get backgroundColor(): number;
|
|
89
|
+
get color(): UIColor;
|
|
75
90
|
/**
|
|
76
91
|
* Gets the foreground color tint.
|
|
77
|
-
* @returns The foreground color
|
|
78
|
-
*/
|
|
79
|
-
get foregroundColor(): number;
|
|
80
|
-
/**
|
|
81
|
-
* Gets the opacity.
|
|
82
|
-
* @returns Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
83
|
-
*/
|
|
84
|
-
get opacity(): number;
|
|
85
|
-
/**
|
|
86
|
-
* Gets the background opacity.
|
|
87
|
-
* @returns Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
92
|
+
* @returns The foreground color UIColor instance
|
|
88
93
|
*/
|
|
89
|
-
get
|
|
94
|
+
get foregroundColor(): UIColor;
|
|
90
95
|
/**
|
|
91
|
-
* Gets the
|
|
92
|
-
* @returns
|
|
93
|
-
*/
|
|
94
|
-
get foregroundOpacity(): number;
|
|
95
|
-
/**
|
|
96
|
-
* Gets whether transparency is enabled for the image.
|
|
97
|
-
* @returns True if transparency is enabled, false otherwise
|
|
98
|
-
*/
|
|
99
|
-
get transparency(): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Gets the progress fill angle in degrees.
|
|
102
|
-
* @returns Angle in degrees (0 = horizontal, 90 = vertical)
|
|
103
|
-
*/
|
|
104
|
-
get angle(): number;
|
|
105
|
-
/**
|
|
106
|
-
* Gets whether the progress fills in forward direction.
|
|
107
|
-
* @returns True if filling forward, false if filling in reverse
|
|
96
|
+
* Gets the background color tint.
|
|
97
|
+
* @returns The background color UIColor instance
|
|
108
98
|
*/
|
|
109
|
-
get
|
|
99
|
+
get backgroundColor(): UIColor;
|
|
110
100
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @
|
|
101
|
+
* Gets the current progress value.
|
|
102
|
+
* @returns Progress value between 0.0 (empty) and 1.0 (full)
|
|
113
103
|
*/
|
|
114
|
-
|
|
104
|
+
get progress(): number;
|
|
115
105
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @
|
|
106
|
+
* Gets whether the progress fills in reverse direction.
|
|
107
|
+
* @returns True if filling in reverse, false if filling forward
|
|
118
108
|
*/
|
|
119
|
-
|
|
109
|
+
get inverseDirection(): boolean;
|
|
120
110
|
/**
|
|
121
111
|
* Sets the foreground (fill) texture.
|
|
122
112
|
*
|
|
@@ -128,54 +118,40 @@ export declare class UIProgress extends UIElement<Mesh> {
|
|
|
128
118
|
*/
|
|
129
119
|
set foregroundTexture(value: Texture);
|
|
130
120
|
/**
|
|
131
|
-
* Sets the
|
|
132
|
-
* @param value - The
|
|
121
|
+
* Sets the background texture.
|
|
122
|
+
* @param value - The background texture, or undefined to remove background
|
|
133
123
|
*/
|
|
134
|
-
set
|
|
124
|
+
set backgroundTexture(value: Texture | undefined);
|
|
135
125
|
/**
|
|
136
|
-
* Sets the
|
|
137
|
-
* @param value - The
|
|
126
|
+
* Sets the color tint.
|
|
127
|
+
* @param value - The UIColor instance
|
|
138
128
|
*/
|
|
139
|
-
set
|
|
129
|
+
set color(value: UIColor);
|
|
140
130
|
/**
|
|
141
131
|
* Sets the foreground color tint.
|
|
142
|
-
* @param value - The foreground color
|
|
143
|
-
*/
|
|
144
|
-
set foregroundColor(value: number);
|
|
145
|
-
/**
|
|
146
|
-
* Sets the opacity.
|
|
147
|
-
* @param value - Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
148
|
-
*/
|
|
149
|
-
set opacity(value: number);
|
|
150
|
-
/**
|
|
151
|
-
* Sets the background opacity.
|
|
152
|
-
* @param value - Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
153
|
-
*/
|
|
154
|
-
set backgroundOpacity(value: number);
|
|
155
|
-
/**
|
|
156
|
-
* Sets the foreground opacity.
|
|
157
|
-
* @param value - Opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
132
|
+
* @param value - The foreground color UIColor instance
|
|
158
133
|
*/
|
|
159
|
-
set
|
|
134
|
+
set foregroundColor(value: UIColor);
|
|
160
135
|
/**
|
|
161
|
-
* Sets
|
|
162
|
-
* @param value -
|
|
163
|
-
*/
|
|
164
|
-
set transparency(value: boolean);
|
|
165
|
-
/**
|
|
166
|
-
* Sets the progress fill angle.
|
|
167
|
-
* @param value - Angle in degrees (0 = horizontal, 90 = vertical)
|
|
136
|
+
* Sets the background color tint.
|
|
137
|
+
* @param value - The background color UIColor instance
|
|
168
138
|
*/
|
|
169
|
-
set
|
|
139
|
+
set backgroundColor(value: UIColor);
|
|
170
140
|
/**
|
|
171
141
|
* Sets the progress fill direction.
|
|
172
|
-
* @param value - True for
|
|
142
|
+
* @param value - True for reverse direction, false for forward
|
|
173
143
|
*/
|
|
174
|
-
set
|
|
144
|
+
set inverseDirection(value: boolean);
|
|
175
145
|
/**
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* This method disposes of the material and calls the parent destroy method.
|
|
146
|
+
* Sets the progress value.
|
|
147
|
+
* @param value - Progress value between 0.0 (empty) and 1.0 (full)
|
|
179
148
|
*/
|
|
149
|
+
set progress(value: number);
|
|
180
150
|
destroy(): void;
|
|
151
|
+
/** Event handler for when the overall color changes */
|
|
152
|
+
private readonly onColorChange;
|
|
153
|
+
/** Event handler for when the foreground color changes */
|
|
154
|
+
private readonly onForegroundColorChange;
|
|
155
|
+
/** Event handler for when the background color changes */
|
|
156
|
+
private readonly onBackgroundColorChange;
|
|
181
157
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Camera } from "three";
|
|
2
|
-
import {
|
|
1
|
+
import type { Camera, WebGLRenderer } from "three";
|
|
2
|
+
import { Scene } from "three";
|
|
3
3
|
import { type UILayer } from "../layers/UILayer";
|
|
4
|
+
import { UIColor } from "../miscellaneous/UIColor";
|
|
4
5
|
import { UIElement } from "./UIElement";
|
|
5
6
|
/**
|
|
6
7
|
* Update modes for controlling when the 3D scene should be re-rendered.
|
|
@@ -27,6 +28,8 @@ export interface UISceneOptions {
|
|
|
27
28
|
width: number;
|
|
28
29
|
/** Height of the scene render target in pixels. */
|
|
29
30
|
height: number;
|
|
31
|
+
/** Color tint applied to the scene texture. */
|
|
32
|
+
color: UIColor;
|
|
30
33
|
/** Three.js scene to render. */
|
|
31
34
|
scene: Scene;
|
|
32
35
|
/** Camera to use for rendering the scene. */
|
|
@@ -56,11 +59,11 @@ export interface UISceneOptions {
|
|
|
56
59
|
* @see {@link Scene} - Three.js scene for 3D content
|
|
57
60
|
* @see {@link Camera} - Three.js camera for scene rendering
|
|
58
61
|
*/
|
|
59
|
-
export declare class UIScene extends UIElement
|
|
60
|
-
/** The material used for rendering the scene texture. */
|
|
61
|
-
private readonly material;
|
|
62
|
+
export declare class UIScene extends UIElement {
|
|
62
63
|
/** The WebGL render target for off-screen scene rendering. */
|
|
63
64
|
private readonly renderTarget;
|
|
65
|
+
/** Internal storage for the color tint. */
|
|
66
|
+
private readonly colorInternal;
|
|
64
67
|
/** Internal storage for the current Three.js scene. */
|
|
65
68
|
private sceneInternal;
|
|
66
69
|
/** Internal storage for the current camera. */
|
|
@@ -93,19 +96,9 @@ export declare class UIScene extends UIElement<Mesh> {
|
|
|
93
96
|
constructor(layer: UILayer, options?: Partial<UISceneOptions>);
|
|
94
97
|
/**
|
|
95
98
|
* Gets the current color tint applied to the scene texture.
|
|
96
|
-
* @returns The
|
|
99
|
+
* @returns The UIColor instance
|
|
97
100
|
*/
|
|
98
|
-
get color():
|
|
99
|
-
/**
|
|
100
|
-
* Gets the current opacity level of the scene texture.
|
|
101
|
-
* @returns The opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
102
|
-
*/
|
|
103
|
-
get opacity(): number;
|
|
104
|
-
/**
|
|
105
|
-
* Gets whether transparency is enabled for the scene texture.
|
|
106
|
-
* @returns True if transparency is enabled, false otherwise
|
|
107
|
-
*/
|
|
108
|
-
get transparency(): boolean;
|
|
101
|
+
get color(): UIColor;
|
|
109
102
|
/**
|
|
110
103
|
* Gets the Three.js scene being rendered.
|
|
111
104
|
* @returns The current Three.js scene
|
|
@@ -138,19 +131,9 @@ export declare class UIScene extends UIElement<Mesh> {
|
|
|
138
131
|
get clearAlpha(): number;
|
|
139
132
|
/**
|
|
140
133
|
* Sets the color tint applied to the scene texture.
|
|
141
|
-
* @param value - The
|
|
142
|
-
*/
|
|
143
|
-
set color(value: number);
|
|
144
|
-
/**
|
|
145
|
-
* Sets the opacity level of the scene texture.
|
|
146
|
-
* @param value - The opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
147
|
-
*/
|
|
148
|
-
set opacity(value: number);
|
|
149
|
-
/**
|
|
150
|
-
* Sets whether transparency is enabled for the scene texture.
|
|
151
|
-
* @param value - True to enable transparency, false to disable
|
|
134
|
+
* @param value - The UIColor instance
|
|
152
135
|
*/
|
|
153
|
-
set
|
|
136
|
+
set color(value: UIColor);
|
|
154
137
|
/**
|
|
155
138
|
* Sets a new Three.js scene to render and marks for re-render.
|
|
156
139
|
* @param value - The new Three.js scene
|
|
@@ -196,5 +179,13 @@ export declare class UIScene extends UIElement<Mesh> {
|
|
|
196
179
|
* want to trigger a scene re-render without changing any properties.
|
|
197
180
|
*/
|
|
198
181
|
requestRender(): void;
|
|
199
|
-
|
|
182
|
+
/**
|
|
183
|
+
* Called before each render frame to update the 3D scene rendering.
|
|
184
|
+
* Handles different update modes and renders the 3D scene to the render target
|
|
185
|
+
* based on the current update mode and property change state.
|
|
186
|
+
* @param renderer - The WebGL renderer used for scene rendering
|
|
187
|
+
*/
|
|
188
|
+
protected onWillRender(renderer: WebGLRenderer): void;
|
|
189
|
+
/** Event handler for when the color changes */
|
|
190
|
+
private readonly onColorChange;
|
|
200
191
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { WebGLRenderer } from "three";
|
|
2
2
|
import { type UILayer } from "../layers/UILayer";
|
|
3
3
|
import type { UITextContent } from "../miscellaneous/textInterfaces";
|
|
4
|
+
import { UIColor } from "../miscellaneous/UIColor";
|
|
4
5
|
import { type UITextPadding } from "../miscellaneous/UITextPadding";
|
|
5
6
|
import { type UITextStyle } from "../miscellaneous/UITextStyle";
|
|
6
7
|
import { UIElement } from "./UIElement";
|
|
@@ -8,16 +9,18 @@ import { UIElement } from "./UIElement";
|
|
|
8
9
|
* Configuration options for UIText element creation.
|
|
9
10
|
*/
|
|
10
11
|
export interface UITextOptions {
|
|
12
|
+
/** X-coordinate of the text element. */
|
|
13
|
+
x: number;
|
|
14
|
+
/** Y-coordinate of the text element. */
|
|
15
|
+
y: number;
|
|
16
|
+
/** Color tint applied to the text. */
|
|
17
|
+
color: UIColor;
|
|
11
18
|
/** Maximum width in pixels before text wrapping occurs. */
|
|
12
19
|
maxWidth: number;
|
|
13
20
|
/** Padding configuration for text content. */
|
|
14
21
|
padding: Partial<UITextPadding>;
|
|
15
22
|
/** Common style properties applied to all text content. */
|
|
16
23
|
commonStyle: Partial<UITextStyle>;
|
|
17
|
-
/** X-coordinate of the text element. */
|
|
18
|
-
x: number;
|
|
19
|
-
/** Y-coordinate of the text element. */
|
|
20
|
-
y: number;
|
|
21
24
|
}
|
|
22
25
|
/**
|
|
23
26
|
* UI element for rendering dynamic text with canvas-based rendering.
|
|
@@ -33,15 +36,15 @@ export interface UITextOptions {
|
|
|
33
36
|
* @see {@link UITextStyle} - Text styling options
|
|
34
37
|
* @see {@link UITextPadding} - Padding configuration
|
|
35
38
|
*/
|
|
36
|
-
export declare class UIText extends UIElement
|
|
37
|
-
/** The material used for rendering the text texture. */
|
|
38
|
-
private readonly material;
|
|
39
|
-
/** The canvas texture containing the rendered text. */
|
|
40
|
-
private readonly texture;
|
|
39
|
+
export declare class UIText extends UIElement {
|
|
41
40
|
/** The HTML canvas element used for text rendering. */
|
|
42
41
|
private readonly canvas;
|
|
43
42
|
/** The 2D rendering context for drawing text on the canvas. */
|
|
44
43
|
private readonly context;
|
|
44
|
+
/** The canvas texture containing the rendered text. */
|
|
45
|
+
private readonly texture;
|
|
46
|
+
/** Internal storage for the color tint. */
|
|
47
|
+
private readonly colorInternal;
|
|
45
48
|
/** Internal storage for the current text content. */
|
|
46
49
|
private contentInternal;
|
|
47
50
|
/** Internal storage for the maximum width before text wrapping. */
|
|
@@ -64,26 +67,14 @@ export declare class UIText extends UIElement<Mesh> {
|
|
|
64
67
|
* @param layer - The UI layer that contains this text element
|
|
65
68
|
* @param content - The text content to display
|
|
66
69
|
* @param options - Configuration options for text rendering
|
|
67
|
-
* @param x - Initial x-coordinate position (defaults to 0)
|
|
68
|
-
* @param y - Initial y-coordinate position (defaults to 0)
|
|
69
70
|
* @throws Will throw an error if canvas context creation fails
|
|
70
71
|
*/
|
|
71
72
|
constructor(layer: UILayer, content: UITextContent, options?: Partial<UITextOptions>);
|
|
72
73
|
/**
|
|
73
74
|
* Gets the current color tint applied to the text.
|
|
74
|
-
* @returns The
|
|
75
|
+
* @returns The UIColor instance
|
|
75
76
|
*/
|
|
76
|
-
get color():
|
|
77
|
-
/**
|
|
78
|
-
* Gets the current opacity level of the text.
|
|
79
|
-
* @returns The opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
80
|
-
*/
|
|
81
|
-
get opacity(): number;
|
|
82
|
-
/**
|
|
83
|
-
* Gets whether transparency is enabled for the text.
|
|
84
|
-
* @returns True if transparency is enabled, false otherwise
|
|
85
|
-
*/
|
|
86
|
-
get transparency(): boolean;
|
|
77
|
+
get color(): UIColor;
|
|
87
78
|
/**
|
|
88
79
|
* Gets the current text content being displayed.
|
|
89
80
|
* @returns The current text content structure
|
|
@@ -106,19 +97,9 @@ export declare class UIText extends UIElement<Mesh> {
|
|
|
106
97
|
get commonStyle(): Partial<UITextStyle>;
|
|
107
98
|
/**
|
|
108
99
|
* Sets the color tint applied to the text.
|
|
109
|
-
* @param value - The
|
|
110
|
-
*/
|
|
111
|
-
set color(value: number);
|
|
112
|
-
/**
|
|
113
|
-
* Sets the opacity level of the text.
|
|
114
|
-
* @param value - The opacity value between 0.0 (transparent) and 1.0 (opaque)
|
|
100
|
+
* @param value - The UIColor instance
|
|
115
101
|
*/
|
|
116
|
-
set
|
|
117
|
-
/**
|
|
118
|
-
* Sets whether transparency is enabled for the text.
|
|
119
|
-
* @param value - True to enable transparency, false to disable
|
|
120
|
-
*/
|
|
121
|
-
set transparency(value: boolean);
|
|
102
|
+
set color(value: UIColor);
|
|
122
103
|
/**
|
|
123
104
|
* Sets new text content and triggers a rebuild.
|
|
124
105
|
* @param value - The new text content structure
|
|
@@ -142,21 +123,26 @@ export declare class UIText extends UIElement<Mesh> {
|
|
|
142
123
|
/**
|
|
143
124
|
* Destroys the text element by cleaning up all associated resources.
|
|
144
125
|
*
|
|
145
|
-
* This method disposes of the
|
|
146
|
-
* the canvas element from the DOM, and calls the parent destroy method
|
|
126
|
+
* This method disposes of the texture resources and calls the parent destroy method
|
|
147
127
|
* to clean up the underlying UI element. After calling this method,
|
|
148
128
|
* the text element should not be used anymore.
|
|
149
129
|
*/
|
|
150
130
|
destroy(): void;
|
|
151
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Called before each render frame to maintain proper text aspect ratio.
|
|
133
|
+
* Adjusts the height based on the target aspect ratio calculated from text content.
|
|
134
|
+
* @param renderer - The WebGL renderer
|
|
135
|
+
* @param deltaTime - Time since last frame in seconds
|
|
136
|
+
*/
|
|
137
|
+
protected onWillRender(renderer: WebGLRenderer, deltaTime: number): void;
|
|
152
138
|
/**
|
|
153
139
|
* Rebuilds the text canvas and texture based on current content and settings.
|
|
154
140
|
*
|
|
155
141
|
* This method calculates the text layout, resizes the canvas to fit the content
|
|
156
142
|
* with padding, renders the text lines to the canvas, and updates the texture.
|
|
157
143
|
* It also calculates and sets the target aspect ratio for proper display.
|
|
158
|
-
*
|
|
159
|
-
* @private
|
|
160
144
|
*/
|
|
161
145
|
private rebuildText;
|
|
146
|
+
/** Event handler for when the color changes */
|
|
147
|
+
private readonly onColorChange;
|
|
162
148
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,13 +21,18 @@ export * from "./elements/UIScene";
|
|
|
21
21
|
export * from "./elements/UIText";
|
|
22
22
|
export * from "./layers/UIFullscreenLayer";
|
|
23
23
|
export * from "./layers/UILayer";
|
|
24
|
-
export * from "./miscellaneous/
|
|
24
|
+
export * from "./miscellaneous/UIColor";
|
|
25
25
|
export * from "./miscellaneous/UIExpression";
|
|
26
|
+
export * from "./miscellaneous/UIGenericInstancedPlane";
|
|
27
|
+
export * from "./miscellaneous/UIInputEvent";
|
|
26
28
|
export * from "./miscellaneous/UIMicro";
|
|
29
|
+
export * from "./miscellaneous/UIMicroAnchorMode";
|
|
27
30
|
export * from "./miscellaneous/UIMode";
|
|
28
31
|
export * from "./miscellaneous/UIOrientation";
|
|
29
32
|
export * from "./miscellaneous/UIPriority";
|
|
30
33
|
export * from "./miscellaneous/UIRelation";
|
|
34
|
+
export * from "./miscellaneous/UISceneWrapperClientAPI";
|
|
31
35
|
export * from "./miscellaneous/UITextPadding";
|
|
32
36
|
export * from "./miscellaneous/UITextSpan";
|
|
33
37
|
export * from "./miscellaneous/UITextStyle";
|
|
38
|
+
export * from "./miscellaneous/UITransparencyMode";
|