Better compass arrow

This commit is contained in:
Pieter Vander Vennet 2023-12-18 01:30:02 +01:00
parent ba47d1bfad
commit 82409984dc
15 changed files with 219 additions and 114 deletions

View file

@ -1,4 +1,4 @@
import { UIEventSource } from "../UIEventSource"
import { Stores, UIEventSource } from "../UIEventSource"
/**
* Exports the device orientation as UIEventSources and detects 'shakes'
@ -33,8 +33,19 @@ export class Orientation {
constructor() {}
public fakeMeasurements() {
public fakeMeasurements(rotateAlpha: boolean = true) {
console.log("Starting fake measurements of orientation sensors", {
alpha: this.alpha,
beta: this.beta,
gamma: this.gamma,
absolute: this.absolute,
})
this.alpha.setData(45)
if (rotateAlpha) {
Stores.Chronic(25).addCallback((date) =>
this.alpha.setData(-(date.getTime() / 10) % 360)
)
}
this.beta.setData(20)
this.gamma.setData(30)
this.absolute.setData(true)