Skip to content

Commit 9c5e257

Browse files
committed
Added Frame halfWidth and halfHeight properties
1 parent 90e6637 commit 9c5e257

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

v3/src/textures/Frame.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ var Frame = new Class({
6565
*/
6666
this.height = height;
6767

68+
// The half sizes of this frame (to save in constant calculations in the renderer)
69+
this.halfWidth = width * 0.5;
70+
71+
this.halfHeight = height * 0.5;
72+
6873
/**
6974
* @property {number} width - The rendering width of this Frame, taking trim into account.
7075
*/
@@ -173,6 +178,9 @@ var Frame = new Class({
173178
this.width = destWidth;
174179
this.height = destHeight;
175180

181+
this.halfWidth = destWidth * 0.5;
182+
this.halfHeight = destHeight * 0.5;
183+
176184
this.centerX = Math.floor(destWidth / 2);
177185
this.centerY = Math.floor(destHeight / 2);
178186

@@ -250,6 +258,9 @@ var Frame = new Class({
250258
clone.width = this.width;
251259
clone.height = this.height;
252260

261+
clone.halfWidth = this.halfWidth;
262+
clone.halfHeight = this.halfHeight;
263+
253264
clone.centerX = this.centerX;
254265
clone.centerY = this.centerY;
255266

0 commit comments

Comments
 (0)