caoziwu 1 týždeň pred
rodič
commit
7c779b06cf

+ 23 - 4
src/renderer/src/components/simulator/DiagramPanel.vue

@@ -21,6 +21,13 @@ let resizeObserver: ResizeObserver | null = null
 const render = (): void => {
   if (!board || !chartDom.value) return
 
+  const pal = palette.value
+  const { z, d1, d2, d3, hCov, vCov, dir } = props.params
+
+  // 根据安装方式选择对应的覆盖角
+  const cov = dir === 'H' ? hCov : vCov
+  const t6 = cov / 2
+
   const labels = {
     empty: t('diagram.empty'),
     horizontalDistance: t('diagram.horizontalDistance'),
@@ -29,12 +36,14 @@ const render = (): void => {
     lowerBound: t('diagram.lowerBound'),
     acousticAxis: t('diagram.acousticAxis'),
     coverage: t('diagram.coverage'),
-    vertical: t('diagram.vertical')
+    vertical: t('diagram.vertical'),
+    coverageAngle: t('diagram.coverageAngle', {
+      cov: cov.toFixed(0),
+      dir: dir === 'H' ? t('params.dirH') : t('params.dirV'),
+      t6: t6.toFixed(0)
+    })
   }
 
-  const pal = palette.value
-  const { z, d1, d2, d3 } = props.params
-
   // 1. 基础物理数据边界
   const rawMaxD = Math.max(d1, d2, d3, 5) * 1.13
   const rawMaxZ = Math.max(z * 1.15, 3.5)
@@ -127,3 +136,13 @@ onBeforeUnmount(() => {
     style="height: 100%; min-height: 350px; width: 100%"
   ></div>
 </template>
+<style scoped>
+/* 强行去掉点击后产生的金黄色焦点框 */
+.chart-box,
+.chart-box *,
+.chart-box svg,
+.chart-box svg * {
+  outline: none !important;
+  box-shadow: none !important;
+}
+</style>

+ 21 - 2
src/renderer/src/components/simulator/TopDiagramPanel.vue

@@ -13,7 +13,7 @@ const props = defineProps<{
 }>()
 
 const chartDom = ref<HTMLDivElement | null>(null)
-const { locale } = useI18n()
+const { t, locale } = useI18n()
 const palette = useChartPalette()
 const covAngle = ref(180)
 
@@ -23,8 +23,27 @@ let resizeObserver: ResizeObserver | null = null
 const render = (): void => {
   if (!board || !chartDom.value) return
   const pal = palette.value
+  const { hCov, vCov, dir } = props.params
+  const cov = dir === 'H' ? vCov : hCov
+  const t6 = cov / 2
+
+  const labels = {
+    forwardDistance: t('diagram.forwardDistance'),
+    lateralDistance: t('diagram.lateralDistance'),
+    leftBound: t('diagram.leftBound'),
+    rightBound: t('diagram.rightBound'),
+    acousticAxis: t('diagram.acousticAxis'),
+    coverage: t('diagram.coverage'),
+    horizontal: t('diagram.horizontal'),
+    coverageAngle: t('diagram.coverageAngle', {
+      cov: cov.toFixed(0),
+      dir: dir === 'H' ? t('params.dirH') : t('params.dirV'),
+      t6: t6.toFixed(0)
+    })
+  }
+
   // 修复:把滑块的值合并进参数再传给绘图函数
-  drawTopDiagram(board, { ...props.params, covAngle: covAngle.value }, pal)
+  drawTopDiagram(board, { ...props.params, covAngle: covAngle.value }, labels, pal)
 }
 
 const snapshot = computed(() => {

+ 17 - 15
src/renderer/src/lib/speaker/jsxgraph/diagram.ts

@@ -12,6 +12,7 @@ export interface DiagramChartLabels {
   acousticAxis: string
   coverage: string
   vertical: string
+  coverageAngle: string
 }
 
 let currentObjects: any[] = []
@@ -83,7 +84,14 @@ export function drawDiagram(
     }
 
     const addObj = (type: string, args: any[], attrs: any = {}) => {
-      if (type === 'point') attrs.withLabel = false
+      if (type === 'point') {
+        attrs.withLabel = false
+      }
+      // 核心修复:强制所有图元锁死,禁止拖拽和悬停交互
+      attrs.fixed = true
+      attrs.highlight = false
+      attrs.showInfobox = false
+
       const obj = board.create(type as any, args, attrs)
       currentObjects.push(obj)
       return obj
@@ -354,20 +362,14 @@ export function drawDiagram(
         { strokeColor: '#eab308', strokeWidth: 2.5, layer: 4 } // 加粗让它更显眼
       )
 
-      // V 标签放在外圈
-      const midA = (lowerAngle + upperAngle) / 2
-      const vLblR = vRadius + maxZ * 0.05
-      addObj(
-        'text',
-        [Math.cos(midA) * vLblR, z - Math.sin(midA) * vLblR, `V = ${cov.toFixed(0)}°`],
-        {
-          fontSize: 11,
-          color: '#ca8a04',
-          anchorX: 'left',
-          anchorY: 'middle',
-          layer: 4
-        }
-      )
+      // 覆盖角标签放在右上角
+      addObj('text', [maxD * 0.95, maxZ * 0.95, labels.coverageAngle], {
+        fontSize: 11,
+        color: '#ca8a04',
+        anchorX: 'right',
+        anchorY: 'top',
+        layer: 4
+      })
     }
 
     // 3. 安装倾斜角 A 的圆弧(内圈)

+ 17 - 0
src/renderer/src/lib/speaker/jsxgraph/topDiagram.ts

@@ -12,6 +12,7 @@ export interface TopDiagramChartLabels {
   acousticAxis: string
   coverage: string
   horizontal: string
+  coverageAngle: string
 }
 
 // 记录当前画布上的业务图元,避免误删
@@ -32,6 +33,7 @@ function parseHex(color: string): [number, number, number] {
 export function drawTopDiagram(
   board: Board,
   p: SpeakerParams & { covAngle?: number },
+  labels: TopDiagramChartLabels,
   pal: ChartPalette
 ): void {
   const { splMax, d1, d2, d3, hCov, vCov, dir } = p
@@ -203,6 +205,21 @@ export function drawTopDiagram(
       { strokeColor: pal.accent, strokeWidth: 2.5, layer: 4 }
     )
 
+    // 覆盖角标签(右上角)
+    if (!isFullCircle) {
+      addObj(
+        'text',
+        [maxD * 0.95, maxD * 0.95, labels.coverageAngle],
+        {
+          fontSize: 11,
+          color: '#ca8a04',
+          anchorX: 'right',
+          anchorY: 'top',
+          layer: 4
+        }
+      )
+    }
+
     // 6. D1/D2/D3 距离参考圆弧
     const rings = [d1, d2, d3].sort((a, b) => a - b)
     rings.forEach((r) => {

+ 2 - 1
src/renderer/src/locales/lang/en_US.json

@@ -75,7 +75,8 @@
     "acousticAxis": "Acoustic axis",
     "coverage": "Coverage",
     "vertical": "Vertical",
-    "horizontal": "Horizontal"
+    "horizontal": "Horizontal",
+    "coverageAngle": "Coverage {cov}° ({dir}) · θ₋₆ = {t6}°"
   },
   "result": {
     "panel": "Results",

+ 2 - 1
src/renderer/src/locales/lang/zh_CN.json

@@ -75,7 +75,8 @@
     "acousticAxis": "声学中轴",
     "coverage": "覆盖角",
     "vertical": "垂直",
-    "horizontal": "水平"
+    "horizontal": "水平",
+    "coverageAngle": "覆盖角 {cov}° ({dir}) · θ₋₆ = {t6}°"
   },
   "result": {
     "panel": "计算结果",