fixed map rotation

This commit is contained in:
Pavol Zibrita 2011-06-04 23:06:24 +02:00
parent 2f5735f65e
commit 4296f8c969

View file

@ -41,14 +41,18 @@ public class AnimateDraggingMapThread {
private void pendingRotateAnimation() throws InterruptedException { private void pendingRotateAnimation() {
boolean conditionToCountinue = true; boolean conditionToCountinue = false;
while (conditionToCountinue && !stopped) { do {
conditionToCountinue = false; conditionToCountinue = false;
float rotationDiff = MapUtils.unifyRotationDiff(tileView.getRotate(), targetRotate); float rotationDiff = MapUtils.unifyRotationDiff(tileView.getRotate(), targetRotate);
float absDiff = Math.abs(rotationDiff); float absDiff = Math.abs(rotationDiff);
if (absDiff > 0) { if (absDiff > 0) {
Thread.sleep(DEFAULT_SLEEP_TO_REDRAW); try {
Thread.sleep(DEFAULT_SLEEP_TO_REDRAW);
} catch (InterruptedException e) {
//do nothing
}
if (absDiff < 1) { if (absDiff < 1) {
tileView.rotateToAnimate(targetRotate); tileView.rotateToAnimate(targetRotate);
} else { } else {
@ -56,7 +60,7 @@ public class AnimateDraggingMapThread {
tileView.rotateToAnimate(rotationDiff / 5 + tileView.getRotate()); tileView.rotateToAnimate(rotationDiff / 5 + tileView.getRotate());
} }
} }
} } while (conditionToCountinue);
} }
@ -159,11 +163,7 @@ public class AnimateDraggingMapThread {
animatingZoomInThread(moveZoom, endZoom, ZOOM_MOVE_ANIMATION_TIME, notifyListener); animatingZoomInThread(moveZoom, endZoom, ZOOM_MOVE_ANIMATION_TIME, notifyListener);
} }
try { pendingRotateAnimation();
pendingRotateAnimation();
} catch (InterruptedException e) {
}
} }
}); });
} }
@ -243,10 +243,7 @@ public class AnimateDraggingMapThread {
public void run() { public void run() {
setTargetValues(zoomEnd, tileView.getLatitude(), tileView.getLongitude()); setTargetValues(zoomEnd, tileView.getLatitude(), tileView.getLongitude());
animatingZoomInThread(zoomStart, zoomEnd, animationTime, notifyListener); animatingZoomInThread(zoomStart, zoomEnd, animationTime, notifyListener);
try { pendingRotateAnimation();
pendingRotateAnimation();
} catch (InterruptedException e) {
}
} }
}); //$NON-NLS-1$ }); //$NON-NLS-1$
} }
@ -286,10 +283,7 @@ public class AnimateDraggingMapThread {
stopped = true; stopped = true;
} }
} }
try { pendingRotateAnimation();
pendingRotateAnimation();
} catch (InterruptedException e) {
}
} }
}); //$NON-NLS-1$ }); //$NON-NLS-1$
} }
@ -314,10 +308,7 @@ public class AnimateDraggingMapThread {
@Override @Override
public void run() { public void run() {
targetRotate = rotate; targetRotate = rotate;
try { pendingRotateAnimation();
pendingRotateAnimation();
} catch (InterruptedException e) {
}
} }
}); });
} else { } else {