Ability to change rotation on ClusterItem
I do show labels on the map which should follow the camera bearing (map rotation). Similar to street names in GoogleMap - they rotate with the map.
by only exposing clusterItemContent we are not able to change the rotation of the Marker.
Applying the rotation on the composable content
clusterItemContent = {
MyLabel(
it.label,
modifier = Modifier.rotate(rotation)
)
}
does not work as it then exceeds the bounds of the rendered marker - see below:
would be nice if someone can take a look at this
Hi @cwsiteplan . I think this could probably be solved using the function marker.rotation(float value), but there is no easy access to it. It would also require changes on android-maps-utils.
The DefaultClusterRenderer provides a function to be overridden, onClusterItemUpdated. This function receives a marker that could potentially be modified.
How to pass this all the way-up it is an open question. Custom Renderers can now be created, so an option could be to override it (similar to this sample in the android-maps-utils) and provide an option to rotate the marker. That could theoretically work, but we would also need to somehow keep the relationship about which markers get which rotation.
already tried to set the rotation in onClusterItemUpdated but that would basically just apply an "offset" to the rotation and the marker would be rotated with the map.
i want the text to keep being "pinned" to the polylines, like street-names.
already tried to achieve that by adding the camera bearing as well. but couldn't make it work.
i've pushed a sample here: https://github.com/googlemaps/android-maps-compose/compare/main...cwsiteplan:android-maps-compose:bug/cluster-marker-rotation?expand=1
the rotation does not work all the time see attached video https://github.com/user-attachments/assets/940af8fb-1245-482a-a1cb-7d62550b20f4