Skip to main content

Home > @jsplumbtoolkit/browser-ui > DragGroupsPlugin

DragGroupsPlugin class

Provides the ability to assign elements to groups for dragging purposes: when a member of some group is dragged, the other elements of the group can be dragged along with it.

The core concept is of the "DragGroup", which is basically just a tag. Each member of a group can belong to the group in one of two roles:

  • **active** The element, when dragged, causes all of the other members of the group to be dragged too. - **passive** The element, when dragged, will not cause any of the other members of the group to be dragged. But when an active member of the group is dragged, passive elements are dragged at the same time.

When you configure this plugin you are required to provide an assignDragGroup function, whose signature is:

assignDragGroup:(v:Vertex) => DragGroupSpec

The return value DragGroupSpec may be either:

  • a string, in which case the element is added to the drag group with the given name in an active role - an object containing id and active which you can specify the active/passive role - null, in which case the element is not added to a drag group.

Signature:

export declare class DragGroupsPlugin implements SurfacePlugin 

Implements: SurfacePlugin

Properties

PropertyModifiersTypeDescription
dragGroupAssigner(v: Vertex) => DragGroupSpec
jsplumbBrowserJsPlumbInstance
surfaceSurface
typestaticstring

Methods

MethodModifiersDescription
addToDragGroup(spec, objects)Adds the given objects to the given drag group.
assignToDragGroup(objects)Runs each of the given objects through the code that automatically assigns them to a drag group. Since this
destroy()
initialise(surface, options)
removeFromDragGroup(objects)Removes the given object(s) from any drag group they may belong to. You don't need to specify the name of the drag group since an object may belong to only one at a time.
reset()