2025-11-27 20:42:46 +08:00
|
|
|
import { CommandManager } from '@esengine/editor-runtime';
|
2025-11-03 21:22:16 +08:00
|
|
|
import { RemoveConnectionCommand } from '../commands/tree/RemoveConnectionCommand';
|
|
|
|
|
import { ITreeState } from '../commands/ITreeState';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 移除连接用例
|
|
|
|
|
*/
|
|
|
|
|
export class RemoveConnectionUseCase {
|
|
|
|
|
constructor(
|
|
|
|
|
private readonly commandManager: CommandManager,
|
|
|
|
|
private readonly treeState: ITreeState
|
|
|
|
|
) {}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 执行移除连接操作
|
|
|
|
|
*/
|
|
|
|
|
execute(from: string, to: string, fromProperty?: string, toProperty?: string): void {
|
|
|
|
|
const command = new RemoveConnectionCommand(
|
|
|
|
|
this.treeState,
|
|
|
|
|
from,
|
|
|
|
|
to,
|
|
|
|
|
fromProperty,
|
|
|
|
|
toProperty
|
|
|
|
|
);
|
|
|
|
|
this.commandManager.execute(command);
|
|
|
|
|
}
|
|
|
|
|
}
|