ForceLayout

extends Layout

The ForceLayout class represents a layout that positions objects using a force-directed algorithm. The simulation is centered at (x, y) and advanced a fixed number of iterations ticks. To create a ForceLayout object and apply it to a collection, use the layout function:

let fl = msc.layout("force", {repulsion: 50, linkDistance: 40});
collection.layout = fl;

Properties

propertyexplanationtypedefault value
refElements the reference elements used by this layoutArray[]
typethe type of the layoutString“force”

Methods

methodexplanationreturn type
clone()returns a copy of this layoutForceLayout

Methods inherited from Layout

methodexplanationreturn type
addRefElement(re)adds a reference element to this layoutvoid
clearRefElements()removes all reference elements from this layoutvoid