TextWidget: minor optimisations

Also fix possible crash with NumberPickerWidget.
pull/5658/head
poire-z 5 years ago
parent 5541d5f5d3
commit a1247160a1

@ -176,7 +176,7 @@ function NumberPickerWidget:paintWidget()
end
local text_value = Button:new{
text = value,
text = tostring(value),
bordersize = 0,
padding = 0,
text_font_face = self.spinner_face.font,

@ -210,6 +210,7 @@ function TextWidget:setText(text)
if text ~= self.text then
self.text = text
self._updated = false
self:free()
end
end
dbg:guard(TextWidget, "setText",
@ -219,8 +220,11 @@ dbg:guard(TextWidget, "setText",
end)
function TextWidget:setMaxWidth(max_width)
self.max_width = max_width
self._updated = false
if max_width ~= self.max_width then
self.max_width = max_width
self._updated = false
self:free()
end
end
function TextWidget:paintTo(bb, x, y)

Loading…
Cancel
Save