improve accelerometer in behavior
authorLiu, Xin <xinx.liu@intel.com>
Fri, 9 Aug 2013 07:34:00 +0000 (15:34 +0800)
committerwanmingx.lin <wanmingx.lin@intel.com>
Fri, 9 Aug 2013 09:12:17 +0000 (17:12 +0800)
Signed-off-by: Liu, Xin <xinx.liu@intel.com>
tests/Accelerometer/index.html
tests/Accelerometer/js/main.js

index f502645..1a0a0bf 100755 (executable)
@@ -63,7 +63,7 @@ Authors:
           <li id="y">Y:</li>
           <li id="z">Z:</li>
         </ul>
-        <p>X, Y, Z are always changing</p>
+        <p>X, Y, Z will be changed while moving the device, otherwise they will be zero</p>
       </div>
     </div>
     <div data-role="footer" data-position="fixed">
index 6e68a8a..af52a3e 100755 (executable)
@@ -32,7 +32,7 @@ window.addEventListener(
     "devicemotion",
     function(evt) {
         var coordinate = evt.acceleration;
-        jQuery("#x").text("X: " + coordinate.x);
-        jQuery("#y").text("Y: " + coordinate.y);
-        jQuery("#z").text("Z: " + coordinate.z);
+        jQuery("#x").text("X: " + Math.round(coordinate.x-0));
+        jQuery("#y").text("Y: " + Math.round(coordinate.y-0));
+        jQuery("#z").text("Z: " + Math.round(coordinate.z-0));
     }, false);