From 8d2a9fd0430cf2f60771d11b9ed90d3106cc6185 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Sun, 25 Jun 2017 10:34:44 +0100 Subject: [PATCH 1/5] Fix a couple of typos in require calls --- v3/src/utils/array/matrix/Rotate180.js | 2 +- v3/src/utils/array/matrix/RotateLeft.js | 2 +- v3/src/utils/array/matrix/RotateRight.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/v3/src/utils/array/matrix/Rotate180.js b/v3/src/utils/array/matrix/Rotate180.js index 4428dc751..21b154d2a 100644 --- a/v3/src/utils/array/matrix/Rotate180.js +++ b/v3/src/utils/array/matrix/Rotate180.js @@ -1,4 +1,4 @@ -var RotateMatrix = require('./RotateMatrix)'; +var RotateMatrix = require('./RotateMatrix'); var Rotate180 = function (matrix) { diff --git a/v3/src/utils/array/matrix/RotateLeft.js b/v3/src/utils/array/matrix/RotateLeft.js index 631afd373..408fad349 100644 --- a/v3/src/utils/array/matrix/RotateLeft.js +++ b/v3/src/utils/array/matrix/RotateLeft.js @@ -1,4 +1,4 @@ -var RotateMatrix = require('./RotateMatrix)'; +var RotateMatrix = require('./RotateMatrix'); var RotateLeft = function (matrix) { diff --git a/v3/src/utils/array/matrix/RotateRight.js b/v3/src/utils/array/matrix/RotateRight.js index d687fd462..90ed2e878 100644 --- a/v3/src/utils/array/matrix/RotateRight.js +++ b/v3/src/utils/array/matrix/RotateRight.js @@ -1,4 +1,4 @@ -var RotateMatrix = require('./RotateMatrix)'; +var RotateMatrix = require('./RotateMatrix'); var RotateRight = function (matrix) { From 6deffce1566a4ce09582d7293cccd47387a30aff Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Sun, 25 Jun 2017 10:38:12 +0100 Subject: [PATCH 2/5] Move a couple of _this = this binds to before their first uses --- v3/src/loader/filetypes/HTMLFile.js | 3 +-- v3/src/loader/filetypes/SVGFile.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/v3/src/loader/filetypes/HTMLFile.js b/v3/src/loader/filetypes/HTMLFile.js index f5d040d71..a73e763ae 100644 --- a/v3/src/loader/filetypes/HTMLFile.js +++ b/v3/src/loader/filetypes/HTMLFile.js @@ -51,6 +51,7 @@ HTMLFile.prototype.onProcess = function (callback) data.push(''); var svg = [ data.join('\n') ]; + var _this = this; try { @@ -69,8 +70,6 @@ HTMLFile.prototype.onProcess = function (callback) this.data.crossOrigin = this.crossOrigin; - var _this = this; - this.data.onload = function () { URL.revokeObjectURL(_this.data.src); diff --git a/v3/src/loader/filetypes/SVGFile.js b/v3/src/loader/filetypes/SVGFile.js index a4fb23d8e..63934c122 100644 --- a/v3/src/loader/filetypes/SVGFile.js +++ b/v3/src/loader/filetypes/SVGFile.js @@ -31,6 +31,7 @@ SVGFile.prototype.onProcess = function (callback) this.state = CONST.FILE_PROCESSING; var svg = [ this.xhrLoader.responseText ]; + var _this = this; try { @@ -49,7 +50,6 @@ SVGFile.prototype.onProcess = function (callback) this.data.crossOrigin = this.crossOrigin; - var _this = this; var retry = false; this.data.onload = function () From 7167120d013f3798e9b24d0dcd433ca885f0a1b9 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Mon, 26 Jun 2017 19:12:46 +0100 Subject: [PATCH 3/5] Remove a couple of duplicate variable assignments --- .../renderer/webgl/renderers/effectrenderer/EffectRenderer.js | 1 - v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js | 2 -- 2 files changed, 3 deletions(-) diff --git a/v3/src/renderer/webgl/renderers/effectrenderer/EffectRenderer.js b/v3/src/renderer/webgl/renderers/effectrenderer/EffectRenderer.js index 3a5e4213e..9a257d753 100644 --- a/v3/src/renderer/webgl/renderers/effectrenderer/EffectRenderer.js +++ b/v3/src/renderer/webgl/renderers/effectrenderer/EffectRenderer.js @@ -167,7 +167,6 @@ EffectRenderer.prototype = { renderEffect: function (gameObject, camera, texture, textureWidth, textureHeight) { var tempMatrix = this.tempMatrix; - var alpha = 16777216; var vertexDataBuffer = this.vertexDataBuffer; var vertexBufferObjectF32 = vertexDataBuffer.floatView; var vertexBufferObjectU32 = vertexDataBuffer.uintView; diff --git a/v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js b/v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js index a5b211dbd..a17cc3c1a 100644 --- a/v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js +++ b/v3/src/renderer/webgl/renderers/spritebatch/SpriteBatch.js @@ -435,7 +435,6 @@ SpriteBatch.prototype = { addSpriteTexture: function (gameObject, camera, texture, textureWidth, textureHeight) { var tempMatrix = this.tempMatrix; - var alpha = 16777216; var vertexDataBuffer = this.vertexDataBuffer; var vertexBufferObjectF32 = vertexDataBuffer.floatView; var vertexBufferObjectU32 = vertexDataBuffer.uintView; @@ -528,7 +527,6 @@ SpriteBatch.prototype = { { var tempMatrix = this.tempMatrix; var frame = gameObject.frame; - var alpha = 16777216; var forceFlipY = (frame.texture.source[frame.sourceIndex].glTexture.isRenderTexture ? true : false); var flipX = gameObject.flipX; var flipY = gameObject.flipY ^ forceFlipY; From 8c50c091bbb8ada1daee78eaa97fe085605f3b7d Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Mon, 26 Jun 2017 19:29:18 +0100 Subject: [PATCH 4/5] Change whitespace to more clearly indicate operator precedence --- v3/src/math/random-data-generator/RandomDataGenerator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v3/src/math/random-data-generator/RandomDataGenerator.js b/v3/src/math/random-data-generator/RandomDataGenerator.js index 15a737aad..d4ce5203b 100644 --- a/v3/src/math/random-data-generator/RandomDataGenerator.js +++ b/v3/src/math/random-data-generator/RandomDataGenerator.js @@ -234,7 +234,7 @@ RandomDataGenerator.prototype = { var a = ''; var b = ''; - for (b = a = ''; a++ < 36; b +=~a % 5 | a * 3&4 ? (a^15 ? 8^this.frac() * (a^20 ? 16 : 4) : 4).toString(16) : '-') + for (b = a = ''; a++ < 36; b +=~a % 5 | a*3 & 4 ? (a^15 ? 8 ^ this.frac()*(a^20 ? 16 : 4) : 4).toString(16) : '-') { } From 58751d5f353d2fa8cd5f21f3a73d83d12937b963 Mon Sep 17 00:00:00 2001 From: Alex Ford Date: Mon, 26 Jun 2017 19:33:39 +0100 Subject: [PATCH 5/5] Fix two cases where numbers seem to be accidentally not truncated --- v3/src/gameobjects/mesh/Mesh.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v3/src/gameobjects/mesh/Mesh.js b/v3/src/gameobjects/mesh/Mesh.js index 23355801d..cf0c265ed 100644 --- a/v3/src/gameobjects/mesh/Mesh.js +++ b/v3/src/gameobjects/mesh/Mesh.js @@ -40,12 +40,12 @@ var Mesh = new Class({ throw new Error('Phaser: Vertex count must match UV count'); } - if (colors.length > 0 && colors.length < (vertices.length / 2)|0) + if (colors.length > 0 && colors.length < ((vertices.length / 2)|0)) { throw new Error('Phaser: Color count must match Vertex count'); } - if (alphas.length > 0 && alphas.length < (vertices.length / 2)|0) + if (alphas.length > 0 && alphas.length < ((vertices.length / 2)|0)) { throw new Error('Phaser: Alpha count must match Vertex count'); }