Fix several issues, attemt to fix zooming issue
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This commit is contained in:
@@ -40,7 +40,10 @@ export class DeviceOrientationService {
|
||||
getCurrentCompassHeading(): Observable<number> {
|
||||
return Observable.create((observer: Observer<number>) => {
|
||||
window.addEventListener("deviceorientation", (event:DeviceOrientationEvent)=>{
|
||||
observer.next(this.compassHeading(event.alpha,event.beta,event.gamma));
|
||||
let heading = this.compassHeading(event.alpha,event.beta,event.gamma);
|
||||
if(!Number.isNaN(heading)) {
|
||||
observer.next(heading);
|
||||
}
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
@@ -1,39 +1,39 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observer, Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* GeolocationService class.
|
||||
* https://developers.google.com/maps/documentation/javascript/
|
||||
* https://dev.w3.org/geo/api/spec-source.html
|
||||
*/
|
||||
@Injectable()
|
||||
export class GeolocationService {
|
||||
|
||||
/**
|
||||
* Tries HTML5 geolocation.
|
||||
*
|
||||
* Wraps the Geolocation API into an observable.
|
||||
*
|
||||
* @return An observable of Position
|
||||
*/
|
||||
getCurrentPosition(): Observable<Position> {
|
||||
return Observable.create((observer: Observer<Position>) => {
|
||||
// Invokes getCurrentPosition method of Geolocation API.
|
||||
navigator.geolocation.watchPosition(
|
||||
(position: Position) => {
|
||||
observer.next(position);
|
||||
},
|
||||
(error: PositionError) => {
|
||||
console.debug('Geolocation service: ' + error.message);
|
||||
observer.error(error);
|
||||
},
|
||||
{
|
||||
enableHighAccuracy: true,
|
||||
timeout: 5000,
|
||||
maximumAge: 0
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observer, Observable } from 'rxjs';
|
||||
|
||||
/**
|
||||
* GeolocationService class.
|
||||
* https://developers.google.com/maps/documentation/javascript/
|
||||
* https://dev.w3.org/geo/api/spec-source.html
|
||||
*/
|
||||
@Injectable()
|
||||
export class GeolocationService {
|
||||
|
||||
/**
|
||||
* Tries HTML5 geolocation.
|
||||
*
|
||||
* Wraps the Geolocation API into an observable.
|
||||
*
|
||||
* @return An observable of Position
|
||||
*/
|
||||
getCurrentPosition(): Observable<Position> {
|
||||
return Observable.create((observer: Observer<Position>) => {
|
||||
// Invokes getCurrentPosition method of Geolocation API.
|
||||
navigator.geolocation.watchPosition(
|
||||
(position: Position) => {
|
||||
observer.next(position);
|
||||
},
|
||||
(error: PositionError) => {
|
||||
console.debug('Geolocation service: ' + error.message);
|
||||
//observer.error(error);
|
||||
},
|
||||
{
|
||||
enableHighAccuracy: true,
|
||||
timeout: 5000,
|
||||
maximumAge: 0
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user