Wraps an SVGElement as a Visual.
Type Details
- yfiles module
- view-component
- yfiles-umd modules
- All view modules
- Legacy UMD name
- yfiles.view.SvgVisual
See Also
Constructors
Creates a new instance which wraps the specified SVG element.
Parameters
A map of options to pass to the method.
- element - SVGElement
- The SVG element which this visual wraps.
See Also
Properties
Gets or sets the SVG element of this visual.
Static Methods
Creates a new TypedSvgVisual<TElement> for the given element
.
Remarks
The purpose of this factory method is to get an instance of SvgVisual but with a better matching type for the svgElement property.
Note that this method still returns an instance of the SvgVisual class, since TypedSvgVisual<TElement> is just a typeScript type. The main benefit is the added type-safety.
Type Parameters
- TElement: SVGElement
- The type of the element, which will typically be inferred from the argument.
Parameters
A map of options to pass to the method.
- element - TElement
- The element to wrap.
Returns
- ↪TypedSvgVisual<TElement>
- A properly typed SvgVisual for the given element.
See Also
from
<TElementextends SVGElement,TTag>(element: TElement, tag: TTag) : TaggedSvgVisual<TElement,TTag>Creates a new TaggedSvgVisual<TElement,TTag> for the given element
and tag
object.
Remarks
The purpose of this factory method is to get an instance of SvgVisual but with a better matching type of the svgElement property and the ability to store an user-provided object as tag with type-safety.
Note that this method still returns an instance of the SvgVisual class, since TaggedSvgVisual<TElement,TTag> is just a typeScript type. The main benefit is the added type-safety.
Type Parameters
- TElement: SVGElement
- The type of the element, typically inferred from the first argument.
- TTag
- The type of the cache value, typically inferred from the second argument.
Parameters
A map of options to pass to the method.
- element - TElement
- The element to wrap.
- tag - TTag
Returns
- ↪TaggedSvgVisual<TElement,TTag>
- A properly typed SvgVisual for the given element and tag value.
See Also
Sets the transform to a scale transform using the given parameters.
Remarks
transform
attribute if possible and thus performs better than using the plain DOM API.Parameters
A map of options to pass to the method.
- transformable - Element
- The SVG element that should be translated.
- scaleX - number
- The vertical scale.
- scaleY - number
- The horizontal scale.
Sets the transform to a translate transform using the given parameters.
Remarks
transform
attribute if possible and thus performs better than using the plain DOM API.Parameters
A map of options to pass to the method.
- transformable - Element
- The SVG element that should be translated.
- dx - number
- The offset on the x-axis.
- dy - number
- The offset on the y-axis.