fix(web): 修复重构导致 allStations 变量未定义引发的渲染崩溃问题

This commit is contained in:
2026-07-11 23:20:35 +08:00
parent d6f37d1415
commit dc835f498d
4 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -324,7 +324,9 @@
`;
}
const width = Math.max(560, Math.max(...allStations.map(c => stationXByCanonical[stationCanonicalByCode[c] || c] || 0)) + 120);
const allX = Object.values(stationXByCanonical);
const maxX = allX.length > 0 ? Math.max(...allX) : 0;
const width = Math.max(560, maxX + 120);
const height = Math.max(260, baseY + currentLineIdx * lineGapY + 60);
mapContainer.innerHTML = `<svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">${svgContent}</svg>`;