feat(inputcontainer): support showing inputcontainer without content

This commit is contained in:
Qingping Hou
2016-01-31 14:25:21 -08:00
parent 0e8eb3320c
commit 68ead0c9b2

View File

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