mirror of
https://github.com/smittix/intercept.git
synced 2026-07-23 08:28:11 -07:00
Fix trackLine.getBounds error in satellite dashboard
LayerGroup doesn't have getBounds() like polyline does. Collect all coordinates and create bounds manually using L.latLngBounds(). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1189,6 +1189,7 @@
|
|||||||
|
|
||||||
// Draw each segment as separate polyline
|
// Draw each segment as separate polyline
|
||||||
trackLine = L.layerGroup();
|
trackLine = L.layerGroup();
|
||||||
|
const allCoords = [];
|
||||||
segments.forEach(seg => {
|
segments.forEach(seg => {
|
||||||
L.polyline(seg, {
|
L.polyline(seg, {
|
||||||
color: pass.color || '#00d4ff',
|
color: pass.color || '#00d4ff',
|
||||||
@@ -1196,6 +1197,7 @@
|
|||||||
opacity: 0.8,
|
opacity: 0.8,
|
||||||
dashArray: '10, 5'
|
dashArray: '10, 5'
|
||||||
}).addTo(trackLine);
|
}).addTo(trackLine);
|
||||||
|
allCoords.push(...seg);
|
||||||
});
|
});
|
||||||
trackLine.addTo(groundMap);
|
trackLine.addTo(groundMap);
|
||||||
|
|
||||||
@@ -1219,7 +1221,10 @@
|
|||||||
.bindPopup(`<b>${pass.name}</b><br>Alt: ${pass.currentPos.alt?.toFixed(0)} km`);
|
.bindPopup(`<b>${pass.name}</b><br>Alt: ${pass.currentPos.alt?.toFixed(0)} km`);
|
||||||
}
|
}
|
||||||
|
|
||||||
groundMap.fitBounds(trackLine.getBounds(), { padding: [30, 30] });
|
// Fit bounds using collected coordinates
|
||||||
|
if (allCoords.length > 0) {
|
||||||
|
groundMap.fitBounds(L.latLngBounds(allCoords), { padding: [30, 30] });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user