Remove use of toDegrees/toRadians util functions

Instead of goog.math.toRadians and goog.math.toDegrees, we now use
our own implementations of these basic conversion functions.
This commit is contained in:
Marc Jansen
2015-10-12 21:10:37 +02:00
parent 758bab8e30
commit 47a7b03e0e
9 changed files with 81 additions and 33 deletions

View File

@@ -2,10 +2,10 @@ goog.provide('ol.DeviceOrientation');
goog.provide('ol.DeviceOrientationProperty');
goog.require('goog.events');
goog.require('goog.math');
goog.require('ol');
goog.require('ol.Object');
goog.require('ol.has');
goog.require('ol.math');
/**
@@ -115,24 +115,24 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(browserEvent) {
var event = /** @type {DeviceOrientationEvent} */
(browserEvent.getBrowserEvent());
if (event.alpha !== null) {
var alpha = goog.math.toRadians(event.alpha);
var alpha = ol.math.toRadians(event.alpha);
this.set(ol.DeviceOrientationProperty.ALPHA, alpha);
// event.absolute is undefined in iOS.
if (goog.isBoolean(event.absolute) && event.absolute) {
this.set(ol.DeviceOrientationProperty.HEADING, alpha);
} else if (goog.isNumber(event.webkitCompassHeading) &&
event.webkitCompassAccuracy != -1) {
var heading = goog.math.toRadians(event.webkitCompassHeading);
var heading = ol.math.toRadians(event.webkitCompassHeading);
this.set(ol.DeviceOrientationProperty.HEADING, heading);
}
}
if (event.beta !== null) {
this.set(ol.DeviceOrientationProperty.BETA,
goog.math.toRadians(event.beta));
ol.math.toRadians(event.beta));
}
if (event.gamma !== null) {
this.set(ol.DeviceOrientationProperty.GAMMA,
goog.math.toRadians(event.gamma));
ol.math.toRadians(event.gamma));
}
this.changed();
};