public interface SVGSVGElement extends SVGElement, SVGTests, SVGLangSpace, SVGExternalResourcesRequired, SVGStylable, SVGLocatable, SVGFitToViewBox, SVGZoomAndPan
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.ALLOW_KEYBOARD_INPUT
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
SVG_ZOOMANDPAN_DISABLE, SVG_ZOOMANDPAN_MAGNIFY, SVG_ZOOMANDPAN_UNKNOWN
Modifier and Type | Method and Description |
---|---|
boolean |
animationsPaused()
Returns true if this SVG document fragment is in a paused state.
|
boolean |
checkEnclosure(SVGElement element,
SVGRect rect)
Returns true if the rendered content of the given element is entirely contained within the supplied rectangle.
|
boolean |
checkIntersection(SVGElement element,
SVGRect rect)
Returns true if the rendered content of the given element intersects the supplied rectangle.
|
SVGAngle |
createSVGAngle()
Creates an
SVGAngle object outside of any document trees. |
SVGLength |
createSVGLength()
Creates an
SVGLength object outside of any document trees. |
SVGMatrix |
createSVGMatrix()
Creates an
SVGMatrix object outside of any document trees. |
SVGNumber |
createSVGNumber()
Creates an
SVGNumber object outside of any document trees. |
SVGPoint |
createSVGPoint()
Creates an
SVGPoint object outside of any document trees. |
SVGRect |
createSVGRect()
Creates an
SVGRect object outside of any document trees. |
SVGTransform |
createSVGTransform()
Creates an
SVGTransform object outside of any document trees. |
SVGTransform |
createSVGTransformFromMatrix(SVGMatrix matrix)
Creates an
SVGTransform object outside of any document trees. |
void |
deselectAll()
Unselects any selected objects, including any selections of text strings and type-in bars.
|
void |
forceRedraw()
In rendering environments supporting interactivity, forces the user agent to immediately redraw all regions of the viewport that require updating.
|
SVGAnimatedLength |
getAnimatedHeight()
|
SVGAnimatedLength |
getAnimatedWidth()
|
String |
getContentScriptType()
Corresponds to attribute
contentScriptType on the given <svg>
element. |
String |
getContentStyleType()
Corresponds to attribute
contentStyleType on the given <svg>
element. |
float |
getCurrentScale()
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. |
float |
getCurrentTime()
Returns the current time in seconds relative to the start time for the current SVG document fragment.
|
SVGPoint |
getCurrentTranslate()
On an outermost
<svg>
element, the corresponding translation factor that takes into account user "magnification". |
SVGViewSpec |
getCurrentView()
The definition of the initial view (i.e., before magnification and panning) of the current innermost SVG document fragment.
|
Element |
getElementById(String elementId)
Searches this SVG document fragment (i.e., the search is restricted to a subset of the document tree) for an Element whose id is given by elementId.
|
NodeList |
getEnclosureList(SVGRect rect,
SVGElement referenceElement)
Returns the list of graphics elements whose rendered content is entirely contained within the supplied rectangle.
|
NodeList |
getIntersectionList(SVGRect rect,
SVGElement referenceElement)
Returns the list of graphics elements whose rendered content intersects the supplied rectangle.
|
float |
getPixelUnitToMillimeterX()
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.
|
float |
getPixelUnitToMillimeterY()
Corresponding size of a pixel unit along the y-axis of the viewport.
|
float |
getScreenPixelToMillimeterX()
User interface (UI) events in DOM Level 2 indicate the screen positions at which the given UI event occurred.
|
float |
getScreenPixelToMillimeterY()
Corresponding size of a screen pixel along the y-axis of the viewport.
|
SVGRect |
getViewport()
The position and size of the viewport (implicit or explicit) that corresponds to this
<svg>
element. |
SVGAnimatedLength |
getX() |
SVGAnimatedLength |
getY() |
boolean |
isUseCurrentView()
|
void |
pauseAnimations()
Suspends (i.e., pauses) all currently running animations that are defined within the SVG document fragment corresponding to this
<svg>
element, causing the animation clock corresponding to this document fragment to stand still until it is unpaused. |
void |
setContentScriptType(String arg) |
void |
setContentStyleType(String arg) |
void |
setCurrentScale(float arg) |
void |
setCurrentTime(float seconds)
Adjusts the clock for this SVG document fragment, establishing a new current time.
|
int |
suspendRedraw(int maxWaitMilliseconds)
Takes a time-out value which indicates that redraw shall not occur until:
|
void |
unpauseAnimations()
Unsuspends (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.
|
void |
unsuspendRedraw(int suspendHandleId)
Cancels a specified
suspendRedraw() by providing a unique suspend handle ID that was returned by a previous suspendRedraw() call. |
void |
unsuspendRedrawAll()
Cancels all currently active
suspendRedraw() method calls. |
getId, getOwnerSVGElement, getViewportElement, getXmlbase, setId, setXmlbase
blur, click, focus, getAccessKey, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getBoundingClientRect, getChildElementCount, getChildren, getClassList, getClassName, getClientHeight, getClientLeft, getClientRects, getClientTop, getClientWidth, getContentEditable, getDataset, getDir, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getInnerHTML, getInnerText, getLang, getLastElementChild, getNextElementSibling, getOffsetHeight, getOffsetLeft, getOffsetParent, getOffsetTop, getOffsetWidth, getOnabort, getOnbeforecopy, getOnbeforecut, getOnbeforepaste, getOnblur, getOnchange, getOnclick, getOncontextmenu, getOncopy, getOncut, getOndblclick, getOndrag, getOndragend, getOndragenter, getOndragleave, getOndragover, getOndragstart, getOndrop, getOnerror, getOnfocus, getOninput, getOninvalid, getOnkeydown, getOnkeypress, getOnkeyup, getOnload, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnmousewheel, getOnpaste, getOnreset, getOnscroll, getOnsearch, getOnselect, getOnselectstart, getOnsubmit, getOntouchcancel, getOntouchend, getOntouchmove, getOntouchstart, getOnwebkitfullscreenchange, getOnwebkitfullscreenerror, getOuterHTML, getOuterText, getPreviousElementSibling, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getStyle, getTabIndex, getTagName, getTitle, getWebkitdropzone, getWebkitRegionOverflow, hasAttribute, hasAttributeNS, insertAdjacentElement, insertAdjacentHTML, insertAdjacentText, isContentEditable, isDraggable, isHidden, isSpellcheck, isTranslate, querySelector, querySelectorAll, removeAttribute, removeAttributeNode, removeAttributeNS, scrollByLines, scrollByPages, scrollIntoView, scrollIntoView, scrollIntoViewIfNeeded, scrollIntoViewIfNeeded, setAccessKey, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setClassName, setContentEditable, setDir, setDraggable, setHidden, setInnerHTML, setInnerText, setLang, setOnabort, setOnbeforecopy, setOnbeforecut, setOnbeforepaste, setOnblur, setOnchange, setOnclick, setOncontextmenu, setOncopy, setOncut, setOndblclick, setOndrag, setOndragend, setOndragenter, setOndragleave, setOndragover, setOndragstart, setOndrop, setOnerror, setOnfocus, setOninput, setOninvalid, setOnkeydown, setOnkeypress, setOnkeyup, setOnload, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnmousewheel, setOnpaste, setOnreset, setOnscroll, setOnsearch, setOnselect, setOnselectstart, setOnsubmit, setOntouchcancel, setOntouchend, setOntouchmove, setOntouchstart, setOnwebkitfullscreenchange, setOnwebkitfullscreenerror, setOuterHTML, setOuterText, setScrollLeft, setScrollTop, setSpellcheck, setTabIndex, setTitle, setTranslate, setWebkitdropzone, webkitMatchesSelector, webkitRequestFullscreen, webkitRequestFullScreen
addEventListener, addEventListener, appendChild, cloneNode, compareDocumentPosition, contains, dispatchEvent, getAttributes, getBaseURI, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentElement, getParentNode, getPrefix, getPreviousSibling, getTextContent, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, removeEventListener, removeEventListener, replaceChild, setNodeValue, setPrefix, setTextContent
getRequiredExtensions, getRequiredFeatures, getSystemLanguage, hasExtension
getXmllang, getXmlspace, setXmllang, setXmlspace
getExternalResourcesRequired
getAnimatedClassName, getPresentationAttribute, getSvgStyle
getBBox, getCTM, getFarthestViewportElement, getNearestViewportElement, getScreenCTM, getTransformToElement
getPreserveAspectRatio, getViewBox
getZoomAndPan, setZoomAndPan
String getContentScriptType()
contentScriptType
on the given <svg>
element.void setContentScriptType(String arg)
String getContentStyleType()
contentStyleType
on the given <svg>
element.void setContentStyleType(String arg)
float getCurrentScale()
<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).void setCurrentScale(float arg)
SVGPoint getCurrentTranslate()
<svg>
element, the corresponding translation factor that takes into account user "magnification".SVGViewSpec getCurrentView()
viewBox
,
preserveAspectRatio
and
zoomAndPan
within
currentView
will match the values for the corresponding DOM attributes that are on SVGSVGElement
directlytransform
and
viewTarget
within
currentView
will be null<view>
element, then: viewBox
,
preserveAspectRatio
and
zoomAndPan
within
currentView
will correspond to the corresponding attributes for the given <view>
elementtransform
and
viewTarget
within
currentView
will be null<view>
), then: viewBox
,
preserveAspectRatio
and
zoomAndPan
within
currentView
will match the values for the corresponding DOM attributes that are on SVGSVGElement
directly for the closest ancestor <svg>
elementtransform
within
currentView
will be nullviewTarget
within
currentView
will represent the target of the linkviewBox
,
preserveAspectRatio
,
zoomAndPan
,
transform
and
viewTarget
within
currentView
will correspond to the values from the SVG view specification fragment identifierSVGAnimatedLength getAnimatedHeight()
float getPixelUnitToMillimeterX()
float getPixelUnitToMillimeterY()
float getScreenPixelToMillimeterX()
float getScreenPixelToMillimeterY()
boolean isUseCurrentView()
<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.SVGRect getViewport()
<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.)SVGAnimatedLength getAnimatedWidth()
SVGAnimatedLength getX()
SVGAnimatedLength getY()
boolean animationsPaused()
boolean checkEnclosure(SVGElement element, SVGRect rect)
pointer-events
processing.boolean checkIntersection(SVGElement element, SVGRect rect)
pointer-events
processing.SVGAngle createSVGAngle()
SVGAngle
object outside of any document trees. The object is initialized to a value of zero degrees (unitless).SVGLength createSVGLength()
SVGLength
object outside of any document trees. The object is initialized to a value of zero user units.SVGMatrix createSVGMatrix()
SVGMatrix
object outside of any document trees. The object is initialized to the identity matrix.SVGNumber createSVGNumber()
SVGNumber
object outside of any document trees. The object is initialized to a value of zero.SVGPoint createSVGPoint()
SVGPoint
object outside of any document trees. The object is initialized to the point (0,0) in the user coordinate system.SVGRect createSVGRect()
SVGRect
object outside of any document trees. The object is initialized such that all values are set to 0 user units.SVGTransform createSVGTransform()
SVGTransform
object outside of any document trees. The object is initialized to an identity matrix transform (SVG_TRANSFORM_MATRIX
).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
.void deselectAll()
void forceRedraw()
float getCurrentTime()
<script>
element before the document's SVGLoad event is dispatched), then 0 is returned.Element getElementById(String elementId)
NodeList getEnclosureList(SVGRect rect, SVGElement referenceElement)
pointer-events
processing.NodeList getIntersectionList(SVGRect rect, SVGElement referenceElement)
pointer-events
processing.void pauseAnimations()
<svg>
element, causing the animation clock corresponding to this document fragment to stand still until it is unpaused.void setCurrentTime(float 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.int suspendRedraw(int maxWaitMilliseconds)
Takes a time-out value which indicates that redraw shall not occur until:
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.
void unpauseAnimations()
void unsuspendRedraw(int suspendHandleId)
suspendRedraw()
by providing a unique suspend handle ID that was returned by a previous suspendRedraw()
call.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.Copyright © 2018. All rights reserved.