From 4296f8c96984d032b01dc34e7b0a305dd95a0d79 Mon Sep 17 00:00:00 2001 From: Pavol Zibrita Date: Sat, 4 Jun 2011 23:06:24 +0200 Subject: [PATCH] fixed map rotation --- .../plus/views/AnimateDraggingMapThread.java | 35 +++++++------------ 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java b/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java index 841696251b..a154bcdceb 100644 --- a/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java +++ b/OsmAnd/src/net/osmand/plus/views/AnimateDraggingMapThread.java @@ -41,14 +41,18 @@ public class AnimateDraggingMapThread { - private void pendingRotateAnimation() throws InterruptedException { - boolean conditionToCountinue = true; - while (conditionToCountinue && !stopped) { + private void pendingRotateAnimation() { + boolean conditionToCountinue = false; + do { conditionToCountinue = false; float rotationDiff = MapUtils.unifyRotationDiff(tileView.getRotate(), targetRotate); float absDiff = Math.abs(rotationDiff); if (absDiff > 0) { - Thread.sleep(DEFAULT_SLEEP_TO_REDRAW); + try { + Thread.sleep(DEFAULT_SLEEP_TO_REDRAW); + } catch (InterruptedException e) { + //do nothing + } if (absDiff < 1) { tileView.rotateToAnimate(targetRotate); } else { @@ -56,7 +60,7 @@ public class AnimateDraggingMapThread { tileView.rotateToAnimate(rotationDiff / 5 + tileView.getRotate()); } } - } + } while (conditionToCountinue); } @@ -159,11 +163,7 @@ public class AnimateDraggingMapThread { animatingZoomInThread(moveZoom, endZoom, ZOOM_MOVE_ANIMATION_TIME, notifyListener); } - try { - pendingRotateAnimation(); - } catch (InterruptedException e) { - } - + pendingRotateAnimation(); } }); } @@ -243,10 +243,7 @@ public class AnimateDraggingMapThread { public void run() { setTargetValues(zoomEnd, tileView.getLatitude(), tileView.getLongitude()); animatingZoomInThread(zoomStart, zoomEnd, animationTime, notifyListener); - try { - pendingRotateAnimation(); - } catch (InterruptedException e) { - } + pendingRotateAnimation(); } }); //$NON-NLS-1$ } @@ -286,10 +283,7 @@ public class AnimateDraggingMapThread { stopped = true; } } - try { - pendingRotateAnimation(); - } catch (InterruptedException e) { - } + pendingRotateAnimation(); } }); //$NON-NLS-1$ } @@ -314,10 +308,7 @@ public class AnimateDraggingMapThread { @Override public void run() { targetRotate = rotate; - try { - pendingRotateAnimation(); - } catch (InterruptedException e) { - } + pendingRotateAnimation(); } }); } else {