You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If rotationGesturesEnabled = false and scrollGesturesEnabledDuringRotateOrZoom = false, a zoom (pinch) gesture with a rotation (or crossing fingers) will break the pan/drag gesture and make it lag. It looks like a CancellationException is swallowed internally (caught but not thrown), see : #502
Environment details :
android-maps-compose 4.3.0
doesn't seem to occur on the simulator, please use a real device.
Steps to reproduce :
set rotationGesturesEnabled = false and scrollGesturesEnabledDuringRotateOrZoom = false
Try to rotate the map with two fingers
Try to pan.drag the map, it doesn't move as intended (zoom is not affected somehow)
Workaround :
setting rotationGesturesEnabled = false and scrollGesturesEnabledDuringRotateOrZoom = true
Code example :
class RecompositionActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
val cameraPositionState = rememberCameraPositionState {
position = defaultCameraPosition
}
Box(Modifier.fillMaxSize()) {
MapsComposeSampleTheme {
GoogleMapView(
modifier = Modifier.matchParentSize(),
cameraPositionState = cameraPositionState
)
}
}
}
}
@Composable
fun GoogleMapView(
modifier: Modifier = Modifier,
cameraPositionState: CameraPositionState = rememberCameraPositionState(),
content: @Composable () -> Unit = {},
) {
var location by remember { mutableStateOf(singapore) }
var zoom by remember { mutableStateOf(5f) }
val context = LocalContext.current
val singaporeState = MarkerState(position = location)
val mapProperties = remember {
MapProperties(
isBuildingEnabled = false,
isIndoorEnabled = false,
isMyLocationEnabled = false,
isTrafficEnabled = false,
mapType = MapType.SATELLITE,
)
}
val mapOptions = remember {
GoogleMapOptions()
.ambientEnabled(false)
.mapToolbarEnabled(false)
.compassEnabled(false)
}
val uiSettings = remember {
MapUiSettings(
compassEnabled = false,
indoorLevelPickerEnabled = false,
mapToolbarEnabled = false,
myLocationButtonEnabled = false,
rotationGesturesEnabled = false,
scrollGesturesEnabledDuringRotateOrZoom = false,
tiltGesturesEnabled = false,
zoomControlsEnabled = false,
)
}
val mapVisible by remember { mutableStateOf(true) }
if (mapVisible) {
// Detect when the map starts moving and print the reason
LaunchedEffect(cameraPositionState.isMoving) {
if (cameraPositionState.isMoving) {
Log.d(TAG, "Map camera started moving due to ${cameraPositionState.cameraMoveStartedReason.name}")
}
}
GoogleMap(
modifier = modifier.fillMaxSize(),
cameraPositionState = cameraPositionState,
googleMapOptionsFactory = {mapOptions},
onMapLoaded = {},
properties = mapProperties,
uiSettings = uiSettings,
onPOIClick = {
Log.d(TAG, "POI clicked: ${it.name}")
}
) {
val markerClick: (Marker) -> Boolean = {
Log.d(TAG, "${it.title} was clicked")
cameraPositionState.projection?.let { projection ->
Log.d(TAG, "The current projection is: $projection")
}
false
}
Marker(
state = singaporeState,
title = "Marker in Singapore",
onClick = markerClick
)
content()
}
}
}
}
The text was updated successfully, but these errors were encountered:
jeffphp
added
triage me
I really want to be triaged.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
labels
Jan 6, 2024
android-maps-compose 4.3.0
If rotationGesturesEnabled = false and scrollGesturesEnabledDuringRotateOrZoom = false, a zoom (pinch) gesture with a rotation (or crossing fingers) will break the pan/drag gesture and make it lag. It looks like a CancellationException is swallowed internally (caught but not thrown), see : #502
Environment details :
android-maps-compose 4.3.0
doesn't seem to occur on the simulator, please use a real device.
Steps to reproduce :
Workaround :
Code example :
class RecompositionActivity : ComponentActivity() {
}
The text was updated successfully, but these errors were encountered: