expand/collapse TOC only by tap on the icon

pull/1019/head
chrox 10 years ago
parent 0a863f07c7
commit 2ad63fc1a3

@ -244,12 +244,14 @@ function ReaderToc:onShowToc()
-- update collapsible state -- update collapsible state
self.expand_button = Button:new{ self.expand_button = Button:new{
icon = "resources/icons/appbar.control.expand.png", icon = "resources/icons/appbar.control.expand.png",
width = Screen:scaleByDPI(30),
bordersize = 0, bordersize = 0,
show_parent = self, show_parent = self,
} }
self.collapse_button = Button:new{ self.collapse_button = Button:new{
icon = "resources/icons/appbar.control.collapse.png", icon = "resources/icons/appbar.control.collapse.png",
width = Screen:scaleByDPI(30),
bordersize = 0, bordersize = 0,
show_parent = self, show_parent = self,
} }

@ -72,14 +72,14 @@ function Button:init()
self[1] = self.frame self[1] = self.frame
if Device:isTouchDevice() then if Device:isTouchDevice() then
self.ges_events = { self.ges_events = {
TapSelect = { TapSelectButton = {
GestureRange:new{ GestureRange:new{
ges = "tap", ges = "tap",
range = self.dimen, range = self.dimen,
}, },
doc = "Tap Button", doc = "Tap Button",
}, },
HoldSelect = { HoldSelectButton = {
GestureRange:new{ GestureRange:new{
ges = "hold", ges = "hold",
range = self.dimen, range = self.dimen,
@ -149,7 +149,7 @@ function Button:showHide(show)
end end
end end
function Button:onTapSelect() function Button:onTapSelectButton()
if self.enabled and self.callback then if self.enabled and self.callback then
self[1].invert = true self[1].invert = true
UIManager:setDirty(self.show_parent, "partial") UIManager:setDirty(self.show_parent, "partial")
@ -162,7 +162,7 @@ function Button:onTapSelect()
return true return true
end end
function Button:onHoldSelect() function Button:onHoldSelectButton()
if self.enabled and self.hold_callback then if self.enabled and self.hold_callback then
self.hold_callback() self.hold_callback()
end end

Loading…
Cancel
Save