@galacean/effects-core 2.10.0-alpha.2 → 2.10.0-alpha.4

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.
@@ -0,0 +1,67 @@
1
+ export declare enum MouseFilter {
2
+ Stop = 0,
3
+ Pass = 1,
4
+ Ignore = 2
5
+ }
6
+ export declare enum MouseBehaviorRecursive {
7
+ Inherited = 0,
8
+ Disabled = 1,
9
+ Enabled = 2
10
+ }
11
+ export declare enum MouseButton {
12
+ None = 0,
13
+ Left = 1,
14
+ Right = 2,
15
+ Middle = 3,
16
+ WheelUp = 4,
17
+ WheelDown = 5,
18
+ WheelLeft = 6,
19
+ WheelRight = 7,
20
+ Xbutton1 = 8,
21
+ Xbutton2 = 9
22
+ }
23
+ export declare enum MouseButtonMask {
24
+ None = 0,
25
+ Left = 1,
26
+ Right = 2,
27
+ Middle = 4,
28
+ Xbutton1 = 128,
29
+ Xbutton2 = 256
30
+ }
31
+ export declare enum FocusMode {
32
+ None = 0,
33
+ Click = 1,
34
+ All = 2,
35
+ Accessibility = 3
36
+ }
37
+ export declare enum FocusBehaviorRecursive {
38
+ Inherited = 0,
39
+ Disabled = 1,
40
+ Enabled = 2
41
+ }
42
+ export declare enum KeyLocation {
43
+ Unspecified = 0,
44
+ Left = 1,
45
+ Right = 2
46
+ }
47
+ export declare enum CursorShape {
48
+ Arrow = 0,
49
+ Ibeam = 1,
50
+ PointingHand = 2,
51
+ Cross = 3,
52
+ Wait = 4,
53
+ Busy = 5,
54
+ Drag = 6,
55
+ CanDrop = 7,
56
+ Forbidden = 8,
57
+ Vsize = 9,
58
+ Hsize = 10,
59
+ Bdiagsize = 11,
60
+ Fdiagsize = 12,
61
+ Move = 13,
62
+ Vsplit = 14,
63
+ Hsplit = 15,
64
+ Help = 16
65
+ }
66
+ /** A preset cursor shape or a complete CSS cursor value. */
67
+ export type CursorStyle = CursorShape | string;
@@ -0,0 +1,2 @@
1
+ export * from './enums';
2
+ export * from './input-event';
@@ -0,0 +1,78 @@
1
+ import type { Matrix3 } from '@galacean/effects-math/es/core/matrix3';
2
+ import { Vector2 } from '@galacean/effects-math/es/core/vector2';
3
+ import { KeyLocation, MouseButton, MouseButtonMask } from './enums';
4
+ export declare class InputEvent {
5
+ static readonly deviceIdEmulation = -1;
6
+ static readonly deviceIdInternal = -2;
7
+ static readonly deviceIdKeyboard = 16;
8
+ static readonly deviceIdMouse = 32;
9
+ device: number;
10
+ pressed: boolean;
11
+ canceled: boolean;
12
+ private _accepted;
13
+ accept(): void;
14
+ clearAccepted(): void;
15
+ isAccepted(): boolean;
16
+ isPressed(): boolean;
17
+ isReleased(): boolean;
18
+ isCanceled(): boolean;
19
+ isEcho(): boolean;
20
+ xformedBy(transform: Matrix3): InputEvent;
21
+ }
22
+ export declare class InputEventWithModifiers extends InputEvent {
23
+ commandOrControlAutoremap: boolean;
24
+ shiftPressed: boolean;
25
+ altPressed: boolean;
26
+ metaPressed: boolean;
27
+ ctrlPressed: boolean;
28
+ protected copyModifiersTo(event: InputEventWithModifiers): void;
29
+ }
30
+ export declare class InputEventKey extends InputEventWithModifiers {
31
+ keycode: string;
32
+ physicalKeycode: string;
33
+ keyLabel: string;
34
+ unicode: number;
35
+ location: KeyLocation;
36
+ echo: boolean;
37
+ isEcho(): boolean;
38
+ }
39
+ export declare class InputEventMouse extends InputEventWithModifiers {
40
+ buttonMask: MouseButtonMask;
41
+ position: Vector2;
42
+ globalPosition: Vector2;
43
+ protected copyMouseTo(event: InputEventMouse): void;
44
+ }
45
+ export declare class InputEventMouseButton extends InputEventMouse {
46
+ factor: number;
47
+ buttonIndex: MouseButton;
48
+ doubleClick: boolean;
49
+ xformedBy(transform: Matrix3): InputEventMouseButton;
50
+ }
51
+ export declare class InputEventMouseMotion extends InputEventMouse {
52
+ tilt: Vector2;
53
+ pressure: number;
54
+ relative: Vector2;
55
+ screenRelative: Vector2;
56
+ velocity: Vector2;
57
+ screenVelocity: Vector2;
58
+ penInverted: boolean;
59
+ xformedBy(transform: Matrix3): InputEventMouseMotion;
60
+ }
61
+ export declare class InputEventScreenTouch extends InputEvent {
62
+ index: number;
63
+ position: Vector2;
64
+ doubleTap: boolean;
65
+ xformedBy(transform: Matrix3): InputEventScreenTouch;
66
+ }
67
+ export declare class InputEventScreenDrag extends InputEvent {
68
+ index: number;
69
+ position: Vector2;
70
+ relative: Vector2;
71
+ screenRelative: Vector2;
72
+ velocity: Vector2;
73
+ screenVelocity: Vector2;
74
+ pressure: number;
75
+ tilt: Vector2;
76
+ penInverted: boolean;
77
+ xformedBy(transform: Matrix3): InputEventScreenDrag;
78
+ }
@@ -29,20 +29,67 @@ export declare enum PointerEventType {
29
29
  export declare class EventSystem implements Disposable {
30
30
  engine: Engine;
31
31
  allowPropagation: boolean;
32
- enabled: boolean;
33
32
  skipPointerMovePicking: boolean;
33
+ private readonly emulateMouseFromTouch;
34
+ private readonly emulateTouchFromMouse;
35
+ private _enabled;
34
36
  private handlers;
35
37
  private nativeHandlers;
36
38
  private target;
39
+ private mouseState;
40
+ private touchStates;
41
+ private mouseFromTouchIndex;
42
+ private touchFromMousePressed;
43
+ private addedTabIndex;
44
+ private addedOutlineStyle;
37
45
  constructor(engine: Engine, allowPropagation?: boolean);
46
+ get enabled(): boolean;
47
+ set enabled(value: boolean);
38
48
  bindListeners(target: HTMLCanvasElement | null): void;
39
49
  dispatchEvent(type: string, event: TouchEventType): void;
40
50
  addEventListener(type: string, callback: (event: TouchEventType) => void): () => void;
41
51
  removeEventListener(type: string, callback: (event: TouchEventType) => void): void;
52
+ dispose(): void;
53
+ private onNativeWheel;
54
+ private onNativeKeyDown;
55
+ private onNativeKeyUp;
56
+ private onNativeMouseDown;
57
+ private onNativeMouseMove;
58
+ private onNativeMouseUp;
59
+ private onNativeTouchStart;
60
+ private onNativeTouchMove;
61
+ private onNativeTouchEnd;
62
+ private onNativeTouchCancel;
63
+ private onWindowBlur;
64
+ private handleNativeMouseDown;
65
+ private handleNativeKey;
66
+ private handleNativeTouchEnd;
67
+ private pushNativeMouseButton;
68
+ private pushNativeMouseMotion;
69
+ private pushNativeScreenTouch;
70
+ private pushNativeScreenDrag;
71
+ private pushEmulatedMouseButton;
72
+ private pushEmulatedMouseMotion;
73
+ private pushMouseButton;
74
+ private pushWheelButton;
75
+ private pushMouseMotion;
76
+ private pushScreenTouch;
77
+ private pushScreenDrag;
78
+ private copyMouseFields;
42
79
  private onClick;
43
80
  private onPointerDown;
44
81
  private onPointerUp;
45
82
  private onPointerMove;
46
83
  private handlePointerEvent;
47
- dispose(): void;
84
+ private createPointerState;
85
+ private updatePointerState;
86
+ private getVelocity;
87
+ private isClick;
88
+ private createPointerEvent;
89
+ private getCanvasPosition;
90
+ private consumeNativeEvent;
91
+ private preventTouchDefaults;
92
+ private focusTarget;
93
+ private addNativeHandler;
94
+ private unbindListeners;
48
95
  }
@@ -17,6 +17,7 @@ export declare class Graphics {
17
17
  private geometry;
18
18
  private coloredMaterial;
19
19
  private texturedMaterial;
20
+ private textMaterial;
20
21
  private readonly lineShape;
21
22
  private readonly bezierShape;
22
23
  private readonly triangleShape;
@@ -108,8 +109,8 @@ export declare class Graphics {
108
109
  drawTriangle(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, color?: Color, thickness?: number): void;
109
110
  /**
110
111
  * 绘制矩形边框
111
- * @param x - 矩形左下角 X 坐标
112
- * @param y - 矩形左下角 Y 坐标
112
+ * @param x - 矩形左上角 X 坐标
113
+ * @param y - 矩形左上角 Y 坐标
113
114
  * @param width - 矩形宽度
114
115
  * @param height - 矩形高度
115
116
  * @param color - 边框颜色,默认白色,范围 0-1
@@ -138,8 +139,8 @@ export declare class Graphics {
138
139
  fillTriangle(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, color?: Color): void;
139
140
  /**
140
141
  * 绘制填充矩形
141
- * @param x - 矩形左下角 X 坐标
142
- * @param y - 矩形左下角 Y 坐标
142
+ * @param x - 矩形左上角 X 坐标
143
+ * @param y - 矩形左上角 Y 坐标
143
144
  * @param width - 矩形宽度
144
145
  * @param height - 矩形高度
145
146
  * @param color - 填充颜色,默认白色,范围 0-1
@@ -158,9 +159,9 @@ export declare class Graphics {
158
159
  */
159
160
  fillCircle(cx: number, cy: number, radius: number, color?: Color): void;
160
161
  /**
161
- * 绘制纹理矩形(本地坐标,Y 向上,(x, y) 为左下角)
162
- * @param x - 矩形左下角 X 坐标
163
- * @param y - 矩形左下角 Y 坐标
162
+ * 绘制纹理矩形(本地坐标,Y 向下,(x, y) 为左上角)
163
+ * @param x - 矩形左上角 X 坐标
164
+ * @param y - 矩形左上角 Y 坐标
164
165
  * @param width - 矩形宽度
165
166
  * @param height - 矩形高度
166
167
  * @param texture - 要采样的纹理。同纹理连续绘制会合批,纹理切换会自动 flush 当前批次
@@ -169,14 +170,14 @@ export declare class Graphics {
169
170
  */
170
171
  drawTexture(x: number, y: number, width: number, height: number, texture: Texture, region?: TextureRegion, color?: Color): void;
171
172
  /**
172
- * 绘制文本(本地坐标,Y 向上,(x, y) 为文本左下角)。
173
+ * 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
173
174
  *
174
175
  * 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
175
176
  * `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
176
177
  *
177
178
  * 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
178
- * @param x - 文本左下角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
179
- * @param y - 文本左下角 Y 坐标(cell 底,含底部 padding;字形 ink 在其上方 padding+ascent 处)
179
+ * @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
180
+ * @param y - 文本 cell 顶部 Y 坐标
180
181
  * @param text - 要绘制的文本内容,空串直接 return
181
182
  * @param fontSize - 字号(逻辑像素)
182
183
  * @param color - 乘色,默认白色,范围 0-1
@@ -9,19 +9,14 @@ export type FontWeight = 'normal' | 'bold' | number;
9
9
  */
10
10
  export type FontStyle = 'normal' | 'italic';
11
11
  /**
12
- * 字形纹理超采样倍数。canvas `fontSize * FONT_SCALE` 渲染,纹理像素也是 scale 倍,
13
- * 但 quad 仍按 1x 逻辑尺寸绘制 — 双线性 downsample 后比原 1x 渲染清晰得多
14
- */
15
- export declare const FONT_SCALE = 2;
16
- /**
17
- * 单张字符 atlas 的边长(像素,scale 后的实际像素,非逻辑尺寸)。
12
+ * 单张字符 atlas 的逻辑边长。实际 canvas 像素尺寸会乘以渲染 resolution。
18
13
  * 512×512 在 24px 字号下约可容纳 250+ 字形,常见 demo 文本足够
19
14
  */
20
15
  export declare const ATLAS_SIZE = 512;
21
16
  /**
22
17
  * 单个字形在 atlas 中的位置 / 度量。
23
18
  *
24
- * `px/py/pw/ph` 是 atlas canvas 像素(scale 后,含四周 padding)。
19
+ * `px/py/pw/ph` 是 atlas canvas 像素(resolution 后,含四周 padding)。
25
20
  * `advance` 是逻辑像素光标前进量(1x,不含 padding)— quad 宽度含 padding,
26
21
  * 但相邻字只按 advance 前进,padding 区透明因此重叠无妨。
27
22
  * `paddingLeft` 是逻辑像素左侧留白(1x),quad 起点左偏此量使字形 ink 落在 cursorX
@@ -47,12 +42,14 @@ export type GlyphInfo = {
47
42
  export declare class GlyphAtlas {
48
43
  private engine;
49
44
  private readonly scaledFontString;
50
- /** atlas canvas(像素 = ATLAS_SIZE × ATLAS_SIZE,自有不进 canvasPool) */
45
+ /** atlas canvas(像素 = ATLAS_SIZE × resolution,自有不进 canvasPool) */
51
46
  readonly canvas: HTMLCanvasElement;
52
47
  /** 与 canvas 绑定的纹理,内容变更后通过 updateSource 重传 */
53
48
  readonly texture: Texture;
54
49
  /** cell 高(逻辑像素,含 padding),用于 quad 高度 */
55
50
  readonly lineHeight: number;
51
+ /** 字形 canvas 的像素密度,与 Pixi 的纹理 resolution 语义一致。 */
52
+ readonly resolution: number;
56
53
  private readonly ctx;
57
54
  private readonly glyphs;
58
55
  /** baseline 距 cell 顶距离(像素,scale 后,含顶部 padding) */
@@ -74,7 +71,7 @@ export declare class GlyphAtlas {
74
71
  /** baseline 距 cell 顶距离(像素,scale 后,仅 ascent 部分,不含 padding) */
75
72
  ascentPx: number,
76
73
  /** baseline 距 cell 底距离(像素,scale 后,仅 descent 部分) */
77
- descentPx: number, fontStyle: FontStyle);
74
+ descentPx: number, fontStyle: FontStyle, resolution: number);
78
75
  /**
79
76
  * 取(必要时渲染并打包)单字。返回 GlyphInfo 或 null(atlas 已满)
80
77
  */
@@ -99,6 +96,7 @@ export declare class TextCache {
99
96
  private engine;
100
97
  /** fontKey -> 该字体的字符 atlas */
101
98
  private readonly atlases;
99
+ private resolution;
102
100
  constructor(engine: Engine);
103
101
  /**
104
102
  * 取(必要时新建)对应字体的字符 atlas
@@ -114,4 +112,5 @@ export declare class TextCache {
114
112
  * 清空所有 atlas 并 dispose 对应纹理。Engine dispose 时调用
115
113
  */
116
114
  dispose(): void;
115
+ private clear;
117
116
  }
@@ -3,6 +3,7 @@ import { Matrix3 } from '@galacean/effects-math/es/core/matrix3';
3
3
  import type * as spec from '@galacean/effects-specification';
4
4
  import type { Disposable } from './utils';
5
5
  import type { Engine } from './engine';
6
+ import type { EventEmitterListener, EventEmitterOptions } from './events';
6
7
  export interface TransformProps {
7
8
  position?: spec.vec3 | Vector3;
8
9
  rotation?: spec.vec3 | Euler;
@@ -13,6 +14,9 @@ export interface TransformProps {
13
14
  anchor?: spec.vec2 | Vector2;
14
15
  valid?: boolean;
15
16
  }
17
+ export type TransformEvent = {
18
+ changed: [transform: Transform];
19
+ };
16
20
  /**
17
21
  * 变换组件,用于描述元素的位置、旋转、缩放等信息
18
22
  */
@@ -87,6 +91,7 @@ export declare class Transform implements Disposable {
87
91
  * 最终模型矩阵对应变换的缓存,当自身矩阵或父矩阵有修改时需要更新
88
92
  */
89
93
  private readonly worldTRSCache;
94
+ private readonly eventEmitter;
90
95
  /**
91
96
  *
92
97
  * @param props
@@ -95,6 +100,8 @@ export declare class Transform implements Disposable {
95
100
  constructor(props?: TransformProps, parent?: Transform);
96
101
  set parentTransform(transform: Transform | null);
97
102
  get parentTransform(): Transform | null;
103
+ on<E extends keyof TransformEvent>(eventName: E, listener: EventEmitterListener<TransformEvent[E]>, options?: EventEmitterOptions): void;
104
+ off<E extends keyof TransformEvent>(eventName: E, listener: EventEmitterListener<TransformEvent[E]>): void;
98
105
  private set worldMatrixDirty(value);
99
106
  private get worldMatrixDirty();
100
107
  /**
@@ -141,6 +141,9 @@ export declare class VFXItem extends EffectsObject implements Disposable {
141
141
  */
142
142
  get renderOrder(): number;
143
143
  set renderOrder(value: number);
144
+ /** Zero-based sibling order within the parent item. */
145
+ get orderInParent(): number;
146
+ set orderInParent(value: number);
144
147
  /**
145
148
  * 元素监听事件
146
149
  * @param eventName - 事件名称
@@ -301,6 +304,7 @@ export declare class VFXItem extends EffectsObject implements Disposable {
301
304
  */
302
305
  duplicate(): VFXItem;
303
306
  private onParentChanged;
307
+ private onOrderInParentChanged;
304
308
  fromData(data: spec.VFXItemData): void;
305
309
  toData(): void;
306
310
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.10.0-alpha.2",
3
+ "version": "2.10.0-alpha.4",
4
4
  "description": "Galacean Effects runtime core for the web",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -1,131 +0,0 @@
1
- import type { Color } from '@galacean/effects-math/es/core';
2
- import type { FontStyle, FontWeight, TextureRegion } from '../render';
3
- import type { Texture } from '../texture';
4
- import { CanvasLayer } from './canvas-layer';
5
- import { Component } from './component';
6
- /**
7
- * 画布元素组件
8
- *
9
- * 进入场景树时沿父链向上查找最近的 CanvasLayer 祖先并注册自己;
10
- * 父级改变或自身销毁时,刷新 / 注销在所属 CanvasLayer 的登记。
11
- *
12
- * 注:拓扑(parent / children / 所属 layer)与 enabled/active 解耦 —
13
- * `component.enabled=false` 仅让自身 draw 被跳过,**不**改父子关系,也**不**从 layer 注销;
14
- * 整棵子树的隐藏由 `vfxItem.setActive(false)` 配合 drawInternal 中的 `isActive` 检查处理
15
- */
16
- export declare class CanvasItem extends Component {
17
- /**
18
- * 父 CanvasItem
19
- * 沿 VFXItem 父链向上查找到的最近的 CanvasItem(只看类型,不看 active/enabled — 拓扑跟激活状态解耦)。
20
- * 若不存在 CanvasItem 祖先(即直属于 CanvasLayer 或处于游离状态),该值为 null。
21
- */
22
- parent: CanvasItem | null;
23
- /**
24
- * 子 CanvasItem 列表(按注册顺序)
25
- * 由子节点在维护自身 parent 时反向写入,draw 时按数组顺序递归绘制
26
- */
27
- readonly children: CanvasItem[];
28
- /**
29
- * 当前所属的 CanvasLayer,未注册到任何 CanvasLayer 时为 null
30
- */
31
- protected canvasLayerNode: CanvasLayer | null;
32
- /**
33
- * 获取当前所属的 CanvasLayer
34
- */
35
- get canvasLayer(): CanvasLayer | null;
36
- onEnable(): void;
37
- onDisable(): void;
38
- onParentChanged(): void;
39
- onDestroy(): void;
40
- /**
41
- * 绘制函数
42
- * 子类重写此方法以输出实际的绘制内容;调用时 graphics 的变换栈顶已经累积了从根到当前节点的所有父变换,
43
- * 子类直接使用 this.drawXxx / this.fillXxx 系列封装方法绘制即可,绘制坐标视为本地坐标。
44
- */
45
- draw(): void;
46
- /**
47
- * 绘制单条线段
48
- * @param x1 - 起点 x
49
- * @param y1 - 起点 y
50
- * @param x2 - 终点 x
51
- * @param y2 - 终点 y
52
- * @param color - 线条颜色
53
- * @param thickness - 线宽
54
- */
55
- drawLine(x1: number, y1: number, x2: number, y2: number, color?: Color, thickness?: number): void;
56
- /**
57
- * 按顺序连接所有点绘制折线(首尾相同则视为闭合)
58
- * @param points - 点数组,格式 [x1,y1,x2,y2,...]
59
- * @param color - 线条颜色
60
- * @param thickness - 线宽
61
- */
62
- drawPolyline(points: number[], color?: Color, thickness?: number): void;
63
- /**
64
- * 绘制三次贝塞尔曲线
65
- */
66
- drawBezier(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, color?: Color, thickness?: number): void;
67
- /**
68
- * 绘制三角形边框
69
- */
70
- drawTriangle(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, color?: Color, thickness?: number): void;
71
- /**
72
- * 绘制矩形边框
73
- * @param x - 矩形左下角 x 坐标
74
- * @param y - 矩形左下角 y 坐标
75
- */
76
- drawRect(x: number, y: number, width: number, height: number, color?: Color, thickness?: number): void;
77
- /**
78
- * 绘制圆形边框
79
- */
80
- drawCircle(cx: number, cy: number, radius: number, color?: Color, thickness?: number): void;
81
- /**
82
- * 绘制填充三角形
83
- */
84
- fillTriangle(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, color?: Color): void;
85
- /**
86
- * 绘制填充矩形
87
- * @param x - 矩形左下角 x 坐标
88
- * @param y - 矩形左下角 y 坐标
89
- */
90
- fillRect(x: number, y: number, width: number, height: number, color?: Color): void;
91
- /**
92
- * 绘制填充圆形
93
- */
94
- fillCircle(cx: number, cy: number, radius: number, color?: Color): void;
95
- /**
96
- * 绘制纹理矩形(本地坐标,Y 向上,(x, y) 为左下角)
97
- * @param region - 纹理 UV 子矩形,默认全图。Y 向上,(u0, v0) 为左下角 UV
98
- * @param color - 乘色,默认白色
99
- */
100
- drawTexture(x: number, y: number, width: number, height: number, texture: Texture, region?: TextureRegion, color?: Color): void;
101
- /**
102
- * 绘制文本(本地坐标,Y 向上,(x, y) 为文本左下角)。
103
- *
104
- * 同一段文本不同颜色不会重复 upload — 颜色由 `color` 参数透传作为乘色,纹理只缓存白色字形。
105
- * 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
106
- */
107
- drawText(x: number, y: number, text: string, fontSize: number, color?: Color, fontFamily?: string, fontWeight?: FontWeight, fontStyle?: FontStyle): void;
108
- /**
109
- * 从当前所属的 CanvasLayer 注销自身(如果有)
110
- * 仅当自身是顶层 CanvasItem 时,才会触发 layer 顶层列表的移除
111
- */
112
- private removeFromCanvasLayer;
113
- /**
114
- * 从当前父 CanvasItem 的 children 中移除自身(如果有)
115
- */
116
- private removeFromParent;
117
- /**
118
- * 更新所有子 CanvasItem 的层级归属。
119
- * 自身失效时调用,子节点会跳过自己向上找到新的父 CanvasItem(可能为 null)。
120
- */
121
- private updateChildrenParentItems;
122
- /**
123
- * 沿父链向上查找最近的 CanvasLayer 祖先
124
- * 注意:自身所在 VFXItem 上的 CanvasLayer 也参与查找(同节点上可能并存 CanvasLayer 与 CanvasItem)
125
- */
126
- private getCanvasLayerNode;
127
- /**
128
- * 沿 VFXItem 父链向上查找最近的 CanvasItem 祖先(不包含自身,只看类型不看 active/enabled)
129
- */
130
- private getParentItem;
131
- }
@@ -1,23 +0,0 @@
1
- import type { CanvasItem } from './canvas-item';
2
- import { Component } from './component';
3
- /**
4
- * 画布层组件
5
- *
6
- * 作为一组顶层 CanvasItem 的容器:本层内所有 parent 为 null 的 CanvasItem 都登记在 canvasItems 中。
7
- * 嵌套关系下的子 CanvasItem 通过其父 CanvasItem 的 children 数组管理,由父节点在 draw 时递归绘制。
8
- */
9
- export declare class CanvasLayer extends Component {
10
- /**
11
- * 当前层中的顶层 CanvasItem 列表(按注册顺序)。
12
- * 仅包含 parent 为 null 的 CanvasItem;嵌套的子 CanvasItem 不会出现在此列表
13
- */
14
- readonly canvasItems: CanvasItem[];
15
- /**
16
- * 绘制层级,数值越小越先绘制
17
- */
18
- layer: number;
19
- onEnable(): void;
20
- onDisable(): void;
21
- private removeFromComposition;
22
- private refreshCanvasItemsLayer;
23
- }
@@ -1,18 +0,0 @@
1
- import { CanvasItem } from './canvas-item';
2
- /**
3
- * 锚点布局组件
4
- *
5
- * `Control extends CanvasItem`。CanvasItem 仅承担绘制与节点层级,Control 在挂到 VFXItem 时把
6
- * `item.transform` 升级为 {@link RectTransform}。
7
- *
8
- * 布局完全由 RectTransform 自治:父子节点关系沿 `Transform.parentTransform / children` 走,
9
- * 父节点 size 变化时通过 `RectTransform.sizeChanged()` 直接调用子节点 sizeChanged 链式传播。
10
- * Control 本身不持有任何与布局相关的状态
11
- */
12
- export declare class Control extends CanvasItem {
13
- /**
14
- * 在挂到 VFXItem 时确保 `item.transform` 是 `RectTransform`。
15
- * 既有 Transform 状态(position / rotation / scale / size / anchor 等)通过 `RectTransform.fromTransform` 复制
16
- */
17
- onAwake(): void;
18
- }