diff --git a/package-lock.json b/package-lock.json index 783e7de855..97d751491f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,6 @@ "@turf/bbox": "^6.5.0", "@turf/center": "^6.5.0", "@turf/helpers": "^6.5.0", - "@turf/intersect": "^6.5.0", "canvg": "^4.0.1", "filesize": "^10.1.1", "get-video-id": "^4.1.5", @@ -7668,30 +7667,6 @@ "url": "https://opencollective.com/turf" } }, - "node_modules/@turf/intersect": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/intersect/-/intersect-6.5.0.tgz", - "integrity": "sha512-2legGJeKrfFkzntcd4GouPugoqPUjexPZnOvfez+3SfIMrHvulw8qV8u7pfVyn2Yqs53yoVCEjS5sEpvQ5YRQg==", - "dependencies": { - "@turf/helpers": "^6.5.0", - "@turf/invariant": "^6.5.0", - "polygon-clipping": "^0.15.3" - }, - "funding": { - "url": "https://opencollective.com/turf" - } - }, - "node_modules/@turf/invariant": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/@turf/invariant/-/invariant-6.5.0.tgz", - "integrity": "sha512-Wv8PRNCtPD31UVbdJE/KVAWKe7l6US+lJItRR/HOEW3eh+U/JwRCSUl/KZ7bmjM/C+zLNoreM2TU6OoLACs4eg==", - "dependencies": { - "@turf/helpers": "^6.5.0" - }, - "funding": { - "url": "https://opencollective.com/turf" - } - }, "node_modules/@turf/meta": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/@turf/meta/-/meta-6.5.0.tgz", @@ -23592,15 +23567,6 @@ "semver-compare": "^1.0.0" } }, - "node_modules/polygon-clipping": { - "version": "0.15.7", - "resolved": "https://registry.npmjs.org/polygon-clipping/-/polygon-clipping-0.15.7.tgz", - "integrity": "sha512-nhfdr83ECBg6xtqOAJab1tbksbBAOMUltN60bU+llHVOL0e5Onm1WpAXXWXVB39L8AJFssoIhEVuy/S90MmotA==", - "dependencies": { - "robust-predicates": "^3.0.2", - "splaytree": "^3.1.0" - } - }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", @@ -27843,11 +27809,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/robust-predicates": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz", - "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==" - }, "node_modules/rollup": { "version": "2.79.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", @@ -29039,11 +29000,6 @@ "node": ">= 6" } }, - "node_modules/splaytree": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/splaytree/-/splaytree-3.1.2.tgz", - "integrity": "sha512-4OM2BJgC5UzrhVnnJA4BkHKGtjXNzzUfpQjCO8I05xYPsfS/VuQDwjCGGMi8rYQilHEV4j8NBqTFbls/PZEE7A==" - }, "node_modules/split-on-first": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-1.1.0.tgz", diff --git a/package.json b/package.json index 737b261863..e9bd878cf5 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "@turf/bbox": "^6.5.0", "@turf/center": "^6.5.0", "@turf/helpers": "^6.5.0", - "@turf/intersect": "^6.5.0", "canvg": "^4.0.1", "filesize": "^10.1.1", "get-video-id": "^4.1.5", diff --git a/src/storyMap/components/StoryMapForm/MapLocationDialog.js b/src/storyMap/components/StoryMapForm/MapLocationDialog.js index 3dc4e51833..3685cae654 100644 --- a/src/storyMap/components/StoryMapForm/MapLocationDialog.js +++ b/src/storyMap/components/StoryMapForm/MapLocationDialog.js @@ -21,8 +21,6 @@ import React, { useRef, useState, } from 'react'; -import * as turf from '@turf/helpers'; -import turfIntersect from '@turf/intersect'; import _ from 'lodash/fp'; import { Trans, useTranslation } from 'react-i18next'; import DeleteIcon from '@mui/icons-material/Delete'; @@ -50,36 +48,6 @@ import VisualizationMapRemoteSource from 'sharedData/visualization/components/Vi import DataLayerDialog from './DataLayerDialog'; import { useStoryMapConfigContext } from './storyMapConfigContext'; -const getDatalayerBoundsIntersection = (currentBounds, dataLayerBounds) => { - if (!dataLayerBounds) { - return true; - } - if (!currentBounds) { - return false; - } - const currentPoly = turf.polygon([ - [ - [currentBounds.getSouthWest().lng, currentBounds.getSouthWest().lat], - [currentBounds.getSouthWest().lng, currentBounds.getNorthEast().lat], - [currentBounds.getNorthEast().lng, currentBounds.getNorthEast().lat], - [currentBounds.getNorthEast().lng, currentBounds.getSouthWest().lat], - [currentBounds.getSouthWest().lng, currentBounds.getSouthWest().lat], - ], - ]); - - const dataLayerPoly = turf.polygon([ - [ - [dataLayerBounds.southWest.lng, dataLayerBounds.southWest.lat], - [dataLayerBounds.southWest.lng, dataLayerBounds.northEast.lat], - [dataLayerBounds.northEast.lng, dataLayerBounds.northEast.lat], - [dataLayerBounds.northEast.lng, dataLayerBounds.southWest.lat], - [dataLayerBounds.southWest.lng, dataLayerBounds.southWest.lat], - ], - ]); - - return turfIntersect(currentPoly, dataLayerPoly); -}; - const BearingIcon = () => { const { t } = useTranslation(); return ( @@ -327,13 +295,7 @@ const MapLocationDialog = props => { }, []); const onAddDataLayer = useCallback(dataLayerConfig => { - const currentBounds = mapRef.current?.getBounds(); - const dataLayerBounds = dataLayerConfig?.viewportConfig?.bounds; - const intersection = getDatalayerBoundsIntersection( - currentBounds, - dataLayerBounds - ); - setChangeBounds(!intersection); + setChangeBounds(true); setDataLayerConfig(dataLayerConfig); }, []);