Returns true
if there are fewer than 2 points to draw and has no SVG path.
Returns the currently cached Path2D object, if any, or null
otherwise.
Explicitly sets the cached Path3D
object to path
.
A new path will not be re-generated unless svgPath
or lines
properties are set, or cache is explicitly cleared with clearCache()
.
The path will still be scaled and aligned in (), if needed, and the new scaled/aligned path will then be cached.
Set or get the path definition as an SVG path string. Reading the property returns empty unless the property was explicitly set previously.
Alignment value as two string values, first for vertical and second for horizontal. Eg. "top left" or "center middle". Setting the property can be done with either a single direction or both (separated by space or comma) in either order.
Horizontal alignment value as string. One of: 'left', 'center', 'right'
Vertical alignment value as string. One of: 'top', 'middle', 'bottom'
Optional
init: FreeformPathInitClears all coordinates in the current lines array.
Parses and sets the path from an evaluated string value, with minimal validation.
First checks value against the cached last value. Returns false
if the path hasn't changed or couldn't be loaded.
Accepted path values:
"x,y" || "[x,y]" - single point (<pt>), y is optional (defaults to x)
"<pt>, <pt>, ..." - Multiple points on one path; at least 2 points are required
"[ <pt>, <pt>, ...], [ <pt>, <pt>, ...], ..." - Multiple paths
"M..." or "m..." - An SVG path; The action data is evaluated as an interpolated string for embedded JS ('${...}')
"() => {...}" - A function returning either a points array or an SVG path string.
Clears the generated & cached Path2D object (if any). Some Path
subclasses my not use the cache.
Typically the cache management is handled automatically when relevant properties are modified.
Sets element width and height property values with optional unit type specifier to use for both dimensions.
If unit
is undefined then the current unit types for each dimension remain unchanged.
Optional
unit: stringOptional
unitY: stringReturns actual pixel width of this element, either scaled to viewWidth
if width unit is %
or actual width value if it is in pixels already. If this element's width value is zero then return viewWidth
.
Returns actual pixel height of this element, either scaled to viewHeight
if height unit is %
or actual height value if it is in pixels already. If this element's height value is zero then return viewHeight
.
Returns actual pixel width and height of this element, potentially scaled to viewSize
.
See actualWidth and actualHeight for details on returned values.
When true
, path is scaled to size of drawing rectangle.
true
if a closePath()
should be used at the of each line segment when crating
paths from arrays of points (ignored for SVG paths, use 'Z'/'z' instead).
Boolean operation to perform with previous path, if any.
May be used by subclasses in their IPathProducer#getPath
method to automatically combine with other paths.
Readonly
layerA zero width/height (default) indicates to draw into the full available image area (eg. passed to render()
in rect
argument). Negative values are not allowed.
How to align within drawing area if/when width
/height
doesn't fill it completely.
Extra position offset to apply after alignment. Expressed as a percentage of overall drawing area size.
An element for drawing paths/shapes, eg. for styled drawing or for clipping. A path can be specified with either an array of points or an SVG syntax path. When using arrays of points, multiple line segments can be specified by wrapping each segment in its own array.