mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 16:52:43 +08:00
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user