diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 2623bfdcdf..1de85ae2ce 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -558,7 +558,7 @@ var Node = cc.Class({ if (this._rotationX !== value || this._rotationY !== value) { this._rotationX = this._rotationY = value; // Update quaternion from rotation - math.quat.fromEuler(this._quat, 0, 0, this._rotationX); + math.quat.fromEuler(this._quat, 0, 0, -this._rotationX); this._localMatDirty = true; var cache = this._hasListenerCache; @@ -587,7 +587,7 @@ var Node = cc.Class({ this._rotationX = value; // Update quaternion from rotation if (this._rotationX === this._rotationY) { - math.quat.fromEuler(this._quat, 0, 0, this._rotationX); + math.quat.fromEuler(this._quat, 0, 0, -this._rotationX); } else { math.quat.fromEuler(this._quat, this._rotationX, this._rotationY, 0); @@ -620,7 +620,7 @@ var Node = cc.Class({ this._rotationY = value; // Update quaternion from rotation if (this._rotationX === this._rotationY) { - math.quat.fromEuler(this._quat, 0, 0, this._rotationX); + math.quat.fromEuler(this._quat, 0, 0, -this._rotationX); } else { math.quat.fromEuler(this._quat, this._rotationX, this._rotationY, 0); diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js index f617b770ce..9cab544652 100644 --- a/cocos2d/core/components/CCLabel.js +++ b/cocos2d/core/components/CCLabel.js @@ -471,7 +471,10 @@ var Label = cc.Class({ material = new SpriteMaterial(); this._texture = new cc.Texture2D(); this._canvas = document.createElement("canvas"); + // create canvas with size so that the default texture impl can be created and don't need activate material again + this._canvas.width = this._canvas.height = 1; this._texture.initWithElement(this._canvas); + this._texture.handleLoadedTexture(); this._context = this._canvas.getContext("2d"); material.texture = this._texture.getImpl(); diff --git a/cocos2d/core/renderer/assemblers/label/label-assembler.js b/cocos2d/core/renderer/assemblers/label/label-assembler.js index 4d8172b864..afaa4429d9 100644 --- a/cocos2d/core/renderer/assemblers/label/label-assembler.js +++ b/cocos2d/core/renderer/assemblers/label/label-assembler.js @@ -31,28 +31,30 @@ const bmfontAssembler = require('./bmfont-assembler'); var labelAssembler = js.addon({ updateRenderData (comp) { - let assembler; - if (comp.font instanceof cc.BitmapFont) { - assembler = bmfontAssembler; - } - else { - assembler = ttfAssembler; - } - - let renderData = comp._renderData; - if (!renderData) { - renderData = comp._renderData = assembler.createData(comp); - } - - let size = comp.node._contentSize; - let anchor = comp.node._anchorPoint; - renderData.updateSizeNPivot(size.width, size.height, anchor.x, anchor.y); - - assembler.update(comp); - - renderData.effect = comp.getEffect(); this.datas.length = 0; - this.datas.push(renderData); + if (comp.string) { + let assembler; + if (comp.font instanceof cc.BitmapFont) { + assembler = bmfontAssembler; + } + else { + assembler = ttfAssembler; + } + + let renderData = comp._renderData; + if (!renderData) { + renderData = comp._renderData = assembler.createData(comp); + } + + let size = comp.node._contentSize; + let anchor = comp.node._anchorPoint; + renderData.updateSizeNPivot(size.width, size.height, anchor.x, anchor.y); + + assembler.update(comp); + + renderData.effect = comp.getEffect(); + this.datas.push(renderData); + } return this.datas; },