feat: 优化测量功能架构与引擎组件
- 重构测量激活逻辑,在 Engine 组件中添加统一的 activateMeasure(mode) 方法 - 简化 MeasureDialogManager,移除冗余的 handleMeasureTypeChange 方法 - 添加 EngineManager.activateMeasure 转发方法 - 修复 loadModel 错误,正确调用 Engine 组件方法 - 为 Engine 组件设置固定背景渐变色 - MeasurePanel 初始化时触发 onModeChange 回调 - 添加 MeasureMode 共享类型定义 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {BimComponent} from '../core/component';
|
||||
import {BimEngine} from '../bim-engine';
|
||||
import {BimDialog} from "../components/dialog";
|
||||
import { BimComponent } from '../core/component';
|
||||
import { BimEngine } from '../bim-engine';
|
||||
import { BimDialog } from "../components/dialog";
|
||||
import { MeasurePanel } from '../components/measure-panel';
|
||||
import type { MeasureConfig, MeasureMode, MeasureResult } from '../components/measure-panel/types';
|
||||
|
||||
@@ -47,12 +47,11 @@ export class MeasureDialogManager extends BimComponent {
|
||||
|
||||
// 创建测量面板(只做 UI,不实现真实测量)
|
||||
this.panel = new MeasurePanel({
|
||||
defaultMode: 'distance', // 默认展示前四个,且默认选中“距离”
|
||||
defaultMode: 'distance', // 默认展示前四个,且默认选中"距离"
|
||||
defaultExpanded: false,
|
||||
onModeChange: (mode) => {
|
||||
// 这里只做事件/占位:未来可在这里切换引擎内置工具
|
||||
// 本次需求不实现真实测量,因此仅保留回调位置
|
||||
console.log('[MeasureDialogManager] 当前测量方式已切换:', mode);
|
||||
this.engine.engine?.activateMeasure(mode);
|
||||
},
|
||||
onClearAll: () => {
|
||||
// 预留:未来可清理引擎测量绘制/标注
|
||||
@@ -90,6 +89,7 @@ export class MeasureDialogManager extends BimComponent {
|
||||
},
|
||||
onClose: () => {
|
||||
this.engine.toolbar?.setBtnActive('measure', false)
|
||||
this.destroy()
|
||||
}
|
||||
});
|
||||
this.dialog.init();
|
||||
@@ -183,6 +183,11 @@ export class MeasureDialogManager extends BimComponent {
|
||||
}
|
||||
|
||||
public destroy(): void {
|
||||
// 停用测量功能
|
||||
if (this.engine.engine) {
|
||||
this.engine.engine.deactivateMeasure();
|
||||
}
|
||||
|
||||
// 关闭弹窗
|
||||
if (this.dialog) {
|
||||
this.dialog.destroy();
|
||||
|
||||
Reference in New Issue
Block a user