Draggable
This is the core draggable library that does the heavy lifting
Static Member Summary
Static Public Members | ||
public static |
Default plugins draggable uses |
|
public static |
Default sensors draggable uses |
Constructor Summary
Public Constructor | ||
public |
constructor(containers: HTMLElement[] | NodeList | HTMLElement, options: Object) Draggable constructor. |
Member Summary
Public Members | ||
public |
|
|
public |
currentOver: * |
|
public |
|
|
public |
Current drag state |
|
public |
Draggables event emitter |
|
public |
|
|
public |
|
|
public |
options: {...defaultOptions: Object, ...options: Object, "classes": *, "announcements": *, "exclude": *} |
|
public |
|
|
public |
|
|
public |
plugins: Plugin[] Active plugins |
|
public |
Active sensors |
|
public |
source: * |
|
public |
|
Method Summary
Public Methods | ||
public |
addContainer(containers: ...HTMLElement): Draggable Adds container to this draggable instance |
|
public |
Adds plugin to this draggable instance. |
|
public |
Adds sensors to this draggable instance. |
|
public |
destroy() Destroys Draggable instance. |
|
public |
getClassNameFor(name: String): String | null Returns class name for class identifier |
|
public |
getClassNamesFor(name: *): String[] Returns class names for class identifier |
|
public |
getDraggableElements(): HTMLElement[] Returns all draggable elements |
|
public |
getDraggableElementsForContainer(container: HTMLElement): HTMLElement[] Returns draggable elements for a given container, excluding the mirror and original source element if present |
|
public |
Returns true if this draggable instance is currently dragging |
|
public |
Removes listener from draggable |
|
public |
Adds listener for draggable events |
|
public |
removeContainer(containers: ...HTMLElement): Draggable Removes container from this draggable instance |
|
public |
removePlugin(plugins: ...typeof Plugin): Draggable Removes plugins that are already attached to this draggable instance. |
|
public |
removeSensor(sensors: ...typeof Sensor): Draggable Removes sensors that are already attached to this draggable instance. |
|
public |
trigger(event: AbstractEvent): Draggable Triggers draggable event |
Private Methods | ||
private |
[onDragMove](event: Event) Drag move handler |
|
private |
[onDragPressure](event: Event) Drag pressure handler |
|
private |
[onDragStart](event: Event) Drag start handler |
|
private |
[onDragStop](event: Event) Drag stop handler |
Static Public Members
public static Plugins: Object source
Default plugins draggable uses
Properties:
Name | Type | Attribute | Description |
Plugins | Object | ||
Plugins.Announcement | Announcement | ||
Plugins.Focusable | Focusable | ||
Plugins.Mirror | Mirror | ||
Plugins.Scrollable | Scrollable |
public static Sensors: Object source
Default sensors draggable uses
Properties:
Name | Type | Attribute | Description |
Sensors | Object | ||
Sensors.MouseSensor | MouseSensor | ||
Sensors.TouchSensor | TouchSensor |
Public Constructors
Public Members
public currentOver: * source
public currentOverContainer: * source
public dragging: Boolean source
Current drag state
Properties:
Name | Type | Attribute | Description |
dragging | * |
public emitter: Emitter source
Draggables event emitter
Properties:
Name | Type | Attribute | Description |
emitter | * |
public lastPlacedContainer: * source
public lastPlacedSource: * source
public options: {...defaultOptions: Object, ...options: Object, "classes": *, "announcements": *, "exclude": *} source
public originalSource: * source
public placedTimeoutID: * source
public source: * source
public sourceContainer: * source
Public Methods
public addContainer(containers: ...HTMLElement): Draggable source
Adds container to this draggable instance
Params:
Name | Type | Attribute | Description |
containers | ...HTMLElement | Containers you want to add to draggable |
Example:
draggable.addContainer(document.body)
public addPlugin(plugins: ...typeof Plugin): Draggable source
Adds plugin to this draggable instance. This will end up calling the attach method of the plugin
Params:
Name | Type | Attribute | Description |
plugins | ...typeof Plugin | Plugins that you want attached to draggable |
Example:
draggable.addPlugin(CustomA11yPlugin, CustomMirrorPlugin)
public addSensor(sensors: ...typeof Sensor): Draggable source
Adds sensors to this draggable instance. This will end up calling the attach method of the sensor
Params:
Name | Type | Attribute | Description |
sensors | ...typeof Sensor | Sensors that you want attached to draggable |
Example:
draggable.addSensor(ForceTouchSensor, CustomSensor)
public destroy() source
Destroys Draggable instance. This removes all internal event listeners and deactivates sensors and plugins
public getClassNameFor(name: String): String | null source
Returns class name for class identifier
Params:
Name | Type | Attribute | Description |
name | String | Name of class identifier |
public getClassNamesFor(name: *): String[] source
Returns class names for class identifier
Params:
Name | Type | Attribute | Description |
name | * |
public getDraggableElements(): HTMLElement[] source
Returns all draggable elements
Return:
HTMLElement[] |
public getDraggableElementsForContainer(container: HTMLElement): HTMLElement[] source
Returns draggable elements for a given container, excluding the mirror and original source element if present
Params:
Name | Type | Attribute | Description |
container | HTMLElement |
Return:
HTMLElement[] |
public off(type: String, callback: Function): Draggable source
Removes listener from draggable
Example:
draggable.off('drag:start', handlerFunction);
public on(type: String, callbacks: ...Function): Draggable source
Adds listener for draggable events
Example:
draggable.on('drag:start', (dragEvent) => dragEvent.cancel());
public removeContainer(containers: ...HTMLElement): Draggable source
Removes container from this draggable instance
Params:
Name | Type | Attribute | Description |
containers | ...HTMLElement | Containers you want to remove from draggable |
Example:
draggable.removeContainer(document.body)
public removePlugin(plugins: ...typeof Plugin): Draggable source
Removes plugins that are already attached to this draggable instance. This will end up calling the detach method of the plugin
Params:
Name | Type | Attribute | Description |
plugins | ...typeof Plugin | Plugins that you want detached from draggable |
Example:
draggable.removePlugin(MirrorPlugin, CustomMirrorPlugin)
public removeSensor(sensors: ...typeof Sensor): Draggable source
Removes sensors that are already attached to this draggable instance. This will end up calling the detach method of the sensor
Params:
Name | Type | Attribute | Description |
sensors | ...typeof Sensor | Sensors that you want attached to draggable |
Example:
draggable.removeSensor(TouchSensor, DragSensor)
public trigger(event: AbstractEvent): Draggable source
Triggers draggable event
Params:
Name | Type | Attribute | Description |
event | AbstractEvent | Event instance |
Example:
draggable.trigger(event);
Private Methods
private [onDragMove](event: Event) source
Drag move handler
Params:
Name | Type | Attribute | Description |
event | Event | DOM Drag event |
private [onDragPressure](event: Event) source
Drag pressure handler
Params:
Name | Type | Attribute | Description |
event | Event | DOM Drag event |
private [onDragStart](event: Event) source
Drag start handler
Params:
Name | Type | Attribute | Description |
event | Event | DOM Drag event |
private [onDragStop](event: Event) source
Drag stop handler
Params:
Name | Type | Attribute | Description |
event | Event | DOM Drag event |