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) function CenterContainer:paintTo(bb, x, y)
local content_size = self[1]:getSize() local content_size = self[1]:getSize()
--- @fixme
-- if content_size.w > self.dimen.w or content_size.h > self.dimen.h then -- check if content is bigger than container
-- throw error? paint to scrap buffer and blit partially? if self.ignore_if_over == "height" then -- align upper borders
-- for now, we ignore this if self.dimen.h < content_size.h then
-- end 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 x_pos = x
local y_pos = y local y_pos = y
if self.ignore ~= "height" then if self.ignore ~= "height" then

@ -462,6 +462,7 @@ function InputDialog:init()
w = self.screen_width, w = self.screen_width,
h = self.screen_height - keyboard_height, h = self.screen_height - keyboard_height,
}, },
ignore_if_over = "height",
frame frame
} }
if Device:isTouchDevice() then -- is used to hide the keyboard with a tap outside of inputbox 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{ self[1] = CenterContainer:new{
dimen = Geom:new{ dimen = Geom:new{
w = Screen:getWidth(), w = Screen:getWidth(),
h = math.max(Screen:getHeight(), self.dialog_frame:getSize().h), h = Screen:getHeight(),
}, },
ignore_if_over = "height",
self.movable, self.movable,
} }
end end

@ -123,9 +123,9 @@ function MultiInputDialog:init()
self[1] = CenterContainer:new{ self[1] = CenterContainer:new{
dimen = Geom:new{ dimen = Geom:new{
w = Screen:getWidth(), w = Screen:getWidth(),
h = math.max(Screen:getHeight() - self._input_widget:getKeyboardDimen().h, h = Screen:getHeight() - self._input_widget:getKeyboardDimen().h,
self.dialog_frame:getSize().h),
}, },
ignore_if_over = "height",
self.dialog_frame, self.dialog_frame,
} }
UIManager:setDirty(self, "ui") UIManager:setDirty(self, "ui")

Loading…
Cancel
Save