Add camera presets and enhance App component with camera controls
This commit is contained in:
@@ -48,6 +48,23 @@ Available methods:
|
||||
- `flyTo(coordinate, duration?)` — quick helper that animates to a small region around `coordinate`.
|
||||
- `fitBounds(northEast, southWest, options?)` — fit the two coordinates with optional `edgePadding`.
|
||||
|
||||
### Camera presets
|
||||
|
||||
For convenience, `CameraPresets` provides common camera configurations you can pass into `animateCamera`.
|
||||
|
||||
Example:
|
||||
|
||||
```ts
|
||||
import { CameraPresets } from '@lynkedup/map-sdk';
|
||||
mapRef.current?.animateCamera(CameraPresets.viewOverlook({ latitude: 37.78825, longitude: -122.4324 }), { duration: 1000 });
|
||||
```
|
||||
|
||||
Provided presets:
|
||||
|
||||
- `viewOverlook(center)` — tilt and rotate to create an overview with pitch ~65° and heading ~45°.
|
||||
- `streetLevel(center)` — street-level view (pitch 0, zoom high).
|
||||
- `overview(center)` — wide overview of the area.
|
||||
|
||||
---
|
||||
|
||||
## PropertyMap (high-level SDK component) ✅
|
||||
|
||||
26
packages/map-sdk/src/cameraPresets.ts
Normal file
26
packages/map-sdk/src/cameraPresets.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { Camera, LatLng } from 'react-native-maps';
|
||||
|
||||
export type CameraPreset = (center: LatLng) => Partial<Camera>;
|
||||
|
||||
export const CameraPresets: Record<string, CameraPreset> = {
|
||||
viewOverlook: (center: LatLng) => ({
|
||||
center,
|
||||
pitch: 65,
|
||||
heading: 45,
|
||||
zoom: 16,
|
||||
}),
|
||||
|
||||
streetLevel: (center: LatLng) => ({
|
||||
center,
|
||||
pitch: 0,
|
||||
heading: 0,
|
||||
zoom: 18,
|
||||
}),
|
||||
|
||||
overview: (center: LatLng) => ({
|
||||
center,
|
||||
pitch: 0,
|
||||
heading: 0,
|
||||
zoom: 12,
|
||||
}),
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
export { default as MapView } from './MapView';
|
||||
export type { MapHandle } from './MapView';
|
||||
export { Marker, Polyline, PROVIDER_GOOGLE } from 'react-native-maps';
|
||||
export { CameraPresets } from './cameraPresets';
|
||||
|
||||
// High-level components
|
||||
export { default as PropertyMap } from './components/PropertyMap';
|
||||
|
||||
Reference in New Issue
Block a user