don't know what i did
This commit is contained in:
parent
8a99e9837e
commit
3ddc526cf8
@ -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 = ""),
|
||||||
|
Loading…
Reference in New Issue
Block a user