CenterContainer: options to handle larger content (#8277)

reviewable/pr8263/r3^2
hius07 3 years ago committed by GitHub
parent 4c9d1ac3f8
commit 3fe09ecc01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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")

Loading…
Cancel
Save