Repository

Pointer

Extends:

Component → Pointer

Pointer is an abstraction that enables various input devices to send the same kind of events. It is designed to accumulate various type of inputs in a Map of PointerOject. Each input device is converted in a PointerOject in order to unify its interface. Usefully mainly internally for interactive UI objects like buttons.

Example:

   //TODO

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public
public
public

Method Summary

Public Methods
public

add(component: Component)

Adds the specified input component as a PointerObject to the pointers list.

public

addMouse(component: *)

public

addTouch(component: *)

public

get(component: Component): Component

Returns the specified PointerObject to work with its state

public

Returns x delta coordinates of the PointerObject (input Component) of the given index.

public

Returns y delta coordinates of the PointerObject (input Component) of the given index.

public

Returns an Array from the pointers Map object.

public

Returns true if ANY of the PointerObjects (input Component) state is true, false otherwise.

public

getX(index: Number): Number

Returns x coordinates of the PointerObject (input Component) of the given index.

public

getY(index: Number): Number

Returns y coordinates of the PointerObject (input Component) of the given index.

public

Remove unused Pointers

Inherited Summary

From class Component
public
public
public

events: *

public

id: *

public

name: *

private

_nexts: *[]

private
public
public

chain(component: Component)

Adds a component to this chained component array

public

Returns the array of attached children components

public

off()

Deactivate the component

public

on()

Activate the component A call to this method calls the setup method if it has not been run yet

public

Run code after the update of all components is run This empty method is usually overriden to perform post-update actions for the component It is called periodically by an internal Mobilizing mechanism

public

preLoad the component This empty method is usually overriden to perform preLoad actions for the component.

public

Run code before the update of all components is run This empty method is usually overriden to perform pre-update actions for the component It is called once per component by an internal Mobilizing mechanism

public

prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server.

public

Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

public

Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism

Public Constructors

public constructor(params: Object) source

Override:

Component#constructor

Params:

NameTypeAttributeDescription
paramsObject

Parameters object, given by the constructor.

params.components[Component]

an array of input components to add to this pointer (i.e. Mouse)

Public Members

public components: * source

public lastActivePointer: * source

public pointers: * source

Public Methods

public add(component: Component) source

Adds the specified input component as a PointerObject to the pointers list.

Params:

NameTypeAttributeDescription
componentComponent

public addMouse(component: *) source

Params:

NameTypeAttributeDescription
component*

public addTouch(component: *) source

Params:

NameTypeAttributeDescription
component*

public get(component: Component): Component source

Returns the specified PointerObject to work with its state

Params:

NameTypeAttributeDescription
componentComponent

Return:

Component

the corresponding input Component

public getDeltaX(index: Number): Number source

Returns x delta coordinates of the PointerObject (input Component) of the given index. If no index is given, the last active pointer will return.

Params:

NameTypeAttributeDescription
indexNumber
  • optional

the pointer object we want to get

Return:

Number

coordinate

public getDeltaY(index: Number): Number source

Returns y delta coordinates of the PointerObject (input Component) of the given index. If no index is given, the last active pointer will return.

Params:

NameTypeAttributeDescription
indexNumber
  • optional

the pointer object we want to get

Return:

Number

coordinate

public getPointers(): Array source

Returns an Array from the pointers Map object. For debug purpose.

Return:

Array

Pointers array

public getState(): Array source

Returns true if ANY of the PointerObjects (input Component) state is true, false otherwise. i.e. if you add a mouse and a touch component to the pointer, this will return true if any of these 2 has it's state to true.

Return:

Array

pointers array

public getX(index: Number): Number source

Returns x coordinates of the PointerObject (input Component) of the given index. If no index is given, the last active pointer will return.

Params:

NameTypeAttributeDescription
indexNumber
  • optional

the pointer object we want to get

Return:

Number

x coordinate

public getY(index: Number): Number source

Returns y coordinates of the PointerObject (input Component) of the given index. If no index is given, the last active pointer will return.

Params:

NameTypeAttributeDescription
indexNumber
  • optional

the pointer object we want to get

Return:

Number

y coordinate

public postUpdate() source

Remove unused Pointers

Override:

Component#postUpdate