Commit 8bb50b1b authored by Leena Miettinen's avatar Leena Miettinen

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: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent 95ddc795
......@@ -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
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment