From 8906bed1e75c4d97cbc1d109fa6cc4e9cbebac14 Mon Sep 17 00:00:00 2001 From: evlist Date: Thu, 17 Nov 2022 23:11:33 +0100 Subject: [PATCH] Minor enhancement. --- src/components/map/Marker.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/map/Marker.tsx b/src/components/map/Marker.tsx index edaa916..637652b 100644 --- a/src/components/map/Marker.tsx +++ b/src/components/map/Marker.tsx @@ -33,8 +33,10 @@ export const Marker: react.FC = (props: MarkerProperties) => { return null; } - const x = lon2tile(props.coordinates.lon, props.keyObject.zoomLevel); - const y = lat2tile(props.coordinates.lat, props.keyObject.zoomLevel); + const x0 = lon2tile(props.coordinates.lon, 0); + const y0 = lat2tile(props.coordinates.lat, 0); + const x = x0 * 2 ** props.keyObject.zoomLevel; + const y = y0 * 2 ** props.keyObject.zoomLevel; if ( x < props.viewPort.topLeft.x || x > props.viewPort.bottomRight.x + 1 || @@ -50,7 +52,10 @@ export const Marker: react.FC = (props: MarkerProperties) => { cache.set({ cacheId: 'points', key: props.id, - value: { id: props.id, coordinates: props.coordinates }, + value: { + coordinates: props.coordinates, + point: { x: x0, y: y0 }, + }, }); return (