Skip to content

Commit 4f329f5

Browse files
committed
fix: wandering marker
1 parent 5d7b0e7 commit 4f329f5

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

demo/src/main/res/layout/multi_profile.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
<ImageView
2424
android:id="@+id/image"
25-
android:layout_width="@dimen/custom_profile_image"
25+
android:layout_width="150dp"
2626
android:layout_height="@dimen/custom_profile_image"/>
2727

2828
<TextView

library/src/main/java/com/google/maps/android/clustering/view/ClusterRendererMultipleItems.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public enum AnimationType {
107107
}
108108

109109
public void setAnimationType(AnimationType type) {
110+
110111
animationInterp = switch (type) {
111112
case LINEAR -> new LinearInterpolator();
112113
case EASE_IN, ACCELERATE -> new AccelerateInterpolator();
@@ -173,7 +174,7 @@ public void setAnimationInterpolator(TimeInterpolator interpolator) {
173174
public ClusterRendererMultipleItems(Context context, GoogleMap map, ClusterManager<T> clusterManager) {
174175
mMap = map;
175176
mAnimate = true;
176-
mAnimationDurationMs = 300;
177+
mAnimationDurationMs = 5000;
177178
mDensity = context.getResources().getDisplayMetrics().density;
178179
mIconGenerator = new IconGenerator(context);
179180
mIconGenerator.setContentView(makeSquareTextView(context));
@@ -529,8 +530,7 @@ public void run() {
529530
final Point point = mSphericalMercatorProjection.toPoint(marker.position);
530531
final Point closest = findClosestCluster(newClustersOnScreen, point);
531532
if (closest != null) {
532-
LatLng animateTo = mSphericalMercatorProjection.toLatLng(closest);
533-
markerModifier.animateThenRemove(marker, marker.position, animateTo);
533+
markerModifier.remove(true, marker.marker);
534534
RendererLogger.d("ClusterRenderer", "Animating then removing marker at position: " + marker.position);
535535
} else if (mClusterMarkerCache.mCache.keySet().iterator().hasNext() && mClusterMarkerCache.mCache.keySet().iterator().next().getItems().contains(marker.clusterItem)) {
536536
T foundItem = null;
@@ -1153,7 +1153,7 @@ private void perform(MarkerModifier markerModifier) {
11531153
if (animateFrom != null) {
11541154
markerModifier.animate(markerWithPosition, animateFrom, item.getPosition());
11551155
RendererLogger.d("ClusterRenderer", "Animating marker from " + animateFrom + " to " + item.getPosition());
1156-
} else if (currentLocation != null) {
1156+
} else {
11571157
markerModifier.animate(markerWithPosition, currentLocation, item.getPosition());
11581158
RendererLogger.d("ClusterRenderer", "Animating marker from " + currentLocation + " to " + item.getPosition());
11591159
}

0 commit comments

Comments
 (0)