android-maps-compose icon indicating copy to clipboard operation
android-maps-compose copied to clipboard

Clustering: Breaks marker anchoring for markers not of the "pin" style.

Open mpfulc opened this issue 2 years ago • 6 comments

The new Clustering() implementation appears to have a preset marker image anchor offset. Or, to be more precise, the composable passed into the clusterItemContent parameter appears to be wrapped in an offset composable when placed on the screen. I see no way to configure that anchor offset, which appears to be Offset(0.5f, 1.0f), the default assigned to markers. This does not break "pin" style markers, but breaks all other marker image types as they are not able to be centered on the point. Adding anchor configurability may be the most robust fix.

mpfulc avatar Mar 10 '23 03:03 mpfulc

If you would like to upvote the priority of this issue, please comment below or react with :+1: so we can see what is popular when we triage.

@mpfulc Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:

This is an automated message, feel free to ignore.

wangela avatar Mar 10 '23 03:03 wangela

any update on this? seems quite crucial to have that configurability - otherwise clustering cannot be used with custom markers. :(

cwsiteplan avatar Sep 04 '23 08:09 cwsiteplan

+1 to getting this fixed. Being able to change the content of the marker but not the anchor point really limits the usefulness of it.

noelb avatar Dec 23 '23 15:12 noelb

any update? this would be a highly appreciated - this is blocker for our product launch.

cwsiteplan avatar Jan 15 '24 07:01 cwsiteplan

Hi @cwsiteplan ,

This should be theoretically possible by implementing a custom renderer, and making sure that the MarkerOptions passed to the onBeforeClusterItemRendered() contains a specific anchor here.

A Clustering object can receive a custom Renderer, and hence the anchor could be set.

I understand this requires a significant amount of work for a single attribute, but on the other hand we need to think rigorously about introducing new parameters for our Composables. We will evaluate this.

kikoso avatar Jan 17 '24 16:01 kikoso

Thanks for the workaround - will try to implement that.

Still I would see the ability of "setting anchor" as essential - having a Map SDK that does not support custom marker content (and as content varies the anchor needs to be adjusted) seems too limited.

cwsiteplan avatar Jan 22 '24 07:01 cwsiteplan