feat(inputcontainer): support showing inputcontainer without content

pull/1783/head
Qingping Hou 8 years ago
parent 0e8eb3320c
commit 68ead0c9b2

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

Loading…
Cancel
Save