Thomas DeWeese wrote:

Jamie Browning wrote:

Thanks for the pointer! This code certainly seems cleaner than mine ;-) However it doesn't seem to have fully solved the problem. Perhaps I am missing something above just the implementation of this function.

Again I have included my test file to show what I mean. Notice how it works fine when preserveAspectRatio abuts the margins to the window minimum, but is offset slightly when the document is scaled to be centered (or right aligned) on the window.


   Well I'm running with ASV 6.0beta in this case the outer SVG is
correct but the inner one is wrong.  To get the inner one to work I
had to modify the function:

function getScreenCTM(elem) {
    if (elem.currentScale) {
      var scale = elem.currentScale;
      var trans = elem.currentTranslate;
      var ret = root.createSVGMatrix();
      ret.scale(scale);
      ret.translate(trans.x, trans.y);
      return ret;
    }

    var pMat = getScreenCTM(elem.parentNode);

    var eMat = elem.getCTM();
    if (eMat == null) return pMat;
    eMat = eMat.multiply(pMat);
    return eMat;
  }

  I don't know if this will fix it for ASV 3.0 (I tend to doubt it).
It's worth noting that this depends on ASV implementing functions
from the standard incorrectly, so you really do need to bypass this
for UA's that implement the spec correctly like Batik.

In my file I attempted to implement a function getGlobalTransform - is this required? (Why did Adobe not implement this function, Grrrr....)


    I don't really know and I don't know ;)


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



Thomas,

Loaded my test into ASV6 and it works fine :-(

Sorry to bang on about the obvious but can I just clarify:

The Adobe Viewer 3 implementation of currentScale/Translate is basically wrong i.e. it doesn't take into account any transformations applied by the UA in order to 'fit' the document to the window. Am I right?

Or is it that getCTM is not implemented and this is what I need to provide?

Sorry again because I know this is not strictly speaking a Batik issue but once solved I will share my modifications with you ;-)

Jamie

P.S. Doesn't ASV6 implement getScreenCTM itself? Not that this helps me unfortunately.


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



Reply via email to