onMouseEvents([callback], [remove])
Class: MenuBar. Method inherited from UIComponent.
Description:
Gets, registers or unregisters a mouse buttons event handler function.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
|
|
function |
The event handler function that receives a MouseEvent object. Pass |
|
|
|
boolean |
false |
Set to |
Returns:
An array of handler functions if no arguments are passed, otherwise this component for method chaining.
Type: this | Array.<function()>
Examples:
// Example event object:
const e = {
target: object, // The component that triggered the event.
type: string, // `click`, `down`, `up`, `enter`, or `leave`.
button: number, // Button number. One of MouseButton enum values.
clicks: number, // Amount of time the click happened. Present when applicable.
modifiers: number, // Keyboard modifiers (bitmask or flags).
alt: boolean, // Indicates if ALT key was pressed.
shift: boolean, // Indicates if SHIFT key was pressed.
ctrl: boolean, // Indicates if CTRL key was pressed.
x: number, // Present when applicable.
y: number, // Present when applicable.
screenX: number, // Present when applicable.
screenY: number, // Present when applicable.
};
