Skip to content

Commit 32e2df9

Browse files
committed
Fixed Inverse UV calc.
1 parent 4f8e509 commit 32e2df9

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

src/textures/Frame.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ Phaser.TextureFrame = function (texture, name, sourceIndex, x, y, width, height)
120120
r: x + width,
121121
b: y + height
122122
},
123+
trim: false,
123124
sourceSize: {
124125
w: width,
125126
h: height
@@ -192,6 +193,8 @@ Phaser.TextureFrame.prototype = {
192193
{
193194
// Store actual values
194195

196+
this.data.trim = true;
197+
195198
this.data.sourceSize.w = actualWidth;
196199
this.data.sourceSize.h = actualHeight;
197200

@@ -250,17 +253,17 @@ Phaser.TextureFrame.prototype = {
250253
var th = this.source.height;
251254
var uvs = this.data.uvs;
252255

253-
uvs.x0 = this.x / tw;
254-
uvs.y0 = this.y / th;
256+
uvs.x0 = this.cutX / tw;
257+
uvs.y0 = this.cutY / th;
255258

256-
uvs.x1 = (this.x + this.height) / tw;
257-
uvs.y1 = this.y / th;
259+
uvs.x1 = (this.cutX + this.cutHeight) / tw;
260+
uvs.y1 = this.cutY / th;
258261

259-
uvs.x2 = (this.x + this.height) / tw;
260-
uvs.y2 = (this.y + this.width) / th;
262+
uvs.x2 = (this.cutX + this.cutHeight) / tw;
263+
uvs.y2 = (this.cutY + this.cutWidth) / th;
261264

262-
uvs.x3 = this.x / tw;
263-
uvs.y3 = (this.y + this.width) / th;
265+
uvs.x3 = this.cutX / tw;
266+
uvs.y3 = (this.cutY + this.cutWidth) / th;
264267

265268
return this;
266269
},

0 commit comments

Comments
 (0)