You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the cluster manager in order to display my markers on my map. I wanted to add the pop animation on the appearance of my marker. However every time that I try to move or to zoom on the map, my markers keep re-appearing.
At the beginning, I was just using custom icons on my markers and they kept blinking every time I zoomed or moved on the map. In order to simplify the demonstration, I am just using the pop animation on the appearAnimation of the marker.
First I thought it might been due to the clearItems then to the cluster again so I tried to optimize the renderer a little bit:
func updateCluster(clusterManager:GMUClusterManager, markerItems:[MarkerItem]){varmarkersToAdd:[POIItem]=[]varmarkersToDelete:[POIItem]=[]
for markerItem in markerItems {
if mapDisplayedItems.contains(where:{ $0.id == markerItem.id })== false {letposition=CLLocationCoordinate2D(latitude: markerItem.lat, longitude: markerItem.lng)letmapItem=POIItem(position: position, id: markerItem.id, picture:nil, markerItem: markerItem)
markersToAdd = markersToAdd +[mapItem]}else if let mapDisplayedItem = mapDisplayedItems.first(where:{ $0.id == markerItem.id }), mapDisplayedItem.position.latitude == markerItem.lat && mapDisplayedItem.position.longitude == markerItem.lng {
mapDisplayedItem.position =CLLocationCoordinate2D(latitude: markerItem.lat, longitude: markerItem.lng)}}
for mapDisplayedItem in mapDisplayedItems {
if markerItems.contains(where:{ $0.id == mapDisplayedItem.id })== false {
markersToDelete = markersToDelete +[mapDisplayedItem]}}
for markerToDelete in markersToDelete {
mapDisplayedItems = mapDisplayedItems.filter({ $0.id != markerToDelete.id })
clusterManager.remove(markerToDelete)}
mapDisplayedItems = mapDisplayedItems + markersToAdd
for markerToAdd in markersToAdd {
clusterManager.add(markerToAdd)}
if !markersToAdd.isEmpty || !markersToDelete.isEmpty {
clusterManager.cluster()}}
Then in my renderer method, I tried to optimize it too:
Hi,
I am using the cluster manager in order to display my markers on my map. I wanted to add the pop animation on the appearance of my marker. However every time that I try to move or to zoom on the map, my markers keep re-appearing.
At the beginning, I was just using custom icons on my markers and they kept blinking every time I zoomed or moved on the map. In order to simplify the demonstration, I am just using the pop animation on the appearAnimation of the marker.
First I thought it might been due to the clearItems then to the cluster again so I tried to optimize the renderer a little bit:
Then in my renderer method, I tried to optimize it too:
Environment details
iOS: 15.4
GoogleMaps: 7.0.0
GooglePlaces: 7.0.0
GoogleUtilities 7.7.0
Google-Maps-iOS-Utils: 4.1.0
Thank you for your help!
The text was updated successfully, but these errors were encountered: