Event listener for Interaction type events.

Interaction type events can occur between any two Interactors (whether they be Shapes, Bodys, Compounds or a mix thereof).

The events that can be caught are BEGIN, ONGOING, and END type events. Theses listeners will operate between pairs of Interactors.

     _Space
    /      \
Cmp1        Cmp3

/ \ | Body1 Cmp2 Body3 | | | Shp1 Body2 Shp3

     |
   Shp2

The possible interactor pairs for callbacks are formed by finding the most recent common ancestor in the world for the given pair of shapes and taking all possible pairings. In the above situation we have:
MRCA(Shp1, Shp2) = Cmp1  --> Possible pairings = [Shp1, Body1] x [Shp2, Body2, Cmp2]
MRCA(Shp1, Shp3) = Space --> Possible pairings = [Shp1, Body1, Cmp1] x [Shp3, Body3, Cmp3]
MRCA(Shp2, Shp3) = Space --> Possible pairings = [Shp2, Body2, Cmp2, Cmp1] x [Shp3, Body3, Cmp3]
Of course, not all of these pairings will generate callbacks, only those for which a valid listener exists for the event type, and for the cbtypes of each interactor.

Furthermore, the listener specifies an interaction type which works even in mixed cases where many types of interaction between two objects is happening at once.

Constructor

@:value({ precedence : 0 })new(event:CbEvent, interactionType:InteractionType, options1:Null<Dynamic>, options2:Null<Dynamic>, handler:InteractionCallback‑>Void, precedence:Int = 0)

Construct a new InteractionListener.

The possible event types are BEGIN, ONGOING and END.

The options arguments are typed Dynamic, and are permitted to be either an OptionType or one of: CbType, CbTypeList, Array<CbType>, flash.Vector<CbType> In which case the input CbType's will be used to construct an OptionType whose included types will be the set of CbTypes supplied.

Parameters:

event

The event type to listen for.

interactionType

The interaction type to listen for.

options1

The OptionType to match first Interactor against, passing null will equate to an empty OptionType.

options2

The OptionType to match second Interactor against, passing null will equate to an empty OptionType.

handler

The callback handler for this listener.

precedence

The precedence of this listener used to sort the order of callbacks in the case of more than one suitable BodyListener existing for the same event on the same Body. (default 0)

Returns:

The newly constructed InteractionListener

Throws:

#

If handler is null.

#

If the event type is not permitted for this listener.

#

If either option is not of the expected Type.

Variables

allowSleepingCallbacks:Bool

For ONGOING listeners only, permit ONGOING callbacks whilst sleeping.

This property determines whether we will still receive ONGOING callbacks between two sleeping Interactors. The default action is to inhibit callbacks between sleeping objects for performance. Setting this field to true will permit Nape to always generate callbacks.

interactionType:InteractionType

The specific type of interaction that is to be listened for.

If we specify that we only want to listen for a fluid type interaction, then this listener will operate so that any other interactions for the same pair of objects is ignored.

options1:OptionType

The OptionType used to match against Interactors for the first object.

options2:OptionType

The OptionType used to match against Interactors for the second object.

@:value(null)zpp_inner_zn:ZPP_InteractionListener = null

@private

handler:InteractionCallback‑>Void

The callback handler for this listener.

Inherited Variables

Defined by Listener

event:CbEvent

The CbEvent this listener responds to.

precedence:Int

The precedence of this listener.

In any case that there is more than one suitable listener for a situation, the listeners will be ordered by their precedence.

space:Null<Space>

The Space this listener is assigned to.

This value can be set, with setting to null being equivalent to removing the listener from whichever Space it is presently assigned to.

read onlytype:ListenerType

The sub-type of this listener.

@:value(null)zpp_inner:ZPP_Listener = null

@private

Inherited Methods

Defined by Listener

@:keeptoString():String

@private