documentationfor yFiles for HTML 2.6

GraphSnapContext

Concrete SnapContext implementation which handles snapping movement for IGraph items.

Inheritance Hierarchy
SnapContext
GraphSnapContext

Remarks

Snapping is enabled for IGraph items by setting an instance of this on the GraphEditorInputMode as snapContext.

This class provides a set of properties that determine the way snapping operations are being performed in the context of IGraphs.

IPositionHandler implementations and the like can retrieve instances of this class from the IInputModeContext.

Examples

Enabling snapping by setting the snap context
mode.snapContext = new GraphSnapContext()
Customizing the snap context
mode.snapContext = new GraphSnapContext({
  nodeToNodeDistance: 30,
  collectNodePairCenterSnapLines: true,
  collectNodePairSegmentSnapLines: false
})
Retrieving a GraphSnapContext instance from the input mode context
const snapContext = inputModeContext.lookup(GraphSnapContext.$class)
if (snapContext && snapContext.isInitializing) {
  // ...
}const snapContext = inputModeContext.lookup(
  GraphSnapContext.$class
) as GraphSnapContext
if (snapContext && snapContext.isInitializing) {
  // ...
}

Related Programming Samples

Snapping
Shows how to enable snapping (guide lines) for interactive changes.

Type Details

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

See Also

Constructors

Properties

Methods

Events