Skip to content

Commit 5fe1dc1

Browse files
committed
better map bounds
1 parent 9bb9a1a commit 5fe1dc1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

apps/dashboard/components/analytics/map-component.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export function MapComponent({
294294
// Use flyTo with smooth animation and duration
295295
mapRef.current.flyTo(
296296
e.latlng,
297-
Math.min(mapRef.current.getZoom() + 2, 8),
297+
Math.min(mapRef.current.getZoom() + 2, 12),
298298
{
299299
animate: true,
300300
duration: 1.5,
@@ -323,7 +323,7 @@ export function MapComponent({
323323
return () => window.removeEventListener('resize', updateHeight);
324324
}, []);
325325

326-
const zoom = 2.2;
326+
const zoom = 1.5;
327327

328328
useEffect(() => {
329329
if (mapRef.current) {
@@ -398,7 +398,7 @@ export function MapComponent({
398398
const centroid = calculateCountryCentroid(countryFeature.geometry);
399399
if (centroid) {
400400
// Fly to the country with smooth animation
401-
mapRef.current.flyTo([centroid.lat, centroid.lng], 5, {
401+
mapRef.current.flyTo([centroid.lat, centroid.lng], 7, {
402402
animate: true,
403403
duration: 2,
404404
easeLinearity: 0.25,
@@ -438,12 +438,12 @@ export function MapComponent({
438438
center={[40, 3]}
439439
className={resolvedTheme === 'dark' ? 'map-dark' : 'map-light'}
440440
maxBounds={[
441-
[-85, -180],
442-
[85, 180],
441+
[-120, -400],
442+
[120, 400],
443443
]}
444-
maxBoundsViscosity={1.0}
445-
maxZoom={5}
446-
minZoom={2.2}
444+
maxBoundsViscosity={0.1}
445+
maxZoom={8}
446+
minZoom={1.5}
447447
preferCanvas
448448
ref={mapRef}
449449
style={{
@@ -462,7 +462,7 @@ export function MapComponent({
462462
// Use flyTo with smooth animation for map background clicks
463463
mapRef.current.flyTo(
464464
latlng,
465-
Math.min(mapRef.current.getZoom() + 1, 6),
465+
Math.min(mapRef.current.getZoom() + 1, 12),
466466
{
467467
animate: true,
468468
duration: 1.2,

0 commit comments

Comments
 (0)