Skip to content

Commit

Permalink
Moved setter of the selection stop index in MeasurableGeometryChartPa…
Browse files Browse the repository at this point in the history
…nel.
  • Loading branch information
FrancescoPazz committed Nov 20, 2024
1 parent 5900bf1 commit 202e447
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
8 changes: 0 additions & 8 deletions lib/ReactViews/Custom/Chart/BottomDockChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,6 @@ class Chart extends React.Component {
7
);

if (idx === 1) {
this.props.terria.setSelectedStopPointIdx(
point ? chartItem.points.indexOf(point) : null
);
} else {
this.props.terria.setSelectedStopPointIdx(null);
}

return {
chartItem,
point
Expand Down
15 changes: 7 additions & 8 deletions lib/ReactViews/Custom/Chart/MeasurableGeometryChartPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ const MeasurableGeometryChartPanel = observer((props: Props) => {
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);
}
const airPointIndex = chartItems
?.find((item) => item.key === ChartKeys.AirChart)
?.points.findIndex((elem) => elem.y === newPoint.y);
console.log("airPointIndex", airPointIndex);
terria.setSelectedStopPointIdx(
airPointIndex && airPointIndex !== -1 ? airPointIndex : null
);

if (!billboardCollection.current) {
billboardCollection.current = new BillboardCollection({
Expand All @@ -126,7 +126,6 @@ const MeasurableGeometryChartPanel = observer((props: Props) => {
terria.currentViewer.notifyRepaintRequired();
}
if (newPoint === undefined || terria.selectedStopPointIdx !== null) {
//terria.setSelectedStopPointIdx(null);
if (billboardCollection.current) {
billboardCollection.current.removeAll();
terria.currentViewer.notifyRepaintRequired();
Expand Down

0 comments on commit 202e447

Please sign in to comment.