ShapeLibrary constructor.
One or more shape sets to include in the library.
Optionaloptions: ShapeLibraryOptionsOptions for the library.
Gets a compiled version of the given shape, creating and caching it if it does not already exist.
Shape type.
Optionalcategory: stringCategory to use. Defaults to the ID of the first category provided in the shape list.
Returns a tag definition that can be used in a Surface's tags declaration. Note that this method
returns an object containing the tag's implementation, but not the name of the tag. You can call the tag whatever you like.
OptionalstrokeWidth: numberOptionalincludeLabel: booleanGets the template for the given shape type in the given set. If no template is resolved then we return DEFAULT_TEMPLATE (and log the issue to the console).
Shape type
Name of set. If not provided, the value of DEFAULT_SET is used as the set name.
Render the given data with the appropriate template. A fill value is set on the resulting element,
and the vector-effect attribute is set to 'non scaling stroke', ie. when the shape is scaled due to
the element dimensions differing from the viewbox, the stroke does not change.
OptionalstrokeWidth: numberStroke width to use. This is passed to the underlying template and is taken into account by the shape template (or at least, it should be, because it has a bearing on the quality of the result)
OptionaltypeParameter: stringOptional key to use to look up an object's type. When not provided, the typeParameter from the class is used.
OptionalcategoryParameter: stringOptional key to use to look up an object's category. When not provided, the categoryParameter from the class is used.
Render a label element for the given data - an SVG text element.
Data to extract label from
OptionallabelProperty: stringName of the property that provides the label. Defaults to "label"
OptionalstrokeWidth: stringOptional stroke width, defaults to 0.25px
Optionallabel: stringOptional label to use, overrides extracting label from the data.
Also we keep a list of all compiled icons, but here we've stripped the category out. we use this in the event that some data doesn't have a category. then it's a lucky dip. the user gets the first icon with a matching id.
map of compiled icons. the keys of this map are set IDs. The values are maps of icon ids to compiled definitions.
Default ShapeLibrary implementation. Use one of these to manage a set of shapes for rendering into your vertices and/or for rendering as a palette from which the user can drag new objects.