refactor(measure): centralize measure type config and migrate API
- Add unified MEASURE_TYPES config in types/measure.ts - Export MEASURE_MODES_ORDERED, ENGINE_TYPE_TO_MODE, MODE_TO_ENGINE_TYPE - Refactor measure-dialog-manager to use centralized config - Refactor measure-panel to use MEASURE_TYPES for icons/order/valueType - Simplify engine/index.ts measureMap with dynamic key access - Add measure settings API (saveMeasureSetting) with cache sync - Add direct engine event listening for measure-changed and section-move - Update i18n keys for 8 measure modes
This commit is contained in:
@@ -6,6 +6,7 @@ import { Engine, type EngineOptions, type ModelLoadOptions } from '../components
|
||||
import { BaseManager } from '../core/base-manager';
|
||||
import { RightKeyManager } from './right-key-manager';
|
||||
import type { MeasureMode } from '../types/measure';
|
||||
import type { MeasureUnit, MeasurePrecision } from '../components/measure-panel/types';
|
||||
import type { SectionBoxRange } from '../components/section-box-panel/types';
|
||||
import type { MenuItemConfig } from '../components/menu/item';
|
||||
import { ManagerRegistry } from '../core/manager-registry';
|
||||
@@ -246,7 +247,6 @@ export class EngineManager extends BaseManager {
|
||||
return this.engineInstance.getCurrentMeasureType();
|
||||
}
|
||||
|
||||
/** 清除所有测量标注 */
|
||||
public clearAllMeasures(): void {
|
||||
if (!this.engineInstance) {
|
||||
return;
|
||||
@@ -254,11 +254,13 @@ export class EngineManager extends BaseManager {
|
||||
this.engineInstance.clearAllMeasures();
|
||||
}
|
||||
|
||||
/**
|
||||
* 激活剖切功能(统一入口)
|
||||
* @param mode 剖切模式: 'x' | 'y' | 'z' (轴向剖切) | 'box' (剖切盒) | 'face' (拾取面剖切)
|
||||
* @remarks 代理调用 Engine.activeSection(mode)
|
||||
*/
|
||||
public saveMeasureSetting(setting: { unit: MeasureUnit; precision: MeasurePrecision }): void {
|
||||
if (!this.engineInstance) {
|
||||
return;
|
||||
}
|
||||
this.engineInstance.saveMeasureSetting(setting);
|
||||
}
|
||||
|
||||
public activeSection(mode: 'x' | 'y' | 'z' | 'box' | 'face'): void {
|
||||
if (!this.engineInstance) {
|
||||
console.warn('[EngineManager] 3D Engine not initialized.');
|
||||
|
||||
Reference in New Issue
Block a user