,, , ,, , , , image/svg+xml , image/svg+xml , interact.js , image/svg+xml , ,, , ,

@interactjs / core/InteractStatic / InteractStatic

Interface: InteractStatic

core/InteractStatic.InteractStatic

interact('#draggable').draggable(true)

var rectables = interact('rect')
rectables
  .gesturable(true)
  .on('gesturemove', function (event) {
      // ...
  })

The methods of this variable can be used to set elements as interactables and also to change various default settings.

Calling it as a function and passing an element or a valid CSS selector string returns an Interactable object which has various methods to configure it.

Param

The HTML or SVG Element to interact with or CSS selector

Callable

InteractStatic

â–¸ InteractStatic(target, options?): Interactable

Parameters

NameType
targetTarget
options?Options

Returns

Interactable

Defined in

core/InteractStatic.ts:38

Table of contents

Properties

Methods

Properties

closest

• closest: (element: Node, selector: string) => HTMLElement | SVGElement

Type declaration

â–¸ (element, selector): HTMLElement | SVGElement

Parameters
NameType
elementNode
selectorstring
Returns

HTMLElement | SVGElement

Defined in

core/InteractStatic.ts:46


createSnapGrid

• createSnapGrid: (grid: GridOptions) => SnapFunction & { coordFields: (readonly ["x", "y"] | readonly ["left", "top"] | readonly ["right", "bottom"] | readonly ["width", "height"])[] ; grid: GridOptions }

Type declaration

â–¸ (grid): SnapFunction & { coordFields: (readonly ["x", "y"] | readonly ["left", "top"] | readonly ["right", "bottom"] | readonly ["width", "height"])[] ; grid: GridOptions }

Parameters
NameType
gridGridOptions
Returns

SnapFunction & { coordFields: (readonly ["x", "y"] | readonly ["left", "top"] | readonly ["right", "bottom"] | readonly ["width", "height"])[] ; grid: GridOptions }

Defined in

snappers/plugin.ts:9


dynamicDrop

• dynamicDrop: (newValue?: boolean) => boolean | InteractStatic

Type declaration

â–¸ (newValue?): boolean | InteractStatic

Returns or sets whether the dimensions of dropzone elements are calculated on every dragmove or only on dragstart for the default dropChecker

Parameters
NameTypeDescription
newValue?booleanTrue to check on each move. False to check only before start
Returns

boolean | InteractStatic

The current setting or interact

Defined in

actions/drop/plugin.ts:176


getElementClientRect

• getElementClientRect: (element: Element) => Required<Rect>

Type declaration

â–¸ (element): Required<Rect>

Parameters
NameType
elementElement
Returns

Required<Rect>

Defined in

core/InteractStatic.ts:44


getElementRect

• getElementRect: (element: Element) => Required<Rect>

Type declaration

â–¸ (element): Required<Rect>

Parameters
NameType
elementElement
Returns

Required<Rect>

Defined in

core/InteractStatic.ts:43


getPointerAverage

• getPointerAverage: (pointers: PointerType[]) => { clientX: number = 0; clientY: number = 0; pageX: number = 0; pageY: number = 0; screenX: number = 0; screenY: number = 0 }

Type declaration

â–¸ (pointers): Object

Parameters
NameType
pointersPointerType[]
Returns

Object

NameType
clientXnumber
clientYnumber
pageXnumber
pageYnumber
screenXnumber
screenYnumber

Defined in

core/InteractStatic.ts:39


getTouchAngle

• getTouchAngle: (event: TouchEvent | PointerType[], deltaSource: string) => number

Type declaration

â–¸ (event, deltaSource): number

Parameters
NameType
eventTouchEvent | PointerType[]
deltaSourcestring
Returns

number

Defined in

core/InteractStatic.ts:42


getTouchBBox

• getTouchBBox: (event: PointerType[]) => { bottom: number = maxY; height: number ; left: number = minX; right: number = maxX; top: number = minY; width: number ; x: number = minX; y: number = minY }

Type declaration

â–¸ (event): Object

Parameters
NameType
eventPointerType[]
Returns

Object

NameType
bottomnumber
heightnumber
leftnumber
rightnumber
topnumber
widthnumber
xnumber
ynumber

Defined in

core/InteractStatic.ts:40


getTouchDistance

• getTouchDistance: (event: TouchEvent | PointerType[], deltaSource: string) => number

Type declaration

â–¸ (event, deltaSource): number

Parameters
NameType
eventTouchEvent | PointerType[]
deltaSourcestring
Returns

number

Defined in

core/InteractStatic.ts:41


matchesSelector

• matchesSelector: (element: Element, selector: string) => boolean

Type declaration

â–¸ (element, selector): boolean

Parameters
NameType
elementElement
selectorstring
Returns

boolean

Defined in

core/InteractStatic.ts:45


maxInteractions

• maxInteractions: (newValue: any) => any

Type declaration

â–¸ (newValue): any

Returns or sets the maximum number of concurrent interactions allowed. By default only 1 interaction is allowed at a time (for backwards compatibility). To allow multiple interactions on the same Interactables and elements, you need to enable it in the draggable, resizable and gesturable 'max' and 'maxPerElement' options.

Parameters
NameTypeDescription
newValueanyAny number. newValue <= 0 means no interactions.
Returns

any

Defined in

auto-start/base.ts:33


modifiers

• modifiers: Object

Type declaration

NameType
aspectRatio(_options?: Partial<AspectRatioOptions>) => Modifier<AspectRatioOptions, AspectRatioState, "aspectRatio", unknown>
aspectRatio._defaultsAspectRatioOptions
aspectRatio._methods{ beforeEnd: (arg: ModifierArg<AspectRatioState>) => void | Point = module.beforeEnd; set: (arg: ModifierArg<AspectRatioState>) => unknown = module.set; start: (arg: ModifierArg<AspectRatioState>) => void = module.start; stop: (arg: ModifierArg<AspectRatioState>) => void = module.stop }
aspectRatio._methods.beforeEnd(arg: ModifierArg<AspectRatioState>) => void | Point
aspectRatio._methods.set(arg: ModifierArg<AspectRatioState>) => unknown
aspectRatio._methods.start(arg: ModifierArg<AspectRatioState>) => void
aspectRatio._methods.stop(arg: ModifierArg<AspectRatioState>) => void
avoidModifierFunction<any, any, "noop">
restrict(_options?: Partial<RestrictOptions>) => Modifier<RestrictOptions, RestrictState, "restrict", unknown>
restrict._defaultsRestrictOptions
restrict._methods{ beforeEnd: (arg: ModifierArg<RestrictState>) => void | Point = module.beforeEnd; set: (arg: ModifierArg<RestrictState>) => unknown = module.set; start: (arg: ModifierArg<RestrictState>) => void = module.start; stop: (arg: ModifierArg<RestrictState>) => void = module.stop }
restrict._methods.beforeEnd(arg: ModifierArg<RestrictState>) => void | Point
restrict._methods.set(arg: ModifierArg<RestrictState>) => unknown
restrict._methods.start(arg: ModifierArg<RestrictState>) => void
restrict._methods.stop(arg: ModifierArg<RestrictState>) => void
restrictEdges(_options?: Partial<RestrictEdgesOptions>) => Modifier<RestrictEdgesOptions, RestrictEdgesState, "restrictEdges", void>
restrictEdges._defaultsRestrictEdgesOptions
restrictEdges._methods{ beforeEnd: (arg: ModifierArg<RestrictEdgesState>) => void | Point = module.beforeEnd; set: (arg: ModifierArg<RestrictEdgesState>) => void = module.set; start: (arg: ModifierArg<RestrictEdgesState>) => void = module.start; stop: (arg: ModifierArg<RestrictEdgesState>) => void = module.stop }
restrictEdges._methods.beforeEnd(arg: ModifierArg<RestrictEdgesState>) => void | Point
restrictEdges._methods.set(arg: ModifierArg<RestrictEdgesState>) => void
restrictEdges._methods.start(arg: ModifierArg<RestrictEdgesState>) => void
restrictEdges._methods.stop(arg: ModifierArg<RestrictEdgesState>) => void
restrictRect(_options?: Partial<RestrictOptions & { elementRect: }>) => Modifier<RestrictOptions & { elementRect: }, RestrictState, "restrictRect", unknown>
restrictRect._defaultsRestrictOptions & { elementRect: }
restrictRect._methods{ beforeEnd: (arg: ModifierArg<RestrictState>) => void | Point = module.beforeEnd; set: (arg: ModifierArg<RestrictState>) => unknown = module.set; start: (arg: ModifierArg<RestrictState>) => void = module.start; stop: (arg: ModifierArg<RestrictState>) => void = module.stop }
restrictRect._methods.beforeEnd(arg: ModifierArg<RestrictState>) => void | Point
restrictRect._methods.set(arg: ModifierArg<RestrictState>) => unknown
restrictRect._methods.start(arg: ModifierArg<RestrictState>) => void
restrictRect._methods.stop(arg: ModifierArg<RestrictState>) => void
restrictSize(_options?: Partial<RestrictSizeOptions>) => Modifier<RestrictSizeOptions, RestrictEdgesState, "restrictSize", void>
restrictSize._defaultsRestrictSizeOptions
restrictSize._methods{ beforeEnd: (arg: ModifierArg<RestrictEdgesState>) => void | Point = module.beforeEnd; set: (arg: ModifierArg<RestrictEdgesState>) => void = module.set; start: (arg: ModifierArg<RestrictEdgesState>) => void = module.start; stop: (arg: ModifierArg<RestrictEdgesState>) => void = module.stop }
restrictSize._methods.beforeEnd(arg: ModifierArg<RestrictEdgesState>) => void | Point
restrictSize._methods.set(arg: ModifierArg<RestrictEdgesState>) => void
restrictSize._methods.start(arg: ModifierArg<RestrictEdgesState>) => void
restrictSize._methods.stop(arg: ModifierArg<RestrictEdgesState>) => void
rubberbandModifierFunction<any, any, "noop">
snap(_options?: Partial<SnapOptions>) => Modifier<SnapOptions, SnapState, "snap", { delta: { x: number = 0; y: number = 0 } ; distance: number = 0; inRange: boolean = false; range: number = 0; target: any = null }>
snap._defaultsSnapOptions
snap._methods{ beforeEnd: (arg: ModifierArg<SnapState>) => void | Point = module.beforeEnd; set: (arg: ModifierArg<SnapState>) => { delta: { x: number = 0; y: number = 0 } ; distance: number = 0; inRange: boolean = false; range: number = 0; target: any = null } = module.set; start: (arg: ModifierArg<SnapState>) => void = module.start; stop: (arg: ModifierArg<SnapState>) => void = module.stop }
snap._methods.beforeEnd(arg: ModifierArg<SnapState>) => void | Point
snap._methods.set(arg: ModifierArg<SnapState>) => { delta: { x: number = 0; y: number = 0 } ; distance: number = 0; inRange: boolean = false; range: number = 0; target: any = null }
snap._methods.start(arg: ModifierArg<SnapState>) => void
snap._methods.stop(arg: ModifierArg<SnapState>) => void
snapEdges(_options?: Partial<SnapEdgesOptions>) => Modifier<SnapEdgesOptions, SnapState, "snapEdges", { delta: { x: number = 0; y: number = 0 } ; distance: number = 0; inRange: boolean = false; range: number = 0; target: any = null }>
snapEdges._defaultsSnapEdgesOptions
snapEdges._methods{ beforeEnd: (arg: ModifierArg<SnapState>) => void | Point = module.beforeEnd; set: (arg: ModifierArg<SnapState>) => { delta: { x: number = 0; y: number = 0 } ; distance: number = 0; inRange: boolean = false; range: number = 0; target: any = null } = module.set; start: (arg: ModifierArg<SnapState>) => void = module.start; stop: (arg: ModifierArg<SnapState>) => void = module.stop }
snapEdges._methods.beforeEnd(arg: ModifierArg<SnapState>) => void | Point
snapEdges._methods.set(arg: ModifierArg<SnapState>) => { delta: { x: number = 0; y: number = 0 } ; distance: number = 0; inRange: boolean = false; range: number = 0; target: any = null }
snapEdges._methods.start(arg: ModifierArg<SnapState>) => void
snapEdges._methods.stop(arg: ModifierArg<SnapState>) => void
snapSize(_options?: Partial<SnapSizeOptions>) => Modifier<SnapSizeOptions, SnapState, "snapSize", { delta: { x: number = 0; y: number = 0 } ; distance: number = 0; inRange: boolean = false; range: number = 0; target: any = null }>
snapSize._defaultsSnapSizeOptions
snapSize._methods{ beforeEnd: (arg: ModifierArg<SnapState>) => void | Point = module.beforeEnd; set: (arg: ModifierArg<SnapState>) => { delta: { x: number = 0; y: number = 0 } ; distance: number = 0; inRange: boolean = false; range: number = 0; target: any = null } = module.set; start: (arg: ModifierArg<SnapState>) => void = module.start; stop: (arg: ModifierArg<SnapState>) => void = module.stop }
snapSize._methods.beforeEnd(arg: ModifierArg<SnapState>) => void | Point
snapSize._methods.set(arg: ModifierArg<SnapState>) => { delta: { x: number = 0; y: number = 0 } ; distance: number = 0; inRange: boolean = false; range: number = 0; target: any = null }
snapSize._methods.start(arg: ModifierArg<SnapState>) => void
snapSize._methods.stop(arg: ModifierArg<SnapState>) => void
springModifierFunction<any, any, "noop">
transformModifierFunction<any, any, "noop">

Defined in

modifiers/plugin.ts:14


snappers

• snappers: __module

Defined in

snappers/plugin.ts:8


version

• version: string

Defined in

core/InteractStatic.ts:48

Methods

addDocument

â–¸ addDocument(doc, options?): void

Parameters

NameType
docDocument
options?object

Returns

void

Defined in

core/InteractStatic.ts:94


debug

â–¸ debug(): any

Returns

any

Defined in

core/InteractStatic.ts:73


isSet

â–¸ isSet(target, options?): boolean

Check if an element or selector has been set with the interact(target) function

Parameters

NameType
targetTarget
options?any

Returns

boolean

Indicates if the element or CSS selector was previously passed to interact

Defined in

core/InteractStatic.ts:66


off

â–¸ off(type, listener, options?): any

Parameters

NameType
typeEventTypes
listenerany
options?object

Returns

any

Defined in

core/InteractStatic.ts:72


on

â–¸ on(type, listener, options?): any

Parameters

NameType
typeEventTypes
listenerListenersArg
options?object

Returns

any

Defined in

core/InteractStatic.ts:71


pointerMoveTolerance

â–¸ pointerMoveTolerance(newValue?): number | InteractStatic

Returns or sets the distance the pointer must be moved before an action sequence occurs. This also affects tolerance for tap events.

Parameters

NameTypeDescription
newValue?numberThe movement from the start position must be greater than this value

Returns

number | InteractStatic

Defined in

core/InteractStatic.ts:90


removeDocument

â–¸ removeDocument(doc): void

Parameters

NameType
docDocument

Returns

void

Defined in

core/InteractStatic.ts:95


stop

â–¸ stop(): InteractStatic

Cancels all interactions (end events are not fired)

Returns

InteractStatic

Defined in

core/InteractStatic.ts:85


supportsPointerEvent

â–¸ supportsPointerEvent(): boolean

Whether or not the browser supports PointerEvents

Returns

boolean

Defined in

core/InteractStatic.ts:81


supportsTouch

â–¸ supportsTouch(): boolean

Whether or not the browser supports touch input

Returns

boolean

Defined in

core/InteractStatic.ts:77


use

â–¸ use(plugin, options?): any

Use a plugin

Parameters

NameType
pluginPlugin
options?Object

Returns

any

Defined in

core/InteractStatic.ts:53