Creates a stencil object.
internal stencil identifier
SVG container for all the stencil's visuals
settings for the whole diagram
Protected
Optional
SVGImageMain SVG or image element of the stencil.
Protected
_containerTop level SVG container (group) encapsulating all the visual elements of this stencil.
Protected
_defaultDefault size of the stencil when created.
Override in the descendant stencils to set a size that makes sense for the stencil type.
Protected
_fillStencil's fill color.
Protected
Optional
_frameStencil's frame path. Usually the main stencil visual.
Protected
Optional
_imageProtected
Optional
_selectorStencil's frame path for selection. Usually an extended (wider) version of the _frame.
Protected
_strokeStencil's outline (stroke) color.
Protected
_strokeProtected
_strokeStencil's outline (stroke) width in pixels.
Specifies whether stencil's fill can be changed by the user.
Stencil height.
Protected
imageLeft (x) coordinate of the stencil.
Protected
naturalNatural (real) height of the image.
Protected
naturalNatural (real) width of the image.
Optional
notesStore any arbitrary string information associated with this stencil in this field.
Protected
paddingText padding from the bounding box.
Holds a collection of connector ports for this stencil.
Specifies whether stencil's stroke properties can be changed by the user.
Text block handling the text rendering.
Text's bounding box where text should fit and/or be anchored to.
Top (y) coordinate of the stencil.
Stencil width.
Static
Protected
DEFAULT_Default text for the newly created stencil.
Static
Protected
svgInner SVG string content of an SVG image (w/o the SVG tags).
Static
titleDefault name of the stencil.
Static
typeA string representation of the type used in diagram configuration (state) JSON.
Internal stencil identifier used in state/configuration JSON as reference to this stencil.
Returns the bottom edge (y) coordinate (calculated)
Protected
centerXReturns the stencil center X coordinate (calculated).
Protected
centerYReturns the stencil center Y coordinate (calculated).
Returns stencil's text color.
Sets the stencil's text color.
Top level SVG container (group) encapsulating all the visual elements of this stencil.
Returns stencil's fill color.
Returns the stencil's font family.
Sets the stencil's font family.
Returns the right edge (x) coordinate (calculated).
Protected
settingsSettings for the whole diagram.
Returns stencil's outline (stroke) color.
Returns stencil's outline (stroke) width in pixels.
Returns the stencil's text.
Sets the stencil's text.
A string representation of the type used in diagram configuration (state) JSON.
Instance accessor returning the value of static typeName.
Protected
visualReturns the SVG group holding the stencil's visual.
Sets the stencil's visual.
Protected
addProtected
addProtected
adjustProtected
adjustProtected
createProtected
createDisables connector ports in specified locations
By default all ports are enabled. Depending on the stencil type it makes sense to disable some (or even all) of the ports.
For example DiamondStencil has all the corner ports disabled as the stencil visual has no visible parts there.
Rest
...portLocations: PortLocation[]locations of the ports to disable.
Protected
getProtected
getInstance method for getting the stencil path. Calls the static getPathD.
bounding width
bounding height
stencil's SVG path string
Returns coordinates for the port in specified location
port location
port center coordinates
Gets stencil's SVG path for the purpose of reacting to pointer and other events.
Some stencil types may have a visual that is very narrow or otherwise hard to hit with a pointer. This method provides a way to get an alternative invisible path that is easier to hit resulting in better user experience.
By default it returns the same path as the main stencil path though.
target width
target height
SVG path string
Returns stencil state (configuration) used to save the whole diagram for future use as well as for undo/redo operations.
stencil state object
Moves the stencil visual to the specified coordinates.
new stencil coordinates
Restores stencil configuration (settings) from a previously saved state.
previously saved state object.
Sets the font size.
font size
Protected
setStatic
Protected
getStatic
getReturns a simplified thumbnail representation of the stencil as an SVG image. It is used by the editor and can potentially be used in other places.
image width
image height
thumbnail as an SVG image
Static
Protected
getOptional
onFired when the stencil creation is completed.
Generated using TypeDoc
Notebook (laptop computer) image stencil.