feat(ui): 移除站点Y轴波浪偏移并简化线路绘制
移除波浪偏移计算逻辑,将贝塞尔曲线线路改为直线段连接,简化了绘图代码。
This commit is contained in:
+2
-8
@@ -190,13 +190,10 @@
|
||||
}
|
||||
|
||||
stationYByCanonical = {};
|
||||
let stationIndex = 0;
|
||||
for (const c of Object.keys(primaryLineByStation)) {
|
||||
const li = primaryLineByStation[c];
|
||||
if (li == null) continue;
|
||||
const waveOffset = (stationIndex % 2 === 0) ? -12 : 12;
|
||||
stationYByCanonical[c] = baseY + li * lineGapY + waveOffset;
|
||||
stationIndex++;
|
||||
stationYByCanonical[c] = baseY + li * lineGapY;
|
||||
}
|
||||
|
||||
const allStations = Object.keys(primaryLineByStation);
|
||||
@@ -232,10 +229,7 @@
|
||||
|
||||
let d = `M ${pts[0].x} ${pts[0].y}`;
|
||||
for (let i = 1; i < pts.length; i++) {
|
||||
const prev = pts[i-1];
|
||||
const curr = pts[i];
|
||||
const midX = (prev.x + curr.x) / 2;
|
||||
d += ` C ${midX} ${prev.y}, ${midX} ${curr.y}, ${curr.x} ${curr.y}`;
|
||||
d += ` L ${pts[i].x} ${pts[i].y}`;
|
||||
}
|
||||
svgContent += `<path d="${d}" fill="none" stroke="${li.color}" stroke-width="8" stroke-linecap="round" stroke-linejoin="round" />`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user