Skip to content

Commit

Permalink
DBC22-1219: Rework done
Browse files Browse the repository at this point in the history
DBC22-1219: Rework done. Updated according to the comments.
  • Loading branch information
bcgov-brwang authored and ray-oxd committed Nov 27, 2023
1 parent 8eeaec3 commit bd50a92
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/frontend/src/Components/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ export default function MapWrapper({
});
}

// Define the function to be executed after the delay
function resetCameraPopupRef() {
cameraPopupRef.current = null;
}

function getCameraCircle(camera) {
if (!camera) {
return {};
Expand Down Expand Up @@ -416,10 +421,9 @@ export default function MapWrapper({

updateClickedCamera(feature);

if (!cameraPopupRef.current) {
cameraPopupRef.current = popup;
}
cameraPopupRef.current = popup;

setTimeout(resetCameraPopupRef, 500);
}
} else {
// if it wasn't a webcam icon, check if it was an event
Expand Down Expand Up @@ -625,6 +629,8 @@ export default function MapWrapper({
clickedEventRef.current.set('clicked', false);
updateClickedEvent(null);
}

cameraPopupRef.current = null;
}

const setRelatedGeometry = (event, state) => {
Expand Down
3 changes: 0 additions & 3 deletions src/frontend/src/Components/map/mapPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,7 @@ export function getCamPopup(camFeature, setClickedCamera, navigate, cameraPopupR
const handlePopupClick = (e) => {
if (!cameraPopupRef.current) {
navigate(`/cameras/${camData.id}`);
}
else{
cameraPopupRef.current = null;
return;
}
};

Expand Down

0 comments on commit bd50a92

Please sign in to comment.