Skip to content

Commit

Permalink
Fixed remaining markers bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoPazz committed Nov 20, 2024
1 parent 4b06d5c commit 5900bf1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 20 deletions.
5 changes: 0 additions & 5 deletions lib/ReactViews/Custom/Chart/BottomDockChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 18 additions & 7 deletions lib/ReactViews/Custom/Chart/MeasurableGeometryChartPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
}
}
};
Expand Down
8 changes: 0 additions & 8 deletions lib/ReactViews/MeasurableGeometry/MeasurablePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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();
}
Expand Down

0 comments on commit 5900bf1

Please sign in to comment.