From ef5f464149f262c713e4d20184bd0acda2e9d5dc Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 28 Mar 2017 18:34:22 +0800 Subject: [PATCH 1/4] Fix ClippingNode warning of enabling unused attrib --- cocos2d/core/CCDrawingPrimitivesWebGL.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cocos2d/core/CCDrawingPrimitivesWebGL.js b/cocos2d/core/CCDrawingPrimitivesWebGL.js index eca726063a..44215e2233 100644 --- a/cocos2d/core/CCDrawingPrimitivesWebGL.js +++ b/cocos2d/core/CCDrawingPrimitivesWebGL.js @@ -85,7 +85,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL# var glContext = this._renderContext; this._shader.use(); this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); - glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_FLAG_POSITION); + glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation, this._colorArray); this._shader.setUniformLocationWith1f(this._pointSizeLocation, this._pointSize); @@ -114,7 +114,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL# var glContext = this._renderContext; this._shader.use(); this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); - glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_FLAG_POSITION); + glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation, this._colorArray); this._shader.setUniformLocationWith1f(this._pointSizeLocation, this._pointSize); @@ -149,7 +149,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL# var glContext = this._renderContext; this._shader.use(); this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); - glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_FLAG_POSITION); + glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation, this._colorArray); var pointBuffer = glContext.createBuffer(); @@ -204,7 +204,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL# var glContext = this._renderContext; this._shader.use(); this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); - glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_FLAG_POSITION); + glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation, this._colorArray); var pointBuffer = glContext.createBuffer(); @@ -235,7 +235,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL# var glContext = this._renderContext; this._shader.use(); this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); - glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_FLAG_POSITION); + glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation, this._colorArray); var pointBuffer = glContext.createBuffer(); @@ -283,7 +283,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL# var glContext = this._renderContext; this._shader.use(); this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); - glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_FLAG_POSITION); + glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation, this._colorArray); var pointBuffer = glContext.createBuffer(); @@ -321,7 +321,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL# var glContext = this._renderContext; this._shader.use(); this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); - glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_FLAG_POSITION); + glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation, this._colorArray); var pointBuffer = glContext.createBuffer(); @@ -360,7 +360,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL# var glContext = this._renderContext; this._shader.use(); this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); - glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_FLAG_POSITION); + glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation, this._colorArray); var pointBuffer = glContext.createBuffer(); @@ -420,7 +420,7 @@ cc.DrawingPrimitiveWebGL = cc._Class.extend(/** @lends cc.DrawingPrimitiveWebGL# var glContext = this._renderContext; this._shader.use(); this._shader.setUniformForModelViewAndProjectionMatrixWithMat4(); - glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_FLAG_POSITION); + glContext.enableVertexAttribArray(macro.VERTEX_ATTRIB_POSITION); this._shader.setUniformLocationWith4fv(this._colorLocation, this._colorArray); var pointBuffer = glContext.createBuffer(); From 98add9085d192e28c67d52355afe1c8fa913566e Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 28 Mar 2017 18:35:19 +0800 Subject: [PATCH 2/4] Fix editbox unstrict comparison --- cocos2d/core/editbox/CCSGEditBox.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2d/core/editbox/CCSGEditBox.js b/cocos2d/core/editbox/CCSGEditBox.js index c73bb9cffc..6161f89e42 100644 --- a/cocos2d/core/editbox/CCSGEditBox.js +++ b/cocos2d/core/editbox/CCSGEditBox.js @@ -699,7 +699,7 @@ _ccsg.EditBox.KeyboardReturnType = KeyboardReturnType; } if (editBox._delegate && editBox._delegate.editBoxTextChanged) { - if (editBox._text.toLowerCase() !== this.value.toLowerCase()) { + if (editBox._text !== this.value) { editBox._text = this.value; thisPointer._updateDomTextCases(); editBox._delegate.editBoxTextChanged(editBox, editBox._text); From 695edd47c90b1b574b67c144c8c729529f3c7002 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 28 Mar 2017 18:35:32 +0800 Subject: [PATCH 3/4] Fix cc.loader.getRes issue --- cocos2d/core/load-pipeline/CCLoader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos2d/core/load-pipeline/CCLoader.js b/cocos2d/core/load-pipeline/CCLoader.js index 50b29798b4..03c4d62c1e 100644 --- a/cocos2d/core/load-pipeline/CCLoader.js +++ b/cocos2d/core/load-pipeline/CCLoader.js @@ -496,7 +496,7 @@ JS.mixin(CCLoader.prototype, { */ getRes: function (url, type) { var item = this._cache[url]; - if (!item && type) { + if (!item) { var uuid = this._getResUuid(url, type, true); if (uuid) { var ref = this._getReferenceKey(uuid); From 8fb2ca7aa7f0474c929f14f36c94ad3efd9dee8a Mon Sep 17 00:00:00 2001 From: pandamicro Date: Wed, 29 Mar 2017 15:49:15 +0800 Subject: [PATCH 4/4] Fix ComponentEventHandler recursive emitEvents issue --- cocos2d/core/components/CCComponentEventHandler.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cocos2d/core/components/CCComponentEventHandler.js b/cocos2d/core/components/CCComponentEventHandler.js index 3f267accec..0b32437f40 100644 --- a/cocos2d/core/components/CCComponentEventHandler.js +++ b/cocos2d/core/components/CCComponentEventHandler.js @@ -23,8 +23,6 @@ THE SOFTWARE. ****************************************************************************/ -var _args = []; - /** * !#en * Component will register a event to target component's handler. @@ -106,17 +104,19 @@ cc.Component.EventHandler = cc.Class({ } } : function(events) { 'use strict'; - _args.length = arguments.length > 0 ? arguments.length - 1 : 0; - for (var i = 0, l = _args.length; i < l; i++) { - _args[i] = arguments[i+1]; + var args, i, l; + if (arguments.length > 0) { + args = new Array(arguments.length - 1); + for (i = 0, l = args.length; i < l; i++) { + args[i] = arguments[i+1]; + } } for (i = 0, l = events.length; i < l; i++) { var event = events[i]; if (!(event instanceof cc.Component.EventHandler)) continue; - event.emit(_args); + event.emit(args); } - _args.length = 0; } },