Andres Toussaint wrote:
HI, i was wondering if there is an equivalent to the emacscript commands detailed following, within Batik Java:

var trans = document.documentElement.currentTranslate;
var scale = document.documentElement.currentScale;

I cannot seem to find them. I am programming drag routines for SVG elements, and want to make them relative to the actual zoom and pan state. I have made this using emacscript but i want this inside the Java application instead of the SVG file.

Yes, there are equiv of the above from the Java Binding:


   SVGDocument doc = ....;
   SVGSVGElement root = doc.getRootElement();
   float scale = root.getCurrentScale();
   SVGPoint trans = root.getCurrentTranslate();

However what you probably want to use is:

   SVGLocatable elem = ...;
   SVGPoint pt = ...
   SVGMatrix mat = elem.getScreenCTM();  // elem -> screen
   mat = mat.inverse();                  // screen -> elem
   pt = pt.matrixTransform(pt);         // from screen coords->elem

   This should also be available in ECMA script (and is with Batik,
but isn't with ASV 3.0 - don't know about 6.0 - I suspect it has it).

   This will deal with any intervening transforms (viewbox, transform, etc).
Elem can be just about any 'graphical' element (rect, g, svg, ...).



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to