diff options
Diffstat (limited to 'modern/src/map/overlay/useMapOverlays.js')
-rw-r--r-- | modern/src/map/overlay/useMapOverlays.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modern/src/map/overlay/useMapOverlays.js b/modern/src/map/overlay/useMapOverlays.js new file mode 100644 index 00000000..ede1e5b9 --- /dev/null +++ b/modern/src/map/overlay/useMapOverlays.js @@ -0,0 +1,29 @@ +import { useSelector } from 'react-redux'; +import { useTranslation } from '../../common/components/LocalizationProvider'; + +const sourceCustom = (url) => ({ + type: 'raster', + tiles: [url], + tileSize: 256, +}); + +export default () => { + const t = useTranslation(); + + const customMapOverlay = useSelector((state) => state.session.server?.overlayUrl); + + return [ + { + id: 'openSeaMap', + title: t('mapOpenSeaMap'), + source: sourceCustom('http://tiles.openseamap.org/seamark/{z}/{x}/{y}.png'), + available: true, + }, + { + id: 'custom', + title: t('mapOverlayCustom'), + source: sourceCustom(customMapOverlay), + available: !!customMapOverlay, + }, + ]; +}; |