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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user