yes, you can use

var ctm = myElement.getTransformToElement(document.documentElement);

which would give you the transform matrix from your current node to the root 
element. Of 
course you can use any other node in the hierarchy instead of 
document.documentElement 
as argument.

You can also use 

var ctm = myElement.getCTM();

which gives you the ctm from your element to the element's parent node.

Note that .getTransformToElement() doesn't work in ASV3, but .getCTM() works. 
You need 
a workaround here, see code below.

------------------

//this code is copied from Kevin Lindsey
//http://www.kevlindev.com/tutorials/basics/transformations/toUserSpace/index.htm
function getTransformToRootElement(node) {
        try {
                //this part is for fully conformant players
                var CTM = node.getTransformToElement(document.documentElement);
        }
        catch (ex) {
                //this part is for ASV3 or other non-conformant players
                // Initialize our CTM the node's Current Transformation Matrix
                var CTM = node.getCTM();
                // Work our way through the ancestor nodes stopping at the SVG 
Document
                while ( ( node = node.parentNode ) != document ) {
                        // Multiply the new CTM to the one with what we have 
accumulated so far
                        CTM = node.getCTM().multiply(CTM);
                }
        }
        return CTM;
}

---------------------

See also http://www.w3.org/TR/SVG11/coords.html#TransformMatrixDefined on how 
to 
interpret the matrix.

Hope this helps,
Andreas

--- In [email protected], Guy Morton <[EMAIL PROTECTED]> wrote:
>
> Hi guys
> 
> I'm pretty new to this, so this may be a dumb question. :-)
> 
> Is there an easier way, in both FF and ASV, to get an element's current 
> transform (preferably as individual items) than reading and parsing it's 
> transform attribute?
> 
> It seems a little clunky to have to parse and rewrite the whole tranform 
> attribute every time I want to make a change, eg alter an item's scale 
> but not it's translate. It works but it seems a little insane.
> 
> Guy
>







-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to