Mouse

new Mouse(canvas, world, callback)

Create and start mouse obj, args: a model, and a callback method.

Parameters:
NameTypeDescription
canvasCanvas | String

The canvas upon which we track the mouse. If a string is given, get the HTML element by that name

worldworld

World instance

callbackfunction

callback(mouse) called on every mouse action

Methods

start()

Start the mouseListeners.

Returns:

this Return this instance for chaining

stop()

Start the mouseListeners.

Returns:

this Return this instance for chaining