Skip to content

Commit 6687c0f

Browse files
committed
Removed redundant file and method and tidied up uv setter (phaserjs#3119)
1 parent 32bc492 commit 6687c0f

2 files changed

Lines changed: 17 additions & 58 deletions

File tree

v3/src/textures/Frame.js

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,6 @@ var Frame = new Class({
187187
return this.updateUVs();
188188
},
189189

190-
setCut: function (x, y, width, height)
191-
{
192-
this.cutX = x;
193-
this.cutY = y;
194-
195-
this.cutWidth = width;
196-
this.cutHeight = height;
197-
198-
return this.updateUVs();
199-
},
200-
201190
/**
202191
* Updates the internal WebGL UV cache and the drawImage cache.
203192
*
@@ -206,32 +195,37 @@ var Frame = new Class({
206195
*/
207196
updateUVs: function ()
208197
{
198+
var cx = this.cutX;
199+
var cy = this.cutY;
200+
var cw = this.cutWidth;
201+
var ch = this.cutHeight;
202+
209203
// Canvas data
210204

211205
var cd = this.data.drawImage;
212206

213-
cd.sWidth = this.cutWidth;
214-
cd.sHeight = this.cutHeight;
215-
cd.dWidth = this.cutWidth;
216-
cd.dHeight = this.cutHeight;
207+
cd.sWidth = cw;
208+
cd.sHeight = ch;
209+
cd.dWidth = cw;
210+
cd.dHeight = ch;
217211

218212
// WebGL data
219213

220214
var tw = this.source.width;
221215
var th = this.source.height;
222216
var uvs = this.data.uvs;
223217

224-
uvs.x0 = this.cutX / tw;
225-
uvs.y0 = this.cutY / th;
218+
uvs.x0 = cx / tw;
219+
uvs.y0 = cy / th;
226220

227-
uvs.x1 = this.cutX / tw;
228-
uvs.y1 = (this.cutY + this.cutHeight) / th;
221+
uvs.x1 = cx / tw;
222+
uvs.y1 = (cy + ch) / th;
229223

230-
uvs.x2 = (this.cutX + this.cutWidth) / tw;
231-
uvs.y2 = (this.cutY + this.cutHeight) / th;
224+
uvs.x2 = (cx + cw) / tw;
225+
uvs.y2 = (cy + ch) / th;
232226

233-
uvs.x3 = (this.cutX + this.cutWidth) / tw;
234-
uvs.y3 = this.cutY / th;
227+
uvs.x3 = (cx + cw) / tw;
228+
uvs.y3 = cy / th;
235229

236230
return this;
237231
},

v3/src/textures/TextureCrop.js

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)