documentationfor yFiles for HTML 2.6

IGridConstraintProvider<T>

Interface for classes that can snap coordinates of items of a specific type to a grid.

Examples

Enabling grid snapping

const snapContext = new GraphSnapContext()

const gridInfo = new GridInfo(50)
snapContext.nodeGridConstraintProvider = new GridConstraintProvider(gridInfo)
snapContext.bendGridConstraintProvider = new GridConstraintProvider(gridInfo)
snapContext.portGridConstraintProvider = new GridConstraintProvider(gridInfo)
snapContext.gridSnapType = GridSnapTypes.GRID_POINTS

graphEditorInputMode.snapContext = snapContext

Note that the grid visualization has to be enabled separately

graphComponent.backgroundGroup.addChild(new GridVisualCreator(gridInfo))

Type Parameters

T
The type of the items this class can snap

Type Details

yfiles module
view-component
yfiles-umd modules
All view modules
Legacy UMD name
yfiles.input.IGridConstraintProvider

See Also

Properties

Methods

Static Methods