googlemaps / googlemaps/android-maps-compose

Can't use Marker as a default clusterItemContent

Open
#310 5 comments 2 reactions 1 assignee Claimed by @dkhawk View on GitHub
priority: p1 type: bug
Dominant language
Kotlin
Stars
1.3k
Forks
181
Avg merge
2d 23h
Merged PRs (30d)
18

Description

I wanted to use default markers and change the color of the selected ones. But I can't use even a default Marker as a clusterItemContent because of the error:
`java.lang.IllegalArgumentException: width and height must be > 0`
I can't change the size of the Marker because it doesn't have a Modifier parameter. So, how can I change the color of the selected marker as before (or in more optimal way), disable titles, snippets etc.?

```
clusterItemContent = {
Marker(
//icon = it.getMarkerDescriptor(selectedEvent == it)
)
}

fun getMarkerDescriptor(isSelected: Boolean = false): BitmapDescriptor? =
if (isSelected) BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE) else null
```
P.S. If I use a custom icon, it drastically decrease performance (especially in debug mode). Is there a way to optimize it?
P.P.S. With a custom icon, I also can't disable snippets and title - only sending null in the data. (The way it doesn't show is to send `true` in `onClusterItemClick`)
```
clusterItemContent = {
Icon(imageVector = Icons.Filled.Abc, it.name)
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.