Skip to content

Commit

Permalink
fix map tooltip disabled (#75)
Browse files Browse the repository at this point in the history
* fix tooltip not displayed

Signed-off-by: jamal-khey <myjamal89@gmail.com>
  • Loading branch information
jamal-khey committed Jun 3, 2024
1 parent 571973e commit 6eae1a2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/components/network-map-viewer/network/network-map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Map, NavigationControl, useControl } from 'react-map-gl';
import { getNominalVoltageColor } from '../../../utils/colors';
import { useNameOrId } from '../utils/equipmentInfosHandler';
import { GeoData } from './geo-data';
import DrawControl, { DRAW_MODES, getMapDrawer } from './draw-control.ts';
import DrawControl, { getMapDrawer } from './draw-control.ts';
import { LineFlowColorMode, LineFlowMode, LineLayer } from './line-layer';
import { MapEquipments } from './map-equipments';
import { SubstationLayer } from './substation-layer';
Expand Down Expand Up @@ -121,12 +121,15 @@ const NetworkMap = forwardRef((props, ref) => {
}, [theme]);
const [cursorType, setCursorType] = useState('grab');
const [isDragging, setDragging] = useState(false);
const [isPolygonDrawingStarted, setPolygonDrawingStarted] = useState(
DRAW_MODES.SIMPLE_SELECT
);

//NOTE these constants are moved to the component's parameters list
//const currentNode = useSelector((state) => state.currentTreeNode);
const { onPolygonChanged, centerOnSubstation, onDrawEvent } = props;
const {
onPolygonChanged,
centerOnSubstation,
onDrawEvent,
shouldDisableToolTip,
} = props;

const { getNameOrId } = useNameOrId(props.useName);

Expand Down Expand Up @@ -286,7 +289,7 @@ const NetworkMap = forwardRef((props, ref) => {
return (
tooltip &&
tooltip.visible &&
!isPolygonDrawingStarted &&
!shouldDisableToolTip &&
//As of now only LINE tooltip is implemented, the following condition is to be removed or tweaked once other types of line tooltip are implemented
tooltip.equipmentType === EQUIPMENT_TYPES.LINE && (
<div
Expand Down Expand Up @@ -689,7 +692,6 @@ const NetworkMap = forwardRef((props, ref) => {
defaultMode="simple_select"
readyToDisplay={readyToDisplay}
onDrawPolygonModeActive={(polygon_draw) => {
setPolygonDrawingStarted(polygon_draw);
props.onDrawPolygonModeActive(polygon_draw);
}}
onCreate={onCreate}
Expand Down Expand Up @@ -727,6 +729,7 @@ NetworkMap.defaultProps = {
updatedLines: [],
useName: true,
visible: true,
shouldDisableToolTip: false,

onSubstationClick: () => {},
onSubstationClickChooseVoltageLevel: () => {},
Expand Down Expand Up @@ -779,6 +782,7 @@ NetworkMap.propTypes = {
updatedLines: PropTypes.array,
useName: PropTypes.bool,
visible: PropTypes.bool,
shouldDisableToolTip: PropTypes.bool,

onHvdcLineMenuClick: PropTypes.func,
onLineMenuClick: PropTypes.func,
Expand Down

0 comments on commit 6eae1a2

Please sign in to comment.