Files
planet/frontend/public/earth/js/constants.js
rayd1o 82f7aa29a6 refactor: 提取地球坐标常量到EARTH_CONFIG
- 添加tilt、chinaLat、chinaLon、latCoefficient等常量
- earth.js和controls.js使用常量替代硬编码
- 离开地球时隐藏tooltip
2026-03-19 12:42:08 +08:00

47 lines
1.0 KiB
JavaScript

// constants.js - Global constants and configuration
// Scene configuration
export const CONFIG = {
defaultCameraZ: 300,
minZoom: 0.5,
maxZoom: 5.0,
earthRadius: 100,
rotationSpeed: 0.002,
};
// Earth coordinate constants
export const EARTH_CONFIG = {
tilt: 23.5, // earth tilt angle (degrees)
tiltRad: 23.5 * Math.PI / 180, // earth tilt angle (radians)
// hangzhou coordinates
chinaLat: 30.2741,
chinaLon: 120.1552,
chinaRotLon: 120.1552 - 270, // for rotation calculation (chinaLon - 270)
// view reset coefficient
latCoefficient: 0.5
};
export const PATHS = {
cablesApi: '/api/v1/visualization/geo/cables',
landingPointsApi: '/api/v1/visualization/geo/landing-points',
geoJSON: './geo.json',
landingPointsStatic: './landing-point-geo.geojson',
};
// Cable colors mapping
export const CABLE_COLORS = {
'Americas II': 0xff4444,
'AU Aleutian A': 0x44ff44,
'AU Aleutian B': 0x4444ff,
'default': 0xffff44
};
// Grid configuration
export const GRID_CONFIG = {
latitudeStep: 10,
longitudeStep: 30,
gridStep: 5
};