laymur 0.2.0 → 0.2.2

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.
Files changed (64) hide show
  1. package/README.md +353 -2
  2. package/dist/builders/UIConstraint2DBuilder.d.ts +102 -14
  3. package/dist/composer/UIComposer.d.ts +0 -0
  4. package/dist/composer/UIFullscreenQuad.d.ts +0 -0
  5. package/dist/composer/UIPass.d.ts +0 -0
  6. package/dist/constraints/UIAspectConstraint.d.ts +40 -36
  7. package/dist/constraints/UIConstraint.d.ts +17 -20
  8. package/dist/constraints/UICoverConstraint.d.ts +0 -72
  9. package/dist/constraints/UICustomConstraint.d.ts +60 -0
  10. package/dist/constraints/UIFitConstraint.d.ts +0 -72
  11. package/dist/constraints/UIHeightConstraint.d.ts +32 -38
  12. package/dist/constraints/UIHorizontalDistanceConstraint.d.ts +77 -46
  13. package/dist/constraints/UIHorizontalProportionConstraint.d.ts +49 -40
  14. package/dist/constraints/UISingleParameterConstraint.d.ts +108 -0
  15. package/dist/constraints/UIVerticalDistanceConstraint.d.ts +77 -46
  16. package/dist/constraints/UIVerticalProportionConstraint.d.ts +49 -40
  17. package/dist/constraints/UIWidthConstraint.d.ts +32 -38
  18. package/dist/elements/UIAnchor.d.ts +58 -45
  19. package/dist/elements/UIDummy.d.ts +63 -12
  20. package/dist/elements/UIElement.d.ts +81 -93
  21. package/dist/elements/UIImage.d.ts +64 -33
  22. package/dist/elements/UINineSline.d.ts +0 -0
  23. package/dist/elements/UIProgress.d.ts +7 -95
  24. package/dist/elements/UIScene.d.ts +142 -84
  25. package/dist/elements/UIText.d.ts +124 -43
  26. package/dist/index.d.ts +10 -11
  27. package/dist/index.js +2887 -2716
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.min.js +1 -1
  30. package/dist/index.min.js.map +1 -1
  31. package/dist/layers/UIFullscreenLayer.d.ts +112 -0
  32. package/dist/layers/UILayer.d.ts +134 -57
  33. package/dist/materials/UIInstancedMaterial.d.ts +0 -0
  34. package/dist/materials/UIMaterial.d.ts +6 -6
  35. package/dist/materials/UINineSliceMaterial.d.ts +0 -0
  36. package/dist/materials/UIProgressMaterial.d.ts +0 -4
  37. package/dist/miscellaneous/UIExpression.d.ts +117 -0
  38. package/dist/miscellaneous/UIMicro.d.ts +73 -119
  39. package/dist/miscellaneous/UIOrientation.d.ts +2 -9
  40. package/dist/miscellaneous/UIPriority.d.ts +56 -0
  41. package/dist/miscellaneous/UIRelation.d.ts +43 -0
  42. package/dist/miscellaneous/UITextPadding.d.ts +7 -0
  43. package/dist/miscellaneous/UITextSpan.d.ts +6 -0
  44. package/dist/miscellaneous/UITextStyle.d.ts +18 -0
  45. package/dist/miscellaneous/asserts.d.ts +111 -4
  46. package/dist/miscellaneous/textInterfaces.d.ts +19 -0
  47. package/dist/miscellaneous/textTools.d.ts +8 -5
  48. package/dist/scalable/UIScalableMesh.d.ts +16 -0
  49. package/dist/scalable/UIScalablePlaneMesh.d.ts +14 -0
  50. package/dist/wrappers/UISceneWrapper.d.ts +18 -0
  51. package/dist/wrappers/UISolverWrapper.d.ts +29 -0
  52. package/package.json +1 -1
  53. package/dist/Passes/UIComposer.d.ts +0 -114
  54. package/dist/Passes/UIFullScreenQuad.d.ts +0 -51
  55. package/dist/Passes/UIPass.d.ts +0 -43
  56. package/dist/builders/UIConstraintContainerBuilder.d.ts +0 -20
  57. package/dist/builders/UIConstraintStackBuilder.d.ts +0 -24
  58. package/dist/constraints/UIConstraintPower.d.ts +0 -57
  59. package/dist/constraints/UIConstraintRule.d.ts +0 -46
  60. package/dist/layers/UIFullScreenLayer.d.ts +0 -13
  61. package/dist/miscellaneous/UIBlending.d.ts +0 -7
  62. package/dist/miscellaneous/UITextInterfaces.d.ts +0 -49
  63. package/dist/miscellaneous/math.d.ts +0 -1
  64. package/dist/miscellaneous/microTransformationTools.d.ts +0 -3
@@ -1,141 +1,199 @@
1
- import type { Camera, WebGLRenderer } from "three";
2
- import { Scene } from "three";
1
+ import type { Camera } from "three";
2
+ import { Mesh, Scene } from "three";
3
3
  import type { UILayer } from "../layers/UILayer";
4
4
  import { UIElement } from "./UIElement";
5
5
  /**
6
- * Defines when a UIScene should be rendered/updated.
6
+ * Update modes for controlling when the 3D scene should be re-rendered.
7
7
  */
8
8
  export declare enum UISceneUpdateMode {
9
- /** Scene is rendered on every frame */
10
- ALWAYS = "always",
11
- /** Scene is rendered when any property changes */
12
- PROPERTY_CHANGED = "property_changed",
13
- /** Scene is only rendered when explicitly requested */
14
- MANUAL = "manual"
9
+ /** Re-render the scene every frame. */
10
+ EACH_FRAME = 1,
11
+ /** Re-render the scene every second frame for performance. */
12
+ EACH_SECOND_FRAME = 2,
13
+ /** Re-render the scene only when properties change. */
14
+ PROPERTY_CHANGED = 3,
15
+ /** Re-render the scene only when manually requested. */
16
+ MANUAL = 4
15
17
  }
16
18
  /**
17
- * Options for customizing the UIScene element.
19
+ * Configuration options for UIScene element creation.
18
20
  */
19
21
  export interface UISceneOptions {
20
- /** Three.js scene to render */
21
- scene: Scene;
22
- /** Camera to use for rendering the scene */
23
- camera: Camera;
24
- /** Width of the scene viewport in pixels */
22
+ /** Initial x-coordinate position. */
23
+ x: number;
24
+ /** Initial y-coordinate position. */
25
+ y: number;
26
+ /** Width of the scene render target in pixels. */
25
27
  width: number;
26
- /** Height of the scene viewport in pixels */
28
+ /** Height of the scene render target in pixels. */
27
29
  height: number;
28
- /** Resolution scaling factor for performance optimization */
30
+ /** Three.js scene to render. */
31
+ scene: Scene;
32
+ /** Camera to use for rendering the scene. */
33
+ camera: Camera;
34
+ /** Update mode controlling when the scene is re-rendered. */
35
+ updateMode: UISceneUpdateMode;
36
+ /** Resolution factor for render target sizing (0.1 to 2.0). */
29
37
  resolutionFactor: number;
30
- /** Whether the scene should be rendered immediately after creation */
31
- renderedByDefault: boolean;
32
- /** Whether to use a depth buffer for rendering */
33
- useDepth: boolean;
34
- /** Color to clear the scene with before rendering */
38
+ /** Clear color for the render target background. */
35
39
  clearColor: number;
36
- /** Alpha value for the clear color (0-1) */
40
+ /** Clear alpha for the render target background. */
37
41
  clearAlpha: number;
38
- /** When the scene should be automatically re-rendered */
39
- updateBehavior: UISceneUpdateMode;
42
+ /** Whether to enable depth buffer for the render target. */
43
+ enableDepthBuffer: boolean;
40
44
  }
41
45
  /**
42
- * A UI element that renders a Three.js scene as a texture.
43
- * This allows 3D content to be integrated into the 2D UI system.
46
+ * UI element for rendering 3D scenes to texture within the UI system.
47
+ *
48
+ * UIScene is a concrete implementation of UIElement that renders a Three.js
49
+ * scene to a WebGL render target and displays it as a texture. It provides
50
+ * control over rendering frequency, resolution, and visual properties. This
51
+ * allows embedding complex 3D content within the 2D UI layout system with
52
+ * performance optimizations through configurable update modes.
53
+ *
54
+ * @see {@link UIElement} - Base class providing UI element functionality
55
+ * @see {@link UISceneUpdateMode} - Update mode configuration
56
+ * @see {@link Scene} - Three.js scene for 3D content
57
+ * @see {@link Camera} - Three.js camera for scene rendering
44
58
  */
45
- export declare class UIScene extends UIElement {
46
- /** Material used to render the scene's render target */
59
+ export declare class UIScene extends UIElement<Mesh> {
60
+ /** The material used for rendering the scene texture. */
47
61
  private readonly material;
48
- /** WebGL render target where the scene is rendered */
62
+ /** The WebGL render target for off-screen scene rendering. */
49
63
  private readonly renderTarget;
50
- /** Color to clear the scene with before rendering */
51
- private clearColorInternal;
52
- /** Alpha value for the clear color */
53
- private clearAlphaInternal;
54
- /** Whether the scene needs to be re-rendered on the next frame */
55
- private needsRenderInternal;
56
- /** When the scene should be automatically re-rendered */
57
- private readonly updateModeInternal;
58
- /** Resolution scaling factor for performance optimization */
59
- private resolutionFactorInternal;
60
- /** The Three.js scene being rendered */
64
+ /** Internal storage for the current Three.js scene. */
61
65
  private sceneInternal;
62
- /** The camera used for rendering the scene */
66
+ /** Internal storage for the current camera. */
63
67
  private cameraInternal;
68
+ /** Internal storage for the current update mode. */
69
+ private updateModeInternal;
70
+ /** Internal storage for the current resolution factor. */
71
+ private resolutionFactorInternal;
72
+ /** Internal storage for the current clear color. */
73
+ private clearColorInternal;
74
+ /** Internal storage for the current clear alpha. */
75
+ private clearAlphaInternal;
76
+ /** Frame alternation boolean for EACH_SECOND_FRAME update mode. */
77
+ private frameBoolean;
78
+ /** Flag indicating if properties have changed requiring a re-render. */
79
+ private propertyChanged;
80
+ /** Flag indicating if a manual render has been requested. */
81
+ private renderRequired;
64
82
  /**
65
- * Creates a new scene UI element.
83
+ * Creates a new UIScene instance with 3D scene rendering capabilities.
84
+ *
85
+ * The scene element creates a WebGL render target for off-screen rendering
86
+ * and displays the result as a texture. A default perspective camera is
87
+ * created if none is provided.
66
88
  *
67
- * @param layer - The UI layer that contains this element
68
- * @param options - Options to customize the scene
69
- * @throws Error if resolution factor is out of valid range or dimensions are invalid
89
+ * @param layer - The UI layer that contains this scene element
90
+ * @param options - Configuration options for scene rendering
91
+ * @throws Will throw an error if resolution factor is outside valid range (0.1-2.0)
70
92
  */
71
93
  constructor(layer: UILayer, options?: Partial<UISceneOptions>);
72
- /** Gets whether the scene needs to be re-rendered on the next frame */
73
- get needsRender(): boolean;
74
- /** Gets the color tint applied to the rendered scene */
94
+ /**
95
+ * Gets the current color tint applied to the scene texture.
96
+ * @returns The color value as a number (e.g., 0xFFFFFF for white)
97
+ */
75
98
  get color(): number;
76
- /** Gets the opacity of the rendered scene */
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
+ */
77
103
  get opacity(): number;
78
- /** Gets the Three.js scene being rendered */
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;
109
+ /**
110
+ * Gets the Three.js scene being rendered.
111
+ * @returns The current Three.js scene
112
+ */
79
113
  get scene(): Scene;
80
- /** Gets the camera used for rendering the scene */
114
+ /**
115
+ * Gets the camera used for rendering the scene.
116
+ * @returns The current Three.js camera
117
+ */
81
118
  get camera(): Camera;
82
- /** Gets the color used to clear the scene before rendering */
119
+ /**
120
+ * Gets the current update mode controlling render frequency.
121
+ * @returns The current update mode
122
+ */
123
+ get updateMode(): UISceneUpdateMode;
124
+ /**
125
+ * Gets the resolution factor for render target sizing.
126
+ * @returns The resolution factor between 0.1 and 2.0
127
+ */
128
+ get resolutionFactor(): number;
129
+ /**
130
+ * Gets the clear color used for the render target background.
131
+ * @returns The clear color as a number
132
+ */
83
133
  get clearColor(): number;
84
- /** Gets the alpha value for the clear color */
134
+ /**
135
+ * Gets the clear alpha used for the render target background.
136
+ * @returns The clear alpha value between 0.0 and 1.0
137
+ */
85
138
  get clearAlpha(): number;
86
- /** Gets the resolution scaling factor */
87
- get resolutionFactor(): number;
88
139
  /**
89
- * Sets the color tint applied to the rendered scene
90
- * @param value - Color in hexadecimal format
140
+ * Sets the color tint applied to the scene texture.
141
+ * @param value - The color value as a number (e.g., 0xFFFFFF for white)
91
142
  */
92
143
  set color(value: number);
93
144
  /**
94
- * Sets the opacity of the rendered scene
95
- * @param value - Opacity value between 0 (transparent) and 1 (opaque)
145
+ * Sets the opacity level of the scene texture.
146
+ * @param value - The opacity value between 0.0 (transparent) and 1.0 (opaque)
96
147
  */
97
148
  set opacity(value: number);
98
149
  /**
99
- * Sets the Three.js scene to be rendered
100
- * @param value - Scene to render
150
+ * Sets whether transparency is enabled for the scene texture.
151
+ * @param value - True to enable transparency, false to disable
152
+ */
153
+ set transparency(value: boolean);
154
+ /**
155
+ * Sets a new Three.js scene to render and marks for re-render.
156
+ * @param value - The new Three.js scene
101
157
  */
102
158
  set scene(value: Scene);
103
159
  /**
104
- * Sets the camera used for rendering the scene
105
- * @param value - Camera to use
160
+ * Sets a new camera for rendering and marks for re-render.
161
+ * @param value - The new Three.js camera
106
162
  */
107
163
  set camera(value: Camera);
108
164
  /**
109
- * Sets the color used to clear the scene before rendering
110
- * @param value - Clear color in hexadecimal format
165
+ * Sets the update mode controlling render frequency and marks for re-render.
166
+ * @param value - The new update mode
111
167
  */
112
- set clearColor(value: number);
168
+ set updateMode(value: UISceneUpdateMode);
113
169
  /**
114
- * Sets the alpha value for the clear color
115
- * @param value - Alpha value between 0 (transparent) and 1 (opaque)
170
+ * Sets the resolution factor and resizes the render target accordingly.
171
+ * @param value - The new resolution factor between 0.1 and 2.0
116
172
  */
117
- set clearAlpha(value: number);
173
+ set resolutionFactor(value: number);
118
174
  /**
119
- * Sets the resolution scaling factor
120
- * @param value - Resolution factor (e.g., 0.5 for half resolution)
175
+ * Sets the clear color for the render target background and marks for re-render.
176
+ * @param value - The new clear color as a number
121
177
  */
122
- set resolutionFactor(value: number);
178
+ set clearColor(value: number);
123
179
  /**
124
- * Destroys the scene element, disposing of all resources and removing it from the layer.
125
- * This should be called when the element is no longer needed.
180
+ * Sets the clear alpha for the render target background and marks for re-render.
181
+ * @param value - The new clear alpha value between 0.0 and 1.0
126
182
  */
127
- destroy(): void;
183
+ set clearAlpha(value: number);
128
184
  /**
129
- * Requests that the scene be re-rendered on the next frame.
130
- * This is used when the scene is in MANUAL update mode or when properties change.
185
+ * Destroys the scene element by cleaning up all associated resources.
186
+ *
187
+ * This method disposes of the material and render target resources,
188
+ * and calls the parent destroy method to clean up the underlying UI element.
189
+ * After calling this method, the scene element should not be used anymore.
131
190
  */
132
- requestRender(): void;
191
+ destroy(): void;
133
192
  /**
134
- * Renders the scene element.
135
- * This will render the Three.js scene to a texture if needed,
136
- * then apply that texture to the mesh.
193
+ * Manually requests a re-render of the scene.
137
194
  *
138
- * @param renderer - The WebGL renderer
195
+ * This method is useful when the update mode is set to MANUAL and you
196
+ * want to trigger a scene re-render without changing any properties.
139
197
  */
140
- protected render(renderer: WebGLRenderer): void;
198
+ requestRender(): void;
141
199
  }
@@ -1,76 +1,157 @@
1
- import type { WebGLRenderer } from "three";
1
+ import { Mesh } from "three";
2
2
  import type { UILayer } from "../layers/UILayer";
3
- import type { UITextPadding, UITextSpan, UITextStyle } from "../miscellaneous/UITextInterfaces";
3
+ import type { UITextContent } from "../miscellaneous/textInterfaces";
4
+ import { type UITextPadding } from "../miscellaneous/UITextPadding";
5
+ import { type UITextStyle } from "../miscellaneous/UITextStyle";
4
6
  import { UIElement } from "./UIElement";
5
7
  /**
6
- * Options for customizing the UIText element.
8
+ * Configuration options for UIText element creation.
7
9
  */
8
10
  export interface UITextOptions {
9
- /** Maximum width of the text block before wrapping occurs */
11
+ /** Maximum width in pixels before text wrapping occurs. */
10
12
  maxWidth: number;
11
- /** Padding around the text */
13
+ /** Padding configuration for text content. */
12
14
  padding: Partial<UITextPadding>;
13
- /** Default style to apply to text spans that don't specify their own style */
14
- defaultStyle: Partial<UITextStyle>;
15
+ /** Common style properties applied to all text content. */
16
+ commonStyle: Partial<UITextStyle>;
15
17
  }
16
18
  /**
17
- * A UI element that displays formatted text.
18
- * Renders text to a canvas and displays it as a texture on a mesh.
19
+ * UI element for rendering dynamic text with canvas-based rendering.
20
+ *
21
+ * UIText is a concrete implementation of UIElement that renders text content
22
+ * using HTML5 Canvas and displays it as a texture. It supports rich text
23
+ * formatting, automatic text wrapping, padding, and dynamic resizing based
24
+ * on content. The text is rendered to a canvas texture which is then applied
25
+ * to a Three.js mesh for display in the 3D scene.
26
+ *
27
+ * @see {@link UIElement} - Base class providing UI element functionality
28
+ * @see {@link UITextContent} - Text content structure
29
+ * @see {@link UITextStyle} - Text styling options
30
+ * @see {@link UITextPadding} - Padding configuration
19
31
  */
20
- export declare class UIText extends UIElement {
21
- /** Material used to render the text */
32
+ export declare class UIText extends UIElement<Mesh> {
33
+ /** The material used for rendering the text texture. */
22
34
  private readonly material;
23
- /** Texture containing the rendered text */
35
+ /** The canvas texture containing the rendered text. */
24
36
  private readonly texture;
25
- /** Canvas element used to render the text */
37
+ /** The HTML canvas element used for text rendering. */
26
38
  private readonly canvas;
27
- /** 2D rendering context for the canvas */
39
+ /** The 2D rendering context for drawing text on the canvas. */
28
40
  private readonly context;
29
- /** Size of the text block without padding */
30
- private readonly textBlockSize;
31
- /** Padding values applied around the text */
32
- private readonly padding;
33
- /** Cached aspect ratio for performance optimization */
34
- private suggestedAspect;
35
- /**
36
- * Creates a new text UI element.
41
+ /** Internal storage for the current text content. */
42
+ private contentInternal;
43
+ /** Internal storage for the maximum width before text wrapping. */
44
+ private maxWidthInternal;
45
+ /** Internal storage for the current padding configuration. */
46
+ private paddingInternal;
47
+ /** Internal storage for the common text style properties. */
48
+ private commonStyleInternal;
49
+ /** Target aspect ratio for the text element based on content. */
50
+ private targetAspectRatio;
51
+ /** Last calculated aspect ratio for comparison during rendering. */
52
+ private lastAspectRatio;
53
+ /**
54
+ * Creates a new UIText instance with dynamic text rendering.
55
+ *
56
+ * The text element will automatically size itself based on the content
57
+ * and specified options. A canvas is created for rendering the text,
58
+ * which is then used as a texture for the 3D mesh.
37
59
  *
38
- * @param layer - The UI layer that contains this element
39
- * @param spans - Text content to display, either as a string, text span, or array of text spans/strings
40
- * @param options - Options to customize the text rendering
41
- * @throws Error if canvas context creation fails
60
+ * @param layer - The UI layer that contains this text element
61
+ * @param content - The text content to display
62
+ * @param options - Configuration options for text rendering
63
+ * @param x - Initial x-coordinate position (defaults to 0)
64
+ * @param y - Initial y-coordinate position (defaults to 0)
65
+ * @throws Will throw an error if canvas context creation fails
66
+ */
67
+ constructor(layer: UILayer, content: UITextContent, options?: Partial<UITextOptions>, x?: number, y?: number);
68
+ /**
69
+ * Gets the current color tint applied to the text.
70
+ * @returns The color value as a number (e.g., 0xFFFFFF for white)
42
71
  */
43
- constructor(layer: UILayer, spans: (UITextSpan | string)[] | UITextSpan | string, options?: Partial<UITextOptions>);
44
- /** Gets the color tint applied to the text */
45
72
  get color(): number;
46
- /** Gets the opacity of the text */
73
+ /**
74
+ * Gets the current opacity level of the text.
75
+ * @returns The opacity value between 0.0 (transparent) and 1.0 (opaque)
76
+ */
47
77
  get opacity(): number;
48
78
  /**
49
- * Sets the color tint applied to the text
50
- * @param value - Color in hexadecimal format
79
+ * Gets whether transparency is enabled for the text.
80
+ * @returns True if transparency is enabled, false otherwise
81
+ */
82
+ get transparency(): boolean;
83
+ /**
84
+ * Gets the current text content being displayed.
85
+ * @returns The current text content structure
86
+ */
87
+ get content(): UITextContent;
88
+ /**
89
+ * Gets the maximum width before text wrapping occurs.
90
+ * @returns The maximum width in pixels
91
+ */
92
+ get maxWidth(): number;
93
+ /**
94
+ * Gets the current padding configuration.
95
+ * @returns The padding configuration for all sides
96
+ */
97
+ get padding(): UITextPadding;
98
+ /**
99
+ * Gets the common style properties applied to the text.
100
+ * @returns The partial text style configuration
101
+ */
102
+ get commonStyle(): Partial<UITextStyle>;
103
+ /**
104
+ * Sets the color tint applied to the text.
105
+ * @param value - The color value as a number (e.g., 0xFFFFFF for white)
51
106
  */
52
107
  set color(value: number);
53
108
  /**
54
- * Sets the opacity of the text
55
- * @param value - Opacity value between 0 (transparent) and 1 (opaque)
109
+ * Sets the opacity level of the text.
110
+ * @param value - The opacity value between 0.0 (transparent) and 1.0 (opaque)
56
111
  */
57
112
  set opacity(value: number);
58
113
  /**
59
- * Destroys the text element, disposing of all resources and removing it from the layer.
60
- * This should be called when the element is no longer needed.
114
+ * Sets whether transparency is enabled for the text.
115
+ * @param value - True to enable transparency, false to disable
61
116
  */
62
- destroy(): void;
117
+ set transparency(value: boolean);
118
+ /**
119
+ * Sets new text content and triggers a rebuild.
120
+ * @param value - The new text content structure
121
+ */
122
+ set content(value: UITextContent);
123
+ /**
124
+ * Sets the maximum width before text wrapping and triggers a rebuild.
125
+ * @param value - The new maximum width in pixels
126
+ */
127
+ set maxWidth(value: number);
63
128
  /**
64
- * Applies transformations to the text element, ensuring the aspect ratio
65
- * matches the rendered text to prevent distortion.
129
+ * Sets new padding configuration and triggers a rebuild.
130
+ * @param value - The new padding configuration
131
+ */
132
+ set padding(value: UITextPadding);
133
+ /**
134
+ * Sets new common style properties and triggers a rebuild.
135
+ * @param value - The new partial text style configuration
136
+ */
137
+ set commonStyle(value: Partial<UITextStyle>);
138
+ /**
139
+ * Destroys the text element by cleaning up all associated resources.
66
140
  *
67
- * This overrides the base implementation to maintain the correct aspect ratio.
141
+ * This method disposes of the material and texture resources, removes
142
+ * the canvas element from the DOM, and calls the parent destroy method
143
+ * to clean up the underlying UI element. After calling this method,
144
+ * the text element should not be used anymore.
68
145
  */
69
- applyTransformations(): void;
146
+ destroy(): void;
70
147
  /**
71
- * Renders the text element.
148
+ * Rebuilds the text canvas and texture based on current content and settings.
149
+ *
150
+ * This method calculates the text layout, resizes the canvas to fit the content
151
+ * with padding, renders the text lines to the canvas, and updates the texture.
152
+ * It also calculates and sets the target aspect ratio for proper display.
72
153
  *
73
- * @param renderer - The WebGL renderer
154
+ * @private
74
155
  */
75
- protected render(renderer: WebGLRenderer): void;
156
+ private rebuildText;
76
157
  }
package/dist/index.d.ts CHANGED
@@ -1,15 +1,11 @@
1
1
  export * from "./builders/UIConstraint2DBuilder";
2
- export * from "./builders/UIConstraintContainerBuilder";
3
- export * from "./builders/UIConstraintStackBuilder";
4
2
  export * from "./constraints/UIAspectConstraint";
5
3
  export * from "./constraints/UIConstraint";
6
- export * from "./constraints/UIConstraintPower";
7
- export * from "./constraints/UIConstraintRule";
8
- export * from "./constraints/UICoverConstraint";
9
- export * from "./constraints/UIFitConstraint";
4
+ export * from "./constraints/UICustomConstraint";
10
5
  export * from "./constraints/UIHeightConstraint";
11
6
  export * from "./constraints/UIHorizontalDistanceConstraint";
12
7
  export * from "./constraints/UIHorizontalProportionConstraint";
8
+ export * from "./constraints/UISingleParameterConstraint";
13
9
  export * from "./constraints/UIVerticalDistanceConstraint";
14
10
  export * from "./constraints/UIVerticalProportionConstraint";
15
11
  export * from "./constraints/UIWidthConstraint";
@@ -20,11 +16,14 @@ export * from "./elements/UIImage";
20
16
  export * from "./elements/UIProgress";
21
17
  export * from "./elements/UIScene";
22
18
  export * from "./elements/UIText";
23
- export * from "./layers/UIFullScreenLayer";
19
+ export * from "./layers/UIFullscreenLayer";
24
20
  export * from "./layers/UILayer";
25
- export * from "./miscellaneous/UIBlending";
21
+ export * from "./miscellaneous/UIExpression";
22
+ export * from "./miscellaneous/UIMicro";
26
23
  export * from "./miscellaneous/UIMode";
27
24
  export * from "./miscellaneous/UIOrientation";
28
- export * from "./miscellaneous/UITextInterfaces";
29
- export * from "./Passes/UIFullScreenQuad";
30
- export * from "./Passes/UIPass";
25
+ export * from "./miscellaneous/UIPriority";
26
+ export * from "./miscellaneous/UIRelation";
27
+ export * from "./miscellaneous/UITextPadding";
28
+ export * from "./miscellaneous/UITextSpan";
29
+ export * from "./miscellaneous/UITextStyle";