@@ -45,8 +45,8 @@ function getRotateMatrix(alpha) {
45
45
*/
46
46
export default class Matrix {
47
47
constructor ( matrixRepresentation ) {
48
- this . __array__ = matrixRepresentation
49
- this . __string__ = getMatrixString ( matrixRepresentation )
48
+ this . __a = matrixRepresentation
49
+ this . __s = getMatrixString ( matrixRepresentation )
50
50
}
51
51
52
52
/**
@@ -55,7 +55,7 @@ export default class Matrix {
55
55
* @returns {string } matrix as matrix3d trasnform string
56
56
*/
57
57
toString ( ) {
58
- return this . __string__
58
+ return this . __s
59
59
}
60
60
61
61
/**
@@ -64,7 +64,7 @@ export default class Matrix {
64
64
* @returns {Array } array of arrays of the current status of the matrix
65
65
*/
66
66
toArray ( ) {
67
- return this . __array__
67
+ return this . __a
68
68
}
69
69
70
70
/**
@@ -79,8 +79,8 @@ export default class Matrix {
79
79
const scaleMatrix = getScaleMatrix ( x , y , z )
80
80
const calculatedMatrix = multiply ( this . toArray ( ) , scaleMatrix )
81
81
82
- this . __array__ = calculatedMatrix
83
- this . __string__ = getMatrixString ( calculatedMatrix )
82
+ this . __a = calculatedMatrix
83
+ this . __s = getMatrixString ( calculatedMatrix )
84
84
85
85
return this
86
86
}
@@ -97,8 +97,13 @@ export default class Matrix {
97
97
const translateMatrix = getTranslateMatrix ( x , y , z )
98
98
const calculatedMatrix = multiply ( this . toArray ( ) , translateMatrix )
99
99
100
- this . __array__ = calculatedMatrix
101
- this . __string__ = getMatrixString ( calculatedMatrix )
100
+ /*
101
+ * private fields minified to have less impact on bundle size
102
+ * __a hoists the array representation of the matrix
103
+ * __s hoists the string representation of the matrix
104
+ */
105
+ this . __a = calculatedMatrix
106
+ this . __s = getMatrixString ( calculatedMatrix )
102
107
103
108
return this
104
109
}
@@ -113,8 +118,8 @@ export default class Matrix {
113
118
const rotateMatrix = getRotateMatrix ( alpha )
114
119
const calculatedMatrix = multiply ( this . toArray ( ) , rotateMatrix )
115
120
116
- this . __array__ = calculatedMatrix
117
- this . __string__ = getMatrixString ( calculatedMatrix )
121
+ this . __a = calculatedMatrix
122
+ this . __s = getMatrixString ( calculatedMatrix )
118
123
119
124
return this
120
125
}
@@ -130,8 +135,8 @@ export default class Matrix {
130
135
const skewMatrix = getSkewMatrix ( alpha , beta )
131
136
const calculatedMatrix = multiply ( this . toArray ( ) , skewMatrix )
132
137
133
- this . __array__ = calculatedMatrix
134
- this . __string__ = getMatrixString ( calculatedMatrix )
138
+ this . __a = calculatedMatrix
139
+ this . __s = getMatrixString ( calculatedMatrix )
135
140
136
141
return this
137
142
}
0 commit comments