UNPKG

@turbox3d/command-manager

Version:

Large-scale productivity application command management library

31 lines (30 loc) 1.32 kB
import { ViewEntity, SceneEvent, EventType } from '@turbox3d/event-manager'; import { CommandManager } from './CommandManager'; import { Interaction } from './Interaction'; import { SceneTool } from './type'; export declare abstract class Command extends Interaction { protected holder: CommandManager; private parent?; protected $children: { [key: string]: Command; }; private activeChildren; constructor(holder: CommandManager, parent?: Command | undefined); /** * 应用当前 Command 及其子级,该方法不仅会强制激活当前 Command 及其子级,还会使它们的交互事件生效 * 同时只能有一个 Command 节点处于应用状态(兄弟节点的交互事件是互斥的) * 永远不用重写该方法,相关初始化逻辑请在 active 接口中编码 */ apply(...args: any[]): void; /** * 激活当前 Command 及其子级,为即将到来的交互事件做好准备 */ active(...args: any[]): void; /** * 注销当前 Command 及其子级,同时将停止响应该指令及子级的交互事件 */ dispose(...args: any[]): void; distributeEvent(eventType: EventType, ev: ViewEntity, event: SceneEvent, tools: SceneTool): void; private onChildActive; private onChildDispose; }