Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "nsIDOMEvent.idl" |
michael@0 | 6 | |
michael@0 | 7 | [scriptable, builtinclass, uuid(f5921a77-3ac5-4374-bc0c-1ed52fe83123)] |
michael@0 | 8 | interface nsIDOMDeviceOrientationEvent : nsIDOMEvent |
michael@0 | 9 | { |
michael@0 | 10 | void initDeviceOrientationEvent(in DOMString eventTypeArg, |
michael@0 | 11 | in boolean canBubbleArg, |
michael@0 | 12 | in boolean cancelableArg, |
michael@0 | 13 | in double alpha, |
michael@0 | 14 | in double beta, |
michael@0 | 15 | in double gamma, |
michael@0 | 16 | in boolean absolute); |
michael@0 | 17 | |
michael@0 | 18 | /* |
michael@0 | 19 | * W3C specification values: http://dev.w3.org/geo/api/spec-source-orientation.html |
michael@0 | 20 | * |
michael@0 | 21 | * Alpha, beta and gamma are Tait-Bryan angles (Z-X'-Y''), that is they correspond to |
michael@0 | 22 | * yaw, pitch and roll in flight coordinates. More specifically, assume the device |
michael@0 | 23 | * is resting face up on a flat surface (its screen is pointing straight up). Then |
michael@0 | 24 | * the X axis points to the right when looking at the screen, the Y axis points up |
michael@0 | 25 | * when looking at the screen, and the Z axis points toward you when looking at |
michael@0 | 26 | * the screen. Alpha/beta/gamma then define the device's orientation by applying |
michael@0 | 27 | * the following rotations to the device in order: |
michael@0 | 28 | * |
michael@0 | 29 | * 1) Rotate it by alpha degrees around its Z axis (like a compass, or like changing |
michael@0 | 30 | * the yaw of an aircraft, assuming the Y axis is the nose of the craft); alpha |
michael@0 | 31 | * is in [0,360). |
michael@0 | 32 | * 2) Rotate it by beta degrees around its X axis (tilting the top of the device |
michael@0 | 33 | * towards or away from you, like pitching an aircraft); beta is in [-180,180). |
michael@0 | 34 | * 3) Rotate it by gamma degrees around its Y axis (tilting it sideways, like |
michael@0 | 35 | * rolling an aircraft); gamma is in [-90,90). |
michael@0 | 36 | */ |
michael@0 | 37 | |
michael@0 | 38 | readonly attribute double alpha; |
michael@0 | 39 | readonly attribute double beta; |
michael@0 | 40 | readonly attribute double gamma; |
michael@0 | 41 | readonly attribute boolean absolute; |
michael@0 | 42 | }; |