I

ISvgDefsCreator

Implementations of this interface are responsible for creating entries in the SVGs defs section that can be shared by SvgVisuals.
Inheritance Hierarchy

Remarks

The SvgDefsManager can then create and update an element that can be used with an SVG use element. The interface is also used to help the SvgDefsManager to find unused elements that can be removed from the defs section.

When an element is created using this interface, the SvgDefsManager assigns an ID to it that is required to reference it through an SVG use element. The ID assigned to it can be queried using the getDefsId method when the ISvgDefsCreator object is passed in that was used to create the element.

Members

No filters for this type

Methods

Callback method that checks if the specified node references the element represented by this instance.
SvgDefsManager iterates elements during cleanUpDefs in the SVG DOM and calls this method to check if the element references the defs element createDefsElement created by this instance. If no element is accepted by this method, the created element will become eligible for removal from the defs section.
abstract

Parameters

context: ICanvasContext
The current canvas context.
node: Node
One SVG node from the SVG DOM.
id: string
The defs id that has been stored for this instance by the provided context.

Return Value

boolean
true if node references the element represented by this instance.

See Also

API
isUseReference, isAttributeReference
Creates the element put into the defs section of the SVG element.
Note that this method should not add an id to the element. The caller performs this.
abstract

Parameters

context: ICanvasContext
The canvas context for which this element is created..

Return Value

SVGElement
An SVGElement that can be put into the defs section of the SVG element. Without an id attribute.
Updates the defs element with the current values, optionally.
This method is called for each instance once per updateVisual call.
abstract

Parameters

context: ICanvasContext
The context within the elements are updated.
oldElement: SVGElement
The element to possibly update.

Static Methods

static

Parameters

Return Value

ISvgDefsCreator
Determine whether the given element has an attribute with the given name that references the id in the defs element.
static

Parameters

element: Element
The element to inspect
attributeName: string
The attribute to check
defsId: string
The id in the defs section

Return Value

boolean
Whether the attribute is equal to "url(#{defsId})"
Checks whether the given DOM node is an SVG use element that references an element with the specified id in the local DOM.
Checks if node matches <use href="#{id}">. If the given id does not start with a '#', it is prepended automatically.
static

Parameters

node: Node
The DOM node to inspect.
id: string
The id of the referenced element.

Return Value

boolean
true if the specified element references the element; otherwise, false.