summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLincoln Ramsay <lincoln.ramsay@nokia.com>2011-03-14 13:35:03 +1000
committerLincoln Ramsay <lincoln.ramsay@nokia.com>2011-03-15 09:22:11 +1000
commit3a0c8cc3d8ec256f4f33f73beb715582ef2a218e (patch)
tree67682e08f3ce7c9fb6c6964a2797cf75c41ad803 /src
parent5a941d613176bcce4a3d860ae1ba05ec368e32b8 (diff)
Fix the FaceDown button.
When the device is placed into 'face down' position, the top should point away from the user. This was really confusing me until I found it.
Diffstat (limited to 'src')
-rw-r--r--src/ui/accelerometercontrol.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ui/accelerometercontrol.cpp b/src/ui/accelerometercontrol.cpp
index d4656f6..1a65afc 100644
--- a/src/ui/accelerometercontrol.cpp
+++ b/src/ui/accelerometercontrol.cpp
@@ -63,6 +63,9 @@ void AccelerometerControl::setValue(const QVector3D &newValue)
mRotation = QQuaternion();
} else if(dot < -0.999) {
mRotation = QQuaternion::fromAxisAndAngle(0, 0, 1, 180);
+ } else if (target.z() == -1) {
+ // special case for face down (mirror of face up, not with the top pointing down)
+ mRotation = QQuaternion(0.0, 0.0, -0.707107, -0.707107);
} else {
// we want the quaternion that transforms target into up
QVector3D cross = QVector3D::crossProduct(target, accelerometerY);