Files
bim_engine/src/managers/walk-path-dialog-manager.ts
yuding 31b60e84ce refactor: 重构 Manager 架构,引入 ManagerRegistry 和 BaseManager 基类
- 新增 ManagerRegistry 单例注册表,统一管理所有 Manager 实例
- 新增 BaseManager 基类,自动管理事件订阅清理
- 新增 BaseDialogManager 基类,统一对话框生命周期管理
- 重构 15 个 Manager 使用新基类
- 重构 Toolbar 按钮和 Menu 按钮移除 engine 参数依赖
- 删除 BimComponent 基类(已不再使用)
- 为所有 Manager 和核心模块添加中文 JSDoc 注释
2026-01-22 15:23:57 +08:00

68 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 漫游路径对话框管理器
* 负责管理漫游路径设置对话框的显示和交互
*/
import { BaseDialogManager } from '../core/base-dialog-manager';
import { WalkPathPanel } from '../components/walk-path-panel';
/**
* 漫游路径对话框管理器
* 继承自 BaseDialogManager提供漫游路径配置的对话框管理功能
*/
export class WalkPathDialogManager extends BaseDialogManager {
/** 漫游路径面板实例 */
private panel: WalkPathPanel | null = null;
/** 对话框唯一标识 */
protected get dialogId() { return 'walk-path-dialog'; }
/** 对话框标题(国际化 key */
protected get dialogTitle() { return 'walkControl.path.dialogTitle'; }
/** 对话框宽度 */
protected get dialogWidth() { return 300; }
/** 对话框高度 */
protected get dialogHeight(): number { return 400; }
/** 初始化 */
public init(): void {}
/**
* 获取对话框位置
* 定位在容器右侧居中
*/
protected getDialogPosition() {
const container = this.registry.container;
if (!container) return { x: 100, y: 100 };
const paddingRight = 20;
const containerWidth = container.clientWidth;
const containerHeight = container.clientHeight;
return {
x: containerWidth - this.dialogWidth - paddingRight,
y: (containerHeight - this.dialogHeight) / 2
};
}
/** 创建对话框内容 */
protected createContent(): HTMLElement {
this.panel = new WalkPathPanel();
this.panel.init();
return this.panel.element;
}
/** 对话框关闭时的回调 */
protected onDialogClose(): void {
if (this.registry.walkControl && this.registry.walkControl.panel) {
this.registry.walkControl.panel.setPathModeActive(false);
}
}
/** 销毁前的清理 */
protected onBeforeDestroy(): void {
if (this.panel) {
this.panel.destroy();
this.panel = null;
}
}
}