Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MouseObserver

Mouse observer

example

// listen to mouse moving (and touch-moving) events mouseObserver.moved.moved.add( function( deltaX, deltaY ){ ... } );

example

// listen to scrolling (and pinching) events mouseObserver.signals.scrolled.add( function( delta ){ ... } );

example

// listen to dragging (and touch-dragging) events mouseObserver.signals.dragged.add( function( deltaX, deltaY ){ ... } );

example

// listen to clicking (and tapping) events mouseObserver.signals.clicked.add( function(){ ... } );

example

// listen to double clicking (and double tapping) events mouseObserver.signals.doubleClicked.add( function(){ ... } );

example

// listen to hovering events mouseObserver.signals.hovered.add( function(){ ... } );

Hierarchy

  • MouseObserver

Index

Constructors

constructor

Properties

altKey

altKey: boolean = false

Optional buttons

buttons: undefined | number = 0

canvasPosition

canvasPosition: Vector2 = new Vector2()

controls

controls: MouseControls

ctrlKey

ctrlKey: boolean = false

domElement

domElement: HTMLCanvasElement

the dom element to observe mouse events in

doubleClickPending

doubleClickPending: boolean

doubleClickSpeed

doubleClickSpeed: number

down

down: Vector2 = new Vector2()

handleScroll

handleScroll: boolean

hoverTimeout

hoverTimeout: number

hovering

hovering: boolean = true

lastClicked

lastClicked: number

lastMoved

lastMoved: number = Infinity

lastTouchDistance

lastTouchDistance: number

metaKey

metaKey: boolean = false

mouse

moving

moving: boolean = false

overElement

overElement: boolean

position

position: Vector2 = new Vector2()

Optional pressed

pressed: undefined | true | false = false

prevClickCP

prevClickCP: Vector2 = new Vector2()

prevPosition

prevPosition: Vector2 = new Vector2()

scrolled

scrolled: boolean = false

shiftKey

shiftKey: boolean = false

viewer

viewer: Viewer

Optional which

which: undefined | number = 0

Accessors

key

  • get key(): number

Methods

_distance

  • _distance(): number

_listen

  • _listen(): void
  • listen to mouse actions

    emits

    {MouseSignals.clicked} when clicked

    emits

    {MouseSignals.hovered} when hovered

    Returns void

_onContextmenu

  • _onContextmenu(event: MouseEvent): void

_onMousedown

  • _onMousedown(event: MouseEvent): void

_onMousemove

  • _onMousemove(event: MouseEvent): void
  • handle mouse move

    emits

    {MouseSignals.moved} when moved

    emits

    {MouseSignals.dragged} when dragged

    Parameters

    • event: MouseEvent

      mouse event

    Returns void

_onMouseup

  • _onMouseup(event: MouseEvent): void
  • handle mouse up

    emits

    {MouseSignals.doubleClicked} when double clicked

    emits

    {MouseSignals.dropped} when dropped

    Parameters

    • event: MouseEvent

      mouse event

    Returns void

_onMousewheel

  • _onMousewheel(event: MouseWheelEvent): void
  • handle mouse scroll

    emits

    {MouseSignals.scrolled} when scrolled

    Parameters

    • event: MouseWheelEvent

      mouse event

    Returns void

_onTouchend

  • _onTouchend(event: TouchEvent): void

_onTouchmove

  • _onTouchmove(event: TouchEvent): void

_onTouchstart

  • _onTouchstart(event: TouchEvent): void

_setCanvasPosition

  • _setCanvasPosition(event: any): void

_setKeys

  • _setKeys(event: MouseEvent | TouchEvent): void

dispose

  • dispose(): void

setParameters

Object literals

signals

signals: object

clicked

clicked: Signal<T> = new Signal()

doubleClicked

doubleClicked: Signal<T> = new Signal()

dragged

dragged: Signal<T> = new Signal()

dropped

dropped: Signal<T> = new Signal()

hovered

hovered: Signal<T> = new Signal()

moved

moved: Signal<T> = new Signal()

scrolled

scrolled: Signal<T> = new Signal()

Generated using TypeDoc