Home Reference Source
public class | source

Collidable

Extends:

* → Collidable

Collidable plugin which detects colliding elements while dragging

Constructor Summary

Public Constructor
public

constructor(draggable: Draggable)

Collidable constructor.

Member Summary

Public Members
public

Animation frame for finding colliding elements

public

Keeps track of currently colliding elements

public

lastCollidingElement: HTMLElement | null

Keeps track of currently colliding elements

Method Summary

Public Methods
public

attach()

Attaches plugins event listeners

public

detach()

Detaches plugins event listeners

public

getCollidables(): HTMLElement[]

Returns current collidables based on collidables option

Private Methods
private

Drag move handler

private

Drag stop handler

private

[onRequestAnimationFrame](target: HTMLElement): Function

Animation frame function

Public Constructors

public constructor(draggable: Draggable) source

Collidable constructor.

Params:

NameTypeAttributeDescription
draggable Draggable

Draggable instance

Public Members

public currentAnimationFrame: Number | null source

Animation frame for finding colliding elements

Properties:

NameTypeAttributeDescription
currentAnimationFrame Number | null

public currentlyCollidingElement: HTMLElement | null source

Keeps track of currently colliding elements

Properties:

NameTypeAttributeDescription
currentlyCollidingElement HTMLElement | null

public lastCollidingElement: HTMLElement | null source

Keeps track of currently colliding elements

Properties:

NameTypeAttributeDescription
lastCollidingElement HTMLElement | null

Public Methods

public attach() source

Attaches plugins event listeners

public detach() source

Detaches plugins event listeners

public getCollidables(): HTMLElement[] source

Returns current collidables based on collidables option

Return:

HTMLElement[]

Private Methods

private [onDragMove](event: DragMoveEvent) source

Drag move handler

Params:

NameTypeAttributeDescription
event DragMoveEvent

Drag move event

private [onDragStop](event: DragStopEvent) source

Drag stop handler

Params:

NameTypeAttributeDescription
event DragStopEvent

Drag stop event

private [onRequestAnimationFrame](target: HTMLElement): Function source

Animation frame function

Params:

NameTypeAttributeDescription
target HTMLElement

Current move target

Return:

Function