2025-12-04 15:24:44 +08:00
|
|
|
|
import { BimButtonGroup } from '../index';
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 底部工具栏 (Toolbar)
|
|
|
|
|
|
* BimButtonGroup 的子类,专门用于加载工具栏默认按钮。
|
|
|
|
|
|
*/
|
|
|
|
|
|
export class Toolbar extends BimButtonGroup {
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 重写初始化,加载默认按钮
|
|
|
|
|
|
*/
|
|
|
|
|
|
public async init(): Promise<void> {
|
|
|
|
|
|
await super.init();
|
|
|
|
|
|
|
|
|
|
|
|
// 动态加载默认按钮配置
|
2025-12-08 10:02:24 +08:00
|
|
|
|
const { createHomeButton } = await import('./buttons/home');
|
2025-12-24 19:02:34 +08:00
|
|
|
|
const { createZoomBoxButton } = await import('./buttons/zoom-box');
|
|
|
|
|
|
const { createWalkMenuButton } = await import('./buttons/walk/walk-menu');
|
2025-12-25 15:47:57 +08:00
|
|
|
|
const { createMapButton } = await import('./buttons/map');
|
|
|
|
|
|
const { createPropertyButton } = await import('./buttons/property');
|
2025-12-24 19:02:34 +08:00
|
|
|
|
const { createSettingButton } = await import('./buttons/setting');
|
|
|
|
|
|
const { createInfoButton } = await import('./buttons/info');
|
2025-12-25 15:47:57 +08:00
|
|
|
|
const { createFullscreenButton } = await import('./buttons/fullscreen');
|
2025-12-22 18:48:38 +08:00
|
|
|
|
const { createMeasureButton } = await import('./buttons/measure');
|
2025-12-24 19:02:34 +08:00
|
|
|
|
const { createSectionMenuButton } = await import('./buttons/section/section-menu');
|
|
|
|
|
|
const { createSectionPlaneButton } = await import('./buttons/section/section-plane');
|
|
|
|
|
|
const { createSectionAxisButton } = await import('./buttons/section/section-axis');
|
|
|
|
|
|
const { createSectionBoxButton } = await import('./buttons/section/section-box');
|
2025-12-04 15:24:44 +08:00
|
|
|
|
|
|
|
|
|
|
this.addGroup('group-1');
|
2025-12-08 10:02:24 +08:00
|
|
|
|
|
|
|
|
|
|
// 使用工厂函数创建按钮,并注入 engine
|
|
|
|
|
|
if (this.engine) {
|
|
|
|
|
|
this.addButton(createHomeButton(this.engine));
|
2025-12-24 19:02:34 +08:00
|
|
|
|
// 你要求:在"首页"后面添加"选框放大"
|
|
|
|
|
|
this.addButton(createZoomBoxButton(this.engine));
|
2025-12-22 18:48:38 +08:00
|
|
|
|
this.addButton(createMeasureButton(this.engine));
|
2025-12-24 19:02:34 +08:00
|
|
|
|
this.addButton(createSectionMenuButton(this.engine));
|
|
|
|
|
|
this.addButton(createSectionPlaneButton(this.engine));
|
|
|
|
|
|
this.addButton(createSectionAxisButton(this.engine));
|
|
|
|
|
|
this.addButton(createSectionBoxButton(this.engine));
|
|
|
|
|
|
this.addButton(createWalkMenuButton(this.engine));
|
2025-12-25 15:47:57 +08:00
|
|
|
|
this.addButton(createMapButton(this.engine));
|
|
|
|
|
|
this.addButton(createPropertyButton(this.engine));
|
2025-12-24 19:02:34 +08:00
|
|
|
|
this.addGroup('group-2');
|
|
|
|
|
|
this.addButton(createSettingButton(this.engine));
|
|
|
|
|
|
this.addButton(createInfoButton(this.engine));
|
2025-12-25 15:47:57 +08:00
|
|
|
|
this.addButton(createFullscreenButton(this.engine));
|
2025-12-08 10:02:24 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
console.warn('[Toolbar] Engine not available when creating buttons.');
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-04 15:24:44 +08:00
|
|
|
|
this.render();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|