Add ol.BrowserFeature.HAS_DEVICE_ORIENTATION
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
@exportSymbol ol.BrowserFeature
|
||||
@exportProperty ol.BrowserFeature.DEVICE_PIXEL_RATIO
|
||||
@exportProperty ol.BrowserFeature.HAS_TOUCH
|
||||
@exportProperty ol.BrowserFeature.HAS_DEVICE_ORIENTATION
|
||||
@exportProperty ol.BrowserFeature.HAS_WEBGL
|
||||
|
||||
@@ -21,6 +21,16 @@ ol.ASSUME_TOUCH = false;
|
||||
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.
|
||||
* @const
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
@exportSymbol ol.DeviceOrientation
|
||||
@exportSymbol ol.DeviceOrientation.SUPPORTED ol.DeviceOrientation.SUPPORTED
|
||||
|
||||
@@ -3,6 +3,7 @@ goog.provide('ol.DeviceOrientationProperty');
|
||||
|
||||
goog.require('goog.events');
|
||||
goog.require('goog.math');
|
||||
goog.require('ol.BrowserFeature');
|
||||
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
|
||||
* @param {goog.events.BrowserEvent} browserEvent Event.
|
||||
@@ -230,7 +222,7 @@ goog.exportProperty(
|
||||
* @private
|
||||
*/
|
||||
ol.DeviceOrientation.prototype.handleTrackingChanged_ = function() {
|
||||
if (ol.DeviceOrientation.SUPPORTED) {
|
||||
if (ol.BrowserFeature.HAS_DEVICE_ORIENTATION) {
|
||||
var tracking = this.getTracking();
|
||||
if (tracking && goog.isNull(this.listenerKey_)) {
|
||||
this.listenerKey_ = goog.events.listen(goog.global, 'deviceorientation',
|
||||
|
||||
Reference in New Issue
Block a user