Open Mobiletainment opened 2 years ago
@Mobiletainment Thank you for opening this issue. 🙏 Please check out these other resources that might be applicable:
google-maps
tagThis is an automated message, feel free to ignore.
I tried to inspect how the collision behavior works, but neither of these approaches was successful:
map.addListener("zoom_changed", (e) => {
console.log(markers.filter((m) => m.getVisible())); // it still tells me that all markers are visible, despite some of them not being shown
});
markers.forEach((marker) => {
marker.addListener("shape_changed", (e) => {
console.log("event fired", marker); // never called
});
});
It would be really nice if google maps exposed an event for changes in the collisions.
Thank you for the library. I'm currently using the vector maps with the new Marker Collision Management which is currently in beta.
My use case is that I have many markers and I'm using the collision behavior
google.maps.CollisionBehavior.OPTIONAL_AND_HIDES_LOWER_PRIORITY
to hide overlapped markers with lower priority.This works well for markers constructed as
google.maps.Marker
without any labels. As soon as I start to use labels withMarkerWithLabel
, I'm seeing leftover labels for markers which are hidden.The following example shows the collision behavior where only 2 markers remain visible while 11 markers should be hidden:
google.maps.Marker
:MarkerWithLabel
:Environment details
@googlemaps/markerwithlabel": "2.0.9
Steps to reproduce
Please check out the beta documentation for Marker Collision Management which is used as a base for this example.
Code example
Thank you for your support.