diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2012-05-30 20:34:27 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2012-05-30 20:34:27 +0200 |
| commit | ea841463e2879c02f38a8426d92b88c4b41aae7b (patch) | |
| tree | af86ea9ecea819c803acf867ae04da4c82303294 | |
| parent | b6ec65f9548c268f5849d2baf9c6765eebb188a4 (diff) | |
| download | cgeo-ea841463e2879c02f38a8426d92b88c4b41aae7b.zip cgeo-ea841463e2879c02f38a8426d92b88c4b41aae7b.tar.gz cgeo-ea841463e2879c02f38a8426d92b88c4b41aae7b.tar.bz2 | |
new: make compass spin fast for large angles, slower for small angles
| -rw-r--r-- | main/src/cgeo/geocaching/ui/CompassView.java | 6 |
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; |
