A utility class that holds all properties of a stroke.
Remarks
The stroke that is defined by instances of this type can be applied to the WebGL2 styles like WebGLShapeNodeStyle, WebGLImageNodeStyle, WebGLGroupNodeStyle, WebGLPolylineEdgeStyle, WebGLArcEdgeStyle, WebGLBridgeEdgeStyle, WebGLLabelStyle, and WebGLIconLabelStyle.
This is a convertible type that can be used with the following notation(s) in parameter lists, parameter objects or setters.
The strings applying to this scheme are converted to WebGLStrokes:
'[thickness] [type] color'
thickness = thickness in px|thin|medium|thick
type = solid|dashed|dotted
color = CSS color strings
Valid color strings are the same as for color. Square brackets mark optional declarations.
Examples:
'3px blue'
'thick blue'
Currently, all WebGLStrokes are solid strokes. Dashed or dotted stroke patterns are not supported.
Type Details
- yFiles module
- view
Constructors
Creates a new stroke with the given color and optional thickness.
Parameters
A map of options to pass to the method.
- color - Color
- The color for the stroke.
- thickness - number
- The optional thickness, which defaults to
1.0
if not specified. - dashStyle - WebGLDashStyle
- lineCap - WebGLLineCap
Properties
Gets the color to use for the stroke.
Gets the dash style for the WebGLStroke.
Remarks
The visual appearance of the 'dashes' and 'gaps' specified by this property depends on the value of the property lineCap, too.
The predefined dash styles are designed for line caps that extend into the 'gaps' like SQUARE and ROUND. With FLAT, the dashes might not look like expected, for example DOT will not be visible at all. Since FLAT is the default value, you should explicitly set another value in this case.
Property Value
Gets the line cap.
Remarks
Constants
Gets a solid black stroke with thickness 1.
An invisible stroke that has no thickness or color.
Static Methods
Creates a WebGLStroke instance from the given stroke-like object by performing automatic type conversion.
Parameters
A map of options to pass to the method.
- strokeLike - WebGLStroke
- The object to convert to a WebGLStroke.
Returns
- ↪WebGLStroke
- The given
strokeLike
if it is already a WebGLStroke, or a new instance initialized to the values found instrokeLike
.