Skip to content

Commit 90f1ec8

Browse files
committed
Merge pull request #1714 from bassarisse/develop
cc.LabelBMFont issues
2 parents 117ec4b + 2ebf9c1 commit 90f1ec8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

cocos2d/label_nodes/CCLabelBMFont.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,8 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
979979
start_line = false;
980980
startOfWord = -1;
981981
startOfLine = -1;
982-
i+= justSkipped;
982+
j--;
983+
skip -= justSkipped;
983984
line++;
984985

985986
if (i >= stringLength)
@@ -1083,6 +1084,11 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
10831084
if (this._string[ctr].charCodeAt(0) == 10 || this._string[ctr].charCodeAt(0) == 0) {
10841085
var lineWidth = 0;
10851086
var line_length = last_line.length;
1087+
// if last line is empty we must just increase lineNumber and work with next line
1088+
if (line_length == 0) {
1089+
lineNumber++;
1090+
continue;
1091+
}
10861092
var index = i + line_length - 1 + lineNumber;
10871093
if (index < 0) continue;
10881094

@@ -1245,11 +1251,11 @@ cc.LabelBMFont = cc.SpriteBatchNode.extend(/** @lends cc.LabelBMFont# */{
12451251
},
12461252

12471253
_getLetterPosXLeft:function (sp) {
1248-
return sp.getPositionX() * this._scaleX + (sp.getContentSize().width * this._scaleX * sp.getAnchorPoint().x);
1254+
return sp.getPositionX() * this._scaleX - (sp.getContentSize().width * this._scaleX * sp.getAnchorPoint().x);
12491255
},
12501256

12511257
_getLetterPosXRight:function (sp) {
1252-
return sp.getPositionX() * this._scaleX - (sp.getContentSize().width * this._scaleX * sp.getAnchorPoint().x);
1258+
return sp.getPositionX() * this._scaleX + (sp.getContentSize().width * this._scaleX * (1 - sp.getAnchorPoint().x));
12531259
}
12541260
});
12551261

0 commit comments

Comments
 (0)