import { Feature, FeatureCollection, GeoJsonProperties, Geometry } from 'geojson'; import { MarkerProps } from '../../types/MarkerProps'; interface FitBoundsProps { markers?: MarkerProps[]; features?: FeatureCollection | Feature | Feature[]; padding?: number; duration?: number; disableAnimation?: boolean; fitBounds?: boolean; animationKey?: unknown; openPopup?: boolean; } /** * FitBounds Component * ------------------- * Automatically adjusts the map viewport to fit visible markers or GeoJSON features. * * Workflow: * 1. Collects coordinates from valid markers and/or GeoJSON features. * 2. Computes bounding box (`LngLatBounds`) for all visible points. * 3. Applies `map.fitBounds()` or `map.flyTo()` depending on the data (single vs multiple points). * 4. Reacts to changes via `animationKey` — prevents redundant animations on repeated renders. * * Props: * - `markers`: array of marker objects (`{ id, lat, lng }`) to fit into view. * - `features`: GeoJSON data (Feature, FeatureCollection, or array of Features). * - `padding`: padding (px) around fitted bounds (default: 50). * - `duration`: animation duration in ms (default: 1000). * - `disableAnimation`: disables map animations when true. * - `fitBounds`: whether bounds fitting is enabled. * - `animationKey`: dependency key to control when to re-run fitting logic. * - `openPopup`: if true, temporarily skips bounds updates to avoid interfering with popups. * * Dependencies: * - `react-map-gl` for Mapbox context. * - `mapbox-gl` for geometry calculations and view transitions. * - `isValidMarker` from local types — filters out invalid marker objects. * - `@tracktor/react-utils` helpers for type-safe checks. */ declare const FitBounds: ({ markers, features, padding, duration, disableAnimation, fitBounds, animationKey, openPopup, }: FitBoundsProps) => null; export default FitBounds;