diff --git a/src/starling/events/Touch.hx b/src/starling/events/Touch.hx index 5814606..fdc49af 100644 --- a/src/starling/events/Touch.hx +++ b/src/starling/events/Touch.hx @@ -63,22 +63,34 @@ class Touch { "previousGlobalY": {get: untyped __js__("function () { return this.get_previousGlobalY (); }")}, "startGlobalX": {get: untyped __js__("function () { return this.get_startGlobalX (); }")}, "startGlobalY": {get: untyped __js__("function () { return this.get_startGlobalY (); }")}, - "globalX": {get: untyped __js__("function () { return this.get_globalX (); }"), - set: untyped __js__("function (v) { return this.set_globalX (v); }")}, - "globalY": {get: untyped __js__("function () { return this.get_globalY (); }"), - set: untyped __js__("function (v) { return this.set_globalY (v); }")}, - "tapCount": {get: untyped __js__("function () { return this.get_tapCount (); }"), - set: untyped __js__("function (v) { return this.set_tapCount (v); }")}, + "globalX": { + get: untyped __js__("function () { return this.get_globalX (); }"), + set: untyped __js__("function (v) { return this.set_globalX (v); }") + }, + "globalY": { + get: untyped __js__("function () { return this.get_globalY (); }"), + set: untyped __js__("function (v) { return this.set_globalY (v); }") + }, + "tapCount": { + get: untyped __js__("function () { return this.get_tapCount (); }"), + set: untyped __js__("function (v) { return this.set_tapCount (v); }") + }, "phase": {get: untyped __js__("function () { return this.get_phase (); }"), set: untyped __js__("function (v) { return this.set_phase (v); }")}, "target": {get: untyped __js__("function () { return this.get_target (); }"), set: untyped __js__("function (v) { return this.set_target (v); }")}, - "timestamp": {get: untyped __js__("function () { return this.get_timestamp (); }"), - set: untyped __js__("function (v) { return this.set_timestamp (v); }")}, - "pressure": {get: untyped __js__("function () { return this.get_pressure (); }"), - set: untyped __js__("function (v) { return this.set_pressure (v); }")}, + "timestamp": { + get: untyped __js__("function () { return this.get_timestamp (); }"), + set: untyped __js__("function (v) { return this.set_timestamp (v); }") + }, + "pressure": { + get: untyped __js__("function () { return this.get_pressure (); }"), + set: untyped __js__("function (v) { return this.set_pressure (v); }") + }, "width": {get: untyped __js__("function () { return this.get_width (); }"), set: untyped __js__("function (v) { return this.set_width (v); }")}, "height": {get: untyped __js__("function () { return this.get_height (); }"), set: untyped __js__("function (v) { return this.set_height (v); }")}, - "cancelled": {get: untyped __js__("function () { return this.get_cancelled (); }"), - set: untyped __js__("function (v) { return this.set_cancelled (v); }")}, + "cancelled": { + get: untyped __js__("function () { return this.get_cancelled (); }"), + set: untyped __js__("function (v) { return this.set_cancelled (v); }") + }, "duration": {get: untyped __js__("function () { return this.get_duration (); }")}, "bubbleChain": {get: untyped __js__("function () { return this.get_bubbleChain (); }")}, }); diff --git a/src/starling/events/TouchEvent.hx b/src/starling/events/TouchEvent.hx index 487754f..94b1b7c 100644 --- a/src/starling/events/TouchEvent.hx +++ b/src/starling/events/TouchEvent.hx @@ -11,46 +11,51 @@ package starling.events; import starling.display.DisplayObject; -/** A TouchEvent is triggered either by touch or mouse input. - * - *
In Starling, both touch events and mouse events are handled through the same class:
- * TouchEvent. To process user input from a touch screen or the mouse, you have to register
- * an event listener for events of the type TouchEvent.TOUCH
. This is the only
- * event type you need to handle; the long list of mouse event types as they are used in
- * conventional Flash are mapped to so-called "TouchPhases" instead.
The difference between mouse input and touch input is that
- * - *In Starling, both touch events and mouse events are handled through the same class:
+ * TouchEvent. To process user input from a touch screen or the mouse, you have to register
+ * an event listener for events of the type TouchEvent.TOUCH
. This is the only
+ * event type you need to handle; the long list of mouse event types as they are used in
+ * conventional Flash are mapped to so-called "TouchPhases" instead.
In Starling, any display object receives touch events, as long as the
- * touchable
property of the object and its parents is enabled. There
- * is no "InteractiveObject" class in Starling.
The event contains a list of all touches that are currently present. Each individual - * touch is stored in an object of type "Touch". Since you are normally only interested in - * the touches that occurred on top of certain objects, you can query the event for touches - * with a specific target:
+ *The difference between mouse input and touch input is that
* - *var touches:Array.<Touch> = touchEvent.getTouches(this);
- *
- * This will return all touches of "this" or one of its children. When you are not using - * multitouch, you can also access the touch object directly, like this:
+ *var touch:Touch = touchEvent.getTouch(this);
- *
- * @see Touch
- * @see TouchPhase
+ * Which objects receive touch events?
+ *
+ * In Starling, any display object receives touch events, as long as the
+ * touchable
property of the object and its parents is enabled. There
+ * is no "InteractiveObject" class in Starling.
The event contains a list of all touches that are currently present. Each individual + * touch is stored in an object of type "Touch". Since you are normally only interested in + * the touches that occurred on top of certain objects, you can query the event for touches + * with a specific target:
+ * + *var touches:Array. = touchEvent.getTouches(this);
+ *
+ * This will return all touches of "this" or one of its children. When you are not using + * multitouch, you can also access the touch object directly, like this:
+ * + *var touch:Touch = touchEvent.getTouch(this);
+ *
+ * @see Touch
+ * @see TouchPhase
*/
class TouchEvent extends Event {
- /** Event type for touch or mouse input. */
+ /**
+ * Event type for touch or mouse input.
+ *
+ * @return The string "touch".
+ */
public static inline var TOUCH:String = "touch";
@:noCompletion private var __shiftKey:Bool;
@@ -72,7 +77,15 @@ class TouchEvent extends Event {
}
#end
- /** Creates a new TouchEvent instance. */
+ /**
+ * Creates a new TouchEvent instance.
+ *
+ * @param type The type of the event.
+ * @param touches An array of touches related to this event, or null if there are none.
+ * @param shiftKey Indicates if the shift key was pressed when the event occurred.
+ * @param ctrlKey Indicates if the ctrl key was pressed when the event occurred. (Mac OS: Cmd or Ctrl)
+ * @param bubbles Indicates if the event bubbles.
+ */
public function new(type:String, touches:Arrayout
-Array, the touches will be added to this Array instead of creating
- * a new object. */
+ * a new object.
+ *
+ * @param target The display object that was touched.
+ * @param phase The phase the touch must be in, or null if you don't care.
+ * @param out An array to which the touches will be added. If null, a new array will be created.
+ * @return An array of touches that originated over the specified target.
+ */
public function getTouches(target:DisplayObject, phase:String = null, out:Array