[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] SVG - positionering af elementer [SOLVED]



Jeg endte med følgende, som gør, hvad jeg ønsker:


<?xml version="1.0" encoding="utf-8"?>

<svg  xmlns="http://www.w3.org/2000/svg";
      xmlns:xlink="http://www.w3.org/1999/xlink"; onload="init();">
    <script type="text/javascript"><![CDATA[
        function init() {
            var r = document.getElementById("textgroup").getBBox();
            var x = 5 + Math.ceil(r.x + r.width);
            document.getElementById("rectgroup").setAttribute("transform", "translate(" + x + ", 0)");
        }
    ]]>
    </script>
    <g id="rectgroup">
        <rect x="0" y="3" width="200" height="30" style="fill: #00ff00"/>
        <rect x="50" y="38" width="100" height="30" style="fill: #00ff00"/>
    </g>
    <g id="textgroup">
        <text y="30" font-family="Verdana" font-size="30">Hello, cruel World!</text>
        <text y="65" font-family="Verdana" font-size="30">This is a very long text string</text>
    </g>
</svg>


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2009-07-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *