diff --git a/app/scripts/components/common/map/hooks/use-fit-bbox.ts b/app/scripts/components/common/map/hooks/use-fit-bbox.ts index ba35c169d..0b40b4603 100644 --- a/app/scripts/components/common/map/hooks/use-fit-bbox.ts +++ b/app/scripts/components/common/map/hooks/use-fit-bbox.ts @@ -26,7 +26,7 @@ export default function useFitBbox( | [number, number, number, number] | undefined; - if (bounds?.length && checkFitBoundsFromLayer(bounds, mapInstance as any)) { + if (bounds?.length && checkFitBoundsFromLayer(bounds, mapInstance)) { mapInstance.fitBounds(bounds, { padding: FIT_BOUNDS_PADDING }); } }, [mapInstance, isUserPositionSet, initialBbox, stacBbox]); diff --git a/app/scripts/components/common/map/utils.ts b/app/scripts/components/common/map/utils.ts index 555466c64..f533ece4a 100644 --- a/app/scripts/components/common/map/utils.ts +++ b/app/scripts/components/common/map/utils.ts @@ -1,5 +1,6 @@ import axios, { Method } from 'axios'; import { Map as MapboxMap } from 'mapbox-gl'; +import { MapRef } from 'react-map-gl'; import { endOfDay, startOfDay } from "date-fns"; import { StacFeature } from "./types"; import { userTzDate2utcString } from "$utils/date"; @@ -35,7 +36,7 @@ export function getMergedBBox(features: StacFeature[]) { export function checkFitBoundsFromLayer( layerBounds?: [number, number, number, number], - mapInstance?: MapboxMap + mapInstance?: MapboxMap | MapRef ) { if (!layerBounds || !mapInstance) return false;