@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,81 @@
|
|
|
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
|
+
/**
|
|
6
|
+
* 单元素行列变更(拖拽交互产生的语义化输入)。
|
|
7
|
+
*
|
|
8
|
+
* 仅用于交互层(gizmo / gesture-handler)计算完整 layoutInfos 的中间表达,
|
|
9
|
+
* 不再作为 FrameLayoutCommand 的直接入参。
|
|
10
|
+
*/
|
|
11
|
+
export type LayoutOrderChange = {
|
|
12
|
+
draggedItemId: string;
|
|
13
|
+
fromRow: number;
|
|
14
|
+
fromColumn: number;
|
|
15
|
+
toRow: number;
|
|
16
|
+
toColumn: number;
|
|
17
|
+
};
|
|
18
|
+
export type FrameLayoutCommandArgs = {
|
|
19
|
+
/** 目标 Frame ID */
|
|
20
|
+
frameId: string;
|
|
21
|
+
/**
|
|
22
|
+
* 新的完整 layoutInfos(由调用方算好整份再传入)。
|
|
23
|
+
*
|
|
24
|
+
* 不传时表示纯 re-layout(沿用 Frame 现有 layoutInfos 重新排布),
|
|
25
|
+
* 用于 moveIn / moveOut 后的画板重排场景。
|
|
26
|
+
*/
|
|
27
|
+
newLayoutInfos?: Record<string, LayoutInfo>;
|
|
28
|
+
itemService: ItemService;
|
|
29
|
+
store: Store;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* frame.autoLayout - 对 Frame 内子元素执行自动布局 Command
|
|
33
|
+
*
|
|
34
|
+
* 快照策略(选项1):只快照 Frame 的 layoutInfos(行列信息)。
|
|
35
|
+
* 子元素 position 与 Frame 尺寸均不快照,undo/redo 时统一通过
|
|
36
|
+
* applyFrameAutoLayout 基于 layoutInfos 重算(重算幂等)。
|
|
37
|
+
*
|
|
38
|
+
* execute: 写入新 layoutInfos(如有)→ applyFrameAutoLayout 重排
|
|
39
|
+
* undo: 写回旧 layoutInfos → applyFrameAutoLayout 重排
|
|
40
|
+
* redo: 写回新 layoutInfos → applyFrameAutoLayout 重排
|
|
41
|
+
*/
|
|
42
|
+
export declare class FrameLayoutCommand implements Command {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly commandId = "frame.autoLayout";
|
|
45
|
+
private _frameId;
|
|
46
|
+
private _newLayoutInfos;
|
|
47
|
+
private _itemService;
|
|
48
|
+
private _store;
|
|
49
|
+
/** 执行前的 layoutInfos 快照(首次 execute 时拍摄) */
|
|
50
|
+
private _oldLayoutInfos;
|
|
51
|
+
/** 执行后的 layoutInfos 快照(execute 后拍摄,供 redo 复用) */
|
|
52
|
+
private _afterLayoutInfos;
|
|
53
|
+
private _captured;
|
|
54
|
+
/**
|
|
55
|
+
* 初始化 Frame 自动布局命令,保存目标 Frame 与新 layoutInfos 副本
|
|
56
|
+
* @param args Frame ID、新 layoutInfos 及依赖的 service/store
|
|
57
|
+
*/
|
|
58
|
+
constructor(args: FrameLayoutCommandArgs);
|
|
59
|
+
/** 首次执行时快照旧 layoutInfos 并按新 layoutInfos 重排 Frame 子元素 */
|
|
60
|
+
execute(): void;
|
|
61
|
+
/** 用执行前的 layoutInfos 快照重排,还原 Frame 布局 */
|
|
62
|
+
undo(): void;
|
|
63
|
+
/** 用执行后的 layoutInfos 快照重排,重新应用目标布局 */
|
|
64
|
+
redo(): void;
|
|
65
|
+
/**
|
|
66
|
+
* 写回指定 layoutInfos 并重排(undo/redo 共用)
|
|
67
|
+
* @param layoutInfos 要写入的 layoutInfos 快照;undefined 表示清除并纯 re-layout
|
|
68
|
+
*/
|
|
69
|
+
private _applyLayoutInfos;
|
|
70
|
+
/**
|
|
71
|
+
* 从 store 中查找目标 Frame 元素
|
|
72
|
+
* @returns 命中的 FrameItem;不存在时返回 undefined
|
|
73
|
+
*/
|
|
74
|
+
private _getFrameItem;
|
|
75
|
+
/**
|
|
76
|
+
* 深拷贝 layoutInfos 映射,避免快照与运行态共享引用
|
|
77
|
+
* @param source 源 layoutInfos
|
|
78
|
+
* @returns 拷贝后的 layoutInfos
|
|
79
|
+
*/
|
|
80
|
+
private _cloneLayoutInfos;
|
|
81
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type FrameLayoutModeCommandArgs = {
|
|
5
|
+
/** Frame ID */
|
|
6
|
+
frameId: string;
|
|
7
|
+
/** 目标布局模式 */
|
|
8
|
+
targetMode: 'auto' | 'free';
|
|
9
|
+
itemService: ItemService;
|
|
10
|
+
store: Store;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* frame.layoutMode - 切换画板布局模式 Command
|
|
14
|
+
*
|
|
15
|
+
* execute: 快照(子元素位置 + Frame 尺寸/位置 + layoutInfos + oldMode),
|
|
16
|
+
* 再通过 updateFrameLayoutMode 切换模式(切到 AUTO 会触发自动布局)
|
|
17
|
+
* undo: 通过 updateFrameLayoutMode 还原模式,并还原子元素位置、Frame 尺寸/位置、layoutInfos
|
|
18
|
+
* redo: 重新切换模式
|
|
19
|
+
*/
|
|
20
|
+
export declare class FrameLayoutModeCommand implements Command {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly commandId = "frame.layoutMode";
|
|
23
|
+
private _frameId;
|
|
24
|
+
private _targetMode;
|
|
25
|
+
private _itemService;
|
|
26
|
+
private _store;
|
|
27
|
+
private _oldSnapshot;
|
|
28
|
+
/**
|
|
29
|
+
* 初始化布局模式切换命令,保存目标 Frame 与目标模式
|
|
30
|
+
* @param args Frame ID、目标模式及依赖的 service/store
|
|
31
|
+
*/
|
|
32
|
+
constructor(args: FrameLayoutModeCommandArgs);
|
|
33
|
+
/** 首次执行时拍摄快照并切换到目标布局模式 */
|
|
34
|
+
execute(): void;
|
|
35
|
+
/** 还原模式、Frame 尺寸/位置、子元素位置与 layoutInfos 至快照状态 */
|
|
36
|
+
undo(): void;
|
|
37
|
+
/** 重新切换到目标布局模式 */
|
|
38
|
+
redo(): void;
|
|
39
|
+
/**
|
|
40
|
+
* 拍摄模式、子元素位置、Frame 尺寸/位置与 layoutInfos 快照
|
|
41
|
+
* @returns 布局模式快照(Frame 不存在时返回默认零值快照)
|
|
42
|
+
*/
|
|
43
|
+
private _captureSnapshot;
|
|
44
|
+
/**
|
|
45
|
+
* 从 store 中查找目标 Frame 元素
|
|
46
|
+
* @returns 命中的 FrameItem,未找到时返回 undefined
|
|
47
|
+
*/
|
|
48
|
+
private _getFrameItem;
|
|
49
|
+
/**
|
|
50
|
+
* 深拷贝 layoutInfos 映射
|
|
51
|
+
* @param source 源 layoutInfos
|
|
52
|
+
* @returns 拷贝后的 layoutInfos
|
|
53
|
+
*/
|
|
54
|
+
private _cloneLayoutInfos;
|
|
55
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type FrameMoveInCommandArgs = {
|
|
5
|
+
/** 要移入的元素 ID 列表 */
|
|
6
|
+
itemIds: string[];
|
|
7
|
+
/** 目标 Frame ID */
|
|
8
|
+
frameId: string;
|
|
9
|
+
itemService: ItemService;
|
|
10
|
+
store: Store;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* frame.moveIn - 将元素移入 Frame Command
|
|
14
|
+
*
|
|
15
|
+
* execute: 调用 ItemService.moveItemsToFrame(数据层 + Player 层 + transform 补偿)
|
|
16
|
+
* undo: 恢复元素 parentId / position 与 Frame.children 快照
|
|
17
|
+
* redo: 重新移入
|
|
18
|
+
*/
|
|
19
|
+
export declare class FrameMoveInCommand implements Command {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly commandId = "frame.moveIn";
|
|
22
|
+
private _itemIds;
|
|
23
|
+
private _frameId;
|
|
24
|
+
private _itemService;
|
|
25
|
+
private _store;
|
|
26
|
+
private _oldSnapshot;
|
|
27
|
+
/**
|
|
28
|
+
* 初始化移入 Frame 命令,保存目标元素与目标 Frame
|
|
29
|
+
* @param args 元素 ID 列表、目标 Frame ID 及依赖的 service/store
|
|
30
|
+
*/
|
|
31
|
+
constructor(args: FrameMoveInCommandArgs);
|
|
32
|
+
/** 首次执行时拍摄快照并将指定元素移入目标 Frame */
|
|
33
|
+
execute(): void;
|
|
34
|
+
/** 恢复元素 parentId、位置及受影响 Frame 的 children 至快照状态 */
|
|
35
|
+
undo(): void;
|
|
36
|
+
/** 重新将元素移入目标 Frame */
|
|
37
|
+
redo(): void;
|
|
38
|
+
/**
|
|
39
|
+
* 拍摄元素位置、parentId 与受影响 Frame 的 children 快照
|
|
40
|
+
* @returns 包含位置、parentId 与 Frame children 的快照对象
|
|
41
|
+
*/
|
|
42
|
+
private _captureSnapshot;
|
|
43
|
+
/**
|
|
44
|
+
* 记录指定 Frame 的 children 副本到 target,已记录则跳过
|
|
45
|
+
* @param frameId Frame ID
|
|
46
|
+
* @param target 收集目标 Map
|
|
47
|
+
*/
|
|
48
|
+
private _recordFrameChildren;
|
|
49
|
+
/**
|
|
50
|
+
* 按快照还原元素 parentId、位置与受影响 Frame 的 children
|
|
51
|
+
* @param snapshot 要还原的快照对象
|
|
52
|
+
*/
|
|
53
|
+
private _restoreSnapshot;
|
|
54
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type FrameMoveOutCommandArgs = {
|
|
5
|
+
/** 要移出的元素 ID 列表 */
|
|
6
|
+
itemIds: string[];
|
|
7
|
+
/** 源 Frame ID(可选,不传则从元素当前 parentId 推断) */
|
|
8
|
+
frameId?: string;
|
|
9
|
+
itemService: ItemService;
|
|
10
|
+
store: Store;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* frame.moveOut - 将元素从 Frame 移出到主场景 Command
|
|
14
|
+
*
|
|
15
|
+
* execute: 调用 ItemService.moveItemsOutOfFrame(数据层 + Player 层 + transform 补偿)
|
|
16
|
+
* undo: 把元素移回各自原 Frame,并恢复 parentId / position / Frame.children
|
|
17
|
+
* redo: 重新移出
|
|
18
|
+
*/
|
|
19
|
+
export declare class FrameMoveOutCommand implements Command {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly commandId = "frame.moveOut";
|
|
22
|
+
private _itemIds;
|
|
23
|
+
private _frameId;
|
|
24
|
+
private _itemService;
|
|
25
|
+
private _store;
|
|
26
|
+
private _oldSnapshot;
|
|
27
|
+
/**
|
|
28
|
+
* 初始化移出 Frame 命令,保存目标元素与可选源 Frame
|
|
29
|
+
* @param args 元素 ID 列表、可选源 Frame ID 及依赖的 service/store
|
|
30
|
+
*/
|
|
31
|
+
constructor(args: FrameMoveOutCommandArgs);
|
|
32
|
+
/** 首次执行时拍摄快照并将指定元素移出 Frame 到主场景 */
|
|
33
|
+
execute(): void;
|
|
34
|
+
/** 将元素移回各自原 Frame,并恢复 parentId、位置与 Frame 的 children */
|
|
35
|
+
undo(): void;
|
|
36
|
+
/** 重新将元素移出 Frame */
|
|
37
|
+
redo(): void;
|
|
38
|
+
/**
|
|
39
|
+
* 拍摄元素位置、parentId 与源 Frame 的 children 快照
|
|
40
|
+
* @returns 包含 positions / parentIds / frameChildren 的快照对象
|
|
41
|
+
*/
|
|
42
|
+
private _captureSnapshot;
|
|
43
|
+
/**
|
|
44
|
+
* 记录指定 Frame 的 children 副本到 target,已记录则跳过
|
|
45
|
+
* @param frameId Frame ID
|
|
46
|
+
* @param target 收集目标 Map
|
|
47
|
+
*/
|
|
48
|
+
private _recordFrameChildren;
|
|
49
|
+
/**
|
|
50
|
+
* 按快照将元素移回原 Frame 并还原 parentId、位置与 Frame 的 children
|
|
51
|
+
* @param snapshot 移出前拍摄的快照
|
|
52
|
+
*/
|
|
53
|
+
private _restoreSnapshot;
|
|
54
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { Store } from '../../store';
|
|
4
|
+
export type GroupChildrenDetachCommandArgs = {
|
|
5
|
+
groupId: string;
|
|
6
|
+
itemIds: string[];
|
|
7
|
+
itemService: ItemService;
|
|
8
|
+
store: Store;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* 将 Group 的部分直属子元素分离到主场景根节点。
|
|
12
|
+
*
|
|
13
|
+
* execute/redo 通过 ItemService 同步修改 Store 与 Player;undo 恢复原始 children 顺序,
|
|
14
|
+
* reparent 前后都进行世界变换补偿。
|
|
15
|
+
*/
|
|
16
|
+
export declare class GroupChildrenDetachCommand implements Command {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly commandId = "group.detachChildren";
|
|
19
|
+
private readonly _groupId;
|
|
20
|
+
private readonly _itemIds;
|
|
21
|
+
private readonly _itemService;
|
|
22
|
+
private readonly _store;
|
|
23
|
+
private _oldChildren;
|
|
24
|
+
constructor(args: GroupChildrenDetachCommandArgs);
|
|
25
|
+
execute(): void;
|
|
26
|
+
undo(): void;
|
|
27
|
+
redo(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
export { CompositeCommand } from './composite-command';
|
|
2
|
+
export type { CompositeCommandArgs } from './composite-command';
|
|
3
|
+
export { ItemCreateCommand } from './item-create-command';
|
|
4
|
+
export type { ItemCreateCommandArgs } from './item-create-command';
|
|
5
|
+
export { ItemDeleteCommand } from './item-delete-command';
|
|
6
|
+
export type { ItemDeleteCommandArgs } from './item-delete-command';
|
|
7
|
+
export { ItemTransformCommand } from './item-transform-command';
|
|
8
|
+
export type { ItemTransformCommandArgs, TransformData } from './item-transform-command';
|
|
9
|
+
export { ItemUpdatePropertyCommand } from './item-update-property-command';
|
|
10
|
+
export type { ItemUpdatePropertyCommandArgs } from './item-update-property-command';
|
|
11
|
+
export { ItemReorderCommand, ReorderType } from './item-reorder-command';
|
|
12
|
+
export type { ItemReorderCommandArgs } from './item-reorder-command';
|
|
13
|
+
export { ItemGroupCommand } from './item-group-command';
|
|
14
|
+
export type { ItemGroupCommandArgs } from './item-group-command';
|
|
15
|
+
export { ItemUngroupCommand } from './item-ungroup-command';
|
|
16
|
+
export type { ItemUngroupCommandArgs } from './item-ungroup-command';
|
|
17
|
+
export { ItemAlignCommand } from './item-align-command';
|
|
18
|
+
export type { ItemAlignCommandArgs } from './item-align-command';
|
|
19
|
+
export { ItemDistributeCommand } from './item-distribute-command';
|
|
20
|
+
export type { ItemDistributeCommandArgs } from './item-distribute-command';
|
|
21
|
+
export { ItemUpdatePropertyBySchemaCommand } from './item-update-property-by-create-info-command';
|
|
22
|
+
export type { ItemUpdatePropertyBySchemaCommandArgs } from './item-update-property-by-create-info-command';
|
|
23
|
+
export { ItemSetFontFamilyCommand } from './item-set-font-family-command';
|
|
24
|
+
export type { ItemSetFontFamilyCommandArgs } from './item-set-font-family-command';
|
|
25
|
+
export { ItemSetGeneratorResourceCommand } from './item-set-generator-resource-command';
|
|
26
|
+
export type { ItemSetGeneratorResourceCommandArgs } from './item-set-generator-resource-command';
|
|
27
|
+
export { TransformMoveCommand } from './transform-move-command';
|
|
28
|
+
export type { TransformMoveCommandArgs } from './transform-move-command';
|
|
29
|
+
export { TransformScaleCommand } from './transform-scale-command';
|
|
30
|
+
export type { TransformScaleCommandArgs, ScaleSnapshot } from './transform-scale-command';
|
|
31
|
+
export { TransformRotateCommand } from './transform-rotate-command';
|
|
32
|
+
export type { TransformRotateCommandArgs, RotateSnapshot } from './transform-rotate-command';
|
|
33
|
+
export { TransformMoveWithLayoutCommand } from './transform-move-with-layout-command';
|
|
34
|
+
export type { TransformMoveWithLayoutCommandArgs } from './transform-move-with-layout-command';
|
|
35
|
+
export { TransformMoveWithFrameChangeCommand } from './transform-move-with-frame-change-command';
|
|
36
|
+
export type { TransformMoveWithFrameChangeCommandArgs, FrameChangeSnapshot } from './transform-move-with-frame-change-command';
|
|
37
|
+
export { GroupChildrenDetachCommand } from './group-children-detach-command';
|
|
38
|
+
export type { GroupChildrenDetachCommandArgs } from './group-children-detach-command';
|
|
39
|
+
export { TextMoveCommand } from './text-move-command';
|
|
40
|
+
export type { TextMoveCommandArgs } from './text-move-command';
|
|
41
|
+
export { TextScaleCommand } from './text-scale-command';
|
|
42
|
+
export type { TextScaleCommandArgs, TextScaleSnapshot } from './text-scale-command';
|
|
43
|
+
export { TextRotateCommand } from './text-rotate-command';
|
|
44
|
+
export type { TextRotateCommandArgs } from './text-rotate-command';
|
|
45
|
+
export { TextUpdateContentCommand } from './text-update-content-command';
|
|
46
|
+
export type { TextUpdateContentCommandArgs, TextContentData } from './text-update-content-command';
|
|
47
|
+
export { SelectionSetCommand } from './selection-set-command';
|
|
48
|
+
export type { SelectionSetCommandArgs } from './selection-set-command';
|
|
49
|
+
export { FrameMoveInCommand } from './frame-move-in-command';
|
|
50
|
+
export type { FrameMoveInCommandArgs } from './frame-move-in-command';
|
|
51
|
+
export { FrameMoveOutCommand } from './frame-move-out-command';
|
|
52
|
+
export type { FrameMoveOutCommandArgs } from './frame-move-out-command';
|
|
53
|
+
export { FrameLayoutCommand } from './frame-layout-command';
|
|
54
|
+
export type { FrameLayoutCommandArgs, LayoutOrderChange } from './frame-layout-command';
|
|
55
|
+
export { FrameLayoutModeCommand } from './frame-layout-mode-command';
|
|
56
|
+
export type { FrameLayoutModeCommandArgs } from './frame-layout-mode-command';
|
|
57
|
+
export { MaskCommitCommand } from './mask-commit-command';
|
|
58
|
+
export type { MaskCommitCommandArgs, MaskLine } from './mask-commit-command';
|
|
59
|
+
export { PictureCutCommitCommand } from './picture-cut-commit-command';
|
|
60
|
+
export type { PictureCutCommitCommandArgs, NormalizedBox } from './picture-cut-commit-command';
|
|
61
|
+
export { PictureExpandCommitCommand } from './picture-expand-commit-command';
|
|
62
|
+
export type { PictureExpandCommitCommandArgs } from './picture-expand-commit-command';
|
|
63
|
+
export { SpriteImageCommand } from './sprite-image-command';
|
|
64
|
+
export type { SpriteImageCommandArgs } from './sprite-image-command';
|
|
65
|
+
export { VideoSourceCommand } from './video-source-command';
|
|
66
|
+
export type { VideoSourceCommandArgs } from './video-source-command';
|
|
67
|
+
export { StateSwitchCommandBase } from './state-switch-command-base';
|
|
68
|
+
export { StateItemCreateCommand } from './state-item-create-command';
|
|
69
|
+
export type { StateItemCreateCommandArgs } from './state-item-create-command';
|
|
70
|
+
export { StateMoveCommand } from './state-move-command';
|
|
71
|
+
export type { StateMoveCommandArgs } from './state-move-command';
|
|
72
|
+
export { StateHandCommand } from './state-hand-command';
|
|
73
|
+
export type { StateHandCommandArgs } from './state-hand-command';
|
|
74
|
+
export { StateImageCutCommand } from './state-image-cut-command';
|
|
75
|
+
export type { StateImageCutCommandArgs } from './state-image-cut-command';
|
|
76
|
+
export { StateImageExpandCommand } from './state-image-expand-command';
|
|
77
|
+
export type { StateImageExpandCommandArgs } from './state-image-expand-command';
|
|
78
|
+
export { StateImageMaskCommand } from './state-image-mask-command';
|
|
79
|
+
export type { StateImageMaskCommandArgs } from './state-image-mask-command';
|
|
80
|
+
export { StateImageTextEditCommand } from './state-image-text-edit-command';
|
|
81
|
+
export type { StateImageTextEditCommandArgs } from './state-image-text-edit-command';
|
|
82
|
+
export { ItemReplaceSourceCommand } from './item-replace-source-command';
|
|
83
|
+
export type { ItemReplaceSourceCommandArgs } from './item-replace-source-command';
|
|
84
|
+
export { SpriteTextEditCommitCommand } from './sprite-text-edit-commit-command';
|
|
85
|
+
export type { SpriteTextEditCommitCommandArgs, SpriteTextInfo } from './sprite-text-edit-commit-command';
|
|
86
|
+
export { ViewportMoveCommand } from './viewport-move-command';
|
|
87
|
+
export type { ViewportMoveCommandArgs } from './viewport-move-command';
|
|
88
|
+
export { ViewportZoomCommand } from './viewport-zoom-command';
|
|
89
|
+
export type { ViewportZoomCommandArgs } from './viewport-zoom-command';
|
|
90
|
+
export { ViewportFitToBoxCommand } from './viewport-fit-to-box-command';
|
|
91
|
+
export type { ViewportFitToBoxCommandArgs } from './viewport-fit-to-box-command';
|
|
92
|
+
export { ViewportFitToItemsCommand } from './viewport-fit-to-items-command';
|
|
93
|
+
export type { ViewportFitToItemsCommandArgs } from './viewport-fit-to-items-command';
|
|
94
|
+
export { VideoPlayCommand } from './video-play-command';
|
|
95
|
+
export type { VideoPlayCommandArgs } from './video-play-command';
|
|
96
|
+
export { SceneSwitchCommand } from './scene-switch-command';
|
|
97
|
+
export { PageAutoLayoutCommand } from './page-auto-layout-command';
|
|
98
|
+
export type { PageAutoLayoutCommandArgs } from './page-auto-layout-command';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { AlignType } from '../../../utils/types';
|
|
4
|
+
export type ItemAlignCommandArgs = {
|
|
5
|
+
alignType: AlignType;
|
|
6
|
+
itemIds: string[];
|
|
7
|
+
itemService: ItemService;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* item.align - 多元素对齐 Command
|
|
11
|
+
*
|
|
12
|
+
* 以「选中元素的整体包围盒」为基准,将每个元素按对齐类型贴到整体包围盒的对应边或中线。
|
|
13
|
+
* 多个元素的位移聚合为同一条 Command —— 一次 undo 即可整体还原。
|
|
14
|
+
*
|
|
15
|
+
* execute: 计算并应用每个元素的新中心位置(首次执行时快照旧位置)
|
|
16
|
+
* undo: 批量还原到旧位置
|
|
17
|
+
* redo: 批量重新应用新位置
|
|
18
|
+
*/
|
|
19
|
+
export declare class ItemAlignCommand implements Command {
|
|
20
|
+
readonly id: string;
|
|
21
|
+
readonly commandId = "item.align";
|
|
22
|
+
private _alignType;
|
|
23
|
+
private _itemIds;
|
|
24
|
+
private _itemService;
|
|
25
|
+
/** 首次 execute 时快照的旧中心位置:itemId → [x, y] */
|
|
26
|
+
private _oldPositions;
|
|
27
|
+
/** 计算出的新中心位置:itemId → [x, y] */
|
|
28
|
+
private _newPositions;
|
|
29
|
+
/**
|
|
30
|
+
* 初始化对齐命令,保存对齐类型与目标元素列表
|
|
31
|
+
* @param args 对齐类型、元素 ID 列表及依赖的 service
|
|
32
|
+
*/
|
|
33
|
+
constructor(args: ItemAlignCommandArgs);
|
|
34
|
+
/** 元素数少于 2 时跳过;否则快照旧位置并按对齐类型应用新位置 */
|
|
35
|
+
execute(): void;
|
|
36
|
+
/** 应用旧位置快照,整体还原对齐前状态 */
|
|
37
|
+
undo(): void;
|
|
38
|
+
/** 重新应用对齐后的位置 */
|
|
39
|
+
redo(): void;
|
|
40
|
+
/**
|
|
41
|
+
* 采集各元素当前中心位置快照
|
|
42
|
+
* @returns 元素 ID 到当前中心位置 [x, y] 的映射;缺失元素被跳过
|
|
43
|
+
*/
|
|
44
|
+
private _snapshotCurrentPositions;
|
|
45
|
+
/** 收集所有非空像素包围盒的元素列表 */
|
|
46
|
+
private _collectItemBoxes;
|
|
47
|
+
/**
|
|
48
|
+
* 批量应用元素中心位置
|
|
49
|
+
* @param positions 元素 ID 到位置的映射
|
|
50
|
+
*/
|
|
51
|
+
private _applyPositions;
|
|
52
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { ItemSchema } from '../../types';
|
|
4
|
+
export type ItemCreateCommandArgs = {
|
|
5
|
+
/** 单个或多个 schema */
|
|
6
|
+
schemas: ItemSchema | ItemSchema[];
|
|
7
|
+
itemService: ItemService;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* item.create - 创建元素 Command(支持单个/批量「先子后父」拓扑序创建)
|
|
11
|
+
*
|
|
12
|
+
* execute: 按拓扑序(先子后父)创建元素,同步捕获真实 id;_createdIds 按输入顺序回填
|
|
13
|
+
* undo: 删除所有已创建的元素
|
|
14
|
+
* redo: 重新创建所有元素,同步重捕真实 id
|
|
15
|
+
*
|
|
16
|
+
* id 契约(B + ii):真实 id 由 {@link ItemService.createItemCore} 经身份策略决定——
|
|
17
|
+
* Artis 下 id=schemaId(固定),SceneArtis 下 id=instanceId(每次重建会变)。
|
|
18
|
+
* 故 _createdIds 在 execute/redo 同步重捕,undo 用最近一次捕获的真实 id 删除。
|
|
19
|
+
* 同步捕获是 ArtisSDK._createByInfo(execute 后即取 createdIds[0] 同步返回)的前提。
|
|
20
|
+
*
|
|
21
|
+
* 拓扑序(D9):批量创建时,容器(GROUP/FRAME)创建会按其 property.children 主动挂载子元素,
|
|
22
|
+
* 故 children 必须先于容器创建。构造期按 schemas 间的 children 引用算稳定的拓扑序 buildOrder,
|
|
23
|
+
* execute/redo 按 buildOrder 创建;_createdIds 仍按输入顺序回填,保证 createdIds getter 与入参
|
|
24
|
+
* schemas 逐项一一对应(SDK 与新调用方依赖此契约)。出现父子循环依赖时构造期直接抛错——
|
|
25
|
+
* 此时 execute 未执行,无副作用、无需回滚,与既有 assertElementIdUnique「构造期失败」策略一致。
|
|
26
|
+
*/
|
|
27
|
+
export declare class ItemCreateCommand implements Command {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly commandId = "item.create";
|
|
30
|
+
private _schemas;
|
|
31
|
+
private _itemService;
|
|
32
|
+
private _createdIds;
|
|
33
|
+
/** 构造期算出的「先子后父」拓扑执行序(元素为 schemas 输入下标) */
|
|
34
|
+
private _buildOrder;
|
|
35
|
+
private _resourcePromises;
|
|
36
|
+
/**
|
|
37
|
+
* 初始化创建命令,规范化 schemas 为数组、预生成种子 ID、查重,并算出拓扑执行序
|
|
38
|
+
* @param args 单个/多个 schema 及依赖的 service
|
|
39
|
+
*/
|
|
40
|
+
constructor(args: ItemCreateCommandArgs);
|
|
41
|
+
/** 按拓扑序创建所有元素,_createdIds 按输入顺序回填;同步收集 resourcePromise 供门面 await */
|
|
42
|
+
execute(): void;
|
|
43
|
+
/** 逆序删除所有已创建的元素(用最近一次捕获的真实 id) */
|
|
44
|
+
undo(): void;
|
|
45
|
+
/** 重新创建所有元素,同步重捕真实 id(SceneArtis 下 instanceId 会变,需重捕维系 undo 链);重捕 resourcePromise */
|
|
46
|
+
redo(): void;
|
|
47
|
+
/**
|
|
48
|
+
* 更新拖拽创建中的同一个元素,并把最终 schema 保存在本 Command 中供 undo/redo 使用。
|
|
49
|
+
* 仅支持 Gizmo 固定宽度 Text 的实时创建;元素 ID 在整个交互内保持不变。
|
|
50
|
+
* @param schema 当前拖拽几何对应的完整 schema
|
|
51
|
+
*/
|
|
52
|
+
updateInteractive(schema: ItemSchema): void;
|
|
53
|
+
/** 交互更新后由入史咽喉读取,确保错误复现记录使用最终 schema 而不是首帧尺寸。 */
|
|
54
|
+
serializeReplay(): {
|
|
55
|
+
args: ItemCreateCommandArgs;
|
|
56
|
+
replayable: true;
|
|
57
|
+
};
|
|
58
|
+
/** 获取本次创建的所有元素 ID(最近一次 execute/redo 捕获的真实 id,与入参 schemas 逐项对应) */
|
|
59
|
+
get createdIds(): string[];
|
|
60
|
+
/** 获取拓扑执行序(输入下标数组,先子后父)—供测试/调试观察 */
|
|
61
|
+
get buildOrder(): number[];
|
|
62
|
+
/** 获取本次创建的异步资源加载 promise(供上层门面 await,对齐 master「创建即资源就绪」语义) */
|
|
63
|
+
get resourcePromises(): Promise<void>[];
|
|
64
|
+
/** 异步资源失败回流 artis.error,同时保留原 Promise 的 rejection 供显式 await 的调用方处理。 */
|
|
65
|
+
private _trackResourcePromise;
|
|
66
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Command } from '../types';
|
|
2
|
+
import { type ItemService } from '../../service';
|
|
3
|
+
import { type Store } from '../../store';
|
|
4
|
+
export type ItemDeleteCommandArgs = {
|
|
5
|
+
itemId: string;
|
|
6
|
+
itemService: ItemService;
|
|
7
|
+
store: Store;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* item.delete - 删除元素 Command
|
|
11
|
+
*
|
|
12
|
+
* execute: 删除元素(保存快照用于恢复)
|
|
13
|
+
* undo: 恢复元素
|
|
14
|
+
* redo: 再次删除
|
|
15
|
+
*/
|
|
16
|
+
export declare class ItemDeleteCommand implements Command {
|
|
17
|
+
readonly id: string;
|
|
18
|
+
readonly commandId = "item.delete";
|
|
19
|
+
private _itemId;
|
|
20
|
+
private _itemService;
|
|
21
|
+
private _store;
|
|
22
|
+
private _schemaSnapshot;
|
|
23
|
+
/**
|
|
24
|
+
* 初始化删除命令,保存目标元素 ID 与依赖项
|
|
25
|
+
* @param args 元素 ID 及依赖的 service/store
|
|
26
|
+
*/
|
|
27
|
+
constructor(args: ItemDeleteCommandArgs);
|
|
28
|
+
/** 拍摄元素 schema 快照后删除元素 */
|
|
29
|
+
execute(): void;
|
|
30
|
+
/** 基于快照重新创建被删除的元素,同步重捕真实 id(SceneArtis 下 instanceId 会变) */
|
|
31
|
+
undo(): void;
|
|
32
|
+
/** 再次删除该元素 */
|
|
33
|
+
redo(): void;
|
|
34
|
+
/**
|
|
35
|
+
* 将 ArtisItem 实例序列化为可重建的 ItemSchema 快照
|
|
36
|
+
* @param item 待序列化的元素
|
|
37
|
+
* @returns 元素 schema
|
|
38
|
+
*/
|
|
39
|
+
private itemToSchema;
|
|
40
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
import type { DistributeType } from '../../../utils/types';
|
|
4
|
+
export type ItemDistributeCommandArgs = {
|
|
5
|
+
distributeType: DistributeType;
|
|
6
|
+
itemIds: string[];
|
|
7
|
+
itemService: ItemService;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* item.distribute - 多元素等间距分布 Command
|
|
11
|
+
*
|
|
12
|
+
* 沿分布方向按元素中心排序,固定首尾两个元素,将中间元素的中心点等间距铺开。
|
|
13
|
+
* 至少需要 3 个元素才有意义;不足 3 个时不做任何处理。
|
|
14
|
+
* 多个元素的位移聚合为同一条 Command —— 一次 undo 即可整体还原。
|
|
15
|
+
*
|
|
16
|
+
* execute: 计算并应用每个元素的新中心位置(首次执行时快照旧位置)
|
|
17
|
+
* undo: 批量还原到旧位置
|
|
18
|
+
* redo: 批量重新应用新位置
|
|
19
|
+
*/
|
|
20
|
+
export declare class ItemDistributeCommand implements Command {
|
|
21
|
+
readonly id: string;
|
|
22
|
+
readonly commandId = "item.distribute";
|
|
23
|
+
private _distributeType;
|
|
24
|
+
private _itemIds;
|
|
25
|
+
private _itemService;
|
|
26
|
+
/** 首次 execute 时快照的旧中心位置:itemId → [x, y] */
|
|
27
|
+
private _oldPositions;
|
|
28
|
+
/** 计算出的新中心位置:itemId → [x, y] */
|
|
29
|
+
private _newPositions;
|
|
30
|
+
/**
|
|
31
|
+
* 初始化分布命令,保存分布类型与目标元素列表
|
|
32
|
+
* @param args 分布类型、元素 ID 列表及依赖的 service
|
|
33
|
+
*/
|
|
34
|
+
constructor(args: ItemDistributeCommandArgs);
|
|
35
|
+
/** 元素数少于 3 时跳过;否则快照旧位置并按分布类型应用新位置 */
|
|
36
|
+
execute(): void;
|
|
37
|
+
/** 应用旧位置快照,整体还原分布前状态 */
|
|
38
|
+
undo(): void;
|
|
39
|
+
/** 重新应用分布后的位置 */
|
|
40
|
+
redo(): void;
|
|
41
|
+
/**
|
|
42
|
+
* 采集各元素当前中心位置快照
|
|
43
|
+
* @returns 元素 ID 到当前中心位置 [x, y] 的映射
|
|
44
|
+
*/
|
|
45
|
+
private _snapshotCurrentPositions;
|
|
46
|
+
/** 收集所有非空包围盒元素的 ID 与中心点 */
|
|
47
|
+
private _collectItemCenters;
|
|
48
|
+
/**
|
|
49
|
+
* 批量应用元素中心位置
|
|
50
|
+
* @param positions 元素 ID 到位置的映射
|
|
51
|
+
*/
|
|
52
|
+
private _applyPositions;
|
|
53
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Command } from '../types';
|
|
2
|
+
import type { ItemService } from '../../service';
|
|
3
|
+
export type ItemGroupCommandArgs = {
|
|
4
|
+
childrenIds: string[];
|
|
5
|
+
itemService: ItemService;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* item.group - 打组 Command
|
|
9
|
+
*
|
|
10
|
+
* execute: 创建 Group 元素,将选中元素作为 children
|
|
11
|
+
* undo: 删除 Group 元素
|
|
12
|
+
* redo: 重新创建 Group
|
|
13
|
+
*
|
|
14
|
+
* id 契约(B + ii):execute/redo 用 createItemCore 同步捕获真实 id 写回 _groupId。
|
|
15
|
+
* Artis 下 id=schemaId(固定);SceneArtis 下 id=instanceId(每次重建会变,需重捕维系 undo 链)。
|
|
16
|
+
*/
|
|
17
|
+
export declare class ItemGroupCommand implements Command {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly commandId = "item.group";
|
|
20
|
+
private _childrenIds;
|
|
21
|
+
private _itemService;
|
|
22
|
+
private _groupId;
|
|
23
|
+
/**
|
|
24
|
+
* 构造打组 Command
|
|
25
|
+
* @param args 包含待打组子元素 ID 列表与 ItemService
|
|
26
|
+
*/
|
|
27
|
+
constructor(args: ItemGroupCommandArgs);
|
|
28
|
+
/** 创建 Group 元素并将选中元素挂为 children,同步捕获真实 id */
|
|
29
|
+
execute(): void;
|
|
30
|
+
/** 撤销打组:删除已创建的 Group 元素 */
|
|
31
|
+
undo(): void;
|
|
32
|
+
/** 重做:复用上次 id 作种子重新创建 Group 元素,同步重捕真实 id */
|
|
33
|
+
redo(): void;
|
|
34
|
+
/**
|
|
35
|
+
* 按子元素像素包围盒并集中心确定新组位置(替代硬编码 [540,960])。
|
|
36
|
+
* 子元素无有效盒(全空节点)时回退默认位置。组为空节点,位置仅作 origin,
|
|
37
|
+
* 子元素最终落点由 createGroupItem 的世界 transform 烘焙保证。
|
|
38
|
+
* @returns 组像素位置 [x, y]
|
|
39
|
+
*/
|
|
40
|
+
private _resolveGroupPosition;
|
|
41
|
+
}
|