add customizable tap zones for tap forward/backward and config

pull/396/head
chrox 11 years ago
parent ea91cdb4be
commit 912a8a496b

@ -38,6 +38,15 @@ DSHOWOVERLAP = false
-- default to false
DSHOWHIDDENFILES = false
-- customizable tap zones(rectangles)
-- x: x coordinate of top left corner in proportion of screen width
-- y: y coordinate of top left corner in proportion of screen height
-- w: width of tap zone in proportion of screen width
-- h: height of tap zone in proportion of screen height
DTAP_ZONE_FORWARD = {x = 1/4, y = 0, w = 3/4, h = 1}
DTAP_ZONE_BACKWARD = {x = 0, y = 0, w = 1/4, h = 1}
DTAP_ZONE_CONFIG = {x = 0, y = 11/12, w = 1, h = 1/12}
-- koptreader config defaults
DKOPTREADER_CONFIG_FONT_SIZE = 1.0 -- range from 0.1 to 3.0
DKOPTREADER_CONFIG_TEXT_WRAP = 0 -- 1 = on, 0 = off

@ -29,10 +29,10 @@ function ReaderConfig:initGesListener()
GestureRange:new{
ges = "tap",
range = Geom:new{
x = 0,
y = 11*Screen:getHeight()/12,
w = Screen:getWidth(),
h = Screen:getHeight()/12,
x = Screen:getWidth()*DTAP_ZONE_CONFIG.x,
y = Screen:getHeight()*DTAP_ZONE_CONFIG.y,
w = Screen:getWidth()*DTAP_ZONE_CONFIG.w,
h = Screen:getHeight()*DTAP_ZONE_CONFIG.h,
}
}
}

@ -62,10 +62,10 @@ function ReaderPaging:initGesListener()
GestureRange:new{
ges = "tap",
range = Geom:new{
x = Screen:getWidth()/4,
y = Screen:getHeight()/4,
w = 3*Screen:getWidth()/4,
h = 2*Screen:getHeight()/3,
x = Screen:getWidth()*DTAP_ZONE_FORWARD.x,
y = Screen:getHeight()*DTAP_ZONE_FORWARD.y,
w = Screen:getWidth()*DTAP_ZONE_FORWARD.w,
h = Screen:getHeight()*DTAP_ZONE_FORWARD.h,
}
}
},
@ -73,10 +73,10 @@ function ReaderPaging:initGesListener()
GestureRange:new{
ges = "tap",
range = Geom:new{
x = 0,
y = Screen:getHeight()/4,
w = Screen:getWidth()/4,
h = 2*Screen:getHeight()/3,
x = Screen:getWidth()*DTAP_ZONE_BACKWARD.x,
y = Screen:getHeight()*DTAP_ZONE_BACKWARD.y,
w = Screen:getWidth()*DTAP_ZONE_BACKWARD.w,
h = Screen:getHeight()*DTAP_ZONE_BACKWARD.h,
}
}
},

@ -81,10 +81,10 @@ function ReaderRolling:initGesListener()
GestureRange:new{
ges = "tap",
range = Geom:new{
x = Screen:getWidth()/4,
y = Screen:getHeight()/4,
w = 3*Screen:getWidth()/4,
h = 5*Screen:getHeight()/8,
x = Screen:getWidth()*DTAP_ZONE_FORWARD.x,
y = Screen:getHeight()*DTAP_ZONE_FORWARD.y,
w = Screen:getWidth()*DTAP_ZONE_FORWARD.w,
h = Screen:getHeight()*DTAP_ZONE_FORWARD.h,
}
}
},
@ -92,10 +92,10 @@ function ReaderRolling:initGesListener()
GestureRange:new{
ges = "tap",
range = Geom:new{
x = 0,
y = Screen:getHeight()/4,
w = Screen:getWidth()/4,
h = 5*Screen:getHeight()/8,
x = Screen:getWidth()*DTAP_ZONE_BACKWARD.x,
y = Screen:getHeight()*DTAP_ZONE_BACKWARD.y,
w = Screen:getWidth()*DTAP_ZONE_BACKWARD.w,
h = Screen:getHeight()*DTAP_ZONE_BACKWARD.h,
}
}
},

@ -138,18 +138,27 @@ function ReaderUI:init()
ui = self
}
table.insert(self.active_widgets, reader_ss)
-- frontlight controller
if Device:getFrontlight() then
-- frontlight controller
table.insert(self, ReaderFrontLight:new{
dialog = self.dialog,
view = self[1],
ui = self
})
end
-- config panel controller
if self.document.info.configurable then
local config_dialog = ReaderConfig:new{
configurable = self.document.configurable,
options = self.document.options,
dialog = self.dialog,
view = self[1],
ui = self
}
table.insert(self, config_dialog)
end
-- for page specific controller
if self.document.info.has_pages then
-- for page specific controller
-- if needed, insert a paging container
local pager = ReaderPaging:new{
dialog = self.dialog,
@ -225,15 +234,6 @@ function ReaderUI:init()
})
end
if self.document.info.configurable then
-- configurable controller
local config_dialog = ReaderConfig:new{
configurable = self.document.configurable,
options = self.document.options,
dialog = self.dialog,
view = self[1],
ui = self
}
table.insert(self, config_dialog)
-- kopt option controller
local koptlistener = ReaderKoptListener:new{
dialog = self.dialog,

Loading…
Cancel
Save