Skip to content

Commit 4acec4e

Browse files
committed
fix: wandering marker
1 parent dbd633f commit 4acec4e

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void setAnimationType(AnimationType type) {
111111
case EASE_IN, ACCELERATE:
112112
animationInterp = new AccelerateInterpolator();
113113
break;
114-
case EASE_OUT:
114+
case EASE_OUT, DECELERATE:
115115
animationInterp = new DecelerateInterpolator();
116116
break;
117117
case EASE_IN_OUT:
@@ -123,9 +123,6 @@ public void setAnimationType(AnimationType type) {
123123
case BOUNCE:
124124
animationInterp = new BounceInterpolator();
125125
break;
126-
case DECELERATE:
127-
animationInterp = new DecelerateInterpolator();
128-
break;
129126
default:
130127
animationInterp = new LinearInterpolator();
131128
break;
@@ -180,7 +177,7 @@ public void setAnimationType(AnimationType type) {
180177
public ClusterRendererMultipleItems(Context context, GoogleMap map, ClusterManager<T> clusterManager) {
181178
mMap = map;
182179
mAnimate = true;
183-
mAnimationDurationMs = 300;
180+
mAnimationDurationMs = 5000;
184181
mDensity = context.getResources().getDisplayMetrics().density;
185182
mIconGenerator = new IconGenerator(context);
186183
mIconGenerator.setContentView(makeSquareTextView(context));
@@ -535,8 +532,7 @@ public void run() {
535532
final Point point = mSphericalMercatorProjection.toPoint(marker.position);
536533
final Point closest = findClosestCluster(newClustersOnScreen, point);
537534
if (closest != null) {
538-
LatLng animateTo = mSphericalMercatorProjection.toLatLng(closest);
539-
markerModifier.animateThenRemove(marker, marker.position, animateTo);
535+
markerModifier.remove(true, marker.marker);
540536
RendererLogger.d("ClusterRenderer", "Animating then removing marker at position: " + marker.position);
541537
} else if (mClusterMarkerCache.mCache.keySet().iterator().hasNext() && mClusterMarkerCache.mCache.keySet().iterator().next().getItems().contains(marker.clusterItem)) {
542538
T foundItem = null;
@@ -1146,7 +1142,7 @@ private void perform(MarkerModifier markerModifier) {
11461142
if (animateFrom != null) {
11471143
markerModifier.animate(markerWithPosition, animateFrom, item.getPosition());
11481144
RendererLogger.d("ClusterRenderer", "Animating marker from " + animateFrom + " to " + item.getPosition());
1149-
} else if (currentLocation != null) {
1145+
} else {
11501146
markerModifier.animate(markerWithPosition, currentLocation, item.getPosition());
11511147
RendererLogger.d("ClusterRenderer", "Animating marker from " + currentLocation + " to " + item.getPosition());
11521148
}

0 commit comments

Comments
 (0)