diff --git a/app/static/css/style.css b/app/static/css/style.css index 1d359cd..f89bab0 100755 --- a/app/static/css/style.css +++ b/app/static/css/style.css @@ -303,6 +303,7 @@ margin: 4em 0; border-radius: 50%; /* box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); */ margin: auto; + pointer-events: none; } diff --git a/app/templates/home.html b/app/templates/home.html index 3485dd5..5edbeef 100755 --- a/app/templates/home.html +++ b/app/templates/home.html @@ -9,7 +9,9 @@
+ + @@ -341,12 +343,13 @@ navigator.userAgent.match(/AppleWebKit/); function init() { - // startBtn.addEventListener("click", startCompass); + startBtn.addEventListener("click", startCompass); navigator.geolocation.getCurrentPosition(locationHandler); if (!isIOS) { window.addEventListener("deviceorientationabsolute", handler, true); } + } function startCompass() { @@ -354,7 +357,6 @@ DeviceOrientationEvent.requestPermission() .then((response) => { if (response === "granted") { - alert("granted") window.addEventListener("deviceorientation", handler, true); } else { alert("has to be allowed!"); @@ -366,7 +368,7 @@ function handler(e) { compass = e.webkitCompassHeading || Math.abs(e.alpha - 360); - compassCircle.style.transform = `translate(-50%, -50%) rotate(${-compass}deg)`; + compassCircle.style.transform = `translate(-50%, -50%) rotate(${pointDegree-compass}deg)`; // ±15 degree @@ -422,7 +424,7 @@ } init(); - startCompass(); + //