A foundational abstract implementation of IEdgeStyle that delegates its behavior to pre-configured style instances.
Remarks
This class supports three primary use cases:
- Wrapping another style with a customized API. This is ideal for providing a simpler or domain-specific API by mapping properties from a subclass to the corresponding values of the delegated style. Subclasses typically return the preconfigured instance from getStyle and modify it in the constructor or through custom property setters.
- Dynamically reconfiguring a style based on the target edge. In this scenario, the implementation keeps one or more style instances as fields and switches between them in getStyle, depending on attributes of the edge, such as its tag property. This approach may also involve dynamically reconfiguring the style instance for specific edge instances. When appropriate, implementations may override clone to simply return
this
. - Replacing one part of the implementation of another style. Instead of subclassing another style, the implementation delegates to all but a subset of the various aspects to an existing implementation and provides its own implementation, otherwise, via overriding specific methods of the base EdgeStyleBase<TVisual> class.
Subclasses must implement getStyle and should ensure that it executes quickly and without allocations.
Type Details
- yFiles module
- view
See Also
Properties
Gets the renderer implementation for this instance.
Remarks
Implements
Methods
addArrows
(context: IRenderContext, group: SVGGElement, edge: IEdge, edgePath: GeneralPath, sourceArrow: IArrow, targetArrow: IArrow)Adds the arrows to a given container.
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The context for the rendering.
- group - SVGGElement
- The container to which the arrows should be added.
- edge - IEdge
- The edge that is being rendered.
- edgePath - GeneralPath
- The edge path.
- sourceArrow - IArrow
- The source arrow.
- targetArrow - IArrow
- The target arrow.
Defined in
Returns a memberwise clone.
Remarks
this
, instead, as the base implementation is completely stateless.Returns
- ↪Object
- A clone of this instance.
Overrides
Creates the visual with the style from getStyle and the edge from getEdge.
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The render context.
- edge - IEdge
- The edge to which this style instance is assigned.
Returns
- ↪Visual?
- The visual as required by the createVisual interface.
See Also
Implements
Crops the edge's path at the nodes.
Remarks
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge that is being rendered.
- sourceArrow - IArrow
- The source arrow instance.
- targetArrow - IArrow
- The target arrow instance.
- path - GeneralPath
- The path that should be cropped.
Returns
- ↪GeneralPath?
- The cropped path. This can be either the same instance of the given path or a newly created instance.
Defined in
Gets the bounds with the style from getStyle and the edge from getEdge.
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- The canvas context.
- edge - IEdge
- The edge to which this style instance is assigned.
Returns
- ↪Rect
- The visual bounds of the visual representation.
Overrides
Returns the edge used for rendering.
Remarks
Parameters
A map of options to pass to the method.
- edge - IEdge
- The original edge to be rendered.
Returns
- ↪IEdge
- The edge used for rendering. By default, this method returns the provided
edge
. Subclasses can override this method to return a different edge, such as a SimpleEdge, to customize rendering behavior.
Gets the path of the edge from getEdge by using the style from getStyle.
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge.
Returns
- ↪GeneralPath?
- The path.
Overrides
Calculates the source arrow anchor and direction for a given arrow and path.
Parameters
A map of options to pass to the method.
- path - GeneralPath
- The path of the edge.
- arrow - IArrow
- The arrow.
Returns
- ↪Tangent?
- The anchor and directional vector of the arrow, if any exist.
Defined in
Provides the core implementation of this style, returning the instance to delegate rendering logic.
Remarks
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge for which the style instance should be returned and applied.
Returns
- ↪IEdgeStyle
- The IEdgeStyle instance responsible for handling all related requests.
Determines the tangent of the edge from getEdge by using the style from getStyle.
Determines the tangent of the edge from getEdge by using the style from getStyle.
Parameters
A map of options to pass to the method.
- edge - IEdge
- The edge.
- segmentIndex - number
- Index of the edge segment.
- ratio - number
- A value between 0 and 1 inclusively that indicates a ratio from the beginning to the end of the edge segment.
Returns
- ↪Tangent?
- The tangent, if it exists.
Overrides
Calculates the target arrow anchor and direction for a given arrow and path.
Parameters
A map of options to pass to the method.
- path - GeneralPath
- The path of the edge.
- arrow - IArrow
- The arrow.
Returns
- ↪Tangent?
- The anchor and directional vector of the arrow, if any exist.
Defined in
Determines with the style from getStyle whether the visualization of the edge from getEdge is hit at the given location.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The input mode context.
- location - Point
- The point to test.
- edge - IEdge
- The edge to which this style instance is assigned.
Returns
- ↪boolean
true
if the specified edge is hit;false
otherwise.
See Also
Overrides
Determines with the style from getStyle whether the visualization of the edge from getEdge is included in the marquee selection.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The input mode context.
- rectangle - Rect
- The marquee selection box.
- edge - IEdge
- The edge to which this style instance is assigned.
Returns
- ↪boolean
true
if the specified edge is visible and selected by the marquee rectangle;false
otherwise.
Overrides
Determines with the style from getStyle whether the visualization of the edge from getEdge is included in the lasso selection.
Parameters
A map of options to pass to the method.
- context - IInputModeContext
- The input mode context.
- path - GeneralPath
- The lasso selection path.
- edge - IEdge
- The edge to which this style instance is assigned.
Returns
- ↪boolean
true
if the specified edge is visible and selected by the lasso path;false
otherwise.
Overrides
Determines with the style from getStyle whether the visualization of the edge from getEdge is visible.
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- The canvas context.
- rectangle - Rect
- The clipping rectangle.
- edge - IEdge
- The edge to which this style instance is assigned.
Returns
- ↪boolean
true
if the specified edge is visible in the clipping rectangle;false
otherwise.
Overrides
updateArrows
(context: IRenderContext, group: SVGGElement, edge: IEdge, edgePath: GeneralPath, sourceArrow: IArrow, targetArrow: IArrow)Updates the arrows in a given container.
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The context for the rendering.
- group - SVGGElement
- The container to which the arrows should be added.
- edge - IEdge
- The edge that is being rendered.
- edgePath - GeneralPath
- The edge path.
- sourceArrow - IArrow
- The source arrow.
- targetArrow - IArrow
- The target arrow.
Defined in
Updates the visual with the style from getStyle and the edge from getEdge.
Parameters
A map of options to pass to the method.
- context - IRenderContext
- The render context.
- oldVisual - Visual
- The visual that has been created in the call to createVisual.
- edge - IEdge
- The edge to which this style instance is assigned.
Returns
- ↪Visual?
- The visual as required by the createVisual interface.