Skip to content

Commit b07c68b

Browse files
committed
use current zoom when opening OSM
1 parent 1e71d54 commit b07c68b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/components/Map.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export function Map({
136136
y={contextMenu.y}
137137
lat={contextMenu.lat}
138138
lng={contextMenu.lng}
139+
zoom={effectiveMapState.zoom}
139140
onClose={() =>
140141
setContextMenu((prev) => ({ ...prev, show: false }))
141142
}
@@ -177,6 +178,7 @@ export function Map({
177178
y={contextMenu.y}
178179
lat={contextMenu.lat}
179180
lng={contextMenu.lng}
181+
zoom={effectiveMapState.zoom}
180182
onClose={() => setContextMenu((prev) => ({ ...prev, show: false }))}
181183
/>
182184
)}

src/components/MapContextMenu.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ interface MapContextMenuProps {
55
y: number;
66
lat: number;
77
lng: number;
8+
zoom: number;
89
onClose: () => void;
910
}
1011

@@ -13,6 +14,7 @@ export function MapContextMenu({
1314
y,
1415
lat,
1516
lng,
17+
zoom,
1618
onClose,
1719
}: MapContextMenuProps) {
1820
useEffect(() => {
@@ -31,10 +33,11 @@ export function MapContextMenu({
3133
id="map-context-menu"
3234
className="absolute z-50 bg-white rounded-lg shadow-lg border border-gray-200 py-1 w-[200px]"
3335
style={{ left: x, top: y }}
34-
onClick={(e) => e.stopPropagation()}
3536
>
3637
<a
37-
href={`https://www.openstreetmap.org/#map=16/${lat}/${lng}`}
38+
href={`https://www.openstreetmap.org/#map=${Math.round(
39+
zoom
40+
)}/${lat}/${lng}`}
3841
target="_blank"
3942
rel="noopener noreferrer"
4043
className="block px-4 py-2 text-sm hover:bg-slate-100"

0 commit comments

Comments
 (0)