# Titanium.Gesture
The Gesture module is responsible for high-level device gestures such as orientation changes and shake gestures.
# Properties
# landscape READONLY
Indicates if the device is currently held in landscape form.
Value is true
if in landscape, and false
otherwise.
# orientation READONLY
Orientation of the device.
Value may be one of the group of Titanium.UI orientation constants, PORTRAIT, UPSIDE_PORTRAIT, LANDSCAPE_LEFT, LANDSCAPE_RIGHT, FACE_UP, FACE_DOWN, or UNKNOWN.
On iOS and Windows, returns the current orientation of the device, regardless of the window orientation. To determine the current window orientation, use orientation.
To set the allowable orientations for a window, see orientationModes.
# portrait READONLY
Indicates if the device is currently held in portrait form.
Value is true
if in portrait, and false
otherwise.
# Events
# orientationchange
Fired when the device orientation changes.
On Android, note that the application must have a heavyweight window or tab group open
in order to receive the orientationchange
event. It is not necessary for the heavyweight
window to be the topmost window.
Almost all real-world applications will have a heavyweight window or a tab group. This is
only likely to be an issue if you create a test case or test application that adds an
orientation change listener from app.js
without opening a heavyweight window.
Properties
Name | Type | Description |
---|---|---|
orientation | Number | Orientation of the device. |
source | Object | Source object that fired the event. |
type | String | Name of the event fired. |
bubbles | Boolean | True if the event will try to bubble up if possible. |
cancelBubble | Boolean | Set to true to stop the event from bubbling. |
# shake
Fired when the device is shaken.
A shake gesture consists of a series of quick accelerations, and is represented by a series of shake events.
The timestamp
property represents the interval between shake events. It is measured in
milliseconds on Android, and in seconds on iOS.
Properties
Name | Type | Description |
---|---|---|
timestamp | Number | Time interval since previous shake event. On iOS, this value is 0 for the first shake event in a series. |
x | Number | Acceleration along the X axis, in Gs. |
y | Number | Acceleration along the Y axis, in Gs. |
z | Number | Acceleration along the Z axis, in Gs. |
source | Object | Source object that fired the event. |
type | String | Name of the event fired. |
bubbles | Boolean | True if the event will try to bubble up if possible. |
cancelBubble | Boolean | Set to true to stop the event from bubbling. |