Set default 'tracking' property to false

This commit is contained in:
Frederic Junod
2013-06-21 09:21:48 +02:00
parent c4ce85c847
commit 9cac8a92df
2 changed files with 10 additions and 6 deletions

View File

@@ -27,6 +27,10 @@ ol.DeviceOrientationProperty = {
*/ */
ol.DeviceOrientation = function(opt_options) { ol.DeviceOrientation = function(opt_options) {
goog.base(this);
var options = goog.isDef(opt_options) ? opt_options : {};
/** /**
* @private * @private
* @type {?number} * @type {?number}
@@ -37,7 +41,7 @@ ol.DeviceOrientation = function(opt_options) {
ol.Object.getChangeEventType(ol.DeviceOrientationProperty.TRACKING), ol.Object.getChangeEventType(ol.DeviceOrientationProperty.TRACKING),
this.handleTrackingChanged_, false, this); this.handleTrackingChanged_, false, this);
goog.base(this, goog.isDef(opt_options) ? opt_options : {}); this.setTracking(goog.isDef(options.tracking) ? options.tracking : false);
}; };
goog.inherits(ol.DeviceOrientation, ol.Object); goog.inherits(ol.DeviceOrientation, ol.Object);
@@ -139,7 +143,8 @@ goog.exportProperty(
/** /**
* @return {boolean|undefined} tracking. * Are we tracking the device's orientation?
* @return {boolean} tracking.
*/ */
ol.DeviceOrientation.prototype.getTracking = function() { ol.DeviceOrientation.prototype.getTracking = function() {
return /** @type {boolean} */ ( return /** @type {boolean} */ (

View File

@@ -86,9 +86,8 @@ ol.Geolocation = function(opt_options) {
if (goog.isDef(options.trackingOptions)) { if (goog.isDef(options.trackingOptions)) {
this.setTrackingOptions(options.trackingOptions); this.setTrackingOptions(options.trackingOptions);
} }
if (goog.isDef(options.tracking)) {
this.setTracking(options.tracking); this.setTracking(goog.isDef(options.tracking) ? options.tracking : false);
}
}; };
goog.inherits(ol.Geolocation, ol.Object); goog.inherits(ol.Geolocation, ol.Object);
@@ -282,7 +281,7 @@ goog.exportProperty(
/** /**
* Are we tracking the user's position? * Are we tracking the user's position?
* @return {boolean|undefined} tracking. * @return {boolean} tracking.
*/ */
ol.Geolocation.prototype.getTracking = function() { ol.Geolocation.prototype.getTracking = function() {
return /** @type {boolean} */ ( return /** @type {boolean} */ (