I correct my self - of course it would be more elegant to call the .inverse() method only once.

The code would read then:

var coordx = evt.clientX;
var coordy = evt.clientY;
//these coordinates are screen pixels
var matrix=document.documentElement.getScreenCTM().inverse();
//matrix now holds scale/rotation/translate/skew values for both x and y
var coordVBx = matrix.a*coordx+matrix.c*coordy+matrix.e;
var coordVBy = matrix..b*coordx+matrix.d*coordy+matrix.f;
//coordVBx and y are now in the coordinate system of the root elements viewBox coordinate system


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]



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



Reply via email to