--- In svg-developers@yahoogroups.com, "johnbaronreid1972" <[EMAIL PROTECTED]> wrote: > I have another problem now that firefox seems to get the bbox wrong. > It returns an extremely large width. I'm using <svg> elements with > several transforms inside the element I'm calling getBBox on. Is this > known to confuse it? I'm on the latest version of Firefox 2. ASV6 > appears to have no problems. I would post an example but I haven't > whittled it down to a test case yet.
Here's a reasonably small test case where the Firefox 2 and ASV6 behaviour differs significantly: <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <svg xmlns="http://www.w3.org/2000/svg" baseProfile="full" onload="init(evt);" pointer-events="none" preserveAspectRatio="xMidYMid" version="1.1" viewBox="0 0 140 130" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink"> <script type="text/javascript"> <![CDATA[ var svgNS = "http://www.w3.org/2000/svg"; var mydoc = null; var root = null; function init(evt) { mydoc = evt.target.ownerDocument; root = mydoc.documentElement; }; function show_notes() { var back = mydoc.getElementById('notes_background'); try { var outline = notes_panel.getBBox(); back.setAttributeNS(null, 'width', Number(outline.width) + 2); back.setAttributeNS(null, 'height', Number(outline.height) + 2); back.setAttributeNS(null, 'x', Number(outline.x) - 1); back.setAttributeNS(null, 'y', Number(outline.y) - 1); } catch (er) { } notes_panel.setAttributeNS(null, 'display', 'inline'); } function hide_notes() { notes_panel.setAttributeNS(null, 'display', 'none'); } function click_hit(hit_id) { var hit = mydoc.getElementById(hit_id); if( null != hit ) { var parent = hit.parentNode; parent.removeChild(hit); parent.appendChild(hit); } var hit_info = mydoc.getElementById(hit_id + '_info'); if( null != hit_info ) { var back = mydoc.getElementById(hit_id + '_info_back'); var underlines = mydoc.getElementById(hit_id + '_underlines'); if( toggle_visibility(hit_info) ) { if( null != underlines ) underlines.setAttributeNS(null, 'display', 'inline'); setTimeout('resize_info_outline("'+hit_id+'");', 1); } else { if( null != underlines ) underlines.setAttributeNS(null, 'display', 'none'); back.setAttributeNS(null, 'width', 0); back.setAttributeNS(null, 'height', 0); back.setAttributeNS(null, 'x', 0); back.setAttributeNS(null, 'y', 0); } } } function resize_info_outline(hit_id) { var back = mydoc.getElementById(hit_id + '_info_back'); var hit_info = mydoc.getElementById(hit_id + '_info'); var outline = hit_info.getBBox(); back.setAttributeNS(null, 'width', Number(outline.width) + 2); back.setAttributeNS(null, 'height', Number(outline.height) + 2); back.setAttributeNS(null, 'x', Number(outline.x) - 1); back.setAttributeNS(null, 'y', Number(outline.y) - 1); } function toggle_visibility(el) { var current = el.getAttributeNS(null, 'display'); if ('none' == current) { el.setAttributeNS(null, 'display', 'inline'); return true; } else { el.setAttributeNS(null, 'display', 'none'); return false; } }; ]]> </script> <defs> <g id="A" transform="scale(1.5,1.4)"> <text style="text-anchor:start; font-family: arial; fill:chartreuse; font-size:100px">A</text> </g> <g id="C" transform="scale(1.58,1.35) translate(-5,0)"> <text style="text-anchor:start; font-family: arial; fill:orange; font-size:100px; baseline-shift:1%">C</text> </g> <g id="G" transform="scale(1.5,1.35) translate(-5,0)"> <text style="text-anchor:start; font-family: arial; fill:cyan; font-size:100px; baseline-shift:1%">G</text> </g> <g id="T" transform="scale(1.75,1.4) translate(-2,0)"> <text style="text-anchor:start; font-family: arial; fill:red; font-size:100px">T</text> </g> </defs> <g transform="translate(0 20)"> <g transform="translate(0)"> <g> <g id="hit_19" transform="translate(31.5 47.2035)"> <circle fill="#3366FF" onclick="click_hit('hit_19')" pointer-events="visiblePainted" r="2" stroke="black" stroke-width="0.3" x="0" y="0"/> <g display="none" id="hit_19_info" pointer-events="visiblePainted" transform="translate(3 0) scale(.5) translate(0 -17)"> <rect fill="white" height="0" id="hit_19_info_back" rx="0.3" stroke="lightgray" stroke-width="0.3" width="0" x="0" y="0"/> <svg height="10" viewBox="0 0 100 200" width="55"> <g transform="translate(0 200)"> <g transform="translate(0 0) scale(1 0.052198)"> <use xlink:href="#T"/> </g> </g> </svg> </g> </g> </g> </g> </g> </svg> ----- 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/