Repository

Mouse

Extends:

Component → Mouse

Give simple access to mouse events

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

target: *

Private Members
private
private
private

_pX: *

private

_pY: *

private
private
private
private
private
private
private
private

_time: *

private
private
private
private
private

_x: *

private

_y: *

Method Summary

Public Methods
public

returns the x and y deltas between the previous and current mouse positions

public

returns the x delta between the previous and current mouse positions

public

returns the y delta between the previous and current mouse positions

public

returns the x and y offsets between the current mouse position and the position at the begining of the drag

public

returns the x offset between the current mouse position and the position at the begining of the drag

public

returns the y offset between the current mouse position and the position at the begining of the drag

public

returns the previous x coordinate of the mouse

public

returns the previous y coordinate of the mouse

public

returns the scroll amounts for the x, y and z axes

public

returns the scroll amount for the x-axis

public

returns the scroll amount for the y-axis

public

returns the scroll amount for the z-axis

public

returns the current x coordinate of the mouse

public

returns the current y coordinate of the mouse

public

returns whether a mouse button is currently pressed or not

public

helper method to check if the wheel has been rotated

public

helper method to check if the wheel is supported on the device

public

off()

public

on()

public
public
public
Private Methods
private

onClick(event: *)

cick event handler Fires a mouseclick event

private

onDblClick(event: *)

dblcick event handler Fires a mousedblclick event

private

onMouseDown(event: *)

mousedown event handler Fires a mousepress event and updates the pressed state

private

onMouseMove(event: *)

mousemove event handler Fires a mousemove event and possibly a mousedrag event

private

onMouseOut(event: *)

mouseover event handler Fires a mouseout event

private

onMouseOver(event: *)

mouseover event handler Fires a mouseover event

private

onMouseUp(event: *)

mouseup event handler Fires a mouserelease event and updates the pressed state

private

onWheel(event: *)

wheel event handler Fires a mousewheel event

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 setup 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

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.targetDOMElement

The DOM element that will be used to attach mouse events on

Public Members

public target: * source

Private Members

private _dragStartX: * source

private _dragStartY: * source

private _pX: * source

private _pY: * source

private _pressed: boolean source

private _resetWheel: boolean source

private _swipeCurrentTime: * source

private _swipeMaxTime: number source

private _swipeMinDist: number source

private _swipeStartTime: * source

private _swipeTime: * source

private _time: * source

private _wheelActivated: boolean source

private _wheelDeltaX: number source

private _wheelDeltaY: number source

private _wheelDeltaZ: number source

private _x: * source

private _y: * source

Public Methods

public getDelta(): Object source

returns the x and y deltas between the previous and current mouse positions

Return:

Object

The x and y delta values

public getDeltaX(): Number source

returns the x delta between the previous and current mouse positions

Return:

Number

The x delta value

public getDeltaY(): Number source

returns the y delta between the previous and current mouse positions

Return:

Number

The y delta value

public getDragOffset(): Object source

returns the x and y offsets between the current mouse position and the position at the begining of the drag

Return:

Object

The x and y offset values

public getDragOffsetX(): Number source

returns the x offset between the current mouse position and the position at the begining of the drag

Return:

Number

The x offset value

public getDragOffsetY(): Number source

returns the y offset between the current mouse position and the position at the begining of the drag

Return:

Number

The y offset value

public getPX(): Number source

returns the previous x coordinate of the mouse

Return:

Number

The x coordinate of the previous mouse position

public getPY(): Number source

returns the previous y coordinate of the mouse

Return:

Number

The y coordinate of the previous mouse position

public getWheelDelta(): Object source

returns the scroll amounts for the x, y and z axes

Return:

Object

The scroll amounts for the x, y and z axes

public getWheelDeltaX(): Number source

returns the scroll amount for the x-axis

Return:

Number

The scroll amount for the x-axis

public getWheelDeltaY(): Number source

returns the scroll amount for the y-axis

Return:

Number

The scroll amount for the y-axis

public getWheelDeltaZ(): Number source

returns the scroll amount for the z-axis

Return:

Number

The scroll amount for the z-axis

public getX(): Number source

returns the current x coordinate of the mouse

Return:

Number

The x coordinate of the mouse position

public getY(): Number source

returns the current y coordinate of the mouse

Return:

Number

The y coordinate of the mouse position

public isPressed(): Boolean source

returns whether a mouse button is currently pressed or not

Return:

Boolean

True if a mouse button is currently pressed

public isWheelActivated(): Boolean source

helper method to check if the wheel has been rotated

Return:

Boolean

True if the wheel has been rotated, false otherwise

public isWheelSupported(): Boolean source

helper method to check if the wheel is supported on the device

Return:

Boolean

True if the wheel is supported, false otherwise

public off() source

Deactivate the component

Override:

Component#off

public on() source

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

Override:

Component#on

public postUpdate() source

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

Override:

Component#postUpdate

public preUpdate() source

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

Override:

Component#preUpdate

public setup() source

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

Override:

Component#setup

Private Methods

private onClick(event: *) source

cick event handler Fires a mouseclick event

Params:

NameTypeAttributeDescription
event*

private onDblClick(event: *) source

dblcick event handler Fires a mousedblclick event

Params:

NameTypeAttributeDescription
event*

private onMouseDown(event: *) source

mousedown event handler Fires a mousepress event and updates the pressed state

Params:

NameTypeAttributeDescription
event*

private onMouseMove(event: *) source

mousemove event handler Fires a mousemove event and possibly a mousedrag event

Params:

NameTypeAttributeDescription
event*

private onMouseOut(event: *) source

mouseover event handler Fires a mouseout event

Params:

NameTypeAttributeDescription
event*

private onMouseOver(event: *) source

mouseover event handler Fires a mouseover event

Params:

NameTypeAttributeDescription
event*

private onMouseUp(event: *) source

mouseup event handler Fires a mouserelease event and updates the pressed state

Params:

NameTypeAttributeDescription
event*

private onWheel(event: *) source

wheel event handler Fires a mousewheel event

Params:

NameTypeAttributeDescription
event*