From 9aaa864f8167c89a0959d7ec8b2a4acc2b6da239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 9 Feb 2013 11:42:55 -0800 Subject: [PATCH] Streamline Matrix by removing unnecessary Matrix#setTo*() and Matrix.get*Instance() methods. Use (new Matrix().*()) instead. --- src/basic/Matrix.js | 105 -------------------------------------------- 1 file changed, 105 deletions(-) diff --git a/src/basic/Matrix.js b/src/basic/Matrix.js index 76b69fa8..872267af 100644 --- a/src/basic/Matrix.js +++ b/src/basic/Matrix.js @@ -606,60 +606,6 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{ return Matrix.create(this._a, this._c, this._b, this._d, 0, 0); }, - /** - * Sets this transform to a scaling transformation. - * - * @param {Number} hor The horizontal scaling factor - * @param {Number} ver The vertical scaling factor - * @return {Matrix} This affine transform - */ - setToScale: function(hor, ver) { - return this.set(hor, 0, 0, ver, 0, 0); - }, - - /** - * Sets this transform to a translation transformation. - * - * @param {Number} dx The distance to translate in the x direction - * @param {Number} dy The distance to translate in the y direction - * @return {Matrix} This affine transform - */ - setToTranslation: function(delta) { - delta = Point.read(arguments); - return this.set(1, 0, 0, 1, delta.x, delta.y); - }, - - /** - * Sets this transform to a shearing transformation. - * - * @param {Number} hor The horizontal shear factor - * @param {Number} ver The vertical shear factor - * @return {Matrix} This affine transform - */ - setToShear: function(hor, ver) { - return this.set(1, ver, hor, 1, 0, 0); - }, - - /** - * Sets this transform to a rotation transformation. - * - * @param {Number} angle The angle of rotation measured in degrees - * @param {Number} x The x coordinate of the anchor point - * @param {Number} y The y coordinate of the anchor point - * @return {Matrix} This affine transform - */ - setToRotation: function(angle, center) { - center = Point.read(arguments, 1); - angle = angle * Math.PI / 180; - var x = center.x, - y = center.y, - cos = Math.cos(angle), - sin = Math.sin(angle); - return this.set(cos, sin, -sin, cos, - x - x * cos + y * sin, - y - x * sin - y * cos); - }, - /** * Applies this matrix to the specified Canvas Context. * @@ -676,57 +622,6 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{ // See Point.create() create: function(a, c, b, d, tx, ty) { return Base.create(Matrix).set(a, c, b, d, tx, ty); - }, - - /** - * Creates a transform representing a scaling transformation. - * - * @param {Number} hor The horizontal scaling factor - * @param {Number} ver The vertical scaling factor - * @return {Matrix} A transform representing a scaling - * transformation - */ - getScaleInstance: function(hor, ver) { - var mx = new Matrix(); - return mx.setToScale.apply(mx, arguments); - }, - - /** - * Creates a transform representing a translation transformation. - * - * @param {Number} dx The distance to translate in the x direction - * @param {Number} dy The distance to translate in the y direction - * @return {Matrix} A transform representing a translation - * transformation - */ - getTranslateInstance: function(delta) { - var mx = new Matrix(); - return mx.setToTranslation.apply(mx, arguments); - }, - - /** - * Creates a transform representing a shearing transformation. - * - * @param {Number} hor The horizontal shear factor - * @param {Number} ver The vertical shear factor - * @return {Matrix} A transform representing a shearing transformation - */ - getShearInstance: function(hor, ver, center) { - var mx = new Matrix(); - return mx.setToShear.apply(mx, arguments); - }, - - /** - * Creates a transform representing a rotation transformation. - * - * @param {Number} angle The angle of rotation measured in degrees - * @param {Number} x The x coordinate of the anchor point - * @param {Number} y The y coordinate of the anchor point - * @return {Matrix} A transform representing a rotation transformation - */ - getRotateInstance: function(angle, center) { - var mx = new Matrix(); - return mx.setToRotation.apply(mx, arguments); } } }, new function() {