Source code

Revision control

Copy as Markdown

Other Tools

<!DOCTYPE html>
<html lang='en'>
<head>
<title>types-dom-01-b-manual.svg</title>
<meta charset='utf-8'>
</head>
<body>
<h1>Source SVG: types-dom-01-b-manual.svg</h1>
<svg version="1.1" baseProfile="tiny" onload="testSVGLocatable()" id="svg-root"
width="100%" height="100%" viewBox="0 0 480 360"
<!--======================================================================-->
<!--= SVG 1.1 2nd Edition Test Case =-->
<!--======================================================================-->
<!--= Copyright 2009 World Wide Web Consortium, (Massachusetts =-->
<!--= Institute of Technology, European Research Consortium for =-->
<!--= Informatics and Mathematics (ERCIM), Keio University). =-->
<!--= All Rights Reserved. =-->
<!--======================================================================-->
<title id="test-title">$RCSfile: types-dom-01-b.svg,v $</title>
<defs>
<font-face font-family="SVGFreeSansASCII" unicode-range="U+0-7F">
<font-face-src>
<font-face-uri xlink:href="../resources/SVGFreeSans.svg#ascii"/>
</font-face-src>
</font-face>
</defs>
<g id="test-body-content" font-family="SVGFreeSansASCII,sans-serif" font-size="18">
<script type="text/ecmascript">
function testSVGLocatable() {
var rotText = document.getElementById("rotatedText");
var blueCircle = document.getElementById("blueCircle")
var matr = rotText.getScreenCTM();
document.getElementById("result1").firstChild.nodeValue = ".getScreenCTM(): " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixed(2) + "," + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(2);
var matr = rotText.getCTM();
document.getElementById("result2").firstChild.nodeValue = ".getCTM(): " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixed(2) + "," + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(2);
var matr = rotText.getTransformToElement(document.getElementById("parentGroup"));
document.getElementById("result3").firstChild.nodeValue = ".getTransformToElement(): " + matr.a.toFixed(2) + "," + matr.b.toFixed(2) + "," + matr.c.toFixed(2) + "," + matr.d.toFixed(2) + "," + matr.e.toFixed(2) + "," + matr.f.toFixed(2);
var bbox = blueCircle.getBBox();
document.getElementById("result4").firstChild.nodeValue = ".getBBox() for 'blueCircle': .x="+bbox.x+",.y="+bbox.y+",.width="+bbox.width+",.height="+bbox.height;
document.getElementById("result5").firstChild.nodeValue = ".farthestViewportElement of blueCircle="+blueCircle.farthestViewportElement.getAttributeNS(null,"id");
document.getElementById("result6").firstChild.nodeValue = ".nearestViewportElement of blueCircle="+blueCircle.nearestViewportElement.getAttributeNS(null,"id");
}
</script>
<g font-size="12">
<g id="parentGroup" transform="translate(70,-60)">
<text id="rotatedText" transform="scale(0.6),rotate(45)" font-size="20" x="30" y="150">Rotated Text for testing SVGLocatable</text>
<text id="otherText" transform="scale(0.7)" font-size="20" x="100" y="130">Some other text with id 'otherText'</text>
<svg id="nestedSVG" x="200" y="100" width="110" height="110" viewBox="-55 -55 110 110">
<circle id="blueCircle" cx="0" cy="0" r="50" fill="blue"/>
</svg>
</g>
<text id="result1" x="10" y="200"> </text>
<text id="result2" x="10" y="220"> </text>
<text id="result3" x="10" y="240"> </text>
<text id="result4" x="10" y="260"> </text>
<text id="result5" x="10" y="280"> </text>
<text id="result6" x="10" y="300"> </text>
</g>
</g>
<g font-family="SVGFreeSansASCII,sans-serif" font-size="32">
<text id="revision" x="10" y="340" stroke="none" fill="black">$Revision: 1.6 $</text>
</g>
<rect id="test-frame" x="1" y="1" width="478" height="358" fill="none" stroke="#000"/>
<!-- comment out this watermark once the test is approved -->
<!--<g id="draft-watermark">
<rect x="1" y="1" width="478" height="20" fill="red" stroke="black" stroke-width="1"/>
<text font-family="SVGFreeSansASCII,sans-serif" font-weight="bold" font-size="20" x="240"
text-anchor="middle" y="18" stroke-width="0.5" stroke="black" fill="white">DRAFT</text>
</g>-->
</svg>
</body>
</html>