laymur 0.2.18 → 0.3.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/README.md +17 -18
- 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 +4 -1
- package/dist/index.js +1236 -941
- 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 +50 -3
- package/dist/miscellaneous/UIColor.d.ts +171 -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 +10 -0
- package/dist/miscellaneous/UITextPadding.d.ts +1 -1
- package/dist/miscellaneous/UITransparencyMode.d.ts +26 -0
- package/dist/miscellaneous/textTools.d.ts +4 -4
- package/dist/scalable/UIScalableMesh.d.ts +0 -16
- package/dist/scalable/UIScalablePlaneMesh.d.ts +0 -14
- package/dist/wrappers/UISceneWrapper.d.ts +17 -15
- package/dist/wrappers/UISolverWrapper.d.ts +185 -0
- package/package.json +1 -1
- 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
|
@@ -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,9 +21,11 @@ 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/UIInputEvent";
|
|
26
27
|
export * from "./miscellaneous/UIMicro";
|
|
28
|
+
export * from "./miscellaneous/UIMicroAnchorMode";
|
|
27
29
|
export * from "./miscellaneous/UIMode";
|
|
28
30
|
export * from "./miscellaneous/UIOrientation";
|
|
29
31
|
export * from "./miscellaneous/UIPriority";
|
|
@@ -31,3 +33,4 @@ export * from "./miscellaneous/UIRelation";
|
|
|
31
33
|
export * from "./miscellaneous/UITextPadding";
|
|
32
34
|
export * from "./miscellaneous/UITextSpan";
|
|
33
35
|
export * from "./miscellaneous/UITextStyle";
|
|
36
|
+
export * from "./miscellaneous/UITransparencyMode";
|