documentationfor yFiles for HTML 3.0.0.3

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, 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.renderTree.createElement(
  graphComponent.renderTree.backgroundGroup,
  gridInfo,
  new GridRenderer(),
)

Type Parameters

T
The type of the items this class can snap

Type Details

yFiles module
view

See Also

Properties

Methods

Static Methods