Cameron McCormack wrote:

I want to get the dimensions of the current viewport that's being used to show a document in Batik. The document has no viewBox. The document uses a script function called from the svg element's onresize to show the dimensions in a text element, but the dimensions shown are always the initial dimensions.

I'm using

svg.width.baseVal.value

and

svg.height.baseVal.value

to get the width and height. Is this correct?

I don't think so. I think what you want is 'svg.viewport'.
See 'samples/tests/spec/scripting/currentScaleTranslate.svg' It does this exact thing.
My reading of the SVG specification says that svg.width/height are always tied to
the width/height attributes of the svg element. When the viewport is resized these
do not change but the relationship between them and the screen does (see
currentScale/Translate). In fact on the outermost SVG the useragent can ignore W/H
entirely in which case the attributes obviously have no relationship with the display.


The complete example is at

http://www.csse.monash.edu.au/~clm/local/dimensions.svg

Thanks,

Cameron







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



Reply via email to