I would like to move a RaphaelElement and created a simple test case:
var paper = Raphael(0, 0, 500, 500);
var rect = paper.rect(50, 50, 100, 100);
rect.attr("fill", "blue");
rect.matrix.translate(300, 300);
But the rectangle isn't moved. At first I thought that for the matrix was probably not updated correctly and tried this:
//...
alert("" + rect.matrix.x(0,0)); // prints 0
rect.matrix.translate(300, 300);
alert("" + rect.matrix.x(0,0)); //prints 300
Obviously the matrix is changed but the rectangle does not care about that. Therefore I changed my code to:
rect.matrix=rect.matrix.translate(300,300);
But that either crashes the program or has no effect at all. It seems like I'm missing some sort of update method, to apply a matrix to a RaphaelElement. Something that looks like this:
rect.updateMatrix();
I've searched in the documentation but didn't find such a method. What is the canonical usage of matrices in RaphaelJs?