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:
yuding
2026-02-02 18:18:36 +08:00
parent 316f42ae6b
commit 044cd0e034
14 changed files with 5566 additions and 5539 deletions

View File

@@ -76,14 +76,14 @@ export const enUS: TranslationDictionary = {
btnName: 'Measure',
dialogTitle: 'Measure',
modes: {
clearHeight: 'Clear Height',
clearDistance: 'Clear Distance',
distance: 'Distance',
minDistance: 'Min Distance',
angle: 'Angle',
elevation: 'Elevation',
volume: 'Volume',
laserDistance: 'Laser Distance',
point: 'Point',
angle: 'Angle',
area: 'Area',
slope: 'Slope',
spaceVolume: 'Space Volume',
},
actions: {
expand: 'Expand',
@@ -97,14 +97,14 @@ export const enUS: TranslationDictionary = {
y: 'Y:',
z: 'Z:',
value: {
clearHeight: 'Clear Height:',
clearDistance: 'Clear Distance:',
distance: 'Distance:',
minDistance: 'Min Distance:',
angle: 'Angle:',
elevation: 'Elevation:',
volume: 'Volume:',
laserDistance: 'Laser Distance:',
point: 'Point:',
angle: 'Angle:',
area: 'Area:',
slope: 'Slope:',
spaceVolume: 'Space Volume:',
}
},
units: {
@@ -113,14 +113,14 @@ export const enUS: TranslationDictionary = {
m: 'm',
km: 'km',
deg: '°',
m3: 'm³',
m2: 'm²',
percent: '%',
},
settings: {
title: 'Settings',
unit: 'Unit:',
precision: 'Precision:',
hint: 'Distance, min distance and elevation use this unit by default; angle and volume use their own units.',
hint: 'Distance, clear distance, clear height and elevation use this unit by default; angle and area use their own units.',
save: 'Save',
cancel: 'Cancel',
}

View File

@@ -79,60 +79,45 @@ export interface TranslationDictionary {
btnName: string;
dialogTitle: string;
/**
* 8 种测量方式名称(用于 UI 按钮 tooltip、当前方式显示等
*/
modes: {
clearHeight: string;
clearDistance: string;
distance: string;
minDistance: string;
angle: string;
elevation: string;
volume: string;
laserDistance: string;
point: string;
angle: string;
area: string;
slope: string;
spaceVolume: string;
};
/**
* 操作按钮文案
*/
actions: {
expand: string;
collapse: string;
clearAll: string;
settings: string;
};
/**
* 结果区标签
*/
labels: {
currentMode: string;
x: string;
y: string;
z: string;
value: {
clearHeight: string;
clearDistance: string;
distance: string;
minDistance: string;
angle: string;
elevation: string;
volume: string;
laserDistance: string;
point: string;
angle: string;
area: string;
slope: string;
spaceVolume: string;
};
};
/**
* 单位(也走国际化,避免硬编码)
*/
units: {
mm: string;
cm: string;
m: string;
km: string;
deg: string;
m3: string;
m2: string;
percent: string;
};

View File

@@ -76,14 +76,14 @@ export const zhCN: TranslationDictionary = {
btnName: '测量',
dialogTitle: '测量',
modes: {
clearHeight: '净高',
clearDistance: '净距',
distance: '距离',
minDistance: '最小距离',
angle: '角度',
elevation: '标高',
volume: '体积',
laserDistance: '激光测距',
point: '坐标',
angle: '角度',
area: '面积',
slope: '坡度',
spaceVolume: '空间体积',
},
actions: {
expand: '展开',
@@ -97,14 +97,14 @@ export const zhCN: TranslationDictionary = {
y: 'Y',
z: 'Z',
value: {
clearHeight: '净高:',
clearDistance: '净距:',
distance: '距离:',
minDistance: '最小距离:',
angle: '角度:',
elevation: '标高:',
volume: '体积',
laserDistance: '激光测距',
point: '坐标',
angle: '角度',
area: '面积:',
slope: '坡度:',
spaceVolume: '空间体积:',
}
},
units: {
@@ -113,14 +113,14 @@ export const zhCN: TranslationDictionary = {
m: 'm',
km: 'km',
deg: '°',
m3: 'm³',
m2: 'm²',
percent: '%',
},
settings: {
title: '设置',
unit: '单位:',
precision: '精度:',
hint: '距离、最小距离和标高默认使用该单位;角度和积有各自默认单位。',
hint: '距离、净距、净高和标高默认使用该单位;角度和积有各自默认单位。',
save: '保存设置',
cancel: '取消',
}