1
1
import { isNil } from 'lodash' ;
2
- import React , { useCallback , useEffect , useRef } from 'react' ;
2
+ import React , { useCallback , useEffect , useMemo , useRef } from 'react' ;
3
3
import { useParams } from 'react-router-dom' ;
4
4
import ReactMapGL , { AttributionControl , ScaleControl , MapRef } from 'react-map-gl/maplibre' ;
5
5
import { useDispatch , useSelector } from 'react-redux' ;
6
6
import { updateViewport , Viewport } from 'reducers/map' ;
7
7
import { RootState } from 'reducers' ;
8
8
9
9
import { LAYER_GROUPS_ORDER , LAYERS } from 'config/layerOrder' ;
10
- import { getTerrain3DExaggeration } from 'reducers/map/selectors' ;
10
+ import { getSignalingSystems , getTerrain3DExaggeration } from 'reducers/map/selectors' ;
11
11
12
12
/* Main data & layers */
13
13
import Background from 'common/Map/Layers/Background' ;
@@ -36,7 +36,7 @@ import Switches from 'common/Map/Layers/Switches';
36
36
import TracksGeographic from 'common/Map/Layers/TracksGeographic' ;
37
37
import TracksOSM from 'common/Map/Layers/TracksOSM' ;
38
38
import colors from 'common/Map/Consts/colors' ;
39
- import osmBlankStyle from 'common/Map/Layers/osmBlankStyle ' ;
39
+ import { blankStyle } from 'common/Map/Layers/blankStyle ' ;
40
40
import { CUSTOM_ATTRIBUTION } from 'common/Map/const' ;
41
41
import LineSearchLayer from 'common/Map/Layers/LineSearchLayer' ;
42
42
@@ -47,6 +47,7 @@ function Map() {
47
47
( state : RootState ) => state . map
48
48
) ;
49
49
const terrain3DExaggeration = useSelector ( getTerrain3DExaggeration ) ;
50
+ const signalingSystems = useSelector ( getSignalingSystems ) ;
50
51
const mapRef = useRef < MapRef | null > ( null ) ;
51
52
const { urlLat, urlLon, urlZoom, urlBearing, urlPitch } = useParams ( ) ;
52
53
const dispatch = useDispatch ( ) ;
@@ -95,6 +96,8 @@ function Map() {
95
96
// eslint-disable-next-line react-hooks/exhaustive-deps
96
97
} , [ ] ) ;
97
98
99
+ const spritesStyle = useMemo ( ( ) => blankStyle ( signalingSystems ) , [ signalingSystems ] ) ;
100
+
98
101
return (
99
102
< main className = "mastcontainer mastcontainer-map" >
100
103
< MapButtons
@@ -108,7 +111,7 @@ function Map() {
108
111
ref = { mapRef }
109
112
cursor = "normal"
110
113
style = { { width : '100%' , height : '100%' } }
111
- mapStyle = { osmBlankStyle }
114
+ mapStyle = { spritesStyle }
112
115
onMove = { ( e ) => updateViewportChange ( e . viewState ) }
113
116
onMoveEnd = { ( e ) => updateViewportChange ( e . viewState , true ) }
114
117
attributionControl = { false } // Defined below
0 commit comments