Merge pull request #9576 from fredj/has-geolocation

Remove geolocation detection from ol/has
This commit is contained in:
Frédéric Junod
2019-05-18 09:40:21 +02:00
committed by GitHub
3 changed files with 11 additions and 11 deletions

View File

@@ -4,6 +4,16 @@
#### Backwards incompatible changes
#### Removal of `GEOLOCATION` constant from `ol/has`
If you were previously using this constant, you can check if `'geolocation'` is define in `navigator` instead.
```js
if ('geolocation' in navigator) {
// ...
}
```
#### Removal of CSS print rules
The CSS media print rules were removed from the `ol.css` file. To get the previous behavior, use the following CSS:

View File

@@ -6,7 +6,6 @@ import {listen} from './events.js';
import Event from './events/Event.js';
import EventType from './events/EventType.js';
import {circular as circularPolygon} from './geom/Polygon.js';
import {GEOLOCATION} from './has.js';
import {toRadians} from './math.js';
import {get as getProjection, getTransformFromProjections, identityTransform} from './proj.js';
@@ -160,7 +159,7 @@ class Geolocation extends BaseObject {
* @private
*/
handleTrackingChanged_() {
if (GEOLOCATION) {
if ('geolocation' in navigator) {
const tracking = this.getTracking();
if (tracking && this.watchId_ === undefined) {
this.watchId_ = navigator.geolocation.watchPosition(

View File

@@ -40,15 +40,6 @@ export const MAC = ua.indexOf('macintosh') !== -1;
export const DEVICE_PIXEL_RATIO = window.devicePixelRatio || 1;
/**
* Is HTML5 geolocation supported in the current browser?
* @const
* @type {boolean}
* @api
*/
export const GEOLOCATION = 'geolocation' in navigator;
/**
* True if browser supports touch events.
* @const