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.DimensionConverter
import im.vector.app.core.utils.openLocation import im.vector.app.core.utils.openLocation
import im.vector.app.databinding.FragmentLocationLiveMapViewBinding 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.UrlMapProvider
import im.vector.app.features.location.zoomToBounds import im.vector.app.features.location.zoomToBounds
import im.vector.app.features.location.zoomToLocation import im.vector.app.features.location.zoomToLocation
@ -137,11 +138,9 @@ class LocationLiveMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
private fun onSymbolClicked(symbol: Symbol?) { private fun onSymbolClicked(symbol: Symbol?) {
symbol?.let { symbol?.let {
val screenLocation = mapboxMap?.get()?.projection?.toScreenLocation(it.latLng) mapboxMap
views.liveLocationPopupAnchor.apply { ?.get()
x = screenLocation?.x ?: 0f ?.zoomToLocation(LocationData(it.latLng.latitude, it.latLng.longitude, null), preserveCurrentZoomLevel = false)
y = (screenLocation?.y ?: 0f) - views.liveLocationPopupAnchor.height
}
LocationLiveMapMarkerOptionsDialog(requireContext()) LocationLiveMapMarkerOptionsDialog(requireContext())
.apply { .apply {

View File

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