feat(earth): cable state management, hover/lock visual separation, fix isSameCable undefined bug

This commit is contained in:
rayd1o
2026-03-19 16:46:40 +08:00
parent 869d661a94
commit 0ecc1bc537
3 changed files with 113 additions and 77 deletions

View File

@@ -2,7 +2,7 @@
import * as THREE from 'three';
import { CONFIG, CABLE_COLORS, PATHS } from './constants.js';
import { CONFIG, CABLE_COLORS, PATHS, CABLE_STATE } from './constants.js';
import { latLonToVector3 } from './utils.js';
import { updateEarthStats, showStatusMessage } from './ui.js';
import { showInfoCard } from './info-card.js';
@@ -340,3 +340,25 @@ export function getCablesById(cableId) {
export function getLandingPoints() {
return landingPoints;
}
const cableStates = new Map();
export function getCableState(cableId) {
return cableStates.get(cableId) || CABLE_STATE.NORMAL;
}
export function setCableState(cableId, state) {
cableStates.set(cableId, state);
}
export function clearAllCableStates() {
cableStates.clear();
}
export function getCableStateInfo() {
const states = {};
cableStates.forEach((state, cableId) => {
states[cableId] = state;
});
return states;
}