Эта страница является
переводом страницы
Gestures API. Перевод выполнен на 100%.
API iRidium. Gestures
Gestures enable interaction with items or activation of particular functions in iRidium projects for panels with sensor screens. Gestures will not work on devices controlled with the help of the mouse and keyboard!
Methods
IR.AddRecognizer
This function is used for activating gestures.
Syntax
IR.AddRecognizer(gesture_type);
| gesture_type
|
IR.GESTURE_SWIPE_LEFT
|
type: Object the gesture type:
- IR.GESTURE_SWIPE_LEFT - to the left;
- IR.GESTURE_SWIPE_RIGHT - to the right;
- IR.GESTURE_SWIPE_UP - up;
- IR.GESTURE_SWIPE_DOWN - down;
- IR.GESTURE_PINCH_IN - to pinch in;
- IR.GESTURE_PINCH_OUT - to pinch out;
- IR.GESTURE_LONG_PRESS - a long pressing;
- IR.GESTURE_DOUBLE_TAP - a double tapping;
|
-
Sample
IR.AddListener(IR.EVENT_START,0,function()
// The event which is activated in the start of application work
{
IR.AddRecognizer(IR.GESTURE_SWIPE_LEFT); // (1) The SWIPE_LEFT gesture is activated
IR.AddRecognizer(IR.GESTURE_SWIPE_RIGHT); // (2) The SWIPE_RIGHT gesture is activated
IR.AddRecognizer(IR.GESTURE_SWIPE_UP); // (3) The SWIPE_UP gesture is activated
IR.AddRecognizer(IR.GESTURE_SWIPE_DOWN); // (4) The SWIPE_DOWN gesture is activated
IR.AddRecognizer(IR.GESTURE_PINCH_IN); // (5) The PINCH_IN gesture is activated
IR.AddRecognizer(IR.GESTURE_PINCH_OUT); // (6) The PINCH_OUT gesture is activated
IR.AddRecognizer(IR.GESTURE_LONG_PRESS); // (7) The LONG_PRESS gesture is activated
IR.AddRecognizer(IR.GESTURE_DOUBLE_TAP); // (8) The DOUBLE_TAP gesture is activated
});
IR.RemoveRecognizer
This function is used for deactivating gestures
Syntax
IR.RemoveRecognizer(gesture_type);
| gesture_type
|
IR.GESTURE_SWIPE_LEFT
|
type: Object the gesture type:
- IR.GESTURE_SWIPE_LEFT - to the left;
- IR.GESTURE_SWIPE_RIGHT - to the right;
- IR.GESTURE_SWIPE_UP - up;
- IR.GESTURE_SWIPE_DOWN - down;
- IR.GESTURE_PINCH_IN - to pinch in;
- IR.GESTURE_PINCH_OUT - to pinch out;
- IR.GESTURE_LONG_PRESS - a long pressing;
- IR.GESTURE_DOUBLE_TAP - a double tapping;
|
-
Sample
IR.AddListener(IR.EVENT_EXIT,0,function() // The event which is activated when exiting the application
{
IR.RemoveRecognizer(IR.GESTURE_SWIPE_LEFT); // (1) The SWIPE_LEFT gesture is deactivated
IR.RemoveRecognizer(IR.GESTURE_SWIPE_RIGHT); // (2) The SWIPE_RIGHT gesture is deactivated
IR.RemoveRecognizer(IR.GESTURE_SWIPE_UP); // (3) The SWIPE_UP gesture is deactivated
IR.RemoveRecognizer(IR.GESTURE_SWIPE_DOWN); // (4) The SWIPE_DOWN gesture is deactivated
IR.RemoveRecognizer(IR.GESTURE_PINCH_IN); // (5) The PINCH_IN gesture is deactivated
IR.RemoveRecognizer(IR.GESTURE_PINCH_OUT); // (6) The PINCH_OUT gesture is deactivated
IR.RemoveRecognizer(IR.GESTURE_LONG_PRESS); // (7) The LONG_PRESS gesture is deactivated
IR.RemoveRecognizer(IR.GESTURE_DOUBLE_TAP); // (8) The DOUBLE_TAP gesture is deactivated
});
Events
IR.EVENT_GESTURE_BEGIN
The event is activated when starting the gesture
Syntax
IR.AddListener(R.EVENT_GESTURE_BEGIN, page, function, [pointer]);
| page
|
IR.GetItem("Page 1")
|
type: object the link to the interface object
|
| function
|
function() {}
|
type: function the unnamed function or referring to the function
|
| pointer
|
-
|
type: object the poiter to the object which serves the function (optional)
|
| gesture
|
-
|
type: variable the type name of the gesture which started
|
| x
|
-
|
type: variable the X coordinate of the gesture start
|
| y
|
-
|
type: variable the Y coordinate of the gesture start
|
Sample
var button;
IR.AddListener(IR.EVENT_START, 0, function()
// The event which is activated in the start of application work
{
// Create the button for switching between pages
var button = IR.CreateItem(IR.ITEM_BUTTON, "text", 10, 10);
button.Text = "";
// Activation of gestures
IR.AddRecognizer(IR.GESTURE_SWIPE_LEFT); // The SWIPE_LEFT gesture is activated
IR.AddRecognizer(IR.GESTURE_SWIPE_RIGHT); // The SWIPE_RIGHT gesture is activated
IR.AddRecognizer(IR.GESTURE_SWIPE_UP); // The SWIPE_UP gesture is activated
IR.AddRecognizer(IR.GESTURE_SWIPE_DOWN); // The SWIPE_DOWN gesture is activated
// Connect the listener, send the current page and the function with parameters
IR.AddListener(IR.EVENT_GESTURE_BEGIN, IR.CurrentPage, function(gesture, x, y)
{
// The selection construction
switch(gesture)
{
case IR.GESTURE_SWIPE_LEFT: // 1
button.Text = "Left"; // If the SWIPE_LEFT gesture starts, then there will be the "Left" sign
break;
case IR.GESTURE_SWIPE_RIGHT: // 2
button.Text = "Right"; // If the SWIPE_RIGHT gesture starts, then there will be the "Right" sign
break;
case IR.GESTURE_SWIPE_UP: // 3
button.Text = "Up"; // If the SWIPE_UP gesture starts, then there will be the "Up" sign
break;
case IR.GESTURE_SWIPE_DOWN: // 4
button.Text = "Down"; // If the SWIPE_DOWN gesture starts, then there will be the "Down" sign
break;
}
});
});