fix(earth): fix satellite trail origin line and sync button state
- Fill unfilled trail points with satellite position instead of (0,0,0) - Update toggle-satellites button state after auto-show on init - Remove trailsReady flag since it's no longer needed
This commit is contained in:
@@ -191,16 +191,27 @@ async function loadData(showWhiteSphere = false) {
|
|||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
console.log('开始加载电缆数据...');
|
console.log('开始加载数据...');
|
||||||
await loadGeoJSONFromPath(scene, getEarth());
|
await Promise.all([
|
||||||
console.log('电缆数据加载完成');
|
(async () => {
|
||||||
await loadLandingPoints(scene, getEarth());
|
await loadGeoJSONFromPath(scene, getEarth());
|
||||||
console.log('登陆点数据加载完成');
|
console.log('电缆数据加载完成');
|
||||||
|
await loadLandingPoints(scene, getEarth());
|
||||||
const satCount = await loadSatellites();
|
console.log('登陆点数据加载完成');
|
||||||
console.log(`卫星数据加载完成: ${satCount} 颗`);
|
})(),
|
||||||
updateSatellitePositions();
|
(async () => {
|
||||||
console.log('卫星位置已更新');
|
const satCount = await loadSatellites();
|
||||||
|
console.log(`卫星数据加载完成: ${satCount} 颗`);
|
||||||
|
updateSatellitePositions();
|
||||||
|
console.log('卫星位置已更新');
|
||||||
|
toggleSatellites(true);
|
||||||
|
const satBtn = document.getElementById('toggle-satellites');
|
||||||
|
if (satBtn) {
|
||||||
|
satBtn.classList.add('active');
|
||||||
|
satBtn.querySelector('.tooltip').textContent = '隐藏卫星';
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
]);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载数据失败:', error);
|
console.error('加载数据失败:', error);
|
||||||
showStatusMessage('加载数据失败: ' + error.message, 'error');
|
showStatusMessage('加载数据失败: ' + error.message, 'error');
|
||||||
|
|||||||
@@ -291,9 +291,9 @@ export function updateSatellitePositions(deltaTime = 0) {
|
|||||||
trailColors[trailIdx + 1] = g * alpha;
|
trailColors[trailIdx + 1] = g * alpha;
|
||||||
trailColors[trailIdx + 2] = b * alpha;
|
trailColors[trailIdx + 2] = b * alpha;
|
||||||
} else {
|
} else {
|
||||||
trailPositions[trailIdx] = 0;
|
trailPositions[trailIdx] = pos.x;
|
||||||
trailPositions[trailIdx + 1] = 0;
|
trailPositions[trailIdx + 1] = pos.y;
|
||||||
trailPositions[trailIdx + 2] = 0;
|
trailPositions[trailIdx + 2] = pos.z;
|
||||||
trailColors[trailIdx] = 0;
|
trailColors[trailIdx] = 0;
|
||||||
trailColors[trailIdx + 1] = 0;
|
trailColors[trailIdx + 1] = 0;
|
||||||
trailColors[trailIdx + 2] = 0;
|
trailColors[trailIdx + 2] = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user