refactor(earth): extract satellite config to SATELLITE_CONFIG constants

This commit is contained in:
rayd1o
2026-03-19 18:00:22 +08:00
parent bb6b18fe3b
commit 4f922f13d1
2 changed files with 12 additions and 5 deletions

View File

@@ -53,6 +53,13 @@ export const CABLE_STATE = {
LOCKED: 'locked'
};
export const SATELLITE_CONFIG = {
maxCount: 2000,
dotSize: 1.5,
trailLength: 30,
apiPath: '/api/v1/visualization/geo/satellites'
};
export const GRID_CONFIG = {
latitudeStep: 10,
longitudeStep: 30,

View File

@@ -2,7 +2,7 @@
import * as THREE from 'three';
import { twoline2satrec, sgp4, propagate, degreesToRadians, radiansToDegrees, eciToGeodetic } from 'satellite.js';
import { CONFIG } from './constants.js';
import { CONFIG, SATELLITE_CONFIG } from './constants.js';
let satellitePoints = null;
let satelliteTrails = null;
@@ -15,9 +15,9 @@ let satellitePositions = [];
let hoverRingSprite = null;
let lockedRingSprite = null;
const SATELLITE_API = '/api/v1/visualization/geo/satellites?limit=2000';
const MAX_SATELLITES = 2000;
const TRAIL_LENGTH = 30;
const SATELLITE_API = SATELLITE_CONFIG.apiPath + '?limit=' + SATELLITE_CONFIG.maxCount;
const MAX_SATELLITES = SATELLITE_CONFIG.maxCount;
const TRAIL_LENGTH = SATELLITE_CONFIG.trailLength;
const DOT_TEXTURE_SIZE = 32;
function createCircularDotTexture() {
@@ -75,7 +75,7 @@ export function createSatellites(scene, earthObj) {
pointsGeometry.setAttribute('color', new THREE.BufferAttribute(colors, 3));
const pointsMaterial = new THREE.PointsMaterial({
size: 1.5,
size: SATELLITE_CONFIG.dotSize,
map: dotTexture,
vertexColors: true,
transparent: true,