From 763fc957765e7ab1f7c4a94fc3788dce2df066ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 28 Feb 2011 20:15:40 +0100 Subject: [PATCH] Fix odd issue of Rasters rotating the wrong way, which seems to be caused by Canvas not using the same Matrix orientation as Paper.js (scaleX (m00) and scaleY (m11) need to be flipped). --- src/basic/Matrix.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/basic/Matrix.js b/src/basic/Matrix.js index 8cfa6574..3fe74aa1 100644 --- a/src/basic/Matrix.js +++ b/src/basic/Matrix.js @@ -455,9 +455,12 @@ var Matrix = Base.extend({ * Applies this matrix to the specified Canvas Context. */ applyToContext: function(context) { + // Canvas contexts seem to use another orientation: The scaleX (m00) and + // scaleY (m11) values need to be flipped to get correct behaviour e.g. + // when using rotation or shearing. context.setTransform( - this._m00, this._m01, this._m10, - this._m11, this._m02, this._m12 + -this._m00, this._m01, this._m10, + -this._m11, this._m02, this._m12 ); },