diff --git a/src/frontend/src/Components/Map.js b/src/frontend/src/Components/Map.js index 2c382c6da..1e4c34764 100644 --- a/src/frontend/src/Components/Map.js +++ b/src/frontend/src/Components/Map.js @@ -222,11 +222,22 @@ export default function MapWrapper({ // Click states const resetClickedStates = (targetFeature) => { + // camera is set to data structure rather than map feature + if (clickedCameraRef.current && !clickedCameraRef.current.setStyle) { + clickedCameraRef.current = mapLayers.current['highwayCams'].getSource().getFeatureById(clickedCameraRef.current.id); + } + if (clickedCameraRef.current && targetFeature != clickedCameraRef.current) { clickedCameraRef.current.setStyle(cameraStyles['static']); updateClickedCamera(null); } + // event is set to data structure rather than map feature + if (clickedEventRef.current && !clickedEventRef.current.ol_uid) { + const features = mapLayers.current[clickedEventRef.current.display_category].getSource(); + clickedEventRef.current = features.getFeatureById(clickedEventRef.current.id); + } + if (clickedEventRef.current && targetFeature != clickedEventRef.current) { clickedEventRef.current.setStyle( getEventIcon(clickedEventRef.current, 'static'),