Private device orientation property enum
This commit is contained in:
@@ -75,7 +75,7 @@ ol.DeviceOrientation = function(opt_options) {
|
||||
this.listenerKey_ = null;
|
||||
|
||||
ol.events.listen(this,
|
||||
ol.Object.getChangeEventType(ol.DeviceOrientation.Property.TRACKING),
|
||||
ol.Object.getChangeEventType(ol.DeviceOrientation.Property_.TRACKING),
|
||||
this.handleTrackingChanged_, this);
|
||||
|
||||
this.setTracking(options.tracking !== undefined ? options.tracking : false);
|
||||
@@ -101,22 +101,22 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(originalEvent) {
|
||||
var event = /** @type {DeviceOrientationEvent} */ (originalEvent);
|
||||
if (event.alpha !== null) {
|
||||
var alpha = ol.math.toRadians(event.alpha);
|
||||
this.set(ol.DeviceOrientation.Property.ALPHA, alpha);
|
||||
this.set(ol.DeviceOrientation.Property_.ALPHA, alpha);
|
||||
// event.absolute is undefined in iOS.
|
||||
if (typeof event.absolute === 'boolean' && event.absolute) {
|
||||
this.set(ol.DeviceOrientation.Property.HEADING, alpha);
|
||||
this.set(ol.DeviceOrientation.Property_.HEADING, alpha);
|
||||
} else if (typeof event.webkitCompassHeading === 'number' &&
|
||||
event.webkitCompassAccuracy != -1) {
|
||||
var heading = ol.math.toRadians(event.webkitCompassHeading);
|
||||
this.set(ol.DeviceOrientation.Property.HEADING, heading);
|
||||
this.set(ol.DeviceOrientation.Property_.HEADING, heading);
|
||||
}
|
||||
}
|
||||
if (event.beta !== null) {
|
||||
this.set(ol.DeviceOrientation.Property.BETA,
|
||||
this.set(ol.DeviceOrientation.Property_.BETA,
|
||||
ol.math.toRadians(event.beta));
|
||||
}
|
||||
if (event.gamma !== null) {
|
||||
this.set(ol.DeviceOrientation.Property.GAMMA,
|
||||
this.set(ol.DeviceOrientation.Property_.GAMMA,
|
||||
ol.math.toRadians(event.gamma));
|
||||
}
|
||||
this.changed();
|
||||
@@ -132,7 +132,7 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(originalEvent) {
|
||||
*/
|
||||
ol.DeviceOrientation.prototype.getAlpha = function() {
|
||||
return /** @type {number|undefined} */ (
|
||||
this.get(ol.DeviceOrientation.Property.ALPHA));
|
||||
this.get(ol.DeviceOrientation.Property_.ALPHA));
|
||||
};
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ ol.DeviceOrientation.prototype.getAlpha = function() {
|
||||
*/
|
||||
ol.DeviceOrientation.prototype.getBeta = function() {
|
||||
return /** @type {number|undefined} */ (
|
||||
this.get(ol.DeviceOrientation.Property.BETA));
|
||||
this.get(ol.DeviceOrientation.Property_.BETA));
|
||||
};
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ ol.DeviceOrientation.prototype.getBeta = function() {
|
||||
*/
|
||||
ol.DeviceOrientation.prototype.getGamma = function() {
|
||||
return /** @type {number|undefined} */ (
|
||||
this.get(ol.DeviceOrientation.Property.GAMMA));
|
||||
this.get(ol.DeviceOrientation.Property_.GAMMA));
|
||||
};
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ ol.DeviceOrientation.prototype.getGamma = function() {
|
||||
*/
|
||||
ol.DeviceOrientation.prototype.getHeading = function() {
|
||||
return /** @type {number|undefined} */ (
|
||||
this.get(ol.DeviceOrientation.Property.HEADING));
|
||||
this.get(ol.DeviceOrientation.Property_.HEADING));
|
||||
};
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ ol.DeviceOrientation.prototype.getHeading = function() {
|
||||
*/
|
||||
ol.DeviceOrientation.prototype.getTracking = function() {
|
||||
return /** @type {boolean} */ (
|
||||
this.get(ol.DeviceOrientation.Property.TRACKING));
|
||||
this.get(ol.DeviceOrientation.Property_.TRACKING));
|
||||
};
|
||||
|
||||
|
||||
@@ -212,14 +212,15 @@ ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() {
|
||||
* @api
|
||||
*/
|
||||
ol.DeviceOrientation.prototype.setTracking = function(tracking) {
|
||||
this.set(ol.DeviceOrientation.Property.TRACKING, tracking);
|
||||
this.set(ol.DeviceOrientation.Property_.TRACKING, tracking);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
* @private
|
||||
*/
|
||||
ol.DeviceOrientation.Property = {
|
||||
ol.DeviceOrientation.Property_ = {
|
||||
ALPHA: 'alpha',
|
||||
BETA: 'beta',
|
||||
GAMMA: 'gamma',
|
||||
|
||||
Reference in New Issue
Block a user