From 5b6e9a8e03bfab2fcad72c613b544d7f6ef53b55 Mon Sep 17 00:00:00 2001 From: chrox Date: Tue, 30 Apr 2013 13:51:10 +0800 Subject: [PATCH] OCR is almost stable, so enable it now --- frontend/ui/reader/readerhighlight.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/ui/reader/readerhighlight.lua b/frontend/ui/reader/readerhighlight.lua index 9a068c025..b108b68a6 100644 --- a/frontend/ui/reader/readerhighlight.lua +++ b/frontend/ui/reader/readerhighlight.lua @@ -68,6 +68,10 @@ function ReaderHighlight:onHold(arg, ges) local screen_rect = self.view:pageToScreenTransform(self.pos.page, self.word_info.box) DEBUG("highlight word rect", screen_rect) if screen_rect then + screen_rect.x = screen_rect.x - screen_rect.h * 0.2 + screen_rect.y = screen_rect.y - screen_rect.h * 0.2 + screen_rect.w = screen_rect.w + screen_rect.h * 0.4 + screen_rect.h = screen_rect.h + screen_rect.h * 0.4 self.view.highlight.rect = screen_rect UIManager:setDirty(self.dialog, "partial") -- if we extracted text directly @@ -77,11 +81,11 @@ function ReaderHighlight:onHold(arg, ges) else UIManager:scheduleIn(0.1, function() local word_box = self.word_info.box - word_box.x = word_box.x - math.floor(word_box.h * 0.1) - word_box.y = word_box.y - math.floor(word_box.h * 0.1) - word_box.w = word_box.w + math.floor(word_box.h * 0.2) - word_box.h = word_box.h + math.floor(word_box.h * 0.2) - --local word = self.ui.document:getOCRWord(self.pos.page, word_box) + word_box.x = word_box.x - math.floor(word_box.h * 0.2) + word_box.y = word_box.y - math.floor(word_box.h * 0.4) + word_box.w = word_box.w + math.floor(word_box.h * 0.4) + word_box.h = word_box.h + math.floor(word_box.h * 0.6) + local word = self.ui.document:getOCRWord(self.pos.page, word_box) DEBUG("OCRed word:", word) self.ui:handleEvent(Event:new("LookupWord", word)) end)