Home Reference Source
public class | source

AutoScroll

Extends:

shared/AbstractPlugin~AbstractPlugin → AutoScroll

AutoScroll plugin which scrolls the closest scrollable parent

Constructor Summary

Public Constructor
public

constructor(draggable: Draggable)

AutoScroll constructor.

Member Summary

Public Members
public

Keeps current mouse position

public

Animation frame looking for the closest scrollable element

public

AutoScroll options

public

Scroll animation frame

public

scrollableElement: HTMLElement | null

Closest scrollable element

Method Summary

Public Methods
public

attach()

Attaches plugins event listeners

public

detach()

Detaches plugins event listeners

public

Returns options passed through draggable

Private Methods
private

[onDragMove](dragEvent: *)

Drag move handler.

private

[onDragStart](dragEvent: *)

Drag start handler.

private

Drag stop handler.

private

Scroll function that does the heavylifting

Public Constructors

public constructor(draggable: Draggable) source

AutoScroll constructor.

Params:

NameTypeAttributeDescription
draggable Draggable

Draggable instance

Public Members

public currentMousePosition: Object | null source

Keeps current mouse position

Properties:

NameTypeAttributeDescription
currentMousePosition Object
currentMousePosition.clientX Number
currentMousePosition.clientY Number

public findScrollableElementFrame: Number | null source

Animation frame looking for the closest scrollable element

Properties:

NameTypeAttributeDescription
findScrollableElementFrame *

public options: Object source

AutoScroll options

Properties:

NameTypeAttributeDescription
options Object
options.speed Number
options.sensitivity Number

public scrollAnimationFrame: Number | null source

Scroll animation frame

Properties:

NameTypeAttributeDescription
scrollAnimationFrame *

public scrollableElement: HTMLElement | null source

Closest scrollable element

Properties:

NameTypeAttributeDescription
scrollableElement *

Public Methods

public attach() source

Attaches plugins event listeners

public detach() source

Detaches plugins event listeners

public getOptions(): Object source

Returns options passed through draggable

Return:

Object

Private Methods

private [onDragMove](dragEvent: *) source

Drag move handler. Remembers mouse position and initiates scrolling

Params:

NameTypeAttributeDescription
dragEvent *

private [onDragStart](dragEvent: *) source

Drag start handler. Finds closest scrollable parent in separate frame

Params:

NameTypeAttributeDescription
dragEvent *

private [onDragStop]() source

Drag stop handler. Cancels scroll animations and resets state

private [scroll]() source

Scroll function that does the heavylifting