Skip to content

Commit 58876df

Browse files
got it
1 parent 6166701 commit 58876df

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib/components/appwrite-network/map-marker.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
'group absolute z-10 flex size-2 cursor-pointer items-center justify-center opacity-0 [animation-delay:var(--delay)]',
4848
{ 'animate-fade-in': animate }
4949
)}
50-
style="left: {position.x}px; top: {position.y}px;--delay: {index * 10}ms;"
50+
style="left: {position.x}%; top: {position.y}%;--delay: {index * 10}ms;"
5151
data-region={slugify(city)}
5252
onmouseenter={handleSetActiveMarker}
5353
onfocus={handleSetActiveMarker}

src/lib/components/appwrite-network/utils/projections.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export const latLongToSvgPosition = ({ latitude, longitude }: Coordinates) => {
1717
const clampedLngRatio = Math.max(0, Math.min(1, lngRatio));
1818
const clampedLatRatio = Math.max(0, Math.min(1, latRatio));
1919

20-
const x = clampedLngRatio * MAP_WIDTH;
21-
const y = (1 - clampedLatRatio) * MAP_HEIGHT;
20+
const x = clampedLngRatio * 100;
21+
const y = (1 - clampedLatRatio) * 100;
2222

23-
return { x, y };
23+
return { x, y }; // percentages, e.g., { x: 42.3, y: 71.8 }
2424
};

0 commit comments

Comments
 (0)