Skip to content

Commit 92a70f0

Browse files
committed
updateUVs now updates the canvas data too. Removed logs. Added setTrim if frame requires it.
1 parent bb3b5c3 commit 92a70f0

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

v3/src/textures/Frame.js

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -143,17 +143,6 @@ var Frame = new Class({
143143
this.updateUVs();
144144
},
145145

146-
setCut: function (x, y, width, height)
147-
{
148-
this.cutX = x;
149-
this.cutY = y;
150-
151-
this.cutWidth = width;
152-
this.cutHeight = height;
153-
154-
return this.updateUVs();
155-
},
156-
157146
/**
158147
* If the frame was trimmed when added to the Texture Atlas, this records the trim and source data.
159148
*
@@ -198,14 +187,36 @@ var Frame = new Class({
198187
return this.updateUVs();
199188
},
200189

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+
201201
/**
202-
* Updates the internal WebGL UV cache.
202+
* Updates the internal WebGL UV cache and the drawImage cache.
203203
*
204204
* @method updateUVs
205205
* @private
206206
*/
207207
updateUVs: function ()
208208
{
209+
// Canvas data
210+
211+
var cd = this.data.drawImage;
212+
213+
cd.sWidth = this.cutWidth;
214+
cd.sHeight = this.cutHeight;
215+
cd.dWidth = this.cutWidth;
216+
cd.dHeight = this.cutHeight;
217+
218+
// WebGL data
219+
209220
var tw = this.source.width;
210221
var th = this.source.height;
211222
var uvs = this.data.uvs;

0 commit comments

Comments
 (0)