The following excample I've tried :

<svg xmlns="http://www.w3.org/2000/svg"; 
xmlns:xlink="http://www.w3.org/1999/xlink";
 id="SVGtest"
 viewBox="0 0 1300 1300"
>
<script type="text/ecmascript">
    function TalkToSVG(){
        if (top.document.embeds !== undefined) {
           var svgdoc = top.document.embeds[0].getSVGDocument();
        } else {
           var svgdoc = top.document;
        }
      var targetElement = svgdoc.getElementById("colorRect");
      targetElement.setAttribute("fill", "orange");
    }

    function getBB(){
        if (top.document.embeds !== undefined) {
           var svgdoc = top.document.embeds[0].getSVGDocument();
        } else {
           var svgdoc = top.document;
        }
           
           var id = "grp_ref_11";
         var targetElement = svgdoc.getElementById(id);
           var bbox = targetElement.getBBox();
           var svgns = 'http://www.w3.org/2000/svg';

           var outline = svgdoc.createElementNS(svgns, 'rect');
           outline.setAttributeNS( null, 'x', bbox.x - 2);
           outline.setAttributeNS( null, 'y', bbox.y - 2 );
           outline.setAttributeNS( null, 'width',  bbox.width + 4 );
           outline.setAttributeNS( null, 'height', bbox.height + 4 );
           outline.setAttributeNS( null, 'stroke', 'blue' );
           outline.setAttributeNS( null, 'fill', 'yellow' );

           CTM = svgdoc.getElementById(id).getCTM()
           CTM.scale=true
           s=CTM.a+" "+CTM.b+" "+CTM.c+" "+CTM.d+" "+CTM.e+" "+CTM.f
           outline.setAttributeNS(null,"transform","matrix("+s+")")

           targetElement.parentNode.insertBefore( outline, 
targetElement );
    }
  </script>

  <g id="grp_ref_11"
     transform="matrix(2.9540248,9.8992566,-
9.4064452,2.8069655,2628.7246,-1570.7828)">
    <path
       id="path93"
       d="M 140,290 L 140,320 L 170,320 L 170,290 L 140,290 z"
       style="fill:#ffffff;fill-opacity:0.2;stroke:#000000;stroke-
opacity:1" />
    <path
       id="path95"
       d="M 140,290 L 140,320 L 170,320 L 170,290 L 140,290 z"
       style="fill:#ffffff;fill-opacity:0.2;stroke:#000000;stroke-
opacity:1" />
    <text
       id="text97"
       startOffset="0"
       font-size="14px"
       y="311"
       x="155"
       style="font-size:14px;text-anchor:middle;fill:#000000;fill-
opacity:1;stroke:none;stroke-opacity:1;font-family:Arial">11</text>
  </g>

  <rect id="Rect" x="0" y="0" width="100" height="100" fill="#777" 
stroke="red" stroke-width="0" onclick="getBB()"/>

  <circle id="colorRect" cx="0" cy="0" r="1" fill="blue" stroke="red" 
stroke-width="0" onclick="TalkToSVG()"/>
 
  <text x="50" y="100" style="fill:red; text-
anchor:middle; ">click</text>
</svg>

Stefan where I do wrong ?

I also need the calculated bbox points. but it looks that bbox in 
Firefox comparing to IE is broken


------------------------------------

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to