diff options
author | rahighi <rahighi> | 2021-08-26 11:46:48 +0430 |
---|---|---|
committer | rahighi <rahighi> | 2021-08-26 11:46:48 +0430 |
commit | eed89f02a9219417fa5f94c0d6c08f5981d23823 (patch) | |
tree | 78b378e1b1bcc54a068c304b1b9af73aa0e8c3a9 /modern/src/map/CurrentLocationMap.js | |
parent | db406fcc787df2fa865e5c5fe333f152e533cda1 (diff) | |
download | trackermap-web-eed89f02a9219417fa5f94c0d6c08f5981d23823.tar.gz trackermap-web-eed89f02a9219417fa5f94c0d6c08f5981d23823.tar.bz2 trackermap-web-eed89f02a9219417fa5f94c0d6c08f5981d23823.zip |
added multiple language support with related layout directions
Diffstat (limited to 'modern/src/map/CurrentLocationMap.js')
-rw-r--r-- | modern/src/map/CurrentLocationMap.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modern/src/map/CurrentLocationMap.js b/modern/src/map/CurrentLocationMap.js index 69724ce1..c875662d 100644 --- a/modern/src/map/CurrentLocationMap.js +++ b/modern/src/map/CurrentLocationMap.js @@ -1,9 +1,14 @@ import maplibregl from 'maplibre-gl'; import { useEffect } from 'react'; +import { useLocalization } from '../common/localization'; import { map } from './Map'; const CurrentLocationMap = () => { + const {direction} = useLocalization(); + useEffect(() => { + const controlsPosition = direction ==='rtl' ? 'top-left' : 'top-right'; + const control = new maplibregl.GeolocateControl({ positionOptions: { enableHighAccuracy: true, @@ -11,9 +16,9 @@ const CurrentLocationMap = () => { }, trackUserLocation: true, }); - map.addControl(control); + map.addControl(control,controlsPosition); return () => map.removeControl(control); - }, []); + }, [direction]); return null; }; |