From 372ff9ff978d71b4b4e36058fbf11b4579c43b84 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Wed, 20 Jul 2022 15:57:30 +0300 Subject: [PATCH 1/4] Move to initial zoom level when a user is focused. --- .../features/location/live/map/LocationLiveMapViewFragment.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 1d6afa9cda..869ce0d388 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 @@ -273,7 +273,7 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment - mapboxMap?.get()?.zoomToLocation(locationData, preserveCurrentZoomLevel = true) + mapboxMap?.get()?.zoomToLocation(locationData, preserveCurrentZoomLevel = false) } } From 0f3e4046e12848701d22a7e4a8be28193afd3ec8 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Wed, 20 Jul 2022 15:57:56 +0300 Subject: [PATCH 2/4] Animate camera while zooming to a user. --- .../im/vector/app/features/location/MapBoxMapExt.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 cbfdf1dfda..8e917c665a 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) { From 5c359d4d45e9abc98872c43f4b1a5013c1afac5f Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Wed, 20 Jul 2022 16:13:01 +0300 Subject: [PATCH 3/4] Changelog added. --- changelog.d/6609.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/6609.misc diff --git a/changelog.d/6609.misc b/changelog.d/6609.misc new file mode 100644 index 0000000000..bf1a9efe14 --- /dev/null +++ b/changelog.d/6609.misc @@ -0,0 +1 @@ +Live Location Sharing - Reset zoom level while focusing a user From 10322545aafa703ef7ebe8db455c9c803536e2f3 Mon Sep 17 00:00:00 2001 From: Onuray Sahin Date: Wed, 20 Jul 2022 16:57:48 +0300 Subject: [PATCH 4/4] Move pin to center when clicked. --- .../location/live/map/LocationLiveMapViewFragment.kt | 9 ++++----- .../main/res/layout/fragment_location_live_map_view.xml | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) 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 869ce0d388..e19580f13b 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 + android:layout_width="0dp" + android:layout_height="0dp" + android:layout_gravity="center"/>