Skip to content

Commit

Permalink
Fix camera due to undefined bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
reyery committed Jun 13, 2024
1 parent 0945a92 commit 688946a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Map/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ const DeckGLMap = ({ data, colors }) => {

// Calculate total bounds with other geometries
let bboxPoly = bboxPolygon(calcBbox(zone));
if (data?.surroundings !== null)
if (data?.surroundings !== null && data.surroundings?.features?.length)
bboxPoly = union(bboxPoly, bboxPolygon(calcBbox(data.surroundings)));
if (data?.trees !== null)
if (data?.trees !== null && data.trees?.features?.length)
bboxPoly = union(bboxPoly, bboxPolygon(calcBbox(data.trees)));

cameraOptions.current = mapbox.cameraForBounds(calcBbox(bboxPoly), {
Expand Down

0 comments on commit 688946a

Please sign in to comment.