Fix satellite dashboard orbit track visibility

The orbit track was being added correctly but wasn't visible because
the map was zoomed to the pass ground track (a small arc). Now the map
fits bounds to include the full orbit track plus observer location
after adding the orbit layer.

Also removed debug console.log statements.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
James Smith
2025-12-30 15:50:43 +00:00
parent 5990119db3
commit 58f3acb484

View File

@@ -1367,16 +1367,11 @@
let targetSatellite = selectedSatellite;
let satColor = satellites[selectedSatellite]?.color || '#00d4ff';
console.log('updateRealTimePositions - selectedPass:', selectedPass, 'passes.length:', passes.length);
if (selectedPass !== null && passes[selectedPass]) {
const pass = passes[selectedPass];
// Use the satellite name from the pass (backend accepts names or NORAD IDs)
targetSatellite = pass.satellite;
satColor = pass.color || satColor;
console.log('Using pass satellite:', targetSatellite, 'color:', satColor);
} else {
console.log('No pass selected, using dropdown satellite:', targetSatellite);
}
try {
@@ -1392,10 +1387,8 @@
});
const data = await response.json();
console.log('Position response:', data);
if (data.status === 'success' && data.positions.length > 0) {
const pos = data.positions[0];
console.log('Position data:', pos.satellite, 'lat:', pos.lat, 'lon:', pos.lon, 'has track:', !!pos.track, 'track length:', pos.track?.length);
// Update telemetry
document.getElementById('telLat').textContent = pos.lat.toFixed(4) + '°';
@@ -1409,7 +1402,6 @@
document.getElementById('statVisible').textContent = pos.elevation > 0 ? '1' : '0';
// Update satellite marker on map
console.log('Updating map, groundMap exists:', !!groundMap);
if (groundMap) {
if (satMarker) groundMap.removeLayer(satMarker);
@@ -1426,18 +1418,14 @@
iconAnchor: [10, 10]
});
satMarker = L.marker([pos.lat, pos.lon], { icon: satIcon }).addTo(groundMap);
console.log('Satellite marker added at', pos.lat, pos.lon);
}
// Always show full orbit track from position data
console.log('Drawing orbit track, pos.track exists:', !!pos.track, 'groundMap exists:', !!groundMap);
if (pos.track && groundMap) {
if (orbitTrack) {
console.log('Removing old orbitTrack');
groundMap.removeLayer(orbitTrack);
}
if (trackLine) {
console.log('Removing old trackLine');
groundMap.removeLayer(trackLine);
trackLine = null;
}
@@ -1465,19 +1453,25 @@
}
// Draw each segment as separate polyline
console.log('Created', segments.length, 'segments, total points:', segments.reduce((sum, s) => sum + s.length, 0));
orbitTrack = L.layerGroup();
const allOrbitCoords = [];
segments.forEach((seg, i) => {
console.log('Adding segment', i, 'with', seg.length, 'points');
L.polyline(seg, {
color: satColor,
weight: 2,
opacity: 0.6,
dashArray: '5, 5'
}).addTo(orbitTrack);
allOrbitCoords.push(...seg);
});
orbitTrack.addTo(groundMap);
console.log('Orbit track added to map');
// Fit map to show the full orbit track
if (allOrbitCoords.length > 0) {
// Add observer location to bounds
allOrbitCoords.push([lat, lon]);
groundMap.fitBounds(L.latLngBounds(allOrbitCoords), { padding: [30, 30] });
}
}
// Update polar plot - preserve pass trajectory if selected