@@ -88,14 +88,18 @@ cc.SpriteFrame = cc.Class.extend(/** @lends cc.SpriteFrame# */{
88
88
* @return {cc.Rect }
89
89
*/
90
90
getRectInPixels :function ( ) {
91
- return this . _rectInPixels ;
91
+ var locRectInPixels = this . _rectInPixels ;
92
+ return cc . rect ( locRectInPixels . x , locRectInPixels . y , locRectInPixels . width , locRectInPixels . height ) ;
92
93
} ,
93
94
94
95
/**
95
96
* @param {cc.Rect } rectInPixels
96
97
*/
97
98
setRectInPixels :function ( rectInPixels ) {
98
- this . _rectInPixels = rectInPixels ;
99
+ this . _rectInPixels . x = rectInPixels . x ;
100
+ this . _rectInPixels . y = rectInPixels . y ;
101
+ this . _rectInPixels . width = rectInPixels . width ;
102
+ this . _rectInPixels . height = rectInPixels . height ;
99
103
this . _rect = cc . RECT_PIXELS_TO_POINTS ( rectInPixels ) ;
100
104
} ,
101
105
@@ -130,7 +134,10 @@ cc.SpriteFrame = cc.Class.extend(/** @lends cc.SpriteFrame# */{
130
134
* @param {cc.Rect } rect
131
135
*/
132
136
setRect :function ( rect ) {
133
- this . _rect = rect ;
137
+ this . _rect . x = rect . x ;
138
+ this . _rect . y = rect . y ;
139
+ this . _rect . width = rect . width ;
140
+ this . _rect . height = rect . height ;
134
141
this . _rectInPixels = cc . RECT_POINTS_TO_PIXELS ( this . _rect ) ;
135
142
} ,
136
143
@@ -147,7 +154,8 @@ cc.SpriteFrame = cc.Class.extend(/** @lends cc.SpriteFrame# */{
147
154
* @param {cc.Point } offsetInPixels
148
155
*/
149
156
setOffsetInPixels :function ( offsetInPixels ) {
150
- this . _offsetInPixels = offsetInPixels ;
157
+ this . _offsetInPixels . x = offsetInPixels . x ;
158
+ this . _offsetInPixels . y = offsetInPixels . y ;
151
159
this . _offset = cc . POINT_PIXELS_TO_POINTS ( this . _offsetInPixels ) ;
152
160
} ,
153
161
@@ -157,15 +165,16 @@ cc.SpriteFrame = cc.Class.extend(/** @lends cc.SpriteFrame# */{
157
165
* @return {cc.Size }
158
166
*/
159
167
getOriginalSizeInPixels :function ( ) {
160
- return this . _originalSizeInPixels ;
168
+ return cc . size ( this . _originalSizeInPixels . width , this . _originalSizeInPixels . height ) ;
161
169
} ,
162
170
163
171
/**
164
172
* set original size of the trimmed image
165
173
* @param {cc.Size } sizeInPixels
166
174
*/
167
175
setOriginalSizeInPixels :function ( sizeInPixels ) {
168
- this . _originalSizeInPixels = sizeInPixels ;
176
+ this . _originalSizeInPixels . width = sizeInPixels . width ;
177
+ this . _originalSizeInPixels . height = sizeInPixels . height ;
169
178
} ,
170
179
171
180
/**
@@ -182,7 +191,8 @@ cc.SpriteFrame = cc.Class.extend(/** @lends cc.SpriteFrame# */{
182
191
* @param {cc.Size } sizeInPixels
183
192
*/
184
193
setOriginalSize :function ( sizeInPixels ) {
185
- this . _originalSize = sizeInPixels ;
194
+ this . _originalSize . width = sizeInPixels . width ;
195
+ this . _originalSize . height = sizeInPixels . height ;
186
196
} ,
187
197
188
198
/**
0 commit comments