mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 21:53:59 +00:00
Remove dead code in GetBitmapTextSize
This commit is contained in:
parent
773dc8a2b9
commit
21efdc57e7
1 changed files with 0 additions and 71 deletions
|
@ -176,80 +176,9 @@ var GetBitmapTextSize = function (src, round, updateOrigin, out)
|
|||
|
||||
text = wrappedLines.join('\n');
|
||||
|
||||
// Loop through the words array and see if we've got any > maxWidth
|
||||
var prev;
|
||||
var offset = 0;
|
||||
var crs = [];
|
||||
|
||||
for (i = 0; i < words.length; i++)
|
||||
{
|
||||
var entry = words[i];
|
||||
var left = entry.x;
|
||||
var right = entry.x + entry.w;
|
||||
|
||||
if (left === 0)
|
||||
{
|
||||
offset = 0;
|
||||
prev = null;
|
||||
}
|
||||
|
||||
if (prev)
|
||||
{
|
||||
var diff = left - (prev.x + prev.w);
|
||||
|
||||
offset = left - (diff + prev.w);
|
||||
|
||||
prev = null;
|
||||
}
|
||||
|
||||
var checkLeft = left - offset;
|
||||
var checkRight = right - offset;
|
||||
|
||||
if (checkLeft > maxWidth || checkRight > maxWidth)
|
||||
{
|
||||
crs.push(entry.i - 1);
|
||||
|
||||
if (entry.cr)
|
||||
{
|
||||
crs.push(entry.i + entry.word.length);
|
||||
|
||||
offset = 0;
|
||||
prev = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
prev = entry;
|
||||
}
|
||||
}
|
||||
else if (entry.cr)
|
||||
{
|
||||
crs.push(entry.i + entry.word.length);
|
||||
|
||||
offset = 0;
|
||||
prev = null;
|
||||
}
|
||||
}
|
||||
|
||||
var stringInsert = function (str, index, value)
|
||||
{
|
||||
return str.substr(0, index) + value + str.substr(index + 1);
|
||||
};
|
||||
|
||||
for (i = crs.length - 1; i >= 0; i--)
|
||||
{
|
||||
if (crs[i] > -1)
|
||||
{
|
||||
text = stringInsert(text, crs[i], '\n');
|
||||
}
|
||||
}
|
||||
|
||||
out.wrappedText = text;
|
||||
|
||||
textLength = text.length;
|
||||
|
||||
// Recalculated in the next loop
|
||||
words = [];
|
||||
current = null;
|
||||
}
|
||||
|
||||
var charIndex = 0;
|
||||
|
|
Loading…
Reference in a new issue