C

SvgVisual

Wraps an SVGElement as a Visual.
Inheritance Hierarchy

Members

No filters for this type

Constructors

Creates a new instance which wraps the specified SVG element.

Parameters

element: SVGElement
The SVG element which this visual wraps.

See Also

API
from, from

Properties

Gets or sets the SVG element of this visual.

Static Methods

Creates a new TypedSvgVisual<TElement> for the given element.

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.

static

Type Parameters

TElement

The type of the element, which will typically be inferred from the argument.

Parameters

element: TElement
The element to wrap.

Return Value

TypedSvgVisual<TElement>
A properly typed SvgVisual for the given element.
Creates a new TaggedSvgVisual<TElement, TTag> for the given element and tag object.

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 TaggedSvgVisual.tag<TElement, TTag> 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.

static

Type Parameters

TElement

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

element: TElement
The element to wrap.
tag: TTag
The object to set to the SvgVisual as TaggedSvgVisual.tag<TElement, TTag>.

Return Value

TaggedSvgVisual<TElement, TTag>
A properly typed SvgVisual for the given element and tag value.
Sets the transform to a scale transform using the given parameters.
This implementation uses caching and the baseVal property of the transform attribute if possible and thus performs better than using the plain DOM API.
static

Parameters

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.
This implementation uses caching and the baseVal property of the transform attribute if possible and thus performs better than using the plain DOM API.
static

Parameters

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.