mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Merge pull request #134 from dabingnn/fix_infiniteloopinLabel
fix infinite loop in label
This commit is contained in:
@@ -81,7 +81,6 @@
|
||||
proto._fragmentText = function (strArr, maxWidth, ctx) {
|
||||
//check the first character
|
||||
|
||||
|
||||
var wrappedWords = [];
|
||||
var text = strArr;
|
||||
var allWidth = ctx.measureText(text).width;
|
||||
@@ -90,7 +89,7 @@
|
||||
var fuzzyLen = text.length * ( maxWidth / allWidth ) | 0;
|
||||
var tmpText = text.substr(fuzzyLen);
|
||||
var width = allWidth - ctx.measureText(tmpText).width;
|
||||
var sLine;
|
||||
var sLine = tmpText;
|
||||
var pushNum = 0;
|
||||
|
||||
//Increased while cycle maximum ceiling. default 100 time
|
||||
@@ -154,6 +153,7 @@
|
||||
if(text.length > 0) {
|
||||
wrappedWords.push(text);
|
||||
}
|
||||
|
||||
return wrappedWords;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user