# Class: Mouse

## Phaser. Mouse

Phaser.Mouse

#### new Mouse(game)

  Phaser.Mouse is responsible for handling all aspects of mouse interaction with the browser. It captures and processes mouse events.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `game` | Phaser.Game | A reference to the currently running game.

  Source:
    - input/Mouse.js, line 14

### Members

#### <static, constant> LEFT_BUTTON :number

  ##### Type:

  - number
  Source:
    - input/Mouse.js, line 134

#### <static, constant> MIDDLE_BUTTON :number

  ##### Type:

  - number
  Source:
    - input/Mouse.js, line 140

#### <static, constant> NO_BUTTON :number

  ##### Type:

  - number
  Source:
    - input/Mouse.js, line 128

#### <static, constant> RIGHT_BUTTON :number

  ##### Type:

  - number
  Source:
    - input/Mouse.js, line 146

#### button

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `button-` | number | The type of click, either: Phaser.Mouse.NO_BUTTON, Phaser.Mouse.LEFT_BUTTON, Phaser.Mouse.MIDDLE_BUTTON or Phaser.Mouse.RIGHT_BUTTON.

  Source:
    - input/Mouse.js, line 60

#### callbackContext

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `callbackContext` | Object | The context under which callbacks are called.

  Source:
    - input/Mouse.js, line 24

#### capture

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `capture` | boolean | If true the DOM mouse events will have event.preventDefault applied to them, if false they will propogate fully.

  Source:
    - input/Mouse.js, line 54

#### disabled

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `disabled` | boolean | You can disable all Input by setting disabled = true. While set all new input related events will be ignored.

  Default Value:
    - false
  Source:
    - input/Mouse.js, line 66

#### event

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `event` | MouseEvent | The browser mouse DOM event. Will be set to null if no mouse event has ever been received.

  Default Value:
    - null
  Source:
    - input/Mouse.js, line 90

#### game

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `game` | Phaser.Game | A reference to the currently running game.

  Source:
    - input/Mouse.js, line 19

#### locked

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `locked` | boolean | If the mouse has been Pointer Locked successfully this will be set to true.

  Default Value:
    - false
  Source:
    - input/Mouse.js, line 72

#### mouseDownCallback

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `mouseDownCallback` | function | A callback that can be fired when the mouse is pressed down.

  Source:
    - input/Mouse.js, line 29

#### mouseMoveCallback

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `mouseMoveCallback` | function | A callback that can be fired when the mouse is moved while pressed down.

  Source:
    - input/Mouse.js, line 34

#### mouseOutCallback

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `mouseOutCallback` | function | A callback that can be fired when the mouse is no longer over the game canvas.

  Source:
    - input/Mouse.js, line 44

#### mouseOverCallback

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `mouseOverCallback` | function | A callback that can be fired when the mouse enters the game canvas (usually after a mouseout).

  Source:
    - input/Mouse.js, line 49

#### mouseUpCallback

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `mouseUpCallback` | function | A callback that can be fired when the mouse is released from a pressed down state.

  Source:
    - input/Mouse.js, line 39

#### pointerLock

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `pointerLock` | Phaser.Signal | This event is dispatched when the browser enters or leaves pointer lock state.

  Source:
    - input/Mouse.js, line 84

#### stopOnGameOut

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `stopOnGameOut` | boolean | If true Pointer.stop will be called if the mouse leaves the game canvas.

  Default Value:
    - false
  Source:
    - input/Mouse.js, line 78

### Methods

#### onMouseDown(event)

  The internal method that handles the mouse down event from the browser.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | MouseEvent | The native event from the browser. This gets stored in Mouse.event.

  Source:
    - input/Mouse.js, line 198

#### onMouseMove(event)

  The internal method that handles the mouse move event from the browser.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | MouseEvent | The native event from the browser. This gets stored in Mouse.event.

  Source:
    - input/Mouse.js, line 230

#### onMouseOut(event)

  The internal method that handles the mouse out event from the browser.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | MouseEvent | The native event from the browser. This gets stored in Mouse.event.

  Source:
    - input/Mouse.js, line 292

#### onMouseOver(event)

  The internal method that handles the mouse over event from the browser.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | MouseEvent | The native event from the browser. This gets stored in Mouse.event.

  Source:
    - input/Mouse.js, line 328

#### onMouseUp(event)

  The internal method that handles the mouse up event from the browser.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | MouseEvent | The native event from the browser. This gets stored in Mouse.event.

  Source:
    - input/Mouse.js, line 260

#### pointerLockChange(event)

  Internal pointerLockChange handler.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `event` | pointerlockchange | The native event from the browser. This gets stored in Mouse.event.

  Source:
    - input/Mouse.js, line 386

#### releasePointerLock()

  Internal release pointer lock handler.

  Source:
    - input/Mouse.js, line 410

#### requestPointerLock()

  If the browser supports it you can request that the pointer be locked to the browser window. This is classically known as 'FPS controls', where the pointer can't leave the browser until the user presses an exit key. If the browser successfully enters a locked state the event Phaser.Mouse.pointerLock will be dispatched and the first parameter will be 'true'.

  Source:
    - input/Mouse.js, line 357

#### start()

  Starts the event listeners running.

  Source:
    - input/Mouse.js, line 150

#### stop()

  Stop the event listeners.

  Source:
    - input/Mouse.js, line 426