refactor: sync managers and section box actions
Wire section box scale/reverse/reset to clipping APIs and sync demo artifacts.
This commit is contained in:
@@ -1,41 +1,18 @@
|
||||
/**
|
||||
* 对话框管理器
|
||||
* 负责创建和管理所有对话框实例
|
||||
*/
|
||||
import { BimDialog } from '../components/dialog';
|
||||
import { BimInfoDialog } from '../components/dialog/bimInfoDialog';
|
||||
import type { DialogOptions } from '../components/dialog/index.type';
|
||||
import type { ThemeConfig } from '../themes/types';
|
||||
import { themeManager } from '../services/theme';
|
||||
import { BaseManager } from '../core/base-manager';
|
||||
|
||||
/**
|
||||
* 对话框管理器
|
||||
* 统一管理对话框的创建、主题更新和销毁
|
||||
*/
|
||||
export class DialogManager extends BaseManager {
|
||||
/** 容器元素 */
|
||||
private container: HTMLElement;
|
||||
/** 活跃的对话框列表 */
|
||||
private activeDialogs: BimDialog[] = [];
|
||||
|
||||
constructor(container: HTMLElement) {
|
||||
super();
|
||||
this.container = container;
|
||||
|
||||
this.subscribe('ui:open-dialog', (payload) => {
|
||||
console.log('[DialogManager] Received open-dialog event:', payload);
|
||||
if (payload.id === 'info') {
|
||||
this.showInfoDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建对话框
|
||||
* @param options 对话框配置选项
|
||||
* @returns 对话框实例
|
||||
*/
|
||||
public create(options: Omit<DialogOptions, 'container'>): BimDialog {
|
||||
const dialog = new BimDialog({
|
||||
container: this.container,
|
||||
@@ -51,15 +28,6 @@ export class DialogManager extends BaseManager {
|
||||
return dialog;
|
||||
}
|
||||
|
||||
/** 显示信息对话框 */
|
||||
public showInfoDialog() {
|
||||
new BimInfoDialog(this.container);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新所有对话框的主题
|
||||
* @param theme 主题配置
|
||||
*/
|
||||
public updateTheme(theme: ThemeConfig) {
|
||||
this.activeDialogs.forEach(dialog => {
|
||||
if (dialog.setTheme) {
|
||||
@@ -68,7 +36,6 @@ export class DialogManager extends BaseManager {
|
||||
});
|
||||
}
|
||||
|
||||
/** 销毁管理器和所有对话框 */
|
||||
public destroy() {
|
||||
this.activeDialogs.forEach(d => d.destroy());
|
||||
this.activeDialogs = [];
|
||||
|
||||
Reference in New Issue
Block a user