mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-09 12:57:48 +00:00
changing pins
This commit is contained in:
@@ -180,7 +180,8 @@ export const pins = {
|
||||
lng: -74.07,
|
||||
city: 'Bogota',
|
||||
code: 'BOG',
|
||||
available: true
|
||||
available: true,
|
||||
x: -0.5
|
||||
},
|
||||
{
|
||||
lat: -34.61,
|
||||
@@ -556,16 +557,16 @@ export const pins = {
|
||||
],
|
||||
edges: [
|
||||
{
|
||||
lat: 37.77,
|
||||
lng: -122.42,
|
||||
city: 'San Francisco',
|
||||
code: 'SFO',
|
||||
lat: 40.71,
|
||||
lng: -74.01,
|
||||
city: 'New York',
|
||||
code: 'NYC',
|
||||
available: true
|
||||
},
|
||||
{
|
||||
lat: 48.86,
|
||||
lng: 2.35,
|
||||
city: 'Paris',
|
||||
lat: 50.11,
|
||||
lng: 8.68,
|
||||
city: 'Frankfurt',
|
||||
code: 'FRA',
|
||||
available: true
|
||||
},
|
||||
@@ -579,19 +580,20 @@ export const pins = {
|
||||
],
|
||||
regions: [
|
||||
{
|
||||
lat: 37.77,
|
||||
lng: -122.42,
|
||||
city: 'San Francisco',
|
||||
code: 'SFO',
|
||||
lat: 40.71,
|
||||
lng: -74.01,
|
||||
city: 'New York',
|
||||
code: 'NYC',
|
||||
available: true
|
||||
},
|
||||
{
|
||||
lat: 48.86,
|
||||
lng: 2.35,
|
||||
city: 'Paris',
|
||||
lat: 50.11,
|
||||
lng: 8.68,
|
||||
city: 'Frankfurt',
|
||||
code: 'FRA',
|
||||
available: true
|
||||
},
|
||||
|
||||
{
|
||||
lat: -33.87,
|
||||
lng: 151.21,
|
||||
|
||||
@@ -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