diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-22 09:57:51 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-22 09:57:51 -0700 |
commit | 67d7ce8e0f428c521d3d032e8145108c9b2a5f45 (patch) | |
tree | 9f350497ebc64951ce2070723ab2b66e1a0f5472 /modern/src/map/main/SelectedDeviceMap.js | |
parent | 111347e3f40640aa4c43c0bc2666d7a92ce03bb2 (diff) | |
download | trackermap-web-67d7ce8e0f428c521d3d032e8145108c9b2a5f45.tar.gz trackermap-web-67d7ce8e0f428c521d3d032e8145108c9b2a5f45.tar.bz2 trackermap-web-67d7ce8e0f428c521d3d032e8145108c9b2a5f45.zip |
Rename map plugins
Diffstat (limited to 'modern/src/map/main/SelectedDeviceMap.js')
-rw-r--r-- | modern/src/map/main/SelectedDeviceMap.js | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/modern/src/map/main/SelectedDeviceMap.js b/modern/src/map/main/SelectedDeviceMap.js deleted file mode 100644 index 250be372..00000000 --- a/modern/src/map/main/SelectedDeviceMap.js +++ /dev/null @@ -1,30 +0,0 @@ -import { useEffect } from 'react'; - -import { useSelector } from 'react-redux'; -import dimensions from '../../common/theme/dimensions'; -import { map } from '../core/Map'; -import { usePrevious } from '../../reactHelper'; -import usePersistedState from '../../common/util/usePersistedState'; - -const SelectedDeviceMap = () => { - const selectedDeviceId = useSelector((state) => state.devices.selectedId); - const previousDeviceId = usePrevious(selectedDeviceId); - - const position = useSelector((state) => state.positions.items[selectedDeviceId]); - - const [mapFollow] = usePersistedState('mapFollow', false); - - useEffect(() => { - if ((selectedDeviceId !== previousDeviceId || mapFollow) && position) { - map.easeTo({ - center: [position.longitude, position.latitude], - zoom: Math.max(map.getZoom(), 10), - offset: [0, -dimensions.popupMapOffset / 2], - }); - } - }); - - return null; -}; - -export default SelectedDeviceMap; |