don't know what i did

This commit is contained in:
Mikkel 2023-02-07 14:56:38 +01:00
parent 8a99e9837e
commit 3ddc526cf8

View File

@ -88,6 +88,23 @@ function setupMap(
}); });
}; };
mapImg.onmouseup = async (event: MouseEvent) => {
const mousePosition: Position = { x: event.offsetX, y: event.offsetY };
displayMousePosition(mousePositionElement, mousePosition);
const mapSize: Size = {
width: mapImg.clientWidth,
height: mapImg.clientHeight,
};
const coords = convertPixelsToCoordinate(mousePosition, mapSize);
displayCoords(coordsElement, coords);
fetcher.call(async () => {
const response = await fetchZipCode(coords);
displayZipCode(zipCodeElement, response.nr, response.navn);
console.log("test")
});
}
mapImg.onmouseleave = (_event: MouseEvent) => { mapImg.onmouseleave = (_event: MouseEvent) => {
[mousePositionElement, coordsElement, zipCodeElement].forEach( [mousePositionElement, coordsElement, zipCodeElement].forEach(
(e) => (e.innerHTML = ""), (e) => (e.innerHTML = ""),