diff options
Diffstat (limited to 'main/src/cgeo/geocaching/ui/CompassView.java')
| -rw-r--r-- | main/src/cgeo/geocaching/ui/CompassView.java | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/ui/CompassView.java b/main/src/cgeo/geocaching/ui/CompassView.java index 770bbaf..5401bfd 100644 --- a/main/src/cgeo/geocaching/ui/CompassView.java +++ b/main/src/cgeo/geocaching/ui/CompassView.java @@ -128,15 +128,13 @@ public class CompassView extends View { * @return the new value */ static protected double smoothUpdate(double goal, double actual) { - double diff = goal - actual; - double offset = 0.0; - + double diff = (goal - actual) % 360; if (diff < 0.0) { diff += 360.0; - } else if (diff >= 360.0) { - diff -= 360.0; } + double offset = 0.0; + // If the difference is smaller than 1 degree, do nothing as it // causes the arrow to vibrate. if (diff > 1.0 && diff <= 180.0) { @@ -181,11 +179,9 @@ public class CompassView extends View { } double azimuthTemp = azimuthDrawn; - double azimuthRelative = azimuthTemp - headingDrawn; + double azimuthRelative = (azimuthTemp - headingDrawn) % 360; if (azimuthRelative < 0) { azimuthRelative += 360; - } else if (azimuthRelative >= 360) { - azimuthRelative -= 360; } // compass margins |
