kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
zooming to user position works
rodzic
915bd837ed
commit
5e188cfdaa
|
@ -16,6 +16,9 @@ import com.geeksville.mesh.model.UIState
|
|||
import com.mapbox.geojson.Feature
|
||||
import com.mapbox.geojson.FeatureCollection
|
||||
import com.mapbox.geojson.Point
|
||||
import com.mapbox.mapboxsdk.camera.CameraPosition
|
||||
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng
|
||||
import com.mapbox.mapboxsdk.maps.MapView
|
||||
import com.mapbox.mapboxsdk.maps.Style
|
||||
import com.mapbox.mapboxsdk.style.layers.Property
|
||||
|
@ -126,6 +129,14 @@ fun MapContent() {
|
|||
style.addSource(nodePositions)
|
||||
style.addLayer(nodeLayer)
|
||||
}
|
||||
|
||||
// Center on the user's position (if we have it)
|
||||
NodeDB.ourNodeInfo?.position?.let {
|
||||
val cameraPos = CameraPosition.Builder().target(
|
||||
LatLng(it.latitude, it.longitude)
|
||||
).zoom(8.0).build()
|
||||
map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPos), 1000)
|
||||
}
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
|
|
@ -6,7 +6,4 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
mapbox:mapbox_uiZoomGestures="true"
|
||||
mapbox:mapbox_uiScrollGestures="true"
|
||||
mapbox:mapbox_cameraTargetLat="-32.557013"
|
||||
mapbox:mapbox_cameraTargetLng="-56.149056"
|
||||
mapbox:mapbox_cameraZoom="5.526846"></com.mapbox.mapboxsdk.maps.MapView>
|
||||
mapbox:mapbox_uiScrollGestures="true"></com.mapbox.mapboxsdk.maps.MapView>
|
||||
|
|
Ładowanie…
Reference in New Issue