diff --git a/src/components/diagrams/diagram-pane.jsx b/src/components/diagrams/diagram-pane.jsx index 82a19474c2..34241cf1d4 100644 --- a/src/components/diagrams/diagram-pane.jsx +++ b/src/components/diagrams/diagram-pane.jsx @@ -1090,7 +1090,6 @@ export function DiagramPane({ }, [currentNode] ); - return ( {({ width, height }) => ( diff --git a/src/components/map-viewer.jsx b/src/components/map-viewer.jsx index 60af3ad9b6..982f08f519 100644 --- a/src/components/map-viewer.jsx +++ b/src/components/map-viewer.jsx @@ -122,9 +122,12 @@ const MapViewer = ({ const openVoltageLevel = useCallback( (vlId) => { - openDiagramView(vlId, DiagramType.VOLTAGE_LEVEL); + // don't open the sld if the drawing mode is activated + if (!isInDrawingMode) { + openDiagramView(vlId, DiagramType.VOLTAGE_LEVEL); + } }, - [openDiagramView] + [openDiagramView, isInDrawingMode] ); function showInSpreadsheet(equipment) { diff --git a/src/components/network/network-map-tab.jsx b/src/components/network/network-map-tab.jsx index 2e3a62d002..fcc183d7bf 100644 --- a/src/components/network/network-map-tab.jsx +++ b/src/components/network/network-map-tab.jsx @@ -361,15 +361,20 @@ export const NetworkMapTab = ({ } const voltageLevelMenuClick = (equipment, x, y) => { - showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.VOLTAGE_LEVEL); + // don't display the voltage level menu in drawing mode. + if (!isInDrawingMode) { + showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.VOLTAGE_LEVEL); + } }; const chooseVoltageLevelForSubstation = useCallback( (idSubstation, x, y) => { - setChoiceVoltageLevelsSubstationId(idSubstation); - setPosition([x, y]); + if (!isInDrawingMode) { + setChoiceVoltageLevelsSubstationId(idSubstation); + setPosition([x, y]); + } }, - [] + [isInDrawingMode] ); const getEquipmentsNotFoundIds = useCallback( @@ -963,6 +968,18 @@ export const NetworkMapTab = ({ ); } + const displayEquipmentMenu = ( + equipment, + x, + y, + equipmentType, + isInDrawingMode + ) => { + // don't display the equipment menu in drawing mode. + if (!isInDrawingMode) { + showEquipmentMenu(equipment, x, y, equipmentType); + } + }; const renderEquipmentMenu = () => { if ( disabled || @@ -1040,13 +1057,31 @@ export const NetworkMapTab = ({ chooseVoltageLevelForSubstation } onSubstationMenuClick={(equipment, x, y) => - showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.SUBSTATION) + displayEquipmentMenu( + equipment, + x, + y, + EQUIPMENT_TYPES.SUBSTATION, + isInDrawingMode + ) } onLineMenuClick={(equipment, x, y) => - showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.LINE) + displayEquipmentMenu( + equipment, + x, + y, + EQUIPMENT_TYPES.LINE, + isInDrawingMode + ) } onHvdcLineMenuClick={(equipment, x, y) => - showEquipmentMenu(equipment, x, y, EQUIPMENT_TYPES.HVDC_LINE) + displayEquipmentMenu( + equipment, + x, + y, + EQUIPMENT_TYPES.HVDC_LINE, + isInDrawingMode + ) } onVoltageLevelMenuClick={voltageLevelMenuClick} mapBoxToken={mapBoxToken}