mapsplugin / cordova-plugin-googlemaps

Google Maps plugin for Cordova
Apache License 2.0
1.66k stars 918 forks source link

Add "number" parameter to MarkerCluster #2811

Open rcpinheiro opened 4 years ago

rcpinheiro commented 4 years ago

When you add markers to MarkerCluster add a optional "number" parameter to the MarkerOptions (default: number=1). That way, MarkerCluster instead of showing the count of Markers, will show the sum of the "number" field in the Markers. Very useful when you try to add lots and lots of identifical markes. For instance, if you have 100 markers in the same location, you only have to add one marker with "number=100" instead of adding 100 markers.

Pull request guide

Thank you for considering to improve this cordova-plugin-googlemaps.

When you create a pull request, please make it to multiple_maps branch instead of master branch.

Because the multiple_maps branch is edge version.

Thank you for your understanding.

wf9a5m75 commented 4 years ago

Could you show me the screenshot? (I'm outside now)

wf9a5m75 commented 4 years ago

Ah, I got your idea. You want to show the value of markers instead of number of markers.

rcpinheiro commented 4 years ago

Right. Three markers with "number" equal to 48, 11 and 2: image

When you zoom out: image

rcpinheiro commented 4 years ago

On second thought, the name "number" is not a good one. It's best to call it "value" or "weight".

wf9a5m75 commented 4 years ago

@rcpinheiro Thank you for your PR. Your idea is good, but creating a special meaning property for particular is not good. Because some people might want to more complex calculation, such as return value * priority;

I also asked someone wanted to customize the strings of the number, such as 2532 -> 2.5k

So, I will create a custom callback instead of particular property.