[OpenLayers-Commits] r11335 - sandbox/sbrunner/openlayers/examples

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Wed Feb 23 10:32:32 EST 2011


Author: sbrunner
Date: 2011-02-23 07:32:32 -0800 (Wed, 23 Feb 2011)
New Revision: 11335

Modified:
   sandbox/sbrunner/openlayers/examples/geolocation.html
   sandbox/sbrunner/openlayers/examples/geolocation.js
Log:
some fix

Modified: sandbox/sbrunner/openlayers/examples/geolocation.html
===================================================================
--- sandbox/sbrunner/openlayers/examples/geolocation.html	2011-02-23 15:32:19 UTC (rev 11334)
+++ sandbox/sbrunner/openlayers/examples/geolocation.html	2011-02-23 15:32:32 UTC (rev 11335)
@@ -30,7 +30,7 @@
             Track  current position and display it with its accuracy.
         </p>
 
-        <div id="map" class="smallmap"><div id="north" /><img id="northimg" src="img/mobile-arrow.png" /></div>
+        <div id="map" class="smallmap"><div id="north"><img id="northimg" src="img/mobile-arrow.png" /></div></div>
         <button id="locate">Locate me!</button>
         <input type="checkbox" name="track" id="track">
         <label for="track">Track my position</label>

Modified: sandbox/sbrunner/openlayers/examples/geolocation.js
===================================================================
--- sandbox/sbrunner/openlayers/examples/geolocation.js	2011-02-23 15:32:19 UTC (rev 11334)
+++ sandbox/sbrunner/openlayers/examples/geolocation.js	2011-02-23 15:32:32 UTC (rev 11335)
@@ -78,8 +78,7 @@
             graphicHeight: 19,
             graphicWidth: 20,
             graphicXOffset: -10,
-            graphicYOffset: -10,
-            rotation: 15
+            graphicYOffset: -10
         }
     );
     vector.addFeatures([
@@ -110,10 +109,22 @@
 };
 $('track').checked = false;
 
+
+
+                if (window.DeviceOrientationEvent) {
+                    window.addEventListener("deviceorientation", function (event) {
+                        if (typeof(event.alpha) != 'undefined') {
+                            var img = document.getElementById("orientation");
+                            var value = "rotate(" + (event.alpha - window.orientation - 90) + "deg)";
+                            img.style.transform = value;
+                            img.style.webkitTransform = value;
+                        }
+                    }, true);
+                }
 // Device Orientation
 if (window.DeviceOrientationEvent) {
     window.addEventListener("deviceorientation", function(event) {
-        if (event.alpha) {
+        if (typeof(event.alpha) != 'undefined') {
             var orientation = event.alpha - window.orientation - 90;
             var img = Openlayers.Util.getElement('northimg');
             var value = "rotate(" + event.orientation + "deg)";



More information about the Commits mailing list