Add ol.BrowserFeature.HAS_GEOLOCATION

This commit is contained in:
Éric Lemoine
2013-12-18 08:22:35 +01:00
parent 62e8803287
commit b6ec5838f7
4 changed files with 12 additions and 11 deletions

View File

@@ -2,4 +2,5 @@
@exportProperty ol.BrowserFeature.DEVICE_PIXEL_RATIO
@exportProperty ol.BrowserFeature.HAS_TOUCH
@exportProperty ol.BrowserFeature.HAS_DEVICE_ORIENTATION
@exportProperty ol.BrowserFeature.HAS_GEOLOCATION
@exportProperty ol.BrowserFeature.HAS_WEBGL

View File

@@ -31,6 +31,15 @@ ol.BrowserFeature.HAS_DEVICE_ORIENTATION =
'DeviceOrientationEvent' in goog.global;
/**
* Is HTML5 geolocation supported in the current browser?
* @const
* @type {boolean}
* @todo stability experimental
*/
ol.BrowserFeature.HAS_GEOLOCATION = 'geolocation' in goog.global.navigator;
/**
* True if browser supports touch events.
* @const

View File

@@ -1,2 +1 @@
@exportSymbol ol.Geolocation
@exportSymbol ol.Geolocation.SUPPORTED ol.Geolocation.SUPPORTED

View File

@@ -6,6 +6,7 @@ goog.provide('ol.GeolocationProperty');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('goog.math');
goog.require('ol.BrowserFeature');
goog.require('ol.Coordinate');
goog.require('ol.Object');
goog.require('ol.proj');
@@ -140,7 +141,7 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() {
* @private
*/
ol.Geolocation.prototype.handleTrackingChanged_ = function() {
if (ol.Geolocation.SUPPORTED) {
if (ol.BrowserFeature.HAS_GEOLOCATION) {
var tracking = this.getTracking();
if (tracking && !goog.isDef(this.watchId_)) {
this.watchId_ = goog.global.navigator.geolocation.watchPosition(
@@ -155,15 +156,6 @@ ol.Geolocation.prototype.handleTrackingChanged_ = function() {
};
/**
* Is HTML5 geolocation supported in the current browser?
* @const
* @type {boolean}
* @todo stability experimental
*/
ol.Geolocation.SUPPORTED = 'geolocation' in goog.global.navigator;
/**
* @private
* @param {GeolocationPosition} position position event.