@@ -11,7 +11,7 @@ import 'common/Map/Map.scss';
11
11
12
12
import { useModal } from 'common/BootstrapSNCF/ModalSNCF' ;
13
13
import { LoaderState } from 'common/Loader' ;
14
- import { loadDataModel , updateTotalsIssue } from 'reducers/editor' ;
14
+ import { loadDataModel , selectLayers , updateTotalsIssue } from 'reducers/editor' ;
15
15
import { updateInfraID } from 'reducers/osrdconf' ;
16
16
import { updateViewport , Viewport } from 'reducers/map' ;
17
17
import { getInfraID } from 'reducers/osrdconf/selectors' ;
@@ -27,7 +27,6 @@ import {
27
27
EditorContextType ,
28
28
ExtendedEditorContextType ,
29
29
FullTool ,
30
- ReadOnlyEditorContextType ,
31
30
Reducer ,
32
31
} from './tools/editorContextTypes' ;
33
32
import { switchProps } from './tools/switchProps' ;
@@ -176,6 +175,11 @@ const Editor: FC = () => {
176
175
useEffect ( ( ) => {
177
176
if ( toolAndState . tool . onMount ) toolAndState . tool . onMount ( extendedContext ) ;
178
177
178
+ const layersList = toolAndState . tool . requiredLayers
179
+ ? new Set ( [ ...editorState . editorLayers , ...toolAndState . tool . requiredLayers ] )
180
+ : editorState . editorLayers ;
181
+ dispatch ( selectLayers ( layersList ) ) ;
182
+
179
183
return ( ) => {
180
184
if ( toolAndState . tool . onUnmount ) toolAndState . tool . onUnmount ( extendedContext ) ;
181
185
} ;
@@ -191,7 +195,7 @@ const Editor: FC = () => {
191
195
< div className = "tool-box bg-primary" >
192
196
{ Object . values ( TOOL_TYPES ) . map ( ( toolType : TOOL_TYPES ) => {
193
197
const tool = TOOLS [ toolType ] ;
194
- const { id, icon : IconComponent , labelTranslationKey, isDisabled } = tool ;
198
+ const { id, icon : IconComponent , labelTranslationKey } = tool ;
195
199
const label = t ( labelTranslationKey ) ;
196
200
197
201
return (
@@ -206,10 +210,6 @@ const Editor: FC = () => {
206
210
onClick = { ( ) => {
207
211
switchTool ( { toolType, toolState : { } } ) ;
208
212
} }
209
- disabled = {
210
- // TODO: clarify the type of extendedContext
211
- isDisabled && isDisabled ( extendedContext as ReadOnlyEditorContextType < any > )
212
- }
213
213
>
214
214
< span className = "sr-only" > { label } </ span >
215
215
< IconComponent />
0 commit comments