Skip to content

Commit

Permalink
fix sglabel pool cache issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zilongshanren authored and pandamicro committed Jun 27, 2017
1 parent a6d10e7 commit a77a23b
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cocos2d/core/label/CCSGLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ _ccsg.Label = _ccsg.Node.extend({

_ccsg.Label.pool = new JS.Pool(function (label) {
// return false;
if (!label instanceof _ccsg.Label) {
if (!(label instanceof _ccsg.Label)) {
return false;
}
label._string = "";
Expand Down Expand Up @@ -1366,12 +1366,18 @@ _ccsg.Label.pool.get = function (string, fontHandle, spriteFrame, fontAsset) {
label._position.y = 0;
label.setAnchorPoint(0.5, 0.5);
_ccsg.Node.prototype.setContentSize.call(label, 128, 128);

label._blendFunc.src = cc.macro.SRC_ALPHA;
label._blendFunc.dst = cc.macro.ONE_MINUS_SRC_ALPHA;

label.setFontFileOrFamily(fontHandle, spriteFrame, fontAsset);
label.setString(label._string);
label.setString(string);
label.setHorizontalAlign( cc.TextAlignment.LEFT);
label.setVerticalAlign( cc.VerticalTextAlignment.TOP);
label.setFontSize(40);
label.setOverflow(0);
label.enableWrapText(true);
label.setVisible(true);
label.setLineHeight(40);
label.setOutlined(false);

return label;
}
else {
Expand Down

0 comments on commit a77a23b

Please sign in to comment.