mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
TextWidget: minor optimisations
Also fix possible crash with NumberPickerWidget.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user