Remove goog.isDefAndNotNull() from deviceorientation.js

This commit is contained in:
Tim Schaub
2015-09-29 09:39:19 -06:00
parent b48cabee28
commit 5acf9023d0
+4 -5
View File
@@ -114,24 +114,23 @@ ol.DeviceOrientation.prototype.disposeInternal = function() {
ol.DeviceOrientation.prototype.orientationChange_ = function(browserEvent) { ol.DeviceOrientation.prototype.orientationChange_ = function(browserEvent) {
var event = /** @type {DeviceOrientationEvent} */ var event = /** @type {DeviceOrientationEvent} */
(browserEvent.getBrowserEvent()); (browserEvent.getBrowserEvent());
if (goog.isDefAndNotNull(event.alpha)) { if (event.alpha !== null) {
var alpha = goog.math.toRadians(event.alpha); var alpha = goog.math.toRadians(event.alpha);
this.set(ol.DeviceOrientationProperty.ALPHA, alpha); this.set(ol.DeviceOrientationProperty.ALPHA, alpha);
// event.absolute is undefined in iOS. // event.absolute is undefined in iOS.
if (goog.isBoolean(event.absolute) && event.absolute) { if (goog.isBoolean(event.absolute) && event.absolute) {
this.set(ol.DeviceOrientationProperty.HEADING, alpha); this.set(ol.DeviceOrientationProperty.HEADING, alpha);
} else if (goog.isDefAndNotNull(event.webkitCompassHeading) && } else if (goog.isNumber(event.webkitCompassHeading) &&
goog.isDefAndNotNull(event.webkitCompassAccuracy) &&
event.webkitCompassAccuracy != -1) { event.webkitCompassAccuracy != -1) {
var heading = goog.math.toRadians(event.webkitCompassHeading); var heading = goog.math.toRadians(event.webkitCompassHeading);
this.set(ol.DeviceOrientationProperty.HEADING, heading); this.set(ol.DeviceOrientationProperty.HEADING, heading);
} }
} }
if (goog.isDefAndNotNull(event.beta)) { if (event.beta !== null) {
this.set(ol.DeviceOrientationProperty.BETA, this.set(ol.DeviceOrientationProperty.BETA,
goog.math.toRadians(event.beta)); goog.math.toRadians(event.beta));
} }
if (goog.isDefAndNotNull(event.gamma)) { if (event.gamma !== null) {
this.set(ol.DeviceOrientationProperty.GAMMA, this.set(ol.DeviceOrientationProperty.GAMMA,
goog.math.toRadians(event.gamma)); goog.math.toRadians(event.gamma));
} }