googlemaps / googlemaps/android-maps-compose

Setting contentPadding offset the cameraPosition

Offen
#142 3 Kommentare 16 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@barbeau arbeitet bereits daran.

Seit 09.6.2022.

priority: p3 type: bug
Vorherrschende Sprache
Kotlin
Sterne
1.3k
Forks
181
Ø Merge
2 T. 23 Std.
Gemergte PRs (30 T.)
18

Beschreibung

Hi,

When adding a contentPadding to the Google map, the map's cameraPosition is never centered on the screen :

![image](https://user-images.githubusercontent.com/3890231/172847319-388bd1bb-30e6-4dc7-a798-b91d9059a223.png)

The default marker is the position given to the map and the little work icon is at the center of the screen with the same map paddings.

#### Environment details

Android Maps Compose version : 2.2.1

#### Code example

```
val bottomSheetPadding = remember { PaddingValues(bottom = 40.dp) }
val cameraPositionState = rememberCameraPositionState {
position = CameraPosition.fromLatLngZoom(LatLng(0.0, 0.0), 17f)
}
GoogleMap(
modifier = modifier.fillMaxSize(),
cameraPositionState = cameraPositionState,
contentPadding = bottomSheetPadding
) {
Marker(state = rememberMarkerState(position = LatLng(0.0, 0.0)))
}

Image(
painter = painterResource(ic_work),
contentDescription = null,
modifier = Modifier
.align(Center)
.padding(bottomSheetPadding)
.padding(bottom = 24.dp) // Icon size /2
.size(48.dp)
)
```

Thanks!

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.