summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-05-23 15:20:16 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-06-01 12:50:29 +0000
commitdce96572f6e073cdf8eed916365c2cc81e9da4a4 (patch)
treecdf5cc78d47ba97a161eddd32296919d43b4e63d
parent0cf1c1fd75d839091385a3fbfa2d3d6cc714cf9a (diff)
Don't try to call Math.hypot() until V4 implements it
We'll be adding that in dev (where I'll then revert this) but I was mistaken when I simply assumed V4 had it while updating this example before. Task-number: QTBUG-68277 Change-Id: Idb3b45317bfb410cea12c3795e82670db79c18b5 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--examples/sensors/accelbubble/accelbubble.qml4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/sensors/accelbubble/accelbubble.qml b/examples/sensors/accelbubble/accelbubble.qml
index 8bd036ff..f26179ff 100644
--- a/examples/sensors/accelbubble/accelbubble.qml
+++ b/examples/sensors/accelbubble/accelbubble.qml
@@ -101,10 +101,10 @@ ApplicationWindow {
}
function calcPitch(x,y,z) {
- return -Math.atan2(y, Math.hypot(x, z)) * mainWindow.radians_to_degrees;
+ return -Math.atan2(y, Math.sqrt(x * x + z * z)) * mainWindow.radians_to_degrees;
}
function calcRoll(x,y,z) {
- return -Math.atan2(x, Math.hypot(y, z)) * mainWindow.radians_to_degrees;
+ return -Math.atan2(x, Math.sqrt(y * y + z * z)) * mainWindow.radians_to_degrees;
}
Image {