Skip to content
Snippets Groups Projects
Commit 8fd53ab6 authored by Mateusz Bolewski's avatar Mateusz Bolewski
Browse files

feat(map): code review fixes

parent db3de4da
No related branches found
No related tags found
3 merge requests!223reset the pin numbers before search results are fetch (so the results will be...,!84feat: Molart modal,!83feat(map): context menu
Pipeline #83775 failed
......@@ -68,13 +68,18 @@ export const useOlMapListeners = ({ view, mapInstance }: UseOlMapListenersInput)
return;
}
mapInstance.getViewport().addEventListener('contextmenu', e => {
const rightClickEvent = (e: MouseEvent): Promise<void> | undefined => {
e.preventDefault();
coordinate.current = mapInstance.getEventCoordinate(e);
pixel.current = mapInstance.getEventPixel(e);
return handleRightClick(coordinate.current, pixel.current);
});
};
mapInstance.getViewport().addEventListener('contextmenu', rightClickEvent);
// eslint-disable-next-line consistent-return
return () => mapInstance.getViewport().removeEventListener('contextmenu', rightClickEvent);
}, [mapInstance, handleRightClick]);
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment