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 WebGL2ShapeNodeStyle, WebGL2IconNodeStyle, WebGL2GroupNodeStyle, WebGL2PolylineEdgeStyle, WebGL2ArcEdgeStyle, WebGL2BridgeEdgeStyle, WebGL2DefaultLabelStyle, and WebGL2IconLabelStyle.
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 WebGL2Strokes:
'[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 WebGL2Strokes are solid strokes. Dashed or dotted stroke patterns are not supported.
Type Details
- yfiles module
- view-webgl
- yfiles-umd modules
- view-webgl, view
- Legacy UMD name
- yfiles.view.WebGL2Stroke
Constructors
WebGL2Stroke
(color: Color, thickness?: number, dashStyle?: WebGL2DashStyle, lineCap?: WebGL2LineCap)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 - WebGL2DashStyle
- lineCap - WebGL2LineCap
Properties
Gets the color to use for the stroke.
Gets the dash style for the WebGL2Stroke.
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.
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 WebGL2Stroke instance from the given stroke-like object by performing automatic type conversion.
Parameters
A map of options to pass to the method.
- strokeLike - WebGL2Stroke
- The object to convert to a WebGL2Stroke.
Returns
- ↪WebGL2Stroke
- The given
strokeLike
if it is already a WebGL2Stroke, or a new instance initialized to the values found instrokeLike
.