j20mc / Nativescript-Danem-Google-Maps-Utils

Nativescript Google-maps-utils android & IOS
The Unlicense
6 stars 6 forks source link

Info windows / custom info windows #2

Closed tommag21 closed 4 years ago

tommag21 commented 4 years ago

Are custom info windows supported yet? Or any kind of infoWindow

By the way thanks for the plugin!

j20mc commented 4 years ago

At the moment this is not possible. To pass information (like icons) from the google-maps plugin to the google-maps-utils plugin I use the infoWindowTemplate. I'm trying to think of a better idea to release this feature.

And thank you for the thank you message, this is my first plugin, it makes me happy

tommag21 commented 4 years ago

I made a little change to the CustomClusterRenderer onBeforeClusterItemRendered function, only on Android yet. Now it shows the default marker info window (marker.title, marker.snippet). The icon is taken the same way from the marker.icon property.

onBeforeClusterItemRendered: function (item, markerOptions) {
    this.super.onBeforeClusterItemRendered(item, markerOptions);
    var mIcon = Image;
    mIcon.imageSource = item.marker.icon.imageSource;
    var androidIcon = com.google.android.gms.maps.model.BitmapDescriptorFactory.fromBitmap(mIcon.imageSource.android);
    markerOptions.icon(androidIcon);
}
j20mc commented 4 years ago

If I remember correctly, I had a problem with the marker.icon because if we had several icon types, it always gave the same.

After testing your piece of code, it works correctly.

j20mc commented 4 years ago

If that suits you, I would add your code instead of mine and I would work on the title and infowindow (ios & android)

tommag21 commented 4 years ago

Of course, you might want to do additional tests anyway. I've only tested on Android emulator

j20mc commented 4 years ago

I have tested on android and all works well. I have to look for iOS and I will update the plugin with the new pod & gradle