Renders a grid, using various different styles and render technologies.
Remarks
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 Details
- yFiles module
- view
See Also
Constructors
Initializes a new instance of the GridRenderer class.
Parameters
A map of options to pass to the method.
- renderMode - RenderMode
- The mode used to render the grid. This option sets the renderMode property on the created object.
- gridStyle - GridStyle
- The grid style that this implementation uses. This option sets the gridStyle property on the created object.
- visible - boolean
- A value indicating whether this GridRenderer is visible. This option sets the visible property on the created object.
- stroke - Stroke
- visibilityThreshold - number
- The visibility threshold. This option sets the visibilityThreshold property on the created object.
Properties
Gets or sets the grid style that this implementation uses.
Property Value
Gets or sets the mode used to render the grid.
Gets or sets a value indicating whether this GridRenderer is visible.
Property Value
true
if visible; false
otherwise.Methods
Returns an implementation of IBoundsProvider that can determine the visible bounds of the rendering of the render tag.
Remarks
Parameters
A map of options to pass to the method.
- renderTag - GridInfo
- the render tag to query the bounds for
Returns
- ↪IBoundsProvider
- An implementation of IBoundsProvider to determine the bounds of the visualization.
Implements
Returns an implementation of IHitTestable that can determine whether the rendering of the render tag has been hit at a given coordinate.
Remarks
Parameters
A map of options to pass to the method.
- renderTag - GridInfo
- the render tag to do the hit testing for
Returns
- ↪IHitTestable
- An implementation of IHitTestable to determine visibility.
Implements
Returns an implementation of IVisibilityTestable that can determine if the rendering of the render tag would be visible in a given context.
Remarks
Parameters
A map of options to pass to the method.
- renderTag - GridInfo
- the render tag to query visibility for
Returns
- ↪IVisibilityTestable
- An implementation of IVisibilityTestable to determine visibility.
Implements
Returns an implementation of IVisualCreator that will create the Visual tree for the render tag.
Remarks
Parameters
A map of options to pass to the method.
Returns
- ↪IVisualCreator
- An implementation of IVisualCreator to create or update the visualization.