Classes that implement this interface can be placed in the SVGs defs section by the SvgDefsManager.
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 that was assigned to it can be queried using the getDefsId method when the ISvgDefsCreator object is passed in that was used to create the element.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.view.ISvgDefsCreator
Methods
Checks if the specified node references the element represented by this object.
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- The current canvas context.
- node - Node
- The SVG node.
- id - string
- The defs id that has been stored for this instance by the provided context.
Returns
- ↪boolean
true
ifnode
references the element represented by this instance.
Creates the element that is put into the defs section of the SVG element.
Parameters
A map of options to pass to the method.
- context - ICanvasContext
- The canvas context that can be used to register brushes etc.
Returns
- ↪SVGElement
- An SVGElement that can be put into the defs section of the SVG element.
Updates the defs element with the current gradient data.
Static Methods
Creates an implementation of the interface ISvgDefsCreator from the given definition.
Remarks
Parameters
A map of options to pass to the method.
- updateDefsElement - function(ICanvasContext, SVGElement):void
Updates the defs element with the current gradient data.
This property holds the implementation for updateDefsElement.
- createDefsElement - function(ICanvasContext):SVGElement
Creates the element that is put into the defs section of the SVG element.
This property holds the implementation for createDefsElement.
- accept - function(ICanvasContext, Node, string):boolean
Checks if the specified node references the element represented by this object.
This property holds the implementation for accept.
Returns
- ↪ISvgDefsCreator
- An instance of the ISvgDefsCreator interface based on the given definition.
Determine whether the given element has an attribute with the given name that references the id in the defs element.
Parameters
A map of options to pass to the method.
- element - Element
- The element to inspect
- attributeName - string
- The attribute to check
- defsId - string
- The id in the defs section
Returns
- ↪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.
Remarks
node
matches <use href="#{id}">. If the given id
does not start with a '#', it is prepended automatically.Parameters
A map of options to pass to the method.
- node - Node
- The DOM node to inspect.
- id - string
- The id of the referenced element.
Returns
- ↪boolean
true
if the specified element references the element; otherwise,false
.