|
@@ -1252,10 +1252,22 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
|
|
<MapLibreGL.ShapeSource
|
|
<MapLibreGL.ShapeSource
|
|
id="nomads"
|
|
id="nomads"
|
|
shape={nomads}
|
|
shape={nomads}
|
|
- onPress={(event) => {
|
|
|
|
- const isCluster = event.features[0].properties?.cluster;
|
|
|
|
|
|
+ onPress={async (event) => {
|
|
|
|
+ const feature = event.features[0];
|
|
|
|
+ const isCluster = feature.properties?.cluster;
|
|
|
|
|
|
if (isCluster) {
|
|
if (isCluster) {
|
|
|
|
+ const clusterCoordinates = (feature.geometry as GeoJSON.Point).coordinates;
|
|
|
|
+
|
|
|
|
+ const currentZoom = await mapRef.current?.getZoom();
|
|
|
|
+ const newZoom = (currentZoom || 0) + 3;
|
|
|
|
+
|
|
|
|
+ cameraRef.current?.setCamera({
|
|
|
|
+ centerCoordinate: clusterCoordinates,
|
|
|
|
+ zoomLevel: newZoom,
|
|
|
|
+ animationDuration: 500,
|
|
|
|
+ animationMode: 'flyTo'
|
|
|
|
+ });
|
|
return;
|
|
return;
|
|
} else {
|
|
} else {
|
|
handleUserPress(event);
|
|
handleUserPress(event);
|
|
@@ -1317,7 +1329,21 @@ const MapScreen: any = ({ navigation, route }: { navigation: any; route: any })
|
|
)}
|
|
)}
|
|
<MapLibreGL.Camera ref={cameraRef} />
|
|
<MapLibreGL.Camera ref={cameraRef} />
|
|
{location && (
|
|
{location && (
|
|
- <MapLibreGL.UserLocation animated={true} showsUserHeadingIndicator={true}>
|
|
|
|
|
|
+ <MapLibreGL.UserLocation
|
|
|
|
+ animated={true}
|
|
|
|
+ showsUserHeadingIndicator={true}
|
|
|
|
+ onPress={async () => {
|
|
|
|
+ const currentZoom = await mapRef.current?.getZoom();
|
|
|
|
+ const newZoom = (currentZoom || 0) + 2;
|
|
|
|
+
|
|
|
|
+ cameraRef.current?.setCamera({
|
|
|
|
+ centerCoordinate: [location.longitude, location.latitude],
|
|
|
|
+ zoomLevel: newZoom,
|
|
|
|
+ animationDuration: 500,
|
|
|
|
+ animationMode: 'flyTo'
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ >
|
|
{/* to do custom user location */}
|
|
{/* to do custom user location */}
|
|
</MapLibreGL.UserLocation>
|
|
</MapLibreGL.UserLocation>
|
|
)}
|
|
)}
|