twotoasters / clusterkraf

A clustering library for the Google Maps Android API v2
Apache License 2.0
255 stars 57 forks source link

Add function to Zoom to Bounds when click in Cluster which has Info Window shown already #10

Open trietbui85 opened 11 years ago

trietbui85 commented 11 years ago

OK, let me describe step by step how to archive it.

In advanced mode

  1. Cluster click behavior: choose Show Info Window
  2. Cluster Info Window Click behavior: choose Zoom to Bounds
  3. Open the Sample Activity. Click on a cluster, then the Info Window will be shown. In this case, if click the Info Window will perform Zoom to Bounds.
  4. I want to have an option, when the Info Window is shown, we can also click on Cluster to perform Zoom to Bounds action. At the moment, click on Cluster when Info Window is shown does nothing.

Thank you for great mapping cluster library.

carltonwhitehead commented 11 years ago

Thanks for the suggestion, @anticafe!

Looking at the Google Maps API docs, it looks like it should be possible to implement this by adding an extra value in Options.ClusterClickBehavior and a check against Marker.isInfoWindowShown(). See https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Marker#isInfoWindowShown()

Did you want to code this change? You could fork it, code it on your fork, and send a pull request. Let me know so we don't duplicate effort (I like the idea enough to implement it myself when I have time).

carltonwhitehead commented 11 years ago

I just tried to implement this (see 13a1c6051c486f1e4c91845656d9a870839e2f8c), but I think I stumbled across a bug in the Google Maps API v2. The problem is the marker.isInfoWindowVisible() returns false when the OnMarkerClickListener calls marker.showInfoWindow() and the onMarkerClick(Marker) returns true, so, even though the Info Window is clearly visible, it is not possible to accurately test its visibility programmatically. I'm going to try to repeat this problem in a more concise example, and then submit a bug report to the Google Maps API v2 bug tracker.

carltonwhitehead commented 11 years ago

Bug filed: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5408 -- @anticafe and anyone else wanting this feature implemented, please star the issue