@galacean/engine-ui 1.5.14 → 1.6.0-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-ui",
3
- "version": "1.5.14",
3
+ "version": "1.6.0-alpha.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -26,10 +26,10 @@
26
26
  "types/**/*"
27
27
  ],
28
28
  "devDependencies": {
29
- "@galacean/engine": "1.5.14"
29
+ "@galacean/engine": "1.6.0-alpha.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "@galacean/engine": "1.5.14"
32
+ "@galacean/engine": "1.6.0-alpha.0"
33
33
  },
34
34
  "scripts": {
35
35
  "b:types": "tsc"
@@ -1,10 +1,21 @@
1
1
  import { Entity, Transform, Vector2 } from "@galacean/engine";
2
+ import { HorizontalAlignmentMode } from "../enums/HorizontalAlignmentMode";
3
+ import { VerticalAlignmentMode } from "../enums/VerticalAlignmentMode";
2
4
  /**
3
5
  * The Transform component exclusive to the UI element.
4
6
  */
5
7
  export declare class UITransform extends Transform {
6
8
  private _size;
7
9
  private _pivot;
10
+ private _rect;
11
+ private _alignLeft;
12
+ private _alignRight;
13
+ private _alignCenter;
14
+ private _alignTop;
15
+ private _alignBottom;
16
+ private _alignMiddle;
17
+ private _horizontalAlignment;
18
+ private _verticalAlignment;
8
19
  /**
9
20
  * Width and height of UI element.
10
21
  */
@@ -15,7 +26,86 @@ export declare class UITransform extends Transform {
15
26
  */
16
27
  get pivot(): Vector2;
17
28
  set pivot(value: Vector2);
29
+ /**
30
+ * Horizontal alignment mode.
31
+ *
32
+ * @remarks
33
+ * Controls how the element aligns horizontally within its parent:
34
+ * - `Left` - Align to parent's left edge
35
+ * - `Center` - Align to parent's horizontal center
36
+ * - `Right` - Align to parent's right edge
37
+ * - `LeftAndRight` - Align to both left and right edges (stretch to fill width)
38
+ */
39
+ get horizontalAlignment(): HorizontalAlignmentMode;
40
+ set horizontalAlignment(value: HorizontalAlignmentMode);
41
+ /**
42
+ * Left margin when horizontalAlignment is Left or LeftAndRight.
43
+ *
44
+ * @remarks
45
+ * Only effective when horizontalAlignment includes Left mode.
46
+ * Distance from the parent's left edge to the element's left edge.
47
+ */
48
+ get alignLeft(): number;
49
+ set alignLeft(value: number);
50
+ /**
51
+ * Right margin when horizontalAlignment is Right or LeftAndRight.
52
+ *
53
+ * @remarks
54
+ * Only effective when horizontalAlignment includes Right mode.
55
+ * Distance from the parent's right edge to the element's right edge.
56
+ */
57
+ get alignRight(): number;
58
+ set alignRight(value: number);
59
+ /**
60
+ * Horizontal center offset when horizontalAlignment is Center.
61
+ *
62
+ * @remarks
63
+ * Only effective when horizontalAlignment is Center mode.
64
+ * Positive values move the element to the right, negative values to the left.
65
+ */
66
+ get alignCenter(): number;
67
+ set alignCenter(value: number);
68
+ /**
69
+ * Vertical alignment mode.
70
+ *
71
+ * @remarks
72
+ * Controls how the element aligns vertically within its parent:
73
+ * - `Top` - Align to parent's top edge
74
+ * - `Middle` - Align to parent's vertical center
75
+ * - `Bottom` - Align to parent's bottom edge
76
+ * - `TopAndBottom` - Align to both top and bottom edges (stretch to fill height)
77
+ */
78
+ get verticalAlignment(): VerticalAlignmentMode;
79
+ set verticalAlignment(value: VerticalAlignmentMode);
80
+ /**
81
+ * Top margin when verticalAlignment is Top or TopAndBottom.
82
+ *
83
+ * @remarks
84
+ * Only effective when verticalAlignment includes Top mode.
85
+ * Used to offset the element from the parent's top edge.
86
+ */
87
+ get alignTop(): number;
88
+ set alignTop(value: number);
89
+ /**
90
+ * Bottom inset used in vertical alignment formulas.
91
+ */
92
+ get alignBottom(): number;
93
+ set alignBottom(value: number);
94
+ /**
95
+ * Vertical middle offset relative to parent's middle.
96
+ */
97
+ get alignMiddle(): number;
98
+ set alignMiddle(value: number);
18
99
  _cloneTo(target: UITransform, srcRoot: Entity, targetRoot: Entity): void;
19
- private _onSizeChange;
20
- private _onPivotChange;
100
+ protected _onLocalMatrixChanging(): void;
101
+ protected _onWorldMatrixChange(): void;
102
+ protected _onPositionChanged(): void;
103
+ protected _onWorldPositionChanged(): void;
104
+ private _updatePositionByAlignment;
105
+ private _updateSizeByAlignment;
106
+ private _updateRectByPivot;
107
+ private _onSizeChanged;
108
+ private _onPivotChanged;
109
+ private _updateWorldFlagWithSelfRectChange;
110
+ private _updateWorldFlagWithParentRectChange;
21
111
  }
@@ -0,0 +1,13 @@
1
+ /** Horizontal alignment mode. */
2
+ export declare enum HorizontalAlignmentMode {
3
+ /** No horizontal alignment. */
4
+ None = 0,
5
+ /** Left-aligned, `alignLeft` drives `position.x`. */
6
+ Left = 1,
7
+ /** Right-aligned, `alignRight` drives `position.x`. */
8
+ Right = 2,
9
+ /** Horizontal stretch, `alignLeft` and `alignRight` drive `position.x` and `size.x`. */
10
+ LeftAndRight = 3,
11
+ /** Center-aligned, `alignCenter` drives `position.x`. */
12
+ Center = 4
13
+ }
@@ -0,0 +1,13 @@
1
+ /** Vertical alignment mode. */
2
+ export declare enum VerticalAlignmentMode {
3
+ /** No vertical alignment. */
4
+ None = 0,
5
+ /** Top-aligned, `alignTop` drives `position.y`. */
6
+ Top = 1,
7
+ /** Bottom-aligned, `alignBottom` drives `position.y`. */
8
+ Bottom = 2,
9
+ /** Vertical stretch, `alignTop` and `alignBottom` drive `position.y` and `size.y`. */
10
+ TopAndBottom = 3,
11
+ /** Middle-aligned, `alignMiddle` drives `position.y`. */
12
+ Middle = 4
13
+ }
package/types/index.d.ts CHANGED
@@ -3,6 +3,8 @@ export * from "./component";
3
3
  export { CanvasRenderMode } from "./enums/CanvasRenderMode";
4
4
  export { ResolutionAdaptationMode } from "./enums/ResolutionAdaptationMode";
5
5
  export { UIPointerEventEmitter } from "./input/UIPointerEventEmitter";
6
+ export { HorizontalAlignmentMode } from "./enums/HorizontalAlignmentMode";
7
+ export { VerticalAlignmentMode } from "./enums/VerticalAlignmentMode";
6
8
  export declare class EngineExtension {
7
9
  _uiDefaultMaterial: Material;
8
10
  _getUIDefaultMaterial(): Material;