Table of Contents

Class SVGSVGElement

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The SVGSVGElement interface provides access to the properties of svg elements, as well as methods to manipulate them. This interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices.

[Value("SVGSVGElement")]
public class SVGSVGElement : SVGGraphicsElement, ElementCSSInlineStyle, GlobalEventHandlers, SVGElementInstance, HTMLOrSVGElement, SVGTests
Inheritance
SVGSVGElement
Implements
Inherited Members

Remarks

Constructors

SVGSVGElement()

public SVGSVGElement()

Properties

CurrentScale

The currentScale property of the SVGSVGElement interface reflects the current scale factor relative to the initial view to take into account user magnification and panning operations on the outermost {{SVGElement("svg")}} element.

[Value("currentScale")]
public Number CurrentScale { get; set; }

Property Value

Number

A float.

Remarks

DOM attributes currentScale and currentTranslate are equivalent to the 2×3 matrix [a b c d e f] = [currentScale 0 0 currentScale currentTranslate.x currentTranslate.y]. If "magnification" is enabled (i.e., zoomAndPan="magnify"), then the effect is as if an extra transformation were placed at the outermost level on the SVG document fragment (i.e., outside the outermost svg element).

If the svg element is not at the outermost level, then currentScale is always 1 and setting it has no effect.

-CurrentTranslate

See also on MDN

CurrentTranslate

The currentTranslate read-only property of the SVGSVGElement interface reflects the translation factor that takes into account user "magnification" corresponding to an outermost {{SVGElement("svg")}} element.

[Value("currentTranslate")]
public DOMPointReadOnly CurrentTranslate { get; }

Property Value

DOMPointReadOnly

A DOMPointReadOnly.

Remarks

If the svg element is not at the outermost level, then currentTranslate is always { x: 0, y: 0 } and is read-only. Otherwise, it is writable.

-CurrentScale
-DOMPointReadOnly

See also on MDN

Height

The height read-only property of the SVGSVGElement interface describes the vertical size of element as an SVGAnimatedLength. It reflects the {{SVGElement("svg")}} element's {{SVGAttr("height")}} attribute, which may not be the SVG's rendered height.

[Value("height")]
public SVGAnimatedLength Height { get; }

Property Value

SVGAnimatedLength

An SVGAnimatedLength.

Remarks

The CSS height property takes precedence over the <svg> element's height attribute, so the value may not reflect the element's appearance. If both the viewBox and height attributes are omitted, the height property reflects that actual height.

-SVGSVGElement.ViewBox
-Width
-BaseVal

See also on MDN

Width

The width read-only property of the SVGSVGElement interface describes the horizontal size of element as an SVGAnimatedLength. It reflects the {{SVGElement("svg")}} element's {{SVGAttr("width")}} attribute, which may not be the SVG's rendered width.

[Value("width")]
public SVGAnimatedLength Width { get; }

Property Value

SVGAnimatedLength

An SVGAnimatedLength.

Remarks

The CSS width property takes precedence over the <svg> element's width attribute, so the value may not reflect the element's appearance. If both the viewBox and width attributes are omitted, the width property reflects that actual width.

-SVGSVGElement.ViewBox
-BaseVal

See also on MDN

X

The x read-only property of the SVGSVGElement interface describes the horizontal coordinate of the position of that SVG as an SVGAnimatedLength. When an {{SVGElement("svg")}} is nested within another <svg>, the horizontal coordinate is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the x-axis. Its syntax is the same as that for <length>.

[Value("x")]
public SVGAnimatedLength X { get; }

Property Value

SVGAnimatedLength

An SVGAnimatedLength.

Remarks

It reflects the svg element's {{SVGAttr("x")}} geometric attribute. The default value is 0. The x attribute has no effect on outermost <svg> elements; only one nested ones. The CSS x property takes precedence over the <svg> element's x attribute, so the value may not reflect the element's appearance.

-Y
-BaseVal

See also on MDN

Y

The y read-only property of the SVGSVGElement interface describes the vertical coordinate of the position of that SVG as an SVGAnimatedLength. When an {{SVGElement("svg")}} is nested within another <svg>, the vertical coordinate is a length in the user coordinate system that is the given distance from the origin of the user coordinate system along the y-axis. Its syntax is the same as that for <length>.

[Value("y")]
public SVGAnimatedLength Y { get; }

Property Value

SVGAnimatedLength

An SVGAnimatedLength.

Remarks

It reflects the svg element's {{SVGAttr("y")}} geometric attribute. The default value is 0. The y attribute has no effect on outermost <svg> elements; only on nested ones. The CSS y property takes precedence over the <svg> element's y attribute, so the value may not reflect the element's appearance.

-X
-BaseVal

See also on MDN

Methods

AnimationsPaused()

The animationsPaused() method of the SVGSVGElement interface checks whether the animations in the SVG document fragment are currently paused.

[Value("animationsPaused")]
public bool AnimationsPaused()

Returns

bool

A boolean. true if this SVG document fragment is in a paused state.

Remarks

CheckEnclosure(SVGElement, DOMRectReadOnly)

The checkEnclosure() method of the SVGSVGElement interface checks if the rendered content of the given element is entirely contained within the supplied rectangle.

[Value("checkEnclosure")]
public bool CheckEnclosure(SVGElement element, DOMRectReadOnly rect)

Parameters

element SVGElement
rect DOMRectReadOnly

Returns

bool

A boolean.

Remarks

Each candidate graphics element is to be considered a match only if the same graphics element can be a target of pointer events as defined in pointer-events processing.

-CheckIntersection(SVGElement, DOMRectReadOnly)

See also on MDN

CheckIntersection(SVGElement, DOMRectReadOnly)

The checkIntersection() method of the SVGSVGElement interface checks if the rendered content of the given element intersects the supplied rectangle.

[Value("checkIntersection")]
public bool CheckIntersection(SVGElement element, DOMRectReadOnly rect)

Parameters

element SVGElement
rect DOMRectReadOnly

Returns

bool

A boolean.

Remarks

Each candidate graphics element is to be considered a match only if the same graphics element can be a target of pointer events as defined in pointer-events processing.

-CheckEnclosure(SVGElement, DOMRectReadOnly)

See also on MDN

CreateSVGAngle()

The createSVGAngle() method of the SVGSVGElement interface creates an SVGAngle object outside of any document trees.

[Value("createSVGAngle")]
public SVGAngle CreateSVGAngle()

Returns

SVGAngle

An SVGAngle object, initialized to a value of 0 (unitless).

Remarks

CreateSVGLength()

The createSVGLength() method of the SVGSVGElement interface creates an SVGLength object outside of any document trees.

[Value("createSVGLength")]
public SVGLength CreateSVGLength()

Returns

SVGLength

An SVGLength object, initialized to a value of 0 (unitless).

Remarks

CreateSVGMatrix()

The createSVGMatrix() method of the SVGSVGElement interface creates a DOMMatrix object outside of any document trees.

[Value("createSVGMatrix")]
public DOMMatrix CreateSVGMatrix()

Returns

DOMMatrix

A DOMMatrix object, initialized to the identity matrix.

Remarks

CreateSVGNumber()

The createSVGNumber() method of the SVGSVGElement interface creates an SVGNumber object outside of any document trees.

[Value("createSVGNumber")]
public SVGNumber CreateSVGNumber()

Returns

SVGNumber

An SVGNumber object, initialized to 0.

Remarks

CreateSVGPoint()

The createSVGPoint() method of the SVGSVGElement interface creates a DOMPoint object outside of any document trees.

[Value("createSVGPoint")]
public DOMPoint CreateSVGPoint()

Returns

DOMPoint

An DOMPoint object, initialized to the point (0,0) in the user coordinate system.

Remarks

CreateSVGRect()

The createSVGRect() method of the SVGSVGElement interface creates an DOMRect object outside of any document trees.

[Value("createSVGRect")]
public DOMRect CreateSVGRect()

Returns

DOMRect

A DOMRect object, initialized with x, y, width, and height all set to 0.

Remarks

CreateSVGTransform()

The createSVGTransform() method of the SVGSVGElement interface creates an SVGTransform object outside of any document trees.

[Value("createSVGTransform")]
public SVGTransform CreateSVGTransform()

Returns

SVGTransform

An SVGTransform object, initialized to the identity matrix transform (matrix(1, 0, 0, 1, 0, 0)).

Remarks

CreateSVGTransformFromMatrix(DOMMatrix2DInit)

The createSVGTransformFromMatrix() method of the SVGSVGElement interface creates an SVGTransform object outside of any document trees, based on the given DOMMatrix object.

[Value("createSVGTransformFromMatrix")]
public SVGTransform CreateSVGTransformFromMatrix(DOMMatrix2DInit matrix = null)

Parameters

matrix DOMMatrix2DInit

Returns

SVGTransform

An SVGTransform object, initialized to the given matrix transform. It is a matrix() transform if the matrix is 2D, and a matrix3d() transform otherwise.

Remarks

DeselectAll()

The deselectAll() method of the SVGSVGElement interface unselects any selected objects, including any selections of text strings and type-in bars.

[Value("deselectAll")]
public GlobalObject.Undefined DeselectAll()

Returns

GlobalObject.Undefined

None.

Remarks

ForceRedraw()

[Value("forceRedraw")]
public GlobalObject.Undefined ForceRedraw()

Returns

GlobalObject.Undefined

GetCurrentTime()

The getCurrentTime() method of the SVGSVGElement interface returns the current time in seconds relative to the start time for the current SVG document fragment.

[Value("getCurrentTime")]
public Number GetCurrentTime()

Returns

Number

A float.

Remarks

If getCurrentTime() is called before the document timeline has begun (for example, by script running in a script element before the document's SVGLoad event is dispatched), then 0 is returned.

See also on MDN

GetElementById(string)

The getElementById() method of the SVGSVGElement interface searches the SVG document fragment (i.e., the search is restricted to a subset of the document tree) for an Element whose id property matches the specified string.

[Value("getElementById")]
public Element GetElementById(string elementId)

Parameters

elementId string

Returns

Element

An Element object describing the DOM element object matching the specified ID, or null if no matching element was found in the SVG document fragment.

Remarks

GetEnclosureList(DOMRectReadOnly, SVGElement?)

[Value("getEnclosureList")]
public NodeList GetEnclosureList(DOMRectReadOnly rect, SVGElement? referenceElement)

Parameters

rect DOMRectReadOnly
referenceElement SVGElement

Returns

NodeList

GetIntersectionList(DOMRectReadOnly, SVGElement?)

[Value("getIntersectionList")]
public NodeList GetIntersectionList(DOMRectReadOnly rect, SVGElement? referenceElement)

Parameters

rect DOMRectReadOnly
referenceElement SVGElement

Returns

NodeList

PauseAnimations()

The pauseAnimations() method of the SVGSVGElement interface suspends (i.e., pauses) all currently running animations that are defined within the SVG document fragment corresponding to this {{SVGElement("svg")}} element, causing the animation clock corresponding to this document fragment to stand still until it is unpaused.

[Value("pauseAnimations")]
public GlobalObject.Undefined PauseAnimations()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

SetCurrentTime(Number)

The setCurrentTime() method of the SVGSVGElement interface adjusts the clock for this SVG document fragment, establishing a new current time.

[Value("setCurrentTime")]
public GlobalObject.Undefined SetCurrentTime(Number seconds)

Parameters

seconds Number

Returns

GlobalObject.Undefined

None.

Remarks

If setCurrentTime() is called before the document timeline has begun (for example, by script running in a script element before the document's SVGLoad event is dispatched), then the value of seconds in the last invocation of the method gives the time that the document will seek to once the document timeline has begun.

See also on MDN

SuspendRedraw(ulong)

[Value("suspendRedraw")]
public ulong SuspendRedraw(ulong maxWaitMilliseconds)

Parameters

maxWaitMilliseconds ulong

Returns

ulong

UnpauseAnimations()

The unpauseAnimations() method of the SVGSVGElement interface resumes (i.e., unpauses) currently running animations that are defined within the SVG document fragment, causing the animation clock to continue from the time at which it was suspended.

[Value("unpauseAnimations")]
public GlobalObject.Undefined UnpauseAnimations()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

UnsuspendRedraw(ulong)

[Value("unsuspendRedraw")]
public GlobalObject.Undefined UnsuspendRedraw(ulong suspendHandleID)

Parameters

suspendHandleID ulong

Returns

GlobalObject.Undefined

UnsuspendRedrawAll()

[Value("unsuspendRedrawAll")]
public GlobalObject.Undefined UnsuspendRedrawAll()

Returns

GlobalObject.Undefined