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