mirror of
https://github.com/koreader/koreader
synced 2024-11-10 01:10:34 +00:00
19ed35e59c
FrameContainer now behaves like other widgets, and no longer re-computes dimensions in paintTo *if you provide a dimen*. Since we do here, for.... reasons I'm not entirely sure still make any sense, make sure we actually compute valid dimensions, instead of an empty rect from Geom:new ;). Fix #11389
26 lines
578 B
Lua
26 lines
578 B
Lua
local TextWidget = require("ui/widget/textwidget")
|
|
local Geom = require("ui/geometry")
|
|
|
|
--[[
|
|
FixedTextWidget
|
|
--]]
|
|
local FixedTextWidget = TextWidget:extend{}
|
|
|
|
function FixedTextWidget:updateSize()
|
|
TextWidget.updateSize(self)
|
|
-- Only difference from TextWidget:
|
|
-- no vertical padding, baseline is height
|
|
self._height = self.face.size
|
|
self._baseline_h = self.face.size
|
|
end
|
|
|
|
function FixedTextWidget:getSize()
|
|
self:updateSize()
|
|
if self._length == 0 then
|
|
return Geom:new()
|
|
end
|
|
return TextWidget.getSize(self)
|
|
end
|
|
|
|
return FixedTextWidget
|