New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some clusters do not transform into markers when clustering condition is based on map zoom level #774
Comments
I have the same issue. I found that the With default With the So the question is, how can we adjust that behaviour from the NonHierarchicalDistanceBasedAlgorithm? Edit: For the fix you have to reimplement (copy/paste) the
|
I am also facing same issue . Library version is 2.2.0 |
Also having the same issue 😞 |
I've confirmed that I can reproduce this issue in this branch: I can also confirm that commenting out the below lines in @SuppressLint("NewApi")
public void run() {
// Commenting out these lines forces correct behavior
// if (clusters.equals(DefaultClusterRenderer.this.mClusters)) {
// mCallback.run();
// return;
// }
final MarkerModifier markerModifier = new MarkerModifier(); |
Also having the same issue |
Hi all! I've opened a pull request here that should hopefully address this use case - #996. |
… when cluster doesn't change (#996) In the current version of DefaultClusterRenderer, there is a built-in optimization to avoid re-rendering items when there isn't a change in the clusters. However, as discussed in #774, this prevents use cases where the clusters/markers should be re-rendered even if the cluster contents don't change. For example, if you want a single item to render as a cluster above a certain zoom level and as a marker below a certain zoom level, this isn't possible - the item will never be updated from the cluster to the marker because that rendering pass is skipped (because the cluster contents didn't change). This PR adds a new DefaultClusterRenderer.shouldRender() method that apps can override to control this optimization when necessary. This allows the above use case as the app can track the previous and current zoom levels and force the render to occur when the transition over the zoom threshold is made. A new demo activity ZoomClusteringDemoActivity (shown as "Clustering: Force on Zoom" in the demo app UI) (gms and v3 flavors) is added as part of this PR to clearly illustrate how shouldRender() is used. This demo also illustrates what I believe is an undocumented feature of the library, which is that the ClusterManager will call the onCameraIdle() implementation of any Renderer that implements GoogleMap.OnCameraIdleListener before clustering and rendering takes place. This allows us to capture the zoom level that can then be used in shouldRender(). This feature is backwards-compatible, as the current behavior of apps will not change - the default implementation of shouldRender() is the same as the current version of the library. Closes #774 🦕
🎉 This issue has been resolved in version 2.3.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Summary
I used this library for clustering a set of points in google map. The requirement is such that clustering is based only on zoom level. On max zoom in , all items are unclustered and markers should be shown. But in some cases, the markers are not visible even on maximum zoom in.(Please note that on max zoom out even single markers are displayed as cluster with text 1)
Expected behavior
On tapping cluster(or zooming in manually) with single item, it should zoom in and turn into marker
Observed behavior
Map zoomed in, but cluster remained same. did not showed marker
Environment details
Steps to reproduce
This can be reproduced using the demo app by making minor changes to
CustomMarkerClusteringDemoActivity.
(I am minimizing the customization here)
startDemo(boolean isRestore)
3)Modify
AddItems()
to return only two points. (I am returning two example points that this issue occur)The text was updated successfully, but these errors were encountered: