Files
bim_engine/src/managers/walk-path-dialog-manager.ts

68 lines
2.0 KiB
TypeScript
Raw Normal View History

/**
*
*
*/
import { BaseDialogManager } from '../core/base-dialog-manager';
2025-12-25 15:47:57 +08:00
import { WalkPathPanel } from '../components/walk-path-panel';
/**
*
* BaseDialogManager
2025-12-25 15:47:57 +08:00
*/
export class WalkPathDialogManager extends BaseDialogManager {
/** 漫游路径面板实例 */
2025-12-25 15:47:57 +08:00
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; }
2025-12-25 15:47:57 +08:00
/** 初始化 */
public init(): void {}
2025-12-25 15:47:57 +08:00
/**
*
*
2025-12-25 15:47:57 +08:00
*/
protected getDialogPosition() {
const container = this.registry.container;
if (!container) return { x: 100, y: 100 };
2025-12-25 15:47:57 +08:00
const paddingRight = 20;
const containerWidth = container.clientWidth;
const containerHeight = container.clientHeight;
2025-12-25 15:47:57 +08:00
return {
x: containerWidth - this.dialogWidth - paddingRight,
y: (containerHeight - this.dialogHeight) / 2
};
2025-12-25 15:47:57 +08:00
}
/** 创建对话框内容 */
protected createContent(): HTMLElement {
this.panel = new WalkPathPanel();
this.panel.init();
return this.panel.element;
2025-12-25 15:47:57 +08:00
}
/** 对话框关闭时的回调 */
protected onDialogClose(): void {
if (this.registry.walkControl && this.registry.walkControl.panel) {
this.registry.walkControl.panel.setPathModeActive(false);
2025-12-25 15:47:57 +08:00
}
}
2025-12-25 15:47:57 +08:00
/** 销毁前的清理 */
protected onBeforeDestroy(): void {
2025-12-25 15:47:57 +08:00
if (this.panel) {
this.panel.destroy();
this.panel = null;
}
}
}