xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Abreu" <charlesab...@gmail.com>
Subject Zoom and pan via DOM interfaces
Date Thu, 28 Sep 2006 13:23:26 GMT
Hi,

I have this sample svg:

<svg width="200" height="200" viewBox="0 0 200 200" xmlns="
http://www.w3.org/2000/svg"
    xmlns:xlink="http://www.w3.org/1999/xlink">
   <script language="javascript"><![CDATA[
        function translate(evt, d) {
            var SVGDoc  = evt.target.ownerDocument;
            var SVGRoot = SVGDoc.documentElement;

            SVGRoot.currentTranslate.x+=d;
            SVGRoot.currentTranslate.y+=d;

        }
    ]]></script>
    <circle cx="20" cy="20" r="15" style="fill: blue"
onmouseover="translate(evt, 10)"/>
    <rect x="100" y="100" width="50" height="50" style="fill: green"
onmouseover="translate(evt, -10)"/>
</svg>


What I do is pan the entire document simply by modifying currentTranslate
property of svg root element via ecmascript, but I coudn't find a way to do
the same in Java, using Batik and dom api. Is there any glue to this? I need
to apply pan and zoom on documents loaded on JSVGCanvas.

I'm not very experienced with svg and Batik, so any help is welcome.

Thanks in advance!

Charles Abreu

Mime
View raw message