Move pin to center when clicked.

This commit is contained in:
Onuray Sahin 2022-07-20 16:57:48 +03:00
parent 5c359d4d45
commit 10322545aa
2 changed files with 7 additions and 7 deletions

View File

@ -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<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 {

View File

@ -8,8 +8,9 @@
<View
android:id="@+id/liveLocationPopupAnchor"
android:layout_width="40dp"
android:layout_height="40dp" />
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_gravity="center"/>
<FrameLayout
android:id="@+id/liveLocationMapFragmentContainer"