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/stop the mouseListeners. Note that NetLogo's model is to have mouse move events always on, rather than starting/stopping them on mouse down/up. We may want do make that optional, using the more standard down/up enabling move events.

Returns:

this Return this instance for chaining