Minor enhancement.

This commit is contained in:
Eric van der Vlist 2022-11-17 23:11:33 +01:00
parent 7c09a5536a
commit 8906bed1e7
1 changed files with 8 additions and 3 deletions

View File

@ -33,8 +33,10 @@ export const Marker: react.FC<MarkerProperties> = (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<MarkerProperties> = (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 (
<g