diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-09-05 11:48:56 -0700 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2021-09-05 11:48:56 -0700 |
commit | 8be2723476e7b3f1905446a2d7dce36c8c11cf60 (patch) | |
tree | 5c0ea1d9aee09fc4b384d61190f5f1fb3740beb6 /modern/src | |
parent | 1aefaf62068c9d74df8cebe39616dc9f8bdc6596 (diff) | |
download | etbsa-traccar-web-8be2723476e7b3f1905446a2d7dce36c8c11cf60.tar.gz etbsa-traccar-web-8be2723476e7b3f1905446a2d7dce36c8c11cf60.tar.bz2 etbsa-traccar-web-8be2723476e7b3f1905446a2d7dce36c8c11cf60.zip |
Add map padding
Diffstat (limited to 'modern/src')
-rw-r--r-- | modern/src/MainPage.js | 2 | ||||
-rw-r--r-- | modern/src/map/MapPadding.js | 14 |
2 files changed, 16 insertions, 0 deletions
diff --git a/modern/src/MainPage.js b/modern/src/MainPage.js index 4de1107..e632bf9 100644 --- a/modern/src/MainPage.js +++ b/modern/src/MainPage.js @@ -21,6 +21,7 @@ import CurrentLocationMap from './map/CurrentLocationMap'; import BottomMenu from './components/BottomMenu'; import { useTranslation } from './LocalizationProvider'; import PoiMap from './map/PoiMap'; +import MapPadding from './map/MapPadding'; const useStyles = makeStyles((theme) => ({ root: { @@ -109,6 +110,7 @@ const MainPage = () => { return ( <div className={classes.root}> <Map> + {!isTablet && <MapPadding left={parseInt(theme.dimensions.drawerWidthDesktop)} />} <CurrentLocationMap /> <GeofenceMap /> <AccuracyMap /> diff --git a/modern/src/map/MapPadding.js b/modern/src/map/MapPadding.js new file mode 100644 index 0000000..cb16579 --- /dev/null +++ b/modern/src/map/MapPadding.js @@ -0,0 +1,14 @@ +import { useEffect } from 'react'; + +import { map } from './Map'; + +const MapPadding = ({ top, right, bottom, left }) => { + useEffect(() => { + map.setPadding({ top, right, bottom, left }); + return () => map.setPadding({ top: 0, right: 0, bottom: 0, left: 0 }); + }, [top, right, bottom, left]); + + return null; +}; + +export default MapPadding; |