Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/frontend/src/Components/map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import Button from 'react-bootstrap/Button';
import cloneDeep from 'lodash/cloneDeep';
import Spinner from 'react-bootstrap/Spinner';
import PropTypes from 'prop-types';

// Internal imports
import { addCameraGroups } from '../data/webcams.js';
Expand Down Expand Up @@ -617,6 +618,20 @@
);
});

if (rootCamera) {
mapRef.current.on('change:size', function() {
const params = new URLSearchParams(window.location.search);

Check warning on line 623 in src/frontend/src/Components/map/Map.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `globalThis` over `window`.

See more on https://sonarcloud.io/project/issues?id=bcgov_DriveBC.ca&issues=AZ10GlLwIXK3d2b_758n&open=AZ10GlLwIXK3d2b_758n&pullRequest=1289
const urlZoom = parseFloat(params.get('zoom'));

Check warning on line 624 in src/frontend/src/Components/map/Map.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `Number.parseFloat` over `parseFloat`.

See more on https://sonarcloud.io/project/issues?id=bcgov_DriveBC.ca&issues=AZ10GlLwIXK3d2b_758o&open=AZ10GlLwIXK3d2b_758o&pullRequest=1289
mapView.current.setZoom(urlZoom);
mapView.current.setCenter(
fromLonLat([
rootCamera.location.coordinates[0],
rootCamera.location.coordinates[1]
])
);
});
}

// Event listeners
mapRef.current.on('click', async e => {
const features = mapRef.current.getFeaturesAtPixel(e.pixel, {
Expand Down Expand Up @@ -1330,3 +1345,13 @@
</div>
);
}

DriveBCMap.propTypes = {
mapProps: PropTypes.shape({
rootCamera: PropTypes.shape({
location: PropTypes.shape({
coordinates: PropTypes.arrayOf(PropTypes.number),
}),
}),
}),
};
Loading