Closed Bug 1067176 Opened 10 years ago Closed 6 years ago

[Peak] [Keon] [Flame] Device Orientation alpha value seems inverted

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mossroy, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:32.0) Gecko/20100101 Firefox/32.0
Build ID: 20140830210550

Steps to reproduce:

- Open any app that uses the Device Orientation API, like Compass+ : https://marketplace.firefox.com/app/compass-plus
- See where the North is pointed to
- Rotate your device clockwise and check where the North is pointed to


Actual results:

The compass also rotates clockwise on the screen, making the North point to another direction on the Compass.


Expected results:

The compass should rotate counter-clockwise on the screen, so that to compensate the device rotation. The North should always point to the same direction on the Compass.

I have this same issue on Peak and Keon devices, with latest versions of 1.3 and 2.0 branches. And on every compass application I found.
I thing I did not have this issue with version 1.1.0hd.

It behaves like the alpha value of Device Orientation API would be interpreted in the wrong (counter)clockwise convention.

It might be a side-effect of https://bugzilla.mozilla.org/show_bug.cgi?id=938035 ?
OS: All → Gonk (Firefox OS)
Hardware: All → ARM
I think this might be a dup of bug 961195.
Same issue with build id 20141011072056 (v2.0 nightly from geeksphone)
Status: UNCONFIRMED → NEW
Ever confirmed: true
I have this issue with the flame device too. (Could someone with permission add [flame] to the bug title?)

I think you are correct in suspecting that it is a side effect of 938035.

Looking at the code to https://developer.mozilla.org/en-US/demos/detail/simple-compass,
the calculation does appear to assume the opposite definition of alpha from W3C. Not only that,
when I downloaded that app and changed the line        
   rotate(360 - e.alpha); 
to
   rotate(e.alpha);

in index.html, it works works correctly. 

I'm not sure this is a duplicate of bug 961195 , but I think it is the same as bug 997024.
(In reply to ajb44.geo from comment #3)
> I have this issue with the flame device too. (Could someone with permission
> add [flame] to the bug title?)

Done.
Summary: [Peak] [Keon] Device Orientation alpha value seems inverted → [Peak] [Keon] [Flame] Device Orientation alpha value seems inverted
It seems that in version 1.3, all 3 angles have been inverted compared to the previous versions. This is most probably a result of bug 938035. The changes can be seen here [https://hg.mozilla.org/mozilla-central/rev/3d937509b0fe]. This is why not only compass apps but also labyrinth games like OrbLand Labyrinth Free [https://marketplace.firefox.com/app/orbland-free] are now all inverted. Some, like Spirit Level [https://marketplace.firefox.com/app/spirit-level] seems to have been fixed.

According to the explanation on [https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Orientation_and_motion_data_explained], alpha is actually correct now (it increases as the device is rotated toward the left), as is gamma (it increases as the device is tipped toward the right).

On the other hand, beta is now inverted compared to the explanation. It is at 0 when the device is horizontal (as on a table) and increases when the device is tipped backwards up to 90 when it is vertical (portrait mode, facing the user).

Tested on Geeksphone Peak with version 1.3 and 1.4, and Flame with version 2.0 (didn’t test alpha on that one, only beta and gamma).

After checking the W3C specs [http://www.w3.org/TR/orientation-event/], I think it’s actually the explanation on MDN that is wrong about beta. The W3C specs state: “A user is holding the device in their hand, with the screen in a vertical plane and the top of the screen pointing upwards. The value of beta is 90, irrespective of what alpha and gamma are.”. According to the MDN explanation, it would be -90. The image about beta on MDN shows the arrows representing gamma growing clockwise when looking /down/ the x axis (along the negative direction), while the W3C specs state: “Rotations must use the right-hand convention, such that positive rotation around an axis is clockwise when viewed along the positive direction of the axis.”

In summary, this is not a Firefox OS bug, as it follows the W3C specs now, but a MDN (documentation) bug, and a bug of all the apps that did not fix their code yet :).
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.