magnetic-fling: move by screen size

This commit is contained in:
Hannes Janetzek 2013-01-07 15:18:41 +01:00
parent 70f2af2f33
commit 30fede04d2

View File

@ -381,10 +381,11 @@ final class TouchHandler implements OnGestureListener, OnScaleGestureListener, O
Log.d(TAG, "velocity: " + a + " " + velocityX + " " + velocityY + " - " + vx + " " + vy); Log.d(TAG, "velocity: " + a + " " + velocityX + " " + velocityY + " - " + vx + " " + vy);
if (a < 500) if (a < 400)
return true; return true;
mMapPosition.animateTo(vx * Tile.TILE_SIZE * 2, vy * Tile.TILE_SIZE * 2, 250); float move = Math.min(mMapView.getWidth(), mMapView.getHeight()) * 2 / 3;
mMapPosition.animateTo(vx * move, vy * move, 250);
} else { } else {
mScroller.fling(0, 0, Math.round(velocityX) / 2, Math.round(velocityY) / 2, mScroller.fling(0, 0, Math.round(velocityX) / 2, Math.round(velocityY) / 2,
-w, w, -h, h); -w, w, -h, h);