Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Hierarchy

  • MouseInteractionManager

Index

Constructors

  • new MouseInteractionManager(object: any, layer: any, permissions?: {}, callbacks?: {}, options?: {}): MouseInteractionManager
  • Parameters

    • object: any
    • layer: any
    • permissions: {} = {}
      • callbacks: {} = {}
        • options: {} = {}

          Returns MouseInteractionManager

        Properties

        object: any
        layer: any
        permissions: {}

        Type declaration

          callbacks: {}

          Type declaration

            options: { target: DisplayObject; dragResistance: number }

            Interaction options which configure handling workflows

            Type declaration

            • target: DisplayObject
            • dragResistance: number
            state: number

            The current interaction state

            handlers: any

            Bound handlers which can be added and removed

            dragTime: number

            The drag handling time

            lcTime: number

            The time of the last left-click event

            rcTime: number

            The time of the last right-click event

            _dragRight: boolean

            A flag for whether we are right-click dragging

            controlIcon: ControlIcon

            An optional ControlIcon instance for the object

            INTERACTION_STATES: { NONE: number; HOVER: number; CLICKED: number; DRAG: number; DROP: number } = ...

            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 declaration

            • NONE: number
            • HOVER: number
            • CLICKED: number
            • DRAG: number
            • DROP: number
            LONG_PRESS_DURATION_MS: number = 500

            The number of milliseconds of mouse click depression to consider it a long press.

            longPressTimeout: number = null

            Global timeout for the long-press event.

            Accessors

            • get target(): any
            • Get the target

              Returns any

            • get states(): Object
            • A reference to the possible interaction states which can be observed

              Returns Object

            Methods

            • can(action: string, event: Event): boolean
            • Test whether the current user has permission to perform a step of the workflow

              Parameters

              • action: string

                The action being attempted

              • event: Event

                The event being handled

              Returns boolean

              Can the action be performed?

            • callback(action: string, event: Event, ...args: any[]): any
            • Execute a callback function associated with a certain action in the workflow

              Parameters

              • action: string

                The action being attempted

              • event: Event

                The event being handled

              • Rest ...args: any[]

                Additional callback arguments.

              Returns any

            • cancel(event: Event): void
            • A public method to cancel a current interaction workflow from this manager.

              Parameters

              • event: Event

                The event that initiates the cancellation

              Returns void

            • _activateHoverEvents(): void
            • Activate a set of listeners which handle hover events on the target object

              Returns void

            • _activateClickEvents(): void
            • Activate a new set of listeners for click events on the target object

              Returns void

            • _deactivateClickEvents(): void
            • Deactivate event listeners for click events on the target object

              Returns void

            • _activateDragEvents(): void
            • Activate events required for handling a drag-and-drop workflow

              Returns void

            • _deactivateDragEvents(): void
            • Deactivate events required for handling drag-and-drop workflow.

              Returns void

            • _handleMouseOver(event: any): any
            • Handle mouse-over events which activate downstream listeners and do not stop propagation.

              Parameters

              • event: any

              Returns any

            • _handleMouseOut(event: any): any
            • Handle mouse-out events which terminate hover workflows and do not stop propagation.

              Parameters

              • event: any

              Returns any

            • _handleMouseDown(event: any): any
            • Handle mouse-down events which activate downstream listeners. Stop further propagation only if the event is allowed by either single or double-click.

              Parameters

              • event: any

              Returns any

            • _handleClickLeft(event: any): void
            • Handle mouse-down which trigger a single left-click workflow.

              Parameters

              • event: any

              Returns void

            • _handleClickLeft2(event: any): any
            • Handle mouse-down which trigger a single left-click workflow.

              Parameters

              • event: any

              Returns any

            • _handleLongPress(event: InteractionEvent, origin: Point): any
            • Handle a long mouse depression to trigger a long-press workflow.

              Parameters

              • event: InteractionEvent

                The mousedown event.

              • origin: Point

                The local canvas co-ordinates of the mousepress.

              Returns any

            • _handleRightDown(event: any): any
            • Handle right-click mouse-down events. Stop further propagation only if the event is allowed by either single or double-click.

              Parameters

              • event: any

              Returns any

            • _handleClickRight(event: any): void
            • Handle single right-click actions.

              Parameters

              • event: any

              Returns void

            • _handleClickRight2(event: any): any
            • Handle double right-click actions.

              Parameters

              • event: any

              Returns any

            • _handleMouseMove(event: any): any
            • Handle mouse movement during a drag workflow

              Parameters

              • event: any

              Returns any

            • _handleDragStart(event: any): any
            • Handle the beginning of a new drag start workflow, moving all controlled objects on the layer

              Parameters

              • event: any

              Returns any

            • _handleDragMove(event: any): any
            • Handle the continuation of a drag workflow, moving all controlled objects on the layer

              Parameters

              • event: any

              Returns any

            • _handleMouseUp(event: any): void
            • Handle mouse up events which may optionally conclude a drag workflow

              Parameters

              • event: any

              Returns void

            • _handleDragDrop(event: any): void
            • Handle the conclusion of a drag workflow, placing all dragged objects back on the layer

              Parameters

              • event: any

              Returns void

            • _handleDragCancel(event: PointerEvent): void
            • Handle the cancellation of a drag workflow, resetting back to the original state

              Parameters

              • event: PointerEvent

              Returns void