(V8 Plugin) Use new Touch API
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / docs / content / actor.js
index b2ea595..5ad2180 100644 (file)
@@ -9,14 +9,12 @@
 
 ```
 var actor = new dali.Actor();
-var imageActor = new dali.ImageActor();
 var textActor = new dali.TextActor("hello world");
-var meshActor = new dali.MeshActor();
 var camera = new dali.CameraActor();
 var layer = new dali.Layer();
 ```
 
-### Hello world example </h3>
+### Hello world example
 ```
 var myActor = new dali.TextActor("hello-world");
 
@@ -40,7 +38,8 @@ An actor inherits its parent's position.  The relative position between the acto
 
 1) ParentOrigin.  This Vector3 property defines a point within the parent actor's area.
 
-<img src="../assets/img/shared/parent-origin.png">
+![ ](../assets/img/parent-origin.png)
+
 
 The default is "top-left", which can be visualized in 2D as (0, 0), but is actually Vector3(0, 0, 0.5) in the 3D DALi world.  The actor's position is relative to this point.
 ```
@@ -50,7 +49,7 @@ myActor.parentOrigin = [0.5, 0.5, 0.5];
 
 2) AnchorPoint.  This Vector3 property defines a point within the child actor's area.
 
-<img src="../assets/img/shared/anchor-point.png">
+![ ](../assets/img/anchor-point.png)
 
 The default is "center", which can be visualized in 2D as (0.5, 0.5), but is actually Vector3(0.5, 0.5, 0.5) in the 3D DALi world.  The actor's position is also relative to this point.
 ```
@@ -60,7 +59,7 @@ myActor.anchorPoint = [0.5, 0.5, 0.5];
 
 3) Position.  This is the position vector between the parent-origin and anchor-point.
 
-<img src="../assets/img/shared/actor-position.png">
+![ ](../assets/img/actor-position.png)
 
 Therefore by default, an actors position is the distance between its center and the top-left corner of its parent.
 
@@ -72,50 +71,54 @@ Note that since DALi is a 3D toolkit, this behaviour is the result of a default
 
 The actor provides the following call back events
 
-| Name              | Description                            | Parameters passed to call back |
-|-------------------|----------------------------------------|--------------------------|
-|touched            | touch event                            | (actor, touchEvent )     |
-|hovered            | mouse or pointer hovering over actor   | (actor, hoverEvent)      |
-|mouse-wheel-event  | mouse wheel events                     | (actor, wheelEvent)      |
-|on-stage           | actor has been moved on stage          | (actor)                  |
-|off-stage          | actor has been moved off stage         | (actor)                  |
+| Name            | Description                            | Parameters passed to call back |
+|-----------------|----------------------------------------|--------------------------|
+|touch            | touch                                  | (actor, touchData )      |
+|hovered          | mouse or pointer hovering over actor   | (actor, hoverEvent)      |
+|mouseWheelEvent  | mouse wheel events                     | (actor, wheelEvent)      |
+|onStage          | actor has been moved on stage          | (actor)                  |
+|offStage         | actor has been moved off stage         | (actor)                  |
 
 
 #### Touch event
 
 Used to detect multiple touch events on the actor. The state of each touch point can be:
-+ "down"        = touch down
-+ "up"          = Touch up
-+ "motion"      = Finger dragged or hovered
-+ "leave"       =  Leave the boundary of an actor
-+ "stationary"  = No change from last event.  Useful when a multi-point event occurs where
-all points are sent but indicates that this particular point has not changed since the last time
-+ "interrupted"  = A system event has occurred which has interrupted the touch or hover event sequence
++ "DOWN"        = touch down
++ "UP"          = Touch up
++ "MOTION"      = Finger dragged or hovered
++ "LEAVE"       = Leave the boundary of an actor
++ "STATIONARY"  = No change from last event.  Useful when a multi-point event occurs where
+                  all points are sent but indicates that this particular point has not changed
+                  since the last time
++ "INTERRUPTED" = A system event has occurred which has interrupted the touch or hover event sequence
 
 
 
 ```
-touchEvent = {
+touchData = {
   
   pointCount: int,  // number of points touched ( multi-touch )
   time: int,        // The time in milliseconds that the touch event occurred.
-  points = [ touchPoints ],    // array of TouchPoints, to support
-  
-  TouchPoint = {
+  points = [ Points ],    // array of Points
   
-    "deviceId" : int,      // Each touch point has a unique device ID
-    "state" : string,      // touch state ="down,up,motion,leave,stationary, interrupted }
-    "sourceActor" : actor, // the actor that is emitting the callback (the actor that is hit maybe a child of it)
-    "hitActor" : actor,    // actor that was hit
-    "local" :  {x,y},      // co-ordinates of top left of hit actor (local.x, local.y)
-    "screen" : {x,y}       // co-ordinates of top left of hit actor (screen.x, screen.y)
-    }
+  Point = {
+    "deviceId" : int,        // Each touch point has a unique device ID
+    "state" : string,        // touch state ="DOWN","UP","MOTION","LEAVE","STATIONARY","INTERRUPTED"
+    "sourceActor" : actor,   // the actor that is emitting the callback (the actor that is hit maybe a child of it)
+    "hitActor" : actor,      // actor that was hit
+    "local" :  {x,y},        // co-ordinates of top left of hit actor (local.x, local.y)
+    "screen" : {x,y},        // co-ordinates of top left of hit actor (screen.x, screen.y)
+    "radius" : float,        // radius of the press point (average of both the horizontal & vertical radii)
+    "ellipseRadius" : {x,y}, // both the horizontal and the vertical radii of the press point
+    "pressure" : float,      // the touch pressure
+    "angle" : float          // angle of the press point relative to the Y-Axis (in degrees)
+  }
 }
 
-function OnPressed( actor, touchEvent )
+function onPressed( actor, touchData )
 {
-  var firstPoint = touchEvent.points[0];
-  log("first touch point = " + firstPoint.screen.x + "," +firstPoint.screen.x + "actor= "+firstPoint.hitActor );
+  var firstPoint = touchData.points[0];
+  log("first touch point = " + firstPoint.screen.x + "," + firstPoint.screen.x + "actor= " + firstPoint.hitActor );
   
   var anim = new dali.Animation( 4 );
   var rotation = new dali.Rotation( 90, 0, 0 ); // pitch, yaw, roll
@@ -125,7 +128,7 @@ function OnPressed( actor, touchEvent )
 }
   
 // connect to touch events
-myActor.connect( "touched", onPressed );
+myActor.on( "touch", onPressed );
 
 ```
 
@@ -139,12 +142,17 @@ hoverEvent = {
   points[]    // array of TouchPoints
   
   TouchPoint = {
-      // See touchEvent TouchPoint object
+    "deviceId" : int,      // Each touch point has a unique device ID
+    "state" : string,      // touch state ="down,up,motion,leave,stationary, interrupted }
+    "sourceActor" : actor, // the actor that is emitting the callback (the actor that is hit maybe a child of it)
+    "hitActor" : actor,    // actor that was hit
+    "local" :  {x,y},      // co-ordinates of top left of hit actor (local.x, local.y)
+    "screen" : {x,y}       // co-ordinates of top left of hit actor (screen.x, screen.y)
   }
 }
 ```
       // connect to touch events
-      myActor.connect( "hovered", onHover);
+      myActor.on( "hovered", onHover);
 
 #### Mouse wheel event
 
@@ -162,7 +170,7 @@ mouseWheelEvent = {
 }
   
 // connect to touch events
-myActor.connect( "mouse-wheel-event", onMouseWheel );
+myActor.on( "mouseWheelEvent", onMouseWheel );
 ```
 #### Key events
 
@@ -226,6 +234,7 @@ See
 
 
  * @class Actor
+ * @extends Handle
  */
 
 
@@ -383,7 +392,7 @@ WORLD_POSITION_Z
 /**
  * Actors orientation
  * @property orientation
- * @type dali orientation object
+ * @type dali Rotation object
  */
 ORIENTATION
 
@@ -391,7 +400,7 @@ ORIENTATION
 /**
  * Actors world-orientation
  * @property worldOrientation
- * @type dali Orientation object ( read only)
+ * @type dali Rotation object ( read only)
  */
 WORLD_ORIENTATION
 
@@ -487,9 +496,9 @@ WORLD_COLOR
 
 /**
  * Actors sensitive flag
- * brief Sets whether an actor should emit touch event signals; @see SignalTouched().
+ * brief Sets whether an actor should emit touch event signals; @see SignalTouch().
  *
- * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouched(),
+ * An actor is sensitive by default, which means that as soon as an application connects to the SignalTouch(),
  * the touch event signal will be emitted.
  *
  * If the application wishes to temporarily disable the touch event signal emission, then they can do so by calling
@@ -543,7 +552,7 @@ INHERIT_SCALE,
  * By default a renderable actor will be drawn as a 3D object. It will be depth-tested against
  * other objects in the world i.e. it may be obscured if other objects are in front.
  *
- * If OVERLAY is used, the actor and its children will be drawn as a 2D overlay.
+ * If OVERLAY_2D is used, the actor and its children will be drawn as a 2D overlay.
  * Overlay actors are drawn in a separate pass, after all non-overlay actors within the Layer.
  * For overlay actors, the drawing order is determined by the hierachy (depth-first search order),
  * and depth-testing will not be used.
@@ -554,9 +563,9 @@ INHERIT_SCALE,
  *
  * @example
  *
- *      var actor.drawMode = dali.DRAW_MODE_NORMAL;  // binary 00. The default draw-mode
- *      var actor.drawMode = dali.DRAW_MODE_OVERLAY; // binary 01. Draw the actor and its children as an overlay
- *      var actor.drawMode = dali.DRAW_MODE_STENCIL ;// binary 11. Draw the actor and its children into the stencil buffer
+ *      var actor.drawMode = dali.DRAW_MODE_NORMAL;     // binary 00. The default draw-mode
+ *      var actor.drawMode = dali.DRAW_MODE_OVERLAY_2D; // binary 01. Draw the actor and its children as an overlay
+ *      var actor.drawMode = dali.DRAW_MODE_STENCIL ;   // binary 11. Draw the actor and its children into the stencil buffer
  *
  *
  * @type Number