i have made some changes to the coordinate identification routine.
Could you please, substitute the function getCanvasCoord in the Director object for this one, and let me know whether this works for you ?
I could send you a complete caat.js file if needed.
thanks.
getCanvasCoord:function (point, e) {
var pt = new CAAT.Math.Point();
var posx = 0;
var posy = 0;
/**
* Chrome.
* offsetX and offsetY is the actual coordinate in the DOM element, regardless the affine transformation
* it has applied.
*/
if (typeof e.offsetX!=="undefined") {
posx= e.offsetX;
posy= e.offsetY;
} else
/**
* FF
* clientX and clientY are, more or less, in canvas coordinates.
* But must be corrected with scale, calculated from bouding client rect reported size, and actual size.
* This won't work right with rotated canvas objects.
*/
if ( typeof e.clientX!=="undefined" && this.canvas.getBoundingClientRect ) {
var bcr= this.canvas.getBoundingClientRect();
posx= (e.clientX - bcr.left) * (this.canvas.width/bcr.width);
posy= (e.clientY - bcr.top) * (this.canvas.height/bcr.height);
} else {
/**
* older browsers.
* survival model. try to find things on your own by traversing upwards the DOM tree.
*/
if (!e) e = window.event;
if (e.pageX || e.pageY) {
posx = e.pageX;
posy = e.pageY;
}
else if (e.clientX || e.clientY) {
posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
var offset = this.getOffset(this.canvas);
posx -= offset.x;
posy -= offset.y;
}
posx*= this.SCREEN_RATIO;
posy*= this.SCREEN_RATIO;
//////////////
// transformar coordenada inversamente con affine transform de director.
pt.x = posx;
pt.y = posy;
if (!this.modelViewMatrixI) {
this.modelViewMatrix.getInverse(this.modelViewMatrixI);
}
this.modelViewMatrixI.transformCoord(pt);
posx = pt.x;
posy = pt.y
point.set(posx, posy);
this.screenMousePoint.set(posx, posy);
},