refactor(readerfooter): optimization and bug fixes

* avoid unnecessary initialization
* really fix the crash caused by autoRefreshTime....
* responsive progress bar layout
This commit is contained in:
Qingping Hou
2016-03-12 00:59:15 -08:00
parent 70fb3f8a6e
commit 1683023f2c
3 changed files with 87 additions and 90 deletions

View File

@@ -23,17 +23,22 @@ function ReaderFlipping:init()
end
function ReaderFlipping:resetLayout()
self[1].dimen.w = Screen:getWidth()
local new_screen_width = Screen:getWidth()
if new_screen_width == self._last_screen_width then return end
local new_screen_height = Screen:getHeight()
self._last_screen_width = new_screen_width
self[1].dimen.w = new_screen_width
if Device:isTouchDevice() then
self.ges_events = {
Tap = {
GestureRange:new{
ges = "tap",
range = Geom:new{
x = Screen:getWidth()*DTAP_ZONE_FLIPPING.x,
y = Screen:getHeight()*DTAP_ZONE_FLIPPING.y,
w = Screen:getWidth()*DTAP_ZONE_FLIPPING.w,
h = Screen:getHeight()*DTAP_ZONE_FLIPPING.h
x = new_screen_width*DTAP_ZONE_FLIPPING.x,
y = new_screen_height*DTAP_ZONE_FLIPPING.y,
w = new_screen_width*DTAP_ZONE_FLIPPING.w,
h = new_screen_height*DTAP_ZONE_FLIPPING.h
}
}
}