@vvfx/artis 0.0.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/dist/artis/artis.d.ts +44 -0
- package/dist/artis/base-artis.d.ts +520 -0
- package/dist/artis/canvas-layer-order.d.ts +19 -0
- package/dist/artis/create-info-to-schema.d.ts +21 -0
- package/dist/artis/index.d.ts +15 -0
- package/dist/artis/operations/index.d.ts +3 -0
- package/dist/artis/operations/operations.d.ts +362 -0
- package/dist/artis/operations/scene-operations.d.ts +26 -0
- package/dist/artis/operations/types.d.ts +39 -0
- package/dist/artis/scene-artis.d.ts +386 -0
- package/dist/artis/screenshot-service.d.ts +83 -0
- package/dist/artis/types.d.ts +130 -0
- package/dist/artis/wiring/index.d.ts +17 -0
- package/dist/artis/wiring/register-commands.d.ts +44 -0
- package/dist/artis/wiring/setup-commands.d.ts +5 -0
- package/dist/artis/wiring/setup-event-bindings.d.ts +16 -0
- package/dist/artis/wiring/setup-keybindings.d.ts +38 -0
- package/dist/artis/wiring/setup-plugins.d.ts +5 -0
- package/dist/artis/wiring/wiring-context.d.ts +34 -0
- package/dist/artis-sdk/artis-sdk.d.ts +1117 -0
- package/dist/artis-sdk/index.d.ts +1 -0
- package/dist/core/asset/asset-manager.d.ts +288 -0
- package/dist/core/asset/index.d.ts +3 -0
- package/dist/core/command/command-service.d.ts +315 -0
- package/dist/core/command/commands/composite-command.d.ts +45 -0
- package/dist/core/command/commands/frame-layout-command.d.ts +81 -0
- package/dist/core/command/commands/frame-layout-mode-command.d.ts +55 -0
- package/dist/core/command/commands/frame-move-in-command.d.ts +54 -0
- package/dist/core/command/commands/frame-move-out-command.d.ts +54 -0
- package/dist/core/command/commands/group-children-detach-command.d.ts +28 -0
- package/dist/core/command/commands/index.d.ts +98 -0
- package/dist/core/command/commands/item-align-command.d.ts +52 -0
- package/dist/core/command/commands/item-create-command.d.ts +66 -0
- package/dist/core/command/commands/item-delete-command.d.ts +40 -0
- package/dist/core/command/commands/item-distribute-command.d.ts +53 -0
- package/dist/core/command/commands/item-group-command.d.ts +41 -0
- package/dist/core/command/commands/item-reorder-command.d.ts +41 -0
- package/dist/core/command/commands/item-replace-source-command.d.ts +48 -0
- package/dist/core/command/commands/item-set-font-family-command.d.ts +46 -0
- package/dist/core/command/commands/item-set-generator-resource-command.d.ts +40 -0
- package/dist/core/command/commands/item-transform-command.d.ts +51 -0
- package/dist/core/command/commands/item-ungroup-command.d.ts +34 -0
- package/dist/core/command/commands/item-update-property-by-create-info-command.d.ts +41 -0
- package/dist/core/command/commands/item-update-property-command.d.ts +82 -0
- package/dist/core/command/commands/mask-commit-command.d.ts +53 -0
- package/dist/core/command/commands/page-auto-layout-command.d.ts +53 -0
- package/dist/core/command/commands/picture-cut-commit-command.d.ts +43 -0
- package/dist/core/command/commands/picture-expand-commit-command.d.ts +35 -0
- package/dist/core/command/commands/scene-switch-command.d.ts +35 -0
- package/dist/core/command/commands/selection-set-command.d.ts +38 -0
- package/dist/core/command/commands/sprite-image-command.d.ts +36 -0
- package/dist/core/command/commands/sprite-text-edit-commit-command.d.ts +43 -0
- package/dist/core/command/commands/state-hand-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-cut-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-expand-command.d.ts +14 -0
- package/dist/core/command/commands/state-image-mask-command.d.ts +15 -0
- package/dist/core/command/commands/state-image-text-edit-command.d.ts +14 -0
- package/dist/core/command/commands/state-item-create-command.d.ts +34 -0
- package/dist/core/command/commands/state-move-command.d.ts +14 -0
- package/dist/core/command/commands/state-switch-command-base.d.ts +41 -0
- package/dist/core/command/commands/text-move-command.d.ts +47 -0
- package/dist/core/command/commands/text-rotate-command.d.ts +52 -0
- package/dist/core/command/commands/text-scale-command.d.ts +56 -0
- package/dist/core/command/commands/text-update-content-command.d.ts +51 -0
- package/dist/core/command/commands/transform-move-command.d.ts +56 -0
- package/dist/core/command/commands/transform-move-with-frame-change-command.d.ts +80 -0
- package/dist/core/command/commands/transform-move-with-layout-command.d.ts +56 -0
- package/dist/core/command/commands/transform-rotate-command.d.ts +51 -0
- package/dist/core/command/commands/transform-scale-command.d.ts +54 -0
- package/dist/core/command/commands/video-play-command.d.ts +28 -0
- package/dist/core/command/commands/video-source-command.d.ts +39 -0
- package/dist/core/command/commands/viewport-fit-to-box-command.d.ts +37 -0
- package/dist/core/command/commands/viewport-fit-to-items-command.d.ts +43 -0
- package/dist/core/command/commands/viewport-move-command.d.ts +34 -0
- package/dist/core/command/commands/viewport-zoom-command.d.ts +35 -0
- package/dist/core/command/index.d.ts +5 -0
- package/dist/core/command/registry.d.ts +246 -0
- package/dist/core/command/types.d.ts +124 -0
- package/dist/core/element-registry/element-facade.d.ts +35 -0
- package/dist/core/element-registry/element-identity-strategy.d.ts +75 -0
- package/dist/core/element-registry/element-registry.d.ts +72 -0
- package/dist/core/element-registry/index.d.ts +5 -0
- package/dist/core/element-registry/types.d.ts +15 -0
- package/dist/core/gizmo/gizmo-bootstrap.d.ts +70 -0
- package/dist/core/gizmo/gizmo-command-binder.d.ts +55 -0
- package/dist/core/gizmo/gizmo-config-override.d.ts +24 -0
- package/dist/core/gizmo/gizmo-registry.d.ts +39 -0
- package/dist/core/gizmo/index.d.ts +19 -0
- package/dist/core/gizmo/register-gizmo-command-bindings.d.ts +20 -0
- package/dist/core/gizmo/state-gizmo-controller.d.ts +20 -0
- package/dist/core/history/history-manager.d.ts +174 -0
- package/dist/core/history/index.d.ts +1 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/item/base-item.d.ts +154 -0
- package/dist/core/item/card-item.d.ts +91 -0
- package/dist/core/item/default-item-schema.d.ts +20 -0
- package/dist/core/item/effects-item.d.ts +99 -0
- package/dist/core/item/frame-item.d.ts +153 -0
- package/dist/core/item/generator-item.d.ts +114 -0
- package/dist/core/item/group-item.d.ts +51 -0
- package/dist/core/item/index.d.ts +25 -0
- package/dist/core/item/sprite-item.d.ts +80 -0
- package/dist/core/item/text-item.d.ts +171 -0
- package/dist/core/item/types.d.ts +158 -0
- package/dist/core/item/video-item.d.ts +120 -0
- package/dist/core/keybinding/index.d.ts +11 -0
- package/dist/core/keybinding/key-binding-controller.d.ts +44 -0
- package/dist/core/keybinding/key-binding-registry.d.ts +92 -0
- package/dist/core/keybinding/key-binding-store.d.ts +29 -0
- package/dist/core/keybinding/key-matcher.d.ts +24 -0
- package/dist/core/keybinding/types.d.ts +84 -0
- package/dist/core/plugin/index.d.ts +3 -0
- package/dist/core/plugin/io-plugin.d.ts +167 -0
- package/dist/core/plugin/plugin-system.d.ts +77 -0
- package/dist/core/predict/align-predict.d.ts +20 -0
- package/dist/core/predict/base/box-ops.d.ts +40 -0
- package/dist/core/predict/base/index.d.ts +14 -0
- package/dist/core/predict/base/parent-coord.d.ts +29 -0
- package/dist/core/predict/base/schema-box.d.ts +21 -0
- package/dist/core/predict/distribute-predict.d.ts +19 -0
- package/dist/core/predict/frame-layout-predict.d.ts +24 -0
- package/dist/core/predict/index.d.ts +12 -0
- package/dist/core/preferences/index.d.ts +2 -0
- package/dist/core/preferences/user-preferences-manager.d.ts +130 -0
- package/dist/core/quality/error-monitor/error-monitor-facade.d.ts +73 -0
- package/dist/core/quality/error-monitor/error-monitor.d.ts +106 -0
- package/dist/core/quality/error-monitor/index.d.ts +4 -0
- package/dist/core/quality/error-monitor/types.d.ts +198 -0
- package/dist/core/quality/index.d.ts +3 -0
- package/dist/core/quality/perf-monitor/index.d.ts +5 -0
- package/dist/core/quality/perf-monitor/perf-monitor-facade.d.ts +45 -0
- package/dist/core/quality/perf-monitor/perf-monitor.d.ts +60 -0
- package/dist/core/quality/perf-monitor/types.d.ts +66 -0
- package/dist/core/quality/stability-monitor/index.d.ts +5 -0
- package/dist/core/quality/stability-monitor/stability-monitor-facade.d.ts +50 -0
- package/dist/core/quality/stability-monitor/stability-monitor.d.ts +61 -0
- package/dist/core/quality/stability-monitor/types.d.ts +69 -0
- package/dist/core/renderer/background-controller.d.ts +56 -0
- package/dist/core/renderer/index.d.ts +5 -0
- package/dist/core/renderer/player-adapter.d.ts +129 -0
- package/dist/core/renderer/renderer.d.ts +134 -0
- package/dist/core/service/frame-service.d.ts +116 -0
- package/dist/core/service/index.d.ts +9 -0
- package/dist/core/service/interaction-providers.d.ts +20 -0
- package/dist/core/service/interaction-service.d.ts +211 -0
- package/dist/core/service/item-asset-service.d.ts +120 -0
- package/dist/core/service/item-creator-service.d.ts +211 -0
- package/dist/core/service/item-service.d.ts +641 -0
- package/dist/core/service/item-sync-service.d.ts +66 -0
- package/dist/core/service/json-scene-sync-service.d.ts +140 -0
- package/dist/core/service/refresh-animation-base-service.d.ts +1 -0
- package/dist/core/service/scene-data-assembler.d.ts +166 -0
- package/dist/core/service/view-service.d.ts +202 -0
- package/dist/core/state/base-state.d.ts +28 -0
- package/dist/core/state/index.d.ts +6 -0
- package/dist/core/state/presets.d.ts +25 -0
- package/dist/core/state/state-manager.d.ts +50 -0
- package/dist/core/state/types.d.ts +52 -0
- package/dist/core/store/index.d.ts +3 -0
- package/dist/core/store/scene-store.d.ts +194 -0
- package/dist/core/store/store.d.ts +36 -0
- package/dist/core/types/artis-config.d.ts +186 -0
- package/dist/core/types/artis-events.d.ts +101 -0
- package/dist/core/types/frame.d.ts +3 -0
- package/dist/core/types/generator.d.ts +28 -0
- package/dist/core/types/index.d.ts +15 -0
- package/dist/core/types/item-create-info.d.ts +205 -0
- package/dist/core/types/item-property.d.ts +149 -0
- package/dist/core/types/item-reorder.d.ts +12 -0
- package/dist/core/types/item-schema.d.ts +263 -0
- package/dist/core/types/item-set-property.d.ts +48 -0
- package/dist/core/types/page.d.ts +40 -0
- package/dist/core/types/sdk.d.ts +28 -0
- package/dist/core/types/view.d.ts +39 -0
- package/dist/helper/exporter/config.d.ts +18 -0
- package/dist/helper/exporter/const.d.ts +71 -0
- package/dist/helper/exporter/export-media.d.ts +189 -0
- package/dist/helper/exporter/exporter.d.ts +58 -0
- package/dist/helper/exporter/index.d.ts +2 -0
- package/dist/helper/exporter/types.d.ts +194 -0
- package/dist/helper/exporter/utils.d.ts +71 -0
- package/dist/helper/exporter/wav-audio.d.ts +35 -0
- package/dist/helper/html-overlay/anchor-navigation-runtime.d.ts +1 -0
- package/dist/helper/html-overlay/auto-height-layout.d.ts +16 -0
- package/dist/helper/html-overlay/auto-height-runtime.d.ts +40 -0
- package/dist/helper/html-overlay/document-runtime.d.ts +18 -0
- package/dist/helper/html-overlay/document-transform.d.ts +46 -0
- package/dist/helper/html-overlay/dom-order.d.ts +5 -0
- package/dist/helper/html-overlay/host-message-runtime.d.ts +15 -0
- package/dist/helper/html-overlay/html-capture-runtime.d.ts +12 -0
- package/dist/helper/html-overlay/html-card-service.d.ts +287 -0
- package/dist/helper/html-overlay/html-viewport-style.d.ts +6 -0
- package/dist/helper/html-overlay/index.d.ts +1 -0
- package/dist/helper/html-overlay/inline-script-json.d.ts +1 -0
- package/dist/helper/html-overlay/mime-utils.d.ts +13 -0
- package/dist/helper/html-overlay/overlay-transform.d.ts +30 -0
- package/dist/helper/html-overlay/path-utils.d.ts +34 -0
- package/dist/helper/html-overlay/runtime-context.d.ts +2 -0
- package/dist/helper/html-overlay/shell-runtime.d.ts +13 -0
- package/dist/helper/index.d.ts +5 -0
- package/dist/helper/scene-builder.d.ts +111 -0
- package/dist/helper/screen-shot.d.ts +51 -0
- package/dist/helper/size-adapt.d.ts +88 -0
- package/dist/index.cjs +69350 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.mjs +68963 -0
- package/dist/index.mjs.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/player.d.ts +9 -0
- package/dist/utils/background-manager.d.ts +76 -0
- package/dist/utils/common-utils.d.ts +39 -0
- package/dist/utils/container-size.d.ts +7 -0
- package/dist/utils/find-player-item.d.ts +9 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/json-data-utils.d.ts +198 -0
- package/dist/utils/layout-utils.d.ts +144 -0
- package/dist/utils/pixel-box-utils.d.ts +26 -0
- package/dist/utils/player-data-utils.d.ts +9 -0
- package/dist/utils/player-utils.d.ts +42 -0
- package/dist/utils/replay-utils.d.ts +22 -0
- package/dist/utils/types.d.ts +130 -0
- package/package.json +66 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type SpriteImageCommandArgs = {
|
|
5
|
+
itemId: string;
|
|
6
|
+
newImageUrl: string;
|
|
7
|
+
itemService: ItemService;
|
|
8
|
+
store: Store;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* sprite.image - 修改 Sprite 元素贴图 Command
|
|
12
|
+
*
|
|
13
|
+
* execute: 将元素贴图替换为新 URL
|
|
14
|
+
* undo: 恢复旧贴图
|
|
15
|
+
* redo: 重新应用新贴图
|
|
16
|
+
*/
|
|
17
|
+
export declare class SpriteImageCommand implements Command {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly commandId = "sprite.image";
|
|
20
|
+
private _itemId;
|
|
21
|
+
private _newImageUrl;
|
|
22
|
+
private _oldImageUrl;
|
|
23
|
+
private _itemService;
|
|
24
|
+
private _store;
|
|
25
|
+
/**
|
|
26
|
+
* 构造贴图修改命令,并从 store 中快照旧贴图 URL
|
|
27
|
+
* @param args 命令参数(含元素 id、新贴图 URL、ItemService、Store)
|
|
28
|
+
*/
|
|
29
|
+
constructor(args: SpriteImageCommandArgs);
|
|
30
|
+
/** 将元素贴图替换为新 URL */
|
|
31
|
+
execute(): void;
|
|
32
|
+
/** 恢复旧贴图 */
|
|
33
|
+
undo(): void;
|
|
34
|
+
/** 重新应用新贴图 */
|
|
35
|
+
redo(): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
export type SpriteTextInfo = {
|
|
3
|
+
text: string;
|
|
4
|
+
fontSize: number;
|
|
5
|
+
fontFamily: string;
|
|
6
|
+
color: [number, number, number, number];
|
|
7
|
+
/** 其他可能变化的属性 */
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
export type SpriteTextEditCommitCommandArgs = {
|
|
11
|
+
/** 目标元素 ID(须为 player instanceId;Artis 侧 toVfxItemId 翻译后传入,SceneArtis 直传) */
|
|
12
|
+
itemId: string;
|
|
13
|
+
newTextInfo: SpriteTextInfo;
|
|
14
|
+
oldTextInfo: SpriteTextInfo;
|
|
15
|
+
/** 应用 SpriteText 信息的回调;itemId 语义同上,为 instanceId */
|
|
16
|
+
applyTextInfo: (itemId: string, info: SpriteTextInfo) => void;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* spriteTextEdit.commit - SpriteText 编辑提交 Command
|
|
20
|
+
*
|
|
21
|
+
* execute: 应用编辑后的 SpriteText 信息
|
|
22
|
+
* undo: 恢复到编辑前的 SpriteText 信息
|
|
23
|
+
* redo: 重新应用编辑后的信息
|
|
24
|
+
*/
|
|
25
|
+
export declare class SpriteTextEditCommitCommand implements Command {
|
|
26
|
+
readonly id: string;
|
|
27
|
+
readonly commandId = "spriteTextEdit.commit";
|
|
28
|
+
private _itemId;
|
|
29
|
+
private _newTextInfo;
|
|
30
|
+
private _oldTextInfo;
|
|
31
|
+
private _applyTextInfo;
|
|
32
|
+
/**
|
|
33
|
+
* 构造 SpriteText 编辑提交命令,缓存新旧文本信息与回调
|
|
34
|
+
* @param args 命令参数(含元素 id、新旧 SpriteText 信息与 applyTextInfo 回调)
|
|
35
|
+
*/
|
|
36
|
+
constructor(args: SpriteTextEditCommitCommandArgs);
|
|
37
|
+
/** 应用编辑后的 SpriteText 信息 */
|
|
38
|
+
execute(): void;
|
|
39
|
+
/** 恢复到编辑前的 SpriteText 信息 */
|
|
40
|
+
undo(): void;
|
|
41
|
+
/** 重新应用编辑后的信息 */
|
|
42
|
+
redo(): void;
|
|
43
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StateNavigator } from '../../state';
|
|
2
|
+
import { StateSwitchCommandBase } from './state-switch-command-base';
|
|
3
|
+
export type StateHandCommandArgs = {
|
|
4
|
+
states: StateNavigator;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* state.hand - 切到「手型」平移视图态 Command(不入 History)
|
|
8
|
+
*
|
|
9
|
+
* 业务方:`artis.command.execute('state.hand')`。
|
|
10
|
+
*/
|
|
11
|
+
export declare class StateHandCommand extends StateSwitchCommandBase {
|
|
12
|
+
readonly commandId = "state.hand";
|
|
13
|
+
constructor(args: StateHandCommandArgs);
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StateNavigator } from '../../state';
|
|
2
|
+
import { StateSwitchCommandBase } from './state-switch-command-base';
|
|
3
|
+
export type StateImageCutCommandArgs = {
|
|
4
|
+
states: StateNavigator;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* state.imageCut - 切到「图片裁剪」态 Command(不入 History)
|
|
8
|
+
*
|
|
9
|
+
* 业务方:`artis.command.execute('state.imageCut')`。
|
|
10
|
+
*/
|
|
11
|
+
export declare class StateImageCutCommand extends StateSwitchCommandBase {
|
|
12
|
+
readonly commandId = "state.imageCut";
|
|
13
|
+
constructor(args: StateImageCutCommandArgs);
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StateNavigator } from '../../state';
|
|
2
|
+
import { StateSwitchCommandBase } from './state-switch-command-base';
|
|
3
|
+
export type StateImageExpandCommandArgs = {
|
|
4
|
+
states: StateNavigator;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* state.imageExpand - 切到「图片扩边」态 Command(不入 History)
|
|
8
|
+
*
|
|
9
|
+
* 业务方:`artis.command.execute('state.imageExpand')`。
|
|
10
|
+
*/
|
|
11
|
+
export declare class StateImageExpandCommand extends StateSwitchCommandBase {
|
|
12
|
+
readonly commandId = "state.imageExpand";
|
|
13
|
+
constructor(args: StateImageExpandCommandArgs);
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { StateNavigator } from '../../state';
|
|
2
|
+
import { StateSwitchCommandBase } from './state-switch-command-base';
|
|
3
|
+
export type StateImageMaskCommandArgs = {
|
|
4
|
+
states: StateNavigator;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* state.imageMask - 切到「图片蒙版」态 Command(不入 History)
|
|
8
|
+
*
|
|
9
|
+
* 业务方:`artis.command.execute('state.imageMask')`。
|
|
10
|
+
* 笔刷大小等蒙版偏好仍走 `artis.gizmoManager.configs.set(maskConfig, { brushSize })`。
|
|
11
|
+
*/
|
|
12
|
+
export declare class StateImageMaskCommand extends StateSwitchCommandBase {
|
|
13
|
+
readonly commandId = "state.imageMask";
|
|
14
|
+
constructor(args: StateImageMaskCommandArgs);
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StateNavigator } from '../../state';
|
|
2
|
+
import { StateSwitchCommandBase } from './state-switch-command-base';
|
|
3
|
+
export type StateImageTextEditCommandArgs = {
|
|
4
|
+
states: StateNavigator;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* state.imageTextEdit - 切到「图文编辑」态 Command(不入 History)
|
|
8
|
+
*
|
|
9
|
+
* 业务方:`artis.command.execute('state.imageTextEdit')`。
|
|
10
|
+
*/
|
|
11
|
+
export declare class StateImageTextEditCommand extends StateSwitchCommandBase {
|
|
12
|
+
readonly commandId = "state.imageTextEdit";
|
|
13
|
+
constructor(args: StateImageTextEditCommandArgs);
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { StateNavigator } from '../../state';
|
|
2
|
+
import { ItemCreateType } from '@vvfx/gizmo';
|
|
3
|
+
import { StateSwitchCommandBase } from './state-switch-command-base';
|
|
4
|
+
export type StateItemCreateCommandArgs = {
|
|
5
|
+
/** 进入的交互创建类型(TEXT/FRAME/VIDEO_GENERATOR/IMAGE_GENERATOR)。缺省 FRAME。 */
|
|
6
|
+
createType?: ItemCreateType;
|
|
7
|
+
states: StateNavigator;
|
|
8
|
+
getCreateType: () => ItemCreateType;
|
|
9
|
+
setCreateType: (value: ItemCreateType) => void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* state.itemCreate - 进入「元素交互创建」态 Command(不入 History)
|
|
13
|
+
*
|
|
14
|
+
* 继承 {@link StateSwitchCommandBase}(切到 itemCreate 态、undo 回前态),额外在 execute/undo 增补:
|
|
15
|
+
* 设 item-create gizmo 的 `createType`(TEXT/FRAME/VIDEO_GENERATOR/IMAGE_GENERATOR)。
|
|
16
|
+
*
|
|
17
|
+
* 设计:交互态创建本质是"交互态收集 schema → 调 item.create",本命令只负责"进入态 + 配 createType";
|
|
18
|
+
* 用户在画布上的创建动作由 ItemCreateGizmo 收集后经 BaseArtis._handleGizmoEvent 调 item.create 收尾。
|
|
19
|
+
*
|
|
20
|
+
* 命名归 state.* 体系(本质是切态进 itemCreate,而非建元素)。绑定旧 `openItemCreateGizmo` 兼容入口。
|
|
21
|
+
*
|
|
22
|
+
* 业务方:`artis.command.execute('state.itemCreate', { createType: ItemCreateType.TEXT })`。
|
|
23
|
+
*/
|
|
24
|
+
export declare class StateItemCreateCommand extends StateSwitchCommandBase {
|
|
25
|
+
readonly commandId = "state.itemCreate";
|
|
26
|
+
private readonly _createType;
|
|
27
|
+
private readonly _prevCreateType;
|
|
28
|
+
private readonly _setCreateType;
|
|
29
|
+
constructor(args: StateItemCreateCommandArgs);
|
|
30
|
+
/** 进入 itemCreate 态并设 gizmo createType */
|
|
31
|
+
execute(): void;
|
|
32
|
+
/** 退出:切回前态 + 还原 gizmo createType */
|
|
33
|
+
undo(): void;
|
|
34
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StateNavigator } from '../../state';
|
|
2
|
+
import { StateSwitchCommandBase } from './state-switch-command-base';
|
|
3
|
+
export type StateMoveCommandArgs = {
|
|
4
|
+
states: StateNavigator;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* state.move - 切回默认「移动」态 Command(不入 History)
|
|
8
|
+
*
|
|
9
|
+
* 业务方:`artis.command.execute('state.move')`。退出其他工具态回到移动选区态。
|
|
10
|
+
*/
|
|
11
|
+
export declare class StateMoveCommand extends StateSwitchCommandBase {
|
|
12
|
+
readonly commandId = "state.move";
|
|
13
|
+
constructor(args: StateMoveCommandArgs);
|
|
14
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { StateNavigator, StateId } from '../../state';
|
|
3
|
+
/**
|
|
4
|
+
* 切换交互态 Command 基类。
|
|
5
|
+
*
|
|
6
|
+
* 把"切换 gizmo 态"收口为 command 体系,Command 仅依赖 StateNavigator,
|
|
7
|
+
* 业务方走 `artis.command.execute('state.xxx')`。子类只需固定 `commandId` + `stateId`,execute/undo/redo 复用本基类。
|
|
8
|
+
*
|
|
9
|
+
* - execute: 切到目标 stateId;undo: 切回构造期快照的前态(保证 undo 能退出该态)
|
|
10
|
+
* - **isHistorical=false:不入 History**(交互态切换是 UI 转场/工具切换,非数据编辑,不该被 undo/redo 干扰)
|
|
11
|
+
* - 前态快照取 `states.activeState.id`,undo 时还原;若前态与目标态相同则 activate 内部幂等
|
|
12
|
+
*
|
|
13
|
+
* 复杂态(所进态还需额外配置,如 itemCreate 要设 gizmo.createType)覆写 execute/undo 增补配置即可。
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class StateSwitchCommandBase implements Command {
|
|
16
|
+
abstract readonly commandId: string;
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly isHistorical = false;
|
|
19
|
+
/** 可变(Command.params 接口允许,子类可在 super 后累加 createType 等额外字段) */
|
|
20
|
+
params: Record<string, unknown>;
|
|
21
|
+
protected readonly _stateId: StateId;
|
|
22
|
+
protected readonly _states: StateNavigator;
|
|
23
|
+
protected readonly _source?: any;
|
|
24
|
+
/** 构造期快照的前态 id,供 undo 还原 */
|
|
25
|
+
protected readonly _prevStateId: StateId;
|
|
26
|
+
constructor(args: {
|
|
27
|
+
commandId: string;
|
|
28
|
+
stateId: StateId;
|
|
29
|
+
states: StateNavigator;
|
|
30
|
+
source?: any;
|
|
31
|
+
});
|
|
32
|
+
/** 切到目标态 */
|
|
33
|
+
execute(): void;
|
|
34
|
+
/** 切回前态 */
|
|
35
|
+
undo(): void;
|
|
36
|
+
redo(): void;
|
|
37
|
+
serializeReplay(): {
|
|
38
|
+
args: Record<string, unknown>;
|
|
39
|
+
replayable: false;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type TextMoveCommandArgs = {
|
|
5
|
+
itemId: string;
|
|
6
|
+
deltaPosition: [number, number];
|
|
7
|
+
itemService: ItemService;
|
|
8
|
+
store: Store;
|
|
9
|
+
/** 交互前的旧 position。若不传,则在首次 execute 时从 store 中捕获 */
|
|
10
|
+
oldPosition?: [number, number];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* text.move - 移动文本元素 Command(单元素)
|
|
14
|
+
*
|
|
15
|
+
* execute: 按 delta 移动文本元素
|
|
16
|
+
* undo: 恢复到移动前的 position
|
|
17
|
+
* redo: 重新应用移动
|
|
18
|
+
* merge: 连续移动合并(累加 delta)
|
|
19
|
+
*/
|
|
20
|
+
export declare class TextMoveCommand implements Command {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly commandId = "text.move";
|
|
23
|
+
private _itemId;
|
|
24
|
+
private _deltaPosition;
|
|
25
|
+
private _oldPosition;
|
|
26
|
+
private _itemService;
|
|
27
|
+
private _store;
|
|
28
|
+
/**
|
|
29
|
+
* 构造文本移动命令,缓存目标元素与位移量
|
|
30
|
+
* @param args 命令参数(含元素 id、位移量、ItemService、Store 及可选旧 position)
|
|
31
|
+
*/
|
|
32
|
+
constructor(args: TextMoveCommandArgs);
|
|
33
|
+
/**
|
|
34
|
+
* 按位移量移动目标元素;元素不存在或已捕获旧值时跳过记录
|
|
35
|
+
*/
|
|
36
|
+
execute(): void;
|
|
37
|
+
/** 恢复到移动前的 position */
|
|
38
|
+
undo(): void;
|
|
39
|
+
/** 重新应用移动 */
|
|
40
|
+
redo(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 与同元素后续移动命令合并:累加 delta
|
|
43
|
+
* @param other 紧随其后的命令
|
|
44
|
+
* @returns 同元素合并成功返回 true,否则 false
|
|
45
|
+
*/
|
|
46
|
+
merge(other: Command): boolean;
|
|
47
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type TextRotateCommandArgs = {
|
|
5
|
+
itemId: string;
|
|
6
|
+
newRotation: number;
|
|
7
|
+
newPosition: [number, number];
|
|
8
|
+
itemService: ItemService;
|
|
9
|
+
store: Store;
|
|
10
|
+
/** 交互前的旧 rotation。若不传,则在首次 execute 时从 store 中捕获 */
|
|
11
|
+
oldRotation?: number;
|
|
12
|
+
/** 交互前的旧 position。若不传,则在首次 execute 时从 store 中捕获 */
|
|
13
|
+
oldPosition?: [number, number];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* text.rotate - 旋转文本元素 Command(单元素)
|
|
17
|
+
*
|
|
18
|
+
* execute: 应用新的 rotation + position
|
|
19
|
+
* undo: 恢复到旋转前的值
|
|
20
|
+
* redo: 重新应用旋转后的值
|
|
21
|
+
* merge: 连续旋转合并(保留最初 old,更新 new)
|
|
22
|
+
*/
|
|
23
|
+
export declare class TextRotateCommand implements Command {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly commandId = "text.rotate";
|
|
26
|
+
private _itemId;
|
|
27
|
+
private _newRotation;
|
|
28
|
+
private _newPosition;
|
|
29
|
+
private _oldRotation;
|
|
30
|
+
private _oldPosition;
|
|
31
|
+
private _itemService;
|
|
32
|
+
private _store;
|
|
33
|
+
/**
|
|
34
|
+
* 构造文本旋转命令,缓存目标元素与新旧 rotation/position
|
|
35
|
+
* @param args 命令参数(含元素 id、新 rotation/position、ItemService、Store 及可选旧值)
|
|
36
|
+
*/
|
|
37
|
+
constructor(args: TextRotateCommandArgs);
|
|
38
|
+
/**
|
|
39
|
+
* 应用新的 rotation + position;元素不存在时跳过
|
|
40
|
+
*/
|
|
41
|
+
execute(): void;
|
|
42
|
+
/** 恢复到旋转前的 rotation + position */
|
|
43
|
+
undo(): void;
|
|
44
|
+
/** 重新应用旋转后的值 */
|
|
45
|
+
redo(): void;
|
|
46
|
+
/**
|
|
47
|
+
* 与同元素后续旋转命令合并:保留最初 old,更新 new
|
|
48
|
+
* @param other 紧随其后的命令
|
|
49
|
+
* @returns 同元素合并成功返回 true,否则 false
|
|
50
|
+
*/
|
|
51
|
+
merge(other: Command): boolean;
|
|
52
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type TextScaleSnapshot = {
|
|
5
|
+
position: [number, number];
|
|
6
|
+
scale: [number, number];
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
fontSize: number;
|
|
10
|
+
lineHeight: number;
|
|
11
|
+
};
|
|
12
|
+
export type TextScaleCommandArgs = {
|
|
13
|
+
itemId: string;
|
|
14
|
+
newSnapshot: TextScaleSnapshot;
|
|
15
|
+
itemService: ItemService;
|
|
16
|
+
store: Store;
|
|
17
|
+
/** 交互前的旧快照。若不传,则在首次 execute 时从 store 中捕获 */
|
|
18
|
+
oldSnapshot?: TextScaleSnapshot;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* text.scale - 缩放文本元素 Command(单元素)
|
|
22
|
+
*
|
|
23
|
+
* execute: 应用新的 scale/size/position
|
|
24
|
+
* undo: 恢复到缩放前的值
|
|
25
|
+
* redo: 重新应用缩放后的值
|
|
26
|
+
* merge: 连续缩放合并(保留最初 old,更新 new)
|
|
27
|
+
*/
|
|
28
|
+
export declare class TextScaleCommand implements Command {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
readonly commandId = "text.scale";
|
|
31
|
+
private _itemId;
|
|
32
|
+
private _newSnapshot;
|
|
33
|
+
private _oldSnapshot;
|
|
34
|
+
private _itemService;
|
|
35
|
+
private _store;
|
|
36
|
+
/**
|
|
37
|
+
* 初始化文本缩放命令,记录目标元素与新旧快照
|
|
38
|
+
* @param args 命令参数(itemId、新快照、itemService、store、可选旧快照)
|
|
39
|
+
*/
|
|
40
|
+
constructor(args: TextScaleCommandArgs);
|
|
41
|
+
private _applySnapshot;
|
|
42
|
+
/**
|
|
43
|
+
* 应用新快照到目标文本元素,首次执行时若未提供旧快照则从 store 捕获
|
|
44
|
+
*/
|
|
45
|
+
execute(): void;
|
|
46
|
+
/** 撤销缩放,恢复到旧快照(无旧快照时跳过) */
|
|
47
|
+
undo(): void;
|
|
48
|
+
/** 重做缩放,重新应用新快照 */
|
|
49
|
+
redo(): void;
|
|
50
|
+
/**
|
|
51
|
+
* 合并连续的同元素缩放命令,保留最初旧快照、更新新快照为目标值
|
|
52
|
+
* @param other 后续命令
|
|
53
|
+
* @returns 是否合并成功
|
|
54
|
+
*/
|
|
55
|
+
merge(other: Command): boolean;
|
|
56
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type TextContentData = Partial<{
|
|
5
|
+
text: string;
|
|
6
|
+
fontSize: number;
|
|
7
|
+
fontFamily: string;
|
|
8
|
+
lineHeight: number;
|
|
9
|
+
color: [number, number, number, number];
|
|
10
|
+
fontWeight: number;
|
|
11
|
+
fontStyle: number;
|
|
12
|
+
textAlign: number;
|
|
13
|
+
outlineColor: [number, number, number, number];
|
|
14
|
+
outlineWidth: number;
|
|
15
|
+
outlineEnabled: boolean;
|
|
16
|
+
}>;
|
|
17
|
+
export type TextUpdateContentCommandArgs = {
|
|
18
|
+
itemId: string;
|
|
19
|
+
newContent: TextContentData;
|
|
20
|
+
itemService: ItemService;
|
|
21
|
+
store: Store;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* text.updateContent - 修改文本内容/样式 Command
|
|
25
|
+
*
|
|
26
|
+
* execute: 应用新文本内容/样式
|
|
27
|
+
* undo: 恢复旧文本内容/样式
|
|
28
|
+
* redo: 重新应用新文本内容/样式
|
|
29
|
+
*/
|
|
30
|
+
export declare class TextUpdateContentCommand implements Command {
|
|
31
|
+
readonly id: string;
|
|
32
|
+
readonly commandId = "text.updateContent";
|
|
33
|
+
private _itemId;
|
|
34
|
+
private _newContent;
|
|
35
|
+
private _oldContent;
|
|
36
|
+
private _itemService;
|
|
37
|
+
private _store;
|
|
38
|
+
/**
|
|
39
|
+
* 初始化文本内容/样式修改命令
|
|
40
|
+
* @param args 命令参数(itemId、新内容、itemService、store)
|
|
41
|
+
*/
|
|
42
|
+
constructor(args: TextUpdateContentCommandArgs);
|
|
43
|
+
/**
|
|
44
|
+
* 应用新文本内容/样式,首次执行时按新内容字段从 store 捕获旧值
|
|
45
|
+
*/
|
|
46
|
+
execute(): void;
|
|
47
|
+
/** 撤销修改,恢复旧文本内容/样式(无旧值时跳过) */
|
|
48
|
+
undo(): void;
|
|
49
|
+
/** 重做修改,重新应用新文本内容/样式 */
|
|
50
|
+
redo(): void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type TransformMoveCommandArgs = {
|
|
5
|
+
itemIds: string[];
|
|
6
|
+
deltaPosition: [number, number];
|
|
7
|
+
itemService: ItemService;
|
|
8
|
+
store: Store;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* transform.move - 移动元素 Command(支持多选)
|
|
12
|
+
*
|
|
13
|
+
* execute: 按 delta 移动所有目标元素
|
|
14
|
+
* undo: 恢复到移动前的 position
|
|
15
|
+
* redo: 重新应用移动
|
|
16
|
+
* merge: 同一批元素连续移动合并(累加 delta)
|
|
17
|
+
*/
|
|
18
|
+
export declare class TransformMoveCommand implements Command {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly commandId = "transform.move";
|
|
21
|
+
private _itemIds;
|
|
22
|
+
private _deltaPosition;
|
|
23
|
+
private _oldPositions;
|
|
24
|
+
private _itemService;
|
|
25
|
+
private _store;
|
|
26
|
+
/**
|
|
27
|
+
* 初始化移动命令,记录目标元素与位移量
|
|
28
|
+
* @param args 命令参数(itemIds、deltaPosition、itemService、store)
|
|
29
|
+
*/
|
|
30
|
+
constructor(args: TransformMoveCommandArgs);
|
|
31
|
+
/** 返回受影响的元素 ID 列表 */
|
|
32
|
+
get itemIds(): string[];
|
|
33
|
+
/** 返回各元素移动前的原始位置快照 */
|
|
34
|
+
get oldPositions(): Map<string, [number, number]>;
|
|
35
|
+
/** 按 delta 移动所有目标元素,首次执行时记录各元素原始位置 */
|
|
36
|
+
execute(): void;
|
|
37
|
+
/** 撤销移动,将各元素恢复到原始位置 */
|
|
38
|
+
undo(): void;
|
|
39
|
+
/** 重做移动,基于原始位置叠加 delta 得到新位置 */
|
|
40
|
+
redo(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 合并连续的同批元素移动命令,累加位移量
|
|
43
|
+
* @param other 后续命令
|
|
44
|
+
* @returns 是否合并成功
|
|
45
|
+
*/
|
|
46
|
+
merge(other: Command): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 序列化为可重放入参:输出累加合并后的纯数据(itemIds + deltaPosition)。
|
|
49
|
+
* 复现页据此直接 new TransformMoveCommand({...}) 重建,无需工厂/服务引用。
|
|
50
|
+
* 命令已合并过 delta,故输出的 delta 是最终累加值(修复交互态 merge 后只存末次 delta 的问题)。
|
|
51
|
+
*/
|
|
52
|
+
serializeReplay(): {
|
|
53
|
+
args: Record<string, unknown>;
|
|
54
|
+
replayable: boolean;
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type FrameChangeSnapshot = {
|
|
5
|
+
/** 元素旧位置 */
|
|
6
|
+
positions: Map<string, [number, number]>;
|
|
7
|
+
/** 元素旧 parentId(undefined 表示根节点) */
|
|
8
|
+
parentIds: Map<string, string | undefined>;
|
|
9
|
+
/** 受影响 Frame 的旧 children */
|
|
10
|
+
frameChildren: Map<string, string[]>;
|
|
11
|
+
};
|
|
12
|
+
export type TransformMoveWithFrameChangeCommandArgs = {
|
|
13
|
+
itemIds: string[];
|
|
14
|
+
/** 新的元素位置 */
|
|
15
|
+
newPositions: Map<string, [number, number]>;
|
|
16
|
+
/** 新的 parentId(undefined 表示移出到根节点) */
|
|
17
|
+
newParentIds: Map<string, string | undefined>;
|
|
18
|
+
/** 受影响 Frame 的新 children */
|
|
19
|
+
newFrameChildren: Map<string, string[]>;
|
|
20
|
+
itemService: ItemService;
|
|
21
|
+
store: Store;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* transform.moveWithFrameChange - 元素移动 + 移入/移出 Frame Command
|
|
25
|
+
*
|
|
26
|
+
* execute: 移动元素并变更 parentId + Frame.children
|
|
27
|
+
* undo: 恢复元素位置 + parentId + Frame.children
|
|
28
|
+
* redo: 重新应用
|
|
29
|
+
* merge: 同一批元素连续变化合并(保留最初 old,更新 new)
|
|
30
|
+
*/
|
|
31
|
+
export declare class TransformMoveWithFrameChangeCommand implements Command {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly commandId = "transform.moveWithFrameChange";
|
|
34
|
+
private _itemIds;
|
|
35
|
+
private _newPositions;
|
|
36
|
+
private _newParentIds;
|
|
37
|
+
private _newFrameChildren;
|
|
38
|
+
private _oldSnapshot;
|
|
39
|
+
private _itemService;
|
|
40
|
+
private _store;
|
|
41
|
+
/**
|
|
42
|
+
* 初始化移动+Frame 变更命令,记录目标元素与新旧位置/父子关系/Frame.children
|
|
43
|
+
* @param args 命令参数(itemIds、新位置、新 parentId、新 Frame.children、itemService、store)
|
|
44
|
+
*/
|
|
45
|
+
constructor(args: TransformMoveWithFrameChangeCommandArgs);
|
|
46
|
+
/** 返回受影响的元素 ID 列表 */
|
|
47
|
+
get itemIds(): string[];
|
|
48
|
+
/** 返回首次执行时捕获的旧快照(位置/parentId/Frame.children) */
|
|
49
|
+
get oldSnapshot(): FrameChangeSnapshot | undefined;
|
|
50
|
+
/** 应用新位置与父子关系变更,首次执行时捕获旧快照 */
|
|
51
|
+
execute(): void;
|
|
52
|
+
/** 撤销变更,将位置/parentId/Frame.children 恢复到旧快照(无旧快照时跳过) */
|
|
53
|
+
undo(): void;
|
|
54
|
+
/** 重做变更,重新应用新位置/parentId/Frame.children */
|
|
55
|
+
redo(): void;
|
|
56
|
+
/**
|
|
57
|
+
* 应用一组变更(execute / undo / redo 共用)
|
|
58
|
+
*
|
|
59
|
+
* 分两阶段:
|
|
60
|
+
* 1. 父变化的元素:按目标 parentId 分组,委托 ItemService.moveItemsToFrame / moveItemsOutOfFrame
|
|
61
|
+
* 完成「Player setParent + transform 补偿 + parentId + Frame.children」一体化更新
|
|
62
|
+
* 2. 父未变的元素:直接 updateItemTransform 设置新位置
|
|
63
|
+
* 3. 用目标快照覆盖 Frame.children(确保最终一致,兼容外部传入的精确 children 序列)
|
|
64
|
+
* @param positions 目标位置
|
|
65
|
+
* @param parentIds 目标 parentId(undefined 表示根节点)
|
|
66
|
+
* @param frameChildren 目标 Frame.children
|
|
67
|
+
*/
|
|
68
|
+
private _applyChanges;
|
|
69
|
+
/**
|
|
70
|
+
* 合并连续的同批元素变更命令,保留最初旧快照、更新新值为目标值
|
|
71
|
+
* @param other 后续命令
|
|
72
|
+
* @returns 是否合并成功
|
|
73
|
+
*/
|
|
74
|
+
merge(other: Command): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* 从 store 捕获元素当前位置/parentId 与所有相关 Frame 的 children,作为撤销依据
|
|
77
|
+
* @returns 旧状态快照(位置、parentId、Frame.children)
|
|
78
|
+
*/
|
|
79
|
+
private _captureOldSnapshot;
|
|
80
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
import type { LayoutInfo } from '../../types';
|
|
5
|
+
export type TransformMoveWithLayoutCommandArgs = {
|
|
6
|
+
itemIds: string[];
|
|
7
|
+
/** 所在 Frame 的 ID */
|
|
8
|
+
frameId: string;
|
|
9
|
+
/** 新的元素位置 */
|
|
10
|
+
newPositions: Map<string, [number, number]>;
|
|
11
|
+
/** 新的 Frame layoutInfos */
|
|
12
|
+
newFrameLayoutInfos: Record<string, LayoutInfo>;
|
|
13
|
+
itemService: ItemService;
|
|
14
|
+
store: Store;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* transform.moveWithLayout - 元素移动 + Frame 内排布顺序变化 Command
|
|
18
|
+
*
|
|
19
|
+
* execute: 移动元素并更新 Frame 的 layoutInfos
|
|
20
|
+
* undo: 恢复元素位置 + Frame layoutInfos
|
|
21
|
+
* redo: 重新应用
|
|
22
|
+
* merge: 同一批元素 + 同一 Frame 连续变化合并
|
|
23
|
+
*/
|
|
24
|
+
export declare class TransformMoveWithLayoutCommand implements Command {
|
|
25
|
+
readonly id: string;
|
|
26
|
+
readonly commandId = "transform.moveWithLayout";
|
|
27
|
+
private _itemIds;
|
|
28
|
+
private _frameId;
|
|
29
|
+
private _newPositions;
|
|
30
|
+
private _newFrameLayoutInfos;
|
|
31
|
+
private _oldPositions;
|
|
32
|
+
private _oldFrameLayoutInfos;
|
|
33
|
+
private _itemService;
|
|
34
|
+
private _store;
|
|
35
|
+
/**
|
|
36
|
+
* 初始化移动+排布变更命令,记录目标元素、Frame 与新位置/新 layoutInfos
|
|
37
|
+
* @param args 命令参数(itemIds、frameId、新位置、新 layoutInfos、itemService、store)
|
|
38
|
+
*/
|
|
39
|
+
constructor(args: TransformMoveWithLayoutCommandArgs);
|
|
40
|
+
/** 返回受影响的元素 ID 列表 */
|
|
41
|
+
get itemIds(): string[];
|
|
42
|
+
/** 返回各元素移动前的原始位置快照 */
|
|
43
|
+
get oldPositions(): Map<string, [number, number]>;
|
|
44
|
+
/** 应用新位置并更新 Frame 的 layoutInfos,首次执行时捕获旧值 */
|
|
45
|
+
execute(): void;
|
|
46
|
+
/** 撤销变更,恢复元素位置与 Frame 的旧 layoutInfos */
|
|
47
|
+
undo(): void;
|
|
48
|
+
/** 重做变更,重新应用新位置与新 layoutInfos */
|
|
49
|
+
redo(): void;
|
|
50
|
+
/**
|
|
51
|
+
* 合并连续的同批元素、同 Frame 变更命令,保留最初旧值、更新新值为目标值
|
|
52
|
+
* @param other 后续命令
|
|
53
|
+
* @returns 是否合并成功
|
|
54
|
+
*/
|
|
55
|
+
merge(other: Command): boolean;
|
|
56
|
+
}
|