Add ol.BrowserFeature.HAS_DEVICE_ORIENTATION

This commit is contained in:
Éric Lemoine
2013-12-18 08:20:52 +01:00
parent 79718151b7
commit 62e8803287
4 changed files with 13 additions and 11 deletions
+1
View File
@@ -1,4 +1,5 @@
@exportSymbol ol.BrowserFeature @exportSymbol ol.BrowserFeature
@exportProperty ol.BrowserFeature.DEVICE_PIXEL_RATIO @exportProperty ol.BrowserFeature.DEVICE_PIXEL_RATIO
@exportProperty ol.BrowserFeature.HAS_TOUCH @exportProperty ol.BrowserFeature.HAS_TOUCH
@exportProperty ol.BrowserFeature.HAS_DEVICE_ORIENTATION
@exportProperty ol.BrowserFeature.HAS_WEBGL @exportProperty ol.BrowserFeature.HAS_WEBGL
+10
View File
@@ -21,6 +21,16 @@ ol.ASSUME_TOUCH = false;
ol.BrowserFeature.DEVICE_PIXEL_RATIO = goog.global.devicePixelRatio || 1; ol.BrowserFeature.DEVICE_PIXEL_RATIO = goog.global.devicePixelRatio || 1;
/**
* Indicates if DeviceOrientation is supported in the user's browser.
* @const
* @type {boolean}
* @todo stability experimental
*/
ol.BrowserFeature.HAS_DEVICE_ORIENTATION =
'DeviceOrientationEvent' in goog.global;
/** /**
* True if browser supports touch events. * True if browser supports touch events.
* @const * @const
-1
View File
@@ -1,2 +1 @@
@exportSymbol ol.DeviceOrientation @exportSymbol ol.DeviceOrientation
@exportSymbol ol.DeviceOrientation.SUPPORTED ol.DeviceOrientation.SUPPORTED
+2 -10
View File
@@ -3,6 +3,7 @@ goog.provide('ol.DeviceOrientationProperty');
goog.require('goog.events'); goog.require('goog.events');
goog.require('goog.math'); goog.require('goog.math');
goog.require('ol.BrowserFeature');
goog.require('ol.Object'); goog.require('ol.Object');
@@ -111,15 +112,6 @@ ol.DeviceOrientation.prototype.disposeInternal = function() {
}; };
/**
* Indicates if DeviceOrientation is supported in the user's browser.
* @const
* @type {boolean}
* @todo stability experimental
*/
ol.DeviceOrientation.SUPPORTED = 'DeviceOrientationEvent' in goog.global;
/** /**
* @private * @private
* @param {goog.events.BrowserEvent} browserEvent Event. * @param {goog.events.BrowserEvent} browserEvent Event.
@@ -230,7 +222,7 @@ goog.exportProperty(
* @private * @private
*/ */
ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() { ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() {
if (ol.DeviceOrientation.SUPPORTED) { if (ol.BrowserFeature.HAS_DEVICE_ORIENTATION) {
var tracking = this.getTracking(); var tracking = this.getTracking();
if (tracking && goog.isNull(this.listenerKey_)) { if (tracking && goog.isNull(this.listenerKey_)) {
this.listenerKey_ = goog.events.listen(goog.global, 'deviceorientation', this.listenerKey_ = goog.events.listen(goog.global, 'deviceorientation',