Merge pull request #9576 from fredj/has-geolocation
Remove geolocation detection from ol/has
This commit is contained in:
@@ -4,6 +4,16 @@
|
|||||||
|
|
||||||
#### Backwards incompatible changes
|
#### 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
|
#### 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:
|
The CSS media print rules were removed from the `ol.css` file. To get the previous behavior, use the following CSS:
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import {listen} from './events.js';
|
|||||||
import Event from './events/Event.js';
|
import Event from './events/Event.js';
|
||||||
import EventType from './events/EventType.js';
|
import EventType from './events/EventType.js';
|
||||||
import {circular as circularPolygon} from './geom/Polygon.js';
|
import {circular as circularPolygon} from './geom/Polygon.js';
|
||||||
import {GEOLOCATION} from './has.js';
|
|
||||||
import {toRadians} from './math.js';
|
import {toRadians} from './math.js';
|
||||||
import {get as getProjection, getTransformFromProjections, identityTransform} from './proj.js';
|
import {get as getProjection, getTransformFromProjections, identityTransform} from './proj.js';
|
||||||
|
|
||||||
@@ -160,7 +159,7 @@ class Geolocation extends BaseObject {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
handleTrackingChanged_() {
|
handleTrackingChanged_() {
|
||||||
if (GEOLOCATION) {
|
if ('geolocation' in navigator) {
|
||||||
const tracking = this.getTracking();
|
const tracking = this.getTracking();
|
||||||
if (tracking && this.watchId_ === undefined) {
|
if (tracking && this.watchId_ === undefined) {
|
||||||
this.watchId_ = navigator.geolocation.watchPosition(
|
this.watchId_ = navigator.geolocation.watchPosition(
|
||||||
|
|||||||
@@ -40,15 +40,6 @@ export const MAC = ua.indexOf('macintosh') !== -1;
|
|||||||
export const DEVICE_PIXEL_RATIO = window.devicePixelRatio || 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.
|
* True if browser supports touch events.
|
||||||
* @const
|
* @const
|
||||||
|
|||||||
Reference in New Issue
Block a user