From a7429205edd94e8e92144a04ee5c7075b6938640 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Mon, 28 Feb 2011 18:27:57 +0100 Subject: [PATCH] Allow Matrix#applyToContext to optionally reset the matrix transformation. --- src/basic/Matrix.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/basic/Matrix.js b/src/basic/Matrix.js index 8cfa6574..18130794 100644 --- a/src/basic/Matrix.js +++ b/src/basic/Matrix.js @@ -454,11 +454,18 @@ var Matrix = Base.extend({ /** * Applies this matrix to the specified Canvas Context. */ - applyToContext: function(context) { - context.setTransform( - this._m00, this._m01, this._m10, - this._m11, this._m02, this._m12 - ); + applyToContext: function(context, reset) { + if (reset) { + context.setTransform( + this._m00, this._m01, this._m10, + this._m11, this._m02, this._m12 + ); + } else { + context.transform( + this._m00, this._m01, this._m10, + this._m11, this._m02, this._m12 + ); + } }, statics: {