@vvfx/sdk 0.1.19-alpha.8 → 0.2.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.
Files changed (102) hide show
  1. package/LICENSE +22 -0
  2. package/dist/index.js +96633 -14
  3. package/dist/index.js.map +1 -0
  4. package/dist/index.mjs +96736 -0
  5. package/dist/index.mjs.map +1 -0
  6. package/dist/src/config.d.ts +855 -0
  7. package/dist/src/exporter/config.d.ts +18 -0
  8. package/dist/src/exporter/const.d.ts +71 -0
  9. package/dist/src/exporter/export-media.d.ts +68 -0
  10. package/dist/src/exporter/exporter.d.ts +22 -0
  11. package/dist/src/exporter/index.d.ts +2 -0
  12. package/dist/src/exporter/types.d.ts +194 -0
  13. package/dist/src/exporter/utils.d.ts +22 -0
  14. package/dist/src/exporter/wav-audio.d.ts +27 -0
  15. package/dist/src/gesture-handler/gizmo/adsorption-gizmo.d.ts +68 -0
  16. package/dist/src/gesture-handler/gizmo/control-gizmo.d.ts +67 -0
  17. package/dist/src/gesture-handler/gizmo/gizmo.d.ts +59 -0
  18. package/dist/src/gesture-handler/gizmo/icon-gizmo.d.ts +44 -0
  19. package/dist/src/gesture-handler/gizmo/index.d.ts +6 -0
  20. package/dist/src/gesture-handler/gizmo/item-create-gizmo.d.ts +43 -0
  21. package/dist/src/gesture-handler/gizmo/loading-gizmo.d.ts +48 -0
  22. package/dist/src/gesture-handler/gizmo/mask-gizmo.d.ts +113 -0
  23. package/dist/src/gesture-handler/gizmo/picture-cut-gizmo.d.ts +94 -0
  24. package/dist/src/gesture-handler/gizmo/picture-expand-gizmo.d.ts +57 -0
  25. package/dist/src/gesture-handler/gizmo/preference-gizmo.d.ts +32 -0
  26. package/dist/src/gesture-handler/gizmo/selector-gizmo.d.ts +101 -0
  27. package/dist/src/gesture-handler/gizmo/sprite-text-edit-gizmo.d.ts +36 -0
  28. package/dist/src/gesture-handler/gizmo/text-gizmo.d.ts +128 -0
  29. package/dist/src/gesture-handler/gizmo/transform-gizmo.d.ts +233 -0
  30. package/dist/src/gesture-handler/gizmo/type.d.ts +402 -0
  31. package/dist/src/gesture-handler/index.d.ts +3 -0
  32. package/dist/src/gesture-handler/src/gesture-handler.d.ts +143 -0
  33. package/dist/src/gesture-handler/src/icons.d.ts +7 -0
  34. package/dist/src/gesture-handler/utils.d.ts +2 -0
  35. package/dist/src/html-overlay/auto-height-runtime.d.ts +13 -0
  36. package/dist/src/html-overlay/document-runtime.d.ts +4 -0
  37. package/dist/src/html-overlay/document-transform.d.ts +7 -0
  38. package/dist/src/html-overlay/dom-order.d.ts +1 -0
  39. package/dist/src/html-overlay/host-message-runtime.d.ts +3 -0
  40. package/dist/src/html-overlay/html-viewport-style.d.ts +1 -0
  41. package/dist/src/html-overlay/index.d.ts +1 -0
  42. package/dist/src/html-overlay/manager.d.ts +77 -0
  43. package/dist/src/html-overlay/mime-utils.d.ts +2 -0
  44. package/dist/src/html-overlay/overlay-transform.d.ts +13 -0
  45. package/dist/src/html-overlay/path-utils.d.ts +8 -0
  46. package/dist/src/html-overlay/shell-runtime.d.ts +6 -0
  47. package/dist/src/index.d.ts +14 -0
  48. package/dist/src/math/box2.d.ts +166 -0
  49. package/dist/src/math/circle.d.ts +82 -0
  50. package/dist/src/math/euler.d.ts +20 -0
  51. package/dist/src/math/index.d.ts +13 -0
  52. package/dist/src/math/line2.d.ts +93 -0
  53. package/dist/src/math/line3.d.ts +17 -0
  54. package/dist/src/math/matrix4.d.ts +28 -0
  55. package/dist/src/math/plane.d.ts +14 -0
  56. package/dist/src/math/quaternion.d.ts +3 -0
  57. package/dist/src/math/ray-caster.d.ts +10 -0
  58. package/dist/src/math/ray.d.ts +18 -0
  59. package/dist/src/math/type.d.ts +32 -0
  60. package/dist/src/math/utils.d.ts +19 -0
  61. package/dist/src/math/vector2.d.ts +30 -0
  62. package/dist/src/math/vector3.d.ts +29 -0
  63. package/dist/src/screen-shot/index.d.ts +1 -0
  64. package/dist/src/screen-shot/screen-shot.d.ts +35 -0
  65. package/dist/src/sdk-item/base-item.d.ts +126 -0
  66. package/dist/src/sdk-item/card-item.d.ts +67 -0
  67. package/dist/src/sdk-item/effects-item.d.ts +70 -0
  68. package/dist/src/sdk-item/frame-item.d.ts +112 -0
  69. package/dist/src/sdk-item/generator-item.d.ts +86 -0
  70. package/dist/src/sdk-item/group-item.d.ts +57 -0
  71. package/dist/src/sdk-item/index.d.ts +36 -0
  72. package/dist/src/sdk-item/sprite-item.d.ts +67 -0
  73. package/dist/src/sdk-item/text-item.d.ts +107 -0
  74. package/dist/src/sdk-item/types.d.ts +153 -0
  75. package/dist/src/sdk-item/video-item.d.ts +87 -0
  76. package/dist/src/sdk.d.ts +589 -0
  77. package/dist/src/service/UndoRedo.d.ts +48 -0
  78. package/dist/src/shared/index.d.ts +1 -0
  79. package/dist/src/shared/player.d.ts +9 -0
  80. package/dist/src/size-adapte/index.d.ts +1 -0
  81. package/dist/src/size-adapte/size-adapt.d.ts +28 -0
  82. package/dist/src/types.d.ts +1298 -0
  83. package/dist/src/utils/background-manager.d.ts +72 -0
  84. package/dist/src/utils/common-utils.d.ts +28 -0
  85. package/dist/src/utils/index.d.ts +8 -0
  86. package/dist/src/utils/interaction-utils.d.ts +60 -0
  87. package/dist/src/utils/json-data-utils.d.ts +165 -0
  88. package/dist/src/utils/layout-utils.d.ts +219 -0
  89. package/dist/src/utils/page-data-utils.d.ts +372 -0
  90. package/dist/src/utils/player-data-utils.d.ts +11 -0
  91. package/dist/src/utils/types.d.ts +114 -0
  92. package/dist/src/wireframe/common/box.d.ts +1 -0
  93. package/dist/src/wireframe/common/dashed-line.d.ts +1 -0
  94. package/dist/src/wireframe/common/line.d.ts +1 -0
  95. package/dist/src/wireframe/common/pixi-ext.d.ts +11 -0
  96. package/dist/src/wireframe/common/pixi.d.ts +18 -0
  97. package/dist/src/wireframe/index.d.ts +4 -0
  98. package/package.json +42 -22
  99. package/dist/index.cjs +0 -14
  100. package/dist/index.d.cts +0 -3485
  101. package/dist/index.d.ts +0 -3485
  102. package/dist/index.global.js +0 -333
@@ -0,0 +1,43 @@
1
+ import { Graphics } from '@pixi/graphics';
2
+ import { Sprite } from '@pixi/sprite';
3
+ import { Gizmo } from './gizmo';
4
+ import { GestureCursorResult, GizmoType, ItemCreateType } from './type';
5
+ import { PageDataUtils } from '../../utils/page-data-utils';
6
+ import { SDKEvents } from '../../sdk';
7
+ import { EventEmitter } from '@galacean/effects';
8
+ export declare class ItemCreateGizmo extends Gizmo {
9
+ type: GizmoType;
10
+ _createType: ItemCreateType;
11
+ /**
12
+ * 鼠标状态绘制结果
13
+ */
14
+ cursorResult: GestureCursorResult;
15
+ private _pageDataUtils;
16
+ private _eventEmitter;
17
+ private graphics;
18
+ private dragStartPoint;
19
+ private dragCurrentPoint;
20
+ private dragStartViewPoint;
21
+ private isDragging;
22
+ private frameBox;
23
+ private frameChildren;
24
+ private interactiveChildrenBoxes;
25
+ constructor(utils: PageDataUtils, emitter: EventEmitter<SDKEvents>);
26
+ get interactive(): boolean;
27
+ set interactive(bool: boolean);
28
+ get createType(): ItemCreateType;
29
+ set createType(type: ItemCreateType);
30
+ preparationAction(event: MouseEvent): GizmoType | undefined;
31
+ preAction(event: MouseEvent, isDoubleClick?: boolean): GizmoType | undefined;
32
+ action(event: MouseEvent): void;
33
+ endAction(event: MouseEvent): GizmoType | undefined;
34
+ interruption(): GizmoType | undefined;
35
+ private resetDragState;
36
+ actionKey(keyCode: KeyboardEvent): void;
37
+ endActionKey(keyCode: KeyboardEvent): void;
38
+ cancelPreparation(): void;
39
+ refreshResults(): void;
40
+ getRenderObjects(): (Graphics | Sprite)[];
41
+ refreshCursorResult(): void;
42
+ refreshInteractiveChildrenBoxes(): never[] | undefined;
43
+ }
@@ -0,0 +1,48 @@
1
+ import type { Sprite } from '@pixi/sprite';
2
+ import { Box2 } from '../../math';
3
+ import { PageDataUtils } from '../../utils/page-data-utils';
4
+ import { Graphics } from '../../wireframe';
5
+ import { Gizmo } from './gizmo';
6
+ import { GestureCursorResult, GizmoType } from './type';
7
+ export type LoadingGizmoTip = {
8
+ text: string;
9
+ fontSize?: number;
10
+ fontFamily?: string;
11
+ color?: number;
12
+ };
13
+ export type LoadingGizmoItemOptions = {
14
+ /** Loading 提示文案 */
15
+ tip?: LoadingGizmoTip;
16
+ /** 指定 Loading 区域 */
17
+ loadingBox?: Box2;
18
+ /** 清理选中 */
19
+ clearSelected?: boolean;
20
+ };
21
+ export declare class LoadingGizmo extends Gizmo {
22
+ constructor(utils: PageDataUtils);
23
+ type: GizmoType;
24
+ private _pageDataUtils;
25
+ private _idMap;
26
+ private createLoadingVFXItem;
27
+ add(id: string, options?: LoadingGizmoItemOptions): void;
28
+ delete(id: string): void;
29
+ /**
30
+ * 更新指定 loading 元素的提示文案
31
+ */
32
+ update(id: string, options: {
33
+ tip?: LoadingGizmoTip;
34
+ }): void;
35
+ cursorResult: GestureCursorResult;
36
+ initialize(): void;
37
+ preparationAction(): GizmoType | undefined;
38
+ preAction(): GizmoType | undefined;
39
+ action(): void;
40
+ endAction(): GizmoType | undefined;
41
+ interruption(): GizmoType | undefined;
42
+ actionKey(): void;
43
+ endActionKey(): void;
44
+ cancelPreparation(): void;
45
+ refreshResults(): void;
46
+ getRenderObjects(): (Graphics | Sprite)[];
47
+ private refreshRenderObjects;
48
+ }
@@ -0,0 +1,113 @@
1
+ import { MaskGizmoConfig } from '../../config';
2
+ import { SDKEvents } from '../../sdk';
3
+ import { EventEmitter } from '../../shared';
4
+ import { GizmoUndoRedo } from '../../service/UndoRedo';
5
+ import { PageDataUtils } from '../../utils/page-data-utils';
6
+ import { Application, Graphics, Sprite } from '../../wireframe';
7
+ import { Gizmo } from './gizmo';
8
+ import { GestureCursorResult, GizmoType, MaskResult } from './type';
9
+ /**
10
+ * 蒙版工具的撤销重做数据类型
11
+ */
12
+ export type MaskUndoRedoData = {
13
+ lines: MaskResult['lines'];
14
+ };
15
+ export declare class MaskGizmo extends Gizmo {
16
+ constructor(utils: PageDataUtils, app: Application, eventEmitter: EventEmitter<SDKEvents>);
17
+ private _pageDataUtils;
18
+ private _eventEmitter;
19
+ private _app;
20
+ /**
21
+ * 用于持久化蒙版状态的 RenderTexture
22
+ */
23
+ private maskRenderTexture;
24
+ /**
25
+ * 用于显示 RenderTexture 的 Sprite
26
+ */
27
+ private maskSprite;
28
+ private _config;
29
+ private boxGraphics;
30
+ type: GizmoType;
31
+ mode: 'paint' | 'erase';
32
+ /**
33
+ * 蒙版工具独立的撤销重做实例
34
+ */
35
+ private _undoRedo;
36
+ /**
37
+ * 存储绘画开始前的数据,用于 undoRedo
38
+ */
39
+ private _oldLines;
40
+ /**
41
+ * 鼠标状态绘制结果
42
+ */
43
+ cursorResult: GestureCursorResult;
44
+ result: MaskResult;
45
+ /**
46
+ * 获取蒙版工具的撤销重做实例
47
+ */
48
+ get undoRedo(): GizmoUndoRedo<MaskUndoRedoData>;
49
+ get interactive(): boolean;
50
+ set interactive(bool: boolean);
51
+ get config(): MaskGizmoConfig;
52
+ set config(config: Partial<MaskGizmoConfig>);
53
+ /**
54
+ * 设置模式
55
+ * @param mode 模式类型:'paint' 表示涂抹,'erase' 表示擦除
56
+ */
57
+ setMode(mode: 'paint' | 'erase'): void;
58
+ initialize(): void;
59
+ preparationAction(event: MouseEvent): GizmoType | undefined;
60
+ preAction(event: MouseEvent): GizmoType | undefined;
61
+ action(event: MouseEvent): void;
62
+ endAction(): GizmoType | undefined;
63
+ interruption(): GizmoType | undefined;
64
+ actionKey(): void;
65
+ endActionKey(): void;
66
+ cancelPreparation(): void;
67
+ refreshResults(): void;
68
+ getRenderObjects(): (Graphics | Sprite)[];
69
+ /**
70
+ * 清理 RenderTexture
71
+ */
72
+ private clearRenderObjects;
73
+ private refreshRenderObjects;
74
+ /** 刷新指针结果 */
75
+ private refreshCursorResult;
76
+ close(): void;
77
+ clearMask(): void;
78
+ /**
79
+ * 撤销操作
80
+ * @returns 是否成功撤销
81
+ */
82
+ undo(): boolean;
83
+ /**
84
+ * 重做操作
85
+ * @returns 是否成功重做
86
+ */
87
+ redo(): boolean;
88
+ /**
89
+ * 检查是否可以撤销
90
+ */
91
+ get canUndo(): boolean;
92
+ /**
93
+ * 检查是否可以重做
94
+ */
95
+ get canRedo(): boolean;
96
+ /**
97
+ * 清空 undoRedo 历史
98
+ */
99
+ clearUndoRedo(): void;
100
+ /**
101
+ * 加载蒙版图片
102
+ * @param url 图片地址
103
+ * @returns Promise<HTMLImageElement>
104
+ */
105
+ loadMaskImage(url: string): Promise<HTMLImageElement>;
106
+ /**
107
+ * 获取蒙版 base64(异步版本,确保 maskImage 正确加载)
108
+ * @returns Promise<蒙版图像的 base64 字符串 | null>
109
+ * @description maskImage 是一张黑白蒙版图片,白色表示主体部分
110
+ * 输出蒙版:主体色为 maskColor,背景色为白色
111
+ */
112
+ getMask(): string | null;
113
+ }
@@ -0,0 +1,94 @@
1
+ import { Box2, Vector2 } from '../../math';
2
+ import { SDKEvents } from '../../sdk';
3
+ import { GizmoUndoRedo } from '../../service/UndoRedo';
4
+ import { EventEmitter } from '../../shared';
5
+ import { PageDataUtils } from '../../utils/page-data-utils';
6
+ import { Graphics } from '../../wireframe';
7
+ import { Gizmo } from './gizmo';
8
+ import { GestureCursorResult, GizmoType, PictureCutInteractionParam, PictureCutInteractionType, PictureCutResult } from './type';
9
+ /**
10
+ * 图片裁切工具的撤销重做数据类型
11
+ */
12
+ export type PictureCutUndoRedoData = {
13
+ normalizeCutBox: Box2;
14
+ };
15
+ export declare class PictureCutGizmo extends Gizmo {
16
+ result: PictureCutResult;
17
+ interactionParam: PictureCutInteractionParam;
18
+ graphics: Graphics;
19
+ /**
20
+ * @description Shift按键是否按下,用于判断交互
21
+ */
22
+ isShiftDown: boolean;
23
+ _isLockScale: boolean;
24
+ private _pageDataUtils;
25
+ private _eventEmitter;
26
+ readonly type: GizmoType;
27
+ /**
28
+ * 图片裁切工具独立的撤销重做实例
29
+ */
30
+ private _undoRedo;
31
+ /**
32
+ * 存储操作开始前的数据,用于 undoRedo
33
+ */
34
+ private _oldNormalizeCutBox;
35
+ /**
36
+ * 鼠标状态绘制结果
37
+ */
38
+ cursorResult: GestureCursorResult;
39
+ /**
40
+ * 获取图片裁切工具的撤销重做实例
41
+ */
42
+ get undoRedo(): GizmoUndoRedo<PictureCutUndoRedoData>;
43
+ get interactive(): boolean;
44
+ set interactive(bool: boolean);
45
+ get isLockScale(): boolean;
46
+ set isLockScale(state: boolean);
47
+ constructor(utils: PageDataUtils, eventEmitter: EventEmitter<SDKEvents>);
48
+ preparationAction(event: MouseEvent): GizmoType | undefined;
49
+ preAction(): GizmoType | undefined;
50
+ action(event: MouseEvent): void;
51
+ endAction(event: MouseEvent): GizmoType | undefined;
52
+ interruption(): GizmoType | undefined;
53
+ actionKey(keyCode: KeyboardEvent): void;
54
+ endActionKey(keyCode: KeyboardEvent): void;
55
+ cancelPreparation(): void;
56
+ refreshResults(): void;
57
+ refreshRenderObjects(): Graphics[];
58
+ /**
59
+ * 刷新指针结果
60
+ * @param activeType 交互类型
61
+ * @param angle 指针方向
62
+ */
63
+ refreshCursorResult(activeType: PictureCutInteractionType, angle?: number): void;
64
+ getRenderObjects(): Graphics[];
65
+ private refreshInteractionType;
66
+ getCutInfo(): {
67
+ cutBox: Box2;
68
+ itemBox: Box2;
69
+ } | undefined;
70
+ getCutBox(): Box2 | undefined;
71
+ setCutBox(min: Vector2, max: Vector2): Box2 | undefined;
72
+ /**
73
+ * 撤销操作
74
+ * @returns 是否成功撤销
75
+ */
76
+ undo(): boolean;
77
+ /**
78
+ * 重做操作
79
+ * @returns 是否成功重做
80
+ */
81
+ redo(): boolean;
82
+ /**
83
+ * 检查是否可以撤销
84
+ */
85
+ get canUndo(): boolean;
86
+ /**
87
+ * 检查是否可以重做
88
+ */
89
+ get canRedo(): boolean;
90
+ /**
91
+ * 清空 undoRedo 历史
92
+ */
93
+ clearUndoRedo(): void;
94
+ }
@@ -0,0 +1,57 @@
1
+ import { Box2, Vector2 } from '../../math';
2
+ import { SDKEvents } from '../../sdk';
3
+ import { EventEmitter } from '../../shared';
4
+ import { PageDataUtils } from '../../utils/page-data-utils';
5
+ import { Graphics } from '../../wireframe';
6
+ import { Gizmo } from './gizmo';
7
+ import { GestureCursorResult, GizmoType, PictureExpandInteractionParam, PictureExpandInteractionType, PictureExpandResult } from './type';
8
+ export declare class PictureExpandGizmo extends Gizmo {
9
+ result: PictureExpandResult;
10
+ interactionParam: PictureExpandInteractionParam;
11
+ graphics: Graphics;
12
+ /**
13
+ * @description Shift按键是否按下,用于判断交互
14
+ */
15
+ isShiftDown: boolean;
16
+ /**
17
+ * @description 是否锁定宽高比缩放
18
+ */
19
+ _isLockScale: boolean;
20
+ private _pageDataUtils;
21
+ private _eventEmitter;
22
+ readonly type: GizmoType;
23
+ /**
24
+ * 鼠标状态绘制结果
25
+ */
26
+ cursorResult: GestureCursorResult;
27
+ get interactive(): boolean;
28
+ set interactive(bool: boolean);
29
+ get isLockScale(): boolean;
30
+ set isLockScale(state: boolean);
31
+ constructor(utils: PageDataUtils, eventEmitter: EventEmitter<SDKEvents>);
32
+ preparationAction(event: MouseEvent): GizmoType | undefined;
33
+ preAction(event: MouseEvent, isDoubleClick?: boolean): GizmoType | undefined;
34
+ action(event: MouseEvent): void;
35
+ endAction(event: MouseEvent): GizmoType | undefined;
36
+ interruption(): GizmoType | undefined;
37
+ actionKey(keyCode: KeyboardEvent): void;
38
+ endActionKey(keyCode: KeyboardEvent): void;
39
+ cancelPreparation(): void;
40
+ refreshResults(): void;
41
+ refreshRenderObjects(): Graphics[];
42
+ /**
43
+ * 刷新指针结果
44
+ * @param activeType 交互类型
45
+ * @param point 指针位置
46
+ * @param dir 指针方向
47
+ */
48
+ refreshCursorResult(activeType: PictureExpandInteractionType, angle?: number): void;
49
+ getRenderObjects(): Graphics[];
50
+ private refreshInteractionType;
51
+ getExpandInfo(): {
52
+ expandBox: Box2;
53
+ itemBox: Box2;
54
+ } | undefined;
55
+ getExpandBox(): Box2 | undefined;
56
+ setExpandBox(min: Vector2, max: Vector2): Box2 | undefined;
57
+ }
@@ -0,0 +1,32 @@
1
+ import { Box2 } from '../../math';
2
+ import type { PageDataUtils } from '../../utils/page-data-utils';
3
+ import { Graphics, Sprite } from '../../wireframe';
4
+ import { Gizmo } from './gizmo';
5
+ import type { GizmoType } from './type';
6
+ export declare class PreferenceGizmo extends Gizmo {
7
+ safeAreaSprites: Map<string, Sprite>;
8
+ preparationAction(): GizmoType | undefined;
9
+ preAction(): GizmoType | undefined;
10
+ action(): void;
11
+ endAction(): GizmoType | undefined;
12
+ interruption(): GizmoType | undefined;
13
+ actionKey(): void;
14
+ endActionKey(): void;
15
+ cancelPreparation(): void;
16
+ refreshResults(): void;
17
+ refreshRenderObjects(): void;
18
+ getRenderObjects(): Graphics[];
19
+ /**
20
+ * 遮挡层绘制结果
21
+ */
22
+ box: Box2;
23
+ /**
24
+ * 视图框图形
25
+ */
26
+ private graphics;
27
+ PageDataUtils: PageDataUtils;
28
+ readonly type = "preference";
29
+ constructor(utils: PageDataUtils);
30
+ get interactive(): boolean;
31
+ set interactive(bool: boolean);
32
+ }
@@ -0,0 +1,101 @@
1
+ import { Graphics } from '@pixi/graphics';
2
+ import '../../wireframe/common/pixi-ext';
3
+ import { Composition } from '../../shared/player';
4
+ import { Gizmo } from './gizmo';
5
+ import type { GizmoType, HitTestResult, SelectorResult } from './type';
6
+ import type { PageDataUtils } from '../../utils/page-data-utils';
7
+ import { Vector2 } from '../../math';
8
+ export declare class SelectorGizmo extends Gizmo {
9
+ /**
10
+ * @description 点选绘制结果
11
+ */
12
+ result: SelectorResult;
13
+ /**
14
+ * @description 选中元素ID
15
+ */
16
+ selectedItemIds: string[];
17
+ /**
18
+ * @description 可选择子元素父节点序号
19
+ */
20
+ activeParentIds: string[];
21
+ /**
22
+ * @description 框选鼠标起始点
23
+ */
24
+ cursorPoint: Vector2;
25
+ /**
26
+ * @description 交互起始点
27
+ */
28
+ startPoint: Vector2;
29
+ /**
30
+ * @description 预处理鼠标位置
31
+ */
32
+ firstClickPoint: Vector2;
33
+ /**
34
+ * @description 选择器图形
35
+ */
36
+ graphics: Graphics;
37
+ pageDataUtils: PageDataUtils;
38
+ clearResult: boolean;
39
+ readonly type: GizmoType;
40
+ get interactive(): boolean;
41
+ set interactive(bool: boolean);
42
+ constructor(utils: PageDataUtils);
43
+ actionKey(): void;
44
+ endActionKey(): void;
45
+ /**
46
+ * 获取选择器交互绘制结果
47
+ * @returns 点选交互信息
48
+ */
49
+ getRenderObjects(): Graphics[];
50
+ /**
51
+ * 取消预备状态
52
+ */
53
+ cancelPreparation(): void;
54
+ /**
55
+ * 准备行动事件 - 预选
56
+ * @param event 鼠标事件
57
+ */
58
+ preparationAction(event: MouseEvent, targetType?: GizmoType): GizmoType | undefined;
59
+ /**
60
+ * 行动前置事件
61
+ * - 二维模式 设置框选起始状态 || 选中元素
62
+ * - 三维模式 设置交互起始态 || 选中元素
63
+ * @description 当未处于预选态时,表明触发框选交互,设置起始点;当处于预选态时,表明触发 transformGizmo.
64
+ * @param event 鼠标事件
65
+ */
66
+ preAction(event: MouseEvent, isDoubleClick?: boolean, firstClickPoint?: Vector2): GizmoType | undefined;
67
+ /**
68
+ * 行动事件 - 框选[仅支持2D框选]
69
+ * @param event 鼠标事件
70
+ */
71
+ action(event: MouseEvent): void;
72
+ endAction(): undefined;
73
+ addSelectedItem(id: string): string[] | undefined;
74
+ /**
75
+ * 交互中断事件 - 清空交互状态, 重新进行交互Gizmo选中
76
+ * @returns undefined
77
+ */
78
+ interruption(): GizmoType | undefined;
79
+ /**
80
+ * 射线碰撞结果
81
+ * @param point 屏幕点坐标
82
+ * @param cameraState 相机状态
83
+ * @param isLeftDown 是否为左键
84
+ * @returns 射线碰撞结果
85
+ */
86
+ hitTest(point: Vector2): string[];
87
+ refreshResultRegions(hitTestResult: HitTestResult): void;
88
+ reorderHitTestResult(hitTestResult: HitTestResult, playerComposition: Composition): string[];
89
+ filterSelectedItems(selectedIds: string[]): string[];
90
+ addActiveParentIds(selectedIds?: string[]): void;
91
+ resetActiveParentIds(id: string): void;
92
+ refreshResults(): void;
93
+ /**
94
+ * 画板元素点击区域优先处理
95
+ * 当点击画板左上角 40x20 区域时,强制优先选中画板
96
+ * @param mouse 鼠标位置
97
+ * @param currentSelectedIds 当前选中的元素ID列表
98
+ * @returns 处理后的选中ID列表
99
+ */
100
+ preSelectedFrameOutBound(mouse: Vector2, currentSelectedIds: string[]): string[];
101
+ }
@@ -0,0 +1,36 @@
1
+ import { Graphics, Text } from '../../wireframe';
2
+ import { Gizmo } from './gizmo';
3
+ import { GizmoType, SpriteTextEditInteractionParam, SpriteTextEditResult, SpriteTextInitParam } from './type';
4
+ import { PageDataUtils } from '../../utils/page-data-utils';
5
+ import { SDKEvents } from '../../sdk';
6
+ import { EventEmitter } from '../../shared';
7
+ export declare class SpriteTextEditGizmo extends Gizmo {
8
+ readonly type: GizmoType;
9
+ private _pageDataUtils;
10
+ private _eventEmitter;
11
+ graphics: Graphics;
12
+ editGraphics: Graphics;
13
+ preSelectedText: Text;
14
+ result: SpriteTextEditResult;
15
+ interactionParam: SpriteTextEditInteractionParam;
16
+ clearPreSelected: boolean;
17
+ constructor(pageDataUtils: PageDataUtils, emitter: EventEmitter<SDKEvents>);
18
+ get interactive(): boolean;
19
+ set interactive(state: boolean);
20
+ preparationAction(event: MouseEvent): GizmoType | undefined;
21
+ preAction(): GizmoType | undefined;
22
+ action(event: MouseEvent): void;
23
+ endAction(event: MouseEvent): GizmoType | undefined;
24
+ interruption(): GizmoType | undefined;
25
+ actionKey(keyCode: KeyboardEvent): void;
26
+ endActionKey(keyCode: KeyboardEvent): void;
27
+ cancelPreparation(): void;
28
+ initResult(initParams: SpriteTextInitParam[]): void;
29
+ clearResult(): void;
30
+ setSelected(id: string, index: number): void;
31
+ setText(id: string, index: number, text: string): void;
32
+ setChangedState(id: string, index: number, hasChanged: boolean): void;
33
+ setEditState(id: string, index: number, isEditing: boolean): void;
34
+ refreshResults(): void;
35
+ getRenderObjects(): (Graphics | Text)[];
36
+ }
@@ -0,0 +1,128 @@
1
+ import { Graphics, Sprite } from '../../wireframe';
2
+ import { SDKEvents } from '../../sdk';
3
+ import { EventEmitter } from '../../shared';
4
+ import { Gizmo } from './gizmo';
5
+ import { GestureCursorResult, GizmoType, ScaleParam, TextInteractionParam, TextResult } from './type';
6
+ import { PageDataUtils } from '../../utils/page-data-utils';
7
+ import { Box2, Vector2 } from '../../math';
8
+ import { AdsorptionGizmo } from './adsorption-gizmo';
9
+ import { SelectorGizmo } from './selector-gizmo';
10
+ import { SDKItem } from '../../sdk-item';
11
+ export declare class TextGizmo extends Gizmo {
12
+ readonly type = "text";
13
+ private _eventEmitter;
14
+ /**
15
+ * @description 用于绘制选中态
16
+ */
17
+ textAreaElement: HTMLTextAreaElement;
18
+ /**
19
+ * @description 用于绘制选中包围盒
20
+ */
21
+ graphics: Graphics;
22
+ /**
23
+ * @description 数据刷新工具
24
+ */
25
+ private _pageDataUtils;
26
+ /**
27
+ * @description 绘制结果
28
+ */
29
+ result: TextResult;
30
+ /**
31
+ * @description 交互参数
32
+ */
33
+ interactionParam: TextInteractionParam;
34
+ /**
35
+ * @description 吸附交互器
36
+ */
37
+ _adsorptionGizmo: AdsorptionGizmo;
38
+ /**
39
+ * @description 鼠标交互样式结果
40
+ */
41
+ cursorResult: GestureCursorResult;
42
+ /**
43
+ * @description 退出编辑态时忽视交互
44
+ */
45
+ ignoreInteraction: boolean;
46
+ /**
47
+ * @description 缩放方向
48
+ */
49
+ scaleParam?: ScaleParam;
50
+ rotationSprite: Sprite;
51
+ cursorPoint: Vector2;
52
+ private _selectorGizmo;
53
+ /**
54
+ * @description 画板包围盒信息
55
+ */
56
+ frameBoxes: Map<string, Box2>;
57
+ /**
58
+ * @description
59
+ */
60
+ toAddedFrameId: string | undefined;
61
+ /**
62
+ * @description 需要处理子元素分离的组信息
63
+ * key: groupId, value: 需要分离的子元素信息
64
+ */
65
+ groupsNeedProcess: Map<string, {
66
+ groupId: string;
67
+ frameId: string;
68
+ childrenOutOfFrame: string[];
69
+ }>;
70
+ /**
71
+ * @description 自动布局插入指示器
72
+ */
73
+ private autoLayoutIndicator;
74
+ /**
75
+ * @description 是否在自动布局拖拽中
76
+ */
77
+ private isAutoLayoutDragging;
78
+ /**
79
+ * @description 被拖拽元素的原始行列位置(用于自动布局时调整其他元素)
80
+ */
81
+ private autoLayoutDragOriginalPosition;
82
+ /**
83
+ * @description 待应用的布局位置(用于延迟执行行列修改)
84
+ */
85
+ private pendingLayoutPosition;
86
+ /**
87
+ * @description 自动布局指示器 Graphics
88
+ */
89
+ private autoLayoutGraphics;
90
+ get interactive(): boolean;
91
+ set interactive(bool: boolean);
92
+ constructor(pageDataUtils: PageDataUtils, adsorptionGizmo: AdsorptionGizmo, selectorGizmo: SelectorGizmo, eventEmitter: EventEmitter<SDKEvents>, parent?: HTMLElement | null);
93
+ preparationAction(event: MouseEvent): GizmoType | undefined;
94
+ preAction(event: MouseEvent, isDoubleClick?: boolean): GizmoType | undefined;
95
+ action(event: MouseEvent): void;
96
+ endAction(event: MouseEvent): GizmoType | undefined;
97
+ interruption(): GizmoType | undefined;
98
+ actionKey(keyCode: KeyboardEvent): void;
99
+ endActionKey(keyCode: KeyboardEvent): void;
100
+ cancelPreparation(): void;
101
+ refreshResults(): void;
102
+ private refreshInteractionParam;
103
+ refreshCursorResult(): void;
104
+ getRenderObjects(): (Graphics | Sprite)[];
105
+ /**
106
+ * @description 绘制自动布局指示线
107
+ */
108
+ private renderAutoLayoutIndicator;
109
+ private handleInput;
110
+ private handleBlur;
111
+ private initInteractionPlane;
112
+ /**
113
+ * @description 更新自动布局指示器
114
+ * 基于鼠标位置实时更新被拖拽元素的 layoutInfos(row 和 column)
115
+ * 注意:移动过程中只更新被拖拽元素的布局信息,其他元素保持不动
116
+ * 等到交互结束时再执行整体排布
117
+ */
118
+ private updateAutoLayoutIndicator;
119
+ /**
120
+ * @description 执行自动布局重排序
121
+ * 基于更新后的 layoutInfos 重新排布所有元素
122
+ * @param draggedItem 被拖拽的元素
123
+ */
124
+ private executeAutoLayoutReorder;
125
+ private getTextAlign;
126
+ refreshFrameBoxes(): void;
127
+ refreshItemFrameRelationShip(item: SDKItem, mouse: Vector2): string | undefined;
128
+ }