@galacean/effects-plugin-editor-gizmo 2.10.4 → 2.11.0-alpha.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.
Files changed (125) hide show
  1. package/README.md +37 -5
  2. package/dist/2d/configs/builtin-configs.d.ts +14 -0
  3. package/dist/2d/configs/config-definition.d.ts +40 -0
  4. package/dist/2d/configs/config-manager.d.ts +52 -0
  5. package/dist/2d/configs/index.d.ts +6 -0
  6. package/dist/2d/configs/loading-config.d.ts +3 -0
  7. package/dist/2d/configs/types.d.ts +321 -0
  8. package/dist/2d/cursor-icons.d.ts +8 -0
  9. package/dist/2d/cursor.d.ts +36 -0
  10. package/dist/2d/drag-threshold.d.ts +13 -0
  11. package/dist/2d/drawing.d.ts +148 -0
  12. package/dist/2d/frame/frame-assisted-layout.d.ts +115 -0
  13. package/dist/2d/frame/frame-auto-layout.d.ts +47 -0
  14. package/dist/2d/frame/frame-manager.d.ts +169 -0
  15. package/dist/2d/frame/frame-resize.d.ts +13 -0
  16. package/dist/2d/frame/index.d.ts +5 -0
  17. package/dist/2d/frame/layout-calculations.d.ts +109 -0
  18. package/dist/2d/frame/types.d.ts +41 -0
  19. package/dist/2d/gesture-handler.d.ts +253 -0
  20. package/dist/2d/gizmo-action.d.ts +159 -0
  21. package/dist/2d/gizmo-manager.d.ts +105 -0
  22. package/dist/2d/gizmo-owner.d.ts +65 -0
  23. package/dist/2d/gizmo-tool.d.ts +15 -0
  24. package/dist/2d/gizmo-tools/hand-gizmo-tool.d.ts +4 -0
  25. package/dist/2d/gizmo-tools/image-cut-gizmo-tool.d.ts +7 -0
  26. package/dist/2d/gizmo-tools/image-expand-gizmo-tool.d.ts +7 -0
  27. package/dist/2d/gizmo-tools/index.d.ts +7 -0
  28. package/dist/2d/gizmo-tools/item-create-gizmo-tool.d.ts +10 -0
  29. package/dist/2d/gizmo-tools/mask-gizmo-tool.d.ts +7 -0
  30. package/dist/2d/gizmo-tools/move-gizmo-tool.d.ts +6 -0
  31. package/dist/2d/gizmo-tools/sprite-text-edit-gizmo-tool.d.ts +7 -0
  32. package/dist/2d/gizmo-type.d.ts +37 -0
  33. package/dist/2d/gizmo.d.ts +60 -0
  34. package/dist/2d/gizmos/box-selection-gizmo.d.ts +67 -0
  35. package/dist/2d/gizmos/change-selection-gizmo.d.ts +45 -0
  36. package/dist/2d/gizmos/click-drag-multiplex-gizmo.d.ts +95 -0
  37. package/dist/2d/gizmos/corner-rotation-gizmo.d.ts +101 -0
  38. package/dist/2d/gizmos/enter-edit-mode-gizmo.d.ts +11 -0
  39. package/dist/2d/gizmos/hand-gizmo.d.ts +67 -0
  40. package/dist/2d/gizmos/icon-gizmo.d.ts +107 -0
  41. package/dist/2d/gizmos/image-cut-gizmo.d.ts +140 -0
  42. package/dist/2d/gizmos/image-expand-gizmo.d.ts +135 -0
  43. package/dist/2d/gizmos/image-interaction.d.ts +40 -0
  44. package/dist/2d/gizmos/item-create-gizmo.d.ts +146 -0
  45. package/dist/2d/gizmos/leave-effects-edit-gizmo.d.ts +11 -0
  46. package/dist/2d/gizmos/leave-text-edit-gizmo.d.ts +11 -0
  47. package/dist/2d/gizmos/loading-gizmo.d.ts +110 -0
  48. package/dist/2d/gizmos/loading-manager.d.ts +74 -0
  49. package/dist/2d/gizmos/mask-gizmo.d.ts +153 -0
  50. package/dist/2d/gizmos/move-selection-gizmo.d.ts +64 -0
  51. package/dist/2d/gizmos/resize-selection-gizmo/anchored-resize.d.ts +40 -0
  52. package/dist/2d/gizmos/resize-selection-gizmo/index.d.ts +2 -0
  53. package/dist/2d/gizmos/resize-selection-gizmo/resize-selection-gizmo.d.ts +364 -0
  54. package/dist/2d/gizmos/resize-selection-gizmo/transform-types.d.ts +27 -0
  55. package/dist/2d/gizmos/select-text-gizmo.d.ts +77 -0
  56. package/dist/2d/gizmos/sprite-text-edit-gizmo.d.ts +149 -0
  57. package/dist/2d/gizmos/text-gizmo.d.ts +65 -0
  58. package/dist/2d/gizmos/viewport-overlay-gizmo.d.ts +66 -0
  59. package/dist/2d/index.d.ts +44 -0
  60. package/dist/2d/items/default-vfx-items.d.ts +45 -0
  61. package/dist/2d/items/index.d.ts +6 -0
  62. package/dist/2d/items/item-geometry.d.ts +69 -0
  63. package/dist/2d/items/item-hierarchy.d.ts +39 -0
  64. package/dist/2d/items/item-predicates.d.ts +31 -0
  65. package/dist/2d/items/media-controls.d.ts +39 -0
  66. package/dist/2d/items/vfx-item-factory.d.ts +13 -0
  67. package/dist/2d/math/core.d.ts +26 -0
  68. package/dist/2d/math/geometry.d.ts +83 -0
  69. package/dist/2d/math/index.d.ts +4 -0
  70. package/dist/2d/math/ray-caster.d.ts +56 -0
  71. package/dist/2d/math/utils.d.ts +6 -0
  72. package/dist/2d/modes/default-selection-mode.d.ts +19 -0
  73. package/dist/2d/modes/edit-mode.d.ts +18 -0
  74. package/dist/2d/modes/effects-edit-mode.d.ts +34 -0
  75. package/dist/2d/modes/index.d.ts +4 -0
  76. package/dist/2d/modes/text-edit-mode.d.ts +34 -0
  77. package/dist/2d/selection/create-selection-interaction-gizmo.d.ts +14 -0
  78. package/dist/2d/selection/index.d.ts +3 -0
  79. package/dist/2d/selection/selection.d.ts +338 -0
  80. package/dist/2d/selection/snap-manager.d.ts +130 -0
  81. package/dist/2d/text/index.d.ts +2 -0
  82. package/dist/2d/text/text-caret-mapper.d.ts +61 -0
  83. package/dist/2d/text/text-edit-session.d.ts +169 -0
  84. package/dist/2d/viewport/coordinates.d.ts +89 -0
  85. package/dist/2d/viewport/gizmo-viewport.d.ts +108 -0
  86. package/dist/2d/viewport/index.d.ts +6 -0
  87. package/dist/2d/viewport/types.d.ts +11 -0
  88. package/dist/2d/viewport/viewport-navigation-controller.d.ts +110 -0
  89. package/dist/2d/viewport/viewport-operations.d.ts +15 -0
  90. package/dist/2d/viewport/viewport-range.d.ts +9 -0
  91. package/dist/2d/viewport/viewport-utils.d.ts +32 -0
  92. package/dist/{gizmo-component.d.ts → 3d/gizmo-component.d.ts} +3 -5
  93. package/dist/3d/index.d.ts +4 -0
  94. package/dist/index.d.ts +2 -5
  95. package/dist/index.js +15030 -171
  96. package/dist/index.js.map +1 -1
  97. package/dist/index.min.js +2 -2
  98. package/dist/index.min.js.map +1 -1
  99. package/dist/index.mjs +14871 -173
  100. package/dist/index.mjs.map +1 -1
  101. package/package.json +9 -3
  102. /package/dist/{constants.d.ts → 3d/constants.d.ts} +0 -0
  103. /package/dist/{define.d.ts → 3d/define.d.ts} +0 -0
  104. /package/dist/{geometry → 3d/geometry}/box.d.ts +0 -0
  105. /package/dist/{geometry → 3d/geometry}/cone.d.ts +0 -0
  106. /package/dist/{geometry → 3d/geometry}/cylinder.d.ts +0 -0
  107. /package/dist/{geometry → 3d/geometry}/direction-light.d.ts +0 -0
  108. /package/dist/{geometry → 3d/geometry}/floor-line-edge.d.ts +0 -0
  109. /package/dist/{geometry → 3d/geometry}/floor-line.d.ts +0 -0
  110. /package/dist/{geometry → 3d/geometry}/frustum.d.ts +0 -0
  111. /package/dist/{geometry → 3d/geometry}/geometry.d.ts +0 -0
  112. /package/dist/{geometry → 3d/geometry}/index.d.ts +0 -0
  113. /package/dist/{geometry → 3d/geometry}/plane.d.ts +0 -0
  114. /package/dist/{geometry → 3d/geometry}/point-light.d.ts +0 -0
  115. /package/dist/{geometry → 3d/geometry}/sphere.d.ts +0 -0
  116. /package/dist/{geometry → 3d/geometry}/spot-light.d.ts +0 -0
  117. /package/dist/{geometry → 3d/geometry}/torus.d.ts +0 -0
  118. /package/dist/{gizmo-loader.d.ts → 3d/gizmo-loader.d.ts} +0 -0
  119. /package/dist/{gizmo-vfx-item.d.ts → 3d/gizmo-vfx-item.d.ts} +0 -0
  120. /package/dist/{math-utils.d.ts → 3d/math-utils.d.ts} +0 -0
  121. /package/dist/{mesh.d.ts → 3d/mesh.d.ts} +0 -0
  122. /package/dist/{raycast.d.ts → 3d/raycast.d.ts} +0 -0
  123. /package/dist/{shape.d.ts → 3d/shape.d.ts} +0 -0
  124. /package/dist/{util.d.ts → 3d/util.d.ts} +0 -0
  125. /package/dist/{wireframe.d.ts → 3d/wireframe.d.ts} +0 -0
@@ -0,0 +1,77 @@
1
+ import { type InputEventMouseButton, type InputEventMouseMotion } from '@galacean/effects';
2
+ import type { Control } from '@galacean/effects-plugin-gui';
3
+ import { Gizmo } from '../gizmo';
4
+ import type { GizmoOwner } from '../gizmo-owner';
5
+ import type { TextEditSession } from '../text/text-edit-session';
6
+ /** 在文本编辑模式下悬停、选择并切换文本对象。 */
7
+ export declare class SelectTextGizmo extends Gizmo {
8
+ private readonly session;
9
+ readonly type = "select-text";
10
+ private static readonly HOVER_HIT_RADIUS;
11
+ private static readonly HOVER_LINE_WIDTH;
12
+ private static readonly HOVER_DASH_LENGTH;
13
+ private static readonly HOVER_GAP_LENGTH;
14
+ private _hoverTextId;
15
+ private pointerSelecting;
16
+ /**
17
+ * 创建文本选择交互。
18
+ * @param owner Gizmo 宿主。
19
+ * @param session 文本编辑会话。
20
+ */
21
+ constructor(owner: GizmoOwner, session: TextEditSession);
22
+ /** 当前悬停文本的 ID。 */
23
+ get hoverTextId(): string | undefined;
24
+ /**
25
+ * 更新文本悬停或拖拽选区。
26
+ * @param event 鼠标移动事件。
27
+ */
28
+ onMouseMove(event: InputEventMouseMotion): void;
29
+ /**
30
+ * 切换到命中的文本并开始指针选区。
31
+ * @param event 鼠标按下事件。
32
+ */
33
+ onMouseDown(event: InputEventMouseButton): void;
34
+ /**
35
+ * 更新文本指针选区。
36
+ * @param event 鼠标拖拽事件。
37
+ */
38
+ onMouseDrag(event: InputEventMouseMotion): void;
39
+ /**
40
+ * 完成文本指针选区。
41
+ * @param event 鼠标抬起事件。
42
+ */
43
+ onMouseUp(event: InputEventMouseButton): void;
44
+ /** 清除离开视口后的文本悬停状态。 */
45
+ onMouseLeave(): void;
46
+ /** 在每帧更新时校验悬停文本是否仍可编辑。 */
47
+ onUpdate(): void;
48
+ /**
49
+ * 绘制悬停文本的轮廓。
50
+ * @param control 绘制控制器。
51
+ */
52
+ draw(control: Control): void;
53
+ /** 释放文本选择交互状态。 */
54
+ dispose(): void;
55
+ /**
56
+ * 查找指定位置可编辑的文本对象。
57
+ * @param point 视口坐标。
58
+ * @param excludeEditingItem 是否排除当前编辑对象。
59
+ * @param includeNearby 是否使用悬停命中容差。
60
+ * @returns 命中的文本对象。
61
+ */
62
+ private resolveTextTarget;
63
+ /**
64
+ * 判断对象是否可作为文本选择目标。
65
+ * @param item 待检查对象。
66
+ * @param excludeEditingItem 是否排除当前编辑对象。
67
+ * @returns 是否为可选文本对象。
68
+ */
69
+ private isTextCandidate;
70
+ /** 清除文本悬停目标。 */
71
+ private clearHover;
72
+ /**
73
+ * 设置文本编辑光标。
74
+ * @param _event 当前鼠标事件。
75
+ */
76
+ private setTextCursor;
77
+ }
@@ -0,0 +1,149 @@
1
+ import type { spec } from '@galacean/effects';
2
+ import { type InputEventMouseButton, type InputEventMouseMotion } from '@galacean/effects';
3
+ import type { Control } from '@galacean/effects-plugin-gui';
4
+ import { Gizmo } from '../gizmo';
5
+ import { GizmoType } from '../gizmo-type';
6
+ import { Box2 } from '@galacean/effects-math/es/extension/index';
7
+ import type { SpriteTextEditConfig } from '../configs/types';
8
+ /**
9
+ * 图层文字信息
10
+ */
11
+ export type SpriteTextInfo = {
12
+ /**
13
+ * 元素ID
14
+ */
15
+ id: string;
16
+ /**
17
+ * 文本框索引
18
+ */
19
+ index: number;
20
+ /**
21
+ * 文本包围盒
22
+ */
23
+ box: Box2;
24
+ /**
25
+ * 文本内容
26
+ */
27
+ text: string;
28
+ /**
29
+ * 是否被修改过
30
+ */
31
+ hasChanged: boolean;
32
+ /**
33
+ * 是否处于编辑态
34
+ */
35
+ isEditing: boolean;
36
+ };
37
+ /**
38
+ * 精准改字功能初始化信息
39
+ */
40
+ export type SpriteTextInitParam = {
41
+ /**
42
+ * 元素ID
43
+ */
44
+ id: string;
45
+ /** 原始包围盒。 */
46
+ originBox?: Box2;
47
+ /**
48
+ * 改字信息
49
+ */
50
+ info: SpriteTextInitInfo[];
51
+ };
52
+ /** 单个精准改字文本框的初始化信息。 */
53
+ export type SpriteTextInitInfo = {
54
+ /**
55
+ * 是否被修改过
56
+ */
57
+ hasChanged: boolean;
58
+ /**
59
+ * 文字内容
60
+ */
61
+ text: string;
62
+ /**
63
+ * 包围盒信息
64
+ */
65
+ box: [spec.vec2, spec.vec2, spec.vec2, spec.vec2];
66
+ };
67
+ /** 精准改字交互参数 */
68
+ type SpriteTextEditInteractionParam = {
69
+ /** 已选中索引 */
70
+ selected: number;
71
+ /** 预选中索引 */
72
+ preSelected: number;
73
+ };
74
+ /** 精准改字结果列表 */
75
+ type SpriteTextEditResult = SpriteTextInfo[];
76
+ /** 在图层文本框上提供悬停、选择、编辑和绘制能力。 */
77
+ export declare class SpriteTextEditGizmo extends Gizmo {
78
+ readonly type: GizmoType;
79
+ result: SpriteTextEditResult;
80
+ interactionParam: SpriteTextEditInteractionParam;
81
+ /** onMouseMove 命中缓存(坐标未变则跳过 computePreSelected,避免每帧全 result 命中扫描)。 */
82
+ private cachedCoords;
83
+ /** 当前精准改字配置。 */
84
+ get config(): Readonly<SpriteTextEditConfig>;
85
+ /**
86
+ * 更新指针悬停的文本框。
87
+ * @param _event 鼠标移动事件。
88
+ */
89
+ onMouseMove(_event: InputEventMouseMotion): void;
90
+ /** 鼠标离开交互层:清预选中 + 失效缓存。 */
91
+ onMouseLeave(): void;
92
+ /**
93
+ * 将命中的文本框设为编辑态并发送点击事件。
94
+ * @param event 鼠标按下事件。
95
+ */
96
+ onMouseDown(event: InputEventMouseButton): void;
97
+ /**
98
+ * 以初始化参数列表填充 result,将原始角点转换为相对元素包围盒的归一化盒。
99
+ * @param initParams 初始化参数列表
100
+ */
101
+ initResult(initParams: SpriteTextInitParam[]): void;
102
+ /** 清空当前所有改字结果数据。 */
103
+ clearResultData(): void;
104
+ /**
105
+ * 设置当前选中文字框;找不到时告警。
106
+ * @param id 元素 ID
107
+ * @param index 文本框索引
108
+ */
109
+ setSelected(id: string, index: number): void;
110
+ /**
111
+ * 设置指定文字框的文本内容;找不到时告警。
112
+ * @param id 元素 ID
113
+ * @param index 文本框索引
114
+ * @param text 文本内容
115
+ */
116
+ setText(id: string, index: number, text: string): void;
117
+ /**
118
+ * 设置指定文字框的"已改动"状态;找不到时告警。
119
+ * @param id 元素 ID
120
+ * @param index 文本框索引
121
+ * @param hasChanged 是否已改动
122
+ */
123
+ setChangedState(id: string, index: number, hasChanged: boolean): void;
124
+ /**
125
+ * 设置指定文字框的编辑态;找不到时告警。
126
+ * @param id 元素 ID
127
+ * @param index 文本框索引
128
+ * @param isEditing 是否处于编辑态
129
+ */
130
+ setEditState(id: string, index: number, isEditing: boolean): void;
131
+ /**
132
+ * 绘制文本框状态与正在编辑的文本。
133
+ * @param control 绘制控制器。
134
+ */
135
+ draw(control: Control): void;
136
+ /**
137
+ * 获取指定元素的视口包围盒。
138
+ * @param id 元素 ID。
139
+ * @returns 元素包围盒。
140
+ */
141
+ private getItemOriginBox;
142
+ /**
143
+ * 查找鼠标命中的文本框索引。
144
+ * @param mouse 鼠标位置。
145
+ * @returns 首个命中索引;未命中时返回 -1。
146
+ */
147
+ private computePreSelected;
148
+ }
149
+ export {};
@@ -0,0 +1,65 @@
1
+ import { type InputEventMouseButton } from '@galacean/effects';
2
+ import type { Control } from '@galacean/effects-plugin-gui';
3
+ import { Gizmo } from '../gizmo';
4
+ import type { GizmoOwner } from '../gizmo-owner';
5
+ import { GizmoType } from '../gizmo-type';
6
+ import type { TextEditSession, TextInteractionParam, TextResult } from '../text/text-edit-session';
7
+ export type { TextEmptyResult, TextInteractionParam, TextResult, TextValidResult, } from '../text/text-edit-session';
8
+ /** 文本编辑态包围盒线色。 */
9
+ export declare const TEXT_EDIT_BOX_LINE_COLOR = 3900150;
10
+ /** 文本编辑态包围盒线宽。 */
11
+ export declare const TEXT_EDIT_BOX_LINE_WIDTH = 2;
12
+ /** 将文本编辑会话投影到画布并绘制编辑框。 */
13
+ export declare class TextGizmo extends Gizmo {
14
+ readonly type = GizmoType.TEXT;
15
+ result: TextResult;
16
+ private readonly session;
17
+ private readonly projectionToken;
18
+ /**
19
+ * 转发文本输入事件。
20
+ * @param payload 文本输入结果。
21
+ */
22
+ private readonly forwardTextInput;
23
+ /**
24
+ * @param owner Gizmo 宿主
25
+ * @param session 文本编辑会话
26
+ */
27
+ constructor(owner: GizmoOwner, session: TextEditSession);
28
+ /** 文本编辑使用的 DOM 输入框。 */
29
+ get textAreaElement(): HTMLTextAreaElement;
30
+ /** 当前文本交互状态。 */
31
+ get interactionParam(): TextInteractionParam;
32
+ /** 是否正在编辑文本。 */
33
+ get isEditing(): boolean;
34
+ /** 当前视口缩放。 */
35
+ get viewScale(): number;
36
+ /**
37
+ * 保留文本编辑会话的鼠标按下入口。
38
+ * @param _event 鼠标按下事件
39
+ */
40
+ onMouseDown(_event: InputEventMouseButton): void;
41
+ /**
42
+ * 编辑中接收鼠标抬起事件。
43
+ * @param event 鼠标抬起事件
44
+ */
45
+ onMouseUp(event: InputEventMouseButton): void;
46
+ /** 更新文本元素的视图包围盒。 */
47
+ onUpdate(): void;
48
+ /**
49
+ * 绘制文本编辑框并同步 DOM 输入框。
50
+ * @param control 绘制控制器
51
+ */
52
+ draw(control?: Control): void;
53
+ /**
54
+ * 选中当前编辑文本的全部内容,并将焦点交给输入框。
55
+ * @returns 当前存在可编辑文本时返回 true
56
+ */
57
+ selectAllText(): boolean;
58
+ /** 脱离文本编辑会话投影。 */
59
+ dispose(): void;
60
+ /**
61
+ * 绘制文本编辑包围盒。
62
+ * @param control 绘制控制器
63
+ */
64
+ private drawEditBox;
65
+ }
@@ -0,0 +1,66 @@
1
+ import type { Control } from '@galacean/effects-plugin-gui';
2
+ import { Box2 } from '@galacean/effects-math/es/extension/index';
3
+ import type { Matrix3 } from '../math';
4
+ import { Gizmo } from '../gizmo';
5
+ import { GizmoType } from '../gizmo-type';
6
+ import type { ViewportOverlayConfig } from '../configs/types';
7
+ /** 视口画板与安全区配置。 */
8
+ export type ViewProperty = {
9
+ /** 画板(设计稿)尺寸 [宽, 高],单位为设计稿像素 */
10
+ size: [number, number];
11
+ /** 出血安全区 [上, 下, 左, 右],单位为设计稿像素,相对画板边缘的边距 */
12
+ safeArea: [number, number, number, number];
13
+ /** 预览安全区列表 */
14
+ previewSafeAreas: {
15
+ /** 安全区包围盒 [左, 上, 宽, 高],单位为设计稿像素,相对画板左上角 */
16
+ box: [number, number, number, number];
17
+ /** 填充色 [r, g, b, a?],0..255 */
18
+ color?: number[];
19
+ /** 背景贴图地址 */
20
+ url?: string;
21
+ /** 是否可见 */
22
+ visible?: boolean;
23
+ }[];
24
+ };
25
+ /** 视口展示 gizmo:绘制画板边框、画框外遮罩、出血与预览安全区。 */
26
+ export declare class ViewportOverlayGizmo extends Gizmo {
27
+ readonly type = GizmoType.VIEWPORT_OVERLAY;
28
+ /** 遮挡层绘制结果(画板视口盒) */
29
+ box: Box2;
30
+ /** 主视口归一化 Box2 到屏幕的变换。 */
31
+ transform: Matrix3 | undefined;
32
+ /** 视图属性(由外部设置) */
33
+ viewProperty: ViewProperty | undefined;
34
+ /** 外部提供的主视口包围盒计算函数。 */
35
+ mainViewportBoxProvider: (() => Box2 | null) | undefined;
36
+ /** previewSafeAreas 贴图缓存:url → Texture(避免每帧重建) */
37
+ private safeAreaTextures;
38
+ /** previewSafeAreas 贴图加载 Promise:url → Promise<Texture>(防重入,加载完写入 safeAreaTextures) */
39
+ private safeAreaTexturePromises;
40
+ /** 当前视口覆盖层配置。 */
41
+ get config(): Readonly<ViewportOverlayConfig>;
42
+ /** 刷新当前画板或主视口的屏幕包围盒。 */
43
+ onUpdate(): void;
44
+ /**
45
+ * 绘制画板外遮罩、安全区与画板边框。
46
+ * @param control 绘制控制器。
47
+ */
48
+ draw(control: Control): void;
49
+ /** 释放预览安全区贴图缓存,调用父类释放。 */
50
+ dispose(): void;
51
+ /**
52
+ * 将居中的预览矩形投影为屏幕包围盒。
53
+ * @param item 提供合成相机的播放器元素。
54
+ * @param size 预览尺寸。
55
+ * @returns 主视口屏幕包围盒。
56
+ */
57
+ private projectPreviewBox;
58
+ /**
59
+ * 获取预览安全区贴图(懒加载)。命中且未销毁则直接返回;否则发起一次异步加载并返回
60
+ * undefined(本帧跳过该贴图,加载完成后由持续渲染循环自动重绘)。与 IconGizmo 同模式。
61
+ * @param url 贴图地址
62
+ * @param engine effects 引擎实例(取自 control)
63
+ * @returns 命中且未销毁的缓存纹理;未命中且发起异步加载时返回 undefined
64
+ */
65
+ private getSafeAreaTexture;
66
+ }
@@ -0,0 +1,44 @@
1
+ export * from './math';
2
+ export type { ViewportNavigationRange } from './viewport';
3
+ export * from './text';
4
+ export * from './modes';
5
+ export * from './gizmo-tools';
6
+ export * from './gizmo';
7
+ export * from './gizmo-tool';
8
+ export * from './gizmo-action';
9
+ export * from './gizmo-manager';
10
+ export * from './gizmo-owner';
11
+ export * from './gizmos/loading-manager';
12
+ export * from './gizmo-type';
13
+ export * from './frame';
14
+ export { ConfigManager, DEFAULT_LOADING_FRAGMENT, cloneConfigValue, defineConfig, freezeConfigValue, effectsEditModeConfig, iconConfig, itemCreateConfig, loadingConfig, maskConfig, imageCutConfig, imageExpandConfig, resizeSelectionConfig, selectionPreviewConfig, selectionSnapConfig, spriteTextEditConfig, viewportNavigationConfig, viewportOverlayConfig, } from './configs';
15
+ export type { AnyConfigChange, AnyConfigDefinition, ConfigChange, ConfigDefinition, ConfigManagerEvents, ConfigValue, EffectsEditModeConfig, IconConfig, ItemCreateConfig, LoadingConfig, MaskConfig, ImageCutConfig, ImageExpandConfig, ResizeSelectionBehavior, ResizeSelectionConfig, SelectionPreviewConfig, SnapConfig, SpriteTextEditConfig, ViewportNavigationConfig, ViewportOverlayConfig, } from './configs';
16
+ export * from './items';
17
+ export * from './drawing';
18
+ export * from './viewport';
19
+ export * from './selection';
20
+ export * from './gesture-handler';
21
+ export * from './cursor';
22
+ export * from './cursor-icons';
23
+ export * from './drag-threshold';
24
+ export * from './gizmos/image-interaction';
25
+ export * from './gizmos/resize-selection-gizmo';
26
+ export * from './gizmos/corner-rotation-gizmo';
27
+ export * from './gizmos/text-gizmo';
28
+ export * from './gizmos/select-text-gizmo';
29
+ export * from './gizmos/image-cut-gizmo';
30
+ export * from './gizmos/image-expand-gizmo';
31
+ export * from './gizmos/mask-gizmo';
32
+ export * from './gizmos/sprite-text-edit-gizmo';
33
+ export * from './gizmos/icon-gizmo';
34
+ export * from './gizmos/loading-gizmo';
35
+ export * from './gizmos/viewport-overlay-gizmo';
36
+ export * from './gizmos/item-create-gizmo';
37
+ export * from './gizmos/hand-gizmo';
38
+ export * from './gizmos/box-selection-gizmo';
39
+ export * from './gizmos/change-selection-gizmo';
40
+ export * from './gizmos/move-selection-gizmo';
41
+ export * from './gizmos/click-drag-multiplex-gizmo';
42
+ export * from './gizmos/leave-text-edit-gizmo';
43
+ export * from './gizmos/leave-effects-edit-gizmo';
44
+ export * from './gizmos/enter-edit-mode-gizmo';
@@ -0,0 +1,45 @@
1
+ import { type Composition, spec, type VFXItem } from '@galacean/effects';
2
+ /** 创建内置类型 VFXItem 的便捷工厂。 */
3
+ export declare class DefaultVFXItems {
4
+ /**
5
+ * 创建空元素。
6
+ * @param composition 目标合成
7
+ * @param parent 父元素
8
+ * @param name 元素名称
9
+ * @returns 新建的空元素
10
+ */
11
+ static createEmpty(composition: Composition, parent?: null, name?: string): VFXItem;
12
+ /**
13
+ * 创建图片元素。
14
+ * @param composition 目标合成
15
+ * @param parent 父元素
16
+ * @param name 元素名称
17
+ * @returns 新建的图片元素
18
+ */
19
+ static createSprite(composition: Composition, parent?: null, name?: string): VFXItem;
20
+ /**
21
+ * 创建文本元素。
22
+ * @param composition 目标合成
23
+ * @param parent 父元素
24
+ * @param name 元素名称
25
+ * @returns 新建的文本元素
26
+ */
27
+ static createText(composition: Composition, parent?: null, name?: string): VFXItem;
28
+ /**
29
+ * 创建视频元素。
30
+ * @param composition 目标合成
31
+ * @param parent 父元素
32
+ * @param name 元素名称
33
+ * @returns 新建的视频元素
34
+ */
35
+ static createVideo(composition: Composition, parent?: null, name?: string): VFXItem;
36
+ /**
37
+ * 加载并创建动效合成元素。
38
+ * @param composition 目标合成
39
+ * @param effects 动效地址或场景数据
40
+ * @param parent 父元素
41
+ * @param urlname 元素名称
42
+ * @returns 新建的动效元素
43
+ */
44
+ static createEffects(composition: Composition, effects: string | spec.JSONScene, parent?: null, urlname?: string): Promise<VFXItem>;
45
+ }
@@ -0,0 +1,6 @@
1
+ export * from './default-vfx-items';
2
+ export * from './item-geometry';
3
+ export * from './item-hierarchy';
4
+ export * from './item-predicates';
5
+ export * from './media-controls';
6
+ export * from './vfx-item-factory';
@@ -0,0 +1,69 @@
1
+ import { type VFXItem } from '@galacean/effects';
2
+ import { Box2 } from '@galacean/effects-math/es/extension/index';
3
+ import type { Matrix3 } from '../math';
4
+ import { Euler, Matrix4, Vector2, Vector3 } from '../math';
5
+ /**
6
+ * 获取元素用于编辑的视图 Box2。
7
+ * @param item 播放器元素
8
+ * @param containerSize 视图大小
9
+ * @returns 视图坐标系中的轴对齐包围盒
10
+ */
11
+ export declare function getItemViewBox(item: VFXItem, containerSize: Vector2): Box2;
12
+ /**
13
+ * 获取归一化 Box2 到元素视图坐标的变换。
14
+ * @param item 播放器元素
15
+ * @param containerSize 视图大小
16
+ * @returns 有效变换;元素不可见或没有有效矩形时返回 undefined
17
+ */
18
+ export declare function getItemViewTransform(item: VFXItem, containerSize: Vector2): Matrix3 | undefined;
19
+ /**
20
+ * 获取播放器元素在视图中的锚点坐标。
21
+ * @param item 播放器元素
22
+ * @param containerSize 视图容器大小
23
+ * @returns 视图锚点坐标
24
+ */
25
+ export declare function getItemViewAnchor(item: VFXItem, containerSize: Vector2): Vector2;
26
+ /**
27
+ * 获取元素的变换矩阵和父级变换矩阵。
28
+ * @param item 播放器元素
29
+ * @returns 元素的变换矩阵和父级变换矩阵
30
+ */
31
+ export declare function getItemTransform(item: VFXItem): {
32
+ matrix: Matrix4;
33
+ parentMatrix: Matrix4;
34
+ };
35
+ /** 元素的世界分解变换。 */
36
+ export type DecomposedItemTransform = {
37
+ /** 元素的世界矩阵。 */
38
+ matrix: Matrix4;
39
+ /** 父元素的世界矩阵。 */
40
+ parentMatrix: Matrix4;
41
+ /** 元素的世界位置。 */
42
+ position: Vector3;
43
+ /** 元素的世界旋转。 */
44
+ rotation: Euler;
45
+ /** 元素的世界缩放。 */
46
+ scale: Vector3;
47
+ };
48
+ /**
49
+ * 获取元素的世界变换。
50
+ * @param item 播放器元素
51
+ * @returns 分解后的世界变换
52
+ */
53
+ export declare function decomposeItemTransform(item: VFXItem): DecomposedItemTransform;
54
+ /**
55
+ * 获取播放器元素在视图中的尺寸。
56
+ * @param item 播放器元素
57
+ * @param containerSize 视图容器大小
58
+ * @returns 视图尺寸
59
+ */
60
+ export declare function getItemViewSize(item: VFXItem, containerSize: Vector2): Vector2;
61
+ /**
62
+ * 获取元素在所属合成坐标系中的实际世界尺寸。
63
+ *
64
+ * `transform.size` 是元素本地尺寸;这里叠加元素到合成根之间的缩放,
65
+ * 但排除合成本身的世界变换,与 Frame 尺寸写回使用的坐标系保持一致。
66
+ * @param item 播放器元素
67
+ * @returns 元素在所属合成坐标系中的尺寸
68
+ */
69
+ export declare function getItemWorldSize(item: VFXItem): Vector2;
@@ -0,0 +1,39 @@
1
+ import type { Composition, VFXItem } from '@galacean/effects';
2
+ /**
3
+ * 判断播放器元素是否参与交互命中。
4
+ *
5
+ * 部分测试夹具或外部运行时节点可能未提供 isVisible;只有明确为 false 时视为隐藏。
6
+ * @param item 待判断元素
7
+ * @returns 是否可参与交互
8
+ */
9
+ export declare function isPlayerItemVisible(item: VFXItem | undefined): boolean;
10
+ /**
11
+ * 获取元素自身或祖先链中最近的动效容器。
12
+ *
13
+ * 默认编辑模式下,Effects 预合成的运行时子节点只负责渲染,点选、框选等交互
14
+ * 会归并到该容器;EffectsEditMode 使用本方法识别当前放开的子树边界。
15
+ * @param item 待解析的播放器元素
16
+ * @returns 最近的动效容器;不在动效子树中时返回 undefined
17
+ */
18
+ export declare function getEffectsPlayerItemOwner(item: VFXItem | undefined): VFXItem | undefined;
19
+ /**
20
+ * 获取元素祖先链中的所有画板。
21
+ *
22
+ * 不包含元素自身,结果按从近到远排列。
23
+ * @param item 待检查的播放器元素
24
+ * @returns 元素所在的画板祖先列表
25
+ */
26
+ export declare function getFramePlayerItemAncestors(item: VFXItem): VFXItem[];
27
+ /**
28
+ * 获取播放器元素的所有子元素。
29
+ * @param item 播放器元素
30
+ * @returns 子元素数组
31
+ */
32
+ export declare function getItemChildren(item: VFXItem): VFXItem[];
33
+ /**
34
+ * 在合成元素树内按实例 ID 查找元素。
35
+ * @param composition 合成(无合成返回 undefined)
36
+ * @param id 元素 instanceId
37
+ * @returns 命中元素;未命中或无合成返回 undefined
38
+ */
39
+ export declare function getPlayerItemById(composition: Composition | undefined, id: string): VFXItem | undefined;
@@ -0,0 +1,31 @@
1
+ import { type VFXItem } from '@galacean/effects';
2
+ /**
3
+ * 判断播放器元素是否为画板元素。
4
+ * @param item 播放器元素
5
+ * @returns 是否为画板元素
6
+ */
7
+ export declare function isFramePlayerItem(item: VFXItem): boolean;
8
+ /**
9
+ * 判断播放器元素是否为动效元素。
10
+ * @param item 播放器元素
11
+ * @returns 是否为动效元素
12
+ */
13
+ export declare function isEffectsPlayerItem(item: VFXItem): boolean;
14
+ /**
15
+ * 判断播放器元素是否为生成器元素。
16
+ * @param item 播放器元素
17
+ * @returns 是否为生成器元素
18
+ */
19
+ export declare function isGeneratorPlayerItem(item: VFXItem): boolean;
20
+ /**
21
+ * 判断播放器生成器元素是否为视频生成器。
22
+ * @param item 播放器元素
23
+ * @returns 是否为视频生成器
24
+ */
25
+ export declare function isVideoGeneratorPlayerItem(item: VFXItem): boolean;
26
+ /**
27
+ * 判断播放器元素是否为组元素。
28
+ * @param item 播放器元素
29
+ * @returns 是否为组元素
30
+ */
31
+ export declare function isGroupPlayerItem(item: VFXItem): false;
@@ -0,0 +1,39 @@
1
+ import { type Engine } from '@galacean/effects';
2
+ import { VideoComponent } from '@galacean/effects-plugin-multimedia';
3
+ /**
4
+ * 请求播放视频组件,并撤销尚未落地的暂停请求。
5
+ * @param videoComponent 视频组件
6
+ */
7
+ export declare function playVideoComponent(videoComponent: VideoComponent): void;
8
+ /**
9
+ * 请求暂停视频组件。
10
+ *
11
+ * Multimedia 组件在 `HTMLVideoElement.play()` 尚未完成时直接暂停会产生 AbortError,
12
+ * 因此等待组件内部的在途播放结束后再暂停;期间再次播放会取消本次暂停请求。
13
+ * @param videoComponent 视频组件
14
+ */
15
+ export declare function pauseVideoComponent(videoComponent: VideoComponent): void;
16
+ /**
17
+ * 播放视频元素。
18
+ * @param engine 引擎
19
+ * @param id 视频元素 id
20
+ */
21
+ export declare function playVideoItem(engine: Engine, id: string): void;
22
+ /**
23
+ * 暂停视频元素。
24
+ * @param engine 引擎
25
+ * @param id 视频元素 id
26
+ */
27
+ export declare function pauseVideoItem(engine: Engine, id: string): void;
28
+ /**
29
+ * 播放动效元素。
30
+ * @param engine 引擎
31
+ * @param id 动效元素 id
32
+ */
33
+ export declare function playEffectsItem(engine: Engine, id: string): void;
34
+ /**
35
+ * 暂停动效元素。
36
+ * @param engine 引擎
37
+ * @param id 动效元素 id
38
+ */
39
+ export declare function pauseEffectsItem(engine: Engine, id: string): void;
@@ -0,0 +1,13 @@
1
+ import { type Component, type Composition, type Constructor, VFXItem } from '@galacean/effects';
2
+ /** 创建 VFXItem、挂载组件并加入合成的底层工厂。 */
3
+ export declare class VFXItemFactory {
4
+ /**
5
+ * 创建并挂载 VFXItem。
6
+ * @param composition 目标合成
7
+ * @param parent 父元素
8
+ * @param name 元素名称
9
+ * @param types 待挂载的组件类型
10
+ * @returns 新建的 VFXItem
11
+ */
12
+ static createVFXItem(composition: Composition, parent?: null, name?: string, ...types: Constructor<Component>[]): VFXItem;
13
+ }
@@ -0,0 +1,26 @@
1
+ import { math } from '@galacean/effects';
2
+ /** Effects runtime 使用的 core math 构造器与工具。 */
3
+ export declare const Color: typeof math.Color;
4
+ export declare const Euler: typeof math.Euler;
5
+ export declare const EulerOrder: typeof math.EulerOrder;
6
+ export declare const Matrix3: typeof math.Matrix3;
7
+ export declare const Matrix4: typeof math.Matrix4;
8
+ export declare const Quaternion: typeof math.Quaternion;
9
+ export declare const Ray: typeof math.Ray;
10
+ export declare const Vector2: typeof math.Vector2;
11
+ export declare const Vector3: typeof math.Vector3;
12
+ export declare const DEG2RAD: number;
13
+ export declare const RAD2DEG: number;
14
+ export declare const clamp: typeof math.clamp;
15
+ export declare const isEqual: typeof math.isEqual;
16
+ export declare const isZero: typeof math.isZero;
17
+ /** Effects runtime 使用的 core math 实例类型。 */
18
+ export type Color = math.Color;
19
+ export type Euler = math.Euler;
20
+ export type EulerOrder = math.EulerOrder;
21
+ export type Matrix3 = math.Matrix3;
22
+ export type Matrix4 = math.Matrix4;
23
+ export type Quaternion = math.Quaternion;
24
+ export type Ray = math.Ray;
25
+ export type Vector2 = math.Vector2;
26
+ export type Vector3 = math.Vector3;