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

Define custom marker images with Composables

Open alexvanyo opened this issue 3 years ago • 3 comments

For cases where info windows aren't flexible enough, or the marker images need to be dynamic in some way, it'd be great to be able to use a @Composable to render the marker images.

With Views, this was possible by creating a view and using View.drawToBitmap, which should roughly also be possible with a ComposeView (with caveats, due to the use of software rendering).

alexvanyo avatar Feb 18 '22 19:02 alexvanyo

if were possible to load an url image would be amazing 🤩

PedroARuiz avatar Feb 27 '22 21:02 PedroARuiz

https://issuetracker.google.com/issues/220892485

bubenheimer avatar May 20 '22 17:05 bubenheimer

IconGenerator from android-map-utils provides a recipe that looks helpful to take inspiration from, combined with (Abstract)ComposeView and View.drawToBitmap as @alexvanyo suggests. (In case someone is looking for a more spelled out approach.)

bubenheimer avatar Jun 18 '22 13:06 bubenheimer

@alexvanyo: I've proposed a pattern for this in #258. That PR adds it to Clustering markers, but I'm considering bringing the same approach to regular Markers as well (a Composable content arg instead of a BitmapDescriptor). Would greatly appreciate your feedback (does it work the way you expect?).

DSteve595 avatar Feb 07 '23 23:02 DSteve595

Using the Clustering class works really well for rendering Markers from Composables....except how should we set the anchor, infoWindowAnchor, flat and draggable MarkerOptions?

spiral123 avatar Mar 06 '23 17:03 spiral123

The goal isn't to use Clustering for all markers, but we're testing the Composable marker rendering on that first. Barring any major issues, we'll try porting that over to regular Markers, which is where you'll be able to use anchor, infoWindowAnchor, etc.

DSteve595 avatar Mar 06 '23 18:03 DSteve595

Any news on this issue?

andlopru avatar Jun 27 '23 21:06 andlopru

:tada: This issue has been resolved in version 2.14.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

googlemaps-bot avatar Aug 17 '23 18:08 googlemaps-bot

Thank you @mosmb for contributing the # 2 most popular feature request in this project!

wangela avatar Aug 17 '23 18:08 wangela

Thank you to both of you @wangela & @kikoso Can't wait to deprecate my homemade solution at work and use this!

mosmb avatar Aug 18 '23 14:08 mosmb