Rename ol.DeviceOrientationProperty to ol.DeviceOrientation.Property

This commit is contained in:
Frederic Junod
2016-08-29 12:13:01 +02:00
committed by Tim Schaub
parent 21d436e529
commit 3972ec42f6
2 changed files with 25 additions and 24 deletions

View File

@@ -13,6 +13,7 @@ A number of internal types have been renamed. This will not affect those who us
* rename `ol.format.IGCZ` to `ol.format.IGC.Z`
* rename `ol.layer.GroupProperty` to `ol.layer.Group.Property`
* rename `ol.CollectionProperty` to `ol.Collection.Property`
* rename `ol.DeviceOrientationProperty` to `ol.DeviceOrientation.Property`
### v3.18.0

View File

@@ -7,18 +7,6 @@ goog.require('ol.has');
goog.require('ol.math');
/**
* @enum {string}
*/
ol.DeviceOrientationProperty = {
ALPHA: 'alpha',
BETA: 'beta',
GAMMA: 'gamma',
HEADING: 'heading',
TRACKING: 'tracking'
};
/**
* @classdesc
* The ol.DeviceOrientation class provides access to information from
@@ -87,7 +75,7 @@ ol.DeviceOrientation = function(opt_options) {
this.listenerKey_ = null;
ol.events.listen(this,
ol.Object.getChangeEventType(ol.DeviceOrientationProperty.TRACKING),
ol.Object.getChangeEventType(ol.DeviceOrientation.Property.TRACKING),
this.handleTrackingChanged_, this);
this.setTracking(options.tracking !== undefined ? options.tracking : false);
@@ -113,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.DeviceOrientationProperty.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.DeviceOrientationProperty.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.DeviceOrientationProperty.HEADING, heading);
this.set(ol.DeviceOrientation.Property.HEADING, heading);
}
}
if (event.beta !== null) {
this.set(ol.DeviceOrientationProperty.BETA,
this.set(ol.DeviceOrientation.Property.BETA,
ol.math.toRadians(event.beta));
}
if (event.gamma !== null) {
this.set(ol.DeviceOrientationProperty.GAMMA,
this.set(ol.DeviceOrientation.Property.GAMMA,
ol.math.toRadians(event.gamma));
}
this.changed();
@@ -144,7 +132,7 @@ ol.DeviceOrientation.prototype.orientationChange_ = function(originalEvent) {
*/
ol.DeviceOrientation.prototype.getAlpha = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientationProperty.ALPHA));
this.get(ol.DeviceOrientation.Property.ALPHA));
};
@@ -157,7 +145,7 @@ ol.DeviceOrientation.prototype.getAlpha = function() {
*/
ol.DeviceOrientation.prototype.getBeta = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientationProperty.BETA));
this.get(ol.DeviceOrientation.Property.BETA));
};
@@ -170,7 +158,7 @@ ol.DeviceOrientation.prototype.getBeta = function() {
*/
ol.DeviceOrientation.prototype.getGamma = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientationProperty.GAMMA));
this.get(ol.DeviceOrientation.Property.GAMMA));
};
@@ -183,7 +171,7 @@ ol.DeviceOrientation.prototype.getGamma = function() {
*/
ol.DeviceOrientation.prototype.getHeading = function() {
return /** @type {number|undefined} */ (
this.get(ol.DeviceOrientationProperty.HEADING));
this.get(ol.DeviceOrientation.Property.HEADING));
};
@@ -195,7 +183,7 @@ ol.DeviceOrientation.prototype.getHeading = function() {
*/
ol.DeviceOrientation.prototype.getTracking = function() {
return /** @type {boolean} */ (
this.get(ol.DeviceOrientationProperty.TRACKING));
this.get(ol.DeviceOrientation.Property.TRACKING));
};
@@ -224,5 +212,17 @@ ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() {
* @api
*/
ol.DeviceOrientation.prototype.setTracking = function(tracking) {
this.set(ol.DeviceOrientationProperty.TRACKING, tracking);
this.set(ol.DeviceOrientation.Property.TRACKING, tracking);
};
/**
* @enum {string}
*/
ol.DeviceOrientation.Property = {
ALPHA: 'alpha',
BETA: 'beta',
GAMMA: 'gamma',
HEADING: 'heading',
TRACKING: 'tracking'
};