SVGSVGElement Interface
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.
Extends
SVGZoomAndPan, SVGLangSpace, SVGFitToViewBox, SVGStylable, SVGExternalResourcesRequired, SVGTests, SVGLocatable, SVGElement
Constructors
Code new SVGSVGElement() #
SVGSVGElement();
Methods
Code bool animationsPaused() #
bool animationsPaused();
Code bool checkEnclosure(SVGElement element, SVGRect rect) #
pointer-events
processing.
bool checkEnclosure(SVGElement element, SVGRect rect);
Code bool checkIntersection(SVGElement element, SVGRect rect) #
pointer-events
processing.
bool checkIntersection(SVGElement element, SVGRect rect);
Code SVGAngle createSVGAngle() #
SVGAngle
object outside of any document trees. The object is initialized to a value of zero degrees (unitless).
SVGAngle createSVGAngle();
Code SVGLength createSVGLength() #
SVGLength
object outside of any document trees. The object is initialized to a value of zero user units.
SVGLength createSVGLength();
Code SVGMatrix createSVGMatrix() #
SVGMatrix
object outside of any document trees. The object is initialized to the identity matrix.
SVGMatrix createSVGMatrix();
Code SVGNumber createSVGNumber() #
SVGNumber
object outside of any document trees. The object is initialized to a value of zero.
SVGNumber createSVGNumber();
Code SVGPoint createSVGPoint() #
SVGPoint
object outside of any document trees. The object is initialized to the point (0,0) in the user coordinate system.
SVGPoint createSVGPoint();
Code SVGRect createSVGRect() #
SVGRect
object outside of any document trees. The object is initialized such that all values are set to 0 user units.
SVGRect createSVGRect();
Code SVGTransform createSVGTransform() #
SVGTransform
object outside of any document trees. The object is initialized to an identity matrix transform (SVG_TRANSFORM_MATRIX
).
SVGTransform createSVGTransform();
Code SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix) #
SVGTransform
object outside of any document trees. The object is initialized to the given matrix transform (i.e., SVG_TRANSFORM_MATRIX
). The values from the parameter matrix are copied, the matrix parameter is not adopted as SVGTransform::matrix
.
SVGTransform createSVGTransformFromMatrix(SVGMatrix matrix);
Code void deselectAll() #
void deselectAll();
Code void forceRedraw() #
void forceRedraw();
Code num getCurrentTime() #
<script>
element before the document's SVGLoad event is dispatched), then 0 is returned.
num getCurrentTime();
Code Element getElementById(String elementId) #
Element getElementById(String elementId);
Code NodeList getEnclosureList(SVGRect rect, SVGElement referenceElement) #
pointer-events
processing.
NodeList getEnclosureList(SVGRect rect, SVGElement referenceElement);
Code NodeList getIntersectionList(SVGRect rect, SVGElement referenceElement) #
pointer-events
processing.
NodeList getIntersectionList(SVGRect rect, SVGElement referenceElement);
Code void pauseAnimations() #
Code void setCurrentTime(num seconds) #
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.
void setCurrentTime(num seconds);
Code int suspendRedraw(int maxWaitMilliseconds) #
Takes a time-out value which indicates that redraw shall not occur until:
- the corresponding unsuspendRedraw() call has been made,
- an unsuspendRedrawAll() call has been made, or
- its timer has timed out.
In environments that do not support interactivity (e.g., print media), then redraw shall not be suspended. Calls to suspendRedraw()
and unsuspendRedraw()
should, but need not be, made in balanced pairs.
To suspend redraw actions as a collection of SVG DOM changes occur, precede the changes to the SVG DOM with a method call similar to:
suspendHandleID = suspendRedraw(maxWaitMilliseconds);
and follow the changes with a method call similar to:
unsuspendRedraw(suspendHandleID);
Note that multiple suspendRedraw calls can be used at once and that each such method call is treated independently of the other suspendRedraw method calls.
int suspendRedraw(int maxWaitMilliseconds);
Code void unpauseAnimations() #
void unpauseAnimations();
Code void unsuspendRedraw(int suspendHandleId) #
suspendRedraw()
by providing a unique suspend handle ID that was returned by a previous suspendRedraw()
call.
void unsuspendRedraw(int suspendHandleId);
Code void unsuspendRedrawAll() #
suspendRedraw()
method calls. This method is most useful at the very end of a set of SVG DOM calls to ensure that all pending suspendRedraw()
method calls have been cancelled.
void unsuspendRedrawAll();
Fields
Code num currentScale #
<svg>
element, this attribute indicates the current scale factor relative to the initial view to take into account user magnification and panning operations. DOM attributes currentScale
and currentTranslate
are equivalent to the 2x3 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).
num currentScale;
Code final SVGViewSpec currentView #
- If the initial view was a "standard" view, then:
- the values for
viewBox
,preserveAspectRatio
andzoomAndPan
withincurrentView
will match the values for the corresponding DOM attributes that are onSVGSVGElement
directly - the values for
transform
andviewTarget
withincurrentView
will be null
- the values for
- If the initial view was a link into a
<view>
element, then:- the values for
viewBox
,preserveAspectRatio
andzoomAndPan
withincurrentView
will correspond to the corresponding attributes for the given<view>
element - the values for
transform
andviewTarget
withincurrentView
will be null
- the values for
- If the initial view was a link into another element (i.e., other than a
<view>
), then:- the values for
viewBox
,preserveAspectRatio
andzoomAndPan
withincurrentView
will match the values for the corresponding DOM attributes that are onSVGSVGElement
directly for the closest ancestor<svg>
element - the values for
transform
withincurrentView
will be null - the
viewTarget
withincurrentView
will represent the target of the link
- the values for
- If the initial view was a link into the SVG document fragment using an SVG view specification fragment identifier (i.e., #svgView(...)), then:
- the values for
viewBox
,preserveAspectRatio
,zoomAndPan
,transform
andviewTarget
withincurrentView
will correspond to the values from the SVG view specification fragment identifier
- the values for
final SVGViewSpec currentView;
Code final SVGAnimatedLength height #
Code final num pixelUnitToMillimeterX #
final num pixelUnitToMillimeterX;
Code final num pixelUnitToMillimeterY #
final num pixelUnitToMillimeterY;
Code final num screenPixelToMillimeterX #
final num screenPixelToMillimeterX;
Code final num screenPixelToMillimeterY #
final num screenPixelToMillimeterY;
Code final bool useCurrentView #
<svg>
element such as
viewBox
) or to a "custom" view (i.e., a hyperlink into a particular <view>
or other element). If the initial view is the "standard" view, then this attribute is false. If the initial view is a "custom" view, then this attribute is true.
final bool useCurrentView;
Code final SVGRect viewport #
<svg>
element. When the browser is actually rendering the content, then the position and size values represent the actual values when rendering. The position and size values are unitless values in the coordinate system of the parent element. If no parent element exists (i.e., <svg>
element represents the root of the document tree), if this SVG document is embedded as part of another document (e.g., via the HTML <object>
element), then the position and size are unitless values in the coordinate system of the parent document. (If the parent uses CSS or XSL layout, then unitless values represent pixel units for the current CSS or XSL viewport.)
final SVGRect viewport;
Code final SVGAnimatedLength width #
Code final SVGAnimatedLength x #
final SVGAnimatedLength x;
Code final SVGAnimatedLength y #
final SVGAnimatedLength y;
This page includes content from the Mozilla Foundation that is graciously licensed under a Creative Commons: Attribution-Sharealike license. Mozilla has no other association with Dart or dartlang.org. We encourage you to improve the web by contributing to The Mozilla Developer Network.