sproutcore / TransformJS

A jQuery plugin that provides an abstraction over 2d and 3d transforms - Project Owner: jtaby
transformjs.strobeapp.com
MIT License
229 stars 23 forks source link

Wrong 2d-matrix #21

Open DevCybran opened 12 years ago

DevCybran commented 12 years ago

Currently, the 2d-matrix is built by the following code:

  if (supports2d) {
    s  = "matrix(";
      s += tM.e(1,1).toFixed(10) + "," + tM.e(1,2).toFixed(10) + ",";
      s += tM.e(2,1).toFixed(10) + "," + tM.e(2,2).toFixed(10) + ",";
      s += tM.e(3,1).toFixed(10) + "px," + tM.e(3,2).toFixed(10)+'px';
    s += ")";        
  }

This is not absolutely correct, since the suffix "px" in two last attributes is only supported by firefox (property MozTransform). All other browsers are expecting a matrix without any unit, ignoring any matrix that is built with a unit inside. The corrected code (for other browsers only):

  if (supports2d) {
    s  = "matrix(";
      s += tM.e(1,1).toFixed(10) + "," + tM.e(1,2).toFixed(10) + ",";
      s += tM.e(2,1).toFixed(10) + "," + tM.e(2,2).toFixed(10) + ",";
      s += tM.e(3,1).toFixed(10) + "," + tM.e(3,2).toFixed(10);
    s += ")";  
  }