fix(earth): highlight all cable segments by cable_id

- Add cable_id mapping to group MultiLineString segments
- Highlight all segments of same cable on hover
- Highlight all segments of same cable on click lock
- Reset all segments when clearing lock
- Add pulse animation to all locked cable segments
- Fix hover/click behavior with cable_id grouping
This commit is contained in:
rayd1o
2026-03-12 12:51:07 +08:00
parent aaae6a53c3
commit ceb1b728d5
2 changed files with 81 additions and 23 deletions

View File

@@ -9,6 +9,7 @@ import { updateCableDetails, updateEarthStats, showStatusMessage } from './ui.js
export let cableLines = [];
export let landingPoints = [];
export let lockedCable = null;
let cableIdMap = new Map();
function getCableColor(properties) {
if (properties.color) {
@@ -46,8 +47,10 @@ function createCableLine(points, color, properties, earthObj) {
});
const cableLine = new THREE.Line(lineGeometry, lineMaterial);
const cableId = properties.cable_id || properties.id || properties.Name || Math.random().toString(36);
cableLine.userData = {
type: 'cable',
cableId: cableId,
name: properties.Name || properties.cableName || 'Unknown',
owner: properties.owner || properties.owners || '-',
status: properties.status || '-',
@@ -58,6 +61,11 @@ function createCableLine(points, color, properties, earthObj) {
};
cableLine.renderOrder = 1;
if (!cableIdMap.has(cableId)) {
cableIdMap.set(cableId, []);
}
cableIdMap.get(cableId).push(cableLine);
return cableLine;
}
@@ -332,6 +340,10 @@ export function getCableLines() {
return cableLines;
}
export function getCablesById(cableId) {
return cableIdMap.get(cableId) || [];
}
export function getLandingPoints() {
return landingPoints;
}