[OpenLayers-Commits] r11200 - sandbox/cmoullet/openlayers/examples
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Feb 21 11:02:19 EST 2011
Author: cmoullet
Date: 2011-02-21 08:02:19 -0800 (Mon, 21 Feb 2011)
New Revision: 11200
Modified:
sandbox/cmoullet/openlayers/examples/accelerometer.html
Log:
Add output information and compass information
Modified: sandbox/cmoullet/openlayers/examples/accelerometer.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/accelerometer.html 2011-02-21 15:49:36 UTC (rev 11199)
+++ sandbox/cmoullet/openlayers/examples/accelerometer.html 2011-02-21 16:02:19 UTC (rev 11200)
@@ -19,22 +19,39 @@
if (window.DeviceOrientationEvent) {
window.addEventListener("deviceorientation", function (event) {
document.getElementById('resultDeviceOrientation').innerHTML = "Alpha: " + event.alpha + "<br>";
- document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Beta: " + event.beta+ "<br>";
- document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Gamma: " + event.gamma+ "<br>";
+ document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Beta: " + event.beta + "<br>";
+ document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Gamma: " + event.gamma + "<br>";
+ if (typeof event.absolute != 'undefined') {
+ document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Gamma: " + event.absolute + "<br>";
+ }
+ if (typeof event.compassCalibrated != 'undefined') {
+ document.getElementById('resultDeviceOrientation').innerHTML = document.getElementById('resultDeviceOrientation').innerHTML + "Gamma: " + event.compassCalibrated + "<br>";
+ }
}, true);
}
if (window.DeviceMotionEvent) {
window.addEventListener('devicemotion', function (event) {
- document.getElementById('resultDeviceMotion').innerHTML = "accelerationIncludingGravity.x: " + event.accelerationIncludingGravity.x+ "<br>";
- document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "accelerationIncludingGravity.y: " + event.accelerationIncludingGravity.y+ "<br>";
- document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "accelerationIncludingGravity.z: " + event.accelerationIncludingGravity.z+ "<br>";
+
+ document.getElementById('resultDeviceMotion').innerHTML = "accelerationIncludingGravity.x: " + event.accelerationIncludingGravity.x + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "accelerationIncludingGravity.y: " + event.accelerationIncludingGravity.y + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "accelerationIncludingGravity.z: " + event.accelerationIncludingGravity.z + "<br>";
+ if (typeof event.acceleration != 'undefined') {
+ document.getElementById('resultDeviceMotion').innerHTML = "acceleration.x: " + event.acceleration.x + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "acceleration.y: " + event.acceleration.y + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "acceleration.z: " + event.acceleration.z + "<br>";
+ }
+ if (typeof event.rotationRate != 'undefined') {
+ document.getElementById('resultDeviceMotion').innerHTML = "rotationRate.alpha: " + event.rotationRate.alpha + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "rotationRate.beta: " + event.rotationRate.beta + "<br>";
+ document.getElementById('resultDeviceMotion').innerHTML = document.getElementById('resultDeviceMotion').innerHTML + "rotationRate.gamma: " + event.rotationRate.gamma + "<br>";
+ }
}, true);
}
if (window.MozOrientation) {
window.addEventListener("MozOrientation", function (orientation) {
- document.getElementById('resultMozOrientation').innerHTML = "orientation.x: " + orientation.x+ "<br>";
- document.getElementById('resultMozOrientation').innerHTML = document.getElementById('resultMozOrientation').innerHTML + "orientation.y: " + orientation.y+ "<br>";
- document.getElementById('resultMozOrientation').innerHTML = document.getElementById('resultMozOrientation').innerHTML + "orientation.z: " + orientation.z+ "<br>";
+ document.getElementById('resultMozOrientation').innerHTML = "orientation.x: " + orientation.x + "<br>";
+ document.getElementById('resultMozOrientation').innerHTML = document.getElementById('resultMozOrientation').innerHTML + "orientation.y: " + orientation.y + "<br>";
+ document.getElementById('resultMozOrientation').innerHTML = document.getElementById('resultMozOrientation').innerHTML + "orientation.z: " + orientation.z + "<br>";
}, true);
}
} else {
@@ -52,14 +69,17 @@
</p>
<h1>Device motion</h1>
+
<div id="resultDeviceMotion">
</div>
<h1>Device orientation</h1>
+
<div id="resultDeviceOrientation">
</div>
<h1>MOZ orientation</h1>
+
<div id="resultMozOrientation">
</div>
More information about the Commits
mailing list