2025-11-18 14:46:51 +08:00
|
|
|
import { CommandManager } from '@esengine/editor-core';
|
2025-11-03 21:22:16 +08:00
|
|
|
import { UpdateNodeDataCommand } from '../commands/tree/UpdateNodeDataCommand';
|
|
|
|
|
import { ITreeState } from '../commands/ITreeState';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新节点数据用例
|
|
|
|
|
*/
|
|
|
|
|
export class UpdateNodeDataUseCase {
|
|
|
|
|
constructor(
|
|
|
|
|
private readonly commandManager: CommandManager,
|
|
|
|
|
private readonly treeState: ITreeState
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新节点数据
|
|
|
|
|
*/
|
|
|
|
|
execute(nodeId: string, data: Record<string, unknown>): void {
|
|
|
|
|
const command = new UpdateNodeDataCommand(this.treeState, nodeId, data);
|
|
|
|
|
this.commandManager.execute(command);
|
|
|
|
|
}
|
|
|
|
|
}
|