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:
yuding
2026-01-15 14:13:13 +08:00
parent cd1f8186d0
commit f6257f5162
101 changed files with 31269 additions and 29937 deletions

100
demo/DEPLOY.md Normal file
View File

@@ -0,0 +1,100 @@
# Demo 部署指南
## 问题说明
部署后出现 `404: Not Found` 错误,找不到 `/static/js/draco/draco_wasm_wrapper.js` 等文件。
这是因为 3D 模型使用了 Draco 压缩,需要 Draco 解码器文件。
## 解决方案
### 需要部署的文件结构
```
demo/
├── index.html
├── viewer.html
├── lib/
│ ├── bim-engine-sdk.umd.js
│ └── bim-engine-sdk.umd.js.map
├── static/
│ └── js/
│ └── draco/
│ ├── draco_decoder.js
│ ├── draco_decoder.wasm
│ ├── draco_encoder.js
│ ├── draco_wasm_wrapper.js
│ └── DRACOLoader.js
└── model/
└── test2/
└── (模型文件)
```
### 自动复制文件
在项目根目录执行:
```bash
# 方法1: 复制所有文件(推荐)
npm run copy:demo-all
# 方法2: 分步复制
npm run copy:demo # 复制 SDK 文件
npm run copy:demo-draco # 复制 Draco 文件
```
在 demo 目录执行:
```bash
npm run copy-all # 复制 SDK 和 Draco 文件
```
### 手动部署步骤
如果自动脚本不可用,手动复制以下文件到服务器:
1. **必需文件**:
- `index.html``viewer.html`
- `lib/bim-engine-sdk.umd.js`
- `static/js/draco/` 目录下的所有文件
2. **可选文件**:
- `lib/bim-engine-sdk.umd.js.map` (用于调试)
- `model/` 目录 (如果加载本地模型)
### Nginx 配置示例
```nginx
server {
listen 80;
server_name your-domain.com;
root /var/www/demo;
index index.html viewer.html;
location / {
try_files $uri $uri/ /index.html;
}
# 确保 draco 文件可访问
location /static/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
```
## 验证部署
部署后访问以下 URL 确认文件存在:
- `http://your-domain.com/static/js/draco/draco_wasm_wrapper.js`
- `http://your-domain.com/static/js/draco/draco_decoder.wasm`
如果返回 404,说明文件未正确部署。
## 注意事项
1. **路径硬编码**: Draco 路径在 SDK 中硬编码为 `/static/js/draco/`,请勿修改目录结构
2. **WASM 文件**: 确保 `.wasm` 文件的 MIME 类型正确配置为 `application/wasm`
3. **跨域问题**: 如果 draco 文件在不同域名,需要配置 CORS