Merge pull request #898 from houqp/houqp-master

fix(ui): hide button framecontainer background in hide() method
This commit is contained in:
Huang Xin
2014-09-14 12:10:57 +08:00
2 changed files with 9 additions and 5 deletions

View File

@@ -50,7 +50,7 @@ function Button:init()
self.width = widget_size.w
end
-- set FrameContainer content
self[1] = FrameContainer:new{
self.frame = FrameContainer:new{
margin = self.margin,
bordersize = self.bordersize,
background = self.background,
@@ -65,11 +65,12 @@ function Button:init()
}
}
if self.preselect then
self[1].color = 15
self.frame.color = 15
else
self[1].color = 5
self.frame.color = 5
end
self.dimen = self[1]:getSize()
self.dimen = self.frame:getSize()
self[1] = self.frame
if Device:isTouchDevice() then
self.ges_events = {
TapSelect = {
@@ -128,6 +129,8 @@ end
function Button:hide()
if self.icon then
self.frame.orig_background = self[1].background
self.frame.background = nil
self.label_widget.hide = true
end
end
@@ -135,6 +138,7 @@ end
function Button:show()
if self.icon then
self.label_widget.hide = false
self.frame.background = self[1].old_background
end
end

View File

@@ -30,7 +30,7 @@ function FrameContainer:paintTo(bb, x, y)
self.dimen = Geom:new{
x = x, y = y,
w = my_size.w,
h = my_size.h
h = my_size.h
}
local container_width = self.width or my_size.w
local container_height = self.height or my_size.h