[dali_1.4.26] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / docs / content / pan-gesture-detector.js
1 /**
2  *
3 ## PanGestureDetector API
4
5
6 PanGestureDetector analyse a stream of touch events and looks for panning (or dragging) gestures.
7 If an actor is attached to the pan gesture detector, the detector will emit a detected signal to
8 the application when it recognises a pan gesture on the attached actor in its analysis.
9
10 ### Simple example
11
12 ```
13 // Create a pan gesture detector
14 var panGestureDetector = new dali.PanGestureDetector();
15
16 var actor = new dali.Actor();
17 dali.stage.add(actor);
18
19 // Attach an actor to the detector
20 panGestureDetector.attach(actor);
21
22 // Connect the detected signal
23 panGestureDetector.on("panDetected", onPan);
24
25 onPan = function(actor, panGesture)
26 {
27     log("Pan gesture state: " + panGesture.state + ", number of touches: " + panGesture.numberOfTouches + ", time stamp: " + panGesture.time + "\n");
28     log("local position: " + panGesture.position.x + ", " + panGesture.position.y + "\n");
29     log("local displacement: " + panGesture.displacement.x + ", " + panGesture.displacement.y + "\n");
30     log("local velocity: " + panGesture.velocity.x + ", " + panGesture.velocity.y + "\n");
31     log("screen position: " + panGesture.screenPosition.x + ", " + panGesture.screenPosition.y + "\n");
32     log("screen displacement: " + panGesture.screenDisplacement.x + ", " + panGesture.screenDisplacement.y + "\n");
33     log("screen velocity: " + panGesture.screenVelocity.x + ", " + panGesture.screenVelocity.y + "\n");
34 }
35
36 // Detach the actor from the detector
37 panGestureDetector.detach(actor);
38 ```
39 @class PanGestureDetector
40
41 */