laymur 0.1.73 → 0.2.1
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 +367 -0
- package/dist/builders/UIConstraint2DBuilder.d.ts +130 -0
- package/dist/composer/UIComposer.d.ts +0 -0
- package/dist/composer/UIFullscreenQuad.d.ts +0 -0
- package/dist/composer/UIPass.d.ts +0 -0
- package/dist/constraints/UIAspectConstraint.d.ts +60 -0
- package/dist/constraints/UIConstraint.d.ts +29 -0
- package/dist/constraints/UICoverConstraint.d.ts +0 -0
- package/dist/constraints/UICustomConstraint.d.ts +60 -0
- package/dist/constraints/UIFitConstraint.d.ts +0 -0
- package/dist/constraints/UIHeightConstraint.d.ts +49 -0
- package/dist/constraints/UIHorizontalDistanceConstraint.d.ts +94 -0
- package/dist/constraints/UIHorizontalProportionConstraint.d.ts +67 -0
- package/dist/constraints/UISingleParameterConstraint.d.ts +108 -0
- package/dist/constraints/UIVerticalDistanceConstraint.d.ts +94 -0
- package/dist/constraints/UIVerticalProportionConstraint.d.ts +67 -0
- package/dist/constraints/UIWidthConstraint.d.ts +49 -0
- package/dist/elements/UIAnchor.d.ts +78 -0
- package/dist/elements/UIDummy.d.ts +72 -0
- package/dist/elements/UIElement.d.ts +121 -0
- package/dist/elements/UIImage.d.ts +88 -0
- package/dist/elements/UINineSline.d.ts +0 -0
- package/dist/elements/UIProgress.d.ts +39 -0
- package/dist/elements/UIScene.d.ts +199 -0
- package/dist/elements/UIText.d.ts +157 -0
- package/dist/index.d.ts +29 -31
- package/dist/index.js +3320 -3251
- 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 +112 -0
- package/dist/layers/UILayer.d.ts +144 -0
- package/dist/materials/UIInstancedMaterial.d.ts +0 -0
- package/dist/materials/UIMaterial.d.ts +13 -0
- package/dist/materials/UINineSliceMaterial.d.ts +0 -0
- package/dist/{Materials → materials}/UIProgressMaterial.d.ts +0 -4
- package/dist/miscellaneous/UIExpression.d.ts +117 -0
- package/dist/miscellaneous/UIMicro.d.ts +130 -0
- package/dist/{Miscellaneous → miscellaneous}/UIOrientation.d.ts +2 -9
- package/dist/miscellaneous/UIPriority.d.ts +56 -0
- package/dist/miscellaneous/UIRelation.d.ts +43 -0
- package/dist/miscellaneous/UITextPadding.d.ts +7 -0
- package/dist/miscellaneous/UITextSpan.d.ts +6 -0
- package/dist/miscellaneous/UITextStyle.d.ts +18 -0
- package/dist/miscellaneous/asserts.d.ts +112 -0
- package/dist/miscellaneous/textInterfaces.d.ts +19 -0
- package/dist/miscellaneous/textTools.d.ts +12 -0
- package/dist/scalable/UIScalableMesh.d.ts +16 -0
- package/dist/scalable/UIScalablePlaneMesh.d.ts +14 -0
- package/dist/wrappers/UISceneWrapper.d.ts +18 -0
- package/dist/wrappers/UISolverWrapper.d.ts +29 -0
- package/package.json +3 -3
- package/dist/Builders/UIConstraint2DBuilder.d.ts +0 -42
- package/dist/Builders/UIConstraintContainerBuilder.d.ts +0 -20
- package/dist/Builders/UIConstraintStackBuilder.d.ts +0 -24
- package/dist/Constraints/UIAspectConstraint.d.ts +0 -56
- package/dist/Constraints/UIConstraint.d.ts +0 -32
- package/dist/Constraints/UIConstraintPower.d.ts +0 -57
- package/dist/Constraints/UIConstraintRule.d.ts +0 -46
- package/dist/Constraints/UICoverConstraint.d.ts +0 -72
- package/dist/Constraints/UIFitConstraint.d.ts +0 -72
- package/dist/Constraints/UIHeightConstraint.d.ts +0 -55
- package/dist/Constraints/UIHorizontalDistanceConstraint.d.ts +0 -63
- package/dist/Constraints/UIHorizontalProportionConstraint.d.ts +0 -58
- package/dist/Constraints/UIVerticalDistanceConstraint.d.ts +0 -63
- package/dist/Constraints/UIVerticalProportionConstraint.d.ts +0 -58
- package/dist/Constraints/UIWidthConstraint.d.ts +0 -55
- package/dist/Elements/UIAnchor.d.ts +0 -66
- package/dist/Elements/UIDummy.d.ts +0 -21
- package/dist/Elements/UIElement.d.ts +0 -134
- package/dist/Elements/UIImage.d.ts +0 -57
- package/dist/Elements/UIProgress.d.ts +0 -127
- package/dist/Elements/UIScene.d.ts +0 -141
- package/dist/Elements/UIText.d.ts +0 -76
- package/dist/Layers/UIFullScreenLayer.d.ts +0 -13
- package/dist/Layers/UILayer.d.ts +0 -68
- package/dist/Materials/UIMaterial.d.ts +0 -13
- package/dist/Miscellaneous/UIBlending.d.ts +0 -7
- package/dist/Miscellaneous/UIMicro.d.ts +0 -176
- package/dist/Miscellaneous/UITextInterfaces.d.ts +0 -49
- package/dist/Miscellaneous/asserts.d.ts +0 -5
- package/dist/Miscellaneous/math.d.ts +0 -1
- package/dist/Miscellaneous/microTransformationTools.d.ts +0 -3
- package/dist/Miscellaneous/symbols.d.ts +0 -1
- package/dist/Miscellaneous/textTools.d.ts +0 -9
- package/dist/Passes/UIComposer.d.ts +0 -114
- package/dist/Passes/UIFullScreenQuad.d.ts +0 -51
- package/dist/Passes/UIPass.d.ts +0 -43
- /package/dist/{Miscellaneous → miscellaneous}/UIMode.d.ts +0 -0
- /package/dist/{Miscellaneous → miscellaneous}/threeInstances.d.ts +0 -0
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Texture, WebGLRenderer } from "three";
|
|
2
|
-
import type { UILayer } from "../Layers/UILayer";
|
|
3
|
-
import { UIBlending } from "../Miscellaneous/UIBlending";
|
|
4
|
-
import { UIElement } from "./UIElement";
|
|
5
|
-
/**
|
|
6
|
-
* A UI element that displays an image texture.
|
|
7
|
-
* Renders a textured mesh using the provided texture.
|
|
8
|
-
*/
|
|
9
|
-
export declare class UIImage extends UIElement {
|
|
10
|
-
/** Material used to render the image */
|
|
11
|
-
private readonly material;
|
|
12
|
-
/** The texture displayed by this image */
|
|
13
|
-
private readonly textureInternal;
|
|
14
|
-
private blendingInternal;
|
|
15
|
-
/**
|
|
16
|
-
* Creates a new image UI element.
|
|
17
|
-
*
|
|
18
|
-
* @param layer - The UI layer that contains this element
|
|
19
|
-
* @param texture - The texture to display
|
|
20
|
-
* @throws Error if the texture has invalid dimensions
|
|
21
|
-
*/
|
|
22
|
-
constructor(layer: UILayer, texture: Texture);
|
|
23
|
-
/** Gets the texture displayed by this image */
|
|
24
|
-
get texture(): Texture;
|
|
25
|
-
/** Gets the color tint applied to the image */
|
|
26
|
-
get color(): number;
|
|
27
|
-
/** Gets the opacity of the image */
|
|
28
|
-
get opacity(): number;
|
|
29
|
-
/** Gets the blending mode of the image */
|
|
30
|
-
get blending(): UIBlending;
|
|
31
|
-
/**
|
|
32
|
-
* Sets the color tint applied to the image
|
|
33
|
-
* @param value - Color in hexadecimal format
|
|
34
|
-
*/
|
|
35
|
-
set color(value: number);
|
|
36
|
-
/**
|
|
37
|
-
* Sets the opacity of the image
|
|
38
|
-
* @param value - Opacity value between 0 (transparent) and 1 (opaque)
|
|
39
|
-
*/
|
|
40
|
-
set opacity(value: number);
|
|
41
|
-
/**
|
|
42
|
-
* Sets the blending mode of the image
|
|
43
|
-
* @param value - Blending mode to apply
|
|
44
|
-
*/
|
|
45
|
-
set blending(value: UIBlending);
|
|
46
|
-
/**
|
|
47
|
-
* Destroys the image element, disposing of all resources and removing it from the layer.
|
|
48
|
-
* This should be called when the element is no longer needed.
|
|
49
|
-
*/
|
|
50
|
-
destroy(): void;
|
|
51
|
-
/**
|
|
52
|
-
* Renders the image element.
|
|
53
|
-
*
|
|
54
|
-
* @param renderer - The WebGL renderer
|
|
55
|
-
*/
|
|
56
|
-
protected render(renderer: WebGLRenderer): void;
|
|
57
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type { Texture, WebGLRenderer } from "three";
|
|
2
|
-
import type { UILayer } from "../Layers/UILayer";
|
|
3
|
-
import { UIElement } from "./UIElement";
|
|
4
|
-
/**
|
|
5
|
-
* Options for customizing the UIProgress element.
|
|
6
|
-
*/
|
|
7
|
-
export interface UIProgressOptions {
|
|
8
|
-
/** Optional background texture to display behind the progress indicator */
|
|
9
|
-
textureBackground: Texture;
|
|
10
|
-
/** Progress value from 0 to 1 */
|
|
11
|
-
progress: number;
|
|
12
|
-
/** Whether progress increases in the direction specified by angle (true) or opposite to it (false) */
|
|
13
|
-
isForegroundDirection: boolean;
|
|
14
|
-
/** Angle in degrees specifying the direction of progress */
|
|
15
|
-
angle: number;
|
|
16
|
-
/** Overall color tint applied to both textures */
|
|
17
|
-
color: number;
|
|
18
|
-
/** Overall opacity applied to both textures */
|
|
19
|
-
opacity: number;
|
|
20
|
-
/** Color tint applied to the background texture */
|
|
21
|
-
backgroundColor: number;
|
|
22
|
-
/** Color tint applied to the foreground texture */
|
|
23
|
-
foregroundColor: number;
|
|
24
|
-
/** Opacity of the background texture */
|
|
25
|
-
backgroundOpacity: number;
|
|
26
|
-
/** Opacity of the foreground texture */
|
|
27
|
-
foregroundOpacity: number;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* A UI element that displays a progress indicator.
|
|
31
|
-
* Can be used for loading bars, health bars, sliders, etc.
|
|
32
|
-
*/
|
|
33
|
-
export declare class UIProgress extends UIElement {
|
|
34
|
-
/** Material used to render the progress indicator */
|
|
35
|
-
private readonly material;
|
|
36
|
-
/** Width of the underlying image texture */
|
|
37
|
-
private readonly imageWidth;
|
|
38
|
-
/** Height of the underlying image texture */
|
|
39
|
-
private readonly imageHeight;
|
|
40
|
-
/**
|
|
41
|
-
* Creates a new progress UI element.
|
|
42
|
-
*
|
|
43
|
-
* @param layer - The UI layer that contains this element
|
|
44
|
-
* @param textureForeground - The texture to use for the progress indicator
|
|
45
|
-
* @param options - Options to customize the progress indicator
|
|
46
|
-
* @throws Error if either texture has invalid dimensions
|
|
47
|
-
*/
|
|
48
|
-
constructor(layer: UILayer, textureForeground: Texture, options?: Partial<UIProgressOptions>);
|
|
49
|
-
/** Gets the current progress value (0 to 1) */
|
|
50
|
-
get progress(): number;
|
|
51
|
-
/** Gets the background texture if one was provided */
|
|
52
|
-
get backgroundTexture(): Texture | undefined;
|
|
53
|
-
/** Gets the foreground texture used for the progress indicator */
|
|
54
|
-
get foregroundTexture(): Texture;
|
|
55
|
-
/** Gets the color tint applied to the background texture */
|
|
56
|
-
get backgroundColor(): number;
|
|
57
|
-
/** Gets the color tint applied to the foreground texture */
|
|
58
|
-
get foregroundColor(): number;
|
|
59
|
-
/** Gets the overall color tint applied to both textures */
|
|
60
|
-
get color(): number;
|
|
61
|
-
/** Gets the opacity of the background texture */
|
|
62
|
-
get backgroundOpacity(): number;
|
|
63
|
-
/** Gets the opacity of the foreground texture */
|
|
64
|
-
get foregroundOpacity(): number;
|
|
65
|
-
/** Gets the overall opacity applied to both textures */
|
|
66
|
-
get opacity(): number;
|
|
67
|
-
/** Gets the angle in degrees specifying the direction of progress */
|
|
68
|
-
get angle(): number;
|
|
69
|
-
/** Gets whether progress increases in the direction specified by angle (true) or opposite to it (false) */
|
|
70
|
-
get isForwardDirection(): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Sets the progress value
|
|
73
|
-
* @param value - Progress value between 0 (empty) and 1 (full)
|
|
74
|
-
*/
|
|
75
|
-
set progress(value: number);
|
|
76
|
-
/**
|
|
77
|
-
* Sets the color tint applied to the background texture
|
|
78
|
-
* @param value - Color in hexadecimal format
|
|
79
|
-
*/
|
|
80
|
-
set backgroundColor(value: number);
|
|
81
|
-
/**
|
|
82
|
-
* Sets the color tint applied to the foreground texture
|
|
83
|
-
* @param value - Color in hexadecimal format
|
|
84
|
-
*/
|
|
85
|
-
set foregroundColor(value: number);
|
|
86
|
-
/**
|
|
87
|
-
* Sets the overall color tint applied to both textures
|
|
88
|
-
* @param value - Color in hexadecimal format
|
|
89
|
-
*/
|
|
90
|
-
set color(value: number);
|
|
91
|
-
/**
|
|
92
|
-
* Sets the opacity of the background texture
|
|
93
|
-
* @param value - Opacity value between 0 (transparent) and 1 (opaque)
|
|
94
|
-
*/
|
|
95
|
-
set backgroundOpacity(value: number);
|
|
96
|
-
/**
|
|
97
|
-
* Sets the opacity of the foreground texture
|
|
98
|
-
* @param value - Opacity value between 0 (transparent) and 1 (opaque)
|
|
99
|
-
*/
|
|
100
|
-
set foregroundOpacity(value: number);
|
|
101
|
-
/**
|
|
102
|
-
* Sets the overall opacity applied to both textures
|
|
103
|
-
* @param value - Opacity value between 0 (transparent) and 1 (opaque)
|
|
104
|
-
*/
|
|
105
|
-
set opacity(value: number);
|
|
106
|
-
/**
|
|
107
|
-
* Sets the angle specifying the direction of progress
|
|
108
|
-
* @param value - Angle in degrees
|
|
109
|
-
*/
|
|
110
|
-
set angle(value: number);
|
|
111
|
-
/**
|
|
112
|
-
* Sets whether progress increases in the direction specified by angle
|
|
113
|
-
* @param value - true to increase in the direction of angle, false for opposite
|
|
114
|
-
*/
|
|
115
|
-
set isForwardDirection(value: boolean);
|
|
116
|
-
/**
|
|
117
|
-
* Destroys the progress element, disposing of all resources and removing it from the layer.
|
|
118
|
-
* This should be called when the element is no longer needed.
|
|
119
|
-
*/
|
|
120
|
-
destroy(): void;
|
|
121
|
-
/**
|
|
122
|
-
* Renders the progress element.
|
|
123
|
-
*
|
|
124
|
-
* @param renderer - The WebGL renderer
|
|
125
|
-
*/
|
|
126
|
-
protected render(renderer: WebGLRenderer): void;
|
|
127
|
-
}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import type { Camera, WebGLRenderer } from "three";
|
|
2
|
-
import { Scene } from "three";
|
|
3
|
-
import type { UILayer } from "../Layers/UILayer";
|
|
4
|
-
import { UIElement } from "./UIElement";
|
|
5
|
-
/**
|
|
6
|
-
* Defines when a UIScene should be rendered/updated.
|
|
7
|
-
*/
|
|
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"
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Options for customizing the UIScene element.
|
|
18
|
-
*/
|
|
19
|
-
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 */
|
|
25
|
-
width: number;
|
|
26
|
-
/** Height of the scene viewport in pixels */
|
|
27
|
-
height: number;
|
|
28
|
-
/** Resolution scaling factor for performance optimization */
|
|
29
|
-
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 */
|
|
35
|
-
clearColor: number;
|
|
36
|
-
/** Alpha value for the clear color (0-1) */
|
|
37
|
-
clearAlpha: number;
|
|
38
|
-
/** When the scene should be automatically re-rendered */
|
|
39
|
-
updateBehavior: UISceneUpdateMode;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
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.
|
|
44
|
-
*/
|
|
45
|
-
export declare class UIScene extends UIElement {
|
|
46
|
-
/** Material used to render the scene's render target */
|
|
47
|
-
private readonly material;
|
|
48
|
-
/** WebGL render target where the scene is rendered */
|
|
49
|
-
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 */
|
|
61
|
-
private sceneInternal;
|
|
62
|
-
/** The camera used for rendering the scene */
|
|
63
|
-
private cameraInternal;
|
|
64
|
-
/**
|
|
65
|
-
* Creates a new scene UI element.
|
|
66
|
-
*
|
|
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
|
|
70
|
-
*/
|
|
71
|
-
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 */
|
|
75
|
-
get color(): number;
|
|
76
|
-
/** Gets the opacity of the rendered scene */
|
|
77
|
-
get opacity(): number;
|
|
78
|
-
/** Gets the Three.js scene being rendered */
|
|
79
|
-
get scene(): Scene;
|
|
80
|
-
/** Gets the camera used for rendering the scene */
|
|
81
|
-
get camera(): Camera;
|
|
82
|
-
/** Gets the color used to clear the scene before rendering */
|
|
83
|
-
get clearColor(): number;
|
|
84
|
-
/** Gets the alpha value for the clear color */
|
|
85
|
-
get clearAlpha(): number;
|
|
86
|
-
/** Gets the resolution scaling factor */
|
|
87
|
-
get resolutionFactor(): number;
|
|
88
|
-
/**
|
|
89
|
-
* Sets the color tint applied to the rendered scene
|
|
90
|
-
* @param value - Color in hexadecimal format
|
|
91
|
-
*/
|
|
92
|
-
set color(value: number);
|
|
93
|
-
/**
|
|
94
|
-
* Sets the opacity of the rendered scene
|
|
95
|
-
* @param value - Opacity value between 0 (transparent) and 1 (opaque)
|
|
96
|
-
*/
|
|
97
|
-
set opacity(value: number);
|
|
98
|
-
/**
|
|
99
|
-
* Sets the Three.js scene to be rendered
|
|
100
|
-
* @param value - Scene to render
|
|
101
|
-
*/
|
|
102
|
-
set scene(value: Scene);
|
|
103
|
-
/**
|
|
104
|
-
* Sets the camera used for rendering the scene
|
|
105
|
-
* @param value - Camera to use
|
|
106
|
-
*/
|
|
107
|
-
set camera(value: Camera);
|
|
108
|
-
/**
|
|
109
|
-
* Sets the color used to clear the scene before rendering
|
|
110
|
-
* @param value - Clear color in hexadecimal format
|
|
111
|
-
*/
|
|
112
|
-
set clearColor(value: number);
|
|
113
|
-
/**
|
|
114
|
-
* Sets the alpha value for the clear color
|
|
115
|
-
* @param value - Alpha value between 0 (transparent) and 1 (opaque)
|
|
116
|
-
*/
|
|
117
|
-
set clearAlpha(value: number);
|
|
118
|
-
/**
|
|
119
|
-
* Sets the resolution scaling factor
|
|
120
|
-
* @param value - Resolution factor (e.g., 0.5 for half resolution)
|
|
121
|
-
*/
|
|
122
|
-
set resolutionFactor(value: number);
|
|
123
|
-
/**
|
|
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.
|
|
126
|
-
*/
|
|
127
|
-
destroy(): void;
|
|
128
|
-
/**
|
|
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.
|
|
131
|
-
*/
|
|
132
|
-
requestRender(): void;
|
|
133
|
-
/**
|
|
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.
|
|
137
|
-
*
|
|
138
|
-
* @param renderer - The WebGL renderer
|
|
139
|
-
*/
|
|
140
|
-
protected render(renderer: WebGLRenderer): void;
|
|
141
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import type { WebGLRenderer } from "three";
|
|
2
|
-
import type { UILayer } from "../Layers/UILayer";
|
|
3
|
-
import type { UITextPadding, UITextSpan, UITextStyle } from "../Miscellaneous/UITextInterfaces";
|
|
4
|
-
import { UIElement } from "./UIElement";
|
|
5
|
-
/**
|
|
6
|
-
* Options for customizing the UIText element.
|
|
7
|
-
*/
|
|
8
|
-
export interface UITextOptions {
|
|
9
|
-
/** Maximum width of the text block before wrapping occurs */
|
|
10
|
-
maxWidth: number;
|
|
11
|
-
/** Padding around the text */
|
|
12
|
-
padding: Partial<UITextPadding>;
|
|
13
|
-
/** Default style to apply to text spans that don't specify their own style */
|
|
14
|
-
defaultStyle: Partial<UITextStyle>;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* A UI element that displays formatted text.
|
|
18
|
-
* Renders text to a canvas and displays it as a texture on a mesh.
|
|
19
|
-
*/
|
|
20
|
-
export declare class UIText extends UIElement {
|
|
21
|
-
/** Material used to render the text */
|
|
22
|
-
private readonly material;
|
|
23
|
-
/** Texture containing the rendered text */
|
|
24
|
-
private readonly texture;
|
|
25
|
-
/** Canvas element used to render the text */
|
|
26
|
-
private readonly canvas;
|
|
27
|
-
/** 2D rendering context for the canvas */
|
|
28
|
-
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.
|
|
37
|
-
*
|
|
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 parameters - Options to customize the text rendering
|
|
41
|
-
* @throws Error if canvas context creation fails
|
|
42
|
-
*/
|
|
43
|
-
constructor(layer: UILayer, spans: (UITextSpan | string)[] | UITextSpan | string, parameters?: Partial<UITextOptions>);
|
|
44
|
-
/** Gets the color tint applied to the text */
|
|
45
|
-
get color(): number;
|
|
46
|
-
/** Gets the opacity of the text */
|
|
47
|
-
get opacity(): number;
|
|
48
|
-
/**
|
|
49
|
-
* Sets the color tint applied to the text
|
|
50
|
-
* @param value - Color in hexadecimal format
|
|
51
|
-
*/
|
|
52
|
-
set color(value: number);
|
|
53
|
-
/**
|
|
54
|
-
* Sets the opacity of the text
|
|
55
|
-
* @param value - Opacity value between 0 (transparent) and 1 (opaque)
|
|
56
|
-
*/
|
|
57
|
-
set opacity(value: number);
|
|
58
|
-
/**
|
|
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.
|
|
61
|
-
*/
|
|
62
|
-
destroy(): void;
|
|
63
|
-
/**
|
|
64
|
-
* Applies transformations to the text element, ensuring the aspect ratio
|
|
65
|
-
* matches the rendered text to prevent distortion.
|
|
66
|
-
*
|
|
67
|
-
* This overrides the base implementation to maintain the correct aspect ratio.
|
|
68
|
-
*/
|
|
69
|
-
applyTransformations(): void;
|
|
70
|
-
/**
|
|
71
|
-
* Renders the text element.
|
|
72
|
-
*
|
|
73
|
-
* @param renderer - The WebGL renderer
|
|
74
|
-
*/
|
|
75
|
-
protected render(renderer: WebGLRenderer): void;
|
|
76
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { WebGLRenderer } from "three";
|
|
2
|
-
import { UILayer } from "./UILayer";
|
|
3
|
-
export declare class UIFullScreenLayer extends UILayer {
|
|
4
|
-
private targetScreenHeight?;
|
|
5
|
-
constructor();
|
|
6
|
-
get tergetScreenHeight(): number | undefined;
|
|
7
|
-
set tergetScreenHeight(value: number | undefined);
|
|
8
|
-
destroy(): void;
|
|
9
|
-
render(renderer: WebGLRenderer, deltaTime: number): void;
|
|
10
|
-
private calculateScale;
|
|
11
|
-
private readonly onResize;
|
|
12
|
-
private readonly onClick;
|
|
13
|
-
}
|
package/dist/Layers/UILayer.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { Eventail } from "eventail";
|
|
2
|
-
import { Constraint, Solver, Variable } from "kiwi.js";
|
|
3
|
-
import type { Object3D, WebGLRenderer } from "three";
|
|
4
|
-
import { OrthographicCamera, Scene } from "three";
|
|
5
|
-
import type { UIConstraint } from "../Constraints/UIConstraint";
|
|
6
|
-
import { UIAnchor } from "../Elements/UIAnchor";
|
|
7
|
-
import { UIElement } from "../Elements/UIElement";
|
|
8
|
-
import { addConstraintSymbol, addUIConstraintSymbol, addUIElementSymbol, addVariableSymbol, heightSymbol, removeConstraintSymbol, removeUIConstraintSymbol, removeUIElementSymbol, removeVariableSymbol, sortSymbol, suggestVariableSymbol, widthSymbol, xSymbol, ySymbol } from "../Miscellaneous/symbols";
|
|
9
|
-
import { UIMode } from "../Miscellaneous/UIMode";
|
|
10
|
-
import { UIOrientation } from "../Miscellaneous/UIOrientation";
|
|
11
|
-
interface VariableDescription {
|
|
12
|
-
strength: number;
|
|
13
|
-
suggestedValue: number;
|
|
14
|
-
}
|
|
15
|
-
interface UIElementDescription {
|
|
16
|
-
object?: Object3D;
|
|
17
|
-
variables: Map<Variable, VariableDescription>;
|
|
18
|
-
constraints: Set<UIConstraint>;
|
|
19
|
-
}
|
|
20
|
-
interface UIConstraintDescription {
|
|
21
|
-
elements: Set<UIElement | UIAnchor>;
|
|
22
|
-
variables: Map<Variable, VariableDescription>;
|
|
23
|
-
constraints: Set<Constraint>;
|
|
24
|
-
}
|
|
25
|
-
export declare enum UILayerEvent {
|
|
26
|
-
ORIENTATION_CHANGED = "orientation_changed",
|
|
27
|
-
CLICK = "click"
|
|
28
|
-
}
|
|
29
|
-
export declare abstract class UILayer extends Eventail {
|
|
30
|
-
mode: UIMode;
|
|
31
|
-
readonly [xSymbol]: Variable;
|
|
32
|
-
readonly [ySymbol]: Variable;
|
|
33
|
-
readonly [widthSymbol]: Variable;
|
|
34
|
-
readonly [heightSymbol]: Variable;
|
|
35
|
-
protected readonly scene: Scene;
|
|
36
|
-
protected readonly camera: OrthographicCamera;
|
|
37
|
-
protected solver?: Solver | undefined;
|
|
38
|
-
protected elements: Map<UIElement | UIAnchor, UIElementDescription>;
|
|
39
|
-
protected constraints: Map<UIConstraint, UIConstraintDescription>;
|
|
40
|
-
protected constraintX?: Constraint;
|
|
41
|
-
protected constraintY?: Constraint;
|
|
42
|
-
protected constraintW?: Constraint;
|
|
43
|
-
protected constraintH?: Constraint;
|
|
44
|
-
protected orientationPrivate: UIOrientation;
|
|
45
|
-
protected needsRecalculation: boolean;
|
|
46
|
-
get orientation(): UIOrientation;
|
|
47
|
-
get width(): number;
|
|
48
|
-
get height(): number;
|
|
49
|
-
destroy(): void;
|
|
50
|
-
[addUIElementSymbol](element: UIElement | UIAnchor, object?: Object3D, renderOrder?: number): void;
|
|
51
|
-
[removeUIElementSymbol](element: UIElement | UIAnchor): void;
|
|
52
|
-
[addUIConstraintSymbol](constraint: UIConstraint, elements: Set<UIElement | UIAnchor>): void;
|
|
53
|
-
[removeUIConstraintSymbol](constraint: UIConstraint): void;
|
|
54
|
-
[addConstraintSymbol](owner: UIConstraint, constraint: Constraint): void;
|
|
55
|
-
[removeConstraintSymbol](owner: UIConstraint, constraint: Constraint): void;
|
|
56
|
-
[addVariableSymbol](owner: UIElement | UIAnchor | UIConstraint, variable: Variable, strength: number): void;
|
|
57
|
-
[removeVariableSymbol](owner: UIElement | UIAnchor | UIConstraint, variable: Variable): void;
|
|
58
|
-
[suggestVariableSymbol](owner: UIElement | UIAnchor | UIConstraint, variable: Variable, value: number): void;
|
|
59
|
-
[sortSymbol](): void;
|
|
60
|
-
render(renderer: WebGLRenderer, deltaTime: number): void;
|
|
61
|
-
protected clickInternal(x: number, y: number): void;
|
|
62
|
-
protected resizeInternal(width: number, height: number): void;
|
|
63
|
-
protected applyCameraSize(width: number, height: number): void;
|
|
64
|
-
protected rebuildLayerConstraints(width: number, height: number): void;
|
|
65
|
-
protected updateOrientation(width: number, height: number): void;
|
|
66
|
-
private rebuildSolver;
|
|
67
|
-
}
|
|
68
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Texture } from "three";
|
|
2
|
-
import { ShaderMaterial } from "three";
|
|
3
|
-
import { UIBlending } from "../Miscellaneous/UIBlending";
|
|
4
|
-
export declare class UIMaterial extends ShaderMaterial {
|
|
5
|
-
constructor(map?: Texture);
|
|
6
|
-
getTexture(): Texture | undefined;
|
|
7
|
-
getColor(): number;
|
|
8
|
-
getOpacity(): number;
|
|
9
|
-
setTexture(value: Texture | undefined): void;
|
|
10
|
-
setColor(value: number): void;
|
|
11
|
-
setOpacity(value: number): void;
|
|
12
|
-
setBlending(blending: UIBlending): void;
|
|
13
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import type { UIElement } from "../Elements/UIElement";
|
|
2
|
-
/**
|
|
3
|
-
* Internal implementation of micro-transformations for UI elements.
|
|
4
|
-
* Stores the raw transformation values and recalculation flag.
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export declare class UIMicroInternal {
|
|
8
|
-
/** X-axis offset from element position */
|
|
9
|
-
x: number;
|
|
10
|
-
/** Y-axis offset from element position */
|
|
11
|
-
y: number;
|
|
12
|
-
/** X-axis anchor point (0-1) where transformations are applied */
|
|
13
|
-
anchorX: number;
|
|
14
|
-
/** Y-axis anchor point (0-1) where transformations are applied */
|
|
15
|
-
anchorY: number;
|
|
16
|
-
/** X-axis scaling factor */
|
|
17
|
-
scaleX: number;
|
|
18
|
-
/** Y-axis scaling factor */
|
|
19
|
-
scaleY: number;
|
|
20
|
-
/** Rotation in radians */
|
|
21
|
-
rotation: number;
|
|
22
|
-
/** Flag indicating whether transformations need to be recalculated */
|
|
23
|
-
needsRecalculation: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Provides fine-grained transformations for UI elements.
|
|
27
|
-
*
|
|
28
|
-
* Micro-transformations allow for detailed positioning, scaling, and rotation
|
|
29
|
-
* adjustments relative to an element's base position and dimensions.
|
|
30
|
-
* These transformations are applied on top of the standard element positioning
|
|
31
|
-
* and can be used for effects like pivoting, offsetting, and animation.
|
|
32
|
-
*/
|
|
33
|
-
export declare class UIMicro {
|
|
34
|
-
private readonly raw;
|
|
35
|
-
private readonly owner;
|
|
36
|
-
/**
|
|
37
|
-
* Creates a new micro-transformation interface.
|
|
38
|
-
*
|
|
39
|
-
* @param raw - The internal state object that stores transformation values
|
|
40
|
-
* @param owner - The UI element that owns these transformations
|
|
41
|
-
*/
|
|
42
|
-
constructor(raw: UIMicroInternal, owner: UIElement);
|
|
43
|
-
/**
|
|
44
|
-
* Gets the X-axis offset from the element's position.
|
|
45
|
-
*/
|
|
46
|
-
get x(): number;
|
|
47
|
-
/**
|
|
48
|
-
* Gets the Y-axis offset from the element's position.
|
|
49
|
-
*/
|
|
50
|
-
get y(): number;
|
|
51
|
-
/**
|
|
52
|
-
* Gets the X-axis anchor point (0-1) where transformations are applied.
|
|
53
|
-
*
|
|
54
|
-
* - 0.0 = left edge
|
|
55
|
-
* - 0.5 = center (default)
|
|
56
|
-
* - 1.0 = right edge
|
|
57
|
-
*/
|
|
58
|
-
get anchorX(): number;
|
|
59
|
-
/**
|
|
60
|
-
* Gets the Y-axis anchor point (0-1) where transformations are applied.
|
|
61
|
-
*
|
|
62
|
-
* - 0.0 = top edge
|
|
63
|
-
* - 0.5 = center (default)
|
|
64
|
-
* - 1.0 = bottom edge
|
|
65
|
-
*/
|
|
66
|
-
get anchorY(): number;
|
|
67
|
-
/**
|
|
68
|
-
* Gets the X-axis scaling factor.
|
|
69
|
-
*
|
|
70
|
-
* - 1.0 = normal size (default)
|
|
71
|
-
* - > 1.0 = enlarged
|
|
72
|
-
* - < 1.0 = reduced
|
|
73
|
-
*/
|
|
74
|
-
get scaleX(): number;
|
|
75
|
-
/**
|
|
76
|
-
* Gets the Y-axis scaling factor.
|
|
77
|
-
*
|
|
78
|
-
* - 1.0 = normal size (default)
|
|
79
|
-
* - > 1.0 = enlarged
|
|
80
|
-
* - < 1.0 = reduced
|
|
81
|
-
*/
|
|
82
|
-
get scaleY(): number;
|
|
83
|
-
/**
|
|
84
|
-
* Gets the rotation in degrees.
|
|
85
|
-
* Converted from the internal radians value.
|
|
86
|
-
*/
|
|
87
|
-
get angle(): number;
|
|
88
|
-
/**
|
|
89
|
-
* Gets the rotation in radians.
|
|
90
|
-
*/
|
|
91
|
-
get rotation(): number;
|
|
92
|
-
/**
|
|
93
|
-
* Sets the X-axis offset from the element's position.
|
|
94
|
-
*
|
|
95
|
-
* @param value - X offset in pixels
|
|
96
|
-
*/
|
|
97
|
-
set x(value: number);
|
|
98
|
-
/**
|
|
99
|
-
* Sets the Y-axis offset from the element's position.
|
|
100
|
-
*
|
|
101
|
-
* @param value - Y offset in pixels
|
|
102
|
-
*/
|
|
103
|
-
set y(value: number);
|
|
104
|
-
/**
|
|
105
|
-
* Sets the X-axis anchor point where transformations are applied.
|
|
106
|
-
*
|
|
107
|
-
* @param value - X anchor (0-1):
|
|
108
|
-
* - 0.0 = left edge
|
|
109
|
-
* - 0.5 = center (default)
|
|
110
|
-
* - 1.0 = right edge
|
|
111
|
-
*/
|
|
112
|
-
set anchorX(value: number);
|
|
113
|
-
/**
|
|
114
|
-
* Sets the Y-axis anchor point where transformations are applied.
|
|
115
|
-
*
|
|
116
|
-
* @param value - Y anchor (0-1):
|
|
117
|
-
* - 0.0 = top edge
|
|
118
|
-
* - 0.5 = center (default)
|
|
119
|
-
* - 1.0 = bottom edge
|
|
120
|
-
*/
|
|
121
|
-
set anchorY(value: number);
|
|
122
|
-
/**
|
|
123
|
-
* Sets the X-axis scaling factor.
|
|
124
|
-
*
|
|
125
|
-
* @param value - X scale factor:
|
|
126
|
-
* - 1.0 = normal size (default)
|
|
127
|
-
* - > 1.0 = enlarged
|
|
128
|
-
* - < 1.0 = reduced
|
|
129
|
-
*/
|
|
130
|
-
set scaleX(value: number);
|
|
131
|
-
/**
|
|
132
|
-
* Sets the Y-axis scaling factor.
|
|
133
|
-
*
|
|
134
|
-
* @param value - Y scale factor:
|
|
135
|
-
* - 1.0 = normal size (default)
|
|
136
|
-
* - > 1.0 = enlarged
|
|
137
|
-
* - < 1.0 = reduced
|
|
138
|
-
*/
|
|
139
|
-
set scaleY(value: number);
|
|
140
|
-
/**
|
|
141
|
-
* Sets the rotation in degrees.
|
|
142
|
-
* Automatically converts to radians for internal storage.
|
|
143
|
-
*
|
|
144
|
-
* @param value - Rotation angle in degrees
|
|
145
|
-
*/
|
|
146
|
-
set angle(value: number);
|
|
147
|
-
/**
|
|
148
|
-
* Sets the rotation in radians.
|
|
149
|
-
*
|
|
150
|
-
* @param value - Rotation angle in radians
|
|
151
|
-
*/
|
|
152
|
-
set rotation(value: number);
|
|
153
|
-
/**
|
|
154
|
-
* Sets the anchor point based on global coordinates relative to the element.
|
|
155
|
-
* Converts the global position to a normalized anchor point (0-1 range).
|
|
156
|
-
*
|
|
157
|
-
* This is useful for setting the pivot point to a specific position,
|
|
158
|
-
* such as making an element rotate around a particular point.
|
|
159
|
-
*
|
|
160
|
-
* @param x - Global X coordinate to set as anchor
|
|
161
|
-
* @param y - Global Y coordinate to set as anchor
|
|
162
|
-
*/
|
|
163
|
-
setAnchorByGlobalPosition(x: number, y: number): void;
|
|
164
|
-
/**
|
|
165
|
-
* Resets all micro-transformations to their default values.
|
|
166
|
-
*
|
|
167
|
-
* Default values:
|
|
168
|
-
* - Position (x, y): 0
|
|
169
|
-
* - Anchor (anchorX, anchorY): 0.5 (centered)
|
|
170
|
-
* - Scale (scaleX, scaleY): 1.0 (original size)
|
|
171
|
-
* - Rotation: 0 (no rotation)
|
|
172
|
-
*
|
|
173
|
-
* Only triggers recalculation if any values were changed.
|
|
174
|
-
*/
|
|
175
|
-
reset(): void;
|
|
176
|
-
}
|