fix(ui): hide button framecontainer background in hide() method

pull/898/head
Qingping Hou 10 years ago
parent 8568f77741
commit 5e035c2517

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

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

Loading…
Cancel
Save