aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/ui/CompassView.java
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2012-05-30 20:34:27 +0200
committerBananeweizen <bananeweizen@gmx.de>2012-05-30 20:34:27 +0200
commitea841463e2879c02f38a8426d92b88c4b41aae7b (patch)
treeaf86ea9ecea819c803acf867ae04da4c82303294 /main/src/cgeo/geocaching/ui/CompassView.java
parentb6ec65f9548c268f5849d2baf9c6765eebb188a4 (diff)
downloadcgeo-ea841463e2879c02f38a8426d92b88c4b41aae7b.zip
cgeo-ea841463e2879c02f38a8426d92b88c4b41aae7b.tar.gz
cgeo-ea841463e2879c02f38a8426d92b88c4b41aae7b.tar.bz2
new: make compass spin fast for large angles, slower for small angles
Diffstat (limited to 'main/src/cgeo/geocaching/ui/CompassView.java')
-rw-r--r--main/src/cgeo/geocaching/ui/CompassView.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/ui/CompassView.java b/main/src/cgeo/geocaching/ui/CompassView.java
index d0b4a36..770bbaf 100644
--- a/main/src/cgeo/geocaching/ui/CompassView.java
+++ b/main/src/cgeo/geocaching/ui/CompassView.java
@@ -129,8 +129,6 @@ public class CompassView extends View {
*/
static protected double smoothUpdate(double goal, double actual) {
double diff = goal - actual;
- final boolean largeDiff = Math.abs(diff) > 5;
-
double offset = 0.0;
if (diff < 0.0) {
@@ -142,9 +140,9 @@ public class CompassView extends View {
// If the difference is smaller than 1 degree, do nothing as it
// causes the arrow to vibrate.
if (diff > 1.0 && diff <= 180.0) {
- offset = largeDiff ? 2.0 : 1.0;
+ offset = Math.ceil(diff / 10.0); // for larger angles, rotate faster
} else if (diff > 180.0 && diff < 359.0) {
- offset = largeDiff ? -2.0 : -1.0;
+ offset = Math.floor((diff - 360.0) / 10.0);
}
return actual + offset;