API Documentation

for 0.0.1
Show:

Mouse Class

Give simple access to mouse events

Constructor

Mouse

(
  • params
)

Parameters:

  • params Object

    Config parameters

    • [target=window] Object optional

      The DOM element this instance is attached to

Methods

byPass TODO!

()

chain

(
  • component
)
Adds a component to this chained component array

Parameters:

getChainedComponents

() Array
Returns the array of attached children components

Returns:

Array: children arrays

getContext

() Context

Inherited from Base but overwritten in src/js/Mobilizing/Base.js:37

Get the Mobilizing context

Returns:

Context: The Mobilizing context

getDelta

() Object

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

Returns:

Object:

The x and y delta values

getDeltaX

() Number

returns the x delta between the previous and current mouse positions

Returns:

Number:

The x delta value

getDeltaY

() Number

returns the y delta between the previous and current mouse positions

Returns:

Number:

The y delta value

getDragOffset

() Object

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

Returns:

Object:

The x and y offset values

getDragOffsetX

() Number

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

Returns:

Number:

The x offset value

getDragOffsetY

() Number

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

Returns:

Number:

The y offset value

getID

() Int
Get the Object unique ID

Returns:

Int: The Object ID

getPX

() Number

returns the previous x coordinate of the mouse

Returns:

Number:

The x coordinate of the previous mouse position

getPY

() Number

returns the previous y coordinate of the mouse

Returns:

Number:

The y coordinate of the previous mouse position

getStatus

() Boolean
Get the activation status of the component

Returns:

Boolean: True if active, false otherwise

getWheelDelta

() Object

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

Returns:

Object:

The scroll amounts for the x, y and z axes

getWheelDeltaX

() Number

returns the scroll amount for the x-axis

Returns:

Number:

The scroll amount for the x-axis

getWheelDeltaY

() Number

returns the scroll amount for the y-axis

Returns:

Number:

The scroll amount for the y-axis

getWheelDeltaZ

() Number

returns the scroll amount for the z-axis

Returns:

Number:

The scroll amount for the z-axis

getX

() Number

returns the current x coordinate of the mouse

Returns:

Number:

The x coordinate of the mouse position

getY

() Number

returns the current y coordinate of the mouse

Returns:

Number:

The y coordinate of the mouse position

isPressed

() Boolean

returns whether a mouse button is currently pressed or not

Returns:

Boolean:

True if a mouse button is currently pressed

isWheelActivated

() Boolean

helper method to check if the wheel has been rotated

Returns:

Boolean:

True if the wheel has been rotated, false otherwise

isWheelSupported

() Boolean

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

Returns:

Boolean:

True if the wheel is supported, false otherwise

off

()

Inherited from Component but overwritten in src/js/Mobilizing/input/Mouse.js:146

on

()

Inherited from Component but overwritten in src/js/Mobilizing/input/Mouse.js:124

onClick

() private

cick event handler Fires a mouseclick event

onDblClick

() private

dblcick event handler Fires a mousedblclick event

onMouseDown

() private

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

onMouseMove

() private

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

onMouseOut

() private

mouseover event handler Fires a mouseout event

onMouseOver

() private

mouseover event handler Fires a mouseover event

onMouseUp

() private

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

onWheel

() private

wheel event handler Fires a mousewheel event

postUpdate

()
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

preLoad

()
preLoad the component This empty method is usually overriden to perform setup actions for the component. The preLoad is designed to be called before any other method, even setup. In the case of user scripts, it is used to preload all needed datas before the setup (pictures, font, etc.) It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

preUpdate

()
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

runSetup

()
Calls the setup if it has not already been called This method should not be called 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

setContext

(
  • context
)
Set the Mobilizing context

Parameters:

  • context Context
    The Mobilizing Context

setName

(
  • name
)
Set the Object name

Parameters:

  • name String
    The Object name

setup

()
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

setup Setup

()

Initialization method

update

()
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

Properties

_active

Boolean private
Whether the component is active or not

_context

Context private
A reference to the Mobilizing context

_setupDone

Boolean private
Whether the component's setup has been called

events

EventEmitter
An event emmiter used to send custom events

Events

mouseclick

Fired when a button is pressed and released on the target element

Event Payload:

  • button Number

    The button number pressed

mousedblclick

Fired when a button is clicked twice on the target element

Event Payload:

  • button Number

    The button number pressed

mousedrag

Fired when a mouse move is detected and a button is being pressed

mousemove

Fired when a mouse move is detected

mouseout

Fired when the pointer moves off the target element

mouseover

Fired when the pointer moves onto the target element

mousepress

Fired when a button is pressed

Event Payload:

  • button Number

    The button number pressed

mouserelease

Fired when a button is released

mouseupdate

Fired when the mouse postupdate is called

mousewheel

Fired when the wheel button is rotated

Event Payload:

  • deltaX Number

    The scroll amount for the x-axis

  • deltaY Number

    The scroll amount for the y-axis

  • deltaZ Number

    The scroll amount for the z-axis