Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MouseControls

Mouse controls

Hierarchy

  • MouseControls

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

actionList

actionList: MouseAction[] = []

disabled

disabled: boolean

mouse

stage

stage: Stage

the stage object

Methods

add

  • Add a new mouse action triggered by an event, key and button combination. The MouseActions class provides a number of static methods for use as callback functions.

    example

    // change ambient light intensity on mouse scroll // while the ctrl and shift keys are pressed stage.mouseControls.add( "scroll-ctrl+shift", function( stage, delta ){ var ai = stage.getParameters().ambientIntensity; stage.setParameters( { ambientIntensity: Math.max( 0, ai + delta / 50 ) } ); } );

    example

    // Call the MouseActions.zoomDrag method on mouse drag events // with left and right mouse buttons simultaneous stage.mouseControls.add( "drag-left+right", MouseActions.zoomDrag );

    Parameters

    • triggerStr: string

      the trigger for the action

    • callback: MouseActionCallback

      the callback function for the action

    Returns void

clear

  • clear(): void

preset

remove

  • Remove a mouse action. The trigger string can contain an asterix (*) as a wildcard for any key or mouse button. When the callback function is given, only actions that call that function are removed.

    example

    // remove actions triggered solely by a scroll event stage.mouseControls.remove( "scroll" );

    example

    // remove actions triggered by a scroll event, including // those requiring a key pressed or mouse button used stage.mouseControls.remove( "scroll-*" );

    example

    // remove actions triggered by a scroll event // while the shift key is pressed stage.mouseControls.remove( "scroll-shift" );

    Parameters

    Returns void

run

Generated using TypeDoc