onMouseWheel([callback], [remove])

Class: CheckBoxMenuItem. Method inherited from UIComponent.

Description:

Gets, registers or unregisters a mouse wheel event handler function.

Parameters:

Name Type Default Description

[callback]

function

The event handler function that receives a MouseWheelEvent object. Pass null to unregister all handler functions.

[remove]

boolean

false

Set to true to unregister the event handler.

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,          // `wheel`.
  button: number,        // Button number. One of MouseButton enum values. Present when applicable.
  scrollAmount: number,  // Returns the number of units that should be scrolled per click of mouse wheel rotation.
  rotation: number,      // Indicates the number of "clicks" the mouse wheel was rotated.
                         // A partial rotation may occur if the mouse supports a high-resolution wheel.
                         // In this case, the number is zero until a full "click" has been accumulated.
  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,             // Mouse x position relative to component
  y: number,             // Mouse y position relative to component
  screenX: number,       // Mouse x position relative to default screen
  screenY: number,       // Mouse y position relative to default screen
};

Also See: