Skip to main content

Home > @jsplumbtoolkit/core > MagnetizerRunOptions

MagnetizerRunOptions interface#

Signature:

export interface MagnetizerRunOptions<T> 

Properties#

PropertyTypeDescription
constrain?MagnetizerConstrainFunction(Optional) Optional function used to constrain the movement of elements when the magnetizer is being applied. An example of this in use in the Toolkit is in the label spacer module, in which the magnetizer is used to ensure labels do not overlap, but their movement is limited to travel along the path inscribed by the connector to which they belong.
elements?Dictionary<T> | Array<T>(Optional) List of elements to magnetize. If not provided, the magnetizer's current element list is used.
exclude?FilterFunction<T>(Optional) Optional function used to determine which elements to completely exclude from the magnetizer - they are treated as if they do not exist, and other elements may end up positioned intersecting them.
filter?FilterFunction<T>(Optional) Optional function used to filter elements from being affected by the magnetizer. They are still taken into account when magnetizing the other elements, unless you set excludeFocus:true.
gather?boolean(Optional) Defaults to false. If true, the magnetizer works in reverse: elements are gathered together (without overlapping)
grid?Grid(Optional)
iterations?number(Optional) Number of iterations to run for. More iterations takes longer but does better magnetizing.
origin?PointXY(Optional) Optional origin to use for magnetization process. If not provided, the computed center of the all elements to be magnetized will be used instead.
padding?PointXY(Optional) Optional value for the padding to leave between elements. Defaults to 20 pixels in each axis.