Files
bim_engine/src/managers/walk-path-dialog-manager.ts
yuding 73edf0b3b8 refactor(managers): accept registry parameter via constructor injection
All 16 managers now receive ManagerRegistry instance through constructor
instead of calling ManagerRegistry.getInstance(). This enables each
BimEngine instance to have its own isolated set of managers.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-02-28 10:08:36 +08:00

73 lines
2.1 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 { ManagerRegistry } from '../core/manager-registry';
import { WalkPathPanel } from '../components/walk-path-panel';
/**
* 漫游路径对话框管理器
* 继承自 BaseDialogManager提供漫游路径配置的对话框管理功能
*/
export class WalkPathDialogManager extends BaseDialogManager {
/** 漫游路径面板实例 */
private panel: WalkPathPanel | null = null;
constructor(registry: ManagerRegistry) {
super(registry);
}
/** 对话框唯一标识 */
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 450; }
/** 初始化 */
public init(): void {}
/**
* 获取对话框位置
* 定位在容器右上角
*/
protected getDialogPosition() {
const container = this.registry.container;
if (!container) return { x: 100, y: 100 };
const paddingRight = 20;
const paddingTop = 20;
const containerWidth = container.clientWidth;
return {
x: containerWidth - this.dialogWidth - paddingRight,
y: paddingTop
};
}
/** 创建对话框内容 */
protected createContent(): HTMLElement {
this.panel = new WalkPathPanel(this.registry);
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;
}
}
}