@galacean/effects-core 2.10.0-alpha.4 → 2.10.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.
@@ -1,13 +1,3 @@
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
1
  export declare enum MouseButton {
12
2
  None = 0,
13
3
  Left = 1,
@@ -28,40 +18,8 @@ export declare enum MouseButtonMask {
28
18
  Xbutton1 = 128,
29
19
  Xbutton2 = 256
30
20
  }
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
21
  export declare enum KeyLocation {
43
22
  Unspecified = 0,
44
23
  Left = 1,
45
24
  Right = 2
46
25
  }
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;
@@ -17,6 +17,7 @@ export declare function registerPlugin(name: string, pluginClass: PluginConstruc
17
17
  export declare function unregisterPlugin(name: string): void;
18
18
  export declare class PluginSystem {
19
19
  static getPlugins(): Plugin[];
20
+ static notifyCompositionCreating(composition: Composition, scene?: Scene): void;
20
21
  static notifyCompositionCreated(composition: Composition, scene?: Scene): void;
21
22
  static notifyCompositionDestroy(composition: Composition): void;
22
23
  static notifyEngineCreated(engine: Engine): void;
@@ -1,4 +1,6 @@
1
1
  import type { Engine } from '../../engine';
2
+ import { EventEmitter } from '../../events';
3
+ import { InputEvent } from '../../input';
2
4
  import type { Disposable } from '../../utils';
3
5
  export declare const EVENT_TYPE_CLICK = "click";
4
6
  export declare const EVENT_TYPE_TOUCH_START = "touchstart";
@@ -26,7 +28,12 @@ export declare enum PointerEventType {
26
28
  PointerUp = 1,
27
29
  PointerMove = 2
28
30
  }
29
- export declare class EventSystem implements Disposable {
31
+ export type EventSystemEvent = {
32
+ input: [event: InputEvent];
33
+ canvasFocus: [];
34
+ canvasBlur: [];
35
+ };
36
+ export declare class EventSystem extends EventEmitter<EventSystemEvent> implements Disposable {
30
37
  engine: Engine;
31
38
  allowPropagation: boolean;
32
39
  skipPointerMovePicking: boolean;
@@ -37,6 +44,14 @@ export declare class EventSystem implements Disposable {
37
44
  private nativeHandlers;
38
45
  private target;
39
46
  private mouseState;
47
+ /**
48
+ * Logical mouse button state maintained from mousedown/mouseup transitions.
49
+ *
50
+ * On macOS, a trackpad may emit a release-edge pointermove with buttons=0
51
+ * before mouseup. Treating that motion as a release ends the drag early and
52
+ * may skip the final transform commit.
53
+ */
54
+ private mouseButtonMask;
40
55
  private touchStates;
41
56
  private mouseFromTouchIndex;
42
57
  private touchFromMousePressed;
@@ -44,7 +59,17 @@ export declare class EventSystem implements Disposable {
44
59
  private addedOutlineStyle;
45
60
  constructor(engine: Engine, allowPropagation?: boolean);
46
61
  get enabled(): boolean;
62
+ /**
63
+ * Enables native input processing.
64
+ *
65
+ * Change this only while there are no active key, mouse, touch, or drag sessions.
66
+ */
47
67
  set enabled(value: boolean);
68
+ /**
69
+ * Rebinds native input listeners to a canvas.
70
+ *
71
+ * Rebind or unbind only while there are no active key, mouse, touch, or drag sessions.
72
+ */
48
73
  bindListeners(target: HTMLCanvasElement | null): void;
49
74
  dispatchEvent(type: string, event: TouchEventType): void;
50
75
  addEventListener(type: string, callback: (event: TouchEventType) => void): () => void;
@@ -60,7 +85,8 @@ export declare class EventSystem implements Disposable {
60
85
  private onNativeTouchMove;
61
86
  private onNativeTouchEnd;
62
87
  private onNativeTouchCancel;
63
- private onWindowBlur;
88
+ private onCanvasFocus;
89
+ private onCanvasBlur;
64
90
  private handleNativeMouseDown;
65
91
  private handleNativeKey;
66
92
  private handleNativeTouchEnd;
@@ -71,6 +97,7 @@ export declare class EventSystem implements Disposable {
71
97
  private pushEmulatedMouseButton;
72
98
  private pushEmulatedMouseMotion;
73
99
  private pushMouseButton;
100
+ private setMouseButtonPressed;
74
101
  private pushWheelButton;
75
102
  private pushMouseMotion;
76
103
  private pushScreenTouch;
@@ -88,8 +115,10 @@ export declare class EventSystem implements Disposable {
88
115
  private createPointerEvent;
89
116
  private getCanvasPosition;
90
117
  private consumeNativeEvent;
118
+ private pushInput;
91
119
  private preventTouchDefaults;
92
120
  private focusTarget;
121
+ private resetInputState;
93
122
  private addNativeHandler;
94
123
  private unbindListeners;
95
124
  }
@@ -27,6 +27,13 @@ export declare abstract class Plugin {
27
27
  * @param engine - 引擎实例
28
28
  */
29
29
  onAssetsLoadFinish(scene: Scene, options: SceneLoadOptions, engine: Engine): void;
30
+ /**
31
+ * 合成内容开始创建前触发。
32
+ * 此时 root、pluginRoot 和 sceneRoot 已创建,但场景内容尚未实例化。
33
+ * @param composition - 正在创建的合成对象
34
+ * @param scene - 场景对象
35
+ */
36
+ onCompositionCreating(composition: Composition, scene?: Scene): void;
30
37
  /**
31
38
  * 合成创建完成后触发。
32
39
  * @param composition - 合成对象
@@ -12,12 +12,33 @@ export type TextureRegion = {
12
12
  u1: number;
13
13
  v1: number;
14
14
  };
15
+ export type NinePatchDrawOptions = {
16
+ sourceX: number;
17
+ sourceY: number;
18
+ sourceWidth: number;
19
+ sourceHeight: number;
20
+ marginLeft: number;
21
+ marginTop: number;
22
+ marginRight: number;
23
+ marginBottom: number;
24
+ horizontalMode?: number;
25
+ verticalMode?: number;
26
+ drawCenter?: boolean;
27
+ };
28
+ /** Logical text metrics produced by the glyph atlas used for rendering. */
29
+ export type TextMeasurement = {
30
+ width: number;
31
+ lineHeight: number;
32
+ advances: number[];
33
+ };
15
34
  export declare class Graphics {
16
35
  private engine;
17
36
  private geometry;
37
+ private ninePatchGeometry;
18
38
  private coloredMaterial;
19
39
  private texturedMaterial;
20
40
  private textMaterial;
41
+ private ninePatchMaterial;
21
42
  private readonly lineShape;
22
43
  private readonly bezierShape;
23
44
  private readonly triangleShape;
@@ -28,6 +49,10 @@ export declare class Graphics {
28
49
  private colors;
29
50
  private uvs;
30
51
  private indices;
52
+ private ninePatchDrawSourceSizes;
53
+ private ninePatchSourceRects;
54
+ private ninePatchMargins;
55
+ private ninePatchOptions;
31
56
  private lineStyle;
32
57
  private currentBatchType;
33
58
  private currentBatchTexture;
@@ -35,6 +60,9 @@ export declare class Graphics {
35
60
  private textCache;
36
61
  private transformStack;
37
62
  private currentTransform;
63
+ private clipStack;
64
+ private logicalWidth;
65
+ private logicalHeight;
38
66
  private get currentVertexCount();
39
67
  private get currentIndexCount();
40
68
  constructor(engine: Engine);
@@ -51,6 +79,10 @@ export declare class Graphics {
51
79
  * 恢复上一个变换
52
80
  */
53
81
  popTransform(): void;
82
+ /** Pushes a local rectangular child clip using a screen-space AABB scissor. */
83
+ pushClipRect(x: number, y: number, width: number, height: number): void;
84
+ /** Restores the parent rectangular clip. */
85
+ popClipRect(): void;
54
86
  /**
55
87
  * 刷新并渲染所有累积的绘制命令
56
88
  */
@@ -59,6 +91,8 @@ export declare class Graphics {
59
91
  * 切换到指定批次类型/纹理。若与当前批次不一致,先 flush 已累积顶点
60
92
  */
61
93
  private ensureBatch;
94
+ private applyClipRect;
95
+ private clipRectsEqual;
62
96
  /**
63
97
  * 提交当前累积的顶点到 renderer,清空缓冲(批次内部 flush 不重置 batchType)
64
98
  */
@@ -169,11 +203,16 @@ export declare class Graphics {
169
203
  * @param color - 乘色,默认白色
170
204
  */
171
205
  drawTexture(x: number, y: number, width: number, height: number, texture: Texture, region?: TextureRegion, color?: Color): void;
206
+ /**
207
+ * Draws a nine-patch as one quad. Stretching and repetition are resolved in the fragment shader,
208
+ * so Tile and TileFit do not expand into CPU-side geometry.
209
+ */
210
+ drawNinePatch(x: number, y: number, width: number, height: number, texture: Texture, options: NinePatchDrawOptions, color?: Color): void;
172
211
  /**
173
212
  * 绘制文本(本地坐标,Y 向下,(x, y) 为文本 cell 左上角)。
174
213
  *
175
214
  * 文本走字符级 bitmap atlas(同一字体下每个字只渲染一次,任意文本组合复用 atlas);
176
- * `color` 作为乘色与白色字形 alpha 相乘,任意颜色都不会污染 atlas。
215
+ * `color` atlas 字形 RGBA 相乘,任意颜色都不会污染 atlas。
177
216
  *
178
217
  * 字体参数全部展开,避免调用方每帧创建临时 style 对象触发 GC
179
218
  * @param x - 文本左上角 X 坐标(首字 ink 起始处,含 padding 的 quad 会向左延伸)
@@ -186,9 +225,12 @@ export declare class Graphics {
186
225
  * @param fontStyle - 字形,默认 `normal`,支持 `'italic'`
187
226
  */
188
227
  drawText(x: number, y: number, text: string, fontSize: number, color?: Color, fontFamily?: string, fontWeight?: FontWeight, fontStyle?: FontStyle): void;
228
+ /** Measures text with the same glyph metrics used by {@link drawText}. */
229
+ measureText(text: string, fontSize: number, fontFamily?: string, fontWeight?: FontWeight, fontStyle?: FontStyle): TextMeasurement;
189
230
  dispose(): void;
190
231
  private buildShape;
191
232
  private buildShapeLine;
233
+ private getScreenScale;
192
234
  private setTriangleShape;
193
235
  private setRectangleShape;
194
236
  private setCircleShape;
@@ -7,7 +7,7 @@ export type FontWeight = 'normal' | 'bold' | number;
7
7
  /**
8
8
  * 字形(对齐 canvas 2d font 字符串可接受值)
9
9
  */
10
- export type FontStyle = 'normal' | 'italic';
10
+ export type FontStyle = 'normal' | 'italic' | 'oblique';
11
11
  /**
12
12
  * 单张字符 atlas 的逻辑边长。实际 canvas 像素尺寸会乘以渲染 resolution。
13
13
  * 512×512 在 24px 字号下约可容纳 250+ 字形,常见 demo 文本足够
@@ -48,7 +48,7 @@ export declare class GlyphAtlas {
48
48
  readonly texture: Texture;
49
49
  /** cell 高(逻辑像素,含 padding),用于 quad 高度 */
50
50
  readonly lineHeight: number;
51
- /** 字形 canvas 的像素密度,与 Pixi 的纹理 resolution 语义一致。 */
51
+ /** 字形 canvas 的像素密度。 */
52
52
  readonly resolution: number;
53
53
  private readonly ctx;
54
54
  private readonly glyphs;
@@ -87,7 +87,7 @@ export declare class GlyphAtlas {
87
87
  * `ATLAS_SIZE × ATLAS_SIZE` 的离屏 canvas atlas,字符按需逐个绘制并打包,
88
88
  * `Graphics.drawText` 通过逐字 quad 引用 atlas 子矩形渲染。
89
89
  *
90
- * - 同一段文本不同颜色不会重复 upload(颜色由顶点 `vColor` 乘上字形 alpha)
90
+ * - 同一段文本不同颜色不会重复 upload(颜色由顶点 `vColor` 与字形 RGBA 相乘)
91
91
  * - 同一字体/字号下重复字符只渲染一次,显著减少 canvas → texture 上传次数
92
92
  *
93
93
  * 入参全部展开(避免调用方每帧创建临时 style 对象触发 GC)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/effects-core",
3
- "version": "2.10.0-alpha.4",
3
+ "version": "2.10.0",
4
4
  "description": "Galacean Effects runtime core for the web",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.js",
@@ -42,8 +42,8 @@
42
42
  "registry": "https://registry.npmjs.org"
43
43
  },
44
44
  "dependencies": {
45
- "@galacean/effects-specification": "^2.8.1",
46
- "@galacean/effects-math": "1.2.0",
45
+ "@galacean/effects-specification": "^2.9.0",
46
+ "@galacean/effects-math": "1.2.1",
47
47
  "flatbuffers": "24.3.25",
48
48
  "uuid": "9.0.1",
49
49
  "libtess": "1.2.2"
@@ -1,28 +0,0 @@
1
- import type { Engine } from '../engine';
2
- import { CanvasRootControl } from '../gui';
3
- import { Component } from './component';
4
- export declare enum CanvasRenderMode {
5
- ScreenSpace = 0,
6
- CameraSpace = 1,
7
- WorldSpace = 2,
8
- WorldSpaceFaceCamera = 3
9
- }
10
- /** Canvas-layer boundary attached to a VFXItem. Input state remains owned by the window root. */
11
- export declare class UICanvas extends Component {
12
- readonly rootControl: CanvasRootControl;
13
- renderMode: CanvasRenderMode;
14
- receivesEvents: boolean;
15
- private _order;
16
- private registered;
17
- constructor(engine: Engine);
18
- get order(): number;
19
- set order(value: number);
20
- get isVisible(): boolean;
21
- onEnable(): void;
22
- onDisable(): void;
23
- onDestroy(): void;
24
- dispose(): void;
25
- private register;
26
- private unregister;
27
- private destroyCanvas;
28
- }
@@ -1,38 +0,0 @@
1
- import type { ContainerControl, Control } from '../gui';
2
- import type { Engine } from '../engine';
3
- import { Component } from './component';
4
- /**
5
- * Scene-tree bridge for a GUI Control. The VFXItem tree owns lifecycle and
6
- * serialization while the Control tree owns layout, drawing and input.
7
- */
8
- export declare class UIControl extends Component {
9
- static fallbackParentGetDelegate?: (control: UIControl) => ContainerControl | null;
10
- private controlNode;
11
- private linkedItemTransform;
12
- private linkedControl;
13
- private syncingLocation;
14
- private readonly itemTransformChanged;
15
- private readonly controlLocationChanged;
16
- constructor(engine: Engine);
17
- get control(): Control | null;
18
- set control(value: Control | null);
19
- get hasControl(): boolean;
20
- onAwake(): void;
21
- onEnable(): void;
22
- onDisable(): void;
23
- onParentChanged(): void;
24
- onOrderInParentChanged(): void;
25
- onDestroy(): void;
26
- dispose(): void;
27
- /** Unlinks the GUI object without disposing or modifying it. */
28
- unlinkControl(): void;
29
- private disposeControl;
30
- private syncControl;
31
- private syncControlOrder;
32
- private resolveParent;
33
- private bindLocationSync;
34
- private unbindLocationSync;
35
- private syncItemLocationToControl;
36
- private syncControlLocationToItem;
37
- private copyItemLocationToControl;
38
- }
@@ -1,188 +0,0 @@
1
- import type { Color } from '@galacean/effects-math/es/core';
2
- import { Matrix3 } from '@galacean/effects-math/es/core/matrix3';
3
- import { Vector2 } from '@galacean/effects-math/es/core/vector2';
4
- import type { Engine } from '../engine';
5
- import type { CursorStyle, InputEventKey, InputEventMouseButton, InputEventMouseMotion, InputEventScreenDrag, InputEventScreenTouch } from '../input';
6
- import { FocusBehaviorRecursive, FocusMode, MouseBehaviorRecursive, MouseFilter } from '../input';
7
- import type { EventEmitterListener, EventEmitterOptions } from '../events';
8
- import type { FontStyle, FontWeight, TextureRegion } from '../render';
9
- import type { Texture } from '../texture';
10
- import type { UIControl } from '../components/ui-control';
11
- import type { VFXItem } from '../vfx-item';
12
- export type Rect = {
13
- position: Vector2;
14
- size: Vector2;
15
- };
16
- export type LayoutPreset = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' | 'centerLeft' | 'centerTop' | 'centerRight' | 'centerBottom' | 'center' | 'leftWide' | 'topWide' | 'rightWide' | 'bottomWide' | 'vcenterWide' | 'hcenterWide' | 'fullRect';
17
- export type ControlEvent = {
18
- locationChanged: [control: Control];
19
- sizeChanged: [control: Control];
20
- parentChanged: [control: Control];
21
- };
22
- /**
23
- * A drawable GUI object. Controls form a tree independent from the VFXItem
24
- * scene tree. UIControl is the bridge between both trees.
25
- */
26
- export declare class Control {
27
- readonly engine: Engine;
28
- private _parent;
29
- private _visible;
30
- private _enabled;
31
- private _mouseFilter;
32
- private _mouseBehaviorRecursive;
33
- private _focusMode;
34
- private _focusBehaviorRecursive;
35
- private _defaultCursorShape;
36
- private _rotation;
37
- private transformDirty;
38
- private readonly cachedTransform;
39
- private readonly eventEmitter;
40
- private disposed;
41
- /** Scene-tree bridge that owns this GUI object, if any. */
42
- owner: UIControl | null;
43
- readonly position: Vector2;
44
- readonly size: Vector2;
45
- readonly anchorMin: Vector2;
46
- readonly anchorMax: Vector2;
47
- readonly offsetMin: Vector2;
48
- readonly offsetMax: Vector2;
49
- readonly pivot: Vector2;
50
- readonly scale: Vector2;
51
- readonly shear: Vector2;
52
- mouseForcePassScrollEvents: boolean;
53
- clipContents: boolean;
54
- constructor(engine: Engine);
55
- get parent(): ContainerControl | null;
56
- /** Scene item exposed through the optional UIControl bridge. */
57
- get item(): VFXItem | null;
58
- set parent(value: ContainerControl | null);
59
- get indexInParent(): number;
60
- set indexInParent(value: number);
61
- get visible(): boolean;
62
- set visible(value: boolean);
63
- get visibleInHierarchy(): boolean;
64
- get enabled(): boolean;
65
- set enabled(value: boolean);
66
- get enabledInHierarchy(): boolean;
67
- get mouseFilter(): MouseFilter;
68
- set mouseFilter(value: MouseFilter);
69
- get mouseBehaviorRecursive(): MouseBehaviorRecursive;
70
- set mouseBehaviorRecursive(value: MouseBehaviorRecursive);
71
- get focusMode(): FocusMode;
72
- set focusMode(value: FocusMode);
73
- get focusBehaviorRecursive(): FocusBehaviorRecursive;
74
- set focusBehaviorRecursive(value: FocusBehaviorRecursive);
75
- get defaultCursorShape(): CursorStyle;
76
- set defaultCursorShape(value: CursorStyle);
77
- get location(): Vector2;
78
- set location(value: Vector2);
79
- get rotation(): number;
80
- get x(): number;
81
- set x(value: number);
82
- get y(): number;
83
- set y(value: number);
84
- get width(): number;
85
- set width(value: number);
86
- get height(): number;
87
- set height(value: number);
88
- on<E extends keyof ControlEvent>(eventName: E, listener: EventEmitterListener<ControlEvent[E]>, options?: EventEmitterOptions): void;
89
- off<E extends keyof ControlEvent>(eventName: E, listener: EventEmitterListener<ControlEvent[E]>): void;
90
- setPosition(x: number, y: number, keepOffsets?: boolean): void;
91
- setSize(width: number, height: number): void;
92
- setScale(x: number, y: number): void;
93
- setRotation(degrees: number): void;
94
- setShear(x: number, y: number): void;
95
- setPivot(x: number, y: number): void;
96
- setAnchorMin(x: number, y: number): void;
97
- setAnchorMax(x: number, y: number): void;
98
- setOffsetMin(x: number, y: number): void;
99
- setOffsetMax(x: number, y: number): void;
100
- getRect(): Rect;
101
- getTransform2D(): Matrix3;
102
- setAnchorsPreset(preset: LayoutPreset, keepOffsets?: boolean): void;
103
- setOffsetsPreset(preset: LayoutPreset, margin?: number): void;
104
- setAnchorsAndOffsetsPreset(preset: LayoutPreset, margin?: number): void;
105
- get root(): RootControl | null;
106
- get isDisposed(): boolean;
107
- getGlobalTransform2D(): Matrix3;
108
- hasPoint(point: Vector2): boolean;
109
- getEffectiveMouseFilter(): MouseFilter;
110
- getFocusModeWithOverride(): FocusMode;
111
- getCursorShape(position: Vector2): CursorStyle;
112
- focus(): void;
113
- grabFocus(): void;
114
- grabClickFocus(): void;
115
- releaseFocus(): void;
116
- warpMouse(position: Vector2): void;
117
- /** Converts a window-space position into this control's local coordinates. */
118
- makePositionLocal(position: Vector2): Vector2;
119
- /** Gets the current mouse position transformed into this control's coordinates. */
120
- getLocalMousePosition(): Vector2;
121
- update(deltaTime: number): void;
122
- draw(): void;
123
- onDestroy(): void;
124
- drawLine(x1: number, y1: number, x2: number, y2: number, color?: Color, thickness?: number): void;
125
- drawPolyline(points: number[], color?: Color, thickness?: number): void;
126
- drawBezier(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, color?: Color, thickness?: number): void;
127
- drawTriangle(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, color?: Color, thickness?: number): void;
128
- drawRect(x: number, y: number, width: number, height: number, color?: Color, thickness?: number): void;
129
- drawCircle(cx: number, cy: number, radius: number, color?: Color, thickness?: number): void;
130
- fillTriangle(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, color?: Color): void;
131
- fillRect(x: number, y: number, width: number, height: number, color?: Color): void;
132
- fillCircle(cx: number, cy: number, radius: number, color?: Color): void;
133
- drawTexture(x: number, y: number, width: number, height: number, texture: Texture, region?: TextureRegion, color?: Color): void;
134
- drawText(x: number, y: number, text: string, fontSize: number, color?: Color, fontFamily?: string, fontWeight?: FontWeight, fontStyle?: FontStyle): void;
135
- onMouseEnter(location: Vector2): void;
136
- onMouseMove(event: InputEventMouseMotion): void;
137
- onMouseLeave(): void;
138
- onMouseWheel(event: InputEventMouseButton): void;
139
- onMouseDown(event: InputEventMouseButton): void;
140
- onMouseUp(event: InputEventMouseButton): void;
141
- onTouchDown(event: InputEventScreenTouch): void;
142
- onTouchMove(event: InputEventScreenDrag): void;
143
- onTouchUp(event: InputEventScreenTouch): void;
144
- onKeyDown(event: InputEventKey): void;
145
- onKeyUp(event: InputEventKey): void;
146
- onGotFocus(): void;
147
- onLostFocus(): void;
148
- protected getDragData(position: Vector2): unknown;
149
- protected canDropData(position: Vector2, data: unknown): boolean;
150
- protected dropData(position: Vector2, data: unknown): void;
151
- dispose(): void;
152
- private applyBounds;
153
- private markTransformDirty;
154
- private getParentRect;
155
- private computeOffsets;
156
- private computeAnchors;
157
- private isMouseRecursiveEnabled;
158
- private isFocusRecursiveEnabled;
159
- }
160
- /** A Control that owns child Controls. */
161
- export declare class ContainerControl extends Control {
162
- readonly children: Control[];
163
- addChild<T extends Control>(child: T): T;
164
- removeChild(child: Control): void;
165
- getChildIndex(child: Control): number;
166
- drawSelf(): void;
167
- draw(): void;
168
- protected drawChildren(): void;
169
- update(deltaTime: number): void;
170
- dispose(): void;
171
- }
172
- /** Base class for GUI tree roots and input dispatchers. */
173
- export declare abstract class RootControl extends ContainerControl {
174
- abstract getMousePosition(): Vector2;
175
- abstract guiGetFocusOwner(): Control | null;
176
- abstract guiIsDragging(): boolean;
177
- abstract guiGetDragData(): unknown;
178
- abstract guiIsDragSuccessful(): boolean;
179
- abstract guiCancelDrag(): void;
180
- abstract grabControlFocus(control: Control): void;
181
- abstract grabControlClickFocus(control: Control): void;
182
- abstract releaseControlFocus(control?: Control): void;
183
- abstract warpControlMouse(position: Vector2): void;
184
- abstract updateMouseCursorState(): void;
185
- abstract controlStateChanged(control: Control): void;
186
- abstract controlRemoved(control: Control): void;
187
- abstract controlTreeChanged(): void;
188
- }
@@ -1,2 +0,0 @@
1
- export * from './control';
2
- export * from './roots';
@@ -1,79 +0,0 @@
1
- import { Vector2 } from '@galacean/effects-math/es/core/vector2';
2
- import type { UICanvas } from '../components/ui-canvas';
3
- import type { Engine } from '../engine';
4
- import type { InputEvent } from '../input';
5
- import type { Control } from './control';
6
- import { ContainerControl, RootControl } from './control';
7
- /** CanvasLayer-like boundary for a single UICanvas GUI tree. */
8
- export declare class CanvasRootControl extends ContainerControl {
9
- readonly canvas: UICanvas;
10
- constructor(engine: Engine, canvas: UICanvas);
11
- get inputDisabled(): boolean;
12
- }
13
- /** Global ordered collection of UICanvas roots. */
14
- export declare class CanvasContainer extends ContainerControl {
15
- constructor(engine: Engine);
16
- sortCanvases(): void;
17
- addChildInternal(child: Control): void;
18
- draw(): void;
19
- }
20
- /** Engine window GUI root. Routes events across all UICanvas roots. */
21
- export declare class WindowRootControl extends RootControl {
22
- readonly canvases: CanvasContainer;
23
- dragThreshold: number;
24
- private lastInput;
25
- private readonly gui;
26
- constructor(engine: Engine);
27
- pushInput(event: InputEvent): void;
28
- isInputHandled(): boolean;
29
- getMousePosition(): Vector2;
30
- guiGetFocusOwner(): Control | null;
31
- guiReleaseFocus(): void;
32
- guiIsDragging(): boolean;
33
- guiGetDragData(): unknown;
34
- guiIsDragSuccessful(): boolean;
35
- guiCancelDrag(): void;
36
- grabControlFocus(control: Control): void;
37
- grabControlClickFocus(control: Control): void;
38
- releaseControlFocus(control?: Control): void;
39
- warpControlMouse(position: Vector2): void;
40
- updateMouseCursorState(): void;
41
- controlStateChanged(control: Control): void;
42
- controlRemoved(control: Control): void;
43
- controlTreeChanged(): void;
44
- cancelPointerInput(): void;
45
- resize(width: number, height: number): void;
46
- render(): void;
47
- update(deltaTime: number): void;
48
- dispose(): void;
49
- private processGUIInput;
50
- private processMouseButton;
51
- private processMouseMotion;
52
- private processScreenTouch;
53
- private processScreenDrag;
54
- private callGUIInput;
55
- private callControlInput;
56
- private findInputControl;
57
- private findControlAtPosition;
58
- private updateMouseOver;
59
- private buildHoverHierarchy;
60
- private findClickFocus;
61
- private beginDragging;
62
- private finishDrop;
63
- private findDropTarget;
64
- private endDragging;
65
- private updateCursor;
66
- private postGrabClickFocus;
67
- private cleanupInternalState;
68
- private dropMouseFocus;
69
- private dropMouseOver;
70
- private dropControlState;
71
- private requestMouseOverUpdate;
72
- private getGlobalInverse;
73
- private toLocal;
74
- private controlBelongsToSubtree;
75
- private isControlValid;
76
- private isControlUsable;
77
- private findCanvasRoot;
78
- private isFocusTargetUsable;
79
- }