Skip to content

Bug: fix centering on clicked cluster item #42

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

Open
koinsaari opened this issue Jan 15, 2025 · 0 comments
Open

Bug: fix centering on clicked cluster item #42

koinsaari opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@koinsaari
Copy link
Owner

Calculating latitude for centering cluster item click correctly to display the info window does not work on high zoom levels

@koinsaari koinsaari converted this from a draft issue Jan 15, 2025
@koinsaari koinsaari added the bug Something isn't working label Jan 15, 2025
koinsaari added a commit that referenced this issue Jan 21, 2025
This commit introduces a hacky solution to switch place markers on the map to use the Marker composable instead of custom composables. The advantage of using Marker is that we can leverage the built-in info window functionality, removing the need to manually create and position a custom info window.

Previously, when a place marker was selected, we had to calculate the position of its info window manually. If the user moved the map, the info window stayed in the same position on the screen instead of sticking to the marker on the map. One way to fix this was to update the state in real time to keep the info window in sync, but that caused constant state updates and heavy recompositions, making the UI sluggish.

To avoid this, I decided to use the Marker composable (or MarkerInfoWindowComposable to be specific because that is the one you can customize the most). However, due to a current issue (googlemaps/android-maps-compose#409) in the Google Maps Compose library, Marker composables cannot be used directly inside the clusterItemContent (causes an invalid applier error). To work around this, we create a separate marker composable for the selected item at the same position with the same appearance. This gives the same effect as if the cluster items themselves were Marker composables.

Part of #12, #42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant