mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
cre.getWordFromPosition(): fix a few issues
Drop the use of crengine's getWordFromPosition() which is a bit unreliable: it may returns wrong coordinates, or words from far away in the book (ie. when holding in the margins). Rely only on the robust getTextFromPositions() that we already use for multi words selection. Having good coordinates allows refreshing a smaller region (the higlighted word, or the 2 lines if hyphenated).
This commit is contained in:
@@ -760,10 +760,10 @@ function ReaderHighlight:onHold(arg, ges)
|
||||
table.insert(boxes, self.selected_word.sbox)
|
||||
self.view.highlight.temp[self.hold_pos.page] = boxes
|
||||
end
|
||||
UIManager:setDirty(self.dialog, "ui")
|
||||
--- @todo only mark word?
|
||||
-- Unfortunately, CREngine does not return good coordinates
|
||||
-- UIManager:setDirty(self.dialog, "partial", self.selected_word.sbox)
|
||||
-- UIManager:setDirty(self.dialog, "ui")
|
||||
-- But now it does:
|
||||
UIManager:setDirty(self.dialog, "ui", self.selected_word.sbox)
|
||||
self:_resetHoldTimer()
|
||||
if word.pos0 then
|
||||
-- Remember original highlight start position, so we can show
|
||||
|
||||
Reference in New Issue
Block a user