@@ -66,17 +66,26 @@ cc.affineTransformMake = function (a, b, c, d, tx, ty) {
66
66
* Apply the affine transformation on a point.
67
67
* @function
68
68
*
69
- * @param {cc.Point } point
70
- * @param {cc.AffineTransform } t
69
+ * @param {cc.Point|Number } point or x
70
+ * @param {cc.AffineTransform|Number } transOrY transform matrix or y
71
+ * @param {cc.AffineTransform } t transform matrix or y
71
72
* @return {cc.Point }
72
73
*/
73
- cc . pointApplyAffineTransform = function ( point , t ) {
74
- return { x : t . a * point . x + t . c * point . y + t . tx , y : t . b * point . x + t . d * point . y + t . ty } ;
74
+ cc . pointApplyAffineTransform = function ( point , transOrY , t ) {
75
+ var x , y ;
76
+ if ( t === undefined ) {
77
+ t = transOrY ;
78
+ x = point . x ;
79
+ y = point . y ;
80
+ } else {
81
+ x = point ;
82
+ y = transOrY ;
83
+ }
84
+ return { x : t . a * x + t . c * y + t . tx , y : t . b * x + t . d * y + t . ty } ;
75
85
} ;
76
86
77
- cc . _pointApplyAffineTransform = function ( x , y , t ) {
78
- return { x : t . a * x + t . c * y + t . tx ,
79
- y : t . b * x + t . d * y + t . ty } ;
87
+ cc . _pointApplyAffineTransform = function ( x , y , t ) { //it will remove.
88
+ return cc . pointApplyAffineTransform ( x , y , t ) ;
80
89
} ;
81
90
82
91
/**
@@ -131,10 +140,10 @@ cc.rectApplyAffineTransform = function (rect, anAffineTransform) {
131
140
var right = cc . rectGetMaxX ( rect ) ;
132
141
var bottom = cc . rectGetMaxY ( rect ) ;
133
142
134
- var topLeft = cc . _pointApplyAffineTransform ( left , top , anAffineTransform ) ;
135
- var topRight = cc . _pointApplyAffineTransform ( right , top , anAffineTransform ) ;
136
- var bottomLeft = cc . _pointApplyAffineTransform ( left , bottom , anAffineTransform ) ;
137
- var bottomRight = cc . _pointApplyAffineTransform ( right , bottom , anAffineTransform ) ;
143
+ var topLeft = cc . pointApplyAffineTransform ( left , top , anAffineTransform ) ;
144
+ var topRight = cc . pointApplyAffineTransform ( right , top , anAffineTransform ) ;
145
+ var bottomLeft = cc . pointApplyAffineTransform ( left , bottom , anAffineTransform ) ;
146
+ var bottomRight = cc . pointApplyAffineTransform ( right , bottom , anAffineTransform ) ;
138
147
139
148
var minX = Math . min ( topLeft . x , topRight . x , bottomLeft . x , bottomRight . x ) ;
140
149
var maxX = Math . max ( topLeft . x , topRight . x , bottomLeft . x , bottomRight . x ) ;
@@ -150,10 +159,10 @@ cc._rectApplyAffineTransformIn = function(rect, anAffineTransform){
150
159
var right = cc . rectGetMaxX ( rect ) ;
151
160
var bottom = cc . rectGetMaxY ( rect ) ;
152
161
153
- var topLeft = cc . _pointApplyAffineTransform ( left , top , anAffineTransform ) ;
154
- var topRight = cc . _pointApplyAffineTransform ( right , top , anAffineTransform ) ;
155
- var bottomLeft = cc . _pointApplyAffineTransform ( left , bottom , anAffineTransform ) ;
156
- var bottomRight = cc . _pointApplyAffineTransform ( right , bottom , anAffineTransform ) ;
162
+ var topLeft = cc . pointApplyAffineTransform ( left , top , anAffineTransform ) ;
163
+ var topRight = cc . pointApplyAffineTransform ( right , top , anAffineTransform ) ;
164
+ var bottomLeft = cc . pointApplyAffineTransform ( left , bottom , anAffineTransform ) ;
165
+ var bottomRight = cc . pointApplyAffineTransform ( right , bottom , anAffineTransform ) ;
157
166
158
167
var minX = Math . min ( topLeft . x , topRight . x , bottomLeft . x , bottomRight . x ) ;
159
168
var maxX = Math . max ( topLeft . x , topRight . x , bottomLeft . x , bottomRight . x ) ;
0 commit comments