From 5900bf12a3f9334131fd0dc58db6df87ef662ef7 Mon Sep 17 00:00:00 2001 From: Francesco Pazzaglia Date: Wed, 20 Nov 2024 11:19:49 +0100 Subject: [PATCH] Fixed remaining markers bug. --- .../Custom/Chart/BottomDockChart.jsx | 5 ---- .../Chart/MeasurableGeometryChartPanel.tsx | 25 +++++++++++++------ .../MeasurableGeometry/MeasurablePanel.tsx | 8 ------ 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/lib/ReactViews/Custom/Chart/BottomDockChart.jsx b/lib/ReactViews/Custom/Chart/BottomDockChart.jsx index c405714bf0c..5eb5b2512ec 100644 --- a/lib/ReactViews/Custom/Chart/BottomDockChart.jsx +++ b/lib/ReactViews/Custom/Chart/BottomDockChart.jsx @@ -266,11 +266,6 @@ class Chart extends React.Component { () => this.props.terria.selectedStopPointIdx, (idx) => { if (idx !== null && this.props.chartItems) { - console.log( - "this.props.terria.selectedStopPointIdx: ", - this.props.terria.selectedStopPointIdx - ); - console.log("idx: ", idx); const sumDistances = this.props.terria.measurableGeom.stopGroundDistances .slice(0, idx + 1) diff --git a/lib/ReactViews/Custom/Chart/MeasurableGeometryChartPanel.tsx b/lib/ReactViews/Custom/Chart/MeasurableGeometryChartPanel.tsx index 01cff61dd22..f6fab298b40 100644 --- a/lib/ReactViews/Custom/Chart/MeasurableGeometryChartPanel.tsx +++ b/lib/ReactViews/Custom/Chart/MeasurableGeometryChartPanel.tsx @@ -89,12 +89,24 @@ const MeasurableGeometryChartPanel = observer((props: Props) => { (!chartPoint?.current || chartPoint.current !== newPoint) ) { chartPoint.current = newPoint; + console.log("newPoint", newPoint); const pointIndex = chartItems ?.find((item) => item.key === ChartKeys.GroundChart) ?.points.findIndex((elem) => elem === newPoint); + console.log("pointIndex", pointIndex); if (!pointIndex) return; const coords = terria?.measurableGeom?.sampledPoints?.[pointIndex]; + console.log("coords", coords); if (!coords) return; + console.log("chartItems: ", chartItems); + + if (chartItems) { + const airPointIndex = chartItems[1].points.findIndex( + (elem) => elem === newPoint + ); + console.log("airPointIndex", airPointIndex); + } + if (!billboardCollection.current) { billboardCollection.current = new BillboardCollection({ scene: terria.cesium.scene @@ -112,13 +124,12 @@ const MeasurableGeometryChartPanel = observer((props: Props) => { }); terria.currentViewer.notifyRepaintRequired(); - } else { - if (newPoint === undefined) { - terria.setSelectedStopPointIdx(null); - if (billboardCollection.current) { - billboardCollection.current.removeAll(); - terria.currentViewer.notifyRepaintRequired(); - } + } + if (newPoint === undefined || terria.selectedStopPointIdx !== null) { + //terria.setSelectedStopPointIdx(null); + if (billboardCollection.current) { + billboardCollection.current.removeAll(); + terria.currentViewer.notifyRepaintRequired(); } } }; diff --git a/lib/ReactViews/MeasurableGeometry/MeasurablePanel.tsx b/lib/ReactViews/MeasurableGeometry/MeasurablePanel.tsx index eaac59ef589..09b863b62a7 100644 --- a/lib/ReactViews/MeasurableGeometry/MeasurablePanel.tsx +++ b/lib/ReactViews/MeasurableGeometry/MeasurablePanel.tsx @@ -420,11 +420,6 @@ const MeasurablePanel = observer((props: Props) => { }; useEffect(() => { - console.log( - "aiudo terria.selectedStopPointIdx", - terria.selectedStopPointIdx - ); - if (terria.selectedStopPointIdx !== null) setHighlightedRow(terria.selectedStopPointIdx); else setHighlightedRow(null); @@ -446,7 +441,6 @@ const MeasurablePanel = observer((props: Props) => { if (terria.cesium) { if (nearbyStopPoint) { - console.log("You're near the point: ", nearbyStopPoint); if (!billboardCollection.current) { billboardCollection.current = new BillboardCollection({ scene: terria.cesium.scene @@ -465,10 +459,8 @@ const MeasurablePanel = observer((props: Props) => { id: "chartPointPlaceholder" }); const idx = terria.measurableGeom.stopPoints.indexOf(nearbyStopPoint); - console.log("idx: ", idx); terria.setSelectedStopPointIdx(idx); } else { - console.log("You're not near any points."); if (billboardCollection.current) { billboardCollection.current.removeAll(); }