|
|
|
@ -354,6 +354,7 @@
|
|
|
|
|
DeviceOrientationEvent.requestPermission()
|
|
|
|
|
.then((response) => {
|
|
|
|
|
if (response === "granted") {
|
|
|
|
|
alert("granted")
|
|
|
|
|
window.addEventListener("deviceorientation", handler, true);
|
|
|
|
|
} else {
|
|
|
|
|
alert("has to be allowed!");
|
|
|
|
@ -365,7 +366,7 @@
|
|
|
|
|
|
|
|
|
|
function handler(e) {
|
|
|
|
|
compass = e.webkitCompassHeading || Math.abs(e.alpha - 360);
|
|
|
|
|
compassCircle.style.transform = `translate(-50%, -50%) rotate(${pointDegree-compass}deg)`;
|
|
|
|
|
compassCircle.style.transform = `translate(-50%, -50%) rotate(${-compass}deg)`;
|
|
|
|
|
|
|
|
|
|
// ±15 degree
|
|
|
|
|
|
|
|
|
|