mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
feat(inputcontainer): support showing inputcontainer without content
This commit is contained in:
@@ -51,19 +51,21 @@ function InputContainer:_init()
|
||||
end
|
||||
|
||||
function InputContainer:paintTo(bb, x, y)
|
||||
if self[1] == nil then
|
||||
return
|
||||
end
|
||||
|
||||
if not self.dimen then
|
||||
local content_size = self[1]:getSize()
|
||||
self.dimen = Geom:new{w = content_size.w, h = content_size.h}
|
||||
end
|
||||
self.dimen.x = x
|
||||
self.dimen.y = y
|
||||
if self[1] then
|
||||
if self.vertical_align == "center" then
|
||||
local content_size = self[1]:getSize()
|
||||
self[1]:paintTo(bb, x, y + math.floor((self.dimen.h - content_size.h)/2))
|
||||
else
|
||||
self[1]:paintTo(bb, x, y)
|
||||
end
|
||||
if self.vertical_align == "center" then
|
||||
local content_size = self[1]:getSize()
|
||||
self[1]:paintTo(bb, x, y + math.floor((self.dimen.h - content_size.h)/2))
|
||||
else
|
||||
self[1]:paintTo(bb, x, y)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -97,6 +99,10 @@ function InputContainer:onGesture(ev)
|
||||
end
|
||||
|
||||
function InputContainer:onInput(input)
|
||||
if self.enter_callback == nil then
|
||||
return
|
||||
end
|
||||
|
||||
local InputDialog = require("ui/widget/inputdialog")
|
||||
self.input_dialog = InputDialog:new{
|
||||
title = input.title or "",
|
||||
|
||||
Reference in New Issue
Block a user