forked from Blendman974/faceclaw
Port Compass to iOS
This commit is contained in:
1 parent
5ae2c245c6
commit
2b3e068a23
32 files changed
+490
-56
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { magneticDeclinationDegrees } from './geomagnetic'
|
||||
import { getCurrentLocation } from './location'
|
||||
|
||||
export function restoreDeclination(latitude: number, longitude: number, _degrees: number): number | null {
|
||||
return magneticDeclinationDegrees(latitude, longitude)
|
||||
}
|
||||
|
||||
export async function getCurrentDeclination(): Promise<{ latitude: number; longitude: number; degrees: number }> {
|
||||
const location = await getCurrentLocation()
|
||||
const degrees = magneticDeclinationDegrees(location.latitude, location.longitude)
|
||||
if (degrees === null) throw new Error('Magnetic declination unavailable')
|
||||
return { ...location, degrees }
|
||||
}
|
||||
Reference in new issue
Block a user