-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It's off by 90°, it claims east is north #11
Comments
I ran into—and corrected—this issue, but only for Android and only for Chrome (I have more work I'm doing on this project). The issue is that a year after Lamplightdev wrote this code, the event handler window.ondeviceorientation changed to calculate orientation relative to your device's current position, NOT True North. So every time you refresh, it's always going to point relative to the direction you're facing when you accessed the page. The fix I've implemented so far (and again, only confirmed to work on Android and only on Chrome) is to change the event handler to window.ondeviceorientationabsolute . See the code here (note, this version is not designed to point to True North, but a designated location here in Vancouver, WA): Edit: here's the implementation in my actual project, which uses trigonometry to turn it into a compass that points at a user-designated location rather than True North: https://github.com/DenJansen/SakanyTaurus/blob/master/sakanytaurus/sakanyapp/templates/sakanyapp/compass.html |
@DenJansen Was that implementation in your project the last update? Or have you made any more progress in fixing this issue for other browsers? |
@AC0793 I'm afraid that's the last update at the moment. I've been busy with other projects, and haven't really prioritized this one, since a pub crawl app seems a little anachronistic at this time :-/ I do plan on exploring this more in the future. It's going to involve digging through documentation on event handlers for various devices/browsers, as there doesn't seem to be a universal event handler for this information. |
hi there |
Hi, just as an FYI to everyone, I did play around with the compass a little more about a month ago. If you're interested in capturing device orientation events, I recommend checking out the Generic Sensor API. It's the best effort so far to create a universal event for capturing info from device sensors. Still nowhere near 100%, but definitely better than the ondeviceorientation events for universality: https://mobiforge.com/design-development/the-generic-sensor-api |
Like described it thinks east is where north is.
Tested on two devices with multiple browsers.
The text was updated successfully, but these errors were encountered: