Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live Location Sharing - Reset zoom level while focusing a user (PSG-624) #6609

Merged
merged 4 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/6609.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Live Location Sharing - Reset zoom level while focusing a user
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -137,11 +138,9 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra

private fun onSymbolClicked(symbol: Symbol?) {
symbol?.let {
val screenLocation = mapboxMap?.get()?.projection?.toScreenLocation(it.latLng)
views.liveLocationPopupAnchor.apply {
x = screenLocation?.x ?: 0f
y = (screenLocation?.y ?: 0f) - views.liveLocationPopupAnchor.height
}
mapboxMap
?.get()
?.zoomToLocation(LocationData(it.latLng.latitude, it.latLng.longitude, null), preserveCurrentZoomLevel = false)

LocationLiveMapMarkerOptionsDialog(requireContext())
.apply {
Expand Down Expand Up @@ -273,7 +272,7 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
.find { it.matrixItem.id == userId }
?.locationData
?.let { locationData ->
mapboxMap?.get()?.zoomToLocation(locationData, preserveCurrentZoomLevel = true)
mapboxMap?.get()?.zoomToLocation(locationData, preserveCurrentZoomLevel = false)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@

<View
android:id="@+id/liveLocationPopupAnchor"
android:layout_width="40dp"
android:layout_height="40dp" />
android:layout_width="0dp"
Claire1817 marked this conversation as resolved.
Show resolved Hide resolved
android:layout_height="0dp"
android:layout_gravity="center"/>

<FrameLayout
android:id="@+id/liveLocationMapFragmentContainer"
Expand Down