API Docs for: 0.1.0
Show:

zerk.game.engine.system.control.mouse Class

Mouse Interface

Provides methods to handle mouse inputs.

Methods

_getCursorPosition

(
  • event
)
Object protected

Returns the position of the cursor by given mouse event

Parameters:

  • event Event

    Native mouse event

Returns:

Object: Coordinate object

_onContextMenu

(
  • event
)
Boolean protected

Context menu event handler

Parameters:

  • event Event

    Native event

Returns:

Boolean: Returns false

_onMouseDown

(
  • event
)
Boolean protected

Mouse down event handler

Parameters:

  • event Event

    Native event

Returns:

Boolean:

_onMouseMove

(
  • event
)
protected

Mouse move event handler

Parameters:

  • event Event

    Native event

_onMouseScroll

(
  • event
)
protected

Mouse scroll event handler

Parameters:

  • event Event

    Native event

_onMouseUp

(
  • event
)
Boolean protected

Mouse up event handler

Parameters:

  • event Event

    Native event

Returns:

Boolean: Returns false

fireEvent

(
  • event
)
Boolen

Fire event

Parameters:

  • event String

    Event name

Returns:

Boolen: Returns false when the bubble was canceled

init

(
  • engine
)

Class constructor

Parameters:

on

(
  • event
  • callback
  • scope
)

Register event handler

Parameters:

  • event String

    Event name

  • callback Function

    Callback function. Return false to cancel event bubble.

  • scope Object

    Scope to be used in callback function

un

(
  • event
  • callback
)
Boolen

Unregister event handler

Parameters:

  • event String

    Event name

  • callback Function

    Callback function

Returns:

Boolen: Returns true on success

Properties

_eventListeners

Array protected

List of event handlers

_lastMousePosition

Object protected

Coordinates of the last mouse position

_mouseJointActive

Boolean protected

State of the mouse joint

mouseLeftDown

Boolean

State of the left mouse button

mouseRightDown

Boolean

State of the right mouse button

mouseX

Integer

Horizontal cursor position

mouseX

Integer

Vertical cursor position

Events

mousedown

Fires when a mouse button is pressed

Event Payload:

  • event DOMEvent

mouseup

Fires when a mouse button is released

Event Payload:

  • event DOMEvent