Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmcd committed Apr 18, 2018
2 parents cf62482 + 8867ef8 commit 0c7715f
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public void run() {
// Find all of the existing clusters that are on-screen. These are candidates for
// markers to animate from.
List<Point> existingClustersOnScreen = null;
if (DefaultClusterRenderer.this.mClusters != null && SHOULD_ANIMATE) {
if (DefaultClusterRenderer.this.mClusters != null && SHOULD_ANIMATE && mAnimate) {
existingClustersOnScreen = new ArrayList<Point>();
for (Cluster<T> c : DefaultClusterRenderer.this.mClusters) {
if (shouldRenderAsCluster(c) && visibleBounds.contains(c.getPosition())) {
Expand All @@ -392,10 +392,10 @@ public void run() {
new ConcurrentHashMap<MarkerWithPosition, Boolean>());
for (Cluster<T> c : clusters) {
boolean onScreen = visibleBounds.contains(c.getPosition());
if (zoomingIn && onScreen && SHOULD_ANIMATE) {
if (zoomingIn && onScreen && SHOULD_ANIMATE && mAnimate) {
Point point = mSphericalMercatorProjection.toPoint(c.getPosition());
Point closest = findClosestCluster(existingClustersOnScreen, point);
if (closest != null && mAnimate) {
if (closest != null) {
LatLng animateTo = mSphericalMercatorProjection.toLatLng(closest);
markerModifier.add(true, new CreateMarkerTask(c, newMarkers, animateTo));
} else {
Expand All @@ -416,7 +416,7 @@ public void run() {
// Find all of the new clusters that were added on-screen. These are candidates for
// markers to animate from.
List<Point> newClustersOnScreen = null;
if (SHOULD_ANIMATE) {
if (SHOULD_ANIMATE && mAnimate) {
newClustersOnScreen = new ArrayList<Point>();
for (Cluster<T> c : clusters) {
if (shouldRenderAsCluster(c) && visibleBounds.contains(c.getPosition())) {
Expand All @@ -431,10 +431,10 @@ public void run() {
boolean onScreen = visibleBounds.contains(marker.position);
// Don't animate when zooming out more than 3 zoom levels.
// TODO: drop animation based on speed of device & number of markers to animate.
if (!zoomingIn && zoomDelta > -3 && onScreen && SHOULD_ANIMATE) {
if (!zoomingIn && zoomDelta > -3 && onScreen && SHOULD_ANIMATE && mAnimate) {
final Point point = mSphericalMercatorProjection.toPoint(marker.position);
final Point closest = findClosestCluster(newClustersOnScreen, point);
if (closest != null && mAnimate) {
if (closest != null) {
LatLng animateTo = mSphericalMercatorProjection.toLatLng(closest);
markerModifier.animateThenRemove(marker, marker.position, animateTo);
} else {
Expand Down

0 comments on commit 0c7715f

Please sign in to comment.