Steven Huey wrote:
svgElement = (SVGOMSVGElement) canvas.getSVGDocument().getRootElement();
updateManager.getUpdateRunnableQueue().invokeLater(
new Runnable() {
public void run() {
svgElement.setAttributeNS(null, "viewBox", "# # # #");
}
}
);
The ecmascript version of this works fine for me with CVS Batik:
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg id="foo" width="450" height="500"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 450 500">
<rect x="10" y="10" width="200" height="300"
fill="red" stroke="blue" stroke-width="10"
onclick="document.rootElement.setAttribute('viewBox', '0 0 220 320')"
/>
</svg>
I end up with a RuntimeException and after checking the SVGOMSVGElement source I found:
public SVGAnimatedRect getViewBox() { throw new RuntimeException(" !!! TODO: getViewBox()"); }
There is no reason for the set call to trigger getViewBox. Is it possible that your code to calculate the viewBox is calling this method? In which case I guess for now you will need to get the raw attribute and parse it yourself.
Is there any other way to dynamically change the size of the viewBox attribute? I'm also looking to change the height and width attributes at the same time. Basically what I'm trying to accomplish is given a large SVG document view only a specific area within the document so I'm trying to set the width, height, and viewBox attributes accordingly.
Thanks, Steve
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
