dom/interfaces/events/nsIDOMDeviceOrientationEvent.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/interfaces/events/nsIDOMDeviceOrientationEvent.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,42 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "nsIDOMEvent.idl"
     1.9 +
    1.10 +[scriptable, builtinclass, uuid(f5921a77-3ac5-4374-bc0c-1ed52fe83123)]
    1.11 +interface nsIDOMDeviceOrientationEvent : nsIDOMEvent
    1.12 +{
    1.13 +  void initDeviceOrientationEvent(in DOMString eventTypeArg,
    1.14 +                                  in boolean canBubbleArg,
    1.15 +                                  in boolean cancelableArg,
    1.16 +                                  in double alpha,
    1.17 +                                  in double beta,
    1.18 +                                  in double gamma,
    1.19 +                                  in boolean absolute);
    1.20 +
    1.21 +  /*
    1.22 +   * W3C specification values: http://dev.w3.org/geo/api/spec-source-orientation.html
    1.23 +   *
    1.24 +   * Alpha, beta and gamma are Tait-Bryan angles (Z-X'-Y''), that is they correspond to
    1.25 +   * yaw, pitch and roll in flight coordinates. More specifically, assume the device
    1.26 +   * is resting face up on a flat surface (its screen is pointing straight up). Then
    1.27 +   * the X axis points to the right when looking at the screen, the Y axis points up
    1.28 +   * when looking at the screen, and the Z axis points toward you when looking at
    1.29 +   * the screen. Alpha/beta/gamma then define the device's orientation by applying
    1.30 +   * the following rotations to the device in order:
    1.31 +   *
    1.32 +   * 1) Rotate it by alpha degrees around its Z axis (like a compass, or like changing
    1.33 +   *    the yaw of an aircraft, assuming the Y axis is the nose of the craft); alpha
    1.34 +   *    is in [0,360).
    1.35 +   * 2) Rotate it by beta degrees around its X axis (tilting the top of the device
    1.36 +   *    towards or away from you, like pitching an aircraft); beta is in [-180,180).
    1.37 +   * 3) Rotate it by gamma degrees around its Y axis (tilting it sideways, like
    1.38 +   *    rolling an aircraft); gamma is in [-90,90).
    1.39 +   */
    1.40 +
    1.41 +  readonly attribute double alpha;
    1.42 +  readonly attribute double beta;
    1.43 +  readonly attribute double gamma;
    1.44 +  readonly attribute boolean absolute;
    1.45 +};

mercurial