2
0
mirror of https://github.com/koreader/koreader synced 2024-10-31 21:20:20 +00:00

Merge pull request #594 from kai771/overlap_fix

Overlap on/off improvement
This commit is contained in:
Tigran Aivazian 2012-11-16 10:10:17 -08:00
commit b681967243

View File

@ -1466,7 +1466,6 @@ function UniReader:show(no)
fb.bb:dimRect(0,self.dest_y + height - self.show_overlap, width, self.show_overlap) fb.bb:dimRect(0,self.dest_y + height - self.show_overlap, width, self.show_overlap)
end end
end end
self.show_overlap = 0
-- render highlights to page -- render highlights to page
if self.highlight[no] then if self.highlight[no] then
@ -1848,6 +1847,7 @@ function UniReader:setglobalzoom_mode(newzoommode)
if self.globalzoom_mode ~= newzoommode then if self.globalzoom_mode ~= newzoommode then
self.last_globalzoom_mode = nil self.last_globalzoom_mode = nil
self.globalzoom_mode = newzoommode self.globalzoom_mode = newzoommode
self.show_overlap = 0
self:redrawCurrentPage() self:redrawCurrentPage()
end end
end end
@ -2484,6 +2484,7 @@ function UniReader:inputLoop()
self.toc_xview = nil self.toc_xview = nil
self.toc_cview = nil self.toc_cview = nil
self.toc_curidx_to_x = nil self.toc_curidx_to_x = nil
self.show_overlap = 0
self:setDefaults() self:setDefaults()
if self.doc ~= nil then if self.doc ~= nil then
self.doc:close() self.doc:close()
@ -2543,6 +2544,7 @@ function UniReader:gotoPrevNextTocEntry(direction)
end end
local toc_entry = self.toc[k + direction] local toc_entry = self.toc[k + direction]
if toc_entry then if toc_entry then
self.show_overlap = 0
return self:goto(toc_entry.page, true) return self:goto(toc_entry.page, true)
end end
break break
@ -2551,11 +2553,14 @@ function UniReader:gotoPrevNextTocEntry(direction)
if not found_curr_toc then if not found_curr_toc then
if direction == 1 and self.pageno ~= numpages then if direction == 1 and self.pageno ~= numpages then
self.show_overlap = 0
return self:goto(numpages, true) return self:goto(numpages, true)
elseif direction == -1 then elseif direction == -1 then
if self.pageno == numpages then if self.pageno == numpages then
self.show_overlap = 0
return self:goto(last_toc_page, true) return self:goto(last_toc_page, true)
else else
self.show_overlap = 0
return self:goto(penul_toc_page, true) return self:goto(penul_toc_page, true)
end end
end end
@ -2628,6 +2633,7 @@ function UniReader:addAllCommands()
end end
if prev_jump_no >= 1 then if prev_jump_no >= 1 then
unireader.show_overlap = 0
unireader.jump_history.cur = prev_jump_no unireader.jump_history.cur = prev_jump_no
unireader:goto(unireader.jump_history[prev_jump_no].page, true) unireader:goto(unireader.jump_history[prev_jump_no].page, true)
else else
@ -2639,6 +2645,7 @@ function UniReader:addAllCommands()
function(unireader) function(unireader)
local next_jump_no = unireader.jump_history.cur + 1 local next_jump_no = unireader.jump_history.cur + 1
if next_jump_no <= #self.jump_history then if next_jump_no <= #self.jump_history then
unireader.show_overlap = 0
unireader.jump_history.cur = next_jump_no unireader.jump_history.cur = next_jump_no
unireader:goto(unireader.jump_history[next_jump_no].page, true) unireader:goto(unireader.jump_history[next_jump_no].page, true)
-- set new head if we reached the top of backward stack -- set new head if we reached the top of backward stack
@ -2793,7 +2800,10 @@ function UniReader:addAllCommands()
else else
bm = self:nextBookMarkedPage() bm = self:nextBookMarkedPage()
end end
if bm then self:goto(bm.page, true) end if bm then
self.show_overlap = 0
self:goto(bm.page, true)
end
end) end)
self.commands:add(KEY_B,MOD_SHIFT,"B", self.commands:add(KEY_B,MOD_SHIFT,"B",
"show jump history", "show jump history",
@ -2835,7 +2845,6 @@ function UniReader:addAllCommands()
"toggle showing page overlap areas", "toggle showing page overlap areas",
function(unireader) function(unireader)
unireader.show_overlap_enable = not unireader.show_overlap_enable unireader.show_overlap_enable = not unireader.show_overlap_enable
InfoMessage:inform("Turning overlap "..(unireader.show_overlap_enable and "on " or "off "), DINFO_DELAY, 1, MSG_AUX)
self.settings:saveSetting("show_overlap_enable", unireader.show_overlap_enable) self.settings:saveSetting("show_overlap_enable", unireader.show_overlap_enable)
self:redrawCurrentPage() self:redrawCurrentPage()
end) end)