mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
CenterContainer: options to handle larger content (#8277)
This commit is contained in:
@@ -8,11 +8,19 @@ local CenterContainer = WidgetContainer:new()
|
||||
|
||||
function CenterContainer:paintTo(bb, x, y)
|
||||
local content_size = self[1]:getSize()
|
||||
--- @fixme
|
||||
-- if content_size.w > self.dimen.w or content_size.h > self.dimen.h then
|
||||
-- throw error? paint to scrap buffer and blit partially?
|
||||
-- for now, we ignore this
|
||||
-- end
|
||||
|
||||
-- check if content is bigger than container
|
||||
if self.ignore_if_over == "height" then -- align upper borders
|
||||
if self.dimen.h < content_size.h then
|
||||
self.ignore = "height"
|
||||
end
|
||||
end
|
||||
if self.ignore_if_over == "width" then -- align left borders
|
||||
if self.dimen.w < content_size.w then
|
||||
self.ignore = "width"
|
||||
end
|
||||
end
|
||||
|
||||
local x_pos = x
|
||||
local y_pos = y
|
||||
if self.ignore ~= "height" then
|
||||
|
||||
@@ -462,6 +462,7 @@ function InputDialog:init()
|
||||
w = self.screen_width,
|
||||
h = self.screen_height - keyboard_height,
|
||||
},
|
||||
ignore_if_over = "height",
|
||||
frame
|
||||
}
|
||||
if Device:isTouchDevice() then -- is used to hide the keyboard with a tap outside of inputbox
|
||||
|
||||
@@ -159,8 +159,9 @@ function KeyboardLayoutDialog:init()
|
||||
self[1] = CenterContainer:new{
|
||||
dimen = Geom:new{
|
||||
w = Screen:getWidth(),
|
||||
h = math.max(Screen:getHeight(), self.dialog_frame:getSize().h),
|
||||
h = Screen:getHeight(),
|
||||
},
|
||||
ignore_if_over = "height",
|
||||
self.movable,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -123,9 +123,9 @@ function MultiInputDialog:init()
|
||||
self[1] = CenterContainer:new{
|
||||
dimen = Geom:new{
|
||||
w = Screen:getWidth(),
|
||||
h = math.max(Screen:getHeight() - self._input_widget:getKeyboardDimen().h,
|
||||
self.dialog_frame:getSize().h),
|
||||
h = Screen:getHeight() - self._input_widget:getKeyboardDimen().h,
|
||||
},
|
||||
ignore_if_over = "height",
|
||||
self.dialog_frame,
|
||||
}
|
||||
UIManager:setDirty(self, "ui")
|
||||
|
||||
Reference in New Issue
Block a user