mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Merge pull request #410 from chrox/master
add dictionary lookup in crereader
This commit is contained in:
@@ -127,6 +127,25 @@ function CreDocument:getPageCount()
|
||||
return self._document:getPages()
|
||||
end
|
||||
|
||||
function CreDocument:getWordFromPosition(pos)
|
||||
local word_box = self._document:getWordFromPos(pos.x, pos.y)
|
||||
if word_box.word then
|
||||
return {
|
||||
word = word_box.word,
|
||||
page = self._document:getCurrentPage(),
|
||||
sbox = {
|
||||
x = word_box.x0, y = word_box.y0,
|
||||
w = word_box.x1 - word_box.x0,
|
||||
h = word_box.y1 - word_box.y0,
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function CreDocument:getTextFromPositions(doc, pos0, pos1)
|
||||
DEBUG("getTextFromPositions not finished yet")
|
||||
end
|
||||
|
||||
function CreDocument:drawCurrentView(target, x, y, rect, pos)
|
||||
tile_bb = Blitbuffer.new(rect.w, rect.h)
|
||||
self._document:drawCurrentPage(tile_bb)
|
||||
|
||||
@@ -149,6 +149,11 @@ function ReaderView:screenToPageTransform(pos)
|
||||
else
|
||||
return self:getSinglePagePosition(pos)
|
||||
end
|
||||
else
|
||||
pos.page = self.ui.document:getCurrentPage()
|
||||
local last_y = self.ui.document:getCurrentPos()
|
||||
DEBUG("document has no pages at", pos)
|
||||
return pos
|
||||
end
|
||||
end
|
||||
|
||||
@@ -162,6 +167,8 @@ function ReaderView:pageToScreenTransform(page, rect)
|
||||
else
|
||||
return self:getSinglePageRect(rect)
|
||||
end
|
||||
else
|
||||
return rect
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Submodule koreader-base updated: 756cd1ed83...1f45c486f7
Reference in New Issue
Block a user