refactor: 提取地球坐标常量到EARTH_CONFIG

- 添加tilt、chinaLat、chinaLon、latCoefficient等常量
- earth.js和controls.js使用常量替代硬编码
- 离开地球时隐藏tooltip
This commit is contained in:
rayd1o
2026-03-19 12:42:08 +08:00
parent 777891f865
commit 82f7aa29a6
3 changed files with 22 additions and 12 deletions

View File

@@ -1,7 +1,7 @@
// earth.js - 3D Earth creation module
import * as THREE from 'three';
import { CONFIG } from './constants.js';
import { CONFIG, EARTH_CONFIG } from './constants.js';
import { latLonToVector3 } from './utils.js';
export let earth = null;
@@ -22,9 +22,9 @@ export function createEarth(scene) {
opacity: 0.8,
side: THREE.DoubleSide
});
earth = new THREE.Mesh(geometry, material);
earth.rotation.x = 23.5 * Math.PI / 180;
earth.rotation.x = EARTH_CONFIG.tiltRad;
scene.add(earth);
const textureUrls = [