Maik Sch�rer wrote:
> Simply transform the viewPort to the outermost SVG element's > coordinate system by using the inverse of the screen CTM for the > outermost SVG element. I don't understand that what is "the inverse of the screen CTM" ?
Maik - I did not follow the whole thread, I don't know exactly what you want to do. But I can explain the screen CTM:
CTM stands for "current transform matrix" and holds scaling, rotation and translation values. It is a 3x3 matrix, but only the first two rows are relevant. Have a look at
http://www.w3.org/TR/SVG11/coords.html#EstablishingANewUserSpace
you can call the method ".getScreenCTM()" on the root element (equals to documentElement) as follows. Subsequently if you want to transform the screen coordinates (which you receive e.g. by the evt.clientX and evt.clientY properties) to the viewBox coordinate system of your root element you can use the following code:
var coordx = evt.clientX; var coordy = evt.clientY; //these coordinates are screen pixels var matrix=document.documentElement.getScreenCTM(); //matrix now holds scale/rotation/translate/skew values for both x and y var coordVBx = matrix.inverse().a*coordx+matrix.inverse().c*coordy+matrix.inverse().e; var coordVBy = matrix.inverse().b*coordx+matrix.inverse().d*coordy+matrix.inverse().f; //coordVBx and y are now in the coordinate system of the root elements viewBox coordinate system
see http://www.w3.org/TR/SVG11/coords.html#EstablishingANewUserSpace to see what the matrix values a to f mean.
Good luck, Andreas
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
