feat(ui): 移除站点Y轴波浪偏移并简化线路绘制

移除波浪偏移计算逻辑,将贝塞尔曲线线路改为直线段连接,简化了绘图代码。
This commit is contained in:
2026-07-05 15:38:38 +08:00
parent 06a89c678a
commit c5b61cfd8e
+2 -8
View File
@@ -190,13 +190,10 @@
} }
stationYByCanonical = {}; stationYByCanonical = {};
let stationIndex = 0;
for (const c of Object.keys(primaryLineByStation)) { for (const c of Object.keys(primaryLineByStation)) {
const li = primaryLineByStation[c]; const li = primaryLineByStation[c];
if (li == null) continue; if (li == null) continue;
const waveOffset = (stationIndex % 2 === 0) ? -12 : 12; stationYByCanonical[c] = baseY + li * lineGapY;
stationYByCanonical[c] = baseY + li * lineGapY + waveOffset;
stationIndex++;
} }
const allStations = Object.keys(primaryLineByStation); const allStations = Object.keys(primaryLineByStation);
@@ -232,10 +229,7 @@
let d = `M ${pts[0].x} ${pts[0].y}`; let d = `M ${pts[0].x} ${pts[0].y}`;
for (let i = 1; i < pts.length; i++) { for (let i = 1; i < pts.length; i++) {
const prev = pts[i-1]; d += ` L ${pts[i].x} ${pts[i].y}`;
const curr = pts[i];
const midX = (prev.x + curr.x) / 2;
d += ` C ${midX} ${prev.y}, ${midX} ${curr.y}, ${curr.x} ${curr.y}`;
} }
svgContent += `<path d="${d}" fill="none" stroke="${li.color}" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" />`; svgContent += `<path d="${d}" fill="none" stroke="${li.color}" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" />`;
} }