Be-Prepared / Be-Prepared.github.io

Handy PWA filled with useful tools.
Other
0 stars 0 forks source link

Compass does not work on iOS #13

Closed fidian closed 3 months ago

fidian commented 3 months ago

Figure out why the compass doesn't work and fix it if possible.

fidian commented 3 months ago

It appears that the absolute orientation sensor is not there or not allowed to be accessed. Fall back to the relative orientation sensor as long as it has the compass info.

https://github.com/w3c/deviceorientation/issues/57 (lots of good discussion)

https://developer.apple.com/documentation/webkitjs/deviceorientationevent

Should also prompt for three permissions at once for devices with AbsoluteOrientationSensor.

https://developer.mozilla.org/en-US/docs/Web/API/AbsoluteOrientationSensor

fidian commented 3 months ago

Fixed by completely changing compass