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#
| property | explanation | type | default value |
|---|
refElements  | the reference elements used by this layout | Array | [] |
| type | the type of the layout | String | “force” |
Methods#
| method | explanation | return type |
|---|
| clone() | returns a copy of this layout | ForceLayout |
Methods inherited from Layout#
| method | explanation | return type |
|---|
| addRefElement(re) | adds a reference element to this layout | void |
| clearRefElements() | removes all reference elements from this layout | void |