Created
February 11, 2013 12:56
-
-
Save desandro/4754275 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Item.prototype._applyTransformPosition = function() { | |
// get possible translate position | |
if ( !transformProperty ) { | |
return; | |
} | |
var style = getStyle( this.element ); | |
var transform = style[ transformProperty ]; | |
if ( transform.indexOf('matrix') !== 0 ) { | |
return; | |
} | |
// split matrix(1, 0, 0, 1, x, y) | |
var matrixValues = transform.split(','); | |
// translate X value is in 12th or 4th position | |
var xIndex = transform.indexOf('matrix3d') === 0 ? 12 : 4; | |
this.position.x += parseInt( matrixValues[ xIndex ], 10 ); | |
// translate X value is in 13th or 5th position | |
this.position.y += parseInt( matrixValues[ xIndex + 1 ], 10 ); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment