fix bug in TextBoxWidget

shrink box width if text is shorter than one line.
pull/2/merge
Qingping Hou 12 years ago
parent 08e2c7888e
commit 81d733d269

@ -256,15 +256,19 @@ function TextBoxWidget:_render()
local h = (font_height + line_height_px) * #v_list - line_height_px
self._bb = Blitbuffer.new(self.width, h)
local y = font_height
local pen_x = 0
for _,l in ipairs(v_list) do
local pen_x = 0
pen_x = 0
for _,w in ipairs(l) do
renderUtf8Text(self._bb, pen_x, y, self.face, w.word, true)
pen_x = pen_x + w.width + space_w
end
y = y + line_height_px + font_height
end
-- if text is only one line, shrink to text's width
if #v_list == 1 then
self.width = pen_x
end
end
function TextBoxWidget:getSize()

Loading…
Cancel
Save