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.
- package/README.md +353 -2
- package/dist/builders/UIConstraint2DBuilder.d.ts +102 -14
- 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 +40 -36
- package/dist/constraints/UIConstraint.d.ts +17 -20
- package/dist/constraints/UICoverConstraint.d.ts +0 -72
- package/dist/constraints/UICustomConstraint.d.ts +60 -0
- package/dist/constraints/UIFitConstraint.d.ts +0 -72
- package/dist/constraints/UIHeightConstraint.d.ts +32 -38
- package/dist/constraints/UIHorizontalDistanceConstraint.d.ts +77 -46
- package/dist/constraints/UIHorizontalProportionConstraint.d.ts +49 -40
- package/dist/constraints/UISingleParameterConstraint.d.ts +108 -0
- package/dist/constraints/UIVerticalDistanceConstraint.d.ts +77 -46
- package/dist/constraints/UIVerticalProportionConstraint.d.ts +49 -40
- package/dist/constraints/UIWidthConstraint.d.ts +32 -38
- package/dist/elements/UIAnchor.d.ts +58 -45
- package/dist/elements/UIDummy.d.ts +63 -12
- package/dist/elements/UIElement.d.ts +81 -93
- package/dist/elements/UIImage.d.ts +64 -33
- package/dist/elements/UINineSline.d.ts +0 -0
- package/dist/elements/UIProgress.d.ts +7 -95
- package/dist/elements/UIScene.d.ts +142 -84
- package/dist/elements/UIText.d.ts +124 -43
- package/dist/index.d.ts +10 -11
- package/dist/index.js +2887 -2716
- 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 +134 -57
- package/dist/materials/UIInstancedMaterial.d.ts +0 -0
- package/dist/materials/UIMaterial.d.ts +6 -6
- package/dist/materials/UINineSliceMaterial.d.ts +0 -0
- package/dist/materials/UIProgressMaterial.d.ts +0 -4
- package/dist/miscellaneous/UIExpression.d.ts +117 -0
- package/dist/miscellaneous/UIMicro.d.ts +73 -119
- package/dist/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 +111 -4
- package/dist/miscellaneous/textInterfaces.d.ts +19 -0
- package/dist/miscellaneous/textTools.d.ts +8 -5
- 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 +1 -1
- 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/builders/UIConstraintContainerBuilder.d.ts +0 -20
- package/dist/builders/UIConstraintStackBuilder.d.ts +0 -24
- package/dist/constraints/UIConstraintPower.d.ts +0 -57
- package/dist/constraints/UIConstraintRule.d.ts +0 -46
- package/dist/layers/UIFullScreenLayer.d.ts +0 -13
- package/dist/miscellaneous/UIBlending.d.ts +0 -7
- package/dist/miscellaneous/UITextInterfaces.d.ts +0 -49
- package/dist/miscellaneous/math.d.ts +0 -1
- package/dist/miscellaneous/microTransformationTools.d.ts +0 -3
|
@@ -1,63 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { UIOrientation } from "../miscellaneous/UIOrientation";
|
|
5
|
-
import { UIConstraint } from "./UIConstraint";
|
|
6
|
-
import type { UIConstraintPower } from "./UIConstraintPower";
|
|
7
|
-
import type { UIConstraintRule } from "./UIConstraintRule";
|
|
1
|
+
import type { UIPlaneElement, UIPointElement } from "../miscellaneous/asserts";
|
|
2
|
+
import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint";
|
|
3
|
+
import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
|
|
8
4
|
/**
|
|
9
|
-
* Configuration options for
|
|
5
|
+
* Configuration options for UIVerticalDistanceConstraint creation.
|
|
10
6
|
*/
|
|
11
|
-
export interface
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
/** The
|
|
7
|
+
export interface UIVerticalDistanceConstraintOptions extends UISingleParameterConstraintOptions {
|
|
8
|
+
/** Anchor point for element A (0.0 = top edge, 0.5 = center, 1.0 = bottom edge). */
|
|
9
|
+
anchorA: number;
|
|
10
|
+
/** Anchor point for element B (0.0 = top edge, 0.5 = center, 1.0 = bottom edge). */
|
|
11
|
+
anchorB: number;
|
|
12
|
+
/** The desired vertical distance between the elements. */
|
|
17
13
|
distance: number;
|
|
18
|
-
/** Priority level for this constraint */
|
|
19
|
-
power: UIConstraintPower;
|
|
20
|
-
/** Rule for the constraint relationship (equal, less than, greater than) */
|
|
21
|
-
rule: UIConstraintRule;
|
|
22
|
-
/** Screen orientation when this constraint should be active */
|
|
23
|
-
orientation: UIOrientation;
|
|
24
14
|
}
|
|
25
15
|
/**
|
|
26
|
-
* Constraint that enforces
|
|
16
|
+
* Constraint that enforces vertical distance between two UI elements.
|
|
27
17
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
18
|
+
* UIVerticalDistanceConstraint creates a mathematical relationship that maintains
|
|
19
|
+
* a specific vertical distance between two elements using configurable anchor points.
|
|
20
|
+
* For plane elements, anchors determine the reference point (0.0 = top, 0.5 = center, 1.0 = bottom).
|
|
21
|
+
* For point elements, the anchor is always the element's position. The constraint equation is:
|
|
22
|
+
* (elementB.y + elementB.height * anchorB) - (elementA.y + elementA.height * anchorA) = distance
|
|
23
|
+
*
|
|
24
|
+
* @see {@link UISingleParameterConstraint} - Base class for single-parameter constraints
|
|
25
|
+
* @see {@link UIPointElement} - Point elements that can be constrained
|
|
26
|
+
* @see {@link UIPlaneElement} - Plane elements that can be constrained
|
|
27
|
+
* @see {@link UIExpression} - Mathematical expressions for constraint equations
|
|
30
28
|
*/
|
|
31
|
-
export declare class UIVerticalDistanceConstraint extends
|
|
32
|
-
private readonly
|
|
33
|
-
private readonly
|
|
34
|
-
/** The
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
private
|
|
38
|
-
/**
|
|
39
|
-
|
|
29
|
+
export declare class UIVerticalDistanceConstraint extends UISingleParameterConstraint {
|
|
30
|
+
private readonly a;
|
|
31
|
+
private readonly b;
|
|
32
|
+
/** The constraint descriptor managed by the solver system. */
|
|
33
|
+
protected readonly constraint: number;
|
|
34
|
+
/** Internal storage for element A's anchor point. */
|
|
35
|
+
private anchorAInternal;
|
|
36
|
+
/** Internal storage for element B's anchor point. */
|
|
37
|
+
private anchorBInternal;
|
|
38
|
+
/** Internal storage for the vertical distance value. */
|
|
39
|
+
private distanceInternal;
|
|
40
|
+
/**
|
|
41
|
+
* Creates a new UIVerticalDistanceConstraint instance.
|
|
40
42
|
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
43
|
+
* The constraint will use default anchor points (0.5 = center) and zero distance
|
|
44
|
+
* if not specified in options. Both elements must be from the same layer.
|
|
45
|
+
*
|
|
46
|
+
* @param a - The first UI element (point or plane element)
|
|
47
|
+
* @param b - The second UI element (point or plane element)
|
|
48
|
+
* @param options - Configuration options for the constraint
|
|
49
|
+
* @throws Will throw an error if elements are not from the same layer
|
|
50
|
+
* @see {@link assertValidConstraintSubjects}
|
|
44
51
|
*/
|
|
45
|
-
constructor(
|
|
52
|
+
constructor(a: UIPointElement | UIPlaneElement, b: UIPointElement | UIPlaneElement, options?: Partial<UIVerticalDistanceConstraintOptions>);
|
|
46
53
|
/**
|
|
47
|
-
*
|
|
54
|
+
* Gets the current vertical distance being enforced.
|
|
55
|
+
* @returns The vertical distance in pixels
|
|
48
56
|
*/
|
|
49
|
-
|
|
57
|
+
get distance(): number;
|
|
50
58
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
59
|
+
* Gets the anchor point for element A.
|
|
60
|
+
* @returns The anchor value (0.0 = top, 0.5 = center, 1.0 = bottom)
|
|
61
|
+
*/
|
|
62
|
+
get anchorA(): number;
|
|
63
|
+
/**
|
|
64
|
+
* Gets the anchor point for element B.
|
|
65
|
+
* @returns The anchor value (0.0 = top, 0.5 = center, 1.0 = bottom)
|
|
56
66
|
*/
|
|
57
|
-
|
|
67
|
+
get anchorB(): number;
|
|
58
68
|
/**
|
|
59
|
-
*
|
|
69
|
+
* Sets a new vertical distance and updates the constraint equation.
|
|
70
|
+
* @param value - The new vertical distance in pixels
|
|
71
|
+
*/
|
|
72
|
+
set distance(value: number);
|
|
73
|
+
/**
|
|
74
|
+
* Sets a new anchor point for element A and updates the constraint equation.
|
|
75
|
+
* @param value - The new anchor value (0.0 = top, 0.5 = center, 1.0 = bottom)
|
|
76
|
+
*/
|
|
77
|
+
set anchorA(value: number);
|
|
78
|
+
/**
|
|
79
|
+
* Sets a new anchor point for element B and updates the constraint equation.
|
|
80
|
+
* @param value - The new anchor value (0.0 = top, 0.5 = center, 1.0 = bottom)
|
|
81
|
+
*/
|
|
82
|
+
set anchorB(value: number);
|
|
83
|
+
/**
|
|
84
|
+
* Builds the left-hand side expression for the constraint equation.
|
|
85
|
+
*
|
|
86
|
+
* Creates the expression: (elementB.y + elementB.height * anchorB) - (elementA.y + elementA.height * anchorA)
|
|
87
|
+
* For point elements, only the y position is used since they have no height.
|
|
88
|
+
* For plane elements, the anchor determines the reference point within the element's height.
|
|
60
89
|
*
|
|
90
|
+
* @returns The UIExpression representing the vertical distance calculation
|
|
91
|
+
* @private
|
|
61
92
|
*/
|
|
62
|
-
|
|
93
|
+
private buildLHS;
|
|
63
94
|
}
|
|
@@ -1,58 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
import { UIConstraint } from "./UIConstraint";
|
|
5
|
-
import type { UIConstraintPower } from "./UIConstraintPower";
|
|
6
|
-
import type { UIConstraintRule } from "./UIConstraintRule";
|
|
1
|
+
import type { UIPlaneElement } from "../miscellaneous/asserts";
|
|
2
|
+
import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint";
|
|
3
|
+
import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
|
|
7
4
|
/**
|
|
8
|
-
* Configuration options for
|
|
5
|
+
* Configuration options for UIVerticalProportionConstraint creation.
|
|
9
6
|
*/
|
|
10
|
-
export interface
|
|
11
|
-
/** The
|
|
7
|
+
export interface UIVerticalProportionConstraintOptions extends UISingleParameterConstraintOptions {
|
|
8
|
+
/** The proportional relationship between element heights (elementA.height = elementB.height * proportion). */
|
|
12
9
|
proportion: number;
|
|
13
|
-
/** Priority level for this constraint */
|
|
14
|
-
power: UIConstraintPower;
|
|
15
|
-
/** Rule for the constraint relationship (equal, less than, greater than) */
|
|
16
|
-
rule: UIConstraintRule;
|
|
17
|
-
/** Screen orientation when this constraint should be active */
|
|
18
|
-
orientation: UIOrientation;
|
|
19
10
|
}
|
|
20
11
|
/**
|
|
21
|
-
* Constraint that enforces
|
|
12
|
+
* Constraint that enforces proportional height relationships between two UI elements.
|
|
22
13
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
14
|
+
* UIVerticalProportionConstraint creates a mathematical relationship that maintains
|
|
15
|
+
* a proportional ratio between the heights of two plane elements. The constraint equation is:
|
|
16
|
+
* elementA.height * proportion = elementB.height, which can be rearranged as:
|
|
17
|
+
* elementA.height * proportion - elementB.height = 0
|
|
18
|
+
*
|
|
19
|
+
* This is useful for creating responsive layouts where elements need to maintain
|
|
20
|
+
* specific height ratios, such as header-to-content ratios or row height proportions.
|
|
21
|
+
*
|
|
22
|
+
* @see {@link UISingleParameterConstraint} - Base class for single-parameter constraints
|
|
23
|
+
* @see {@link UIPlaneElement} - Plane elements that can have proportional constraints applied
|
|
24
|
+
* @see {@link UIExpression} - Mathematical expressions for constraint equations
|
|
25
25
|
*/
|
|
26
|
-
export declare class UIVerticalProportionConstraint extends
|
|
27
|
-
private readonly
|
|
28
|
-
private readonly
|
|
29
|
-
/** The
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
private
|
|
26
|
+
export declare class UIVerticalProportionConstraint extends UISingleParameterConstraint {
|
|
27
|
+
private readonly a;
|
|
28
|
+
private readonly b;
|
|
29
|
+
/** The constraint descriptor managed by the solver system. */
|
|
30
|
+
protected readonly constraint: number;
|
|
31
|
+
/** Internal storage for the current proportion value. */
|
|
32
|
+
private proportionInternal;
|
|
33
33
|
/**
|
|
34
|
-
* Creates a new
|
|
34
|
+
* Creates a new UIVerticalProportionConstraint instance.
|
|
35
|
+
*
|
|
36
|
+
* The constraint will enforce the relationship: elementA.height * proportion = elementB.height.
|
|
37
|
+
* If no proportion is specified, it defaults to 1.0 (equal heights).
|
|
38
|
+
* Both elements must be from the same layer.
|
|
35
39
|
*
|
|
36
|
-
* @param
|
|
37
|
-
* @param
|
|
38
|
-
* @param options - Configuration options
|
|
40
|
+
* @param a - The first UI plane element (whose height will be multiplied by proportion)
|
|
41
|
+
* @param b - The second UI plane element (target height for the proportion)
|
|
42
|
+
* @param options - Configuration options for the constraint
|
|
43
|
+
* @throws Will throw an error if elements are not from the same layer
|
|
44
|
+
* @see {@link assertValidConstraintSubjects}
|
|
39
45
|
*/
|
|
40
|
-
constructor(
|
|
46
|
+
constructor(a: UIPlaneElement, b: UIPlaneElement, options?: Partial<UIVerticalProportionConstraintOptions>);
|
|
41
47
|
/**
|
|
42
|
-
*
|
|
48
|
+
* Gets the current proportion value being enforced.
|
|
49
|
+
* @returns The proportion ratio (elementA.height = elementB.height * proportion)
|
|
43
50
|
*/
|
|
44
|
-
|
|
51
|
+
get proportion(): number;
|
|
45
52
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* Creates a constraint expression in the form: (elementOne.height * proportion) - elementTwo.height = 0
|
|
49
|
-
* This ensures the height ratio between elements matches the specified proportion.
|
|
50
|
-
*
|
|
53
|
+
* Sets a new proportion value and updates the constraint equation.
|
|
54
|
+
* @param value - The new proportion ratio
|
|
51
55
|
*/
|
|
52
|
-
|
|
56
|
+
set proportion(value: number);
|
|
53
57
|
/**
|
|
54
|
-
*
|
|
58
|
+
* Builds the left-hand side expression for the constraint equation.
|
|
59
|
+
*
|
|
60
|
+
* Creates the expression: (elementA.height * proportion) - elementB.height = 0
|
|
61
|
+
* This enforces the relationship: elementA.height * proportion = elementB.height
|
|
55
62
|
*
|
|
63
|
+
* @returns The UIExpression representing the proportional height relationship
|
|
64
|
+
* @private
|
|
56
65
|
*/
|
|
57
|
-
|
|
66
|
+
private buildLHS;
|
|
58
67
|
}
|
|
@@ -1,55 +1,49 @@
|
|
|
1
1
|
import type { UIElement } from "../elements/UIElement";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import type { UIConstraintPower } from "./UIConstraintPower";
|
|
5
|
-
import type { UIConstraintRule } from "./UIConstraintRule";
|
|
2
|
+
import type { UISingleParameterConstraintOptions } from "./UISingleParameterConstraint";
|
|
3
|
+
import { UISingleParameterConstraint } from "./UISingleParameterConstraint";
|
|
6
4
|
/**
|
|
7
|
-
* Configuration options for
|
|
5
|
+
* Configuration options for UIWidthConstraint creation.
|
|
8
6
|
*/
|
|
9
|
-
export interface
|
|
10
|
-
/** The
|
|
7
|
+
export interface UIWidthConstraintOptions extends UISingleParameterConstraintOptions {
|
|
8
|
+
/** The desired width value for the element. */
|
|
11
9
|
width: number;
|
|
12
|
-
/** Priority level for this constraint */
|
|
13
|
-
power: UIConstraintPower;
|
|
14
|
-
/** Rule for the constraint relationship (equal, less than, greater than) */
|
|
15
|
-
rule: UIConstraintRule;
|
|
16
|
-
/** Screen orientation when this constraint should be active */
|
|
17
|
-
orientation: UIOrientation;
|
|
18
10
|
}
|
|
19
11
|
/**
|
|
20
|
-
* Constraint that enforces a specific width for
|
|
12
|
+
* Constraint that enforces a specific width value for UI elements.
|
|
21
13
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
14
|
+
* UIWidthConstraint creates a mathematical relationship that fixes an element's
|
|
15
|
+
* width to a constant value. The constraint equation is: element.width = width.
|
|
16
|
+
* This is useful for ensuring elements maintain a specific width regardless of
|
|
17
|
+
* other layout changes or for setting fixed dimensions in responsive layouts.
|
|
18
|
+
*
|
|
19
|
+
* @see {@link UISingleParameterConstraint} - Base class for single-parameter constraints
|
|
20
|
+
* @see {@link UIElement} - Elements that can have width constraints applied
|
|
21
|
+
* @see {@link UIExpression} - Mathematical expressions for constraint equations
|
|
24
22
|
*/
|
|
25
|
-
export declare class UIWidthConstraint extends
|
|
23
|
+
export declare class UIWidthConstraint extends UISingleParameterConstraint {
|
|
26
24
|
private readonly element;
|
|
27
|
-
/** The
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
private
|
|
25
|
+
/** The constraint descriptor managed by the solver system. */
|
|
26
|
+
protected readonly constraint: number;
|
|
27
|
+
/** Internal storage for the current width value. */
|
|
28
|
+
private widthInternal;
|
|
31
29
|
/**
|
|
32
|
-
* Creates a new
|
|
30
|
+
* Creates a new UIWidthConstraint instance.
|
|
31
|
+
*
|
|
32
|
+
* If no width is specified in options, the constraint will use the
|
|
33
|
+
* element's current width as the target width value.
|
|
33
34
|
*
|
|
34
|
-
* @param element - The UI element to
|
|
35
|
-
* @param options - Configuration options
|
|
35
|
+
* @param element - The UI element to apply the width constraint to
|
|
36
|
+
* @param options - Configuration options for the constraint
|
|
36
37
|
*/
|
|
37
|
-
constructor(element: UIElement, options?: Partial<
|
|
38
|
+
constructor(element: UIElement, options?: Partial<UIWidthConstraintOptions>);
|
|
38
39
|
/**
|
|
39
|
-
*
|
|
40
|
+
* Gets the current width value being enforced.
|
|
41
|
+
* @returns The width value in pixels
|
|
40
42
|
*/
|
|
41
|
-
|
|
43
|
+
get width(): number;
|
|
42
44
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* Creates a constraint that enforces the element's width based
|
|
46
|
-
* on the specified rule (equal to, less than, or greater than).
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
protected buildConstraints(): void;
|
|
50
|
-
/**
|
|
51
|
-
* Removes the width constraint from the constraint solver.
|
|
52
|
-
*
|
|
45
|
+
* Sets a new width value and updates the constraint equation.
|
|
46
|
+
* @param value - The new width value in pixels
|
|
53
47
|
*/
|
|
54
|
-
|
|
48
|
+
set width(value: number);
|
|
55
49
|
}
|
|
@@ -1,65 +1,78 @@
|
|
|
1
|
-
import { Variable } from "@lume/kiwi";
|
|
2
1
|
import { Eventail } from "eventail";
|
|
3
|
-
import type { Object3D, WebGLRenderer } from "three";
|
|
4
2
|
import type { UILayer } from "../layers/UILayer";
|
|
5
|
-
|
|
3
|
+
import type { UIPointElement } from "../miscellaneous/asserts";
|
|
4
|
+
import type { UISolverWrapper } from "../wrappers/UISolverWrapper";
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base class representing a minimal UI element as a point in 2D space.
|
|
7
|
+
*
|
|
8
|
+
* A UIAnchor serves as the fundamental building block for UI layout systems,
|
|
9
|
+
* representing a single point with x and y coordinates. It provides constraint-based
|
|
10
|
+
* positioning through solver variables and serves as an anchor point for more
|
|
11
|
+
* complex UI elements.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link UIPointElement} - Interface defining point element behavior
|
|
14
|
+
* @see {@link UILayer} - Container layer for UI elements
|
|
15
|
+
* @see {@link UISolverWrapper} - Constraint solver integration
|
|
16
|
+
*/
|
|
17
|
+
export declare abstract class UIAnchor extends Eventail implements UIPointElement {
|
|
6
18
|
readonly layer: UILayer;
|
|
7
|
-
|
|
8
|
-
/** X position variable for constraint system */
|
|
9
|
-
["xInternal"]: Variable;
|
|
10
|
-
/** Y position variable for constraint system */
|
|
11
|
-
["yInternal"]: Variable;
|
|
12
|
-
/** Flag indicating whether the element needs recalculation */
|
|
13
|
-
["needsRecalculationInternal"]: boolean;
|
|
14
|
-
/** Unique identifier for the element */
|
|
19
|
+
/** Optional name identifier for the anchor. */
|
|
15
20
|
name: string;
|
|
16
21
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @param layer - The UI layer that contains this element
|
|
20
|
-
* @param x - Initial x position
|
|
21
|
-
* @param y - Initial y position
|
|
22
|
+
* Solver variable descriptor for the x-coordinate.
|
|
23
|
+
* This variable is managed by the constraint solver system.
|
|
22
24
|
*/
|
|
23
|
-
|
|
24
|
-
/** Gets the current x position of the anchor */
|
|
25
|
-
get x(): number;
|
|
26
|
-
/** Gets the current y position of the anchor */
|
|
27
|
-
get y(): number;
|
|
28
|
-
/** Gets the current z-index (depth) of the element */
|
|
29
|
-
get zIndex(): number;
|
|
30
|
-
/** Gets whether the element needs recalculation */
|
|
31
|
-
protected get needsRecalculation(): boolean;
|
|
25
|
+
readonly xVariable: number;
|
|
32
26
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
27
|
+
* Solver variable descriptor for the y-coordinate.
|
|
28
|
+
* This variable is managed by the constraint solver system.
|
|
35
29
|
*/
|
|
36
|
-
|
|
30
|
+
readonly yVariable: number;
|
|
37
31
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
32
|
+
* Reference to the constraint solver wrapper for variable management.
|
|
33
|
+
* @see {@link UISolverWrapper}
|
|
40
34
|
*/
|
|
41
|
-
|
|
35
|
+
protected readonly solverWrapper: UISolverWrapper;
|
|
42
36
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
37
|
+
* Creates a new UIAnchor instance.
|
|
38
|
+
*
|
|
39
|
+
* @param layer - The UI layer that contains this anchor
|
|
40
|
+
* @param x - Initial x-coordinate position
|
|
41
|
+
* @param y - Initial y-coordinate position
|
|
42
|
+
* @throws Will throw an error if x or y are not valid numbers
|
|
43
|
+
* @see {@link assertValidNumber}
|
|
45
44
|
*/
|
|
46
|
-
|
|
45
|
+
constructor(layer: UILayer, x: number, y: number);
|
|
47
46
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
47
|
+
* Gets the current x-coordinate value from the solver.
|
|
48
|
+
* @returns The current x-coordinate position
|
|
50
49
|
*/
|
|
51
|
-
|
|
50
|
+
get x(): number;
|
|
52
51
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* Gets the current y-coordinate value from the solver.
|
|
53
|
+
* @returns The current y-coordinate position
|
|
55
54
|
*/
|
|
56
|
-
|
|
55
|
+
get y(): number;
|
|
56
|
+
/**
|
|
57
|
+
* Sets the x-coordinate value through the solver system.
|
|
58
|
+
* @param value - The new x-coordinate value
|
|
59
|
+
* @throws Will throw an error if value is not a valid number
|
|
60
|
+
* @see {@link assertValidNumber}
|
|
61
|
+
*/
|
|
62
|
+
set x(value: number);
|
|
57
63
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
64
|
+
* Sets the y-coordinate value through the solver system.
|
|
65
|
+
* @param value - The new y-coordinate value
|
|
66
|
+
* @throws Will throw an error if value is not a valid number
|
|
67
|
+
* @see {@link assertValidNumber}
|
|
68
|
+
*/
|
|
69
|
+
set y(value: number);
|
|
70
|
+
/**
|
|
71
|
+
* Destroys the anchor by removing its solver variables.
|
|
60
72
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
73
|
+
* This method cleans up the solver variables associated with this anchor,
|
|
74
|
+
* effectively removing it from the constraint solving system. After calling
|
|
75
|
+
* this method, the anchor should not be used anymore.
|
|
63
76
|
*/
|
|
64
|
-
|
|
77
|
+
destroy(): void;
|
|
65
78
|
}
|
|
@@ -1,21 +1,72 @@
|
|
|
1
1
|
import type { UILayer } from "../layers/UILayer";
|
|
2
|
-
import {
|
|
2
|
+
import { type UIPlaneElement } from "../miscellaneous/asserts";
|
|
3
|
+
import { UIAnchor } from "./UIAnchor";
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
5
|
+
* Abstract UI element that extends UIAnchor with dimensions but without rendering.
|
|
6
|
+
*
|
|
7
|
+
* UIDummy represents a rectangular area in the UI layout system that has position
|
|
8
|
+
* and dimensions (width and height) but does not perform any visual rendering.
|
|
9
|
+
* It serves as a placeholder or spacer element in constraint-based layouts,
|
|
10
|
+
* useful for defining layout structure without visual content.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link UIAnchor} - Base class providing position functionality
|
|
13
|
+
* @see {@link UIPlaneElement} - Interface defining dimensional element behavior
|
|
14
|
+
* @see {@link UILayer} - Container layer for UI elements
|
|
6
15
|
*/
|
|
7
|
-
export declare class UIDummy extends
|
|
16
|
+
export declare abstract class UIDummy extends UIAnchor implements UIPlaneElement {
|
|
8
17
|
/**
|
|
9
|
-
*
|
|
18
|
+
* Solver variable descriptor for the width dimension.
|
|
19
|
+
* This variable is managed by the constraint solver system.
|
|
20
|
+
*/
|
|
21
|
+
readonly wVariable: number;
|
|
22
|
+
/**
|
|
23
|
+
* Solver variable descriptor for the height dimension.
|
|
24
|
+
* This variable is managed by the constraint solver system.
|
|
25
|
+
*/
|
|
26
|
+
readonly hVariable: number;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new UIDummy instance with position and dimensions.
|
|
10
29
|
*
|
|
11
|
-
* @param layer - The UI layer that contains this element
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
30
|
+
* @param layer - The UI layer that contains this dummy element
|
|
31
|
+
* @param x - Initial x-coordinate position
|
|
32
|
+
* @param y - Initial y-coordinate position
|
|
33
|
+
* @param width - Initial width dimension (defaults to 100)
|
|
34
|
+
* @param height - Initial height dimension (defaults to 100)
|
|
35
|
+
* @throws Will throw an error if width or height are not valid positive numbers
|
|
36
|
+
* @see {@link assertValidPositiveNumber}
|
|
14
37
|
*/
|
|
15
|
-
constructor(layer: UILayer, width?: number, height?: number);
|
|
38
|
+
constructor(layer: UILayer, x: number, y: number, width?: number, height?: number);
|
|
16
39
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
40
|
+
* Gets the current width value from the solver.
|
|
41
|
+
* @returns The current width dimension
|
|
42
|
+
*/
|
|
43
|
+
get width(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Gets the current height value from the solver.
|
|
46
|
+
* @returns The current height dimension
|
|
47
|
+
*/
|
|
48
|
+
get height(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Sets the width value through the solver system.
|
|
51
|
+
* @param value - The new width dimension (must be positive)
|
|
52
|
+
* @throws Will throw an error if value is not a valid positive number
|
|
53
|
+
* @see {@link assertValidPositiveNumber}
|
|
54
|
+
*/
|
|
55
|
+
set width(value: number);
|
|
56
|
+
/**
|
|
57
|
+
* Sets the height value through the solver system.
|
|
58
|
+
* @param value - The new height dimension (must be positive)
|
|
59
|
+
* @throws Will throw an error if value is not a valid positive number
|
|
60
|
+
* @see {@link assertValidPositiveNumber}
|
|
61
|
+
*/
|
|
62
|
+
set height(value: number);
|
|
63
|
+
/**
|
|
64
|
+
* Destroys the dummy element by removing its solver variables.
|
|
65
|
+
*
|
|
66
|
+
* This method cleans up the dimension solver variables (width and height)
|
|
67
|
+
* associated with this dummy element, then calls the parent destroy method
|
|
68
|
+
* to clean up position variables. After calling this method, the dummy
|
|
69
|
+
* element should not be used anymore.
|
|
19
70
|
*/
|
|
20
|
-
|
|
71
|
+
destroy(): void;
|
|
21
72
|
}
|