Size wordbubbles to text

This commit is contained in:
2014-06-15 20:18:09 -07:00
parent 8d45eccd0d
commit a20de3a575

View File

@@ -624,18 +624,19 @@ var moonlightDialog = {
function stringSize(str, font)
{
var widths = [];
var width = 0;
var height = 0;
var f = font || '12px arial';
str.split("\n").forEach(function(x) {
var o = $('<div>' + x + '</div>')
.css({'position': 'absolute', 'float': 'left', 'visibility': 'hidden', 'font': f})
.appendTo($('body'));
widths.push(o.width());
if ( o.width() > width )
width = o.width();
height += 5 + o.height();
o.remove();
}, this);
return [Math.max.call(widths), height];
return [width, height];
}
var EffectSprite = function(game, x, y, key, frame, animation) {