aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/MapCamera.js
blob: 7ebf24fb6d175acbe9a918f19fa6d1d6d9c5532b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { useEffect } from 'react';

import { map } from './core/MapView';

const MapCamera = ({
  latitude, longitude,
}) => {
  useEffect(() => {
    map.jumpTo({
      center: [longitude, latitude],
      zoom: Math.max(map.getZoom(), 10),
    });
  }, [latitude, longitude]);

  return null;
};

export default MapCamera;