summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeena Miettinen <riitta-leena.miettinen@digia.com>2014-04-08 12:28:47 +0200
committerLeena Miettinen <riitta-leena.miettinen@digia.com>2014-04-24 14:02:06 +0200
commit8bb50b1b1e40dc038f4a57a7b565e117f6f99ad6 (patch)
treec3bea6faaba0cc016b446b9d39b8e742579b42e4
parent95ddc795a5cf39739b8d56520d51cfb9acc7bf14 (diff)
downloadqt-creator-8bb50b1b1e40dc038f4a57a7b565e117f6f99ad6.tar.gz
Doc: update Accelbubble example
The app could not recover from receiving a NaN value from the Accelerometer, so NaN values are ignored. Change-Id: Ia33d800f7fe080e07dcf327c26b3772e994793bf Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
-rw-r--r--doc/examples/accelbubble/main.qml3
-rw-r--r--doc/src/qtquick/creator-mobile-app-tutorial.qdoc3
2 files changed, 6 insertions, 0 deletions
diff --git a/doc/examples/accelbubble/main.qml b/doc/examples/accelbubble/main.qml
index 80c961f78b..0f3d198941 100644
--- a/doc/examples/accelbubble/main.qml
+++ b/doc/examples/accelbubble/main.qml
@@ -79,6 +79,9 @@ ApplicationWindow {
var newX = (bubble.x + calcRoll(accel.reading.x, accel.reading.y, accel.reading.z) * 0.1)
var newY = (bubble.y - calcPitch(accel.reading.x, accel.reading.y, accel.reading.z) * 0.1)
+ if (isNaN(newX) || isNaN(newY))
+ return;
+
if (newX < 0)
newX = 0
diff --git a/doc/src/qtquick/creator-mobile-app-tutorial.qdoc b/doc/src/qtquick/creator-mobile-app-tutorial.qdoc
index 483f9cd665..09713b4d83 100644
--- a/doc/src/qtquick/creator-mobile-app-tutorial.qdoc
+++ b/doc/src/qtquick/creator-mobile-app-tutorial.qdoc
@@ -196,6 +196,9 @@
\skipto onReadingChanged
\printuntil }
+ We want to ensure that the position of the bubble is always within
+ the bounds of the screen. If the Accelerometer returns not a number
+ (NaN), the value is ignored and the bubble position is not updated.
\li Add SmoothedAnimation behavior on the \a x and \a y properties of
the bubble to make its movement look smoother.