cre: fix highlights in 2-pages mode (#4753)

Also check for boxes in the 2nd page when in 2 page modes
(and fix onTapXPointerSavedHighlight(), too quickly cut
and pasted from drawXPointerSavedHighlight() recently).
Bump crengine and cre.cpp to correctly returns rect for
the first line of the 2nd page.
This commit is contained in:
poire-z
2019-03-07 22:13:30 +01:00
committed by GitHub
parent 511570f65d
commit 2c98c81a0d
3 changed files with 14 additions and 7 deletions

View File

@@ -495,7 +495,7 @@ function ReaderView:drawXPointerSavedHighlight(bb, x, y)
-- showing menu...). We might want to cache these boxes per page (and
-- clear that cache when page layout change or highlights are added
-- or removed).
local cur_page, cur_scroll_top, cur_scroll_bottom
local cur_page, cur_page2, cur_scroll_top, cur_scroll_bottom
for page, _ in pairs(self.highlight.saved) do
local items = self.highlight.saved[page]
if not items then items = {} end
@@ -508,6 +508,9 @@ function ReaderView:drawXPointerSavedHighlight(bb, x, y)
if self.view_mode == "page" then
if not cur_page then
cur_page = self.ui.document:getPageFromXPointer(self.ui.document:getXPointer())
if self.ui.document:getVisiblePageCount() > 1 then
cur_page2 = cur_page + 1
end
end
local page0 = self.ui.document:getPageFromXPointer(pos0)
local page1 = self.ui.document:getPageFromXPointer(pos1)
@@ -515,6 +518,8 @@ function ReaderView:drawXPointerSavedHighlight(bb, x, y)
local end_page = math.max(page0, page1)
if start_page <= cur_page and end_page >= cur_page then
is_in_view = true
elseif cur_page2 and start_page <= cur_page2 and end_page >= cur_page2 then
is_in_view = true
end
else
if not cur_scroll_top then