new Mouse(options)
This manager handles the interactions between the experiment's stimuli and the mouse.
Note: the unit of Mouse is that of its associated Window.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
- Source:
- To Do:
-
- visible is not handled at the moment (mouse is always visible)
Extends
- PsychObject
Methods
clickReset(buttonsopt)
Reset the clocks associated to the given mouse buttons.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
buttons |
Array.number |
<optional> |
[0,1,2] | the buttons to reset (0: left, 1: center, 2: right) |
- Source:
getPos() → {Array.number}
Get the current position of the mouse in mouse/Window units.
- Source:
Returns:
the position of the mouse in mouse/Window units
- Type
- Array.number
getPressed(getTimeopt) → {Array.number|Array.<Array.number>}
Get the status of each button (pressed or released) and, optionally, the time elapsed between the last call to clickReset and the pressing or releasing of the buttons.
Note: clickReset is typically called at stimulus onset. When the participant presses a button, the time elapsed since the clickReset is stored internally and can be accessed any time afterwards with getPressed.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
getTime |
boolean |
<optional> |
false | whether or not to also return timestamps |
- Source:
Returns:
either an array of size 3 with the status (1 for pressed, 0 for released) of each mouse button [left, center, right], or a tuple with that array and another array of size 3 with the timestamps.
- Type
- Array.number | Array.<Array.number>
getRel() → {Array.number}
Get the position of the mouse relative to that at the last call to getRel
or getPos, in mouse/Window units.
- Source:
Returns:
the relation position of the mouse in mouse/Window units.
- Type
- Array.number
getWheelRel() → {Array.number}
Get the travel of the mouse scroll wheel since the last call to getWheelRel.
Note: Even though this method returns a [x, y] array, for most wheels/systems y is the only value that varies.
- Source:
Returns:
the mouse scroll wheel travel
- Type
- Array.number
mouseMoved(distanceopt, resetopt) → {boolean}
Determine whether the mouse has moved beyond a certain distance.
distance
- mouseMoved() or mouseMoved(undefined, false): determine whether the mouse has moved at all since the last call to getPos
- mouseMoved(distance: number, false): determine whether the mouse has travelled further than distance, in terms of line of sight
- mouseMoved(distance: [number,number], false): determine whether the mouse has travelled horizontally or vertically further then the given horizontal and vertical distances
reset
- mouseMoved(distance, true): reset the mouse move clock, return false
- mouseMoved(distance, 'here'): return false
- mouseMoved(distance, [x: number, y: number]: artifically set the previous mouse position to the given coordinates and determine whether the mouse moved further than the given distance
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
distance |
undefined | number | Array.number |
<optional> |
the distance to which the mouse movement is compared (see above for a full description) | |
reset |
boolean | String | Array.number |
<optional> |
false | see above for a full description |
- Source:
Returns:
see above for a full description
- Type
- boolean
mouseMoveTime() → {number}
Get the amount of time elapsed since the last mouse movement.
- Source:
Returns:
the time elapsed since the last mouse movement
- Type
- number