restrict highlight in current page area

This should fix #588.

Highlight in multiple pages is too complicated and requires large
code refactoring and will not be considered for now.
This commit is contained in:
chrox
2014-07-02 16:38:09 +08:00
parent c1323fb882
commit 27b15b7020
2 changed files with 37 additions and 0 deletions

View File

@@ -231,6 +231,13 @@ function ReaderHighlight:onHoldPan(arg, ges)
DEBUG("no previous hold position")
return true
end
local page_area = self.view:getScreenPageArea(self.hold_pos.page)
DEBUG("current page area", page_area)
if ges.pos:notIntersectWith(page_area) then
DEBUG("not inside page area")
return true
end
self.holdpan_pos = self.view:screenToPageTransform(ges.pos)
DEBUG("holdpan position in page", self.holdpan_pos)
self.selected_text = self.ui.document:getTextFromPositions(self.hold_pos, self.holdpan_pos)