documentationfor yFiles for HTML 2.6

LabelSnapContext

Manages interactive snapping of ILabels to their owner during drag operations like movements.

Inheritance Hierarchy
SnapContext
LabelSnapContext

Remarks

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

This class provides a set of properties to customize the snapping behavior.

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

Examples

Snapping is enabled by installing the snapping context on the GraphEditorInputMode
Enabling snapping by setting the snap context
mode.snapContext = new GraphSnapContext()
mode.labelSnapContext = new LabelSnapContext()
Customizing the snap context
mode.snapContext = new LabelSnapContext({
  collectNodeShapeSnapLines: true,
  snapDistance: 3
})
Obtaining the LabelSnapContext from the IInputModeContext
const snapContext = inputModeContext.lookup(LabelSnapContext.$class)
if (snapContext !== null && snapContext.isInitializing) {
  // do something
}const snapContext = inputModeContext.lookup(
  LabelSnapContext.$class
) as LabelSnapContext
if (snapContext !== null && snapContext.isInitializing) {
  // do something
}

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.LabelSnapContext

See Also

Constructors

Properties

Methods

Events