Merge pull request #993 from pagameba/deviceorientation-ios

Detect iOS compass heading
This commit is contained in:
Frédéric Junod committed 2013-09-09 05:57:34 -07:00
commit 7ffd2bcaa1
9 files changed
+49 -23

No files matched your search

+5
View File
@@ -122,6 +122,11 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(browserEvent) {
// event.absolute is undefined in iOS.
if (goog.isBoolean(event.absolute) && event.absolute) {
this.set(ol.DeviceOrientationProperty.HEADING, alpha);
} else if (goog.isDefAndNotNull(event.webkitCompassHeading) &&
goog.isDefAndNotNull(event.webkitCompassAccuracy) &&
event.webkitCompassAccuracy != -1) {
var heading = goog.math.toRadians(event.webkitCompassHeading);
this.set(ol.DeviceOrientationProperty.HEADING, heading);
}
}
if (goog.isDefAndNotNull(event.beta)) {