MouseInteractionManager

MouseInteractionManager

Handle mouse interaction events for a Canvas object. There are three phases of events: hover, click, and drag

Hover Events: _handleMouseOver action: hoverIn _handleMouseOut action: hoverOut

Left Click and Double-Click _handleMouseDown action: clickLeft action: clickLeft2

Right Click and Double-Click _handleRightDown action: clickRight action: clickRight2

Drag and Drop _handleMouseMove action: dragLeftStart action: dragLeftMove action: dragRightStart action: dragLeftMove _handleMouseUp action: dragLeftDrop action: dragRightDrop _handleDragCancel action: dragLeftCancel action: dragRightCancel

Constructor

new MouseInteractionManager()

Source:

Members

(static) INTERACTION_STATES :Object.<string, number>

Source:

Enumerate the states of a mouse interaction workflow. 0: NONE - the object is inactive 1: HOVER - the mouse is hovered over the object 2: CLICKED - the object is clicked 3: DRAG - the object is being dragged 4: DROP - the object is being dropped

Type:
  • Object.<string, number>

_dragRight :boolean

Source:

A flag for whether we are right-click dragging

Type:
  • boolean

dragTime :number

Source:

The drag handling time

Type:
  • number

handlers :Object

Source:

Bound handlers which can be added and removed

Type:
  • Object

lcTime :number

Source:

The time of the last left-click event

Type:
  • number

rcTime :number

Source:

The time of the last right-click event

Type:
  • number

state :number

Source:

The current interaction state

Type:
  • number

states

Source:

A reference to the possible interaction states which can be observed

target

Source:

Get the target

Methods

activate()

Source:

Activate interactivity for the handled object

callback(action, event)

Source:

Execute a callback function associated with a certain action in the workflow

Parameters:
Name Type Description
action string

The action being attempted

event Event

The event being handled

can(action, event) → {boolean}

Source:

Test whether the current user has permission to perform a step of the workflow

Parameters:
Name Type Description
action string

The action being attempted

event Event

The event being handled

Returns:

Can the action be performed?

Type
boolean