mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 01:07:46 +00:00
fix(location): map drag interception + wrap precision chips
- The interactive picker map didn't tell ancestor views to stop intercepting touches, so a horizontal drag on the Teleport map got stolen (opening the nav drawer) instead of panning. Add the same requestDisallowInterceptTouchEvent touch listener LocationPreviewMap already uses. - The precision chips were a single horizontally-scrolling Row; make them a FlowRow so "Region · ~1250 km … Building · ~38 m" wraps onto multiple lines. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YU8YLcjH9ALr4PgdAkGPZh
This commit is contained in:
+6
-6
@@ -25,10 +25,11 @@ import android.location.Address
|
||||
import androidx.compose.animation.core.animateDpAsState
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -550,6 +551,7 @@ private fun MyLocationButton(
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalLayoutApi::class)
|
||||
@Composable
|
||||
private fun PickerBottomBar(
|
||||
cell: String?,
|
||||
@@ -578,12 +580,10 @@ private fun PickerBottomBar(
|
||||
style = MaterialTheme.typography.labelLarge,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
)
|
||||
Row(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.horizontalScroll(rememberScrollState())
|
||||
.padding(vertical = 10.dp),
|
||||
FlowRow(
|
||||
modifier = Modifier.fillMaxWidth().padding(vertical = 10.dp),
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
GeohashChannelLevel.ordered.forEach { lvl ->
|
||||
FilterChip(
|
||||
|
||||
+13
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.ui.note.creators.location
|
||||
|
||||
import android.view.MotionEvent
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
@@ -100,6 +101,18 @@ fun LocationPickerMap(
|
||||
controller.setZoom(zoom)
|
||||
controller.setCenter(GeoPoint(latitude, longitude))
|
||||
|
||||
// Ask ancestors (nav drawer, horizontal pager, feed) to stop intercepting
|
||||
// touches while a finger is on the map, so a horizontal drag pans the map
|
||||
// instead of opening the drawer or being stolen as a swipe. Mirrors
|
||||
// LocationPreviewMap. Returning false lets the MapView still pan/zoom/tap.
|
||||
setOnTouchListener { view, event ->
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> view.parent?.requestDisallowInterceptTouchEvent(true)
|
||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_CANCEL -> view.parent?.requestDisallowInterceptTouchEvent(false)
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
val receiver =
|
||||
object : MapEventsReceiver {
|
||||
override fun singleTapConfirmedHelper(p: GeoPoint): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user