API Docs for: 1.0.1
Show:

Kiwi.Input.Mouse Class

Defined in: src\input\Mouse.ts:10
Module: Input
Parent Module: Kiwi

Handles the dispatching/management of Mouse Events on a game. When this class is instantiated a MouseCursor object is also created (on this object) which holds the information that is unique to the mouse cursor, although majority of that information is still accessible inside this object.

Constructor

Kiwi.Input.Mouse

(
  • game
)
Kiwi.Input.Mouse

Parameters:

  • game Kiwi.Game

    The game that this mouse manager belongs to.

Returns:

Methods

boot

() public

This method is executed when the DOM has finished loading and thus the MouseManager can start listening for events.

justPressed

(
  • [duration=200]
)
Boolean public

Returns a boolean indicating if the mouse was 'justPressed' within a certain timeframe. The default timeframe is 200 milliseconds.

Parameters:

  • [duration=200] Number optional

    The timeframe that it could have occured in.

Returns:

Boolean:

justReleased

(
  • [duration=200]
)
Boolean public

Returns a boolean indicating if the mouse was 'justReleased' within a certain timeframe. The default timeframe is 200 milliseconds.

Parameters:

  • [duration=200] Number optional

    The timeframe that it could have occured in..

Returns:

Boolean:

objType

() String public

The type of object that this is.

Returns:

String:

onMouseDown

(
  • event.
)
private

Method that gets fired when the mouse is pressed on the stage.

Parameters:

  • event. MouseEvent

onMouseMove

(
  • event.
)
private

Method that gets fired when the mouse moves anywhere on the stage.

Parameters:

  • event. MouseEvent

onMouseUp

(
  • event.
)
private

Method that gets fired when the mouse is released on the stage.

Parameters:

  • event. MouseEvent

onMouseWheel

(
  • event.
)
private

Method that gets fired when the mousewheel is moved.

Parameters:

  • event. MouseEvent

reset

() public

Runs the Reset method on the MouseCursor.

start

() public

Start the mouse event listeners on the game. Automatically called by the boot.

stop

() public

Stops the mouse event listeners from working. Useful if you no longer want the mouse to 'work'/be listened to.

update

() public

The update loop for the cursor.

Properties

_cursor

Kiwi.Input.MouseCursor private

The MouseCursor that is on the stage. This contains the coordinates and information about the cursor.

_domElement

HTMLDivElement private

The HTMLElement that is being used to apply the mouse events to.

_game

Kiwi.Game private

The game that this mouse manager belongs to.

altKey

Boolean public

Indicates if the alt key is down.

Default: false

button

Number public

Returns a number indicating the button that was used. This can be used with the STATIC button properties.

ctrlKey

Boolean public

Indicates if the ctrl key is down.

Default: false

cursor

Kiwi.Input.MouseCursor private

Returns the MouseCursor that is being used on the stage. This is READ ONLY.

duration

Number public

Gets the duration in Milliseconds that the mouse cursor has either been up or down for.

isDown

Boolean public

Indicates whether or not the cursor is currently down. This is READ ONLY.

Default: false

isUp

Boolean public

Indicates whether or not the cursor is currently up. This is READ ONLY.

Default: true

LEFT_BUTTON

Number public final static

The numeric value for the LEFT button.

Default: 0

MIDDLE_BUTTON

Number public final static

The numeric value for the MIDDLE button.

Default: 1

mouseWheel

Kiwi.Signal public

A Signal that dispatches events mouse wheel moves.

onDown

Kiwi.Signal public

A Signal that dispatches events when the mouse is pressed down on the stage.

onUp

Kiwi.Signal public

A Signal that dispatches events when the mouse is released from being down on the stage.

RIGHT_BUTTON

Number public final static

The numeric value for the RIGHT button.

Default: 2

shiftKey

Boolean public

Indicates if the shift key is down.

Default: false

wheelDeltaX

Number public

Gets the wheelDeltaX coordinate of the mouse cursors wheel.

wheelDeltaY

Number public

Gets the wheelDeltaY coordinate of the mouse cursors wheel.

x

Number public

Gets the x coordinate of the mouse cursor.

y

Number public

Gets the y coordinate of the mouse cursor.