class js.html.svg.SVGElement extends Element
Available on js
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.
Documentation for this class was provided by MDN.
Instance Fields
var currentScale:Float
On an outermost <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).
On an outermost <svg>
element, the corresponding translation factor that takes into account user "magnification".
var currentView:ViewSpec
The definition of the initial view (i.e., before magnification and panning) of the current innermost SVG document fragment. The meaning depends on the situation:
- 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
var pixelUnitToMillimeterX:Float
Size of a pixel units (as defined by CSS2) along the x-axis of the viewport, which represents a unit somewhere in the range of 70dpi to 120dpi, and, on systems that support this, might actually match the characteristics of the target medium. On systems where it is impossible to know the size of a pixel, a suitable default pixel size is provided.
var pixelUnitToMillimeterY:Float
Corresponding size of a pixel unit along the y-axis of the viewport.
var screenPixelToMillimeterX:Float
User interface (UI) events in DOM Level 2 indicate the screen positions at which the given UI event occurred. When the browser actually knows the physical size of a "screen unit", this attribute will express that information; otherwise, user agents will provide a suitable default value such as .28mm.
var screenPixelToMillimeterY:Float
Corresponding size of a screen pixel along the y-axis of the viewport.
var useCurrentView:Bool
The initial view (i.e., before magnification and panning) of the current innermost SVG document fragment can be either the "standard" view (i.e., based on attributes on the <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.
The position and size of the viewport (implicit or explicit) that corresponds to this <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.)