@@ -25,15 +25,15 @@ Phaser.TextureFrame = function (texture, name, sourceIndex, x, y, width, height)
2525 */
2626 this . texture = texture ;
2727
28- this . source = texture . source [ sourceIndex ] ;
29-
30- this . sourceIndex = sourceIndex ;
31-
3228 /**
3329 * @property {string } name - The name of this frame within the Texture.
3430 */
3531 this . name = name ;
3632
33+ this . source = texture . source [ sourceIndex ] ;
34+
35+ this . sourceIndex = sourceIndex ;
36+
3737 /**
3838 * @property {number } cutX - X position within the source image to cut from.
3939 */
@@ -150,34 +150,6 @@ Phaser.TextureFrame.prototype.constructor = Phaser.TextureFrame;
150150
151151Phaser . TextureFrame . prototype = {
152152
153- crop : function ( width , height , x , y )
154- {
155- if ( width === undefined ) { width = this . data . cut . w ; }
156- if ( height === undefined ) { height = this . data . cut . h ; }
157- if ( x === undefined ) { x = 0 ; }
158- if ( y === undefined ) { y = 0 ; }
159-
160- if ( width === undefined )
161- {
162- // No arguments means reset the crop
163- this . cutX = this . data . cut . x ;
164- this . cutY = this . data . cut . y ;
165- this . cutWidth = this . data . cut . w ;
166- this . cutHeight = this . data . cut . h ;
167- }
168- else if ( width !== this . cutWidth || height !== this . cutHeight || x !== this . cutX || y !== this . cutY )
169- {
170- this . cutX = Phaser . Math . clamp ( x , this . data . cut . x , this . data . cut . r ) ;
171- this . cutY = Phaser . Math . clamp ( y , this . data . cut . y , this . data . cut . b ) ;
172- this . cutWidth = Phaser . Math . clamp ( width , 0 , this . data . cut . w - this . cutX ) ;
173- this . cutHeight = Phaser . Math . clamp ( height , 0 , this . data . cut . h - this . cutY ) ;
174- }
175-
176- this . updateUVs ( ) ;
177-
178- return this ;
179- } ,
180-
181153 /**
182154 * If the frame was trimmed when added to the Texture Atlas, this records the trim and source data.
183155 *
@@ -268,30 +240,27 @@ Phaser.TextureFrame.prototype = {
268240 return this ;
269241 } ,
270242
271- /**
272- * Adjusts of all the Frame properties based on the given width and height values.
273- *
274- * @method Phaser.TextureFrame#resize
275- * @param {integer } width - The new width of the Frame.
276- * @param {integer } height - The new height of the Frame.
277- */
278- resize : function ( width , height )
279- {
280- } ,
281-
282243 clone : function ( )
283244 {
245+ var clone = new Phaser . TextureFrame ( this . texture , this . name , this . sourceIndex ) ;
284246
285- } ,
247+ clone . cutX = this . cutX ;
248+ clone . cutY = this . cutY ;
249+ clone . cutWidth = this . cutWidth ;
250+ clone . cutHeight = this . cutHeight ;
286251
287- right : function ( )
288- {
252+ clone . x = this . x ;
253+ clone . y = this . y ;
254+ clone . width = this . width ;
255+ clone . height = this . height ;
289256
290- } ,
257+ clone . rotated = this . rotated ;
291258
292- bottom : function ( )
293- {
259+ clone . data = Phaser . Utils . extend ( true , clone . data , this . data ) ;
260+
261+ clone . updateUVs ( ) ;
294262
263+ return clone ;
295264 } ,
296265
297266 destroy : function ( )
0 commit comments