Skip to content

Commit 2bc0703

Browse files
committed
Fixed a bug of cc.LabelTTF that its enableShadow doesn't work.
1 parent d47f061 commit 2bc0703

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cocos2d/core/labelttf/CCLabelTTFCanvasRenderCmd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ cc.LabelTTF._firsrEnglish = /^[a-zA-Z0-9ÄÖÜäöüßéèçàùêâîôû]/;
413413
locShadowColor = node._shadowColor || this._displayedColor;
414414
var locStrokeColor = node._strokeColor, locFontFillColor = node._textFillColor;
415415

416-
this._shadowColorStr = "rgba(" + (0 | (locShadowColor.r * 0.5)) + "," + (0 | (locShadowColor.g * 0.5)) + "," + (0 | (locShadowColor.b * 0.5)) + "," + node._shadowOpacity + ")";
416+
this._shadowColorStr = "rgba(" + (0 | (locShadowColor.r)) + "," + (0 | (locShadowColor.g)) + "," + (0 | (locShadowColor.b)) + "," + node._shadowOpacity + ")";
417417
this._fillColorStr = "rgba(" + (0 | (locDisplayColor.r / 255 * locFontFillColor.r)) + "," + (0 | (locDisplayColor.g / 255 * locFontFillColor.g)) + ","
418418
+ (0 | (locDisplayColor.b / 255 * locFontFillColor.b)) + ", 1)"; //use globalOpacity + locDisplayedOpacity / 255 + ")";
419419
this._strokeColorStr = "rgba(" + (0 | (locDisplayColor.r / 255 * locStrokeColor.r)) + "," + (0 | (locDisplayColor.g / 255 * locStrokeColor.g)) + ","

cocos2d/core/labelttf/CCLabelTTFWebGLRenderCmd.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737
proto._setColorsString = function () {
3838
this.setDirtyFlag(cc.Node._dirtyFlags.textDirty);
3939
var node = this._node;
40-
var locStrokeColor = node._strokeColor, locFontFillColor = node._textFillColor;
41-
this._shadowColorStr = "rgba(128,128,128," + node._shadowOpacity + ")";
40+
var locStrokeColor = node._strokeColor, locFontFillColor = node._textFillColor,
41+
locShadowColor = node._shadowColor || this._displayedColor;
42+
this._shadowColorStr = "rgba(" + (0 | locShadowColor.r) + "," + (0 | locShadowColor.g) + "," + (0 | locShadowColor.b) + "," + node._shadowOpacity + ")";
4243
this._fillColorStr = "rgba(" + (0 | locFontFillColor.r) + "," + (0 | locFontFillColor.g) + "," + (0 | locFontFillColor.b) + ", 1)";
4344
this._strokeColorStr = "rgba(" + (0 | locStrokeColor.r) + "," + (0 | locStrokeColor.g) + "," + (0 | locStrokeColor.b) + ", 1)";
4445
};

0 commit comments

Comments
 (0)