Skip to content

Commit

Permalink
[Map] Zoom camera on substation when locating it
Browse files Browse the repository at this point in the history
  • Loading branch information
jamal-khey committed Nov 5, 2024
1 parent 1164471 commit d23227c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/network-map-viewer/network/network-map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const INITIAL_CENTERED = {
centeredSubstationId: null,
centered: false,
};
const DEFAULT_LOCATE_SUBSTATION_ZOOM_LEVEL = 12;

// get polygon coordinates (features) or an empty object
function getPolygonFeatures() {
Expand Down Expand Up @@ -187,6 +188,8 @@ const NetworkMap = forwardRef((props, ref) => {
mapRef.current?.flyTo({
center: [geodata.lon, geodata.lat],
duration: 2000,
zoom: props.locateSubStationZoomLevel,
essential: true,
});
setCentered({
lastCenteredSubstation: centered.centeredSubstationId,
Expand Down Expand Up @@ -643,6 +646,7 @@ NetworkMap.defaultProps = {
useName: true,
visible: true,
shouldDisableToolTip: false,
locateSubStationZoomLevel: DEFAULT_LOCATE_SUBSTATION_ZOOM_LEVEL,

onSubstationClick: () => {},
onSubstationClickChooseVoltageLevel: () => {},
Expand Down Expand Up @@ -696,7 +700,7 @@ NetworkMap.propTypes = {
useName: PropTypes.bool,
visible: PropTypes.bool,
shouldDisableToolTip: PropTypes.bool,

locateSubStationZoomLevel: PropTypes.number,
onHvdcLineMenuClick: PropTypes.func,
onLineMenuClick: PropTypes.func,
onTieLineMenuClick: PropTypes.func,
Expand Down

0 comments on commit d23227c

Please sign in to comment.