C

GridRenderer

Renders a grid, using various different styles and render technologies.
ImplementsInheritance Hierarchy

Remarks

The SVG renderMode provides the following CSS classes to conveniently change the color of the grid visual:

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(),
)

See Also

Developer's Guide

API

GridInfo, gridStyle

Members

No filters for this type

Constructors

Initializes a new instance of the GridRenderer class.

Parameters

Properties

Gets or sets the grid style that this implementation uses.
conversionfinal

Property Value

The grid style.
Gets or sets the mode used to render the grid.
conversionfinal
Gets or sets the stroke to use for rendering the grid.
conversionfinal

Property Value

The stroke.
Gets or sets the visibility threshold.
This indicates the minimum distance in the view coordinate system between two grid points. If the distance becomes smaller, the grid will not be rendered.
final

Property Value

The visibility threshold.
Gets or sets a value indicating whether this GridRenderer is visible.
final

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.
This method may always return the same instance. By contract, clients will not cache instances returned, but will always call this method before the methods on the instance will be called. This contract enables the use of the flyweight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.
final

Parameters

renderTag: GridInfo
the render tag to query the bounds for

Return Value

IBoundsProvider
An implementation of IBoundsProvider to determine the bounds of the visualization.
Returns an implementation of IHitTestable that can determine whether the rendering of the render tag has been hit at a given coordinate.
This method may always return the same instance. By contract, clients will not cache instances returned, but will always call this method before the methods on the instance will be called. This contract enables the use of the flyweight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.
final

Parameters

renderTag: GridInfo
the render tag to do the hit testing for

Return Value

IHitTestable
An implementation of IHitTestable to determine visibility.
Returns an implementation of IVisibilityTestable that can determine if the rendering of the render tag would be visible in a given context.
This method may always return the same instance. By contract clients will not cache instances returned but will always call this method before the methods on the instance will be called. This contract enables the use of the flyweight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.
final

Parameters

renderTag: GridInfo
the render tag to query visibility for

Return Value

IVisibilityTestable
An implementation of IVisibilityTestable to determine visibility.
Returns an implementation of IVisualCreator that will create the Visual tree for the render tag.
This method may always return the same instance. By contract, clients will not cache instances returned, but will always call this method before the methods on the instance will be called. This contract enables the use of the flyweight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.
final

Parameters

renderTag: GridInfo
the render tag to create a Visual for

Return Value

IVisualCreator
An implementation of IVisualCreator to create or update the visualization.