From eed89f02a9219417fa5f94c0d6c08f5981d23823 Mon Sep 17 00:00:00 2001 From: rahighi Date: Thu, 26 Aug 2021 11:46:48 +0430 Subject: added multiple language support with related layout directions --- modern/src/map/CurrentLocationMap.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'modern/src/map/CurrentLocationMap.js') 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; }; -- cgit v1.2.3