Deal with ol.global issues
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
goog.provide('ol.Geolocation');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.Object');
|
||||
goog.require('ol.geom.Polygon');
|
||||
goog.require('ol.has');
|
||||
goog.require('ol.math');
|
||||
@@ -113,15 +113,17 @@ ol.Geolocation.prototype.handleProjectionChanged_ = function() {
|
||||
* @private
|
||||
*/
|
||||
ol.Geolocation.prototype.handleTrackingChanged_ = function() {
|
||||
var global = ol.global;
|
||||
if (ol.has.GEOLOCATION) {
|
||||
var navigator = global.navigator;
|
||||
var tracking = this.getTracking();
|
||||
if (tracking && this.watchId_ === undefined) {
|
||||
this.watchId_ = ol.global.navigator.geolocation.watchPosition(
|
||||
this.watchId_ = navigator.geolocation.watchPosition(
|
||||
this.positionChange_.bind(this),
|
||||
this.positionError_.bind(this),
|
||||
this.getTrackingOptions());
|
||||
} else if (!tracking && this.watchId_ !== undefined) {
|
||||
ol.global.navigator.geolocation.clearWatch(this.watchId_);
|
||||
navigator.geolocation.clearWatch(this.watchId_);
|
||||
this.watchId_ = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user