mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-07 04:22:09 +00:00
changing pins
This commit is contained in:
@@ -5,11 +5,6 @@ type Coordinates = {
|
||||
longitude: number;
|
||||
};
|
||||
|
||||
type PixelPosition = {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
|
||||
export const latLongToSvgPosition = ({
|
||||
latitude,
|
||||
longitude,
|
||||
@@ -19,10 +14,10 @@ export const latLongToSvgPosition = ({
|
||||
const { west, east, north, south } = MAP_BOUNDS;
|
||||
|
||||
const lngRatio = (longitude - west) / (east - west);
|
||||
const latRatio = (north - latitude) / (north - south);
|
||||
const latRatio = (latitude - south) / (north - south);
|
||||
|
||||
const x = Math.max(0, Math.min(1, lngRatio)) * 100; // % instead of px
|
||||
const y = Math.max(0, Math.min(1, latRatio)) * 100;
|
||||
const x = Math.max(0, Math.min(1, lngRatio)) * 100;
|
||||
const y = Math.max(0, Math.min(1, 1 - latRatio)) * 100;
|
||||
|
||||
return { x, y };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user