synchronize hightlights in non-/reflowing modes

and there is no need to OCR word if we can extract text from
original page in reflowing mode thanks to the rect maps between
normal page and reflowed page.
This commit is contained in:
chrox
2013-10-12 23:07:13 +08:00
parent 2f61b96748
commit 4660a3532b
7 changed files with 599 additions and 395 deletions

View File

@@ -331,12 +331,16 @@ function ReaderView:drawSavedHighlight(bb, x, y)
local items = self.highlight.saved[page]
if not items then items = {} end
for i = 1, #items do
for j = 1, #items[i].boxes do
local rect = self:pageToScreenTransform(page, items[i].boxes[j])
if rect then
self:drawHighlightRect(bb, x, y, rect, self.highlight.saved_drawer)
end
end -- end for each box
local pos0, pos1 = items[i].pos0, items[i].pos1
local boxes = self.ui.document:getPageBoxesFromPositions(page, pos0, pos1)
if boxes then
for _, box in pairs(boxes) do
local rect = self:pageToScreenTransform(page, box)
if rect then
self:drawHighlightRect(bb, x, y, rect, self.highlight.saved_drawer)
end
end -- end for each box
end -- end if boxes
end -- end for each hightlight
end -- end for each page
end