File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments