refactor Components props extracting

This commit is contained in:
Horcrux
2017-02-03 19:43:25 +08:00
parent 9b62d500ce
commit 5bd9b40c17
35 changed files with 208 additions and 276 deletions

View File

@@ -2,7 +2,6 @@
* based on
* https://github.com/CreateJS/EaselJS/blob/631cdffb85eff9413dab43b4676f059b4232d291/src/easeljs/geom/Matrix2D.js
*/
import _ from 'lodash';
const DEG_TO_RAD = Math.PI / 180;
/**
@@ -25,7 +24,7 @@ const DEG_TO_RAD = Math.PI / 180;
* @param {Number} [ty=0] Specifies the ty property for the new matrix.
* @constructor
**/
class Matrix2D {
export default class Matrix2D {
constructor(a, b, c, d, tx, ty) {
this.setTransform(a, b, c, d, tx, ty);
@@ -80,11 +79,11 @@ class Matrix2D {
* @return {Matrix2D} This instance. Useful for chaining method calls.
*/
setTransform = function(a, b, c, d, tx, ty) {
// don't forget to update docs in the constructor if these change:
this.a = _.isNil(a) ? 1 : a;
/*eslint eqeqeq:0*/
this.a = a == null ? 1 : a;
this.b = b || 0;
this.c = c || 0;
this.d = _.isNil(d) ? 1 : d;
this.d = b == null ? 1 : d;
this.tx = tx || 0;
this.ty = ty || 0;
return this;
@@ -281,5 +280,3 @@ class Matrix2D {
return this;
};
}
export default Matrix2D;