Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EventMouse

The mouse event

Hierarchy

Index

Constructors

constructor

  • newEventMouse(eventType: number, bubbles?: undefined | false | true, prevLoc?: Vec2): EventMouse

Properties

Private _button

_button: number = EventMouse.BUTTON_MISSING

Private _prevX

_prevX: number = 0

Private _prevY

_prevY: number = 0

Private _scrollX

_scrollX: number = 0

Private _scrollY

_scrollY: number = 0

Private _x

_x: number = 0

Private _y

_y: number = 0

bubbles

bubbles: boolean

Indicate whether the event bubbles up through the hierarchy or not.

currentTarget

currentTarget: Object | null = null

A reference to the currently registered target for the event.

eventPhase

eventPhase: number = 0

Indicates which phase of the event flow is currently being evaluated. Returns an integer value represented by 4 constants:

  • Event.NONE = 0
  • Event.CAPTURING_PHASE = 1
  • Event.AT_TARGET = 2
  • Event.BUBBLING_PHASE = 3 The phases are explained in the [section 3.1, Event dispatch and DOM event flow] markdown, of the DOM Level 3 Events specification.

eventType

eventType: number

The type of the event, possible values are UP, DOWN, MOVE, SCROLL

movementX

movementX: number = 0

Mouse movement on x axis of the UI coordinate system.

movementY

movementY: number = 0

Mouse movement on y axis of the UI coordinate system.

propagationImmediateStopped

propagationImmediateStopped: boolean = false

Stops propagation for current event immediately, the event won't even be dispatched to the listeners attached in the current target.

propagationStopped

propagationStopped: boolean = false

Stops propagation for current event.

target

target: Object | null = null

A reference to the target to which the event was originally dispatched.

type

type: string

The name of the event (case-sensitive), e.g. "click", "fire", or "submit".

Static ACCELERATION

ACCELERATION: string = "acceleration"

The type code of Acceleration event.

Static AT_TARGET

AT_TARGET: number = 2

The target phase comprises only the event target node [markdown] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow)

Static BUBBLING_PHASE

BUBBLING_PHASE: number = 3

The bubbling phase comprises any subsequent nodes encountered on the return trip to the root of the hierarchy [markdown] (http://www.w3.org/TR/DOM-Level-3-Events/#event-flow)

Static BUTTON_4

BUTTON_4: number = 3

The tag of mouse's button 4.

Static BUTTON_5

BUTTON_5: number = 4

The tag of mouse's button 5.

Static BUTTON_6

BUTTON_6: number = 5

The tag of mouse's button 6.

Static BUTTON_7

BUTTON_7: number = 6

The tag of mouse's button 7.

Static BUTTON_8

BUTTON_8: number = 7

The tag of mouse's button 8.

Static BUTTON_LEFT

BUTTON_LEFT: number = 0

The tag of mouse's left button.

Static BUTTON_MIDDLE

BUTTON_MIDDLE: number = 1

The tag of mouse's middle button.

Static BUTTON_MISSING

BUTTON_MISSING: number = -1

The default tag when no button is pressed

Static BUTTON_RIGHT

BUTTON_RIGHT: number = 2

The tag of mouse's right button (The right button number is 2 on browser).

Static CAPTURING_PHASE

CAPTURING_PHASE: number = 1

The capturing phase comprises the journey from the root to the last node before the event target's node markdown

Static DOWN

DOWN: number = 1

The event code of mouse down event.

Static KEYBOARD

KEYBOARD: string = "keyboard"

The type code of Keyboard event.

Static MOUSE

MOUSE: string = "mouse"

The type code of Mouse event.

Static MOVE

MOVE: number = 3

The event code of mouse move event.

Static NONE

NONE: number = 0

The none event code of mouse event.

Static NO_TYPE

NO_TYPE: string = "no_type"

Code for event without type.

Static SCROLL

SCROLL: number = 4

The event code of mouse scroll event.

Static TOUCH

TOUCH: string = "touch"

The type code of Touch event.

Static UP

UP: number = 2

The event code of mouse up event.

Methods

getButton

  • getButton(): number

getCurrentTarget

  • getCurrentTarget(): null | Object
  • Gets current target of the event
    note: It only be available when the event listener is associated with node.
    It returns 0 when the listener is associated with fixed priority.

    Returns null | Object

    • The target with which the event associates.

getDelta

getDeltaX

  • getDeltaX(): number

getDeltaY

  • getDeltaY(): number

getLocation

getLocationInView

getLocationX

  • getLocationX(): number

getLocationY

  • getLocationY(): number

getPreviousLocation

getScrollX

  • getScrollX(): number

getScrollY

  • getScrollY(): number

getType

  • getType(): string

getUIDelta

getUIDeltaX

  • getUIDeltaX(): number

getUIDeltaY

  • getUIDeltaY(): number

getUILocation

getUILocationX

  • getUILocationX(): number

getUILocationY

  • getUILocationY(): number

getUIPreviousLocation

  • getUIPreviousLocation(out?: Vec2): Vec2

isStopped

  • isStopped(): boolean

reuse

  • reuse(type: string, bubbles?: undefined | false | true): void
  • Reinitialize the event for being used again after retrieved from the object pool.

    Parameters

    • type: string

      The name of the event (case-sensitive), e.g. "click", "fire", or "submit"

    • Optional bubbles: undefined | false | true

      A boolean indicating whether the event bubbles up through the tree or not

    Returns void

setButton

  • setButton(button: number): void

setLocation

  • setLocation(x: number, y: number): void

setScrollData

  • setScrollData(scrollX: number, scrollY: number): void

unuse

  • unuse(): void

Generated using TypeDoc