Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DOMMouseMoveTracker

Mouse drag tracker, get the coordinate value where the mouse moves in time.

const tracker = new DOMMouseMoveTracker(
onMove:(deltaX: number, deltaY: number, moveEvent: Object) => void,
onMoveEnd:() => void,
container: HTMLElement
);

Hierarchy

  • DOMMouseMoveTracker

Index

Constructors

  • new DOMMouseMoveTracker(onMove: (x: number, y: number, e: any) => void, onMoveEnd: (e: any) => void, domNode: Element): DOMMouseMoveTracker
  • onMove is the callback that will be called on every mouse move. onMoveEnd is called on mouse up when movement has ended.

    Parameters

    • onMove: (x: number, y: number, e: any) => void
        • (x: number, y: number, e: any): void
        • Parameters

          • x: number
          • y: number
          • e: any

          Returns void

    • onMoveEnd: (e: any) => void
        • (e: any): void
        • Parameters

          • e: any

          Returns void

    • domNode: Element

    Returns DOMMouseMoveTracker

Properties

animationFrameID: any = null
deltaX: number = 0
deltaY: number = 0
domNode: Element
eventMoveToken: any = null
eventUpToken: any = null
isDraggingStatus: boolean = false
moveEvent: any = null
onMove: any = null
onMoveEnd: any = null
x: number = 0
y: number = 0

Methods

  • captureMouseMoves(event: any): void
  • This is to set up the listeners for listening to mouse move and mouse up signaling the movement has ended. Please note that these listeners are added at the document.body level. It takes in an event in order to grab inital state.

    Parameters

    • event: any

    Returns void

  • didMouseMove(): void
  • Returns void

  • isDragging(): boolean
  • Returns whether or not if the mouse movement is being tracked.

    Returns boolean

  • onMouseMove(event: any): void
  • Calls onMove passed into constructor and updates internal state.

    Parameters

    • event: any

    Returns void

  • onMouseUp(event: any): void
  • Calls onMoveEnd passed into constructor and updates internal state.

    Parameters

    • event: any

    Returns void

  • releaseMouseMoves(): void
  • These releases all of the listeners on document.body.

    Returns void

Generated using TypeDoc