diff --git a/changelog.d/6609.misc b/changelog.d/6609.misc new file mode 100644 index 00000000000..bf1a9efe144 --- /dev/null +++ b/changelog.d/6609.misc @@ -0,0 +1 @@ +Live Location Sharing - Reset zoom level while focusing a user diff --git a/vector/src/main/java/im/vector/app/features/location/MapBoxMapExt.kt b/vector/src/main/java/im/vector/app/features/location/MapBoxMapExt.kt index cbfdf1dfda7..8e917c665a9 100644 --- a/vector/src/main/java/im/vector/app/features/location/MapBoxMapExt.kt +++ b/vector/src/main/java/im/vector/app/features/location/MapBoxMapExt.kt @@ -28,10 +28,12 @@ fun MapboxMap?.zoomToLocation(locationData: LocationData, preserveCurrentZoomLev } else { INITIAL_MAP_ZOOM_IN_PREVIEW } - this?.cameraPosition = CameraPosition.Builder() - .target(LatLng(locationData.latitude, locationData.longitude)) - .zoom(zoomLevel) - .build() + this?.easeCamera { + CameraPosition.Builder() + .target(LatLng(locationData.latitude, locationData.longitude)) + .zoom(zoomLevel) + .build() + } } fun MapboxMap?.zoomToBounds(latLngBounds: LatLngBounds) { diff --git a/vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt b/vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt index 1d6afa9cdac..e19580f13b7 100644 --- a/vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt +++ b/vector/src/main/java/im/vector/app/features/location/live/map/LocationLiveMapViewFragment.kt @@ -45,6 +45,7 @@ import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.utils.DimensionConverter import im.vector.app.core.utils.openLocation import im.vector.app.databinding.FragmentLocationLiveMapViewBinding +import im.vector.app.features.location.LocationData import im.vector.app.features.location.UrlMapProvider import im.vector.app.features.location.zoomToBounds import im.vector.app.features.location.zoomToLocation @@ -137,11 +138,9 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment - mapboxMap?.get()?.zoomToLocation(locationData, preserveCurrentZoomLevel = true) + mapboxMap?.get()?.zoomToLocation(locationData, preserveCurrentZoomLevel = false) } } diff --git a/vector/src/main/res/layout/fragment_location_live_map_view.xml b/vector/src/main/res/layout/fragment_location_live_map_view.xml index c5e978e4eee..95598db0ded 100644 --- a/vector/src/main/res/layout/fragment_location_live_map_view.xml +++ b/vector/src/main/res/layout/fragment_location_live_map_view.xml @@ -8,8 +8,9 @@ + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_gravity="center"/>