googlemaps / googlemaps/android-maps-compose

Clustering should support diff util

Open
#504 4 comments 14 reactions 0 assignees View on GitHub
priority: p2 type: feature request
Dominant language
Kotlin
Stars
1.3k
Forks
181
Avg merge
2d 23h
Merged PRs (30d)
18

Description

**Is your feature request related to a problem? Please describe.**
My map has millions of points so I cannot add all of them at once. Hence what map moves I download items only visible on screen. When user does only small map movements points and clusters flicker and animations looks bad. This is because current implementation look like this:
```
LaunchedEffect(itemsState) {
snapshotFlow { itemsState.value.toList() }
.collect { items ->
clusterManager.clearItems()
clusterManager.addItems(items)
clusterManager.cluster()
}
}
```
So when ever items are updated clustering is recreated.

**Describe the solution you'd like**
I think we should be able to provide some diffing to only add or remove a subset of items.

**Describe alternatives you've considered**
I also though about just coping whole `Clustering` method and add custom logic, but it's not possible to reuse `ResetMapListeners` method.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.