A node style that can display node shapes with a boundary that is defined by a GeneralPath instance.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.styles.GeneralPathNodeStyle
See Also
Constructors
Creates a new instance using the specified path and a custom renderer instance.
Parameters
A map of options to pass to the method.
- path - GeneralPath
- The path that defines the boundary of this style. The path must be defined in such a way that the point (0,0) represents the top left of a node's layout and the point (1,1) the lower right. The path will be scaled accordingly to the node's size. If not specified, a simple rectangular path is used.
- renderer - GeneralPathNodeStyleRenderer
- Custom renderer instance for this style. If none is provided, a new instance of the default implementation will be used.
- fill - Fill
- stroke - Stroke
- cssClass - string
A CSS class that will be applied to the visualization. This option sets the cssClass property on the created object.
- aspectRatio - number
The aspect ratio for scaling the path to a node's size. This option sets the aspectRatio property on the created object.
Properties
Gets or sets the aspect ratio for scaling the path to a node's size.
Remarks
If this value is positive and finite, the path will be scaled to the largest rectangle that a) has a width-to-height ratio that matches this value and b) fits into the node's size. Otherwise, the path is scaled to the node's size (and aspect ratio) without further restrictions.
The default value is 0
. I.e. path is scaled to the node's size (and aspect ratio).
See Also
Get or sets the path that defines the boundary of the shape.
Gets the renderer implementation that can be queried for implementations that provide details about the visual appearance and visual behavior for a given node and this style instance.
Remarks
const creator = style.renderer.getVisualCreator(node, style)
const visual = creator.createVisual(context)
See Also
Implements
Methods
Create a clone of this object.
Static Methods
Creates a new GeneralPathNodeStyle instance for a copy of the given path.
Remarks
Parameters
A map of options to pass to the method.
- path - GeneralPath
- The path that defines the outline of a node's visualization. The width and height of its bounds have to be positive and finite.
Throws
- Exception({ name: 'ArgumentError' })
- If the width or height of the given path's bounds is not positive and finite.