init commit,

This commit is contained in:
louiscklaw
2025-05-28 09:55:51 +08:00
commit efe70ceb69
8042 changed files with 951668 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import type {
ScaleControlProps,
GeolocateControlProps,
FullscreenControlProps,
NavigationControlProps,
} from 'react-map-gl/mapbox';
import {
ScaleControl,
GeolocateControl,
NavigationControl,
FullscreenControl,
} from 'react-map-gl/mapbox';
// ----------------------------------------------------------------------
export type MapControlsProps = {
hideScale?: boolean;
hideGeolocate?: boolean;
hideFullscreen?: boolean;
hideNavigation?: boolean;
slotProps?: {
scale?: ScaleControlProps;
geolocate?: GeolocateControlProps;
fullscreen?: FullscreenControlProps;
navigation?: NavigationControlProps;
};
};
export function MapControls({
hideScale,
hideGeolocate,
hideFullscreen,
hideNavigation,
slotProps,
}: MapControlsProps) {
return (
<>
{!hideGeolocate && (
<GeolocateControl
position="top-left"
{...slotProps?.geolocate}
positionOptions={{ enableHighAccuracy: true, ...slotProps?.geolocate?.positionOptions }}
/>
)}
{!hideFullscreen && <FullscreenControl position="top-left" {...slotProps?.fullscreen} />}
{!hideScale && <ScaleControl position="bottom-left" {...slotProps?.scale} />}
{!hideNavigation && <NavigationControl position="bottom-left" {...slotProps?.navigation} />}
</>
);
}